StreamedPatternCoordinates.java

00001 package edu.stanford.hci.r3.units.coordinates;
00002 
00003 import edu.stanford.hci.r3.pen.PenSample;
00004 import edu.stanford.hci.r3.units.PatternDots;
00005 import edu.stanford.hci.r3.units.Units;
00006 
00020 public class StreamedPatternCoordinates extends Coordinates {
00021 
00026         public StreamedPatternCoordinates(PatternDots xCoord, PatternDots yCoord) {
00027                 super(xCoord, yCoord);
00028         }
00029 
00035         public StreamedPatternCoordinates(PenSample sample) {
00036                 this(new PatternDots(sample.getX()), new PatternDots(sample.getY()));
00037         }
00038 
00042         public PatternDots getX() {
00043                 return (PatternDots) x;
00044         }
00045 
00049         public double getXVal() {
00050                 return x.getValue();
00051         }
00052 
00056         public PatternDots getY() {
00057                 return (PatternDots) y;
00058         }
00059 
00063         public double getYVal() {
00064                 return y.getValue();
00065         }
00066 
00070         public void setX(PatternDots xCoord) {
00071                 x = xCoord;
00072         }
00073 
00077         public void setX(Units xCoord) {
00078                 if (xCoord instanceof PatternDots) {
00079                         x = xCoord;
00080                 } else {
00081                         System.err.println("StreamedPatternCoordinates: Incorrect type passed to setX(). ["
00082                                         + xCoord.getClass() + "]");
00083                 }
00084         }
00085 
00089         public void setY(PatternDots yCoord) {
00090                 y = yCoord;
00091         }
00092 
00096         public void setY(Units yCoord) {
00097                 if (yCoord instanceof PatternDots) {
00098                         y = yCoord;
00099                 } else {
00100                         System.err.println("StreamedPatternCoordinates: Incorrect type passed to setY(). ["
00101                                         + yCoord.getClass() + "]");
00102                 }
00103         }
00104 
00108         public String toString() {
00109                 return "[" + x + ", " + y + "]";
00110         }
00111 }

Generated on Sat Apr 14 18:21:38 2007 for R3 Paper Toolkit by  doxygen 1.4.7