Package com.topologi.diffx.sequence
Class EventSequence
java.lang.Object
com.topologi.diffx.sequence.EventSequence
A sequence of events used for the Diff-X algorithm.
This class wraps a list of DiffXEvents and provide method to
access and modify the content of the list using strongly typed methods.
- Since:
- 0.7
- Version:
- 6 December 2008
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classAn iterator over the event elements in the sequences. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PrefixMappingThe prefix mapping for the elements in this sequence.private final List<DiffXEvent>The sequence of events. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new event sequence.EventSequence(int size) Creates a new event sequence of the specified size. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEvent(int i, DiffXEvent e) Inserts an event to this sequence at the specified position.voidAdds an event to this sequence.voidaddSequence(EventSequence seq) Adds a sequence of events to this sequence.booleanequals(EventSequence seq) Returnstrueif the specified event sequence is the same as this one.booleanReturnstrueif the specified event sequence is the same as this one.Returns a event iterator for this list.events()Returns the sequence of events.voidExport the sequence.getEvent(int i) Returns the event at position i.Returns the prefix mapping for the namespace URIs in this sequence.inthashCode()voidMaps a namespace URI to a prefix.removeEvent(int index) Removes an event from this sequence at the specified position.setEvent(int index, DiffXEvent e) Replaces an event of this sequence at the specified position.intsize()The size of the sequence.toString()Returns the string representation of this sequence.
-
Field Details
-
prefixMapping
The prefix mapping for the elements in this sequence. -
sequence
The sequence of events.
-
-
Constructor Details
-
EventSequence
public EventSequence()Creates a new event sequence. -
EventSequence
public EventSequence(int size) Creates a new event sequence of the specified size.- Parameters:
size- The size of the sequence.
-
-
Method Details
-
addSequence
Adds a sequence of events to this sequence.- Parameters:
seq- The sequence of events to be added.
-
addEvent
Adds an event to this sequence.- Parameters:
e- The event to be added.
-
addEvent
Inserts an event to this sequence at the specified position.- Parameters:
i- The position of the event.e- The event to be added.
-
getEvent
Returns the event at position i.- Parameters:
i- The position of the event.- Returns:
- the event at position i.
-
setEvent
Replaces an event of this sequence at the specified position.- Parameters:
index- The 0-based index of the position.e- The event to be inserted.- Returns:
- The event at the previous position.
-
removeEvent
Removes an event from this sequence at the specified position.- Parameters:
index- The 0-based index of the position.- Returns:
- The removed event.
-
size
public int size()The size of the sequence.- Returns:
- The number of events in the sequence.
-
eventIterator
Returns a event iterator for this list.- Returns:
- The event iterator for this sequence.
-
events
Returns the sequence of events.- Returns:
- the sequence of events.
-
hashCode
public int hashCode() -
equals
Returnstrueif the specified event sequence is the same as this one.- Parameters:
seq- The sequence of events to compare with this one.- Returns:
trueif the specified event sequence is equal to this one;falseotherwise.
-
equals
Returnstrueif the specified event sequence is the same as this one.This method will redirect to the
equals(EventSequence)method if the specified object is an instance ofEventSequence. -
toString
Returns the string representation of this sequence. -
export
Export the sequence.- Parameters:
w- The print writer receiving the SAX events.
-
mapPrefix
Maps a namespace URI to a prefix.- Parameters:
uri- The namespace URI to map.prefix- The prefix to use.- Throws:
NullPointerException- if the URI or prefix isnull- See Also:
-
getPrefixMapping
Returns the prefix mapping for the namespace URIs in this sequence.- Returns:
- the prefix mapping for the namespace URIs in this sequence.
-