|
From: Elmer G. <ega...@us...> - 2004-10-13 01:30:01
|
Update of /cvsroot/javaowl/Reasoner/src/org/javaowl/reasoner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27952/src/org/javaowl/reasoner Added Files: AbstractConcept.java AtomicConcept.java Concept.java Log Message: Added new reasoner files. --- NEW FILE: AtomicConcept.java --- /* AtomicConcept.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer Garduno Hernandez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.reasoner; import java.util.Map; import java.util.HashMap; public class AtomicConcept extends AbstractConcept{ private final String name; private final boolean negated; private final boolean top; private final boolean bottom; private final static Map map = new HashMap(); private final static Map negatedMap = new HashMap(); public final static AtomicConcept TOP; public final static AtomicConcept BOTTOM; static { TOP = new AtomicConcept("TOP", false, true, false); map.put("TOP", TOP); BOTTOM = new AtomicConcept("TOP", true, false, true); negatedMap.put("TOP", BOTTOM); } private AtomicConcept(String name, boolean negated, boolean top, boolean bottom) { this.name = name; this.negated = negated; this.top = top; this.bottom = bottom; } public final static AtomicConcept getConcept(String name) { AtomicConcept concept = (AtomicConcept) map.get(name); if (concept == null) { concept = new AtomicConcept(name, false, false, false); map.put(name, concept); } return concept; } public AtomicConcept getNegatedConcept() { if (negated) { AtomicConcept concept = (AtomicConcept) map.get(name); if (concept == null) { concept = new AtomicConcept(name, false, false, false); negatedMap.put(name, concept); } return concept; } AtomicConcept concept = (AtomicConcept) negatedMap.get(name); if (concept == null) { concept = new AtomicConcept(name, true, false, false); negatedMap.put(name, concept); } return concept; } public boolean isTop() { return top; } public boolean isBottom() { return bottom; } public boolean isNegated() { return negated; } public boolean isAtomic() { return true; } public boolean equals(Object o) { if (! (o instanceof AtomicConcept)) return false; return o == this; } } --- NEW FILE: AbstractConcept.java --- /* AbstractConcept.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer Garduno Hernandez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.reasoner; public abstract class AbstractConcept implements Concept{ public boolean isTop() { return false; } public boolean isBottom() { return false; } } --- NEW FILE: Concept.java --- /* Concept.java Copyright (C) 2004 Gerardo Horvilleur Martinez, Elmer Garduno Hernandez This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.javaowl.reasoner; public interface Concept { boolean isAtomic(); boolean isTop(); boolean isBottom(); boolean isNegated(); } |