jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors AggregrateSelector.java,1.5,1.6 ClassSelector.java,1.5,1.6 InstanceofSelector.java,1.3,1.4 PickyHintedClassSelector.java,1.5,1.6

[email protected]
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12008/platform/container/impl/src/java/org/jicarilla/container/selectors

Modified Files:
	AggregrateSelector.java ClassSelector.java 
	InstanceofSelector.java PickyHintedClassSelector.java 
Log Message:
minor api improvements + tests

Index: AggregrateSelector.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors/AggregrateSelector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- AggregrateSelector.java	18 Jan 2004 15:52:34 -0000	1.5
+++ AggregrateSelector.java	9 Mar 2004 23:59:59 -0000	1.6
@@ -72,8 +72,8 @@
 
         final Object criterion = ((AggregrateSelector)o).getCriterion();
 
-        if( !(criterion instanceof Selector[]) )
-            return false;
+        /*if( !(criterion instanceof Selector[]) )
+            return false;*/
         final Selector[] selectors = (Selector[])criterion;
 
         return Arrays.equals( m_selectors, selectors );
@@ -81,20 +81,15 @@
 
     public int hashCode()
     {
-        if( getCriterion() == null )
-            return 80;
-        else
+        int code = 85;
+        for( int i = 0; i < m_selectors.length; i++ )
         {
-            int code = 85;
-            for( int i = 0; i < m_selectors.length; i++ )
-            {
-                Selector selector = m_selectors[i];
-                if( selector == null )
-                    code += 1;
-                else
-                    code += selector.hashCode();
-            }
-            return code;
+            Selector selector = m_selectors[i];
+            if( selector == null )
+                code += 1;
+            else
+                code += selector.hashCode();
         }
+        return code;
     }
 }

Index: ClassSelector.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors/ClassSelector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ClassSelector.java	10 Jan 2004 10:14:11 -0000	1.5
+++ ClassSelector.java	9 Mar 2004 23:59:59 -0000	1.6
@@ -89,9 +89,6 @@
 
     public int hashCode()
     {
-        if( getCriterion() == null )
-            return 50;
-        else
-            return getCriterion().hashCode() + 50;
+        return getCriterion().hashCode() + 50;
     }
 }

Index: InstanceofSelector.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors/InstanceofSelector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- InstanceofSelector.java	10 Jan 2004 10:14:11 -0000	1.3
+++ InstanceofSelector.java	9 Mar 2004 23:59:59 -0000	1.4
@@ -59,4 +59,25 @@
     {
         return m_criterion;
     }
+
+    public boolean equals( Object o )
+    {
+        if( this == o )
+            return true;
+
+        if( !(o instanceof InstanceofSelector) )
+            return false;
+
+        final InstanceofSelector instanceofSelector = (InstanceofSelector)o;
+
+        if( !m_criterion.equals( instanceofSelector.m_criterion ) )
+            return false;
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        return getCriterion().hashCode() + 120;
+    }
 }

Index: PickyHintedClassSelector.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/java/org/jicarilla/container/selectors/PickyHintedClassSelector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- PickyHintedClassSelector.java	18 Jan 2004 15:52:34 -0000	1.5
+++ PickyHintedClassSelector.java	9 Mar 2004 23:59:59 -0000	1.6
@@ -33,7 +33,7 @@
  */
 public class PickyHintedClassSelector extends ClassSelector
 {
-    public final String m_hint;
+    protected final String m_hint;
 
     public PickyHintedClassSelector( final Class clazz, final String hint )
     {
@@ -81,12 +81,7 @@
 
     public int hashCode()
     {
-        if( m_hint == null )
-            return super.hashCode() + 10;
-        else
-        {
-            return super.hashCode() + 10 + m_hint.hashCode();
-        }
+        return super.hashCode() + 10 + m_hint.hashCode();
     }
 
 }



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.