Package jflex.generator
Class CountEmitter
- java.lang.Object
-
- jflex.generator.PackEmitter
-
- jflex.generator.CountEmitter
-
public class CountEmitter extends PackEmitter
An emitter for an array encoded as count/value pairs in a string.- Version:
- JFlex 1.8.1
- Author:
- Gerwin Klein
-
-
Field Summary
-
Fields inherited from class jflex.generator.PackEmitter
chunks, name, out
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CountEmitter(String name)
Create a count/value emitter for a specific field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
emit(int count, int value)
Emit one count/value pair.void
emitCountValueString(int[] a)
Emits a plain int array as a count/value string.void
emitUnpack()
Emits count/value unpacking code for the generated array.void
setValTranslation(int i)
Translate all values by given amount.
-
-
-
Constructor Detail
-
CountEmitter
protected CountEmitter(String name)
Create a count/value emitter for a specific field.- Parameters:
name
- name of the generated array
-
-
Method Detail
-
emitUnpack
public void emitUnpack()
Emits count/value unpacking code for the generated array.- Specified by:
emitUnpack
in classPackEmitter
- See Also:
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].
-
emit
public void emit(int count, int value)
Emit one count/value pair.Automatically translates value by the
translate
value.- Parameters:
count
- a int.value
- a int.- See Also:
setValTranslation(int)
-
emitCountValueString
public void emitCountValueString(int[] a)
Emits a plain int array as a count/value string. Expects the preamble code (declaration, javadoc) to already be emitted. Values in the array must be no larger than 0xFFFF (encoded as char), array must have at least one element.
-
-