org.apache.poi.ss.formula
Class EvaluationConditionalFormatRule

java.lang.Object
  extended by org.apache.poi.ss.formula.EvaluationConditionalFormatRule
All Implemented Interfaces:
java.lang.Comparable<EvaluationConditionalFormatRule>

public class EvaluationConditionalFormatRule
extends java.lang.Object
implements java.lang.Comparable<EvaluationConditionalFormatRule>


Nested Class Summary
static class EvaluationConditionalFormatRule.OperatorEnum
          Not calling it OperatorType to avoid confusion for now with other classes.
protected static class EvaluationConditionalFormatRule.ValueAndFormat
          Note: this class has a natural ordering that is inconsistent with equals.
protected static interface EvaluationConditionalFormatRule.ValueFunction
          instances evaluate the values for a region and return the positive matches for the function type.
 
Constructor Summary
EvaluationConditionalFormatRule(WorkbookEvaluator workbookEvaluator, Sheet sheet, ConditionalFormatting formatting, int formattingIndex, ConditionalFormattingRule rule, int ruleIndex, CellRangeAddress[] regions)
           
 
Method Summary
 int compareTo(EvaluationConditionalFormatRule o)
          Per Excel Help, XSSF rule priority is sheet-wide, not just within the owning ConditionalFormatting object.
 boolean equals(java.lang.Object obj)
          Defined as equal sheet name and formatting and rule indexes
 ConditionalFormatting getFormatting()
           
 int getFormattingIndex()
           
 java.lang.String getFormula1()
           
 java.lang.String getFormula2()
           
 ExcelNumberFormat getNumberFormat()
           
 EvaluationConditionalFormatRule.OperatorEnum getOperator()
           
 int getPriority()
           
 CellRangeAddress[] getRegions()
           
 ConditionalFormattingRule getRule()
           
 int getRuleIndex()
           
 Sheet getSheet()
           
 ConditionType getType()
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvaluationConditionalFormatRule

public EvaluationConditionalFormatRule(WorkbookEvaluator workbookEvaluator,
                                       Sheet sheet,
                                       ConditionalFormatting formatting,
                                       int formattingIndex,
                                       ConditionalFormattingRule rule,
                                       int ruleIndex,
                                       CellRangeAddress[] regions)
Parameters:
workbookEvaluator -
sheet -
formatting -
formattingIndex - for priority, zero based
rule -
ruleIndex - for priority, zero based, if this is an HSSF rule. Unused for XSSF rules
regions - could be read from formatting, but every call creates new objects in a new array. this allows calling it once per formatting instance, and re-using the array.
Method Detail

getSheet

public Sheet getSheet()
Returns:
sheet

getFormatting

public ConditionalFormatting getFormatting()
Returns:
the formatting

getFormattingIndex

public int getFormattingIndex()
Returns:
conditional formatting index

getNumberFormat

public ExcelNumberFormat getNumberFormat()
Returns:
Excel number format string to apply to matching cells, or null to keep the cell default

getRule

public ConditionalFormattingRule getRule()
Returns:
the rule

getRuleIndex

public int getRuleIndex()
Returns:
rule index

getRegions

public CellRangeAddress[] getRegions()
Returns:
the regions

getPriority

public int getPriority()
Returns:
the priority

getFormula1

public java.lang.String getFormula1()
Returns:
the formula1

getFormula2

public java.lang.String getFormula2()
Returns:
the formula2

getOperator

public EvaluationConditionalFormatRule.OperatorEnum getOperator()
Returns:
the operator

getType

public ConditionType getType()
Returns:
the type

equals

public boolean equals(java.lang.Object obj)
Defined as equal sheet name and formatting and rule indexes

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

compareTo

public int compareTo(EvaluationConditionalFormatRule o)
Per Excel Help, XSSF rule priority is sheet-wide, not just within the owning ConditionalFormatting object. This can be seen by creating 4 rules applying to two different ranges and examining the XML.

HSSF priority is based on definition/persistence order.

Specified by:
compareTo in interface java.lang.Comparable<EvaluationConditionalFormatRule>
Parameters:
o -
Returns:
comparison based on sheet name, formatting index, and rule priority

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object