00001 package edu.stanford.hci.r3.units.coordinates;
00002
00003 import edu.stanford.hci.r3.units.PatternDots;
00004 import edu.stanford.hci.r3.units.Units;
00005
00023 public class BatchedPatternCoordinates extends Coordinates {
00024
00025 private int book;
00026
00027 private int page;
00028
00029 private int segment;
00030
00031 private int shelf;
00032
00037 public BatchedPatternCoordinates(int theSegment, int theShelf, int theBook, int thePage,
00038 PatternDots xCoord, PatternDots yCoord) {
00039 super(xCoord, yCoord);
00040 segment = theSegment;
00041 shelf = theShelf;
00042 book = theBook;
00043 page = thePage;
00044 }
00045
00046 public String getAddress() {
00047 return segment + "." + shelf + "." + book + "." + page;
00048 }
00049
00050 public int getBook() {
00051 return book;
00052 }
00053
00054 public int getPage() {
00055 return page;
00056 }
00057
00058 public int getSegment() {
00059 return segment;
00060 }
00061
00062 public int getShelf() {
00063 return shelf;
00064 }
00065
00069 public PatternDots getX() {
00070 return (PatternDots) x;
00071 }
00072
00076 public double getXVal() {
00077 return x.getValue();
00078 }
00079
00083 public PatternDots getY() {
00084 return (PatternDots) y;
00085 }
00086
00090 public double getYVal() {
00091 return y.getValue();
00092 }
00093
00097 public void setX(PatternDots xCoord) {
00098 x = xCoord;
00099 }
00100
00104 public void setX(Units xCoord) {
00105 if (xCoord instanceof PatternDots) {
00106 x = xCoord;
00107 } else {
00108 System.err.println("BatchedPatternCoordinates: Incorrect type passed to setX(). ["
00109 + xCoord.getClass() + "]");
00110 }
00111 }
00112
00116 public void setY(PatternDots yCoord) {
00117 y = yCoord;
00118 }
00119
00123 public void setY(Units yCoord) {
00124 if (yCoord instanceof PatternDots) {
00125 y = yCoord;
00126 } else {
00127 System.err.println("BatchedPatternCoordinates: Incorrect type passed to setY(). ["
00128 + yCoord.getClass() + "]");
00129 }
00130 }
00131
00135 public String toString() {
00136 return getAddress() + " [" + x + ", " + y + "]";
00137 }
00138 }