Html interface empty { }; Html
; abstract class empcont implements java.io.Serializable { abstract public boolean is_full(); abstract public void insert( emp e ); abstract public void insert( int empno, int age, java.lang.String dept, java.lang.String name ); abstract public void close(int cardpers); abstract public void checkin(); //abstract public static CContTyp open(String namefile); we need it to be CContTYp =>PB } ; Html; // abstract cursor declaration Html abstract class empcursor implements java.util.Enumeration { abstract public emp obj(); abstract public void insert( emp e ); abstract public void insert( int empno, int age, java.lang.String dept, java.lang.String name ); abstract public emp first(); abstract public boolean more(); abstract public emp next(); abstract public void remove(); abstract public emp position(int pos); abstract public boolean hasMoreElements(); abstract public Object nextElement(); } ; Html static ; final class empcont1 extends empcont implements empty { emp_1 first_2, last_2; public empcont1() { if ( emp_1.cont == null ) emp_1.cont = this; else Jakarta.util.Util.fatalError("creating more than one instance"); first_2 = last_2 = null; } public boolean is_full() { return false; } public void insert( emp e ) { new emp_1 ( this, e ); //use the same for both methods //allows to add a counter in the method } public void insert( int empno, int age, java.lang.String dept, java.lang.String name ) { new emp_1( this, empno, age, dept, name ); //use the same for both methods //allows to add a counter in the method } public void close(int cardpers) { } public void checkin() { } public static empcont1 open(String namefile) { empcont1 cont = null; return cont; } } ; ; final class emp_1 extends emp { static public empcont1 cont = null; // element linking methods // element unlinking methods emp_1 left_2, right_2; boolean df_4; emp_1 ( ) { } emp_1 ( empcont1 c, emp e ) { super(e); // element linking methods // element unlinking methods dlist_relink_2(); df_4 = false; } emp_1 ( empcont1 c, int empno, int age, java.lang.String dept, java.lang.String name ) { super( empno, age, dept, name ); // element linking methods // element unlinking methods dlist_relink_2(); df_4 = false; } // element linking methods // element unlinking methods final void dlist_relink_2() { left_2 = null; if (cont.last_2 == null) cont.last_2 = this; right_2 = cont.first_2; cont.first_2 = this; if (right_2 != null) right_2.left_2 = this; } // element linking methods // element unlinking methods final void dlist_unlink_2() { if (left_2 != null) left_2.right_2 = right_2; if (right_2 != null) right_2.left_2 = left_2; if (cont.first_2 == this) cont.first_2 = right_2; if (cont.last_2 == this) cont.last_2 = left_2; } public int empno() { return empno; } public int age() { return age; } public java.lang.String dept() { return dept; } public java.lang.String name() { return name; } public int empno( int _newvalue ) { empno = _newvalue; return empno; } public int age( int _newvalue ) { age = _newvalue; return age; } public java.lang.String dept( java.lang.String _newvalue ) { dept = _newvalue; return dept; } public java.lang.String name( java.lang.String _newvalue ) { name = _newvalue; return name; } } // element linking methods // element unlinking methods ; ; abstract class empcursor_1 extends empcursor implements java.util.Enumeration{ // encapsulates only added data members and insert/remove methods public emp_1 obj; public empcont1 cont; // movement methods public emp obj() { return obj; } public boolean hasMoreElements() { return more(); } public Object nextElement() { Object ret = obj; next(); return ret; } public void insert( emp e ) { obj = new emp_1 ( cont, e ); // movement methods } public void insert( int empno, int age, java.lang.String dept, java.lang.String name ) { obj = new emp_1( cont, empno, age, dept, name ); // movement methods } // note: once element is unlinked, it is effectively deleted from the container // and will be garbage collected by Java once the cursor no longer points // to it. public void remove() { // movement methods obj.dlist_unlink_2(); obj.df_4 = true; } // position method -- will be overloaded by those concrete cursors supporting // postioning operation public emp position(int pos) { return null; } // movement methods final protected void adv_2() { obj = obj.right_2; } final protected void start_2() { obj = cont.first_2; } final protected void back_2() { obj = obj.left_2; } final protected void end_2() { obj = cont.last_2; } } // movement methods ; Html ; final class old extends empcursor_1 { // cursor specific (user-defined) fields // cursor-specific generated fields public old (empcont1 cont000 ) { obj = null; cont = cont000; // cursor specific (user-defined) fields } static public java.util.Enumeration elements(empcont1 cont000 ) { old enum_cur = new old( cont000 ); enum_cur.first(); return enum_cur; } public emp first() { // cursor specific (user-defined) fields start_2(); while ( obj != null && ) { adv_2(); } while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. age() > 40 ) break; adv_2(); } return obj; } public boolean more() { return obj != null; } public emp next() { // cursor specific (user-defined) fields adv_2(); while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. age() > 40 ) break; adv_2(); } return obj; } } // cursor specific (user-defined) fields ; Html ; final class all extends empcursor_1 { // cursor specific (user-defined) fields // cursor-specific generated fields public all (empcont1 cont000 ) { obj = null; cont = cont000; // cursor specific (user-defined) fields } static public java.util.Enumeration elements(empcont1 cont000 ) { all enum_cur = new all( cont000 ); enum_cur.first(); return enum_cur; } public emp first() { // cursor specific (user-defined) fields start_2(); while ( obj != null && ) { adv_2(); } while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( ) break; adv_2(); } return obj; } public boolean more() { return obj != null; } public emp next() { // cursor specific (user-defined) fields adv_2(); while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( ) break; adv_2(); } return obj; } } // cursor specific (user-defined) fields ; Html ; final class allname extends empcursor_1 { public int x; // cursor specific (user-defined) fields java.util.Vector vbuf_95; emp_1 [] buffer_95; int index_95; int asize_95; // cursor-specific generated fields public allname (empcont1 cont000, int x000 ) { obj = null; cont = cont000; x = x000; // cursor specific (user-defined) fields } static public java.util.Enumeration elements(empcont1 cont000, int x000 ) { allname enum_cur = new allname( cont000, x000 ); enum_cur.first(); return enum_cur; } public emp first() { // cursor specific (user-defined) fields vbuf_95 = new java.util.Vector( ); start_2(); while ( obj != null && ) { adv_2(); } while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. age() == x ) break; adv_2(); } while ( obj != null ){ vbuf_95.addElement( obj ); adv_2(); while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. age() == x ) break; adv_2(); } } asize_95 = vbuf_95.size( ); buffer_95 = new emp_1[asize_95 + 1]; vbuf_95.copyInto( buffer_95 ); /* * add an extra null element to the array so that the * code for nextMethod() could be as simple as possible */ buffer_95[asize_95] = null; /* sort the buffer if needed */ int incr = asize_95 / 2; while ( incr >= 1 ) { for ( int i = incr; i < asize_95; i++ ) { emp_1 tmp = buffer_95[i]; int j = i; while ( j >= incr && tmp. name().compareTo( buffer_95[j - incr]. name( )) <0 ) { buffer_95[j] = buffer_95[j - incr]; j-= incr; } buffer_95[j] = tmp; } incr /= 2; } /* return the first element */ obj = buffer_95[0]; index_95 = 1; return obj; } public boolean more() { return index_95 <= asize_95; } public emp next() { // cursor specific (user-defined) fields obj = buffer_95[index_95++]; return obj; } } // cursor specific (user-defined) fields ; Html ; final class allname1 extends empcursor_1 { // cursor specific (user-defined) fields // cursor-specific generated fields public allname1 (empcont1 cont000 ) { obj = null; cont = cont000; // cursor specific (user-defined) fields } static public java.util.Enumeration elements(empcont1 cont000 ) { allname1 enum_cur = new allname1( cont000 ); enum_cur.first(); return enum_cur; } public emp first() { // cursor specific (user-defined) fields start_2(); while ( obj != null && ) { adv_2(); } while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. name().compareTo( "Don")==0 ) break; adv_2(); } return obj; } public boolean more() { return obj != null; } public emp next() { // cursor specific (user-defined) fields adv_2(); while ( obj != null ) { if ( !( ) ) { obj = null; break; } if ( obj. name().compareTo( "Don")==0 ) break; adv_2(); } return obj; } } // cursor specific (user-defined) fields ;