step.encoding
Class StrideIntStrategy

java.lang.Object
  |
  +--step.encoding.Encoder
        |
        +--step.encoding.Strategy
              |
              +--step.encoding.RegularValueStrategy
                    |
                    +--step.encoding.StrideIntStrategy
Direct Known Subclasses:
PStrideIntStrategy

public class StrideIntStrategy
extends RegularValueStrategy

Assume that the (integer) values increase or decrease with a regular increment.

Algorithm:

 if current - last == stride
     then -> nothing
     else -> meta:IrregularValueEvent, current
 
Credit: Chilimbi, Jones, Zorn (HATF/Meta-TF)

See Also:
StepInt

Field Summary
static String STRATEGY_NAME
           
 
Fields inherited from class step.encoding.RegularValueStrategy
_nextIsRegular
 
Fields inherited from class step.encoding.Strategy
_baseEncoder
 
Constructor Summary
StrideIntStrategy(Encoder baseEncoder, int stride)
          Create a new "stride" strategy.
 
Method Summary
 StepObject decode(DecodeContext context)
          Decode a stride value.
 void dump(int level)
           
 void encode(StepObject o, EncodeContext context)
          Encode a stride value.
 
Methods inherited from class step.encoding.RegularValueStrategy
setNextIsRegular
 
Methods inherited from class step.encoding.Strategy
baseDecode, baseEncode, eventMessage
 
Methods inherited from class step.encoding.Encoder
getFactory, getName, indent, makeFieldName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRATEGY_NAME

public static final String STRATEGY_NAME
See Also:
Constant Field Values
Constructor Detail

StrideIntStrategy

public StrideIntStrategy(Encoder baseEncoder,
                         int stride)
Create a new "stride" strategy.

Parameters:
baseEncoder - the encoder to defer to for deviant values.
stride - the increment from the previous value.
Method Detail

encode

public void encode(StepObject o,
                   EncodeContext context)
            throws EncoderException,
                   IOException
Encode a stride value.

Specified by:
encode in class Encoder
Throws:
EncoderException - if the value is not a StepInt.
IOException - if the encode operation encountered an I/O failure.

decode

public StepObject decode(DecodeContext context)
                  throws EncoderException,
                         IOException
Decode a stride value.

Specified by:
decode in class Encoder
Throws:
IOException - if the decode operation encountered an I/O failure.
EncoderException - if the decode operation encountered an error.

dump

public void dump(int level)
Specified by:
dump in class Encoder