net.sf.saffron.opt
Class OptUtil

java.lang.Object
  |
  +--net.sf.saffron.opt.OptUtil

public abstract class OptUtil
extends Object

OptUtil defines static utility methods for use in optimizing SaffronRels.

Since:
26 September, 2003
Version:
$Id: //open/saffron/src/net/sf/saffron/opt/OptUtil.java#4 $
Author:
jhyde

Nested Class Summary
private static class OptUtil.RelHolder
           
private static class OptUtil.VariableSetVisitor
           
private static class OptUtil.VariableUsedVisitor
           
 
Field Summary
private static Variable var0
           
private static Variable var1
           
 
Constructor Summary
OptUtil()
           
 
Method Summary
static SaffronRel clone(SaffronRel rel)
           
static SaffronRel[] clone(SaffronRel[] rels)
           
static int getInputOrdinal(String name)
          Returns the ordinal of the input represented by the variable name, or -1 if it does not represent an input.
static Set getVariablesSet(SaffronRel rel)
          Returns a list of variables set by a relational expression or its descendants.
static String[] getVariablesSetAndUsed(SaffronRel rel0, SaffronRel rel1)
          Returns a set of distinct variables set by rel0 and used by rel1.
static Set getVariablesUsed(SaffronRel rel)
          Returns a list of variables used by a relational expression or its descendants.
static SaffronRel go(RelVisitor visitor, SaffronRel p)
          Sets a RelVisitor going on a given relational expression, and returns the result.
static FieldAccess makeFieldAccess(Expression expr, int field)
          Constructs a reference to the fieldth field of an expression.
static Expression makeFieldAccess(Expression expr, String fieldName)
          Constructs a reference to a named field of an expression.
static FieldAccess makeFieldAccess(int ordinal, int field)
          Constructs a reference to the fieldth field of the ordinalth input.
static String makeName(int ordinal)
          Constructs the name for the ordinalth input.
static Variable makeReference(int ordinal)
           
static String toString(SaffronRel[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

var0

private static final Variable var0

var1

private static final Variable var1
Constructor Detail

OptUtil

public OptUtil()
Method Detail

getInputOrdinal

public static int getInputOrdinal(String name)
Returns the ordinal of the input represented by the variable name, or -1 if it does not represent an input.


getVariablesSet

public static Set getVariablesSet(SaffronRel rel)
Returns a list of variables set by a relational expression or its descendants.


getVariablesSetAndUsed

public static String[] getVariablesSetAndUsed(SaffronRel rel0,
                                              SaffronRel rel1)
Returns a set of distinct variables set by rel0 and used by rel1.


getVariablesUsed

public static Set getVariablesUsed(SaffronRel rel)
Returns a list of variables used by a relational expression or its descendants. The list may contain duplicates.


clone

public static SaffronRel clone(SaffronRel rel)

clone

public static SaffronRel[] clone(SaffronRel[] rels)

go

public static SaffronRel go(RelVisitor visitor,
                            SaffronRel p)
Sets a RelVisitor going on a given relational expression, and returns the result.


makeFieldAccess

public static FieldAccess makeFieldAccess(int ordinal,
                                          int field)
Constructs a reference to the fieldth field of the ordinalth input.


makeFieldAccess

public static FieldAccess makeFieldAccess(Expression expr,
                                          int field)
Constructs a reference to the fieldth field of an expression.


makeFieldAccess

public static Expression makeFieldAccess(Expression expr,
                                         String fieldName)
Constructs a reference to a named field of an expression.


makeName

public static String makeName(int ordinal)
Constructs the name for the ordinalth input. For example, makeName(0) returns "$input0".


makeReference

public static Variable makeReference(int ordinal)

toString

public static String toString(SaffronRel[] a)

SourceForge.net_Logo