Class IgnorableSpaceEvent
- All Implemented Interfaces:
DiffXEvent,TextEvent,XMLFormattable,XMLWritable
This class can be used to ignore whitespaces for processing but preserve them for formatting. This event keeps the exact formatting of the white space henceby preserving it, but will consider any instances of this class to be equal regardless of their actual formatting so that the algorithm ignores the differences.
- Version:
- 28 March 2010
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ignorable white space event. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(DiffXEvent e) Returnstrueif the event is an ignorable white space, regardless of the characters that it matches.booleanReturnstrueif the event is an ignorable white space, regardless of the characters that it matches.Returns the characters that this event represents.intReturns the weight of this event.inthashCode()Always returns the same value.voidsetWeight(int weight) Ignored.toString()Returns "ignorable-space".toXML()Returns a xml representation of the object of the implementing class.voidWrites the XML representation of the implementing instance using the specifiedXMLWriter.toXML(StringBuffer xml) Appends the XML representation of the object of the implementing class.
-
Field Details
-
characters
The characters for this event.
-
-
Constructor Details
-
IgnorableSpaceEvent
Creates a new ignorable white space event.- Parameters:
seq- The char sequence.- Throws:
NullPointerException- If the given String isnull.
-
-
Method Details
-
toString
Returns "ignorable-space". -
hashCode
public int hashCode()Always returns the same value. -
equals
Returnstrueif the event is an ignorable white space, regardless of the characters that it matches. -
equals
Returnstrueif the event is an ignorable white space, regardless of the characters that it matches.- Specified by:
equalsin interfaceDiffXEvent- 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
Description copied from interface:XMLWritableWrites 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
Description copied from interface:XMLFormattableReturns a xml representation of the object of the implementing class.
Most implementation should use the following code to ensure consistent data with the other
toXMLmethod:return this.toXML(new StringBuffer()).toString();
- Specified by:
toXMLin interfaceXMLFormattable- Returns:
- a XML representation of the object of the implementing class.
-
toXML
Description copied from interface:XMLFormattableAppends 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.
-
getWeight
public int getWeight()Description copied from interface:DiffXEventReturns the weight of this event.The default weight should be 1.
- Specified by:
getWeightin interfaceDiffXEvent- Returns:
- The weight of this event.
-
setWeight
public void setWeight(int weight) Ignored. Sets the weight of this event.This method is intended for use by algorithms, optimisers and loaders in order to adjust the importance of an event.
- Specified by:
setWeightin interfaceDiffXEvent- Parameters:
weight- The weight of this event.
-