Class HierarchyHelper

java.lang.Object
de.monticore.tf.odrules.HierarchyHelper

public final class HierarchyHelper extends Object
  • Constructor Details

    • HierarchyHelper

      public HierarchyHelper()
    • HierarchyHelper

      public HierarchyHelper(ASTODRule astodRule)
  • Method Details

    • isListObject

      public boolean isListObject(String objectName)
      Checks whether the object with the given name is a list object.
      Parameters:
      objectName - the name of the object
      Returns:
      whether it is a list
    • getPackageName

      public String getPackageName()
      Get package name for code generation
      Returns:
    • setPackageName

      public void setPackageName(String packageName)
      Set package name for code generation
      Parameters:
      packageName -
    • packageisPresentName

      public boolean packageisPresentName()
      Check if package name for code generation is set
      Returns:
    • getCustomImports

      public List<String> getCustomImports()
      Get all custom imports for code generation
      Returns:
    • addCustomImports

      public void addCustomImports(String customImport)
      Add custom import for code generation
      Parameters:
      customImport -
    • getInnerLinkObjectsLHS

      public List<ASTMatchingObject> getInnerLinkObjectsLHS(List<ASTMatchingObject> allMatches, ASTMatchingObject obj)
      Calculates all inner objects of a given object
      Parameters:
      allMatches - The list of all LHS match elements.
      obj - The list from which we want the childs.
      Returns:
      a List of the names of all (direct) childs from the list.
    • getListObjects

      public List<ASTMatchingObject> getListObjects(List<ASTMatchingObject> allObjects)
      Removes every mandatory object.
      Parameters:
      allObjects - list of all objects
      Returns:
      a list of all found list objects
    • isListChild

      public boolean isListChild(ASTMatchingObject object)
      Checks if the given object is in a list.
      Parameters:
      object - The object to be checked
      Returns:
      If the object is in a list
    • isListChild

      public boolean isListChild(String objectname)
    • isLhsListChild

      public boolean isLhsListChild(String objectname)
    • isLhsListChild

      public boolean isLhsListChild(ASTMatchingObject object)
    • isRhsListChild

      public boolean isRhsListChild(String objectname)
    • isRhsListChild

      public boolean isRhsListChild(ASTMatchingObject object)
    • getMandatoryObjectsWithoutOptAndListChilds

      public List<ASTMatchingObject> getMandatoryObjectsWithoutOptAndListChilds(List<ASTMatchingObject> allMatches)
      Removes every optional and listChild match-object.
      Parameters:
      allMatches - list of all match-objects
      Returns:
      a list of match-objects without optional and listChild objects
    • getMandatoryObjectsWithoutListChilds

      public List<ASTMatchingObject> getMandatoryObjectsWithoutListChilds(List<ASTMatchingObject> allMatches)
      Removes every listChild match-object.
      Parameters:
      allMatches - list of all match-objects
      Returns:
      a list of match-objects without listChild objects
    • getListChilds

      public List<ASTMatchingObject> getListChilds(List<ASTMatchingObject> allObjects, ASTMatchingObject list)
      Removes every optional and listChild match-object.
      Parameters:
      allObjects - list of all match-objects
      Returns:
      a list of match-objects without optional and listChild objects
    • getListChildsWithOptionals

      public List<ASTMatchingObject> getListChildsWithOptionals(List<ASTMatchingObject> allobjects, ASTMatchingObject list)
      Gives all child objects from a given list of objects, including optionals
      Parameters:
      allobjects - the objects to search in
      Returns:
      all objects in lists in the given objects
    • getListChilds

      public List<ASTMatchingObject> getListChilds(List<ASTMatchingObject> allobjects)
      Gives all objects in a List in the given list of objects, besides optionals
      Parameters:
      allobjects - the objects to search in
      Returns:
      all objects in lists in the given objects
    • getListChildsWithOptionals

      public List<ASTMatchingObject> getListChildsWithOptionals(List<ASTMatchingObject> allobjects)
      Gives all objects in a List in the given list of objects
      Parameters:
      allobjects - the objects to search in
      Returns:
      all objects in lists in the given objects
    • getListParent

      public String getListParent(String object)
      Gives the ListStructure Name the given objectName lies in
      Parameters:
      object - The name of the object
      Returns:
      The name of the list Structure which contains the object
    • getListTree

      public List<String> getListTree(String object)
      Method to get the Treepath the object lies in.
      Parameters:
      object - The Object for which we want to find a path in the List-Structure Tree
      Returns:
      A List starting with the root-list and ending with the list containing the given Object.
    • getObjectByName

      public ASTMatchingObject getObjectByName(List<ASTMatchingObject> allObjects, String name)
      Gives the Object to a Name in a given List of Objects
      Parameters:
      allObjects - The List of objects where the object should be found in.
      name - The given objectname
      Returns:
      The object which has the given name, null if no object was found
    • getMandatoryChangeObjects

      public List<ASTChange> getMandatoryChangeObjects(List<ASTChange> allChanges)
      Removes every Change object with the Optional type.
      Parameters:
      allChanges - list of all Change objects
      Returns:
      a list of Changes without optional objects
    • getMandatoryChangeObjectsNoList

      public List<ASTChange> getMandatoryChangeObjectsNoList(List<ASTChange> allChanges)
      Removes every Change object with the Optional type and the list type.
      Parameters:
      allChanges - list of all Change objects
      Returns:
      a list of Changes without optional objects and list objects
    • getChangeObjectsWhithoutCreate

      public List<ASTChange> getChangeObjectsWhithoutCreate(ASTReplacement replacements)
    • getMandatoryChangeObjectsOnlyList

      public List<ASTChange> getMandatoryChangeObjectsOnlyList(List<ASTChange> allChanges)
      Only change objects with the list type.
      Parameters:
      allChanges - list of all Change objects
      Returns:
      a list of Changes, which are list objects
    • getMandatoryDeleteObjects

      public List<ASTDeleteOperation> getMandatoryDeleteObjects(List<ASTDeleteOperation> allDeletes)
      Removes every Delete object with the Optional type.
      Parameters:
      allDeletes - list of all Delete objects
      Returns:
      a list of Deletes without optional objects
    • getMandatoryMatchObjects

      public List<ASTMatchingObject> getMandatoryMatchObjects(List<ASTMatchingObject> allMatches)
      Removes every optional Match object.
      Parameters:
      allMatches - list of all Match objects
      Returns:
      a list of Matches without optional objects
    • getMandatoryObjectsWithoutOptList

      public List<ASTMatchingObject> getMandatoryObjectsWithoutOptList(List<ASTMatchingObject> allMatches)
      Removes every optional and list match object.
      Parameters:
      allMatches - list of all Match objects
      Returns:
      a list of Matches without optional and list objects
    • getOptionalMatchObjects

      public List<ASTMatchingObject> getOptionalMatchObjects(List<ASTMatchingObject> allMatches)
      Removes every mandatory Match object.
      Parameters:
      allMatches - list of all Match objects
      Returns:
      a list of optional Match objects
    • isNoOptionalName

      public boolean isNoOptionalName(List<ASTMatchingObject> matches, String linkName)
      Checks if one of the InnerLinkObjects is an Optional object
      Parameters:
      matches - list of matches to check
      linkName - the name of the object to look for
      Returns:
      true, if the object with the given name is no optional
    • getOptListObjects

      public List<ASTMatchingObject> getOptListObjects(List<ASTMatchingObject> allObjects)
      Removes every normal object.
      Parameters:
      allObjects - list of all Match-objects
      Returns:
      a list of optional Match objects
    • isWithinOptionalStructure

      public boolean isWithinOptionalStructure(String objectName)
      Checks if the object with the given name is within an optional structure.
      Parameters:
      objectName - the object name
      Returns:
      whether the object is within an optional structure
    • isWithinNegativeStructure

      public boolean isWithinNegativeStructure(String objectName)
      Checks if the object with the given name is within an negative structure (not[[..]]-element).
      Parameters:
      objectName - the object name
      Returns:
      whether the object is within a negative structure
    • isWithinListStructure

      public boolean isWithinListStructure(String objectName)
    • getMatchingObject

      public static ASTMatchingObject getMatchingObject(List<ASTMatchingObject> allObjects, String name)