Example #1
0
  public Object clone() throws CloneNotSupportedException {

    Notebook clone = (Notebook) super.clone();
    clone.height = this.height; // this.height.clone();
    clone.width = this.width;
    clone.weight = this.weight;
    return clone;
  }
  public static void testExpr() {
    Notebook notebook = new Notebook();

    // should match
    notebook.storeNote("foobar");
    notebook.storeNote("foo bar");
    notebook.storeNote("football-bar");
    notebook.storeNote("a football-bartender");

    // should not match
    notebook.storeNote("barefoot");
    notebook.storeNote("handbags carrots cheese");

    notebook.removeNote("foo*bar");

    notebook.listNotes();
  }
  /** Test the class (debugging) */
  public static void test() {
    Notebook notebook = new Notebook();

    notebook.storeNote("cancelled :(");
    notebook.storeNote("did stuff");
    notebook.storeNote("cancelled :I");
    notebook.storeNote("did more stuff");
    notebook.storeNote("didn't do much");
    notebook.storeNote("cancelled :)");
    notebook.storeNote("stuff again...");
    notebook.storeNote("aaaand... cancelled :D");
    notebook.storeNote("arc");
    notebook.storeNote("abc");
    notebook.storeNote("a cup");

    notebook.removeNote("??????");

    notebook.removeNote("diddelidoo");

    notebook.listNotes();
  }