setText() public method

public setText ( String text ) : void
text String
return void
Beispiel #1
0
    static void Main()
    {
        DotProductElement dp = new DotProductElement ();
        //VectorVariableDeclaration a = new VectorVariableDeclaration();
        //Element b;
        //Element c;
        //a.addValue(b);
        //a.addValue(c);

        //VectorVariableDeclaration aa = new VectorVariableDeclaration();
        //Element bb;
        //Element cc;
        //a.addValue(bb);
        //a.addValue(cc);
        VariableElement variable = new VariableElement();
        VariableElement variable1 = new VariableElement();
        variable.setText("vector");
        variable1.setText("vector1");
        dp.setLhs(variable);
        dp.setRhs(variable1);
        VariableElement variable2 = new VariableElement();
        VariableElement variable3 = new VariableElement();
        variable2 = dp.getLhs();
        variable3 = dp.getRhs();
        //dp.getRhs();
    }   
Beispiel #2
0
 static void Main()
 {
     ReturnElement ret = new ReturnElement();
     VariableElement variable = new VariableElement();
     variable.setText("int");
     ret.setreturnvariable(variable);
     Element b;
     b = ret.getreturnvariable();
 } 
Beispiel #3
0
    //---------------< test stub >--------------------------------------------

    
    static void Main()
    {
         MatrixTranspose tran = new  MatrixTranspose();
         VariableElement variable = new VariableElement();
         variable.setText("a");
            tran.setvariable(variable);
            VariableElement tr;
            tr = tran.getvariable();
        
    }  
Beispiel #4
0
    //-----------<Test Stub>--------
  static void main(string[] args)
  {
      Console.WriteLine("\nTesting the DeleteVariable class");
      Console.WriteLine("\n================================\n");
      DeleteVariable elem_del = new DeleteVariable();
      VariableElement var_elem = new VariableElement();
      string value = "a";
      var_elem.setText(value);
      elem_del.setVar(var_elem);
      VariableElement element = elem_del.getVar();
      Console.WriteLine("{0} The expression of class is: delete", element.getText());

  }
Beispiel #5
0
 static void Main()
 {
     BracketElement brac = new BracketElement();
     VariableElement a =  new VariableElement();
     VariableElement b = new VariableElement();
     VariableElement c = new VariableElement();
     a.setText("subtraction expression");
     
     
     brac.setbracketexpression(a);
     Element e;
     e = (Element)brac.getbracketexpression();
   }       
Beispiel #6
0
    static void Main()
    {
        MatrixReference dec = new MatrixReference();
        string mtext;
        mtext = "double";

        VariableElement name = new VariableElement();
        name.setText("a");
        dec.settype(mtext);
        dec.setvariable(name);
        string d;
        Element e;
        d= dec.gettype();
        e = (Element)dec.getvariable();
    }  
Beispiel #7
0
    static void Main()
    {
        DeclarationElement dec = new DeclarationElement();
        string mtext;
        mtext = "double";

        VariableElement name = new VariableElement();
        name.setText("a");
        dec.settype(mtext);
        dec.setvariable(name);
        string d;
        Element e;
        d= dec.gettype();
        e = (Element)dec.getvariable();
    }  
Beispiel #8
0
 static void Main(String[] args)
 {
     Console.WriteLine("\nTesting the LessThanEqualTo class");
     Console.WriteLine("\n==========================================\n");
     LessThanEqualToElement elem = new LessThanEqualToElement();
     VariableElement var_elem0 = new VariableElement();
     var_elem0.setText("a");
     elem.setLessThanEqualToLhs(var_elem0);
     VariableElement var_elem1 = new VariableElement();
     var_elem1.setText("b");
     elem.setLessThanEqualToRhs(var_elem1);
     VariableElement var_elem2 = new VariableElement();
     var_elem2 = (VariableElement)elem.getLessThanEqualToLhs();
     VariableElement var_elem3 = new VariableElement();
     var_elem3 = (VariableElement)elem.getLessThanEqualToRhs();
     Console.Write("LessThanEqualTo element is "+ var_elem2.getText().ToString()+" <= "+ var_elem3.getText().ToString()+"\n\n");
 }
Beispiel #9
0
    static void Main()
    {
        FunctionCallElement funccall = new FunctionCallElement();
        

        VariableElement name = new VariableElement();
        name.setText("functioncall");
        funccall.setfunctioncallname(name);
        VariableElement name1 = new VariableElement();
        VariableElement name2 = new VariableElement();
        name1.setText("a");
        name2.setText("b");
        funccall.setparameters(name1);
        funccall.setparameters(name2);

        List<Element> s = funccall.getparameters();
        Element e;
        
        e = (Element)funccall.getfunctioncallname();
    }  
    //-----------<Test Stub>--------
  static void main(string[] args)
  {
      Console.WriteLine("\nTesting the AssignmentOperationElement class");
      Console.WriteLine("\n==========================================\n");
      AssignmentOperationElement elem_assign = new AssignmentOperationElement();
      IntegerElement int_elem = new IntegerElement();
      VariableElement var_elem = new VariableElement();
      string lhsval = "a";
      string rhsval = "3";
      VariableElement lhs = var_elem;
      Element rhs = int_elem;
      int_elem.setText(rhsval);
      var_elem.setText(lhsval);
      elem_assign.setLhs(lhs);
      elem_assign.setRhs(rhs);
      var_elem=elem_assign.getLhs();
      int_elem = (IntegerElement)elem_assign.getRhs();
      Console.WriteLine("{0} The element at Lhs is:", int_elem.getText());
      Console.WriteLine("{0} The element at the rhs is:", var_elem.getText());

  }
Beispiel #11
0
   //-----------<Test Stub>--------
 static void main(string[] args)
 {
     Console.WriteLine("\nTesting the MatrixElement class");
     Console.WriteLine("\n================================\n");
     MatrixElement elem_mat = new MatrixElement();
     VariableElement elem_var = new VariableElement();
     IntegerElement elem_int = new IntegerElement();
     string var = "matrix";
     string row = "3";
     string column = "4";
     elem_var.setText(var);
     elem_mat.setVar(elem_var);
     elem_int.setText(row);
     elem_mat.setRow(elem_int);
     elem_int.setText(column);
     elem_mat.setColumn(elem_int);
     VariableElement varelement = elem_mat.getVar();
     IntegerElement rowelement = elem_mat.getRow();
     IntegerElement columnelement = elem_mat.getColumn();
     Console.WriteLine("The Matrix element is:{0},[{1}],[{2}]", varelement.getText(),rowelement.getText(),columnelement.getText());
 }
Beispiel #12
0
     static void Main(String[] args)
 {
     Console.WriteLine("\nTesting the IfStatementElement class");
     Console.WriteLine("\n==========================================\n");
     EqualityOperationElement elem = new EqualityOperationElement();
     VariableElement var_elem = new VariableElement();
     var_elem.setText("a");
     elem.setequalityLhs(var_elem);
     IntegerElement int_elem = new IntegerElement();
     int_elem.setText("1");
     elem.setequalityRhs(int_elem);
     VariableElement elem2 = new VariableElement();
     elem2.setText("b");
     IfStatementElement if_elem = new IfStatementElement();
     if_elem.CONDITION= elem;
     ScalarVariableDeclaration scalar_elem = new ScalarVariableDeclaration();
     scalar_elem.setType("int");
     scalar_elem.setVar(var_elem);
     List<Element> Iflist = new List<Element>();
     Iflist.Add(scalar_elem);
     if_elem.IFCODE = Iflist;
     List<Element> ElseList = new List<Element>();
     ElseList.Add(int_elem);
     if_elem.ELSECODE = ElseList;
     Console.Write("IfStatement element " + var_elem1.GetType().ToString()+" "+ var_elem1.getText().ToString() + "\n");
     EqualityOperationElement eq_elem = new EqualityOperationElement();
     eq_elem = (EqualityOperationElement)if_elem.CONDITION;
     Console.Write("The condition has : "+eq_elem.ToString()+"->"+eq_elem.getequalityLhs()+" == "+eq_elem.getequalityRhs()+"\n");
     List<Element> elem_list = new List<Element>();
     elem_list = if_elem.IFCODE;
     for (int i = 0; i < elem_list.Count; i++)
     {
         Console.Write("The if loop list has " + elem_list[i].ToString() + "\n");
     }
     elem_list = if_elem.ELSECODE;
     for (int i = 0; i < elem_list.Count; i++)
     {
         Console.Write("The Else loop list has " + elem_list[i].ToString() + "\n");
     }
 }
Beispiel #13
0
 static void Main(String[] args)
 {
     Console.WriteLine("\nTesting the ForStatementElement class");
     Console.WriteLine("\n==========================================\n");
     RangeElement elem = new RangeElement();
     VariableElement var_elem = new VariableElement();
     var_elem.setText("a");
     elem.RANGEVARIABLE = var_elem;
     IntegerElement int_elem = new IntegerElement();
     int_elem.setText("1");
     elem.STARTINGRANGE = int_elem;
     IntegerElement int_elem2 = new IntegerElement();
     int_elem2.setText("10");
     elem.ENDINGRANGE = int_elem2;
     ForStatementElement for_elem = new ForStatementElement();
     for_elem.RANGE = elem;
     ScalarVariableDeclaration scalar_elem = new ScalarVariableDeclaration();
     scalar_elem.setType("int");
     scalar_elem.setVar(var_elem);
     for_elem.ADDCODE = scalar_elem;
     RangeElement Relem = new RangeElement();
     Relem = for_elem.RANGE;
     Console.Write("Range is "+Relem.STARTINGRANGE.getText()+" to "+ Relem.ENDINGRANGE.getText()+"\n");
     List<Element> elem_list = new List<Element>();
     elem_list = for_elem.CODELIST;
     for(int i=0; i<elem_list.Count;i++)
     {
         Console.Write("The for statement list has " + elem_list[i].ToString()+"\n");
     }
 }
   //-----------<Test Stub>--------
 static void main(string[] args)
 {
     Console.WriteLine("\nTesting the MatrixVariableDeclaration class");
     Console.WriteLine("\n===========================================\n");
     MatrixVariableDeclaration elem_mat = new MatrixVariableDeclaration();
     VariableElement elem_var = new VariableElement();
     IntegerElement elem_int = new IntegerElement();
     //List<Element> elementlist = new List<Element>();
     string var = "matrix";
     string row = "3";
     string column = "2";
     elem_var.setText(var);
     elem_mat.setVar(elem_var);
     elem_int.setText(row);
     elem_mat.setRow(elem_int);
     elem_int.setText(column);
     elem_mat.setColumn(elem_int);
     for (int i = 0; i < (int.Parse(row) * int.Parse(column)); i++)
     {
         elem_int.setText(i.ToString());
         elem_mat.addValue(elem_int);
     }
     string type = "int";
     elem_mat.setType(type);
     elem_mat.setValue();
     int[,] matrix = new int[int.Parse(row), int.Parse(column)];
     matrix = elem_mat.getintValue();
     Console.WriteLine("The name of the Matrix is:{0}", elem_mat.getVar().getText());
     Console.WriteLine("The Row and Column of the Matrix is:{0},{1}", elem_mat.getRow().getText(), elem_mat.getColumn().getText());
     Console.WriteLine("The type of matrix is:{0}", elem_mat.getType());
     for(int i=0;i<int.Parse(row);i++)
     {
         for (int j = 0; j < int.Parse(column); j++)
         {
             Console.WriteLine("The value of matrix is:{0}", matrix[i, j]);
         }
     }
     
 }
Beispiel #15
0
        private void CreateData()
        {
            int curElement = 0;
            
            StringReader readStr = new StringReader(matStr.ToString());
            XmlTextReader xf = new XmlTextReader(readStr);
            MatrixVariableDeclaration mat=null;
            VectorVariableDeclaration vec = null;
            string matElem="";
            int currRow = 0;
            int index = 0;
            string type="";
            int totalRows = 0;
            int totalCols = 0;
            int currCol = -1;
            int[,] elems = new int[10, 10]; ;
            while (xf.Read())
            {
                switch (xf.NodeType)
                {
                    case XmlNodeType.Element:
                        {
                            if (xf.Name == "Matrix")
                            {
                                curElement = 1;
                                mat = new MatrixVariableDeclaration();
                                currRow = 0; currCol = -1;
                            }
                            if (xf.Name == "Vector")
                            {
                                curElement = 2;
                                vec = new VectorVariableDeclaration();
                            }
                            if (curElement == 2)
                            {
                                if (xf.Name == "name")
                                    matElem = "name";
                               
                            }
                            if (curElement == 1)
                            {
                                if (xf.Name == "name")
                                    matElem = "name";
                                if (xf.Name == "row")
                                    matElem = "row";
                                if (xf.Name == "col")
                                    matElem = "column";
                                if (xf.Name == "type")
                                    matElem = "type";
                                if (xf.Name == "Elements")
                                {
                                    elems = new int[totalRows, totalCols];
                                }
                                if (xf.Name == "Element")
                                {
                                    matElem = "elem";
                                    if (currCol == totalCols - 1 && currRow < totalRows - 1)
                                    {
                                        currRow += 1;
                                        currCol = 0;
                                    }
                                    else currCol += 1;
                                }
                            }

                            break;
                        }
                    case XmlNodeType.Text:
                        {
                            if (curElement == 1)
                            {
                                if (matElem == "row")
                                {
                                    IntegerElement row = new IntegerElement();
                                    totalRows = int.Parse(xf.Value.ToString());
                                    row.setText(xf.Value);
                                    mat.setRow(row);
                                }
                                if (matElem == "column")
                                {
                                    IntegerElement col = new IntegerElement();
                                    totalCols = int.Parse(xf.Value.ToString());
                                    col.setText(xf.Value);
                                    mat.setColumn(col);
                                }
                                if (matElem == "name")
                                {
                                    VariableElement val = new VariableElement();
                                    val.setText(xf.Value);
                                    mat.setVar(val);
                                }
                                if (matElem == "type")
                                    {
                                        type = xf.Value;
                                        mat.setType(type);
                                    }
                                if (matElem == "elem")
                                {
                                    if (type == "int")
                                    {
                                        elems[currRow, currCol] = int.Parse(xf.Value.ToString());
                                    }
                                    else if (type == "double")
                                        mat.setdoubleValueat(currRow, currCol, double.Parse(xf.Value.ToString()));
                                }
                            }
                            break;
                        }
                    case XmlNodeType.EndElement:
                        {
                            if (xf.Name == "Elements" && curElement==1)
                            {
                                mat.setIntMatrix(elems);
                                parallelMap.Add(mat.getVar().getText(), mat);
                            }
                            Console.Write("End:" + xf.Name);
                            break;
                        }
                    default:
                        {
                            Console.Write("\n");
                            break;
                        }
                }
            }
        }
Beispiel #16
0
 static void Main(String[] args)
 {
     Console.WriteLine("\nTesting the ParallelForStatementElement class");
     Console.WriteLine("\n==========================================\n");
     RangeElement elem = new RangeElement();
     VariableElement var_elem = new VariableElement();
     var_elem.setText("a");
     elem.RANGEVARIABLE = var_elem;
     IntegerElement int_elem = new IntegerElement();
     int_elem.setText("1");
     elem.STARTINGRANGE = int_elem;
     IntegerElement int_elem2 = new IntegerElement();
     int_elem2.setText("10");
     elem.ENDINGRANGE = int_elem2;
     ParallelForElement for_elem = new ParallelForElement();
     for_elem.RANGE = elem;
     ScalarVariableDeclaration scalar_elem = new ScalarVariableDeclaration();
     scalar_elem.setType("int");
     scalar_elem.setVar(var_elem);
     for_elem.ADDCODE = scalar_elem;
     for_elem.syncfunction();
     VariableElement elem2 = new VariableElement();
     elem2.setText("b");
     for_elem.ADDCODE = elem2;
     for_elem.syncfunction();
     RangeElement Relem = new RangeElement();
     Relem = for_elem.RANGE;
     Console.Write("Range is " + Relem.STARTINGRANGE.getText() + " to " + Relem.ENDINGRANGE.getText() + "\n");
     List<List<Element>> elem_list = new List<List<Element>>();
     elem_list = for_elem.PARALLELCODE;
     for(int i=0; i<elem_list.Count;i++)
     {
         List<Element> code = new List<Element>();
         code = elem_list[i];
         for (int j = 0; j<code.Count; j++)
         {
             Console.Write("The parallelfor statement code list "+ (i+1) +" has "+ code[j].ToString() + "\n");
         }
     }
 }
Beispiel #17
0
    static void Main()
    {
        PlotFunctionElement plotElement = new PlotFunctionElement();
        IntegerElement row = new IntegerElement();
        row.setText("2");
        
        IntegerElement col = new IntegerElement();
        col.setText("2");
        VariableElement varElement = new VariableElement();
        varElement.setText("a");
        DoubleElement dblElement = new DoubleElement();

        plotElement.setPlotFunction("subPlot");
        plotElement.setRow(row);
        plotElement.setColumn(col);
        plotElement.setData(varElement);
        


    }