public final class NaiveSequenceSlicer extends Object
The slice does modify the original sequences.
Note: Using this class may lead to problems in the execution of the Diff-X algorithm and incorrect results, because it could potentially take off some parts that helps the Diff-X algorithm ensuring that the XML is well-formed.
Constructor and Description |
---|
NaiveSequenceSlicer(EventSequence seq0,
EventSequence seq1)
Creates a new sequence slicer.
|
Modifier and Type | Method and Description |
---|---|
void |
formatEnd(DiffXFormatter formatter)
Formats the end subsequence that has been buffered by this class.
|
void |
formatStart(DiffXFormatter formatter)
Formats the start subsequence that has been buffered by this class.
|
EventSequence |
getEnd()
Returns the current end sequence buffer.
|
EventSequence |
getStart()
Returns the current start sequence buffer.
|
int |
sliceEnd()
Slices the end of both sequences.
|
int |
sliceEnd(DiffXFormatter formatter)
Slices the end of both sequences and formats the start subsequence with the specified
formatter.
|
int |
sliceStart()
Slices the start of both sequences.
|
int |
sliceStart(DiffXFormatter formatter)
Slices the start of both sequences and formats the start subsequence with the specified
formatter.
|
public NaiveSequenceSlicer(EventSequence seq0, EventSequence seq1)
seq0
- The first sequence to slice.seq1
- The second sequence to slice.public int sliceStart() throws IllegalStateException
The common start sequence will be stroed in the class until the next
formatStart(DiffXFormatter)
is called.
IllegalStateException
- If the start buffer is not empty.public int sliceEnd() throws IllegalStateException
The common end sequence will be stored in the class until the next
formatEnd(DiffXFormatter)
is called.
IllegalStateException
- If the end buffer is not empty.public int sliceStart(DiffXFormatter formatter) throws IllegalStateException, NullPointerException, IOException
Implementation note: although this is functionally equivalent to call successively the
methods sliceStart()
and formatStart(DiffXFormatter)
, this method is
optimised and passes the event directly to the formatter without using a buffer.
formatter
- The formatter that will handle the output.IllegalStateException
- If the start buffer is not empty.NullPointerException
- If the specified formatter is null
.IOException
- If an error occurs whilst writing with the formatter.public int sliceEnd(DiffXFormatter formatter) throws IllegalStateException, NullPointerException, IOException
Implementation note: although this is exactly equivalent to successive calls to the
methods sliceEnd()
and formatEnd(DiffXFormatter)
.
formatter
- The formatter that will handle the output.IllegalStateException
- If the end buffer is not empty.NullPointerException
- If the specified formatter is null
.IOException
- If an error occurs whilst writing with the formatter.public void formatStart(DiffXFormatter formatter) throws NullPointerException, IOException
This method will clear the buffer, but will do nothing if the start buffer is
null
.
formatter
- The formatter that will handle the output.NullPointerException
- If the specified formatter is null
.IOException
- If an error occurs whilst writing with the formatter.public void formatEnd(DiffXFormatter formatter) throws NullPointerException, IOException
This method will clear the buffer, but will do nothing if the end buffer is
null
.
formatter
- The formatter that will handle the output.NullPointerException
- If the specified formatter is null
.IOException
- If an error occurs whilst writing with the formatter.public EventSequence getStart()
null
if none.public EventSequence getEnd()
null
if none.Copyright © 2007-2019. All Rights Reserved.