yass.database
Class NodePositionChangeEvent

java.lang.Object
  extended by yass.database.Event
      extended by yass.database.NodePositionChangeEvent

public class NodePositionChangeEvent
extends Event

A node location change event which occurs in the simulator to be stored for later analysis. Events of this type encapsulate changes in node identity, position or status, that do not relate directly to network activity.


Field Summary
private static java.sql.PreparedStatement insertionPreparedStatement
          A database prepared statement with which to insert node location transition events into the database
private static org.apache.log4j.Logger log
          The logger
private  Node node
          The node which underwent transition
private  Position position
          The new position of the node
 
Fields inherited from class yass.database.Event
INSERT_ATTEMPT_MAX
 
Constructor Summary
NodePositionChangeEvent(Node node, Position position)
          Creates a new instance of NodePositionChangeEvent
 
Method Summary
private static java.sql.PreparedStatement createInsertionPreparedStatement(Database database)
          Creates a database prepared statement with which to insert node location transition events into the database
static java.lang.String getInsertSql(DatabaseType type)
          Obtains SQL code to insert an instance of this event type into the relevant table
 Node getNode()
          Obtains the node
 Position getPosition()
          Obtains the node position
static java.lang.String[] getPurgeSimulationSql(DatabaseType type)
          Obtains SQL code to all instances of this event type from the relevant table related to a specified simulation
static java.lang.String[] getRemoveRowSql(DatabaseType type)
          Obtains SQL code to remove instances of this event type from the relevant table
static java.lang.String[] getTableBuildSql(DatabaseType type)
          Obtains SQL code to build the database table used to store events of this type
static java.lang.String[] getTableDropSql(DatabaseType type)
          Obtains SQL code to drop the database table used to store events of this type
static java.lang.String getTableName()
          Obtains the name of the database table used to store events of this type
protected  void performInsert(Database database, double timestamp)
          Inserts the node location transition event into the supplied database with the specified timestamp
 
Methods inherited from class yass.database.Event
insertIntoDatabase, setDoubleColumn, setDoubleColumnSanitiseMissing, setIntegerColumn, setIntegerColumnSanitiseMissing, setShortColumn, setShortColumnSanitiseMissing, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

insertionPreparedStatement

private static java.sql.PreparedStatement insertionPreparedStatement
A database prepared statement with which to insert node location transition events into the database


log

private static org.apache.log4j.Logger log
The logger


node

private Node node
The node which underwent transition


position

private Position position
The new position of the node

Constructor Detail

NodePositionChangeEvent

public NodePositionChangeEvent(Node node,
                               Position position)
Creates a new instance of NodePositionChangeEvent

Parameters:
node - the node whose new position is to be recorded
position - the new position
Method Detail

performInsert

protected void performInsert(Database database,
                             double timestamp)
                      throws java.sql.SQLException
Inserts the node location transition event into the supplied database with the specified timestamp

Specified by:
performInsert in class Event
Parameters:
database - the simulation event database
timestamp - the time at which the event occured
Throws:
java.sql.SQLException - if the event cannot be inserted into the database

createInsertionPreparedStatement

private static java.sql.PreparedStatement createInsertionPreparedStatement(Database database)
                                                                    throws java.sql.SQLException
Creates a database prepared statement with which to insert node location transition events into the database

Parameters:
database - the simulation event database
Returns:
the prepared statement
Throws:
java.sql.SQLException

getPosition

public Position getPosition()
Obtains the node position

Returns:
the node position

getNode

public Node getNode()
Obtains the node

Returns:
the node

getTableName

public static java.lang.String getTableName()
Obtains the name of the database table used to store events of this type

Returns:
the name of the database table used to store events of this type

getTableBuildSql

public static java.lang.String[] getTableBuildSql(DatabaseType type)
Obtains SQL code to build the database table used to store events of this type

Parameters:
type - the database type
Returns:
SQL code to build the database table used to store events of this type

getInsertSql

public static java.lang.String getInsertSql(DatabaseType type)
Obtains SQL code to insert an instance of this event type into the relevant table

Parameters:
type - the database type
Returns:
SQL code to insert an instance of this event type into the relevant table

getTableDropSql

public static java.lang.String[] getTableDropSql(DatabaseType type)
Obtains SQL code to drop the database table used to store events of this type

Parameters:
type - the database type
Returns:
SQL code to drop the database table used to store events of this type

getRemoveRowSql

public static java.lang.String[] getRemoveRowSql(DatabaseType type)
Obtains SQL code to remove instances of this event type from the relevant table

Parameters:
type - the database type
Returns:
SQL code to remove instances of this event type from the relevant table

getPurgeSimulationSql

public static java.lang.String[] getPurgeSimulationSql(DatabaseType type)
Obtains SQL code to all instances of this event type from the relevant table related to a specified simulation

Parameters:
type - the database type
Returns:
SQL code to remove instances of this event type from the relevant table