/** * <code>getStartEndIntervals</code> use startVariable for every token + the endVariable for the * last one if a slot is empty, and has no tokens, use the endVariable from the previous slot * * @param view - <code>VizView</code> - * @param slot - <code>PwSlot</code> - * @param previousToken - <code>PwToken</code> - * @param isLastSlot - <code>boolean</code> - * @return - <code>PwDomain[]</code> - */ public static PwDomain[] getStartEndIntervals( VizView view, PwSlot slot, PwToken previousToken, boolean isLastSlot, boolean alwaysReturnEnd) { PwDomain[] intervalArray = new PwDomain[2]; PwDomain startIntervalDomain = null; PwDomain endIntervalDomain = null; PwVariable intervalVariable = null, lastIntervalVariable = null; PwToken baseToken = slot.getBaseToken(); PwDomain intervalDomain = null, lastIntervalDomain = null; if (baseToken == null) { // empty slot if ((previousToken == null) || // first slot (isLastSlot == true)) { // last slot intervalArray[0] = null; intervalArray[1] = null; return intervalArray; } else { // empty slot between filled slots intervalVariable = previousToken.getEndVariable(); } } else if (isLastSlot || alwaysReturnEnd) { intervalVariable = baseToken.getStartVariable(); lastIntervalVariable = baseToken.getEndVariable(); } else { intervalVariable = baseToken.getStartVariable(); } if (intervalVariable == null) { startIntervalDomain = intervalDomain; } else { startIntervalDomain = intervalVariable.getDomain(); } // System.err.println( "startIntervalDomain " + startIntervalDomain.toString()); if ((lastIntervalVariable != null) || (lastIntervalDomain != null)) { if (lastIntervalVariable == null) { endIntervalDomain = lastIntervalDomain; } else { endIntervalDomain = lastIntervalVariable.getDomain(); } // System.err.println( "endIntervalDomain " + endIntervalDomain.toString()); } if (alwaysReturnEnd && (endIntervalDomain == null)) { endIntervalDomain = startIntervalDomain; } intervalArray[0] = startIntervalDomain; intervalArray[1] = endIntervalDomain; return intervalArray; } // end getStartEndIntervals
/** * <code>addTokenNavNode</code> * * @param token - <code>PwToken</code> - * @return - <code>TokenNavNode</code> - */ protected final TokenNavNode addTokenNavNode(final PwToken token) { // TokenNetwork.TokenNode TemporalExtent.TemporalNode // System.err.println( "addTokenNavNode id " + token.getId() + " " + token.getClass()); boolean isDraggable = true; TokenNavNode tokenNavNode = (TokenNavNode) entityNavNodeMap.get(token.getId()); if (tokenNavNode == null) { tokenNavNode = new TokenNavNode( token, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), NavNodeGenerics.getTokenColor(token, this), isDraggable, this); entityNavNodeMap.put(token.getId(), tokenNavNode); jGoDocument.addObjectAtTail(tokenNavNode); } return tokenNavNode; } // end addTokenNavNode