JFlex

Class CountEmitter


public class CountEmitter
extends PackEmitter

An emitter for an array encoded as count/value pairs in a string.

Field Summary

Fields inherited from class JFlex.PackEmitter

chunks, name, out

Constructor Summary

CountEmitter(String name)
Create a count/value emitter for a specific field.

Method Summary

void
emit(int count, int value)
Emit one count/value pair.
void
emitUnpack()
Emits count/value unpacking code for the generated array.
void
setValTranslation(int i)
Translate all values by given amount.

Methods inherited from class JFlex.PackEmitter

breaks, constName, emitInit, emitUC, emitUnpack, nl, println, toString

Constructor Details

CountEmitter

protected CountEmitter(String name)
Create a count/value emitter for a specific field.
Parameters:
name - name of the generated array

Method Details

emit

public void emit(int count,
                 int value)
Emit one count/value pair. Automatically translates value by the translate value.
Parameters:
count -
value -

emitUnpack

public void emitUnpack()
Emits count/value unpacking code for the generated array.
Overrides:
emitUnpack in interface PackEmitter
See Also:
JFlex.PackEmitter.emitUnPack()

setValTranslation

public void setValTranslation(int i)
Translate all values by given amount. Use to move value interval from [0, 0xFFFF] to something different.
Parameters:
i - amount the value will be translated by. Example: i = 1 allows values in [-1, 0xFFFE].