org.norther.tammi.sprig.jfree.function
Class FormatExpression

java.lang.Object
  extended by org.norther.tammi.sprig.jfree.function.ReportExpression
      extended by org.norther.tammi.sprig.jfree.function.FormatExpression
All Implemented Interfaces:
Serializable, Cloneable, org.jfree.report.function.Expression

public class FormatExpression
extends ReportExpression

A format expression.

Version:
$Id: FormatExpression.java,v 1.14 2009/09/28 15:08:52 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
FormatExpression()
          Constructs a new expression.
 
Method Summary
 Double change(Object value, Object total)
          Calculates the specified change.
 Number fixed(Object value)
          Returns the object as a fixed number.
 String format(Date value, String... pttrn)
          Formats a date with a pattern.
 String format(Number value, String... pttrn)
          Formats a number with a pattern.
 String format(Object value, String... pttrn)
          Formats an object with a pattern.
 String format(String value, String... bsnm)
          Formats a string.
 String getBaseName()
          Gets the base name.
 String getPattern()
          Gets the pattern.
protected  int getPatternIndex()
          Gets the pattern index.
 String getPatternName()
          Gets the pattern name.
 Object getValue()
           
 boolean isFixed()
          Checks the fixed option.
 boolean isUnformatted()
          Checks the unformatted option.
protected  void resetReferenceIndex()
          Resets the the current reference index to update it during the next value retrieval.
 void setBaseName(String name)
          Sets the base name.
 void setFixed(boolean flag)
          Sets the fixed option.
 void setPattern(String str)
          Sets the pattern.
 void setPatternName(String name)
          Sets the pattern name.
 void setUnformatted(boolean flag)
          Sets the unformatted option.
 Double share(Object value, Object total)
          Calculates the specified share.
 
Methods inherited from class org.norther.tammi.sprig.jfree.function.ReportExpression
clone, concat, getAttribute, getDataRow, getDependencyLevel, getDescription, getDetail, getGroup, getInstance, getMaxValue, getMinValue, getName, getOperation, getOperationEnum, getReferenceIndex, getReferenceName, getReportConfiguration, getReportModel, getResourceBundleFactory, getRowIndex, getValue, getValue, getWordIndex, isActive, isDeepTraversing, isPreserve, setActive, setAttribute, setDependencyLevel, setMaxValue, setMinValue, setName, setOperation, setPreserve, setReferenceName, setRuntime, setWordIndex, toString, toStrings
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatExpression

public FormatExpression()
Constructs a new expression.

Method Detail

getValue

public Object getValue()
Specified by:
getValue in interface org.jfree.report.function.Expression
Overrides:
getValue in class ReportExpression

getPattern

public String getPattern()
Gets the pattern.

Returns:
the pattern.

setPattern

public void setPattern(String str)
Sets the pattern.

Parameters:
str - the pattern.

getPatternName

public String getPatternName()
Gets the pattern name.

Returns:
the pattern name.

setPatternName

public void setPatternName(String name)
Sets the pattern name.

Parameters:
name - the pattern name.

getBaseName

public String getBaseName()
Gets the base name.

Returns:
the base name.

setBaseName

public void setBaseName(String name)
Sets the base name.

Parameters:
name - the base name.

isFixed

public boolean isFixed()
Checks the fixed option.

Returns:
true for fixed numbers, false otherwise.

setFixed

public void setFixed(boolean flag)
Sets the fixed option.

Parameters:
flag - true for fixed numbers, false otherwise.

isUnformatted

public boolean isUnformatted()
Checks the unformatted option.

Returns:
true for unformatted, false otherwise.

setUnformatted

public void setUnformatted(boolean flag)
Sets the unformatted option.

Parameters:
flag - true for unformatted, false otherwise.

change

public Double change(Object value,
                     Object total)
Calculates the specified change.

Parameters:
value - the value.
total - the total.
Returns:
the change as a percentage.

share

public Double share(Object value,
                    Object total)
Calculates the specified share.

Parameters:
value - the value.
total - the total.
Returns:
the share as a percentage.

fixed

public Number fixed(Object value)
Returns the object as a fixed number.

Parameters:
value - the object.
Returns:
the fixed number.

format

public String format(Object value,
                     String... pttrn)
Formats an object with a pattern.

Parameters:
value - the object.
pttrn - the pattern.
Returns:
the formatted string or null.

format

public String format(String value,
                     String... bsnm)
Formats a string.

Parameters:
value - the string.
bsnm - the base name.
Returns:
the formatted string or null.

format

public String format(Number value,
                     String... pttrn)
Formats a number with a pattern.

Parameters:
value - the number.
pttrn - the pattern.
Returns:
the formatted number or null.

format

public String format(Date value,
                     String... pttrn)
Formats a date with a pattern.

Parameters:
value - the date.
pttrn - the pattern.
Returns:
the formatted date or null.

resetReferenceIndex

protected void resetReferenceIndex()
Description copied from class: ReportExpression
Resets the the current reference index to update it during the next value retrieval.

Overrides:
resetReferenceIndex in class ReportExpression

getPatternIndex

protected int getPatternIndex()
Gets the pattern index.

Returns:
the pattern index or -1.


Copyright © 2004 The Norther Organization. All rights reserved.