class TLD {

    public static Key getNextParentKey(Key docKey) {
        Text startCF = docKey.getColumnFamily();
        if (startCF.find(NULL) != -1) {
            // we have a start key with a document uid, add to the end of the cf to ensure we go to the next doc
            // parse out the uid
            String cf = startCF.toString();
            int index = cf.indexOf('\0');
            if (index >= 0) {
                String uid = cf.substring(index + 1);
                int index2 = uid.indexOf('\0');
                if (index2 >= 0) {
                    uid = uid.substring(0, index2);
                }
                // if we do not have an empty uid
                if (!uid.isEmpty()) {
                    uid = TLD.parseRootPointerFromId(uid);
                    // to get to the next doc, add the separator for the UID 'extra' (child doc) portion and then the max unicode string
                    Text nextDoc = new Text(cf.substring(0, index) + NULL + uid + DEFAULT_SEPARATOR + MAX_UNICODE_STRING);
                    docKey = new Key(docKey.getRow(), nextDoc, docKey.getColumnQualifier(), docKey.getColumnVisibility(), docKey.getTimestamp());
                }
            }
        }
        return docKey;
    }

    private  TLD();

}