Fix windows file separator bug

This commit is contained in:
Chris Myers 2017-07-09 19:41:17 -06:00
parent 71fdaa1109
commit 5810d56b4a
44 changed files with 1266 additions and 1482 deletions

View file

@ -27,8 +27,6 @@ import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.xml.stream.XMLStreamException;
import org.jlibsedml.SEDMLDocument;
import org.jlibsedml.SedML;
import org.sbml.jsbml.SBMLDocument;
import org.sbml.jsbml.SBMLErrorLog;
import org.sbml.jsbml.SBMLReader;
@ -47,7 +45,6 @@ import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.model.Hierarc
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.states.EventState;
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.states.HierarchicalState;
import edu.utah.ece.async.ibiosim.analysis.simulation.hierarchical.states.HierarchicalState.StateType;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
@ -85,7 +82,6 @@ public abstract class HierarchicalSimulation implements ParentSimulator
private JFrame running;
private String SBMLFileName;
private boolean sbmlHasErrorsFlag;
private String separator;
private boolean stoichAmpBoolean;
private double stoichAmpGridValue;
protected double timeLimit;
@ -189,7 +185,6 @@ public abstract class HierarchicalSimulation implements ParentSimulator
throw new BioSimException("The SBML file contains " + document.getErrorCount() + " error(s):\n" + errorString, "Error!");
}
separator = GlobalConstants.separator;
}
public HierarchicalSimulation(HierarchicalSimulation copy)
@ -212,7 +207,6 @@ public abstract class HierarchicalSimulation implements ParentSimulator
this.type = copy.type;
this.isGrid = copy.isGrid;
this.topmodel = copy.topmodel;
this.separator = copy.separator;
this.currentTime = copy.currentTime;
this.randomNumberGenerator = copy.randomNumberGenerator;
this.initValues = copy.initValues;
@ -384,14 +378,6 @@ public abstract class HierarchicalSimulation implements ParentSimulator
return sbmlHasErrorsFlag;
}
/**
* @return the separator
*/
public String getSeparator()
{
return separator;
}
/**
* @return the stoichAmpBoolean
*/
@ -550,15 +536,6 @@ public abstract class HierarchicalSimulation implements ParentSimulator
this.sbmlHasErrorsFlag = sbmlHasErrorsFlag;
}
/**
* @param separator
* the separator to set
*/
public void setSeparator(String separator)
{
this.separator = separator;
}
/**
* @param stoichAmpBoolean
* the stoichAmpBoolean to set

View file

@ -613,7 +613,7 @@ public class SBML2SBOL {
Model subModel = null;
if (extModelRef!=null) {
String extModel = extModelRef.getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
SBMLDocument subDocument = SBMLutilities.readSBML(externalSBMLPath + GlobalConstants.separator + extModel);
SBMLDocument subDocument = SBMLutilities.readSBML(externalSBMLPath + File.separator + extModel);
subModel = subDocument.getModel();
if (!comps.contains(modelRef)) {
comps.add(modelRef);
@ -764,7 +764,7 @@ public class SBML2SBOL {
sbmlDoc = SBMLutilities.readSBML(inputFilePath);
}
else {
sbmlDoc = SBMLutilities.readSBML(includeSBMLPath + GlobalConstants.separator + inputFilePath);
sbmlDoc = SBMLutilities.readSBML(includeSBMLPath + File.separator + inputFilePath);
}
SBOLDocument sbolDoc = new SBOLDocument();
SBML2SBOL.convert_SBML2SBOL(sbolDoc,includeSBMLPath, sbmlDoc, inputFilePath, ref_sbolInputFilePath, sbolURIPre);

View file

@ -13,11 +13,8 @@
*******************************************************************************/
package edu.utah.ece.async.ibiosim.dataModels.biomodel.parser;
import java.awt.GridLayout;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ -27,11 +24,6 @@ import java.util.Observable;
import java.util.Properties;
import java.util.prefs.Preferences;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.xml.stream.XMLStreamException;
import org.sbml.jsbml.ASTNode;
@ -46,8 +38,6 @@ import org.sbml.jsbml.ext.comp.CompSBMLDocumentPlugin;
import org.sbml.jsbml.ext.comp.CompSBasePlugin;
import org.sbml.jsbml.Compartment;
import org.sbml.jsbml.ext.layout.CompartmentGlyph;
//CompartmentType not supported in Level 3
//import org.sbml.jsbml.CompartmentType;
import org.sbml.jsbml.Constraint;
import org.sbml.jsbml.ext.comp.Deletion;
import org.sbml.jsbml.ext.layout.Dimensions;
@ -82,8 +72,6 @@ import org.sbml.jsbml.ext.comp.SBaseRef;
import org.sbml.jsbml.Species;
import org.sbml.jsbml.ext.layout.SpeciesGlyph;
import org.sbml.jsbml.SpeciesReference;
//SpeciesType not supported in Level 3
//import org.sbml.jsbml.SpeciesType;
import org.sbml.jsbml.ext.comp.Submodel;
import org.sbml.jsbml.ext.fbc.FBCConstants;
import org.sbml.jsbml.ext.fbc.FBCModelPlugin;
@ -96,15 +84,10 @@ import org.sbml.jsbml.xml.XMLNode;
import org.sbml.libsbml.libsbmlConstants;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.network.AbstractionEngine;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.network.GeneticNetwork;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.network.Promoter;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.network.SpeciesInterface;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.Message;
import edu.utah.ece.async.ibiosim.dataModels.util.MutableString;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
@ -118,8 +101,6 @@ import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
*/
public class BioModel extends Observable{
private String separator;
private String filename = null;
private Message message = new Message();
@ -127,8 +108,6 @@ public class BioModel extends Observable{
private GridTable gridTable;
public BioModel(String path) {
//gcm2sbml = new GCM2SBML(this);
separator = GlobalConstants.separator;
this.path = path;
compartments = new HashMap<String, Properties>();
gridTable = new GridTable();
@ -2161,7 +2140,7 @@ public class BioModel extends Observable{
public boolean load(String filename) throws XMLStreamException, IOException {
//gcm2sbml.load(filename);
this.filename = filename;
String[] splitPath = filename.split(separator);
String[] splitPath = GlobalConstants.splitPath(filename);
sbmlFile = splitPath[splitPath.length-1].replace(".gcm",".xml");
return loadSBMLFile(sbmlFile);
}
@ -5349,7 +5328,7 @@ public class BioModel extends Observable{
BioModel subBioModel = new BioModel(path);
String extModelFile = sbmlComp.getListOfExternalModelDefinitions().get(submodel.getModelRef())
.getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
subBioModel.load(path + separator + extModelFile);
subBioModel.load(path + File.separator + extModelFile);
// TODO: Not currently supported.
String md5 = Utility.MD5(subBioModel.getSBMLDocument());
if (!sbmlComp.getListOfExternalModelDefinitions().get(submodel.getModelRef()).getMd5().equals("") &&
@ -5489,8 +5468,8 @@ public class BioModel extends Observable{
private boolean loadSBMLFile(String sbmlFile) throws XMLStreamException, IOException {
boolean successful = true;
if (!sbmlFile.equals("")) {
if (new File(path + separator + sbmlFile).exists()) {
sbml = SBMLutilities.readSBML(path + separator + sbmlFile);
if (new File(path + File.separator + sbmlFile).exists()) {
sbml = SBMLutilities.readSBML(path + File.separator + sbmlFile);
createLayoutPlugin();
createCompPlugin();
createFBCPlugin();
@ -5526,7 +5505,7 @@ public class BioModel extends Observable{
.getModelRef()).getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
if (!comps.contains(extModel)) {
comps.add(extModel);
SBMLDocument subDocument = SBMLutilities.readSBML(path + separator + extModel);
SBMLDocument subDocument = SBMLutilities.readSBML(path + File.separator + extModel);
CompModelPlugin subDocumentCompModel = SBMLutilities.getCompModelPlugin(subDocument.getModel());
ModelDefinition md = new ModelDefinition(subDocument.getModel());
String id = subDocument.getModel().getId();
@ -5602,7 +5581,7 @@ public class BioModel extends Observable{
.getModelRef()).getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
if (!comps.contains(extModel)) {
comps.add(extModel);
SBMLDocument subDocument = SBMLutilities.readSBML(path + separator + extModel);
SBMLDocument subDocument = SBMLutilities.readSBML(path + File.separator + extModel);
CompModelPlugin subDocumentCompModel = SBMLutilities.getCompModelPlugin(subDocument.getModel());
String id = subDocument.getModel().getId();
// TODO: hack to avoid jsbml scope bug
@ -5862,7 +5841,7 @@ public class BioModel extends Observable{
for (String subModelId : comps) {
BioModel subModel = new BioModel(path);
String extModelFile = model.getExtModelFileName(subModelId);
subModel.load(path + separator + extModelFile);
subModel.load(path + File.separator + extModelFile);
ArrayList<String> modelListCopy = copyArray(modelList);
if (modelListCopy.contains(subModel.getFilename())) {
message.setErrorDialog("Loop Detected", "Cannot flatten model.\n" + "There is a loop in the components.");
@ -5935,7 +5914,7 @@ public class BioModel extends Observable{
for (String subModelId : comps) {
BioModel subModel = new BioModel(path);
String extModelFile = getExtModelFileName(subModelId);
subModel.load(path + separator + extModelFile);
subModel.load(path + File.separator + extModelFile);
ArrayList<String> modelListCopy = copyArray(modelList);
if (modelListCopy.contains(subModel.getFilename())) {
message.setErrorDialog("Loop Detected", "Cannot flatten model.\n" + "There is a loop in the components.");
@ -5991,7 +5970,7 @@ public class BioModel extends Observable{
BioModel subModel = new BioModel(path);
String extModel = model.getSBMLComp().getListOfExternalModelDefinitions().get(model.getSBMLCompModel().getListOfSubmodels().get(s)
.getModelRef()).getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
subModel.load(path + separator + extModel);
subModel.load(path + File.separator + extModel);
ArrayList<String> modelListCopy = copyArray(modelList);
if (modelListCopy.contains(subModel.getFilename())) {
while (!modelList.isEmpty()) {
@ -6629,20 +6608,6 @@ public class BioModel extends Observable{
return path;
}
public String getSeparator() {
return separator;
}
//UNDO-REDO METHODS
/*
public void setGrid(Grid g) {
grid = g;
}
*/
public boolean isGridEnabled() {
if ((gridTable.getNumRows() > 0) && (gridTable.getNumCols() > 0)) return true;
return false;

View file

@ -743,7 +743,7 @@ public class GCM2SBML {
* @throws XMLStreamException
*/
public void convertGCM2SBML(String root, String fileName) throws XMLStreamException, IOException {
String filename = root + GlobalConstants.separator + fileName;
String filename = root + File.separator + fileName;
int condCnt = 0;
for (String s : conditions) {
bioModel.createCondition(s,condCnt);
@ -852,7 +852,7 @@ public class GCM2SBML {
bioModel.createComponentFromGCM(s,components.get(s));
}
if (sbmlFile!=null && !sbmlFile.equals("")) {
SBMLDocument document = SBMLutilities.readSBML(root + GlobalConstants.separator + sbmlFile);
SBMLDocument document = SBMLutilities.readSBML(root + File.separator + sbmlFile);
if (document!=null) {
Model model = document.getModel();
Model modelNew = bioModel.getSBMLDocument().getModel();
@ -864,7 +864,7 @@ public class GCM2SBML {
for (int i = 0; i < model.getEventCount(); i++) {
modelNew.addEvent(model.getEvent(i).clone());
}
new File(root + GlobalConstants.separator + sbmlFile).delete();
new File(root + File.separator + sbmlFile).delete();
}
}
new File(filename).delete();

View file

@ -48,15 +48,11 @@ import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
* @version %I%
*/
public class GCMParser {
private String separator;
public GCMParser(String filename) throws XMLStreamException, IOException {
separator = GlobalConstants.separator;
//this.debug = debug;
biomodel = new BioModel(filename.substring(0, filename.length()
- filename.split(separator)[filename.split(separator).length - 1]
.length()));
- GlobalConstants.getFilename(filename).length()));
biomodel.load(filename);
data = new StringBuffer();
@ -74,7 +70,6 @@ public class GCMParser {
}
public GCMParser(BioModel gcm) {
separator = GlobalConstants.separator;
//this.debug = debug;
this.biomodel = gcm;
}

View file

@ -5831,9 +5831,9 @@ public class SBMLutilities
Submodel submodel = bioModel.getSBMLCompModel().getListOfSubmodels().get(sbaseRef.getIdRef());
String extModel = bioModel.getSBMLComp().getListOfExternalModelDefinitions().get(submodel.getModelRef()).getSource()
.replace("file://", "").replace("file:", "").replace(".gcm", ".xml");
subModel.load(root + GlobalConstants.separator + extModel);
subModel.load(root + File.separator + extModel);
id += changeIdToPortRef(root, sbaseRef.getSBaseRef(), subModel);
subModel.save(root + GlobalConstants.separator + extModel);
subModel.save(root + File.separator + extModel);
}
if (sbaseRef.isSetIdRef())
{
@ -5936,7 +5936,7 @@ public class SBMLutilities
Submodel submodel = sbmlCompModel.getListOfSubmodels().get(i);
String extModel = sbmlComp.getListOfExternalModelDefinitions().get(submodel.getModelRef()).getSource().replace("file://", "")
.replace("file:", "").replace(".gcm", ".xml");
subModel.load(root + GlobalConstants.separator + extModel);
subModel.load(root + File.separator + extModel);
ArrayList<SBase> elements = getListOfAllElements(document.getModel());
for (int j = 0; j < elements.size(); j++)
{
@ -5955,7 +5955,7 @@ public class SBMLutilities
Deletion deletion = submodel.getListOfDeletions().get(j);
changeIdToPortRef(root, deletion, subModel);
}
subModel.save(root + GlobalConstants.separator + extModel);
subModel.save(root + File.separator + extModel);
}
return true;

View file

@ -29,7 +29,6 @@ import java.util.regex.Pattern;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.xml.stream.XMLStreamException;
@ -281,12 +280,11 @@ public class Utility {
}
public static HashMap<String, double[]> calculateAverage(String folder) {
String separator = GlobalConstants.separator;
HashMap<String, double[]> result = new HashMap<String, double[]>();
HashMap<String, double[]> average = null;
String[] files = getTSDFiles(folder);
for (int i = 0; i < files.length; i++) {
result = readFile(folder+separator+files[i]);
result = readFile(folder+File.separator+files[i]);
if (average == null) {
average = result;
} else {

View file

@ -14,6 +14,7 @@
package edu.utah.ece.async.ibiosim.dataModels.util;
import java.io.File;
import java.util.regex.Pattern;
/**
*
@ -330,9 +331,23 @@ public class GlobalConstants {
public static final int DEFAULT_COMPARTMENT_HEIGHT = 250;
public static final int DEFAULT_TEXT_WIDTH = 40;
public static final int DEFAULT_TEXT_HEIGHT = 10;
public static final String separator = (File.separator.equals("\\")) ? "\\\\" : File.separator;
//public static final String separator = (File.separator.equals("\\")) ? "\\\\" : File.separator;
//public static final String separator = File.separator;
public static int SBML_LEVEL = 3;
public static int SBML_VERSION = 1;
public static String[] splitPath(String path) {
String[] subDirs = path.split(Pattern.quote(File.separator));
return subDirs;
}
public static String getFilename(String path) {
String[] subDirs = splitPath(path);
return subDirs[subDirs.length-1];
}
public static String getPath(String path) {
return path.substring(0, path.lastIndexOf(File.separator));
}
}

File diff suppressed because it is too large Load diff

View file

@ -249,13 +249,13 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
this.modelFile = modelFile;
if (modelFile.endsWith(".lpn"))
{
sbmlFile = root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile.replace(".lpn", ".xml");
sbmlFile = root + File.separator + simName + File.separator + modelFile.replace(".lpn", ".xml");
}
else
{
sbmlFile = root + GlobalConstants.separator + modelFile;
sbmlFile = root + File.separator + modelFile;
}
sbmlProp = root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile.replace(".lpn", ".xml");
sbmlProp = root + File.separator + simName + File.separator + modelFile.replace(".lpn", ".xml");
interestingSpecies = new ArrayList<String>();
change = false;
biosimrc = Preferences.userRoot();
@ -538,7 +538,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
String[] props = new String[] { "none" };
LPN lpn = new LPN();
try {
lpn.load(root + GlobalConstants.separator + modelFile);
lpn.load(root + File.separator + modelFile);
String[] getProps = lpn.getProperties().toArray(new String[0]);
props = new String[getProps.length + 1];
props[0] = "none";
@ -1070,23 +1070,23 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
{
if (append.isSelected())
{
String[] searchForRunFiles = new File(root + GlobalConstants.separator + outDir).list();
String[] searchForRunFiles = new File(root + File.separator + outDir).list();
for (String s : searchForRunFiles)
{
if (s.length() > 3 && new File(root + GlobalConstants.separator + outDir + GlobalConstants.separator + s).isFile() && (s.equals("mean.tsd") || s.equals("standard_deviation.tsd") || s.equals("variance.tsd")))
if (s.length() > 3 && new File(root + File.separator + outDir + File.separator + s).isFile() && (s.equals("mean.tsd") || s.equals("standard_deviation.tsd") || s.equals("variance.tsd")))
{
new File(root + GlobalConstants.separator + outDir + GlobalConstants.separator + s).delete();
new File(root + File.separator + outDir + File.separator + s).delete();
}
}
}
else
{
String[] searchForRunFiles = new File(root + GlobalConstants.separator + outDir).list();
String[] searchForRunFiles = new File(root + File.separator + outDir).list();
for (String s : searchForRunFiles)
{
if (s.length() > 3 && s.substring(0, 4).equals("run-") && new File(root + GlobalConstants.separator + outDir + GlobalConstants.separator + s).isFile())
if (s.length() > 3 && s.substring(0, 4).equals("run-") && new File(root + File.separator + outDir + File.separator + s).isFile())
{
new File(root + GlobalConstants.separator + outDir + GlobalConstants.separator + s).delete();
new File(root + File.separator + outDir + File.separator + s).delete();
}
}
}
@ -1115,7 +1115,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
gui.getExitButton().addActionListener(runProgram);
if (monteCarlo.isSelected() || ODE.isSelected())
{
File[] files = new File(root + GlobalConstants.separator + outDir).listFiles();
File[] files = new File(root + File.separator + outDir).listFiles();
for (File f : files)
{
if (f.getName().contains("mean.") || f.getName().contains("standard_deviation.") || f.getName().contains("variance."))
@ -1137,18 +1137,18 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
String directory = null;
if (!direct.equals("."))
{
simulationName = simName + GlobalConstants.separator + direct;
simulationName = simName + File.separator + direct;
directory = direct;
}
exit = runProgram.execute(simProp, fba, sbml, dot, xhtml, Gui.frame, ODE, monteCarlo, sim, printer_id, printer_track_quantity, root
+ GlobalConstants.separator + simName, stateAbstraction, 1, intSpecies, log, gui, simTab, root, progress, simulationName, modelEditor, directory,
+ File.separator + simName, stateAbstraction, 1, intSpecies, log, gui, simTab, root, progress, simulationName, modelEditor, directory,
initialTime, outputStartTime, timeLimit, runTime, modelFile, lpnAbstraction, reactionAbstraction, expandReactions, lpnProperty, absError, relError, timeStep, printInterval,
run, rndSeed, refresh, label, running);
if (stateAbstraction.isSelected() && modelEditor == null && !sim.contains("markov-chain-analysis") && exit == 0)
{
simProp = simProp.replace("\\", "/");
Nary_Run nary_Run = new Nary_Run(this, simulators, simProp.split("/"), simProp, fba, sbml, dot, xhtml, stateAbstraction, ODE, monteCarlo,
initialTime, outputStartTime, timeLimit, ((String) (intervalLabel.getSelectedItem())), printInterval, minTimeStep, timeStep, root + GlobalConstants.separator + simName,
initialTime, outputStartTime, timeLimit, ((String) (intervalLabel.getSelectedItem())), printInterval, minTimeStep, timeStep, root + File.separator + simName,
rndSeed, run, printer_id, printer_track_quantity, intSpecies, rap1, rap2, qss, con, log, gui, simTab, root, directory, modelFile,
reactionAbstraction, lpnAbstraction, absError, relError);
nary_Run.open();
@ -1173,11 +1173,11 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
public int getStartIndex(String outDir) {
if (append.isSelected())
{
String[] searchForRunFiles = new File(root + GlobalConstants.separator + outDir).list();
String[] searchForRunFiles = new File(root + File.separator + outDir).list();
int start = 1;
for (String s : searchForRunFiles)
{
if (s.length() > 3 && s.substring(0, 4).equals("run-") && new File(root + GlobalConstants.separator + outDir + GlobalConstants.separator + s).isFile())
if (s.length() > 3 && s.substring(0, 4).equals("run-") && new File(root + File.separator + outDir + File.separator + s).isFile())
{
String getNumber = s.substring(4, s.length());
String number = "";
@ -1594,7 +1594,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
boolean saveTopLevel = false;
if (!direct.equals("."))
{
simProp = simProp.substring(0, simProp.length() - simProp.split("/")[simProp.split("/").length - 1].length()) + direct + GlobalConstants.separator + simProp.substring(simProp.length() - simProp.split("/")[simProp.split("/").length - 1].length());
simProp = simProp.substring(0, simProp.length() - simProp.split("/")[simProp.split("/").length - 1].length()) + direct + File.separator + simProp.substring(simProp.length() - simProp.split("/")[simProp.split("/").length - 1].length());
saveTopLevel = true;
}
String propName = simProp.substring(0, simProp.length() - getFilename[getFilename.length - 1].length()) + getFilename[getFilename.length - 1].substring(0, cut) + ".properties";
@ -1610,11 +1610,11 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
}
else
{
outDir = simName + GlobalConstants.separator + direct;
outDir = simName + File.separator + direct;
}
if (!runs.isEnabled())
{
for (String runs : new File(root + GlobalConstants.separator + outDir).list())
for (String runs : new File(root + File.separator + outDir).list())
{
if (runs.length() >= 4)
{
@ -1647,7 +1647,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
}
if (!fileStem.getText().trim().equals(""))
{
new File(root + GlobalConstants.separator + simName + GlobalConstants.separator + fileStem.getText().trim()).mkdir();
new File(root + File.separator + simName + File.separator + fileStem.getText().trim()).mkdir();
getProps.setProperty("file.stem", fileStem.getText().trim());
}
if (monteCarlo.isSelected() || ODE.isSelected())
@ -2011,10 +2011,10 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
*/
private void loadPropertiesFile(String simName, String modelName)
{
String openFile = root + GlobalConstants.separator + simName + GlobalConstants.separator + simName + ".properties";
String openFile = root + File.separator + simName + File.separator + simName + ".properties";
if (!(new File(openFile)).exists())
{
openFile = root + GlobalConstants.separator + simName + GlobalConstants.separator + modelName + ".properties";
openFile = root + File.separator + simName + File.separator + modelName + ".properties";
if (!(new File(openFile)).exists())
{
return;
@ -2998,7 +2998,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
public Graph createGraph(String open)
{
String outDir = root + GlobalConstants.separator + simName;
String outDir = root + File.separator + simName;
String printer_id;
printer_id = "tsd.printer";
String printer_track_quantity = "amount";
@ -3082,20 +3082,20 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
{
try {
LPN lhpnFile = new LPN();
lhpnFile.load(root + GlobalConstants.separator + modelFile);
lhpnFile.load(root + File.separator + modelFile);
Abstraction abst = new Abstraction(lhpnFile, lpnAbstraction.getAbstractionProperty());
abst.abstractSTG(false);
abst.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile);
abst.save(root + File.separator + simName + File.separator + modelFile);
if (transientProperties != null && !((String) transientProperties.getSelectedItem()).equals("none"))
{
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile, ((String) transientProperties.getSelectedItem()));
t1.convertLPN2SBML(root + File.separator + simName + File.separator + modelFile, ((String) transientProperties.getSelectedItem()));
}
else
{
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile, "");
t1.convertLPN2SBML(root + File.separator + simName + File.separator + modelFile, "");
}
} catch (BioSimException e) {
// TODO Auto-generated catch block
@ -3109,18 +3109,18 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
try {
if (transientProperties != null && !((String) transientProperties.getSelectedItem()).equals("none"))
{
t1.convertLPN2SBML(root + GlobalConstants.separator + modelFile, ((String) transientProperties.getSelectedItem()));
t1.convertLPN2SBML(root + File.separator + modelFile, ((String) transientProperties.getSelectedItem()));
}
else
{
t1.convertLPN2SBML(root + GlobalConstants.separator + modelFile, "");
t1.convertLPN2SBML(root + File.separator + modelFile, "");
}
} catch (BioSimException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
t1.setFilename(root + GlobalConstants.separator + simName + GlobalConstants.separator + stem + GlobalConstants.separator + modelFile.replace(".lpn", ".xml"));
t1.setFilename(root + File.separator + simName + File.separator + stem + File.separator + modelFile.replace(".lpn", ".xml"));
t1.outputSBML();
if (!stem.equals(""))
{
@ -3205,7 +3205,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
public void setSim(String newSimName)
{
sbmlFile = sbmlFile.replace("\\", "/");
sbmlProp = root + GlobalConstants.separator + newSimName + GlobalConstants.separator + sbmlFile.split("/")[sbmlFile.split("/").length - 1];
sbmlProp = root + File.separator + newSimName + File.separator + sbmlFile.split("/")[sbmlFile.split("/").length - 1];
simName = newSimName;
}
@ -3264,7 +3264,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
public Graph createProbGraph(String open)
{
String outDir = root + GlobalConstants.separator + simName;
String outDir = root + File.separator + simName;
String printer_id;
printer_id = "tsd.printer";
String printer_track_quantity = "amount";
@ -3287,7 +3287,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
{
}
}
if (!dirs.isEmpty() && new File(root + GlobalConstants.separator + simName + GlobalConstants.separator + stem + dirs.get(0) + GlobalConstants.separator + "sim-rep.txt").exists())
if (!dirs.isEmpty() && new File(root + File.separator + simName + File.separator + stem + dirs.get(0) + File.separator + "sim-rep.txt").exists())
{
ArrayList<String> dataLabels = new ArrayList<String>();
ArrayList<ArrayList<Double>> data = new ArrayList<ArrayList<Double>>();
@ -3306,7 +3306,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
ArrayList<String> vals = new ArrayList<String>();
try
{
Scanner s = new Scanner(new File(root + GlobalConstants.separator + simName + GlobalConstants.separator + stem + d + GlobalConstants.separator + "sim-rep.txt"));
Scanner s = new Scanner(new File(root + File.separator + simName + File.separator + stem + d + File.separator + "sim-rep.txt"));
while (s.hasNextLine())
{
String[] ss = s.nextLine().split(" ");
@ -3367,7 +3367,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
}
}
DataParser constData = new DataParser(dataLabels, data);
constData.outputTSD(root + GlobalConstants.separator + simName + GlobalConstants.separator + "sim-rep.tsd");
constData.outputTSD(root + File.separator + simName + File.separator + "sim-rep.tsd");
for (int i = 0; i < simTab.getComponentCount(); i++)
{
if (simTab.getComponentAt(i).getName().equals("TSD Graph"))
@ -3591,9 +3591,9 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
{
if (!fileStem.getText().trim().equals(""))
{
return root + GlobalConstants.separator + simName + GlobalConstants.separator + fileStem.getText().trim();
return root + File.separator + simName + File.separator + fileStem.getText().trim();
}
return root + GlobalConstants.separator + simName;
return root + File.separator + simName;
}
public String getSimName()
@ -3619,7 +3619,7 @@ public class AnalysisView extends JPanel implements ActionListener, Runnable, Mo
String[] props = new String[] { "none" };
LPN lpn = new LPN();
try {
lpn.load(root + GlobalConstants.separator + modelFile);
lpn.load(root + File.separator + modelFile);
String[] getProps = lpn.getProperties().toArray(new String[0]);
props = new String[getProps.length + 1];
props[0] = "none";

View file

@ -44,7 +44,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.gui.Gui;
import edu.utah.ece.async.ibiosim.gui.util.Log;
import edu.utah.ece.async.ibiosim.gui.util.Utility;
@ -223,8 +222,6 @@ public class Nary_Run implements ActionListener, Runnable
private final String root;
private String separator;
private final String useInterval;
private final String direct;
@ -254,8 +251,6 @@ public class Nary_Run implements ActionListener, Runnable
String direct, String modelFile, JRadioButton abstraction, AbstractionPanel abstPane,
double absError, double relError)
{
separator = GlobalConstants.separator;
// intitializes the member variables
this.absError = absError;
this.relError = relError;
@ -379,17 +374,17 @@ public class Nary_Run implements ActionListener, Runnable
Properties naryProps = new Properties();
try
{
FileInputStream load = new FileInputStream(new File(outDir + separator
FileInputStream load = new FileInputStream(new File(outDir + File.separator
+ "species.properties"));
naryProps.load(load);
load.close();
FileOutputStream store = new FileOutputStream(new File(outDir + separator
FileOutputStream store = new FileOutputStream(new File(outDir + File.separator
+ "species.properties"));
naryProps.store(store, "");
store.close();
naryProps = new Properties();
new File("species.properties").delete();
load = new FileInputStream(new File(outDir + separator + "species.properties"));
load = new FileInputStream(new File(outDir + File.separator + "species.properties"));
naryProps.load(load);
load.close();
}
@ -796,7 +791,7 @@ public class Nary_Run implements ActionListener, Runnable
Properties nary = new Properties();
try
{
FileInputStream load = new FileInputStream(new File(outDir + GlobalConstants.separator
FileInputStream load = new FileInputStream(new File(outDir + File.separator
+ "species.properties"));
nary.load(load);
load.close();

View file

@ -401,10 +401,10 @@ public class Run implements ActionListener, Observer
theFile = filename.substring(filename.lastIndexOf('\\') + 1);
}
File work = new File(directory);
new FileWriter(new File(directory + GlobalConstants.separator + "running")).close();
FileWriter logFile = new FileWriter(new File(directory + GlobalConstants.separator + "log.txt"));
new FileWriter(new File(directory + File.separator + "running")).close();
FileWriter logFile = new FileWriter(new File(directory + File.separator + "log.txt"));
Properties properties = new Properties();
properties.load(new FileInputStream(directory + GlobalConstants.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".properties"));
properties.load(new FileInputStream(directory + File.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".properties"));
boolean genStats = Boolean.parseBoolean(properties.getProperty("reb2sac.generate.statistics"));
String out = theFile;
if (out.length() > 4 && out.substring(out.length() - 5, out.length()).equals(".sbml"))
@ -437,7 +437,7 @@ public class Run implements ActionListener, Observer
}
}
BioModel bioModel = new BioModel(root);
bioModel.load(root + GlobalConstants.separator + modelEditor.getRefFile());
bioModel.load(root + File.separator + modelEditor.getRefFile());
time1 = System.nanoTime();
String prop = null;
if (!lpnProperty.equals(""))
@ -478,29 +478,29 @@ public class Run implements ActionListener, Observer
prop = mutProp.getString();
if (lpnFile == null)
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
lpnFile.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName);
lpnFile.save(root + File.separator + simName + File.separator + lpnName);
try
{
Translator t1 = new Translator();
if (abstraction.isSelected())
{
LPN lhpnFile = new LPN();
lhpnFile.load(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName);
lhpnFile.load(root + File.separator + simName + File.separator + lpnName);
Abstraction abst = new Abstraction(lhpnFile, abstPane.getAbstractionProperty());
abst.addObserver(this);
abst.abstractSTG(false);
abst.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName + ".temp");
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName + ".temp", prop);
abst.save(root + File.separator + simName + File.separator + lpnName + ".temp");
t1.convertLPN2SBML(root + File.separator + simName + File.separator + lpnName + ".temp", prop);
}
else
{
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName, prop);
t1.convertLPN2SBML(root + File.separator + simName + File.separator + lpnName, prop);
}
t1.setFilename(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName.replace(".lpn", ".xml"));
t1.setFilename(root + File.separator + simName + File.separator + lpnName.replace(".lpn", ".xml"));
t1.outputSBML();
}
catch(BioSimException e)
@ -519,7 +519,7 @@ public class Run implements ActionListener, Observer
else if (fba.isSelected())
{
time1 = System.nanoTime();
FluxBalanceAnalysis fluxBalanceAnalysis = new FluxBalanceAnalysis(directory + GlobalConstants.separator, theFile, absError);
FluxBalanceAnalysis fluxBalanceAnalysis = new FluxBalanceAnalysis(directory + File.separator, theFile, absError);
exitValue = fluxBalanceAnalysis.PerformFluxBalanceAnalysis();
}
else if (sbml.isSelected())
@ -532,14 +532,14 @@ public class Run implements ActionListener, Observer
{
sbmlName += ".xml";
}
File f = new File(root + GlobalConstants.separator + sbmlName);
File f = new File(root + File.separator + sbmlName);
if (f.exists())
{
Object[] options = { "Overwrite", "Cancel" };
int value = JOptionPane.showOptionDialog(component, "File already exists." + "\nDo you want to overwrite?", "Overwrite", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (value == JOptionPane.YES_OPTION)
{
File dir = new File(root + GlobalConstants.separator + sbmlName);
File dir = new File(root + File.separator + sbmlName);
if (dir.isDirectory())
{
gui.deleteDir(dir);
@ -552,7 +552,7 @@ public class Run implements ActionListener, Observer
}
else
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -567,17 +567,17 @@ public class Run implements ActionListener, Observer
if (abstraction.isSelected())
{
LPN lhpnFile = new LPN();
lhpnFile.load(root + GlobalConstants.separator + modelFile);
lhpnFile.load(root + File.separator + modelFile);
Abstraction abst = new Abstraction(lhpnFile, abstPane.getAbstractionProperty());
abst.abstractSTG(false);
abst.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile);
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile, lpnProperty);
abst.save(root + File.separator + simName + File.separator + modelFile);
t1.convertLPN2SBML(root + File.separator + simName + File.separator + modelFile, lpnProperty);
}
else
{
t1.convertLPN2SBML(root + GlobalConstants.separator + modelFile, lpnProperty);
t1.convertLPN2SBML(root + File.separator + modelFile, lpnProperty);
}
t1.setFilename(root + GlobalConstants.separator + sbmlName);
t1.setFilename(root + File.separator + sbmlName);
t1.outputSBML();
exitValue = 0;
logFile.close();
@ -611,7 +611,7 @@ public class Run implements ActionListener, Observer
}
progress.setIndeterminate(true);
BioModel bioModel = new BioModel(root);
bioModel.load(root + GlobalConstants.separator + modelEditor.getRefFile());
bioModel.load(root + File.separator + modelEditor.getRefFile());
if (bioModel.flattenModel(true) != null)
{
time1 = System.nanoTime();
@ -654,28 +654,28 @@ public class Run implements ActionListener, Observer
prop = mutProp.getString();
if (lpnFile == null)
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
lpnFile.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName);
lpnFile.save(root + File.separator + simName + File.separator + lpnName);
try
{
Translator t1 = new Translator();
if (abstraction.isSelected())
{
LPN lhpnFile = new LPN();
lhpnFile.load(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName);
lhpnFile.load(root + File.separator + simName + File.separator + lpnName);
Abstraction abst = new Abstraction(lhpnFile, abstPane.getAbstractionProperty());
abst.abstractSTG(false);
abst.save(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName + ".temp");
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName + ".temp", prop);
abst.save(root + File.separator + simName + File.separator + lpnName + ".temp");
t1.convertLPN2SBML(root + File.separator + simName + File.separator + lpnName + ".temp", prop);
}
else
{
t1.convertLPN2SBML(root + GlobalConstants.separator + simName + GlobalConstants.separator + lpnName, prop);
t1.convertLPN2SBML(root + File.separator + simName + File.separator + lpnName, prop);
}
t1.setFilename(root + GlobalConstants.separator + sbmlName);
t1.setFilename(root + File.separator + sbmlName);
t1.outputSBML();
}
catch(BioSimException e)
@ -686,7 +686,7 @@ public class Run implements ActionListener, Observer
else
{
time1 = System.nanoTime();
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -696,17 +696,17 @@ public class Run implements ActionListener, Observer
{
if (analysisView.reb2sacAbstraction() && (abstraction.isSelected() || nary.isSelected()))
{
log.addText("Executing:\n" + Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + GlobalConstants.separator + sbmlName + " " + filename + "\n");
logFile.write("Executing:\n" + Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + GlobalConstants.separator + sbmlName + " " + filename + "\n\n");
log.addText("Executing:\n" + Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + File.separator + sbmlName + " " + filename + "\n");
logFile.write("Executing:\n" + Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + File.separator + sbmlName + " " + filename + "\n\n");
time1 = System.nanoTime();
reb2sac = exec.exec(Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + GlobalConstants.separator + sbmlName + " " + theFile, Gui.envp, work);
reb2sac = exec.exec(Gui.reb2sacExecutable + " --target.encoding=sbml --out=" + ".." + File.separator + sbmlName + " " + theFile, Gui.envp, work);
}
else
{
log.addText("Outputting SBML file:\n" + root + GlobalConstants.separator + sbmlName + "\n");
logFile.write("Outputting SBML file:\n" + root + GlobalConstants.separator + sbmlName + "\n\n");
log.addText("Outputting SBML file:\n" + root + File.separator + sbmlName + "\n");
logFile.write("Outputting SBML file:\n" + root + File.separator + sbmlName + "\n\n");
time1 = System.nanoTime();
FileOutputStream fileOutput = new FileOutputStream(new File(root + GlobalConstants.separator + sbmlName));
FileOutputStream fileOutput = new FileOutputStream(new File(root + File.separator + sbmlName));
FileInputStream fileInput = new FileInputStream(new File(filename));
int read = fileInput.read();
while (read != -1)
@ -732,13 +732,13 @@ public class Run implements ActionListener, Observer
LPN lhpnFile = new LPN();
lhpnFile.addObserver(this);
try {
lhpnFile.load(directory + GlobalConstants.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".lpn");
lhpnFile.load(directory + File.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".lpn");
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(),
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
lhpnFile.printDot(directory + GlobalConstants.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".dot");
lhpnFile.printDot(directory + File.separator + theFile.replace(".sbml", "").replace(".xml", "") + ".dot");
time1 = System.nanoTime();
exitValue = 0;
}
@ -746,7 +746,7 @@ public class Run implements ActionListener, Observer
{
LPN lhpnFile = new LPN();
try {
lhpnFile.load(root + GlobalConstants.separator + modelFile);
lhpnFile.load(root + File.separator + modelFile);
} catch (BioSimException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -755,11 +755,11 @@ public class Run implements ActionListener, Observer
{
Abstraction abst = new Abstraction(lhpnFile, abstPane.getAbstractionProperty());
abst.abstractSTG(false);
abst.printDot(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile.replace(".lpn", ".dot"));
abst.printDot(root + File.separator + simName + File.separator + modelFile.replace(".lpn", ".dot"));
}
else
{
lhpnFile.printDot(root + GlobalConstants.separator + simName + GlobalConstants.separator + modelFile.replace(".lpn", ".dot"));
lhpnFile.printDot(root + File.separator + simName + File.separator + modelFile.replace(".lpn", ".dot"));
}
time1 = System.nanoTime();
exitValue = 0;
@ -800,7 +800,7 @@ public class Run implements ActionListener, Observer
{
lhpnFile = new LPN();
try {
lhpnFile.load(root + GlobalConstants.separator + modelFile);
lhpnFile.load(root + File.separator + modelFile);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(),
JOptionPane.ERROR_MESSAGE);
@ -829,7 +829,7 @@ public class Run implements ActionListener, Observer
}
BioModel bioModel = new BioModel(root);
bioModel.addObserver(this);
bioModel.load(root + GlobalConstants.separator + modelEditor.getRefFile());
bioModel.load(root + File.separator + modelEditor.getRefFile());
if (bioModel.flattenModel(true) != null)
{
time1 = System.nanoTime();
@ -871,7 +871,7 @@ public class Run implements ActionListener, Observer
prop = mutProp.getString();
if (lhpnFile == null)
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -956,7 +956,7 @@ public class Run implements ActionListener, Observer
}
else
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -972,7 +972,7 @@ public class Run implements ActionListener, Observer
{
lhpnFile = new LPN();
try {
lhpnFile.load(root + GlobalConstants.separator + modelFile);
lhpnFile.load(root + File.separator + modelFile);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(),
JOptionPane.ERROR_MESSAGE);
@ -1001,7 +1001,7 @@ public class Run implements ActionListener, Observer
}
}
BioModel bioModel = new BioModel(root);
bioModel.load(root + GlobalConstants.separator + modelEditor.getRefFile());
bioModel.load(root + File.separator + modelEditor.getRefFile());
if (bioModel.flattenModel(true) != null)
{
time1 = System.nanoTime();
@ -1043,7 +1043,7 @@ public class Run implements ActionListener, Observer
prop = mutProp.getString();
if (lhpnFile == null)
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -1053,7 +1053,7 @@ public class Run implements ActionListener, Observer
}
else
{
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return 0;
}
@ -1123,7 +1123,7 @@ public class Run implements ActionListener, Observer
else
{
BioModel gcm = new BioModel(root);
gcm.load(root + GlobalConstants.separator + modelEditor.getRefFile());
gcm.load(root + File.separator + modelEditor.getRefFile());
ArrayList<Property> propList = new ArrayList<Property>();
if (prop == null)
{
@ -1158,7 +1158,7 @@ public class Run implements ActionListener, Observer
String simrep = sg.getMarkovResults();
if (simrep != null)
{
FileOutputStream simrepstream = new FileOutputStream(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
FileOutputStream simrepstream = new FileOutputStream(new File(directory + File.separator + "sim-rep.txt"));
simrepstream.write((simrep).getBytes());
simrepstream.close();
}
@ -1239,7 +1239,7 @@ public class Run implements ActionListener, Observer
String simrep = sg.getMarkovResults();
if (simrep != null)
{
FileOutputStream simrepstream = new FileOutputStream(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
FileOutputStream simrepstream = new FileOutputStream(new File(directory + File.separator + "sim-rep.txt"));
simrepstream.write((simrep).getBytes());
simrepstream.close();
}
@ -1277,7 +1277,7 @@ public class Run implements ActionListener, Observer
JOptionPane.showMessageDialog(Gui.frame, "Error viewing state graph.", "Error", JOptionPane.ERROR_MESSAGE);
}
}
if (sg.outputTSD(directory + GlobalConstants.separator + "percent-term-time.tsd"))
if (sg.outputTSD(directory + File.separator + "percent-term-time.tsd"))
{
if (refresh)
{
@ -1330,15 +1330,15 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.CR);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1351,14 +1351,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.DIRECT);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1371,14 +1371,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_DIRECT);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1391,14 +1391,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_DIRECT);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, 0, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1411,14 +1411,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_MIXED);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1431,14 +1431,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_HYBRID);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, minTimeStep, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1449,15 +1449,15 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.RK);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, (int) Math.floor(timeLimit / printInterval), 0, absError, printer_track_quantity, genStats,
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, (int) Math.floor(timeLimit / printInterval), 0, absError, printer_track_quantity, genStats,
simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1468,14 +1468,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_RK);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1486,14 +1486,14 @@ public class Run implements ActionListener, Observer
dynSim = new DynamicSimulation(SimulationType.HIERARCHICAL_RK);
dynSim.addObserver(this);
String SBMLFileName = directory + GlobalConstants.separator + theFile;
String SBMLFileName = directory + File.separator + theFile;
if (direct != null && !direct.equals("."))
{
outDir = outDir + GlobalConstants.separator + direct;
outDir = outDir + File.separator + direct;
}
dynSim.simulate(SBMLFileName, root, outDir + GlobalConstants.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
dynSim.simulate(SBMLFileName, root, outDir + File.separator, timeLimit, timeStep, 0.0, rndSeed, progress, printInterval, runs, progressLabel, running, stoichAmpValue, intSpecies, 0, 0, absError, printer_track_quantity, genStats, simTab, reactionAbstraction, initialTime, outputStartTime);
exitValue = 0;
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
return exitValue;
}
@ -1722,7 +1722,7 @@ public class Run implements ActionListener, Observer
{
try
{
ModelEditor gcm = new ModelEditor(root + GlobalConstants.separator, sbmlName, gui, log, false, null, null, null, false, false);
ModelEditor gcm = new ModelEditor(root + File.separator, sbmlName, gui, log, false, null, null, null, false, false);
gui.addTab(sbmlName, gcm, "Model Editor");
gui.addToTree(sbmlName);
}
@ -1842,18 +1842,18 @@ public class Run implements ActionListener, Observer
warning = ((Graph) simTab.getComponentAt(i)).getWarning();
((Graph) simTab.getComponentAt(i)).calculateAverageVarianceDeviation(run, 0, direct, warning, true);
}
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
if (outputTerm)
{
ArrayList<String> dataLabels = new ArrayList<String>();
dataLabels.add("time");
ArrayList<ArrayList<Double>> terms = new ArrayList<ArrayList<Double>>();
if (new File(directory + GlobalConstants.separator + "sim-rep.txt").exists())
if (new File(directory + File.separator + "sim-rep.txt").exists())
{
try
{
Scanner s = new Scanner(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
Scanner s = new Scanner(new File(directory + File.separator + "sim-rep.txt"));
if (s.hasNextLine())
{
String[] ss = s.nextLine().split(" ");
@ -1880,7 +1880,7 @@ public class Run implements ActionListener, Observer
e.printStackTrace();
}
}
Scanner scan = new Scanner(new File(directory + GlobalConstants.separator + "term-time.txt"));
Scanner scan = new Scanner(new File(directory + File.separator + "term-time.txt"));
while (scan.hasNextLine())
{
String line = scan.nextLine();
@ -1929,9 +1929,9 @@ public class Run implements ActionListener, Observer
}
}
DataParser probData = new DataParser(dataLabels, data);
probData.outputTSD(directory + GlobalConstants.separator + "term-time.tsd");
probData.outputTSD(directory + File.separator + "term-time.tsd");
probData = new DataParser(dataLabels, percentData);
probData.outputTSD(directory + GlobalConstants.separator + "percent-term-time.tsd");
probData.outputTSD(directory + File.separator + "percent-term-time.tsd");
}
if (refresh)
{
@ -1975,18 +1975,18 @@ public class Run implements ActionListener, Observer
warning = ((Graph) simTab.getComponentAt(i)).getWarning();
((Graph) simTab.getComponentAt(i)).calculateAverageVarianceDeviation(run, 0, direct, warning, true);
}
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
if (outputTerm)
{
ArrayList<String> dataLabels = new ArrayList<String>();
dataLabels.add("time");
ArrayList<ArrayList<Double>> terms = new ArrayList<ArrayList<Double>>();
if (new File(directory + GlobalConstants.separator + "sim-rep.txt").exists())
if (new File(directory + File.separator + "sim-rep.txt").exists())
{
try
{
Scanner s = new Scanner(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
Scanner s = new Scanner(new File(directory + File.separator + "sim-rep.txt"));
if (s.hasNextLine())
{
String[] ss = s.nextLine().split(" ");
@ -2013,7 +2013,7 @@ public class Run implements ActionListener, Observer
e.printStackTrace();
}
}
Scanner scan = new Scanner(new File(directory + GlobalConstants.separator + "term-time.txt"));
Scanner scan = new Scanner(new File(directory + File.separator + "term-time.txt"));
while (scan.hasNextLine())
{
String line = scan.nextLine();
@ -2062,9 +2062,9 @@ public class Run implements ActionListener, Observer
}
}
DataParser probData = new DataParser(dataLabels, data);
probData.outputTSD(directory + GlobalConstants.separator + "term-time.tsd");
probData.outputTSD(directory + File.separator + "term-time.tsd");
probData = new DataParser(dataLabels, percentData);
probData.outputTSD(directory + GlobalConstants.separator + "percent-term-time.tsd");
probData.outputTSD(directory + File.separator + "percent-term-time.tsd");
}
simTab.getComponentAt(i).setName("TSD Graph");
}
@ -2131,18 +2131,18 @@ public class Run implements ActionListener, Observer
warning = ((Graph) simTab.getComponentAt(i)).getWarning();
((Graph) simTab.getComponentAt(i)).calculateAverageVarianceDeviation(run, 0, direct, warning, true);
}
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
if (outputTerm)
{
ArrayList<String> dataLabels = new ArrayList<String>();
dataLabels.add("time");
ArrayList<ArrayList<Double>> terms = new ArrayList<ArrayList<Double>>();
if (new File(directory + GlobalConstants.separator + "sim-rep.txt").exists())
if (new File(directory + File.separator + "sim-rep.txt").exists())
{
try
{
Scanner s = new Scanner(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
Scanner s = new Scanner(new File(directory + File.separator + "sim-rep.txt"));
if (s.hasNextLine())
{
String[] ss = s.nextLine().split(" ");
@ -2169,7 +2169,7 @@ public class Run implements ActionListener, Observer
e.printStackTrace();
}
}
Scanner scan = new Scanner(new File(directory + GlobalConstants.separator + "term-time.txt"));
Scanner scan = new Scanner(new File(directory + File.separator + "term-time.txt"));
while (scan.hasNextLine())
{
String line = scan.nextLine();
@ -2218,9 +2218,9 @@ public class Run implements ActionListener, Observer
}
}
DataParser probData = new DataParser(dataLabels, data);
probData.outputTSD(directory + GlobalConstants.separator + "term-time.tsd");
probData.outputTSD(directory + File.separator + "term-time.tsd");
probData = new DataParser(dataLabels, percentData);
probData.outputTSD(directory + GlobalConstants.separator + "percent-term-time.tsd");
probData.outputTSD(directory + File.separator + "percent-term-time.tsd");
}
if (refresh)
{
@ -2264,18 +2264,18 @@ public class Run implements ActionListener, Observer
warning = ((Graph) simTab.getComponentAt(i)).getWarning();
((Graph) simTab.getComponentAt(i)).calculateAverageVarianceDeviation(run, 0, direct, warning, true);
}
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
if (outputTerm)
{
ArrayList<String> dataLabels = new ArrayList<String>();
dataLabels.add("time");
ArrayList<ArrayList<Double>> terms = new ArrayList<ArrayList<Double>>();
if (new File(directory + GlobalConstants.separator + "sim-rep.txt").exists())
if (new File(directory + File.separator + "sim-rep.txt").exists())
{
try
{
Scanner s = new Scanner(new File(directory + GlobalConstants.separator + "sim-rep.txt"));
Scanner s = new Scanner(new File(directory + File.separator + "sim-rep.txt"));
if (s.hasNextLine())
{
String[] ss = s.nextLine().split(" ");
@ -2302,7 +2302,7 @@ public class Run implements ActionListener, Observer
e.printStackTrace();
}
}
Scanner scan = new Scanner(new File(directory + GlobalConstants.separator + "term-time.txt"));
Scanner scan = new Scanner(new File(directory + File.separator + "term-time.txt"));
while (scan.hasNextLine())
{
String line = scan.nextLine();
@ -2351,9 +2351,9 @@ public class Run implements ActionListener, Observer
}
}
DataParser probData = new DataParser(dataLabels, data);
probData.outputTSD(directory + GlobalConstants.separator + "term-time.tsd");
probData.outputTSD(directory + File.separator + "term-time.tsd");
probData = new DataParser(dataLabels, percentData);
probData.outputTSD(directory + GlobalConstants.separator + "percent-term-time.tsd");
probData.outputTSD(directory + File.separator + "percent-term-time.tsd");
}
simTab.getComponentAt(i).setName("TSD Graph");
}
@ -2380,7 +2380,7 @@ public class Run implements ActionListener, Observer
}
}
}
new File(directory + GlobalConstants.separator + "running").delete();
new File(directory + File.separator + "running").delete();
logFile.close();
}
catch (InterruptedException e1)

View file

@ -65,8 +65,6 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
private Gui biosim;
private String separator;
private String[] species;
private JScrollPane scroll1;
@ -84,16 +82,15 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
private String[] list;
public DataManager(String directory, Gui biosim) {
separator = GlobalConstants.separator;
this.biosim = biosim;
this.directory = directory;
this.lrnName = directory.split(separator)[directory.split(separator).length - 1];
this.lrnName = GlobalConstants.getFilename(directory);
list = new String[0];
previous = null;
try {
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -176,7 +173,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
dataFile = dataFile.trim();
try {
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : p.keySet().toArray(new String[0])) {
@ -189,7 +186,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
int run = 0;
String[] list = new File(directory).list();
for (int i = 0; i < list.length; i++) {
if (!(new File(directory + separator + list[i]).isDirectory()) && list[i].length() > 4) {
if (!(new File(directory + File.separator + list[i]).isDirectory()) && list[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list[i].charAt(list[i].length() - j) + end;
@ -214,9 +211,9 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
data.add(new ArrayList<Double>());
}
DataParser parser = new DataParser(specs, data);
parser.outputTSD(directory + separator + end);
parser.outputTSD(directory + File.separator + end);
p.setProperty(end, dataFile);
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -230,7 +227,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
files.setListData(s);
this.list = s;
files.setSelectedValue(dataFile, true);
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
catch (IOException e1) {
JOptionPane.showMessageDialog(Gui.frame, "Unable to add new file.", "Error", JOptionPane.ERROR_MESSAGE);
@ -241,7 +238,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
if (files.getSelectedIndices().length > 0) {
try {
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
Object[] delete = files.getSelectedValues();
@ -249,7 +246,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
int run = 0;
String[] list = new File(directory).list();
for (int i = 0; i < list.length; i++) {
if (!(new File(directory + separator + list[i]).isDirectory()) && list[i].length() > 4) {
if (!(new File(directory + File.separator + list[i]).isDirectory()) && list[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list[i].charAt(list[i].length() - j) + end;
@ -267,12 +264,12 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
for (String s : p.keySet().toArray(new String[0])) {
if (p.getProperty(s).equals(file)) {
if (s.equals("run-" + run + ".tsd")) {
new File(directory + separator + s).delete();
new File(directory + File.separator + s).delete();
p.remove(s);
}
else {
new File(directory + separator + s).delete();
new File(directory + separator + "run-" + run + ".tsd").renameTo(new File(directory + separator + s));
new File(directory + File.separator + s).delete();
new File(directory + File.separator + "run-" + run + ".tsd").renameTo(new File(directory + File.separator + s));
p.setProperty(s, p.getProperty("run-" + run + ".tsd"));
p.remove("run-" + run + ".tsd");
}
@ -280,7 +277,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
}
}
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -293,7 +290,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
sort(s);
files.setListData(s);
list = s;
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
this.removeAll();
table = new JTable();
scroll1 = new JScrollPane();
@ -311,7 +308,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
this.revalidate();
this.repaint();
dirty = false;
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
catch (IOException e1) {
JOptionPane.showMessageDialog(Gui.frame, "Unable to remove selected files.", "Error", JOptionPane.ERROR_MESSAGE);
@ -336,7 +333,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
return;
}
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : list) {
@ -351,7 +348,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
p.setProperty(s, rename);
}
}
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -392,7 +389,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
int run = 0;
String[] list = new File(directory).list();
for (int i = 0; i < list.length; i++) {
if (!(new File(directory + separator + list[i]).isDirectory()) && list[i].length() > 4) {
if (!(new File(directory + File.separator + list[i]).isDirectory()) && list[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list[i].charAt(list[i].length() - j) + end;
@ -408,7 +405,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
}
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : this.list) {
@ -421,8 +418,8 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
for (String s : p.keySet().toArray(new String[0])) {
if (p.getProperty(s).equals(files.getSelectedValue())) {
String end = "run-" + (run + 1) + ".tsd";
FileOutputStream out = new FileOutputStream(new File(directory + separator + end));
FileInputStream in = new FileInputStream(new File(directory + separator + s));
FileOutputStream out = new FileOutputStream(new File(directory + File.separator + end));
FileInputStream in = new FileInputStream(new File(directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -433,7 +430,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
p.setProperty(end, copy);
}
}
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -454,21 +451,21 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
}
else if (e.getSource() == copyFromView) {
String root = directory.substring(0, directory.length() - directory.split(separator)[directory.split(separator).length - 1].length());
String root = directory.substring(0, directory.length() - GlobalConstants.getFilename(directory).length());
ArrayList<String> list = new ArrayList<String>();
for (String s : new File(root).list()) {
if (new File(root + separator + s).isDirectory() && !s.equals(directory.split(separator)[directory.split(separator).length - 1])) {
if (new File(root + File.separator + s).isDirectory() && !s.equals(GlobalConstants.getFilename(directory))) {
boolean add = false;
for (String ss : new File(root + separator + s).list()) {
if (new File(root + separator + s + separator + ss).isDirectory()) {
for (String ss : new File(root + File.separator + s).list()) {
if (new File(root + File.separator + s + File.separator + ss).isDirectory()) {
boolean add2 = false;
for (String sss : new File(root + separator + s + separator + ss).list()) {
for (String sss : new File(root + File.separator + s + File.separator + ss).list()) {
if (sss.endsWith(".tsd") && sss.startsWith("run-")) {
add2 = true;
}
}
if (add2) {
list.add(s + separator + ss);
list.add(s + File.separator + ss);
}
}
else if (ss.endsWith(".tsd") && ss.startsWith("run-")) {
@ -498,7 +495,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
int run = 0;
String[] lists = new File(directory).list();
for (int i = 0; i < lists.length; i++) {
if (!(new File(directory + separator + lists[i]).isDirectory()) && lists[i].length() > 4) {
if (!(new File(directory + File.separator + lists[i]).isDirectory()) && lists[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = lists[i].charAt(lists[i].length() - j) + end;
@ -513,17 +510,17 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
}
}
String[] list1 = new File(root + separator + sims.getSelectedValue()).list();
String[] list1 = new File(root + File.separator + sims.getSelectedValue()).list();
Properties p = new Properties();
try {
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
}
catch (IOException e1) {
}
for (int i = 0; i < list1.length; i++) {
if (!(new File(root + separator + sims.getSelectedValue() + separator + list1[i]).isDirectory()) && list1[i].length() > 4) {
if (!(new File(root + File.separator + sims.getSelectedValue() + File.separator + list1[i]).isDirectory()) && list1[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list1[i].charAt(list1[i].length() - j) + end;
@ -531,7 +528,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
if (end.equals(".tsd") && list1[i].startsWith("run-")) {
try {
String last = "run-" + (run + 1) + ".tsd";
TSDParser tsd = new TSDParser(root + separator + sims.getSelectedValue() + separator + list1[i], false);
TSDParser tsd = new TSDParser(root + File.separator + sims.getSelectedValue() + File.separator + list1[i], false);
ArrayList<String> specs = tsd.getSpecies();
ArrayList<ArrayList<Double>> data = tsd.getData();
int a, b;
@ -551,8 +548,8 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
tsd.setSpecies(specs);
tsd.setData(data);
tsd.outputTSD(directory + separator + last);
p.setProperty(last, sims.getSelectedValue() + separator + list1[i]);
tsd.outputTSD(directory + File.separator + last);
p.setProperty(last, sims.getSelectedValue() + File.separator + list1[i]);
run++;
}
catch (Exception e1) {
@ -589,11 +586,11 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
this.revalidate();
this.repaint();
dirty = false;
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
if (ss.length > 0) {
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
}
catch (IOException e1) {
@ -621,7 +618,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
int run = 0;
String[] list = new File(directory).list();
for (int i = 0; i < list.length; i++) {
if (!(new File(directory + separator + list[i]).isDirectory()) && list[i].length() > 4) {
if (!(new File(directory + File.separator + list[i]).isDirectory()) && list[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list[i].charAt(list[i].length() - j) + end;
@ -640,14 +637,14 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
String[] list1 = new File(importFile).list();
Properties p = new Properties();
try {
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
}
catch (IOException e1) {
}
for (int i = 0; i < list1.length; i++) {
if (!(new File(importFile + separator + list1[i]).isDirectory()) && list1[i].length() > 4) {
if (!(new File(importFile + File.separator + list1[i]).isDirectory()) && list1[i].length() > 4) {
String end = "";
for (int j = 1; j < 5; j++) {
end = list1[i].charAt(list1[i].length() - j) + end;
@ -655,7 +652,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
if (end.equals(".tsd")) {
// try {
String last = "run-" + (run + 1) + ".tsd";
TSDParser tsd = new TSDParser(importFile + separator + list1[i], false);
TSDParser tsd = new TSDParser(importFile + File.separator + list1[i], false);
ArrayList<String> specs = tsd.getSpecies();
ArrayList<ArrayList<Double>> data = tsd.getData();
int a, b;
@ -675,8 +672,8 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
tsd.setSpecies(specs);
tsd.setData(data);
tsd.outputTSD(directory + separator + last);
p.setProperty(last, importFile + separator + list1[i]);
tsd.outputTSD(directory + File.separator + last);
p.setProperty(last, importFile + File.separator + list1[i]);
run++;
// }
// catch (IOException e1) {
@ -715,11 +712,11 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
this.revalidate();
this.repaint();
dirty = false;
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
if (s.length > 0) {
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
}
catch (IOException e1) {
@ -762,7 +759,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
}
parse.setSpecies(specs);
parse.setData(data);
parse.outputTSD(directory + separator + end);
parse.outputTSD(directory + File.separator + end);
// ADDED BY SB. DIRTY WAY
TSDParser extractVars;
ArrayList<String> datFileVars = new ArrayList<String>();
@ -770,8 +767,8 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
Boolean varPresent = false;
// Finding the intersection of all the variables
// present in all data files.
for (int i = 1; (new File(directory + separator + "run-" + i + ".tsd")).exists(); i++) {
extractVars = new TSDParser(directory + separator + "run-" + i + ".tsd", false);
for (int i = 1; (new File(directory + File.separator + "run-" + i + ".tsd")).exists(); i++) {
extractVars = new TSDParser(directory + File.separator + "run-" + i + ".tsd", false);
datFileVars = extractVars.getSpecies();
if (i == 1) {
allVars.addAll(datFileVars);
@ -792,11 +789,11 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
species = allVars.toArray(new String[0]);
// ADDED END SB
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
p.setProperty(end, importFile);
FileOutputStream store = new FileOutputStream(new File(directory + separator + lrnName + ".lrn"));
FileOutputStream store = new FileOutputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.store(store, "Learn File Data");
store.close();
ArrayList<String> getValues = new ArrayList<String>();
@ -812,7 +809,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
previous = "";
files.setSelectedValue(importFile, true);
if (s.length > 0) {
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
}
}
@ -842,19 +839,19 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
try {
String file = (String) files.getSelectedValue();
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : p.keySet().toArray(new String[0])) {
if (p.getProperty(s).equals(file)) {
parser.outputTSD(directory + separator + s);
parser.outputTSD(directory + File.separator + s);
}
}
}
catch (IOException e1) {
JOptionPane.showMessageDialog(Gui.frame, "Unable to save file.", "Error", JOptionPane.ERROR_MESSAGE);
}
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
dirty = false;
}
@ -960,7 +957,7 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
public void setDirectory(String directory) {
this.directory = directory;
this.lrnName = directory.split(separator)[directory.split(separator).length - 1];
this.lrnName = GlobalConstants.getFilename(directory);
}
private void createTable(String[][] dat, String[] spec) {
@ -1107,19 +1104,19 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
DataParser parser = new DataParser(species, data);
try {
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : p.keySet().toArray(new String[0])) {
if (p.getProperty(s).equals(previous)) {
parser.outputTSD(directory + separator + s);
parser.outputTSD(directory + File.separator + s);
}
}
}
catch (IOException e1) {
JOptionPane.showMessageDialog(Gui.frame, "Unable to save file.", "Error", JOptionPane.ERROR_MESSAGE);
}
biosim.refreshLearn(directory.split(separator)[directory.split(separator).length - 1]);
biosim.refreshLearn(GlobalConstants.getFilename(directory));
}
dirty = false;
}
@ -1130,16 +1127,16 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
String background;
try {
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
if (p.containsKey("genenet.file")) {
String[] getProp = p.getProperty("genenet.file").split(separator);
background = directory.substring(0, directory.length() - lrnName.length()) + separator + getProp[getProp.length - 1];
String[] getProp = GlobalConstants.splitPath(p.getProperty("genenet.file"));
background = directory.substring(0, directory.length() - lrnName.length()) + File.separator + getProp[getProp.length - 1];
}
else if (p.containsKey("learn.file")) {
String[] getProp = p.getProperty("learn.file").split(separator);
background = directory.substring(0, directory.length() - lrnName.length()) + separator + getProp[getProp.length - 1];
String[] getProp = GlobalConstants.splitPath(p.getProperty("learn.file"));
background = directory.substring(0, directory.length() - lrnName.length()) + File.separator + getProp[getProp.length - 1];
}
else {
background = null;
@ -1190,8 +1187,8 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
Boolean varPresent = false;
// Finding the intersection of all the variables present in all
// data files.
for (int i = 1; (new File(directory + separator + "run-" + i + ".tsd")).exists(); i++) {
extractVars = new TSDParser(directory + separator + "run-" + i + ".tsd", false);
for (int i = 1; (new File(directory + File.separator + "run-" + i + ".tsd")).exists(); i++) {
extractVars = new TSDParser(directory + File.separator + "run-" + i + ".tsd", false);
datFileVars = extractVars.getSpecies();
if (i == 1) {
allVars.addAll(datFileVars);
@ -1301,12 +1298,12 @@ public class DataManager extends JPanel implements ActionListener, TableModelLis
try {
saveChanges(null);
Properties p = new Properties();
FileInputStream load = new FileInputStream(new File(directory + separator + lrnName + ".lrn"));
FileInputStream load = new FileInputStream(new File(directory + File.separator + lrnName + ".lrn"));
p.load(load);
load.close();
for (String s : p.keySet().toArray(new String[0])) {
if (p.getProperty(s).equals(file)) {
TSDParser tsd = new TSDParser(directory + separator + s, false);
TSDParser tsd = new TSDParser(directory + File.separator + s, false);
ArrayList<String> specs = tsd.getSpecies();
ArrayList<ArrayList<Double>> data = tsd.getData();
for (String sp : species) {

View file

@ -138,8 +138,6 @@ public class LearnView extends JPanel implements ActionListener, Runnable
private Log log;
private String separator;
private Gui biosim;
private String learnFile;
@ -165,11 +163,10 @@ public class LearnView extends JPanel implements ActionListener, Runnable
*/
public LearnView(String directory, Log log, Gui biosim)
{
separator = GlobalConstants.separator;
this.biosim = biosim;
this.log = log;
this.directory = directory;
String[] getFilename = directory.split(separator);
String[] getFilename = GlobalConstants.splitPath(directory);
lrnFile = getFilename[getFilename.length - 1] + ".lrn";
Preferences biosimrc = Preferences.userRoot();
// Sets up the encodings area
@ -400,13 +397,13 @@ public class LearnView extends JPanel implements ActionListener, Runnable
learnFile = "";
try
{
FileInputStream in = new FileInputStream(new File(directory + separator + lrnFile));
FileInputStream in = new FileInputStream(new File(directory + File.separator + lrnFile));
load.load(in);
in.close();
if (load.containsKey("genenet.file"))
{
String[] getProp = load.getProperty("genenet.file").split(separator);
learnFile = directory.substring(0, directory.length() - getFilename[getFilename.length - 1].length()) + separator + getProp[getProp.length - 1];
String[] getProp = GlobalConstants.splitPath(load.getProperty("genenet.file"));
learnFile = directory.substring(0, directory.length() - getFilename[getFilename.length - 1].length()) + File.separator + getProp[getProp.length - 1];
backgroundField.setText(getProp[getProp.length - 1]);
}
if (load.containsKey("genenet.Tn"))
@ -502,7 +499,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
try {
document = SBMLutilities.readSBML(learnFile);
Model model = document.getModel();
FileWriter write = new FileWriter(new File(directory + separator + "background.gcm"));
FileWriter write = new FileWriter(new File(directory + File.separator + "background.gcm"));
write.write("digraph G {\n");
for (int i = 0; i < model.getSpeciesCount(); i++)
{
@ -575,7 +572,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
BioModel bioModel = new BioModel(biosim.getRoot());
bioModel.load(learnFile);
speciesList = bioModel.getSpecies();
FileWriter write = new FileWriter(new File(directory + separator + "background.gcm"));
FileWriter write = new FileWriter(new File(directory + File.separator + "background.gcm"));
BufferedReader input = new BufferedReader(new FileReader(new File(learnFile)));
String line = null;
while ((line = input.readLine()) != null)
@ -622,12 +619,12 @@ public class LearnView extends JPanel implements ActionListener, Runnable
// runHolder.add(viewLog);
viewLog.addActionListener(this);
viewLog.setMnemonic(KeyEvent.VK_R);
if (!(new File(directory + separator + "method.gcm").exists()))
if (!(new File(directory + File.separator + "method.gcm").exists()))
{
viewModel.setEnabled(false);
saveModel.setEnabled(false);
}
if (!(new File(directory + separator + "run.log").exists()))
if (!(new File(directory + File.separator + "run.log").exists()))
{
viewLog.setEnabled(false);
}
@ -785,7 +782,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
{
try
{
FileWriter write = new FileWriter(new File(directory + separator + "levels.lvl"));
FileWriter write = new FileWriter(new File(directory + File.separator + "levels.lvl"));
write.write("time, 0\n");
for (int i = 0; i < species.size(); i++)
{
@ -881,7 +878,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
{
if (!readfile)
{
FileWriter write = new FileWriter(new File(directory + separator + "levels.lvl"));
FileWriter write = new FileWriter(new File(directory + File.separator + "levels.lvl"));
write.write("time, 0\n");
for (int i = 0; i < species.size(); i++)
{
@ -939,7 +936,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
InputStream reb = learn.getInputStream();
InputStreamReader isr = new InputStreamReader(reb);
BufferedReader br = new BufferedReader(isr);
FileWriter out = new FileWriter(new File(directory + separator + "run.log"));
FileWriter out = new FileWriter(new File(directory + File.separator + "run.log"));
while ((output = br.readLine()) != null)
{
out.write(output);
@ -956,7 +953,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
}
learn.waitFor();
}
Scanner f = new Scanner(new File(directory + separator + "levels.lvl"));
Scanner f = new Scanner(new File(directory + File.separator + "levels.lvl"));
str = new ArrayList<String>();
while (f.hasNextLine())
{
@ -1235,7 +1232,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
public void saveModel()
{
if (new File(directory + separator + "method.gcm").exists())
if (new File(directory + File.separator + "method.gcm").exists())
{
String copy = null;
while (copy == null)
@ -1272,7 +1269,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
copy += ".gcm";
}
}
biosim.saveGCM(copy, directory + separator + "method.gcm");
biosim.saveGCM(copy, directory + File.separator + "method.gcm");
}
else
{
@ -1285,19 +1282,19 @@ public class LearnView extends JPanel implements ActionListener, Runnable
try
{
File work = new File(directory);
if (new File(directory + separator + "method.gcm").exists())
if (new File(directory + File.separator + "method.gcm").exists())
{
if (System.getProperty("os.name").contentEquals("Linux"))
{
String command = "dotty method.gcm";
log.addText("Executing:\n" + "dotty " + directory + separator + "method.gcm\n");
log.addText("Executing:\n" + "dotty " + directory + File.separator + "method.gcm\n");
Runtime exec = Runtime.getRuntime();
exec.exec(command, null, work);
}
else if (System.getProperty("os.name").toLowerCase().startsWith("mac os"))
{
String command = "open method.dot";
log.addText("Executing:\n" + "open " + directory + separator + "method.dot\n");
log.addText("Executing:\n" + "open " + directory + File.separator + "method.dot\n");
Runtime exec = Runtime.getRuntime();
//exec.exec("cp method.gcm method.dot", null, work);
//exec = Runtime.getRuntime();
@ -1306,7 +1303,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
else
{
String command = "dotty method.gcm";
log.addText("Executing:\n" + "dotty " + directory + separator + "method.gcm\n");
log.addText("Executing:\n" + "dotty " + directory + File.separator + "method.gcm\n");
Runtime exec = Runtime.getRuntime();
exec.exec(command, null, work);
}
@ -1326,9 +1323,9 @@ public class LearnView extends JPanel implements ActionListener, Runnable
{
try
{
if (new File(directory + separator + "run.log").exists())
if (new File(directory + File.separator + "run.log").exists())
{
File log = new File(directory + separator + "run.log");
File log = new File(directory + File.separator + "run.log");
FileInputStream input = new FileInputStream(log);
JTextArea messageArea = new JTextArea();
int read = -1;
@ -1360,7 +1357,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
try
{
Properties prop = new Properties();
FileInputStream in = new FileInputStream(new File(directory + separator + lrnFile));
FileInputStream in = new FileInputStream(new File(directory + File.separator + lrnFile));
prop.load(in);
in.close();
prop.setProperty("genenet.file", learnFile);
@ -1409,12 +1406,12 @@ public class LearnView extends JPanel implements ActionListener, Runnable
{
prop.setProperty("genenet.find.base.prob", "false");
}
log.addText("Saving learn parameters to file:\n" + directory + separator + lrnFile + "\n");
FileOutputStream out = new FileOutputStream(new File(directory + separator + lrnFile));
log.addText("Saving learn parameters to file:\n" + directory + File.separator + lrnFile + "\n");
FileOutputStream out = new FileOutputStream(new File(directory + File.separator + lrnFile));
prop.store(out, learnFile);
out.close();
log.addText("Creating levels file:\n" + directory + separator + "levels.lvl\n");
FileWriter write = new FileWriter(new File(directory + separator + "levels.lvl"));
log.addText("Creating levels file:\n" + directory + File.separator + "levels.lvl\n");
FileWriter write = new FileWriter(new File(directory + File.separator + "levels.lvl"));
write.write("time, 0\n");
for (int i = 0; i < species.size(); i++)
{
@ -1593,7 +1590,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
FileWriter write;
try
{
write = new FileWriter(new File(directory + separator + "levels.lvl"));
write = new FileWriter(new File(directory + File.separator + "levels.lvl"));
write.write("time, 0\n");
for (int i = 0; i < species.size(); i++)
{
@ -1764,7 +1761,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
InputStream reb = learn.getInputStream();
InputStreamReader isr = new InputStreamReader(reb);
BufferedReader br = new BufferedReader(isr);
FileWriter out = new FileWriter(new File(directory + separator + "run.log"));
FileWriter out = new FileWriter(new File(directory + File.separator + "run.log"));
int count = 0;
while ((output = br.readLine()) != null)
{
@ -1803,13 +1800,13 @@ public class LearnView extends JPanel implements ActionListener, Runnable
opendot(exec, work);
running.setCursor(null);
running.dispose();
if (new File(directory + separator + "method.gcm").exists())
if (new File(directory + File.separator + "method.gcm").exists())
{
viewModel.setEnabled(true);
saveModel.setEnabled(true);
saveModel();
}
if (new File(directory + separator + "run.log").exists())
if (new File(directory + File.separator + "run.log").exists())
{
viewLog.setEnabled(true);
}
@ -1819,21 +1816,21 @@ public class LearnView extends JPanel implements ActionListener, Runnable
private void opendot(Runtime exec, File work)
{
if (new File(directory + separator + "method.gcm").exists())
if (new File(directory + File.separator + "method.gcm").exists())
{
try
{
if (System.getProperty("os.name").contentEquals("Linux"))
{
String command = "dotty method.gcm";
log.addText("Executing:\n" + "dotty " + directory + separator + "method.gcm\n");
log.addText("Executing:\n" + "dotty " + directory + File.separator + "method.gcm\n");
exec = Runtime.getRuntime();
exec.exec(command, null, work);
}
else if (System.getProperty("os.name").toLowerCase().startsWith("mac os"))
{
String command = "open method.dot";
log.addText("Executing:\n" + "open " + directory + separator + "method.dot\n");
log.addText("Executing:\n" + "open " + directory + File.separator + "method.dot\n");
exec = Runtime.getRuntime();
//exec.exec("cp method.gcm method.dot", null, work);
//exec = Runtime.getRuntime();
@ -1842,7 +1839,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
else
{
String command = "dotty method.gcm";
log.addText("Executing:\n" + "dotty " + directory + separator + "method.gcm\n");
log.addText("Executing:\n" + "dotty " + directory + File.separator + "method.gcm\n");
exec = Runtime.getRuntime();
exec.exec(command, null, work);
}
@ -1907,7 +1904,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
{
SBMLDocument document = SBMLutilities.readSBML(learnFile);
Model model = document.getModel();
FileWriter write = new FileWriter(new File(directory + separator + "background.gcm"));
FileWriter write = new FileWriter(new File(directory + File.separator + "background.gcm"));
write.write("digraph G {\n");
for (int i = 0; i < model.getSpeciesCount(); i++)
{
@ -1978,7 +1975,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
BioModel bioModel = new BioModel(biosim.getRoot());
bioModel.load(learnFile);
speciesList = bioModel.getSpecies();
FileWriter write = new FileWriter(new File(directory + separator + "background.gcm"));
FileWriter write = new FileWriter(new File(directory + File.separator + "background.gcm"));
BufferedReader input = new BufferedReader(new FileReader(new File(learnFile)));
String line = null;
while ((line = input.readLine()) != null)
@ -2026,7 +2023,7 @@ public class LearnView extends JPanel implements ActionListener, Runnable
public void setDirectory(String directory)
{
this.directory = directory;
String[] getFilename = directory.split(separator);
String[] getFilename = GlobalConstants.splitPath(directory);
lrnFile = getFilename[getFilename.length - 1] + ".lrn";
}

View file

@ -23,7 +23,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import javax.swing.DefaultListModel;
import javax.swing.DefaultListSelectionModel;
@ -56,29 +55,21 @@ import edu.utah.ece.async.ibiosim.gui.Gui;
public class ParamEstimatorPanel extends JPanel implements ActionListener, Runnable, ListSelectionListener
{
/**
*
*/
private static final long serialVersionUID = 1L;
private JComboBox methods;
private final String[] methodNames = { "None", "SRES" };
private String directory, filename;
private String separator;
private Gui biosim;
private ArrayList<String> parameterList;
private SBMLDocument sbmlDocument;
private Pattern IDpat = Pattern.compile("([a-zA-Z]|_)([a-zA-Z]|[0-9]|_)*");
private JList list, list2;
JButton add, remove, insertBound;
// Specify bounds
private JTextField up, lw, paramId;
/**
* This is the constructor for the Learn class. It initializes all the input
* fields, puts them on panels, adds the panels to the frame, and then
@ -103,11 +94,6 @@ public class ParamEstimatorPanel extends JPanel implements ActionListener, Runna
return;
}
this.separator = GlobalConstants.separator;
this.biosim = biosim;
this.directory = directory;
this.filename = filename;
Model model = sbmlDocument.getModel();
DefaultListModel listmodel1 = new DefaultListModel();
@ -119,7 +105,7 @@ public class ParamEstimatorPanel extends JPanel implements ActionListener, Runna
listmodel1.add(count++, param.getId());
}
String[] fileArray = filename.split(separator);
String[] fileArray = GlobalConstants.splitPath(filename);
String file = fileArray[fileArray.length - 1];
JPanel thresholdPanel1 = new JPanel(new GridLayout(2, 2));
JLabel backgroundLabel = new JLabel("Model File:");

View file

@ -34,7 +34,6 @@ import javax.swing.JTextArea;
import javax.swing.JTextField;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.ibiosim.gui.Gui;
import edu.utah.ece.async.ibiosim.gui.modelEditor.util.AbstractRunnableNamedButton;
@ -63,7 +62,7 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
private PropertyList variables, places, transitions, controlFlow,
properties;
private String filename = "", directory = "", separator = "";
private String filename = "", directory = "";
private String[] varOptions = new String[] { "Boolean", "Continuous",
"Discrete" };
@ -87,8 +86,6 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
super();
this.biosim = biosim;
addMouseListener(biosim);
separator = GlobalConstants.separator;
lhpnFile = lhpn;
if (lhpnFile == null) {
@ -96,10 +93,10 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
}
this.directory = directory;
if (filename != null) {
File f = new File(directory + separator + filename);
File f = new File(directory + File.separator + filename);
if (!(f.length() == 0)) {
try {
lhpnFile.load(directory + separator + filename);
lhpnFile.load(directory + File.separator + filename);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
@ -242,7 +239,7 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
}
public void save() {
lhpnFile.save(directory + separator + filename);
lhpnFile.save(directory + File.separator + filename);
dirty = false;
biosim.updateAsyncViews(filename);
}
@ -251,8 +248,8 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
if (newName.endsWith(".xml")) {
Translator t1 = new Translator();
try {
t1.convertLPN2SBML(directory + separator + filename, "");
t1.setFilename(directory + separator + newName);
t1.convertLPN2SBML(directory + File.separator + filename, "");
t1.setFilename(directory + File.separator + newName);
t1.outputSBML();
biosim.addToTree(newName);
} catch (BioSimException e) {
@ -260,7 +257,7 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
}
} else {
dirty = false;
lhpnFile.save(directory + separator + newName);
lhpnFile.save(directory + File.separator + newName);
reload(newName);
biosim.addToTree(newName);
biosim.updateAsyncViews(newName);
@ -270,19 +267,19 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
public void viewLhpn() {
try {
File work = new File(directory);
if (new File(directory + separator + filename).exists()) {
if (new File(directory + File.separator + filename).exists()) {
String dotFile = filename.replace(".lpn", ".dot");
File dot = new File(directory + separator + dotFile);
File dot = new File(directory + File.separator + dotFile);
dot.delete();
Preferences biosimrc = Preferences.userRoot();
String command = biosimrc.get("biosim.general.graphviz", "");
command = command + " " + dotFile;
Runtime exec = Runtime.getRuntime();
lhpnFile.printDot(directory + separator + dotFile);
lhpnFile.printDot(directory + File.separator + dotFile);
if (dot.exists()) {
exec.exec(command, null, work);
} else {
File log = new File(directory + separator + "atacs.log");
File log = new File(directory + File.separator + "atacs.log");
BufferedReader input = new BufferedReader(new FileReader(
log));
String line = null;
@ -317,9 +314,9 @@ public class LHPNEditor extends JPanel implements ActionListener, MouseListener
public void reload(String newName) {
filename = newName + ".lpn";
if (new File(directory + separator + newName).exists()) {
if (new File(directory + File.separator + newName).exists()) {
try {
lhpnFile.load(directory + separator + newName);
lhpnFile.load(directory + File.separator + newName);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();

View file

@ -19,6 +19,7 @@ import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -217,7 +218,7 @@ public class DropComponentPanel extends JPanel implements ActionListener {
//don't allow dropping a grid component
try {
if (compGCM.getGridEnabledFromFile(bioModel.getPath() + GlobalConstants.separator + component.replace(".gcm",".xml"))) {
if (compGCM.getGridEnabledFromFile(bioModel.getPath() + File.separator + component.replace(".gcm",".xml"))) {
JOptionPane.showMessageDialog(Gui.frame,
"Dropping grid modules is disallowed.\n" +
@ -293,7 +294,7 @@ public class DropComponentPanel extends JPanel implements ActionListener {
BioModel compGCMFile = new BioModel(bioModel.getPath());
try {
compGCMFile.load(bioModel.getPath() + GlobalConstants.separator + component);
compGCMFile.load(bioModel.getPath() + File.separator + component);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
@ -351,7 +352,7 @@ public class DropComponentPanel extends JPanel implements ActionListener {
//don't allow grids within a grid
try {
if (compGCM.getGridEnabledFromFile(bioModel.getPath() + GlobalConstants.separator + component.replace(".gcm",".xml"))) {
if (compGCM.getGridEnabledFromFile(bioModel.getPath() + File.separator + component.replace(".gcm",".xml"))) {
JOptionPane.showMessageDialog(Gui.frame,
"Dropping grid modules is disallowed.\n" +
"Please choose a different module.",
@ -446,7 +447,7 @@ public class DropComponentPanel extends JPanel implements ActionListener {
for(int col=0; col<colCount; col++) {
BioModel compBioModel = new BioModel(bioModel.getPath());
try {
compBioModel.load(bioModel.getPath() + GlobalConstants.separator + comp);
compBioModel.load(bioModel.getPath() + File.separator + comp);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();

View file

@ -17,6 +17,7 @@ import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@ -1047,7 +1048,7 @@ public class Grid {
if (!compGCM.equals("none")) {
BioModel compGCMFile = new BioModel(bioModel.getPath());
try {
compGCMFile.load(bioModel.getPath() + GlobalConstants.separator + compGCM);
compGCMFile.load(bioModel.getPath() + File.separator + compGCM);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();

View file

@ -18,6 +18,7 @@ import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -149,7 +150,7 @@ public class GridPanel extends JPanel implements ActionListener {
//don't allow dropping a grid component
try {
if (component != "none" && compGCM.getGridEnabledFromFile(gcm.getPath() +
GlobalConstants.separator + component.replace(".gcm",".xml"))) {
File.separator + component.replace(".gcm",".xml"))) {
JOptionPane.showMessageDialog(Gui.frame,
"Dropping grid modules is disallowed.\n" +
@ -278,7 +279,7 @@ public class GridPanel extends JPanel implements ActionListener {
//don't allow dropping a grid component
try {
if (!component.equals("none") && compGCM.getGridEnabledFromFile(gcm.getPath() +
GlobalConstants.separator + component.replace(".gcm",".xml"))) {
File.separator + component.replace(".gcm",".xml"))) {
JOptionPane.showMessageDialog(Gui.frame,
"Dropping grid modules is disallowed.\n" +

View file

@ -49,8 +49,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@ -181,7 +179,7 @@ public class MovieContainer extends JPanel implements ActionListener {
for (String s : new File(directoryName).list()) {
String fullFileName = directoryName + GlobalConstants.separator + s;
String fullFileName = directoryName + File.separator + s;
File f = new File(fullFileName);
if (s.endsWith(".tsd") || s.endsWith(".dtsd") && f.isFile()) {
@ -300,13 +298,13 @@ public class MovieContainer extends JPanel implements ActionListener {
movieToolbar.addSeparator();
rewindButton = makeToolButton("movie" + GlobalConstants.separator + "rewind.png", "rewind", "Rewind", this);
rewindButton = makeToolButton("movie" + File.separator + "rewind.png", "rewind", "Rewind", this);
movieToolbar.add(rewindButton);
singleStepButton = makeToolButton("movie" + GlobalConstants.separator + "single_step.png", "singlestep", "Single Step", this);
singleStepButton = makeToolButton("movie" + File.separator + "single_step.png", "singlestep", "Single Step", this);
movieToolbar.add(singleStepButton);
playPauseButton = makeToolButton("movie" + GlobalConstants.separator + "play.png", "playpause", "Play", this);
playPauseButton = makeToolButton("movie" + File.separator + "play.png", "playpause", "Play", this);
movieToolbar.add(playPauseButton);
slider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0);
@ -427,13 +425,13 @@ public class MovieContainer extends JPanel implements ActionListener {
slider.setValue(0);
playTimer.setDelay(FRAME_DELAY_MILLISECONDS);
setIcon(playPauseButton, "movie" + GlobalConstants.separator + "pause.png");
setIcon(playPauseButton, "movie" + File.separator + "pause.png");
playTimer.start();
mode = PLAYING;
}
else{
setIcon(playPauseButton, "movie" + GlobalConstants.separator + "play.png");
setIcon(playPauseButton, "movie" + File.separator + "play.png");
playTimer.stop();
mode = PAUSED;
}
@ -786,10 +784,8 @@ public class MovieContainer extends JPanel implements ActionListener {
}
}
String separator = GlobalConstants.separator;
String filenum = String.format("%09d", fileNumber);
schematic.outputFrame(analysisView.getRootPath() + separator + filenum + ".jpg", scale);
schematic.outputFrame(analysisView.getRootPath() + File.separator + filenum + ".jpg", scale);
}
/**
@ -797,14 +793,12 @@ public class MovieContainer extends JPanel implements ActionListener {
*/
private void removeJPGs() {
String separator = GlobalConstants.separator;
//remove all created jpg files
for (int jpgNum = 0; jpgNum <= slider.getMaximum(); ++jpgNum) {
String jpgNumString = String.format("%09d", jpgNum);
String jpgFilename =
analysisView.getRootPath() + separator + jpgNumString + ".jpg";
analysisView.getRootPath() + File.separator + jpgNumString + ".jpg";
File jpgFile = new File(jpgFilename);
if (jpgFile.exists() && jpgFile.canWrite())
@ -937,7 +931,7 @@ public class MovieContainer extends JPanel implements ActionListener {
private String getPreferencesFullPath() {
String path = analysisView.getSimPath();
String fullPath = path + GlobalConstants.separator + "schematic_preferences.json";
String fullPath = path + File.separator + "schematic_preferences.json";
return fullPath;
}
@ -1010,15 +1004,13 @@ public class MovieContainer extends JPanel implements ActionListener {
progressBar.setValue((100 * (currentFrame - startFrame) / (endFrame - startFrame)));
}
String separator = GlobalConstants.separator;
String path = "";
String movieName = "";
if (outputFilename.contains(separator)) {
if (outputFilename.contains(File.separator)) {
path = outputFilename.substring(0, outputFilename.lastIndexOf(separator));
movieName = outputFilename.substring(outputFilename.lastIndexOf(separator)+1, outputFilename.length());
path = outputFilename.substring(0, outputFilename.lastIndexOf(File.separator));
movieName = outputFilename.substring(outputFilename.lastIndexOf(File.separator)+1, outputFilename.length());
}
if (movieName.contains("."))
@ -1036,8 +1028,8 @@ public class MovieContainer extends JPanel implements ActionListener {
"ffmpeg " + "-y " +
"-r " + "5 " +
"-b " + "5000k " +
"-i " + analysisView.getRootPath() + separator + "%09d.jpg " +
path + separator + movieName + ".mp4";
"-i " + analysisView.getRootPath() + File.separator + "%09d.jpg " +
path + File.separator + movieName + ".mp4";
}
else if (movieFormat.equals("avi")) {
//args for ffmpeg
@ -1046,8 +1038,8 @@ public class MovieContainer extends JPanel implements ActionListener {
"-r " + "5 " +
"-vcodec " + "copy " +
"-b " + "5000k " +
"-i " + analysisView.getRootPath() + separator + "%09d.jpg " +
path + separator + movieName + ".avi";
"-i " + analysisView.getRootPath() + File.separator + "%09d.jpg " +
path + File.separator + movieName + ".avi";
}
//run ffmpeg to generate the movie file

View file

@ -16,6 +16,7 @@ package edu.utah.ece.async.ibiosim.gui.modelEditor.sbol;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@ -387,7 +388,7 @@ public class SBOLAssociationPanel2 extends JPanel implements ActionListener {
}
if (dnaComponent != null) {
SBOLDescriptorPanel2 descriptorPanel = new SBOLDescriptorPanel2(
SBOLFileName.substring(SBOLFileName.lastIndexOf(GlobalConstants.separator) + 1),
GlobalConstants.getPath(SBOLFileName) + File.separator,
dnaComponent.getDisplayId(), dnaComponent.getName(), dnaComponent.getDescription());
descriptorPanel.openViewer();
}

View file

@ -16,6 +16,7 @@ package edu.utah.ece.async.ibiosim.gui.modelEditor.sbol;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@ -101,9 +102,7 @@ public class SBOLDescriptorPanel2 extends JPanel implements ActionListener {
saveFilePaths.add("Save to New File");
saveFileIDBox = new JComboBox();
for (String saveFilePath : saveFilePaths) {
String regex = GlobalConstants.separator;
String[] splitPath = saveFilePath.split(regex);
saveFileIDBox.addItem(splitPath[splitPath.length - 1]);
saveFileIDBox.addItem(GlobalConstants.getFilename(saveFilePath));
}
add(new JLabel("SBOL ComponentDefinition ID:"));
@ -178,7 +177,7 @@ public class SBOLDescriptorPanel2 extends JPanel implements ActionListener {
SBOLDocument newSBOLDoc = new SBOLDocument();
newSBOLDoc.setDefaultURIprefix(EditPreferences.getDefaultUriPrefix());
String filePath = identityManager.getBioModel().getPath() + GlobalConstants.separator + newName;
String filePath = identityManager.getBioModel().getPath() + File.separator + newName;
try
{
newSBOLDoc.write(filePath);

View file

@ -1340,7 +1340,7 @@ public class BioGraph extends mxGraph {
BioModel compBioModel = new BioModel(bioModel.getPath());
String modelFileName = bioModel.getModelFileName(id);
try {
compBioModel.load(bioModel.getPath() + GlobalConstants.separator + modelFileName);
compBioModel.load(bioModel.getPath() + File.separator + modelFileName);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
@ -2294,11 +2294,11 @@ public class BioGraph extends mxGraph {
if (modelFileName.equals("")) {
return false;
}
File compFile = new File(bioModel.getPath() + GlobalConstants.separator + modelFileName);
File compFile = new File(bioModel.getPath() + File.separator + modelFileName);
if (compFile.exists()) {
try {
compBioModel.load(bioModel.getPath() + GlobalConstants.separator + modelFileName);
compBioModel.load(bioModel.getPath() + File.separator + modelFileName);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();

View file

@ -184,8 +184,6 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
private ElementsPanel elementsPanel;
private String separator;
private ModelPanel modelPanel;
private Schematic schematic;
@ -235,7 +233,6 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
public ModelEditor(String path, String filename, Gui biosim, Log log, boolean paramsOnly, String simName,
String paramFile, AnalysisView analysisView, boolean textBased, boolean grid) throws Exception {
super();
separator = GlobalConstants.separator;
this.biosim = biosim;
this.log = log;
this.path = path;
@ -269,7 +266,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
biomodel = new BioModel(path);
biomodel.addObserver(this);
if (filename != null) {
biomodel.load(path + separator + filename);
biomodel.load(path + File.separator + filename);
this.filename = filename;
this.modelId = filename.replace(".gcm", "").replace(".xml", "");
} else {
@ -307,7 +304,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
filename = newName + ".xml";
modelId = newName;
try {
biomodel.load(path + separator + newName + ".xml");
biomodel.load(path + File.separator + newName + ".xml");
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -418,7 +415,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
public void save(boolean check) {
setDirty(false);
speciesPanel.refreshSpeciesPanel(biomodel);
GeneticNetwork.setRoot(path + separator);
GeneticNetwork.setRoot(path + File.separator);
// Annotate SBML model with synthesized SBOL DNA component and save
// component to local SBOL file
@ -443,7 +440,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
}
}
try {
biomodel.save(path + separator + modelId + ".xml");
biomodel.save(path + File.separator + modelId + ".xml");
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -453,12 +450,12 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
log.addText("Saving SBML file:\n" + path + separator + modelId + ".xml");
log.addText("Saving SBML file:\n" + path + File.separator + modelId + ".xml");
// saveAsSBOL2();
// log.addText("Converting SBML into SBOL and saving into the project's
// SBOL library.");
if (check) {
Utils.check(path + separator + modelId + ".xml", biomodel.getSBMLDocument(), false);
Utils.check(path + File.separator + modelId + ".xml", biomodel.getSBMLDocument(), false);
}
biosim.updateViews(modelId + ".xml");
@ -663,7 +660,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
String exportFilePath = edu.utah.ece.async.ibiosim.gui.util.Utility.browse(Gui.frame, lastFilePath, null,
JFileChooser.FILES_ONLY, "Export " + fileType.replace("1", ""), -1);
if (!exportFilePath.equals("")) {
String dir = exportFilePath.substring(0, exportFilePath.lastIndexOf(GlobalConstants.separator));
String dir = GlobalConstants.getPath(exportFilePath);
biosimrc.put("biosim.general.export_dir", dir);
if (fileType.equals("SBOL")) {
@ -839,14 +836,14 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
String exportPath = edu.utah.ece.async.ibiosim.gui.util.Utility.browse(Gui.frame, lastFilePath, null,
JFileChooser.FILES_ONLY, "Export " + "SBML", -1);
if (!exportPath.equals("")) {
String dir = exportPath.substring(0, exportPath.lastIndexOf(GlobalConstants.separator));
String dir = GlobalConstants.getPath(exportPath);
biosimrc.put("biosim.general.export_dir", dir);
GCMParser parser;
try {
parser = new GCMParser(path + separator + modelId + ".xml");
parser = new GCMParser(path + File.separator + modelId + ".xml");
GeneticNetwork network = null;
BioModel bioModel = new BioModel(path);
bioModel.load(path + separator + modelId + ".xml");
bioModel.load(path + File.separator + modelId + ".xml");
SBMLDocument sbml = bioModel.flattenModel(true);
if (sbml == null)
return;
@ -871,17 +868,17 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
}
public void saveAsVerilog(String newName) {
if (new File(path + separator + newName).exists()) {
if (new File(path + File.separator + newName).exists()) {
int value = JOptionPane.showOptionDialog(Gui.frame, newName + " already exists. Overwrite file?",
"Save file", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (value == JOptionPane.NO_OPTION) {
return;
}
}
log.addText("Saving SBML file as SystemVerilog file:\n" + path + separator + newName + "\n");
log.addText("Saving SBML file as SystemVerilog file:\n" + path + File.separator + newName + "\n");
try {
if (saveLPN(biomodel, path + separator + newName.replace(".sv", ".lpn"))) {
Lpn2verilog.convert(path + separator + newName.replace(".sv", ".lpn"));
if (saveLPN(biomodel, path + File.separator + newName.replace(".sv", ".lpn"))) {
Lpn2verilog.convert(path + File.separator + newName.replace(".sv", ".lpn"));
biosim.addToTree(newName);
}
} catch (XMLStreamException e) {
@ -899,16 +896,16 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
}
public void saveAsLPN(String newName) {
if (new File(path + separator + newName).exists()) {
if (new File(path + File.separator + newName).exists()) {
int value = JOptionPane.showOptionDialog(Gui.frame, newName + " already exists. Overwrite file?",
"Save file", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (value == JOptionPane.NO_OPTION) {
return;
}
}
log.addText("Saving SBML file as LPN file:\n" + path + separator + newName + "\n");
log.addText("Saving SBML file as LPN file:\n" + path + File.separator + newName + "\n");
try {
if (saveLPN(biomodel, path + separator + newName)) {
if (saveLPN(biomodel, path + File.separator + newName)) {
biosim.addToTree(newName);
}
} catch (XMLStreamException e) {
@ -926,20 +923,20 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
public void saveAs(String newName) {
try {
if (new File(path + separator + newName + ".xml").exists()) {
if (new File(path + File.separator + newName + ".xml").exists()) {
int value = JOptionPane.showOptionDialog(Gui.frame, newName + " already exists. Overwrite file?",
"Save file", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (value == JOptionPane.YES_OPTION) {
biomodel.save(path + separator + newName + ".xml");
log.addText("Saving SBML file as:\n" + path + separator + newName + ".xml\n");
biomodel.save(path + File.separator + newName + ".xml");
log.addText("Saving SBML file as:\n" + path + File.separator + newName + ".xml\n");
biosim.addToTree(newName + ".xml");
} else {
// Do nothing
return;
}
} else {
biomodel.save(path + separator + newName + ".xml");
log.addText("Saving SBML file as:\n" + path + separator + newName + ".xml\n");
biomodel.save(path + File.separator + newName + ".xml");
log.addText("Saving SBML file as:\n" + path + File.separator + newName + ".xml\n");
biosim.addToTree(newName + ".xml");
}
biosim.updateTabName(modelId + ".xml", newName + ".xml");
@ -969,7 +966,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
String exportPath = edu.utah.ece.async.ibiosim.gui.util.Utility.browse(Gui.frame, lastFilePath, null,
JFileChooser.FILES_ONLY, "Export " + "Schematic", -1);
if (!exportPath.equals("")) {
String dir = exportPath.substring(0, exportPath.lastIndexOf(GlobalConstants.separator));
String dir = GlobalConstants.getPath(exportPath);
biosimrc.put("biosim.general.export_dir", dir);
schematic.outputFrame(exportPath, false);
log.addText("Exporting schmeatic image:\n" + exportPath + "\n");
@ -1182,7 +1179,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
sweepTwo += "_" + sweepThese2.get(i) + "=" + sweep2.get(i).get(k);
}
}
new File(path + separator + simName + separator + stem
new File(path + File.separator + simName + File.separator + stem
+ sweepTwo.replace("/", "-").replace("-> ", "").replace("+> ", "")
.replace("-| ", "").replace("x> ", "").replace("\"", "").replace(" ", "_")
.replace(",", "")).mkdir();
@ -1201,7 +1198,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
}
}
} else {
new File(path + separator + simName + separator + stem
new File(path + File.separator + simName + File.separator + stem
+ sweep.replace("/", "-").replace("-> ", "").replace("+> ", "").replace("-| ", "")
.replace("x> ", "").replace("\"", "").replace(" ", "_").replace(",", ""))
.mkdir();
@ -1225,7 +1222,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
new ConstraintTermThread(analysisView).start(threads, dirs, levelOne, stem);
} else {
if (!stem.equals("")) {
new File(path + separator + simName + separator + stem).mkdir();
new File(path + File.separator + simName + File.separator + stem).mkdir();
}
if (createSBML(stem, ".", analysisMethod)) {
if (!stem.equals("")) {
@ -1671,15 +1668,15 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
reactionId);
SEDMLutilities.getDataGenerator(sedml, namedSBase.getId(), namedSBase.getName(), "stddev", taskId, type,
reactionId);
for (int i = analysisView.getStartIndex(taskId.replace("__", GlobalConstants.separator)); i < analysisView
.getStartIndex(taskId.replace("__", GlobalConstants.separator)) + analysisView.getNumRuns(); i++) {
for (int i = analysisView.getStartIndex(taskId.replace("__", File.separator)); i < analysisView
.getStartIndex(taskId.replace("__", File.separator)) + analysisView.getNumRuns(); i++) {
SEDMLutilities.getDataGenerator(sedml, namedSBase.getId(), namedSBase.getName(), "" + i, taskId, type,
reactionId);
}
}
private void createDataGenerators(org.sbml.jsbml.Model model, SedML sedml, String taskId) {
if (analysisView.getStartIndex(taskId.replace("__", GlobalConstants.separator)) == 1) {
if (analysisView.getStartIndex(taskId.replace("__", File.separator)) == 1) {
SEDMLutilities.removeDataGeneratorsByTaskId(sedml, taskId);
}
for (Compartment compartment : model.getListOfCompartments()) {
@ -1727,12 +1724,12 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
SBMLWriter Xwriter = new SBMLWriter();
try {
SBMLDocument sbmlDoc = SBMLReader
.read(new File(path + GlobalConstants.separator + simName + GlobalConstants.separator + filename));
.read(new File(path + File.separator + simName + File.separator + filename));
createDataGenerators(sbmlDoc.getModel(), sedml, taskId);
if (model.getListOfChanges().size() == 0)
return;
Xwriter.write(applyChanges(sedmlDoc, sbmlDoc, model),
path + GlobalConstants.separator + simName + GlobalConstants.separator + filename);
path + File.separator + simName + File.separator + filename);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -1795,16 +1792,16 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
SBMLDocument d = network.getSBML();
network.markAbstractable();
network.mergeSBML(path + separator + simName + separator + stem + direct + separator + modelId + ".xml",
network.mergeSBML(path + File.separator + simName + File.separator + stem + direct + File.separator + modelId + ".xml",
d);
} else {
SBMLWriter writer = new SBMLWriter();
PrintStream p;
try {
GeneticNetwork.reformatArrayContent(biomodel, sbml,
path + separator + simName + separator + stem + direct + separator + modelId + ".xml");
path + File.separator + simName + File.separator + stem + direct + File.separator + modelId + ".xml");
p = new PrintStream(new FileOutputStream(
path + separator + simName + separator + stem + direct + separator + modelId + ".xml"),
path + File.separator + simName + File.separator + stem + direct + File.separator + modelId + ".xml"),
true, "UTF-8");
p.print(writer.writeSBMLToString(sbml));
p.close();
@ -1823,7 +1820,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
}
} else {
try {
biomodel.save(path + separator + simName + separator + stem + direct + separator + modelId + ".xml");
biomodel.save(path + File.separator + simName + File.separator + stem + direct + File.separator + modelId + ".xml");
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -2123,12 +2120,12 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
String file = filename.replace(".gcm", ".xml");
compartmentPanel = new Compartments(biomodel, this, paramsOnly, getParams, path + separator + file,
compartmentPanel = new Compartments(biomodel, this, paramsOnly, getParams, path + File.separator + file,
parameterChanges, false);
reactionPanel = new Reactions(biomodel, paramsOnly, getParams, path + separator + file, parameterChanges, this);
speciesPanel = new MySpecies(biomodel, paramsOnly, getParams, path + separator + file, parameterChanges,
reactionPanel = new Reactions(biomodel, paramsOnly, getParams, path + File.separator + file, parameterChanges, this);
speciesPanel = new MySpecies(biomodel, paramsOnly, getParams, path + File.separator + file, parameterChanges,
grid.isEnabled(), this);
parametersPanel = new Parameters(biomodel, this, paramsOnly, getParams, path + separator + file,
parametersPanel = new Parameters(biomodel, this, paramsOnly, getParams, path + File.separator + file,
parameterChanges, (paramsOnly || !textBased) && !grid.isEnabled());
rulesPanel = new Rules(biomodel, this);
consPanel = new Constraints(biomodel, this);
@ -2484,7 +2481,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
if (paramsOnly) {
refGCM = new BioModel(path);
try {
refGCM.load(path + separator + refFile);
refGCM.load(path + File.separator + refFile);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -2522,7 +2519,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
if (paramsOnly) {
refGCM = new BioModel(path);
try {
refGCM.load(path + separator + refFile);
refGCM.load(path + File.separator + refFile);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -2560,7 +2557,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
if (paramsOnly) {
refGCM = new BioModel(path);
try {
refGCM.load(path + separator + refFile);
refGCM.load(path + File.separator + refFile);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -2596,7 +2593,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
* BioModel refBioModel = null;
*
* if (paramsOnly) { refBioModel = new BioModel(path);
* refBioModel.load(path + separator + refFile); }
* refBioModel.load(path + File.separator + refFile); }
*/
// TODO: This is a messy way to do things. We set the selected component
@ -2650,7 +2647,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
boolean check = true;
BioModel g = new BioModel(path);
try {
g.load(path + separator + checkFile);
g.load(path + File.separator + checkFile);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",
JOptionPane.ERROR_MESSAGE);
@ -2736,7 +2733,7 @@ public class ModelEditor extends JPanel implements ActionListener, MouseListener
if (comp != null && !comp.equals("")) {
BioModel subBioModel = new BioModel(path);
try {
subBioModel.load(path + separator + comp);
subBioModel.load(path + File.separator + comp);
subBioModel.flattenBioModel();
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File",

View file

@ -36,6 +36,7 @@ import java.awt.event.MouseWheelListener;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@ -2125,7 +2126,7 @@ public class Schematic extends JPanel implements ActionListener {
* @return: A boolean representing success or failure. True means it worked, false, means there was no output in the module.
*/
public String connectComponentToSpecies(String compID, String specID) throws ListChooser.EmptyListException{
String fullPath = bioModel.getPath() + GlobalConstants.separator + bioModel.getModelFileName(compID);
String fullPath = bioModel.getPath() + File.separator + bioModel.getModelFileName(compID);
BioModel compBioModel = new BioModel(bioModel.getPath());
try {
compBioModel.load(fullPath);
@ -2152,7 +2153,7 @@ public class Schematic extends JPanel implements ActionListener {
* @return a boolean representing success or failure.
*/
public String connectSpeciesToComponent(String specID, String compID) throws ListChooser.EmptyListException{
String fullPath = bioModel.getPath() + GlobalConstants.separator + bioModel.getModelFileName(compID);
String fullPath = bioModel.getPath() + File.separator + bioModel.getModelFileName(compID);
BioModel compBioModel = new BioModel(bioModel.getPath());
try {
compBioModel.load(fullPath);
@ -2180,7 +2181,7 @@ public class Schematic extends JPanel implements ActionListener {
*/
public String connectComponentToVariable(String compID, String varID) throws ListChooser.EmptyListException{
Parameter p = bioModel.getSBMLDocument().getModel().getParameter(varID);
String fullPath = bioModel.getPath() + GlobalConstants.separator + bioModel.getModelFileName(compID);
String fullPath = bioModel.getPath() + File.separator + bioModel.getModelFileName(compID);
BioModel compBioModel = new BioModel(bioModel.getPath());
try {
compBioModel.load(fullPath);
@ -2215,7 +2216,7 @@ public class Schematic extends JPanel implements ActionListener {
*/
public String connectVariableToComponent(String varID, String compID) throws ListChooser.EmptyListException{
Parameter p = bioModel.getSBMLDocument().getModel().getParameter(varID);
String fullPath = bioModel.getPath() + GlobalConstants.separator + bioModel.getModelFileName(compID);
String fullPath = bioModel.getPath() + File.separator + bioModel.getModelFileName(compID);
BioModel compBioModel = new BioModel(bioModel.getPath());
try {
compBioModel.load(fullPath);
@ -2605,7 +2606,7 @@ public class Schematic extends JPanel implements ActionListener {
String extModel = bioModel.getSBMLComp().getListOfExternalModelDefinitions().get(bioModel.getSBMLCompModel().getListOfSubmodels().get(s)
.getModelRef()).getSource().replace("file://","").replace("file:","").replace(".gcm",".xml");
try {
subModel.load(bioModel.getPath() + bioModel.getSeparator() + extModel);
subModel.load(bioModel.getPath() + File.separator + extModel);
Model submodel = subModel.getSBMLDocument().getModel();
for (int j = 0; j < submodel.getSpeciesCount(); ++j)
@ -2975,19 +2976,18 @@ public class Schematic extends JPanel implements ActionListener {
public void outputFrame(String filename, boolean scale) {
FileOutputStream out = null;
String separator = GlobalConstants.separator;
String path = "";
if (filename.contains(separator)) {
path = filename.substring(0, filename.lastIndexOf(separator));
filename = filename.substring(filename.lastIndexOf(separator)+1, filename.length());
if (filename.contains(File.separator)) {
path = GlobalConstants.getPath(filename);
filename = GlobalConstants.getFilename(filename);
}
if (filename.contains("."))
filename = filename.substring(0, filename.indexOf("."));
filename = path + separator + filename + ".jpg";
filename = path + File.separator + filename + ".jpg";
try {
out = new FileOutputStream(filename);

View file

@ -14,6 +14,7 @@
package edu.utah.ece.async.ibiosim.gui.modelEditor.schematic;
import java.awt.BorderLayout;
import java.io.File;
import java.util.Vector;
import javax.swing.JFrame;
@ -24,8 +25,6 @@ import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
/**
*
* @author Chris Myers
@ -70,7 +69,7 @@ public class TreeChooser extends JPanel {
String out = "";
for (Object part : tp.getPath()) {
out += GlobalConstants.separator + ((DefaultMutableTreeNode)part).toString();
out += File.separator + ((DefaultMutableTreeNode)part).toString();
}
return out;

View file

@ -71,7 +71,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
private ButtonGroup timingMethodGroup, technologyGroup, algorithmGroup;
private String directory, separator, root, synthFile, synthesisFile, sourceFile,
private String directory, root, synthFile, synthesisFile, sourceFile,
sourceFileNoPath;
private String oldMax, oldDelay, oldBdd;
@ -90,18 +90,17 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
* displays the frame.
*/
public SynthesisViewATACS(String directory, String filename, Log log, Gui biosim) {
separator = GlobalConstants.separator;
this.biosim = biosim;
this.directory = directory;
this.log = log;
this.sourceFile = filename;
String[] getFilename = directory.split(separator);
synthFile = getFilename[getFilename.length - 1] + ".syn";
String[] tempDir = directory.split(separator);
String[] getFilename = GlobalConstants.splitPath(directory);
synthFile = GlobalConstants.getFilename(directory) + ".syn";
String[] tempDir = GlobalConstants.splitPath(directory);
root = tempDir[0];
for (int i = 1; i < tempDir.length - 1; i++) {
root = root + separator + tempDir[i];
root = root + File.separator + tempDir[i];
}
JPanel timingRadioPanel = new JPanel();
@ -389,11 +388,11 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
Properties load = new Properties();
synthesisFile = "";
try {
FileInputStream in = new FileInputStream(new File(directory + separator + synthFile));
FileInputStream in = new FileInputStream(new File(directory + File.separator + synthFile));
load.load(in);
in.close();
if (load.containsKey("synthesis.file")) {
String[] getProp = load.getProperty("synthesis.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("synthesis.file"));
synthesisFile = directory.substring(0, directory.length()
- getFilename[getFilename.length - 1].length())
+ getProp[getProp.length - 1];
@ -681,7 +680,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
JOptionPane.showMessageDialog(Gui.frame, "Unable to load properties file!",
"Error Loading Properties", JOptionPane.ERROR_MESSAGE);
}
String[] tempArray = synthesisFile.split(separator);
String[] tempArray = GlobalConstants.splitPath(synthesisFile);
sourceFileNoPath = tempArray[tempArray.length - 1];
backgroundField = new JTextField(sourceFileNoPath);
@ -710,7 +709,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
}
}
getFilename = sourceFile.split(separator);
getFilename = GlobalConstants.splitPath(sourceFile);
getFilename = getFilename[getFilename.length - 1].split("\\.");
File graphFile = new File(getFilename[0] + ".dot");
File rulesFile = new File(getFilename[0] + ".prs");
@ -821,7 +820,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
new Thread(this).start();
}
else if (e.getSource() == save) {
log.addText("Saving:\n" + directory + separator + synthFile + "\n");
log.addText("Saving:\n" + directory + File.separator + synthFile + "\n");
save();
}
else if (e.getSource() == viewCircuit) {
@ -864,7 +863,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
JOptionPane.ERROR_MESSAGE);
return;
}
else if (new File(directory + separator + filename).exists()
else if (new File(directory + File.separator + filename).exists()
|| filename.equals(sourceFileNoPath) || contains) {
JOptionPane.showMessageDialog(Gui.frame,
"This component is already contained in this tool.", "Error",
@ -879,14 +878,14 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
if (componentList.getSelectedValue() != null) {
String selected = componentList.getSelectedValue().toString();
componentList.removeItem(selected);
new File(directory + separator + selected).delete();
new File(directory + File.separator + selected).delete();
}
}
}
@Override
public void run() {
String[] tempArray = synthesisFile.split(separator);
String[] tempArray = GlobalConstants.splitPath(synthesisFile);
String circuitFile = tempArray[tempArray.length - 1];
tempArray = sourceFile.split("separator");
tempArray = tempArray[tempArray.length - 1].split("\\.");
@ -899,8 +898,8 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
graphFilename = tempArray[0] + ".dot";
}
else {
rulesFilename = directory + separator + componentField.getText().trim() + ".prs";
graphFilename = directory + separator + componentField.getText().trim() + ".dot";
rulesFilename = directory + File.separator + componentField.getText().trim() + ".prs";
graphFilename = directory + File.separator + componentField.getText().trim() + ".dot";
}
File rulesFile = new File(rulesFilename);
File graphFile = new File(graphFilename);
@ -915,8 +914,8 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
}
for (String s : componentList.getItems()) {
try {
FileInputStream in = new FileInputStream(new File(root + separator + s));
FileOutputStream out = new FileOutputStream(new File(directory + separator + s));
FileInputStream in = new FileInputStream(new File(root + File.separator + s));
FileOutputStream out = new FileOutputStream(new File(directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -1237,7 +1236,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
InputStream reb = synth.getInputStream();
InputStreamReader isr = new InputStreamReader(reb);
BufferedReader br = new BufferedReader(isr);
FileWriter out = new FileWriter(new File(directory + separator + "run.log"));
FileWriter out = new FileWriter(new File(directory + File.separator + "run.log"));
while ((output = br.readLine()) != null) {
out.write(output);
out.write("\n");
@ -1584,10 +1583,10 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
else {
prop.setProperty("synthesis.minins", "false");
}
FileOutputStream out = new FileOutputStream(new File(directory + separator + synthFile));
FileOutputStream out = new FileOutputStream(new File(directory + File.separator + synthFile));
prop.store(out, synthesisFile);
out.close();
log.addText("Saving Parameter File:\n" + directory + separator + synthFile + "\n");
log.addText("Saving Parameter File:\n" + directory + File.separator + synthFile + "\n");
change = false;
oldMax = maxSize.getText();
oldDelay = gateDelay.getText();
@ -1599,9 +1598,9 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
}
for (String s : componentList.getItems()) {
try {
new File(directory + separator + s).createNewFile();
FileInputStream in = new FileInputStream(new File(root + separator + s));
FileOutputStream out = new FileOutputStream(new File(directory + separator + s));
new File(directory + File.separator + s).createNewFile();
FileInputStream in = new FileInputStream(new File(root + File.separator + s));
FileOutputStream out = new FileOutputStream(new File(directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -1639,7 +1638,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
}
public void viewCircuit() {
String[] getFilename = sourceFile.split(separator);
String[] getFilename = GlobalConstants.splitPath(sourceFile);
String circuitFile = getFilename[getFilename.length - 1];
String graphFile;
if (componentField.getText().trim().equals("")) {
@ -1653,7 +1652,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
try {
File work = new File(directory);
Runtime exec = Runtime.getRuntime();
File circuit = new File(directory + separator + graphFile);
File circuit = new File(directory + File.separator + graphFile);
if (!circuit.exists()) {
String cmd = "";
if (circuitFile.endsWith(".g")) {
@ -1677,12 +1676,12 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
else if (circuitFile.endsWith(".rsg")) {
cmd = "atacs -lsodps " + circuitFile;
}
if (new File(directory + separator + graphFile).exists()) {
if (new File(directory + File.separator + graphFile).exists()) {
exec.exec(cmd, null, work);
log.addText("Executing:\n" + cmd);
}
else {
File log = new File(directory + separator + "atacs.log");
File log = new File(directory + File.separator + "atacs.log");
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();
@ -1705,7 +1704,7 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
Preferences biosimrc = Preferences.userRoot();
String command = biosimrc.get("biosim.general.graphviz", "");
exec.exec(command + " " + graphFile, null, work);
log.addText(command + " " + directory + separator + graphFile + "\n");
log.addText(command + " " + directory + File.separator + graphFile + "\n");
}
catch (Exception e1) {
JOptionPane.showMessageDialog(Gui.frame, "Unable to view circuit.", "Error",
@ -1785,8 +1784,8 @@ public class SynthesisViewATACS extends JPanel implements ActionListener, Runnab
public void viewLog() {
try {
if (new File(directory + separator + "run.log").exists()) {
File log = new File(directory + separator + "run.log");
if (new File(directory + File.separator + "run.log").exists()) {
File log = new File(directory + File.separator + "run.log");
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();

View file

@ -59,8 +59,6 @@ public class FileTree extends JPanel implements MouseListener {
public JTree tree; // JTree
private String separator;
private boolean lema, atacs, async, lpn;
public static ImageIcon ICON_VHDL;
@ -120,7 +118,6 @@ public class FileTree extends JPanel implements MouseListener {
this.lpn = lpn;
this.gui = gui;
async = lema || atacs;
separator = GlobalConstants.separator;
ICON_VHDL = ResourceManager.getImageIcon("iconVHDL.png");
@ -189,7 +186,7 @@ public class FileTree extends JPanel implements MouseListener {
fileLocation = "";
while (node != null) {
if (node.getParent() != null) {
fileLocation = separator + node + fileLocation;
fileLocation = File.separator + node + fileLocation;
String parentNode = node.getParent().toString(); //DK
if (parentNode.endsWith(".xml") || parentNode.endsWith(".sbml") || parentNode.endsWith(".gcm")
|| parentNode.endsWith(".vhd") || parentNode.endsWith(".prop") || parentNode.endsWith(".s") || parentNode.endsWith(".inst")
@ -211,7 +208,7 @@ public class FileTree extends JPanel implements MouseListener {
fileLocations[i] = "";
while (node != null) {
if (node.getParent() != null) {
fileLocations[i] = separator + node + fileLocations[i];
fileLocations[i] = File.separator + node + fileLocations[i];
String parentNode = node.getParent().toString(); //DK
if (parentNode.endsWith(".xml") || parentNode.endsWith(".sbml") || parentNode.endsWith(".gcm")
|| parentNode.endsWith(".vhd") || parentNode.endsWith(".prop") || parentNode.endsWith(".s") || parentNode.endsWith(".inst")
@ -310,7 +307,7 @@ public class FileTree extends JPanel implements MouseListener {
if (curPath.equals("."))
newPath = thisObject;
else
newPath = curPath + separator + thisObject;
newPath = curPath + File.separator + thisObject;
if ((f = new File(newPath)).isDirectory() && !f.getName().equals("CVS")) {
dirs.add(thisObject);
}
@ -320,19 +317,19 @@ public class FileTree extends JPanel implements MouseListener {
if (!sbolFile.equals(gui.getCurrentProjectId()+".sbol")) {
try {
SBOLReader.setDropObjectsWithDuplicateURIs(true);
gui.getSBOLDocument().read(curPath + separator + sbolFile);
gui.getSBOLDocument().read(curPath + File.separator + sbolFile);
SBOLReader.setDropObjectsWithDuplicateURIs(false);
gui.writeSBOLDocument();
new File(curPath + separator + sbolFile).delete();
new File(curPath + File.separator + sbolFile).delete();
// if (!SBOLReader.getSBOLVersion(curPath + separator + sbolFile).endsWith(SBOLReader.SBOLVERSION2)) {
// if (!SBOLReader.getSBOLVersion(curPath + File.separator + sbolFile).endsWith(SBOLReader.SBOLVERSION2)) {
// Preferences biosimrc = Preferences.userRoot();
// SBOLReader.setKeepGoing(true);
// SBOLReader.setURIPrefix(biosimrc.get(GlobalConstants.SBOL_AUTHORITY_PREFERENCE,""));
// SBOLDocument sbolDoc;
// sbolDoc = SBOLReader.read(curPath + separator + sbolFile);
// sbolDoc = SBOLReader.read(curPath + File.separator + sbolFile);
// sbolDoc.setDefaultURIprefix(biosimrc.get(GlobalConstants.SBOL_AUTHORITY_PREFERENCE,""));
// sbolDoc.write(curPath + separator + sbolFile);
// sbolDoc.write(curPath + File.separator + sbolFile);
// }
}
catch (SBOLValidationException e) {
@ -353,12 +350,12 @@ public class FileTree extends JPanel implements MouseListener {
String sbmlFile = thisObject.replace(".gcm",".xml");
BioModel bioModel = new BioModel(curPath);
try {
bioModel.load(curPath + separator + sbmlFile);
bioModel.load(curPath + File.separator + sbmlFile);
GCM2SBML gcm2sbml = new GCM2SBML(bioModel);
gcm2sbml.load(curPath + separator + thisObject.toString());
System.out.println(curPath + separator + thisObject.toString());
gcm2sbml.load(curPath + File.separator + thisObject.toString());
System.out.println(curPath + File.separator + thisObject.toString());
gcm2sbml.convertGCM2SBML(curPath,thisObject.toString());
bioModel.save(curPath + separator + sbmlFile);
bioModel.save(curPath + File.separator + sbmlFile);
files.add(sbmlFile);
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
@ -483,11 +480,11 @@ public class FileTree extends JPanel implements MouseListener {
if (curPath.equals("."))
newPath = d;
else
newPath = curPath + separator + d;
newPath = curPath + File.separator + d;
f = new File(newPath);
if (new File(newPath + separator + d + ".sim").exists()) {
if (new File(newPath + File.separator + d + ".sim").exists()) {
try {
Scanner scan = new Scanner(new File(newPath + separator + d + ".sim"));
Scanner scan = new Scanner(new File(newPath + File.separator + d + ".sim"));
String refFile = scan.nextLine();
if (refFile.equals(files.get(fnum)) || refFile.replace(".gcm", ".xml").equals(files.get(fnum))) {
file.add(new DefaultMutableTreeNode(new IconData(ICON_SIMULATION, null, d)));
@ -497,9 +494,9 @@ public class FileTree extends JPanel implements MouseListener {
catch (Exception e) {
e.printStackTrace();
}
} else if (new File(newPath + separator + d + GlobalConstants.SBOL_SYNTH_PROPERTIES_EXTENSION).exists()) {
} else if (new File(newPath + File.separator + d + GlobalConstants.SBOL_SYNTH_PROPERTIES_EXTENSION).exists()) {
try {
Properties synthProps = SBOLUtility.loadSBOLSynthesisProperties(newPath, separator, Gui.frame);
Properties synthProps = SBOLUtility.loadSBOLSynthesisProperties(newPath, File.separator, Gui.frame);
if (synthProps != null)
if (synthProps.containsKey(GlobalConstants.SBOL_SYNTH_SPEC_PROPERTY)) {
String refFile = synthProps.getProperty(GlobalConstants.SBOL_SYNTH_SPEC_PROPERTY);
@ -512,21 +509,21 @@ public class FileTree extends JPanel implements MouseListener {
catch (Exception e) {
e.printStackTrace();
}
} else if (new File(newPath + separator + d + ".lrn").exists()) {
} else if (new File(newPath + File.separator + d + ".lrn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(newPath + separator + d + ".lrn"));
FileInputStream in = new FileInputStream(new File(newPath + File.separator + d + ".lrn"));
load.load(in);
in.close();
if (load.containsKey("genenet.file")) {
String[] getProp = load.getProperty("genenet.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("genenet.file"));
if (files.get(fnum).equals(getProp[getProp.length - 1])
|| files.get(fnum).equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
file.add(new DefaultMutableTreeNode(new IconData(ICON_LEARN, null, d)));
}
}
else if (load.containsKey("learn.file")) {
String[] getProp = load.getProperty("learn.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("learn.file"));
if (files.get(fnum).equals(getProp[getProp.length - 1])
|| files.get(fnum).equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
file.add(new DefaultMutableTreeNode(new IconData(ICON_LEARN, null, d)));
@ -537,14 +534,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(newPath + separator + d + ".syn").exists()) {
else if (new File(newPath + File.separator + d + ".syn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(newPath + separator + d + ".syn"));
FileInputStream in = new FileInputStream(new File(newPath + File.separator + d + ".syn"));
load.load(in);
in.close();
if (load.containsKey("synthesis.file")) {
String[] getProp = load.getProperty("synthesis.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("synthesis.file"));
if (files.get(fnum).equals(getProp[getProp.length - 1])) {
file.add(new DefaultMutableTreeNode(new IconData(ICON_SYNTHESIS, null, d)));
}
@ -554,14 +551,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(newPath + separator + d + ".ver").exists()) {
else if (new File(newPath + File.separator + d + ".ver").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(newPath + separator + d + ".ver"));
FileInputStream in = new FileInputStream(new File(newPath + File.separator + d + ".ver"));
load.load(in);
in.close();
if (load.containsKey("verification.file")) {
String[] getProp = load.getProperty("verification.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("verification.file"));
if (files.get(fnum).equals(getProp[getProp.length - 1])) {
file.add(new DefaultMutableTreeNode(new IconData(ICON_VERIFY, null, d)));
}
@ -588,12 +585,12 @@ public class FileTree extends JPanel implements MouseListener {
public void addToTree(String item, String dir) {
deleteFromTree(item);
String path = dir + separator + item;
File file = new File(dir + separator + item);
String path = dir + File.separator + item;
File file = new File(dir + File.separator + item);
if (file.isDirectory()) {
if (new File(path + separator + item + ".sim").exists()) {
if (new File(path + File.separator + item + ".sim").exists()) {
try {
Scanner scan = new Scanner(new File(path + separator + item + ".sim"));
Scanner scan = new Scanner(new File(path + File.separator + item + ".sim"));
String refFile = scan.nextLine();
scan.close();
for (int i = 0; i < root.getChildCount(); i++) {
@ -620,9 +617,9 @@ public class FileTree extends JPanel implements MouseListener {
catch (Exception e) {
e.printStackTrace();
}
} else if (new File(path + separator + item + GlobalConstants.SBOL_SYNTH_PROPERTIES_EXTENSION).exists()) {
} else if (new File(path + File.separator + item + GlobalConstants.SBOL_SYNTH_PROPERTIES_EXTENSION).exists()) {
try {
Properties synthProps = SBOLUtility.loadSBOLSynthesisProperties(path, separator, Gui.frame);
Properties synthProps = SBOLUtility.loadSBOLSynthesisProperties(path, File.separator, Gui.frame);
if (synthProps != null) {
if (synthProps.containsKey(GlobalConstants.SBOL_SYNTH_SPEC_PROPERTY)) {
String refFile = synthProps.getProperty(GlobalConstants.SBOL_SYNTH_SPEC_PROPERTY);
@ -653,14 +650,14 @@ public class FileTree extends JPanel implements MouseListener {
catch (Exception e) {
e.printStackTrace();
}
} else if (new File(path + separator + item + ".lrn").exists()) {
} else if (new File(path + File.separator + item + ".lrn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + item + ".lrn"));
FileInputStream in = new FileInputStream(new File(path + File.separator + item + ".lrn"));
load.load(in);
in.close();
if (load.containsKey("genenet.file")) {
String[] getProp = load.getProperty("genenet.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("genenet.file"));
for (int i = 0; i < root.getChildCount(); i++) {
if (root.getChildAt(i).toString().equals(getProp[getProp.length - 1])
|| root.getChildAt(i).toString().equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
@ -684,7 +681,7 @@ public class FileTree extends JPanel implements MouseListener {
}
}
else if (load.containsKey("learn.file")) {
String[] getProp = load.getProperty("learn.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("learn.file"));
for (int i = 0; i < root.getChildCount(); i++) {
if (root.getChildAt(i).toString().equals(getProp[getProp.length - 1])
|| root.getChildAt(i).toString().equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
@ -712,14 +709,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(path + separator + item + ".syn").exists()) {
else if (new File(path + File.separator + item + ".syn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + item + ".syn"));
FileInputStream in = new FileInputStream(new File(path + File.separator + item + ".syn"));
load.load(in);
in.close();
if (load.containsKey("synthesis.file")) {
String[] getProp = load.getProperty("synthesis.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("synthesis.file"));
for (int i = 0; i < root.getChildCount(); i++) {
if (root.getChildAt(i).toString().equals(getProp[getProp.length - 1])) {
int insert = 0;
@ -746,14 +743,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(path + separator + item + ".ver").exists()) {
else if (new File(path + File.separator + item + ".ver").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + item + ".ver"));
FileInputStream in = new FileInputStream(new File(path + File.separator + item + ".ver"));
load.load(in);
in.close();
if (load.containsKey("verification.file")) {
String[] getProp = load.getProperty("verification.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("verification.file"));
for (int i = 0; i < root.getChildCount(); i++) {
if (root.getChildAt(i).toString().equals(getProp[getProp.length - 1])) {
int insert = 0;
@ -846,11 +843,11 @@ public class FileTree extends JPanel implements MouseListener {
String[] files = new File(dir).list();
sort(files);
for (String f : files) {
path = dir + separator + f;
path = dir + File.separator + f;
if (new File(path).isDirectory()) {
if (new File(path + separator + f + ".sim").exists()) {
if (new File(path + File.separator + f + ".sim").exists()) {
try {
Scanner scan = new Scanner(new File(path + separator + f + ".sim"));
Scanner scan = new Scanner(new File(path + File.separator + f + ".sim"));
String refFile = scan.nextLine();
scan.close();
if (item.equals(refFile) || item.equals(refFile.replace(".gcm", ".xml"))) {
@ -861,20 +858,20 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(path + separator + f + ".lrn").exists()) {
else if (new File(path + File.separator + f + ".lrn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + f + ".lrn"));
FileInputStream in = new FileInputStream(new File(path + File.separator + f + ".lrn"));
load.load(in);
in.close();
if (load.containsKey("genenet.file")) {
String[] getProp = load.getProperty("genenet.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("genenet.file"));
if (item.equals(getProp[getProp.length - 1]) || item.equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
node.add(new DefaultMutableTreeNode(new IconData(ICON_LEARN, null, f)));
}
}
else if (load.containsKey("learn.file")) {
String[] getProp = load.getProperty("learn.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("learn.file"));
if (item.equals(getProp[getProp.length - 1]) || item.equals(getProp[getProp.length - 1].replace(".gcm", ".xml"))) {
node.add(new DefaultMutableTreeNode(new IconData(ICON_LEARN, null, f)));
}
@ -884,14 +881,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(path + separator + f + ".syn").exists()) {
else if (new File(path + File.separator + f + ".syn").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + f + ".syn"));
FileInputStream in = new FileInputStream(new File(path + File.separator + f + ".syn"));
load.load(in);
in.close();
if (load.containsKey("synthesis.file")) {
String[] getProp = load.getProperty("synthesis.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("synthesis.file"));
if (item.equals(getProp[getProp.length - 1])) {
node.add(new DefaultMutableTreeNode(new IconData(ICON_SYNTHESIS, null, f)));
}
@ -901,14 +898,14 @@ public class FileTree extends JPanel implements MouseListener {
e.printStackTrace();
}
}
else if (new File(path + separator + f + ".ver").exists()) {
else if (new File(path + File.separator + f + ".ver").exists()) {
try {
Properties load = new Properties();
FileInputStream in = new FileInputStream(new File(path + separator + f + ".ver"));
FileInputStream in = new FileInputStream(new File(path + File.separator + f + ".ver"));
load.load(in);
in.close();
if (load.containsKey("verification.file")) {
String[] getProp = load.getProperty("verification.file").split(separator);
String[] getProp = GlobalConstants.splitPath(load.getProperty("verification.file"));
if (item.equals(getProp[getProp.length - 1])) {
node.add(new DefaultMutableTreeNode(new IconData(ICON_VERIFY, null, f)));
}

View file

@ -29,11 +29,7 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.prefs.Preferences;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
@ -388,7 +384,7 @@ public class Utility {
fd.setDirectory(file.getPath());
}
else {
fd.setDirectory(file.getPath().substring(file.getPath().indexOf(GlobalConstants.separator)+1));
fd.setDirectory(GlobalConstants.getPath(file.getPath()) + File.separator);
fd.setFile(file.getName());
}
}
@ -456,7 +452,7 @@ public class Utility {
selectedFile += ".tsd";
}
}
return fd.getDirectory() + GlobalConstants.separator + selectedFile;
return fd.getDirectory() + File.separator + selectedFile;
}
return "";
}

View file

@ -15,7 +15,6 @@ package edu.utah.ece.async.ibiosim.gui.verificationView;
import javax.swing.*;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.ibiosim.gui.Gui;
import edu.utah.ece.async.ibiosim.gui.modelEditor.util.PropertyList;
@ -58,7 +57,7 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
private JTextField field;
private String directory, separator, root, absFile, oldBdd;
private String directory, root, absFile, oldBdd;
private JLabel preAbsLabel, loopAbsLabel, postAbsLabel;
@ -70,8 +69,6 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
private Log log;
private VerificationView verification;
private final AbstractionProperty absProperty;
/**
@ -80,17 +77,15 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
* then displays the frame.
*/
public AbstractionPanel(String directory, VerificationView verification, Log log) {
separator = GlobalConstants.separator;
this.directory = directory;
this.log = log;
this.verification = verification;
this.setLayout(new BorderLayout());
absFile = verification.getVerName() + ".abs";
verification.copyFile();
absProperty = new AbstractionProperty();
LPN lhpn = new LPN();
try {
lhpn.load(directory + separator + verification.verifyFile);
lhpn.load(directory + File.separator + verification.verifyFile);
createGUI(lhpn);
} catch (BioSimException e) {
@ -228,22 +223,21 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
change = false;
}
public AbstractionPanel(String directory, String lpnFile, Log log) {
separator = GlobalConstants.separator;
this.directory = directory;
this.log = log;
this.setLayout(new BorderLayout());
this.setMaximumSize(new Dimension(300, 150));
this.absProperty = new AbstractionProperty();
LPN lhpn = new LPN();
try {
lhpn.load(directory + separator + lpnFile);
createGUI(lhpn);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(),
JOptionPane.ERROR_MESSAGE);
public AbstractionPanel(String directory, String lpnFile, Log log) {
this.directory = directory;
this.log = log;
this.setLayout(new BorderLayout());
this.setMaximumSize(new Dimension(300, 150));
this.absProperty = new AbstractionProperty();
LPN lhpn = new LPN();
try {
lhpn.load(directory + File.separator + lpnFile);
createGUI(lhpn);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(),
JOptionPane.ERROR_MESSAGE);
}
}
}
/*
// Creates the interesting species JList
listModel = new DefaultListModel();
@ -618,10 +612,10 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
prop.setProperty("abstraction.factor", iterField.getText());
}
FileOutputStream out = new FileOutputStream(new File(directory
+ separator + absFile));
+ File.separator + absFile));
prop.store(out, absFile);
out.close();
log.addText("Saving Parameter File:\n" + directory + separator
log.addText("Saving Parameter File:\n" + directory + File.separator
+ absFile + "\n");
change = false;
} catch (Exception e1) {
@ -632,11 +626,11 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
if (componentList != null) {
for (String s : componentList.getItems()) {
try {
new File(directory + separator + s).createNewFile();
new File(directory + File.separator + s).createNewFile();
FileInputStream in = new FileInputStream(new File(root
+ separator + s));
+ File.separator + s));
FileOutputStream out = new FileOutputStream(new File(
directory + separator + s));
directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -660,8 +654,8 @@ public class AbstractionPanel extends JPanel implements ActionListener, Runnable
public void viewLog() {
try {
if (new File(directory + separator + "run.log").exists()) {
File log = new File(directory + separator + "run.log");
if (new File(directory + File.separator + "run.log").exists()) {
File log = new File(directory + File.separator + "run.log");
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();

View file

@ -23,6 +23,7 @@ import edu.utah.ece.async.ibiosim.gui.modelEditor.util.Runnable;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
/**
* This class creates a GUI front end for the Verification tool. It provides the
@ -58,7 +59,7 @@ public class ParameterEditor extends JPanel implements ActionListener {
private PropertyList variables;
private String separator, root;
private String root;
//private String directory, verFile, oldBdd, sourceFileNoPath;
@ -81,20 +82,10 @@ public class ParameterEditor extends JPanel implements ActionListener {
* then displays the frame.
*/
public ParameterEditor(String directory, boolean lema, boolean atacs) {
separator = GlobalConstants.separator;
//this.atacs = atacs;
//this.biosim = biosim;
//this.log = log;
//this.directory = directory;
//this.bigTab = bigTab;
// String[] getFilename = directory.split(separator);
//String[] tempArray = filename.split("\\.");
//String traceFilename = tempArray[0] + ".trace";
//File traceFile = new File(traceFilename);
String[] tempDir = directory.split(separator);
String[] tempDir = GlobalConstants.splitPath(directory);
root = tempDir[0];
for (int i = 1; i < tempDir.length - 1; i++) {
root = root + separator + tempDir[i];
root = root + File.separator + tempDir[i];
}
JPanel abstractionPanel = new JPanel();

View file

@ -127,7 +127,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
private ButtonGroup timingMethodGroup, algorithmGroup, abstractionGroup;
private String directory, separator, root, verFile, oldBdd,
private String directory, root, verFile, oldBdd,
sourceFileNoPath;
public String verifyFile;
@ -150,7 +150,6 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
*/
public VerificationView(String directory, String verName, String filename,
Log log, Gui biosim, boolean lema, boolean atacs) {
separator = GlobalConstants.separator;
this.atacs = atacs;
this.lema = lema;
this.biosim = biosim;
@ -160,10 +159,10 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String[] tempArray = filename.split("\\.");
String traceFilename = tempArray[0] + ".trace";
File traceFile = new File(traceFilename);
String[] tempDir = directory.split(separator);
String[] tempDir = GlobalConstants.splitPath(directory);
root = tempDir[0];
for (int i = 1; i < tempDir.length - 1; i++) {
root = root + separator + tempDir[i];
root = root + File.separator + tempDir[i];
}
this.setMaximumSize(new Dimension(300,300));
this.setMinimumSize(new Dimension(300,300));
@ -493,7 +492,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
verifyFile = "";
try {
FileInputStream in = new FileInputStream(new File(directory
+ separator + verFile));
+ File.separator + verFile));
load.load(in);
in.close();
if (load.containsKey("verification.file")) {
@ -527,7 +526,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
abstractLhpn.setSelected(true);
}
}
abstPane = new AbstractionPanel(root + separator + verName, this, log);
abstPane = new AbstractionPanel(root + File.separator + verName, this, log);
if (load.containsKey("verification.timing.methods")) {
if (atacs) {
if (load.getProperty("verification.timing.methods").equals("untimed")) {
@ -882,7 +881,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
abstPane.iterField.setText(load
.getProperty("abstraction.iterations"));
}
tempArray = verifyFile.split(separator);
tempArray = GlobalConstants.splitPath(verifyFile);
sourceFileNoPath = tempArray[tempArray.length - 1];
backgroundField = new JTextField(sourceFileNoPath);
} catch (Exception e) {
@ -927,7 +926,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
JPanel backgroundPanel = new JPanel();
JLabel backgroundLabel = new JLabel("Model File:");
tempArray = verifyFile.split(separator);
tempArray = GlobalConstants.splitPath(verifyFile);
JLabel componentLabel = new JLabel("Component:");
componentField.setPreferredSize(new Dimension(200, 20));
String sourceFile = tempArray[tempArray.length - 1];
@ -995,7 +994,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
save(verFile);
new Thread(this).start();
} else if (e.getSource() == save) {
log.addText("Saving:\n" + directory + separator + verFile + "\n");
log.addText("Saving:\n" + directory + File.separator + verFile + "\n");
save(verFile);
} else if (e.getSource() == viewCircuit) {
viewCircuit();
@ -1032,7 +1031,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
"You must select a valid VHDL file.", "Error",
JOptionPane.ERROR_MESSAGE);
return;
} else if (new File(directory + separator + filename).exists()
} else if (new File(directory + File.separator + filename).exists()
|| filename.equals(sourceFileNoPath) || contains) {
JOptionPane
.showMessageDialog(
@ -1048,7 +1047,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
if (componentList.getSelectedValue() != null) {
String selected = componentList.getSelectedValue().toString();
componentList.removeItem(selected);
new File(directory + separator + selected).delete();
new File(directory + File.separator + selected).delete();
}
} else if (e.getSource() == addSFile) {
String sFile = JOptionPane.showInputDialog(this, "Enter Assembly File Name:",
@ -1094,7 +1093,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
"You must select a valid LPN file.", "Error",
JOptionPane.ERROR_MESSAGE);
return;
} else if (new File(directory + separator + filename).exists()
} else if (new File(directory + File.separator + filename).exists()
|| filename.equals(sourceFileNoPath) || contains) {
JOptionPane
.showMessageDialog(
@ -1113,7 +1112,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
if (lpnList.getSelectedValue() != null) {
String selected = lpnList.getSelectedValue().toString();
lpnList.removeItem(selected);
new File(directory + separator + selected).delete();
new File(directory + File.separator + selected).delete();
}
}
}
@ -1131,7 +1130,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
@Override
public void run() {
copyFile();
String[] array = directory.split(separator);
String[] array = GlobalConstants.splitPath(directory);
String tempDir = "";
String lpnFileName = "";
if (!verifyFile.endsWith("lpn")) {
@ -1143,7 +1142,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
if (untimedStateSearch.isSelected()) {
LPN lpn = new LPN();
try {
lpn.load(directory + separator + lpnFileName);
lpn.load(directory + File.separator + lpnFileName);
} catch (BioSimException e1) {
JOptionPane.showMessageDialog(Gui.frame, e1.getMessage(), e1.getTitle(), JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
@ -1159,7 +1158,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String curLPNname = (String) lpnList.getSelectedValues()[i];
LPN curLPN = new LPN();
try {
curLPN.load(directory + separator + curLPNname);
curLPN.load(directory + File.separator + curLPNname);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
@ -1288,7 +1287,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// if (dot.isSelected()) {
// Options.setOutputSgFlag(true);
// }
// Options.setPrjSgPath(directory + separator);
// Options.setPrjSgPath(directory + File.separator);
// // Options for printing the final numbers from search_dfs or search_dfsPOR.
// Options.setOutputLogFlag(true);
//// Options.setPrintLogToFile(false);
@ -1296,7 +1295,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// if (dot.isSelected()) {
// for (int i=0; i<stateGraphArray.length; i++) {
// String graphFileName = stateGraphArray[i].getLpn().getLabel() + "POR_"+ Options.getCycleClosingMthd() + "_local_sg.dot";
// stateGraphArray[i].outputLocalStateGraph(directory + separator + graphFileName);
// stateGraphArray[i].outputLocalStateGraph(directory + File.separator + graphFileName);
// }
// // Code for producing global state graph is in search_dfsPOR in the Analysis class.
// }
@ -1411,7 +1410,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
if (dot.isSelected()) {
Options.setOutputSgFlag(true);
}
//Options.setPrjSgPath(directory + separator);
//Options.setPrjSgPath(directory + File.separator);
System.out.println("directory = "+ directory);
Options.setPrjSgPath(directory);
// Options for printing the final numbers from search_dfs.
@ -1425,7 +1424,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
//}
//else { // No POR
// Options.setPrjSgPath(directory + separator);
// Options.setPrjSgPath(directory + File.separator);
// // Options for printing the final numbers from search_dfs or search_dfsPOR.
// Options.setOutputLogFlag(true);
// // Options.setPrintLogToFile(false);
@ -1589,7 +1588,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
for (Component comp : compMap.values()) {
LPN lpnComp = new LPN();
lpnComp = comp.buildLPN(lpnComp);
lpnComp.save(root + separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + comp.getComponentId() + ".lpn");
lpnComp.save(root + File.separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + comp.getComponentId() + ".lpn");
}
}
maxNumVarsInOneComp++;
@ -1636,8 +1635,8 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
LpnProcess curProcess = processMap.get(curProcId);
LPN lpnProc = new LPN();
lpnProc = curProcess.buildLPN(lpnProc);
lpnProc.save(root + separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + curProcId + ".lpn");
//lpnProc.save(directory + separator + lpn.getLabel() + curProcId + ".lpn");
lpnProc.save(root + File.separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + curProcId + ".lpn");
//lpnProc.save(directory + File.separator + lpn.getLabel() + curProcId + ".lpn");
}
JOptionPane.showMessageDialog(
Gui.frame,
@ -1654,7 +1653,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// --- TEMP ----
//checkDecomposition(lpn, lpnComp);
// -------------
lpnComp.save(root + separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + comp.getComponentId() + ".lpn");
lpnComp.save(root + File.separator + lpn.getLabel() + "_decomp" + maxNumVarsInOneComp + "vars" + comp.getComponentId() + ".lpn");
}
}
}
@ -1702,11 +1701,11 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
} catch (Exception e) {
}
for (int i = 0; i < array.length - 1; i++) {
tempDir = tempDir + array[i] + separator;
tempDir = tempDir + array[i] + File.separator;
}
LPN lhpnFile = new LPN();
try {
lhpnFile.load(directory + separator + lpnFileName);
lhpnFile.load(directory + File.separator + lpnFileName);
} catch (BioSimException e2) {
JOptionPane.showMessageDialog(Gui.frame, e2.getMessage(), e2.getTitle(), JOptionPane.ERROR_MESSAGE);
e2.printStackTrace();
@ -1716,7 +1715,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
//if(dbm2.isSelected())
//{
//try {
//verification.timed_state_exploration.dbm2.StateExploration.findStateGraph(lhpnFile, directory+separator, lpnFileName);
//verification.timed_state_exploration.dbm2.StateExploration.findStateGraph(lhpnFile, directory+File.separator, lpnFileName);
//} catch (FileNotFoundException e) {
//e.printStackTrace();
//}
@ -1740,7 +1739,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// else
// {
// LhpnFile lpn = new LhpnFile();
// lpn.load(directory + separator + lpnFileName);
// lpn.load(directory + File.separator + lpnFileName);
//
// // The full state graph is created for only one LPN.
//
@ -1771,10 +1770,10 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// }
// else {
// if (dot.isSelected()) {
// stateGraphArray[0].outputLocalStateGraph(directory + separator + graphFileName);
// stateGraphArray[0].outputLocalStateGraph(directory + File.separator + graphFileName);
// }
// if(graph.isSelected()){
// showGraph(directory + separator + graphFileName);
// showGraph(directory + File.separator + graphFileName);
// }
// }
//
@ -1787,7 +1786,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// This is the code before the revision for allowing multiple LPNs
// // Uses the timed_state_exploration.zoneProject infrastructure.
// LhpnFile lpn = new LhpnFile();
// lpn.load(directory + separator + lpnFileName);
// lpn.load(directory + File.separator + lpnFileName);
//
// // The full state graph is created for only one LPN.
//
@ -1807,11 +1806,11 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// String graphFileName = verifyFile.replace(".lpn", "") + "_sg.dot";
//
// if (dot.isSelected()) {
// stateGraphArray[0].outputLocalStateGraph(directory + separator + graphFileName);
// stateGraphArray[0].outputLocalStateGraph(directory + File.separator + graphFileName);
// }
//
// if(graph.isSelected()){
// showGraph(directory + separator + graphFileName);
// showGraph(directory + File.separator + graphFileName);
// }
//
// Options.setTimingAnalsysisType("off");
@ -1822,12 +1821,12 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// Uses the timed_state_exploration.zoneProject infrastructure.
LPN lpn = new LPN();
try {
lpn.load(directory + separator + lpnFileName);
lpn.load(directory + File.separator + lpnFileName);
} catch (BioSimException e2) {
JOptionPane.showMessageDialog(Gui.frame, e2.getMessage(), e2.getTitle(), JOptionPane.ERROR_MESSAGE);
e2.printStackTrace();
}
Options.set_TimingLogFile(directory + separator
Options.set_TimingLogFile(directory + File.separator
+ lpnFileName + ".tlog");
// Load any other listed LPNs.
@ -1837,7 +1836,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
// for (int i=0; i < lpnList.getSelectedValues().length; i++) {
// String curLPNname = (String) lpnList.getSelectedValues()[i];
// LhpnFile curLPN = new LhpnFile();
// curLPN.load(directory + separator + curLPNname);
// curLPN.load(directory + File.separator + curLPNname);
// selectedLPNs.add(curLPN);
// }
@ -1846,7 +1845,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String curLPNname = guiLPNList[i];
LPN curLPN = new LPN();
try {
curLPN.load(directory + separator + curLPNname);
curLPN.load(directory + File.separator + curLPNname);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(), e.getTitle(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
@ -1888,7 +1887,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
Project timedStateSearch = new Project(selectedLPNs);
if (dot.isSelected()) {
Options.setOutputSgFlag(true);
Options.setPrjSgPath(directory + separator);
Options.setPrjSgPath(directory + File.separator);
}
try {
timedStateSearch.search();
@ -1900,11 +1899,11 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String graphFileName = "full_sg.dot";
// if (dot.isSelected()) {
// stateGraphArray[0].outputLocalStateGraph(directory + separator + graphFileName);
// stateGraphArray[0].outputLocalStateGraph(directory + File.separator + graphFileName);
// }
if(graph.isSelected()){
showGraph(directory + separator + graphFileName);
showGraph(directory + File.separator + graphFileName);
}
Options.setTimingAnalsysisType("off");
@ -1971,15 +1970,15 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
}
abstraction.abstractSTG(true);
if (!lhpn.isSelected() && !view.isSelected()) {
abstraction.save(directory + separator + abstFilename);
abstraction.save(directory + File.separator + abstFilename);
}
sourceFile = abstFilename;
} else {
String[] tempArray = verifyFile.split(separator);
String[] tempArray = GlobalConstants.splitPath(verifyFile);
sourceFile = tempArray[tempArray.length - 1];
}
if (!lhpn.isSelected() && !view.isSelected()) {
abstraction.save(directory + separator + abstFilename);
abstraction.save(directory + File.separator + abstFilename);
}
if (!lhpn.isSelected() && !view.isSelected()) {
String[] tempArray = verifyFile.split("\\.");
@ -1989,25 +1988,25 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String dotName = "";
if (componentField.getText().trim().equals("")) {
if (verifyFile.endsWith(".g")) {
pargName = directory + separator
pargName = directory + File.separator
+ sourceFile.replace(".g", ".prg");
dotName = directory + separator
dotName = directory + File.separator
+ sourceFile.replace(".g", ".dot");
} else if (verifyFile.endsWith(".lpn")) {
pargName = directory + separator
pargName = directory + File.separator
+ sourceFile.replace(".lpn", ".prg");
dotName = directory + separator
dotName = directory + File.separator
+ sourceFile.replace(".lpn", ".dot");
} else if (verifyFile.endsWith(".vhd")) {
pargName = directory + separator
pargName = directory + File.separator
+ sourceFile.replace(".vhd", ".prg");
dotName = directory + separator
dotName = directory + File.separator
+ sourceFile.replace(".vhd", ".dot");
}
} else {
pargName = directory + separator
pargName = directory + File.separator
+ componentField.getText().trim() + ".prg";
dotName = directory + separator
dotName = directory + File.separator
+ componentField.getText().trim() + ".dot";
}
File pargFile = new File(pargName);
@ -2024,9 +2023,9 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
for (String s : componentList.getItems()) {
try {
FileInputStream in = new FileInputStream(new File(root
+ separator + s));
+ File.separator + s));
FileOutputStream out = new FileOutputStream(new File(
directory + separator + s));
directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -2044,9 +2043,9 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
for (String s : lpnList.getItems()) {
try {
FileInputStream in = new FileInputStream(new File(root
+ separator + s));
+ File.separator + s));
FileOutputStream out = new FileOutputStream(new File(
directory + separator + s));
directory + File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -2301,7 +2300,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
InputStreamReader isr = new InputStreamReader(reb);
BufferedReader br = new BufferedReader(isr);
FileWriter out = new FileWriter(new File(directory
+ separator + "run.log"));
+ File.separator + "run.log"));
while ((output = br.readLine()) != null) {
out.write(output);
out.write("\n");
@ -2340,7 +2339,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
InputStreamReader isr = new InputStreamReader(reb);
BufferedReader br = new BufferedReader(isr);
FileWriter out = new FileWriter(new File(directory
+ separator + "run.log"));
+ File.separator + "run.log"));
while ((output = br.readLine()) != null) {
out.write(output);
out.write("\n");
@ -2405,7 +2404,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
running.setCursor(null);
running.dispose();
FileInputStream atacsLog = new FileInputStream(new File(
directory + separator + "atacs.log"));
directory + File.separator + "atacs.log"));
InputStreamReader atacsReader = new InputStreamReader(atacsLog);
BufferedReader atacsBuffer = new BufferedReader(atacsReader);
boolean success = false;
@ -2456,17 +2455,17 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
}
} else {
if (lhpn.isSelected()) {
abstraction.save(tempDir + separator + abstFilename);
abstraction.save(tempDir + File.separator + abstFilename);
biosim.addToTree(abstFilename);
} else if (view.isSelected()) {
abstraction.save(directory + separator + abstFilename);
work = new File(directory + separator);
abstraction.save(directory + File.separator + abstFilename);
work = new File(directory + File.separator);
try {
String dotName = abstFilename.replace(".lpn", ".dot");
new File(directory + separator + dotName).delete();
new File(directory + File.separator + dotName).delete();
Runtime exec = Runtime.getRuntime();
abstraction.printDot(directory + separator + dotName);
if (new File(directory + separator + dotName).exists()) {
abstraction.printDot(directory + File.separator + dotName);
if (new File(directory + File.separator + dotName).exists()) {
Preferences biosimrc = Preferences.userRoot();
String command = biosimrc.get("biosim.general.graphviz", "") + " ";
Process dot = exec.exec(command + dotName, null, work);
@ -2537,7 +2536,7 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
try {
Properties prop = new Properties();
// FileInputStream in = new FileInputStream(new File(directory
// + separator + filename));
// + File.separator + filename));
// prop.load(in);
// in.close();
prop.setProperty("verification.file", verifyFile);
@ -2851,10 +2850,10 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
.getText());
}
FileOutputStream out = new FileOutputStream(new File(directory
+ separator + verFile));
+ File.separator + verFile));
prop.store(out, verifyFile);
out.close();
log.addText("Saving Parameter File:\n" + directory + separator
log.addText("Saving Parameter File:\n" + directory + File.separator
+ verFile + "\n");
change = false;
oldBdd = bddSize.getText();
@ -2866,11 +2865,11 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
}
for (String s : componentList.getItems()) {
try {
new File(directory + separator + s).createNewFile();
new File(directory + File.separator + s).createNewFile();
FileInputStream in = new FileInputStream(new File(root
+ separator + s));
+ File.separator + s));
FileOutputStream out = new FileOutputStream(new File(directory
+ separator + s));
+ File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -2887,11 +2886,11 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
}
for (String s : lpnList.getItems()) {
try {
new File(directory + separator + s).createNewFile();
new File(directory + File.separator + s).createNewFile();
FileInputStream in = new FileInputStream(new File(root
+ separator + s));
+ File.separator + s));
FileOutputStream out = new FileOutputStream(new File(directory
+ separator + s));
+ File.separator + s));
int read = in.read();
while (read != -1) {
out.write(read);
@ -2964,8 +2963,8 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
String[] getFilename = verifyFile.split("\\.");
String traceFilename = getFilename[0] + ".trace";
try {
if (new File(directory + separator + traceFilename).exists()) {
File log = new File(directory + separator + traceFilename);
if (new File(directory + File.separator + traceFilename).exists()) {
File log = new File(directory + File.separator + traceFilename);
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();
@ -2997,8 +2996,8 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
public void viewLog() {
try {
if (new File(directory + separator + "run.log").exists()) {
File log = new File(directory + separator + "run.log");
if (new File(directory + File.separator + "run.log").exists()) {
File log = new File(directory + File.separator + "run.log");
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();
@ -3042,19 +3041,19 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
}
public void copyFile() {
String[] tempArray = verifyFile.split(separator);
String[] tempArray = GlobalConstants.splitPath(verifyFile);
String sourceFile = tempArray[tempArray.length - 1];
String[] workArray = directory.split(separator);
String[] workArray = GlobalConstants.splitPath(directory);
String workDir = "";
for (int i = 0; i < (workArray.length - 1); i++) {
workDir = workDir + workArray[i] + separator;
workDir = workDir + workArray[i] + File.separator;
}
try {
File newFile = new File(directory + separator + sourceFile);
File newFile = new File(directory + File.separator + sourceFile);
newFile.createNewFile();
FileOutputStream copyin = new FileOutputStream(newFile);
FileInputStream copyout = new FileInputStream(new File(workDir
+ separator + sourceFile));
+ File.separator + sourceFile));
int read = copyout.read();
while (read != -1) {
copyin.write(read);
@ -3103,8 +3102,8 @@ public class VerificationView extends JPanel implements ActionListener, Runnable
} else if (sourceFile.endsWith(".xml")) {
BioModel bioModel = new BioModel(workDir);
try {
bioModel.load(workDir + separator + sourceFile);
ModelEditor.saveLPN(bioModel, directory + separator + sourceFile.replace(".xml", ".lpn"));
bioModel.load(workDir + File.separator + sourceFile);
ModelEditor.saveLPN(bioModel, directory + File.separator + sourceFile.replace(".xml", ".lpn"));
} catch (XMLStreamException e) {
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML in SBML file", "Error Checking File", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();

View file

@ -632,7 +632,7 @@ public class Learn
public void getDotFile(String filename, String directory, SpeciesCollection collection, NetCon network) throws BioSimException
{
Map<String, String> speciesToNode;
File fout = new File(directory + GlobalConstants.separator + filename);
File fout = new File(directory + File.separator + filename);
FileOutputStream fos = null;
OutputStreamWriter osw = null;
try

View file

@ -13,6 +13,7 @@
*******************************************************************************/
package edu.utah.ece.async.ibiosim.synthesis.SBMLTechMapping;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
@ -315,7 +316,7 @@ public class Synthesizer {
private static void createSubmodel(String submodelID, String sbmlFileID, BioModel biomodel) throws XMLStreamException, IOException {
BioModel subBiomodel = new BioModel(biomodel.getPath());
subBiomodel.load(biomodel.getPath() + biomodel.getSeparator() + sbmlFileID);
subBiomodel.load(biomodel.getPath() + File.separator + sbmlFileID);
String md5 = Utility.MD5(subBiomodel.getSBMLDocument());
biomodel.addComponent(submodelID, sbmlFileID, subBiomodel.IsWithinCompartment(),

View file

@ -16,9 +16,6 @@ package edu.utah.ece.async.lema.verification;
import java.io.File;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.lema.verification.lpn.LPN;
import edu.utah.ece.async.lema.verification.platu.main.Options;
@ -35,8 +32,6 @@ import edu.utah.ece.async.lema.verification.platu.project.Project;
*/
public class VerificationCommandLine {
static String separator = GlobalConstants.separator;
public static void main (String[] args) {
if (args.length == 0) {
System.err.println("Error: Missing arguments.");
@ -145,14 +140,14 @@ public class VerificationCommandLine {
for (int i=0; i < lpns.length; i++) {
String curLPNname = lpns[i].getName();
LPN curLPN = new LPN();
curLPN.load(directory + separator + curLPNname);
curLPN.load(directory + File.separator + curLPNname);
lpnList.add(curLPN);
}
}
else {
for (int i=0; i < lpnNames.size(); i++) {
LPN curLPN = new LPN();
curLPN.load(directory + separator + lpnNames.get(i));//load(directory + curLPNname);
curLPN.load(directory + File.separator + lpnNames.get(i));//load(directory + curLPNname);
lpnList.add(curLPN);
}
}

View file

@ -52,8 +52,6 @@ import edu.utah.ece.async.lema.verification.timed_state_exploration.zoneProject.
*/
public class LPN extends Observable {
protected String separator;
protected HashMap<String, Transition> transitions;
protected HashMap<String, Place> places;
@ -126,7 +124,6 @@ public class LPN extends Observable {
private static int implicitPlaceCount=0;
public LPN() {
separator = GlobalConstants.separator;
transitions = new HashMap<String, Transition>();
places = new HashMap<String, Place>();
implicitPlaceMap = new HashMap<String,String>();
@ -870,7 +867,7 @@ public class LPN extends Observable {
public void load(String filename) throws BioSimException {
StringBuffer data = new StringBuffer();
label = filename.split(separator)[filename.split(separator).length - 1].replace(".lpn","");
label = GlobalConstants.getFilename(filename).replace(".lpn","");
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
String str;

View file

@ -33,14 +33,13 @@ public class Lpn2verilog {
public static void convert(String lpnFileName) throws BioSimException {
HashMap<String,Boolean> visitedPlaces;
String enable = "";
String separator = GlobalConstants.separator;
try{
LPN lpn = new LPN();
lpn.load(lpnFileName);
String svFileName = lpnFileName.replaceAll(".lpn", ".sv");
File svFile = new File(svFileName);
svFile.createNewFile();
String[] svPath = svFileName.split(separator);
String[] svPath = GlobalConstants.splitPath(svFileName);
//for (int i=0; i < svPath.length; i++){
//System.out.println("\nModule string is " + svPath[i] + "\n");}
String svModuleName = svPath[svPath.length -1].split("\\.")[0];

View file

@ -13,6 +13,7 @@
*******************************************************************************/
package edu.utah.ece.async.lema.verification.lpn.LpnDecomposition;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -110,7 +111,7 @@ public class LpnComponentList extends LPN{
LpnComponentGraph componentGraph = new LpnComponentGraph(sharedCompVarsMap, compMap, maxNumVarsInOneComp);
if (Options.getDebugMode()) {
String graphFileName = lpnFileName + maxNumVarsInOneComp + "Vars" + "_compGraph" + iter + ".dot";
componentGraph.outputDotFile(directory + separator + graphFileName);
componentGraph.outputDotFile(directory + File.separator + graphFileName);
}
Vertex vertexToCoalesce = componentGraph.selectVerticesToCoalesce();
if (vertexToCoalesce != null) {

View file

@ -729,7 +729,7 @@ public class Translator extends Observable {
// create sbml file
//document = new SBMLDocument(BioSim.SBML_LEVEL, BioSim.SBML_VERSION);
document = new SBMLDocument(3,1);
String[] filenameSplit = filename.split(GlobalConstants.separator);
String[] filenameSplit = GlobalConstants.splitPath(filename);
String modelId = filenameSplit[filenameSplit.length-1].replace(".xml","");
Model m = document.createModel(modelId);

View file

@ -14,6 +14,7 @@
package edu.utah.ece.async.lema.verification.platu.logicAnalysis;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.NumberFormat;
@ -26,7 +27,6 @@ import java.util.Observable;
import java.util.PriorityQueue;
import java.util.Stack;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.Message;
import edu.utah.ece.async.lema.verification.lpn.Abstraction;
import edu.utah.ece.async.lema.verification.lpn.ExprTree;
@ -81,7 +81,6 @@ public class Analysis extends Observable{
*/
private HashSet<Transition> visitedTrans;
HashMap<Transition, StaticDependencySets> staticDependency = new HashMap<Transition, StaticDependencySets>();
private String separator = GlobalConstants.separator;
public Analysis(StateGraph[] lpnList, State[] initStateArray, LPNTranRelation lpnTranRelation, String method) {
traceCex = new LinkedList<Transition>();
@ -1273,7 +1272,7 @@ public class Analysis extends Observable{
}
private void drawDependencyGraphs(LPN[] lpnList) {
String fileName = Options.getPrjSgPath() + separator + "dependencyGraph.dot";
String fileName = Options.getPrjSgPath() + File.separator + "dependencyGraph.dot";
BufferedWriter out;
try {
out = new BufferedWriter(new FileWriter(fileName));
@ -1834,7 +1833,7 @@ public class Analysis extends Observable{
try {
String fileName = null;
if (isPOR) {
fileName = Options.getPrjSgPath() + separator + Options.getLogName() + "_" + Options.getPOR() + "_"
fileName = Options.getPrjSgPath() + File.separator + Options.getLogName() + "_" + Options.getPOR() + "_"
+ Options.getCycleClosingMthd() + "_" + Options.getCycleClosingStrongStubbornMethd() + ".log";
}
else

View file

@ -14,6 +14,7 @@
package edu.utah.ece.async.lema.verification.platu.project;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
@ -30,7 +31,6 @@ import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.TokenStream;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.lema.verification.lpn.LPN;
import edu.utah.ece.async.lema.verification.lpn.Translator;
@ -78,8 +78,6 @@ public class Project {
protected CompositionalAnalysis analysis = null;
private Observer observer;
private static String separator = GlobalConstants.separator;
public Project() {
this.label = "";
@ -429,7 +427,7 @@ public class Project {
try {
String fileName = null;
if (isPOR) {
fileName = Options.getPrjSgPath() + separator + Options.getLogName() + "_"
fileName = Options.getPrjSgPath() + File.separator + Options.getLogName() + "_"
+ Options.getPOR() + "_" + Options.getCycleClosingMthd() + "_"
+ Options.getCycleClosingStrongStubbornMethd() + "_runtime.log";
}

View file

@ -14,6 +14,7 @@
package edu.utah.ece.async.lema.verification.platu.stategraph;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
@ -25,7 +26,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.lema.verification.lpn.LPN;
import edu.utah.ece.async.lema.verification.lpn.Place;
import edu.utah.ece.async.lema.verification.lpn.Transition;
@ -84,7 +84,6 @@ public class StateGraph {
protected Set<Constraint> constraintSet = new HashSet<Constraint>();
protected LPN lpn;
protected static Set<Entry<Transition, State>> emptySet = new HashSet<Entry<Transition, State>>(0);
private String separator = GlobalConstants.separator;
public StateGraph(LPN lpn) {
this.lpn = lpn;
@ -1250,10 +1249,10 @@ public class StateGraph {
String graphFileName = null;
if ( Options.getTimingAnalysisType() == "off") {
if (Options.getPOR().toLowerCase().equals("off")) {
graphFileName = Options.getPrjSgPath() + separator + getLpn().getLabel() + "_local_full_sg.dot";
graphFileName = Options.getPrjSgPath() + File.separator + getLpn().getLabel() + "_local_full_sg.dot";
}
else {
graphFileName = Options.getPrjSgPath() + separator + getLpn().getLabel() + "_POR_"+ Options.getCycleClosingMthd() + "_local_sg.dot";
graphFileName = Options.getPrjSgPath() + File.separator + getLpn().getLabel() + "_POR_"+ Options.getCycleClosingMthd() + "_local_sg.dot";
}
} else {
// TODO: Need to add separator here?

View file

@ -16,7 +16,6 @@ package edu.utah.ece.async.lema.verification.timed_state_exploration.zoneProject
import java.io.File;
import java.util.ArrayList;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.lema.verification.lpn.LPN;
import edu.utah.ece.async.lema.verification.platu.main.Options;
@ -91,8 +90,8 @@ public class Conolse7_26_2012 {
LPN lpn = new LPN();
lpn.load(directory + GlobalConstants.separator + lpnList[0]);
Options.set_TimingLogFile(directory + GlobalConstants.separator
lpn.load(directory + File.separator + lpnList[0]);
Options.set_TimingLogFile(directory + File.separator
+ lpnList[0] + ".tlog");
@ -103,7 +102,7 @@ public class Conolse7_26_2012 {
for (int i=1; i < lpnList.length; i++) {
String curLPNname = lpnList[i];
LPN curLPN = new LPN();
curLPN.load(directory + GlobalConstants.separator + curLPNname);
curLPN.load(directory + File.separator + curLPNname);
selectedLPNs.add(curLPN);
}