rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
try
try
private void doInstall(AutomatedInstallData installdata) throws Exception { // TODO: i18n System.out.println("[ Starting automated installation ]"); // walk the panels in order Iterator panelsIterator = installdata.panelsOrder.iterator(); while(panelsIterator.hasNext()) { Panel p = (Panel)panelsIterator.next(); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; String panelClassName = p.className; String automationHelperClassName = "com.izforge.izpack.panels."+panelClassName+"AutomationHelper"; Class automationHelperClass = null; // determine if the panel supports automated install try { automationHelperClass = Class.forName(automationHelperClassName); } catch(ClassNotFoundException e) { // this is OK - not all panels have/need automation support. continue; } // instantiate the automation logic for the panel PanelAutomation automationHelperInstance = null; if(automationHelperClass != null) { try { automationHelperInstance = (PanelAutomation)automationHelperClass.newInstance(); } catch(Exception e) { System.err.println("ERROR: no default constructor for "+automationHelperClassName+", skipping..."); continue; } } // We get the panels root xml markup Vector panelRoots = installdata.xmlData.getChildrenNamed (panelClassName); int panelRootNo = 0; if (this.panelInstanceCount.containsKey (panelClassName)) { // get number of panel instance to process panelRootNo = ((Integer)this.panelInstanceCount.get (panelClassName)).intValue (); } XMLElement panelRoot = (XMLElement)panelRoots.elementAt (panelRootNo); this.panelInstanceCount.put (panelClassName, new Integer (panelRootNo+1)); // execute the installation logic for the current panel, if it has any: if(automationHelperInstance != null) { try { automationHelperInstance.runAutomated(installdata, panelRoot); } catch(Exception e) { System.err.println ("ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace (); continue; } } } System.out.println("[ Automated installation done ]"); // Bye Housekeeper.getInstance().shutDown(0); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6629f6e7b4d88c756f0670c257942fdabc2ec0f1/AutomatedInstaller.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
} catch(Exception e)
} catch (Exception e)
private void doInstall(AutomatedInstallData installdata) throws Exception { // TODO: i18n System.out.println("[ Starting automated installation ]"); // walk the panels in order Iterator panelsIterator = installdata.panelsOrder.iterator(); while(panelsIterator.hasNext()) { Panel p = (Panel)panelsIterator.next(); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; String panelClassName = p.className; String automationHelperClassName = "com.izforge.izpack.panels."+panelClassName+"AutomationHelper"; Class automationHelperClass = null; // determine if the panel supports automated install try { automationHelperClass = Class.forName(automationHelperClassName); } catch(ClassNotFoundException e) { // this is OK - not all panels have/need automation support. continue; } // instantiate the automation logic for the panel PanelAutomation automationHelperInstance = null; if(automationHelperClass != null) { try { automationHelperInstance = (PanelAutomation)automationHelperClass.newInstance(); } catch(Exception e) { System.err.println("ERROR: no default constructor for "+automationHelperClassName+", skipping..."); continue; } } // We get the panels root xml markup Vector panelRoots = installdata.xmlData.getChildrenNamed (panelClassName); int panelRootNo = 0; if (this.panelInstanceCount.containsKey (panelClassName)) { // get number of panel instance to process panelRootNo = ((Integer)this.panelInstanceCount.get (panelClassName)).intValue (); } XMLElement panelRoot = (XMLElement)panelRoots.elementAt (panelRootNo); this.panelInstanceCount.put (panelClassName, new Integer (panelRootNo+1)); // execute the installation logic for the current panel, if it has any: if(automationHelperInstance != null) { try { automationHelperInstance.runAutomated(installdata, panelRoot); } catch(Exception e) { System.err.println ("ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace (); continue; } } } System.out.println("[ Automated installation done ]"); // Bye Housekeeper.getInstance().shutDown(0); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6629f6e7b4d88c756f0670c257942fdabc2ec0f1/AutomatedInstaller.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
System.err.println ("ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace ();
System.err.println( "ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace();
private void doInstall(AutomatedInstallData installdata) throws Exception { // TODO: i18n System.out.println("[ Starting automated installation ]"); // walk the panels in order Iterator panelsIterator = installdata.panelsOrder.iterator(); while(panelsIterator.hasNext()) { Panel p = (Panel)panelsIterator.next(); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; String panelClassName = p.className; String automationHelperClassName = "com.izforge.izpack.panels."+panelClassName+"AutomationHelper"; Class automationHelperClass = null; // determine if the panel supports automated install try { automationHelperClass = Class.forName(automationHelperClassName); } catch(ClassNotFoundException e) { // this is OK - not all panels have/need automation support. continue; } // instantiate the automation logic for the panel PanelAutomation automationHelperInstance = null; if(automationHelperClass != null) { try { automationHelperInstance = (PanelAutomation)automationHelperClass.newInstance(); } catch(Exception e) { System.err.println("ERROR: no default constructor for "+automationHelperClassName+", skipping..."); continue; } } // We get the panels root xml markup Vector panelRoots = installdata.xmlData.getChildrenNamed (panelClassName); int panelRootNo = 0; if (this.panelInstanceCount.containsKey (panelClassName)) { // get number of panel instance to process panelRootNo = ((Integer)this.panelInstanceCount.get (panelClassName)).intValue (); } XMLElement panelRoot = (XMLElement)panelRoots.elementAt (panelRootNo); this.panelInstanceCount.put (panelClassName, new Integer (panelRootNo+1)); // execute the installation logic for the current panel, if it has any: if(automationHelperInstance != null) { try { automationHelperInstance.runAutomated(installdata, panelRoot); } catch(Exception e) { System.err.println ("ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace (); continue; } } } System.out.println("[ Automated installation done ]"); // Bye Housekeeper.getInstance().shutDown(0); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6629f6e7b4d88c756f0670c257942fdabc2ec0f1/AutomatedInstaller.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
if (idata.info.getWriteUninstaller()) { System.out.println("[ Writing the uninstaller data ... ]"); writeUninstallData(); }
private void doInstall(AutomatedInstallData installdata) throws Exception { // TODO: i18n System.out.println("[ Starting automated installation ]"); // walk the panels in order Iterator panelsIterator = installdata.panelsOrder.iterator(); while(panelsIterator.hasNext()) { Panel p = (Panel)panelsIterator.next(); if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue; String panelClassName = p.className; String automationHelperClassName = "com.izforge.izpack.panels."+panelClassName+"AutomationHelper"; Class automationHelperClass = null; // determine if the panel supports automated install try { automationHelperClass = Class.forName(automationHelperClassName); } catch(ClassNotFoundException e) { // this is OK - not all panels have/need automation support. continue; } // instantiate the automation logic for the panel PanelAutomation automationHelperInstance = null; if(automationHelperClass != null) { try { automationHelperInstance = (PanelAutomation)automationHelperClass.newInstance(); } catch(Exception e) { System.err.println("ERROR: no default constructor for "+automationHelperClassName+", skipping..."); continue; } } // We get the panels root xml markup Vector panelRoots = installdata.xmlData.getChildrenNamed (panelClassName); int panelRootNo = 0; if (this.panelInstanceCount.containsKey (panelClassName)) { // get number of panel instance to process panelRootNo = ((Integer)this.panelInstanceCount.get (panelClassName)).intValue (); } XMLElement panelRoot = (XMLElement)panelRoots.elementAt (panelRootNo); this.panelInstanceCount.put (panelClassName, new Integer (panelRootNo+1)); // execute the installation logic for the current panel, if it has any: if(automationHelperInstance != null) { try { automationHelperInstance.runAutomated(installdata, panelRoot); } catch(Exception e) { System.err.println ("ERROR: automated installation failed for panel " + panelClassName); e.printStackTrace (); continue; } } } System.out.println("[ Automated installation done ]"); // Bye Housekeeper.getInstance().shutDown(0); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6629f6e7b4d88c756f0670c257942fdabc2ec0f1/AutomatedInstaller.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
XMLElement rtn = (XMLElement)parser.parse();
XMLElement rtn = (XMLElement) parser.parse();
public XMLElement getXMLData(File input) throws Exception { FileInputStream in = new FileInputStream(input); // Initialises the parser StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setReader(new StdXMLReader(in)); parser.setValidator(new NonValidator()); XMLElement rtn = (XMLElement)parser.parse(); in.close(); return rtn; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6629f6e7b4d88c756f0670c257942fdabc2ec0f1/AutomatedInstaller.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstaller.java
public void loadInstallData(AutomatedInstallData installdata) throws Exception
public void loadInstallData(AutomatedInstallData installdata) throws Exception
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
in = getClass().getResourceAsStream("/vars");
in = InstallerBase.class.getResourceAsStream("/vars");
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
in = getClass().getResourceAsStream("/info");
in = InstallerBase.class.getResourceAsStream("/info");
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close();
in = InstallerBase.class.getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List) objIn.readObject(); objIn.close();
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
in = getClass().getResourceAsStream("/packs.info");
in = InstallerBase.class.getResourceAsStream("/packs.info");
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
availablePacks.add(pk);
availablePacks.add(pk);
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator);
installdata.setVariable(ScriptParser.JAVA_HOME, System .getProperty("java.home")); installdata.setVariable(ScriptParser.USER_HOME, System .getProperty("user.home")); installdata.setVariable(ScriptParser.USER_NAME, System .getProperty("user.name")); installdata.setVariable(ScriptParser.FILE_SEPARATOR, File.separator);
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; DataInputStream datIn; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = getClass().getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = getClass().getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = getClass().getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List)objIn.readObject(); objIn.close(); String os = System.getProperty("os.name"); // We read the packs data in = getClass().getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String user = System.getProperty("user.name"); String dir; String installPath; if (os.regionMatches(true, 0, "windows", 0, 7)) { dir = buildWindowsDefaultPath(); } else if (os.regionMatches(true, 0, "mac os x", 0, 6)) { dir = "/Applications" + File.separator; } else if (os.regionMatches(true, 0, "mac", 0, 3)) { dir = ""; } else { if (user.equals("root")) { dir = "/usr/local" + File.separator; } else { dir = System.getProperty("user.home") + File.separator; } } installPath = dir + inf.getAppName(); installdata.setInstallPath(installPath); installdata.setVariable (ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable (ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable (ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable (ScriptParser.FILE_SEPARATOR, File.separator); if (null != variables) { Enumeration enum = variables.keys(); String varName = null; String varValue = null; while (enum.hasMoreElements()) { varName = (String) enum.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/InstallerBase.java/buggy/src/lib/com/izforge/izpack/installer/InstallerBase.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else { setForeground(list.getForeground()); setBackground(list.getBackground()); } // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon; icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); icon = new ImageIcon(GrayFilter.createDisabledImage(icon.getImage())); grayIcons.put(iso3, icon); } if (isSelected || index == -1) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/8c24ce73874e85ddaaf0cbd8e7d8ff768aaf9bcf/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java
monospacedFont = new FontUIResource(font1);
public IzPackMetalTheme() { color = new ColorUIResource(0, 0, 0); Font font1 = createFont("Tahoma", Font.PLAIN, 11); Font font2 = createFont("Tahoma", Font.BOLD, 11); menuFont = new FontUIResource(font1); controlFont = new FontUIResource(font1); windowTitleFont = new FontUIResource(font2); monospacedFont = new FontUIResource(font1); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/IzPackMetalTheme.java/buggy/src/lib/com/izforge/izpack/gui/IzPackMetalTheme.java
}catch (Exception ex){ ; }
}catch (Exception ex){}
public String process (ProcessingClient client){ String retValue = ""; String host = "localhost"; int port = 0; int oPort = 0; boolean found = false; InetAddress inet = null; ServerSocket socket = null; try{ if (client.getNumFields()>1){ host = client.getFieldContents(0); oPort = Integer.parseInt(client.getFieldContents(1)); }else{ oPort = Integer.parseInt(client.getFieldContents(0)); } }catch (Exception ex){ return getReturnValue(client, null, null); } port = oPort; while (!found){ try{ inet = InetAddress.getByName(host); socket = new ServerSocket(port, 0, inet); if (socket.getLocalPort() > 0){ found = true; retValue = getReturnValue(client, null, String.valueOf(port)); }else{ port++; } }catch (java.net.BindException ex){ port++; }catch (Exception ex){ return getReturnValue(client, null, null); }finally{ try{ socket.close(); }catch (Exception ex){ ; } } } return retValue; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/PortProcessor.java/buggy/src/lib/com/izforge/izpack/util/PortProcessor.java
skeleton_is = new JarInputStream (new FileInputStream (
skeleton_is = new ZipInputStream (new FileInputStream (
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/258a408f1734b5684545464044697e930ea8d135/Packager.java/buggy/src/lib/com/izforge/izpack/compiler/Packager.java
this.vs = new VariableSubstitutor(idata.getVariableValueMap());
this.vs = new VariableSubstitutor(idata.getVariables());
public ProcessPanelWorker( AutomatedInstallData idata, AbstractUIProcessHandler handler) throws IOException { this.idata = idata; this.handler = handler; this.vs = new VariableSubstitutor(idata.getVariableValueMap()); if (!readSpec()) throw new IOException("Error reading processing specification"); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/ProcessPanelWorker.java/buggy/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java
packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.packs"), parent.icons.getImageIcon("preferences"), JLabel.TRAILING);
packsLabel = new JLabel( parent.langpack.getString("ImgPacksPanel.packs"), parent.icons.getImageIcon("preferences"), JLabel.TRAILING);
public ImgPacksPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); preLoadImages(); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.packs"), parent.icons.getImageIcon("preferences"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 1, 1, 0.25, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.snap"), parent.icons.getImageIcon("tip"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 1, 0, 1, 1, 0.75, 0.0); layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsList = new JList(idata.availablePacks.toArray()); packsList.addListSelectionListener(this); packsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroller1 = new JScrollPane(packsList); parent.buildConstraints(gbConstraints, 0, 1, 1, 1, 0.25, 1.0); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(scroller1, gbConstraints); add(scroller1); imgLabel = new JLabel((ImageIcon) images.get(0)); JScrollPane scroller2 = new JScrollPane(imgLabel); parent.buildConstraints(gbConstraints, 1, 1, 1, 1, 0.75, 1.0); layout.addLayoutComponent(scroller2, gbConstraints); add(scroller2); checkBox = new JCheckBox(parent.langpack.getString("ImgPacksPanel.checkbox")); checkBox.addActionListener(this); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(checkBox, gbConstraints); add(checkBox); spaceLabel = new JLabel(parent.langpack.getString("PacksPanel.space")); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(spaceLabel, gbConstraints); add(spaceLabel); descLabel = new JLabel(""); parent.buildConstraints(gbConstraints, 1, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(descLabel, gbConstraints); add(descLabel); packsList.setSelectedIndex(0); // We update the checkbox and the description Pack pack = (Pack) idata.availablePacks.get(index); checkBox.setEnabled(!pack.required); checkBox.setSelected(idata.selectedPacks.contains(pack)); descLabel.setText(pack.description); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.snap"), parent.icons.getImageIcon("tip"), JLabel.TRAILING);
packsLabel = new JLabel( parent.langpack.getString("ImgPacksPanel.snap"), parent.icons.getImageIcon("tip"), JLabel.TRAILING);
public ImgPacksPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); preLoadImages(); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.packs"), parent.icons.getImageIcon("preferences"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 1, 1, 0.25, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.snap"), parent.icons.getImageIcon("tip"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 1, 0, 1, 1, 0.75, 0.0); layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsList = new JList(idata.availablePacks.toArray()); packsList.addListSelectionListener(this); packsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroller1 = new JScrollPane(packsList); parent.buildConstraints(gbConstraints, 0, 1, 1, 1, 0.25, 1.0); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(scroller1, gbConstraints); add(scroller1); imgLabel = new JLabel((ImageIcon) images.get(0)); JScrollPane scroller2 = new JScrollPane(imgLabel); parent.buildConstraints(gbConstraints, 1, 1, 1, 1, 0.75, 1.0); layout.addLayoutComponent(scroller2, gbConstraints); add(scroller2); checkBox = new JCheckBox(parent.langpack.getString("ImgPacksPanel.checkbox")); checkBox.addActionListener(this); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(checkBox, gbConstraints); add(checkBox); spaceLabel = new JLabel(parent.langpack.getString("PacksPanel.space")); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(spaceLabel, gbConstraints); add(spaceLabel); descLabel = new JLabel(""); parent.buildConstraints(gbConstraints, 1, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(descLabel, gbConstraints); add(descLabel); packsList.setSelectedIndex(0); // We update the checkbox and the description Pack pack = (Pack) idata.availablePacks.get(index); checkBox.setEnabled(!pack.required); checkBox.setSelected(idata.selectedPacks.contains(pack)); descLabel.setText(pack.description); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
checkBox = new JCheckBox(parent.langpack.getString("ImgPacksPanel.checkbox"));
checkBox = new JCheckBox(parent.langpack.getString("ImgPacksPanel.checkbox"));
public ImgPacksPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); preLoadImages(); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.packs"), parent.icons.getImageIcon("preferences"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 1, 1, 0.25, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsLabel = new JLabel(parent.langpack.getString("ImgPacksPanel.snap"), parent.icons.getImageIcon("tip"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 1, 0, 1, 1, 0.75, 0.0); layout.addLayoutComponent(packsLabel, gbConstraints); add(packsLabel); packsList = new JList(idata.availablePacks.toArray()); packsList.addListSelectionListener(this); packsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scroller1 = new JScrollPane(packsList); parent.buildConstraints(gbConstraints, 0, 1, 1, 1, 0.25, 1.0); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(scroller1, gbConstraints); add(scroller1); imgLabel = new JLabel((ImageIcon) images.get(0)); JScrollPane scroller2 = new JScrollPane(imgLabel); parent.buildConstraints(gbConstraints, 1, 1, 1, 1, 0.75, 1.0); layout.addLayoutComponent(scroller2, gbConstraints); add(scroller2); checkBox = new JCheckBox(parent.langpack.getString("ImgPacksPanel.checkbox")); checkBox.addActionListener(this); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(checkBox, gbConstraints); add(checkBox); spaceLabel = new JLabel(parent.langpack.getString("PacksPanel.space")); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(spaceLabel, gbConstraints); add(spaceLabel); descLabel = new JLabel(""); parent.buildConstraints(gbConstraints, 1, 2, 1, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(descLabel, gbConstraints); add(descLabel); packsList.setSelectedIndex(0); // We update the checkbox and the description Pack pack = (Pack) idata.availablePacks.get(index); checkBox.setEnabled(!pack.required); checkBox.setSelected(idata.selectedPacks.contains(pack)); descLabel.setText(pack.description); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
} else
} else
public void actionPerformed(ActionEvent e) { // We select or not the current pack Pack pack = (Pack) idata.availablePacks.get(index); if (checkBox.isSelected()) { idata.selectedPacks.add(pack); bytes += pack.nbytes; } else { idata.selectedPacks.remove(idata.selectedPacks.indexOf(pack)); bytes -= pack.nbytes; } showSpaceRequired(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
new ImgPacksPanelAutomationHelper().makeXMLData(idata, panelRoot);
new ImgPacksPanelAutomationHelper().makeXMLData(idata, panelRoot);
public void makeXMLData(XMLElement panelRoot) { new ImgPacksPanelAutomationHelper().makeXMLData(idata, panelRoot); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
URL url = ResourceManager.getInstance().getURL("ImgPacksPanel.img." + i);
URL url = ResourceManager.getInstance().getURL("ImgPacksPanel.img." + i);
private void preLoadImages() { int size = idata.availablePacks.size(); images = new ArrayList(size); for (int i = 0; i < size; i++) try { URL url = ResourceManager.getInstance().getURL("ImgPacksPanel.img." + i); ImageIcon img = new ImageIcon(url); images.add(img); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
} catch (Exception err)
} catch (Exception err)
private void preLoadImages() { int size = idata.availablePacks.size(); images = new ArrayList(size); for (int i = 0; i < size; i++) try { URL url = ResourceManager.getInstance().getURL("ImgPacksPanel.img." + i); ImageIcon img = new ImageIcon(url); images.add(img); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
StringBuffer result = new StringBuffer(parent.langpack.getString("PacksPanel.space"));
StringBuffer result = new StringBuffer(parent.langpack.getString("PacksPanel.space"));
private void showSpaceRequired() { StringBuffer result = new StringBuffer(parent.langpack.getString("PacksPanel.space")); result.append(Pack.toByteUnitsString(bytes)); spaceLabel.setText(result.toString()); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/ImgPacksPanel.java/buggy/src/lib/com/izforge/izpack/panels/ImgPacksPanel.java
Debug.error("delete it ");
public void rewind() throws IllegalArgumentException, NativeLibException { synchronized (logging) { Iterator iter = logging.iterator(); suspendLogging(); while (iter.hasNext()) { RegistryLogItem rli = (RegistryLogItem) iter.next(); switch (rli.getType()) { case RegistryLogItem.CREATED_KEY: deleteKeyIfEmpty(rli.getRoot(), rli.getKey()); break; case RegistryLogItem.REMOVED_KEY: createKeyN(rli.getRoot(), rli.getKey()); break; case RegistryLogItem.CREATED_VALUE: RegDataContainer currentContents = null; // Delete value only if reg entry exists and equal to the // stored // value. try { currentContents = getValue(rli.getRoot(), rli.getKey(), rli.getValueName()); } catch (NativeLibException nle) { break; } if (currentContents.equals(rli.getNewValue())) { Debug.error("delete it "); deleteValueN(rli.getRoot(), rli.getKey(), rli.getValueName()); } // TODO: what todo if value has changed? break; case RegistryLogItem.REMOVED_VALUE: // Set old value only if reg entry not exists. try { getValue(rli.getRoot(), rli.getKey(), rli.getValueName()); } catch (NativeLibException nle) { setValueN(rli.getRoot(), rli.getKey(), rli.getValueName(), rli .getOldValue()); } break; case RegistryLogItem.CHANGED_VALUE: // Change to old value only if reg entry exists and equal to // the // stored value. try { currentContents = getValue(rli.getRoot(), rli.getKey(), rli.getValueName()); } catch (NativeLibException nle) { break; } if (currentContents.equals(rli.getNewValue())) { setValueN(rli.getRoot(), rli.getKey(), rli.getValueName(), rli .getOldValue()); } break; } } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/7c92c0823142dc99b3d510ed43f6078683490d9f/RegistryImpl.java/clean/src/lib/com/coi/tools/os/win/RegistryImpl.java
public NativeLibException(String message)
public NativeLibException()
public NativeLibException(String message) { super(message); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/NativeLibException.java/buggy/src/lib/com/coi/tools/os/win/NativeLibException.java
super(message);
super();
public NativeLibException(String message) { super(message); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/NativeLibException.java/buggy/src/lib/com/coi/tools/os/win/NativeLibException.java
public RegDataContainer(String data)
public RegDataContainer()
public RegDataContainer(String data) { super(); type = REG_SZ; stringData = data; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/RegDataContainer.java/buggy/src/lib/com/coi/tools/os/win/RegDataContainer.java
type = REG_SZ; stringData = data;
public RegDataContainer(String data) { super(); type = REG_SZ; stringData = data; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/RegDataContainer.java/buggy/src/lib/com/coi/tools/os/win/RegDataContainer.java
dir = dir + File.separator;
dir += File.separator;
public void loadInstallData(AutomatedInstallData installdata) throws Exception { // Usefull variables InputStream in; ObjectInputStream objIn; int size; int i; // We load the variables Properties variables = null; in = InstallerBase.class.getResourceAsStream("/vars"); if (null != in) { objIn = new ObjectInputStream(in); variables = (Properties) objIn.readObject(); objIn.close(); } // We load the Info data in = InstallerBase.class.getResourceAsStream("/info"); objIn = new ObjectInputStream(in); Info inf = (Info) objIn.readObject(); objIn.close(); // We put the Info data as variables installdata.setVariable(ScriptParser.APP_NAME, inf.getAppName()); if (inf.getAppURL() != null) installdata.setVariable(ScriptParser.APP_URL, inf.getAppURL()); installdata.setVariable(ScriptParser.APP_VER, inf.getAppVersion()); // We read the panels order data in = InstallerBase.class.getResourceAsStream("/panelsOrder"); objIn = new ObjectInputStream(in); List panelsOrder = (List) objIn.readObject(); objIn.close(); // We read the packs data in = InstallerBase.class.getResourceAsStream("/packs.info"); objIn = new ObjectInputStream(in); size = objIn.readInt(); ArrayList availablePacks = new ArrayList(); ArrayList allPacks = new ArrayList(); for (i = 0; i < size; i++) { Pack pk = (Pack) objIn.readObject(); allPacks.add(pk); if (OsConstraint.oneMatchesCurrentSystem(pk.osConstraints)) availablePacks.add(pk); } objIn.close(); // We determine the operating system and the initial installation path String dir; String installPath; if (OsVersion.IS_WINDOWS) { dir = buildWindowsDefaultPath(); } else if (OsVersion.IS_OSX) { dir = "/Applications"; } else { if (new File("/usr/local/").canWrite()) { dir = "/usr/local"; } else { dir = System.getProperty("user.home"); } } // We determine the hostname and IPAdress String hostname; String IPAddress; try { InetAddress addr = InetAddress.getLocalHost(); // Get IP Address IPAddress = addr.getHostAddress(); // Get hostname hostname = addr.getHostName(); } catch (Exception e) { hostname = ""; IPAddress = ""; } installdata.setVariable("APPLICATIONS_DEFAULT_ROOT", dir); dir = dir + File.separator; installdata.setVariable(ScriptParser.JAVA_HOME, System.getProperty("java.home")); installdata.setVariable(ScriptParser.CLASS_PATH, System.getProperty("java.class.path")); installdata.setVariable(ScriptParser.USER_HOME, System.getProperty("user.home")); installdata.setVariable(ScriptParser.USER_NAME, System.getProperty("user.name")); installdata.setVariable(ScriptParser.IP_ADDRESS, IPAddress); installdata.setVariable(ScriptParser.HOST_NAME, hostname); installdata.setVariable(ScriptParser.FILE_SEPARATOR, File.separator); Enumeration e = System.getProperties().keys(); while (e.hasMoreElements()) { String varName = (String) e.nextElement(); String varValue = System.getProperty(varName); if (varValue != null) { varName = varName.replace('.', '_'); installdata.setVariable("SYSTEM_" + varName, varValue); } } if (null != variables) { Enumeration enumeration = variables.keys(); String varName; String varValue; while (enumeration.hasMoreElements()) { varName = (String) enumeration.nextElement(); varValue = variables.getProperty(varName); installdata.setVariable(varName, varValue); } } installdata.info = inf; installdata.panelsOrder = panelsOrder; installdata.availablePacks = availablePacks; installdata.allPacks = allPacks; // get list of preselected packs Iterator pack_it = availablePacks.iterator(); while (pack_it.hasNext()) { Pack pack = (Pack) pack_it.next(); if (pack.preselected) installdata.selectedPacks.add(pack); } // Set the installation path in a default manner installPath = dir + inf.getAppName(); if (inf.getInstallationSubPath() != null) { // A subpath was defined, use it. installPath = IoHelper.translatePath(dir + inf.getInstallationSubPath(), new VariableSubstitutor(installdata.getVariables())); } installdata.setInstallPath(installPath); // Load custom action data. loadCustomData(installdata); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/InstallerBase.java/clean/src/lib/com/izforge/izpack/installer/InstallerBase.java
gbConstraints.fill = GridBagConstraints.NONE;
gbConstraints.fill = GridBagConstraints.BOTH;
public XInfoPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We add the components infoLabel = new JLabel(parent.langpack.getString("InfoPanel.info"), parent.icons.getImageIcon("edit"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 1, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.SOUTHWEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); textArea = new JTextArea(); textArea.setEditable(false); JScrollPane scroller = new JScrollPane(textArea); parent.buildConstraints(gbConstraints, 0, 1, 1, 1, 1.0, 0.9); gbConstraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/f39722ad59a994fd771e40221acb117b7c3da50d/XInfoPanel.java/clean/src/lib/com/izforge/izpack/panels/XInfoPanel.java
return new GenericObjectPool(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle);
return new GenericObjectPool(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_softMinEvictableIdleTimeMillis);
public ObjectPool createPool() { return new GenericObjectPool(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle); }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/1f72da420f6f9f9c7ea090bde158e7289c1a7138/GenericObjectPoolFactory.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPoolFactory.java
this.parent = parent;
this.parentFrame = parent;
public TargetPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); //Initialization this.parent = parent; // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // load the default directory info (if present) loadDefaultDir(); if (defaultDir != null) // override the system default that uses app name (which is set in the Installer class) idata.setInstallPath(defaultDir); // We create and put the components infoLabel = new JLabel( parent.langpack.getString("TargetPanel.info"), parent.icons.getImageIcon("home"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 3.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.SOUTHWEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); textField = new JTextField(idata.getInstallPath(), 40); textField.addActionListener(this); parent.buildConstraints(gbConstraints, 0, 1, GridBagConstraints.RELATIVE, 1, 1.0, 0.0); gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(textField, gbConstraints); add(textField); browseButton = ButtonFactory.createButton( parent.langpack.getString("TargetPanel.browse"), parent.icons.getImageIcon("open"), idata.buttonsHColor); browseButton.addActionListener(this); parent.buildConstraints(gbConstraints, 1, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0); gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(browseButton, gbConstraints); add(browseButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
parent.navigateNext();
parentFrame.navigateNext();
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source != textField) { // The user wants to browse its filesystem // Prepares the file chooser JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(textField.getText())); fc.setMultiSelectionEnabled(false); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.addChoosableFileFilter(fc.getAcceptAllFileFilter()); // Shows it if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { String path = fc.getSelectedFile().getAbsolutePath(); File dir = new File(path); if (dir.canWrite()) textField.setText(path); } } else if (source == textField) { parent.navigateNext(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
parent.langpack.getString("TargetPanel.empty_target"), parent.langpack.getString("installer.warning"),
parentFrame.langpack.getString("TargetPanel.empty_target"), parentFrame.langpack.getString("installer.warning"),
public boolean isValidated() { String installPath = textField.getText(); boolean ok = true; // We put a warning if the specified target is nameless if (installPath.length() == 0) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.empty_target"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } if (!ok) return ok; // Normalize the path File path = new File(installPath).getAbsoluteFile(); installPath = path.toString(); // We put a warning if the directory exists else we warn that it will be created if (path.exists()) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.warn"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } else JOptionPane.showMessageDialog( this, parent.langpack.getString("TargetPanel.createdir") + "\n" + installPath); idata.setInstallPath(installPath); return ok; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
parent.langpack.getString("TargetPanel.warn"), parent.langpack.getString("installer.warning"),
parentFrame.langpack.getString("TargetPanel.warn"), parentFrame.langpack.getString("installer.warning"),
public boolean isValidated() { String installPath = textField.getText(); boolean ok = true; // We put a warning if the specified target is nameless if (installPath.length() == 0) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.empty_target"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } if (!ok) return ok; // Normalize the path File path = new File(installPath).getAbsoluteFile(); installPath = path.toString(); // We put a warning if the directory exists else we warn that it will be created if (path.exists()) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.warn"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } else JOptionPane.showMessageDialog( this, parent.langpack.getString("TargetPanel.createdir") + "\n" + installPath); idata.setInstallPath(installPath); return ok; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
parent.langpack.getString("TargetPanel.createdir")
parentFrame.langpack.getString("TargetPanel.createdir")
public boolean isValidated() { String installPath = textField.getText(); boolean ok = true; // We put a warning if the specified target is nameless if (installPath.length() == 0) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.empty_target"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } if (!ok) return ok; // Normalize the path File path = new File(installPath).getAbsoluteFile(); installPath = path.toString(); // We put a warning if the directory exists else we warn that it will be created if (path.exists()) { int res = JOptionPane.showConfirmDialog( this, parent.langpack.getString("TargetPanel.warn"), parent.langpack.getString("installer.warning"), JOptionPane.YES_NO_OPTION); ok = (res == JOptionPane.YES_OPTION); } else JOptionPane.showMessageDialog( this, parent.langpack.getString("TargetPanel.createdir") + "\n" + installPath); idata.setInstallPath(installPath); return ok; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir.windows");
in = parentFrame.getResource("TargetPanel.dir.windows");
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir.macosx");
in = parentFrame.getResource("TargetPanel.dir.macosx");
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir.mac");
in = parentFrame.getResource("TargetPanel.dir.mac");
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir.".concat(os));
in = parentFrame.getResource("TargetPanel.dir.".concat(os));
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir.unix");
in = parentFrame.getResource("TargetPanel.dir.unix");
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
in = parent.getResource("TargetPanel.dir");
in = parentFrame.getResource("TargetPanel.dir");
public void loadDefaultDir() { BufferedReader br = null; try { String os = System.getProperty("os.name"); InputStream in = null; if (os.regionMatches(true, 0, "windows", 0, 7)) in = parent.getResource("TargetPanel.dir.windows"); else if (os.regionMatches(true, 0, "mac os x", 0, 8)) in = parent.getResource("TargetPanel.dir.macosx"); else if (os.regionMatches(true, 0, "mac", 0, 3)) in = parent.getResource("TargetPanel.dir.mac"); else { // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res files in = parent.getResource("TargetPanel.dir.".concat(os)); // if not specific os, try getting generic 'unix' resource file if (in == null) in = parent.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) in = parent.getResource("TargetPanel.dir"); } // if all above tests failed, there is no resource file, // so use system default if (in == null) return; // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line = null; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!line.equals("")) break; } defaultDir = line; } catch (Exception e) { defaultDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) { } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/TargetPanel.java/clean/src/lib/com/izforge/izpack/panels/TargetPanel.java
protected TestKeyedObjectPoolFactory(final String name) {
public TestKeyedObjectPoolFactory(final String name) {
protected TestKeyedObjectPoolFactory(final String name) { super(name); }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/c4373c1dc85ccc9f5ff8a6633f2a8c59693dc20b/TestKeyedObjectPoolFactory.java/clean/src/test/org/apache/commons/pool/TestKeyedObjectPoolFactory.java
public ModelBasedTesting( String graphmlFileName_, Object object_ ) { _graphmlFileName = graphmlFileName_; _object = object_; _logger = Logger.getLogger( ModelBasedTesting.class ); PropertyConfigurator.configure("log4j.properties"); readFiles(); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED );
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
throw new RuntimeException( "A start nod can only exist in one file, see files " +
throw new RuntimeException( "A start nod can only exist in one file, see files " +
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
}
}
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) );
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) )
if ( _graph.hashCode() == g.hashCode() )
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.debug( " Graphs are the same, next..." );
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.debug( "Analysing graph in file: " + g.getUserDatum( FILE_KEY ) );
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) +
_logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) +
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
boolean v1IsMerged = false;
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
} _graph.removeVertex( v1 ); }
_graph.removeVertex( v1 ); } }
private void analyseSubGraphs() { boolean foundStartGraph = false; for ( Iterator iter = _graphList.iterator(); iter.hasNext(); ) { SparseGraph g = (SparseGraph) iter.next(); Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; // Find all vertices that are start nodes (START_NODE) if ( v.getUserDatum( LABEL_KEY ).equals( START_NODE ) ) { Object[] edges = v.getOutEdges().toArray(); if ( edges.length != 1 ) { throw new RuntimeException( "A start nod can only have one out edge, look in file: " + g.getUserDatum( FILE_KEY ) ); } DirectedSparseEdge edge = (DirectedSparseEdge)edges[ 0 ]; g.addUserDatum( LABEL_KEY, edge.getDest().getUserDatum(LABEL_KEY), UserData.SHARED ); if ( edge.containsUserDatumKey( LABEL_KEY ) ) { if ( foundStartGraph == true ) { throw new RuntimeException( "A start nod can only exist in one file, see files " + _graph.getUserDatum( FILE_KEY )+ ", and " + g.getUserDatum( FILE_KEY ) ); } foundStartGraph = true; _graph = g; } else { // Since the edge does not contain a label, this is a subgraph // Mark the destination node of the edge to a subgraph starting node edge.getDest().addUserDatum( SUBGRAPH_START_VERTEX, SUBGRAPH_START_VERTEX, UserData.SHARED ); } } } } _logger.debug( "Investigating graph: " + _graph.getUserDatum( LABEL_KEY ) ); for ( int i = 0; i < _graphList.size(); i++ ) { SparseGraph g = (SparseGraph)_graphList.elementAt( i ); _logger.debug( "With graph: " + g.getUserDatum( LABEL_KEY ) + " in file: " + g.getUserDatum( FILE_KEY ) ); if ( _graph.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { _logger.debug( " Graphs are the same, next..." ); continue; } Object[] vertices = _graph.getVertices().toArray(); for ( int j = 0; j < vertices.length; j++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)vertices[ j ]; _logger.debug( "Investigating vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) ); if ( v1.getUserDatum( LABEL_KEY ).equals( g.getUserDatum( LABEL_KEY ) ) ) { if ( v1.containsUserDatumKey( MERGE ) ) { _logger.debug( "The vertex is marked MERGE, and will not be replaced by a subgraph."); continue; } if ( v1.containsUserDatumKey( NO_MERGE ) ) { _logger.debug( "The vertex is marked NO_MERGE, and will not be replaced by a subgraph."); continue; } _logger.debug( "A subgraph'ed vertex: " + v1.getUserDatum( LABEL_KEY ) + " in graph: " + g.getUserDatum( FILE_KEY ) + ", equals a node in the graph in file: " + _graph.getUserDatum( FILE_KEY ) ); appendGraph( _graph, g ); //writeGraph("/tmp/debug_append.graphml"); copySubGraphs( _graph, v1 ); //writeGraph("/tmp/debug_merge.graphml"); vertices = _graph.getVertices().toArray(); i = -1; j = -1; } } } // Merge all nodes marked MERGE Object[] list1 = _graph.getVertices().toArray(); for ( int i = 0; i < list1.length; i++ ) { DirectedSparseVertex v1 = (DirectedSparseVertex)list1[ i ]; if ( v1.containsUserDatumKey( MERGE ) == false ) { continue; } Object[] list2 = _graph.getVertices().toArray(); for ( int j = 0; j < list2.length; j++ ) { DirectedSparseVertex v2 = (DirectedSparseVertex)list2[ j ]; if ( v1.hashCode() == v2.hashCode() ) { continue; } if ( v1.getUserDatum( LABEL_KEY ).equals( v2.getUserDatum( LABEL_KEY ) ) == false ) { continue; } _logger.debug( "Merging vertex(" + v1.hashCode() + "): " + v1.getUserDatum( LABEL_KEY ) + "with vertex(" + v2.hashCode() ); Object[] inEdges = v1.getInEdges().toArray(); for (int x = 0; x < inEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( edge.getSource(), v2 ) ); new_edge.importUserData( edge ); } Object[] outEdges = v1.getOutEdges().toArray(); for (int x = 0; x < outEdges.length; x++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ x ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)_graph.addEdge( new DirectedSparseEdge( v2, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing merged vertex(" + v1.hashCode() + ")" ); } _graph.removeVertex( v1 ); } _logger.debug( "Done merging" ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ];
DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ];
private void copySubGraphs( SparseGraph g, DirectedSparseVertex targetVertex ) { DirectedSparseVertex sourceVertex = null; Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; if ( v.getUserDatum( LABEL_KEY ).equals( targetVertex.getUserDatum( LABEL_KEY ) ) ) { if ( v.containsUserDatumKey( SUBGRAPH_START_VERTEX ) == false ) { continue; } if ( v.containsUserDatumKey( MERGE ) ) { continue; } if ( v.containsUserDatumKey( NO_MERGE ) ) { continue; } if ( v.hashCode() == targetVertex.hashCode() ) { continue; } sourceVertex = v; break; } } if ( sourceVertex == null ) { return; } _logger.info( "Start merging target vertex(" + targetVertex.hashCode() + ") with source vertex(" + sourceVertex.hashCode() + "), " + sourceVertex.getUserDatum( LABEL_KEY ) ); Object[] inEdges = sourceVertex.getInEdges().toArray(); for (int i = 0; i < inEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( edge.getSource(), targetVertex ) ); new_edge.importUserData( edge ); } Object[] outEdges = sourceVertex.getOutEdges().toArray(); for (int i = 0; i < outEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( targetVertex, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing source vertex(" + sourceVertex.hashCode() + ")" ); g.removeVertex( sourceVertex ); targetVertex.addUserDatum( NO_MERGE, "no merge", UserData.SHARED ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void copySubGraphs( SparseGraph g, DirectedSparseVertex targetVertex ) { DirectedSparseVertex sourceVertex = null; Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; if ( v.getUserDatum( LABEL_KEY ).equals( targetVertex.getUserDatum( LABEL_KEY ) ) ) { if ( v.containsUserDatumKey( SUBGRAPH_START_VERTEX ) == false ) { continue; } if ( v.containsUserDatumKey( MERGE ) ) { continue; } if ( v.containsUserDatumKey( NO_MERGE ) ) { continue; } if ( v.hashCode() == targetVertex.hashCode() ) { continue; } sourceVertex = v; break; } } if ( sourceVertex == null ) { return; } _logger.info( "Start merging target vertex(" + targetVertex.hashCode() + ") with source vertex(" + sourceVertex.hashCode() + "), " + sourceVertex.getUserDatum( LABEL_KEY ) ); Object[] inEdges = sourceVertex.getInEdges().toArray(); for (int i = 0; i < inEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( edge.getSource(), targetVertex ) ); new_edge.importUserData( edge ); } Object[] outEdges = sourceVertex.getOutEdges().toArray(); for (int i = 0; i < outEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( targetVertex, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing source vertex(" + sourceVertex.hashCode() + ")" ); g.removeVertex( sourceVertex ); targetVertex.addUserDatum( NO_MERGE, "no merge", UserData.SHARED ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void copySubGraphs( SparseGraph g, DirectedSparseVertex targetVertex ) { DirectedSparseVertex sourceVertex = null; Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; if ( v.getUserDatum( LABEL_KEY ).equals( targetVertex.getUserDatum( LABEL_KEY ) ) ) { if ( v.containsUserDatumKey( SUBGRAPH_START_VERTEX ) == false ) { continue; } if ( v.containsUserDatumKey( MERGE ) ) { continue; } if ( v.containsUserDatumKey( NO_MERGE ) ) { continue; } if ( v.hashCode() == targetVertex.hashCode() ) { continue; } sourceVertex = v; break; } } if ( sourceVertex == null ) { return; } _logger.info( "Start merging target vertex(" + targetVertex.hashCode() + ") with source vertex(" + sourceVertex.hashCode() + "), " + sourceVertex.getUserDatum( LABEL_KEY ) ); Object[] inEdges = sourceVertex.getInEdges().toArray(); for (int i = 0; i < inEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( edge.getSource(), targetVertex ) ); new_edge.importUserData( edge ); } Object[] outEdges = sourceVertex.getOutEdges().toArray(); for (int i = 0; i < outEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( targetVertex, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing source vertex(" + sourceVertex.hashCode() + ")" ); g.removeVertex( sourceVertex ); targetVertex.addUserDatum( NO_MERGE, "no merge", UserData.SHARED ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private void copySubGraphs( SparseGraph g, DirectedSparseVertex targetVertex ) { DirectedSparseVertex sourceVertex = null; Object[] vertices = g.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex v = (DirectedSparseVertex)vertices[ i ]; if ( v.getUserDatum( LABEL_KEY ).equals( targetVertex.getUserDatum( LABEL_KEY ) ) ) { if ( v.containsUserDatumKey( SUBGRAPH_START_VERTEX ) == false ) { continue; } if ( v.containsUserDatumKey( MERGE ) ) { continue; } if ( v.containsUserDatumKey( NO_MERGE ) ) { continue; } if ( v.hashCode() == targetVertex.hashCode() ) { continue; } sourceVertex = v; break; } } if ( sourceVertex == null ) { return; } _logger.info( "Start merging target vertex(" + targetVertex.hashCode() + ") with source vertex(" + sourceVertex.hashCode() + "), " + sourceVertex.getUserDatum( LABEL_KEY ) ); Object[] inEdges = sourceVertex.getInEdges().toArray(); for (int i = 0; i < inEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)inEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( edge.getSource(), targetVertex ) ); new_edge.importUserData( edge ); } Object[] outEdges = sourceVertex.getOutEdges().toArray(); for (int i = 0; i < outEdges.length; i++) { DirectedSparseEdge edge = (DirectedSparseEdge)outEdges[ i ]; DirectedSparseEdge new_edge = (DirectedSparseEdge)g.addEdge( new DirectedSparseEdge( targetVertex, edge.getDest() ) ); new_edge.importUserData( edge ); } _logger.debug( "Remvoing source vertex(" + sourceVertex.hashCode() + ")" ); g.removeVertex( sourceVertex ); targetVertex.addUserDatum( NO_MERGE, "no merge", UserData.SHARED ); }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
_logger.info( "Intend to take the shortest path between: " + (String)_nextVertex.getUserDatum( LABEL_KEY ) + " and " + (String)e.getDest().getUserDatum( LABEL_KEY ) + " (from: " + (String)e.getSource().getUserDatum( LABEL_KEY ) + "), using " + _shortestPathToVertex.size() + " hops." );
_logger.info( "Intend to take the shortest path between: " + _nextVertex.getUserDatum( LABEL_KEY ) + " and " + (String)e.getDest().getUserDatum( LABEL_KEY ) + " (from: " + e.getSource().getUserDatum( LABEL_KEY ) + "), using " + _shortestPathToVertex.size() + " hops." );
private void executeMethod( boolean optimize ) throws FoundNoEdgeException { DirectedSparseEdge edge = null; Object[] outEdges = null; if ( _nextVertex.containsUserDatumKey( BACK_KEY ) && _history. size() >= 3 ) { Float probability = (Float)_nextVertex.getUserDatum( BACK_KEY ); int index = _radomGenerator.nextInt( 100 ); if ( index < ( probability.floatValue() * 100 ) ) { String str = (String)_history.removeLast(); _logger.debug( "Remove from history: " + str ); String nodeLabel = (String)_history.getLast(); _logger.debug( "Reversing a vertex. From: " + (String)_nextVertex.getUserDatum( LABEL_KEY ) + ", to: " + nodeLabel ); Object[] vertices = _graph.getVertices().toArray(); for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)vertices[ i ]; if ( nodeLabel == (String)vertex.getUserDatum( LABEL_KEY ) ) { try { _nextVertex = vertex; String label = "PressBackButton"; _logger.debug( "Invoke method for edge: \"" + label + "\"" ); invokeMethod( label ); label = nodeLabel; _logger.debug( "Invoke method for vertex: \"" + label + "\"" ); invokeMethod( label ); } catch( GoBackToPreviousVertexException e ) { throw new RuntimeException( "An GoBackToPreviousVertexException was thrown where it should not be thrown." ); } return; } } throw new RuntimeException( "An attempt was made to reverse to vertex: " + nodeLabel + ", and did not find it." ); } } _logger.debug( "Vertex = " + (String)_nextVertex.getUserDatum( LABEL_KEY ) ); outEdges = _nextVertex.getOutEdges().toArray(); _logger.debug( "Number of outgoing edges = " + outEdges.length ); outEdges = shuffle( outEdges ); if ( _shortestPathToVertex == null && _runUntilAllEdgesVisited == true ) { Vector unvisitedEdges = returnUnvisitedEdge(); if ( unvisitedEdges.size() == 0) { _logger.debug( "All edges has been visited!" ); return; } _logger.info( "Found " + unvisitedEdges.size() + " unvisited edges." ); Object[] shuffledList = shuffle( unvisitedEdges.toArray() ); DirectedSparseEdge e = (DirectedSparseEdge)shuffledList[ 0 ]; if ( e == null ) { throw new RuntimeException( "Found an empty edge!" ); } _logger.info( "Selecting edge: " + getCompleteEdgeName( e ) ); _shortestPathToVertex = new DijkstraShortestPath( _graph ).getPath( _nextVertex, e.getSource() ); _shortestPathToVertex.add( e ); _logger.info( "Intend to take the shortest path between: " + (String)_nextVertex.getUserDatum( LABEL_KEY ) + " and " + (String)e.getDest().getUserDatum( LABEL_KEY ) + " (from: " + (String)e.getSource().getUserDatum( LABEL_KEY ) + "), using " + _shortestPathToVertex.size() + " hops." ); String paths = "The route is: "; for (Iterator iter = _shortestPathToVertex.iterator(); iter.hasNext();) { DirectedSparseEdge item = (DirectedSparseEdge) iter.next(); paths += getCompleteEdgeName( item ) + " ==> "; } paths += " Done!"; _logger.info( paths ); } if ( _shortestPathToVertex != null && _shortestPathToVertex.size() > 0 ) { edge = (DirectedSparseEdge)_shortestPathToVertex.get( 0 ); _shortestPathToVertex.remove( 0 ); _logger.debug( "Removed edge: " + getCompleteEdgeName( edge ) + " from the shortest path list, " + _shortestPathToVertex.size() + " hops remaining." ); if ( _shortestPathToVertex.size() == 0 ) { _shortestPathToVertex = null; } } else if ( optimize ) { // Look for an edge that has not been visited yet. for ( int i = 0; i < outEdges.length; i++ ) { edge = (DirectedSparseEdge)outEdges[ i ]; Integer vistited = (Integer)edge.getUserDatum( VISITED_KEY ); if ( vistited.intValue() == 0 ) { if ( _rejectedEdge == edge ) { // This edge has been rejected, because some condition was not fullfilled. // Try with the next edge in the for-loop. // _rejectedEdge has to be set to null, because it can be valid next time. _rejectedEdge = null; } else { _logger.debug( "Found an edge which has not been visited yet: " + getCompleteEdgeName( edge ) ); break; } } edge = null; } if ( edge == null ) { _logger.debug( "All edges has been visited (" + outEdges.length + ")" ); edge = getWeightedEdge( _nextVertex ); } } else { edge = getWeightedEdge( _nextVertex ); } if ( edge == null ) { throw new RuntimeException( "Did not find any edge." ); } _logger.debug( "Edge = \"" + getCompleteEdgeName( edge ) + "\"" ); _prevVertex = _nextVertex; _nextVertex = (DirectedSparseVertex)edge.getDest(); try { String label = (String)edge.getUserDatum( LABEL_KEY ); _logger.debug( "Invoke method for edge: \"" + label + "\"" ); invokeMethod( label ); Integer vistited = (Integer)edge.getUserDatum( VISITED_KEY ); vistited = new Integer( vistited.intValue() + 1 ); edge.setUserDatum( VISITED_KEY, vistited, UserData.SHARED ); label = (String)edge.getDest().getUserDatum( LABEL_KEY ); _logger.debug( "Invoke method for vertex: \"" + label + "\"" ); invokeMethod( label ); vistited = (Integer)edge.getDest().getUserDatum( VISITED_KEY ); vistited = new Integer( vistited.intValue() + 1 ); edge.getDest().setUserDatum( VISITED_KEY, vistited, UserData.SHARED ); if ( ((String)edge.getDest().getUserDatum( LABEL_KEY )).equals( "Stop" ) ) { _logger.debug( "Clearing the history" ); _history.clear(); } if ( edge.containsUserDatumKey( NO_HISTORY ) == false ) { _logger.debug( "Add to history: " + getCompleteEdgeName( edge ) ); _history.add( (String)edge.getDest().getUserDatum( LABEL_KEY ) ); } } catch( GoBackToPreviousVertexException e ) { _logger.debug( "The edge: " + getCompleteEdgeName( edge ) + " can not be run due to unfullfilled conditions." ); _logger.debug( "Trying from vertex: " + (String)_prevVertex.getUserDatum( LABEL_KEY ) + " again." ); _rejectedEdge = edge; _nextVertex = _prevVertex; } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
throw new RuntimeException( "The methoden is not defined: " + method );
throw new RuntimeException( "The method is not defined: " + method );
private void invokeMethod( String method ) throws GoBackToPreviousVertexException { Class cls = _object.getClass(); try { if ( method.compareTo( "" ) != 0 ) { Method meth = cls.getMethod( method, null ); meth.invoke( _object, null ); } } catch( NoSuchMethodException e ) { _logger.error( e ); _logger.error( "Try to invoke method: " + method ); throw new RuntimeException( "The methoden is not defined: " + method ); } catch( java.lang.reflect.InvocationTargetException e ) { if ( e.getTargetException().getClass() == GoBackToPreviousVertexException.class ) { throw new GoBackToPreviousVertexException(); } _logger.error( e.getCause().getMessage() ); e.getCause().printStackTrace(); throw new RuntimeException( e.getCause().getMessage() ); } catch( Exception e ) { _logger.error( e ); e.printStackTrace(); throw new RuntimeException( "Abrupt end of execution: " + e.getMessage() ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private SparseGraph parseFile( String fileName ) { SparseGraph graph = new SparseGraph(); graph.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); try { _logger.info( "Parsing file: " + fileName ); _doc = _parser.build( fileName ); // Parse all vertices (nodes) Iterator iter = _doc.getDescendants( new ElementFilter( "node" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; if ( element.getAttributeValue( "yfiles.foldertype" ) != null ) { _logger.debug( "Excluded node: " + element.getAttributeValue( "yfiles.foldertype" ) ); continue; } _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "NodeLabel" ) ); while ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { Element nodeLabel = (Element)o2; _logger.debug( "Full name: " + nodeLabel.getQualifiedName() ); _logger.debug( "Name: " + nodeLabel.getTextTrim() ); DirectedSparseVertex v = (DirectedSparseVertex) graph.addVertex( new DirectedSparseVertex() ); v.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); v.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); v.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); String str = nodeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label; if ( m.find( )) { label = m.group( 1 ); v.addUserDatum( LABEL_KEY, label, UserData.SHARED ); } else { throw new RuntimeException( "Label must be defined." ); } _logger.debug( "Added node: " + v.getUserDatum( LABEL_KEY ) ); // If merge is defined, find it... // If defined, it means that the node will be merged with all other nodes wit the same name, // but not replaced by any subgraphs p = Pattern.compile( "(MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found MERGE for edge: " + label ); } // If no merge is defined, find it... // If defined, it means that when merging graphs, this specific vertex will not be merged // or replaced by any subgraphs p = Pattern.compile( "(NO_MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( NO_MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found NO_MERGE for edge: " + label ); } // NOTE: Only for html applications // In browsers, the usage of the 'Back'-button can be used. // If defined, with a value value, which depicts the probability for the edge // to be executed, tha back-button will be pressed in the browser. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(back=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find( ) ) { Float probability; String value = m.group( 2 ); try { probability = Float.valueOf( value.trim() ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", back is not a correct float value: " + error.toString() ); } v.addUserDatum( BACK_KEY, probability, UserData.SHARED ); } } } } } Object[] vertices = graph.getVertices().toArray(); // Parse all edges (arrows or transtitions) iter = _doc.getDescendants( new ElementFilter( "edge" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "EdgeLabel" ) ); Element edgeLabel = null; if ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { edgeLabel = (Element)o2; _logger.debug( "Full name: " + edgeLabel.getQualifiedName() ); _logger.debug( "Name: " + edgeLabel.getTextTrim() ); } } _logger.debug( "source: " + element.getAttributeValue( "source" ) ); _logger.debug( "target: " + element.getAttributeValue( "target" ) ); DirectedSparseVertex source = null; DirectedSparseVertex dest = null; for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)vertices[ i ]; // Find source vertex if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "source" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { source = vertex; } if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "target" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { dest = vertex; } } if ( source == null ) { String msg = "Could not find starting node for edge. Name: " + element.getAttributeValue( "source" ); _logger.error( msg ); throw new RuntimeException( msg ); } if ( dest == null ) { String msg = "Could not find end node for edge. Name: " + element.getAttributeValue( "target" ); _logger.error( msg ); throw new RuntimeException( msg ); } DirectedSparseEdge e = new DirectedSparseEdge( source, dest ); graph.addEdge( e ); e.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); e.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); if ( edgeLabel != null ) { String str = edgeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label = null; if ( m.find() ) { label = m.group( 1 ); e.addUserDatum( LABEL_KEY, label, UserData.SHARED ); _logger.debug( "Found label= " + label + " for edge id: " + edgeLabel.getQualifiedName() ); } else { throw new RuntimeException( "Label for edge must be defined." ); } // If weight is defined, find it... // weight must be associated with a value, which depicts the probability for the edge // to be executed. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(weight=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { Float weight; String value = m.group( 2 ); try { weight = Float.valueOf( value.trim() ); _logger.debug( "Found weight= " + weight + " for edge: " + label ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", weight is not a correct float value: " + error.toString() ); } e.addUserDatum( WEIGHT_KEY, weight, UserData.SHARED ); } // If No_history is defined, find it... // If defined, it means that when executing this edge, it shall not // be added to the history list of passed edgses. p = Pattern.compile( "(No_history)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { e.addUserDatum( NO_HISTORY, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found No_history for edge: " + label ); } // If condition used defined, find it... p = Pattern.compile( "(if: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); HashMap conditions = null; while ( m.find( ) ) { if ( conditions == null ) { conditions = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); conditions.put( variable, state ); _logger.debug( "Condition: " + variable + " = " + state ); } if ( conditions != null ) { e.addUserDatum( CONDITION_KEY, conditions, UserData.SHARED ); } // If state are defined, find them... HashMap states = null; p = Pattern.compile( "(state: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( states == null ) { states = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); states.put( variable, state ); _logger.debug( "State: " + variable + " = " + state ); } if ( states != null ) { e.addUserDatum( STATE_KEY, states, UserData.SHARED ); } // If string variables are defined, find them... HashMap variables = null; p = Pattern.compile( "(string: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); String variable = m.group( 3 ); variables.put( variableLabel, variable ); _logger.debug( "String variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(integer: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Integer variable = Integer.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Integer variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(float: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Float variable = Float.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Float variable: " + variableLabel + " = " + variable ); } if ( variables != null ) { e.addUserDatum( VARIABLE_KEY, variables, UserData.SHARED ); } } e.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); _logger.debug( "Adderade edge: \"" + e.getUserDatum( LABEL_KEY ) + "\"" ); } } } catch ( JDOMException e ) { _logger.error( e ); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } catch ( IOException e ) { e.printStackTrace(); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } return graph; }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private SparseGraph parseFile( String fileName ) { SparseGraph graph = new SparseGraph(); graph.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); try { _logger.info( "Parsing file: " + fileName ); _doc = _parser.build( fileName ); // Parse all vertices (nodes) Iterator iter = _doc.getDescendants( new ElementFilter( "node" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; if ( element.getAttributeValue( "yfiles.foldertype" ) != null ) { _logger.debug( "Excluded node: " + element.getAttributeValue( "yfiles.foldertype" ) ); continue; } _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "NodeLabel" ) ); while ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { Element nodeLabel = (Element)o2; _logger.debug( "Full name: " + nodeLabel.getQualifiedName() ); _logger.debug( "Name: " + nodeLabel.getTextTrim() ); DirectedSparseVertex v = (DirectedSparseVertex) graph.addVertex( new DirectedSparseVertex() ); v.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); v.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); v.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); String str = nodeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label; if ( m.find( )) { label = m.group( 1 ); v.addUserDatum( LABEL_KEY, label, UserData.SHARED ); } else { throw new RuntimeException( "Label must be defined." ); } _logger.debug( "Added node: " + v.getUserDatum( LABEL_KEY ) ); // If merge is defined, find it... // If defined, it means that the node will be merged with all other nodes wit the same name, // but not replaced by any subgraphs p = Pattern.compile( "(MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found MERGE for edge: " + label ); } // If no merge is defined, find it... // If defined, it means that when merging graphs, this specific vertex will not be merged // or replaced by any subgraphs p = Pattern.compile( "(NO_MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( NO_MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found NO_MERGE for edge: " + label ); } // NOTE: Only for html applications // In browsers, the usage of the 'Back'-button can be used. // If defined, with a value value, which depicts the probability for the edge // to be executed, tha back-button will be pressed in the browser. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(back=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find( ) ) { Float probability; String value = m.group( 2 ); try { probability = Float.valueOf( value.trim() ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", back is not a correct float value: " + error.toString() ); } v.addUserDatum( BACK_KEY, probability, UserData.SHARED ); } } } } } Object[] vertices = graph.getVertices().toArray(); // Parse all edges (arrows or transtitions) iter = _doc.getDescendants( new ElementFilter( "edge" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "EdgeLabel" ) ); Element edgeLabel = null; if ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { edgeLabel = (Element)o2; _logger.debug( "Full name: " + edgeLabel.getQualifiedName() ); _logger.debug( "Name: " + edgeLabel.getTextTrim() ); } } _logger.debug( "source: " + element.getAttributeValue( "source" ) ); _logger.debug( "target: " + element.getAttributeValue( "target" ) ); DirectedSparseVertex source = null; DirectedSparseVertex dest = null; for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)vertices[ i ]; // Find source vertex if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "source" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { source = vertex; } if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "target" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { dest = vertex; } } if ( source == null ) { String msg = "Could not find starting node for edge. Name: " + element.getAttributeValue( "source" ); _logger.error( msg ); throw new RuntimeException( msg ); } if ( dest == null ) { String msg = "Could not find end node for edge. Name: " + element.getAttributeValue( "target" ); _logger.error( msg ); throw new RuntimeException( msg ); } DirectedSparseEdge e = new DirectedSparseEdge( source, dest ); graph.addEdge( e ); e.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); e.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); if ( edgeLabel != null ) { String str = edgeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label = null; if ( m.find() ) { label = m.group( 1 ); e.addUserDatum( LABEL_KEY, label, UserData.SHARED ); _logger.debug( "Found label= " + label + " for edge id: " + edgeLabel.getQualifiedName() ); } else { throw new RuntimeException( "Label for edge must be defined." ); } // If weight is defined, find it... // weight must be associated with a value, which depicts the probability for the edge // to be executed. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(weight=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { Float weight; String value = m.group( 2 ); try { weight = Float.valueOf( value.trim() ); _logger.debug( "Found weight= " + weight + " for edge: " + label ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", weight is not a correct float value: " + error.toString() ); } e.addUserDatum( WEIGHT_KEY, weight, UserData.SHARED ); } // If No_history is defined, find it... // If defined, it means that when executing this edge, it shall not // be added to the history list of passed edgses. p = Pattern.compile( "(No_history)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { e.addUserDatum( NO_HISTORY, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found No_history for edge: " + label ); } // If condition used defined, find it... p = Pattern.compile( "(if: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); HashMap conditions = null; while ( m.find( ) ) { if ( conditions == null ) { conditions = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); conditions.put( variable, state ); _logger.debug( "Condition: " + variable + " = " + state ); } if ( conditions != null ) { e.addUserDatum( CONDITION_KEY, conditions, UserData.SHARED ); } // If state are defined, find them... HashMap states = null; p = Pattern.compile( "(state: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( states == null ) { states = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); states.put( variable, state ); _logger.debug( "State: " + variable + " = " + state ); } if ( states != null ) { e.addUserDatum( STATE_KEY, states, UserData.SHARED ); } // If string variables are defined, find them... HashMap variables = null; p = Pattern.compile( "(string: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); String variable = m.group( 3 ); variables.put( variableLabel, variable ); _logger.debug( "String variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(integer: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Integer variable = Integer.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Integer variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(float: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Float variable = Float.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Float variable: " + variableLabel + " = " + variable ); } if ( variables != null ) { e.addUserDatum( VARIABLE_KEY, variables, UserData.SHARED ); } } e.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); _logger.debug( "Adderade edge: \"" + e.getUserDatum( LABEL_KEY ) + "\"" ); } } } catch ( JDOMException e ) { _logger.error( e ); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } catch ( IOException e ) { e.printStackTrace(); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } return graph; }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private SparseGraph parseFile( String fileName ) { SparseGraph graph = new SparseGraph(); graph.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); try { _logger.info( "Parsing file: " + fileName ); _doc = _parser.build( fileName ); // Parse all vertices (nodes) Iterator iter = _doc.getDescendants( new ElementFilter( "node" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; if ( element.getAttributeValue( "yfiles.foldertype" ) != null ) { _logger.debug( "Excluded node: " + element.getAttributeValue( "yfiles.foldertype" ) ); continue; } _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "NodeLabel" ) ); while ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { Element nodeLabel = (Element)o2; _logger.debug( "Full name: " + nodeLabel.getQualifiedName() ); _logger.debug( "Name: " + nodeLabel.getTextTrim() ); DirectedSparseVertex v = (DirectedSparseVertex) graph.addVertex( new DirectedSparseVertex() ); v.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); v.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); v.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); String str = nodeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label; if ( m.find( )) { label = m.group( 1 ); v.addUserDatum( LABEL_KEY, label, UserData.SHARED ); } else { throw new RuntimeException( "Label must be defined." ); } _logger.debug( "Added node: " + v.getUserDatum( LABEL_KEY ) ); // If merge is defined, find it... // If defined, it means that the node will be merged with all other nodes wit the same name, // but not replaced by any subgraphs p = Pattern.compile( "(MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found MERGE for edge: " + label ); } // If no merge is defined, find it... // If defined, it means that when merging graphs, this specific vertex will not be merged // or replaced by any subgraphs p = Pattern.compile( "(NO_MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( NO_MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found NO_MERGE for edge: " + label ); } // NOTE: Only for html applications // In browsers, the usage of the 'Back'-button can be used. // If defined, with a value value, which depicts the probability for the edge // to be executed, tha back-button will be pressed in the browser. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(back=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find( ) ) { Float probability; String value = m.group( 2 ); try { probability = Float.valueOf( value.trim() ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", back is not a correct float value: " + error.toString() ); } v.addUserDatum( BACK_KEY, probability, UserData.SHARED ); } } } } } Object[] vertices = graph.getVertices().toArray(); // Parse all edges (arrows or transtitions) iter = _doc.getDescendants( new ElementFilter( "edge" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "EdgeLabel" ) ); Element edgeLabel = null; if ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { edgeLabel = (Element)o2; _logger.debug( "Full name: " + edgeLabel.getQualifiedName() ); _logger.debug( "Name: " + edgeLabel.getTextTrim() ); } } _logger.debug( "source: " + element.getAttributeValue( "source" ) ); _logger.debug( "target: " + element.getAttributeValue( "target" ) ); DirectedSparseVertex source = null; DirectedSparseVertex dest = null; for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)vertices[ i ]; // Find source vertex if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "source" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { source = vertex; } if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "target" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { dest = vertex; } } if ( source == null ) { String msg = "Could not find starting node for edge. Name: " + element.getAttributeValue( "source" ); _logger.error( msg ); throw new RuntimeException( msg ); } if ( dest == null ) { String msg = "Could not find end node for edge. Name: " + element.getAttributeValue( "target" ); _logger.error( msg ); throw new RuntimeException( msg ); } DirectedSparseEdge e = new DirectedSparseEdge( source, dest ); graph.addEdge( e ); e.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); e.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); if ( edgeLabel != null ) { String str = edgeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label = null; if ( m.find() ) { label = m.group( 1 ); e.addUserDatum( LABEL_KEY, label, UserData.SHARED ); _logger.debug( "Found label= " + label + " for edge id: " + edgeLabel.getQualifiedName() ); } else { throw new RuntimeException( "Label for edge must be defined." ); } // If weight is defined, find it... // weight must be associated with a value, which depicts the probability for the edge // to be executed. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(weight=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { Float weight; String value = m.group( 2 ); try { weight = Float.valueOf( value.trim() ); _logger.debug( "Found weight= " + weight + " for edge: " + label ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", weight is not a correct float value: " + error.toString() ); } e.addUserDatum( WEIGHT_KEY, weight, UserData.SHARED ); } // If No_history is defined, find it... // If defined, it means that when executing this edge, it shall not // be added to the history list of passed edgses. p = Pattern.compile( "(No_history)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { e.addUserDatum( NO_HISTORY, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found No_history for edge: " + label ); } // If condition used defined, find it... p = Pattern.compile( "(if: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); HashMap conditions = null; while ( m.find( ) ) { if ( conditions == null ) { conditions = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); conditions.put( variable, state ); _logger.debug( "Condition: " + variable + " = " + state ); } if ( conditions != null ) { e.addUserDatum( CONDITION_KEY, conditions, UserData.SHARED ); } // If state are defined, find them... HashMap states = null; p = Pattern.compile( "(state: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( states == null ) { states = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); states.put( variable, state ); _logger.debug( "State: " + variable + " = " + state ); } if ( states != null ) { e.addUserDatum( STATE_KEY, states, UserData.SHARED ); } // If string variables are defined, find them... HashMap variables = null; p = Pattern.compile( "(string: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); String variable = m.group( 3 ); variables.put( variableLabel, variable ); _logger.debug( "String variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(integer: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Integer variable = Integer.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Integer variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(float: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Float variable = Float.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Float variable: " + variableLabel + " = " + variable ); } if ( variables != null ) { e.addUserDatum( VARIABLE_KEY, variables, UserData.SHARED ); } } e.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); _logger.debug( "Adderade edge: \"" + e.getUserDatum( LABEL_KEY ) + "\"" ); } } } catch ( JDOMException e ) { _logger.error( e ); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } catch ( IOException e ) { e.printStackTrace(); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } return graph; }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
private SparseGraph parseFile( String fileName ) { SparseGraph graph = new SparseGraph(); graph.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); try { _logger.info( "Parsing file: " + fileName ); _doc = _parser.build( fileName ); // Parse all vertices (nodes) Iterator iter = _doc.getDescendants( new ElementFilter( "node" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; if ( element.getAttributeValue( "yfiles.foldertype" ) != null ) { _logger.debug( "Excluded node: " + element.getAttributeValue( "yfiles.foldertype" ) ); continue; } _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "NodeLabel" ) ); while ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { Element nodeLabel = (Element)o2; _logger.debug( "Full name: " + nodeLabel.getQualifiedName() ); _logger.debug( "Name: " + nodeLabel.getTextTrim() ); DirectedSparseVertex v = (DirectedSparseVertex) graph.addVertex( new DirectedSparseVertex() ); v.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); v.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); v.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); String str = nodeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label; if ( m.find( )) { label = m.group( 1 ); v.addUserDatum( LABEL_KEY, label, UserData.SHARED ); } else { throw new RuntimeException( "Label must be defined." ); } _logger.debug( "Added node: " + v.getUserDatum( LABEL_KEY ) ); // If merge is defined, find it... // If defined, it means that the node will be merged with all other nodes wit the same name, // but not replaced by any subgraphs p = Pattern.compile( "(MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found MERGE for edge: " + label ); } // If no merge is defined, find it... // If defined, it means that when merging graphs, this specific vertex will not be merged // or replaced by any subgraphs p = Pattern.compile( "(NO_MERGE)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { v.addUserDatum( NO_MERGE, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found NO_MERGE for edge: " + label ); } // NOTE: Only for html applications // In browsers, the usage of the 'Back'-button can be used. // If defined, with a value value, which depicts the probability for the edge // to be executed, tha back-button will be pressed in the browser. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(back=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find( ) ) { Float probability; String value = m.group( 2 ); try { probability = Float.valueOf( value.trim() ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", back is not a correct float value: " + error.toString() ); } v.addUserDatum( BACK_KEY, probability, UserData.SHARED ); } } } } } Object[] vertices = graph.getVertices().toArray(); // Parse all edges (arrows or transtitions) iter = _doc.getDescendants( new ElementFilter( "edge" ) ); while ( iter.hasNext() ) { Object o = iter.next(); if ( o instanceof Element ) { Element element = (Element)o; _logger.debug( "id: " + element.getAttributeValue( "id" ) ); Iterator iter2 = element.getDescendants( new ElementFilter( "EdgeLabel" ) ); Element edgeLabel = null; if ( iter2.hasNext() ) { Object o2 = iter2.next(); if ( o2 instanceof Element ) { edgeLabel = (Element)o2; _logger.debug( "Full name: " + edgeLabel.getQualifiedName() ); _logger.debug( "Name: " + edgeLabel.getTextTrim() ); } } _logger.debug( "source: " + element.getAttributeValue( "source" ) ); _logger.debug( "target: " + element.getAttributeValue( "target" ) ); DirectedSparseVertex source = null; DirectedSparseVertex dest = null; for ( int i = 0; i < vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)vertices[ i ]; // Find source vertex if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "source" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { source = vertex; } if ( vertex.getUserDatum( ID_KEY ).equals( element.getAttributeValue( "target" ) ) && vertex.getUserDatum( FILE_KEY ).equals( fileName ) ) { dest = vertex; } } if ( source == null ) { String msg = "Could not find starting node for edge. Name: " + element.getAttributeValue( "source" ); _logger.error( msg ); throw new RuntimeException( msg ); } if ( dest == null ) { String msg = "Could not find end node for edge. Name: " + element.getAttributeValue( "target" ); _logger.error( msg ); throw new RuntimeException( msg ); } DirectedSparseEdge e = new DirectedSparseEdge( source, dest ); graph.addEdge( e ); e.addUserDatum( ID_KEY, element.getAttributeValue( "id" ), UserData.SHARED ); e.addUserDatum( FILE_KEY, fileName, UserData.SHARED ); if ( edgeLabel != null ) { String str = edgeLabel.getTextTrim(); Pattern p = Pattern.compile( "(.*)", Pattern.MULTILINE ); Matcher m = p.matcher( str ); String label = null; if ( m.find() ) { label = m.group( 1 ); e.addUserDatum( LABEL_KEY, label, UserData.SHARED ); _logger.debug( "Found label= " + label + " for edge id: " + edgeLabel.getQualifiedName() ); } else { throw new RuntimeException( "Label for edge must be defined." ); } // If weight is defined, find it... // weight must be associated with a value, which depicts the probability for the edge // to be executed. // A value of 0.05 is the same as 5% chance of going down this road. p = Pattern.compile( "(weight=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { Float weight; String value = m.group( 2 ); try { weight = Float.valueOf( value.trim() ); _logger.debug( "Found weight= " + weight + " for edge: " + label ); } catch ( NumberFormatException error ) { throw new RuntimeException( "For label: " + label + ", weight is not a correct float value: " + error.toString() ); } e.addUserDatum( WEIGHT_KEY, weight, UserData.SHARED ); } // If No_history is defined, find it... // If defined, it means that when executing this edge, it shall not // be added to the history list of passed edgses. p = Pattern.compile( "(No_history)", Pattern.MULTILINE ); m = p.matcher( str ); if ( m.find() ) { e.addUserDatum( NO_HISTORY, m.group( 1 ), UserData.SHARED ); _logger.debug( "Found No_history for edge: " + label ); } // If condition used defined, find it... p = Pattern.compile( "(if: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); HashMap conditions = null; while ( m.find( ) ) { if ( conditions == null ) { conditions = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); conditions.put( variable, state ); _logger.debug( "Condition: " + variable + " = " + state ); } if ( conditions != null ) { e.addUserDatum( CONDITION_KEY, conditions, UserData.SHARED ); } // If state are defined, find them... HashMap states = null; p = Pattern.compile( "(state: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( states == null ) { states = new HashMap(); } String variable = m.group( 2 ); Boolean state = Boolean.valueOf( m.group( 3 ) ); states.put( variable, state ); _logger.debug( "State: " + variable + " = " + state ); } if ( states != null ) { e.addUserDatum( STATE_KEY, states, UserData.SHARED ); } // If string variables are defined, find them... HashMap variables = null; p = Pattern.compile( "(string: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); String variable = m.group( 3 ); variables.put( variableLabel, variable ); _logger.debug( "String variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(integer: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Integer variable = Integer.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Integer variable: " + variableLabel + " = " + variable ); } // If integer variables are defined, find them... p = Pattern.compile( "(float: (.*)=(.*))", Pattern.MULTILINE ); m = p.matcher( str ); while ( m.find( ) ) { if ( variables == null ) { variables = new HashMap(); } String variableLabel = m.group( 2 ); Float variable = Float.valueOf( m.group( 3 ) ); variables.put( variableLabel, variable ); _logger.debug( "Float variable: " + variableLabel + " = " + variable ); } if ( variables != null ) { e.addUserDatum( VARIABLE_KEY, variables, UserData.SHARED ); } } e.addUserDatum( VISITED_KEY, new Integer( 0 ), UserData.SHARED ); _logger.debug( "Adderade edge: \"" + e.getUserDatum( LABEL_KEY ) + "\"" ); } } } catch ( JDOMException e ) { _logger.error( e ); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } catch ( IOException e ) { e.printStackTrace(); throw new RuntimeException( "Kunde inte skanna filen: " + fileName ); } return graph; }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); )
for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); )
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
} catch (IOException e)
} catch (IOException e)
public void writeGraph( String mergedGraphml_ ) { StringBuffer sourceFile = new StringBuffer(); try { FileWriter file = new FileWriter( mergedGraphml_ ); sourceFile.append( "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ); sourceFile.append( "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns/graphml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n" ); sourceFile.append( " <key id=\"d0\" for=\"node\" yfiles.type=\"nodegraphics\"/>\n" ); sourceFile.append( " <key id=\"d1\" for=\"edge\" yfiles.type=\"edgegraphics\"/>\n" ); sourceFile.append( " <graph id=\"G\" edgedefault=\"directed\">\n" ); int numVertices = _graph.getVertices().size(); Indexer id = Indexer.getAndUpdateIndexer( _graph ); for ( int i = 0; i < numVertices; i++ ) { Vertex v = (Vertex) id.getVertex(i); int vId = i+1; sourceFile.append( " <node id=\"n" + vId + "\">\n" ); sourceFile.append( " <data key=\"d0\" >\n" ); sourceFile.append( " <y:ShapeNode >\n" ); sourceFile.append( " <y:Geometry x=\"241.875\" y=\"158.701171875\" width=\"95.0\" height=\"30.0\"/>\n" ); sourceFile.append( " <y:Fill color=\"#CCCCFF\" transparent=\"false\"/>\n" ); sourceFile.append( " <y:BorderStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:NodeLabel x=\"1.5\" y=\"5.6494140625\" width=\"92.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"internal\" modelPosition=\"c\" autoSizePolicy=\"content\">" + v.getUserDatum( LABEL_KEY ) + "</y:NodeLabel>\n" ); sourceFile.append( " <y:Shape type=\"rectangle\"/>\n" ); sourceFile.append( " </y:ShapeNode>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </node>\n" ); } int i = 0; for ( Iterator edgeIterator = _graph.getEdges().iterator(); edgeIterator.hasNext(); ) { Edge e = (Edge) edgeIterator.next(); Pair p = e.getEndpoints(); Vertex src = (Vertex) p.getFirst(); Vertex dest = (Vertex) p.getSecond(); int srcId = id.getIndex(src)+1; int destId = id.getIndex(dest)+1; int nId = ++i; sourceFile.append( " <edge id=\"" + nId + "\" source=\"n" + srcId + "\" target=\"n" + destId + "\">\n" ); sourceFile.append( " <data key=\"d1\" >\n" ); sourceFile.append( " <y:PolyLineEdge >\n" ); sourceFile.append( " <y:Path sx=\"-23.75\" sy=\"15.0\" tx=\"-23.75\" ty=\"-15.0\">\n" ); sourceFile.append( " <y:Point x=\"273.3125\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"95.0\"/>\n" ); sourceFile.append( " <y:Point x=\"209.5625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " <y:Point x=\"265.625\" y=\"143.701171875\"/>\n" ); sourceFile.append( " </y:Path>\n" ); sourceFile.append( " <y:LineStyle type=\"line\" width=\"1.0\" color=\"#000000\" />\n" ); sourceFile.append( " <y:Arrows source=\"none\" target=\"standard\"/>\n" ); sourceFile.append( " <y:EdgeLabel x=\"-148.25\" y=\"30.000000000000014\" width=\"169.0\" height=\"18.701171875\" visible=\"true\" alignment=\"center\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" textColor=\"#000000\" modelName=\"free\" modelPosition=\"anywhere\" preferredPlacement=\"on_edge\" distance=\"2.0\" ratio=\"0.5\">" + e.getUserDatum( LABEL_KEY ) + "</y:EdgeLabel>\n" ); sourceFile.append( " <y:BendStyle smoothed=\"false\"/>\n" ); sourceFile.append( " </y:PolyLineEdge>\n" ); sourceFile.append( " </data>\n" ); sourceFile.append( " </edge>\n" ); } sourceFile.append( " </graph>\n" ); sourceFile.append( "</graphml>\n" ); file.write( sourceFile.toString() ); file.flush(); _logger.info( "Wrote: " + mergedGraphml_ ); } catch (IOException e) { e.printStackTrace(); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/4d22840dae349fccc763d621c45be8eacebe533e/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row);
if (comp.getUserObject() instanceof Widget) { Class<? extends Component> type = ((Widget)comp.getUserObject()).getType(); if (type == TabSheet.class) comp = ((TabFolder)comp).getChildren().get(((TabFolder)comp).getCurrentIndex()); for (Property prop : Property.values()) { if (prop.isValidFor(type) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop.getValue(comp)); row.add(prop); gb.getRows().add(row); }
PropertyTabSheet(final Panel panel, final boolean styleProperties) { super(styleProperties ? "Styles" : "Properties"); final GridBox gb = initGridBox(); gb.setPosition(GAP, GAP); final Divider div = new Divider(); div.setX(GAP); div.setHeight(6); final Label lbl = new Label("Edit Property Value:"); lbl.setAlignX(AlignX.RIGHT); lbl.setX(GAP); lbl.setHeight(EDITOR_HEIGHT); editor = defaultEditor = new TextField(); editor.setVisible(false); editor.setHeight(EDITOR_HEIGHT); final Button b = new Button("Apply"); b.setEnabled(false); b.setSize(90, EDITOR_HEIGHT); b.setStandard(true); addPropertyChangeListener(Main.SIZE_ARY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { if (getInnerHeight() > 20 && getInnerWidth() > 20) { gb.setSize(getInnerWidth() - GAP * 2, getInnerHeight() - GAP * 2 - div.getHeight() - editor.getHeight()); div.setY(gb.getY() + gb.getHeight()); div.setWidth(gb.getWidth()); int y = div.getY() + div.getHeight(); lbl.setY(y); int width = (gb.getWidth() - GAP * 4 - b.getWidth()) / 2; lbl.setWidth(width); editor.setPosition(lbl.getX() + lbl.getWidth() + GAP, y); editor.setWidth(width); b.setPosition(editor.getX() + editor.getWidth() + GAP, y); } } }); gb.addPropertyChangeListener(GridBox.Row.PROPERTY_ROW_SELECTED, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { GridBox.Row row = gb.getSelectedRow(); editor.setVisible(false); MaskEditorComponent ed; String value; if (row == null) { ed = defaultEditor; value = ""; b.setEnabled(false); } else { Property prop = (Property)row.get(COL_PROPERTY); ed = propToEditor.get(prop); if (ed == null) propToEditor.put(prop, ed = prop.newEditor()); value = row.get(COL_VALUE).toString(); b.setEnabled(true); } ed.setBounds(editor.getX(), editor.getY(), editor.getWidth(), editor.getHeight()); ed.setText(value); ed.setVisible(true); if (ed.getParent() == null) { int index = getChildren().indexOf(b); getChildren().add(index, ed); } editor = ed; } }); b.addActionListener(Button.ACTION_CLICK, new ActionListener() { public void actionPerformed(ActionEvent ev) { GridBox.Row row = gb.getSelectedRow(); if (row != null) { row.set(COL_VALUE, editor.getText()); Property prop = (Property)row.get(COL_PROPERTY); if (prop != null && panel.getChildren().size() > 0) { for (int i = 0, cnt = panel.getChildren().size(); i < cnt; i++) { Component comp = panel.getChildren().get(i); String name = prop.getName(); if (comp instanceof RadioButton) { String value = editor.getText(); if (i > 0 && name.equals(RadioButton.PROPERTY_CHECKED)) continue; else if (name.equals(TextComponent.PROPERTY_TEXT)) value += (i + 1); else if (name.equals(Component.PROPERTY_X) || name.equals(name.equals(Component.PROPERTY_Y))) { int oldValue = (Integer)prop.getValue(comp); oldValue += Integer.parseInt(value) - oldValue; value = String.valueOf(oldValue); } prop.setValue(comp, value); } else { prop.setValue(comp, editor.getText()); } } } } } }); panel.addItemChangeListener(new ItemChangeListener() { public void itemChange(ItemChangeEvent ev) { if (ev.getType() == ItemChangeEvent.Type.ADD && panel.getChildren().size() == 1) { gb.getRows().clear(); Component comp = panel.getChildren().get(0); for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row); } } } } }); getChildren().add(gb); getChildren().add(div); getChildren().add(lbl); getChildren().add(editor); getChildren().add(b); }
57467 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57467/7e6fa19b43f70aafed5df473b8b0f919b6d0b6c8/PropertyTabSheet.java/clean/src/thinwire/apps/playground/PropertyTabSheet.java
}
}
PropertyTabSheet(final Panel panel, final boolean styleProperties) { super(styleProperties ? "Styles" : "Properties"); final GridBox gb = initGridBox(); gb.setPosition(GAP, GAP); final Divider div = new Divider(); div.setX(GAP); div.setHeight(6); final Label lbl = new Label("Edit Property Value:"); lbl.setAlignX(AlignX.RIGHT); lbl.setX(GAP); lbl.setHeight(EDITOR_HEIGHT); editor = defaultEditor = new TextField(); editor.setVisible(false); editor.setHeight(EDITOR_HEIGHT); final Button b = new Button("Apply"); b.setEnabled(false); b.setSize(90, EDITOR_HEIGHT); b.setStandard(true); addPropertyChangeListener(Main.SIZE_ARY, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { if (getInnerHeight() > 20 && getInnerWidth() > 20) { gb.setSize(getInnerWidth() - GAP * 2, getInnerHeight() - GAP * 2 - div.getHeight() - editor.getHeight()); div.setY(gb.getY() + gb.getHeight()); div.setWidth(gb.getWidth()); int y = div.getY() + div.getHeight(); lbl.setY(y); int width = (gb.getWidth() - GAP * 4 - b.getWidth()) / 2; lbl.setWidth(width); editor.setPosition(lbl.getX() + lbl.getWidth() + GAP, y); editor.setWidth(width); b.setPosition(editor.getX() + editor.getWidth() + GAP, y); } } }); gb.addPropertyChangeListener(GridBox.Row.PROPERTY_ROW_SELECTED, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { GridBox.Row row = gb.getSelectedRow(); editor.setVisible(false); MaskEditorComponent ed; String value; if (row == null) { ed = defaultEditor; value = ""; b.setEnabled(false); } else { Property prop = (Property)row.get(COL_PROPERTY); ed = propToEditor.get(prop); if (ed == null) propToEditor.put(prop, ed = prop.newEditor()); value = row.get(COL_VALUE).toString(); b.setEnabled(true); } ed.setBounds(editor.getX(), editor.getY(), editor.getWidth(), editor.getHeight()); ed.setText(value); ed.setVisible(true); if (ed.getParent() == null) { int index = getChildren().indexOf(b); getChildren().add(index, ed); } editor = ed; } }); b.addActionListener(Button.ACTION_CLICK, new ActionListener() { public void actionPerformed(ActionEvent ev) { GridBox.Row row = gb.getSelectedRow(); if (row != null) { row.set(COL_VALUE, editor.getText()); Property prop = (Property)row.get(COL_PROPERTY); if (prop != null && panel.getChildren().size() > 0) { for (int i = 0, cnt = panel.getChildren().size(); i < cnt; i++) { Component comp = panel.getChildren().get(i); String name = prop.getName(); if (comp instanceof RadioButton) { String value = editor.getText(); if (i > 0 && name.equals(RadioButton.PROPERTY_CHECKED)) continue; else if (name.equals(TextComponent.PROPERTY_TEXT)) value += (i + 1); else if (name.equals(Component.PROPERTY_X) || name.equals(name.equals(Component.PROPERTY_Y))) { int oldValue = (Integer)prop.getValue(comp); oldValue += Integer.parseInt(value) - oldValue; value = String.valueOf(oldValue); } prop.setValue(comp, value); } else { prop.setValue(comp, editor.getText()); } } } } } }); panel.addItemChangeListener(new ItemChangeListener() { public void itemChange(ItemChangeEvent ev) { if (ev.getType() == ItemChangeEvent.Type.ADD && panel.getChildren().size() == 1) { gb.getRows().clear(); Component comp = panel.getChildren().get(0); for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row); } } } } }); getChildren().add(gb); getChildren().add(div); getChildren().add(lbl); getChildren().add(editor); getChildren().add(b); }
57467 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57467/7e6fa19b43f70aafed5df473b8b0f919b6d0b6c8/PropertyTabSheet.java/clean/src/thinwire/apps/playground/PropertyTabSheet.java
Class<? extends Component> type = ((Widget)comp.getUserObject()).getType(); if (type == TabSheet.class) comp = ((TabFolder)comp).getChildren().get(((TabFolder)comp).getCurrentIndex());
public void actionPerformed(ActionEvent ev) { GridBox.Row row = gb.getSelectedRow(); if (row != null) { row.set(COL_VALUE, editor.getText()); Property prop = (Property)row.get(COL_PROPERTY); if (prop != null && panel.getChildren().size() > 0) { for (int i = 0, cnt = panel.getChildren().size(); i < cnt; i++) { Component comp = panel.getChildren().get(i); String name = prop.getName(); if (comp instanceof RadioButton) { String value = editor.getText(); if (i > 0 && name.equals(RadioButton.PROPERTY_CHECKED)) continue; else if (name.equals(TextComponent.PROPERTY_TEXT)) value += (i + 1); else if (name.equals(Component.PROPERTY_X) || name.equals(name.equals(Component.PROPERTY_Y))) { int oldValue = (Integer)prop.getValue(comp); oldValue += Integer.parseInt(value) - oldValue; value = String.valueOf(oldValue); } prop.setValue(comp, value); } else { prop.setValue(comp, editor.getText()); } } } } }
57467 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57467/7e6fa19b43f70aafed5df473b8b0f919b6d0b6c8/PropertyTabSheet.java/clean/src/thinwire/apps/playground/PropertyTabSheet.java
for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row);
if (comp.getUserObject() instanceof Widget) { Class<? extends Component> type = ((Widget)comp.getUserObject()).getType(); if (type == TabSheet.class) comp = ((TabFolder)comp).getChildren().get(((TabFolder)comp).getCurrentIndex()); for (Property prop : Property.values()) { if (prop.isValidFor(type) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop.getValue(comp)); row.add(prop); gb.getRows().add(row); }
public void itemChange(ItemChangeEvent ev) { if (ev.getType() == ItemChangeEvent.Type.ADD && panel.getChildren().size() == 1) { gb.getRows().clear(); Component comp = panel.getChildren().get(0); for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row); } } } }
57467 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57467/7e6fa19b43f70aafed5df473b8b0f919b6d0b6c8/PropertyTabSheet.java/clean/src/thinwire/apps/playground/PropertyTabSheet.java
}
}
public void itemChange(ItemChangeEvent ev) { if (ev.getType() == ItemChangeEvent.Type.ADD && panel.getChildren().size() == 1) { gb.getRows().clear(); Component comp = panel.getChildren().get(0); for (Property prop : Property.values()) { if (prop.isValidFor(comp) && prop.isStyleProperty() == styleProperties) { GridBox.Row row = new GridBox.Row(); row.add(Main.getSimpleClassName(prop.getType()).replace('$', '.')); row.add(prop.getName()); row.add(prop.getDefaultValue(comp)); row.add(prop == Property.FX_VISIBLE_CHANGE ? FX.Type.NONE : prop.getValue(comp)); row.add(prop); gb.getRows().add(row); } } } }
57467 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57467/7e6fa19b43f70aafed5df473b8b0f919b6d0b6c8/PropertyTabSheet.java/clean/src/thinwire/apps/playground/PropertyTabSheet.java
if (this.pathMatches((String) this.pathComboBox.getSelectedItem())) { return true; }
return this.pathMatches((String) this.pathComboBox.getSelectedItem());
public boolean autodetect() { Vector items = new Vector(); /* * Check if the user has entered data into the ComboBox and add it to the Itemlist */ String selected = (String) this.pathComboBox.getSelectedItem(); if (selected == null) { return false; } boolean found = false; for (int x = 0; x < this.pathComboBox.getItemCount(); x++) { if (((String) this.pathComboBox.getItemAt(x)).equals(selected)) { found = true; } } if (!found) { // System.out.println("Not found in Itemlist"); this.pathComboBox.addItem(this.pathComboBox.getSelectedItem()); } // Checks whether a placeholder item is in the combobox // and resolve the pathes automatically: // /usr/lib/* searches all folders in usr/lib to find // /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String) this.pathComboBox.getItemAt(i); if (path.endsWith("*")) { path = path.substring(0, path.length() - 1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x = 0; x < subdirs.length; x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches(search)) { items.add(search); } } } } else { if (this.pathMatches(path)) { items.add(path); } } } // Make the enties in the vector unique items = new Vector(new HashSet(items)); // Now clear the combobox and add the items out of the newly // generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i = 0; i < items.size(); i++) { this.pathComboBox.addItem(vs.substitute((String) items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String) this.pathComboBox.getItemAt(i); if (this.pathMatches(path)) { this.pathComboBox.setSelectedIndex(i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches((String) this.pathComboBox.getSelectedItem())) { return true; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
return false;
public boolean autodetect() { Vector items = new Vector(); /* * Check if the user has entered data into the ComboBox and add it to the Itemlist */ String selected = (String) this.pathComboBox.getSelectedItem(); if (selected == null) { return false; } boolean found = false; for (int x = 0; x < this.pathComboBox.getItemCount(); x++) { if (((String) this.pathComboBox.getItemAt(x)).equals(selected)) { found = true; } } if (!found) { // System.out.println("Not found in Itemlist"); this.pathComboBox.addItem(this.pathComboBox.getSelectedItem()); } // Checks whether a placeholder item is in the combobox // and resolve the pathes automatically: // /usr/lib/* searches all folders in usr/lib to find // /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String) this.pathComboBox.getItemAt(i); if (path.endsWith("*")) { path = path.substring(0, path.length() - 1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x = 0; x < subdirs.length; x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches(search)) { items.add(search); } } } } else { if (this.pathMatches(path)) { items.add(path); } } } // Make the enties in the vector unique items = new Vector(new HashSet(items)); // Now clear the combobox and add the items out of the newly // generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i = 0; i < items.size(); i++) { this.pathComboBox.addItem(vs.substitute((String) items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String) this.pathComboBox.getItemAt(i); if (this.pathMatches(path)) { this.pathComboBox.setSelectedIndex(i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches((String) this.pathComboBox.getSelectedItem())) { return true; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
layout = new TwoColumnLayout(10, 5, 30, 25, TwoColumnLayout.LEFT);
TwoColumnLayout layout = new TwoColumnLayout(10, 5, 30, 25, TwoColumnLayout.LEFT);
public UserInputPanel(InstallerFrame parent, InstallData installData) { super(parent, installData); instanceNumber = instanceCount++; this.parentFrame = parent; // ---------------------------------------------------- // ---------------------------------------------------- layout = new TwoColumnLayout(10, 5, 30, 25, TwoColumnLayout.LEFT); setLayout(layout); // ---------------------------------------------------- // get a locale database // ---------------------------------------------------- try { // this.langpack = parent.langpack; String resource = LANG_FILE_NAME + "_" + idata.localeISO3; this.langpack = new LocaleDatabase(ResourceManager.getInstance().getInputStream( resource)); } catch (Throwable exception) {} // ---------------------------------------------------- // read the specifications // ---------------------------------------------------- try { readSpec(); } catch (Throwable exception) { // log the problem exception.printStackTrace(); } if (!haveSpec) { // return if we could not read the spec. further // processing will only lead to problems. In this // case we must skip the panel when it gets activated. return; } // ---------------------------------------------------- // process all field nodes. Each field node is analyzed // for its type, then an appropriate memeber function // is called that will create the correct UI elements. // ---------------------------------------------------- Vector fields = spec.getChildrenNamed(FIELD_NODE_ID); for (int i = 0; i < fields.size(); i++) { XMLElement field = (XMLElement) fields.elementAt(i); String attribute = field.getAttribute(TYPE); if (attribute != null) { if (attribute.equals(RULE_FIELD)) { addRuleField(field); } else if (attribute.equals(TEXT_FIELD)) { addTextField(field); } else if (attribute.equals(COMBO_FIELD)) { addComboBox(field); } else if (attribute.equals(RADIO_FIELD)) { addRadioButton(field); } else if (attribute.equals(PWD_FIELD)) { addPasswordField(field); } else if (attribute.equals(SPACE_FIELD)) { addSpace(field); } else if (attribute.equals(DIVIDER_FIELD)) { addDivider(field); } else if (attribute.equals(CHECK_FIELD)) { addCheckBox(field); } else if (attribute.equals(STATIC_TEXT)) { addText(field); } else if (attribute.equals(TITLE_FIELD)) { addTitle(field); } else if (attribute.equals(SEARCH_FIELD)) { addSearch(field); } } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
style = style + Font.BOLD;
style += Font.BOLD;
private void addTitle(XMLElement spec) { String title = getText(spec); boolean italic = getBoolean(spec, ITALICS, false); boolean bold = getBoolean(spec, BOLD, false); float multiplier = getFloat(spec, SIZE, 2.0f); int justify = getAlignment(spec); if (title != null) { JLabel label = new JLabel(title); Font font = label.getFont(); float size = font.getSize(); int style = 0; if (bold) { style = style + Font.BOLD; } if (italic) { style = style + Font.ITALIC; } font = font.deriveFont(style, (size * multiplier)); label.setFont(font); label.setAlignmentX(0); TwoColumnConstraints constraints = new TwoColumnConstraints(); constraints.align = justify; constraints.position = TwoColumnConstraints.NORTH; add(label, constraints); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
style = style + Font.ITALIC;
style += Font.ITALIC;
private void addTitle(XMLElement spec) { String title = getText(spec); boolean italic = getBoolean(spec, ITALICS, false); boolean bold = getBoolean(spec, BOLD, false); float multiplier = getFloat(spec, SIZE, 2.0f); int justify = getAlignment(spec); if (title != null) { JLabel label = new JLabel(title); Font font = label.getFont(); float size = font.getSize(); int style = 0; if (bold) { style = style + Font.BOLD; } if (italic) { style = style + Font.ITALIC; } font = font.deriveFont(style, (size * multiplier)); label.setFont(font); label.setAlignmentX(0); TwoColumnConstraints constraints = new TwoColumnConstraints(); constraints.align = justify; constraints.position = TwoColumnConstraints.NORTH; add(label, constraints); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
|| uiElement[POS_DISPLAYED].toString().equals("false"))
|| "false".equals(uiElement[POS_DISPLAYED].toString()))
private void buildUI() { Object[] uiElement; for (int i = 0; i < uiElements.size(); i++) { uiElement = (Object[]) uiElements.elementAt(i); if (itemRequiredFor((Vector) uiElement[POS_PACKS]) && itemRequiredForOs((Vector) uiElement[POS_OS])) { try { if (uiElement[POS_DISPLAYED] == null || uiElement[POS_DISPLAYED].toString().equals("false")) { add((JComponent) uiElement[POS_FIELD], uiElement[POS_CONSTRAINTS]); } uiElement[POS_DISPLAYED] = Boolean.valueOf(true); uiElements.remove(i); uiElements.add(i, uiElement); } catch (Throwable exception) { System.out.println("Internal format error in field: " + uiElement[POS_TYPE].toString()); // !!! logging } } else { try { if (uiElement[POS_DISPLAYED] != null && uiElement[POS_DISPLAYED].toString().equals("true")) { remove((JComponent) uiElement[POS_FIELD]); } } catch (Throwable exception) { System.out.println("Internal format error in field: " + uiElement[POS_TYPE].toString()); // !!! logging } uiElement[POS_DISPLAYED] = Boolean.valueOf(false); uiElements.remove(i); uiElements.add(i, uiElement); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
&& uiElement[POS_DISPLAYED].toString().equals("true"))
&& "true".equals(uiElement[POS_DISPLAYED].toString()))
private void buildUI() { Object[] uiElement; for (int i = 0; i < uiElements.size(); i++) { uiElement = (Object[]) uiElements.elementAt(i); if (itemRequiredFor((Vector) uiElement[POS_PACKS]) && itemRequiredForOs((Vector) uiElement[POS_OS])) { try { if (uiElement[POS_DISPLAYED] == null || uiElement[POS_DISPLAYED].toString().equals("false")) { add((JComponent) uiElement[POS_FIELD], uiElement[POS_CONSTRAINTS]); } uiElement[POS_DISPLAYED] = Boolean.valueOf(true); uiElements.remove(i); uiElements.add(i, uiElement); } catch (Throwable exception) { System.out.println("Internal format error in field: " + uiElement[POS_TYPE].toString()); // !!! logging } } else { try { if (uiElement[POS_DISPLAYED] != null && uiElement[POS_DISPLAYED].toString().equals("true")) { remove((JComponent) uiElement[POS_FIELD]); } } catch (Throwable exception) { System.out.println("Internal format error in field: " + uiElement[POS_TYPE].toString()); // !!! logging } uiElement[POS_DISPLAYED] = Boolean.valueOf(false); uiElements.remove(i); uiElements.add(i, uiElement); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
if (family.equals("windows"))
if ("windows".equals(family))
public boolean itemRequiredForOs(Vector os) { if (os.size() == 0) { return true; } for (int i = 0; i < os.size(); i++) { String family = ((XMLElement) os.elementAt(i)).getAttribute(FAMILY); boolean match = false; if (family.equals("windows")) { match = OsVersion.IS_WINDOWS; } else if (family.equals("mac")) { match = OsVersion.IS_OSX; } else if (family.equals("unix")) { match = OsVersion.IS_UNIX; } return match; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
else if (family.equals("mac"))
else if ("mac".equals(family))
public boolean itemRequiredForOs(Vector os) { if (os.size() == 0) { return true; } for (int i = 0; i < os.size(); i++) { String family = ((XMLElement) os.elementAt(i)).getAttribute(FAMILY); boolean match = false; if (family.equals("windows")) { match = OsVersion.IS_WINDOWS; } else if (family.equals("mac")) { match = OsVersion.IS_OSX; } else if (family.equals("unix")) { match = OsVersion.IS_UNIX; } return match; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
else if (family.equals("unix"))
else if ("unix".equals(family))
public boolean itemRequiredForOs(Vector os) { if (os.size() == 0) { return true; } for (int i = 0; i < os.size(); i++) { String family = ((XMLElement) os.elementAt(i)).getAttribute(FAMILY); boolean match = false; if (family.equals("windows")) { match = OsVersion.IS_WINDOWS; } else if (family.equals("mac")) { match = OsVersion.IS_OSX; } else if (family.equals("unix")) { match = OsVersion.IS_UNIX; } return match; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
return match;
if (match) { return true; }
public boolean itemRequiredForOs(Vector os) { if (os.size() == 0) { return true; } for (int i = 0; i < os.size(); i++) { String family = ((XMLElement) os.elementAt(i)).getAttribute(FAMILY); boolean match = false; if (family.equals("windows")) { match = OsVersion.IS_WINDOWS; } else if (family.equals("mac")) { match = OsVersion.IS_OSX; } else if (family.equals("unix")) { match = OsVersion.IS_UNIX; } return match; } return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
if (message.equals(""))
if ("".equals(message))
private boolean readRuleField(Object[] field) { RuleInputField ruleField = null; String variable = null; try { ruleField = (RuleInputField) field[POS_FIELD]; variable = (String) field[POS_VARIABLE]; } catch (Throwable exception) { return (true); } if ((variable == null) || (ruleField == null)) { return (true); } boolean success = ruleField.validateContents(); if (!success) { String message = ""; try { message = langpack.getString((String) field[POS_MESSAGE]); if (message.equals("")) { message = (String) field[POS_MESSAGE]; } } catch (Throwable t) { message = (String) field[POS_MESSAGE]; } JOptionPane.showMessageDialog(parentFrame, message, parentFrame.langpack .getString("UserInputPanel.error.caption"), JOptionPane.WARNING_MESSAGE); return (false); } idata.setVariable(variable, ruleField.getText()); entries.add(new TextValuePair(variable, ruleField.getText())); return (true); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java
public UserInputPanelAutomationHelper(Map entries)
public UserInputPanelAutomationHelper ()
public UserInputPanelAutomationHelper(Map entries) { this.entries = entries; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/UserInputPanelAutomationHelper.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanelAutomationHelper.java
this.entries = entries;
this.entries = null;
public UserInputPanelAutomationHelper(Map entries) { this.entries = entries; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/UserInputPanelAutomationHelper.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanelAutomationHelper.java
public void emitError (String title, String message)
public void emitError(String title, String message)
public void emitError (String title, String message) { JOptionPane.showMessageDialog(this, message, title, JOptionPane.ERROR_MESSAGE); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/IzPanel.java/buggy/src/lib/com/izforge/izpack/installer/IzPanel.java