Package com.scriptel.proscript
Class ErrorCorrectionTable
- java.lang.Object
-
- com.scriptel.proscript.ErrorCorrectionTable
-
public class ErrorCorrectionTable extends java.lang.Object
This class represents the internal error correction table used by a ScripTouch device to correct for natural deformities in the sensor surface.
-
-
Constructor Summary
Constructors Constructor Description ErrorCorrectionTable(byte[] table)
Creates a new error correction table object from a byte array.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Checks for equality with another error correction table.static ErrorCorrectionTable
fromSrecord(java.io.BufferedReader reader)
This method reads an error correction table stored in a Motorola SRecord file into an error correction table object.int
getBoundX1()
int
getBoundX2()
int
getBoundY1()
int
getBoundY2()
int
getChecksum()
java.util.List<ErrorCorrectionSample>
getSamples()
byte[]
getTable()
int
getxDelta()
int
getxMin()
int
getxOffset()
int
getyDelta()
int
getyMin()
int
getyOffset()
int
hashCode()
Generates a unique(-ish) hash code for this object.boolean
isValid()
void
toSrecord(java.io.Writer writer)
This method converts the current error correction table to a Motorola S-Record file.java.lang.String
toString()
This method converts this object into a human readable string.
-
-
-
Method Detail
-
toSrecord
public void toSrecord(java.io.Writer writer) throws java.io.IOException
This method converts the current error correction table to a Motorola S-Record file.- Parameters:
writer
- Writer to write the SRecord file out to.- Throws:
java.io.IOException
- Thrown in the event of a problem.
-
fromSrecord
public static ErrorCorrectionTable fromSrecord(java.io.BufferedReader reader) throws java.io.IOException
This method reads an error correction table stored in a Motorola SRecord file into an error correction table object. This is a normal s-record file, with a few twists:- Records must consist of 16 bit addressed data records and one 16 bit terminator.
- Records must be exactly 32 bytes long.
- Records must be address contiguously.
- The first record must start at address 0x7000.
- Parameters:
reader
- Reader to read the error correction table into.- Returns:
- Error correction table stored in the file.
- Throws:
java.io.IOException
- Thrown in the event of a problem reading the file.
-
equals
public boolean equals(java.lang.Object o)
Checks for equality with another error correction table.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- Object to compare against.- Returns:
- True if the object is an error correction table with equal values.
-
hashCode
public int hashCode()
Generates a unique(-ish) hash code for this object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- Hash code for this object.
-
toString
public java.lang.String toString()
This method converts this object into a human readable string.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Human readable string.
-
getxMin
public int getxMin()
- Returns:
- the xMin
-
getxDelta
public int getxDelta()
- Returns:
- the xDelta
-
getyMin
public int getyMin()
- Returns:
- the yMin
-
getyDelta
public int getyDelta()
- Returns:
- the yDelta
-
getxOffset
public int getxOffset()
- Returns:
- the xOffset
-
getyOffset
public int getyOffset()
- Returns:
- the yOffset
-
getChecksum
public int getChecksum()
- Returns:
- the checksum
-
isValid
public boolean isValid()
- Returns:
- the valid
-
getSamples
public java.util.List<ErrorCorrectionSample> getSamples()
- Returns:
- the samples
-
getBoundX1
public int getBoundX1()
- Returns:
- the boundX1
-
getBoundX2
public int getBoundX2()
- Returns:
- the boundX2
-
getBoundY1
public int getBoundY1()
- Returns:
- the boundY1
-
getBoundY2
public int getBoundY2()
- Returns:
- the boundY2
-
getTable
public byte[] getTable()
- Returns:
- the table
-
-