public int getChildCount(Object parent) { if (parent instanceof RootNode) { return this.commandHistory.getSessionCount(); } else if (parent instanceof Session) { Session session = (Session) parent; return session.commandCount(); } return -1; }
public Object getChild(Object parent, int index) { if (parent instanceof RootNode) { return this.commandHistory.getSession(this.commandHistory.getSessionCount() - 1 - index); } else if (parent instanceof Session) { Session session = (Session) parent; return session.getCommand(session.commandCount() - 1 - index); } return null; }
public int getIndexOfChild(Object parent, Object child) { if (parent instanceof RootNode) { return indexReverser( this.commandHistory.getSessionCount(), this.commandHistory.indexOfSession((Session) child)); } else if (parent instanceof Session) { Session session = (Session) parent; return indexReverser(session.commandCount(), session.indexOfCommand((String) child)); } return -1; }