-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPitchParser.java
More file actions
36 lines (33 loc) · 960 Bytes
/
Copy pathPitchParser.java
File metadata and controls
36 lines (33 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package edu.kit.informatik;
/**
* Helper class to determine pitch type.
*
* @author John Dederer
* @version 1.0
*/
public final class PitchParser {
/**
* Private constructor to avoid instantiation.
*/
private PitchParser() {
}
/**
* Returns the pitch type provided in program parameter.
* Idea for this method came from example solutions of the Übungsaufgaben. Credits go to : Martin Löper.
*
* @param pitchType the type provided
* @return the pitch type requested
*/
public static Pitch getPitchType(String pitchType) {
switch (pitchType) {
case Pitch.TYPE_STD:
return new Pitch();
case Pitch.TYPE_TORUS:
return new TorusPitch();
default:
Terminal.printLine("Error, the pitch type \"" + pitchType + "\" is invalid.");
System.exit(1);
return null;
}
}
}