org.basex.core
Class Context

java.lang.Object
  extended by org.basex.core.Context

public final class Context
extends java.lang.Object

This class offers as central database context. It references the currently opened database. Moreover, it provides references to the currently used, marked and copied node sets.

Author:
Workgroup DBIS, University of Konstanz 2005-09, ISC License, Christian Gruen

Field Summary
 Prop prop
          Database properties.
 
Constructor Summary
Context()
          Constructor.
Context(Context ctx)
          Constructor.
 
Method Summary
 void addToPool(Data d)
          Adds the specified data reference to the pool.
 void close()
          Closes the database instance.
 void closeDB()
          Removes the current database context.
 Nodes copied()
          Returns the copied context set.
 void copy(Nodes copy)
          Sets the current node set as copy.
 Nodes current()
          Returns the current context set.
 void current(Nodes curr)
          Sets the current context set.
 Data data()
          Returns data reference.
 void data(Data d)
          Sets the data reference.
 Nodes marked()
          Returns the marked context set.
 void marked(Nodes mark)
          Sets the marked context set.
 void openDB(Data d)
          Sets the specified data instance as current database.
 Data pin(java.lang.String name)
          Pins the pool.
 boolean pinned(java.lang.String db)
          Checks if the specified database is pinned.
 boolean root()
          Returns true if all current nodes refer to document nodes.
 boolean unpin(Data d)
          Unpins a data reference.
 void update()
          Updates references to the document nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prop

public final Prop prop
Database properties.

Constructor Detail

Context

public Context()
Constructor.


Context

public Context(Context ctx)
Constructor.

Parameters:
ctx - parent context
Method Detail

close

public void close()
Closes the database instance.


root

public boolean root()
Returns true if all current nodes refer to document nodes.

Returns:
result of check

data

public Data data()
Returns data reference.

Returns:
data reference

openDB

public void openDB(Data d)
Sets the specified data instance as current database.

Parameters:
d - data reference

closeDB

public void closeDB()
Removes the current database context.


update

public void update()
Updates references to the document nodes.


current

public Nodes current()
Returns the current context set.

Returns:
current context set

current

public void current(Nodes curr)
Sets the current context set.

Parameters:
curr - current context set

data

public void data(Data d)
Sets the data reference.

Parameters:
d - data reference

copied

public Nodes copied()
Returns the copied context set.

Returns:
copied context set

copy

public void copy(Nodes copy)
Sets the current node set as copy.

Parameters:
copy - current node set as copy.

marked

public Nodes marked()
Returns the marked context set.

Returns:
marked context set

marked

public void marked(Nodes mark)
Sets the marked context set.

Parameters:
mark - marked context set

pin

public Data pin(java.lang.String name)
Pins the pool.

Parameters:
name - name of database
Returns:
data reference

unpin

public boolean unpin(Data d)
Unpins a data reference.

Parameters:
d - data reference
Returns:
true if reference was removed from the pool

addToPool

public void addToPool(Data d)
Adds the specified data reference to the pool.

Parameters:
d - data reference

pinned

public boolean pinned(java.lang.String db)
Checks if the specified database is pinned.

Parameters:
db - name of database
Returns:
int use-status