use of org.sbolstandard.core2.ModuleDefinition in project libSBOLj by SynBioDex.
the class ModuleDefModuleTree method createModuleMDGraph.
public void createModuleMDGraph(SBOLDocument doc, int depth, ArrayList<String> mdNames, ArrayList<Integer> address, ModuleDefinition parentMd) throws SBOLValidationException {
// System.out.println("depth = " + depth);
if (depth > 0) {
for (int i = 1; i <= numOfModules; i++) {
address.add(i);
System.out.println("address = " + intArrayListToString(address));
System.out.println("addrSelfRef = " + intArrayListToString(addrCirfRef));
String mdId = "md_" + intArrayListToString(address);
String mId = "m_" + intArrayListToString(address);
System.out.println("mdId = " + mdId);
// System.out.println("mId = " + mId);
if (intArrayListToString(address).equals(intArrayListToString(addrCirfRef))) {
int circularRefIndex = randInt(0, mdNames.size() - 1);
// int circleRefIndex = mdNames.size()-1; // Force 10704 to occur.
System.out.println("circleRefIndex = " + circularRefIndex);
System.out.println("address = " + intArrayListToString(address));
System.out.println("addrCirRef = " + intArrayListToString(addrCirfRef));
System.out.println("mdNames = " + mdNames);
if (circularRefIndex == mdNames.size() - 1) {
System.out.println("Expect 11704");
expectedError = "11704";
} else {
System.out.println("Expect 11705");
expectedError = "11705";
}
System.out.println("Last module displayId (mId) = " + mId);
System.out.println("parentMd displayId = " + parentMd.getDisplayId());
System.out.println("mdName = " + mdNames.get(circularRefIndex));
// create the circular reference from module with mId to module definition selected by mdNames.get(circularRefIndex).
parentMd.createModule(mId, mdNames.get(circularRefIndex));
} else {
ModuleDefinition childMd = doc.createModuleDefinition(mdId);
parentMd.createModule(mId, mdId);
mdNames.add(mdId);
// System.out.println(mdId);
// System.out.println("Interm. Module displayId = " + m.getDisplayId());
System.out.println("mdNames = " + mdNames);
createModuleMDGraph(doc, depth - 1, mdNames, address, childMd);
mdNames.remove(mdId);
}
address.remove(address.size() - 1);
}
}
}
Aggregations