org.gjt.universe
Class Wormhole

java.lang.Object
  |
  +--org.gjt.universe.DBItem
        |
        +--org.gjt.universe.Wormhole
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
WormholeOscillating, WormholeUndefined

public class Wormhole
extends DBItem

A wormhole is a zero length conduit between two distant points in space through the lowest (zero-dimension) level of hyperspace. These end points may even be located in different galaxies. wormholes may only exist on the edge of a star system where the curvature of space is allows the envelope between normal and hyperspace to be pierced. Multiple wormholes make exist around the same star system, but must be a significant distance apart in order to prevent mutual collapse. While passing through a wormhole requires minimal movement on the part of a vessel, the travel time to and from each end of the wormhole combined with the careful navigation through each end point, is assumed to require the equivalent of 0.5 parsecs of movement (the size of this penalty may be adjusted by the active theme). All wormholes have a diameter which limits the maximum size of a vessel which may pass through it (based on the longest axis of the vessel due to hyperspace lensing effects). Multiple smaller vessels may pass through a worm-hole simultaneously provided the sum of their longest dimension does not exceed the diameter of the wormhole. A fleet whose combined diameter exceeds the diameter of the wormhole may pass through it in waves, but a movement penalty of 0.25 parsecs per wave is applied in order to reflect the maneuvering such a re-organization requires (the size of this penalty may be adjusted by the active theme). If the other end of the wormhole is at an enemy occupied star system, then the enemy may attack the incoming fleet as each wave arrives. Some wormholes are unstable and will erode by a small amount with each transit by a vessel. While random, the amount of erosion is generally proportional to the size of the ship passing through the wormhole. When completely eroded, the wormhole will collapse and disappear, stranding the destabilizing vessel on the other side. A civilization must posses the appropriate level of hyperspace sensor technology to determine whether or not a wormhole is stable, and, if unstable, the degree. Other highly advanced technology can destabilize a stable wormhole, and stabilize an unstable one. The frequency of wormhole occurance is normally very rare (controlled by game options), and each galaxy will normally only contain a small random number of wormholes at the start of a game. There will always be at least one wormhole joining one galaxy to another, as this is the only natural mechanism for intergalactic travel. Additional new wormholes may occur naturally during the game following a hyperspace storm. Likewise, some portion of previously stable wormholes may become unstable following such a storm.

Author:
Allan Noordvyk
See Also:
WormholeOscillating, Serialized Form

Field Summary
private  float diameter
           
private  SystemID endPointID1
           
private  SystemID endPointID2
           
private  WormholeID id
           
private  float integrity
           
private  boolean isIntergalactic
           
private  boolean isStable
           
private  java.lang.String name
           
private static WormholeID ourNextID
           
 
Constructor Summary
  Wormhole()
          This constructor returns a wormhole with randomly determined attributes.
(package private) Wormhole(boolean dummy)
          Constructor for WormholeUndefined.
  Wormhole(SystemID ep1, SystemID ep2, boolean s)
          This constructor returns a wormhole between the indicated star systems and having a random diameter of between 50 and 1000 meters and a random initial integrity of between 10 and 100.
  Wormhole(SystemID ep1, SystemID ep2, float d, boolean s, float i)
          This constructer is the desginated initializer for instances of this class, all other constructors in this class and subclasses should call this method as their first instruction.
 
Method Summary
private  void analyzeEndPoints()
          This method builds the name of this wormhole based on the current end-points and notes whether the wormhole is intergalactic or not.
private  void connectToSystemWithID(SystemID anID)
          This method handles notifying the star system with the given ID that this wormhole has an end-point in it.
private  void disconnectFromSystemWithID(SystemID anID)
          This method handles notifying the star system with the given ID that this wormhole no longer has an end-point in it.
 float getDiameter()
          This method returns the diameter of the wormhole (in meters).
 SystemBase getEndPoint1()
          This method returns the star system which is the first end-point of the wormhole.
 SystemBase getEndPoint2()
          This method returns the star system which is the second end-point of the wormhole.
 SystemID getEndPointID1()
          This method returns the ID of the star system which is the first end-point of the wormhole.
 SystemID getEndPointID2()
          This method returns the ID of the star system which is the second end-point of the wormhole.
 WormholeID getID()
          This method returns the unique ID of the receiving instance.
 Index getIndex()
          This method provides a concrete implementation of the method inhernited from our abstract superclass.
 float getIntegrity()
          This method returns the remaining integrity of the wormhole.
 boolean getIsStable()
          This method returns true if the wormhole is stable, and false otherwise.
 java.lang.String getName()
          This method returns the name of the wormhole by indicating the names of the star systems which are its end-points.
 boolean hasCollapsed()
          This method returns true if the wormhole has collapsed and thus no longer allows transit.
 boolean isEndPoint(SystemID anID)
          This method is provided to allow callers to easily test is a particualr star system is one of the end- points of the receiving wormhole instances.
 boolean isIntergalactic()
          This method returns true if the end-points of the wormhole are in different galaxies.
 boolean isOscillating()
          This method returns true if the wormhole is oscillating (i.e.
 void reduceIntegrity(float delta)
          This method reduces the integrity of the wormhole by the given amount.
 void setDiameter(float newValue)
          This method sets the diameter of the wormhole (in meters).
 void setEndPointID1(SystemID newValue)
          This method sets the ID of the star system which is the first end-point of the wormhole.
 void setEndPointID2(SystemID newValue)
          This method sets the ID of the star system which is the second end-point of the wormhole.
 void setIntegrity(float newValue)
          This method sets the remaining integrity of the wormhole to the supplied value.
 void setIsStable(boolean newValue)
          This method returns true if the wormhole is stable, and false otherwise.
 VectorDisplayReturn specificDisplayDebug()
          This method is used for debugging purposes and returns a display vector describing this object.
 
Methods inherited from class org.gjt.universe.DBItem
getLocation, getOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private WormholeID id

endPointID1

private SystemID endPointID1

endPointID2

private SystemID endPointID2

diameter

private float diameter

isStable

private boolean isStable

integrity

private float integrity

isIntergalactic

private boolean isIntergalactic

name

private java.lang.String name

ourNextID

private static WormholeID ourNextID
Constructor Detail

Wormhole

public Wormhole(SystemID ep1,
                SystemID ep2,
                float d,
                boolean s,
                float i)
This constructer is the desginated initializer for instances of this class, all other constructors in this class and subclasses should call this method as their first instruction.

Parameters:
ep1 - The ID of the star system at one end point of the wormhole.
ep2 - The ID of the star system at the other end point of the wormhole.
d - The diameter of the wormhole (in meters)
s - True if the wormhole is currently stable, false otherwise.
i - The initial integrity value of the wormhole

Wormhole

public Wormhole(SystemID ep1,
                SystemID ep2,
                boolean s)
This constructor returns a wormhole between the indicated star systems and having a random diameter of between 50 and 1000 meters and a random initial integrity of between 10 and 100.

Parameters:
ep1 - The ID of the star system at one end point of the wormhole.
ep2 - The ID of the star system at the other end point of the wormhole.
s - True if the wormhole is stable and false otherwise.

Wormhole

public Wormhole()
This constructor returns a wormhole with randomly determined attributes.


Wormhole

Wormhole(boolean dummy)
Constructor for WormholeUndefined. N.B. Does not register this instance with the game as one present in the game since its used to represent bogus or unknown wormhole information.

Method Detail

connectToSystemWithID

private void connectToSystemWithID(SystemID anID)
This method handles notifying the star system with the given ID that this wormhole has an end-point in it.

See Also:
setEndPointID1( SystemID aSystemID ), setEndPointID2( SystemID aSystemID )

disconnectFromSystemWithID

private void disconnectFromSystemWithID(SystemID anID)
This method handles notifying the star system with the given ID that this wormhole no longer has an end-point in it.

See Also:
setEndPointID1( SystemID aSystemID ), setEndPointID2( SystemID aSystemID )

analyzeEndPoints

private void analyzeEndPoints()
This method builds the name of this wormhole based on the current end-points and notes whether the wormhole is intergalactic or not. Because this involves actually looking up our end-point system objects in the SystemList, it is avoided until necessary and the result kept until one or the other of the end-points changed.

See Also:
getName(), isIntergalactic()

getID

public WormholeID getID()
This method returns the unique ID of the receiving instance.


getIndex

public Index getIndex()
This method provides a concrete implementation of the method inhernited from our abstract superclass. It simply returns the ID of the receiving instance.

Specified by:
getIndex in class DBItem

getName

public java.lang.String getName()
This method returns the name of the wormhole by indicating the names of the star systems which are its end-points.

Specified by:
getName in class DBItem

isIntergalactic

public boolean isIntergalactic()
This method returns true if the end-points of the wormhole are in different galaxies.


getEndPointID1

public SystemID getEndPointID1()
This method returns the ID of the star system which is the first end-point of the wormhole.


getEndPointID2

public SystemID getEndPointID2()
This method returns the ID of the star system which is the second end-point of the wormhole.


getEndPoint1

public SystemBase getEndPoint1()
This method returns the star system which is the first end-point of the wormhole. Note that this method slightly more expensive than getEndPointID1 and thus should not be called if only the ID is desired.


getEndPoint2

public SystemBase getEndPoint2()
This method returns the star system which is the second end-point of the wormhole. Note that this method slightly more expensive than getEndPointID2 and thus should not be called if only the ID is desired.


setEndPointID1

public void setEndPointID1(SystemID newValue)
This method sets the ID of the star system which is the first end-point of the wormhole.

Parameters:
newValue - The new end-point of the wormhole.

setEndPointID2

public void setEndPointID2(SystemID newValue)
This method sets the ID of the star system which is the second end-point of the wormhole.

Parameters:
newValue - The new end-point of the wormhole.

isEndPoint

public boolean isEndPoint(SystemID anID)
This method is provided to allow callers to easily test is a particualr star system is one of the end- points of the receiving wormhole instances. This method returns true if the star system with the given ID is one of the end-points of the wormhole, and false otherwise.

Parameters:
anID - The ID of the star system being tested.

getDiameter

public float getDiameter()
This method returns the diameter of the wormhole (in meters).


setDiameter

public void setDiameter(float newValue)
This method sets the diameter of the wormhole (in meters).

Parameters:
newValue - The new value to be adopted.

getIsStable

public boolean getIsStable()
This method returns true if the wormhole is stable, and false otherwise.


setIsStable

public void setIsStable(boolean newValue)
This method returns true if the wormhole is stable, and false otherwise.

Parameters:
newValue - The new value to be adopted.

getIntegrity

public float getIntegrity()
This method returns the remaining integrity of the wormhole. If the value is zero or less then the wormhole has collapsed and may not be used for travel.


setIntegrity

public void setIntegrity(float newValue)
This method sets the remaining integrity of the wormhole to the supplied value. If the new value is zero or less, the wormhole is considered to have collapsed and will be removed from those available in the game.

Parameters:
newValue - The new value to be adopted.

reduceIntegrity

public void reduceIntegrity(float delta)
This method reduces the integrity of the wormhole by the given amount. This method is provided as a convenience and simply calls setIntegrity after doing the necessary subtraction from the current integrity value.

See Also:
setIntegrity( float newValue )

hasCollapsed

public boolean hasCollapsed()
This method returns true if the wormhole has collapsed and thus no longer allows transit.


isOscillating

public boolean isOscillating()
This method returns true if the wormhole is oscillating (i.e. may change the star system where one of its end-points is located) and false if it is not. All instances of this base class are non-oscillating and thus this method always returns false. However, this method is overridden in the WormholeOscillating subclass to return true.

See Also:
WormholeOscillating

specificDisplayDebug

public VectorDisplayReturn specificDisplayDebug()
This method is used for debugging purposes and returns a display vector describing this object.

Specified by:
specificDisplayDebug in class DBItem


Copyright © 2001 Universe Dev Team All Rights Reserved.