示例#1
0
        private GeneticCode(string name, string aas, string start, IEquatable<string> base1, IEquatable<string> base2,
			IEquatable<string> base3)
        {
            if (!base1.Equals(b1)){
                throw new Exception("Wrong codons.");
            }
            if (!base2.Equals(b2)){
                throw new Exception("Wrong codons.");
            }
            if (!base3.Equals(b3)){
                throw new Exception("Wrong codons.");
            }
            this.name = name;
            this.start = start;
            for (int i = 0; i < b1.Length; i++){
                string codon = "" + b1[i] + b2[i] + b3[i];
                codon2Aa.Add(codon, aas[i]);
                if (codon.Contains("T")){
                    string c2 = codon.Replace('T', 'U');
                    codon2Aa.Add(c2, aas[i]);
                }
            }
        }
		public void TargetWithGenerics(IEquatable<int> a, string c) { }
示例#3
0
        public override bool Equals(object other)
        {
            IEquatable <Binding> equatable = this;

            return(equatable.Equals(other as Binding));
        }
示例#4
0
        private void ProductManagement(IEquatable<string> operationRequest)
        {
            try
            {
                if ((dgvProduct.CurrentRow == null) && (!operationRequest.Equals(Resources.OperationRequestInsert)))
                    return;

                using (var frmCatalog = new FrmCatalog())
                {
                    float preQtyInStock = 0;
                    if (_productList.Count != 0)
                        preQtyInStock = (_productList[dgvProduct.CurrentRow.Index]).QtyInStock;
                    if (operationRequest.Equals(Resources.OperationRequestUpdate))
                        frmCatalog.Product = _productList[dgvProduct.CurrentRow.Index];

                    if (frmCatalog.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            if (frmCatalog.Product == null)
                            {
                                IListToBindingList(
                                    _productService.GetCatalogs(chbInstockOnly.Checked));
                            }
                            else
                            {
                                if (operationRequest.Equals(Resources.OperationRequestUpdate))
                                {
                                    UpdateSelectedProduct(
                                        frmCatalog.Product,
                                        preQtyInStock);

                                    if (frmCatalog.Product.QtyInStock == 0)
                                    {
                                        for (var counter = 0; counter < _productList.Count; counter++)
                                        {
                                            if (_productList[counter].ProductId == frmCatalog.Product.ProductId)
                                                _productList.RemoveAt(counter);
                                        }
                                    }
                                }
                                else
                                {
                                    if (frmCatalog.Product.QtyInStock == 0)
                                        _productList.Add(frmCatalog.Product);
                                }
                            }
                            dgvProduct.Refresh();
                            SetProductInfo();

                            UpdateResultInfo();
                            EnableActionButton();
                        }
                        catch (Exception exception)
                        {
                            FrmExtendedMessageBox.UnknownErrorMessage(
                                Resources.MsgCaptionUnknownError,
                                exception.Message);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                FrmExtendedMessageBox.UnknownErrorMessage(
                    Resources.MsgCaptionUnknownError,
                    exception.Message);
            }
        }
示例#5
0
 private static DayOfWeek? GetDayOfWeek(IEquatable<string> dateString, IList<string> dayNames)
 {
     for (int i = 0; i < dayNames.Count; i++)
     {
         if (dateString.Equals(dayNames[i].ToLowerInvariant()))
         {
             return (DayOfWeek) (i % 7);
         }
     }
     return null;
 }
示例#6
0
        /// <summary>
        /// Add's an option to the x264 query string.
        /// Handles 2 cases.  1 Where rtf_x264Query.Text is empty, and one where there is an option with no value,
        /// e.g no-fast-pskip
        /// </summary>
        /// <param name="optNameToChange">The Option Name to Change</param>
        private void HasNoOptions(IEquatable<string> optNameToChange)
        {
            string colon = string.Empty;
            if (rtf_x264Query.Text != string.Empty)
                colon = ":";

            string query = rtf_x264Query.Text;
            if (optNameToChange.Equals("me"))
            {
                switch (drop_MotionEstimationMethod.SelectedIndex)
                {
                    case 1:
                        query = query + colon + "me=dia";
                        break;

                    case 2:
                        query = query + colon + "me=hex";
                        break;

                    case 3:
                        query = query + colon + "me=umh";
                        break;

                    case 4:
                        query = query + colon + "me=esa";
                        break;

                    case 5:
                        query = query + colon + "me=tesa";
                        break;

                    default:
                        break;
                }
            }
            else if (optNameToChange.Equals("direct"))
            {
                switch (drop_directPrediction.SelectedIndex)
                {
                    case 1:
                        query = query + colon + "direct=none";
                        break;

                    case 2:
                        query = query + colon + "direct=spatial";
                        break;

                    case 3:
                        query = query + colon + "direct=temporal";
                        break;

                    case 4:
                        query = query + colon + "direct=auto";
                        break;

                    default:
                        break;
                }
            }
            else if (optNameToChange.Equals("analyse"))
            {
                switch (drop_analysis.SelectedIndex)
                {
                    case 1:
                        query = query + colon + "analyse=none";
                        break;

                    case 2:
                        query = query + colon + "analyse=some";
                        break;

                    case 3:
                        query = query + colon + "analyse=all";
                        break;

                    default:
                        break;
                }
            }
            else if (optNameToChange.Equals("merange"))
            {
                int value = drop_MotionEstimationRange.SelectedIndex + 3;
                query = query + colon + "merange=" + value;
            }
            else if (optNameToChange.Equals("b-adapt"))
            {
                int value = drop_adaptBFrames.SelectedIndex - 1;
                query = query + colon + "b-adapt=" + value;
            }
            else if (optNameToChange.Equals("deblock"))
            {
                string da = drop_deblockAlpha.SelectedItem.ToString();
                string db = drop_deblockBeta.Text;

                if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))
                {
                    drop_deblockBeta.SelectedItem = "Default (0)";
                    drop_deblockAlpha.SelectedItem = "Default (0)";
                }
                else
                {
                    if (db.Contains("Default"))
                        db = "0";

                    if (da.Contains("Default"))
                        da = "0";

                    query = query + colon + "deblock=" + da + "," + db;
                }
            }
            else if (optNameToChange.Equals("aq-strength"))
            {
                if (slider_adaptiveQuantStrength.Value == 10)
                    query = string.Empty;
                else
                {
                    double value = slider_adaptiveQuantStrength.Value * 0.1;
                    string aqs = value.ToString("f1", culture);
                    query += colon + "aq-strength=" + aqs;
                }
            }
            else if (optNameToChange.Equals("psy-rd"))
            {
                if (slider_psyrd.Value == 10 && slider_psytrellis.Value == 0)
                    query += string.Empty;
                else
                {
                    double psyrd = slider_psyrd.Value * 0.1;
                    double psytre = slider_psytrellis.Value * 0.05;

                    string rd = psyrd.ToString("f1", culture);
                    string rt = psytre.ToString("f2", culture);

                    query += colon + "psy-rd=" + rd + "," + rt;
                }
            }
            else if (optNameToChange.Equals("b-pyramid"))
            {
                switch (combo_pyrmidalBFrames.SelectedIndex)
                {
                    case 0:
                        break;
                    case 1:
                        query = query + colon + "b-pyramid=none";
                        break;
                    case 2:
                        query = query + colon + "b-pyramid=strict";
                        break;
                }
            }
            else if (optNameToChange.Equals("no-dct-decimate"))
            {
                if (check_noDCTDecimate.CheckState == CheckState.Checked)
                    query = query + colon + "no-dct-decimate=1";
            }
            else if (optNameToChange.Equals("8x8dct"))
            {
                if (check_8x8DCT.CheckState == CheckState.Unchecked)
                    query = query + colon + "8x8dct=0";
            }
            else if (optNameToChange.Equals("cabac"))
            {
                if (check_Cabac.CheckState != CheckState.Checked)
                    query = query + colon + "cabac=0";
            }
            else if (optNameToChange.Equals("weightp"))
            {
                if (check_weightp.CheckState == CheckState.Unchecked)
                    query = query + colon + "weightp=0";
            }
            else if (optNameToChange.Equals("ref"))
            {
                if (!drop_refFrames.SelectedItem.ToString().Contains("Default"))
                    query = query + colon + "ref=" + drop_refFrames.SelectedItem;
            }
            else if (optNameToChange.Equals("bframes"))
            {
                string value = drop_bFrames.SelectedItem.ToString();
                if (!drop_bFrames.SelectedItem.ToString().Contains("Default"))
                    query = query + colon + "bframes=" + value;
            }
            else if (optNameToChange.Equals("subq"))
            {
                string value = drop_subpixelMotionEstimation.SelectedItem.ToString();
                if (!drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))
                {
                    string[] val = value.Split(':');
                    query = query + colon + "subq=" + val[0];
                }
            }
            else if (optNameToChange.Equals("trellis"))
            {
                switch (drop_trellis.SelectedIndex)
                {
                    case 1: // Off
                        query = query + colon + "trellis=0";
                        break;
                    case 2: // Encode Only
                        query = query + colon + "trellis=1";
                        break;
                    case 3: // Always
                        query = query + colon + "trellis=2";
                        break;
                    default:
                        break;
                }
            }

            rtf_x264Query.Text = query;
        }
示例#7
0
        private void CustomerManagement(IEquatable<string> operationRequest)
        {
            using (var frmCustomer = new FrmCustomer())
            {
                frmCustomer.CommonService = _commonService;
                frmCustomer.CustomerService = _customerService;

                if (operationRequest.Equals(Resources.OperationRequestUpdate))
                    if (dgvCustomer.CurrentRow != null)
                        frmCustomer.Customer = _customerList[dgvCustomer.CurrentRow.Index];

                if (frmCustomer.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        ThreadStart threadStart = UpdateControlContent;
                        var thread = new Thread(threadStart);
                        thread.Start();

                        if (operationRequest.Equals(Resources.OperationRequestInsert))
                            _customerList.Add(frmCustomer.Customer);

                        dgvCustomer.Refresh();
                        SetCustomerInfo();
                        UpdateResultInfo();
                        EnableActionButton();
                    }
                    catch (Exception exception)
                    {
                        FrmExtendedMessageBox.UnknownErrorMessage(
                            Resources.MsgCaptionUnknownError,
                            exception.Message);
                    }
                }
            }

            SetFocusToCustomerList();
        }
示例#8
0
 /// <summary>
 /// Checks if the specified object instance is equal to another instance
 /// </summary>
 /// <typeparam name="TObject">The type of the object.</typeparam>
 /// <param name="self">The object to check.</param>
 /// <param name="other">The other object to compare with.</param>
 /// <returns><c>True</c> if the object instances are equal</returns>
 public static bool EqualsTo <TObject>(this IEquatable <TObject> self, TObject other)
 {
     return(self.Equals(other));
 }
示例#9
0
 public EquatableSubject(string name) : base(name)
 {
     _inner = Substitute.For <IEquatable <EquatableSubject> >();
 }
示例#10
0
            public bool Equals(T x, T y)
            {
                Type type = typeof(T);

                // Null?
                if (!type.IsValueType || (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom(typeof(Nullable <>))))
                {
                    if (Object.Equals(x, default(T)))
                    {
                        return(Object.Equals(y, default(T)));
                    }

                    if (Object.Equals(y, default(T)))
                    {
                        return(false);
                    }
                }

                // Same type?
                if (!skipTypeCheck && x.GetType() != y.GetType())
                {
                    return(false);
                }

                // Implements IEquatable<T>?
                IEquatable <T> equatable = x as IEquatable <T>;

                if (equatable != null)
                {
                    return(equatable.Equals(y));
                }

                // Implements IComparable<T>?
                IComparable <T> comparable1 = x as IComparable <T>;

                if (comparable1 != null)
                {
                    return(comparable1.CompareTo(y) == 0);
                }

                // Implements IComparable?
                IComparable comparable2 = x as IComparable;

                if (comparable2 != null)
                {
                    return(comparable2.CompareTo(y) == 0);
                }

                // Enumerable?
                IEnumerable enumerableX = x as IEnumerable;
                IEnumerable enumerableY = y as IEnumerable;

                if (enumerableX != null && enumerableY != null)
                {
                    IEnumerator enumeratorX = enumerableX.GetEnumerator();
                    IEnumerator enumeratorY = enumerableY.GetEnumerator();

                    while (true)
                    {
                        bool hasNextX = enumeratorX.MoveNext();
                        bool hasNextY = enumeratorY.MoveNext();

                        if (!hasNextX || !hasNextY)
                        {
                            return(hasNextX == hasNextY);
                        }

                        if (!innerComparer.Equals(enumeratorX.Current, enumeratorY.Current))
                        {
                            return(false);
                        }
                    }
                }

                // Last case, rely on Object.Equals
                return(Object.Equals(x, y));
            }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="PropertySpecification"/> class.
 /// </summary>
 /// <param name="target">
 /// The criterion used to match the requested
 /// <see cref="PropertyInfo"/> with the specified value.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="target"/> is <see langword="null"/>.
 /// </exception>
 public PropertySpecification(IEquatable <PropertyInfo> target)
 {
     this.target = target ?? throw new ArgumentNullException(nameof(target));
 }
示例#12
0
 public static void Another <T>(IEquatable <T> objEquatable, T another)
 {
     Assert.IsNotNull(another);
     Assert.IsFalse(Object.ReferenceEquals(objEquatable, another));
     Assert.IsFalse(objEquatable.Equals(another));
 }
示例#13
0
 public static void Similar <T>(IEquatable <T> objEquatable, T similar)
 {
     Assert.IsNotNull(similar);
     Assert.IsFalse(Object.ReferenceEquals(objEquatable, similar));
     Assert.IsTrue(objEquatable.Equals(similar));
 }
示例#14
0
 private void StartElement(IEquatable <string> qName, IDictionary <string, string> attrs)
 {
     if (inFeature)
     {
         if (qName.Equals("location"))
         {
             //inFeatureLocation = true;
         }
         else if (qName.Equals("position"))
         {
             string position = attrs["position"];
             featureBegin = position;
             featureEnd   = position;
         }
         else if (qName.Equals("begin"))
         {
             string position = attrs.ContainsKey("position") ? attrs["position"] : attrs["status"];
             featureBegin = position;
         }
         else if (qName.Equals("end"))
         {
             string position = attrs.ContainsKey("position") ? attrs["position"] : attrs["status"];
             featureEnd = position;
         }
         else if (qName.Equals("original"))
         {
             original = new StringBuilder();
         }
         else if (qName.Equals("variation"))
         {
             variation = new StringBuilder();
         }
         else
         {
             throw new Exception("Unknown qname: " + qName);
         }
     }
     if (inOrganism)
     {
         if (qName.Equals("name"))
         {
             string type = attrs["type"];
             if (type.Equals("scientific"))
             {
                 oname = new StringBuilder();
             }
         }
         else if (qName.Equals("dbReference"))
         {
             string type = attrs["type"];
             if (type.Equals("NCBI Taxonomy"))
             {
                 string id = attrs["id"];
                 entry.AddTaxonomyId(id);
             }
         }
     }
     if (inOrganismHost)
     {
         if (qName.Equals("dbReference"))
         {
             string type = attrs["type"];
             if (type.Equals("NCBI Taxonomy"))
             {
                 string id = attrs["id"];
                 entry.AddHostTaxonomyId(id);
             }
         }
     }
     if (qName.Equals("entry"))
     {
         entry             = new UniprotEntry();
         accessions        = new List <string>();
         proteinFullNames  = new List <string>();
         proteinShortNames = new List <string>();
         proteinEcNumbers  = new List <string>();
         gnames            = new List <Tuple <string, string> >();
         onames            = new List <string>();
         unames            = new List <string>();
         level             = 0;
         numIsoforms       = 0;
         isoformToEnst     = new Dictionary <string, List <string> >();
     }
     else if (qName.Equals("dbReference"))
     {
         inDbRef         = true;
         dbReferenceType = attrs["type"];
         dbReferenceId   = attrs["id"];
         entry.AddDbEntry(dbReferenceType, dbReferenceId);
     }
     else if (qName.Equals("molecule") && dbReferenceType.Equals("Ensembl"))
     {
         molecule = new StringBuilder();
     }
     else if (qName.Equals("property"))
     {
         if (inDbRef)
         {
             entry.AddDbEntryProperty(dbReferenceType, dbReferenceId, attrs["type"], attrs["value"]);
         }
     }
     else if (qName.Equals("feature"))
     {
         inFeature          = true;
         featureType        = attrs.ContainsKey("type") ? attrs["type"] : "";
         featureDescription = attrs.ContainsKey("description") ? attrs["description"] : "";
         featureStatus      = attrs.ContainsKey("status") ? attrs["status"] : "";
         featureId          = attrs.ContainsKey("id") ? attrs["id"] : "";
         entry.AddFeature(featureType, featureDescription, featureStatus, featureId);
     }
     else if (qName.Equals("sequence"))
     {
         sequence = new StringBuilder();
     }
     else if (qName.Equals("keyword"))
     {
         keyword = new StringBuilder();
     }
     else if (qName.Equals("accession"))
     {
         accession = new StringBuilder();
     }
     else if (qName.Equals("protein"))
     {
         inProtein = true;
     }
     else if (qName.Equals("recommendedName") && inProtein)
     {
         inProteinRecommendedName = true;
     }
     else if (qName.Equals("organism"))
     {
         inOrganism = true;
     }
     else if (qName.Equals("organismHost"))
     {
         inOrganismHost = true;
     }
     else if (qName.Equals("gene"))
     {
         inGene = true;
     }
     else if (qName.Equals("fullName") && inProteinRecommendedName)
     {
         proteinFullName = new StringBuilder();
     }
     else if (qName.Equals("shortName") && inProteinRecommendedName)
     {
         proteinShortName = new StringBuilder();
     }
     else if (qName.Equals("ecNumber") && inProteinRecommendedName)
     {
         proteinEcNumber = new StringBuilder();
     }
     else if (qName.Equals("name") && inGene)
     {
         gname     = new StringBuilder();
         gnameType = attrs["type"];
     }
     else if (qName.Equals("name") && level == 1)
     {
         uname = new StringBuilder();
     }
     else if (qName.Equals("isoform"))
     {
         if (inDbRef)
         {
             ++numIsoforms;
         }
     }
 }
示例#15
0
 static void M4 <T, U> (T t, IEquatable <U> u) where T : IEquatable <U>
 {
 }
示例#16
0
 public void MyMethod_12 <T>(IEquatable <T> foo)
 {
 }
 public int Offset(IEquatable <T> bad, int k) => delta1.GetValueOrDefault(bad, -1);
示例#18
0
        private void UserManagement(IEquatable<string> operationRequest)
        {
            using (var frmUser = new FrmUser())
            {
                if (operationRequest.Equals(Resources.OperationRequestUpdate))
                    if (dgvUser.CurrentRow != null) frmUser.User = _UserList[dgvUser.CurrentRow.Index];

                if (frmUser.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        if ((operationRequest.Equals(Resources.OperationRequestInsert)))
                            _UserList.Add(frmUser.User);
                        dgvUser.Refresh();
                        UpdateResultInfo();
                        EnableActionButton();
                    }
                    catch (Exception exception)
                    {
                        FrmExtendedMessageBox.UnknownErrorMessage(
                            Resources.MsgCaptionUnknownError,
                            exception.Message);
                    }
                }
            }
        }
示例#19
0
 public static MatchAny <T> ThatMatches <TOther>(IEquatable <TOther> match)
     where TOther : T
 {
     return(new MatchAny <T>(x => x is TOther && match.Equals((TOther)x), match));
 }
示例#20
0
 private void StartElement(IEquatable<string> qName, IDictionary<string, string> attrs)
 {
     if (inFeature){
         if (qName.Equals("location")){
             //inFeatureLocation = true;
         } else if (qName.Equals("position")){
             string position = attrs["position"];
             featureBegin = position;
             featureEnd = position;
         } else if (qName.Equals("begin")){
             string position = attrs.ContainsKey("position") ? attrs["position"] : attrs["status"];
             featureBegin = position;
         } else if (qName.Equals("end")){
             string position = attrs.ContainsKey("position") ? attrs["position"] : attrs["status"];
             featureEnd = position;
         } else if (qName.Equals("original")){
             original = new StringBuilder();
         } else if (qName.Equals("variation")){
             variation = new StringBuilder();
         }else{
             throw new Exception("Unknown qname: " + qName);
         }
     }
     if (inOrganism) {
         if (qName.Equals("name")) {
             string type = attrs["type"];
             if (type.Equals("scientific")) {
                 oname = new StringBuilder();
             }
         } else if (qName.Equals("dbReference")) {
             string type = attrs["type"];
             if (type.Equals("NCBI Taxonomy")) {
                 string id = attrs["id"];
                 entry.AddTaxonomyId(id);
             }
         }
     }
     if (inOrganismHost) {
         if (qName.Equals("dbReference")) {
             string type = attrs["type"];
             if (type.Equals("NCBI Taxonomy")) {
                 string id = attrs["id"];
                 entry.AddHostTaxonomyId(id);
             }
         }
     }
     if (qName.Equals("entry")) {
         entry = new UniprotEntry();
         accessions = new List<string>();
         proteinFullNames = new List<string>();
         proteinShortNames = new List<string>();
         proteinEcNumbers = new List<string>();
         gnames = new List<Tuple<string, string>>();
         onames = new List<string>();
         unames = new List<string>();
         level = 0;
         numIsoforms = 0;
         isoformToEnst = new Dictionary<string, List<string>>();
     } else if (qName.Equals("dbReference")){
         inDbRef = true;
         dbReferenceType = attrs["type"];
         dbReferenceId = attrs["id"];
         entry.AddDbEntry(dbReferenceType, dbReferenceId);
     } else if (qName.Equals("molecule") && dbReferenceType.Equals("Ensembl")){
         molecule = new StringBuilder();
     } else if (qName.Equals("property")){
         if (inDbRef){
             entry.AddDbEntryProperty(dbReferenceType, dbReferenceId, attrs["type"], attrs["value"]);
         }
     } else if (qName.Equals("feature")){
         inFeature = true;
         featureType = attrs.ContainsKey("type") ? attrs["type"] : "";
         featureDescription = attrs.ContainsKey("description") ? attrs["description"] : "";
         featureStatus = attrs.ContainsKey("status") ? attrs["status"] : "";
         featureId = attrs.ContainsKey("id") ? attrs["id"] : "";
         entry.AddFeature(featureType, featureDescription, featureStatus, featureId);
     } else if (qName.Equals("sequence")) {
         sequence = new StringBuilder();
     } else if (qName.Equals("keyword")) {
         keyword = new StringBuilder();
     } else if (qName.Equals("accession")) {
         accession = new StringBuilder();
     } else if (qName.Equals("protein")){
         inProtein = true;
     } else if (qName.Equals("recommendedName") && inProtein){
         inProteinRecommendedName = true;
     } else if (qName.Equals("organism")) {
         inOrganism = true;
     } else if (qName.Equals("organismHost")) {
         inOrganismHost = true;
     } else if (qName.Equals("gene")) {
         inGene = true;
     } else if (qName.Equals("fullName") && inProteinRecommendedName){
         proteinFullName = new StringBuilder();
     } else if (qName.Equals("shortName") && inProteinRecommendedName){
         proteinShortName = new StringBuilder();
     } else if (qName.Equals("ecNumber") && inProteinRecommendedName){
         proteinEcNumber = new StringBuilder();
     } else if (qName.Equals("name") && inGene){
         gname = new StringBuilder();
         gnameType = attrs["type"];
     } else if (qName.Equals("name") && level == 1){
         uname = new StringBuilder();
     } else if (qName.Equals("isoform")){
         if (inDbRef)
             ++numIsoforms;
     }
 }
示例#21
0
 static public bool NullableEquals <T>(this IEquatable <T> value, IEquatable <T> other)
 {
     return(value?.Equals(other) ?? other == null);
 }
示例#22
0
        /// <summary>
        /// Maintains a list of already processed assemblies.
        /// </summary>
        /// <param name="assemblyName"></param>
        /// <returns></returns>
        private bool AlreadyProcessed(IEquatable<string> assemblyName)
        {
            foreach (string processedAssembly in processedAssemblies)
            {
                if (assemblyName.Equals(processedAssembly))
                {
                    return true;
                }
            }

            return false;
        }
 private static IRejectedExecutionHandler CreateRejectedExecutionHandler(IEquatable<string> policyName)
 {
     if(policyName.Equals("ABORT")) {
         return new AbortPolicy();
     }
     if(policyName.Equals("DISCARD")) {
         return new DiscardPolicy();
     }
     if(policyName.Equals("DISCARD_OLDEST")) {
         return new DiscardOldestPolicy();
     }
     return new CallerRunsPolicy();
 }
示例#24
0
		private static void AssertNodeName(XmlNode node, IEquatable<string> expectedName)
		{
			if (expectedName.Equals(node.Name))
				return;
			
			String message = String.Format("Unexpected node under '{0}': Expected '{1}' but found '{2}'",
										   expectedName, expectedName, node.Name);

			throw new Exception(message);
		}
示例#25
0
 /// <summary>
 /// Set expectations for an <see cref="IEquatable&lt;T&gt;"/>.
 /// </summary>
 public static EquatableMatcher <T> The <T>(IEquatable <T> actual)
 {
     return(Expectations.Wrap <IEquatable <T>, EquatableMatcher <T> >(actual));
 }
示例#26
0
        static T[] _HRemoveAll <T>(this IList <T> values, T toremove)
        {
            if (_HRemoveAll_selftest)
            {
                _HRemoveAll_selftest = false;
                object   objx  = "ab--c".Replace("-", "");
                object[] tlst0 = new object[] { null, 1, 2, null, 3, 4, null, 1, objx, 3, null, "abc" };
                object[] tlst1 = tlst0._HRemoveAll(null);
                HDebug.Assert(tlst1.Length == 8);
                HDebug.Assert((int   )(tlst1[0]) == 1);
                HDebug.Assert((int   )(tlst1[1]) == 2);
                HDebug.Assert((int   )(tlst1[2]) == 3);
                HDebug.Assert((int   )(tlst1[3]) == 4);
                HDebug.Assert((int   )(tlst1[4]) == 1);
                HDebug.Assert((string)(tlst1[5]) == "abc");
                HDebug.Assert(tlst1[5] == objx);
                HDebug.Assert((int   )(tlst1[6]) == 3);
                HDebug.Assert((string)(tlst1[7]) == "abc");
                HDebug.Assert(tlst1[7] != objx);

                object[] tlst2 = tlst1._HRemoveAll(objx);
                HDebug.Assert(tlst2.Length == 7);
                HDebug.Assert((int   )(tlst2[0]) == 1);
                HDebug.Assert((int   )(tlst2[1]) == 2);
                HDebug.Assert((int   )(tlst2[2]) == 3);
                HDebug.Assert((int   )(tlst2[3]) == 4);
                HDebug.Assert((int   )(tlst2[4]) == 1);
                HDebug.Assert((int   )(tlst2[5]) == 3);
                HDebug.Assert((string)(tlst2[6]) == "abc");
                HDebug.Assert(tlst2[6] != objx);

                int[] tlst3 = (new int[] { 1, 2, 3, 4, 1, 3 })._HRemoveAll(1);
                HDebug.Assert(tlst3.Length == 4);
                HDebug.Assert((int)(tlst3[0]) == 2);
                HDebug.Assert((int)(tlst3[1]) == 3);
                HDebug.Assert((int)(tlst3[2]) == 4);
                HDebug.Assert((int)(tlst3[3]) == 3);
            }

            Predicate <T> match;

            if (toremove == null)
            {
                match = delegate(T val) { return(val == null); };
            }
            else if (toremove is IEquatable <T> )
            {
                IEquatable <T> eqt = toremove as IEquatable <T>;
                match = delegate(T val) { return(eqt.Equals(val)); };
            }
            else if (typeof(T) == typeof(object))
            {
                match = delegate(T val) { return(object.ReferenceEquals(toremove, val)); };
            }
            else
            {
                throw new Exception();
            }

            List <T> _values = new List <T>(values);

            _values.RemoveAll(match);
            return(_values.ToArray());
        }
示例#27
0
 private GeneticCode(string name, string aas, string start, IEquatable <string> base1, IEquatable <string> base2,
                     IEquatable <string> base3)
 {
     if (!base1.Equals(b1))
     {
         throw new Exception("Wrong codons.");
     }
     if (!base2.Equals(b2))
     {
         throw new Exception("Wrong codons.");
     }
     if (!base3.Equals(b3))
     {
         throw new Exception("Wrong codons.");
     }
     this.name  = name;
     this.start = start;
     for (int i = 0; i < b1.Length; i++)
     {
         string codon = "" + b1[i] + b2[i] + b3[i];
         codon2Aa.Add(codon, aas[i]);
         if (codon.Contains("T"))
         {
             string c2 = codon.Replace('T', 'U');
             codon2Aa.Add(c2, aas[i]);
         }
     }
 }
        bool Equals <T>(object x, object y) where T : IEquatable <T>
        {
            IEquatable <T> yEquatable = (IEquatable <T>)y;

            return(yEquatable.Equals((T)x));
        }
示例#29
0
        public override bool Equals(object other)
        {
            IEquatable <Wait <C, T> > wait = this;

            return(wait.Equals(other as Wait <C, T>));
        }
示例#30
0
        /// <summary>
        /// Add's an option to the x264 query string.
        /// Handles 2 cases.  1 Where rtf_x264Query.Text is empty, and one where there is an option with no value,
        /// e.g no-fast-pskip
        /// </summary>
        /// <param name="optNameToChange">The Option Name to Change</param>
        private void HasNoOptions(IEquatable <string> optNameToChange)
        {
            string colon = string.Empty;

            if (rtf_x264Query.Text != string.Empty)
            {
                colon = ":";
            }

            string query = rtf_x264Query.Text;

            if (optNameToChange.Equals("me"))
            {
                switch (drop_MotionEstimationMethod.SelectedIndex)
                {
                case 1:
                    query = query + colon + "me=dia";
                    break;

                case 2:
                    query = query + colon + "me=hex";
                    break;

                case 3:
                    query = query + colon + "me=umh";
                    break;

                case 4:
                    query = query + colon + "me=esa";
                    break;

                case 5:
                    query = query + colon + "me=tesa";
                    break;

                default:
                    break;
                }
            }
            else if (optNameToChange.Equals("direct"))
            {
                switch (drop_directPrediction.SelectedIndex)
                {
                case 1:
                    query = query + colon + "direct=none";
                    break;

                case 2:
                    query = query + colon + "direct=spatial";
                    break;

                case 3:
                    query = query + colon + "direct=temporal";
                    break;

                case 4:
                    query = query + colon + "direct=auto";
                    break;

                default:
                    break;
                }
            }
            else if (optNameToChange.Equals("analyse"))
            {
                switch (drop_analysis.SelectedIndex)
                {
                case 1:
                    query = query + colon + "analyse=none";
                    break;

                case 2:
                    query = query + colon + "analyse=i4x4,i8x8";
                    break;

                case 3:
                    query = query + colon + "analyse=all";
                    break;

                default:
                    break;
                }
            }
            else if (optNameToChange.Equals("merange"))
            {
                int value = drop_MotionEstimationRange.SelectedIndex + 3;
                query = query + colon + "merange=" + value;
            }
            else if (optNameToChange.Equals("b-adapt"))
            {
                int value = drop_adaptBFrames.SelectedIndex - 1;
                query = query + colon + "b-adapt=" + value;
            }
            else if (optNameToChange.Equals("deblock"))
            {
                string da = drop_deblockAlpha.SelectedItem.ToString();
                string db = drop_deblockBeta.Text;

                if (((da.Contains("Default")) && (db.Contains("Default"))) || ((da.Contains("0")) && (db.Contains("0"))))
                {
                    drop_deblockBeta.SelectedItem  = "Default (0)";
                    drop_deblockAlpha.SelectedItem = "Default (0)";
                }
                else
                {
                    if (db.Contains("Default"))
                    {
                        db = "0";
                    }

                    if (da.Contains("Default"))
                    {
                        da = "0";
                    }

                    query = query + colon + "deblock=" + da + "," + db;
                }
            }
            else if (optNameToChange.Equals("aq-strength"))
            {
                if (slider_adaptiveQuantStrength.Value == 10)
                {
                    query = string.Empty;
                }
                else
                {
                    double value = slider_adaptiveQuantStrength.Value * 0.1;
                    string aqs   = value.ToString("f1", CultureInfo.InvariantCulture);
                    query += colon + "aq-strength=" + aqs;
                }
            }
            else if (optNameToChange.Equals("psy-rd"))
            {
                if (slider_psyrd.Value == 10 && slider_psytrellis.Value == 0)
                {
                    query += string.Empty;
                }
                else
                {
                    double psyrd  = slider_psyrd.Value * 0.1;
                    double psytre = slider_psytrellis.Value * 0.05;

                    string rd = psyrd.ToString("f1", CultureInfo.InvariantCulture);
                    string rt = psytre.ToString("f2", CultureInfo.InvariantCulture);

                    query += colon + "psy-rd=" + rd + "," + rt;
                }
            }
            else if (optNameToChange.Equals("b-pyramid"))
            {
                switch (combo_pyrmidalBFrames.SelectedIndex)
                {
                case 0:
                    break;

                case 1:
                    query = query + colon + "b-pyramid=none";
                    break;

                case 2:
                    query = query + colon + "b-pyramid=strict";
                    break;
                }
            }
            else if (optNameToChange.Equals("no-dct-decimate"))
            {
                if (check_noDCTDecimate.CheckState == CheckState.Checked)
                {
                    query = query + colon + "no-dct-decimate=1";
                }
            }
            else if (optNameToChange.Equals("8x8dct"))
            {
                if (check_8x8DCT.CheckState == CheckState.Unchecked)
                {
                    query = query + colon + "8x8dct=0";
                }
            }
            else if (optNameToChange.Equals("cabac"))
            {
                if (check_Cabac.CheckState != CheckState.Checked)
                {
                    query = query + colon + "cabac=0";
                }
            }
            else if (optNameToChange.Equals("weightp"))
            {
                if (check_weightp.CheckState == CheckState.Unchecked)
                {
                    query = query + colon + "weightp=0";
                }
            }
            else if (optNameToChange.Equals("ref"))
            {
                if (!drop_refFrames.SelectedItem.ToString().Contains("Default"))
                {
                    query = query + colon + "ref=" + drop_refFrames.SelectedItem;
                }
            }
            else if (optNameToChange.Equals("bframes"))
            {
                string value = drop_bFrames.SelectedItem.ToString();
                if (!drop_bFrames.SelectedItem.ToString().Contains("Default"))
                {
                    query = query + colon + "bframes=" + value;
                }
            }
            else if (optNameToChange.Equals("subq"))
            {
                string value = drop_subpixelMotionEstimation.SelectedItem.ToString();
                if (!drop_subpixelMotionEstimation.SelectedItem.ToString().Contains("Default"))
                {
                    string[] val = value.Split(':');
                    query = query + colon + "subq=" + val[0];
                }
            }
            else if (optNameToChange.Equals("trellis"))
            {
                switch (drop_trellis.SelectedIndex)
                {
                case 1:     // Off
                    query = query + colon + "trellis=0";
                    break;

                case 2:     // Encode Only
                    query = query + colon + "trellis=1";
                    break;

                case 3:     // Always
                    query = query + colon + "trellis=2";
                    break;

                default:
                    break;
                }
            }

            rtf_x264Query.Text = query;
        }
示例#31
0
 internal static bool SafeEquals <T>(this IEquatable <T> left, IEquatable <T> right)
 {
     return(left?.Equals(right) ?? false);
 }
示例#32
0
 private void EndElement(IEquatable <string> qName, HandleUniprotEntry handle, bool isTrembl)
 {
     if (qName.Equals("sequence"))
     {
         entry.Sequence = StringUtils.RemoveWhitespace(sequence.ToString());
         sequence       = null;
     }
     else if (qName.Equals("keyword"))
     {
         entry.AddKeyword(StringUtils.RemoveWhitespace(keyword.ToString()));
         keyword = null;
     }
     else if (qName.Equals("molecule") && dbReferenceType.Equals("Ensembl"))
     {
         string mol = molecule.ToString().Trim();
         entry.AddDbEntryProperty(dbReferenceType, dbReferenceId, "isoform ID", mol);
         if (!isoformToEnst.ContainsKey(mol))
         {
             isoformToEnst.Add(mol, new List <string>());
         }
         isoformToEnst[mol].Add(dbReferenceId);
         molecule = null;
     }
     else if (qName.Equals("entry"))
     {
         entry.Accessions        = accessions.ToArray();
         entry.ProteinFullNames  = proteinFullNames.ToArray();
         entry.ProteinShortNames = proteinShortNames.ToArray();
         entry.ProteinEcNumbers  = proteinEcNumbers.ToArray();
         entry.GeneNamesAndTypes = gnames.ToArray();
         entry.OrganismNames     = onames.ToArray();
         entry.UniprotNames      = unames.ToArray();
         entry.IsTrembl          = isTrembl;
         if (resolveIsoforms)
         {
             if (numIsoforms > 1 && isoformToEnst.Count > 1)
             {
                 List <UniprotEntry> isoEntries = entry.ResolveIsoforms(isoformToEnst);
                 foreach (UniprotEntry e in isoEntries)
                 {
                     handle(e);
                 }
             }
             else
             {
                 handle(entry);
             }
         }
         else
         {
             handle(entry);
         }
     }
     else if (qName.Equals("dbReference"))
     {
         inDbRef = false;
     }
     else if (qName.Equals("accession"))
     {
         accessions.Add(StringUtils.RemoveWhitespace(accession.ToString()));
         accession = null;
     }
     else if (qName.Equals("location"))
     {
         if (inFeature)
         {
             //inFeatureLocation = false;
             entry.AddFeatureLocation(featureBegin, featureEnd);
         }
     }
     else if (qName.Equals("variation"))
     {
         if (inFeature)
         {
             entry.AddFeatureVariation(StringUtils.RemoveWhitespace(variation.ToString()));
             variation = null;
         }
     }
     else if (qName.Equals("original"))
     {
         if (inFeature)
         {
             entry.AddFeatureOriginal(StringUtils.RemoveWhitespace(original.ToString()));
             original = null;
         }
     }
     else if (qName.Equals("feature"))
     {
         inFeature = false;
         foreach (FeatureType type in entry.GetAllFeatureTypes())
         {
             int c = entry.GetFeatureCount(type);
             if (!featureCounts.ContainsKey(type))
             {
                 featureCounts.Add(type, 0);
             }
             featureCounts[type] += c;
         }
     }
     else if (qName.Equals("fullName") && inProteinRecommendedName)
     {
         proteinFullNames.Add(proteinFullName.ToString().Trim());
         proteinFullName = null;
     }
     else if (qName.Equals("shortName") && inProteinRecommendedName)
     {
         proteinShortNames.Add(proteinShortName.ToString().Trim());
         proteinShortName = null;
     }
     else if (qName.Equals("ecNumber") && inProteinRecommendedName)
     {
         proteinEcNumbers.Add(proteinEcNumber.ToString().Trim());
         proteinEcNumber = null;
     }
     else if (qName.Equals("name") && inGene)
     {
         gnames.Add(new Tuple <string, string>(gname.ToString().Trim(), gnameType.Trim()));
         gname     = null;
         gnameType = null;
     }
     else if (qName.Equals("name") && inOrganism)
     {
         string on = oname?.ToString().Trim();
         if (@on?.Length > 0)
         {
             onames.Add(@on);
             oname = null;
         }
     }
     else if (qName.Equals("name") && level == 1)
     {
         unames.Add(uname.ToString().Trim());
         uname = null;
     }
     else if (qName.Equals("protein"))
     {
         inProtein = false;
     }
     else if (qName.Equals("recommendedName") && inProtein)
     {
         inProteinRecommendedName = false;
     }
     else if (qName.Equals("gene"))
     {
         inGene = false;
     }
     else if (qName.Equals("organism"))
     {
         inOrganism = false;
     }
     else if (qName.Equals("organismHost"))
     {
         inOrganismHost = false;
     }
 }
示例#33
0
        public static void TestEquals()
        {
            var jsonNumber = new JsonNumber(123);

            Assert.True(jsonNumber.Equals(new JsonNumber(123)));
            Assert.True(new JsonNumber(123).Equals(jsonNumber));

            Assert.True(jsonNumber.Equals(new JsonNumber((ushort)123)));
            Assert.True(new JsonNumber((ushort)123).Equals(jsonNumber));

            Assert.True(jsonNumber.Equals(new JsonNumber("123")));
            Assert.True(new JsonNumber("123").Equals(jsonNumber));

            Assert.False(jsonNumber.Equals(new JsonNumber("123e0")));
            Assert.False(new JsonNumber("123e0").Equals(jsonNumber));

            Assert.False(jsonNumber.Equals(new JsonNumber("123e1")));
            Assert.False(new JsonNumber("123e1").Equals(jsonNumber));

            Assert.False(jsonNumber.Equals(new JsonNumber(17)));
            Assert.False(new JsonNumber(17).Equals(jsonNumber));

            Assert.True(jsonNumber == new JsonNumber(123));
            Assert.True(jsonNumber != new JsonNumber(17));

            JsonNode jsonNode = new JsonNumber(123);

            Assert.True(jsonNumber.Equals(jsonNode));

            IEquatable <JsonNumber> jsonNumberIEquatable = jsonNumber;

            Assert.True(jsonNumberIEquatable.Equals(jsonNumber));
            Assert.True(jsonNumber.Equals(jsonNumberIEquatable));

            Assert.False(jsonNumber.Equals(null));

            object jsonNumberCopy   = jsonNumber;
            object jsonNumberObject = new JsonNumber(123);

            Assert.True(jsonNumber.Equals(jsonNumberObject));
            Assert.True(jsonNumberCopy.Equals(jsonNumberObject));
            Assert.True(jsonNumberObject.Equals(jsonNumber));

            jsonNumber = new JsonNumber();
            Assert.True(jsonNumber.Equals(new JsonNumber()));
            Assert.False(jsonNumber.Equals(new JsonNumber(5)));

            Assert.False(jsonNumber.Equals(new Exception()));

            JsonNumber jsonNumberNull = null;

            Assert.False(jsonNumber == jsonNumberNull);
            Assert.False(jsonNumberNull == jsonNumber);

            Assert.True(jsonNumber != jsonNumberNull);
            Assert.True(jsonNumberNull != jsonNumber);

            JsonNumber otherJsonNumberNull = null;

            Assert.True(jsonNumberNull == otherJsonNumberNull);
        }
示例#34
0
 public static IEquatable<Point> CalculateAcceleration(IEquatable<Point> data)
 {
     return null;
 }
示例#35
0
文件: Events.cs 项目: jesumarquez/lt
 private Empleado GetDriverForLogin(IMessage generico, LogUltimoLoginVo lastLogin, IEquatable <string> code)
 {
     return(code.Equals(MessageCode.RfidDriverLogout.GetMessageCode()) && lastLogin != null && lastLogin.IdChofer > 0
                        ? DaoFactory.EmpleadoDAO.FindById(lastLogin.IdChofer)
                        : GetChoferForLogin(generico.GetRiderId()));
 }
示例#36
0
 private void EndElement(IEquatable<string> qName, HandleUniprotEntry handle, bool isTrembl)
 {
     if (qName.Equals("sequence")){
         entry.Sequence = StringUtils.RemoveWhitespace(sequence.ToString());
         sequence = null;
     } else if (qName.Equals("keyword")) {
         entry.AddKeyword(StringUtils.RemoveWhitespace(keyword.ToString()));
         keyword = null;
     } else if (qName.Equals("entry")) {
         entry.Accessions = accessions.ToArray();
         entry.ProteinFullNames = proteinFullNames.ToArray();
         entry.ProteinShortNames = proteinShortNames.ToArray();
         entry.ProteinEcNumbers = proteinEcNumbers.ToArray();
         entry.GeneNamesAndTypes = gnames.ToArray();
         entry.OrganismNames = onames.ToArray();
         entry.UniprotNames = unames.ToArray();
         entry.IsTrembl = isTrembl;
         handle(entry);
         entryCount++;
     } else if (qName.Equals("dbReference")){
         inDbRef = false;
     } else if (qName.Equals("accession")){
         accessions.Add(StringUtils.RemoveWhitespace(accession.ToString()));
         accession = null;
     } else if (qName.Equals("location")){
         if (inFeature){
             inFeatureLocation = false;
             entry.AddFeatureLocation(featureBegin, featureEnd);
         }
     } else if (qName.Equals("variation")){
         if (inFeature){
             entry.AddFeatureVariation(StringUtils.RemoveWhitespace(variation.ToString()));
             variation = null;
         }
     } else if (qName.Equals("original")){
         if (inFeature){
             entry.AddFeatureOriginal(StringUtils.RemoveWhitespace(original.ToString()));
             original = null;
         }
     } else if (qName.Equals("feature")){
         inFeature = false;
         foreach (FeatureType type in entry.GetAllFeatureTypes()){
             int c = entry.GetFeatureCount(type);
             if (!featureCounts.ContainsKey(type)){
                 featureCounts.Add(type, 0);
             }
             featureCounts[type] += c;
         }
     } else if (qName.Equals("fullName") && inProteinRecommendedName){
         proteinFullNames.Add(proteinFullName.ToString().Trim());
         proteinFullName = null;
     } else if (qName.Equals("shortName") && inProteinRecommendedName){
         proteinShortNames.Add(proteinShortName.ToString().Trim());
         proteinShortName = null;
     } else if (qName.Equals("ecNumber") && inProteinRecommendedName){
         proteinEcNumbers.Add(proteinEcNumber.ToString().Trim());
         proteinEcNumber = null;
     } else if (qName.Equals("name") && inGene){
         gnames.Add(new Tuple<string, string>(gname.ToString().Trim(), gnameType.Trim()));
         gname = null;
         gnameType = null;
     } else if (qName.Equals("name") && inOrganism){
         if (oname != null){
             string on = oname.ToString().Trim();
             if (on.Length > 0){
                 onames.Add(on);
                 oname = null;
             }
         }
     } else if (qName.Equals("name") && level == 1){
         unames.Add(uname.ToString().Trim());
         uname = null;
     } else if (qName.Equals("protein")){
         inProtein = false;
     } else if (qName.Equals("recommendedName") && inProtein){
         inProteinRecommendedName = false;
     } else if (qName.Equals("gene")){
         inGene = false;
     } else if (qName.Equals("organism")) {
         inOrganism = false;
     } else if (qName.Equals("organismHost")) {
         inOrganismHost = false;
     }
 }
示例#37
0
 public void Add(IEquatable <T> element)
 {
     _expected.Add(element);
 }
示例#38
0
 private void Remove(IEquatable<Filter> filter)
 {
     foreach (ListViewItem item in listView.Items)
     {
         if (filter.Equals(item.Tag as Filter))
         {
             item.Remove();
             return;
         }
     }
 }
示例#39
0
 private bool Matches(IEquatable <T> expected, T actual) =>
 expected == null ? actual == null : expected.Equals(actual);
示例#40
0
 private void EndElement(IEquatable<string> qName, HandleUniprotEntry handle, bool isTrembl)
 {
     if (qName.Equals("sequence")){
         entry.Sequence = StringUtils.RemoveWhitespace(sequence.ToString());
         sequence = null;
     } else if (qName.Equals("keyword")) {
         entry.AddKeyword(StringUtils.RemoveWhitespace(keyword.ToString()));
         keyword = null;
     } else if (qName.Equals("molecule") && dbReferenceType.Equals("Ensembl")){
         string mol = molecule.ToString().Trim();
         entry.AddDbEntryProperty(dbReferenceType, dbReferenceId, "isoform ID", mol);
         if (!isoformToEnst.ContainsKey(mol))
             isoformToEnst.Add(mol, new List<string>());
         isoformToEnst[mol].Add(dbReferenceId);
         molecule = null;
     } else if (qName.Equals("entry")){
         entry.Accessions = accessions.ToArray();
         entry.ProteinFullNames = proteinFullNames.ToArray();
         entry.ProteinShortNames = proteinShortNames.ToArray();
         entry.ProteinEcNumbers = proteinEcNumbers.ToArray();
         entry.GeneNamesAndTypes = gnames.ToArray();
         entry.OrganismNames = onames.ToArray();
         entry.UniprotNames = unames.ToArray();
         entry.IsTrembl = isTrembl;
         if (resolveIsoforms){
             if (numIsoforms > 1 && isoformToEnst.Count > 1){
                 List<UniprotEntry> isoEntries = entry.ResolveIsoforms(isoformToEnst);
                 foreach (UniprotEntry e in isoEntries){
                     handle(e);
                 }
             } else
                 handle(entry);
         } else
             handle(entry);
     } else if (qName.Equals("dbReference")){
         inDbRef = false;
     } else if (qName.Equals("accession")){
         accessions.Add(StringUtils.RemoveWhitespace(accession.ToString()));
         accession = null;
     } else if (qName.Equals("location")){
         if (inFeature){
             //inFeatureLocation = false;
             entry.AddFeatureLocation(featureBegin, featureEnd);
         }
     } else if (qName.Equals("variation")){
         if (inFeature){
             entry.AddFeatureVariation(StringUtils.RemoveWhitespace(variation.ToString()));
             variation = null;
         }
     } else if (qName.Equals("original")){
         if (inFeature){
             entry.AddFeatureOriginal(StringUtils.RemoveWhitespace(original.ToString()));
             original = null;
         }
     } else if (qName.Equals("feature")){
         inFeature = false;
         foreach (FeatureType type in entry.GetAllFeatureTypes()){
             int c = entry.GetFeatureCount(type);
             if (!featureCounts.ContainsKey(type)){
                 featureCounts.Add(type, 0);
             }
             featureCounts[type] += c;
         }
     } else if (qName.Equals("fullName") && inProteinRecommendedName){
         proteinFullNames.Add(proteinFullName.ToString().Trim());
         proteinFullName = null;
     } else if (qName.Equals("shortName") && inProteinRecommendedName){
         proteinShortNames.Add(proteinShortName.ToString().Trim());
         proteinShortName = null;
     } else if (qName.Equals("ecNumber") && inProteinRecommendedName){
         proteinEcNumbers.Add(proteinEcNumber.ToString().Trim());
         proteinEcNumber = null;
     } else if (qName.Equals("name") && inGene){
         gnames.Add(new Tuple<string, string>(gname.ToString().Trim(), gnameType.Trim()));
         gname = null;
         gnameType = null;
     } else if (qName.Equals("name") && inOrganism){
         string on = oname?.ToString().Trim();
         if (@on?.Length > 0){
             onames.Add(@on);
             oname = null;
         }
     } else if (qName.Equals("name") && level == 1){
         unames.Add(uname.ToString().Trim());
         uname = null;
     } else if (qName.Equals("protein")){
         inProtein = false;
     } else if (qName.Equals("recommendedName") && inProtein){
         inProteinRecommendedName = false;
     } else if (qName.Equals("gene")){
         inGene = false;
     } else if (qName.Equals("organism")) {
         inOrganism = false;
     } else if (qName.Equals("organismHost")) {
         inOrganismHost = false;
     }
 }
示例#41
0
 public EmployeeDataAccessProxy(PersonalityContext db, IEquatable <object> primaryKey)
 {
     this.db         = db;
     this.primaryKey = primaryKey;
 }
示例#42
0
 private static string PosInFocus(IEquatable<string> metricName)
 {
     var posOut = String.Empty;
     if (metricName.Equals("Tdp"))
         posOut = "QB";
     if (metricName.Equals("Tdr"))
         posOut = "RB";
     return posOut;
 }
示例#43
0
 private void EndElement(IEquatable <string> qName, HandleUniprotEntry handle, bool isTrembl)
 {
     if (qName.Equals("sequence"))
     {
         entry.Sequence = StringUtils.RemoveWhitespace(sequence.ToString());
         sequence       = null;
     }
     else if (qName.Equals("keyword"))
     {
         entry.AddKeyword(StringUtils.RemoveWhitespace(keyword.ToString()));
         keyword = null;
     }
     else if (qName.Equals("entry"))
     {
         entry.Accessions        = accessions.ToArray();
         entry.ProteinFullNames  = proteinFullNames.ToArray();
         entry.ProteinShortNames = proteinShortNames.ToArray();
         entry.ProteinEcNumbers  = proteinEcNumbers.ToArray();
         entry.GeneNamesAndTypes = gnames.ToArray();
         entry.OrganismNames     = onames.ToArray();
         entry.UniprotNames      = unames.ToArray();
         entry.IsTrembl          = isTrembl;
         handle(entry);
         entryCount++;
     }
     else if (qName.Equals("dbReference"))
     {
         inDbRef = false;
     }
     else if (qName.Equals("accession"))
     {
         accessions.Add(StringUtils.RemoveWhitespace(accession.ToString()));
         accession = null;
     }
     else if (qName.Equals("location"))
     {
         if (inFeature)
         {
             inFeatureLocation = false;
             entry.AddFeatureLocation(featureBegin, featureEnd);
         }
     }
     else if (qName.Equals("variation"))
     {
         if (inFeature)
         {
             entry.AddFeatureVariation(StringUtils.RemoveWhitespace(variation.ToString()));
             variation = null;
         }
     }
     else if (qName.Equals("original"))
     {
         if (inFeature)
         {
             entry.AddFeatureOriginal(StringUtils.RemoveWhitespace(original.ToString()));
             original = null;
         }
     }
     else if (qName.Equals("feature"))
     {
         inFeature = false;
         foreach (FeatureType type in entry.GetAllFeatureTypes())
         {
             int c = entry.GetFeatureCount(type);
             if (!featureCounts.ContainsKey(type))
             {
                 featureCounts.Add(type, 0);
             }
             featureCounts[type] += c;
         }
     }
     else if (qName.Equals("fullName") && inProteinRecommendedName)
     {
         proteinFullNames.Add(proteinFullName.ToString().Trim());
         proteinFullName = null;
     }
     else if (qName.Equals("shortName") && inProteinRecommendedName)
     {
         proteinShortNames.Add(proteinShortName.ToString().Trim());
         proteinShortName = null;
     }
     else if (qName.Equals("ecNumber") && inProteinRecommendedName)
     {
         proteinEcNumbers.Add(proteinEcNumber.ToString().Trim());
         proteinEcNumber = null;
     }
     else if (qName.Equals("name") && inGene)
     {
         gnames.Add(new Tuple <string, string>(gname.ToString().Trim(), gnameType.Trim()));
         gname     = null;
         gnameType = null;
     }
     else if (qName.Equals("name") && inOrganism)
     {
         if (oname != null)
         {
             string on = oname.ToString().Trim();
             if (on.Length > 0)
             {
                 onames.Add(on);
                 oname = null;
             }
         }
     }
     else if (qName.Equals("name") && level == 1)
     {
         unames.Add(uname.ToString().Trim());
         uname = null;
     }
     else if (qName.Equals("protein"))
     {
         inProtein = false;
     }
     else if (qName.Equals("recommendedName") && inProtein)
     {
         inProteinRecommendedName = false;
     }
     else if (qName.Equals("gene"))
     {
         inGene = false;
     }
     else if (qName.Equals("organism"))
     {
         inOrganism = false;
     }
     else if (qName.Equals("organismHost"))
     {
         inOrganismHost = false;
     }
 }
示例#44
0
 private void Remove(IEquatable<EtwProvider> provider)
 {
     foreach (ListViewItem item in listView.Items)
     {
         if (provider.Equals(item.Tag as EtwProvider))
         {
             item.Remove();
             return;
         }
     }
 }
示例#45
0
 static bool CompareInstances(IEquatable <T> instance, T comparand) => instance != null && instance.Equals(comparand);
示例#46
0
 private void Remove(IEquatable<QuickColorizer> colorizer)
 {
     foreach (ListViewItem item in listViewQuickColorizers.Items)
     {
         if (colorizer.Equals(item.Tag as QuickColorizer))
         {
             item.Remove();
             return;
         }
     }
 }
示例#47
0
 public static Predicate <T> Eq(IEquatable <T> k)
 => k.Equals;
示例#48
0
 private static DayOfWeek StringToDayOfWeek(IEquatable<string> dateString)
 {
     return GetDayOfWeek(dateString, allDayNames) ??
            DateTime.Now.DayOfWeek;
 }
示例#49
0
 public static string ToDateString(this IEquatable <DateTime> date, string formattedValue)
 {
     return(date.Equals(DateTime.MinValue) ? "Unknown" : formattedValue);
 }
示例#50
0
        private void Set(Config rc, string key, int currentValue, IEquatable<int> defaultValue)
		{
			if (defaultValue.Equals(currentValue))
			{
				Unset(rc, key);
			}
			else
			{
				rc.setInt(Section, Name, key, currentValue);
			}
		}
示例#51
0
 private void Remove(IEquatable<ColorSet> set)
 {
     foreach (ListViewItem item in listViewColorSets.Items)
     {
         if (set.Equals(item.Tag as ColorSet))
         {
             item.Remove();
             return;
         }
     }
 }