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 int CompareTo(Transition <T> other) { int fromCmp = FromState.CompareTo(other.FromState); int symbolCmp = Symbol.CompareTo(other.Symbol); int toCmp = ToState.CompareTo(other.ToState); return(fromCmp != 0 ? fromCmp : (symbolCmp != 0 ? symbolCmp : toCmp)); }
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)); }
public virtual int CompareTo(Transition <T> t) { int fromCmp = FromState.CompareTo(t.FromState); int symbolCmp = Symbol.CompareTo(t.Symbol); int toCmp = ToState.CompareTo(t.ToState); return(fromCmp != 0 ? fromCmp : (symbolCmp != 0 ? symbolCmp : toCmp)); }
/// <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 override bool Equals(object other) { Transition <T> transition = other as Transition <T>; if (transition != null) { return(FromState.Equals(transition.FromState) && ToState.Equals(transition.ToState) && Symbol == (transition.Symbol)); } return(false); }
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); }
// overriding equals public override bool Equals(Object other) { if (other == null) { return(false); } else if (other is Transition <T> ) { var otherCast = other as Transition <T>; return(FromState.Equals(otherCast.FromState) && ToState.Equals(otherCast.ToState) && Symbol.Equals(otherCast.Symbol)); } else { return(false); } }
public override bool Equals(Object other) { if (other == null) { return(false); } if (other is Transition <T> ) { Transition <T> oT = (Transition <T>)other; return (FromState.CompareTo(oT.FromState) == 0 && ToState.CompareTo(oT.ToState) == 0 && Symbol == oT.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 bool CanAutoTrigger() { var hasTimeTrigger = TriggerAfter != null; var byTimeResult = false; var hasConditionTrigger = AutoTriggerFunction != null; var byConditionResult = false; if (hasTimeTrigger) { var state = Workflow.States.FirstOrDefault(x => x.InnerState.GetHashCode() == FromState.GetHashCode()); var timeSpan = DateTime.Now.Subtract(state.EntryDate); byTimeResult = timeSpan >= TriggerAfter; } if (hasConditionTrigger) { byConditionResult = AutoTriggerFunction.Invoke(); } if (hasTimeTrigger && hasConditionTrigger) { return(byTimeResult && byConditionResult); //pass both } else { return((hasTimeTrigger && byTimeResult) || (hasConditionTrigger && byConditionResult)); } }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("TDDITransition"); oprot.WriteStructBegin(struc); TField field = new TField(); if (__isset.Id) { field.Name = "Id"; field.Type = TType.I64; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteI64(Id); oprot.WriteFieldEnd(); } if (Name != null && __isset.Name) { field.Name = "Name"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteString(Name); oprot.WriteFieldEnd(); } if (Description != null && __isset.Description) { field.Name = "Description"; field.Type = TType.String; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteString(Description); oprot.WriteFieldEnd(); } if (__isset.IsCitation) { field.Name = "IsCitation"; field.Type = TType.Bool; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteBool(IsCitation); oprot.WriteFieldEnd(); } if (__isset.IsAbstract) { field.Name = "IsAbstract"; field.Type = TType.Bool; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteBool(IsAbstract); oprot.WriteFieldEnd(); } if (KeyValueMaps != null && __isset.KeyValueMaps) { field.Name = "KeyValueMaps"; field.Type = TType.List; field.ID = 6; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.Struct, KeyValueMaps.Count)); foreach (TDDIKeyValueMapRef _iter827 in KeyValueMaps) { _iter827.Write(oprot); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (CitedElement != null && __isset.CitedElement) { field.Name = "CitedElement"; field.Type = TType.Struct; field.ID = 7; oprot.WriteFieldBegin(field); CitedElement.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.Probability) { field.Name = "Probability"; field.Type = TType.Double; field.ID = 8; oprot.WriteFieldBegin(field); oprot.WriteDouble(Probability); oprot.WriteFieldEnd(); } if (ProbabilityDistribution != null && __isset.ProbabilityDistribution) { field.Name = "ProbabilityDistribution"; field.Type = TType.Struct; field.ID = 9; oprot.WriteFieldBegin(field); ProbabilityDistribution.Write(oprot); oprot.WriteFieldEnd(); } if (FromFailState != null && __isset.FromFailState) { field.Name = "FromFailState"; field.Type = TType.Struct; field.ID = 10; oprot.WriteFieldBegin(field); FromFailState.Write(oprot); oprot.WriteFieldEnd(); } if (ToFailState != null && __isset.ToFailState) { field.Name = "ToFailState"; field.Type = TType.Struct; field.ID = 11; oprot.WriteFieldBegin(field); ToFailState.Write(oprot); oprot.WriteFieldEnd(); } if (FromState != null && __isset.FromState) { field.Name = "FromState"; field.Type = TType.Struct; field.ID = 12; oprot.WriteFieldBegin(field); FromState.Write(oprot); oprot.WriteFieldEnd(); } if (ToState != null && __isset.ToState) { field.Name = "ToState"; field.Type = TType.Struct; field.ID = 13; oprot.WriteFieldBegin(field); ToState.Write(oprot); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
public override string ToString() { StringBuilder __sb = new StringBuilder("TDDITransition("); bool __first = true; if (__isset.Id) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Id: "); __sb.Append(Id); } if (Name != null && __isset.Name) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Name: "); __sb.Append(Name); } if (Description != null && __isset.Description) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Description: "); __sb.Append(Description); } if (__isset.IsCitation) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("IsCitation: "); __sb.Append(IsCitation); } if (__isset.IsAbstract) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("IsAbstract: "); __sb.Append(IsAbstract); } if (KeyValueMaps != null && __isset.KeyValueMaps) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("KeyValueMaps: "); __sb.Append(KeyValueMaps); } if (CitedElement != null && __isset.CitedElement) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("CitedElement: "); __sb.Append(CitedElement == null ? "<null>" : CitedElement.ToString()); } if (__isset.Probability) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Probability: "); __sb.Append(Probability); } if (ProbabilityDistribution != null && __isset.ProbabilityDistribution) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ProbabilityDistribution: "); __sb.Append(ProbabilityDistribution == null ? "<null>" : ProbabilityDistribution.ToString()); } if (FromFailState != null && __isset.FromFailState) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("FromFailState: "); __sb.Append(FromFailState == null ? "<null>" : FromFailState.ToString()); } if (ToFailState != null && __isset.ToFailState) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ToFailState: "); __sb.Append(ToFailState == null ? "<null>" : ToFailState.ToString()); } if (FromState != null && __isset.FromState) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("FromState: "); __sb.Append(FromState == null ? "<null>" : FromState.ToString()); } if (ToState != null && __isset.ToState) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ToState: "); __sb.Append(ToState == null ? "<null>" : ToState.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
public bool Equals(FromState other) { return(State.Equals(other.State) && IsInitial == other.IsInitial); }
public override string ToString() { return($"[{FromState.ToString()}]-->[{NowState.ToString()}]"); }