3) All of the Lulesh code is reliant on being given some input
domain that comes with a bunch of constant defining the problem
(starting positions, velocities etc.). I tried to implement this as
a static variable but I get an error saying that I cannot declare a
static non-final field. Why is this, and is there a better way to
approach the issue of a helper class that is filled with constants.
(Copying the list so that others can also contribute, and also search if
they have the same question.)
Yes, a helper class that uses a helper class filled with constants ... :-)
If the state is immutable, you can declare it as static state in any
class of your choice, just as in Java.
If the state is mutable, then use a singleton class, e.g.
e.g.
class Data {
public static val v = new SingletonData();
public static class SingletonData {
var field1:Type1 = value1;
...
var fieldn:Typen = valuen;
}
}
Note however that unlike Java, X10 has places and each place has its own
copy of static state. If you really need a single mutable location for
each field that is globally accessible you must use a GlobalRef.
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users