1 |
iliev |
596 |
/* |
2 |
|
|
* jlscp - a java LinuxSampler control protocol API |
3 |
|
|
* |
4 |
|
|
* Copyright (C) 2005 Grigor Kirilov Iliev |
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 |
|
|
import java.util.Vector; |
26 |
|
|
|
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Represents the Result set as defined in LSCP protocol specification. |
30 |
|
|
* @author Grigor Iliev |
31 |
|
|
*/ |
32 |
|
|
class ResultSet { |
33 |
|
|
private int idx = 0; |
34 |
|
|
|
35 |
|
|
private int code = 0; |
36 |
|
|
private String message = null; |
37 |
|
|
|
38 |
|
|
private String res = null; |
39 |
|
|
private final Vector<String> mlRes = new Vector<String>(); |
40 |
|
|
|
41 |
|
|
private boolean warning = false; |
42 |
|
|
|
43 |
|
|
/** Creates a new instance of ResultSet */ |
44 |
|
|
public ResultSet() { |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
/** |
48 |
|
|
* Determines whether this result set has warning message. |
49 |
|
|
* @return <code>true</code> if this result set has warning message, |
50 |
|
|
* <code>false</code> otherwise. |
51 |
|
|
*/ |
52 |
|
|
public boolean |
53 |
|
|
hasWarning() { return warning; } |
54 |
|
|
|
55 |
|
|
/** |
56 |
|
|
* Sets whether this result set has warning message. |
57 |
|
|
* @param b Determines whether this result set has warning message. |
58 |
|
|
*/ |
59 |
|
|
public void |
60 |
|
|
setWarning(boolean b) { warning = b; } |
61 |
|
|
|
62 |
|
|
/** |
63 |
|
|
* Gets the index of indexed warnings and empty result sets. |
64 |
|
|
* @return The index of indexed warnings and empty result sets. |
65 |
|
|
*/ |
66 |
|
|
public int |
67 |
|
|
getIndex() { return idx; } |
68 |
|
|
|
69 |
|
|
/** |
70 |
|
|
* Sets the index of indexed warnings and empty result sets. |
71 |
|
|
* @param idx The specifed index. |
72 |
|
|
*/ |
73 |
|
|
public void |
74 |
|
|
setIndex(int idx) { this.idx = idx; } |
75 |
|
|
|
76 |
|
|
/** |
77 |
|
|
* Gets the code of warning or error result set. |
78 |
|
|
* @return The unique numeric identifier of the warning or error. |
79 |
|
|
*/ |
80 |
|
|
public int |
81 |
|
|
getCode() { return code; } |
82 |
|
|
|
83 |
|
|
/** |
84 |
|
|
* Sets the code of warning or error result set. |
85 |
|
|
* @param code The unique numeric identifier of the warning or error. |
86 |
|
|
*/ |
87 |
|
|
public void |
88 |
|
|
setCode(int code) { this.code = code; } |
89 |
|
|
|
90 |
|
|
/** |
91 |
|
|
* Gets the warning or error message. |
92 |
|
|
* @return The warning or error message. |
93 |
|
|
*/ |
94 |
|
|
public String |
95 |
|
|
getMessage() { return message; } |
96 |
|
|
|
97 |
|
|
/** |
98 |
|
|
* Sets the warning or error message. |
99 |
|
|
* @param message The warning or error message. |
100 |
|
|
*/ |
101 |
|
|
public void |
102 |
|
|
setMessage(String message) { this.message = message; } |
103 |
|
|
|
104 |
|
|
/** |
105 |
|
|
* Gets a single line result set. |
106 |
|
|
* @return A single line result set. |
107 |
|
|
*/ |
108 |
|
|
public String |
109 |
|
|
getResult() { return res; } |
110 |
|
|
|
111 |
|
|
/** |
112 |
|
|
* Sets a single line result set. |
113 |
|
|
* @param res The single line result set. |
114 |
|
|
*/ |
115 |
|
|
public void |
116 |
|
|
setResult(String res) { this.res = res; } |
117 |
|
|
|
118 |
|
|
/** |
119 |
|
|
* Adds line to the multi-line result set. |
120 |
|
|
* @param ln The line to be added. |
121 |
|
|
*/ |
122 |
|
|
public void |
123 |
|
|
addLine(String ln) { mlRes.add(ln); } |
124 |
|
|
|
125 |
|
|
/** |
126 |
|
|
* Gets a multi-line result set. |
127 |
|
|
* @return A multi-line result set. |
128 |
|
|
*/ |
129 |
|
|
public String[] |
130 |
|
|
getMultiLineResult() { return mlRes.toArray(new String[mlRes.size()]); } |
131 |
|
|
} |