com.topologi.diffx.event.impl
Class SpaceEvent

java.lang.Object
  extended bycom.topologi.diffx.event.impl.DiffXEventBase
      extended bycom.topologi.diffx.event.impl.CharactersEventBase
          extended bycom.topologi.diffx.event.impl.SpaceEvent
All Implemented Interfaces:
DiffXEvent, TextEvent, XMLFormattable, XMLWritable

public final class SpaceEvent
extends CharactersEventBase
implements TextEvent

A particular type of event reserved for white spaces.

Version:
23 December 2004
Author:
Christophe Lauret (Allette Systems)

Field Summary
static SpaceEvent DOUBLE_WHITESPACE
          A static instance for the double whitespaces.
static SpaceEvent NEW_LINE
          A static instance for the new lines.
static SpaceEvent SINGLE_WHITESPACE
          A static instance for the single whitespaces.
static SpaceEvent TAB
          A static instance for tabs.
 
Constructor Summary
SpaceEvent(CharSequence w)
          Creates a new word event.
 
Method Summary
static SpaceEvent getInstance(CharSequence space)
          Returns the white space event corresponding to the given string.
 String toString()
           
 
Methods inherited from class com.topologi.diffx.event.impl.CharactersEventBase
equals, equals, getCharacters, getWeight, hashCode, setWeight, toXML, toXML, toXML
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.topologi.diffx.event.TextEvent
getCharacters
 
Methods inherited from interface com.topologi.diffx.event.DiffXEvent
equals, getWeight, setWeight
 
Methods inherited from interface com.topologi.diffx.xml.XMLWritable
toXML
 
Methods inherited from interface com.topologi.diffx.xml.XMLFormattable
toXML, toXML
 

Field Detail

SINGLE_WHITESPACE

public static final SpaceEvent SINGLE_WHITESPACE
A static instance for the single whitespaces.

Use this constant instead of creating new instances


DOUBLE_WHITESPACE

public static final SpaceEvent DOUBLE_WHITESPACE
A static instance for the double whitespaces.

Use this constant instead of creating new instances


NEW_LINE

public static final SpaceEvent NEW_LINE
A static instance for the new lines.

Use this constant instead of creating new instances


TAB

public static final SpaceEvent TAB
A static instance for tabs.

Use this constant instead of creating new instances

Constructor Detail

SpaceEvent

public SpaceEvent(CharSequence w)
           throws NullPointerException
Creates a new word event.

Parameters:
w - The word as a string.
Throws:
NullPointerException - If the given String is null.
Method Detail

toString

public String toString()
See Also:
Object.toString()

getInstance

public static SpaceEvent getInstance(CharSequence space)
Returns the white space event corresponding to the given string.

Parameters:
space - The string for the white space event.
Returns:
A readable string.