Exemplo n.º 1
0
        public bool _setConnectionElement(GAtomicConnectionDirection direction, GAtomicElementObject element)
        {
            if ((direction < GAtomicConnectionDirection.TOP) || (direction > GAtomicConnectionDirection.TRIPLE_LEFT))
            {
                return(false);
            }

            for (int k = 0; k < connection_elements.Length; k++)
            {
                GAtomicConnectionElement c = (GAtomicConnectionElement)connection_elements[k];
                if (c.DirectionOfConnectingElement == direction)
                {
                    c.AtomicElement = element;
                }
            }

            return(true);
        }
Exemplo 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);
        }
Exemplo n.º 3
0
 public GAtomicConnectionElement(GAtomicElementObject elem, GAtomicConnectionDirection dir)
 {
     atomic_element = elem;
     direction_of_connecting_element = dir;
 }