KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > identity > assignment > TermTokenizer


1 package org.jbpm.identity.assignment;
2
3 /**
4  * chops an actor assignment expression into terms.
5  */

6 public class TermTokenizer {
7
8   private String JavaDoc expression = null;
9   private int index = 0;
10   
11   public TermTokenizer(String JavaDoc expression) {
12     this.expression = expression;
13   }
14
15   public boolean hasMoreTerms() {
16     return (index!=-1);
17   }
18   
19   public String JavaDoc nextTerm() {
20     String JavaDoc term = null;
21     int startIndex = index;
22     index = expression.indexOf("-->", index);
23     if (index!=-1) {
24       term = expression.substring(startIndex, index).trim();
25       index+=3;
26     } else {
27       term = expression.substring(startIndex).trim();
28     }
29     return term;
30   }
31 }
32
Popular Tags