public class InfiniteCharacterTape extends AbstractInfiniteTape<Integer>
Character is not sufficient to represent each Unicode character. Actually, two
chars are needed, a high and a low surrogate one. Therefore, we use Integer here.
Overflow is handled such that each value on tape is in the range between
Character.MIN_CODE_POINT and Character.MAX_CODE_POINT, decrementing on the
minimum value leads to the maximum one and vice versa.
Reading EOF:
There's the special case of TapeEofBehaviour.READS_MINUS_ONE. Then, on reading EOF
from the input stream, the tape will contain a -1, which denotes no legal Character and behaves as
follows:
0,Character.MAX_CODE_POINT.NUL character.See the unit tests for details.
| Constructor and Description |
|---|
InfiniteCharacterTape(Charset charset,
TapeEofBehaviour eofBehaviour) |
| Modifier and Type | Method and Description |
|---|---|
protected TapeSegment<Integer> |
createSegment() |
void |
decrement() |
void |
increment() |
boolean |
isZero() |
void |
readTo(DataOutput output) |
void |
writeFrom(DataInput input) |
createNextSegment, getOrCreateNextSegment, getOrCreatePreviousSegment, moveBackward, moveForward, read, writepublic InfiniteCharacterTape(Charset charset, TapeEofBehaviour eofBehaviour)
protected TapeSegment<Integer> createSegment()
createSegment in class AbstractInfiniteTape<Integer>public void increment()
public void decrement()
public void readTo(DataOutput output) throws TapeIOException
TapeIOExceptionpublic void writeFrom(DataInput input) throws TapeIOException
TapeIOExceptionpublic boolean isZero()
Copyright © 2018. All rights reserved.