/*
 * Generated by XDoclet - Do not edit!
 */
package org.jboss.test.cmp2.fkstackoverflow.ejb;

/**
 * Primary key for ComplexParent.
 */
public class ComplexParentPK
   extends java.lang.Object
   implements java.io.Serializable
{
   private int _hashCode = 0;
   private StringBuffer _toStringValue = null;

   public java.lang.Long id1;
   public java.lang.Long id2;

   public ComplexParentPK()
   {
   }

   public ComplexParentPK( java.lang.Long id1,java.lang.Long id2 )
   {
      this.id1 = id1;
      this.id2 = id2;
   }

   public java.lang.Long getId1()
   {
      return id1;
   }
   public java.lang.Long getId2()
   {
      return id2;
   }

   public void setId1(java.lang.Long id1)
   {
      this.id1 = id1;
      _hashCode = 0;
   }
   public void setId2(java.lang.Long id2)
   {
      this.id2 = id2;
      _hashCode = 0;
   }

   public int hashCode()
   {
      if( _hashCode == 0 )
      {
         if (this.id1 != null) _hashCode += this.id1.hashCode();
         if (this.id2 != null) _hashCode += this.id2.hashCode();
      }

      return _hashCode;
   }

   public boolean equals(Object obj)
   {
      if( !(obj instanceof org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK) )
         return false;

      org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK pk = (org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj;
      boolean eq = true;

      if( obj == null )
      {
         eq = false;
      }
      else
      {
         if( this.id1 == null && ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId1() == null )
         {
            eq = true;
         }
         else
         {
            if( this.id1 == null || ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId1() == null )
            {
               eq = false;
            }
            else
            {
               eq = eq && this.id1.equals( pk.id1 );
            }
         }
         if( this.id2 == null && ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId2() == null )
         {
            eq = true;
         }
         else
         {
            if( this.id2 == null || ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId2() == null )
            {
               eq = false;
            }
            else
            {
               eq = eq && this.id2.equals( pk.id2 );
            }
         }
      }

      return eq;
   }

   /** @return String representation of this pk in the form of [.field1.field2.field3]. */
   public String toString()
   {
      if( _toStringValue == null )
      {
         _toStringValue = new StringBuffer("[.");
         _toStringValue.append(this.id1).append('.');
         _toStringValue.append(this.id2).append('.');
         _toStringValue.append(']');
      }

      return _toStringValue.toString();
   }

}
