zugvis
Class Functions

java.lang.Object
  extended by zugvis.Functions

public class Functions
extends java.lang.Object

Set of utility functions


Constructor Summary
Functions()
           
 
Method Summary
static prefuse.data.Table addInternalConnectionIDs(prefuse.data.Table connections)
          Adds internal Connection IDs, ids are 0, 10, 20, 30...
static prefuse.data.Table addStationNames(prefuse.data.Table data, prefuse.data.Table stations)
          Adds new columns with trainnames on the data-tabel
static prefuse.data.Table addTipText(prefuse.data.Table data, prefuse.data.Table dates, boolean relativ)
          Adds a new column "tipText" with traininfos in HTML specially for tooltips
static prefuse.data.Table addTrainInfo(prefuse.data.Table data, prefuse.data.Table trains)
          Adds new columns with trainnames and infos on the data-table
static void deleteDirectory(java.io.File path)
           
static prefuse.data.Table deleteStopOvers(prefuse.data.Table connections)
          Delete Stop overs
static java.lang.String extractTabels(java.lang.String zipfileName, java.lang.String tempDirName)
          tries to extract the 4 necessary datatables from a given zip file
static java.util.GregorianCalendar getEarliestDate(prefuse.data.Table data, java.util.GregorianCalendar day)
          Get the earliste connection (time/date) of a specific date
static java.lang.Object getFieldforID(java.lang.String ID, java.lang.String IDfield, java.lang.String field, prefuse.data.Table t)
           
static java.util.GregorianCalendar getLatestDate(prefuse.data.Table data, java.util.GregorianCalendar day)
          Get the lastest arival of connection (time/date) of a specific date
static prefuse.data.Table getSortedConnections(prefuse.data.Table connections, boolean ascend)
          Sort connectionstable on field "fromTime"
static int long2int(long l)
          Returns the int value that is closest to l.
static prefuse.data.Table makeData(prefuse.data.Table connections, prefuse.data.Table stations, prefuse.data.Table trains, prefuse.data.Table dates)
          Geneartes a Table with all Dates of the planevalidation and trains
static prefuse.data.Table makeRelData(prefuse.data.Table connections, prefuse.data.Table stations, prefuse.data.Table trains, prefuse.data.Table dates)
          Geneartes a Table with all Dates of the planevalidation and trains for the relative barchartvisualization
static long object2Long(java.lang.Object obj)
          convert an object to a long
static int searchLast(java.lang.String searchField, java.lang.String searchValue, prefuse.data.Table t)
          find the last row in a table containing a given value
static com.toedter.calendar.JCalendar setValidDates(com.toedter.calendar.JCalendar calendar, prefuse.data.Table dates)
          Sets the calendar MinSelectableDate and MaxSelectableDate
static boolean trainOnDate(int connectID, java.util.GregorianCalendar onDate, prefuse.data.Table dates)
          Return true if a connection goes on a specific date
static java.lang.String trainOnDateInfo(java.lang.String connectID, prefuse.data.Table dates)
          Return a string with traininfos abaut the plan
static java.lang.String validateTabels(prefuse.data.Table connections, prefuse.data.Table stations, prefuse.data.Table trains, prefuse.data.Table dates)
          tests the consitency of the 4 datatables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

deleteStopOvers

public static prefuse.data.Table deleteStopOvers(prefuse.data.Table connections)
Delete Stop overs

Parameters:
connections - Tabel of Connections
Returns:
Table of Connections without stop overs

getSortedConnections

public static prefuse.data.Table getSortedConnections(prefuse.data.Table connections,
                                                      boolean ascend)
Sort connectionstable on field "fromTime"

Parameters:
ascend - Sort ascend
connections - Tabel of Connections
Returns:
Sortet table of Connections

makeData

public static prefuse.data.Table makeData(prefuse.data.Table connections,
                                          prefuse.data.Table stations,
                                          prefuse.data.Table trains,
                                          prefuse.data.Table dates)
Geneartes a Table with all Dates of the planevalidation and trains

Parameters:
connections - Table of connections
stations - Table of stationnames and infos
trains - Table of trainnames and infos
dates - Table of dates, if a connection goes or not on a specific day/date (first row are the planvaluerange)
Returns:
Table of all connections and infos

makeRelData

public static prefuse.data.Table makeRelData(prefuse.data.Table connections,
                                             prefuse.data.Table stations,
                                             prefuse.data.Table trains,
                                             prefuse.data.Table dates)
Geneartes a Table with all Dates of the planevalidation and trains for the relative barchartvisualization

Parameters:
connections - Table of connections
stations - Table of stationnames and infos
trains - Table of trainnames and infos
dates - Table of dates, if a connection goes or not on a specific day/date (first row are the planvaluerange)
Returns:
Table of all connections and infos

trainOnDate

public static boolean trainOnDate(int connectID,
                                  java.util.GregorianCalendar onDate,
                                  prefuse.data.Table dates)
Return true if a connection goes on a specific date

Parameters:
connectID - ID of the connection
onDate - The specific Date
dates - Table of Dates
Returns:
True if the Connection goes on the specific date

trainOnDateInfo

public static java.lang.String trainOnDateInfo(java.lang.String connectID,
                                               prefuse.data.Table dates)
Return a string with traininfos abaut the plan

Parameters:
connectID - ID of the connection
dates - Table of Dates
Returns:
String with traininfos

addInternalConnectionIDs

public static prefuse.data.Table addInternalConnectionIDs(prefuse.data.Table connections)
Adds internal Connection IDs, ids are 0, 10, 20, 30...

Parameters:
connections - Table of connections
Returns:
Table of data with internalConnectionIDs

addTrainInfo

public static prefuse.data.Table addTrainInfo(prefuse.data.Table data,
                                              prefuse.data.Table trains)
Adds new columns with trainnames and infos on the data-table

Parameters:
data - Table of connections
trains - Table of traininfos
Returns:
Table of data with trainnames and infos added

addTipText

public static prefuse.data.Table addTipText(prefuse.data.Table data,
                                            prefuse.data.Table dates,
                                            boolean relativ)
Adds a new column "tipText" with traininfos in HTML specially for tooltips

Parameters:
dates - Table of dates
relativ - If relativ, timeinfos ware taken from "fromTimeReal" and "toTimeReal"
data - Table of connections with tiptextrow
Returns:
Table of data with trainnames and infos added

addStationNames

public static prefuse.data.Table addStationNames(prefuse.data.Table data,
                                                 prefuse.data.Table stations)
Adds new columns with trainnames on the data-tabel

Parameters:
stations - Table of stationnames and infos
data - Table of connections
Returns:
Table of data with stationnames added

getEarliestDate

public static java.util.GregorianCalendar getEarliestDate(prefuse.data.Table data,
                                                          java.util.GregorianCalendar day)
Get the earliste connection (time/date) of a specific date

Parameters:
data - Table of data/connections
day - the specific day
Returns:
date/time of eralist connection

getLatestDate

public static java.util.GregorianCalendar getLatestDate(prefuse.data.Table data,
                                                        java.util.GregorianCalendar day)
Get the lastest arival of connection (time/date) of a specific date

Parameters:
data - Table of data/connections
day - the specific day
Returns:
date/time of arrival of the last connection

setValidDates

public static com.toedter.calendar.JCalendar setValidDates(com.toedter.calendar.JCalendar calendar,
                                                           prefuse.data.Table dates)
Sets the calendar MinSelectableDate and MaxSelectableDate

Parameters:
calendar - Calendar to set
dates - Table of dates
Returns:
Modified calendar

object2Long

public static long object2Long(java.lang.Object obj)
convert an object to a long


long2int

public static int long2int(long l)
Returns the int value that is closest to l. That is, if l can fit into a 32-bit unsigned number, returns (int)l. Otherwise, returns either Integer.MAX_VALUE or Integer.MIN_VALUE as appropriate.


getFieldforID

public static java.lang.Object getFieldforID(java.lang.String ID,
                                             java.lang.String IDfield,
                                             java.lang.String field,
                                             prefuse.data.Table t)
Parameters:
ID -
IDfield -
field -
t -
Returns:

searchLast

public static int searchLast(java.lang.String searchField,
                             java.lang.String searchValue,
                             prefuse.data.Table t)
find the last row in a table containing a given value

Parameters:
searchField - the field of the table that is compared to the searchValue parameter.
searchValue - the value that is searched

extractTabels

public static java.lang.String extractTabels(java.lang.String zipfileName,
                                             java.lang.String tempDirName)
tries to extract the 4 necessary datatables from a given zip file

Returns:
an empty string of no errors occurred. Otherwise an error message is returned.

deleteDirectory

public static void deleteDirectory(java.io.File path)

validateTabels

public static java.lang.String validateTabels(prefuse.data.Table connections,
                                              prefuse.data.Table stations,
                                              prefuse.data.Table trains,
                                              prefuse.data.Table dates)
tests the consitency of the 4 datatables