java.lang.Object
org.apache.wicket.util.diff.ToString
org.apache.wicket.util.diff.Chunk
Holds a information about a part of the text involved in a differencing or patching operation.
- Version:
- $Id: Chunk.java,v 1.1 2006/03/12 00:24:21 juanca Exp $
- Author:
- Juanco Anez
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionChunk
(int pos, int count) Creates a chunk that doesn't copy the original text.Creates a chunk and saves a copy the original chunk's text.Creates a chunk that will be displaced in the resulting text, and saves a copy the original chunk's text.Creates a chunk and saves a copy the original chunk's text.Creates a chunk that will be displaced in the resulting text, and saves a copy the original chunk's text. -
Method Summary
Modifier and TypeMethodDescriptionint
anchor()
Returns the anchor position of the chunk.void
Add the text of this chunk to the target at the given position.void
applyDelete
(List<Object> target) Delete this chunk from he given text.chunk()
Returns the text saved for this chunk.int
first()
Returns the index of the first line of the chunk.int
last()
Returns the index of the last line of the chunk.Provide a string representation of the numeric range of this chunk.void
Provide a string representation of the numeric range of this chunk.void
rangeString
(StringBuilder s, String separ) Provide a string representation of the numeric range of this chunk.int
rcsfrom()
Returns the from index of the chunk in RCS terms.int
rcsto()
Returns the to index of the chunk in RCS terms.int
size()
Returns the size of the chunk.Retrieves a slice from anObject
array.static <T> List<T>
Retrieves the specified part from aList
.void
Provide a string image of the chunk using the an empty prefix and postfix.toString
(StringBuilder s, String prefix, String postfix) Provide a string image of the chunk using the given prefix and postfix.boolean
Verifies that this chunk's saved text matches the corresponding text in the given sequence.Methods inherited from class org.apache.wicket.util.diff.ToString
arrayToString, arrayToString, stringToArray, toString
-
Field Details
-
anchor
-
count
-
chunk
-
-
Constructor Details
-
Chunk
Creates a chunk that doesn't copy the original text.- Parameters:
pos
- the start position in the text.count
- the size of the chunk.
-
Chunk
Creates a chunk and saves a copy the original chunk's text.- Parameters:
iseq
- the original text.pos
- the start position in the text.count
- the size of the chunk.
-
Chunk
Creates a chunk that will be displaced in the resulting text, and saves a copy the original chunk's text.- Parameters:
iseq
- the original text.pos
- the start position in the text.count
- the size of the chunk.offset
- the position the chunk should have in the resulting text.
-
Chunk
Creates a chunk and saves a copy the original chunk's text.- Parameters:
iseq
- the original text.pos
- the start position in the text.count
- the size of the chunk.
-
Chunk
Creates a chunk that will be displaced in the resulting text, and saves a copy the original chunk's text.- Parameters:
iseq
- the original text.pos
- the start position in the text.count
- the size of the chunk.offset
- the position the chunk should have in the resulting text.
-
-
Method Details
-
anchor
Returns the anchor position of the chunk.- Returns:
- the anchor position.
-
size
Returns the size of the chunk.- Returns:
- the size.
-
first
Returns the index of the first line of the chunk.- Returns:
- int
-
last
Returns the index of the last line of the chunk.- Returns:
- int
-
rcsfrom
Returns the from index of the chunk in RCS terms.- Returns:
- int
-
rcsto
Returns the to index of the chunk in RCS terms.- Returns:
- int
-
chunk
Returns the text saved for this chunk.- Returns:
- the text.
-
verify
Verifies that this chunk's saved text matches the corresponding text in the given sequence.- Parameters:
target
- the sequence to verify against.- Returns:
- true if the texts match.
-
applyDelete
Delete this chunk from he given text.- Parameters:
target
- the text to delete from.
-
applyAdd
Add the text of this chunk to the target at the given position.- Parameters:
start
- where to add the text.target
- the text to add to.
-
toString
Provide a string image of the chunk using the an empty prefix and postfix. -
toString
Provide a string image of the chunk using the given prefix and postfix.- Parameters:
s
- where the string image should be appended.prefix
- the text that should prefix each line.postfix
- the text that should end each line.- Returns:
- StringBuilder
-
slice
Retrieves the specified part from aList
.- Type Parameters:
T
- the type of objects contained inseq
- Parameters:
seq
- the list to retrieve a slice from.pos
- the start position.count
- the number of items in the slice.- Returns:
- a
List
containing the specified items.
-
slice
Retrieves a slice from anObject
array.- Parameters:
seq
- the list to retrieve a slice from.pos
- the start position.count
- the number of items in the slice.- Returns:
- a
List
containing the specified items.
-
rangeString
Provide a string representation of the numeric range of this chunk.- Returns:
- String
-
rangeString
Provide a string representation of the numeric range of this chunk.- Parameters:
s
- where the string representation should be appended.
-
rangeString
Provide a string representation of the numeric range of this chunk.- Parameters:
s
- where the string representation should be appended.separ
- what to use as line separator.
-