Package com.topologi.diffx.event.impl
Class CharactersEventBase
java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.CharactersEventBase
- All Implemented Interfaces:
DiffXEvent,TextEvent,XMLFormattable,XMLWritable
- Direct Known Subclasses:
CharactersEvent,SpaceEvent,WordEvent
A base class for all the characters events "characters" SAX event.
- Version:
- 28 March 2010
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe characters for this event.private final intA suitable hashCode for this event.Fields inherited from class com.topologi.diffx.event.impl.DiffXEventBase
ESC, weight -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanequals(DiffXEvent e) Returnstrueif the event is a character event and its content is equivalent.final StringReturns the characters that this event represents.final inthashCode()private static intCalculates the hashcode value from a string.final voidWrites the XML representation of the implementing instance using the specifiedXMLWriter.final StringBuffertoXML(StringBuffer xml) Appends the XML representation of the object of the implementing class.Methods inherited from class com.topologi.diffx.event.impl.DiffXEventBase
equals, getWeight, setWeight, toXMLMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.topologi.diffx.event.DiffXEvent
getWeight, setWeightMethods inherited from interface com.topologi.diffx.xml.XMLFormattable
toXML
-
Field Details
-
characters
The characters for this event. -
hashCode
private final int hashCodeA suitable hashCode for this event.
-
-
Constructor Details
-
CharactersEventBase
Creates a new characters event.- Parameters:
seq- The char sequence.- Throws:
NullPointerException- If the given String isnull.
-
-
Method Details
-
hashCode
public final int hashCode()- Specified by:
hashCodein classDiffXEventBase
-
equals
Returnstrueif the event is a character event and its content is equivalent.- Specified by:
equalsin interfaceDiffXEvent- Specified by:
equalsin classDiffXEventBase- Parameters:
e- The event to compare with this event.- Returns:
trueif considered equal;falseotherwise.
-
getCharacters
Returns the characters that this event represents.Note: this method will return the characters as used by Java (ie. Unicode), they may not be suitable for writing to an XML string.
- Specified by:
getCharactersin interfaceTextEvent- Returns:
- The characters that this event represents.
-
toXML
Writes the XML representation of the implementing instance using the specifiedXMLWriter.- Specified by:
toXMLin interfaceXMLWritable- Parameters:
xml- The XMLWriter to use.- Throws:
IOException- IF an I/O exception occurs whilst writing.
-
toXML
Appends the XML representation of the object of the implementing class.Implementations must ensure that the returned string buffer is the same object as the specified string buffer.
- Specified by:
toXMLin interfaceXMLFormattable- Parameters:
xml- The string buffer to which the XML representation is appended to.- Returns:
- The modified string buffer.
- Throws:
NullPointerException- if the specified character sequence isnull.
-
toHashCode
Calculates the hashcode value from a string.- Parameters:
s- A string from which to calculate the hashcode.- Returns:
- a suitable hashcode value.
-