Пример #1
0
  protected void initialiseStateMap() {
    Stg stg = getUnderlyingStg();
    HashMap<String, SignalData> newStateMap = new HashMap<>();
    LinkedList<String> allSignals = new LinkedList<>();
    for (Type type : Type.values()) {
      Set<String> typedSignals = stg.getSignalReferences(type);
      allSignals.addAll(typedSignals);
      for (String signal : typedSignals) {
        SignalData signalData = new SignalData(signal, type);
        signalData.copy(signalDataMap.get(signal));
        signalData.visible = type != Type.INTERNAL;
        newStateMap.put(signal, signalData);
      }
    }
    signalDataMap = newStateMap;

    signals.retainAll(allSignals);
    allSignals.removeAll(signals);
    signals.addAll(allSignals);
    updateSignalState();
  }
Пример #2
0
 private LinkedList<Pair<String, Color>> getOrderedTraceSignals(Stg stg, Trace trace) {
   LinkedList<Pair<String, Color>> result = new LinkedList<>();
   HashSet<String> traceSignals = new HashSet<>();
   for (String transitionRef : trace) {
     Node node = stg.getNodeByReference(transitionRef);
     if (node instanceof SignalTransition) {
       SignalTransition transition = (SignalTransition) node;
       String signalRef = stg.getSignalReference(transition);
       traceSignals.add(signalRef);
     }
   }
   for (String signalRef : signals) {
     if (traceSignals.contains(signalRef)) {
       SignalData signalData = signalDataMap.get(signalRef);
       if ((signalData != null) && signalData.visible) {
         result.add(new Pair<String, Color>(signalData.name, signalData.color));
       }
     }
   }
   return result;
 }