org.apache.poi.hssf.record.aggregates
Class CFRecordsAggregate

java.lang.Object
  extended by org.apache.poi.hssf.record.Record
      extended by org.apache.poi.hssf.record.aggregates.CFRecordsAggregate

public final class CFRecordsAggregate
extends Record

CFRecordsAggregate - aggregates Conditional Formatting records CFHeaderRecord and number of up to three CFRuleRecord records together to simplify access to them.

Author:
Dmitriy Kumshayev

Field Summary
static short sid
           
 
Constructor Summary
CFRecordsAggregate(Region[] regions, CFRuleRecord[] rules)
           
 
Method Summary
 void addRule(CFRuleRecord r)
           
 CFRecordsAggregate cloneCFAggregate()
          Create a deep clone of the record
static CFRecordsAggregate createCFAggregate(java.util.List recs, int pOffset)
          Create CFRecordsAggregate from a list of CF Records
protected  void fillFields(RecordInputStream in)
          called by the constructor, should set class level fields.
 CFHeaderRecord getHeader()
           
 int getNumberOfRules()
           
 int getRecordSize()
          gives the current serialized size of the record.
 CFRuleRecord getRule(int idx)
           
 short getSid()
          return the non static version of the id for this record.
 int serialize(int offset, byte[] data)
          called by the class that is responsible for writing this sucker.
 void setRule(int idx, CFRuleRecord r)
           
 java.lang.String toString()
          String representation of CFRecordsAggregate
protected  void validateSid(short id)
          called by constructor, should throw runtime exception in the event of a record passed with a differing ID.
 
Methods inherited from class org.apache.poi.hssf.record.Record
clone, cloneViaReserialise, isInValueSection, isValue, serialize
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sid

public static final short sid
See Also:
Constant Field Values
Constructor Detail

CFRecordsAggregate

public CFRecordsAggregate(Region[] regions,
                          CFRuleRecord[] rules)
Method Detail

createCFAggregate

public static CFRecordsAggregate createCFAggregate(java.util.List recs,
                                                   int pOffset)
Create CFRecordsAggregate from a list of CF Records

Parameters:
recs - - list of Record objects
offset - - position of CFHeaderRecord object in the list of Record objects
Returns:
CFRecordsAggregate object

cloneCFAggregate

public CFRecordsAggregate cloneCFAggregate()
Create a deep clone of the record

Returns:

fillFields

protected void fillFields(RecordInputStream in)
Description copied from class: Record
called by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.

Specified by:
fillFields in class Record
Parameters:
in - the RecordInputstream to read the record from

getSid

public short getSid()
Description copied from class: Record
return the non static version of the id for this record.

Specified by:
getSid in class Record

serialize

public int serialize(int offset,
                     byte[] data)
called by the class that is responsible for writing this sucker. Subclasses should implement this so that their data is passed back in a byte array.

Specified by:
serialize in class Record
Parameters:
offset - to begin writing at
data - byte array containing instance data
Returns:
number of bytes written

validateSid

protected void validateSid(short id)
Description copied from class: Record
called by constructor, should throw runtime exception in the event of a record passed with a differing ID.

Specified by:
validateSid in class Record
Parameters:
id - alleged id for this record

getHeader

public CFHeaderRecord getHeader()
Returns:
the header. Never null.

getRule

public CFRuleRecord getRule(int idx)

setRule

public void setRule(int idx,
                    CFRuleRecord r)

addRule

public void addRule(CFRuleRecord r)

getNumberOfRules

public int getNumberOfRules()

getRecordSize

public int getRecordSize()
Description copied from class: Record
gives the current serialized size of the record. Should include the sid and reclength (4 bytes).

Overrides:
getRecordSize in class Record
Returns:
sum of sizes of all aggregated records

toString

public java.lang.String toString()
String representation of CFRecordsAggregate

Overrides:
toString in class Record


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.