Class FeatureModel

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

public class FeatureModel extends 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(String aName)
  • Method Details

    • setName

      public boolean setName(String aName)
    • getName

      public String getName()
    • getNode

      public FeatureNode getNode(int index)
    • getNode

      public 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 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 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 "reqImplementations": [ // Mixset only { "requirementIdentifier": string, "qualityClassName": string | null, "implementingFeature": string | null, "requirementResolved": boolean, // recomputed output only; ignored on fromJSON "qualityClassResolved": boolean // recomputed output only; ignored on fromJSON } ], "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 } ], "requirements": [ // present if and only if an UmpleModel is attached; sorted by identifier { "identifier": string, "language": string, "statement": string, "who": string, "when": string, "what": string, "why": string, "useCaseSteps": [ { "id": string, "stepType": "UserStep" | "SystemResponse", "content": string } ], "qualityClasses": [ { "name": string, "content": string } ] } ] } } ===SCHEMA END===
    • fromJSON

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

      public FeatureLeaf getFeatureLeafNode(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(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.
    • rebindFeatureLeavesToCanonicalMixsets

      public void rebindFeatureLeavesToCanonicalMixsets()
      Rebind each FeatureLeaf whose MixsetOrFile is a Mixset to the canonical Mixset registered in UmpleModel.mixsetOrFiles for that name, when one exists. This repairs leaves constructed with detached Mixset placeholders by createFeatureModelSegment
    • 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. Only the require statement the link belongs to is checked: the require statements of the features it reaches are separate constraints, checked on their own when those features are used. 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 satisfy every require statement that applies, i.e. whether they form a valid configuration of the feature model.
    • getUnsatisfiedFeatureLinks

      public List<FeatureLink> getUnsatisfiedFeatureLinks()
      This method returns the feature links, each created by a require statement, that the use-statements do not satisfy. A require statement applies when it is at the top level of a file, or in a mixset that has a use-statement; the require statements of unused mixsets are ignored.
    • toString

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

      public List<FeatureNode> getRootFeatures()