net.sf.freecol.common.model
Class HistoryEvent

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.StringTemplate
          extended by net.sf.freecol.common.model.HistoryEvent

public class HistoryEvent
extends StringTemplate


Nested Class Summary
static class HistoryEvent.EventType
           
 
Nested classes/interfaces inherited from class net.sf.freecol.common.model.StringTemplate
StringTemplate.TemplateType
 
Field Summary
private  HistoryEvent.EventType eventType
          The type of event.
private  Turn turn
          The turn in which the event took place
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
HistoryEvent()
           
HistoryEvent(Turn turn, HistoryEvent.EventType eventType)
           
 
Method Summary
 HistoryEvent add(java.lang.String key, java.lang.String value)
          Add a new key and replacement to the HistoryEvent.
 HistoryEvent addAmount(java.lang.String key, int amount)
          Add a key and an integer value to replace it to this StringTemplate.
 HistoryEvent addName(java.lang.String key, java.lang.String value)
          Add a new key and replacement to the HistoryEvent.
 HistoryEvent addStringTemplate(java.lang.String key, StringTemplate template)
          Add a key and a StringTemplate to replace it to this StringTemplate.
 HistoryEvent.EventType getEventType()
          Get the EventType value.
 Turn getTurn()
          Get the int value.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setEventType(HistoryEvent.EventType newEventType)
          Set the EventType value.
 void setTurn(Turn newInt)
          Set the int value.
 java.lang.String toString()
          Builds a string representation of this object.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.model.StringTemplate
add, addAmount, addName, addName, addStringTemplate, equals, getDefaultId, getKeys, getReplacement, getReplacements, getTemplateType, hashCode, key, label, name, readAttributes, readChildren, setDefaultId, template, writeChildren
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

turn

private Turn turn
The turn in which the event took place


eventType

private HistoryEvent.EventType eventType
The type of event.

Constructor Detail

HistoryEvent

public HistoryEvent()

HistoryEvent

public HistoryEvent(Turn turn,
                    HistoryEvent.EventType eventType)
Method Detail

getTurn

public final Turn getTurn()
Get the int value.

Returns:
a int value

setTurn

public final void setTurn(Turn newInt)
Set the int value.

Parameters:
newInt - The new int value.

getEventType

public final HistoryEvent.EventType getEventType()
Get the EventType value.

Returns:
a EventType value

setEventType

public final void setEventType(HistoryEvent.EventType newEventType)
Set the EventType value.

Parameters:
newEventType - The new EventType value.

add

public HistoryEvent add(java.lang.String key,
                        java.lang.String value)
Add a new key and replacement to the HistoryEvent. This is only possible if the HistoryEvent is of type TEMPLATE.

Overrides:
add in class StringTemplate
Parameters:
key - a String value
value - a String value
Returns:
a HistoryEvent value

addName

public HistoryEvent addName(java.lang.String key,
                            java.lang.String value)
Add a new key and replacement to the HistoryEvent. The replacement must be a proper name. This is only possible if the HistoryEvent is of type TEMPLATE.

Overrides:
addName in class StringTemplate
Parameters:
key - a String value
value - a String value
Returns:
a HistoryEvent value

addAmount

public HistoryEvent addAmount(java.lang.String key,
                              int amount)
Add a key and an integer value to replace it to this StringTemplate.

Parameters:
key - a String value
amount - an int value
Returns:
a HistoryEvent value

addStringTemplate

public HistoryEvent addStringTemplate(java.lang.String key,
                                      StringTemplate template)
Add a key and a StringTemplate to replace it to this StringTemplate.

Overrides:
addStringTemplate in class StringTemplate
Parameters:
key - a String value
template - a StringTemplate value
Returns:
a HistoryEvent value

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Overrides:
toXMLImpl in class StringTemplate
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class StringTemplate
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Overrides:
readFromXMLImpl in class FreeColObject
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

toString

public java.lang.String toString()
Builds a string representation of this object.

Overrides:
toString in class StringTemplate

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
the tag name.