MyList.java
package com.classes;
import java.io.IOException;
final public class MyList<T> extends MyArrayInterface<T>
{
private Object[] ojValue = null;
private int USELength =0 ;
public MyList()
{
this(2);
}
public MyList(int __longth__)
{
ojValue = new Object[__longth__];
// for(Object _o : ojValue)
// {
// _o = new Object();
// }
}
public void insert(int indEx,T value) throws IOException
{
this.__TS__add(indEx, value);
}
private void __TS__add(int _wz,T _o) throws IOException
{
if((_wz >this.USELength&&_wz<this.ojValue.length)||(_wz>this.ojValue.length))
{
//System.err.println("=================forbid to do this=================");
}
else if(_wz == this.USELength)
{
this.ojValue[_wz] = _o;
}
else
{
System.out.println("tr0");
Object _ob = this.ojValue[_wz];
this.ojValue[_wz] = _o;
for(int i = this.USELength;i>_wz;i--)
{
this.__move__inClass__private(i);
}
this.ojValue[_wz+1] = _ob;
this.USELength +=1;
}
}
private void __move__inClass__private(int __x__)
{
if(__x__<this.ojValue.length)
{
this.ojValue[__x__] = this.ojValue[__x__ - 1];
}
else
{
this.__add__inCLASS__private();
this.ojValue[__x__] = this.ojValue[__x__ - 1];
}
}
private void __add__inCLASS__private()
{
Object[] _ls___ = new Object[USELength+5];
System.arraycopy(ojValue, 0, _ls___, 0, USELength);
this.ojValue = _ls___;
//System.out.println("use the up");
}
public void push_back(T __value__)
{
if(this.USELength<this.ojValue.length)
{
this.__push_BACK__inCLASS__private(__value__);
}
else
{
this.__add__inCLASS__private();
this.__push_BACK__inCLASS__private(__value__);
//System.out.println("use the copy");
}
}
final private void __push_BACK__inCLASS__private(T __value__)
{
this.ojValue[this.USELength] = __value__;
this.USELength +=1;
}
public void pop()
{
this.ojValue[this.USELength] = null;
this.USELength -=1;
}
public void change(int _x,T _o)
{
if(_x<this.USELength)
{
this.ojValue[_x] = _o;
}
else
{
//System.err.println("=================changeERROR=============");
}
}
public void changeEachother(int _x ,int x_)
{
Object _OC = null;
if(_x<this.USELength&&x_<this.USELength)
{
_OC = this.ojValue[_x];
this.ojValue[_x] = this.ojValue[x_];
this.ojValue[x_] = _OC;
}
else
{
//System.err.println("=================changeEachotherERROR=================");
}
}
public T find(int _x) throws IOException
{
if(_x>=this.USELength)
{
throw new IOException();
}
return (T)(this.ojValue[_x]);
}
public int getLength()
{
return this.USELength;
}
public String toString()
{
String _sUsingLedthIndexOverRideIng = new String();
for(int i =0;i<this.USELength;i++)
{
_sUsingLedthIndexOverRideIng +=this.ojValue[i].toString()+",";
}
return _sUsingLedthIndexOverRideIng;
}
}
MyArrayabs.JAVA
package com.classes;
import java.io.IOException;
public abstract class MyArrayInterface<T> implements interArrayFace<T>
{
//public abstract void add(int _wz,T _o) throws IOException;
public abstract void push_back(T __value__);
public abstract void pop();
public abstract T find(int _x) throws IOException;
public abstract int getLength();
public void run(int longs)
{
try
{
Thread.sleep(longs);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
interArrayFace.java
package com.classes;
public interface interArrayFace<T>
{
public abstract void push_back(T __value__);
public abstract void pop();
public abstract int getLength();
}