public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var newNode = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("SpanWithText")); newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); var atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("start")); atr.Value = StartIndex.ToString(); atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("end")); atr.Value = EndIndex.ToString(); atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("price")); atr.Value = Price.ToStringUniform(); atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("tstLeft")); atr.Value = TextLeft; atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("tstRight")); atr.Value = TextRight; if (!string.IsNullOrEmpty(Name)) { atr = newNode.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("name")); atr.Value = Name; } }
/// <summary> /// A hash code for this object that will always be the same for EntityDefinition objects with the /// same values /// </summary> /// <returns>The generated hash code</returns> public override int GetHashCode() { int hashCode = Entity.GetHashCode(); hashCode = (hashCode * 251) + Type.GetHashCode(); hashCode = (hashCode * 251) + StartIndex.GetHashCode(); hashCode = (hashCode * 251) + EndIndex.GetHashCode(); hashCode = (hashCode * 251) + Score.GetHashCode(); return(hashCode); }
/// <summary> /// Replace elements with operation and replace index variable with indexing number. /// </summary> /// <param name="fromIndex"></param> /// <param name="toIndex"></param> /// <param name="operation"></param> /// <returns></returns> private string JoinElementsWithOperation(int fromIndex, int toIndex, string operation) { string FunctionBody = string.Empty; int counterIndex = fromIndex; bool still = true; while (still) { var e = GetElement(counterIndex); string se_text = e.ElementDeclaration.Replace("$" + this.SequenceIndexName, "`"); se_text = se_text.Replace(this.SequenceIndexName, counterIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + this.SequenceIndexName); if (!string.IsNullOrEmpty(SequenceRangeStartName)) { se_text = se_text.Replace("$" + SequenceRangeStartName, "`"); se_text = se_text.Replace(SequenceRangeStartName, StartIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeStartName); } if (!string.IsNullOrEmpty(SequenceRangeEndName)) { se_text = se_text.Replace("$" + SequenceRangeEndName, "`"); se_text = se_text.Replace(SequenceRangeEndName, EndIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeEndName); } FunctionBody += "(" + se_text + ")"; if (fromIndex > toIndex) { counterIndex--; if (counterIndex < toIndex) { still = false; } } else { counterIndex++; if (counterIndex > toIndex) { still = false; } } if (still) { FunctionBody += " " + operation + " "; } } return(FunctionBody); }
public override void Eval(TemplateContext context, System.IO.StringWriter writer) { // evaluate indicies object objStartIdx = StartIndex.Eval(context); object objEndIdx = EndIndex.Eval(context); // check indicies if (!(objStartIdx is Int32)) { throw new ParserException("Start index expression should evaluate to integer.", StartIndex.Line, StartIndex.Column); } if (!(objEndIdx is Int32)) { throw new ParserException("End index expression should evaluate to integer.", StartIndex.Line, StartIndex.Column); } int startIdx = Convert.ToInt32(objStartIdx); int endIdx = Convert.ToInt32(objEndIdx); int step = startIdx < endIdx ? 1 : -1; endIdx += step; int i = startIdx; do { context.Variables[IndexIdentifier] = i; // evaluate statements foreach (Statement stm in Statements) { stm.Eval(context, writer); } i += step; }while (i != endIdx); // cleanup vars context.Variables.Remove(IndexIdentifier); }
/// <summary> /// Compares this EntityDefinition to the passed in EntityDefinition /// The ordering follows the following precedence (stopping when one value differs) /// Higher score /// Case insensitive lexicographic ordering Type /// Case sensitive lexicographic Entity (value) /// Earlier in the string first /// Shorter first /// </summary> /// <param name="other">The EntityDefinition to compare against</param> /// <returns>The result of the comparison</returns> public int CompareTo(LuisEntity other) { if (object.ReferenceEquals(other, null)) { return(1); } // Compare score (higher comes first) var comparison = other.Score.CompareTo(Score); // Compare Type if (comparison == 0) { comparison = string.Compare(Type, other.Type, StringComparison.Ordinal); } // Compare Entity if (comparison == 0) { comparison = string.Compare(Entity, other.Entity, StringComparison.Ordinal); } // Compare StartIndex if (comparison == 0) { comparison = StartIndex.CompareTo(other.StartIndex); } // Compare EndIndex if (comparison == 0) { comparison = EndIndex.CompareTo(other.EndIndex); } return(comparison); }
public override void CheckSemantic(SymbolTable symbolTable, List <CompileError> errors) { ///check semantics al StartIndex StartIndex.CheckSemantic(symbolTable, errors); ///check semantics al EndIndex EndIndex.CheckSemantic(symbolTable, errors); ///si StartIndex no evaluó de error if (!Object.Equals(StartIndex.NodeInfo, SemanticInfo.SemanticError)) { ///la expresión de StartIndex tiene que ser compatible con 'int' if (!StartIndex.NodeInfo.BuiltInType.IsCompatibleWith(BuiltInType.Int)) { errors.Add(new CompileError { Line = StartIndex.Line, Column = StartIndex.CharPositionInLine, ErrorMessage = string.Format("Cannot implicitly convert type '{0}' to 'int'", StartIndex.NodeInfo.Type.Name), Kind = ErrorKind.Semantic }); ///el nodo evalúa de error NodeInfo = SemanticInfo.SemanticError; } } ///si EndIndex no evaluó de error if (!Object.Equals(EndIndex.NodeInfo, SemanticInfo.SemanticError)) { ///la expresión de EndIndex tiene que ser compatible con 'int' if (!EndIndex.NodeInfo.BuiltInType.IsCompatibleWith(BuiltInType.Int)) { errors.Add(new CompileError { Line = EndIndex.Line, Column = EndIndex.CharPositionInLine, ErrorMessage = string.Format("Cannot implicitly convert type '{0}' to 'int'", EndIndex.NodeInfo.Type.Name), Kind = ErrorKind.Semantic }); ///el nodo evalúa de error NodeInfo = SemanticInfo.SemanticError; } } SemanticInfo loopVarInfo; ///no puede haber otra variable con el mismo nombre que este if (symbolTable.GetDefinedVariableDeep(LoopVariable, out loopVarInfo)) { errors.Add(new CompileError { Line = GetChild(0).Line, Column = GetChild(0).CharPositionInLine, ErrorMessage = string.Format("A local variable named '{0}' cannot be declared in this scope because it would give a different meaning to'{1}', which is already used in a 'parent or current' scope to denote something else", LoopVariable, LoopVariable), Kind = ErrorKind.Semantic }); } ///creamos un nuevo scope symbolTable.InitNewScope(); ///agregamos la variable de iteración al scope actual SemanticInfo loopVariable = new SemanticInfo { Name = LoopVariable, ElementKind = SymbolKind.Variable, IsReadOnly = true, //ponemos la variable como readonly BuiltInType = BuiltInType.Int, Type = SemanticInfo.Int }; symbolTable.InsertSymbol(loopVariable); ///check semantics al ForBody ForBody.CheckSemantic(symbolTable, errors); ///aquí concluye el scope que crea el for symbolTable.CloseCurrentScope(); ///si el ForBody evalúa de error este también if (Object.Equals(ForBody.NodeInfo, SemanticInfo.SemanticError)) { ///el nodo evalúa de error NodeInfo = SemanticInfo.SemanticError; return; } ///seteamos la información del NodeInfo NodeInfo.BuiltInType = BuiltInType.Void; NodeInfo.Type = SemanticInfo.Void; ///el ForBody no puede retornar valor if (ForBody.NodeInfo.BuiltInType.IsReturnType()) { errors.Add(new CompileError { Line = ForBody.Line, Column = ForBody.CharPositionInLine, ErrorMessage = "Body of control instruction 'for' cannot return value", Kind = ErrorKind.Semantic }); ///el nodo evalúa de error NodeInfo = SemanticInfo.SemanticError; } }
public override void GenerateCode(ILCodeGenerator cg) { ///el for crea su scope(en IL) cg.ILGenerator.BeginScope(); ///creamos un nuevo contexto cg.ILContextTable.InitNewContext(); ///definimos los labels necesarios en el ciclo Label forCondLabel = cg.ILGenerator.DefineLabel(); Label forEndLabel = cg.ILGenerator.DefineLabel(); ///guardamos el label a donde vamos a saltar cg.EndLoopLabelStack.Push(forEndLabel); ///declaramos la variable local de iteracion del for ILElementInfo forloopVariable = cg.ILContextTable.InsertILElement(LoopVariable, new ILElementInfo { LocalBuilder = cg.ILGenerator.DeclareLocal(typeof(int)), ElementKind = SymbolKind.Variable }); ///declaramamos una varaible que representa a EndIndex ILElementInfo endLoopVariable = cg.ILContextTable.InsertILElement("endLoopVariable", new ILElementInfo { LocalBuilder = cg.ILGenerator.DeclareLocal(typeof(int)), ElementKind = SymbolKind.Variable }); ///generamos la expresion de fin y la almacenamos EndIndex.GenerateCode(cg); cg.ILGenerator.Emit(OpCodes.Ldc_I4_1); cg.ILGenerator.Emit(OpCodes.Add); cg.ILGenerator.Emit(OpCodes.Stloc, endLoopVariable.LocalBuilder); ///generamos la expresion de inicializacion y lo almacenamos StartIndex.GenerateCode(cg); cg.ILGenerator.Emit(OpCodes.Stloc, forloopVariable.LocalBuilder); ///condition del for cg.ILGenerator.MarkLabel(forCondLabel); cg.ILGenerator.Emit(OpCodes.Ldloc, forloopVariable.LocalBuilder); cg.ILGenerator.Emit(OpCodes.Ldloc, endLoopVariable.LocalBuilder); ///si no se cumple la condition, saltamos al fin del ciclo cg.ILGenerator.Emit(OpCodes.Clt); cg.ILGenerator.Emit(OpCodes.Brfalse, forEndLabel); ///generamos el codigo del cuerpo ForBody.GenerateCode(cg); ///incrementamos la variable del ciclo cg.ILGenerator.Emit(OpCodes.Ldloc, forloopVariable.LocalBuilder); cg.ILGenerator.Emit(OpCodes.Ldc_I4_1); cg.ILGenerator.Emit(OpCodes.Add); cg.ILGenerator.Emit(OpCodes.Stloc, forloopVariable.LocalBuilder); ///saltamos a la condicion del for cg.ILGenerator.Emit(OpCodes.Br, forCondLabel); ///ponemos la variable de fin de ciclo cg.ILGenerator.MarkLabel(forEndLabel); ///sacamos el label guardado cg.EndLoopLabelStack.Pop(); ///cerramos el contexto cg.ILContextTable.CloseCurrentContext(); ///cerramos el scope del for(en IL) cg.ILGenerator.EndScope(); }
public override string ToString() { return(string.Concat(_tree.Word.Substring(StartIndex, (EndIndex ?? _tree.CurrentSuffixEndIndex) - StartIndex + 1), "(", StartIndex, ",", EndIndex.HasValue ? EndIndex.ToString() : "#", ")")); }
public DataSet CreatSource() { RecordCount = GetRecordCount(); PageCount = (RecordCount % PageSize) == 0 ? RecordCount / PageSize : RecordCount / PageSize + 1; int StartIndex, EndIndex; StartIndex = CurrentPage * PageSize; EndIndex = (CurrentPage + 1) * PageSize + 1; string strSQL = "SELECT * FROM (SELECT ROW_NUMBER() OVER(" + SQLOrder + ")ROWNUMBER, *FROM " + DatabaseTable + " " + SQLCondition + ")A WHERE ROWNUMBER > " + StartIndex.ToString() + " AND ROWNUMBER < " + EndIndex.ToString(); DataSet dataSet = DAL.SQLHelper.GetDataSet(strSQL); GeneratePager(); PagerState(); return(dataSet); }
/// <summary> /// Returns true if DetailedSegmentEffort instances are equal /// </summary> /// <param name="other">Instance of DetailedSegmentEffort to be compared</param> /// <returns>Boolean</returns> public bool Equals(DetailedSegmentEffort other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Activity == other.Activity || Activity != null && Activity.Equals(other.Activity) ) && ( Athlete == other.Athlete || Athlete != null && Athlete.Equals(other.Athlete) ) && ( MovingTime == other.MovingTime || MovingTime != null && MovingTime.Equals(other.MovingTime) ) && ( StartIndex == other.StartIndex || StartIndex != null && StartIndex.Equals(other.StartIndex) ) && ( EndIndex == other.EndIndex || EndIndex != null && EndIndex.Equals(other.EndIndex) ) && ( AverageCadence == other.AverageCadence || AverageCadence != null && AverageCadence.Equals(other.AverageCadence) ) && ( AverageWatts == other.AverageWatts || AverageWatts != null && AverageWatts.Equals(other.AverageWatts) ) && ( DeviceWatts == other.DeviceWatts || DeviceWatts != null && DeviceWatts.Equals(other.DeviceWatts) ) && ( AverageHeartrate == other.AverageHeartrate || AverageHeartrate != null && AverageHeartrate.Equals(other.AverageHeartrate) ) && ( MaxHeartrate == other.MaxHeartrate || MaxHeartrate != null && MaxHeartrate.Equals(other.MaxHeartrate) ) && ( Segment == other.Segment || Segment != null && Segment.Equals(other.Segment) ) && ( KomRank == other.KomRank || KomRank != null && KomRank.Equals(other.KomRank) ) && ( PrRank == other.PrRank || PrRank != null && PrRank.Equals(other.PrRank) ) && ( Hidden == other.Hidden || Hidden != null && Hidden.Equals(other.Hidden) )); }
/// <summary> /// Returns true if Lap instances are equal /// </summary> /// <param name="other">Instance of Lap to be compared</param> /// <returns>Boolean</returns> public bool Equals(Lap other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Activity == other.Activity || Activity != null && Activity.Equals(other.Activity) ) && ( Athlete == other.Athlete || Athlete != null && Athlete.Equals(other.Athlete) ) && ( AverageCadence == other.AverageCadence || AverageCadence != null && AverageCadence.Equals(other.AverageCadence) ) && ( AverageSpeed == other.AverageSpeed || AverageSpeed != null && AverageSpeed.Equals(other.AverageSpeed) ) && ( Distance == other.Distance || Distance != null && Distance.Equals(other.Distance) ) && ( ElapsedTime == other.ElapsedTime || ElapsedTime != null && ElapsedTime.Equals(other.ElapsedTime) ) && ( StartIndex == other.StartIndex || StartIndex != null && StartIndex.Equals(other.StartIndex) ) && ( EndIndex == other.EndIndex || EndIndex != null && EndIndex.Equals(other.EndIndex) ) && ( LapIndex == other.LapIndex || LapIndex != null && LapIndex.Equals(other.LapIndex) ) && ( MaxSpeed == other.MaxSpeed || MaxSpeed != null && MaxSpeed.Equals(other.MaxSpeed) ) && ( MovingTime == other.MovingTime || MovingTime != null && MovingTime.Equals(other.MovingTime) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( PaceZone == other.PaceZone || PaceZone != null && PaceZone.Equals(other.PaceZone) ) && ( Split == other.Split || Split != null && Split.Equals(other.Split) ) && ( StartDate == other.StartDate || StartDate != null && StartDate.Equals(other.StartDate) ) && ( StartDateLocal == other.StartDateLocal || StartDateLocal != null && StartDateLocal.Equals(other.StartDateLocal) ) && ( TotalElevationGain == other.TotalElevationGain || TotalElevationGain != null && TotalElevationGain.Equals(other.TotalElevationGain) )); }
public IEnumerable <ChannelMessageHeader> GetHeaders() { var set = new IMAP_SequenceSet(String.Format("{0}:{1}", StartIndex <= 1 ? 1 : StartIndex, EndIndex < 0 ? "*" : EndIndex.ToString())); return(FetchImapSet(set)); }
/// <summary> /// This is a tricky functions /// it returns Vector if components are Scalars. /// Matrix if components are Vectors /// </summary> /// <param name="fromIndex"></param> /// <param name="toIndex"></param> /// <returns></returns> public QsValue QsValueElements(int fromIndex, int toIndex) { if (this.Parameters.Length > 0) { List <string> ProcessedElements = new List <string>(); #region symbolic representation if (fromIndex > toIndex) { for (int e_ix = fromIndex; e_ix >= toIndex; e_ix--) { var se = GetElement(e_ix); // s[n](x) ..> $x*x^n+$n # symbolic variables shouldn't be changed ($x, $n) we should take care. // first preserve the symbolic variable with the same index name that we are going to change. string se_text = se.ElementDeclaration.Replace("$" + this.SequenceIndexName, "`"); // replace the index name with the se_text = se_text.Replace(this.SequenceIndexName, e_ix.ToString(CultureInfo.InvariantCulture)); // get back the symbolic se_text = se_text.Replace("`", "$" + this.SequenceIndexName); if (!string.IsNullOrEmpty(SequenceRangeStartName)) { se_text = se_text.Replace("$" + SequenceRangeStartName, "`"); se_text = se_text.Replace(SequenceRangeStartName, StartIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeStartName); } if (!string.IsNullOrEmpty(SequenceRangeEndName)) { se_text = se_text.Replace("$" + SequenceRangeEndName, "`"); se_text = se_text.Replace(SequenceRangeEndName, EndIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeEndName); } // replace the parameters in declaration with the same foreach (var param in this.Parameters) { se_text = se_text.Replace("$" + param.Name, "`"); se_text = se_text.Replace(param.Name, "$" + param.Name); se_text = se_text.Replace("`", "$" + param.Name); } ProcessedElements.Add(se_text); } } else { for (int e_ix = fromIndex; e_ix <= toIndex; e_ix++) { var se = GetElement(e_ix); string se_text = se.ElementDeclaration.Replace("$" + this.SequenceIndexName, "`"); se_text = se_text.Replace(this.SequenceIndexName, e_ix.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + this.SequenceIndexName); if (!string.IsNullOrEmpty(SequenceRangeStartName)) { se_text = se_text.Replace("$" + SequenceRangeStartName, "`"); se_text = se_text.Replace(SequenceRangeStartName, StartIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeStartName); } if (!string.IsNullOrEmpty(SequenceRangeEndName)) { se_text = se_text.Replace("$" + SequenceRangeEndName, "`"); se_text = se_text.Replace(SequenceRangeEndName, EndIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeEndName); } // replace the parameters with names foreach (var param in this.Parameters) { se_text = se_text.Replace("$" + param.Name, "`"); se_text = se_text.Replace(param.Name, "$" + param.Name); se_text = se_text.Replace("`", "$" + param.Name); } ProcessedElements.Add(se_text); } } var ee = QsEvaluator.CurrentEvaluator.SilentEvaluate(ProcessedElements[0]); QsValue Total; if (ee is QsScalar) { Total = new QsVector(System.Math.Abs(toIndex - fromIndex) + 1); foreach (string pel in ProcessedElements) { ((QsVector)Total).AddComponent((QsScalar)QsEvaluator.CurrentEvaluator.SilentEvaluate(pel)); } } else if (ee is QsVector) { Total = new QsMatrix(); foreach (string pel in ProcessedElements) { ((QsMatrix)Total).AddVector((QsVector)QsEvaluator.CurrentEvaluator.SilentEvaluate(pel)); } } else if (ee is QsMatrix) { Total = new QsTensor(); foreach (string pel in ProcessedElements) { ((QsTensor)Total).AddMatrix((QsMatrix)QsEvaluator.CurrentEvaluator.SilentEvaluate(pel)); } } else { throw new QsException("This is enough, no more than matrix values please."); } #endregion return(Total); } QsValue firstElement = (QsValue)GetElementValue(fromIndex); if (firstElement is QsScalar) { //return vector QsVector Total = new QsVector(System.Math.Abs(toIndex - fromIndex) + 1); #region Numerical Representation Total.AddComponent((QsScalar)firstElement); if (toIndex >= fromIndex) { for (int i = fromIndex + 1; i <= toIndex; i++) { Total.AddComponent((QsScalar)GetElementValue(i)); } } else { for (int i = fromIndex - 1; i >= toIndex; i--) { Total.AddComponent((QsScalar)GetElementValue(i)); } } #endregion return(Total); } else if (firstElement is QsVector) { //return vector QsMatrix Total = new QsMatrix(); Total.AddVector((QsVector)firstElement); if (toIndex >= fromIndex) { for (int i = fromIndex + 1; i <= toIndex; i++) { Total.AddVector((QsVector)GetElementValue(i)); } } else { for (int i = fromIndex - 1; i >= toIndex; i--) { Total.AddVector((QsVector)GetElementValue(i)); } } return(Total); } else if (firstElement is QsMatrix) { throw new NotImplementedException(); } else { throw new NotSupportedException(); } }
/// <summary> /// Gets the element quantity and employ cach /// </summary> /// <param name="index"></param> /// <returns></returns> public QsValue GetElementValue(int index) { QsValue val; if (CachingEnabled) { if (CachedValues.TryGetValue(index, out val)) { return(val); } } if (this.Parameters.Length > 0) { // this is a call to form symbolic element // like g[n](x) ..> x^n // and calling g[2] // the output should be x^2 // and be parsed into function (QsFunction) var e = GetElement(index); string se_text = e.ElementDeclaration.Replace("$" + this.SequenceIndexName, "`"); se_text = se_text.Replace(this.SequenceIndexName, index.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + this.SequenceIndexName); if (!string.IsNullOrEmpty(SequenceRangeStartName)) { se_text = se_text.Replace("$" + SequenceRangeStartName, "`"); se_text = se_text.Replace(SequenceRangeStartName, StartIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeStartName); } if (!string.IsNullOrEmpty(SequenceRangeEndName)) { se_text = se_text.Replace("$" + SequenceRangeEndName, "`"); se_text = se_text.Replace(SequenceRangeEndName, EndIndex.ToString(CultureInfo.InvariantCulture)); se_text = se_text.Replace("`", "$" + SequenceRangeEndName); } var FunctionBody = se_text; string porma = string.Empty; // the parameters separated by comma ',' foreach (var prm in this.Parameters) { porma += prm.Name + ", "; } porma = porma.TrimEnd(',', ' '); string FunctionDeclaration = "_(" + porma + ") = " + FunctionBody; QsFunction qs = QsFunction.ParseFunction(QsEvaluator.CurrentEvaluator, FunctionDeclaration); return(new QsScalar(ScalarTypes.FunctionQuantity) { FunctionQuantity = qs.ToQuantity() }); } else { val = GetElement(index).Execute(index); } if (CachingEnabled) { CachedValues[index] = val; } return(val); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Activity != null) { hashCode = hashCode * 59 + Activity.GetHashCode(); } if (Athlete != null) { hashCode = hashCode * 59 + Athlete.GetHashCode(); } if (MovingTime != null) { hashCode = hashCode * 59 + MovingTime.GetHashCode(); } if (StartIndex != null) { hashCode = hashCode * 59 + StartIndex.GetHashCode(); } if (EndIndex != null) { hashCode = hashCode * 59 + EndIndex.GetHashCode(); } if (AverageCadence != null) { hashCode = hashCode * 59 + AverageCadence.GetHashCode(); } if (AverageWatts != null) { hashCode = hashCode * 59 + AverageWatts.GetHashCode(); } if (DeviceWatts != null) { hashCode = hashCode * 59 + DeviceWatts.GetHashCode(); } if (AverageHeartrate != null) { hashCode = hashCode * 59 + AverageHeartrate.GetHashCode(); } if (MaxHeartrate != null) { hashCode = hashCode * 59 + MaxHeartrate.GetHashCode(); } if (Segment != null) { hashCode = hashCode * 59 + Segment.GetHashCode(); } if (KomRank != null) { hashCode = hashCode * 59 + KomRank.GetHashCode(); } if (PrRank != null) { hashCode = hashCode * 59 + PrRank.GetHashCode(); } if (Hidden != null) { hashCode = hashCode * 59 + Hidden.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return(StartIndex.GetHashCode() * 13 ^ EndIndex.GetHashCode()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Activity != null) { hashCode = hashCode * 59 + Activity.GetHashCode(); } if (Athlete != null) { hashCode = hashCode * 59 + Athlete.GetHashCode(); } if (AverageCadence != null) { hashCode = hashCode * 59 + AverageCadence.GetHashCode(); } if (AverageSpeed != null) { hashCode = hashCode * 59 + AverageSpeed.GetHashCode(); } if (Distance != null) { hashCode = hashCode * 59 + Distance.GetHashCode(); } if (ElapsedTime != null) { hashCode = hashCode * 59 + ElapsedTime.GetHashCode(); } if (StartIndex != null) { hashCode = hashCode * 59 + StartIndex.GetHashCode(); } if (EndIndex != null) { hashCode = hashCode * 59 + EndIndex.GetHashCode(); } if (LapIndex != null) { hashCode = hashCode * 59 + LapIndex.GetHashCode(); } if (MaxSpeed != null) { hashCode = hashCode * 59 + MaxSpeed.GetHashCode(); } if (MovingTime != null) { hashCode = hashCode * 59 + MovingTime.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (PaceZone != null) { hashCode = hashCode * 59 + PaceZone.GetHashCode(); } if (Split != null) { hashCode = hashCode * 59 + Split.GetHashCode(); } if (StartDate != null) { hashCode = hashCode * 59 + StartDate.GetHashCode(); } if (StartDateLocal != null) { hashCode = hashCode * 59 + StartDateLocal.GetHashCode(); } if (TotalElevationGain != null) { hashCode = hashCode * 59 + TotalElevationGain.GetHashCode(); } return(hashCode); } }