package edu.mit.csail.uid;

public class Pattern {
   String imgURL = null;
   float similarity = 0.7f;

   int dx=0, dy=0;

   public Pattern(){ }
   public Pattern(Pattern p){
      imgURL = p.imgURL;
      similarity = p.similarity;
   }

   public Pattern(String imgURL_){
      imgURL = imgURL_;
   }

   public Pattern similar(float similarity_){
      Pattern ret = new Pattern(this);
      ret.similarity = similarity_;
      return ret;
   }

   public Pattern exact(){
      Pattern ret = new Pattern(this);
      ret.similarity = 1.0f;
      return ret;
   }

   public Pattern targetOffset(int dx_, int dy_){
      Pattern ret = new Pattern(this);
      ret.dx = dx_;
      ret.dy = dy_;
      return ret;
   }

   public String toString(){
     String ret = "Pattern(\"" + imgURL + "\")";
     ret += ".similar(" + similarity +")";
     if(dx!=0 || dy!=0)
        ret += ".targetOffset(" + dx + "," + dy +")";
     return ret;
   }

   Location getTargetOffset(){
      return new Location(dx, dy);
   }

}


@@ -942,16 +942,23 @@
   %7D%0A%0A   
+public 
 Location
@@ -1018,11 +1018,70 @@
 ;%0A   %7D%0A%0A
+   public String getFilename()%7B%0A      return imgURL;%0A   %7D%0A%0A
 %7D%0A%0A

add Pattern.getFilename()