Set Name in @Datatypes

From AIBenchWiki

Jump to: navigation, search


This is a solution for this FR

As mentioned before, the @Datatype annotation has a namingMethod field to allow a customizable way to set the name of the clipboard elements. A problem arises when the user changes a clipboard item through the built-in rename functionality (via F2, or click), because the user object isn't notified of this change and further inconsistences may occur.

A new setNameMethod has been added to the @Datatype annotation to solve this problem. When this method is defined, the user allows AIBench to automatically notify the user object wrapped inside the clipboard item that its name has changed.



To use it a user must only add the following to his @Datatypes declarations:

  • 1- The user must define a method that will receive only one argument (String) and will return none.
  • 2- As it ought to be expected, if a user defines a setNameMethod but doesn't define a namingMethod, AIBench will not be able to further retrieve the correct name of the Object.


@Datatype(structure=Structure.COMPLEX,viewable=false,namingMethod="getName",setNameMethod="setName")
public class Cube{

private String name; private double edge;
public Cube(String name,double edge){ this.name = name; this.edge = edge; }
public void setName(String s) this.name = s; }
public String getName(){ return this.name; }
...
Personal tools
Documentation