public void Add(T t) { if (t.CompareTo(Value) > 0) { if (Greater == null) { Greater = new TreeNode(t, this); return; } Greater.Add(t); } else if (t.CompareTo(Value) < 0) { if (Smaller == null) { Smaller = new TreeNode(t, this); return; } Smaller.Add(t); } else // t = Value { throw new ArgumentException("Can not have two elements with this same value."); } }
public override void VisitSmaller(Smaller n) { SetupOperands(n); _gen.Emit(OpCodes.Clt); _lastWalkedType = typeof(bool); }
public PowerUp getPowerUp(PowerUpList chosenPowerUpID) { PowerUp chosenPowerUp = null; switch (chosenPowerUpID) { case PowerUpList.SlowDown: chosenPowerUp = new SlowDown(10); break; case PowerUpList.SpeedUp: chosenPowerUp = new SpeedUp(10); break; case PowerUpList.Warp: chosenPowerUp = new Warp(10); break; case PowerUpList.IceyPlayer: chosenPowerUp = new IceyPlayer(10); break; case PowerUpList.ObjectSpawnPowerUp: chosenPowerUp = new ObjectSpawnPowerUp(10); break; case PowerUpList.Pull: chosenPowerUp = new Pull(10); break; case PowerUpList.Push: chosenPowerUp = new Push(10); break; case PowerUpList.Bigger: chosenPowerUp = new Bigger(10); break; case PowerUpList.Smaller: chosenPowerUp = new Smaller(10); break; case PowerUpList.OrbitingShield: chosenPowerUp = new OrbitingShield(10); break; } return chosenPowerUp; }
public virtual void VisitSmaller(Smaller n) { }
public static void Main() { string[] transactions = { "bob,627,1973,amsterdam", "alex,387,885,bangkok", "alex,355,1029,barcelona", "alex,587,402,bangkok", "chalicefy,973,830,barcelona", "alex,932,86,bangkok", "bob,188,989,amsterdam" }; int[] test = { 0, 1, 2, 3, 4, 5, 6, 0, 1 }; int[] test2 = { 1, 3, 5, 2 }; string[] tests = { "bella", "label", "roller" }; string input2 = "10#11#12"; string something = Program.Mapping.FreqAlphabets(input2); Ranks instanceOfRanks = new Ranks(); string[] medals = instanceOfRanks.FindRelativeRanks(test2); int response4 = WordLength.LengthOfLastWord("b a "); IList <int> response2 = Program.SelfDivide.SelfDividingNumbers(1, 22); IList <string> transactionsResponse = Program.Invalid.InvalidTransactions(transactions); int[] response = ArrayIntersect.Intersect(test, test2); response = ArrayParity.SortArrayByParity(test); IList <int> smallAnswer = Smaller.CountSmaller(test); IList <string> answers = Common.GetValues(tests); int [] answer = Smaller.SmallerNumbersThanCurrent(test); // int response = ReduceToZero.NumberOfSteps(14); //response = Max69.Maximum69Number(9669); ListNode head = new ListNode(1); ListNode second = new ListNode(0); head.next = second; ListNode third = new ListNode(1); second.next = third; GetDecimalValue.GetDecimal(head); BalancedString.GetBalancedCount("RLRRRLLRLL"); string stones = "aAAbbbb"; string jewels = "aA"; int count = JewelsAndStones.GetJewelCount(jewels, stones); int[] digits = { 12, 345, 2, 6, 7896 }; int J = EvenDigits.NumEvenDigits(digits); int i = SubtractProdAndSum.SubtractProductAndSum(234); char[] values = new char[] { 'a', 'a', 'b', 'b', 'c', 'c', 'c' }; StringCompression.StringCompression.Compress(values); int[] input = new int[] { 3, 2, 3, 4, 3, 3 }; Console.WriteLine("Result is: {1}", Decompress.Decompress.DecompressRLElist(input)); }
protected internal virtual void create() { int num = this.string_0.Length; Unit unit = null; int num2 = 0; while (this.int_0 < num) { char ch2 = this.string_0[this.int_0]; if (char.IsWhiteSpace(ch2)) { goto Label_041D; } unit = null; char ch = ch2; switch (ch) { case '!': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotEquals(); this.int_0++; } if (unit == null) { unit = new Not(); } goto Label_03B6; case '"': case '#': case '$': case '\'': case ';': goto Label_02D1; case '%': unit = new Mod(); this.int_0++; goto Label_03B6; case '&': this.int_0++; if ((this.int_0 >= num) || (this.string_0[this.int_0] != '&')) { break; } unit = new And(); this.int_0++; goto Label_03B6; case '(': goto Label_02DD; case ')': goto Label_02F4; case '*': goto Label_0312; case '+': goto Label_032B; case ',': throw new ReportError(new StringBuilder("位置").Append(this.int_0).Append("不应该出现逗号").ToString().ToString()); case '-': goto Label_0341; case '.': goto Label_0357; case '/': unit = new Divide(); this.int_0++; goto Label_03B6; case ':': unit = new Link(this.cellExt1_0); this.int_0++; goto Label_03B6; case '<': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotGreater(); this.int_0++; } if (unit == null) { unit = new Smaller(); } goto Label_03B6; case '=': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { this.int_0++; } unit = new Equals(); goto Label_03B6; case '>': this.int_0++; if ((this.int_0 < num) && (this.string_0[this.int_0] == '=')) { unit = new NotSmaller(); this.int_0++; } if (unit == null) { unit = new Greater(); } goto Label_03B6; default: if (ch != '|') { goto Label_02D1; } this.int_0++; if ((this.int_0 >= num) || (this.string_0[this.int_0] != '|')) { throw new ReportError("不能识别标识符|"); } unit = new Or(); this.int_0++; goto Label_03B6; } unit = LoadFunction.newFunction("address", this.env_0, this.cellExt1_0, this.dataSet_0); goto Label_03B6; Label_02D1: unit = this.createNode(); goto Label_03B6; Label_02DD: num2++; this.int_0++; continue; Label_02F4: if (--num2 < 0) { throw new ReportError("括号不匹配,右括号太多!"); } this.int_0++; continue; Label_0312: unit = new Multiply(); this.int_0++; goto Label_03B6; Label_032B: unit = new Add(); this.int_0++; goto Label_03B6; Label_0341: unit = new Subtract(); this.int_0++; goto Label_03B6; Label_0357: if ((this.unit_1 != null) && !this.unit_1.Operator) { unit = LoadFunction.newFunction("dsmember", this.env_0, this.cellExt1_0, this.dataSet_0); this.int_0++; } else { unit = this.createNode(); } Label_03B6: unit.InBrackets = num2; this.unit_1 = unit; if (this.unit_0 != null) { Unit right = this.unit_0; Unit unit2 = null; while (right != null) { if (right.Priority >= unit.Priority) { break; } unit2 = right; right = right.Right; } unit.Left = right; if (unit2 == null) { this.unit_0 = unit; } else { unit2.Right = unit; } continue; } this.unit_0 = unit; continue; Label_041D: this.int_0++; } if (num2 > 0) { throw new ReportError("括号不匹配,左括号太多!"); } }
//----------------------------------------------------------- private Type Visit(Smaller node, Table table) { VisitBinaryOperator("<", node, Type.INTEGER, table); return(Type.BOOLEAN); }
//----------------------------------------------------------- public string Visit(Smaller node, Table table) { return(VisitBinaryOperator("clt", node, table)); }