Back to project page sana.
The source code is released under:
Copyright (c) 2010, Moca All rights reserved. The source code for Moca is licensed under the BSD license as follows: Redistribution and use in source and binary forms, with or without modification, ...
If you think the Android project sana listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.moca.procedure.branching; /*from www. j a va2 s . c om*/ import java.util.HashMap; import org.moca.procedure.ProcedureElement; import org.moca.procedure.ProcedureParseException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * LogicNot is a Criteria subclass that serves as a container to hold a single * Criteria object. It's criteriaMet() method evaluates the Criteria it holds * and returns the opposite (not). */ public class LogicNot extends Criteria { Criteria criteria; public LogicNot(Criteria crit) { this.criteria = crit; } public boolean criteriaMet() { return !criteria.criteriaMet(); } public static LogicNot fromXML(Node node, HashMap<String, ProcedureElement> elts) throws ProcedureParseException { if(!node.getNodeName().equals("not")) throw new ProcedureParseException("LogicNot got NodeName " + node.getNodeName()); NodeList children = node.getChildNodes(); if (children.getLength() != 3) throw new ProcedureParseException("LogicNot wrong number of elements: expects 1"); Node child = children.item(1); return new LogicNot(Criteria.switchOnCriteria(child, elts)); } }