Class InstanceStack

java.lang.Object
com.aquima.interactions.rule.InstanceStack
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SnapshotInstanceStack

public class InstanceStack extends Object implements Serializable
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 Details

    • InstanceStack

      public InstanceStack()
      Constructs an empty instance stack object.
    • InstanceStack

      protected InstanceStack(InstanceStack other)
      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

      public InstanceStack duplicate()
      Creates a duplicate of the instance stack.
      Returns:
      A duplicate of the instance stack.
    • getActiveInstance

      public IEntityInstance 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. 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

      public void pushActiveInstance(IEntityInstance instance)
      This method adds the given instance to the stack of active instances.
      Parameters:
      instance - The instance that should be marked active.
    • popActiveInstance

      public IEntityInstance popActiveInstance()
      This method will remove and return the instance that was last activated.
      Returns:
      The instance that was last activated.
    • peekActiveInstance

      public IEntityInstance 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

      public IEntityInstance[] getActiveInstances(boolean ignoreDeletedInstances)
      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

      public String toString()
      Overrides:
      toString in class Object