-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.java
97 lines (85 loc) · 1.65 KB
/
Model.java
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aoop;
import java.util.ArrayList;
/**
* Model of MVC pattern
* Contains all data models
* @author Daniel and Erik
*/
public class Model {
/**
* default constructor.
* creates a tone
*/
public Model()
{
sound = new Tone(600,0.2);
}
/**
* Add controller part of MVC pattern
* @param c controller
*/
public void addController(Controller c)
{
this.c = c;
}
/**
* Add view part of MVC pattern
* @param v view
*/
public void addView(View v)
{
this.v = v;
}
/**
* Sets current filter to f
* @param f filter to use
*/
public void setCurrentFilter(Filter f)
{
curFilter = f;
}
/**
* Gets active filter
* @return active filter
*/
public Filter getCurrentFilter()
{
return curFilter;
}
/**
* Gets current sound
* @return current sound
*/
public Sound getSound()
{
return sound;
}
/**
* Sets current sound to s
* @param s new sound
*/
public void setSound(Sound s)
{
sound = s;
}
/**
* Gets samples of current sound
* @return current samples
*/
public double[] getSample()
{
return sound.getSample();
}
/**
* field variables
*/
private Sound sound;
private Filter curFilter;
private Controller c;
private View v;
}