Package com.aquima.interactions.rule
Class InstanceStack
java.lang.Object
com.aquima.interactions.rule.InstanceStack
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SnapshotInstanceStack
This class holds a list of instance that are active. The class provides methods for activating new instances, or
de-activating instances.
- Since:
- 5.0
- Author:
- o.kerpershoek
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs an empty instance stack object.protected
InstanceStack
(InstanceStack other) Constructs an instance stack with all the instances from the provided stack. -
Method Summary
Modifier and TypeMethodDescriptionCreates a duplicate of the instance stack.getActiveInstance
(String entityName, boolean ignoreDeletedInstances) LET OP ! wat te doen wanneer er meerdere instanties van hetzelfde type teruggegeven worden? - Indien deze echt van gelijk type zijn (b.v.getActiveInstances
(boolean ignoreDeletedInstances) This method will return an array containing all the instances that have been activated on the stack.boolean
isEmpty()
This method will return a boolean indicating if the stack is empty.This method will return the instance that was last activated.This method will remove and return the instance that was last activated.void
pushActiveInstance
(IEntityInstance instance) This method adds the given instance to the stack of active instances.toString()
-
Constructor Details
-
InstanceStack
public InstanceStack()Constructs an empty instance stack object. -
InstanceStack
Constructs an instance stack with all the instances from the provided stack.- Parameters:
other
- The instance stack whose content should be copied.
-
-
Method Details
-
duplicate
Creates a duplicate of the instance stack.- Returns:
- A duplicate of the instance stack.
-
getActiveInstance
LET OP ! wat te doen wanneer er meerdere instanties van hetzelfde type teruggegeven worden? - Indien deze echt van gelijk type zijn (b.v. tweemaal persoon) dan is dit incorrect, aangezien Er geen onderscheid gemaakt kan worden tussen beide. - Indien er een parent-child relatie is tussen de typen (persoon, customer) ook fout- Parameters:
entityName
- The type for which the active instance is requested.ignoreDeletedInstances
- Boolean indicating if deleted instances should be skipped.- Returns:
- The instance that was activated with the specified type.
-
pushActiveInstance
This method adds the given instance to the stack of active instances.- Parameters:
instance
- The instance that should be marked active.
-
popActiveInstance
This method will remove and return the instance that was last activated.- Returns:
- The instance that was last activated.
-
peekActiveInstance
This method will return the instance that was last activated.- Returns:
- the instance that was last activated or null if no active instance exists.
-
isEmpty
public boolean isEmpty()This method will return a boolean indicating if the stack is empty.- Returns:
- a boolean indicating if the stack is empty.
-
getActiveInstances
This method will return an array containing all the instances that have been activated on the stack.- Parameters:
ignoreDeletedInstances
- Boolean indicating if deleted instances should be skipped.- Returns:
- an array containing all the instances that have been activated on the stack.
-
toString
-