@Override public boolean picksplit( HSPLeafNode<WritableString, R> leaf, int level, ArrayList<ArrayList<Pair<WritableString, R>>> childrenData, ArrayList<Predicate> childrenPredicates) { if (level == 1) { initializePredicates(childrenPredicates); for (Pair<WritableString, R> p : leaf.getKeyRecords()) { WritableString str = p.getFirst(); int idx = charToInt(str.getString().charAt(0)); childrenData.get(idx).add(p); } for (int i = 0; i < childrenData.size(); i++) { if (childrenData.get(i).size() > 1) { return true; } } return false; } WritableChar predic = (WritableChar) leaf.getPredicate(); if (predic == null) return false; initializePredicates(childrenPredicates); for (Pair<WritableString, R> p : leaf.getKeyRecords()) { WritableString str = p.getFirst(); int idx = charToInt(str.getString().charAt(level - 1)); childrenData.get(idx).add(p); } for (int i = 0; i < childrenData.size(); i++) { if (childrenData.get(i).size() > 1) { return true; } } return false; }
@Override public boolean consistent(HSPNode<WritableString, R> e, WritableString q, int level) { if (((WritableChar) (e.getPredicate())).getChar() == q.getString().charAt(level - 1)) return true; if (((WritableChar) (e.getPredicate())).getChar() == '-' && level >= q.getString().length()) return true; return false; }
@Override public WritableChar determinePredicate(WritableString key, Predicate parentPred, int level) { char c = key.getString().charAt(level - 1); return new WritableChar(c); }