Class NestedPlan

  • All Implemented Interfaces:
    IPlan, Clonable<IPlan>

    public class NestedPlan
    extends Plan
    Implements the nested plan of a link specification. Note that the subPlans fields is set to null by the instructor. Before adding a subplan for the first time, the subPlans field must be initiated.
    Version:
    1.0
    Author:
    Axel-C. Ngonga Ngomo (ngonga@informatik.uni-leipzig.de), Kleanthi Georgala (georgala@informatik.uni-leipzig.de)
    • Constructor Detail

      • NestedPlan

        public NestedPlan()
        Constructor of the NestedPlan class.
    • Method Detail

      • getSubPlans

        public List<NestedPlan> getSubPlans()
        Returns the set of sub-plans of the current plan.
        Returns:
        the current sub-plans
      • setSubPlans

        public void setSubPlans​(List<NestedPlan> subPlans)
        Sets the sub-plans of the plan.
        Parameters:
        subPlans - The sub-plans to set
      • getOperator

        public Instruction.Command getOperator()
        Returns the operator of the plan.
        Returns:
        the operator of the plan
      • setOperator

        public void setOperator​(Instruction.Command operator)
        Sets the operator of the plan.
        Parameters:
        operator - The operator to set
      • getFilteringInstruction

        public Instruction getFilteringInstruction()
        Returns the filtering Instruction of the plan.
        Returns:
        the filtering instruction of the plan
      • setFilteringInstruction

        public void setFilteringInstruction​(Instruction filteringInstruction)
        Sets the filtering Instruction of the plan.
        Parameters:
        filteringInstruction - The filtering instruction to set
      • getExecutionStatus

        public boolean getExecutionStatus()
        Returns the execution status of the plan.
        Returns:
        true if the current plan has been executed or false otherwise
      • setExecutionStatus

        public void setExecutionStatus​(boolean executionStatus)
        Updates the execution status of the plan. If the plan has just been executed then it changes the value from false to true.
        Parameters:
        executionStatus - true if the plan has just been executed or false otherwise.
      • isEmpty

        public boolean isEmpty()
        Checks if the plan is empty. Returns true if and only if the instruction list is empty and both the sub-plans and the filtering instructions are null.
        Overrides:
        isEmpty in class Plan
        Returns:
        true if the plan is empty and false otherwise
      • isAtomic

        public boolean isAtomic()
        Checks whether the current plan is atomic or not. A plan is atomic if its sub-plans are null or if the existing sub-plans are empty.
        Returns:
        true if the plan is atomic and false otherwise
      • getInstructionList

        public List<Instruction> getInstructionList()
        Returns the list of instructions contained in a instructionList. If the plan is not atomic, then the functions returns all the instructions of each atomic nested plan included in the current plan.
        Specified by:
        getInstructionList in interface IPlan
        Overrides:
        getInstructionList in class Plan
        Returns:
        a clone of the list of instructions of the current plan
      • size

        public int size()
        Returns the size of the current plan. The size of a plan is equal to the size of its instruction list.
        Overrides:
        size in class Plan
        Returns:
        the size of the plan
      • clone

        public NestedPlan clone()
        Returns a clone of the current plan. Each non-primitive field of the current plan is cloned by invoking the clone function of the corresponding class.
        Specified by:
        clone in interface Clonable<IPlan>
        Overrides:
        clone in class Plan
        Returns:
        a clone of the current plan
      • addSubplan

        public void addSubplan​(NestedPlan subplan)
        Adds a sub-Plan to the current list of sub-plans. If there is no list one will be created.
        Parameters:
        subplan - The sub-plan to be added
      • getAllMeasures

        public List<String> getAllMeasures()
        Returns all the metric expressions of the current plan.
        Returns:
        List of all metric expressions
      • toString

        public String toString()
        String representation of the current plan.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the current plan
      • getThreshold

        public String getThreshold()
        Returns the threshold of the current plan. If the filtering instruction is not null, then it returns the threshold of the filtering instruction and 0 otherwise.
        Returns:
        the threshold as string
      • finalPlan

        public String finalPlan()
        Returns a string representation of current plan as a set of commands.
        Returns:
        the current plan as a set of commands
      • equals

        public boolean equals​(Object other)
        Compares the current plan with another plan, P. If P is null then it returns false. If both plans are atomic, then the functions returns true if they have the same instruction list. If both plans are complex, then the function checks if each field of the current plan is equal to the corresponding field of P. If one of the plans is atomic and the other is not, then it returns false.
        Overrides:
        equals in class Plan
        Returns:
        true if both plans are equal, and false otherwise