aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-08 06:20:35 +0100
committerSven Gothel <[email protected]>2011-02-08 06:20:35 +0100
commit4cda4b70dbcd21cf57e1e253ddba32b88bcaec18 (patch)
tree6f16d211cb80ebf5dcc8cab6424c70079a38ea7f /src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
parenteb7986963c87bc6f33e7f18bb90ddf898b7dd63a (diff)
Move implementation private files from com.jogamp.<module>.impl. to jogamp.<module> (1/2) - rename task
- com.jogamp.opengl.impl -> jogamp.opengl - com.jogamp.opengl.util.glsl.fixedfunc.impl -> jogamp.opengl.util.glsl.fixedfunc - com.jogamp.nativewindow.impl -> jogamp.nativewindow - com.jogamp.newt.impl -> jogamp.newt This sorts implementation details from the top level, ie skipping the public 'com', allowing a better seperation of public classes and implementation details and also reduces strings. This approach of public/private seperation is also used in the OpenJDK.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java195
1 files changed, 195 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
new file mode 100644
index 000000000..60cef9919
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
@@ -0,0 +1,195 @@
+package com.jogamp.opengl.impl.glu.nurbs;
+
+/**
+ * Class replacing C language pointer
+ *
+ * @author Tomas Hrasky
+ *
+ */
+public class CArrayOfFloats {
+
+ /**
+ * Underlaying array
+ */
+ private float[] array;
+
+ /**
+ * Pointer to array member
+ */
+ private int pointer;
+
+ /**
+ * Don't check for array borders?
+ */
+ private boolean noCheck = true;
+
+ /**
+ * Makes new CArray
+ *
+ * @param array
+ * underlaying array
+ * @param pointer
+ * pointer (index) to array
+ */
+ public CArrayOfFloats(float[] array, int pointer) {
+ this.array = array;
+ // this.pointer=pointer;
+ setPointer(pointer);
+ }
+
+ /**
+ * Makes new CArray from other CArray
+ *
+ * @param carray
+ * reference array
+ */
+ public CArrayOfFloats(CArrayOfFloats carray) {
+ this.array = carray.array;
+ // this.pointer=carray.pointer;
+ setPointer(carray.pointer);
+ }
+
+ /**
+ * Makes new CArray with pointer set to 0
+ *
+ * @param ctlarray
+ * underlaying array
+ */
+ public CArrayOfFloats(float[] ctlarray) {
+ this.array = ctlarray;
+ this.pointer = 0;
+ }
+
+ /**
+ * Returns element at pointer
+ *
+ * @return element at pointer
+ */
+ public float get() {
+ return array[pointer];
+ }
+
+ /**
+ * Increases pointer by one (++)
+ */
+ public void pp() {
+ // pointer++;
+ setPointer(pointer + 1);
+ }
+
+ /**
+ * Sets element at pointer
+ *
+ * @param f
+ * desired value
+ */
+ public void set(float f) {
+ array[pointer] = f;
+
+ }
+
+ /**
+ * Returns array element at specified index
+ *
+ * @param i
+ * array index
+ * @return element at index
+ */
+ public float get(int i) {
+ return array[i];
+ }
+
+ /**
+ * Returns array element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @return element at relative index
+ */
+ public float getRelative(int i) {
+ return array[pointer + i];
+ }
+
+ /**
+ * Sets value of element at specified index relatively to pointer
+ *
+ * @param i
+ * relative index
+ * @param value
+ * value to be set
+ */
+ public void setRelative(int i, float value) {
+ array[pointer + i] = value;
+ }
+
+ /**
+ * Lessens pointer by value
+ *
+ * @param i
+ * lessen by
+ */
+ public void lessenPointerBy(int i) {
+ // pointer-=i;
+ setPointer(pointer - i);
+ }
+
+ /**
+ * Returns pointer value
+ *
+ * @return pointer value
+ */
+ public int getPointer() {
+ return pointer;
+ }
+
+ /**
+ * Sets ponter value
+ *
+ * @param pointer
+ * pointer value to be set
+ */
+ public void setPointer(int pointer) {
+ if (!noCheck && pointer > array.length)
+ throw new IllegalArgumentException("Pointer " + pointer
+ + " out of bounds " + array.length);
+ this.pointer = pointer;
+ }
+
+ /**
+ * Raises pointer by value
+ *
+ * @param i
+ * raise by
+ */
+ public void raisePointerBy(int i) {
+ // pointer+=i;
+ setPointer(pointer + i);
+ }
+
+ /**
+ * Lessens ponter by one (--)
+ */
+ public void mm() {
+ // pointer--;
+ setPointer(pointer - 1);
+ }
+
+ /**
+ * Returns underlaying array
+ *
+ * @return underlaying array
+ */
+ public float[] getArray() {
+ return array;
+ }
+
+ /**
+ * Sets underlaying array
+ *
+ * @param array
+ * underlaying array
+ */
+ public void setArray(float[] array) {
+ this.array = array;
+ }
+}