|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.dartra.standard.StringProperties
Simple class to hold properties (name-value) pairs. This class can parse name-value strings and returns the contained properties as a name-value pair string using the toString() method.
This class is used by game implementation classes to put their specific properties in a string representation. This representation can be saved to a persistent store. Since it is a string it allows for queries that take these specialized properties into account (e.g. give me all x01-games with as start score 301).
Constructor Summary | |
StringProperties()
Create an empty collection of string name-value properties. |
|
StringProperties(java.lang.String properties)
Create a collection of name-value properties based on the properties present in given string. |
Method Summary | |
boolean |
getBooleanProperty(java.lang.String name)
Returns the value of named property as a boolean. |
int[] |
getIntArrayProperty(java.lang.String name)
Returns the value of named comma separated property as an int[]. |
int |
getIntProperty(java.lang.String name)
Returns the value of named property as an int. |
java.lang.String |
getProperty(java.lang.String name)
Returns the value of named property, or null if the property is not known. |
java.util.Enumeration |
getPropertyNames()
Get an iterator listing the known property names. |
java.lang.String[] |
getStringArrayProperty(java.lang.String name)
Returns the value of named comma separated property as an String[]. |
void |
setAllProperties(StringProperties props)
Add all properties of given properties collection to this collection; |
void |
setProperty(java.lang.String name,
boolean value)
Set named property to given value. |
void |
setProperty(java.lang.String name,
int value)
Set named property to given value. |
void |
setProperty(java.lang.String name,
int[] values)
Set named property to given value. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Set named property to given value. |
void |
setProperty(java.lang.String name,
java.lang.String[] values)
Set named property to given value. |
int |
size()
Returns the number of known properties. |
java.lang.String |
toString()
Returns a string representation of the properties contained by this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StringProperties()
Create an empty collection of string name-value properties.
public StringProperties(java.lang.String properties)
Create a collection of name-value properties based on the properties present in given string.
properties
- The properties string, of format (name=value' ')*, for instance
"a=b c=d".Method Detail |
public void setProperty(java.lang.String name, java.lang.String value)
Set named property to given value. If a property with given name already exists, the previous value is replaced.
public void setProperty(java.lang.String name, boolean value)
Set named property to given value. If a property with given name already exists, the previous value is replaced.
public void setProperty(java.lang.String name, int value)
Set named property to given value. If a property with given name already exists, the previous value is replaced.
public void setProperty(java.lang.String name, int[] values)
Set named property to given value. If a property with given name already exists, the previous value is replaced.
public void setProperty(java.lang.String name, java.lang.String[] values)
Set named property to given value. If a property with given name already exists, the previous value is replaced.
public java.lang.String getProperty(java.lang.String name)
Returns the value of named property, or null if the property is not known.
public boolean getBooleanProperty(java.lang.String name)
Returns the value of named property as a boolean.
public int getIntProperty(java.lang.String name)
Returns the value of named property as an int.
public int[] getIntArrayProperty(java.lang.String name)
Returns the value of named comma separated property as an int[].
public java.lang.String[] getStringArrayProperty(java.lang.String name)
Returns the value of named comma separated property as an String[].
public java.util.Enumeration getPropertyNames()
Get an iterator listing the known property names.
public int size()
Returns the number of known properties.
public void setAllProperties(StringProperties props)
Add all properties of given properties collection to this collection;
public java.lang.String toString()
Returns a string representation of the properties contained by this object. This string can be parsed by the contructor.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |