Package breitband.game.board
Class CityContract
- java.lang.Object
-
- breitband.game.board.Contract
-
- breitband.game.board.CityContract
-
public class CityContract extends Contract
Class containing all information about contracts between two cities- Author:
- Klara Schöbel
-
-
Constructor Summary
Constructors Constructor Description CityContract(java.lang.String id, int value, City cityA, City cityB)
constructs a contract between two cities with an id, and a value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Override for the equals() method of java.lang.object to match the logic behind cityContracts.City
getCityA()
getter for cityACity
getCityB()
getter for CityBint
hashCode()
override for hashCode() of java.lang.object
-
-
-
Constructor Detail
-
CityContract
public CityContract(java.lang.String id, int value, City cityA, City cityB)
constructs a contract between two cities with an id, and a value- Parameters:
id
- id of the contract (see alsoContract.getCID()
)value
- value of the Contract (see alsoContract.getValue()
)cityA
- "starting" city of the route specified by this contract (see alsogetCityA()
)cityB
- "ending" city of the route specified by this contract (see alsogetCityB()
)
-
-
Method Detail
-
getCityA
public City getCityA()
getter for cityA- Returns:
- cityA
-
getCityB
public City getCityB()
getter for CityB- Returns:
- cityB
-
equals
public boolean equals(java.lang.Object o)
Override for the equals() method of java.lang.object to match the logic behind cityContracts.Two city contracts are equal if they have the same cities
- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- object it could be equal to- Returns:
- if this object is equal to object o
-
hashCode
public int hashCode()
override for hashCode() of java.lang.object- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- our hash of the city obtained by name of cityA + "/" + name of cityB
-
-