This class represents a table mapping tuples of strings to integer values. It is used by {@link LayeredTokenPattern} for matching patterns against{@link LayeredSequence} objects.
The core of this class is a mapping from string tuples of length {@code n} tointegers {@code 0 <= i <} {@link Encoder#MAX_SIZE}. The mapping is defined by a list of {@code n} sets of String symbols {@code S_1, ..., S_n}, and a special symbol {@link Encoder#UNK}. The mapping assigns an integer value to each tuple {@code (x_1, ..., x_n)}, where {@code x_i} is either in{@code S_i} or is the symbol {@code UNK}. For example, if {@code n=2} and{@code} S_1=S_2 = 0,1}}, then a possible mapping would be {@code (0,0) => 0, (0,1) => 1,(0, UNK) => 2, (1,0) => 3, (1,1) => 4, (1,UNK) => 5, (UNK,0) => 6, (UNK,1) => 7, (UNK,UNK) => 8}.
Given a String tuple {@code (x_1, ..., x_n)}, it is mapped to an integer value as follows. First, it is mapped to an intermediate tuple {@code (y_1, ..., y_n)}, where {@code y_i = x_i} if {@code x_i} is in{@code S_i}, otherwise {@code y_i = UNK}. Then the value of {@code (y_1, ..., y_n)} according to the mapping is returned. This procedureis implemented in the method {@link Encoder#encode(String[])}, which represents tuples as String arrays.
There is no guarantee on the actual integer values assigned to each tuple. The mapping cannot be larger than 2^16. This means that the product {@code (|S_1|+1) * (|S_2|+1) * ... * (|S_n| + 1)} must be less than or equalto 2^16.
@author afader@POST @Path("/") void create(User user);Example implementation:
public class GsonEncoder implements Encoder { private final Gson gson; public GsonEncoder(Gson gson) { this.gson = gson; } @Override public void encode(Object object, RequestTemplate template) { template.body(gson.toJson(object)); } }
@POST @Path("/") Session login(@Named("username") String username, @Named("password") String password);
Encoder
is a class which can be used to create files or streams that encode the state of a collection of JavaBeans in terms of their public APIs. The Encoder
, in conjunction with its persistence delegates, is responsible for breaking the object graph down into a series of Statements
s and Expression
s which can be used to create it. A subclass typically provides a syntax for these expressions using some human readable form - like Java source code or XML.
@since 1.4
@version 1.3 11/15/00
@author Philip Milne
First the encoder should be initialized with a ParameterList object provided through the constructor. Then, the run() method is invoked and the encoder executes. The exit code of the class can be obtained with the getExitCode() method, after the constructor and after the run method. A non-zero value indicates that an error has occurred.
The modules are inserted in the encoding chain with the following order:
The encoder uses a pull model. This means that the last module (PostCompRateAllocator) requests data from its source (EntropyCoder), ...
Writing of the codestream writing (header+bit stream) is realized by HeaderEncoder and CodestreamWriter modules.
Packed packet headers and file-format creation are carried out by CodestreamManipulator and FileFormatWriter modules respectively.
Many modules of the encoder may behave differently depending on the tile-component. The specifications of their behaviour are kept in specialized modules extending ModuleSpec class. All these modules are accessible through an instance of EncoderSpecs class.
@see ImgReader @see ImgDataJoiner @see ForwCompTransf @see Tiler @see ImgDataConverter @see ForwardWT @see Quantizer @see ROIScaler @see EntropyCoder @see PostCompRateAllocator @see HeaderEncoder @see CodestreamWriter @see CodestreamManipulator @see FileFormatWriter @see ModuleSpec @see EncoderSpecsTo read the data back, use a corresponding {@link Decoder} @see Decoder
Known implementations: {@link LevenshteinEncoder}{@link ArithEncoder}@see Decoder @author Kirilchuk V.E.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|