1 |
/* |
2 |
* jlscp - a java LinuxSampler control protocol API |
3 |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of jlscp. |
7 |
* |
8 |
* jlscp is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 |
10 |
* as published by the Free Software Foundation. |
11 |
* |
12 |
* jlscp is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with jlscp; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 |
* MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
package org.linuxsampler.lscp; |
24 |
|
25 |
/** |
26 |
* Defines the generic properties that every parameter should have. |
27 |
* @author Grigor Iliev |
28 |
*/ |
29 |
public interface Parameter<T> { |
30 |
/** |
31 |
* Gets the name of this parameter. |
32 |
* @return The name of this parameter. |
33 |
*/ |
34 |
public String getName(); |
35 |
|
36 |
/** |
37 |
* Sets the name of this parameter. |
38 |
* @param name A <code>String</code> instance containing the new name for this parameter. |
39 |
*/ |
40 |
public void setName(String name); |
41 |
|
42 |
/** |
43 |
* Parses the specified character string and sets the value of this parameter |
44 |
* with the parsed result. |
45 |
* @param s A character string containing the value to be parsed. |
46 |
* @throws LscpException If the parsing failed. |
47 |
*/ |
48 |
public void parseValue(String s) throws LscpException; |
49 |
|
50 |
/** |
51 |
* Gets a character string representation of the parameter's value. |
52 |
* @return A character string representation of the parameter's value. |
53 |
*/ |
54 |
public String getStringValue(); |
55 |
|
56 |
/** |
57 |
* Gets the description of this parameter. |
58 |
* @return The description of this parameter. |
59 |
*/ |
60 |
public String getDescription(); |
61 |
|
62 |
/** |
63 |
* Gets the type of this parameter. |
64 |
* @return The type of this parameter. |
65 |
*/ |
66 |
public ParameterType getType(); |
67 |
|
68 |
/** |
69 |
* Gets the current value of this parameter. |
70 |
* @return The current value of this parameter. |
71 |
*/ |
72 |
public T getValue(); |
73 |
|
74 |
/** |
75 |
* Sets the current value of this parameter. |
76 |
* @param val The new value for this parameter. |
77 |
*/ |
78 |
public void setValue(T val); |
79 |
|
80 |
/** |
81 |
* Gets the default value for this parameter. |
82 |
* @return The default value for this parameter. |
83 |
*/ |
84 |
public T getDefault(); |
85 |
|
86 |
/** |
87 |
* Defines if this parameter can be altered. |
88 |
* @return <code>true</code> if the parameter is readonly and <code>false</code> |
89 |
* if the parameter can be altered. |
90 |
*/ |
91 |
public boolean isFixed(); |
92 |
|
93 |
/** |
94 |
* Defines if this parameter allows only one value or list of values. |
95 |
* @return <code>false</code> if this parameter allows only one value and <code>true</code> |
96 |
* if allows a list of values. |
97 |
*/ |
98 |
public boolean isMultiplicity(); |
99 |
|
100 |
/** |
101 |
* Defines if this parameter must be given when the device is to be created. |
102 |
* @return <code>true</code> if this parameter must be given when the device |
103 |
* is to be created and <code>false</code> otherwise. |
104 |
*/ |
105 |
public boolean isMandatory(); |
106 |
|
107 |
/** |
108 |
* Checks if this parameter depends on some other parameter(s). |
109 |
* @return <code>true</code> if this parameter depends on some other parameter(s) |
110 |
* and <code>false</code> otherwise. |
111 |
*/ |
112 |
public boolean hasDependances(); |
113 |
|
114 |
/** |
115 |
* Gets a <code>String</code> array with parameter's names this parameter depends on. |
116 |
* @return A <code>String</code> array with parameter's names this parameter depends on |
117 |
* or <code>null</code> if this parameter has no dependances. |
118 |
*/ |
119 |
public String[] getDependances(); |
120 |
|
121 |
/** |
122 |
* Determines whether this parameter has a lower limit. |
123 |
* @return <code>true</code> if this parameter has a lower limit, |
124 |
* <code>false</code> otherwise. |
125 |
*/ |
126 |
public boolean hasRangeMin(); |
127 |
|
128 |
/** |
129 |
* Gets the lower limit of the allowed value range for this parameter. |
130 |
* @return The lower limit of the allowed value range for this |
131 |
* parameter or <code>null</code> if the parameter doesn't have lower limit. |
132 |
*/ |
133 |
public Number getRangeMin(); |
134 |
|
135 |
/** |
136 |
* Determines whether this parameter has an upper limit. |
137 |
* @return <code>true</code> if this parameter has an upper limit, |
138 |
* <code>false</code> otherwise. |
139 |
*/ |
140 |
public boolean hasRangeMax(); |
141 |
|
142 |
/** |
143 |
* Gets the upper limit of the allowed value range for this parameter. |
144 |
* @return The upper limit of the allowed value range for this |
145 |
* parameter or <code>null</code> if the parameter doesn't have upper limit. |
146 |
*/ |
147 |
public Number getRangeMax(); |
148 |
|
149 |
/** |
150 |
* Determines whether this parameter has a list of possible values. |
151 |
* @return <code>true</code> if this parameter has a list of possible values, |
152 |
* <code>false</code> otherwise. |
153 |
*/ |
154 |
public boolean hasPossibilities(); |
155 |
|
156 |
/** |
157 |
* Gets a list of possible values for this parameter. |
158 |
* @return A list of possible values for this parameter. |
159 |
*/ |
160 |
public T[] getPossibilities(); |
161 |
} |