protected Vector /* of Object */ queryAssertionLines1(String query) throws IOException { write(query); Vector v = readlines(); Vector r = new Vector(); for (Enumeration e = v.elements(); e.hasMoreElements(); ) { r.addElement(TT.stringToObject((String) e.nextElement())); } return r; }
protected Vector /* of String */ readlines() throws IOException { Vector r = new Vector(); while (true) { String s = in.readLine(); if (DEBUG) dbg("FROM TT: <" + s + ">"); if (s.equals(".")) break; if (s.startsWith("error:")) break; r.addElement(s); } return r; }
protected static Vector /* of String */ stringToVector(String s, String delim) { Vector r = new Vector(); int fromIndex = 0, len = s.length(); ResultChar rc = new ResultChar(); while (fromIndex < len) { rc.ch = 0; int i = indexOfAny(s, delim, fromIndex, rc); if (i == -1) { r.addElement(s.substring(fromIndex, len)); break; } r.addElement(s.substring(fromIndex, i)); /* Skip different delimiters. */ i++; for (; i < len; i++) { if (s.charAt(i) == rc.ch || -1 == delim.indexOf(s.charAt(i))) break; } fromIndex = i; } return r; }
protected Vector /* of TTPNode */ queryPNodes1(String query) throws IOException { write(query); Vector lines = readlines(); Vector r = new Vector(); for (Enumeration e = lines.elements(); e.hasMoreElements(); ) { Vector line = stringToVector((String) e.nextElement(), ":"); TTLexEntry le = new TTLexEntry(); le.citationForm = (String) line.elementAt(0); le.features = (String) line.elementAt(1); le.inflection = (String) line.elementAt(2); le.inflFeatures = (String) line.elementAt(3); TTLexEntryToObj leo = new TTLexEntryToObj(); leo.lexentry = le; leo.objname = (String) line.elementAt(4); leo.features = (String) line.elementAt(5); TTPNode pn = new TTPNode(); pn.feature = TT.featureGet(le.features, TT.FT_POS, TT.F_NULL); pn.leo = leo; pn.startpos = TT.longParse((String) line.elementAt(8), true); pn.endpos = TT.longParse((String) line.elementAt(9), true); r.addElement(pn); } return r; }
protected Vector /* of TTLexEntryToObj */ queryLeos1(String query) throws IOException { write(query); Vector lines = readlines(); Vector r = new Vector(); for (Enumeration e = lines.elements(); e.hasMoreElements(); ) { Vector line = stringToVector((String) e.nextElement(), ":"); TTLexEntry le = new TTLexEntry(); le.citationForm = (String) line.elementAt(0); le.features = (String) line.elementAt(1); le.inflection = (String) line.elementAt(2); le.inflFeatures = (String) line.elementAt(3); TTLexEntryToObj leo = new TTLexEntryToObj(); leo.lexentry = le; leo.objname = (String) line.elementAt(4); leo.features = (String) line.elementAt(5); r.addElement(leo); } return r; }