Here is an example that compiles:
val region:Region(2)! = [0..10,0..20];
val arr = new ArrayList[Array[Int](region)]();
arr.add( new Array[Int](region) );
On Wed, Jun 16, 2010 at 3:35 PM, Andrei Blackness <[email protected]> wrote:
> I made an ArrayList containing arrays something like this
>
> val arrSolutionsList = new ArrayList[Array[int]()]();
>
> this is working but I would like to make an ArrayList with two dimentional
> arrays... as far as I can see the following tries are incorect...
>
> val arrSolutionsList = new ArrayList[Array[int]([0..1,0..0])]();
> val arrSolutionsList = new ArrayList[new Array[int]([0..1,0..0])]();
>
> Can anyone help me? How do I tell the ArrayList to use two dimentional
> arrays? The curios thing however is that I can add a two dimentional array
> in the list with
> arrSolutionsList.add(myArray); where myArray is --> val myArray = new
> Array[int]([0..1,0..0]); but when I get it out of the list with
> arrSolutionsList.apply(position); It seems to return a rank==1 array...
> cause when I try to get the values from the returned array like this:
>
>
> var temp:Array[int] = new Array[int]([0..1,0..0]);
> temp = arrSolutionsList.apply(position);
> var val :Int = 0;
> for(var j:Int = 0; j<2; j++){
> val += temp.apply([j,0]);
> }
>
> I get a compile error like
>
> Method apply(x10.lang.Int){x10.array.Array#this.region.rank==1}[] in
> x10.array.Array[x10.lang.Int] cannot be called with
> arguments (x10.lang.ValRail[x10.lang.Int]{self.length==2}); Call invalid;
> calling environment does not entail the method guard.
>
>
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> X10-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users