be.optiloading
Class Ship

java.lang.Object
  extended by be.optiloading.Ship

public class Ship
extends java.lang.Object

Ship class used to stow information about the ship and do ship's calculations.

Author:
Tim Pintens, info@optiloading.be, www.optiloading.be

Field Summary
 java.util.ArrayList<Intensity> intensitylist
          An ArrayList containing the intensity data used to make hull stress calculations.
 java.util.ArrayList<Tank> tanks
          Represents a list of all the ship's cargo tanks.
 Cargo toLoad
           
 
Method Summary
 boolean checkToLoad(Cargo tload, float dens, float t, float c)
          Method to check the cargo and set the to be loaded cargo if the desired cargo value is acceptable.
 boolean checkToLoad(float tmd, float spec, float dens, float t, float c)
          Method to check if it is possible to achieve a desired TMD and if so set the to be loaded cargo value.
 float getData(ShipParticular particular)
          Method used to get ship particulars.
static Ship getInstance()
          Returns the uniqueInstance of the Ship object (Singleton).
 java.util.ArrayList<java.lang.Float> getSolution(java.util.ArrayList<java.lang.Float> volumes)
          Method used to set Volumes and get the solution values (mainly used for testing purposes).
 void loadShipData(java.io.InputStream shipd, java.io.InputStream hydrod, java.io.InputStream tankd, java.io.InputStream buoyancyd)
          Method to load all the ship's data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

intensitylist

public java.util.ArrayList<Intensity> intensitylist
An ArrayList containing the intensity data used to make hull stress calculations. This ArrayList if filled within the loadIntensityData(InputStream lightshipd).


tanks

public java.util.ArrayList<Tank> tanks
Represents a list of all the ship's cargo tanks. This list contains Tank objects.


toLoad

public Cargo toLoad
Method Detail

getInstance

public static Ship getInstance()
Returns the uniqueInstance of the Ship object (Singleton).

Returns:
Ship object.

loadShipData

public void loadShipData(java.io.InputStream shipd,
                         java.io.InputStream hydrod,
                         java.io.InputStream tankd,
                         java.io.InputStream buoyancyd)
Method to load all the ship's data.

Parameters:
shipd - InputStream object containing general ship's data.
hydrod - InputStream object containing the ship's hydrostatic tables.
tankd - InputStream object containg tank data from the ship.
buoyancyd - InputStream object containg section data from the ship.

checkToLoad

public boolean checkToLoad(Cargo tload,
                           float dens,
                           float t,
                           float c)
Method to check the cargo and set the to be loaded cargo if the desired cargo value is acceptable.

Parameters:
tload - Cargo object containing the weight, volume and specific gravity of the cargo.
dens - Floating point value that contains the density of the water in which the ship is floating.
f - Floating point value that contains the desired trim.
c - Floating point value that contains the weight of the miscellaneous compartments.
Returns:
Boolean value is true is cargo is valid else false.

checkToLoad

public boolean checkToLoad(float tmd,
                           float spec,
                           float dens,
                           float t,
                           float c)
Method to check if it is possible to achieve a desired TMD and if so set the to be loaded cargo value.

Parameters:
tmd - Floating point value indicating the desired TMD.
spec - Floating point value indicating the specific gravity of the cargo to be loaded.
dens - Floating point value that contains the density of the water in which the ship is floating.
f - Floating point value that contains the desired trim.
c - Floating point value that contains the weight of the miscellaneous compartments.
Returns:
Boolean value is true is cargo is valid else false.

getSolution

public java.util.ArrayList<java.lang.Float> getSolution(java.util.ArrayList<java.lang.Float> volumes)
Method used to set Volumes and get the solution values (mainly used for testing purposes).

Parameters:
volumes - ArrayList containing the floating point values of each tank volume.
Returns:
Array of floating points containing the calculated values.

getData

public float getData(ShipParticular particular)
Method used to get ship particulars.

Parameters:
particular - ShipParticular indicating which particular to get (see enum class ShipParticular).
Returns:
Floating point value containing the wanted particular.