1 4 package org.objectweb.proactive.core.group.topology; 5 6 import org.objectweb.proactive.core.group.Group; 7 import org.objectweb.proactive.core.mop.ConstructionOfReifiedObjectFailedException; 8 9 10 15 public class Line extends TopologyGroup { 17 18 protected int width; 19 20 26 public Line(Group g, int size) 27 throws ConstructionOfReifiedObjectFailedException { 28 super(g, size); 29 this.width = size; 30 } 31 32 36 public int getWidth() { 37 return this.width; 38 } 39 40 45 public int getX(Object o) { 46 return this.indexOf(o); 47 } 48 49 54 public Object left(Object o) { 55 int position = this.indexOf(o); 56 if (position != 0) { 57 return this.get(position - 1); 58 } else { 59 return null; 60 } 61 } 62 63 68 public Object right(Object o) { 69 int position = this.indexOf(o); 70 if (position != this.getWidth()) { 71 return this.get(position + 1); 72 } else { 73 return null; 74 } 75 } 76 } 77 | Popular Tags |