Class FeatureModel
java.lang.Object
cruise.umple.compiler.FeatureModel
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddFeaturelink(FeatureLink aFeaturelink) booleanaddFeaturelinkAt(FeatureLink aFeaturelink, int index) addNode()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 FeatureModelDeserializes a JSON string.getFeatureLeafNode(String name) This method returns a leaf node from FeatureModel based on its name.getFeaturelink(int index) getName()getNode()getNode(int index) This method does conditional addition for a FeatureLeaf based on the provided name.This method returns the feature links, each created by a require statement, that the use-statements do not satisfy.booleanbooleanhasNode()booleanintindexOfFeaturelink(FeatureLink aFeaturelink) intindexOfNode(FeatureNode aNode) booleanisUsedFeatureLeaf(FeatureLeaf featureLeaf) This method returns true if the feature leaf has a use-statement.static intstatic intintintvoidRebind each FeatureLeaf whose MixsetOrFile is a Mixset to the canonical Mixset registered in UmpleModel.mixsetOrFiles for that name, when one exists.booleanremoveFeaturelink(FeatureLink aFeaturelink) booleanremoveNode(FeatureNode aNode) booleanThis method checks whether the use-statements satisfy every require statement that applies, i.e.booleanbooleansetUmpleModel(UmpleModel aNewUmpleModel) toJSON()Serializes this FeatureModel to a complete JSON string.toString()
-
Constructor Details
-
FeatureModel
-
-
Method Details
-
setName
-
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
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
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. -
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
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. 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
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
-
getRootFeatures
-