// ## operation generateReverse(ReactionAdjList) public StructureTemplate generateReverse(ReactionAdjList p_reactionAdjList) { // #[ operation generateReverse(ReactionAdjList) int r_num = getReactantNumber(); Matchable r1 = getAllowedFunctionalGroupAt(1); LinkedList reactant = new LinkedList(); reactant.add(r1); if (r_num == 2) { Matchable r2 = getAllowedFunctionalGroupAt(2); reactant.add(r2); } LinkedList reverse = p_reactionAdjList.reactFunctionalGroup(reactant); StructureTemplate reverseRT = new StructureTemplate(reverse); reverseRT.reactantTree = this.reactantTree; return reverseRT; // #] }
// ## operation isReverse(StructureTemplate,ReactionAdjList) public boolean isReverse( StructureTemplate p_structureTemplate, ReactionAdjList p_reactionAdjList) { // #[ operation isReverse(StructureTemplate,ReactionAdjList) return (p_structureTemplate.equals(generateReverse(p_reactionAdjList))); // #] }