Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     higher       = GetComponent <Higher>();
     selectedCard = this.gameObject;
     cameFromOtherDefaultBehavior = false;
     indexOfSelectedCard          = 0;
 }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     ComputerScoreKeeper.scoreValue = 0;
     PlayerScoreKeeper.scoreValue   = 0;
     higher = GetComponent <Higher>();
     determineMatchEndScreen();
 }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputNumber">buffer length 3</param>
        /// <param name="segmentNum"></param>
        /// <returns></returns>
        private static void SegmentToStringLower(ref byte[] segmentBuffer, TextWriter outputStream, int zerosAfterCurrentSegment)
        {
            if (segmentBuffer[0] != 0)
            { // 100 - 900 -> hundredths place
                outputStream.Write(Lower[segmentBuffer[0]]);
                outputStream.Write(wordSeparator);
                outputStream.Write(Higher.First().Key);

                if (segmentBuffer[1] != 0 || segmentBuffer [2] != 0)
                {
                    outputStream.Write(wordSeparator);
                }
            }
            if (segmentBuffer[1] != 0)
            { // 10 - 99
                segmentBuffer[1] *= 10;
                if (segmentBuffer[1] == 10)
                { // 10 - 19
                    outputStream.Write(Lower[segmentBuffer[1] + segmentBuffer[2]]);
                }
                else
                { // 20 - 99
                    outputStream.Write(Lower[segmentBuffer[1]]);
                    outputStream.Write(wordJoiner);
                    outputStream.Write(Lower[segmentBuffer[2]]);
                }
            }
            else if (segmentBuffer[2] != 0)
            { // 1 - 9
                outputStream.Write(Lower[segmentBuffer[2]]);
            }

            SegmentToStringHigher(outputStream, zerosAfterCurrentSegment);
        }
Exemplo n.º 4
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Higher.GetHashCode();
         hashCode = (hashCode * 397) ^ Lower.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 5
0
        private static void SegmentToStringHigher(TextWriter outputStream, int zerosAfterCurrentSegment)
        {
            var countMaxKey = 0;
            var numOfZeros  = zerosAfterCurrentSegment;

            // find and remove largest values possible
            // since smaller values must be first
            {
                var maxSet = Higher.Last().Value;
                while (numOfZeros > maxSet)
                {
                    countMaxKey++;
                    numOfZeros -= maxSet;
                }
            }

            // find smaller values based on wether they can be found
            // in the subset or must be calculated with smaller values to reach exact number
            if (numOfZeros > 0)
            {
                if (numOfZeros % 3 == 0)
                {
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher[numOfZeros]);
                }
                else if (numOfZeros % 3 == 1)
                {
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher.First().Key);
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher.First().Key);
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher[numOfZeros - 4]);
                }
                else// == 2
                {
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher.First().Key);
                    outputStream.Write(wordSeparator);
                    outputStream.Write(Higher[numOfZeros - 2]);
                }
            }
            var maxValue = Higher.Last().Key;

            for (var j = 0; j < countMaxKey; j++)
            {
                outputStream.Write(wordSeparator);
                outputStream.Write(maxValue);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Convert a word to a number
        /// </summary>
        /// <param name="NumberChunk">Section of a number word e.g. One-Hundred is two chunks [One, Hundred]</param>
        /// <returns></returns>
        public static BigInteger ConvertToNumber(IEnumerable <string> NumberChunk)
        {
            var total = BigInteger.Zero;

            var _sto = BigInteger.Zero;
            var tmp  = NumberChunk;

            var isNegative = false;

            foreach (var item in NumberChunk)
            {
                if (Lower.TryGetValue(item, out var lowerNum))
                {
                    // if here again then count number
                    total += _sto;

                    // here then number
                    _sto = lowerNum;
                }
                else if (Higher.TryGetValue(item, out var higherNum))
                {
                    // multiply previous number
                    var zeroHolder = BigInteger.Pow(new BigInteger(10), higherNum);

                    if (_sto.IsZero)
                    {
                        throw new ArgumentException("Invalid number format.");
                    }

                    _sto = BigInteger.Multiply(zeroHolder, _sto);
                }
                else if (item.Equals("Negative"))
                {
                    isNegative = true;
                }
            }
            total += _sto;

            if (isNegative)
            {
                total *= -1;
            }

            return(total);
        }
Exemplo n.º 7
0
            /// <summary>
            /// Gets the vertex buffer for the specified level.
            /// </summary>
            public VBO <ColorNormalVertex> GetLevel(int Level, Polarity Direction)
            {
                if (Direction == Polarity.Negative)
                {
                    Level--;
                }
                VBO <ColorNormalVertex> c = this._Levels[Level, (int)Direction];

                if (c == null)
                {
                    IIterator <ColorNormalVertex, VBO <ColorNormalVertex> > vboc = VBO <ColorNormalVertex> .Create();

                    IBoundedPlaneSurface <Material> bps = Shape.Slice(this._StratifiedRenderer._Source, this._Axis, Level, delegate(T Lower, T Higher, Axis Axis)
                    {
                        if (Direction == Polarity.Positive && !Higher.Equals(this._StratifiedRenderer._Default))
                        {
                            return(this._StratifiedRenderer._SurfacizeFunc(Lower, this._StratifiedRenderer._Default, Axis));
                        }
                        if (Direction == Polarity.Negative && !Lower.Equals(this._StratifiedRenderer._Default))
                        {
                            return(this._StratifiedRenderer._SurfacizeFunc(this._StratifiedRenderer._Default, Higher, Axis));
                        }
                        return(Material.Default);
                    }, Material.Default);

                    QuadtreeSurface <Material> qs = bps.Extend <QuadtreeSurface <Material> >();
                    if (qs != null)
                    {
                        StaticRenderer.Send(qs, vboc, vboc);
                    }
                    else
                    {
                        StaticRenderer.Send(bps, vboc);
                    }

                    this._Levels[Level, (int)Direction] = c = vboc.End();
                }
                return(c);
            }
Exemplo n.º 8
0
        private Block SearchThroughCompanionBuddies(long requestedCapacity)
        {
            if (Lower != null)
            {
                Block lowerResult = Lower.Allocate(requestedCapacity);

                if (lowerResult != null)
                {
                    return(lowerResult);
                }
            }

            if (Higher != null)
            {
                Block higherResult = Higher.Allocate(requestedCapacity);

                if (higherResult != null)
                {
                    return(higherResult);
                }
            }

            return(null);
        }
Exemplo n.º 9
0
 // Start is called before the first frame update
 void Start()
 {
     higher     = GetComponent <Higher>();
     selectable = GetComponent <Selectable>();
 }
Exemplo n.º 10
0
        internal string _ToString(bool shortVariant, Pullenti.Morph.MorphLang lang, int lev, int fromRange)
        {
            StringBuilder   res = new StringBuilder();
            DatePointerType p   = Pointer;

            if (lang == null)
            {
                lang = Pullenti.Morph.MorphLang.RU;
            }
            if (IsRelative)
            {
                if (Pointer == DatePointerType.Today)
                {
                    res.AppendFormat("сейчас");
                    if (!shortVariant)
                    {
                        Pullenti.Ner.Date.Internal.DateRelHelper.AppendToString(this, res);
                    }
                    return(res.ToString());
                }
                string word       = null;
                int    val        = 0;
                bool   back       = false;
                bool   isLocalRel = this.GetStringValue(ATTR_ISRELATIVE) == "true";
                foreach (Pullenti.Ner.Slot s in Slots)
                {
                    if (s.TypeName == ATTR_CENTURY)
                    {
                        word = "век";
                        int.TryParse(s.Value as string, out val);
                    }
                    else if (s.TypeName == ATTR_YEAR)
                    {
                        word = "год";
                        int.TryParse(s.Value as string, out val);
                    }
                    else if (s.TypeName == ATTR_MONTH)
                    {
                        word = "месяц";
                        int.TryParse(s.Value as string, out val);
                        if (!isLocalRel && val >= 1 && val <= 12)
                        {
                            res.Append(m_Month0[val - 1]);
                        }
                    }
                    else if (s.TypeName == ATTR_DAY)
                    {
                        word = "день";
                        int.TryParse(s.Value as string, out val);
                        if ((!isLocalRel && Month > 0 && Month <= 12) && Higher != null && Higher.GetStringValue(ATTR_ISRELATIVE) != "true")
                        {
                            res.AppendFormat("{0} {1}", val, m_Month[Month - 1]);
                        }
                        else if (!isLocalRel)
                        {
                            res.AppendFormat("{0} число", val);
                        }
                    }
                    else if (s.TypeName == ATTR_QUARTAL)
                    {
                        word = "квартал";
                        int.TryParse(s.Value as string, out val);
                    }
                    else if (s.TypeName == ATTR_WEEK)
                    {
                        word = "неделя";
                        int.TryParse(s.Value as string, out val);
                    }
                    else if (s.TypeName == ATTR_HOUR)
                    {
                        word = "час";
                        int.TryParse(s.Value as string, out val);
                        if (!isLocalRel)
                        {
                            res.AppendFormat("{0}:{1}", val.ToString("D02"), Minute.ToString("D02"));
                        }
                    }
                    else if (s.TypeName == ATTR_MINUTE)
                    {
                        word = "минута";
                        int.TryParse(s.Value as string, out val);
                    }
                    else if (s.TypeName == ATTR_DAYOFWEEK)
                    {
                        int.TryParse(s.Value as string, out val);
                        if (!isLocalRel)
                        {
                            res.Append((val >= 1 && val <= 7 ? m_WeekDayEx[val - 1] : "?"));
                        }
                        else
                        {
                            if (val < 0)
                            {
                                val  = -val;
                                back = true;
                            }
                            if (val >= 0 && val <= 7)
                            {
                                res.AppendFormat("{0} {1}", (val == 7 ? (back ? "прошлое" : "будущее") : ((val == 3 || val == 6) ? (back ? "прошлая" : "будущая") : (back ? "прошлый" : "будущий"))), m_WeekDayEx[val - 1]);
                                break;
                            }
                        }
                    }
                }
                if (word != null && isLocalRel)
                {
                    if (val == 0)
                    {
                        res.AppendFormat("{0} {1}", (word == "неделя" || word == "минута" ? "текущая" : "текущий"), word);
                    }
                    else if (val > 0 && !back)
                    {
                        res.AppendFormat("{0} {1} вперёд", val, Pullenti.Ner.Core.MiscHelper.GetTextMorphVarByCaseAndNumberEx(word, null, Pullenti.Morph.MorphNumber.Undefined, val.ToString()));
                    }
                    else
                    {
                        val = -val;
                        res.AppendFormat("{0} {1} назад", val, Pullenti.Ner.Core.MiscHelper.GetTextMorphVarByCaseAndNumberEx(word, null, Pullenti.Morph.MorphNumber.Undefined, val.ToString()));
                    }
                }
                else if (!isLocalRel && res.Length == 0)
                {
                    res.AppendFormat("{0} {1}", val, Pullenti.Ner.Core.MiscHelper.GetTextMorphVarByCaseAndNumberEx(word, null, Pullenti.Morph.MorphNumber.Undefined, val.ToString()));
                }
                if (!shortVariant)
                {
                    Pullenti.Ner.Date.Internal.DateRelHelper.AppendToString(this, res);
                }
                if (fromRange == 1)
                {
                    res.Insert(0, string.Format("{0} ", (lang.IsUa ? "з" : (lang.IsEn ? "from" : "с"))));
                }
                else if (fromRange == 2)
                {
                    res.Insert(0, (lang.IsEn ? "to " : "по "));
                }
                return(res.ToString());
            }
            if (fromRange == 1)
            {
                res.AppendFormat("{0} ", (lang.IsUa ? "з" : (lang.IsEn ? "from" : "с")));
            }
            else if (fromRange == 2)
            {
                res.AppendFormat((lang.IsEn ? "to " : "по "));
            }
            if (p != DatePointerType.No)
            {
                string val = (string)Pullenti.Ner.Date.Internal.MetaDate.Pointer.ConvertInnerValueToOuterValue(p.ToString(), lang);
                if (fromRange == 0 || lang.IsEn)
                {
                }
                else if (fromRange == 1)
                {
                    if (p == DatePointerType.Begin)
                    {
                        val = (lang.IsUa ? "початку" : "начала");
                    }
                    else if (p == DatePointerType.Center)
                    {
                        val = (lang.IsUa ? "середини" : "середины");
                    }
                    else if (p == DatePointerType.End)
                    {
                        val = (lang.IsUa ? "кінця" : "конца");
                    }
                    else if (p == DatePointerType.Today)
                    {
                        val = (lang.IsUa ? "цього часу" : "настоящего времени");
                    }
                }
                else if (fromRange == 2)
                {
                    if (p == DatePointerType.Begin)
                    {
                        val = (lang.IsUa ? "початок" : "начало");
                    }
                    else if (p == DatePointerType.Center)
                    {
                        val = (lang.IsUa ? "середину" : "середину");
                    }
                    else if (p == DatePointerType.End)
                    {
                        val = (lang.IsUa ? "кінець" : "конец");
                    }
                    else if (p == DatePointerType.Today)
                    {
                        val = (lang.IsUa ? "теперішній час" : "настоящее время");
                    }
                }
                res.AppendFormat("{0} ", val);
            }
            if (DayOfWeek > 0)
            {
                if (lang.IsEn)
                {
                    res.AppendFormat("{0}, ", m_WeekDayEn[DayOfWeek - 1]);
                }
                else
                {
                    res.AppendFormat("{0}, ", m_WeekDay[DayOfWeek - 1]);
                }
            }
            int y    = Year;
            int m    = Month;
            int d    = Day;
            int cent = Century;

            if (y == 0 && cent != 0)
            {
                bool isBc = cent < 0;
                if (cent < 0)
                {
                    cent = -cent;
                }
                res.Append(Pullenti.Ner.Core.NumberHelper.GetNumberRoman(cent));
                if (lang.IsUa)
                {
                    res.Append(" century");
                }
                else if (m > 0 || p != DatePointerType.No || fromRange == 1)
                {
                    res.Append((lang.IsUa ? " віка" : " века"));
                }
                else
                {
                    res.Append((lang.IsUa ? " вік" : " век"));
                }
                if (isBc)
                {
                    res.Append((lang.IsUa ? " до н.е." : " до н.э."));
                }
                return(res.ToString());
            }
            if (d > 0)
            {
                res.Append(d);
            }
            if (m > 0 && m <= 12)
            {
                if (res.Length > 0 && res[res.Length - 1] != ' ')
                {
                    res.Append(' ');
                }
                if (lang.IsUa)
                {
                    res.Append((d > 0 || p != DatePointerType.No || fromRange != 0 ? m_MonthUA[m - 1] : m_Month0UA[m - 1]));
                }
                else if (lang.IsEn)
                {
                    res.Append(m_MonthEN[m - 1]);
                }
                else
                {
                    res.Append((d > 0 || p != DatePointerType.No || fromRange != 0 ? m_Month[m - 1] : m_Month0[m - 1]));
                }
            }
            if (y != 0)
            {
                bool isBc = y < 0;
                if (y < 0)
                {
                    y = -y;
                }
                if (res.Length > 0 && res[res.Length - 1] != ' ')
                {
                    res.Append(' ');
                }
                if (lang != null && lang.IsEn)
                {
                    res.AppendFormat("{0}", y);
                }
                else if (shortVariant)
                {
                    res.AppendFormat("{0}{1}", y, (lang.IsUa ? "р" : "г"));
                }
                else if (m > 0 || p != DatePointerType.No || fromRange == 1)
                {
                    res.AppendFormat("{0} {1}", y, (lang.IsUa ? "року" : "года"));
                }
                else
                {
                    res.AppendFormat("{0} {1}", y, (lang.IsUa ? "рік" : "год"));
                }
                if (isBc)
                {
                    res.Append((lang.IsUa ? " до н.е." : (lang.IsEn ? "BC" : " до н.э.")));
                }
            }
            int h  = Hour;
            int mi = Minute;
            int se = Second;

            if (h >= 0 && mi >= 0)
            {
                if (res.Length > 0)
                {
                    res.Append(' ');
                }
                res.AppendFormat("{0}:{1}", h.ToString("D02"), mi.ToString("D02"));
                if (se >= 0)
                {
                    res.AppendFormat(":{0}", se.ToString("D02"));
                }
            }
            if (res.Length == 0)
            {
                if (Quartal != 0)
                {
                    res.AppendFormat("{0}-й квартал", Quartal);
                }
            }
            if (res.Length == 0)
            {
                return("?");
            }
            while (res[res.Length - 1] == ' ' || res[res.Length - 1] == ',')
            {
                res.Length--;
            }
            if (!shortVariant && IsRelative)
            {
                Pullenti.Ner.Date.Internal.DateRelHelper.AppendToString(this, res);
            }
            return(res.ToString().Trim());
        }
Exemplo n.º 11
0
        public override bool CanBeEquals(Pullenti.Ner.Referent obj, Pullenti.Ner.Core.ReferentsEqualType typ)
        {
            PersonPropertyReferent pr = obj as PersonPropertyReferent;

            if (pr == null)
            {
                return(false);
            }
            string n1 = Name;
            string n2 = pr.Name;

            if (n1 == null || n2 == null)
            {
                return(false);
            }
            bool eqBosses = false;

            if (n1 != n2)
            {
                if (typ == Pullenti.Ner.Core.ReferentsEqualType.DifferentTexts)
                {
                    return(false);
                }
                if (m_Bosses0.Contains(n1) && m_Bosses1.Contains(n2))
                {
                    eqBosses = true;
                }
                else if (m_Bosses1.Contains(n1) && m_Bosses0.Contains(n2))
                {
                    eqBosses = true;
                }
                else
                {
                    if (!n1.StartsWith(n2 + " ") && !n2.StartsWith(n1 + " "))
                    {
                        return(false);
                    }
                    eqBosses = true;
                }
                for (PersonPropertyReferent hi = Higher; hi != null; hi = hi.Higher)
                {
                    if ((++_tmpStack) > 20)
                    {
                    }
                    else if (hi.CanBeEquals(pr, typ))
                    {
                        _tmpStack--;
                        return(false);
                    }
                    _tmpStack--;
                }
                for (PersonPropertyReferent hi = pr.Higher; hi != null; hi = hi.Higher)
                {
                    if ((++_tmpStack) > 20)
                    {
                    }
                    else if (hi.CanBeEquals(this, typ))
                    {
                        _tmpStack--;
                        return(false);
                    }
                    _tmpStack--;
                }
            }
            if (Higher != null && pr.Higher != null)
            {
                if ((++_tmpStack) > 20)
                {
                }
                else if (!Higher.CanBeEquals(pr.Higher, typ))
                {
                    _tmpStack--;
                    return(false);
                }
                _tmpStack--;
            }
            if (this.FindSlot("@GENERAL", null, true) != null || pr.FindSlot("@GENERAL", null, true) != null)
            {
                return(this.ToString() == pr.ToString());
            }
            if (this.FindSlot(ATTR_REF, null, true) != null || pr.FindSlot(ATTR_REF, null, true) != null)
            {
                List <object> refs1 = new List <object>();
                List <object> refs2 = new List <object>();
                foreach (Pullenti.Ner.Slot s in Slots)
                {
                    if (s.TypeName == ATTR_REF)
                    {
                        refs1.Add(s.Value);
                    }
                }
                foreach (Pullenti.Ner.Slot s in pr.Slots)
                {
                    if (s.TypeName == ATTR_REF)
                    {
                        refs2.Add(s.Value);
                    }
                }
                bool eq   = false;
                bool noeq = false;
                for (int i = 0; i < refs1.Count; i++)
                {
                    if (refs2.Contains(refs1[i]))
                    {
                        eq = true;
                        continue;
                    }
                    noeq = true;
                    if (refs1[i] is Pullenti.Ner.Referent)
                    {
                        foreach (object rr in refs2)
                        {
                            if (rr is Pullenti.Ner.Referent)
                            {
                                if ((rr as Pullenti.Ner.Referent).CanBeEquals(refs1[i] as Pullenti.Ner.Referent, typ))
                                {
                                    noeq = false;
                                    eq   = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                for (int i = 0; i < refs2.Count; i++)
                {
                    if (refs1.Contains(refs2[i]))
                    {
                        eq = true;
                        continue;
                    }
                    noeq = true;
                    if (refs2[i] is Pullenti.Ner.Referent)
                    {
                        foreach (object rr in refs1)
                        {
                            if (rr is Pullenti.Ner.Referent)
                            {
                                if ((rr as Pullenti.Ner.Referent).CanBeEquals(refs2[i] as Pullenti.Ner.Referent, typ))
                                {
                                    noeq = false;
                                    eq   = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (eq && !noeq)
                {
                }
                else if (noeq && ((eq || refs1.Count == 0 || refs2.Count == 0)))
                {
                    if (typ == Pullenti.Ner.Core.ReferentsEqualType.DifferentTexts || n1 != n2)
                    {
                        return(false);
                    }
                    if (Higher != null || pr.Higher != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else if (!eqBosses && n1 != n2)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 12
0
 // Start is called before the first frame update
 void Start()
 {
     higher       = GetComponent <Higher>();
     selectedCard = this.gameObject;
 }
Exemplo n.º 13
0
 private void Start()
 {
     higher = GetComponent <Higher>();
 }
Exemplo n.º 14
0
    // Start is called before the first frame update
    void Start()
    {
        playerInput = FindObjectOfType <PlayerInput>();
        List <string> deck = Higher.GenerateDeck();

        higher = FindObjectOfType <Higher>();

        int i = 0;

        foreach (string card in deck)
        {
            //print(card);
            if (this.name == "P1")
            {
                cardFace = higher.cardFaces[0];
                break;
            }

            if (this.name == "P2")
            {
                cardFace = higher.cardFaces[1];
                break;
            }

            if (this.name == "P3")
            {
                cardFace = higher.cardFaces[2];
                break;
            }

            if (this.name == "P4")
            {
                cardFace = higher.cardFaces[3];
                break;
            }

            if (this.name == "P5")
            {
                cardFace = higher.cardFaces[4];
                break;
            }

            if (this.name == "P6")
            {
                cardFace = higher.cardFaces[5];
                break;
            }

            if (this.name == "P7")
            {
                cardFace = higher.cardFaces[6];
                break;
            }

            if (this.name == "P8")
            {
                cardFace = higher.cardFaces[7];
                break;
            }

            if (this.name == "P9")
            {
                cardFace = higher.cardFaces[8];
                break;
            }

            if (this.name == "S1")
            {
                cardFace = higher.cardFaces[9];
                break;
            }

            if (this.name == "W1")
            {
                cardFace = higher.cardFaces[10];
                break;
            }

            if (this.name == "X1")
            {
                cardFace = higher.cardFaces[11];
                break;
            }

            i++;
        }
        selectable     = GetComponent <Selectable>();
        spriteRenderer = GetComponent <SpriteRenderer>();
    }
Exemplo n.º 15
0
        public override bool CanBeEquals(Pullenti.Ner.Referent obj, Pullenti.Ner.Core.ReferentsEqualType typ)
        {
            GeoReferent geo = obj as GeoReferent;

            if (geo == null)
            {
                return(false);
            }
            if (geo.Alpha2 != null && geo.Alpha2 == Alpha2)
            {
                return(true);
            }
            if (IsCity != geo.IsCity)
            {
                return(false);
            }
            if (IsUnion != geo.IsUnion)
            {
                return(false);
            }
            if (IsUnion)
            {
                foreach (Pullenti.Ner.Slot s in Slots)
                {
                    if (s.TypeName == ATTR_REF)
                    {
                        if (obj.FindSlot(ATTR_REF, s.Value, true) == null)
                        {
                            return(false);
                        }
                    }
                }
                foreach (Pullenti.Ner.Slot s in obj.Slots)
                {
                    if (s.TypeName == ATTR_REF)
                    {
                        if (this.FindSlot(ATTR_REF, s.Value, true) == null)
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            Pullenti.Ner.Referent ref1 = this.GetSlotValue(ATTR_REF) as Pullenti.Ner.Referent;
            Pullenti.Ner.Referent ref2 = geo.GetSlotValue(ATTR_REF) as Pullenti.Ner.Referent;
            if (ref1 != null && ref2 != null)
            {
                if (ref1 != ref2)
                {
                    return(false);
                }
            }
            bool r  = IsRegion || IsState;
            bool r1 = geo.IsRegion || geo.IsState;

            if (r != r1)
            {
                if (IsTerritory != geo.IsTerritory)
                {
                    return(false);
                }
                return(false);
            }
            bool eqNames = false;

            foreach (Pullenti.Ner.Slot s in Slots)
            {
                if (s.TypeName == ATTR_NAME)
                {
                    if (geo.FindSlot(s.TypeName, s.Value, true) != null)
                    {
                        eqNames = true;
                        break;
                    }
                }
            }
            if (!eqNames)
            {
                return(false);
            }
            if (IsRegion && geo.IsRegion)
            {
                List <string> typs1 = Typs;
                List <string> typs2 = geo.Typs;
                bool          ok    = false;
                foreach (string t in typs1)
                {
                    if (typs2.Contains(t))
                    {
                        ok = true;
                    }
                    else
                    {
                        foreach (string tt in typs2)
                        {
                            if (Pullenti.Morph.LanguageHelper.EndsWith(tt, t) || Pullenti.Morph.LanguageHelper.EndsWith(t, tt))
                            {
                                ok = true;
                            }
                        }
                    }
                }
                if (!ok)
                {
                    return(false);
                }
            }
            if (Higher != null && geo.Higher != null)
            {
                if (_checkRoundDep(this) || _checkRoundDep(geo))
                {
                    return(false);
                }
                if (Higher.CanBeEquals(geo.Higher, typ))
                {
                }
                else if (geo.Higher.Higher != null && Higher.CanBeEquals(geo.Higher.Higher, typ))
                {
                }
                else if (Higher.Higher != null && Higher.Higher.CanBeEquals(geo.Higher, typ))
                {
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 16
0
        string _ToString(bool shortVariant, Pullenti.Morph.MorphLang lang, bool outCladr, int lev)
        {
            if (IsUnion && !IsState)
            {
                StringBuilder res = new StringBuilder();
                res.Append(this.GetStringValue(ATTR_TYPE));
                foreach (Pullenti.Ner.Slot s in Slots)
                {
                    if (s.TypeName == ATTR_REF && (s.Value is Pullenti.Ner.Referent))
                    {
                        res.AppendFormat("; {0}", (s.Value as Pullenti.Ner.Referent).ToString(true, lang, 0));
                    }
                }
                return(res.ToString());
            }
            string name = Pullenti.Ner.Core.MiscHelper.ConvertFirstCharUpperAndOtherLower(this._getName(lang != null && lang.IsEn));

            if (!shortVariant)
            {
                if (!IsState)
                {
                    if (IsCity && IsRegion)
                    {
                    }
                    else
                    {
                        string typ = this.GetStringValue(ATTR_TYPE);
                        if (typ != null)
                        {
                            if (!IsCity)
                            {
                                int i = typ.LastIndexOf(' ');
                                if (i > 0)
                                {
                                    typ = typ.Substring(i + 1);
                                }
                            }
                            name = string.Format("{0} {1}", typ, name);
                        }
                    }
                }
            }
            if (!shortVariant && outCladr)
            {
                object kladr = this.GetSlotValue(ATTR_FIAS);
                if (kladr is Pullenti.Ner.Referent)
                {
                    name = string.Format("{0} (ФИАС: {1})", name, (kladr as Pullenti.Ner.Referent).GetStringValue("GUID") ?? "?");
                }
                string bti = this.GetStringValue(ATTR_BTI);
                if (bti != null)
                {
                    name = string.Format("{0} (БТИ {1})", name, bti);
                }
            }
            if (!shortVariant && Higher != null && (lev < 10))
            {
                if (((Higher.IsCity && IsRegion)) || ((this.FindSlot(ATTR_TYPE, "город", true) == null && this.FindSlot(ATTR_TYPE, "місто", true) == null && IsCity)))
                {
                    return(string.Format("{0}; {1}", name, Higher._ToString(false, lang, false, lev + 1)));
                }
            }
            return(name);
        }
Exemplo n.º 17
0
 public bool Matches(uint Instruction)
 {
     return(Higher.Matches((ushort)((Instruction >> 16) & 0xFFFF)) && Lower.Matches((ushort)(Instruction & 0xFFFF)));
 }