public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is InventoryAdjustment other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) && ((FromState == null && other.FromState == null) || (FromState?.Equals(other.FromState) == true)) && ((ToState == null && other.ToState == null) || (ToState?.Equals(other.ToState) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) && ((CatalogObjectType == null && other.CatalogObjectType == null) || (CatalogObjectType?.Equals(other.CatalogObjectType) == true)) && ((Quantity == null && other.Quantity == null) || (Quantity?.Equals(other.Quantity) == true)) && ((TotalPriceMoney == null && other.TotalPriceMoney == null) || (TotalPriceMoney?.Equals(other.TotalPriceMoney) == true)) && ((OccurredAt == null && other.OccurredAt == null) || (OccurredAt?.Equals(other.OccurredAt) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((Source == null && other.Source == null) || (Source?.Equals(other.Source) == true)) && ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) && ((TransactionId == null && other.TransactionId == null) || (TransactionId?.Equals(other.TransactionId) == true)) && ((RefundId == null && other.RefundId == null) || (RefundId?.Equals(other.RefundId) == true)) && ((PurchaseOrderId == null && other.PurchaseOrderId == null) || (PurchaseOrderId?.Equals(other.PurchaseOrderId) == true)) && ((GoodsReceiptId == null && other.GoodsReceiptId == null) || (GoodsReceiptId?.Equals(other.GoodsReceiptId) == true))); }
public override int GetHashCode() { int hash = 13; hash = (hash * 7) + FromState.GetHashCode(); hash = (hash * 7) + ToState.GetHashCode(); return(hash + Cost); }
public int CompareTo(Transition <T> other) { int fromCompare = FromState.Equals(other.FromState) ? 1 : 0; int symbolCompare = Symbol.CompareTo(other.Symbol); int toCompare = ToState.Equals(other.ToState) ? 1 : 0; return(fromCompare != 0 ? fromCompare : (symbolCompare != 0 ? symbolCompare : toCompare)); }
/// <summary> /// Compares two <see cref="Transition{T}"/> objects. /// </summary> /// <param name="other">The <see cref="Transition{T}"/> to compare to.</param> /// <returns>An integer indicator. TODO: Need to check this one with Paul</returns> public int CompareTo(Transition <T> other) { int fromCompare = FromState.Equals(other.FromState) ? 1 : 0; int idCompare = Identifier.CompareTo(other.Identifier); int toCompare = ToState.Equals(other.ToState) ? 1 : 0; //And now, for some magic return(fromCompare != 0 ? fromCompare : (idCompare != 0 ? idCompare : toCompare)); }
public void NewGame() { if (transition) { return; } toState = ToState.NewGame; transition = true; }
public string ToLaTeX() { if (ToState.Equals(FromState)) //{${1}$} ({0}) { return(string.Format("({0}) edge[out=80,in=100,loop] node[above]{1} ({0})", FromState, "{$" + GetRule().Replace("_", "\\_") + "$}")); } return(string.Format("({0}) edge node[above]{1} ({2})", FromState, "{$" + GetRule().Replace("_", "\\_") + "$}", ToState)); }
public bool Equals(EdgeAction <T> other) { if (other == null) { return(false); } else { bool states_equal = FromState.Equals(other.FromState) && ToState.Equals(other.ToState); bool costs_equal = Cost.Equals(other.Cost); return(states_equal && costs_equal); } }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (FromState != null ? FromState.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FromStateId.GetHashCode(); hashCode = (hashCode * 397) ^ (ToState != null ? ToState.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ToStateId.GetHashCode(); hashCode = (hashCode * 397) ^ (PermissionGroups != null ? PermissionGroups.GetHashCode() : 0); hashCode = (hashCode * 397) ^ SkipPermissionGroups.GetHashCode(); return(hashCode); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } else if (obj is Transition <T> ) { Transition <T> transition = (Transition <T>)obj; return(FromState.CompareTo(transition.FromState) == 0 && ToState.CompareTo(transition.ToState) == 0 && Symbol == transition.Symbol); } return(false); }
protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}"); toStringOutput.Add($"ReferenceId = {(ReferenceId == null ? "null" : ReferenceId == string.Empty ? "" : ReferenceId)}"); toStringOutput.Add($"FromState = {(FromState == null ? "null" : FromState.ToString())}"); toStringOutput.Add($"ToState = {(ToState == null ? "null" : ToState.ToString())}"); toStringOutput.Add($"LocationId = {(LocationId == null ? "null" : LocationId == string.Empty ? "" : LocationId)}"); toStringOutput.Add($"CatalogObjectId = {(CatalogObjectId == null ? "null" : CatalogObjectId == string.Empty ? "" : CatalogObjectId)}"); toStringOutput.Add($"CatalogObjectType = {(CatalogObjectType == null ? "null" : CatalogObjectType == string.Empty ? "" : CatalogObjectType)}"); toStringOutput.Add($"Quantity = {(Quantity == null ? "null" : Quantity == string.Empty ? "" : Quantity)}"); toStringOutput.Add($"TotalPriceMoney = {(TotalPriceMoney == null ? "null" : TotalPriceMoney.ToString())}"); toStringOutput.Add($"OccurredAt = {(OccurredAt == null ? "null" : OccurredAt == string.Empty ? "" : OccurredAt)}"); toStringOutput.Add($"CreatedAt = {(CreatedAt == null ? "null" : CreatedAt == string.Empty ? "" : CreatedAt)}"); toStringOutput.Add($"Source = {(Source == null ? "null" : Source.ToString())}"); toStringOutput.Add($"EmployeeId = {(EmployeeId == null ? "null" : EmployeeId == string.Empty ? "" : EmployeeId)}"); toStringOutput.Add($"TransactionId = {(TransactionId == null ? "null" : TransactionId == string.Empty ? "" : TransactionId)}"); toStringOutput.Add($"RefundId = {(RefundId == null ? "null" : RefundId == string.Empty ? "" : RefundId)}"); toStringOutput.Add($"PurchaseOrderId = {(PurchaseOrderId == null ? "null" : PurchaseOrderId == string.Empty ? "" : PurchaseOrderId)}"); toStringOutput.Add($"GoodsReceiptId = {(GoodsReceiptId == null ? "null" : GoodsReceiptId == string.Empty ? "" : GoodsReceiptId)}"); }
public virtual bool RunTrigger(IStateParam param, StateMachine sm) { //if (!sm.CheckState(FromState)) //{ // throw new NotCurrentStateException(sm.GetType().ToString() + " : current is " + sm.CurrentState.StateName + ",not Transition from: " + FromState.StateName); //} StateExitEventArgs seea = new StateExitEventArgs(); try { FromState.DoExit(seea); } catch (Exception ex) { throw ex; } try { runAct.Invoke(sm, null); } catch (Exception ex) { throw ex; } StateEntryEventArgs senea = new StateEntryEventArgs(sm); try { ToState.ExecDoEntry(senea); } catch (Exception ex) { throw ex; } return(true); }
public override bool RunTrigger(IStateParam param, StateMachine sm) { try { StateExitEventArgs seea = new StateExitEventArgs(); FromState.DoExit(seea); } catch { throw new StateMachineFatelException(FromState.StateName + ": get exit fail event"); } runAct.Invoke(sm, null); try { StateEntryEventArgs seea = new StateEntryEventArgs(sm); ToState.ExecDoEntry(seea); } catch { throw new StateMachineFatelException(ToState.StateName + ": get entry fail event"); } return(true); }
public override int GetHashCode() { int hashCode = -855846569; if (Id != null) { hashCode += Id.GetHashCode(); } if (ReferenceId != null) { hashCode += ReferenceId.GetHashCode(); } if (FromState != null) { hashCode += FromState.GetHashCode(); } if (ToState != null) { hashCode += ToState.GetHashCode(); } if (LocationId != null) { hashCode += LocationId.GetHashCode(); } if (CatalogObjectId != null) { hashCode += CatalogObjectId.GetHashCode(); } if (CatalogObjectType != null) { hashCode += CatalogObjectType.GetHashCode(); } if (Quantity != null) { hashCode += Quantity.GetHashCode(); } if (TotalPriceMoney != null) { hashCode += TotalPriceMoney.GetHashCode(); } if (OccurredAt != null) { hashCode += OccurredAt.GetHashCode(); } if (CreatedAt != null) { hashCode += CreatedAt.GetHashCode(); } if (Source != null) { hashCode += Source.GetHashCode(); } if (EmployeeId != null) { hashCode += EmployeeId.GetHashCode(); } if (TransactionId != null) { hashCode += TransactionId.GetHashCode(); } if (RefundId != null) { hashCode += RefundId.GetHashCode(); } if (PurchaseOrderId != null) { hashCode += PurchaseOrderId.GetHashCode(); } if (GoodsReceiptId != null) { hashCode += GoodsReceiptId.GetHashCode(); } return(hashCode); }
public void Quit() { toState = ToState.Quit; transition = true; }