Project

General

Profile

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

library / src / main / java / org / distorted / library / type / Static1D.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 1-dimensional data structure containing a single float. The float has no particular meaning; 
25
 * when this data structure is used in Dynamics, we can think of it as a 1-dimensional Point
26
 * a few of which the Dynamic interpolates between.
27
 */
28

    
29
public class Static1D extends Static implements Data1D
30
  {
31
  float x;
32

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

    
35
  Static1D(int dim, float ox)
36
    {
37
    super(dim);
38
    x = ox;
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42
/**
43
 * Constructor that initialises the value of the single float to ox.   
44
 *   
45
 * @param ox value of the single float.
46
 */
47
  public Static1D(int ox)
48
    {
49
    super(1);
50
    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
  public Static1D(float ox)
60
    {
61
    super(1);
62
    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

    
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
///////////////////////////////////////////////////////////////////////////////////////////////////
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

    
120
  }
(14-14/18)