Class AbstractProxyMutableResourceList
java.lang.Object
com.refinedmods.refinedstorage.api.resource.list.AbstractProxyMutableResourceList
- All Implemented Interfaces:
MutableResourceList
,ResourceList
- Direct Known Subclasses:
FuzzyResourceListImpl
,ListenableResourceList
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public abstract class AbstractProxyMutableResourceList
extends Object
implements MutableResourceList
This is a utility class to easily decorate a
MutableResourceListImpl
.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.refinedmods.refinedstorage.api.resource.list.MutableResourceList
MutableResourceList.OperationResult
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
-
Method Summary
Modifier and TypeMethodDescriptionadd
(ResourceKey resource, long amount) Adds a given resource to the list.void
clear()
Clears the list.boolean
contains
(ResourceKey resource) copy()
Copies the list.Retrieves all resources and their amounts from the list.long
get
(ResourceKey resource) getAll()
boolean
isEmpty()
remove
(ResourceKey resource, long amount) Removes as much of a certain amount of a resource in the list.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.refinedmods.refinedstorage.api.resource.list.MutableResourceList
add, remove
-
Constructor Details
-
AbstractProxyMutableResourceList
-
-
Method Details
-
add
Description copied from interface:MutableResourceList
Adds a given resource to the list.- Specified by:
add
in interfaceMutableResourceList
- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0- Returns:
- the result of the operation
-
remove
Description copied from interface:MutableResourceList
Removes as much of a certain amount of a resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list.- Specified by:
remove
in interfaceMutableResourceList
- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0- Returns:
- a result if the removal operation was successful, otherwise null
-
copyState
Description copied from interface:ResourceList
Retrieves all resources and their amounts from the list.- Specified by:
copyState
in interfaceResourceList
- Returns:
- a list of resource amounts
-
get
- Specified by:
get
in interfaceResourceList
- Parameters:
resource
- the resource- Returns:
- the amount stored, or zero if not stored
-
contains
- Specified by:
contains
in interfaceResourceList
- Parameters:
resource
- the resource- Returns:
- whether the list contains this resource
-
getAll
- Specified by:
getAll
in interfaceResourceList
- Returns:
- set of resources contained in this list
-
copy
Description copied from interface:MutableResourceList
Copies the list.- Specified by:
copy
in interfaceMutableResourceList
-
clear
public void clear()Description copied from interface:MutableResourceList
Clears the list.- Specified by:
clear
in interfaceMutableResourceList
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceResourceList
- Returns:
- whether the list is empty
-
toString
-