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

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


  /**
   * @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


  /**
   * @throws java.lang.Exception
   */
  @Before
  public void setUp() throws Exception {
    index = new DefaultIndexImpl();
  }
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

   * Test method for
   * {@link edu.luc.cs.laufer.cs313.occurences.DefaultToken#DefaultToken(java.lang.String, int)}.
   */
  @Test
  public void testDefaultToken() {
    new DefaultToken("abc", 5);
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs313.occurences.DefaultToken#DefaultToken(java.lang.String, int)}.
   */
  @Test
  public void testDefaultTokenNegative() {
    try {
      new DefaultToken("abc", -1);
      fail("expected failed assertion > 0");
    } catch (IllegalArgumentException e) {
    }
  }
View Full Code Here

   * {@link edu.luc.cs.laufer.cs313.occurences.DefaultToken#DefaultToken(java.lang.String, int)}.
   */
  @Test
  public void testDefaultTokenNull() {
    try {
      new DefaultToken(null, 77);
      fail("expected failed assertion != 0");
    } catch (IllegalArgumentException e) {
    }
  }
View Full Code Here

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

TOP

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

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.