Ejemplo n.º 1
0
        public int CompareTo(QuestionContent other)
        {
            if (this.Content != other.Content)
            {
                return(this.Content.Length - other.Content.Length);
            }

            if (this.QuestionPartCollection.Count != other.QuestionPartCollection.Count)
            {
                return(this.QuestionPartCollection.Count - other.QuestionPartCollection.Count);
            }

            for (int i = 0; i < this.QuestionPartCollection.Count; i++)
            {
                QuestionContentPart part      = this.QuestionPartCollection[i];
                QuestionContentPart partOther = other.QuestionPartCollection[i];
                int ret = part.CompareTo(partOther);
                if (ret != 0)
                {
                    return(ret);
                }
            }

            return(0);
        }
Ejemplo n.º 2
0
        public override int CompareTo(QuestionContentPart other)
        {
            if (this == other)
            {
                return(0);
            }

            if (!(other is QuestionContentPart))
            {
                return(-1);
            }

            QuestionFractionPart otherPart = other as QuestionFractionPart;
            int retDenominator             = this.denominator.CompareTo(otherPart.Denominator);
            int retNumertor = this.numerator.CompareTo(otherPart.Numerator);

            if (retDenominator == 0 && retNumertor == 0)
            {
                if (this.withPart != null &&
                    otherPart.WithPart != null)
                {
                    int retWithPart = this.withPart.CompareTo(otherPart.WithPart);
                    return(retWithPart);
                }
                else if (this.withPart != null ||
                         otherPart.WithPart != null)
                {
                    return(-1);
                }
                return(0);
            }

            return(-1);
        }
        public override int CompareTo(QuestionContentPart other)
        {
            if (this == other)
            {
                return(0);
            }

            if (!(other is ArithmeticDecimalValuePart))
            {
                return(-1);
            }

            ArithmeticDecimalValuePart valuePart = other as ArithmeticDecimalValuePart;

            if (this.Value == valuePart.value)
            {
                return(0);
            }
            else if (this.value > valuePart.value)
            {
                return(1);
            }

            return(-1);
        }
Ejemplo n.º 4
0
        public override int CompareTo(QuestionContentPart other)
        {
            if (other == this)
            {
                return(0);
            }

            return(-1);
        }
        public override int CompareTo(QuestionContentPart other)
        {
            if (!(other is QuestionFlowDocumentPart))
            {
                return(-1);
            }

            QuestionFlowDocumentPart flowDocumentPart = other as QuestionFlowDocumentPart;

            return(this.FlowDocument.CompareTo(flowDocumentPart.FlowDocument));
        }
Ejemplo n.º 6
0
        public object Clone()
        {
            QuestionContent newContent = new QuestionContent();

            newContent.Id          = this.Id;
            newContent.Content     = this.Content;
            newContent.ContentType = this.ContentType;
            foreach (QuestionContentPart part in this.QuestionPartCollection)
            {
                QuestionContentPart newPart = part.Clone() as QuestionContentPart;
                newContent.QuestionPartCollection.Add(newPart);
            }

            return(newContent);
        }
Ejemplo n.º 7
0
        public override int CompareTo(QuestionContentPart other)
        {
            if (this == other)
            {
                return(0);
            }

            if (!(other is ArithmeticSignPart))
            {
                return(-1);
            }

            ArithmeticSignPart signOther = other as ArithmeticSignPart;

            return(this.Symbol - signOther.Symbol);
        }
Ejemplo n.º 8
0
        public override int CompareTo(QuestionContentPart other)
        {
            if (this == other)
            {
                return(0);
            }

            if (!(other is QuestionTextPart))
            {
                return(-1);
            }

            QuestionTextPart textPart = other as QuestionTextPart;

            return(this.text.CompareTo(textPart.Text));
        }
Ejemplo n.º 9
0
        public override int CompareTo(QuestionContentPart other)
        {
            if (this == other)
            {
                return(0);
            }

            if (!(other is QuestionPowerPart))
            {
                return(-1);
            }

            QuestionPowerPart otherPower = other as QuestionPowerPart;

            return(this.Content.CompareTo(otherPower.Content));
        }
        public override int CompareTo(QuestionContentPart other)
        {
            if (!(other is ArithmeticFractionValuePart))
            {
                return(-1);
            }

            ArithmeticFractionValuePart otherFraction = other as ArithmeticFractionValuePart;
            double rateThis  = decimal.ToDouble(this.Numerator) / decimal.ToDouble(this.Denominator);
            double rateOther = decimal.ToDouble(otherFraction.Numerator) / decimal.ToDouble(otherFraction.Denominator);

            if (rateThis == rateOther)
            {
                return(0);
            }
            if (rateThis > rateOther)
            {
                return(1);
            }

            return(-1);
        }
        public override int CompareTo(QuestionContentPart other)
        {
            /*
             * QuestionPowerExponentPart part = new QuestionPowerExponentPart();
             * part.BaseNumber = new QuestionContent();
             *
             * QuestionPowerExponentPart part1 = new QuestionPowerExponentPart();
             * part.BaseNumber.QuestionPartCollection.Add(part1);
             * part.BaseNumber.Content += part1.PlaceHolder;
             *
             * part.BaseNumber.Content += "-";
             *
             * part.Power.Power
             * */

            if (this == other)
            {
                return(0);
            }

            if (!(other is QuestionPowerExponentPart))
            {
                return(-1);
            }

            QuestionPowerExponentPart otherPart = other as QuestionPowerExponentPart;
            int retBase  = this.baseNumber.CompareTo(otherPart.BaseNumber);
            int retPower = this.power.CompareTo(otherPart.Power);

            if (retBase == 0 && retPower == 0)
            {
                return(0);
            }

            return(-1);
        }