use of gov.sandia.n2a.backend.internal.Part in project n2a by frothga.
the class Instance method resolve.
public void resolve(TreeSet<VariableReference> references) {
for (VariableReference r : references) {
Instance result = this;
Object last = r.resolution.get(r.resolution.size() - 1);
for (Object o : r.resolution) {
result = ((Resolver) o).resolve(result);
if (// Resolution is done and this is a global variable.
o == last && r.variable.global) {
if (result instanceof Part) {
// Need to locate our population.
InternalBackendData bed = (InternalBackendData) result.equations.backendData;
result = (Instance) result.container.valuesObject[bed.populationIndex];
}
} else {
if (result instanceof Population) {
// Need to drill down to an instance of the population.
// This is only possible with a singleton.
InternalBackendData bed = (InternalBackendData) result.equations.backendData;
if (!bed.singleton) {
Backend.err.get().println("ERROR: Ambiguous reference to " + result.equations.prefix());
throw new Backend.AbortRun();
}
result = (Instance) result.valuesObject[bed.instances];
}
}
}
valuesObject[r.index] = result;
}
}
Aggregations