de.farafin.snEADy.communication
Class D_Vec2D

java.lang.Object
  extended by de.farafin.snEADy.communication.D_Vec2D

public final class D_Vec2D
extends java.lang.Object

2-dimensional vector datatype for calculating on the playfield

Version:
$Revision: 1.9 $
Author:
roland, lars

Field Summary
 int x
          Comment for x
 int y
          Comment for y
 
Constructor Summary
D_Vec2D()
          default - constructor
D_Vec2D(D_Vec2D vec)
          copy - concstructor
D_Vec2D(int y, int x)
          create - constructor
 
Method Summary
 void add(D_Vec2D a)
           
static D_Vec2D add(D_Vec2D a, D_Vec2D b)
           
 void add(int y, int x)
          add the values to the vector
 java.lang.Object clone()
           
 void copyOnMe(D_Vec2D vec)
          copys all data to the lokal instance. there is no new Instance created
 int dist(D_Vec2D vec)
          manhatten distance: d = dy + dx
 int distWarp(D_Vec2D vec, int height, int width)
          manhatten distance: d = dy + dx with calculating the surface of the world as sphere
 boolean equals(D_Vec2D vec)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

y

public int y
Comment for y


x

public int x
Comment for x

Constructor Detail

D_Vec2D

public D_Vec2D()
default - constructor


D_Vec2D

public D_Vec2D(int y,
               int x)
create - constructor

Parameters:
y -
x -

D_Vec2D

public D_Vec2D(D_Vec2D vec)
copy - concstructor

Parameters:
vec -
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

add

public static D_Vec2D add(D_Vec2D a,
                          D_Vec2D b)
Parameters:
a - Vector a
b - Vector b
Returns:
D_Vec2D: addition of a and b

add

public void add(D_Vec2D a)
Parameters:
a - non static addition to the given vector

add

public void add(int y,
                int x)
add the values to the vector

Parameters:
y - add y (line)
x - add x (row)

copyOnMe

public void copyOnMe(D_Vec2D vec)
copys all data to the lokal instance. there is no new Instance created

Parameters:
vec -

dist

public int dist(D_Vec2D vec)
manhatten distance: d = dy + dx

Parameters:
vec -
Returns:
v

distWarp

public int distWarp(D_Vec2D vec,
                    int height,
                    int width)
manhatten distance: d = dy + dx with calculating the surface of the world as sphere

Parameters:
vec -
height - the playfield heiths
width - the playfield width
Returns:
v

equals

public boolean equals(D_Vec2D vec)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object