FileDocCategorySizeDatePackage
ColumnEnumeration.javaAPI DocExample2600Tue Dec 08 01:21:00 GMT 1998oisoft.togetherx.scripts.SQL.impl

ColumnEnumeration

public class ColumnEnumeration extends Object implements Enumeration

Fields Summary
private oisoft.togetherx.scriptapi.UML.enums.UMLAttributeEnumeration
myAttributes
private Enumeration
myForeignKeys
private TableImpl
myTable
private Enumeration
myForeignColumns
private boolean
myPrimaryKeyOnly
private Object
myCurrent
Constructors Summary
ColumnEnumeration(TableImpl table, SQLModelImpl model)

associates
ColumnEnumeration


//  private QryAttribute myLastAttribute;

//  private Table myForeignTable = null;
 
//  private Enumeration myForeignKeys = new EmptyEnumeration();

     
    this(table,model,true);
  
ColumnEnumeration(TableImpl table, SQLModelImpl model, boolean showForeignKeys)

    this(table,model,showForeignKeys,false);
  
ColumnEnumeration(TableImpl table, SQLModelImpl model, boolean showForeignKeys, boolean primaryKeyOnly)

    myAttributes = table.getUMLClass().getAttributes();
    myPrimaryKeyOnly = primaryKeyOnly;
    myTable = table;
    if( showForeignKeys ){
      myForeignKeys = new ForeignKeyEnumeration(table,model,primaryKeyOnly);
    }
    else{
      myForeignKeys = new EmptyEnumeration();
    }
    advance();
  
Methods Summary
private voidadvance()

    myCurrent = null;
    while( myAttributes.hasMoreElements() ){
      ColumnImpl tmp = (ColumnImpl)myTable.getColumn(myAttributes.getNextUMLAttribute());
      if(!myPrimaryKeyOnly || tmp.isPrimaryKey()){
        myCurrent = tmp;
        break;
      }
    }
    if(myCurrent == null){
      while(!myForeignColumns.hasMoreElements() && myForeignKeys.hasMoreElements() ){
        myForeignColumns = ((SQLForeignKey)myForeignKeys.nextElement()).getColumns();
      }
      if( myForeignColumns.hasMoreElements() ){
        myCurrent = myForeignColumns.nextElement();
      }
    }
  
public booleanhasMoreElements()

    return myCurrent != null;
  
public java.lang.ObjectnextElement()

    Object result = myCurrent;
    advance();
    return result;