fbench.dom
Class ElementModel

java.lang.Object
  extended by fbench.dom.ElementModel
Direct Known Subclasses:
ActionsModel, DOMTextModel, DOMTranslationModel, DOMTreeNode, ECActionsModel, ECActionsTableModel, GraphModel, MutationListener

public class ElementModel
extends java.lang.Object

A utility wrapper for Elements of the DOM tree of an IEC 61499 LibraryElement.

Version:
20051017/JHC - Corrected getName(), getType(), getComment(), toString()- getAttribute() never returns null., 20050817/JHC
Author:
JHC

Constructor Summary
ElementModel()
           
ElementModel(org.w3c.dom.Element el)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if obj is an ElementModel and its contained Element is equal to the Element contained in this object.
static ElementModel forElement(org.w3c.dom.Element el, java.lang.String packageName)
          Returns an ElementModel in the specified package encapsulating the given DOM Element, or null if no such ElementModel exists.
 java.lang.String getComment()
          Returns the Element's "Comment" attribute or other remark if anyIf none exists, returns the empty String.
 org.w3c.dom.Element getElement()
           
 java.lang.String getName()
          Returns the Element's Name attribute.
 java.lang.String getType()
          Returns the Element's Type attribute.
static boolean isDigit(char c)
          Returns true if the given character is a digit in the range {0..9}.
static boolean isLetter(char c)
          Returns true if the given character is an IEC 61131-3 upper or lower case letter.
static boolean isName(java.lang.String s)
          Returns true if the given String is an IEC 61131-3 identifier.
 void setElement(org.w3c.dom.Element el)
           
 java.lang.String toString()
          Returns a String representation of the contained Element.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementModel

public ElementModel()

ElementModel

public ElementModel(org.w3c.dom.Element el)
Method Detail

setElement

public void setElement(org.w3c.dom.Element el)

getName

public java.lang.String getName()
Returns the Element's Name attribute. If none exists, returns the Element's tagName.


getType

public java.lang.String getType()
Returns the Element's Type attribute. If none exists, returns the empty String.


getElement

public org.w3c.dom.Element getElement()

toString

public java.lang.String toString()
Returns a String representation of the contained Element. Default is a Name : Type (* Comment*nbsp;*) representation if possible.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if obj is an ElementModel and its contained Element is equal to the Element contained in this object.

Overrides:
equals in class java.lang.Object

getComment

public java.lang.String getComment()
Returns the Element's "Comment" attribute or other remark if anyIf none exists, returns the empty String.


isName

public static final boolean isName(java.lang.String s)
Returns true if the given String is an IEC 61131-3 identifier.


isLetter

public static final boolean isLetter(char c)
Returns true if the given character is an IEC 61131-3 upper or lower case letter.


isDigit

public static final boolean isDigit(char c)
Returns true if the given character is a digit in the range {0..9}.


forElement

public static ElementModel forElement(org.w3c.dom.Element el,
                                      java.lang.String packageName)
Returns an ElementModel in the specified package encapsulating the given DOM Element, or null if no such ElementModel exists.

Parameters:
el - The DOM Element for which a model is requested.
packageName - The period-terminated package name in which the model class (if any) is contained, e.g., "fbench.graph."