use of ambit2.sln.dictionary.MarkushAtomDictionaryObject in project ambit-mirror by ideaconsult.
the class Expander method expandDictionaryAtom.
public List<IAtom> expandDictionaryAtom(SLNAtom at) {
// Handle a dictionary object
if (at.dictObj instanceof AtomDictionaryObject) {
AtomDictionaryObject aDO = (AtomDictionaryObject) at.dictObj;
SLNAtom newAt = aDO.atom.clone();
expContainer.addAtom(newAt);
List<IAtom> list = new ArrayList<IAtom>();
list.add(newAt);
return list;
} else if (at.dictObj instanceof MacroAtomDictionaryObject) {
return expandMacroAtomDictionaryObject((MacroAtomDictionaryObject) at.dictObj);
} else if (at.dictObj instanceof MarkushAtomDictionaryObject) {
// Get the proper macro/atom component from the Markush atom
// according to the markushPos[...] value
// maObj is either AtomDictionaryObject or MacroAtomDictionaryObject
ISLNDictionaryObject maObj = getProperDictionaryObject(at);
if (maObj instanceof AtomDictionaryObject) {
AtomDictionaryObject aDO = (AtomDictionaryObject) maObj;
SLNAtom newAt = aDO.atom.clone();
expContainer.addAtom(newAt);
List<IAtom> list = new ArrayList<IAtom>();
list.add(newAt);
return list;
} else {
return expandMacroAtomDictionaryObject((MacroAtomDictionaryObject) maObj);
}
}
return null;
}
use of ambit2.sln.dictionary.MarkushAtomDictionaryObject in project ambit-mirror by ideaconsult.
the class SLNParser method parseMarkushDictionaryObject.
public ISLNDictionaryObject parseMarkushDictionaryObject(String dictObjectString) {
markushHelper.analyzeMarkushString();
if (!markushHelper.getErrors().isEmpty()) {
newError(markushHelper.getErrorMessages(), 0, dictObjectString);
return null;
}
List<ISLNDictionaryObject> macroAtoms = new ArrayList<ISLNDictionaryObject>();
List<String> components = markushHelper.getComponentList();
for (int i = 0; i < components.size(); i++) {
// System.out.println(" " + components.get(i));
ISLNDictionaryObject dictObj = parseMacroAtomDictionaryObject(components.get(i), false);
if (dictObj != null)
macroAtoms.add(dictObj);
}
MarkushAtomDictionaryObject markushAtom = new MarkushAtomDictionaryObject(markushHelper.getMarkushAtomName(), dictObjectString, macroAtoms);
return markushAtom;
}
Aggregations