@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FaceInstance other = (FaceInstance) obj; if (_action == null) { if (other._action != null) return false; } else if (!_action.equals(other._action)) return false; if (_ccndID == null) { if (other._ccndID != null) return false; } else if (!_ccndID.equals(other._ccndID)) return false; if (_faceID == null) { if (other._faceID != null) return false; } else if (!_faceID.equals(other._faceID)) return false; if (_ipProto == null) { if (other._ipProto != null) return false; } else if (!_ipProto.equals(other._ipProto)) return false; if (_host == null) { if (other._host != null) return false; } else if (!_host.equals(other._host)) return false; if (_port == null) { if (other._port != null) return false; } else if (!_port.equals(other._port)) return false; if (_multicastInterface == null) { if (other._multicastInterface != null) return false; } else if (!_multicastInterface.equals(other._multicastInterface)) return false; if (_multicastTTL == null) { if (other._multicastTTL != null) return false; } else if (!_multicastTTL.equals(other._multicastTTL)) return false; if (_lifetime == null) { if (other._lifetime != null) return false; } else if (!_lifetime.equals(other._lifetime)) return false; return true; }
/** * Used by NetworkObject to encode the object to a network stream. * * @see org.ccnx.ccn.impl.encoding.XMLEncodable */ public void encode(XMLEncoder encoder) throws ContentEncodingException { if (!validate()) { throw new ContentEncodingException( "Cannot encode " + this.getClass().getName() + ": field values missing."); } encoder.writeStartElement(getElementLabel()); if (null != _action && _action.length() != 0) encoder.writeElement(CCNProtocolDTags.Action, _action); if (null != _ccndID) { _ccndID.encode(encoder); } if (null != _faceID) { encoder.writeElement(CCNProtocolDTags.FaceID, _faceID); } if (null != _ipProto) { encoder.writeElement(CCNProtocolDTags.IPProto, _ipProto.value()); } if (null != _host && _host.length() != 0) { encoder.writeElement(CCNProtocolDTags.Host, _host); } if (null != _port) { encoder.writeElement(CCNProtocolDTags.Port, _port); } if (null != _multicastInterface && _multicastInterface.length() != 0) { encoder.writeElement(CCNProtocolDTags.MulticastInterface, _multicastInterface); } if (null != _multicastTTL) { encoder.writeElement(CCNProtocolDTags.MulticastTTL, _multicastTTL); } if (null != _lifetime) { encoder.writeElement(CCNProtocolDTags.FreshnessSeconds, _lifetime); } encoder.writeEndElement(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_action == null) ? 0 : _action.hashCode()); result = prime * result + ((_ccndID == null) ? 0 : _ccndID.hashCode()); result = prime * result + ((_faceID == null) ? 0 : _faceID.hashCode()); result = prime * result + ((_ipProto == null) ? 0 : _ipProto.hashCode()); result = prime * result + ((_host == null) ? 0 : _host.hashCode()); result = prime * result + ((_port == null) ? 0 : _port.hashCode()); result = prime * result + ((_multicastInterface == null) ? 0 : _multicastInterface.hashCode()); result = prime * result + ((_multicastTTL == null) ? 0 : _multicastTTL.hashCode()); result = prime * result + ((_lifetime == null) ? 0 : _lifetime.hashCode()); return result; }