Package exercise1.exercise1_15

Examples of exercise1.exercise1_15.Lookup


    System.out.println("State after s: "+s2);
    System.out.println("isFinal: "+s2.isFinal());
    Iterator<Lookup> lookupIter = gs.getLookups(s2);
    System.out.println("Have lookups: "+lookupIter.hasNext());
    while(lookupIter.hasNext()) {
      Lookup l = lookupIter.next();
      System.out.println("Have a lookup"+l);
    }
    File someFile = new File("tmp.gazbin");
    try {
      gs.save(someFile);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      assertTrue("could not save trie", false);
      return;
    }
    GazStoreTrie3 gs2 = new GazStoreTrie3();
    try {
      gs2 = (GazStoreTrie3)gs2.load(someFile);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      assertTrue("could not load trie",false);
      return;
    }
    State init_2 = gs2.getInitialState();
    System.out.println("Initial State: "+init_2);
    State s1_2 = init_2.next('a');
    System.out.println("State after a: "+s1_2);
    System.out.println("isFinal: "+s1_2.isFinal());
    State s2_2 = s1_2.next('s');
    System.out.println("State after s: "+s2_2);
    System.out.println("isFinal: "+s2_2.isFinal());
    Iterator<Lookup> lookupIter_2 = gs2.getLookups(s2_2);
    System.out.println("Have lookups: "+lookupIter_2.hasNext());
    while(lookupIter_2.hasNext()) {
      Lookup l = lookupIter_2.next();
      System.out.println("Have a lookup"+l);
    }
   
    System.out.println("************* end ********************");
 
View Full Code Here


    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.printf("%s%n", word);
    }
View Full Code Here

    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.println(word);
    }
View Full Code Here

TOP

Related Classes of exercise1.exercise1_15.Lookup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.