Ejemplo n.º 1
0
  public StateFrame(
      S initialState,
      Map<Set<Location>, Color> clusterColorMap,
      ClusteredGraph<Location, AccessibilityRelation> clusteredGraph,
      int tau) {
    Validate.notNull(initialState);
    JFrame frame = new JFrame();
    frame.setTitle("Cluster States");
    this.clusteredGraph = clusteredGraph;

    frame.getContentPane().setLayout(new GridLayout(clusteredGraph.getClusterCount(), 2));

    for (Cluster<Location> cluster : clusteredGraph.getClusters()) {
      ClusterCanvas clusterCanvas = new ClusterCanvas(clusterColorMap.get(cluster.getVertices()));
      clusterCanvas.setPreferredSize(new Dimension(100, 40));
      frame.getContentPane().add(clusterCanvas);
      VisitComponent label = new VisitComponent(tau);
      frame.getContentPane().add(label);
      visitationLabels.put(cluster, label);
    }

    setClusterVisitationStates(initialState);

    frame.pack();
    frame.setVisible(true);
  }
Ejemplo n.º 2
0
 public void setClusterVisitationStates(State state) {
   for (Cluster<Location> cluster : clusteredGraph.getClusters()) {
     visitationLabels.get(cluster).setVisitationTime(state.getLastVisitTime(cluster));
   }
 }