Code example for InetAddress

Methods: toString

0
	public static final Token AI_3 = new Token("Ai3", null, 3);
	public static final Token[] AIs = { AI_0, AI_1, AI_2, AI_3 };
	 
	public Token(final String name, final InetAddress address, 
			final int playerNumber) {
		String both = name + (null != address ? address.toString() : "");
		this.token = both.hashCode();
		this.playerNumber = playerNumber;
	} 
	 
	@Override 
	public boolean equals(Object other) {
		if ( !other.getClass().equals(Token.class) )
			return false; 
		 
		Token otherToken = (Token) other;
		return otherToken.token == this.token;
	} 
	@Override public int hashCode() { return this.token; }
}