mwalk Platform 0.3.0

mwalk.core
Class PeriodTable

java.lang.Object
  |
  +--mwalk.core.PeriodTable

public class PeriodTable
extends java.lang.Object
implements java.io.Serializable

A class representing the cummulative activity for a link.

Version:
1.0
Author:
Robert Chalmers
See Also:
Serialized Form

Field Summary
 java.util.Hashtable data
          Temporary data that can be stored in table
protected  java.util.Vector entries
          List of period entries
(package private) static long serialVersionUID
          Serialize version ID
 
Constructor Summary
PeriodTable()
          Default constructor.
 
Method Summary
 long add(long start, long stop)
          Add a new time period into the table, without merging adjacent entries.
 long bound(long stop)
          Bound the period table with an explicit stop time.
 void bound(PeriodTable bounder)
          Bound all entries by those from another table (child's table).
 boolean check(long time)
          Check whether a specific time falls within the table periods.
 void clearData()
          Clear temporary data for table and each entry
 long getDuration(long bound)
          Retrieve the total active time in the period table.
 long getEarliest()
          Retrieve the earliest time in the period table.
 long getLatest()
          Retrieve the latest time in the period table.
 void load(java.io.BufferedReader br)
          Load a period table from a file.
 long merge()
          Merge the activity table with no specific bound on the final stop time.
 long merge(long maxStop)
          Merge the activity table with a specific bound on the final stop time.
 void merge(PeriodTable merger)
          Merge periods from another table into this one.
static PeriodTable merge(PeriodTable[] tables)
          Create a new table that contains the total activity of all component tables.
 void print()
          Print the contents of the period table.
private  void readObject(java.io.ObjectInputStream in)
          Initialize transient variables after reading the object in.
 void setEarliest(long time)
          Set the earliest time in the period table if not already earlier.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
Serialize version ID

entries

protected java.util.Vector entries
List of period entries

data

public transient java.util.Hashtable data
Temporary data that can be stored in table
Constructor Detail

PeriodTable

public PeriodTable()
Default constructor.
Method Detail

getEarliest

public long getEarliest()
Retrieve the earliest time in the period table.
Returns:
long earliest time in the table or Long.MAX_VALUE if no earliest time available

setEarliest

public void setEarliest(long time)
Set the earliest time in the period table if not already earlier.
Parameters:
long - earliest time to set

getLatest

public long getLatest()
Retrieve the latest time in the period table.
Returns:
long latest time in the table or Long.MAX_VALUE if no latest time available

getDuration

public long getDuration(long bound)
Retrieve the total active time in the period table.
Parameters:
bound - maximum stop time considered
Returns:
long total active time

check

public boolean check(long time)
Check whether a specific time falls within the table periods.
Parameters:
long - time to check for
Returns:
boolean whether the time fell withing the tables periods

add

public long add(long start,
                long stop)
Add a new time period into the table, without merging adjacent entries. Start times need to be kept so that further adds will respect them.
Parameters:
long - start time of period
long - stop time of period
Returns:
long actual stop time, possibly reduced due to earlier explicit start times

bound

public long bound(long stop)
Bound the period table with an explicit stop time. This happens when a child alerts a parent that another link was used at this time.
Parameters:
long - explicit stop time
Returns:
long next explicit start time beyond this stop

bound

public void bound(PeriodTable bounder)
Bound all entries by those from another table (child's table). A parent may have an exagerrated view of the activity on a particular link, so this allows us to constrain the table to what the child reports as it's actual needs.

merge

public long merge()
Merge the activity table with no specific bound on the final stop time.
Returns:
long actual final stop time

merge

public long merge(long maxStop)
Merge the activity table with a specific bound on the final stop time.
Parameters:
long - bound on final stop time
Returns:
long actual final stop time

merge

public void merge(PeriodTable merger)
Merge periods from another table into this one. This is used to build a single table representing the total activity on all links of a node. This total activity is then used by its parents to bound their tables.
Parameters:
PeriodTable - table to merge into this one

merge

public static PeriodTable merge(PeriodTable[] tables)
Create a new table that contains the total activity of all component tables.
Parameters:
PeriodTable[] - list of component tables to merge
Returns:
PeriodTable new table with total activity

load

public void load(java.io.BufferedReader br)
          throws BuildException
Load a period table from a file.
Parameters:
BufferedReader - reader to use to parse file

print

public void print()
Print the contents of the period table.

clearData

public void clearData()
Clear temporary data for table and each entry

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Initialize transient variables after reading the object in.
Parameters:
ObjectInputStream - input stream
Throws:
IOException - if object not read correctly

mwalk Platform 0.3.0

Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers