Use Java to implement the sequence table in the Data Structure
/*** APR 15,201 3 * copyright (c) jackwang * all rights reserve * @ author <a href = "mailto: wangchengjack@163.com"> jackwang </a> */package COM. example. list;/*** sequence table implementation * @ author administrator **/public class myseqlist {private object [] OBJ; // Storage Element with an initial length of 10 private int Len; // The length of the record sequence table is private final int maxsize = 10;/*** initialize the linear table */Public myseqlist () {This. OBJ = new object [10]; this. len = 0; this. clear ();}/*** judgment Whether the linear disconnection table is empty * @ return null returns true */Public Boolean isempty () {If (LEN = 0) {return true;} return false ;} /*** determine whether the linear table is full * @ return returns true */Public Boolean isfull () {If (LEN = maxsize) {return true;} return false ;} /*** return the length of the linear table * @ return the length of the linear table */Public int length () {return Len;}/*** clear the linear table */Public void clear () {for (INT I = 0; I <obj. length; I ++) {OBJ [I] = NULL ;}/ *** add element * @ Param I the script to add an element * @ Param O elements to be added */Public void insert (int I, object O) {if (I <1) {Throw new runtimeexception ("the script is not standard! ");} If (OBJ [I-1]! = NULL) {for (Int J = len-1; j> I; j --) {OBJ [J + 1] = OBJ [J];} OBJ [I] = O; len ++; return ;}else {OBJ [I-1] = O; Len ++; return ;}} /*** Delete element * @ Param I the index of the element to be deleted */Public void Delete (int I) {if (I> Len | I <1) {Throw new runtimeexception ("the script is not standard! ");} For (Int J = I; j <len-1; j ++) {OBJ [I-1] = OBJ [I];} OBJ [len-1] = NULL; len --;}/*** modify element * @ Param I the script of the element to be modified * @ Param newobj the value to be modified */Public void Update (int I, object newobj) {if (I> Len | I <1) {Throw new runtimeexception ("the script is not standard! ");} OBJ [I-1] = newobj ;} /*** search element ** @ Param o the element to be searched * @ return query index of the element */Public int find (Object O) {for (INT I = 0; I <obj. length; I ++) {If (O. equals (OBJ [I]) {return I + 1 ;}} return-1 ;} /*** index of the previous element of the current element */Public int previous (int I) {if (I> Len | I <1) {Throw new runtimeexception ("the script is not standard! ");} If (I = 1) {return Len;} return I-1 ;} /*** index of the last element of the current element */Public int next (int I) {if (I> Len | I <1) {Throw new runtimeexception ("the script is not standard! ");} If (I = Len) {return 1;} return I + 1;}/*** traverse the output linear table * @ return */Public void print () {for (INT I = 0; I <obj. length; I ++) {system. out. println (OBJ [I] + "");} system. out. println ();}/*** get the element of a specific script * @ Param I * @ return */public object get (int I) {if (I> Len | I <1) {Throw new runtimeexception ("the script is not standard! ");} Return OBJ [I-1];}