org.gjt.universe
Class ProtoObject

java.lang.Object
  |
  +--org.gjt.universe.ProtoObject
Direct Known Subclasses:
ProtoModule, ProtoShip, ProtoTech

public abstract class ProtoObject
extends java.lang.Object

ProtoObject.java Created: Wed Jun 14 09:29:45 2000 ProtoObject is the base class from which ProtoTech, ProtoModule, and ProtoShip are derived. A ProtoObject is created by a OrderTransfer when OrderTransfer.submit() is called. The ProtoObject represents the item under construction/research. It knows how many production points are needed for it to be complete, what turn it is, how many points were transferred to it this turn, and how many more points it needs. It also knows how to create the actual object when it is complete. It also contains methods to get the completion percentage and time remaining.

Version:
$Id: ProtoObject.java,v 1.2 2001/05/07 06:39:12 sstarkey Exp $
Author:
Shalon Wood

Field Summary
(package private)  int currentTurn
          Keeps track of the current turn.
(package private)  float productionThisTurn
          Keeps track of the amount of production added to the ProtoObject this turn.
(package private)  float totalProduction
          Keeps track of the total production added to the ProtoObject.
(package private)  float totalProductionNeeded
          The amount of production needed to build this object.
 
Constructor Summary
ProtoObject()
           
 
Method Summary
 void addProduction(float newProduction, int turn)
          Adds production to the ProtoObject.
(package private) abstract  void buildObject()
          Object type specific method to build the actual object.
 int getEstimatedTimeOfCompletion()
          Estimated time until this object is complete.
(package private) abstract  Index getKey()
           
 float getPercentageCompletion()
          Gets the completion percentage.
 float getProductionNeeded()
           
(package private) static ProtoObject newProtoObject(StationID BID, ModuleDesignID EID)
           
(package private) static ProtoObject newProtoObject(StationID BID, ShipDesignID DID)
           
(package private) static ProtoObject newProtoObject(StationID BID, TechID TID)
           
(package private) abstract  boolean prereqs()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentTurn

int currentTurn
Keeps track of the current turn. If the turn parameter to addProduction is greater than the current turn, currentTurn is set to the new value and productionThisTurn is reset.


productionThisTurn

float productionThisTurn
Keeps track of the amount of production added to the ProtoObject this turn.


totalProduction

float totalProduction
Keeps track of the total production added to the ProtoObject.


totalProductionNeeded

float totalProductionNeeded
The amount of production needed to build this object.

Constructor Detail

ProtoObject

public ProtoObject()
Method Detail

newProtoObject

static ProtoObject newProtoObject(StationID BID,
                                  ShipDesignID DID)

newProtoObject

static ProtoObject newProtoObject(StationID BID,
                                  ModuleDesignID EID)

newProtoObject

static ProtoObject newProtoObject(StationID BID,
                                  TechID TID)

getProductionNeeded

public float getProductionNeeded()

addProduction

public void addProduction(float newProduction,
                          int turn)
Adds production to the ProtoObject.

Parameters:
newProduction - Amount of production to add.
turn - The current turn.

getEstimatedTimeOfCompletion

public int getEstimatedTimeOfCompletion()
Estimated time until this object is complete.

Returns:
Number of turns until this object is complete.

getPercentageCompletion

public float getPercentageCompletion()
Gets the completion percentage.

Returns:
percentage complete (0 < x < 1.0)

buildObject

abstract void buildObject()
Object type specific method to build the actual object.


prereqs

abstract boolean prereqs()

getKey

abstract Index getKey()


Copyright © 2001 Universe Dev Team All Rights Reserved.