public override string ToString() { var tupStr = new StringBuilder(); tupStr.Append("( "); tupStr.Append(Item1.ToString()); tupStr.Append(", "); tupStr.Append(Item2.ToString()); tupStr.Append(" )"); return(tupStr.ToString()); }
public override string ToString() { if (Item1 is EmptyExpression <ItemT> && Item2 is EmptyExpression <ItemT> ) { return(string.Empty); } else if (Item1 is EmptyExpression <ItemT> ) { return(Item2.ToString()); } else if (Item2 is EmptyExpression <ItemT> ) { return(Item1.ToString()); } else if (HasNestedElements) { return($"({Item1} {opName} {Item2})"); } else { return($"{Item1} {opName} {Item2}"); } }
public override void Write(Utf8JsonWriter writer, Sintaksanalizilo.MalinflektaŜtupo value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("tipo", value.GetType().Name); switch (value.Tag) { case Sintaksanalizilo.MalinflektaŜtupo.Tags.Bazo: { var bazo = value as Sintaksanalizilo.MalinflektaŜtupo.Bazo; writer.WriteString("vorttipo", bazo !.Item1.ToString()); writer.WriteString("inflekcio", bazo !.Item2.ToString()); writer.WriteString("bazaVorto", bazo !.BazaVorto); break; } case Sintaksanalizilo.MalinflektaŜtupo.Tags.Nebazo: { var nebazo = value as Sintaksanalizilo.MalinflektaŜtupo.Nebazo; writer.WriteString("vorttipo", nebazo !.Item1.ToString()); writer.WriteString("inflekcio", nebazo !.Item2.ToString()); writer.WriteString("restantaVorto", nebazo !.RestantaVorto); break; } } writer.WriteEndObject(); }
public override string ToString() { return(Item1.ToString().Substring(0, 1) + Item2.ToString().Substring(0, 1)); }
public override string ToString() { return(Item1.ToString() + " " + Item2.ToString() + " " + Item3.ToString()); }
public override int GetHashCode() { return((Item1.ToString() + Item2.ToString() + Item3.ToString()).GetHashCode()); }
public static Workdays ToWorkdays(this List <Event> events, DateTimeZone timeZone) { Option <long> ReduceTime(IGrouping <Date, Event> grouping, string kind, Func <IEnumerable <long>, long> accumulator) { Option <long> time = Option.None <long>(); grouping .Where(g => g.Kind == kind) .Select(g => g.Timestamp) .SomeWhen(e => e.Any()) .MatchSome(some: g => time = accumulator(g).Some()); return(time); } var reduceDate = from e in events group e by new Date(DoubleExtensions.ToLocalDateTimestampMilliseconds(e.Timestamp)) into eg select new { Date = eg.Key, EsentArrival = ReduceTime(eg, "ESENT_MIN", g => g.Min()), EsentDepature = ReduceTime(eg, "ESENT_MAX", g => g.Max()), OtherArrival = ReduceTime(eg, "OTHEREVENT_MIN", g => g.Min()), OtherDepature = ReduceTime(eg, "OTHEREVENT_MAX", g => g.Max()), // Because logged times do not use date as key b //EsentA = eg.Where(e => e.Kind == "ESENT_MIN").ToList(), //OtherA = eg.Where(e => e.Kind == "ESENT_MAX").ToList(), //EsentD = eg.Where(e => e.Kind == "OTHEREVENT_MIN").ToList(), //OtherD = eg.Where(e => e.Kind == "OTHEREVENT_MAX").ToList() // Should really be partitioned by localDate of the clients timezone. }; Option <float> RoundHours(Option <(long, TimeConfidence)> unixTimestamp) { var hours = Option.None <float>(); unixTimestamp.MatchSome(ts => { var value = ts.Item1.ToInstantFromUnixTimestampMilliseconds().InZone(timeZone).LocalDateTime.TimeOfDay; var roundedHours = (float)value.Hour + (float)value.Minute / (float)60 + (float)value.Second / (float)3600 + (float)value.Millisecond / (float)360000; hours = roundedHours.Some(); }); return(hours); } string ConfidenceText(Option <(long, TimeConfidence)> unixTimestamp) { return(unixTimestamp.ValueOr((0, TimeConfidence.None)).Item2.ToString()); } IEnumerable <WorkdayDto> RereduceTime() { foreach (var r in reduceDate) { Option <(long, TimeConfidence)> arrival = Option.None <(long, TimeConfidence)>(); Option <(long, TimeConfidence)> departure = Option.None <(long, TimeConfidence)>(); arrival.MatchNone(() => r.EsentArrival.MatchSome(a => arrival = (a, TimeConfidence.Confident).Some())); arrival.MatchNone(() => r.OtherArrival.MatchSome(a => arrival = (a, TimeConfidence.Insecure).Some())); departure.MatchNone(() => r.EsentDepature.MatchSome(a => departure = (a, TimeConfidence.Confident).Some())); departure.MatchNone(() => r.OtherDepature.MatchSome(a => departure = (a, TimeConfidence.Certain).Some())); yield return(new WorkdayDto { Date = r.Date.DateText(), ArrivalHours = RoundHours(arrival).ValueOr(0), ArrivalConfidence = ConfidenceText(arrival), BreakHours = 0, DepartureHours = RoundHours(departure).ValueOr(0), DepartureConfidence = ConfidenceText(departure) }); } } // System.Diagnostics.Debugger.Break(); return(new Workdays { List = RereduceTime().ToList() }); }
public override string ToString() { return($"({Item1?.ToString()}, {Item2?.ToString()})"); }
public override string ToString() { String Moves = ""; String Levels = ""; for (int i = 0; i < MoveLevels.Length; i++) { Moves = Moves + MoveList[i].ToString() + "¶"; Levels = Levels + MoveLevels[i].ToString() + "¶"; } Moves = Moves + "65535"; Levels = Levels + "65535" + "¶"; return(ID + "¶" + Name + "¶" + BaseHP.ToString() + "¶" + BaseAttack.ToString() + "¶" + BaseDefense.ToString() + "¶" + BaseSpecialAttack.ToString() + "¶" + BaseSpecialDefense.ToString() + "¶" + BaseSpeed.ToString() + "¶" + ((int)LevelingType).ToString() + "¶" + FormID.ToString() + "¶" + GenderValue.ToString() + "¶" + ((int)Type1).ToString() + "¶" + ((int)Type2).ToString() + "¶" + CatchRate.ToString() + "¶" + ExpYield.ToString() + "¶" + EffortYield.ToString() + "¶" + Item1.ToString() + "¶" + Item2.ToString() + "¶" + Ability1.ToString() + "¶" + Ability2.ToString() + "¶" + Ability3.ToString() + "¶" + DexEntry + "¶" + Levels + Moves); }
public override string ToString() { return($"{Item1.ToString()} -> {Item2.ToString()} -> {Item3.ToString()}"); }
/* * public static bool operator ==(Triplet<T1, T2, T3> tuple1, Triplet<T1, T2, T3> tuple2) * { * return tuple1.Equals(tuple2); * } * * public static bool operator !=(Triplet<T1, T2, T3> tuple1, Triplet<T1, T2, T3> tuple2) * { * try { * return !tuple1.Equals(tuple2); * } catch (NullReferenceException e) { * * } * * }*/ public override string ToString() { return("Triplet<" + typeof(T1) + ", " + typeof(T2) + ", " + typeof(T3) + ">(" + Item1.ToString() + ", " + Item2.ToString() + ", " + Item3.ToString() + ")"); }