slcom/slangc/model/CombinedImportModel.sauce

43 lines
1006 B
Plaintext

package slangc.model;
public class CombinedImportModel extends ImportModel {
private ImportModel[] models;
public CombinedImportModel(SystemModel system, boolean synthetic, ImportModel[] innerModels) {
super(system, synthetic);
models = innerModels;
}
public int countInnerModels() {
return models.length;
}
public ImportModel getInnerModel(int index) {
return models[index];
}
@Override
public TypeModel lookupExact(String name) {
for (int i = 0; i < models.length; i++) {
//System.out.println("Checking '" + name + "' against " + models[i]);
TypeModel x = models[i].lookupExact(name);
if (x != null) {
return x;
}
}
return null;
}
@Override
public TypeModel lookupLoose(String name) {
for (int i = 0; i < models.length; i++) {
//System.out.println("Checking '" + name + "' against " + models[i]);
TypeModel x = models[i].lookupLoose(name);
if (x != null) {
return x;
}
}
return null;
}
}