static Vector parse(String str) throws ParseException {
  int state=START;
  int nameStartIndex=-1;
  Vector paths=new Vector();
  Vector names=new Vector();
  boolean root=false;
  for (int i=0, len=str.length(); i < len; i++) {
    char c=str.charAt(i);
switch (c) {
case ' ':
case '\r':
case '\n':
case '\t':
      if (state == IN_NAME) {
        names.addElement(makeName(str,nameStartIndex,i));
        state=AFTER_NAME;
      }
    break;
case '/':
switch (state) {
case IN_NAME:
    names.addElement(makeName(str,nameStartIndex,i));
  break;
case START:
root=true;
break;
case AFTER_SLASH:
throw new ParseException("unexpected_slash");
}
state=AFTER_SLASH;
break;
case '|':
switch (state) {
case START:
throw new ParseException("empty_path");
case AFTER_NAME:
break;
case AFTER_SLASH:
throw new ParseException("expected_name");
case IN_NAME:
names.addElement(makeName(str,nameStartIndex,i));
break;
}
paths.addElement(new Path(root,names));
root=false;
names=new Vector();
state=START;
break;
default :
switch (state) {
case AFTER_NAME:
throw new ParseException("expected_slash");
case AFTER_SLASH:
case START:
nameStartIndex=i;
state=IN_NAME;
break;
case IN_NAME:
break;
}
break;
}
}
switch (state) {
case START:
throw new ParseException("empty_path");
case AFTER_NAME:
break;
case AFTER_SLASH:
throw new ParseException("expected_name");
case IN_NAME:
names.addElement(makeName(str,nameStartIndex,str.length()));
break;
}
paths.addElement(new Path(root,names));
return paths;
}

static Vector parse ( String str ) throws ParseException { int state = START ; int nameStartIndex = - 1 ; Vector paths = new Vector ( ) ; Vector names = new Vector ( ) ; boolean root = false ; for ( int i = 0 , len = str . length ( ) ; i < len ; i ++ ) { char c = str . charAt ( i ) ; switch ( c ) { case ' ' : case '\r' : case '\n' : case '\t' : if ( state == IN_NAME ) { names . addElement ( makeName ( str , nameStartIndex , i ) ) ; state = AFTER_NAME ; } break ; case '/' : switch ( state ) { case IN_NAME : names . addElement ( makeName ( str , nameStartIndex , i ) ) ; break ; case START : root = true ; break ; case AFTER_SLASH : throw new ParseException ( "unexpected_slash" ) ; } state = AFTER_SLASH ; break ; case '|' : switch ( state ) { case START : throw new ParseException ( "empty_path" ) ; case AFTER_NAME : break ; case AFTER_SLASH : throw new ParseException ( "expected_name" ) ; case IN_NAME : names . addElement ( makeName ( str , nameStartIndex , i ) ) ; break ; } paths . addElement ( new Path ( root , names ) ) ; root = false ; names = new Vector ( ) ; state = START ; break ; default : switch ( state ) { case AFTER_NAME : throw new ParseException ( "expected_slash" ) ; case AFTER_SLASH : case START : nameStartIndex = i ; state = IN_NAME ; break ; case IN_NAME : break ; } break ; } } switch ( state ) { case START : throw new ParseException ( "empty_path" ) ; case AFTER_NAME : break ; case AFTER_SLASH : throw new ParseException ( "expected_name" ) ; case IN_NAME : names . addElement ( makeName ( str , nameStartIndex , str . length ( ) ) ) ; break ; } paths . addElement ( new Path ( root , names ) ) ; return paths ; }
gets the list of path from the path string . the path string can represent more paths separated by | .
