public boolean equals()

in src/main/java/org/apache/neethi/builders/PrimitiveAssertion.java [127:168]


    public boolean equals(Object obj) {
      if (!(obj instanceof PrimitiveAssertion)) {
          return false;
      }
      
      PrimitiveAssertion pa = (PrimitiveAssertion) obj;
      
      if ((pa.getName() != null) && (!pa.getName().equals(this.getName()))) {
          return false;
      }
      
      if ((this.getName() != null) && (!this.getName().equals(pa.getName()))) {
          return false;
      }

      if ((pa.isOptional() ^ this.isOptional()) || (pa.isIgnorable() ^ this.isIgnorable())) {
          return false;
      }

      if ( (pa.getTextValue() != null) && (!pa.getTextValue().equals(this.getTextValue()))) {
          return false;
      }

      if ( (this.getTextValue() != null) && (!this.getTextValue().equals(pa.getTextValue()))) {
          return false;
      }
      
      Map<QName, String> attrs1 = getAttributes();
      Map<QName, String> attrs2 = pa.getAttributes();
      for (QName key : attrs1.keySet()) {
          if ((!attrs2.containsKey(key)) || (!attrs1.get(key).equals(attrs2.get(key)))) {
              return false;
          } else {
              attrs2.remove(key);
          }
      }
      if (!attrs2.isEmpty()) {
          return false;
      }
      
      return true;
    }