Changeset 23 for trunk/EventBenchCore/src/de
- Timestamp:
- 04/14/11 13:22:26 (14 years ago)
- Location:
- trunk/EventBenchCore/src/de/ugoe/cs/eventbench
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/data/Event.java
r16 r23 52 52 } else { 53 53 return type.equals(otherEvent.type) 54 && target==otherEvent.target;54 && otherEvent.target==null; 55 55 } 56 56 } else { … … 72 72 if (targetShort!=null) { 73 73 shortId = targetShort+"."+getType(); 74 if ( idInfo!="") {74 if ( !"".equals(idInfo)) { 75 75 shortId += "."+idInfo; 76 76 } … … 87 87 } 88 88 id += getType(); 89 if ( idInfo!="") {89 if ( !"".equals(idInfo) ) { 90 90 id += "." + idInfo; 91 91 } -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java
r19 r23 1 1 package de.ugoe.cs.eventbench.models; 2 2 3 import java.awt.Dimension;4 import java.awt.Rectangle;5 import java.awt.Shape;6 3 import java.util.LinkedHashSet; 7 4 import java.util.LinkedList; … … 9 6 import java.util.Set; 10 7 11 import javax.swing.JFrame;12 13 import org.apache.commons.collections15.Transformer;14 15 16 import edu.uci.ics.jung.algorithms.layout.Layout;17 import edu.uci.ics.jung.algorithms.layout.TreeLayout;18 8 import edu.uci.ics.jung.graph.DelegateTree; 19 9 import edu.uci.ics.jung.graph.Tree; 20 import edu.uci.ics.jung.visualization.BasicVisualizationServer;21 import edu.uci.ics.jung.visualization.decorators.ToStringLabeller;22 import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position;23 10 24 11 public class Trie<T> { … … 155 142 } 156 143 157 pr ivateTree<TrieVertex, Edge> getGraph() {144 protected Tree<TrieVertex, Edge> getGraph() { 158 145 DelegateTree<TrieVertex, Edge> graph = new DelegateTree<TrieVertex, Edge>(); 159 146 rootNode.getGraph(null, graph); 160 147 return graph; 161 }162 163 public void display() {164 Tree<TrieVertex, Edge> graph = this.getGraph();165 Layout<TrieVertex, Edge> layout = new TreeLayout<TrieVertex, Edge>(graph, 60);166 // The BasicVisualizationServer<V,E> is parameterized by the edge types167 BasicVisualizationServer<TrieVertex,Edge> vv =168 new BasicVisualizationServer<TrieVertex,Edge>(layout);169 vv.setPreferredSize(new Dimension(1100,850)); //Sets the viewing area size170 171 172 final Rectangle rect = new Rectangle(40, 20);173 174 Transformer<TrieVertex, Shape> vertexShapeTransformer =175 new Transformer<TrieVertex, Shape>() {176 public Shape transform(TrieVertex s) {177 return rect;178 }179 };180 vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);181 vv.getRenderContext().setVertexShapeTransformer(vertexShapeTransformer);182 vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<TrieVertex>());183 184 JFrame frame = new JFrame("Trie");185 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);186 frame.getContentPane().add(vv);187 frame.pack();188 frame.setVisible(true);189 148 } 190 149 -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java
r19 r23 6 6 7 7 import de.ugoe.cs.eventbench.data.Event; 8 import de.ugoe.cs.eventbench.models.Trie.Edge; 9 import de.ugoe.cs.eventbench.models.Trie.TrieVertex; 10 import edu.uci.ics.jung.graph.Tree; 8 11 9 12 public abstract class TrieBasedModel implements IStochasticProcess { … … 69 72 return sequence; 70 73 } 74 75 public Tree<TrieVertex, Edge> getTrieGraph() { 76 return trie.getGraph(); 77 } 71 78 72 79 @Override
Note: See TracChangeset
for help on using the changeset viewer.