com.ibm.connector2.hod
Class J2HODScreenRecord

java.lang.Object
  |
  +--com.ibm.connector2.hod.J2HODScreenRecord
All Implemented Interfaces:
java.lang.Cloneable, javax.resource.cci.Record, java.io.Serializable, javax.resource.cci.Streamable

public class J2HODScreenRecord
extends java.lang.Object
implements javax.resource.cci.Record, javax.resource.cci.Streamable

This class is used mainly to compare a current screen record information against another screen record for their match. Screen record information can also be manually set or changed to let the host know what has been changed or updated.

See Also:
Serialized Form

Constructor Summary
J2HODScreenRecord()
          Creates an instance of J2HODScreenRecord.
J2HODScreenRecord(int numRows, int numColumns)
          Creates an instance of J2HODScreenRecord.
 
Method Summary
 boolean checkBytes(byte[] b)
          Compares the input byte array.
 boolean checkBytes(byte[] b, int row, int column, boolean caseSense, boolean enableException)
          Compares input byte array with the screen at a specified position.
 boolean checkBytes(java.lang.String s, int row, int column, boolean caseSense, boolean enableException)
          Compares the input string with specified position.
 boolean checkBytes(java.lang.String s, int startRow, int startColumn, int endRow, int endColumn, boolean caseSense, boolean enableException)
          Compares the input string in a specified region.
 java.lang.Object clone()
          Clones current screen record.
 boolean equals(java.lang.Object obj)
          Compares two objects for equality.
 byte[] getBytes()
          Get a byte array representing the screen.
 java.lang.String getRecordName()
          Gets a record name.
 java.lang.String getRecordShortDescription()
          Gets a short record description.
 int hashCode()
          Generates a hash code for the receiver.
 void read(java.io.InputStream istream)
          Reads input stream and store it as a byte array.
 void setBytes(byte[] b)
          Sets byte array.
 void setBytes(byte[] b, int startRow, int startColumn)
          Modify the byte array based on input byte array and specified position The row and column both start at 1.
 void setRecordName(java.lang.String recordName)
          Sets a record name.
 void setRecordShortDescription(java.lang.String description)
          Sets a short description of a record.
 void setString(java.lang.String s, int startRow, int startColumn)
          Modify the byte array based on a string and a cursor position (represented in row and column).
 java.lang.String toString()
          Return a string representing a whole screen record.
 java.lang.String toString(int startRow, int startColumn, int endRow, int endColumn)
          Return a string representing a screen record based on specified start row, start column, end row, end column of the byte array.
 void write(java.io.OutputStream ostream)
          Writes the screen record into an output stream.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J2HODScreenRecord

public J2HODScreenRecord()
Creates an instance of J2HODScreenRecord.

J2HODScreenRecord

public J2HODScreenRecord(int numRows,
                         int numColumns)
Creates an instance of J2HODScreenRecord.
Parameters:
numRows - int - Number of rows on a session screen (must be greater than 0, otherwise default 24 will be used)
numColumns - int - Number of columns on a session screen (must be greater than 0, otherwise default 80 will be used)
Method Detail

checkBytes

public boolean checkBytes(byte[] b)
Compares the input byte array. If it matches, return true, otherwise return false.
Parameters:
b - byte[] - screen record in byte representation
Returns:
boolean - true if screen matches with b; false otherwise.

checkBytes

public boolean checkBytes(byte[] b,
                          int row,
                          int column,
                          boolean caseSense,
                          boolean enableException)
                   throws java.lang.Exception
Compares input byte array with the screen at a specified position. If enableException is true, an exception is thrown when they do not match instead of returning false. If enableException is false, true or false is returned according to the match result. The row and column both start at 1.
Parameters:
b - byte[] - screen record in a byte array representation
row - int - compare start row
column - int - compare start column
caseSense - boolean - case sensitive(true) or not(false)
enableException - boolean - throw exception or not
Returns:
boolean - true if screen matches with b starting at specified row and column; false if they do not match and if enableException is set to false.
Throws:
java.lang.Exception - - only if screen does not match and enableException is set to true.

checkBytes

public boolean checkBytes(java.lang.String s,
                          int startRow,
                          int startColumn,
                          int endRow,
                          int endColumn,
                          boolean caseSense,
                          boolean enableException)
                   throws java.lang.Exception
Compares the input string in a specified region. If enableException is true, an exception is thrown when they do not match instead of returning false. If enableException is false, true or false is returned according to the match result. The row and column both start at 1.
Parameters:
s - String - screen record in a String representation
startRow - int - compare start row
startColumn - int - compare start column
endRow - int - compare end row
endColumn - int - compare end column
caseSense - boolean - case sensitive(true) or not(false)
enableException - boolean - throw exception or not
Returns:
boolean - true if screen matches with s at a specified region; false if they do not match and if enableException is set to false.
Throws:
java.lang.Exception - - only if screen does not match and enableException is set to true.

checkBytes

public boolean checkBytes(java.lang.String s,
                          int row,
                          int column,
                          boolean caseSense,
                          boolean enableException)
                   throws java.lang.Exception
Compares the input string with specified position. If enableException is true, an exception is thrown when they do not match instead of returning false. If enableException is false, true or false is returned according to the match result. The row and column both start at 1.
Parameters:
s - String - screen record in a String representation
row - int - compare start row
column - int - compare start column
caseSense - boolean - case sensitive(true) or not(false)
enableException - boolean - throw exception or not
Returns:
boolean - true if screen matches with s starting at specified row and column; false if they do not match and if enableException is set to false.
Throws:
java.lang.Exception - - only if screen does not match and enableException is set to true.

clone

public java.lang.Object clone()
Clones current screen record.
Specified by:
clone in interface javax.resource.cci.Record
Returns:
java.lang.Object - newly cloned J2HODScreenRecord

equals

public boolean equals(java.lang.Object obj)
Compares two objects for equality. Returns a boolean which indicates whether this object is equivalent to the specified object. This method is used when an object is stored in a hashtable.
Specified by:
equals in interface javax.resource.cci.Record
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object - the Object to compare with
Returns:
boolean - true if the comparing objects are equal; false otherwise.
See Also:
Hashtable

getBytes

public byte[] getBytes()
Get a byte array representing the screen.
Returns:
byte[]

getRecordName

public java.lang.String getRecordName()
Gets a record name.
Specified by:
getRecordName in interface javax.resource.cci.Record
Returns:
String

getRecordShortDescription

public java.lang.String getRecordShortDescription()
Gets a short record description.
Specified by:
getRecordShortDescription in interface javax.resource.cci.Record
Returns:
String

hashCode

public int hashCode()
Generates a hash code for the receiver. This method is supported primarily for hash tables, such as those provided in java.util.
Specified by:
hashCode in interface javax.resource.cci.Record
Overrides:
hashCode in class java.lang.Object
Returns:
int - an integer hash code for the receiver
See Also:
Hashtable

read

public void read(java.io.InputStream istream)
          throws java.io.IOException
Reads input stream and store it as a byte array.
Specified by:
read in interface javax.resource.cci.Streamable
Parameters:
istream - java.io.InputStream

setBytes

public void setBytes(byte[] b)
Sets byte array.

setBytes

public void setBytes(byte[] b,
                     int startRow,
                     int startColumn)
              throws java.lang.Exception
Modify the byte array based on input byte array and specified position The row and column both start at 1.

setRecordName

public void setRecordName(java.lang.String recordName)
Sets a record name.
Specified by:
setRecordName in interface javax.resource.cci.Record
Parameters:
String - recordName

setRecordShortDescription

public void setRecordShortDescription(java.lang.String description)
Sets a short description of a record.
Specified by:
setRecordShortDescription in interface javax.resource.cci.Record
Parameters:
String - description

setString

public void setString(java.lang.String s,
                      int startRow,
                      int startColumn)
               throws java.lang.Exception
Modify the byte array based on a string and a cursor position (represented in row and column). The row and column both start at 1.
Parameters:
s - String - string replacement
startRow - int - string replacement start row
startColumn - int - string replacement start column
Throws:
java.lang.Exception -  

toString

public java.lang.String toString()
Return a string representing a whole screen record.
Overrides:
toString in class java.lang.Object
Returns:
String - screen record

toString

public java.lang.String toString(int startRow,
                                 int startColumn,
                                 int endRow,
                                 int endColumn)
Return a string representing a screen record based on specified start row, start column, end row, end column of the byte array.
Returns:
String - screen record

write

public void write(java.io.OutputStream ostream)
           throws java.io.IOException
Writes the screen record into an output stream.
Specified by:
write in interface javax.resource.cci.Streamable
Parameters:
ostream - java.io.OutputStream - output stream
Throws:
java.io.IOException -