void Awake() { instance = this; tween = GetComponent <TweenScale>(); waitingTime = transform.Find("time").GetComponent <UILabel>(); cancelBtn = transform.Find("cancel_btn").GetComponent <UIButton>(); }
/// <summary> /// Returns true if Solution instances are equal /// </summary> /// <param name="input">Instance of Solution to be compared</param> /// <returns>Boolean</returns> public bool Equals(Solution input) { if (input == null) { return(false); } return (( Costs == input.Costs || (Costs != null && Costs.Equals(input.Costs)) ) && ( Distance == input.Distance || (Distance != null && Distance.Equals(input.Distance)) ) && ( Time == input.Time || (Time != null && Time.Equals(input.Time)) ) && ( TransportTime == input.TransportTime || (TransportTime != null && TransportTime.Equals(input.TransportTime)) ) && ( MaxOperationTime == input.MaxOperationTime || (MaxOperationTime != null && MaxOperationTime.Equals(input.MaxOperationTime)) ) && ( WaitingTime == input.WaitingTime || (WaitingTime != null && WaitingTime.Equals(input.WaitingTime)) ) && ( NoVehicles == input.NoVehicles || (NoVehicles != null && NoVehicles.Equals(input.NoVehicles)) ) && ( NoUnassigned == input.NoUnassigned || (NoUnassigned != null && NoUnassigned.Equals(input.NoUnassigned)) ) && ( Routes == input.Routes || Routes != null && Routes.SequenceEqual(input.Routes) ) && ( Unassigned == input.Unassigned || (Unassigned != null && Unassigned.Equals(input.Unassigned)) )); }
/// <summary> /// Returns true if Activity instances are equal /// </summary> /// <param name="input">Instance of Activity to be compared</param> /// <returns>Boolean</returns> public bool Equals(Activity input) { if (input == null) { return(false); } return (( Type == input.Type || (Type != null && Type.Equals(input.Type)) ) && ( Id == input.Id || (Id != null && Id.Equals(input.Id)) ) && ( LocationId == input.LocationId || (LocationId != null && LocationId.Equals(input.LocationId)) ) && ( ArrTime == input.ArrTime || (ArrTime != null && ArrTime.Equals(input.ArrTime)) ) && ( EndTime == input.EndTime || (EndTime != null && EndTime.Equals(input.EndTime)) ) && ( WaitingTime == input.WaitingTime || (WaitingTime != null && WaitingTime.Equals(input.WaitingTime)) ) && ( Distance == input.Distance || (Distance != null && Distance.Equals(input.Distance)) ) && ( DrivingTime == input.DrivingTime || (DrivingTime != null && DrivingTime.Equals(input.DrivingTime)) ) && ( LoadBefore == input.LoadBefore || LoadBefore != null && LoadBefore.SequenceEqual(input.LoadBefore) ) && ( LoadAfter == input.LoadAfter || LoadAfter != null && LoadAfter.SequenceEqual(input.LoadAfter) )); }
protected virtual void DoRequest(Request request) { if (Users.Count < Capacity) { WaitingTime?.Add(Environment.ToDouble(Environment.Now - request.Time)); Users.Add(request); request.Succeed(); } }
static void Main(string[] args) { SalaryTime salaryTime = new SalaryTime(); WaitingTime waitingTime = new WaitingTime(); Accounting accounting = new Accounting(); accounting.onPay += salaryTime.Earn; accounting.wait += waitingTime.Wait; accounting.Work(31); }
protected virtual void DoRequest(ResourcePoolRequest request) { foreach (var o in Resources) { if (!request.Filter(o)) { continue; } WaitingTime?.Add(Environment.ToDouble(Environment.Now - request.Time)); Resources.Remove(o); request.Succeed(o); return; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Costs != null) { hashCode = hashCode * 59 + Costs.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (Time != null) { hashCode = hashCode * 59 + Time.GetHashCode(); } if (TransportTime != null) { hashCode = hashCode * 59 + TransportTime.GetHashCode(); } if (MaxOperationTime != null) { hashCode = hashCode * 59 + MaxOperationTime.GetHashCode(); } if (WaitingTime != null) { hashCode = hashCode * 59 + WaitingTime.GetHashCode(); } if (NoVehicles != null) { hashCode = hashCode * 59 + NoVehicles.GetHashCode(); } if (NoUnassigned != null) { hashCode = hashCode * 59 + NoUnassigned.GetHashCode(); } if (Routes != null) { hashCode = hashCode * 59 + Routes.GetHashCode(); } if (Unassigned != null) { hashCode = hashCode * 59 + Unassigned.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (LocationId != null) { hashCode = hashCode * 59 + LocationId.GetHashCode(); } if (ArrTime != null) { hashCode = hashCode * 59 + ArrTime.GetHashCode(); } if (EndTime != null) { hashCode = hashCode * 59 + EndTime.GetHashCode(); } if (WaitingTime != null) { hashCode = hashCode * 59 + WaitingTime.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (DrivingTime != null) { hashCode = hashCode * 59 + DrivingTime.GetHashCode(); } if (LoadBefore != null) { hashCode = hashCode * 59 + LoadBefore.GetHashCode(); } if (LoadAfter != null) { hashCode = hashCode * 59 + LoadAfter.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Route instances are equal /// </summary> /// <param name="input">Instance of Route to be compared</param> /// <returns>Boolean</returns> public bool Equals(Route input) { if (input == null) { return(false); } return (( VehicleId == input.VehicleId || (VehicleId != null && VehicleId.Equals(input.VehicleId)) ) && ( Distance == input.Distance || (Distance != null && Distance.Equals(input.Distance)) ) && ( TransportTime == input.TransportTime || (TransportTime != null && TransportTime.Equals(input.TransportTime)) ) && ( CompletionTime == input.CompletionTime || (CompletionTime != null && CompletionTime.Equals(input.CompletionTime)) ) && ( WaitingTime == input.WaitingTime || (WaitingTime != null && WaitingTime.Equals(input.WaitingTime)) ) && ( Activities == input.Activities || Activities != null && Activities.SequenceEqual(input.Activities) ) && ( Points == input.Points || Points != null && Points.SequenceEqual(input.Points) )); }
public async Task <ActionResult> Toggle([Bind(Include = "Id,Status")] WaitingTime waitingTime) { if (ModelState.IsValid) { var isExist = await context.WaitingTimes.FindAsync(waitingTime.Id); if (isExist == null) { // No record exists, therefore add if (waitingTime.Status) { waitingTime.StartTime = DateTime.Now; } context.WaitingTimes.Add(waitingTime); } else { // Record exists, therefore update if (waitingTime.Status) { // Status true isExist.StartTime = DateTime.Now; } else { // Status false if (isExist.Duration == null) { isExist.Duration = 0; } isExist.Duration += (Int32)(DateTime.Now - isExist.StartTime.Value).TotalMinutes; isExist.StartTime = null; } isExist.Status = waitingTime.Status; } await context.SaveChangesAsync(); } return(RedirectToAction("Toggle")); }
/// <summary> /// Sets the message received from Yate /// </summary> /// <param name="node"></param> /// <param name="message"></param> public void SetIncoming(INode node, string message) { if (message.Substring(0, 3) == "%%<") { MessageDirection = MessageDirection.IncomingAnswer; } else { MessageDirection = MessageDirection.IncomingRequest; } Node = node; IncomingOriginalMessage = message; IncomingSplittedMessage = message.Split(':'); if (IncomingSplittedMessage[0].Substring(3) == "message") { MessageId = IncomingSplittedMessage[1]; } WaitingTime.Start(); ChannelId = GetValue("id"); }
protected virtual void DoRequest(PreemptiveRequest request) { if (Users.Count >= Capacity && request.Preempt) { // Check if we can preempt another process // MaxItems are the least important according to priorty, time, and preemption flag var preempt = Users.MaxItems(x => x).Last(); if (preempt.CompareTo(request) > 0) { InterruptTime?.Add(Environment.ToDouble(Environment.Now - request.Time)); preempt.IsPreempted = true; Users.Remove(preempt); preempt.Owner?.Interrupt(new Preempted(request.Owner, preempt.Time)); } } if (Users.Count < Capacity) { WaitingTime?.Add(Environment.ToDouble(Environment.Now - request.Time)); Users.Add(request); request.Succeed(); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (VehicleId != null) { hashCode = hashCode * 59 + VehicleId.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (TransportTime != null) { hashCode = hashCode * 59 + TransportTime.GetHashCode(); } if (CompletionTime != null) { hashCode = hashCode * 59 + CompletionTime.GetHashCode(); } if (WaitingTime != null) { hashCode = hashCode * 59 + WaitingTime.GetHashCode(); } if (Activities != null) { hashCode = hashCode * 59 + Activities.GetHashCode(); } if (Points != null) { hashCode = hashCode * 59 + Points.GetHashCode(); } return(hashCode); } }