pt.digitalis.dif.dem.objects.parameters.rules
Class AbstractParameterRule<T>

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.parameters.rules.AbstractParameterRule<T>
Type Parameters:
T - the parameter base type
All Implemented Interfaces:
IParameterRule<T>
Direct Known Subclasses:
ParameterRuleDependent, ParameterRuleExclusive

public abstract class AbstractParameterRule<T>
extends Object
implements IParameterRule<T>

A base implementation for all parameter rules

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Mar 31, 2009

Field Summary
protected  String parameterID
          The parameter that this rule is associated to
 
Constructor Summary
AbstractParameterRule()
           
 
Method Summary
 ParameterRuleAction getAction()
          Inspector for the 'action' attribute.
 String getDescriptionEndValue()
          Inspector for the 'descriptionEndValue' attribute.
 String getDescriptionStartValue()
          Inspector for the 'descriptionStartValue' attribute.
 String getDescriptionValue()
          Inspector for the 'descriptionValue' attribute.
 String getEndValue()
          Inspector for the 'endValue' attribute.
protected  Map<String,String> getMessages(IStageInstance stage)
          Returns the list of messages available for the parameter rule
 IParameter<T> getParameter(IStageInstance stage)
          Inspector for the 'parameter' attribute.
 String getParameterName(IStageInstance stage, String parameterID)
          Get's the name of a given parameter from the stage messages.
 List<String> getParameters()
          Inspector for the 'parameters' attribute.
 String getStartValue()
          Inspector for the 'startValue' attribute.
 String getValue()
          Inspector for the 'value' attribute.
 AbstractParameterRule<T> init(String parameterID, String parameters, ParameterRuleAction action, String value, String first, String last)
          Initializer
 void setDescriptionEndValue(String descriptionEndValue)
          Modifier for the 'descriptionEndValue' attribute.
 void setDescriptionStartValue(String descriptionStartValue)
          Modifier for the 'descriptionStartValue' attribute.
 void setDescriptionValue(String descriptionValue)
          Modifier for the 'descriptionValue' attribute.
 AbstractParameterRule<T> setEndValue(String endValue)
          Modifier for the 'endValue' attribute.
 AbstractParameterRule<T> setStartValue(String startValue)
          Modifier for the 'startValue' attribute.
 AbstractParameterRule<T> setValue(String value)
          Modifier for the 'value' attribute.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pt.digitalis.dif.dem.objects.parameters.rules.IParameterRule
getValidationResult
 

Field Detail

parameterID

protected String parameterID
The parameter that this rule is associated to

Constructor Detail

AbstractParameterRule

public AbstractParameterRule()
Method Detail

getAction

public ParameterRuleAction getAction()
Description copied from interface: IParameterRule
Inspector for the 'action' attribute.

Specified by:
getAction in interface IParameterRule<T>
Returns:
the action value
See Also:
IParameterRule.getAction()

getDescriptionEndValue

public String getDescriptionEndValue()
Description copied from interface: IParameterRule
Inspector for the 'descriptionEndValue' attribute.

Specified by:
getDescriptionEndValue in interface IParameterRule<T>
Returns:
the descriptionEndValue value
See Also:
IParameterRule.getDescriptionEndValue()

getDescriptionStartValue

public String getDescriptionStartValue()
Description copied from interface: IParameterRule
Inspector for the 'descriptionStartValue' attribute.

Specified by:
getDescriptionStartValue in interface IParameterRule<T>
Returns:
the descriptionStartValue value
See Also:
IParameterRule.getDescriptionStartValue()

getDescriptionValue

public String getDescriptionValue()
Description copied from interface: IParameterRule
Inspector for the 'descriptionValue' attribute.

Specified by:
getDescriptionValue in interface IParameterRule<T>
Returns:
the descriptionValue value
See Also:
IParameterRule.getDescriptionValue()

getEndValue

public String getEndValue()
Description copied from interface: IParameterRule
Inspector for the 'endValue' attribute.

Specified by:
getEndValue in interface IParameterRule<T>
Returns:
the endValue value
See Also:
IParameterRule.getEndValue()

getMessages

protected Map<String,String> getMessages(IStageInstance stage)
Returns the list of messages available for the parameter rule

Parameters:
stage - the stage instance that the parameter is associated to
Returns:
the parameter rule Messages

getParameter

public IParameter<T> getParameter(IStageInstance stage)
                           throws ParameterException
Inspector for the 'parameter' attribute.

Parameters:
stage - the stage instance that the parameter is associated to
Returns:
the parameter value
Throws:
ParameterException - if the parameter does not exist

getParameterName

public String getParameterName(IStageInstance stage,
                               String parameterID)
Get's the name of a given parameter from the stage messages. When missing the parameter ID is returned (camel case interpreted)

Parameters:
stage - the parameter's current stage
parameterID - the parameter ID to fetch the name
Returns:
the parameter name

getParameters

public List<String> getParameters()
Description copied from interface: IParameterRule
Inspector for the 'parameters' attribute.

Specified by:
getParameters in interface IParameterRule<T>
Returns:
the parameters value
See Also:
IParameterRule.getParameters()

getStartValue

public String getStartValue()
Description copied from interface: IParameterRule
Inspector for the 'startValue' attribute.

Specified by:
getStartValue in interface IParameterRule<T>
Returns:
the startValue value
See Also:
IParameterRule.getStartValue()

getValue

public String getValue()
Description copied from interface: IParameterRule
Inspector for the 'value' attribute.

Specified by:
getValue in interface IParameterRule<T>
Returns:
the value value
See Also:
IParameterRule.getValue()

init

public AbstractParameterRule<T> init(String parameterID,
                                     String parameters,
                                     ParameterRuleAction action,
                                     String value,
                                     String first,
                                     String last)
Description copied from interface: IParameterRule
Initializer

Specified by:
init in interface IParameterRule<T>
Parameters:
parameterID - the rule parameter ID
parameters - the list of parameters relevant for the given rule (besides the current parameter)
action - the action to perform according to the rule activation (valid or invalid)
value - the value for comparison
first - the first value for interval comparison
last - the last value for interval comparison
Returns:
the initialized object
See Also:
IParameterRule.init(java.lang.String, java.lang.String, pt.digitalis.dif.dem.objects.parameters.rules.ParameterRuleAction, java.lang.String, java.lang.String, java.lang.String)

setDescriptionEndValue

public void setDescriptionEndValue(String descriptionEndValue)
Description copied from interface: IParameterRule
Modifier for the 'descriptionEndValue' attribute.

Specified by:
setDescriptionEndValue in interface IParameterRule<T>
Parameters:
descriptionEndValue - the new descriptionEndValue value to set
See Also:
IParameterRule.setDescriptionEndValue(java.lang.String)

setDescriptionStartValue

public void setDescriptionStartValue(String descriptionStartValue)
Description copied from interface: IParameterRule
Modifier for the 'descriptionStartValue' attribute.

Specified by:
setDescriptionStartValue in interface IParameterRule<T>
Parameters:
descriptionStartValue - the new descriptionStartValue value to set
See Also:
IParameterRule.setDescriptionStartValue(java.lang.String)

setDescriptionValue

public void setDescriptionValue(String descriptionValue)
Description copied from interface: IParameterRule
Modifier for the 'descriptionValue' attribute.

Specified by:
setDescriptionValue in interface IParameterRule<T>
Parameters:
descriptionValue - the new descriptionValue value to set
See Also:
IParameterRule.setDescriptionValue(java.lang.String)

setEndValue

public AbstractParameterRule<T> setEndValue(String endValue)
Description copied from interface: IParameterRule
Modifier for the 'endValue' attribute.

Specified by:
setEndValue in interface IParameterRule<T>
Parameters:
endValue - the new endValue value to set
Returns:
the updated parameter rule instance
See Also:
IParameterRule.setEndValue(java.lang.String)

setStartValue

public AbstractParameterRule<T> setStartValue(String startValue)
Description copied from interface: IParameterRule
Modifier for the 'startValue' attribute.

Specified by:
setStartValue in interface IParameterRule<T>
Parameters:
startValue - the new startValue value to set
Returns:
the updated parameter rule instance
See Also:
IParameterRule.setStartValue(java.lang.String)

setValue

public AbstractParameterRule<T> setValue(String value)
Description copied from interface: IParameterRule
Modifier for the 'value' attribute.

Specified by:
setValue in interface IParameterRule<T>
Parameters:
value - the new value value to set
Returns:
the updated parameter rule instance
See Also:
IParameterRule.setValue(java.lang.String)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.