|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pnp.xfeature.data.ModelParser
public class ModelParser
A set of static methods used to parse the XML file (in its DOM tree representation) and thus extract the necessary data.
| Field Summary | |
|---|---|
static java.lang.String |
FMTLC_DEFAULTMODELNAME
Deprecated. |
static int |
NOT_A_NODE_DISPLAY_TYPE
|
static int |
XFEATURE_DISPLAYTYPE_CARDINALITY
|
static int |
XFEATURE_DISPLAYTYPE_NODE
|
static int |
XFEATURE_DISPLAYTYPE_NONE
|
static int |
XFEATURE_DISPLAYTYPE_PROPERTY
|
static int |
XFEATURE_DISPLAYTYPE_PROPERTYSET
|
static int |
XFEATURE_DISPLAYTYPE_ROOT
|
| Constructor Summary | |
|---|---|
ModelParser()
|
|
| Method Summary | |||
|---|---|---|---|
static void |
addRequiredCardinalityAndPropertySets(FeatureDiagramModel diagram,
org.w3c.dom.Node parent)
|
||
static java.util.List |
getAvailableNodeChildren(org.w3c.dom.Node node,
org.w3c.dom.Document metaModel)
Returns a list of possible child nodes of the given node according to the entries in the metaModel |
||
static org.w3c.dom.Node |
getDisplayModelEntryFor(org.w3c.dom.Document displayModel,
java.lang.String node)
Returns the node from the display model XML file that describes how to display the node (figurable, i.e. node, property, propertyset) |
||
static java.lang.String |
getDisplayModelProperty(org.w3c.dom.Document displayModel,
java.lang.String displayFormat,
java.lang.String node,
java.lang.String property)
Returns the given display model property of the given feature model node, i.e. the font, line width, etc. |
||
static java.util.List |
getDisplayNodeNames(org.w3c.dom.Document metamodel)
Returns a list of names of nodes that can be displayed on a canvas of the editor, i.e. nodes, properties, property sets, and cardinalities The list has doubled size, every second element is the parent property set (or an empty string if the parent is not a property set) |
||
static java.util.List |
getDisplayNodes(org.w3c.dom.Document metamodel)
Returns a list of nodes that can be displayed on a canvas of the editor, i.e. nodes, properties, property sets, and cardinalities |
||
static java.util.List |
getElementChildren(org.w3c.dom.Node element)
Returns a list of elements children that have the passed name |
||
static java.util.List |
getElementChildrenByName(org.w3c.dom.Node element,
java.lang.String name)
Returns a list of elements children that have the passed name |
||
static long |
getElementId(org.w3c.dom.Node element)
returns the element's unique ID - a positive integer |
||
static java.util.List |
getElementsThat(org.w3c.dom.Document document,
java.lang.String tag,
java.lang.String attr,
java.lang.String value)
Returns a list of those elements from document that have the given tag and their attribute attr equals to value |
||
static java.util.List |
getFigurativeNodes(org.w3c.dom.Document metamodel)
Returns a list of nodes (xml) that can be drawn to canvas as a selectable, editable, moveable, etc. feature model nodes |
||
static java.util.List |
getChildrenThat(java.util.List list,
org.w3c.dom.Node node,
java.lang.String name)
Returns a list of node's child nodes that have the given name |
||
static int |
getIndentCount(org.w3c.dom.Node node)
Tells what is the depth of this node in DOM model |
||
static java.lang.String |
getMetamodelElementDisplayType(org.w3c.dom.Node node)
Reads the display type from the given metamodel node, i.e. returns node, property, propertyset, and cardinality |
||
static int |
getMetamodelElementDisplayTypeConstant(java.lang.String s)
Transforms the string to constant |
||
static org.w3c.dom.Node |
getMetamodelEntryFor(org.w3c.dom.Document metamodel,
java.lang.String node)
Returns the metamodel xml element describing the meta characteristics of the given node |
||
static java.lang.String |
getMetamodelFilename(org.w3c.dom.Document dom)
Analyses the document in order to find the metamodel link i.e. the filename where the appropriate metamodel is saved. |
||
static java.lang.String |
getMetamodelFilename(java.lang.String loc)
Extracts the path to the meta model from Schema location string. |
||
static java.lang.String |
getModelName(org.w3c.dom.Document dom)
Reads the name of the model, i.e. the name attr of the root .xfm file element
|
static java.lang.StringgetNodeAttribute(org.w3c.dom.Node node,
java.lang.String attribute)
Reads the given attribute of the node if available | |
static org.w3c.dom.Node |
getNodeCardinality(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
Returns the cardinality for the passed node |
||
static java.lang.String |
getNodeDisplayType(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
Returns the display type (see above getMetamodelElementDisplayType) for the passed node according to the metaModel |
||
static java.lang.String |
getNodeChildValue(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node,
java.lang.String description)
Returns the value of the value attribute of the given child of node. |
||
static int |
getNodePosition(org.w3c.dom.Node parent,
long id)
Returns an position index within the parent of node with id id |
||
static int |
getNodePosition(org.w3c.dom.Node parent,
org.w3c.dom.Node node)
Traverse the list of child nodes of the "parent" naode and returns an index of "node" node. |
||
static org.w3c.dom.Node |
getNodePropertySet(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node,
java.lang.String name)
Returns the property set node for of the given name for the passed node |
||
static java.lang.String |
getParentPropertySetIfAny(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node)
Returns name of a property set that is a parent node of specified property node |
||
static java.lang.String |
getPropertyDefaultValue(org.w3c.dom.Node node)
Reads the display type from the given metamodel node, i.e. returns node, property, propertyset, and cardinality |
||
static java.util.List |
getPropertyNodes(org.w3c.dom.Document metamodel)
Returns a list of nodes (xml) that are properties of a feature model node |
||
static org.w3c.dom.Node |
getPropertySet(org.w3c.dom.Node parentNode,
java.lang.String propertySet)
Returns property set DOM node specified by name |
||
static int |
getPropertySetIndex(org.w3c.dom.Node parentNode,
org.w3c.dom.Node propertySetNode,
org.w3c.dom.Document metamodelDocument)
Return the position of the parameter among the other parameters of the same type. |
||
static org.w3c.dom.Node |
getSequence(org.w3c.dom.Document metamodel,
java.lang.String nodeName)
Return the sequence node for the passed node name from the metamodel |
||
static org.w3c.dom.Node |
getSubElementByTagName(org.w3c.dom.Node node,
java.lang.String subElementName)
Scans the recursive structure of the given node and returns the sub-node given by subElementName path (using '/' as a delimiter - see getNodeChildValue()) |
||
static java.lang.String |
getTooltip(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
searches given node for ShortDescription descendant and returns its content to be later displayed to the user as a tool tip |
||
static org.w3c.dom.xpath.XPathResult |
getXPathResult(org.w3c.dom.Node node,
java.lang.String xPath)
uses the org.w3c.dom.xpath pacakge to query a DOM Documents with XPath expressions |
||
static java.lang.String |
getXPathValueApache(org.w3c.dom.Document document,
java.lang.String xPath)
Get value of the node specified by an XPath. |
||
static boolean |
isCardinalityNode(org.w3c.dom.Node node)
Checks wheather a node is a cardinality node |
||
static boolean |
isCorrectNodeType(org.w3c.dom.Node node,
java.lang.String type)
Checks wheather a node is a node, property, or property setnode |
||
static boolean |
isPropertyNode(org.w3c.dom.Node node)
Checks wheather a node is a property node |
||
static boolean |
isPropertySetNode(org.w3c.dom.Node node)
Checks wheather a node is a property set node |
||
static java.lang.String |
removeIndex(java.lang.String s)
Return the string where index in brackets e.g. "(3)" is removed. |
||
static boolean |
setGlobalConstraintValue(FeatureDiagramModel diagram,
java.lang.String description,
java.lang.String value)
The same as getNodeChildValue but the value is stored to the appropriate attribute of the given node |
||
static boolean |
setNodeChildValue(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node,
java.lang.String description,
java.lang.String value)
The same as getNodeChildValue but the value is stored to the appropriate attribute of the given node |
||
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FMTLC_DEFAULTMODELNAME
public static final int XFEATURE_DISPLAYTYPE_NONE
public static final int XFEATURE_DISPLAYTYPE_CARDINALITY
public static final int XFEATURE_DISPLAYTYPE_NODE
public static final int XFEATURE_DISPLAYTYPE_PROPERTY
public static final int XFEATURE_DISPLAYTYPE_PROPERTYSET
public static final int XFEATURE_DISPLAYTYPE_ROOT
public static final int NOT_A_NODE_DISPLAY_TYPE
| Constructor Detail |
|---|
public ModelParser()
| Method Detail |
|---|
public static java.lang.String getModelName(org.w3c.dom.Document dom)
public static java.lang.String getMetamodelFilename(org.w3c.dom.Document dom)
dom -
public static java.lang.String getMetamodelFilename(java.lang.String loc)
dom -
public static java.util.List getElementsThat(org.w3c.dom.Document document,
java.lang.String tag,
java.lang.String attr,
java.lang.String value)
public static java.lang.String getNodeAttribute(org.w3c.dom.Node node,
java.lang.String attribute)
public static org.w3c.dom.Node getDisplayModelEntryFor(org.w3c.dom.Document displayModel,
java.lang.String node)
public static java.lang.String getDisplayModelProperty(org.w3c.dom.Document displayModel,
java.lang.String displayFormat,
java.lang.String node,
java.lang.String property)
public static java.lang.String getNodeChildValue(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node,
java.lang.String description)
public static boolean setNodeChildValue(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node,
java.lang.String description,
java.lang.String value)
public static java.util.List getDisplayNodeNames(org.w3c.dom.Document metamodel)
public static java.util.List getDisplayNodes(org.w3c.dom.Document metamodel)
public static java.lang.String getParentPropertySetIfAny(org.w3c.dom.Document metamodel,
org.w3c.dom.Node node)
metamodel - node - property nodepublic static java.util.List getPropertyNodes(org.w3c.dom.Document metamodel)
public static java.util.List getFigurativeNodes(org.w3c.dom.Document metamodel)
public static org.w3c.dom.Node getMetamodelEntryFor(org.w3c.dom.Document metamodel,
java.lang.String node)
public static java.util.List getChildrenThat(java.util.List list,
org.w3c.dom.Node node,
java.lang.String name)
public static java.lang.String getMetamodelElementDisplayType(org.w3c.dom.Node node)
public static java.lang.String getPropertyDefaultValue(org.w3c.dom.Node node)
public static int getMetamodelElementDisplayTypeConstant(java.lang.String s)
public static java.lang.String getNodeDisplayType(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
public static org.w3c.dom.Node getNodeCardinality(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
public static boolean isCardinalityNode(org.w3c.dom.Node node)
public static org.w3c.dom.Node getNodePropertySet(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node,
java.lang.String name)
public static boolean isPropertySetNode(org.w3c.dom.Node node)
public static boolean isPropertyNode(org.w3c.dom.Node node)
public static boolean isCorrectNodeType(org.w3c.dom.Node node,
java.lang.String type)
public static java.util.List getAvailableNodeChildren(org.w3c.dom.Node node,
org.w3c.dom.Document metaModel)
public static java.util.List getElementChildrenByName(org.w3c.dom.Node element,
java.lang.String name)
public static org.w3c.dom.Node getSubElementByTagName(org.w3c.dom.Node node,
java.lang.String subElementName)
public static org.w3c.dom.Node getSequence(org.w3c.dom.Document metamodel,
java.lang.String nodeName)
public static java.util.List getElementChildren(org.w3c.dom.Node element)
public static long getElementId(org.w3c.dom.Node element)
public static int getNodePosition(org.w3c.dom.Node parent,
long id)
id
public static int getNodePosition(org.w3c.dom.Node parent,
org.w3c.dom.Node node)
parent - the parent nodenode - the searched node
public static org.w3c.dom.Node getPropertySet(org.w3c.dom.Node parentNode,
java.lang.String propertySet)
parentNode - node that contains a property setpropertySet - property set name
public static int getPropertySetIndex(org.w3c.dom.Node parentNode,
org.w3c.dom.Node propertySetNode,
org.w3c.dom.Document metamodelDocument)
propertySetNode - node to be searched in the list of
public static java.lang.String removeIndex(java.lang.String s)
s - string that may have index at the end e.g. "Attrirute(2)"
public static void addRequiredCardinalityAndPropertySets(FeatureDiagramModel diagram,
org.w3c.dom.Node parent)
public static java.lang.String getTooltip(org.w3c.dom.Document metaModel,
org.w3c.dom.Node node)
metaModel - reference to the meta-model of the current feature modelnode - the node for which tool tip string is requested
public static java.lang.String getXPathValueApache(org.w3c.dom.Document document,
java.lang.String xPath)
throws org.w3c.dom.xpath.XPathException
document - Document to get node value of.xPath - XPath to select single node value (e.g. "/root/data/value[1]/text()")
org.w3c.dom.xpath.XPathException - if XPath result object is not of type XPathResult.
public static org.w3c.dom.xpath.XPathResult getXPathResult(org.w3c.dom.Node node,
java.lang.String xPath)
throws org.w3c.dom.xpath.XPathException
node - context nodexPath - XPath expression
org.w3c.dom.xpath.XPathException
public static boolean setGlobalConstraintValue(FeatureDiagramModel diagram,
java.lang.String description,
java.lang.String value)
public static int getIndentCount(org.w3c.dom.Node node)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||