Menu

Creating a representation for testing purposes..

In FREVO, each Representation extends the AbstractRepresentation abstract class. The constructor of the AbstractRepresentation expects to be given four parameters:
- number of inputs that will be given to the representation,
- number of outputs that is expected to generate the representation
- a random number generator (we implemented an own class for this - seed can be given as parameter)
- and a Hashtable\<String, XMLFieldEntry>

In order to create a simple representation for testing purposes, you need to create a Hashtable.
Usually FREVO creates this for you when loads the representation from the appropriate xml file.
One example of creating such Hashtable:

Hashtable<String, XMLFieldEntry> properties = new Hashtable<>();
properties .put("example_int", new XMLFieldEntry("6", XMLFieldType.INT, ""));
properties .put("example_ENUM", 
                new XMLFieldEntry("ENUMVALUE", XMLFieldType.ENUM, "<package.EnumClass>"));
properties .put("example_boolean", new XMLFieldEntry("FALSE", XMLFieldType.BOOLEAN, ""));

Then you can create a concrete representation by e.g.:

ConcreteRepr myRepr = new ConcreteRepr(2,2, new NESRandom(1234), properties);

Agnes

Posted by Agnes 2012-09-17 Labels: Test Representation Hashtable

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.