nl.tudelft.simulation.dsol.experiment
Class TimeUnit

java.lang.Object
  extended by nl.tudelft.simulation.dsol.experiment.TimeUnit
All Implemented Interfaces:
Serializable, TimeUnitInterface

public class TimeUnit
extends Object
implements TimeUnitInterface

The TimeUnitInterface defines the simulator time units.
(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:21:30 $
Author:
Peter Jacobs , Alexander Verbraeck
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nl.tudelft.simulation.dsol.experiment.TimeUnitInterface
DAY, HOUR, MILLISECOND, MINUTE, SECOND, UNIT, WEEK
 
Constructor Summary
TimeUnit(long value, String name)
          Method Speed.
 
Method Summary
static double convert(double amount, TimeUnitInterface units, SimulatorInterface simulator)
          converts amount units to the units of the simulator
static double convert(double amount, TimeUnitInterface units, TimeUnitInterface targetUnits)
          converts amount units to the target units
 long getValue()
          Method getValue.This method returns the number of timeunits relative to milliseconds
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeUnit

public TimeUnit(long value,
                String name)
Method Speed.

Parameters:
value - represents the number of miliseconds
name - The name that will show up in reports and animation
Method Detail

getValue

public long getValue()
Description copied from interface: TimeUnitInterface
Method getValue.This method returns the number of timeunits relative to milliseconds

Specified by:
getValue in interface TimeUnitInterface
Returns:
long
See Also:
TimeUnitInterface.getValue()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

convert

public static double convert(double amount,
                             TimeUnitInterface units,
                             SimulatorInterface simulator)
                      throws RemoteException
converts amount units to the units of the simulator

Parameters:
amount - the amount to convert
units - the units of the amount
simulator - the simulator
Returns:
double the amount in simulator units
Throws:
RemoteException - on network exception

convert

public static double convert(double amount,
                             TimeUnitInterface units,
                             TimeUnitInterface targetUnits)
converts amount units to the target units

Parameters:
amount - the amount to convert
units - the units of the amount
targetUnits - the units to convert to
Returns:
double the amount in simulator units


Copyright © 2002-2010 Delft University of Technology, the Netherlands. All Rights Reserved.