jlscp
v0.8

org.linuxsampler.lscp
Class AbstractParameter<T>

java.lang.Object
  extended by org.linuxsampler.lscp.AbstractParameter<T>
All Implemented Interfaces:
Parameter<T>, Parseable
Direct Known Subclasses:
BoolListParameter, BoolParameter, FloatListParameter, FloatParameter, IntListParameter, IntParameter, StringListParameter, StringParameter

public abstract class AbstractParameter<T>
extends java.lang.Object
implements Parameter<T>, Parseable

This class provides default implementation of the Parameter interface.


Constructor Summary
AbstractParameter()
           
 
Method Summary
 T getDefault()
          Gets the default value for this parameter.
 java.lang.String[] getDependances()
          Gets a String array with parameter's names this parameter depends on.
 java.lang.String getDescription()
          Gets the description of this parameter.
 java.lang.String getName()
          Gets the name of this parameter.
 T[] getPossibilities()
          Gets a list of possible values for this parameter.
 java.lang.Number getRangeMax()
          Gets the upper limit of the allowed value range for this parameter.
 java.lang.Number getRangeMin()
          Gets the lower limit of the allowed value range for this parameter.
 ParameterType getType()
          Gets the type of this parameter.
 T getValue()
          Gets the current value of this parameter.
 boolean hasDependances()
          Checks if this parameter depends on some other parameter(s).
 boolean hasPossibilities()
          Determines whether this parameter has a list of possible values.
 boolean hasRangeMax()
          Determines whether this parameter has an upper limit.
 boolean hasRangeMin()
          Determines whether this parameter has a lower limit.
 boolean isBoolean()
          Determines whether this parameter contains boolean value.
 boolean isBooleanList()
          Determines whether this parameter contains list of boolean values.
 boolean isFixed()
          Defines if this parameter can be altered.
 boolean isFloat()
          Determines whether this parameter contains float value.
 boolean isFloatList()
          Determines whether this parameter contains list of float values.
 boolean isInteger()
          Determines whether this parameter contains integer value.
 boolean isIntegerList()
          Determines whether this parameter contains list of integer values.
 boolean isMandatory()
          Defines if this parameter must be given when the device is to be created.
 boolean isMultiplicity()
          Defines if this parameter allows only one value or list of values.
 boolean isString()
          Determines whether this parameter contains string value.
 boolean isStringList()
          Determines whether this parameter contains list of string values.
 boolean parse(java.lang.String s)
          Parses a line of text.
protected  void parseLines(java.lang.String[] lnS)
          Parses the specified lines.
 T setDefault(T dflt)
          Sets the default value for this parameter.
 void setDescription(java.lang.String desc)
          Sets the description of this parameter.
 void setMultiplicity(boolean b)
          Sets if this parameter allows only one value or list of values.
 void setName(java.lang.String name)
          Sets the name of this parameter.
 void setPossibilities(T[] pos)
          Sets the list of possible values for this parameter.
 void setRangeMax(java.lang.Number max)
          Sets the upper limit of the allowed value range for this parameter.
 void setRangeMin(java.lang.Number min)
          Sets the lower limit of the allowed value range for this parameter.
 void setType(ParameterType type)
          Sets the type of this parameter.
 void setValue(T val)
          Sets the current value of this parameter.
 java.lang.String toString()
          Returns the name of this parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.linuxsampler.lscp.Parameter
getStringValue, parseValue
 

Constructor Detail

AbstractParameter

public AbstractParameter()
Method Detail

getName

public java.lang.String getName()
Gets the name of this parameter.

Specified by:
getName in interface Parameter<T>
Returns:
The name of this parameter.

setName

public void setName(java.lang.String name)
Sets the name of this parameter.

Specified by:
setName in interface Parameter<T>
Parameters:
name - A String object containing the new name for this parameter.

getDescription

public java.lang.String getDescription()
Gets the description of this parameter.

Specified by:
getDescription in interface Parameter<T>
Returns:
The description of this parameter.

setDescription

public void setDescription(java.lang.String desc)
Sets the description of this parameter.

Parameters:
desc - A String instance containing the description of this parameter.

getType

public ParameterType getType()
Gets the type of this parameter.

Specified by:
getType in interface Parameter<T>
Returns:
The type of this parameter.

setType

public void setType(ParameterType type)
Sets the type of this parameter.

Parameters:
type - The type of this parameter.

getValue

public T getValue()
Gets the current value of this parameter.

Specified by:
getValue in interface Parameter<T>
Returns:
The current value of this parameter.

setValue

public void setValue(T val)
Sets the current value of this parameter.

Specified by:
setValue in interface Parameter<T>
Parameters:
val - The new value for this parameter.

isBoolean

public boolean isBoolean()
Determines whether this parameter contains boolean value.

Returns:
true if this parameter contains boolean value, false otherwise.

isInteger

public boolean isInteger()
Determines whether this parameter contains integer value.

Returns:
true if this parameter contains integer value, false otherwise.

isFloat

public boolean isFloat()
Determines whether this parameter contains float value.

Returns:
true if this parameter contains float value, false otherwise.

isString

public boolean isString()
Determines whether this parameter contains string value.

Returns:
true if this parameter contains string value, false otherwise.

isBooleanList

public boolean isBooleanList()
Determines whether this parameter contains list of boolean values.

Returns:
true if this parameter contains list of boolean values, false otherwise.

isIntegerList

public boolean isIntegerList()
Determines whether this parameter contains list of integer values.

Returns:
true if this parameter contains list of integer values, false otherwise.

isFloatList

public boolean isFloatList()
Determines whether this parameter contains list of float values.

Returns:
true if this parameter contains list of float values, false otherwise.

isStringList

public boolean isStringList()
Determines whether this parameter contains list of string values.

Returns:
true if this parameter contains list of string values, false otherwise.

isFixed

public boolean isFixed()
Defines if this parameter can be altered.

Specified by:
isFixed in interface Parameter<T>
Returns:
true if the parameter is readonly and false if the parameter can be altered.

isMultiplicity

public boolean isMultiplicity()
Defines if this parameter allows only one value or list of values.

Specified by:
isMultiplicity in interface Parameter<T>
Returns:
false if this parameter allows only one value and true if allows a list of values.

setMultiplicity

public void setMultiplicity(boolean b)
Sets if this parameter allows only one value or list of values.

Parameters:
b - true if this parameter allows list of values, false otherwise.

isMandatory

public boolean isMandatory()
Defines if this parameter must be given when the device is to be created.

Specified by:
isMandatory in interface Parameter<T>
Returns:
true if this parameter must be given when the device is to be created and false otherwise.

getDependances

public java.lang.String[] getDependances()
Gets a String array with parameter's names this parameter depends on.

Specified by:
getDependances in interface Parameter<T>
Returns:
A String array with parameter's names this parameter depends on or null if this parameter has no dependances.

hasDependances

public boolean hasDependances()
Checks if this parameter depends on some other parameter(s).

Specified by:
hasDependances in interface Parameter<T>
Returns:
true if this parameter depends on some other parameter(s) and false otherwise.

parse

public boolean parse(java.lang.String s)
              throws LscpException
Parses a line of text.

Specified by:
parse in interface Parseable
Parameters:
s - A string to be parsed.
Returns:
true if the line has been processed, false otherwise.
Throws:
LscpException - If some error occurs.

parseLines

protected void parseLines(java.lang.String[] lnS)
                   throws LscpException
Parses the specified lines.

Parameters:
lnS - The lines to be parsed.
Throws:
LscpException - If some error occurs.

getDefault

public T getDefault()
Gets the default value for this parameter.

Specified by:
getDefault in interface Parameter<T>
Returns:
The default value for this parameter.

setDefault

public T setDefault(T dflt)
Sets the default value for this parameter.

Parameters:
dflt - Specifies the default value for this parameter.

getRangeMin

public java.lang.Number getRangeMin()
Gets the lower limit of the allowed value range for this parameter.

Specified by:
getRangeMin in interface Parameter<T>
Returns:
The lower limit of the allowed value range for this parameter or null if the parameter doesn't have lower limit.

setRangeMin

public void setRangeMin(java.lang.Number min)
Sets the lower limit of the allowed value range for this parameter.

Parameters:
min - Specifies the lower limit of the allowed value range for this parameter.

getRangeMax

public java.lang.Number getRangeMax()
Gets the upper limit of the allowed value range for this parameter.

Specified by:
getRangeMax in interface Parameter<T>
Returns:
The upper limit of the allowed value range for this parameter or null if the parameter doesn't have upper limit.

setRangeMax

public void setRangeMax(java.lang.Number max)
Sets the upper limit of the allowed value range for this parameter.

Parameters:
max - Specifies the upper limit of the allowed value range for this parameter.

getPossibilities

public T[] getPossibilities()
Gets a list of possible values for this parameter.

Specified by:
getPossibilities in interface Parameter<T>
Returns:
A list of possible values for this parameter.

setPossibilities

public void setPossibilities(T[] pos)
Sets the list of possible values for this parameter.

Parameters:
pos - The new list of possible values for this parameter.

hasRangeMin

public boolean hasRangeMin()
Determines whether this parameter has a lower limit.

Specified by:
hasRangeMin in interface Parameter<T>
Returns:
true if this parameter has a lower limit, false otherwise.

hasRangeMax

public boolean hasRangeMax()
Determines whether this parameter has an upper limit.

Specified by:
hasRangeMax in interface Parameter<T>
Returns:
true if this parameter has an upper limit, false otherwise.

hasPossibilities

public boolean hasPossibilities()
Determines whether this parameter has a list of possible values.

Specified by:
hasPossibilities in interface Parameter<T>
Returns:
true if this parameter has a list of possible values, false otherwise.

toString

public java.lang.String toString()
Returns the name of this parameter.

Overrides:
toString in class java.lang.Object
Returns:
The name of this parameter.

jlscp
v0.8

Copyright © 2009 Grigor Iliev. All rights reserved.