cve
Class Context

java.lang.Object
  |
  +--cve.Context

public class Context
extends java.lang.Object

A context is a tuple of variables and their values.


Field Summary
private  int[] contextVals
           
private  Variable[] contextVars
           
 
Constructor Summary
(package private) Context()
          constructs the empty context.
(package private) Context(Context oldcon, Variable var, int val)
          constructs a new context that is oldcon together with var=val.
(package private) Context(Variable[] vars, int[] vals)
          constructs a new context with variables vars and values vals.
(package private) Context(Variable[] vars, int[] vals, int len)
          constructs a new context with variables vars and values vals, given that len is the number of observed variables.
 
Method Summary
 boolean compatible(Context c1)
          is true if this context is compatible with c1.
 int[] getVals()
          returns the array of values for the context.
 Variable[] getVars()
          returns the array of variables for the context.
 boolean involves(Variable var)
          is true if this context involves variable var.
 int lookup(Variable var)
          returns the value of variable var.
 void print()
           
 Context remove(Variable var)
          returns a new context with var removed.
 Context union(Context c1)
          returns the union of this context and c1.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

contextVars

private Variable[] contextVars

contextVals

private int[] contextVals
Constructor Detail

Context

Context(Variable[] vars,
        int[] vals)
constructs a new context with variables vars and values vals.
Parameters:
vars - the array of variables for the new context
vals - the array of values for the new context

Context

Context(Variable[] vars,
        int[] vals,
        int len)
constructs a new context with variables vars and values vals, given that len is the number of observed variables.
Parameters:
vars - the array containing variables for the new context
vals - the array containing values for the new context
int - the numner of variables in the context

Context

Context()
constructs the empty context.

Context

Context(Context oldcon,
        Variable var,
        int val)
constructs a new context that is oldcon together with var=val. You can assume that var is not assigned in oldcon.
Parameters:
oldcon - the context being expanded
var - a variable that doesn't appear in oldcon
val - a value in the domain of var
Method Detail

getVars

public Variable[] getVars()
returns the array of variables for the context.

getVals

public int[] getVals()
returns the array of values for the context.

compatible

public boolean compatible(Context c1)
is true if this context is compatible with c1.
Parameters:
c1 - a context to compare this one to.
Returns:
true if if this context is compatible with c1.

union

public Context union(Context c1)
returns the union of this context and c1. We assume that the contexts are compatible.
Parameters:
c1 - a context to compare this one to.
Returns:
a context that the union of this context and c1.

involves

public boolean involves(Variable var)
is true if this context involves variable var.

lookup

public int lookup(Variable var)
returns the value of variable var. This assumes that var has a value.

remove

public Context remove(Variable var)
returns a new context with var removed. This assumes that var is in the context.

print

public void print()