cz.cuni.utils.math.vertexSpace.vertex2Dspace
Class Vertex2DSpaceSquare

java.lang.Object
  extended by cz.cuni.utils.math.vertexSpace.vertex2Dspace.Vertex2DSpaceSquare

public class Vertex2DSpaceSquare
extends java.lang.Object

This represent one cube of the VertexSpace. It may contain more then one vertex and is responsible for raising the errors if three vertices which are too close are inserted. It goes like this: 1) first vertex creates an epsilon surrounding, other vertices in those surrounding is reported as the first one 2) note that distance of 2 points may be 1.5 epsilon and the third one may lie in both surroundings - that's the time when error is reported Also - those cubes will be stored in HashMap for quick search. So we will need a hash and equal function. equals() is considering precision, size, x, y, z, NOT STORED VERTICES! Use add(Tuple2D) to insert and obtain a Vertex.


Field Summary
protected  int hashCode
           
protected  double precision
           
protected  int precisionInt
           
protected  java.util.HashSet vertices
           
protected  double[] x
          X-Extends of the space cube. x[0] < x[1]
protected  double[] y
          Y-Extends of the space cube. y[0] < y[1]
 
Constructor Summary
Vertex2DSpaceSquare(double[] xy, double iSize, int iPrecisionInt)
           
Vertex2DSpaceSquare(double iX, double iY, double iSize, int iPrecisionInt)
           
 
Method Summary
 Vertex2D addReferenceUnsafe(Vertex2D v)
           
 boolean equals(java.lang.Object obj)
           
static int getHash(double x, double y, double size, int precisionInt)
          Returns hash code for the cube which starts at x, y, z with a certain precision.
 int hashCode()
           
 java.util.ArrayList check(Tuple2D tuple)
          Returns list of vertices in whose surroundings tuple lies.
 void remove(Vertex2D v)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double[] x
X-Extends of the space cube. x[0] < x[1]


y

protected double[] y
Y-Extends of the space cube. y[0] < y[1]


precisionInt

protected int precisionInt

precision

protected double precision

hashCode

protected final int hashCode

vertices

protected java.util.HashSet vertices
Constructor Detail

Vertex2DSpaceSquare

public Vertex2DSpaceSquare(double iX,
                           double iY,
                           double iSize,
                           int iPrecisionInt)

Vertex2DSpaceSquare

public Vertex2DSpaceSquare(double[] xy,
                           double iSize,
                           int iPrecisionInt)
Method Detail

getHash

public static int getHash(double x,
                          double y,
                          double size,
                          int precisionInt)
Returns hash code for the cube which starts at x, y, z with a certain precision.

Parameters:
x -
y -
precisionInt -

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

check

public java.util.ArrayList check(Tuple2D tuple)
Returns list of vertices in whose surroundings tuple lies.

Parameters:
tuple -
Returns:

remove

public void remove(Vertex2D v)

addReferenceUnsafe

public Vertex2D addReferenceUnsafe(Vertex2D v)