/// /// <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); }
public void testMatchesPersonalID() { JDFEmployee emp = (JDFEmployee) new JDFDoc("Employee").getRoot(); Assert.IsTrue(emp.matches(null)); Assert.IsFalse(emp.matches("p2")); emp.setPersonalID("p1"); Assert.IsFalse(emp.matches("p2")); Assert.IsTrue(emp.matches("p1")); }