28 |
* |
* |
29 |
* @author Grigor Iliev |
* @author Grigor Iliev |
30 |
*/ |
*/ |
31 |
public abstract class AbstractInstrument implements Parseable { |
public abstract class AbstractInstrument implements Instrument, Parseable { |
32 |
private String name = "Untitled"; |
private String name = "Untitled"; |
33 |
private String description = ""; |
private String description = ""; |
34 |
private String path = null; |
private String path = null; |
35 |
private int instrumentIndex = 0; |
private int instrumentIndex = 0; |
36 |
|
private String formatFamily = ""; |
37 |
|
private String formatVersion = ""; |
38 |
|
|
39 |
/** |
/** |
40 |
* Creates a new instance of <code>AbstractInstrument</code>. |
* Creates a new instance of <code>AbstractInstrument</code>. |
41 |
*/ |
*/ |
42 |
public AbstractInstrument() { |
public |
43 |
|
AbstractInstrument() { } |
44 |
|
|
45 |
|
/** |
46 |
|
* Creates a new instance of <code>AbstractInstrument</code>. |
47 |
|
* @param resultSet An array with information categories about an instrument. |
48 |
|
*/ |
49 |
|
public |
50 |
|
AbstractInstrument(String[] resultSet) throws LscpException { |
51 |
|
for(String s : resultSet) |
52 |
|
if(!parse(s)) Client.getLogger().info(LscpI18n.getLogMsg("unknownLine", s)); |
53 |
} |
} |
54 |
|
|
55 |
/** |
/** |
102 |
setInstrumentIndex(int idx) { instrumentIndex = idx; } |
setInstrumentIndex(int idx) { instrumentIndex = idx; } |
103 |
|
|
104 |
/** |
/** |
105 |
|
* Returns the format family of the instrument. |
106 |
|
**/ |
107 |
|
public String |
108 |
|
getFormatFamily() { return formatFamily; } |
109 |
|
|
110 |
|
/** |
111 |
|
* Returns the format version of the instrument. |
112 |
|
**/ |
113 |
|
public String |
114 |
|
getFormatVersion() { return formatVersion; } |
115 |
|
|
116 |
|
/** |
117 |
* Parses a line of text. |
* Parses a line of text. |
118 |
* @param s The string to be parsed. |
* @param s The string to be parsed. |
119 |
* @return <code>true</code> if the line has been processed, <code>false</code> otherwise. |
* @return <code>true</code> if the line has been processed, <code>false</code> otherwise. |
131 |
} else if(s.startsWith("INSTRUMENT_NR: ")) { |
} else if(s.startsWith("INSTRUMENT_NR: ")) { |
132 |
s = s.substring("INSTRUMENT_NR: ".length()); |
s = s.substring("INSTRUMENT_NR: ".length()); |
133 |
setInstrumentIndex(Parser.parseInt(s)); |
setInstrumentIndex(Parser.parseInt(s)); |
134 |
|
} else if(s.startsWith("FORMAT_FAMILY: ")) { |
135 |
|
formatFamily = s.substring("FORMAT_FAMILY: ".length()); |
136 |
|
} else if(s.startsWith("FORMAT_VERSION: ")) { |
137 |
|
formatVersion = s.substring("FORMAT_VERSION: ".length()); |
138 |
} else return false; |
} else return false; |
139 |
|
|
140 |
return true; |
return true; |