public int Compare(VariableDeclarationSyntax x, VariableDeclarationSyntax y) { string xTypeName = this.GetDataTypeName(x); string yTypeName = this.GetDataTypeName(y); //check type int xTypePriority = this.GetDataTypePriority(xTypeName); int yTypePriority = this.GetDataTypePriority(yTypeName); if (xTypePriority != yTypePriority) { return(xTypePriority - yTypePriority); } int value = _stringComparer.Compare(xTypeName, yTypeName); if (value != 0) { return(value); } string xName = x.GetNameStringValue().ToLower(); string yName = y.GetNameStringValue().ToLower(); return(_stringComparer.Compare(xName, yName)); }
public async Task <List <BusArrival> > LoadBusArrivals(ContentPage page, string busStopCode) { string url = string.Format("/busarrivals/get/{0}", busStopCode); JSONNode jsonNode = await NetworkManager.Instance.CreateGet(url); if (jsonNode[NetworkManager.ERROR_KEY] != null) { await page.DisplayAlert("Error", jsonNode[NetworkManager.MSG_KEY], "OK"); return(null); } else { List <BusArrival> busArrivals = new List <BusArrival>(); JSONArray busArrivalsJson = jsonNode["BusArrivals"] as JSONArray; foreach (JSONNode busArrivalJson in busArrivalsJson) { BusArrival busArrival = new BusArrival(busArrivalJson); busArrivals.Add(busArrival); } // sort this busArrivals.Sort((s1, s2) => { return(busArrivalComparator.Compare(s1.serviceNo, s2.serviceNo)); }); return(busArrivals); } }
public override int Compare(ServerEntry x, ServerEntry y) { var v = AlphanumComparatorFast.Compare(x.ActualName, y.ActualName); if (v != 0) { return(v); } return(AlphanumComparatorFast.Compare(x.Id, y.Id)); }
public int Compare(object x, object y) { if (!(x is ISelectionCollectionItemViewModel item1)) { return(0); } if (!(y is ISelectionCollectionItemViewModel item2)) { return(0); } AlphanumComparatorFast comp = new AlphanumComparatorFast(); return(comp.Compare(item1.DisplayText, item2.DisplayText)); }
public int Compare(object x, object y) { if (!(x is ITreeItem item1)) { return(0); } if (!(y is ITreeItem item2)) { return(0); } AlphanumComparatorFast comp = new AlphanumComparatorFast(); return(comp.Compare(item1.DisplayName, item2.DisplayName)); }
public int Compare(SyntaxNodeSortInfo <ReportDataItemElementSyntax> x, SyntaxNodeSortInfo <ReportDataItemElementSyntax> y) { if ((x.Kind == y.Kind) && (x.Kind == ConvertedSyntaxKind.ReportColumn)) { return(_stringComparer.Compare(x.Name, y.Name)); } if (x.Kind == ConvertedSyntaxKind.ReportColumn) { return(-1); } if (y.Kind == ConvertedSyntaxKind.ReportColumn) { return(1); } return(x.Index - y.Index); }
public int Compare(object x, object y) { var ix = x as GenericMod; var iy = y as GenericMod; if (ix == null) { return(iy == null ? 0 : 1); } if (iy == null) { return(-1); } if (ix.AppliedOrder != iy.AppliedOrder) { return(ix.AppliedOrder - iy.AppliedOrder); } return(AlphanumComparatorFast.Compare(ix.DisplayName, iy.DisplayName)); }
public int Compare(MethodSortInfo <T> x, MethodSortInfo <T> y) { //check type int xTypePriority = this.GetTypePriority(x.Kind); int yTypePriority = this.GetTypePriority(y.Kind); if (xTypePriority != yTypePriority) { return(xTypePriority - yTypePriority); } //for known types check name if (yTypePriority != UndefinedPriority) { int val = _stringComparer.Compare(x.Name, y.Name); if (val != 0) { return(val); } } //check old index return(x.Index - y.Index); }
public override int CompareTo(AcPlaceholderNew o) { var c = o as KunosCareerObject; return(c == null?base.CompareTo(o) : AlphanumComparatorFast.Compare(Id, c.Id)); }
int IComparer.Compare(object a, object b) { t1 = (Texture2D)a; t2 = (Texture2D)b; AlphanumComparatorFast comparer = new AlphanumComparatorFast(); return comparer.Compare(t1.name, t2.name); }
private static int Compare(string x, string y) { return(AlphanumComparatorFast.Compare(x, y)); }
protected override int Compare(string x, string y) { return(AlphanumComparatorFast.Compare(x, y)); }
private static void EnsureSame(string a, string b) { Assert.AreEqual(true, AlphanumComparatorFast.Compare(a, b) == 0); Assert.AreEqual(true, AlphanumComparatorFast.Compare(b, a) == 0); }
public static void RemoveDupes(DatDir tDat) { for (int g = 0; g < tDat.ChildCount; g++) { DatDir mGame = (DatDir)tDat.Child(g); if (mGame.DGame == null) { RemoveDupes(mGame); } else { bool found = true; while (found) { found = false; for (int r = 0; r < mGame.ChildCount; r++) { DatFile df0 = (DatFile)mGame.Child(r); for (int t = r + 1; t < mGame.ChildCount; t++) { DatFile df1 = (DatFile)mGame.Child(t); if (!ArrByte.bCompare(df0.CRC, df1.CRC)) { continue; } found = true; string name0 = df0.Name; string name1 = df1.Name; bool nS0 = name0.Contains("\\"); bool ns1 = name1.Contains("\\"); if (nS0 && !ns1) { mGame.ChildRemove(df0); } else if (!nS0 && ns1) { mGame.ChildRemove(df1); } else if (nS0 && ns1) { string s0 = name0.Substring(0, name0.IndexOf("\\", StringComparison.Ordinal)); string s1 = name1.Substring(0, name1.IndexOf("\\", StringComparison.Ordinal)); if (s0 != s1) { mGame.ChildRemove(df1); } else { int res = AlphanumComparatorFast.Compare(name0, name1); mGame.ChildRemove(res >= 0 ? df0 : df1); } } else if (name0 == name1) { mGame.ChildRemove(df1); } else { found = false; continue; } r = mGame.ChildCount; t = mGame.ChildCount; } } } } } }
int IComparer.Compare(object x, object y) { return(AlphanumComparatorFast.Compare((x as AcItemWrapper)?.Id, (y as AcItemWrapper)?.Id)); }
public static void RemoveDupes(DatDir tDat, bool testName = true, bool testWithMergeName = false) { for (int g = 0; g < tDat.ChildCount; g++) { DatDir mGame = (DatDir)tDat.Child(g); if (mGame.DGame == null) { RemoveDupes(mGame, testName); } else { bool found = true; while (found) { found = false; for (int r = 0; r < mGame.ChildCount; r++) { DatFile df0 = (DatFile)mGame.Child(r); for (int t = r + 1; t < mGame.ChildCount; t++) { DatFile df1 = (DatFile)mGame.Child(t); if (testName && df0.Name != df1.Name) { continue; } bool hasCRC = df0.CRC != null && df1.CRC != null; if (hasCRC && !ArrByte.bCompare(df0.CRC, df1.CRC)) { continue; } bool hasSHA1 = df0.SHA1 != null && df1.SHA1 != null; if (hasSHA1 && !ArrByte.bCompare(df0.SHA1, df1.SHA1)) { continue; } bool hasMD5 = df0.MD5 != null && df1.MD5 != null; if (hasMD5 && !ArrByte.bCompare(df0.MD5, df1.MD5)) { continue; } if (!hasCRC && !hasSHA1 && !hasMD5) { continue; } found = true; string name0 = df0.Name; string name1 = df1.Name; bool nS0 = name0.Contains("\\"); bool ns1 = name1.Contains("\\"); if (nS0 && !ns1) { mGame.ChildRemove(df0); } else if (!nS0 && ns1) { mGame.ChildRemove(df1); } else if (nS0 && ns1) { string s0 = name0.Substring(0, name0.IndexOf("\\", StringComparison.Ordinal)); string s1 = name1.Substring(0, name1.IndexOf("\\", StringComparison.Ordinal)); if (s0 != s1) { mGame.ChildRemove(df1); } else { int res = AlphanumComparatorFast.Compare(name0, name1); mGame.ChildRemove(res >= 0 ? df0 : df1); } } else if ((name0 == name1) || (testWithMergeName && (name0 == df1.Merge))) { mGame.ChildRemove(df1); } else { found = false; continue; } r = mGame.ChildCount; t = mGame.ChildCount; } } } } } }
private static void EnsureAboveOf(string a, string b) { Assert.AreEqual(true, AlphanumComparatorFast.Compare(a, b) < 0); Assert.AreEqual(true, AlphanumComparatorFast.Compare(b, a) > 0); }
public override int CompareTo(AcPlaceholderNew o) { return(Enabled == o.Enabled ? AlphanumComparatorFast.Compare(Id, o.Id) : Enabled ? -1 : 1); }
public int CompareTo(Brush b) { return(logical.Compare(Name, b.Name)); }