summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
commitaedc34d55462a75e329bbf342251ff6504cd117e (patch)
treebcc8f1f2352582717b484df302aeea6696b8f000 /projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java
Initial import from SVN
Diffstat (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java')
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java129
1 files changed, 129 insertions, 0 deletions
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java
new file mode 100644
index 0000000..d086840
--- /dev/null
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EONotQualifier.java
@@ -0,0 +1,129 @@
+/*
+Wotonomy: OpenStep design patterns for pure Java applications.
+Copyright (C) 2001 Intersect Software Corporation
+
+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, see http://www.gnu.org
+*/
+
+package net.wotonomy.control;
+
+import net.wotonomy.foundation.internal.WotonomyException;
+
+/**
+* EONotQualifiier negates a specified qualifier,
+* evaluating to the opposite of the specified qualifier.
+*
+* @author michael@mpowers.net
+* @author yjcheung@intersectsoft.com
+* @author $Author: cgruber $
+* @version $Revision: 894 $
+*/
+public class EONotQualifier extends EOQualifier
+ implements EOKeyValueArchiving, EOQualifierEvaluation
+{
+ private EOQualifier qualifier;
+
+ public EONotQualifier(
+ EOQualifier aQualifier )
+ {
+ qualifier = aQualifier;
+ }
+
+ /**
+ * Returns the qualifier that this qualifier negates.
+ */
+ public EOQualifier qualifier()
+ {
+ return qualifier;
+ }
+
+ /**
+ * Evaluates this qualifier for the specified object,
+ * and returns whether the object is qualified.
+ * evaluateWithObject is invoked on qualifier
+ * and the result is negated and returned.
+ */
+ public boolean evaluateWithObject( Object anObject )
+ {
+ return !(qualifier.evaluateWithObject(anObject));
+ }
+
+ /**
+ * Returns a string representation of this qualifier.
+ */
+ public String toString()
+ {
+ return (new StringBuffer("Not ").append(qualifier.toString()).toString());
+ }
+
+ public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver arch) {
+ EOQualifier q = (EOQualifier)arch.decodeObjectForKey("qualifier");
+ if (q == null)
+ return null;
+ return new EONotQualifier(q);
+ }
+
+ public void encodeWithKeyValueArchiver(EOKeyValueArchiver arch) {
+ arch.encodeObject("EONotQualifier", "class");
+ if (qualifier instanceof EOKeyValueArchiving) {
+ EOKeyValueArchiver ar2 = new EOKeyValueArchiver();
+ ((EOKeyValueArchiving)qualifier).encodeWithKeyValueArchiver(ar2);
+ arch.encodeObject(ar2.dictionary(), "qualifiers");
+ } else
+ throw new WotonomyException("Cannot archive instance of " + qualifier.getClass().getName());
+ }
+
+}
+
+/*
+ * $Log$
+ * Revision 1.2 2006/02/16 16:47:14 cgruber
+ * Move some classes in to "internal" packages and re-work imports, etc.
+ *
+ * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions.
+ *
+ * Revision 1.1 2006/02/16 13:19:57 cgruber
+ * Check in all sources in eclipse-friendly maven-enabled packages.
+ *
+ * Revision 1.9 2003/08/12 01:43:04 chochos
+ * formally implement EOQualifierEvaluation
+ *
+ * Revision 1.8 2003/08/11 19:39:30 chochos
+ * special conditions for NSKeyValueCoding.NullValue -> EONull
+ *
+ * Revision 1.7 2003/08/09 01:24:19 chochos
+ * implements EOKeyValueArchiving
+ *
+ * Revision 1.6 2003/08/06 23:07:52 chochos
+ * general code cleanup (mostly, removing unused imports)
+ *
+ * Revision 1.5 2001/10/31 15:25:14 mpowers
+ * Cleanup of qualifiers.
+ *
+ * Revision 1.4 2001/10/30 22:57:28 mpowers
+ * EOQualifier framework is now working.
+ *
+ * Revision 1.3 2001/09/13 15:42:20 mpowers
+ * Fixed another cut/paste typo.
+ *
+ * Revision 1.2 2001/09/13 15:41:34 mpowers
+ * Fixed typo.
+ *
+ * Revision 1.1 2001/09/13 15:38:19 mpowers
+ * Started implementation of the EOQualifier framework.
+ *
+ *
+ */
+
+