Ejemplo n.º 1
0
 public int CompareTo(FuriganaPart other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }
 public override string ToString()
 {
     return(string.Format(@"new AFHSBEntry(){{ AFHSBCrossTabFieldName = ""{0}"", StartIndex = {1}, AFHSBOutputLength = {2}, CrossTabFieldName = ""{3}"", Ordinal = {4}}},", AFHSBCrossTabFieldName, StartIndex.ToString(), AFHSBOutputLength, CrossTabFieldName, Ordinal));
 }
Ejemplo n.º 3
0
 public override string ToString()
 {
     return(StartIndex.ToString() + "; " + Text);
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            var result = PerformSubstring(Text.Get <string>(executionContext), StartIndex.Get <int>(executionContext), Length.Get <int>(executionContext), LeftToRight.Get <bool>(executionContext));

            Result.Set(executionContext, result);
        }
Ejemplo n.º 7
0
 public override int GetHashCode()
 {
     return(Length.GetHashCode() ^ StartIndex.GetHashCode());
 }
Ejemplo n.º 8
0
 /// <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);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Executes the workflow activity.
        /// </summary>
        /// <param name="cube">The cube.</param>
        protected override void Execute(CubeBase Cube)
        {
            var    executionContext = (ActivityContext)Cube.BaseSystemObject;
            string result           = PerformSubstring(pText.Get <string>(executionContext), StartIndex.Get <int>(executionContext), Length.Get <int>(executionContext), LeftToRight.Get <bool>(executionContext));

            pResult.Set(executionContext, result);
        }
        /// <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();
            }
        }
Ejemplo n.º 11
0
        /// <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)
                 ));
        }
Ejemplo n.º 12
0
        /// <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);
        }
Ejemplo n.º 13
0
 /// <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);
     }
 }
Ejemplo n.º 14
0
        /// <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)
                 ));
        }
Ejemplo n.º 15
0
 public virtual int CompareTo(TwitterEntity other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }
Ejemplo n.º 16
0
    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);
    }
Ejemplo n.º 17
0
 public override int GetHashCode()
 {
     return(Palindrome.GetHashCode() ^ StartIndex.GetHashCode() ^ EndIndex.GetHashCode());
 }
Ejemplo n.º 18
0
 public int CompareTo(CacheRegion other)
 {
     return(StartIndex.CompareTo(other.StartIndex));
 }