public class MemoryContainer extends java.lang.Object implements Memory
Memory
,
MemoryObject
Constructor and Description |
---|
MemoryContainer()
Creates a MemoryContainer.
|
MemoryContainer(java.lang.String type)
Creates a MemoryContainer.
|
Modifier and Type | Method and Description |
---|---|
int |
add(Memory memory)
Adds a memory to this container.
|
void |
addMemoryObserver(MemoryObserver memoryObserver)
Add a memory observer to its list
|
java.util.ArrayList<Memory> |
getAllMemories()
Gets all the memories inside this container.
|
java.lang.Double |
getEvaluation()
Gets the greatest evaluation of the memories in the memory list.
|
java.lang.Object |
getI()
Gets the info of the memory which has the greatest evaluation.
|
java.lang.Object |
getI(java.util.function.BinaryOperator<Memory> accumulator)
Gets the info of the memory reduced by the binary operator passed.
|
java.lang.Object |
getI(int index)
Gets the info of the memory which has the index passed.
|
java.lang.Object |
getI(java.util.function.Predicate<Memory> predicate)
Gets the info of the memory filtered by the predicate.
|
java.lang.Object |
getI(java.lang.String name)
Gets the info of the memory which has the name passed.
|
Memory |
getInternalMemory(java.lang.String name)
Gets the internal memory which has the name passed.
|
java.lang.String |
getName()
Gets the type of the memory which has the greatest evaluation.
|
java.lang.Long |
getTimestamp()
Get the TimeStamp of the internal Memory which has the greatest evaluation.
|
void |
setEvaluation(java.lang.Double eval)
Sets the evaluation of this memory.
|
void |
setEvaluation(java.lang.Double eval,
int index)
Sets the evaluation of the memory with the index passed inside this
container.
|
int |
setI(java.lang.Object info)
MemoryContainer inserts the info as a new MemoryObject in its Memory list.
|
int |
setI(java.lang.Object info,
java.lang.Double evaluation)
Creates a Memory Object with the info and the evaluation passed.
|
void |
setI(java.lang.Object info,
java.lang.Double evaluation,
int index)
Sets the info and the evaluation of the memory with the index passed inside
this container.
|
int |
setI(java.lang.Object info,
double evaluation,
java.lang.String type)
Sets the info as the info and an evaluation passed to a Memory of the type
passed.
|
void |
setI(java.lang.Object info,
int index)
Sets the info of the Memory with the index passed.
|
void |
setName(java.lang.String name)
Sets the name of the container.
|
void |
setType(java.lang.String name)
Deprecated.
|
public MemoryContainer()
public MemoryContainer(java.lang.String type)
type
- the type of the memories inside the container.@Deprecated public void setType(java.lang.String name)
public void setName(java.lang.String name)
public java.lang.Object getI()
public java.lang.Object getI(int index)
index
- the index of the memory whose info is searched.public java.lang.Object getI(java.lang.String name)
name
- the name of the memory whose info is searched.public java.lang.Object getI(java.util.function.Predicate<Memory> predicate)
predicate
- the predicate to be used to filter the stream.public java.lang.Object getI(java.util.function.BinaryOperator<Memory> accumulator)
accumulator
- the binary operator.public int setI(java.lang.Object info)
public int setI(java.lang.Object info, java.lang.Double evaluation)
info
- the info of the new Memory Object.evaluation
- the evaluation of the new Memory Object.public void setI(java.lang.Object info, int index)
info
- the information to be set in theindex
- the index of the memory inside the container.public void setI(java.lang.Object info, java.lang.Double evaluation, int index)
info
- the information to be set in the.index
- the index of the memory inside this container.evaluation
- the evaluation to be set.public int setI(java.lang.Object info, double evaluation, java.lang.String type)
info
- the info.evaluation
- the evaluation to set.type
- the type of the Memorypublic java.lang.Double getEvaluation()
getEvaluation
in interface Memory
public java.lang.String getName()
public void setEvaluation(java.lang.Double eval)
Memory
setEvaluation
in interface Memory
eval
- the value to be set as evaluation.public void setEvaluation(java.lang.Double eval, int index)
eval
- the evaluation to set.index
- the index of the memory inside this container.public int add(Memory memory)
memory
- the memory to be added in this containerpublic java.util.ArrayList<Memory> getAllMemories()
public Memory getInternalMemory(java.lang.String name)
name
- the name of the memory whose info is searched.public java.lang.Long getTimestamp()
getTimestamp
in interface Memory
public void addMemoryObserver(MemoryObserver memoryObserver)
Memory
addMemoryObserver
in interface Memory
memoryObserver
- MemoryObserver to be added