relop
Class Schema

java.lang.Object
  extended by relop.Schema

public class Schema
extends java.lang.Object

Each tuple has a schema that defines the logical view of the raw bytes; it describes the types, lengths, offsets, and names of a tuple's fields.


Field Summary
static int MIN_WIDTH
          Minimum column width for output.
 
Constructor Summary
Schema(int fldcnt)
          Constructs a schema for the given number of fields.
 
Method Summary
 int fieldLength(int fldno)
          Gets the length of the given field.
 java.lang.String fieldName(int fldno)
          Gets the name of the given field.
 int fieldNumber(java.lang.String name)
          Gets the number of the field with the given name, or -1 if not found.
 int fieldOffset(int fldno)
          Gets the offset of the given field.
 int fieldType(int fldno)
          Gets the type of the given field.
 int getCount()
          Gets the number of fields in the schema.
 int getLength()
          Gets the size of a tuple (in bytes).
 void initField(int fldno, int type, int length, java.lang.String name)
          Sets the type, length, and name for the given field; this automatically calculates its offset, provided that fields are set in ascending order.
 void initField(int fldno, Schema schema, int srcno)
          Copies a field from another schema.
static Schema join(Schema s1, Schema s2)
          Builds and returns a new schema resulting from joining two schemas.
 void print()
          Prints the schema (i.e.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_WIDTH

public static final int MIN_WIDTH
Minimum column width for output.

See Also:
Constant Field Values
Constructor Detail

Schema

public Schema(int fldcnt)
Constructs a schema for the given number of fields.

Method Detail

initField

public void initField(int fldno,
                      int type,
                      int length,
                      java.lang.String name)
Sets the type, length, and name for the given field; this automatically calculates its offset, provided that fields are set in ascending order.


initField

public void initField(int fldno,
                      Schema schema,
                      int srcno)
Copies a field from another schema.

Parameters:
fldno - number of this field to set
schema - contains the info to copy
srcno - number of the field to copy

join

public static Schema join(Schema s1,
                          Schema s2)
Builds and returns a new schema resulting from joining two schemas.

Parameters:
s1 - the left schema
s2 - the right schema

getCount

public int getCount()
Gets the number of fields in the schema.


getLength

public int getLength()
Gets the size of a tuple (in bytes).


fieldType

public int fieldType(int fldno)
Gets the type of the given field.


fieldLength

public int fieldLength(int fldno)
Gets the length of the given field.


fieldOffset

public int fieldOffset(int fldno)
Gets the offset of the given field.


fieldName

public java.lang.String fieldName(int fldno)
Gets the name of the given field.


fieldNumber

public int fieldNumber(java.lang.String name)
Gets the number of the field with the given name, or -1 if not found.


print

public void print()
Prints the schema (i.e. the first lines of typical query output).