Package edu.luc.cs.laufer.cs313.occurences

Examples of edu.luc.cs.laufer.cs313.occurences.Constants


   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.DefaultToken#getWord()}.
   */
  @Test
  public void testGetLine() {
    Token token = new DefaultToken("abc", 5);
    assertEquals(5, token.getLine());
  }
View Full Code Here


  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {

    Index index = new DefaultIndexImpl();

    String in = "politics without without principle\npleasure without conscience";
    StreamTokenizer s = new StreamTokenizer(new StringReader(in));
    s.ordinaryChar('.');

    int token;
    while ((token = s.nextToken()) != StreamTokenizer.TT_EOF) {
      if (token == StreamTokenizer.TT_WORD) {
        index.add(s.sval, s.lineno());
      }
    }

    System.out.println(index);
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs473.index.DefaultIndexImpl#add(java.lang.String, int)}.
   */
  @Test
  public void testMultipleInstances() throws Exception {
    index.clear();
    Index index2 = index.getClass().newInstance();
    index.add("abc", 1);
    index.add("abc", 2);
    index.add("xyz", 3);
    index.add("xyz", 4);
    index2.add("uvw", 1);
    index2.add("uvw", 2);
    assertEquals(2, index.size());
    assertEquals(1, index2.size());
    assertTrue(index.containsKey("abc"));
    assertTrue(index.containsKey("xyz"));
    assertTrue(index2.containsKey("uvw"));
    assertFalse(index2.containsKey("abc"));
    assertFalse(index2.containsKey("xyz"));
    assertFalse(index.containsKey("uvw"));
  }
View Full Code Here

   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.StreamTokenizerIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild() {
    Index index = new DefaultIndexImpl();
    StreamTokenizerIndexBuilder builder = new StreamTokenizerIndexBuilder(index);
    builder.buildFrom(new StreamTokenizer(new StringReader(s7)));
    assertEquals(s7index, index);
  }
View Full Code Here

   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.StreamTokenizerIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild2() {
    Index index = new DefaultIndexImpl();
    StreamTokenizerIndexBuilder builder = new StreamTokenizerIndexBuilder(index);
    builder.buildFrom(new StreamTokenizer(new StringReader(s8)));
    assertEquals(s8index, index);
  }
View Full Code Here

   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.TokenIteratorIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild() throws Exception {
    Index index = new DefaultIndexImpl();
    TokenIteratorIndexBuilder builder = new TokenIteratorIndexBuilder(index);
    builder.buildFrom(stringToList(s7).iterator());
    assertEquals(s7index, index);
  }
View Full Code Here

   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.TokenIteratorIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild2() throws Exception {
    Index index = new DefaultIndexImpl();
    TokenIteratorIndexBuilder builder = new TokenIteratorIndexBuilder(index);
    builder.buildFrom(stringToList(s8).iterator());
    assertEquals(s8index, index);
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs313.occurences.StreamTokenizerIndexBuilder#StreamTokenizerIndexBuilder(java.io.StreamTokenizer)}.
   */
  @Test
  public void testStreamTokenizerIndexBuilder() {
    try {
      new StreamTokenizerIndexBuilder(null);
      fail("expected assertion != null");
    } catch (IllegalArgumentException e) {
    }
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs313.occurences.StreamTokenizerIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild() {
    Index index = new DefaultIndexImpl();
    StreamTokenizerIndexBuilder builder = new StreamTokenizerIndexBuilder(index);
    builder.buildFrom(new StreamTokenizer(new StringReader(s7)));
    assertEquals(s7index, index);
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs313.occurences.StreamTokenizerIndexBuilder#build(edu.luc.cs.laufer.cs313.occurences.Index)}.
   */
  @Test
  public void testBuild2() {
    Index index = new DefaultIndexImpl();
    StreamTokenizerIndexBuilder builder = new StreamTokenizerIndexBuilder(index);
    builder.buildFrom(new StreamTokenizer(new StringReader(s8)));
    assertEquals(s8index, index);
  }
View Full Code Here

TOP

Related Classes of edu.luc.cs.laufer.cs313.occurences.Constants

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.