Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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;
 }