Class FeatureModel

java.lang.Object
cruise.umple.compiler.FeatureModel

public class FeatureModel
extends java.lang.Object
Copyright: All contributers to the Umple Project. This file is made available subject to the open source license found at: https://umple.org/license Feature model functions
  • Constructor Details

    • FeatureModel

      public FeatureModel​(java.lang.String aName)
  • Method Details

    • setName

      public boolean setName​(java.lang.String aName)
    • getName

      public java.lang.String getName()
    • getNode

      public FeatureNode getNode​(int index)
    • getNode

      public java.util.List<FeatureNode> getNode()
    • numberOfNode

      public int numberOfNode()
    • hasNode

      public boolean hasNode()
    • indexOfNode

      public int indexOfNode​(FeatureNode aNode)
    • getFeaturelink

      public FeatureLink getFeaturelink​(int index)
    • getFeaturelink

      public java.util.List<FeatureLink> getFeaturelink()
    • numberOfFeaturelink

      public int numberOfFeaturelink()
    • hasFeaturelink

      public boolean hasFeaturelink()
    • indexOfFeaturelink

      public int indexOfFeaturelink​(FeatureLink aFeaturelink)
    • getUmpleModel

      public UmpleModel getUmpleModel()
    • hasUmpleModel

      public boolean hasUmpleModel()
    • minimumNumberOfNode

      public static int minimumNumberOfNode()
    • addNode

      public FeatureNode addNode()
    • addNode

      public boolean addNode​(FeatureNode aNode)
    • removeNode

      public boolean removeNode​(FeatureNode aNode)
    • addNodeAt

      public boolean addNodeAt​(FeatureNode aNode, int index)
    • addOrMoveNodeAt

      public boolean addOrMoveNodeAt​(FeatureNode aNode, int index)
    • minimumNumberOfFeaturelink

      public static int minimumNumberOfFeaturelink()
    • addFeaturelink

      public boolean addFeaturelink​(FeatureLink aFeaturelink)
    • removeFeaturelink

      public boolean removeFeaturelink​(FeatureLink aFeaturelink)
    • addFeaturelinkAt

      public boolean addFeaturelinkAt​(FeatureLink aFeaturelink, int index)
    • addOrMoveFeaturelinkAt

      public boolean addOrMoveFeaturelinkAt​(FeatureLink aFeaturelink, int index)
    • setUmpleModel

      public boolean setUmpleModel​(UmpleModel aNewUmpleModel)
    • delete

      public void delete()
    • toJSON

      public java.lang.String toJSON()
      Serializes this FeatureModel to a complete JSON string. schema: ===SCHEMA START=== { "featureModel": { "name": string, "nodes": [ { "id": int, "uniqueName": string, "name": string, "nodeType": "FeatureLeaf" | "CompoundFeatureNode" | "FragmentFeatureLeaf" | "FeatureNode", "isLeaf": boolean, "isCompoundFeature": boolean, "mixsetOrFileNode": { // FeatureLeaf only "type": "Mixset" | "UmpleFile", "name": string, "isMixset": boolean, "isFeature": boolean, // Mixset only "isEmpty": boolean, // Mixset only "useUmpleFile": string | null, "useUmpleLine": int } | null, "childFeatureIds": [int, ...], // CompoundFeatureNode only "fragments": [ // FragmentFeatureLeaf only { "file": string | null, "line": int, "bodyLength": int } ] } ], "links": [ { "sourceNodeId": int, "targetNodeId": int, "linkType": "FeatureLink" | "MultiplicityFeatureConnectingOpType" | "XORFeatureConnectingOpType", "opType": "Mandatory" | "Optional" | "Conjunctive" | "Disjunctive" | "Multiplicity" | "Include" | "Exclude" | "XOR", "isSub": boolean, "lowerBound": int, // Multiplicity/XOR only "upperBound": int // Multiplicity/XOR only } ] } } ===SCHEMA END===
    • fromJSON

      public static FeatureModel fromJSON​(java.lang.String json)
      Deserializes a JSON string.
    • getFeatureLeafNode

      public FeatureLeaf getFeatureLeafNode​(java.lang.String name)
      This method returns a leaf node from FeatureModel based on its name. return null if the leaf node is not found.
    • getOrCreateFeatureLeafNode

      public FeatureLeaf getOrCreateFeatureLeafNode​(java.lang.String name)
      This method does conditional addition for a FeatureLeaf based on the provided name. It returns a new FeatureLeaf if its not found, or existing FeatureLeaf if the name was found.
    • isUsedFeatureLeaf

      public boolean isUsedFeatureLeaf​(FeatureLeaf featureLeaf)
      This method returns true if the feature leaf has a use-statement. It returns false if there is no use-statement for the mixset. It returns false if there is no mixset or file in the feature leaf.
    • evaluateFeatureLink

      public boolean evaluateFeatureLink​(FeatureLink featureLink)
      This method takes a feature link (from the feature model) and decides whether the link is satisfied. If the link is not satisfied, it return false. Ex: the link "source--> and" for M1 and M2 is true if there are use-statements for both M1 and M2.
    • satisfyFeatureModel

      public boolean satisfyFeatureModel()
      This method checks whether the use-statements plus the feature model results in valid configuration. It return true If there is no feature model.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getRootFeatures

      public java.util.List<FeatureNode> getRootFeatures()