From Optflux
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 92: | Line 92: | ||
##:[[Image:release8.png]] | ##:[[Image:release8.png]] | ||
# To understand the structure and contents of the plugin.xml file, please refer to the [[The_Plugin.xml_File]] section. | # To understand the structure and contents of the plugin.xml file, please refer to the [[The_Plugin.xml_File]] section. | ||
− | #: [[Image:release9.png]] | + | ## We Provide an almost empty sample here just for reference [[File:plugin.xml]] |
+ | ##: [[Image:release9.png]] | ||
# Filling the sub-directory structure with rational packages is the next step. Since AIBench/OptFlux development is based on 3 main artifacts we usually sub-divide our java classes by those 3 artifacts. | # Filling the sub-directory structure with rational packages is the next step. Since AIBench/OptFlux development is based on 3 main artifacts we usually sub-divide our java classes by those 3 artifacts. | ||
## This means that '''we should create 3 sub-packages''', one for the OPERATIONS, one for the VIEWS and one for our DATATYPES. | ## This means that '''we should create 3 sub-packages''', one for the OPERATIONS, one for the VIEWS and one for our DATATYPES. | ||
Line 143: | Line 144: | ||
} | } | ||
− | '''@Port(direction=Direction.OUTPUT,order=3)''' ''// use the port annotation with Direction = OUTPUT to note that this is an output of the operation'' | + | '''@Port(direction=Direction.OUTPUT,order=3)''' "''// use the port annotation with Direction = OUTPUT to note that this is an output of the operation''" |
public int result(){ | public int result(){ | ||
return this.x + this.y; | return this.x + this.y; | ||
Line 299: | Line 300: | ||
* The ''@Datatype'' annotation contains several properties that can be specified. Please refer [[Developers#AIBench_Datatypes | here]] for that. | * The ''@Datatype'' annotation contains several properties that can be specified. Please refer [[Developers#AIBench_Datatypes | here]] for that. | ||
− | * You don't need to declare the Datatypes in the '''plugin.xml''' file. | + | * You don't need to declare the Datatypes in the '''plugin.xml''' file. This will be capture automatically by AIBench/OptFlux when used in Operations or placed in the Clipboard. |
== Creating your first View == | == Creating your first View == | ||
Line 366: | Line 367: | ||
Now we will create a more complex operation to interact with the recently created Datatypes and View: | Now we will create a more complex operation to interact with the recently created Datatypes and View: | ||
− | |||
− | |||
The code for the operation goes as follows: | The code for the operation goes as follows: | ||
Line 377: | Line 376: | ||
int[] elements; | int[] elements; | ||
− | @Port(name="Operation",direction=Direction.INPUT,order=1) | + | @Port(name="Operation",direction=Direction.INPUT,order=1) |
public void setOperator(OperationEnumeration operation){ | public void setOperator(OperationEnumeration operation){ | ||
this.operation = operation; | this.operation = operation; | ||
} | } | ||
− | @Port(name="Elements",direction=Direction.INPUT,order=2) | + | @Port(name="Elements",direction=Direction.INPUT,order=2) |
public void setList(int[] elements){ | public void setList(int[] elements){ | ||
this.elements = elements; | this.elements = elements; | ||
} | } | ||
− | @Port(direction=Direction.OUTPUT,order=3) | + | @Port(direction=Direction.OUTPUT,order=3) |
public MyComplexDatatype getResult(){ | public MyComplexDatatype getResult(){ | ||
int res = elements[0]; | int res = elements[0]; | ||
Line 403: | Line 402: | ||
List<MySimpleDatatype> listOfSimples = new ArrayList<MySimpleDatatype>(); | List<MySimpleDatatype> listOfSimples = new ArrayList<MySimpleDatatype>(); | ||
for(int elem: elements) | for(int elem: elements) | ||
− | listOfSimples.add(new MySimpleDatatype(elem)); | + | listOfSimples.add(new MySimpleDatatype(elem)); |
− | MyListDatatype list = new MyListDatatype(listOfSimples); | + | MyListDatatype list = new MyListDatatype(listOfSimples); |
− | MySimpleDatatype result = new MySimpleDatatype(res); | + | MySimpleDatatype result = new MySimpleDatatype(res); |
− | MyComplexDatatype toReturn = new MyComplexDatatype(list, operation, result); | + | MyComplexDatatype toReturn = new MyComplexDatatype(list, operation, result); |
− | return toReturn; | + | return toReturn; |
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |