Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (CleavageC != null ? CleavageC.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RestrictC != null ? RestrictC.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CleavageN != null ? CleavageN.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RestrictN != null ? RestrictN.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
        private void Validate()
        {
            if (string.IsNullOrEmpty(CleavageC) && string.IsNullOrEmpty(CleavageN))
            {
                throw new InvalidDataException(Resources.Enzyme_Validate_Enzymes_must_have_at_least_one_cleavage_point);
            }
            var cleavageAll = String.Empty;

            if (string.IsNullOrEmpty(CleavageC))
            {
                if (!string.IsNullOrEmpty(RestrictC))
                {
                    throw new InvalidDataException(Resources.Enzyme_Validate_Enzyme_must_have_C_terminal_cleavage_to_have_C_terminal_restrictions_);
                }
                CleavageC  = RestrictC = null;
                _cleavageC = null;
                _restrictC = null;
            }
            else
            {
                AminoAcid.ValidateAAList(CleavageC);
                if (!string.IsNullOrEmpty(RestrictC))
                {
                    AminoAcid.ValidateAAList(RestrictC);
                }
                _cleavageC  = CleavageC.ToCharArray();
                _restrictC  = RestrictC == null? null : RestrictC.ToCharArray();
                cleavageAll = CleavageC;
            }
            if (string.IsNullOrEmpty(CleavageN))
            {
                if (!string.IsNullOrEmpty(RestrictN))
                {
                    throw new InvalidDataException(Resources.Enzyme_Validate_Enzyme_must_have_N_terminal_cleavage_to_have_N_terminal_restrictions_);
                }
                CleavageN  = RestrictN = null;
                _cleavageN = null;
                _restrictN = null;
            }
            else
            {
                AminoAcid.ValidateAAList(CleavageN);
                if (!string.IsNullOrEmpty(RestrictN))
                {
                    AminoAcid.ValidateAAList(RestrictN);
                }

                _cleavageN   = CleavageN.ToCharArray();
                _restrictN   = RestrictN == null ? null : RestrictN.ToCharArray();
                cleavageAll += CleavageN;
            }
            _cleavageAll = cleavageAll.ToCharArray();
        }