com.camelspotting.jotl.domain
Class Company

java.lang.Object
  extended by com.camelspotting.jotl.domain.Company
All Implemented Interfaces:
Comparable<Company>

public class Company
extends Object
implements Comparable<Company>

This class represents a company currently in the game.

Version:
1.0
Author:
Mats Andreassen

Constructor Summary
Company(int currentId, String companyName, int inaugerated, long companyValue, long balance, long income, int performance, boolean pwProtected, Map<Vehicle,Integer> vehicleCountMap, Map<Station,Integer> stationCountMap)
          The constructor for companies.
 
Method Summary
 int compareTo(Company o)
          This method makes the companies comparable based on their rating.
 boolean equals(Object o)
          This method returns true if two companies have the same currentID.
 long getBalance()
          Method for getting the company's current balance.
 String getCompanyName()
          Method for getting the company's name
 long getCompanyValue()
          Method for getting the company's current value.
 int getCurrentId()
          Method for getting the current ID of a company
 String getFormattedBalance()
          Method for getting the company's current balance in a format suitable for display.
 String getFormattedCompanyValue()
          Method for getting the company's current value in a format suitable for display.
 String getFormattedIncome()
          Method for getting the company's current income in a format suitable for display.
 int getInaugerationYear()
          Method for getting the company's inaugeration year.
 long getIncome()
          Method for getting the company's current income.
 Map<Station,Integer> getNumberOfStations()
          Method for accessing how many stations a company has.
 Map<Vehicle,Integer> getNumberOfVehicles()
          Method for accessing how many vehicles a company has.
 int getRating()
          Method for getting the company's current rating.
 int hashCode()
           
 boolean isPasswordProtected()
          Method for finding out whether or not the company is password protected.
 String toString()
          Convenience method for printing out relevant information for display.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Company

public Company(int currentId,
               String companyName,
               int inaugerated,
               long companyValue,
               long balance,
               long income,
               int performance,
               boolean pwProtected,
               Map<Vehicle,Integer> vehicleCountMap,
               Map<Station,Integer> stationCountMap)
The constructor for companies.

Parameters:
currentId - in-game id
companyName - the company name
inaugerated - the year the company was founded
companyValue - a company's worth
balance - current balance
income - company's income
rating - company's rating
pwProtected - whether or not the company has been password protected
Method Detail

getNumberOfVehicles

public Map<Vehicle,Integer> getNumberOfVehicles()
Method for accessing how many vehicles a company has. Match the indices in this array with the ServerInfo#vehicles array to find out what number is what kind of vehicle.

Returns:
the array containing the numbers
See Also:
ServerInfo#vehicles

getNumberOfStations

public Map<Station,Integer> getNumberOfStations()
Method for accessing how many stations a company has. Match the indices in this array with the ServerInfo#stations array to find out what number is what kind of stations.

Returns:
the array containing the numbers
See Also:
ServerInfo#stations

getCurrentId

public int getCurrentId()
Method for getting the current ID of a company

Returns:
the id

getCompanyName

public String getCompanyName()
Method for getting the company's name

Returns:
the name

getInaugerationYear

public int getInaugerationYear()
Method for getting the company's inaugeration year.

Returns:
the date

getCompanyValue

public long getCompanyValue()
Method for getting the company's current value.

Returns:
the value

getFormattedCompanyValue

public String getFormattedCompanyValue()
Method for getting the company's current value in a format suitable for display. E.g: £34.241.234

Returns:
the value

getBalance

public long getBalance()
Method for getting the company's current balance.

Returns:
the balance

getFormattedBalance

public String getFormattedBalance()
Method for getting the company's current balance in a format suitable for display. E.g: £34.241.234

Returns:
the balance

getIncome

public long getIncome()
Method for getting the company's current income.

Returns:
the income

getFormattedIncome

public String getFormattedIncome()
Method for getting the company's current income in a format suitable for display. E.g: £34.241.234

Returns:
the income

getRating

public int getRating()
Method for getting the company's current rating.

Returns:
the rating

isPasswordProtected

public boolean isPasswordProtected()
Method for finding out whether or not the company is password protected.

Returns:
whether or not the company is password protected

toString

public String toString()
Convenience method for printing out relevant information for display.

Overrides:
toString in class Object
Returns:
a String representation of the object

compareTo

public int compareTo(Company o)
This method makes the companies comparable based on their rating.

Specified by:
compareTo in interface Comparable<Company>
Parameters:
o - the Company to compare to
Returns:
the difference in performances

equals

public boolean equals(Object o)
This method returns true if two companies have the same currentID. This returns true if the the objects represent the same company inside one game by checking current ID and inaugeration year.

Overrides:
equals in class Object
Returns:
whether they are equal or not

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.