1 |
d333eb6b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
a4835695
|
Leszek Koltunski
|
package org.distorted.library.type;
|
21 |
6a06a912
|
Leszek Koltunski
|
|
22 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23 |
|
|
/**
|
24 |
|
|
* A 1-dimensional data structure containing a single float. The float has no particular meaning;
|
25 |
cacc63de
|
Leszek Koltunski
|
* when this data structure is used in Dynamics, we can think of it as a 1-dimensional Point
|
26 |
568b29d8
|
Leszek Koltunski
|
* a few of which the Dynamic interpolates between.
|
27 |
6a06a912
|
Leszek Koltunski
|
*/
|
28 |
|
|
|
29 |
6d62a900
|
Leszek Koltunski
|
public class Static1D extends Static implements Data1D
|
30 |
6a06a912
|
Leszek Koltunski
|
{
|
31 |
|
|
float x;
|
32 |
|
|
|
33 |
6d62a900
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34 |
|
|
|
35 |
|
|
Static1D(int dim, float ox)
|
36 |
|
|
{
|
37 |
|
|
super(dim);
|
38 |
|
|
x = ox;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
6a06a912
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
42 |
|
|
/**
|
43 |
|
|
* Constructor that initialises the value of the single float to ox.
|
44 |
|
|
*
|
45 |
|
|
* @param ox value of the single float.
|
46 |
|
|
*/
|
47 |
568b29d8
|
Leszek Koltunski
|
public Static1D(int ox)
|
48 |
6a06a912
|
Leszek Koltunski
|
{
|
49 |
6d62a900
|
Leszek Koltunski
|
super(1);
|
50 |
6a06a912
|
Leszek Koltunski
|
x = ox;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
54 |
|
|
/**
|
55 |
|
|
* Constructor that initialises the value of the single float to ox.
|
56 |
|
|
*
|
57 |
|
|
* @param ox value of the single float.
|
58 |
|
|
*/
|
59 |
568b29d8
|
Leszek Koltunski
|
public Static1D(float ox)
|
60 |
6a06a912
|
Leszek Koltunski
|
{
|
61 |
6d62a900
|
Leszek Koltunski
|
super(1);
|
62 |
6a06a912
|
Leszek Koltunski
|
x = ox;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
/**
|
67 |
|
|
* Resets the value of the single float.
|
68 |
|
|
*
|
69 |
|
|
* @param ox new value of the single float.
|
70 |
|
|
*/
|
71 |
|
|
public void set(int ox)
|
72 |
|
|
{
|
73 |
|
|
x = ox;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
77 |
|
|
/**
|
78 |
|
|
* Resets the value of the single float.
|
79 |
|
|
*
|
80 |
|
|
* @param ox new value of the single float.
|
81 |
|
|
*/
|
82 |
|
|
public void set(float ox)
|
83 |
|
|
{
|
84 |
|
|
x = ox;
|
85 |
|
|
}
|
86 |
8df64ab9
|
Leszek Koltunski
|
|
87 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
88 |
|
|
/**
|
89 |
|
|
* Resets the value of the first float.
|
90 |
|
|
*
|
91 |
|
|
* @param ox new value of the first float.
|
92 |
|
|
*/
|
93 |
|
|
public void set1(int ox)
|
94 |
|
|
{
|
95 |
|
|
x = ox;
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
99 |
|
|
/**
|
100 |
|
|
* Resets the value of the first float.
|
101 |
|
|
*
|
102 |
|
|
* @param ox new value of the first float.
|
103 |
|
|
*/
|
104 |
|
|
public void set1(float ox)
|
105 |
|
|
{
|
106 |
|
|
x = ox;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
6a06a912
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
110 |
|
|
/**
|
111 |
|
|
* Return the value of the float contained.
|
112 |
|
|
*
|
113 |
|
|
* @return The single float.
|
114 |
|
|
*/
|
115 |
|
|
public float getX()
|
116 |
|
|
{
|
117 |
|
|
return x;
|
118 |
|
|
}
|
119 |
cacc63de
|
Leszek Koltunski
|
|
120 |
6a06a912
|
Leszek Koltunski
|
}
|