com.eoi.freya.game
Class XMLObject
java.lang.Object
|
+--com.eoi.freya.game.XMLObject
- Direct Known Subclasses:
- BasePhase, BasicGroupList, BasicPlayer, OwnedObject
- public class XMLObject
- extends java.lang.Object
XMLObject is a simple object with a Name attribute and an element that contains information about that entity.
Is used as a base class for more specific objects.
NOTE : In general all set methods will create an element of that type if one doesn't exist,
while get methods throw NoSuchElement execeptions on unknown settings. getBoolean however returns false
if the setting is not found.
Field Summary |
protected org.jdom.Element |
info
info contains the info block that holds the XML representation of the object |
Constructor Summary |
XMLObject(org.jdom.Element e)
|
Method Summary |
void |
addElement(org.jdom.Element e)
|
org.jdom.Element |
getElement(java.lang.String name)
|
org.jdom.Element |
getInfo()
|
int |
getIntSetting(java.lang.String setting)
|
java.util.Iterator |
getIterator(java.lang.String children)
|
java.lang.String |
getName()
|
java.lang.String |
getSetting(java.lang.String setting)
|
boolean |
isSetting(java.lang.String setting)
Returns boolean true if the settings equals 'true', if otherwise false. |
void |
setBooleanSetting(java.lang.String setting,
boolean value)
|
void |
setInfo(org.jdom.Element info)
|
void |
setIntSetting(java.lang.String setting,
int value)
|
void |
setName(java.lang.String name)
|
void |
setSetting(java.lang.String setting,
java.lang.String value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
info
protected org.jdom.Element info
- info contains the info block that holds the XML representation of the object
XMLObject
public XMLObject(org.jdom.Element e)
getName
public java.lang.String getName()
- Returns:
- The NAME of the object
setName
public void setName(java.lang.String name)
- Parameters:
name
- The String NAME of the object.
getSetting
public java.lang.String getSetting(java.lang.String setting)
throws java.util.NoSuchElementException
- Parameters:
settings
- The String name of the setting required- Returns:
- A new String containing the value of the setting
setSetting
public void setSetting(java.lang.String setting,
java.lang.String value)
throws java.util.NoSuchElementException
- Parameters:
setting
- The String name of the setting to change or createvalue
- The String value to set the setting to.
getIntSetting
public int getIntSetting(java.lang.String setting)
throws java.util.NoSuchElementException
setIntSetting
public void setIntSetting(java.lang.String setting,
int value)
throws java.util.NoSuchElementException
getElement
public org.jdom.Element getElement(java.lang.String name)
getIterator
public java.util.Iterator getIterator(java.lang.String children)
getInfo
public org.jdom.Element getInfo()
setInfo
public void setInfo(org.jdom.Element info)
isSetting
public boolean isSetting(java.lang.String setting)
- Returns boolean true if the settings equals 'true', if otherwise false.
NOTE that unfound element return false.
setBooleanSetting
public void setBooleanSetting(java.lang.String setting,
boolean value)
addElement
public void addElement(org.jdom.Element e)
Freya Engine, The Turn Based Game Engine
Copyright(c) 2002 Alexander Bilton
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA