public class Formula extends CommonItem implements Validatable, Registered
Modifier and Type | Class and Description |
---|---|
static class |
Formula.AverageMethod
The average method used for the values of this formula.
|
static class |
Formula.Parser
The parser used to parse the formula.
|
static class |
Formula.Type
The type of formula indicats in which situations it can be used.
|
Modifier and Type | Field and Description |
---|---|
private Coloring |
coloring |
static int |
MAX_FORMULA_LENGTH
The maximum length of the formula that can be stored in the database.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
Formula(FormulaData formulaData) |
Modifier and Type | Method and Description |
---|---|
Formula.AverageMethod |
getAverageMethod()
Get the average method for this formula.
|
static Formula |
getById(DbControl dc,
int id)
Get a
Formula item when you know the ID. |
int |
getChannels()
Get the number of channels required to be able to use this formula.
|
Coloring |
getColoring()
Get coloring information for this formula.
|
(package private) FormulaData |
getData()
Get the
BasicData object that holds all data for this item. |
java.util.Date |
getEntryDate()
Get the date that the item was registered in the database.
|
java.lang.String |
getFormula(int index)
Get an expression.
|
java.util.List<java.lang.String> |
getFormulas()
Get all expressions as an unmodifiable list.
|
Formula.Type |
getFormulaType()
Get the type of formula.
|
static Formula |
getNew(DbControl dc)
Create a new
Formula item. |
int |
getNumFormulas()
Get the number of expression defined by this formula.
|
Formula.Parser |
getParser()
Get the parser that converts the formula to an expresion or restriction.
|
static ItemQuery<Formula> |
getQuery()
Get a new query object for this class.
|
static ItemQuery<Formula> |
getQuery(Formula.Type type,
RawDataType rawDataType,
IntensityTransform source)
Get a query that return formulas that can be used with the specified
raw data type.
|
RawDataType |
getRawDataType()
Get the raw data type this formula can be used on.
|
IntensityTransform |
getResultIntensityTransform()
Get the spot intensity transformation that this formula
generates.
|
IntensityTransform |
getSourceIntensityTransform()
Get the intensity transformation that is required on spot
data if this formula should generate the correct result.
|
Item |
getType()
Get the type of item represented by the object.
|
Type |
getValueType()
Get the type of values that this formula produces.
|
void |
setAverageMethod(Formula.AverageMethod averageMethod)
Set the average method of the formula.
|
void |
setChannels(int channels)
Set the number of channels that are required to use this formula.
|
void |
setEntryDate(java.util.Date entryDate)
Set the date the entry was registered in the database.
|
void |
setFormulas(java.util.List<java.lang.String> formulas)
Set the expressions used by this formula.
|
void |
setFormulaType(Formula.Type type)
Set the type of the formula.
|
void |
setParser(Formula.Parser parser)
Set the parser used to convert the formula to an expression or restriction.
|
void |
setRawDataType(RawDataType rawDataType)
Set the raw data type this formula can be used on.
|
void |
setResultIntensityTransform(IntensityTransform transform)
Sets the transform that this formula generates.
|
void |
setSourceIntensityTransform(IntensityTransform transform)
Sets the transform that is required on spot data if this
formula should generate the correct result.
|
void |
setValueType(Type valueType)
Set the type of the values that this formula produces.
|
(package private) void |
validate()
This method is called on each
Validatable item
before is saved to the database. |
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey
getOwner, isOwner, setOwner, takeOwnership
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
getOwner, isOwner, setOwner, takeOwnership
public static final Item TYPE
Item.CLIENT
,
getType()
public static final int MAX_FORMULA_LENGTH
setFormulas(List)
method to avoid
exceptions.private Coloring coloring
Formula(FormulaData formulaData)
public static Formula getNew(DbControl dc) throws BaseException
Formula
item.dc
- The DbControl
which will be used for
permission checking and database accessFormula
itemBaseException
- If there is an errorpublic static Formula getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Formula
item when you know the ID.dc
- The DbControl
which will be used for
permission checking and database access.id
- The ID of the item to loadFormula
itemItemNotFoundException
- If an item with the specified
ID is not foundPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permission to the itemBaseException
- If there is another errorpublic static ItemQuery<Formula> getQuery()
ItemQuery
objectpublic static ItemQuery<Formula> getQuery(Formula.Type type, RawDataType rawDataType, IntensityTransform source)
type
- The type of formula to return, or null to return any typerawDataType
- The raw data type the formula should be useful for,
or null to not filter on the raw data typesource
- Source data intensity transformation that the formula
should be useful for. This includes all formulas that has specified
the same transformation and those that hasn't specified any transformation
at all. If this parameter is null, no filtering on intensity transformation
is done.ItemQuery
objectFormulaData getData()
BasicItem
BasicData
object that holds all data for this item.getData
in class CommonItem
public Item getType()
Identifiable
Item
enumeration.getType
in interface Identifiable
public java.util.Date getEntryDate()
Registered
getEntryDate
in interface Registered
public void setEntryDate(java.util.Date entryDate)
Registered
setEntryDate
in interface Registered
entryDate
- A date or null to use today's datevoid validate() throws InvalidDataException, BaseException
BasicItem
Validatable
item
before is saved to the database. If the subclass
overrides this method it should also propagate the call
to the superclass, ie. super.validate()
.validate
in class BasicItem
BaseException
- If there is an errorInvalidDataException
Formula.Type.validate(Formula)
public Formula.AverageMethod getAverageMethod()
Formula.AverageMethod
objectpublic void setAverageMethod(Formula.AverageMethod averageMethod) throws PermissionDeniedException, InvalidDataException
averageMethod
- A Formula.AverageMethod
object, null is not allowedPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the averageMethod is nullpublic Formula.Type getFormulaType()
Type
objectpublic void setFormulaType(Formula.Type type) throws PermissionDeniedException, InvalidDataException
type
- A Type
object, null is not allowedPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the type is nullpublic Type getValueType()
Type
object, or null if not knownpublic void setValueType(Type valueType) throws PermissionDeniedException, InvalidDataException
Formula.Type.COLUMN_EXPRESSION
formulas that can have a free value type.
Calls to this method are ignored for other formula types.valueType
- A Type
object, or null if not knownPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
public Formula.Parser getParser()
Formula.Parser
objectpublic void setParser(Formula.Parser parser) throws PermissionDeniedException
parser
- The Formula.Parser
object, null is not allowedPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the parser is nullpublic IntensityTransform getSourceIntensityTransform()
public void setSourceIntensityTransform(IntensityTransform transform)
transform
- The required transform or null if the formula works
with all kind of datapublic IntensityTransform getResultIntensityTransform()
public void setResultIntensityTransform(IntensityTransform transform)
transform
- An intensity transform or null if the formula
generates the same kind of data used as source or doesn't generate intensity
data at allpublic RawDataType getRawDataType()
RawDataType
objectpublic void setRawDataType(RawDataType rawDataType) throws PermissionDeniedException
rawDataType
- The raw data type, or nullPermissionDeniedException
- If the logged in user doesn't have
write permissionpublic int getChannels()
public void setChannels(int channels) throws PermissionDeniedException, InvalidDataException
channels
- The number of channels or 0PermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the value is negativepublic int getNumFormulas()
public java.lang.String getFormula(int index)
index
- The index of the expression, starting at 0public void setFormulas(java.util.List<java.lang.String> formulas) throws InvalidDataException
formulas
- The list of expressionsInvalidUseOfNullException
- If the list is null or empty or if
an individual element in the list is nullPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
public java.util.List<java.lang.String> getFormulas()