/// <summary>
        /// Initializes a new instance of the <see cref="AccordanceIntervalsManager"/> class.
        /// </summary>
        /// <param name="firstChain">
        /// The first chain.
        /// </param>
        /// <param name="secondChain">
        /// The second chain.
        /// </param>
        public AccordanceIntervalsManager(CongenericChain firstChain, CongenericChain secondChain)
        {
            this.firstChain = firstChain;
            this.secondChain = secondChain;
            Length = firstChain.GetLength();
            FirstOccurrencesCount = firstChain.OccurrencesCount;
            SecondOccurrencesCount = secondChain.OccurrencesCount;

            FillAccordanceIntervals();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BinaryIntervalsManager"/> class.
        /// </summary>
        /// <param name="firstChain">
        /// The first chain.
        /// </param>
        /// <param name="secondChain">
        /// The second chain.
        /// </param>
        public BinaryIntervalsManager(CongenericChain firstChain, CongenericChain secondChain)
        {
            FirstElement = firstChain.Element;
            SecondElement = secondChain.Element;
            FirstChain = firstChain;
            SecondChain = secondChain;
            Length = firstChain.GetLength();

            PairsCount = FillPairsCount();
            relationIntervals = new int[PairsCount];
            FillIntervals();
        }
        /// <summary>
        /// Calculation method.
        /// </summary>
        /// <param name="chain">
        /// Source sequence.
        /// </param>
        /// <param name="link">
        /// Link of intervals in chain.
        /// </param>
        /// <returns>
        /// Variations count as <see cref="double"/>.
        /// </returns>
        public double Calculate(CongenericChain chain, Link link)
        {
            int count = 1;
            for (int i = 0; i < chain.GetLength(); i++)
            {
                var j = chain[i] as ValuePhantom;
                if (j != null)
                {
                    count *= ((ValuePhantom)chain[i]).Cardinality;
                }
            }

            return count;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CongenericIntervalsManager"/> class.
        /// </summary>
        /// <param name="chain">
        /// The chain.
        /// </param>
        public CongenericIntervalsManager(CongenericChain chain)
        {
            var positions = chain.Positions;
            int count = positions.Length;

            // if sequence is empty
            if (count == 0)
            {
                throw new ArgumentException("Sequence should not be empty", "chain");
            }

            intervals = new int[count - 1];
            FillIntervals(positions, chain.GetLength());
        }
 /// <summary>
 /// Calculation method.
 /// </summary>
 /// <param name="chain">
 /// Source sequence.
 /// </param>
 /// <param name="link">
 /// Redundant parameter, not used in calculations.
 /// </param>
 /// <returns>
 /// Cut length vocabulary entropy as <see cref="double"/>.
 /// </returns>
 public double Calculate(CongenericChain chain, Link link)
 {
     return Math.Log(chain.GetLength() - cutLength.Calculate(chain, link) + 1, 2);
 }
Пример #6
0
 /// <summary>
 /// Calculation method.
 /// </summary>
 /// <param name="chain">
 /// Source sequence.
 /// </param>
 /// <param name="link">
 /// Redundant parameter, not used in calculations.
 /// </param>
 /// <returns>
 /// Chain length as <see cref="double"/>.
 /// </returns>
 public double Calculate(CongenericChain chain, Link link)
 {
     return chain.GetLength();
 }