Project

General

Profile

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

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

1
///////////////////////////////////////////////////////////////////////////////////////////////////
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
package org.distorted.library.type;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23
/**
24
 * A 2-dimensional data structure containing two floats. The floats have no particular meaning; 
25
 * when this data structure is used in Dynamics, we can think of it as a 2-dimensional Point
26
 * a few of which the Dynamic interpolates between.
27
 */
28

    
29
public class Static2D extends Static1D implements Data2D
30
  {
31
  float y;
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
  Static2D(int dim, float ox, float oy)
36
    {
37
    super(dim,ox);
38
    y = oy;
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
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
  public Static2D(int ox, int oy)
49
    {
50
    super(2,ox);
51
    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
  public Static2D(float ox, float oy)
62
    {
63
    super(2,ox);
64
    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
///////////////////////////////////////////////////////////////////////////////////////////////////
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
///////////////////////////////////////////////////////////////////////////////////////////////////
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
  }
(15-15/18)