Source code: com/virtuosotechnologies/asaph/model/notation/NotationFactory.java
1 /*
2 ================================================================================
3
4 FILE: NotationFactory.java
5
6 PROJECT:
7
8 Asaph
9
10 CONTENTS:
11
12 API providing a factory for notation objects
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.model.notation;
43
44
45 import java.util.List;
46
47
48 /**
49 * API providing a factory for notation objects
50 */
51 public interface NotationFactory
52 {
53 // Gui builder methods
54
55 /**
56 * Get an array of the common intervals.
57 * This is used to construct choosers for intervals.
58 *
59 * @return array of Interval
60 */
61 public Interval[] getCommonIntervals();
62
63
64 /**
65 * Get an array of the base notes-- that is, with a default modifier (usually natural).
66 * This is used to construct choosers for notes.
67 *
68 * @return array of Note
69 */
70 public Note[] getBaseNotes();
71
72
73 /**
74 * Get an array of common modifiers for the given base note.
75 * This is used to construct choosers for notes.
76 *
77 * @param note Note to modify
78 * @return array of common modifiers for the given note.
79 */
80 public NoteModifier[] getCommonModifiersForNote(
81 Note note);
82
83
84 /**
85 * Get the default NoteModifier (typically natural) for the given note.
86 *
87 * @param n the note
88 * @return default NoteModifier
89 */
90 public NoteModifier getDefaultNoteModifierFor(
91 Note n);
92
93
94 // Parsing methods
95
96 /**
97 * Parse a Note from a String
98 *
99 * @param str source String
100 * @return resulting Note
101 */
102 public Note parseNote(
103 String str);
104
105
106 /**
107 * Parse a Note array from a String
108 *
109 * @param str source String
110 * @return resulting Note array
111 */
112 public Note[] parseNoteArray(
113 String str);
114
115
116 /**
117 * Parse a Chord from a String
118 *
119 * @param str source String
120 * @return resulting Chord
121 */
122 public Chord parseChord(
123 String str);
124
125
126 /**
127 * Parse a Chord array from a String
128 *
129 * @param str source String
130 * @return resulting Chord array
131 */
132 public Chord[] parseChordArray(
133 String str);
134
135
136 /**
137 * Generate a string for a chord array
138 *
139 * @param chords array of Chords
140 * @return String
141 */
142 public String unparseChordArray(
143 Chord[] chords);
144
145
146 // Convenience constructors
147
148 /**
149 * Construct an empty Chord
150 *
151 * @return new empty Chord
152 */
153 public Chord getEmptyChord();
154
155
156 /**
157 * Construct a default Note
158 *
159 * @return new Note
160 */
161 public Note getDefaultNote();
162 }