Ejemplo n.º 1
0
        ///
        ///	 <summary> * returns true if the input object is equivalent to this or null</br> valid
        ///	 * object types are:<br/> Employee<br/> EmployeeDef<br/> String - must match @PersonalID
        ///	 * <br/> (non-Javadoc)
        ///	 *  </summary>
        ///	 * <seealso cref= org.cip4.jdflib.ifaces.IMatches#matches(java.lang.Object) </seealso>
        ///
        public virtual bool matches(object subset)
        {
            if (subset == null)
            {
                return(true); // ( matches contract requires true for null to allow
            }
            // wildcards

            if (subset is JDFEmployee)
            {
                // TODO more criteria - person etc.
                JDFEmployee employee = (JDFEmployee)subset;
                return(ContainerUtil.Equals(getPersonalID(), employee.getPersonalID()));
            }
            else if (subset is JDFEmployeeDef)
            {
                JDFEmployeeDef ed = (JDFEmployeeDef)subset;
                return(ContainerUtil.Equals(getPersonalID(), ed.getPersonalID()));
            }
            else if (subset is string)
            {
                return(ContainerUtil.Equals(getPersonalID(), subset));
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void testMatchesEmployeeDef()
        {
            JDFEmployee    emp  = (JDFEmployee) new JDFDoc("Employee").getRoot();
            JDFEmployeeDef emp2 = (JDFEmployeeDef) new JDFDoc("EmployeeDef").getRoot();

            Assert.IsTrue(emp.matches(null));
            emp.setPersonalID("p1");
            Assert.IsFalse(emp.matches(emp2));
            emp2.setPersonalID("p1");
            Assert.IsTrue(emp.matches(emp2));
            emp2.setPersonalID("p2");
            Assert.IsFalse(emp.matches(emp2));
        }