Exemple #1
0
            public static void Read <VertexT, EdgeT, GraphT>(BinaryReader reader, GenericVertex <VertexT, EdgeT, GraphT> vertex)
                where VertexT : GenericVertex <VertexT, EdgeT, GraphT>
                where EdgeT : GenericEdge <VertexT, EdgeT, GraphT>
                where GraphT : GenericGraph <VertexT, EdgeT, GraphT>
            {
                int i;

                Read(reader, (AbstractGraphElement <VertexT>)vertex);

                var flag = reader.ReadUInt32();

                for (i = 0; i < (int)GenericVertex <VertexT, EdgeT, GraphT> .VertexFlags.VertexFlags_MAX; i++)
                {
                    var b = (flag & (1U << i)) != 0;
                    vertex.Flags.Set(i, b);
                }
            }
Exemple #2
0
            public static void Write <VertexT, EdgeT, GraphT>(BinaryWriter writer, GenericVertex <VertexT, EdgeT, GraphT> vertex)
                where VertexT : GenericVertex <VertexT, EdgeT, GraphT>
                where EdgeT : GenericEdge <VertexT, EdgeT, GraphT>
                where GraphT : GenericGraph <VertexT, EdgeT, GraphT>
            {
                int  i;
                uint flag = 0;

                Write(writer, (AbstractGraphElement <VertexT>)vertex);

                for (i = 0; i < (int)GenericVertex <VertexT, EdgeT, GraphT> .VertexFlags.VertexFlags_MAX; i++)
                {
                    if (vertex.Flags[i])
                    {
                        flag |= (1U << i);
                    }
                }
                writer.Write(flag);
            }