Beispiel #1
0
        public void FillFromString(String aSource)
        {
            int    level = 0;
            String s     = aSource;

            while (level <= MaxLines)
            {
                s = TopPyramid.FillFromString(s, level++);
            }
        }
Beispiel #2
0
        public String FillFromString(String aSource, int aLevel)
        {
            String s = aSource;

            if (Top4CellPyramid == null)
            {
                // if correct levels, set corresponding valuse of this 4 cell pyramid
                if ((aLevel == TopLineLevel && !GetActualUpside()) || (aLevel == BottomLineLevel && GetActualUpside()))
                {
                    TopValue = (s.Substring(s.Length - 1, 1) == "1");
                    s        = s.Substring(0, s.Length - 1);
                }

                if ((aLevel == BottomLineLevel && !GetActualUpside()) || (aLevel == TopLineLevel && GetActualUpside()))
                {
                    BottomLeftValue = (s.Substring(s.Length - 1, 1) == "1");
                    s = s.Substring(0, s.Length - 1);
                    BottomUpsideValue = (s.Substring(s.Length - 1, 1) == "1");
                    s = s.Substring(0, s.Length - 1);
                    BottomRightValue = (s.Substring(s.Length - 1, 1) == "1");
                    s = s.Substring(0, s.Length - 1);
                }
            }
            else
            {
                // Then give sibling pyramids to process rest data
                if (Top4CellPyramid != null)
                {
                    s = Top4CellPyramid.FillFromString(s, aLevel);
                }
                if (BottomLeft4CellPyramid != null)
                {
                    s = BottomLeft4CellPyramid.FillFromString(s, aLevel);
                }
                if (BottomUpside4CellPyramid != null)
                {
                    s = BottomUpside4CellPyramid.FillFromString(s, aLevel);
                }
                if (BottomRight4CellPyramid != null)
                {
                    s = BottomRight4CellPyramid.FillFromString(s, aLevel);
                }
            }
            // return source data, unprocessed on this step
            return(s);
        }