EVEDemo.MW
Class View

java.lang.Object
  |
  +--EVEDemo.MW.View

public class View
extends java.lang.Object

This holds views. Mainly used for the EVE-Demo. It holds a view extent, a view definition, and can hold another instance of this same class (as an old view; used for the demo to show "extent differences" ).


Field Summary
private  boolean changed
          has there been a change made? It's for time measurement of performance evaluation
private static boolean DEBUG
           
 java.lang.String esql_definition
          view definition in E-SQL
static int EXTERNAL_WHERE
          2 for EXTERNAL clause
static int FROM_CLAUSE
          2 for FROM clause
static int INTERNAL_WHERE
          1 for INTERNAL clause
static int LOCAL_WHERE
          0 for LOCAL clause
private  Main main
          a handle to the Main class.
private static VKB mainVKB
          handle to the current VKB instance
used for all kinds of stuff of Jeff's algorithm.
private  DataUpdateReceiver myDUR
          handle to the data update receiver in SWEEP
used for performance experiments
private  PSWEEP myPSWEEP
          handle to the current PSWEEP instance
used for incremental VM
private  java.lang.String name
          name of the view
(package private)  Relation negRel
          if we have negative counter, i.e.
private  View oldView
          each instance includes another instance of the same class in order to hold one "old" version of itself.
static int SELECT_CLAUSE
          1 for SELECT clause
private  java.lang.String sql_definition
          view definition in SQL
(package private)  long startPerformance
          timestamp for performance experiments
private  Table table
          the view can hold its own extent as a Table object.
private  java.util.Vector versions
          with the advent of the QC-model, each view has to be capable of temporarily holding a number of "versions", i.e., objects of class "Version" which are needed for selecting a good view after a schema change with the QC-Model.
static int WHERE_CLAUSE
          0 for WHERE clause
 
Constructor Summary
View(Main myMain, java.lang.String vName, MKB mainMKB, VKB myVKB)
          Constructs a new instance of the View class
View(View oldView)
          Copy Constructor.
 
Method Summary
 void addTuples(Relation sweepRelation)
          the interface with the SWEEP classes
adds the incoming SWEEP.Relation-object to the extent
DISABLED FOR RE-IMPLEMENTATION
 boolean getChangeStatus()
           
 java.lang.String getDefinition()
          getDefinition - returns the definition of this view.
 Table getExtent()
          get the extent as the new table object
 java.lang.String getName()
          getName - returns the name of the view
 View getOldView()
          getOldView - returns a reference to the OldView.
 QC getQC(int index)
          returns the QC-Object for the version at "index"
 java.lang.String getVersion(int index)
          returns the view definition string of the version with index "index" as a string
 int numberOfVersions()
          returns the number of versions for this view or null if the vector is not intialized
 void refresh()
          Refresh - refresh the current view from the VKB.
 void removeTuples(Relation sweepRelation)
          the interface with the SWEEP classes
removes the incoming SWEEP.Relation-object from the extent
DISABLED FOR RE-IMPLEMENTATION
 boolean replaceView_DefinitionBy(int version_number)
          calls the VKB to replace this view's View_Definition by version number i
 void saveView()
          saveView - makes a copy of the view into the oldView.
 void sendUpdate(java.lang.String isName, java.lang.String relName, int count, java.lang.String update)
          This is used to send data update to the information source.
 void setExtent(Table ext)
          Set the new table of this View.
 void startVM()
          Used to start the View Maintenance Module
 void stopTimer()
          Stop the timer for the Data Update performance evaluation.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

main

private Main main
a handle to the Main class. This is used so the View class can find the QueryEngine

name

private java.lang.String name
name of the view

esql_definition

public java.lang.String esql_definition
view definition in E-SQL

sql_definition

private java.lang.String sql_definition
view definition in SQL

oldView

private View oldView
each instance includes another instance of the same class in order to hold one "old" version of itself.
I'm still amazed that this is not recursive...

versions

private java.util.Vector versions
with the advent of the QC-model, each view has to be capable of temporarily holding a number of "versions", i.e., objects of class "Version" which are needed for selecting a good view after a schema change with the QC-Model. The Version-class sits in the MW package.

table

private Table table
the view can hold its own extent as a Table object.
this is not feasible when view extents are large, but this is only a demo :-)

myPSWEEP

private PSWEEP myPSWEEP
handle to the current PSWEEP instance
used for incremental VM

myDUR

private DataUpdateReceiver myDUR
handle to the data update receiver in SWEEP
used for performance experiments

mainVKB

private static VKB mainVKB
handle to the current VKB instance
used for all kinds of stuff of Jeff's algorithm. All the view instance must use same VKB object.

WHERE_CLAUSE

public static final int WHERE_CLAUSE
0 for WHERE clause

SELECT_CLAUSE

public static final int SELECT_CLAUSE
1 for SELECT clause

FROM_CLAUSE

public static final int FROM_CLAUSE
2 for FROM clause

changed

private boolean changed
has there been a change made? It's for time measurement of performance evaluation

LOCAL_WHERE

public static final int LOCAL_WHERE
0 for LOCAL clause

INTERNAL_WHERE

public static final int INTERNAL_WHERE
1 for INTERNAL clause

EXTERNAL_WHERE

public static final int EXTERNAL_WHERE
2 for EXTERNAL clause

startPerformance

long startPerformance
timestamp for performance experiments

negRel

Relation negRel
if we have negative counter, i.e. fail to delete something, we store those in this relation. then, after each addition, we try to apply this delete relation again to view, if that is successful, then, we remove the tuple from it, otherwise, we still keep the tuple.
Constructor Detail

View

public View(Main myMain,
            java.lang.String vName,
            MKB mainMKB,
            VKB myVKB)
Constructs a new instance of the View class

View

public View(View oldView)
Copy Constructor. Makes a copy of the view to a second identical variable structure in this instance.
For comparing old and new view extents in the demo
Method Detail

getName

public java.lang.String getName()
getName - returns the name of the view

refresh

public void refresh()
Refresh - refresh the current view from the VKB.
Hacked 030799 by koeller. This function should (ideally) be called only after a view synchronization. So we can retrieve a vector of versions from the VKB so the GUI can query it.

getDefinition

public java.lang.String getDefinition()
getDefinition - returns the definition of this view. This defaults to returning the esql definition since that is what is needed by the GUI.

getExtent

public Table getExtent()
get the extent as the new table object

setExtent

public void setExtent(Table ext)
Set the new table of this View. Needed for incremental Updates.

getOldView

public View getOldView()
getOldView - returns a reference to the OldView.

saveView

public void saveView()
saveView - makes a copy of the view into the oldView. if oldView already exists then, it overrides it.

stopTimer

public void stopTimer()
Stop the timer for the Data Update performance evaluation.

getChangeStatus

public boolean getChangeStatus()

sendUpdate

public void sendUpdate(java.lang.String isName,
                       java.lang.String relName,
                       int count,
                       java.lang.String update)
This is used to send data update to the information source. It's used for SWEEP

startVM

public void startVM()
Used to start the View Maintenance Module

addTuples

public void addTuples(Relation sweepRelation)
the interface with the SWEEP classes
adds the incoming SWEEP.Relation-object to the extent
DISABLED FOR RE-IMPLEMENTATION

removeTuples

public void removeTuples(Relation sweepRelation)
the interface with the SWEEP classes
removes the incoming SWEEP.Relation-object from the extent
DISABLED FOR RE-IMPLEMENTATION

getVersion

public java.lang.String getVersion(int index)
returns the view definition string of the version with index "index" as a string
Parameters:
index - the index of the version to return
Returns:
null if index is wrong

replaceView_DefinitionBy

public boolean replaceView_DefinitionBy(int version_number)
calls the VKB to replace this view's View_Definition by version number i

numberOfVersions

public int numberOfVersions()
returns the number of versions for this view or null if the vector is not intialized
Returns:
-1 is the versions vector is not initialized

getQC

public QC getQC(int index)
returns the QC-Object for the version at "index"
Parameters:
index - the index of the version for which to return the QC-Object
Returns:
null if index is wrong