/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/SamplerEngine.java
ViewVC logotype

Annotation of /jlscp/trunk/src/org/linuxsampler/lscp/SamplerEngine.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1539 - (hide annotations) (download)
Mon Dec 3 22:59:39 2007 UTC (16 years, 4 months ago) by iliev
File size: 3681 byte(s)
* Added new interface - Instrument
* Client: added new methods - getFileInstrumentCount,
  getFileInstrumentInfo,  getFileInstruments

1 iliev 596 /*
2     * jlscp - a java LinuxSampler control protocol API
3     *
4 iliev 1139 * Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 596 *
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 iliev 1421 import static org.linuxsampler.lscp.Parser.*;
26    
27 iliev 596 /**
28     * Provides information about a specific sampler engine.
29     * @author Grigor Iliev
30     */
31     public class SamplerEngine implements Parseable {
32     private String name = null;
33     private String desc = null;
34     private String ver = null;
35    
36    
37     /** Creates a new instance of <code>SamplerEngine</code> */
38     public SamplerEngine() {
39     }
40    
41     /**
42     * Creates a new instance of <code>SamplerEngine</code> and parses the information
43     * about a sampler engine described by <code>resultSet</code>.
44     * @param resultSet An array of information categories about a sampler engine.
45     */
46     public
47     SamplerEngine(String[] resultSet) {
48     for(String s : resultSet)
49     if(!parse(s)) Client.getLogger().info(LscpI18n.getLogMsg("unknownLine", s));
50     }
51    
52     /**
53     * Gets the name of this sampler engine.
54     * @return The name of this sampler engine.
55     */
56     public String
57     getName() { return name; }
58    
59     /**
60     * Sets the name of this sampler engine.
61     * @param name A <code>String</code> instance containing the new name for
62     * this sampler engine.
63     */
64     public void
65     setName(String name) { this.name = name; }
66    
67     /**
68     * Gets a description about this sampler engine.
69     * @return A description about this sampler engine.
70     */
71     public String
72     getDescription() { return desc; }
73    
74     /**
75     * Gets the version of this sampler engine.
76     * @return The version of this sampler engine.
77     */
78     public String
79     getVersion() { return ver; }
80    
81     /**
82     * Parses a line of text.
83     * @param s The string to be parsed.
84     * @return <code>true</code> if the line has been processed, <code>false</code> otherwise.
85     */
86     public boolean
87     parse(String s) {
88     if(s.startsWith("DESCRIPTION: ")) {
89     desc = s.substring("DESCRIPTION: ".length(), s.length());
90 iliev 1421 desc = toNonEscapedString(desc);
91 iliev 596 } else if(s.startsWith("VERSION: ")) {
92     ver = s.substring("VERSION: ".length(), s.length());
93     } else return false;
94    
95     return true;
96     }
97    
98     /**
99 iliev 784 * Compares this <code>SamplerEngine</code> instance to the specified object.
100     * The result is <code>true</code> if <code>obj</code> is reference to
101     * <code>this</code>, or if <code>obj</code> is a <code>SamplerEngine</code> instance
102     * and has non-<code>null</code> name equal to the name of this engine.
103     *
104     * @return <code>true</code> if <code>obj</code> is reference to
105     * <code>this</code>, or if <code>obj</code> is a <code>SamplerEngine</code> instance
106     * and has non-<code>null</code> name equal to the name of this engine;
107     * <code>false</code> otherwise.
108     * @see #getName
109 iliev 596 */
110 iliev 784 public boolean
111     equals(Object obj) {
112     if(this == obj) return true;
113    
114     if(getName() == null || obj == null) return false;
115    
116     if(obj instanceof SamplerEngine)
117     return getName().equals(((SamplerEngine)obj).getName());
118    
119     return false;
120     }
121    
122 iliev 596 public String
123 iliev 1539 toString() { return getName() + " engine"; }
124 iliev 596 }

  ViewVC Help
Powered by ViewVC