public final class IgnorableSpaceEvent extends Object implements TextEvent
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.
Constructor and Description |
---|
IgnorableSpaceEvent(CharSequence seq)
Creates a new ignorable white space event.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(DiffXEvent e)
Returns
true if the event is an ignorable white space, regardless of the
characters that it matches. |
boolean |
equals(Object o)
Returns
true if the event is an ignorable white space, regardless of the
characters that it matches. |
String |
getCharacters()
Returns the characters that this event represents.
|
int |
getWeight()
Returns the weight of this event.
|
int |
hashCode()
Always returns the same value.
|
void |
setWeight(int weight)
Ignored.
|
String |
toString()
Returns "ignorable-space".
|
String |
toXML()
Returns a xml representation of the object of the implementing class.
|
StringBuffer |
toXML(StringBuffer xml)
Appends the XML representation of the object of the implementing class.
|
void |
toXML(XMLWriter xml)
Writes the XML representation of the implementing instance using the specified
XMLWriter . |
public IgnorableSpaceEvent(CharSequence seq) throws NullPointerException
seq
- The char sequence.NullPointerException
- If the given String is null
.public boolean equals(Object o)
true
if the event is an ignorable white space, regardless of the
characters that it matches.public boolean equals(DiffXEvent e)
true
if the event is an ignorable white space, regardless of the
characters that it matches.equals
in interface DiffXEvent
e
- The event to compare with this event.true
if considered equal;
false
otherwise.public String getCharacters()
Note: this method will return the characters as used by Java (ie. Unicode), they may not be suitable for writing to an XML string.
getCharacters
in interface TextEvent
public void toXML(XMLWriter xml) throws IOException
XMLWritable
XMLWriter
.toXML
in interface XMLWritable
xml
- The XMLWriter to use.IOException
- IF an I/O exception occurs whilst writing.public String toXML()
XMLFormattable
Returns a xml representation of the object of the implementing class.
Most implementation should use the following code to ensure consistent data with the
other toXML
method:
return this.toXML(new StringBuffer()).toString();
toXML
in interface XMLFormattable
public StringBuffer toXML(StringBuffer xml) throws NullPointerException
XMLFormattable
Implementations must ensure that the returned string buffer is the same object as the specified string buffer.
toXML
in interface XMLFormattable
xml
- The string buffer to which the XML representation is appended to.NullPointerException
- if the specified character sequence is null
.public int getWeight()
DiffXEvent
The default weight should be 1.
getWeight
in interface DiffXEvent
public void setWeight(int weight)
This method is intended for use by algorithms, optimisers and loaders in order to adjust the importance of an event.
setWeight
in interface DiffXEvent
weight
- The weight of this event.Copyright © 2007-2018. All Rights Reserved.