# EasyScriptCompressedDecoder

Implements EasyScriptDecoder

This class creates the live signature and coordinates that are generated by a compressed ScripTouch EasyScript device.

package | Application

### Methods

## Constructor, creates a new instance of EasyScriptCompressedDecoder class.

    __construct(\com\scriptel\SignatureProtocolsignatureProtocol, intpos, \com\scriptel\EasyScriptEventListenerlistOfCoordinateReceiverListener) : mixed

### Arguments

#### signatureProtocol

`\com\scriptel\SignatureProtocol`

Is the current used signature protocol

#### pos

`int`

the position of the first character of signature data in the entire stream. Follows the meta data.

#### listOfCoordinateReceiverListener

`\com\scriptel\EasyScriptEventListener`

### Response

`mixed`

## This method parses the compressed signature and decompressed it into coordinates

    addValueToSignature(intbyteOfBitStream) : mixed

### Arguments

#### byteOfBitStream

`int`

One byte of the incoming bit stream

### Response

`mixed`

## This method converts a decimal number into a 9-bit format string.

    addValueToStream(intdecNumber) : mixed

### Arguments

#### decNumber

`int`

Is an integer number represents the format (num1 * 23 + num2).

### Response

`mixed`

## This method reads characters from signature and puts them in 9-bit binary value It requires 2 or 3 characters and should only be given as many.

    convertBodnarCharsToValue(stringsignature) : int

Throws | \com\scriptel\SignatureInvalidException

### Arguments

#### signature

`string`

Represents the compressed signature.

### Response

`int`

The converted values of the characters or -1 if it could not be done...a third character may be required.

## Gets the current signature protocol.

    getSigantureProtocol() : \com\scriptel\the

### Response

`\com\scriptel\the`

signatureProtocol

## This method parses the incoming signature in the batch mode. It converts the signature to single chars to handle it in the streaming mode.

    parse(mixedstr) : mixed

Throws | \com\scriptel\SignatureInvalidException

### Arguments

#### str

`mixed`

### Response

`mixed`

## This method parses the signature character by character to decode it.

    parseSignature(mixedch) : mixed

Throws | \com\scriptel\SignatureInvalidException

### Arguments

#### ch

`mixed`

### Response

`mixed`

## This method parses the binary tree to find the value corresponding to a binary string

    searchBinaryTree(arraystream) : int

### Arguments

#### stream

`array`

is a list of boolean values represents the binary stream.

### Response

`int`

The value corresponding to the binary stream. If there weren't enough bits, returns -1, but remembers where it left off.

### Constants

## The maximum value for the compressed device.

    MAXIMUM_COMPRESSED_VALUE

## Contains the value that occurs when the difference between current x and previous x or current y and previous y in a coordinate is repeated.

    REPEAT_HALF

## Contains the value that indicates there is a new stroke.

    NEW_STROKE_CODE

## Contains the value that indicates that the sign of x is reversed.

    REVERSE_X_CODE

## Contains the value that indicates that the sign of y is reversed.

    REVERSE_Y_CODE

## Contains the value that indicates that the signs of x and y are reversed.

    REVERSE_X_AND_Y_CODE

## Contains the value that should be converted to the number 61 when it occurs.

    REVERSE_X_CODE_SWAP

## Contains the value that should be converted to the number 62 when it occurs.

    REVERSE_Y_CODE_SWAP

## Contains the value that should be converted to the number 63 when it occurs.

    REVERSE_X_AND_Y_CODE_SWAP

## Contains the value that should be converted to the number 59 when it occurs.

    REPEAT_HALF_SWAP

## Contains the value that should be converted to the number 60 when it occurs.

    NEW_STROKE_CODE_SWAP

## Contains the value indicates that the user has canceled the signature.

    CANCEL_CODE

### Properties

## This object reads the binary tree.

    tree : \com\scriptel\BinaryTreeReader

var |

### Type(s)

`BinaryTreeReader`

## Default constructor, uses the STN protocol.

    coordinateReceiverListeners :

var | EasyScriptEventListener[].

## This is a string that contains the characters of the incoming signature.

    streamedSignature : string

var |

### Type(s)

`string`

## Handles the binary stream that is used to find X and Y values in the binary tree.

    binaryStream : bool[]

var |

### Type(s)

`array<string|int, bool>`

## This is the used signature protocol.

    sigantureProtocol : \com\scriptel\SignatureProtocol

var |

### Type(s)

`SignatureProtocol`

## keyValues

    keyboardDecoder : \com\scriptel\KeyBoardDecoder

var |

### Type(s)

`\com\scriptel\KeyBoardDecoder`

## Flag indicates whether we are decoding x or y.

    decodingX : bool

var |

### Type(s)

`bool`

## Determines if the sign of X is currently plus or minus.

    xSign : int

var |

### Type(s)

`int`

## Determines if the sign of X is currently plus or minus.

    ySign : int

var |

### Type(s)

`int`

## Handles that last value of X.

    previousX : int

var |

### Type(s)

`int`

## Handles that last value of Y.

    previousY : int

var |

### Type(s)

`int`

## Contains the position of the character that is being processed.

    charPosition : int

var |

### Type(s)

`int`

## An instance of the binary tree.

    nodePointer : \com\scriptel\BinaryTree

var |

### Type(s)

`BinaryTree`

## Contains the value after decompression.

    makeupValue : int

var |

### Type(s)

`int`

## Contains the value of x.

    x : int

var |

### Type(s)

`int`

## Contains the value of y.

    y : int

var |

### Type(s)

`int`

## This is the calculate coordinate.

    currentPoint : \com\scriptel\Coordinate

var |

### Type(s)

`Coordinate`

## currently working on the terminator code

    isMakeupCode : bool

var |

### Type(s)

`bool`

## This is true when there is a new stroke.

    isNewStroke : bool

var |

### Type(s)

`bool`