/** * Returns the Torus in Z (two-dimensional topology group) that contains the object * * @param o - the object * @return the two-dimensional topology group formed by the Torus in Z that contains the object in * the three-dimensional topology group */ public Torus<E> TorusZ(Object o) { ProxyForGroup<E> tmp = null; try { tmp = new ProxyForGroup<E>(this.getTypeName()); } catch (ConstructionOfReifiedObjectFailedException e) { e.printStackTrace(); } int begining = this.getZ(this.indexOf(o)) * (this.getWidth() * this.getHeight()); for (int i = 0; i < (this.getWidth() * this.getHeight()); i++) { tmp.add(this.get(begining + i)); } Torus<E> result = null; try { result = new Torus<E>(tmp, this.getWidth(), this.getDepth()); } catch (ConstructionOfReifiedObjectFailedException e) { e.printStackTrace(); } return result; }
/** * Returns the Ring in depth (one-dimensional topology group) that contains the object * * @param o - the object * @return the one-dimensional topology group formed by the Ring in depth that contains the object * in the three-dimensional topology group */ public Ring<E> RingZ(Object o) { int position = this.indexOf(o); int posY = this.getY(position); ProxyForGroup<E> tmp = null; try { tmp = new ProxyForGroup<E>(this.getTypeName()); } catch (ConstructionOfReifiedObjectFailedException e) { e.printStackTrace(); } int begining = (posY * this.getWidth()) + posY; for (int i = 0; i < this.getDepth(); i++) { tmp.add(this.get(begining + (i * (this.getWidth() * this.getHeight())))); } Ring<E> result = null; try { result = new Ring<E>(tmp, this.getWidth()); } catch (ConstructionOfReifiedObjectFailedException e) { e.printStackTrace(); } return result; }