Class CreateSurroundingBlock

java.lang.Object
de.aristaflow.adept2.core.changeoperations.CreateSurroundingBlock

public class CreateSurroundingBlock extends Object
This change operation offers the possibility to surround nodes with a block of the following types:
  • AND-Split -> AND-Join
  • XOR-Split -> XOR-Join
  • LOOP-Start -> LOOP-End
Call isPossible first to check if the insertion of the surrounding block is valid, than call perform operation to execute the change. TODO Refactor; use a common interface for change operations.
  • Field Details

    • logger

      protected static final Logger logger
      the Logger for the change operation
  • Constructor Details

    • CreateSurroundingBlock

      public CreateSurroundingBlock()
  • Method Details

    • isPossible

      public static boolean isPossible(Template template, Node first, Node last, ProcessConstants.BlockType type)
      Check if it is possible (concerning structural correctness) to create a block which surrounds the two given nodes in the given template.
      Parameters:
      template - The template where the method is performed on.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType
      Returns:
      True, if the insertion is possible.
    • isPossible

      public static boolean isPossible(Template template, Node first, Node last, ProcessConstants.BlockType type, CheckReport checkReport)
      Check if it is possible (concerning structural correctness) to create a block which surrounds the two given nodes in the given template. If the check fails the reason is stored in the given chechReport (provided that checkReport is not null)
      Parameters:
      template - The template where the method is performed on.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType
      checkReport - a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null
      Returns:
      True, if the insertion is possible.
    • isPossible

      public static boolean isPossible(ChangeableInstance instance, Node first, Node last, ProcessConstants.BlockType type)
      Check if it is possible (concerning structural and state-based correctness) to create a block which surrounds the two given nodes in the given instance.
      Parameters:
      instance - The changeable instance where the method is performed on.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType
      Returns:
      True, if the insertion is possible.
    • isPossible

      public static boolean isPossible(ChangeableInstance instance, Node first, Node last, ProcessConstants.BlockType type, CheckReport checkReport)
      Check if it is possible (concerning structural and state-based correctness) to create a block which surrounds the two given nodes in the given template. If the check fails the reason is stored in the given chechReport (provided that checkReport is not null)
      Parameters:
      instance - The changeable instance where the method is performed on.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType
      checkReport - a checkReport object which can be filled with the reason why the isPossible failed (i.e. in the case the method returns false), may be null
      Returns:
      True, if the insertion is possible.
    • performOperation

      public static Node[] performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, ProcessConstants.BlockType type)
      Inserts a new block of the given type around the two given nodes in the given template.
      Parameters:
      session - The session which is used to check for access rights on this method.
      template - The template where the block is inserted.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType (OR_BLOCK, AND_BLOCK, LOOP_BLOCK)
      Returns:
      The newly inserted node.
    • performOperation

      public static Node[] performOperation(SessionToken session, ChangeableTemplate template, Node first, Node last, ProcessConstants.BlockType type, UpdateManager updateManager)
      Inserts a new block of the given type around the two given nodes in the given template (with updateManager).
      Parameters:
      session - The session which is used to check for access rights on this method.
      template - The template where the block is inserted.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType (OR_BLOCK, AND_BLOCK, LOOP_BLOCK)
      updateManager - the manager who controls the update of the visual graph components.
      Returns:
      The newly inserted nodes.
    • performOperation

      public static Node[] performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, ProcessConstants.BlockType type)
      Inserts a new block of the given type around the two given nodes in the given instance.
      Parameters:
      session - The session which is used to check for access rights on this method.
      instance - the changeable instance where the block is inserted.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType (OR_BLOCK, AND_BLOCK, LOOP_BLOCK)
      Returns:
      The newly inserted node.
    • performOperation

      public static Node[] performOperation(SessionToken session, ChangeableInstance instance, Node first, Node last, ProcessConstants.BlockType type, UpdateManager updateManager)
      Inserts a new block of the given type around the two given nodes in the given instance (with updateManager).
      Parameters:
      session - The session which is used to check for access rights on this method.
      instance - the changeable instance where the block is inserted.
      first - the first node of the block
      last - the last node of the block
      type - the BlockType (OR_BLOCK, AND_BLOCK, LOOP_BLOCK)
      updateManager - the manager who controls the update of the visual graph components.
      Returns:
      The newly inserted nodes.
    • performOperation

      protected static Node[] performOperation(SessionToken session, ChangePrimitives processGraph, Node first, Node last, ProcessConstants.BlockType type, UpdateManager updateManager)
      Worker method to do the structural changes for both changeable templates and changeable instances.
      Parameters:
      session - The session which is used to check for access rights on this method.
      processGraph - an instance of type ChangeableTemplate or ChangeableInstance
      first - the first node of the block
      last - the last node of the block
      type - the BlockType (OR_BLOCK, AND_BLOCK, LOOP_BLOCK)
      updateManager - the manager who controls the update of the visual graph components.
      Returns:
      The newly inserted data element.