2.17.2: 2011-06-17

net.sf.basedb.util.export.spotdata
Class JepDynamicField

java.lang.Object
  extended by net.sf.basedb.util.export.spotdata.JepDynamicField
All Implemented Interfaces:
DynamicField, ExportableField

public class JepDynamicField
extends Object
implements DynamicField

A dynamic field implementation that uses a JEP expression to generate the expression that is needed to select the data. One instance of this class is considered to be equal to another if they are configured with the same jep expression and title.

Version:
2.12
Author:
Nicklas
Last modified
$Date: 2010-08-13 12:48:17 +0200 (Fri, 13 Aug 2010) $

Field Summary
private  Formula.AverageMethod averageMethod
           
private  Formatter<?> formatter
           
private  String jep
           
private  String title
           
private  Type type
           
 
Constructor Summary
JepDynamicField()
          Create a new object.
 
Method Summary
 boolean equals(Object obj)
          A jep dynamic field is equal to another field if it uses the same jep expression and has the same title.
 Formula.AverageMethod getAverageMethod()
          Get the average method to use if the exporter is exporting averaged data.
 Expression getExpression(DbControl dc, DynamicQuery query, BioAssaySet source, boolean forAverage)
          Converts the configured JEP expression using the BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery) method.
 Formatter<?> getFormatter()
          Get a formatter that converts the values in this field to strings.
 String getJep()
          Get the configured JEP expression.
 String getTitle()
          Get the column header.
 Type getType()
          Get the data type of the field.
 int hashCode()
           
 void setAverageMethod(Formula.AverageMethod averageMethod)
          Set the average method to use when exporting averaged data.
 void setFormatter(Formatter<?> formatter)
          Set a formatter to use for formatting the exported values.
 void setJep(String jep)
          Set the expression used to select data in the query.
 void setTitle(String title)
          Set the column header title.
 void setType(Type type)
          Set the data type of the exported field.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

jep

private String jep

title

private String title

averageMethod

private Formula.AverageMethod averageMethod

formatter

private Formatter<?> formatter

type

private Type type
Constructor Detail

JepDynamicField

public JepDynamicField()
Create a new object. Before it can be used it must be configured.

Method Detail

getExpression

public Expression getExpression(DbControl dc,
                                DynamicQuery query,
                                BioAssaySet source,
                                boolean forAverage)
Converts the configured JEP expression using the BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery) method. If 'forAverage' is TRUE the confgured Formula.AverageMethod is allowed to transform the expression. If no average method has been configured the average method specified by the IntensityTransform from the 'source' bioassay set is used.

Specified by:
getExpression in interface DynamicField
Parameters:
dc - The DbControl that is used for database access
query - The query the expression will be used with
source - The source bioassay set
forAverage - TRUE if the expression should generate an average of multiple values
Returns:
An expression, or null if it is not possible to create an expression in the given case (this will normally be replaced with an empty column in the output)

getTitle

public String getTitle()
Description copied from interface: ExportableField
Get the column header.

Specified by:
getTitle in interface ExportableField

getType

public Type getType()
Description copied from interface: ExportableField
Get the data type of the field.

Specified by:
getType in interface ExportableField
Returns:
A type object or null if not known

getFormatter

public Formatter<?> getFormatter()
Description copied from interface: ExportableField
Get a formatter that converts the values in this field to strings.

Specified by:
getFormatter in interface ExportableField
Returns:
A formatter or null to use default formatting (normally this means calling the toString() method).

equals

public boolean equals(Object obj)
A jep dynamic field is equal to another field if it uses the same jep expression and has the same title.

Overrides:
equals in class Object
Since:
2.15

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Since:
2.15

toString

public String toString()
Overrides:
toString in class Object
Since:
2.15

getJep

public String getJep()
Get the configured JEP expression.


setJep

public void setJep(String jep)
Set the expression used to select data in the query. The expression is parsed and converted to an Expressions with the BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery) method.


setTitle

public void setTitle(String title)
Set the column header title.


setType

public void setType(Type type)
Set the data type of the exported field.

Since:
2.15

getAverageMethod

public Formula.AverageMethod getAverageMethod()
Get the average method to use if the exporter is exporting averaged data. If no average method has been configured, the everage method specified by the IntensityTransform of the source bioassay set is used.


setAverageMethod

public void setAverageMethod(Formula.AverageMethod averageMethod)
Set the average method to use when exporting averaged data.


setFormatter

public void setFormatter(Formatter<?> formatter)
Set a formatter to use for formatting the exported values.


2.17.2: 2011-06-17