public class Chunk extends ToString
Diff,
Delta| Modifier and Type | Field and Description |
|---|---|
protected int |
anchor |
protected List<Object> |
chunk |
protected int |
count |
| Constructor and Description |
|---|
Chunk(int pos,
int count)
Creates a chunk that doesn't copy the original text.
|
Chunk(List<Object> iseq,
int pos,
int count)
Creates a chunk and saves a copy the original chunk's text.
|
Chunk(List<Object> iseq,
int pos,
int count,
int offset)
Creates a chunk that will be displaced in the resulting text, and saves a copy the original
chunk's text.
|
Chunk(Object[] iseq,
int pos,
int count)
Creates a chunk and saves a copy the original chunk's text.
|
Chunk(Object[] iseq,
int pos,
int count,
int offset)
Creates a chunk that will be displaced in the resulting text, and saves a copy the original
chunk's text.
|
| Modifier and Type | Method and Description |
|---|---|
int |
anchor()
Returns the anchor position of the chunk.
|
void |
applyAdd(int start,
List<Object> target)
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.
|
List<Object> |
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.
|
String |
rangeString()
Provide a string representation of the numeric range of this chunk.
|
void |
rangeString(StringBuilder s)
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.
|
static <T> List<T> |
slice(List<T> seq,
int pos,
int count)
Retrieves the specified part from a
List. |
static List<Object> |
slice(Object[] seq,
int pos,
int count)
Retrieves a slice from an
Object array. |
void |
toString(StringBuilder s)
Provide a string image of the chunk using the an empty prefix and postfix.
|
StringBuilder |
toString(StringBuilder s,
String prefix,
String postfix)
Provide a string image of the chunk using the given prefix and postfix.
|
boolean |
verify(List<Object> target)
Verifies that this chunk's saved text matches the corresponding text in the given sequence.
|
arrayToString, arrayToString, stringToArray, toStringpublic Chunk(int pos,
int count)
pos - the start position in the text.count - the size of the chunk.public Chunk(Object[] iseq, int pos, int count)
iseq - the original text.pos - the start position in the text.count - the size of the chunk.public Chunk(Object[] iseq, int pos, int count, int offset)
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.public Chunk(List<Object> iseq, int pos, int count)
iseq - the original text.pos - the start position in the text.count - the size of the chunk.public Chunk(List<Object> iseq, int pos, int count, int offset)
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.public int anchor()
public int size()
public int first()
public int last()
public int rcsfrom()
public int rcsto()
public boolean verify(List<Object> target)
target - the sequence to verify against.public void applyDelete(List<Object> target)
target - the text to delete from.public void applyAdd(int start,
List<Object> target)
start - where to add the text.target - the text to add to.public void toString(StringBuilder s)
public StringBuilder toString(StringBuilder s, String prefix, String postfix)
s - where the string image should be appended.prefix - the text that should prefix each line.postfix - the text that should end each line.public static <T> List<T> slice(List<T> seq, int pos, int count)
List.T - the type of objects contained in seqseq - the list to retrieve a slice from.pos - the start position.count - the number of items in the slice.List containing the specified items.public static List<Object> slice(Object[] seq, int pos, int count)
Object array.seq - the list to retrieve a slice from.pos - the start position.count - the number of items in the slice.List containing the specified items.public String rangeString()
public void rangeString(StringBuilder s)
s - where the string representation should be appended.public void rangeString(StringBuilder s, String separ)
s - where the string representation should be appended.separ - what to use as line separator.Copyright © 2006–2015 Apache Software Foundation. All rights reserved.