public GraphicOperator(GraphicOperator go)
 {
     OpType = go.OpType;
     OperatorPicBox = go.OperatorPicBox;
     OpName = go.OpName;
     Input1 = null;
     Input2 = null;
     OperatorPicBox.BorderStyle = BorderStyle.FixedSingle;
     OperatorPicBox.SizeMode = PictureBoxSizeMode.StretchImage;
 }
Exemple #2
0
 public DynamicButton(PictureBox pb, string t, BuilderForm parent, GraphicOperator assignedTo, GraphicOperator comingFrom)
 {
     button = ButtonMaker(pb, t);
     picBox = pb;
     type = t;
     builderParent = parent;
     button.Parent = picBox;
     AssignedTo = assignedTo;
     ComingFrom = comingFrom;
 }
 public GraphicOperator(string optype, PictureBox pb, string name)
 {
     OpType = optype;
     OperatorPicBox = pb;
     OpName = name;
     Input1 = null;
     Input2 = null;
     Op2ndType = null;
     OperatorPicBox.BorderStyle = BorderStyle.FixedSingle;
     OperatorPicBox.SizeMode = PictureBoxSizeMode.StretchImage;
 }
 //
 // Constructors
 //
 public GraphicOperator()
 {
     Input1 = null;
     Input2 = null;
     OperatorPicBox = null;
     oldX = 0;
     oldY = 0;
     OpType = "None";
     Op2ndType = "None";
     OpName = "No Name";
     OpPredicate = "No Predicate";
 }
 public void Fill_OperatorBox_Properties(GraphicOperator go)
 {
     textBoxTag.Text = go.PicBox.Tag.ToString();
     pictureBoxOpProperties.Image = go.PicBox.Image;
     BuilderParent.PropertiesType = go.Type;
     textBoxName.Text = go.PicBoxName;
     textBoxPredicate.Text = go.Predicate;
     groupBox1.Text = "Name:";
     groupBox2.Text = "Predicate:";
     groupBox3.Text = "Attribute CheckList:";
     groupBox4.Text = "Attribute List:";
     groupBox5.Text = "GroupBy Types:";
     groupBox2.Hide();
     groupBox3.Hide();
     groupBox4.Hide();
     groupBox5.Hide();
     switch (go.Type)
     {
         case "Select": //Name, Predicate
             {
                 label1.Text = "Select Operator";
                 groupBox2.Show();
                 break;
             }
         case "Project": //Name, Checklist
             {
                 groupBox3.Show();
                 groupBox3.Text = "Project Attributes";
                 //
                 // TODO: display meaningful attributes here
                 //
                 for (int i = 0; i < 5; i++)
                     checkedListBox1.Items.Add(String.Format("Attribute {0}", i));
                 break;
             }
         case "DupElim": //Name, Checklist
             {
                 groupBox3.Show();
                 groupBox3.Text = "DupElim Attributes";
                 //
                 // TODO: display meaningful attributes here
                 //
                 for (int i = 0; i < 5; i++)
                     checkedListBox1.Items.Add(String.Format("Attribute {0}", i));
                 break;
             }
         case "Sort": // Name, List
             {
                 groupBox4.Show();
                 label1.Text = "Sort Operator";
                 groupBox4.Text = "Sort Attributes";
                 listBox1.BeginUpdate();
                 //
                 // TODO: display meaningful attributes here
                 //
                 for (int i = 0; i < 5; i++)
                 {
                     listBox1.Items.Add(String.Format("Attribute {0}", i));
                 }
                 listBox1.EndUpdate();
                 break;
             }
         case "InputStream": // Name, List
             {
                 groupBox4.Show();
                 label1.Text = "Input Stream Operator";
                 groupBox4.Text = "Ports";
                 listBox1.BeginUpdate();
                 //for (int i = 0; i < cm.Connections.Count; i++)
                 //{
                 //    SetPropertiesListBox.Items.Add(cm.Connections[i]);
                 //}
                 //
                 // TODO: display meaningful attributes here
                 //
                 listBox1.EndUpdate();
                 break;
             }
         case "Join": // Name, Predicate, JoinList
             {
                 groupBox2.Show();
                 groupBox3.Show();
                 label1.Text = "Join Operator";
                 groupBox3.Text = "Join Attributes:";
                 listBox1.BeginUpdate();
                 //
                 // TODO: display meaningful attributes here
                 //
                 for (int i = 0; i < 5; i++)
                 {
                     listBox1.Items.Add(String.Format("Join Attribute {0}", i));
                 }
                 listBox1.EndUpdate();
                 break;
             }
         case "Intersect": // Name, Note
             {
                 label1.Text = "Intersect Operator";
                 break;
             }
         case "Difference": // Name, Note
             {
                 label1.Text = "Difference Operator";
                 break;
             }
         case "Union": // Name, Note
             {
                 label1.Text = "Union Operator";
                 break;
             }
         case "GroupBy":
             {
                 groupBox3.Show();
                 groupBox4.Show();
                 groupBox5.Show();
                 System.Collections.Generic.List<string> GroupByListBoxItems = new List<string>();
                 GroupByListBoxItems.Add("GroupByCount");
                 GroupByListBoxItems.Add("GroupByAvg");
                 GroupByListBoxItems.Add("GroupBySum");
                 GroupByListBoxItems.Add("GroupByMax");
                 GroupByListBoxItems.Add("GroupByMin");
                 //
                 // TODO: display meaningful attributes here
                 //
                 for (int i = 0; i < GroupByListBoxItems.Count; i++)
                 {
                     domainUpDownGroupBy.Items.Add(GroupByListBoxItems[i]);
                 }
                 for (int i = 0; i < 5; i++)
                 {
                     checkedListBox1.Items.Add(String.Format("Attribute {0}", i));
                 }
                 for (int i = 0; i < 5; i++)
                 {
                     listBox1.Items.Add(String.Format("Attribute {0}", i));
                 }
                 break;
             }
         case "OutputStream":
             {
                 label1.Text = "Output Stream Operator";
                 break;
             }
         case default(string):
             {
                 MessageBox.Show("The operator name does not match any of the options");
                 break;
             }
     }
 }
 public EditOperatorForm(GraphicOperator go)
 {
     InitializeComponent();
 }
 private void buttonAccept_Click(object sender, EventArgs e)
 {
     GraphicOperator GO = new GraphicOperator(BuilderParent.OperatorListGraphic[Qpos]);
     // Accept Properties
     GO.Predicate = textBoxPredicate.Text;
     switch (GO.Type)
     {
         case "InputStream":
             {
                 //foreach (Connection c in cm.Connections)
                 //{
                 //    if (c.ToString() == C)
                 //        GO.Value = c.ID;
                 //}
                 //
                 // TODO: uncomment and get the input stream working
                 //
                 break;
             }
         case "GroupBy":
             {
                 GO.SecondaryType = (string)domainUpDownGroupBy.SelectedItem;
                 switch (GO.SecondaryType)
                 {
                     case "GroupByCount":
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[4];
                             break;
                         }
                     case "GroupByMax":
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[5];
                             break;
                         }
                     case "GroupByMin":
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[6];
                             break;
                         }
                     case "GroupBySum":
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[7];
                             break;
                         }
                     case "GroupByAvg":
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[3];
                             break;
                         }
                     default:
                         {
                             GO.PicBox.Image = BuilderParent.ImageList.Images[2];
                             break;
                         }
                 }
                 break;
             }
     }
     GO.PicBox.Tag = textBoxTag.Text;
     GO.PicBox.Show();
     if (OpName != textBoxName.Text)
     {
         //
         // TODO: This way of letting the user know that a unique name is required is annoying and a
         // better way can be found to do it.
         //
         if (!BuilderParent.Check_For_Unique_Name(textBoxName.Text)) { textBoxName.Text = "UNIQUE_NAME_REQUIRED!!"; }
         else
         {
             GO.Name = textBoxName.Text;
             MessageBox.Show(GO.Name);
             this.Close();
         }
     }
     else { this.Close(); }
 }
Exemple #8
0
 private void buttonAccept_Click(object sender, EventArgs e)
 {
     // Accept Properties
     if(BuilderParent.PropertiesType == "GroupBy" && (string)domainUpDownGroupBy.SelectedItem == null)
     {
         textBoxName.Text = "GROUPBY_TYPE_REQUIRED!!";
         //GroupByTypeNeeded.Visible = true;
     }
     else if (BuilderParent.Check_For_Unique_Name(textBoxName.Text))
     {
         GraphicOperator GO = new GraphicOperator(BuilderParent.PropertiesType, BuilderParent.PicBoxMaker(new Point(50,50),new Size(50,50),null,"Unassigned Tag"), textBoxName.Text);
         GO.PicBox.Parent = BuilderParent.BuildArea;
         GO.PicBoxName = textBoxName.Text;
         GO.PicBox.Size = BuilderParent.IconSize;
         GO.PicBox.Image = pictureBoxOpProperties.Image;
         // Predicate changes
         if (GO.has_Predicate())
         {
             GO.Predicate = textBoxPredicate.Text;
         }
         switch (GO.Type)
         {
             case "InputStream":
                 {
                     //foreach (Connection c in cm.Connections)
                     //{
                     //    if (c.ToString() == C)
                     //        OperatorListGraphic[QueuePos].Value = c.ID;
                     //}
                     //
                     // TODO: uncomment and get to work with input stream
                     //
                     break;
                 }
             case "GroupBy":
                 {
                     GO.SecondaryType = (string)domainUpDownGroupBy.SelectedItem;
                     switch (GO.SecondaryType)
                     {
                         case "GroupByCount":
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[4];
                                 break;
                             }
                         case "GroupByMax":
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[5];
                                 break;
                             }
                         case "GroupByMin":
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[6];
                                 break;
                             }
                         case "GroupBySum":
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[7];
                                 break;
                             }
                         case "GroupByAvg":
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[3];
                                 break;
                             }
                         default:
                             {
                                 GO.PicBox.Image = BuilderParent.ImageList.Images[2];
                                 break;
                             }
                     }
                     break;
                 }
         }
         if (textBoxTag.Text != "Enter Tag Here")
             GO.PicBox.Tag = textBoxTag.Text;
         else
             GO.PicBox.Tag = String.Format("{0}", GO.PicBoxName);
         GO.PicBox.Show();
         BuilderParent.Search_For_Open_Area_BuildArea(GO.PicBox);
         BuilderParent.OperatorListGraphic.Add(GO);
         BuilderParent.BuildArea.Controls.Add(GO.PicBox);
         addOpQuery();
         this.Close();
     }
     else
     {
         UniqueNameRequiredLabel.Visible = true;
         textBoxName.Text = "UNIQUE_NAME_REQUIRED!!";
         //
         // TODO: this is an annoying way to let the user know that a unique name is required
         // find a better way to do it
         //
     }
 }
Exemple #9
0
 private void BinaryReposition(GraphicOperator topleft, GraphicOperator bottomleft, GraphicOperator right, bool upwards, bool passedBinary)
 {
     //
     // TODO: double check that this method actually gets used, may be old code
     //
     if (topleft != null && bottomleft != null && right != null)
     {
         int Q1 = -1, Q2 = -1;
         if (passedBinary)
         {
             if (upwards)
             {
                 Q1 = Find_OpGraphicList_Index(topleft.PicBox);
                 if (Q1 != -1)
                 {
                     OperatorListGraphic[Q1].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y - 60);
                     Q2 = Find_OpGraphicList_Index(bottomleft.PicBox);
                     if (Q2 != -1)
                         OperatorListGraphic[Q2].PicBox.Location = new Point(OperatorListGraphic[Q1].PicBox.Location.X, OperatorListGraphic[Q1].PicBox.Location.Y + 60);
                 }
             }
             else
             {
                 Q1 = Find_OpGraphicList_Index(topleft.PicBox);
                 if (Q1 != -1)
                 {
                     OperatorListGraphic[Q1].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y);
                     Q2 = Find_OpGraphicList_Index(bottomleft.PicBox);
                     if (Q2 != -1)
                         OperatorListGraphic[Q2].PicBox.Location = new Point(OperatorListGraphic[Q1].PicBox.Location.X, right.PicBox.Location.Y + 60);
                 }
             }
         }
         else
         {
             Q1 = Find_OpGraphicList_Index(topleft.PicBox);
             if (Q1 != -1)
             {
                 OperatorListGraphic[Q1].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y - 60);
                 Q2 = Find_OpGraphicList_Index(bottomleft.PicBox);
                 if (Q2 != -1)
                     OperatorListGraphic[Q2].PicBox.Location = new Point(OperatorListGraphic[Q1].PicBox.Location.X, right.PicBox.Location.Y + 60);
             }
         }
         BuildArea.Invalidate();
     }
 }
Exemple #10
0
 public void Set_Sample_Query2()
 {
     RemoveFromList("Sample Input Stream 2", OperatorListGraphic);
     RemoveFromList("Sample Select Operator 2", OperatorListGraphic);
     RemoveFromList("Sample Output Stream 2", OperatorListGraphic);
     PictureBox tempInput1 = PicBoxMaker(new Point(100, 350), new Size(50, 50), imageList1.Images[8], "Sample Input Stream 2");
     PictureBox tempSelect1 = PicBoxMaker(new Point(300, 350), new Size(50, 50), imageList1.Images[13], "Sample Select Operator 2");
     PictureBox tempOutput = PicBoxMaker(new Point(500, 350), new Size(50, 50), imageList1.Images[11], "Sample Output Stream 2");
     GraphicOperator InStream1 = new GraphicOperator("InputStream", tempInput1, "Sample Input Stream 2");
     GraphicOperator Select1 = new GraphicOperator("Select", tempSelect1, "Sample Select 2");
     GraphicOperator OutStream = new GraphicOperator("OutputStream", tempOutput, "Sample Output Stream 2");
     tempInput1.Name = InStream1.Name;
     tempSelect1.Name = Select1.Name;
     tempOutput.Name = OutStream.Name;
     Select1.Predicate = "$1.2 > i50";
     Select1.Input_1 = InStream1;
     OutStream.Input_1 = Select1;
     this.BuildArea.Controls.Add(tempInput1);
     this.BuildArea.Controls.Add(tempSelect1);
     this.BuildArea.Controls.Add(tempOutput);
     this.OperatorListGraphic.Add(InStream1);
     this.OperatorListGraphic.Add(Select1);
     this.OperatorListGraphic.Add(OutStream);
     BuildArea.Invalidate();
 }
Exemple #11
0
 private void UnaryReposition(GraphicOperator left, GraphicOperator right, bool upwards, bool passedBinary)
 {
     //
     // TODO: double check that this code actually gets used, may be old code
     //
     if (left != null && right != null)
     {
         QueuePos = Find_OpGraphicList_Index(left.PicBox);
         if (QueuePos != -1)
         {
             if (passedBinary)
             {
                 if (upwards)
                     OperatorListGraphic[QueuePos].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y - 60);
                 else
                     OperatorListGraphic[QueuePos].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y + 60);
             }
             else
                 OperatorListGraphic[QueuePos].PicBox.Location = new Point(right.PicBox.Location.X - 60, right.PicBox.Location.Y);
         }
         BuildArea.Invalidate();
     }
 }
Exemple #12
0
 //input1 is whether go is coming in as an input1 or input2
 private void RepositionInputs(GraphicOperator go, List<GraphicOperator> list, int upward, bool input1, int Xseparator)
 {
     if (go != null && list != null && (go.Input_1 != null || go.Input_2 != null))
     {
         #region level direction
         if (upward == 0)
         {
             if (go.isUnaryOp() && go.has_Input1())
             {
                 go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                 RemoveFromList(go.Input_1, list);
                 RepositionInputs(go.Input_1, list, 0, true, Xseparator);
             }
             else
             {
                 if (go.has_Input1() && go.has_Input2())
                 {
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                     go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                     RemoveFromList(go.Input_1, list);
                     RemoveFromList(go.Input_2, list);
                     RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                     RepositionInputs(go.Input_2, list, 2, false, Xseparator);
                 }
                 else if (go.has_Input1())
                 {
                     RemoveFromList(go.Input_1, list);
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                     RepositionInputs(go.Input_1, list, 0, true, Xseparator);
                 }
                 else if (go.has_Input2())
                 {
                     RemoveFromList(go.Input_2, list);
                     go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                     RepositionInputs(go.Input_2, list, 0, false, Xseparator);
                 }
             }
         }
         #endregion
         #region upward
         else if (upward == 1)
         {
             if (input1)
             {
                 if (go.isUnaryOp() && go.has_Input1())
                 {
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                     RemoveFromList(go.Input_1, list);
                     RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                 }
                 else
                 {
                     if (go.has_Input1() && go.has_Input2())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 120);
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                         RemoveFromList(go.Input_1, list);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                         RepositionInputs(go.Input_2, list, 1, false, Xseparator);
                     }
                     else if (go.has_Input1())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                         RemoveFromList(go.Input_1, list);
                         RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                     }
                     else if (go.has_Input2())
                     {
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_2, list, 1, false, Xseparator);
                     }
                 }
             }
             else //input2
             {
                 if (go.isUnaryOp() && go.has_Input1())
                 {
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                     RemoveFromList(go.Input_1, list);
                     RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                 }
                 else
                 {
                     if (go.has_Input1() && go.has_Input2())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y - 60);
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         RemoveFromList(go.Input_1, list);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                         RepositionInputs(go.Input_2, list, 1, false, Xseparator);
                     }
                     else if (go.has_Input1())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         RemoveFromList(go.Input_1, list);
                         RepositionInputs(go.Input_1, list, 1, true, Xseparator);
                     }
                     else if (go.has_Input2())
                     {
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_2, list, 1, false, Xseparator);
                     }
                 }
             }
         }
         #endregion
         #region downward
         else //downward
         {
             if (input1)
             {
                 if (go.isUnaryOp() && go.has_Input1())
                 {
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                     RemoveFromList(go.Input_1, list);
                     RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                 }
                 else
                 {
                     if (go.has_Input1() && go.has_Input2())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                         RemoveFromList(go.Input_1, list);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                         RepositionInputs(go.Input_2, list, 2, false, Xseparator);
                     }
                     else if (go.has_Input1())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         RemoveFromList(go.Input_1, list);
                         RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                     }
                     else if (go.has_Input2())
                     {
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_2, list, 2, false, Xseparator);
                     }
                 }
             }
             else //input2
             {
                 if (go.isUnaryOp() && go.has_Input1())
                 {
                     go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                     RemoveFromList(go.Input_1, list);
                     RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                 }
                 else
                 {
                     if (go.has_Input1() && go.has_Input2())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 120);
                         RemoveFromList(go.Input_1, list);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                         RepositionInputs(go.Input_2, list, 2, false, Xseparator);
                     }
                     else if (go.has_Input1())
                     {
                         go.Input_1.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                         RemoveFromList(go.Input_1, list);
                         RepositionInputs(go.Input_1, list, 2, true, Xseparator);
                     }
                     else if (go.has_Input2())
                     {
                         go.Input_2.PicBox.Location = new Point(go.PicBox.Location.X - 50 - Xseparator, go.PicBox.Location.Y + 60);
                         RemoveFromList(go.Input_2, list);
                         RepositionInputs(go.Input_2, list, 2, false, Xseparator);
                     }
                 }
             }
         }
         #endregion
     }
 }
Exemple #13
0
 private void RemoveFromList(GraphicOperator remove, List<GraphicOperator> list)
 {
     if (remove != null && list != null)
     {
         for (int i = 0; i < list.Count; i++)
             if (list[i].PicBoxName == remove.PicBoxName) { list.RemoveAt(i); break; }
     }
 }
Exemple #14
0
 private void OrganizeAlgorithm(GraphicOperator go, List<GraphicOperator> list, bool upwards, bool passedBinary)
 {
     //
     // TODO: double check that this code actually gets used, may be old code
     //
     GraphicOperator temp1 = new GraphicOperator();
     GraphicOperator temp2 = new GraphicOperator();
     temp1 = go.Input_1;
     temp2 = go.Input_2;
     if (temp1 != null)
     {
         if (temp1.isUnaryOp() && temp1.has_Input1())
         {
             UnaryReposition(temp1.Input_1, temp1, upwards, passedBinary);
             OrganizeAlgorithm(temp1, list, upwards, passedBinary); //also try !passedBinary
         }
         else if (temp1.isBinaryOp() && (temp1.has_Input1() || temp1.has_Input2()))
         {
             if (temp1.has_Input1() && temp1.has_Input2())
             {
                 BinaryReposition(temp1.Input_1, temp1.Input_2, temp1, upwards, passedBinary);
                 OrganizeAlgorithm(temp1, list, true, true);
             }
             else if (temp1.has_Input1() && !temp1.has_Input2())
             {
                 UnaryReposition(temp1, temp1, upwards, passedBinary);
                 OrganizeAlgorithm(temp1, list, upwards, passedBinary);
             }
             else if (!temp1.has_Input1() && temp1.has_Input2())
             {
                 UnaryReposition(temp1.Input_2, temp1, upwards, passedBinary);
                 OrganizeAlgorithm(temp1, list, upwards, passedBinary);
             }
         }
         RemoveFromList(temp1, list);
     }
     if (temp2 != null)
     {
         if (temp2.isUnaryOp() && temp2.has_Input1())
         {
             UnaryReposition(temp2.Input_1, temp2, upwards, passedBinary);
             OrganizeAlgorithm(temp2, list, upwards, passedBinary);
         }
         else if (temp2.isBinaryOp() && (temp2.has_Input1() || temp2.has_Input2()))
         {
             if (temp2.has_Input1() && temp2.has_Input2())
             {
                 BinaryReposition(temp2.Input_1, temp2.Input_2, temp2, upwards, passedBinary);
                 OrganizeAlgorithm(temp2, list, false, true);
             }
             else if (temp2.has_Input1() && !temp2.has_Input2())
             {
                 UnaryReposition(temp2.Input_1, temp2, upwards, passedBinary);
                 OrganizeAlgorithm(temp2, list, upwards, passedBinary);
             }
             else if (!temp2.has_Input1() && temp2.has_Input2())
             {
                 UnaryReposition(temp2.Input_2, temp2, upwards, passedBinary);
                 OrganizeAlgorithm(temp2, list, upwards, passedBinary);
             }
         }
         RemoveFromList(temp2, list);
     }
 }