com.swath
Class Trader

java.lang.Object
  extended bycom.swath.Info
      extended bycom.swath.Identity
          extended bycom.swath.Trader
All Implemented Interfaces:
java.lang.Cloneable

public final class Trader
extends Identity

This class represents a trader in TW.

Since:
SWATH 1.3

Method Summary
 int alignment()
          Gets the trader's alignment.
 java.lang.Object clone()
           
 int corp()
          Deprecated. Use the corporation() method instead.
 Corporation corporation()
          Gets the trader's corporation.
 int credits()
          Gets the amount of credits that the trader has.
 void display()
          Displays this trader in the terminal window.
 void dump()
          Dumps the trader info in the terminal window.
 boolean equals(java.lang.Object obj)
          Compares this trader to another one.
 int experience()
          Gets the trader's experience points.
 int id()
          Gets the internal trader identification number in SWATH.
 boolean isDockedAtPort()
          Indicates if the trader is docked at the port or not.
 boolean isOnline()
          Indicates if the trader is online or not.
 boolean isRealPlayer()
          Indicates if this is a real player or a computer controlled trader.
 boolean isYou()
          Indicates if this is you or not.
 java.util.Date lastUpdate()
          Gets the timestamp when the trader information was last updated.
 java.lang.String name()
          Gets the name of the trader.
 Planet onPlanet()
          If the trader has landed on a planet, this method will return it.
 int rank()
          Gets the current rank of the trader.
 int relation()
          Gets the current relation between you and this trader.
 int sector()
          Gets the sector number where the trader is currently located.
 Ship ship()
          Gets the trader's current ship.
 java.lang.String toString()
           
 int turns()
          Gets the number of turns that the trader has left.
 
Methods inherited from class com.swath.Identity
getCorporation, getTrader, isCorporation, isTrader, isUnknown, isYourCorporation
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object obj)
Compares this trader to another one.

Specified by:
equals in class Identity
Parameters:
obj - The other trader.
Returns:
true if they are equal, otherwise false.
Since:
SWATH 1.5
See Also:
isYou(), isRealPlayer()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in class Identity
Throws:
java.lang.CloneNotSupportedException

id

public int id()
Gets the internal trader identification number in SWATH.

Returns:
The trader id.
Since:
SWATH 1.3
See Also:
Swath.ID_YOU, Swath.ID_NOBODY, Swath.ID_UNKNOWN, Swath.ID_FEDERAL, Swath.ID_FERRENGI, Swath.ID_ALIEN

isYou

public boolean isYou()
Indicates if this is you or not.

Overrides:
isYou in class Identity
Returns:
true if this is you, otherwise false.
Since:
SWATH 1.5
See Also:
isRealPlayer(), equals(Object)

isRealPlayer

public boolean isRealPlayer()
Indicates if this is a real player or a computer controlled trader.

Overrides:
isRealPlayer in class Identity
Returns:
true if this is a real player, otherwise false.
Since:
SWATH 1.6
See Also:
isYou(), equals(Object)

name

public java.lang.String name()
                      throws java.lang.Exception
Gets the name of the trader.

Returns:
The trader name.
Throws:
java.lang.Exception
Since:
SWATH 1.3

sector

public int sector()
           throws java.lang.Exception
Gets the sector number where the trader is currently located.

Returns:
The current location or 0 if unknown.
Throws:
java.lang.Exception
Since:
SWATH 1.6

lastUpdate

public java.util.Date lastUpdate()
                          throws java.lang.Exception
Gets the timestamp when the trader information was last updated.

Returns:
The last update or null if never updated.
Throws:
java.lang.Exception
Since:
SWATH 1.3

corp

public int corp()
         throws java.lang.Exception
Deprecated. Use the corporation() method instead.

Gets the trader's corporation.

Returns:
The corporation id or 0 if the trader is not in a corp.
Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
corporation()

corporation

public Corporation corporation()
                        throws java.lang.Exception
Gets the trader's corporation.

Returns:
The corporation or null if the trader is not in a corporation.
Throws:
java.lang.Exception
Since:
SWATH 1.7

experience

public int experience()
               throws java.lang.Exception
Gets the trader's experience points.

Returns:
The trader's experience.
Throws:
java.lang.Exception
Since:
SWATH 1.3

alignment

public int alignment()
              throws java.lang.Exception
Gets the trader's alignment.

Returns:
The trader's alignment.
Throws:
java.lang.Exception
Since:
SWATH 1.3

credits

public int credits()
            throws java.lang.Exception
Gets the amount of credits that the trader has.

Returns:
Amount of credits.
Throws:
java.lang.Exception
Since:
SWATH 1.3

turns

public int turns()
          throws java.lang.Exception
Gets the number of turns that the trader has left.

Returns:
Number of turns left.
Throws:
java.lang.Exception
Since:
SWATH 1.3

rank

public int rank()
         throws java.lang.Exception
Gets the current rank of the trader.

Returns:
The current rank or -1 if unknown.
Throws:
java.lang.Exception
Since:
SWATH 1.3

relation

public int relation()
             throws java.lang.Exception
Gets the current relation between you and this trader.

Returns:
The relation status.
Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
Swath.WITH_YOU, Swath.ALLIED, Swath.NEUTRAL, Swath.ENEMY

ship

public Ship ship()
          throws java.lang.Exception
Gets the trader's current ship.

Returns:
The current ship or null if not known.
Throws:
java.lang.Exception
Since:
SWATH 1.6.2
See Also:
Ship

isOnline

public boolean isOnline()
                 throws java.lang.Exception
Indicates if the trader is online or not.

Returns:
true if the trader is online, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.6.5

isDockedAtPort

public boolean isDockedAtPort()
                       throws java.lang.Exception
Indicates if the trader is docked at the port or not.

Returns:
true if the trader is docked, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.7

onPlanet

public Planet onPlanet()
                throws java.lang.Exception
If the trader has landed on a planet, this method will return it.

Returns:
The planet or null if not landed or unknown.
Throws:
java.lang.Exception
Since:
SWATH 1.7

display

public void display()
             throws java.lang.Exception
Displays this trader in the terminal window.

Throws:
java.lang.Exception
Since:
SWATH 1.4
See Also:
dump()

dump

public void dump()
          throws java.lang.Exception
Dumps the trader info in the terminal window.

Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
display()