Package pulse.properties
Class NumericProperty
- java.lang.Object
-
- pulse.properties.NumericProperty
-
- All Implemented Interfaces:
Serializable,Comparable<NumericProperty>,Property
- Direct Known Subclasses:
Identifier
public class NumericProperty extends Object implements Property, Comparable<NumericProperty>
APropertythat has a numericvalue, anerrorassociated with this value, a definition domain defining sensible value, and adimensionFactorused to convert the value to SI.The description, abbreviation, and all default values for a specific
NumericPropertyare associated with the specific type set out by theNuemricPropertyKeyword. The latter is used to link with a repository of defaultNumericProperties loaded from an.xmlfile.- See Also:
NumericPropertyKeyword,XMLConverter, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNumericProperty(Number value, NumericProperty pattern)Creates aNumericPropertybased on {NumericProperty(NumericProperty num)A copy constructor forNumericPropertyNumericProperty(NumericPropertyKeyword type, Number... params)Constructor used byXMLConverterto create aNumericPropertywith fully specified set of parameters
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanattemptUpdate(Object value)intcompareTo(NumericProperty arg0)booleanequals(Object o)TheObjecto is considered to be equal to thisNumericPropertyif (a) it is of the same class; (b) its value is the same as for thisNumericProperty, and (c) if it is specified by the sameNumericPropertyKeyword.NumbererrorInCurrentUnits()StringformattedOutput()Uses aNumericPropertyFormatterto generate a formatted outputStringgetAbbreviation(boolean addHtmlTags)SegmentgetBounds()Represents the bounds specified for this numeric property as aSegmentobject.StringgetDescriptor(boolean addHtmlTag)Creates aStringto describe this property (often used in GUI applications).NumbergetDimensionDelta()NumbergetDimensionFactor()NumbergetError()NumericPropertyKeyword[]getExcludeKeywords()NumbergetMaximum()NumbergetMinimum()NumericPropertyKeywordgetType()ObjectgetValue()Retrieves the value of thisProperty.booleanisDefaultSearchVariable()booleanisDiscrete()booleanisOptimisable()booleanisVisibleByDefault()static voidrequireType(NumericProperty property, NumericPropertyKeyword type)voidsetAbbreviation(String abbreviation)voidsetDefaultSearchVariable(boolean defaultSearchVariable)voidsetDescriptor(String descriptor)voidsetDimensionFactor(Number dimensionFactor)voidsetDiscrete(boolean discrete)voidsetDomain(Number minimum, Number maximum)Sets the definition domain for thisNumericProperty.voidsetError(Number error)voidsetExcludeKeywords(NumericPropertyKeyword[] keys)voidsetOptimisable(boolean optimisable)voidsetValue(Number value)Sets thevalueof thisNumericProperty-- if and only if the newvalueis confined within the definition domain for thisNumericProperty.voidsetVisibleByDefault(boolean autoAdjustable)StringtoString()Prints out thetypeandvalueof thisNumericProperty.booleanvalidate()NumbervalueInCurrentUnits()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface pulse.properties.Property
identifier
-
-
-
-
Constructor Detail
-
NumericProperty
protected NumericProperty(Number value, NumericProperty pattern)
Creates aNumericPropertybased on {- Parameters:
value- the for the {pattern- a validNumericProperty
-
NumericProperty
public NumericProperty(NumericPropertyKeyword type, Number... params)
Constructor used byXMLConverterto create aNumericPropertywith fully specified set of parameters- Parameters:
type- the type of thisNumericProperty, set by one of theNumericPropertyKeywordconstantsparams- the numeric parameters in the following order: value, minimum, maximum, dimension factor.- See Also:
XMLConverter
-
NumericProperty
public NumericProperty(NumericProperty num)
A copy constructor forNumericProperty- Parameters:
num- anotherNumericPropertythat is going to be replicated
-
-
Method Detail
-
getExcludeKeywords
public NumericPropertyKeyword[] getExcludeKeywords()
-
setExcludeKeywords
public void setExcludeKeywords(NumericPropertyKeyword[] keys)
-
getType
public NumericPropertyKeyword getType()
-
getValue
public Object getValue()
Description copied from interface:PropertyRetrieves the value of thisProperty.
-
validate
public boolean validate()
-
setValue
public void setValue(Number value)
Sets thevalueof thisNumericProperty-- if and only if the newvalueis confined within the definition domain for thisNumericProperty. Checks whether- Parameters:
value- the value to be set tothis property
-
setDomain
public void setDomain(Number minimum, Number maximum) throws IllegalArgumentException
Sets the definition domain for thisNumericProperty.- Parameters:
minimum- the minimum valuemaximum- the maximum value- Throws:
IllegalArgumentException- if any two ofminimum, maximum, or this.valuehave different primitive types (e.g. adoubleand anint).
-
getMinimum
public Number getMinimum()
-
getMaximum
public Number getMaximum()
-
toString
public String toString()
Prints out thetypeandvalueof thisNumericProperty.
-
valueInCurrentUnits
public Number valueInCurrentUnits()
-
errorInCurrentUnits
public Number errorInCurrentUnits()
-
getDimensionFactor
public Number getDimensionFactor()
-
setDimensionFactor
public void setDimensionFactor(Number dimensionFactor)
-
setVisibleByDefault
public void setVisibleByDefault(boolean autoAdjustable)
-
isVisibleByDefault
public boolean isVisibleByDefault()
-
getError
public Number getError()
-
setError
public void setError(Number error)
-
getDescriptor
public String getDescriptor(boolean addHtmlTag)
Description copied from interface:PropertyCreates aStringto describe this property (often used in GUI applications).- Specified by:
getDescriptorin interfaceProperty- Parameters:
addHtmlTag- iftrue, adds the 'html' tags at both ends of the descriptorString.- Returns:
- a
String, with or without 'html' tags, describing thisProperty
-
setDescriptor
public void setDescriptor(String descriptor)
-
getAbbreviation
public String getAbbreviation(boolean addHtmlTags)
-
setAbbreviation
public void setAbbreviation(String abbreviation)
-
equals
public boolean equals(Object o)
TheObjecto is considered to be equal to thisNumericPropertyif (a) it is of the same class; (b) its value is the same as for thisNumericProperty, and (c) if it is specified by the sameNumericPropertyKeyword.
-
compareTo
public int compareTo(NumericProperty arg0)
- Specified by:
compareToin interfaceComparable<NumericProperty>
-
isDiscrete
public boolean isDiscrete()
-
setDiscrete
public void setDiscrete(boolean discrete)
-
attemptUpdate
public boolean attemptUpdate(Object value)
- Specified by:
attemptUpdatein interfaceProperty
-
requireType
public static void requireType(NumericProperty property, NumericPropertyKeyword type)
-
isDefaultSearchVariable
public boolean isDefaultSearchVariable()
-
isOptimisable
public boolean isOptimisable()
-
setDefaultSearchVariable
public void setDefaultSearchVariable(boolean defaultSearchVariable)
-
setOptimisable
public void setOptimisable(boolean optimisable)
-
getDimensionDelta
public Number getDimensionDelta()
-
getBounds
public Segment getBounds()
Represents the bounds specified for this numeric property as aSegmentobject. The bound numbers are taken by their double values and assigned to the segment.- Returns:
- the bounds in which this property is allowed to change
-
formattedOutput
public String formattedOutput()
Uses aNumericPropertyFormatterto generate a formatted output- Specified by:
formattedOutputin interfaceProperty- Returns:
- a formatted string output with the value (and error -- if available) of this numeric property
-
-