Package gw.internal.gosu.properties
Class PropertyNode
java.lang.Object
gw.internal.gosu.properties.PropertyNode
- All Implemented Interfaces:
IGosuObject
A node in a tree representation of an underlying
PropertySet
. Any compound names, such
as a.b.c and a.b.d, in the keys of the property set are split into a tree representation. In the
a.b.c/a.b.d example there would be a property node for a, with a child node b with two further
leaf children c and d.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String,
PropertyNode> private final String
private final PropertyNode
private final String
private final PropertySet
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PropertyNode
(PropertyNode parent, String name, PropertySet propertySet) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addChild
(PropertyNode node) static PropertyNode
buildTree
(PropertySet propertySet) private PropertyNode
The direct children of this property nodegetChildValue
(String name) Return the value for the named child property; this is just like doing lookup on the underlyingPropertySet
except that the name is prefixed with the full name of this property.The full property name, for example a.bReturn the intrinsic type based on this property nodeprivate String
getName()
getPath()
The last part of the property name, for example b if the full name is a.bReturn the name that should be used for the type based on this property nodegetValue()
Return the value for this property as given by the underlyingPropertySet
boolean
hasValue()
Does this property node have a value in the underlyingPropertySet
(package private) static boolean
isGosuIdentifier
(String name) private static boolean
isGosuIdentifierPart
(char ch) private static boolean
isGosuIdentifierStart
(char ch) boolean
isLeaf()
Is this a leaf node - that is, does it have no children?boolean
isRoot()
Is this the root of a property node tree?private boolean
private static String
private void
toString()
If this node has a property value, returns the value of that property.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface gw.lang.reflect.gs.IGosuObject
equals, hashCode
-
Field Details
-
_parent
-
_name
-
_path
-
_propertySet
-
_children
-
-
Constructor Details
-
PropertyNode
-
-
Method Details
-
buildTree
-
getFullName
The full property name, for example a.b- Returns:
- a non null name, which must be one or more valid Gosu identifiers separated by periods
-
getRelativeName
The last part of the property name, for example b if the full name is a.b- Returns:
- a non null name, which must be a valid Gosu identifier
-
getTypeName
Return the name that should be used for the type based on this property node- Returns:
- a non null type name
-
getIntrinsicType
Return the intrinsic type based on this property node- Specified by:
getIntrinsicType
in interfaceIGosuObject
- Returns:
- intrinsic type
-
hasValue
public boolean hasValue()Does this property node have a value in the underlyingPropertySet
- Returns:
- true if the node has an underlying value, false otherwise
-
getValue
Return the value for this property as given by the underlyingPropertySet
- Returns:
- the property value, or null if it doesn't have one
-
isLeaf
public boolean isLeaf()Is this a leaf node - that is, does it have no children?- Returns:
- true if this node has no children, false otherwise
-
isRoot
public boolean isRoot()Is this the root of a property node tree?- Returns:
- true if this is the root, false otherwise
-
getChildren
The direct children of this property node- Returns:
- a non null, though possibly empty, list of children
-
getChildValue
Return the value for the named child property; this is just like doing lookup on the underlyingPropertySet
except that the name is prefixed with the full name of this property. For example if this property is a then getting the child value b.c will return the value of a.b.c in the original property set- Parameters:
name
- non null name of child property- Returns:
- the child property value, or null if there is no such child property
-
toString
If this node has a property value, returns the value of that property. Otherwise returns a string describing the property name.- Specified by:
toString
in interfaceIGosuObject
- Overrides:
toString
in classObject
-
getChild
-
addChild
-
isUseless
private boolean isUseless() -
removeUseless
private void removeUseless() -
isGosuIdentifier
-
isGosuIdentifierStart
private static boolean isGosuIdentifierStart(char ch) -
isGosuIdentifierPart
private static boolean isGosuIdentifierPart(char ch) -
join
-
getName
-
getPath
-
getParent
-