Пример #1
0
  /**
   * See if the other object matches the template object this represents. (Note that even though
   * "this" is a template, it may have no wildcards -- a template can have all values.)
   */
  boolean matches(EntryRep other) {
    /*
     * We use the fact that this is the template in several ways in
     * the method implementation.  For instance, in this next loop,
     * we know that the real object must be at least my type, which
     * means (a) the field types already match, and (b) it has at
     * least as many fields as the this does.
     */

    // Note: If this object is the MatchAny template then
    //      return true (all entries match MatchAny)
    if (EntryRep.isMatchAny(this)) return true;

    for (int f = 0; f < values.length; f++) {
      if (values[f] == null) { // skip wildcards
        continue;
      }
      if (!values[f].equals(other.values[f])) {
        return false;
      }
    }
    return true; // no mismatches, so must be OK
  }
Пример #2
0
 /** Return the class name that is used by the ``match any'' EntryRep */
 static String matchAnyClassName() {
   return matchAnyRep.classFor();
 }
Пример #3
0
 /** Return <code>true</code> if the given rep is that ``match any'' <code>EntryRep</code>. */
 private static boolean isMatchAny(EntryRep rep) {
   return matchAnyRep.equals(rep);
 }