Package cruise.umple.compiler
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 Summary
Constructors Constructor Description FeatureModel(java.lang.String aName) -
Method Summary
Modifier and Type Method Description booleanaddFeaturelink(FeatureLink aFeaturelink)booleanaddFeaturelinkAt(FeatureLink aFeaturelink, int index)FeatureNodeaddNode()booleanaddNode(FeatureNode aNode)booleanaddNodeAt(FeatureNode aNode, int index)booleanaddOrMoveFeaturelinkAt(FeatureLink aFeaturelink, int index)booleanaddOrMoveNodeAt(FeatureNode aNode, int index)voiddelete()booleanevaluateFeatureLink(FeatureLink featureLink)This method takes a feature link (from the feature model) and decides whether the link is satisfied.static FeatureModelfromJSON(java.lang.String json)Deserializes a JSON string.FeatureLeafgetFeatureLeafNode(java.lang.String name)This method returns a leaf node from FeatureModel based on its name.java.util.List<FeatureLink>getFeaturelink()FeatureLinkgetFeaturelink(int index)java.lang.StringgetName()java.util.List<FeatureNode>getNode()FeatureNodegetNode(int index)FeatureLeafgetOrCreateFeatureLeafNode(java.lang.String name)This method does conditional addition for a FeatureLeaf based on the provided name.java.util.List<FeatureNode>getRootFeatures()UmpleModelgetUmpleModel()booleanhasFeaturelink()booleanhasNode()booleanhasUmpleModel()intindexOfFeaturelink(FeatureLink aFeaturelink)intindexOfNode(FeatureNode aNode)booleanisUsedFeatureLeaf(FeatureLeaf featureLeaf)This method returns true if the feature leaf has a use-statement.static intminimumNumberOfFeaturelink()static intminimumNumberOfNode()intnumberOfFeaturelink()intnumberOfNode()booleanremoveFeaturelink(FeatureLink aFeaturelink)booleanremoveNode(FeatureNode aNode)booleansatisfyFeatureModel()This method checks whether the use-statements plus the feature model results in valid configuration.booleansetName(java.lang.String aName)booleansetUmpleModel(UmpleModel aNewUmpleModel)java.lang.StringtoJSON()Serializes this FeatureModel to a complete JSON string.java.lang.StringtoString()
-
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
-
getNode
-
numberOfNode
public int numberOfNode() -
hasNode
public boolean hasNode() -
indexOfNode
-
getFeaturelink
-
getFeaturelink
-
numberOfFeaturelink
public int numberOfFeaturelink() -
hasFeaturelink
public boolean hasFeaturelink() -
indexOfFeaturelink
-
getUmpleModel
-
hasUmpleModel
public boolean hasUmpleModel() -
minimumNumberOfNode
public static int minimumNumberOfNode() -
addNode
-
addNode
-
removeNode
-
addNodeAt
-
addOrMoveNodeAt
-
minimumNumberOfFeaturelink
public static int minimumNumberOfFeaturelink() -
addFeaturelink
-
removeFeaturelink
-
addFeaturelinkAt
-
addOrMoveFeaturelinkAt
-
setUmpleModel
-
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
Deserializes a JSON string. -
getFeatureLeafNode
This method returns a leaf node from FeatureModel based on its name. return null if the leaf node is not found. -
getOrCreateFeatureLeafNode
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
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
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:
toStringin classjava.lang.Object
-
getRootFeatures
-