Class DiffXEventBase

java.lang.Object
com.topologi.diffx.event.impl.DiffXEventBase
All Implemented Interfaces:
DiffXEvent, XMLFormattable, XMLWritable
Direct Known Subclasses:
AttributeEventImpl, AttributeEventNSImpl, CharactersEventBase, CharEvent, CloseElementEventImpl, CloseElementEventNSImpl, CommentEvent, LineEvent, OpenElementEventImpl, OpenElementEventNSImpl, ProcessingInstructionEvent, XMLBranchEvent

abstract class DiffXEventBase extends Object implements DiffXEvent
A base class for DiffX events.

This class is purely provided for convenience and consistency, it is best, althouhg not strictly required, that most DiffXEvent implementations extend this class.

Version:
3 February 2005
  • Field Details

    • ESC

      static final XMLEscape ESC
      For use by the events to escape XML chars.
    • weight

      int weight
  • Constructor Details

    • DiffXEventBase

      DiffXEventBase()
  • Method Details

    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(DiffXEvent e)
      Indicates whether the specified event is equal to this event.
      Specified by:
      equals in interface DiffXEvent
      Parameters:
      e - The event to compare it with thsi one.
      Returns:
      true if considered equals; false otherwise.
    • equals

      public final boolean equals(Object o)
      Invokes the DiffXEvent.equals(DiffXEvent) method if the specified object if not null and is an instance of DiffXEvent.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare.
      Returns:
      true if the specified object is equal; false otherwise.
    • toXML

      public String toXML()
      Description copied from interface: 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();
      Specified by:
      toXML in interface XMLFormattable
      Returns:
      a XML representation of the object of the implementing class.
    • getWeight

      public int getWeight()
      Description copied from interface: DiffXEvent
      Returns the weight of this event.

      The default weight should be 1.

      Specified by:
      getWeight in interface DiffXEvent
      Returns:
      The weight of this event.
    • setWeight

      public void setWeight(int weight)
      Description copied from interface: DiffXEvent
      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:
      setWeight in interface DiffXEvent
      Parameters:
      weight - The weight of this event.