Skip to content

Commit 004c0f4

Browse files
authored
Updated SquidAPI to include opening OP data files (#662)
1 parent eed1a94 commit 004c0f4

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

squidAPI/src/main/java/org/cirdles/squid/Squid3API.java

+11
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ void newSquid3GeochronProjectFromPrawnXML(Path prawnXMLFileSourcePath)
6060
void newSquid3GeochronProjectFromZippedPrawnXML(Path prawnXMLFileSourcePath)
6161
throws IOException, JAXBException, SAXException, SquidException;
6262

63+
/**
64+
*
65+
* @param dataFileOPSourcePath
66+
* @throws IOException
67+
* @throws JAXBException
68+
* @throws SAXException
69+
* @throws SquidException
70+
*/
71+
void newSquid3GeochronProjectFromDataFileOP(Path dataFileOPSourcePath)
72+
throws IOException, JAXBException, SAXException, SquidException;
73+
6374
/**
6475
* @param projectFilePath
6576
*/

squidAPI/src/main/java/org/cirdles/squid/Squid3Ink.java

+28
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,34 @@ public void newSquid3GeochronProjectFromZippedPrawnXML(Path prawnXMLFileSourcePa
214214
}
215215
}
216216

217+
/**
218+
* @param opFileSourcePath
219+
* @throws IOException
220+
* @throws SquidException
221+
*/
222+
public void newSquid3GeochronProjectFromDataFileOP(Path dataFileOPSourcePath)
223+
throws IOException, SquidException {
224+
File opSourceFile = dataFileOPSourcePath.toFile();
225+
226+
if (opSourceFile != null) {
227+
if (squid3Project.setupPrawnOPFile(opSourceFile)) {
228+
squid3Project = new SquidProject(GEOCHRON);
229+
((SquidProject) squid3Project).autoDivideSamples();
230+
squidPersistentState.updateOPFileListMRU(opSourceFile);
231+
} else {
232+
squid3Project.getTask().setChanged(false);
233+
SquidProject.setProjectChanged(false);
234+
throw new SquidException(
235+
"Squid3 encountered an error while trying to open the selected data file.");
236+
}
237+
} else {
238+
squid3Project.getTask().setChanged(false);
239+
SquidProject.setProjectChanged(false);
240+
throw new SquidException(
241+
"Squid3 encountered an error while trying to open the selected data file.");
242+
}
243+
}
244+
217245
/**
218246
* Loads existing Squid3 project file.
219247
*

squidCore/src/main/java/org/cirdles/squid/projects/Squid3ProjectBasicAPI.java

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.cirdles.squid.tasks.TaskInterface;
2424
import org.cirdles.squid.utilities.squidPrefixTree.SquidPrefixTree;
2525

26+
import java.io.File;
27+
import java.io.IOException;
2628
import java.io.Serializable;
2729
import java.util.List;
2830
import java.util.Map;
@@ -117,6 +119,9 @@ public interface Squid3ProjectBasicAPI extends Serializable {
117119

118120
String getPrawnSourceFilePath();
119121

122+
public boolean setupPrawnOPFile(File opFileNew)
123+
throws IOException, SquidException;
124+
120125
/**
121126
* @return the prefixTree
122127
*/

0 commit comments

Comments
 (0)