|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Position.Position
H thesh enos antikeimenou panw ston xarth.
Invariant: oi syntetagmenes ths theshs (x,y) einai megalyteres h ises tou mhden, dhladh x>=0 kai y>=0.
Pedia ths klasshs: x: syntetegmenh x y: syntetagmenh y max_distance: h megisth apostash apo thn opoia ena zwo mporei na faei enan allon organismo.
| Constructor Summary | |
Position(int x,
int y)
Constructor ths Position. |
|
| Method Summary | |
boolean |
checkIfClose(Position.Position p)
Mas leei an oi dyo theseis twn organismwn einai toso konta wste na mporei o enas na faei ton allon. |
double |
distance(Position.Position p)
Epistrefei thn apostash dyo thesewn. |
int |
get_x()
Epistrefei to x. |
int |
get_y()
Epistrefei to y. |
boolean |
isEqual(Position.Position p)
Elegxei an oi dyo theseis einai idies. |
boolean |
isInside(Position.Position p,
int width,
int height)
Elegxei an to antikeimeno me authn thn thesh einai mesa sto antikeimeno me thesh p. |
void |
set_x(int x)
Thetei to x. |
void |
set_y(int y)
Thetei to y. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Position(int x,
int y)
Precondition: Prepei ta x,y na einai egkyra. Dhladh x>=0 kai y>=0 kai x,y mesa sta oria tou xarth x<=x_max kai y<=y_max.
Postcondition: Ftiaxnoume mia nea thesh me syntetagmenes x,y.
x - H syntetagmenh x.y - H syntetagmenh y.| Method Detail |
public int get_x()
Postcondition: Epistrefei to x.
public int get_y()
Postcondition: Epistrefei to y.
public void set_x(int x)
Precondition: Egkyro x, dhladh x>=0 kai x mesa sta oria tou xarth.
Postcondition: Thetei to x.
x - H timh pou tha dwsoume sto x.public void set_y(int y)
Precondition: Egkyro y, dhladh y>=0 kai y mesa sta oria tou xarth.
Postcondition: Thetei to y.
y - H timh pou tha dwsoume sto y.public boolean checkIfClose(Position.Position p)
Postcondition: Epistrefei true an oi dyo theseis exoun diafora mikroterh h ish apo max_distance alliws false.
public boolean isEqual(Position.Position p)
Postcondition: Epistrefei true an oi dyo theseis einai idies alliws false.
public double distance(Position.Position p)
Postcondition: Epistrefei thn apostash ths theshs auths apo thn thesh p.
param p H thesh pou theloume na doume poso apexei apo th thesh pou eimaste.
public boolean isInside(Position.Position p,
int width,
int height)
Postcondition: Epistrefei true an to antikeimeno me auth th thesh einai mesa sto antikeimeno me thesh p alliws false.
p - H thesh tou antikeimenou sto opoio theloume na doume an eimaste mesa.width - To mhkos tou antikeimenou me thesh p.height - To ypsos tou antikeimenou me thesh p.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||