示例#1
0
        public void WriteDot()
        {
            FileStream   file = new FileStream("test.dot", FileMode.Create);
            StreamWriter sw   = new StreamWriter(file);

            sw.WriteLine("digraph");
            sw.WriteLine("{");

            foreach (Variable var in m_VarList)
            {
                sw.WriteLine("\"" + var.ToString(false) + "\"");
            }

            foreach (Constraint cons in m_ConstraintList)
            {
                sw.WriteLine("\"" + cons.ToString() + "\"");
            }

            foreach (Constraint cons in m_ConstraintList)
            {
                ConstraintVar consVar = cons as ConstraintVar;
                if (!ReferenceEquals(consVar, null))
                {
                    foreach (Variable var in consVar.VariableList)
                    {
                        sw.WriteLine("\"" + cons.ToString() + "\" -> \"" + var.ToString(false) + "\"");
                    }
                }
            }

            sw.WriteLine("}");
            sw.Close();
            file.Close();
        }
示例#2
0
        public void Add(ConstraintVar constraint)
        {
            if (constraint.Index == -1)
            {
                constraint.Index = m_ConstraintList.Count;

                m_ConstraintList.Add(constraint);

                constraint.Add();
                constraint.Post();
                constraint.Update();
            }
        }