Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/virtuosotechnologies/asaph/notationmanager/StandardNoteModifier.java


1   /*
2   ================================================================================
3   
4     FILE:  StandardNoteModifier.java
5     
6     PROJECT:
7     
8       Asaph
9     
10    CONTENTS:
11    
12      Standard implementation of NoteModifier
13    
14    PROGRAMMERS:
15    
16      Daniel Azuma (DA)  <dazuma@kagi.com>
17    
18    COPYRIGHT:
19    
20      Copyright (C) 2003  Daniel Azuma  (dazuma@kagi.com)
21      
22      This program is free software; you can redistribute it and/or
23      modify it under the terms of the GNU General Public License as
24      published by the Free Software Foundation; either version 2
25      of the License, or (at your option) any later version.
26      
27      This program is distributed in the hope that it will be useful,
28      but WITHOUT ANY WARRANTY; without even the implied warranty of
29      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30      GNU General Public License for more details.
31      
32      You should have received a copy of the GNU General Public
33      License along with this program; if not, write to
34        Free Software Foundation, Inc.
35        59 Temple Place, Suite 330
36        Boston, MA 02111-1307 USA
37  
38  ================================================================================
39  */
40  
41  
42  package com.virtuosotechnologies.asaph.notationmanager;
43  
44  import com.virtuosotechnologies.asaph.model.notation.NoteModifier;
45  import com.virtuosotechnologies.asaph.model.notation.NotationFactory;
46  
47  
48  /**
49   * Standard implementation of NoteModifier.
50   */
51  /*package*/ class StandardNoteModifier
52  implements
53    NoteModifier
54  {
55    private StandardNotationFactory factory_;
56    private int value_;
57    
58    
59    /*package*/ StandardNoteModifier(
60      StandardNotationFactory factory,
61      int value)
62    {
63      factory_ = factory;
64      value_ = value;
65    }
66    
67    
68    /*package*/ int getValue()
69    {
70      return value_;
71    }
72    
73    
74    /**
75     * Get the NotationFactory that created this object
76     *
77     * @return the NotationFactory
78     */
79    public NotationFactory getNotationFactory()
80    {
81      return factory_;
82    }
83    
84    
85    /**
86     * Generate the long string representation
87     *
88     * @return String
89     */
90    public String generateLongString()
91    {
92      return factory_.getLongStringForNoteModifierValue(value_);
93    }
94    
95    
96    /**
97     * Generate the short (symbolic) string representation
98     *
99     * @return String
100    */
101   public String generateString()
102   {
103     return factory_.getShortStringForNoteModifierValue(value_);
104   }
105   
106   
107   /**
108    * equals
109    */
110   public boolean equals(
111     Object obj)
112   {
113     if (obj instanceof StandardNoteModifier)
114     {
115       StandardNoteModifier snm = (StandardNoteModifier)obj;
116       return value_ == snm.value_ &&
117         factory_ == snm.factory_;
118     }
119     return false;
120   }
121   
122   
123   /**
124    * hashCode
125    */
126   public int hashCode()
127   {
128     return value_;
129   }
130   
131   
132   /**
133    * toString
134    */
135   public String toString()
136   {
137     return generateString();
138   }
139 }