Esempio n. 1
0
        public override String ToString()
        {
            String s = GAtomicObject._getGAtomicElementsString(element);

            for (GAtomicConnectionDirection direction = GAtomicConnectionDirection.TOP; direction <= GAtomicConnectionDirection.TRIPLE_LEFT; direction++)
            {
                if (_hasConnection(direction))
                {
                    s += "1";
                }
                else
                {
                    s += "0";
                }
            }

            return(s);
        }
Esempio n. 2
0
        public static GAtomicElementObject _getAtomicElementFromString(String s, Point p, int row, int col, int object_size, int ind_list)
        {
            String         atomic_element_string = s.Substring(0, 3);
            GAtomicElement atomic_element        = GAtomicObject._getGAtomicElementFromString(atomic_element_string);

            int    number_of_connections = 0;
            String connections_string    = s.Substring(3);

            if (connections_string.Length != (int)GAtomicConnectionDirection.TRIPLE_LEFT + 1)
            {
                return(null);
            }

            int index = connections_string.IndexOf("1");

            while (index != -1)
            {
                number_of_connections++;
                index = connections_string.IndexOf("1", index + 1);
            }

            GAtomicConnectionElement[] connections = new GAtomicConnectionElement[number_of_connections];
            index = 0;
            int array_index = 0;

            while (index < connections_string.Length)
            {
                if (connections_string.Substring(index++, 1) == "1")
                {
                    connections[array_index++] = new GAtomicConnectionElement(null, (GAtomicConnectionDirection)(index - 1));
                }
            }


            GAtomicElementObject a = new GAtomicElementObject(p, row, col
                                                              , object_size
                                                              , atomic_element, connections, ind_list);

            return(a);
        }