Project

General

Profile

Download (4.42 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / type / Static2D.java @ fe6fe99a

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 2-dimensional data structure containing two floats. The floats have no particular meaning; 
25 cacc63de Leszek Koltunski
 * when this data structure is used in Dynamics, we can think of it as a 2-dimensional Point
26 568b29d8 Leszek Koltunski
 * a few of which the Dynamic interpolates between.
27 6a06a912 Leszek Koltunski
 */
28
29 568b29d8 Leszek Koltunski
public class Static2D extends Static1D implements Data2D
30 6a06a912 Leszek Koltunski
  {
31
  float y;
32
33 6d62a900 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
34
35
  Static2D(int dim, float ox, float oy)
36
    {
37
    super(dim,ox);
38
    y = oy;
39
    }
40
41 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
42
/**
43
 * Constructor that initialises the value of the two floats to (ox,oy).   
44
 *   
45
 * @param ox value of the first float.
46
 * @param oy value of the second float.
47
 */  
48 568b29d8 Leszek Koltunski
  public Static2D(int ox, int oy)
49 6a06a912 Leszek Koltunski
    {
50 6d62a900 Leszek Koltunski
    super(2,ox);
51 6a06a912 Leszek Koltunski
    y = oy;
52
    }
53
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55
/**
56
 * Constructor that initialises the value of the two floats to (ox,oy).   
57
 *   
58
 * @param ox value of the first float.
59
 * @param oy value of the second float.
60
 */    
61 568b29d8 Leszek Koltunski
  public Static2D(float ox, float oy)
62 6a06a912 Leszek Koltunski
    {
63 6d62a900 Leszek Koltunski
    super(2,ox);
64 6a06a912 Leszek Koltunski
    y = oy;
65
    }
66
  
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68
/**
69
 * Reset the value of the floats to (ox,oy).
70
 * 
71
 * @param ox new value of the first float
72
 * @param oy new value of the second float
73
 */
74
  public void set(int ox, int oy)
75
    {
76
    x = ox;
77
    y = oy;
78
    }
79
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81
/**
82
 * Reset the value of the floats to (ox,oy).
83
 * 
84
 * @param ox new value of the first float
85
 * @param oy new value of the seond float
86
 */
87
  public void set(float ox, float oy)
88
    {
89
    x = ox;
90
    y = oy;
91
    }
92
93 8df64ab9 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
94
/**
95
 * Resets the value of the second float.
96
 *
97
 * @param oy new value of the second float.
98
 */
99
  public void set2(int oy)
100
    {
101
    y = oy;
102
    }
103
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105
/**
106
 * Resets the value of the second float.
107
 *
108
 * @param oy new value of the second float.
109
 */
110
  public void set2(float oy)
111
    {
112
    y = oy;
113
    }
114
115 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
116
/**
117
 * Return the value of the second float contained.
118
 * 
119
 * @return The second float.
120
 */
121
  public float getY()
122
    {
123
    return y;  
124
    }
125
126
  }