Class LineEvent

java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
com.topologi.diffx.event.impl.LineEvent
All Implemented Interfaces:
DiffXEvent, TextEvent, XMLFormattable, XMLWritable

public final class LineEvent extends DiffXEventBase implements TextEvent
An interface for any data that comes from a text node.
Version:
27 March 2010
  • Field Details

    • characters

      private final CharSequence characters
      The characters for this event.
    • lineNumber

      private final int lineNumber
      The line number.
    • hashCode

      private final int hashCode
      Hashcode value for this class
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Description copied from class: DiffXEventBase
      Specified by:
      hashCode in class DiffXEventBase
    • equals

      public boolean equals(DiffXEvent e)
      Returns true if the event is a character event and the content is equivalent.
      Specified by:
      equals in interface DiffXEvent
      Specified by:
      equals in class DiffXEventBase
      Parameters:
      e - The event to compare with this event.
      Returns:
      true if considered equal; false otherwise.
    • getCharacters

      public String 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:
      getCharacters in interface TextEvent
      Returns:
      The characters that this event represents.
    • getLineNumber

      public int getLineNumber()
      Returns the line number.
      Returns:
      The line number.
    • toXML

      public void toXML(XMLWriter xml) throws IOException
      Description copied from interface: XMLWritable
      Writes the XML representation of the implementing instance using the specified XMLWriter.
      Specified by:
      toXML in interface XMLWritable
      Parameters:
      xml - The XMLWriter to use.
      Throws:
      IOException - IF an I/O exception occurs whilst writing.
    • toXML

      public StringBuffer toXML(StringBuffer xml) throws NullPointerException
      Description copied from interface: XMLFormattable
      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:
      toXML in interface XMLFormattable
      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 is null.
    • toHashCode

      private int toHashCode(CharSequence comment)
      Calculates the hashcode for this event.
      Parameters:
      comment - The comment string.
      Returns:
      a number suitable as a hashcode.