com.rubecula.darwin.examples.travelingsalesman
Class Client
java.lang.Object
com.rubecula.darwin.examples.travelingsalesman.Client
- All Implemented Interfaces:
- EnvironmentNode, Nameable, java.lang.Comparable<Client>, net.sf.tostring0.Identifiable
public class Client
- extends java.lang.Object
- implements EnvironmentNode, net.sf.tostring0.Identifiable, Nameable, java.lang.Comparable<Client>
- Author:
- Robin Hillyard
TODO consider extending AToString
Constructor Summary |
Client(java.lang.String name,
int x,
int y)
|
Method Summary |
int |
compareTo(Client o)
For now, we sort clients according to the dictionary order of the
identifier (see note...)
Note: this class has a natural ordering that is inconsistent with equals. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getIdentifier()
|
int |
getX()
|
int |
getY()
|
int |
hashCode()
|
void |
setIdentifier(java.lang.String name)
|
java.lang.String |
toString()
|
static Client |
valueOf(java.lang.String clientString)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Client
public Client(java.lang.String name,
int x,
int y)
- Parameters:
name
- x
- y
-
valueOf
public static Client valueOf(java.lang.String clientString)
- Parameters:
clientString
- the coordinates of the clinet in the form x:y
- Returns:
- a new Client formed from the
clientString
compareTo
public int compareTo(Client o)
- For now, we sort clients according to the dictionary order of the
identifier (see note...)
Note: this class has a natural ordering that is inconsistent with equals.
- Specified by:
compareTo
in interface java.lang.Comparable<Client>
- Parameters:
o
-
- Returns:
- the order as =1,0, or 1
- See Also:
Comparable.compareTo(java.lang.Object)
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
- See Also:
Object.equals(java.lang.Object)
getIdentifier
public java.lang.String getIdentifier()
- Specified by:
getIdentifier
in interface net.sf.tostring0.Identifiable
- Returns:
_name
.- See Also:
Identifiable.getIdentifier()
getX
public int getX()
- Returns:
- the x
getY
public int getY()
- Returns:
- the y
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
- See Also:
Object.hashCode()
setIdentifier
public void setIdentifier(java.lang.String name)
- Specified by:
setIdentifier
in interface Nameable
- Parameters:
name
- the String which will be used to identify this object.- See Also:
Nameable.setIdentifier(java.lang.String)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- See Also:
Object.toString()
Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.