public static Collection<Graph> getGraphsByType(String type, Browser browser) { Collection<Graph> result = new Vector<>(); for (Graph g : browser.getGraphs()) { if (g.getType().equals(type)) { result.add(g); } } return result; }
public static Graph getGraphByName(String name, Browser browser) { for (Graph g : browser.getGraphs()) { if (g.getName().equals(name)) { return g; } } return null; }
public Vector<GraphRelationship> getAllRelationships(){ HashSet<GraphRelationship> result=new HashSet<GraphRelationship>(); Graph[] g=null; g = browser.getGraphs(); for (int k=0;k<g.length;k++){ HashSet rel=this.getRelationshipsFromAGraph(((GraphImp)g[k]).getGraph()); result.addAll(rel); } return new Vector<GraphRelationship>(result); }
/** * Generates the main report body * *@return A stringbuffer with the report *@exception Exception Sth. went wrong */ private StringBuffer generateReport() throws Exception { Graph[] gs = browser.getGraphs(); StringBuffer result = new StringBuffer(); Hashtable stats=new Hashtable(); for (int k = 0; k < gs.length; k++) { Graph g = gs[k]; this.generateADiagramReport(stats,g); } Object[] keys=new Vector(stats.keySet()).toArray(); Arrays.sort(keys); StringBuffer report=new StringBuffer(); for (int k=0;k<keys.length;k++){ String key=keys[k].toString(); report.append(key); for (int l=0;l<40-key.length();l++) report.append(" "); report.append(":"+stats.get(key)+"\n"); } return report; }
public Vector getAllRelationships(String relType){ HashSet<GraphRelationship> result=new HashSet<GraphRelationship>(); Graph[] g=null; g = browser.getGraphs(); for (int k=0;k<g.length;k++){ HashSet<GraphRelationship> rel=this.getRelationshipsFromAGraph(((GraphImp)g[k]).getGraph()); for (GraphRelationship gr:rel){ if (gr.getType().equalsIgnoreCase(relType)) result.add(gr); } } return new Vector<GraphRelationship>(result); }
/** * Description of the Method * *@param args Description of Parameter *@exception Exception Description of Exception */ public static void main(String args[]) throws Exception { String file = args[0]; Browser b = new BrowserImp(file); Graph[] gs = b.getGraphs(); for (int k = 0; k < gs.length; k++) { System.err.println(gs[k].getType() + ":" + gs[k].getName()); } }
/** * It obtains all entities in the specification whose type represented as * string is the same as the string passed as parameter * * @param type The type the application is looking for * @return * @throws NotInitialised */ public static GraphEntity[] generateEntitiesOfType(String type, Browser browser) throws NotInitialised { Graph[] gs = browser.getGraphs(); Sequences p = new Sequences(); GraphEntity[] ges = browser.getAllEntities(); HashSet actors = new HashSet(); for (int k = 0; k < ges.length; k++) { if (ges[k].getType().equals(type)) { actors.add(ges[k]); } } return toGEArray(actors.toArray()); }
public void actionPerformed(ActionEvent e) { if (dmtn.getUserObject()instanceof Entity){ Entity ent=(Entity)dmtn.getUserObject(); StringBuffer result=new StringBuffer(); result.append("Diagrams found:<ul>"); Graph[] graphs=browser.getGraphs(); for (int k=0;k<graphs.length;k++){ GraphEntity[] ges; try { ges = graphs[k].getEntities(); boolean found=false; for (int j=0;j<ges.length &&!found;j++){ found=ges[j].getID().equals(ent.getId()); } if (found){ result.append("<li><a href=\"http://app/"+graphs[k].getName()+"/"+ent.getId()+"\">"+graphs[k].getName()+"</a>"); } } catch (NullEntity e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } result.append("</ul>"); resources.getSearchDiagramPanel().setText(result.toString()); resources.focusSearchPane(); } } });
if (userobject.size()==0){ userobject=new Vector(); Graph[] graphs=browser.getGraphs(); for (int k=0;k<graphs.length;k++){
private void generateIndex(Sequences p) throws Exception { Graph[] gs = browser.getGraphs();
Graph[] gs = browser.getGraphs(); float increment=25f/gs.length; for (int k = 0; k < gs.length; k++) {