use of gov.sandia.n2a.language.type.Text in project n2a by frothga.
the class ReadMatrix method open.
public Matrix open(Instance context) {
Simulator simulator = Simulator.instance.get();
// absence of simulator indicates analysis phase, so opening files is unnecessary
if (simulator == null)
return null;
String path = ((Text) operands[0].eval(context)).value;
Object A = simulator.holders.get(path);
if (A == null) {
A = Matrix.factory(simulator.jobDir.resolve(path));
simulator.holders.put(path, A);
} else if (!(A instanceof Matrix)) {
Backend.err.get().println("ERROR: Reopening file as a different resource type.");
throw new Backend.AbortRun();
}
return (Matrix) A;
}
Aggregations