public CandleEventArg(CandleEventType _eventtype, IPair Candle, CandlesSeries _candlescopy) { this.EventType = _eventtype; this.ComingCandle = Candle; this.Collected = Candle.CollectedDate; this.Candlescopy = _candlescopy; }
private IPair <Element> ParseOrExpr(Token token) { var startLoc = token.Range.Start; IPair <Element> pair = ParseAndExpr(token); if (pair == null) { return(null); } while (true) { token = pair.Token; if (token is OrOpToken) { var opToken = (OrOpToken)token; var rightPair = ParseAndExpr(token.Next); if (rightPair == null) { throw Error("右辺が見つかりません。", token.Next); } var range = new TextRange(startLoc, rightPair.Token.Range.End); pair = MakePair(new BinaryExpr(pair.Node, BinaryOperationType.Or, rightPair.Node, range), rightPair.Token); } else { break; } } return(pair); }
private IPair <Element> ParseUnknownMultipleExpr(Token token) { IPair <Element> pair = ParseUnaryExpr(token); if (pair == null) { return(null); } var startLoc = token.Range.Start; while (true) { token = pair.Token; if (token is UnknownOperatorToken) { var rightPair = ParseUnaryExpr(token.Next); if (rightPair == null) { throw Error("右辺が見つかりません。", token.Next); } var range = new TextRange(startLoc, rightPair.Token.Range.End); pair = MakePair(new BinaryExpr(pair.Node, BinaryOperationType.Unknown, rightPair.Node, range), rightPair.Token); } else { break; } } return(pair); }
private IPair <Element> ParseAddExpr(Token token) { IPair <Element> pair = ParseMultipleExpr(token); if (pair == null) { return(null); } var startLoc = token.Range.Start; while (true) { token = pair.Token; var opType = token is AddOpToken ? BinaryOperationType.Add : token is SubOpToken ? BinaryOperationType.Subtract : BinaryOperationType.Unknown; if (opType != BinaryOperationType.Unknown) { var rightPair = ParseMultipleExpr(token.Next); if (rightPair == null) { throw Error("右辺が見つかりません。", token.Next); } var range = new TextRange(startLoc, rightPair.Token.Range.End); pair = MakePair(new BinaryExpr(pair.Node, opType, rightPair.Node, range), rightPair.Token); } else { break; } } return(pair); }
// constructor public Order() { type_ = 0; param1_ = new IPair(); param2_ = new IPair(); }
/// <summary> /// اعمال مجوز تاخیر مجاز بعد از ماموریت ساعت 23 /// </summary> /// <param name="MyRule"></param> public void R4503(AssignedRule MyRule) { //3021 تاخیر مجاز //تاخیر ساعتي 3029 //201 کد پیشکارت درخواست تاخیر مجاز ماموریت /*if (this.DoConcept(3029).Value > 0) * { * PairableScndCnpValue late = ((PairableScndCnpValue)this.DoConcept(3029)); * Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201)); * if (permit != null && (permit.Value > 0 || permit.PairCount > 0)) * { * IPair pair = new ShiftPair(); * pair.From = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From; * pair.To = pair.From + MyRule["First", this.RuleCalculateDate].ToInt(); * this.DoConcept(3021).Value = Operation.Intersect(pair, late).Value; * ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(late, pair)); * this.ReCalculate(13, 3020, 3028); * } * }*/ Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201)); if (permit != null && (permit.Value > 0 || permit.PairCount > 0)) { GetLog(MyRule, DebugRuleState.Before, 4002); IPair pair = permit.Pairs.First(); IPair mojaz = new ShiftPair(1, 6 * 60); PairableScndCnpValue overtime = Operation.Intersect(pair, mojaz); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(overtime); GetLog(MyRule, DebugRuleState.After, 4002); } }
// overload public override void Update() { base.Update(); // count for life //delta IPair delta = new IPair(); if (move_vector_ != null) { delta.Add(move_vector_); } delta.Add(repulse_); pos_.Add(delta); if (GameDef.CollisionWall(pos_, Radius)) { Explode = true; } //if (delta.Zero()) Explode = true; // effect update if (effect_list_ != null) { foreach (Effect effect in effect_list_) { // 特效也會做平移 effect.Pos.Add(delta); // effect update 由 list 執行 } } }
public override void Update() { base.Update(); foreach (Unit unit in Game.Unit_List) { if (unit == Caster) { continue; } IPair delta = Pos - unit.Pos; int radius = (RADIUS + unit.Radius) * GameDef.PIXEL_SCALE; if (delta.LengthSquare() > radius * radius || delta.Zero()) { continue; } delta.ChangeLength(STRENGTH); unit.AddRepulse(delta); } foreach (Missile missile in Game.Missile_List) { if (missile.Caster == Caster) { continue; } IPair delta = Pos - missile.Pos; int radius = (RADIUS + missile.Radius) * GameDef.PIXEL_SCALE; if (delta.LengthSquare() > radius * radius || delta.Zero()) { continue; } delta.ChangeLength(STRENGTH); missile.AddRepulse(delta); } }
public virtual void CheckCollision(Unit unit) { IPair delta = pos_ - unit.Pos; int collision_radius = (radius_ + unit.Radius) * GameDef.PIXEL_SCALE; if (delta.LengthSquare() > collision_radius * collision_radius) { return; } if (caster_ == unit) { if (hurt_self_) { Collision = true; } } else { Collision = true; if (explode_enemy_) { Explode = true; } } }
private IPair <TKey, TValue> Push(IPair <TKey, TValue> node) { LinearAddition(node); //BinarySearchAddition(node); return(node); }
private void Push(IPair <TKey, TValue> node) { _heap.Add(node); var i = _heap.Count - 1; var flag = true; if (Type == HeapType.MaxHeap) { flag = false; } while (i > 0) { if ((_heap[i].CompareTo(_heap[(i - 1) / 2]) > 0) ^ flag) { var temp = _heap[i]; _heap[i] = _heap[(i - 1) / 2]; _heap[(i - 1) / 2] = temp; i = (i - 1) / 2; } else { break; } } }
/////////////////////////////////////////////////////////////////////// internal ArgumentList( /* NOTE: For [apply] and [proc] use only. */ StringPairList list, ArgumentFlags flags ) : this() { if (list != null) { int count = list.Count; for (int index = 0; index < count; index++) { IPair <string> element = list[index]; // // HACK: Skip over any null entries, thus ignoring // them. // if (element == null) { continue; } // // NOTE: Does this argument list accept a variable // numbers of arguments (COMPAT: Tcl)? If so, // add a flag to the final argument to mark it // as an "argument list". // ArgumentFlags nameFlags = ArgumentFlags.None; if ((index == (count - 1)) && String.Compare( element.X, TclVars.Arguments, StringOps.SystemStringComparisonType) == 0) { nameFlags |= ArgumentFlags.ArgumentList; } ArgumentFlags valueFlags = (element.Y != null) ? ArgumentFlags.HasDefault : ArgumentFlags.None; Argument argument; if (FlagOps.HasFlags(flags, ArgumentFlags.NameOnly, true)) { argument = Argument.InternalCreate( flags | nameFlags | valueFlags, element.X, Argument.NoValue, element.Y); } else { argument = Argument.InternalCreate( flags | nameFlags | valueFlags, Argument.NoName, element.X, element.Y); } this.Add(argument); } } }
public override void Cast(Unit unit, IPair destination, Effect[] effect_list) { base.Cast(unit, destination, effect_list); MITraceBall missile = new MITraceBall(unit); missile.Register(); }
public override void Cast(Unit unit, IPair destination, Effect[] effect_list) { base.Cast(unit, destination, effect_list); MIGravity missile = new MIGravity(unit, destination); missile.Register(); }
public override TileChunk GetChunk(TileMap tile_map, int pos_x, int pos_y) { IPair index = new IPair(pos_x, pos_y); if (!chunks.ContainsKey(index)) { TileChunk chunk = ScriptableObject.CreateInstance <TileChunk>(); chunk.index_x = pos_x; chunk.index_y = pos_y; chunk.pos_x = pos_x * tile_map.chunk_size_x; chunk.pos_y = pos_y * tile_map.chunk_size_y; chunk.size_x = tile_map.chunk_size_x; chunk.size_y = tile_map.chunk_size_y; TileChunkDataLayer data_layer = new TileChunkDataLayer(chunk.size_x, chunk.size_y); for (int i = 0; i < chunk.size_x * chunk.size_y; ++i) { data_layer.ids[i] = (Random.value >= 0.5f ? 1 : 0); } chunk.data_layers = new List <TileChunkDataLayer>(); chunk.user_data = new List <ScriptableObject>(); chunk.data_layers.Add(data_layer); chunks.Add(index, chunk); } return(chunks[index]); }
private IPair <Element> ParseProperty(Token token) { IPair <Element> pair = ParseUnit(token); if (pair == null) { return(null); } var startLoc = token.Range.Start; while (true) { var nextToken = pair.Token .MatchFlow((SuffixToken t) => t.Text == "の") .MatchFlow((SymbolToken t) => true); if (nextToken == null) { break; } var propToken = (SymbolToken)pair.Token.Next; var propName = propToken.Text; var range = new TextRange(startLoc, propToken.Range.End); pair = MakePair(new PropertyAccess(pair.Node, propName, range), nextToken); } return(pair); }
private bool _isValidPair(IPair pair) { return (pair.Name.Equals("BIO-BTC") || pair.Name.Equals("BIO-RUR") || pair.Name.Equals("BIO-ETH")); }
public async Task <IOrder> OrderAsync(IPair pair, string Id, System.Threading.CancellationToken cancellationToken) { throw new InvalidOperationException("Not support at this time"); //if (!_isValidPair(pair)) // throw new InvalidOperationException($"Pair {pair.Name} not supported."); //IEnumerable<IOrder> orders = await OrdersAsync(pair, false, cancellationToken); //return orders.Where(o => o.Id.Equals(Id)).FirstOrDefault(); }
public void Delete(IPair <TKey, TValue> x) { // make newParent as small as possible DecreaseKey(x, _minKeyValue); // remove the smallest, which decreases n also Pop(); }
public override void StopCast(Unit unit, IPair destination, Effect[] effect_list) { if (effect_list != null) { effect_list[0].Unregister(); effect_list[0] = null; } }
/// <summary> /// 移除Piar /// </summary> /// <param name="pair">要移除的Pair</param> public async Task <bool> RemovePairAsync(IPair pair) { return(await Task.Run(() => { lock (_pairsLocker) { return _pairs.Remove(pair); } })); }
public AlgorithmeHaussierOrdreUnique(IPair pair, decimal montantFiat, decimal pourcentageAchat, decimal pourcentageVente, int id) { this.pair = pair; montantFiatOrdre = montantFiat; pourcentageBaisseAvantAchat = pourcentageAchat; pourcentageHausseAvantVente = pourcentageVente; iDAlgorithmeHaussier = id; sauvegardeDernierOrdre = "logAlgH_" + iDAlgorithmeHaussier + ".json"; }
public void Cast(int id, IPair destination) { param1_.Clone(destination); param2_.X = id; param2_.Y = 0; type_ = 2; }
// constructor public Missile(int life_time, Unit caster) : base(life_time) { pos_ = new IPair(); repulse_ = new IPair(); caster_ = caster; move_vector_ = null; effect_list_ = null; Explode = Collision = false; }
public void DecreaseKey(IPair <TKey, TValue> node, TKey newKey) { _heap.Remove(node); var item = node as PairNode <TKey, TValue>; item.Key = newKey; Push(node); }
public void DecreaseKey(IPair <TKey, TValue> item, TKey newKey) { _list.Remove(item); var node = item as PairNode <TKey, TValue>; node.Key = newKey; Push(node); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// <c>true</c> if the current object is equal to the <paramref name = "other" /> parameter; otherwise, <c>false</c>. /// </returns> /// <param name = "other">An object to compare with this object. /// </param> public bool Equals(IPair <TFirst, TSecond> other) { if (ReferenceEquals(null, other)) { return(false); } return(firstEqualityComparer.Equals(First, other.First) && secondEqualityComparer.Equals(Second, other.Second)); }
/////////////////////////////////////////////////////////////////////////////////////////////// #region IComparer<IPair<T>> Members public int Compare( IPair <T> left, IPair <T> right ) { if ((left == null) && (right == null)) { return(0); } else if (left == null) { return(-1); } else if (right == null) { return(1); } else { IComparer <T> localComparer = (comparer != null) ? comparer : Comparer <T> .Default; switch (comparisonType) { case PairComparison.LXRX: { return(localComparer.Compare(left.X, right.X)); } case PairComparison.LXRY: { return(localComparer.Compare(left.X, right.Y)); } case PairComparison.LYRX: { return(localComparer.Compare(left.Y, right.X)); } case PairComparison.LYRY: { return(localComparer.Compare(left.Y, right.Y)); } } } if (throwOnError) { throw new ScriptException(); } else { return(0); } }
/// <summary> /// 移除Pair /// </summary> /// <param name="pair">要移除的Pair</param> public async Task <bool> RemovePairAsync(IPair pair) { Pair p = pair as Pair; p.UpdateMethod = UpdateMethod.Delete; return(await Task.Run(() => { lock (_pairsLocker) { return RemovePairHelper(p); } })); }
public override Effect[] BeginCast(Unit unit, IPair destination) { IPair delta = destination - unit.Pos; delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE); Effect[] effect_list = new Effect[1]; effect_list[0] = new EFMakeFireBall(unit, delta); effect_list[0].Register(); return(effect_list); }
public GreatesCommonDenominatorSyntax (IPair @operator, ParsedSyntax left, IToken token, ParsedSyntax right) : base(@operator, left, token, right) { }
public PowerSyntax(IPair @operator, ParsedSyntax left, IToken token, ParsedSyntax right) : base(@operator, left, token, right) {}
protected abstract object GetPairPart(IPair pair);
protected override object GetPairPart(IPair pair) { return pair.GetRest(); }