00001 package edu.stanford.hci.r3.pattern.coordinates;
00002
00003 import edu.stanford.hci.r3.paper.Region;
00004 import edu.stanford.hci.r3.units.Units;
00005
00018 public class RegionID {
00019
00020 private Units height;
00021
00022 private String name;
00023
00024 private Units originX;
00025
00026 private Units originY;
00027
00028 private Units width;
00029
00030 public RegionID(Region r) {
00031 name = r.getName();
00032 originX = r.getOriginX();
00033 originY = r.getOriginY();
00034 width = r.getWidth();
00035 height = r.getHeight();
00036 }
00037
00043 public boolean equals(Object o) {
00044 if (o instanceof RegionID) {
00045 RegionID r = (RegionID) o;
00046 return name.equals(r.name) && originX.equals(r.originX) && originY.equals(r.originY)
00047 && width.equals(r.width) && height.equals(r.height);
00048 }
00049 return false;
00050 }
00051
00059 public int hashCode() {
00060 return (int) (name.hashCode() + originX.getValue() + originY.getValue() + width.getValue() + height
00061 .getValue());
00062 }
00063
00067 public String toString() {
00068 return "Region ID: {" + name + ", " + originX + ", " + originY + ", " + width + ", " + height + "}";
00069 }
00070 }