Class MutableResourceListImpl
java.lang.Object
com.refinedmods.refinedstorage.api.resource.list.MutableResourceListImpl
- All Implemented Interfaces:
MutableResourceList,ResourceList
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public class MutableResourceListImpl
extends Object
implements MutableResourceList
An implementation of a
ResourceList that stores the resource entries in memory.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.refinedmods.refinedstorage.api.resource.list.MutableResourceList
MutableResourceList.OperationResult -
Method Summary
Modifier and TypeMethodDescriptionadd(ResourceKey resource, long amount) Adds a given resource to the list.voidclear()Clears the list.booleancontains(ResourceKey resource) copy()Copies the list.Retrieves all resources and their amounts from the list.static MutableResourceListImplcreate()longget(ResourceKey resource) getAll()booleanisEmpty()static MutableResourceListImplremove(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, waitMethods inherited from interface com.refinedmods.refinedstorage.api.resource.list.MutableResourceList
add, remove
-
Method Details
-
create
-
orderPreserving
-
add
Description copied from interface:MutableResourceListAdds a given resource to the list.- Specified by:
addin 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:MutableResourceListRemoves 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:
removein 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:ResourceListRetrieves all resources and their amounts from the list.- Specified by:
copyStatein interfaceResourceList- Returns:
- a list of resource amounts
-
getAll
- Specified by:
getAllin interfaceResourceList- Returns:
- set of resources contained in this list
-
get
- Specified by:
getin interfaceResourceList- Parameters:
resource- the resource- Returns:
- the amount stored, or zero if not stored
-
contains
- Specified by:
containsin interfaceResourceList- Parameters:
resource- the resource- Returns:
- whether the list contains this resource
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceResourceList- Returns:
- whether the list is empty
-
clear
public void clear()Description copied from interface:MutableResourceListClears the list.- Specified by:
clearin interfaceMutableResourceList
-
copy
Description copied from interface:MutableResourceListCopies the list.- Specified by:
copyin interfaceMutableResourceList
-
toString
-