[back]
Tool |
Creating a complex ITuple
If you want to generate a string like
"int data0 = 0, ITuple testTuple = {float data1 = 1.0, float data2 = 2.0, float data3}, int data4 = 5"
the following code will do it.
>> from paida.tools import TupleString
>> from paida import PTypes
>> tuple0 = TupleString.create()
>> tuple0.addColumn(PTypes.Integer, 'data0', 0)
>> tuple1 = tuple0.addColumn(PTypes.ITuple, 'testTuple')
>> tuple1.addColumn(PTypes.Float, 'data1', 1.0)
>> tuple1.addColumn(PTypes.Float, 'data2', 2.0)
>> tuple1.addColumn(PTypes.String, 'data3', 'testString')
>> tuple0.addColumn(PTypes.Integer, 'data4', 5)
>>
>> columnString = tuple0.getString()
>> print columnString
>>
>> from paida import IAnalysisFactory
>> analysisFactory = IAnalysisFactory.create()
>> treeFactory = analysisFactory.createTreeFactory()
>> tree = treeFactory.create()
>> tupleFactory = analysisFactory.createTupleFactory(tree)
>> complexTuple = tupleFactory.create('complex tuple', 'Complex Tuple', columnString)
[back]