Class Contract

  • Direct Known Subclasses:
    CityContract, RegionContract

    public abstract class Contract
    extends java.lang.Object
    Class containing all information and methods relevant for all contracts regardless of type
    Author:
    Klara Schöbel
    • Constructor Summary

      Constructors 
      Constructor Description
      Contract​(java.lang.String id, int value)
      constructs a contract with an id and a value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCID()
      getter for cID
      java.lang.String getHash()
      getter for hash
      int getPlayer()
      getter for playerID
      int getValue()
      getter for Value
      boolean isDone()
      "getter" for done
      void setDone()
      setter for done (takes no input as a contract should only be set from not done to done)
      void setPlayer​(int playerID)
      setter for playerID
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Contract

        public Contract​(java.lang.String id,
                        int value)
        constructs a contract with an id and a value
        Parameters:
        id - ID of the contract (see also getCID())
        value - Wert des Vertrags (see also getValue())
    • Method Detail

      • getPlayer

        public int getPlayer()
        getter for playerID
        Returns:
        if of player who owns this contract
      • setPlayer

        public void setPlayer​(int playerID)
        setter for playerID
        Parameters:
        playerID - id of player who now owns this contract
      • getCID

        public java.lang.String getCID()
        getter for cID
        Returns:
        ID of this contract
      • isDone

        public boolean isDone()
        "getter" for done
        Returns:
        if the contract is done
      • getValue

        public int getValue()
        getter for Value
        Returns:
        value of this contract
      • setDone

        public void setDone()
        setter for done (takes no input as a contract should only be set from not done to done)
      • getHash

        public java.lang.String getHash()
        getter for hash
        Returns:
        ID of the contract as it fulfills all the requirements for hash-values