/* implmentation of listint.java. Server initially creates and registers 2 objects, but more can be made with the makenew function. */ import java.rmi.*; import java.rmi.server.*; public class list extends UnicastRemoteObject implements listint { public icell front = null; public int y = 1; // for testing public int gety() { return y; } public void sety(int x) { y=x; } public list() throws RemoteException { super(); } public boolean empty() { return front==null; } public int length() { int ax = 0; for(icell i = front; i!=null; i=i.tail) ax++; return ax; } // length public void push(int x) { front = new icell(x,front); } public icell pop() { icell temp = front; if (temp==null) return null; else { front = front.tail; return temp; } // else } public void change(listint l) { try { l.sety(8); } catch (RemoteException er) { er.printStackTrace(); } } public listint makenew(String name) { list newlist = null; try { newlist = new list(); Naming.rebind(name,newlist); } catch (Exception ee) {ee.printStackTrace();} return newlist; } public static void main(String[] args) { try { list l, m; l = new list(); m = new list(); Naming.rebind("l",l); Naming.rebind("m",m); } catch (Exception eee) {eee.printStackTrace();} } // main } // list