/** * Requires vn to point to a relation element. From there it iterates over all matches of the ap. * Puts an empty list for each referenced way. */ private List<Tuple2<WayRole, Long>> extractWayRefs(VTDNav vn, Hashtable<Long, List<Long>> ways) throws NavException, XPathEvalException { vn.push(); List<Tuple2<WayRole, Long>> refs = new ArrayList<>(); for (int j = MEMBER_WAY_PATH.evalXPath(); j != -1; j = MEMBER_WAY_PATH.evalXPath()) { long ref = Long.parseLong(vn.toString(vn.getAttrVal("ref"))); String roleAsString = vn.toString(vn.getAttrVal("role")).toLowerCase(); WayRole role; switch (roleAsString) { case "inner": role = WayRole.INNER; break; case "outer": role = WayRole.OUTER; break; default: continue; } refs.add(Tuple.tuple(role, ref)); ways.put(ref, Collections.emptyList()); } MEMBER_WAY_PATH.resetXPath(); vn.pop(); return refs; }
@Override public <U, I> Stream<Tuple3<U, I, Double>> read(InputStream in, Parser<U> up, Parser<I> ip) throws IOException { return new BufferedReader(new InputStreamReader(in)) .lines() .map( line -> { CharSequence[] tokens = split(line, '\t', 3); U user = up.parse(tokens[0]); I item = ip.parse(tokens[1]); return Tuple.tuple(user, item, 1.0); }); }