DSRG.MKB
Class Attribute

java.lang.Object
  |
  +--DSRG.MKB.Attribute

public class Attribute
extends java.lang.Object

represents an attribute in some relation.
This is meta-knowledge, so the attribute knows only its name, type, and some performance parameters for the QC-Model (size).


Field Summary
private  java.lang.String attName
          the name of this attribute
private  int attSize
          this is the WIDTH of the column, to go with the type.
private  java.lang.String attType
          the type of this attribute (as a String)
private  Relation parent
          my parent relation object
 
Constructor Summary
Attribute(Relation rel, java.lang.String name, int size)
          Construct an Attribute Object.
Attribute(Relation myRel, java.lang.String myName, java.lang.String myType, int mySize)
          These should eventually be the only remaining constructors.
 
Method Summary
 boolean changeName(java.lang.String newName)
          renames attribute in MKB only
 java.lang.String displayAll()
          returns a string representation of this attribute
 java.lang.String getFullName()
          get name in the form "ISName.RelName.AttName"
 IS getIS()
          returns the IS object that is this attribute's parent relation's IS
 java.lang.String getName()
          get name.
 java.lang.String getNoIS()
          Return Attribute Name in the form RelName.AttName.
 Relation getRelation()
          return the relation object that is this attribute's parent
 int getSize()
          return size (which is just a number passed in the constructor) of this attribute
 java.lang.String getType()
          return attribute's type as String
 TypeConstraint getTypeConstraint()
          return a TypeConstraint Object.
 java.lang.String getTypeConstraintAsString()
          return a string of the form "attType(attName)".
 void setSize(int newSize)
          set size of this attribute
 void setType(java.lang.String myType)
          set attribute's type as String
 java.lang.String toString()
          Dump the Attribute Object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

attName

private java.lang.String attName
the name of this attribute

attType

private java.lang.String attType
the type of this attribute (as a String)

attSize

private int attSize
this is the WIDTH of the column, to go with the type. It is not the number of tuples in the attribute. Currently (051999) this is mixed with the physical size of the attribute that we need for QC-computation. We should sort it out later since the logical size could be different from the stored size :(

parent

private Relation parent
my parent relation object
Constructor Detail

Attribute

public Attribute(Relation rel,
                 java.lang.String name,
                 int size)
Construct an Attribute Object. Called from parser. With "size" parameter for QC purpose. The "type" is not assigned here since this would have made the MKBParser too complicated (since Type Constraints are defined later than attributes).

Attribute

public Attribute(Relation myRel,
                 java.lang.String myName,
                 java.lang.String myType,
                 int mySize)
These should eventually be the only remaining constructors. One assumes that the attribute has the relation name of its parent, the other allows to overwrite the table name (for query breakdown)
Method Detail

displayAll

public java.lang.String displayAll()
returns a string representation of this attribute

toString

public java.lang.String toString()
Dump the Attribute Object.
Overrides:
toString in class java.lang.Object

getTypeConstraintAsString

public java.lang.String getTypeConstraintAsString()
return a string of the form "attType(attName)". For user interfaces.

getTypeConstraint

public TypeConstraint getTypeConstraint()
return a TypeConstraint Object. Used for user interface

getName

public java.lang.String getName()
get name.

getFullName

public java.lang.String getFullName()
get name in the form "ISName.RelName.AttName"

getNoIS

public java.lang.String getNoIS()
Return Attribute Name in the form RelName.AttName. Function should be renamed - the name is misleading

getType

public java.lang.String getType()
return attribute's type as String

setType

public void setType(java.lang.String myType)
set attribute's type as String

getSize

public int getSize()
return size (which is just a number passed in the constructor) of this attribute

setSize

public void setSize(int newSize)
set size of this attribute

getRelation

public Relation getRelation()
return the relation object that is this attribute's parent

getIS

public IS getIS()
returns the IS object that is this attribute's parent relation's IS

changeName

public boolean changeName(java.lang.String newName)
renames attribute in MKB only