1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
6 |
* This file is part of JSampler. |
7 |
* |
8 |
* JSampler 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 |
* JSampler 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 JSampler; 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.jsampler; |
24 |
|
25 |
import org.jsampler.event.OrchestraListener; |
26 |
|
27 |
import org.w3c.dom.Document; |
28 |
import org.w3c.dom.Node; |
29 |
|
30 |
|
31 |
/** |
32 |
* A data model representing an orchestra. |
33 |
* @author Grigor Iliev |
34 |
*/ |
35 |
public interface OrchestraModel { |
36 |
/** |
37 |
* Registers the specified listener for receiving event messages. |
38 |
* @param l The <code>OrchestraListener</code> to register. |
39 |
*/ |
40 |
public void addOrchestraListener(OrchestraListener l); |
41 |
|
42 |
/** |
43 |
* Removes the specified listener. |
44 |
* @param l The <code>OrchestraListener</code> to remove. |
45 |
*/ |
46 |
public void removeOrchestraListener(OrchestraListener l); |
47 |
|
48 |
/** |
49 |
* Gets the name of this orchestra. |
50 |
* @return The name of this orchestra. |
51 |
*/ |
52 |
public String getName(); |
53 |
|
54 |
/** |
55 |
* Sets the name of this orchestra. |
56 |
* @param name The new name of this orchestra. |
57 |
*/ |
58 |
public void setName(String name); |
59 |
|
60 |
/** |
61 |
* Gets a brief description about this orchestra. |
62 |
* @return A brief description about this orchestra. |
63 |
*/ |
64 |
public String getDescription(); |
65 |
|
66 |
/** |
67 |
* Sets a description about this orchestra. |
68 |
* @param desc A brief description about this orchestra. |
69 |
*/ |
70 |
public void setDescription(String desc); |
71 |
|
72 |
/** |
73 |
* Gets the current number of instruments in this orchestra. |
74 |
* @return The current number of instruments in this orchestra. |
75 |
*/ |
76 |
public int getInstrumentCount(); |
77 |
|
78 |
/** |
79 |
* Gets the instrument at the specified position. |
80 |
* @param idx The index of the instrument to be returned. |
81 |
* @return The instrument at the specified position. |
82 |
*/ |
83 |
public OrchestraInstrument getInstrument(int idx); |
84 |
|
85 |
/** |
86 |
* Adds the specified instrument to this orchestra. |
87 |
* @param instr The instrument to be added. |
88 |
*/ |
89 |
public void addInstrument(OrchestraInstrument instr); |
90 |
|
91 |
/** |
92 |
* Inserts the specified instrument at the specified position. |
93 |
* @param instr The instrument to be inserted. |
94 |
* @param idx The position of the instrument. |
95 |
* @throws IllegalArgumentException If <code>instr</code> is <code>null</code>. |
96 |
* @throws ArrayIndexOutOfBoundsException If the specified index is invalid. |
97 |
*/ |
98 |
public void insertInstrument(OrchestraInstrument instr, int idx); |
99 |
|
100 |
/** |
101 |
* Removes the specified instrument from this orchestra. |
102 |
* @param idx The index of the instrument to remove. |
103 |
*/ |
104 |
public void removeInstrument(int idx); |
105 |
|
106 |
/** |
107 |
* Removes the specified instrument from this orchestra. |
108 |
* @param instr The instrument to remove. |
109 |
* @return <code>true</code> if the specified instrument was in this orchestra, |
110 |
* <code>false</code> otherwise. |
111 |
*/ |
112 |
public boolean removeInstrument(OrchestraInstrument instr); |
113 |
|
114 |
/** |
115 |
* Gets the position of the specified instrument in this orchestra. |
116 |
* @param instr The instrument whose index should be returned. |
117 |
* @return The position of the specified instrument in this orchestra, |
118 |
* and -1 if <code>instr</code> is <code>null</code> or |
119 |
* the orchestra does not contain the specified instrument. |
120 |
*/ |
121 |
public int getInstrumentIndex(OrchestraInstrument instr); |
122 |
|
123 |
/** |
124 |
* Moves the specified instrument one the top of the instrument list. |
125 |
* This method does nothing if <code>instr</code> is <code>null</code>, |
126 |
* the orchestra does not contain the specified instrument, |
127 |
* or if the instrument is already on the top. |
128 |
* @param instr The instrument to move on top. |
129 |
*/ |
130 |
public void moveInstrumentOnTop(OrchestraInstrument instr); |
131 |
|
132 |
/** |
133 |
* Moves the specified instrument one position up in the instrument list. |
134 |
* This method does nothing if <code>instr</code> is <code>null</code>, |
135 |
* the orchestra does not contain the specified instrument, |
136 |
* or if the instrument is already on the top. |
137 |
* @param instr The instrument to move up. |
138 |
*/ |
139 |
public void moveInstrumentUp(OrchestraInstrument instr); |
140 |
|
141 |
/** |
142 |
* Moves the specified instrument one position down in the instrument list. |
143 |
* This method does nothing if <code>instr</code> is <code>null</code>, |
144 |
* the orchestra does not contain the specified instrument, |
145 |
* or if the instrument is already at the bottom. |
146 |
* @param instr The instrument to move down. |
147 |
*/ |
148 |
public void moveInstrumentDown(OrchestraInstrument instr); |
149 |
|
150 |
/** |
151 |
* Moves the specified instrument at the bottom of the instrument list. |
152 |
* This method does nothing if <code>instr</code> is <code>null</code>, |
153 |
* the orchestra does not contain the specified instrument, |
154 |
* or if the instrument is already at the bottom. |
155 |
* @param instr The instrument to move at bottom. |
156 |
*/ |
157 |
public void moveInstrumentAtBottom(OrchestraInstrument instr); |
158 |
|
159 |
/** |
160 |
* Reads and sets the content of this orchestra provided by <code>node</code>. |
161 |
* @param node The node providing the content of this orchestra. |
162 |
* @throws IllegalArgumentException If an error occurs while |
163 |
* reading the content of this orchestra. |
164 |
*/ |
165 |
public void readObject(Node node); |
166 |
|
167 |
/** |
168 |
* Writes the content of this orchestra to the |
169 |
* specified node of document <code>doc</code>. |
170 |
* @param doc The document containing <code>node</code>. |
171 |
* @param node Specifies the node where the content of this orchestra |
172 |
* should be written. |
173 |
*/ |
174 |
public void writeObject(Document doc, Node node); |
175 |
} |