How to use ArrayList to represent muti-dimension array?

For example, how to use ArralyList to represent array likes this:
a[0][0] = xxx
a[1][1] = xxx
a[2][2] = xxx
.....Thanks

For example, how to use ArralyList to represent array likes this:
> a[0][0] = xxx
a[1][1] = xxx
a[2][2] = xxx
.....Use an ArrayList populated with ArrayLists?
kind regards,
Jos

Similar Messages

  • How we use Surrogate Keys for snowflake dimension

    Hi All,
    my question is - How we use  Surrogate Keys for  snowflake dimension
    i heard from some body Surrogate Keys only work with star schema.
    please correct me if i wrong.
    Regards,
    Manish

    Hi manishcal16PPS,
    According to your description, you can only create natural key in your dimension. But it's not working when using surrogate key. Right?
    In Analysis Services, the snowflake schema of the dimensions are represented by more than one dimension table in other words its takes multiple dimension tables to define a dimension. Surrogate key are just some extra, redundant, unique key based on the
    natural key. So there's no direct relationship or some limitations between surrogate keys and snowflake schema.
    In this scenario, since there's relationship between the two dimensions, you should create natural key. For using natural key or surrogate key. Please refer to an article below:
    Surrogate Key vs. Natural Key
    For understanding star/snowflake schema, please see:
    Understanding Star and Snowflake Schemas 
    Regards,
    Simon Hou
    TechNet Community Support

  • How to use ArrayList?

    i'm not quite sure how to use ArrayList, i read the api documentation but it would be better if someone could explain it to me
    i have a helper method that returns a random number within a given range that picks an index at random but it won't work, here is my code:
         public String getIndex ()
              a1.get(getRandomIndex(int));
         private static int getRandomIndex (int range)
              return ((int) (Math.random () * range));
         }

    You are calling he method incorrectly. You do not use the variable type declaration when calling a method. Do this
    import java.util.*;
    public class TestClass{
         ArrayList<String> words = new ArrayList<String>();
         Random rand = new Random();
         public TestClass(){
              words.add("hello");
              words.add("world");
         public String randomSelection(){
              int index = rand.nextInt(words.size());
              return words.get(index); //notice that I am calling the method with a variable that is an integer, but I don't use "int" when I call it
         public static void main(String args[]) {
              TestClass myTest = new TestClass();
              for(int i=0;i<30;i++){
                   System.out.println(myTest.randomSelection());
    }The API documentation will list the variable type but that is only for you information. It is there so that you know what type of variable top use when calling a particular method.

  • How can i declare 2 or more dimension array as function parameter???

    I am new to Objective-C and Cocoa. and now I have a problem.
    I want to send 2 dimension array to function but it cannot compile the error is "array type has incomplete element type" Please help me
    This is my Interface
    + (void) reValueInArray: (int[][] ) labelValue replaceValue: (int) oldValue withValue: (int) newValue;
    and one more question
    How can i get length of array
    1. array that declare as array at first (int a[5] for example)
    2. array that declare as pointer at first (int a* for example)
    Thank you Very much

    Satake wrote:
    a 2 dimension array is just an array of arrays correct?
    No. It isn't.
    so it'd be something like
    - (void)arrayManipulator:(NSArray *)aTwoDimensionArray;
    You're mixing metaphors. The original poster isn't using NSArray, but, rather, C arrays.
    + (void) reValueInArray: (int[][] ) labelValue replaceValue: (int) oldValue withValue: (int) newValue;
    In C, a multi-dimensional array is just one big, single-dimensioned array that uses fixed sizes for all but one of the component arrays to find a particular element. That means that you can't ever do something like:
    There are several workarounds.
    1) Use NSArray, as suggested in the first reply. That will solve this problem and lots more. With NSArray, you really an have arrays inside of arrays.
    2) Treat the array as just a plain old pointer in the function signature, then cast it back to the properly dimensioned array.
    3) Create a true array of arrays in C, using dynamic allocation. More trouble than it's worth.
    4...N) Other options that are probably more trouble than they're worth.

  • How to use the function who returns an array?

    how to use getAllT in pls/sql or in java?
    --------------------------------------------------->
    create or replace package honghai as
         type TType is varray(25) of number;
    /*it can be like : type TType is table of number;
         function getCountT return number;
         function getAllT return TType;
    end honghai;
    create or replace package body honghai as
    a number;
    function getCountT return number is
         acount number;
         begin
              select count(*) into acount from testasb.t;
              return acount;
         end getCountT;
         function getAllT
         return TType is
         results TType;
         begin
              select testid into results(25) from testasb.T ;
              return results ;
         end getAllT;
    begin
         a := 2;     
    end honghai;
         

    For the java part, click on the link below:
    http://osi.oracle.com/~tkyte/ResultSets/index.html
    For the pl/sql part specific to your problem, see the code below. Since you did not provide any table structure or sample data, I used some simple data for demonstration purposes:
    SQL> CREATE TABLE t
      2    (testid NUMBER)
      3  /
    Table created.
    SQL> INSERT INTO t
      2  VALUES (1)
      3  /
    1 row created.
    SQL> INSERT INTO t
      2  VALUES (2)
      3  /
    1 row created.
    SQL> CREATE OR REPLACE PACKAGE honghai
      2  AS
      3    TYPE ttype IS REF CURSOR;
      4    FUNCTION getcountt RETURN NUMBER;
      5    FUNCTION getallt RETURN ttype;
      6  END honghai;
      7  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY honghai
      2  AS
      3    a NUMBER;
      4    FUNCTION getcountt RETURN NUMBER
      5    IS
      6      account nUMBER;
      7    BEGIN
      8      SELECT COUNT (*)
      9      INTO   account
    10      FROM   scott.t;
    11      RETURN account;
    12    END getcountt;
    13    FUNCTION getallt RETURN ttype
    14    IS
    15      results ttype;
    16    BEGIN
    17      OPEN results for 'SELECT testid FROM scott.t';
    18      RETURN results;
    19    END getallt;
    20  BEGIN
    21    a := 2;
    22  END honghai;
    23  /
    Package body created.
    SQL> VARIABLE g_num NUMBER
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC :g_num := honghai.getcountt
    PL/SQL procedure successfully completed.
    SQL> EXEC :g_ref := honghai.getallt
    PL/SQL procedure successfully completed.
    SQL> PRINT g_num
         G_NUM
             2
    SQL> PRINT g_ref
        TESTID
             1
             2

  • How to use two members from same dimension in Dimension Layout, for HFR

    I am developing a report using Hyperion Financial Reporting. I have taken two dimensions in rows and remaining dimensions in column. After completing one section, I need to make new section of the report on the same grid and page with just adding one more member of the second row dimension. That is data should be the summation of two members of the dimension, say "ACCOUNT".
    Kindly guide me the steps. Also i would like you to know that i am begineer with Hyperion Financial Reporting.
    Thanks
    Roshan

    Can you give some explanation of your gird layout and what you are trying to achieve?
    Like Account and Scenario in row
    Year, Market in columns
    Product in Page
    Regards
    Celvin
    http://www.orahyplabs.com
    Please mark the responses as helpful/correct if applicable

  • BPC - Dimension Owner - How to use a Team as a dimension owner

    BPC 7.0 MS
    I have a dimension with an OWNER property.  I can define the OWNER property for a dimension member to be a User by using the syntax of:
    <domain name>\<username>
    for example, we have an Active Directory domain of CORP and a username of L123456.  I can use
    CORP\L123456
    as the OWNER property value and the dimension with process successfully.
    I have added a Team in BPC, for example called MyTeam.  I try to set the OWNER for a dimension member to
    MyTeam
    and when I process the dimension I get the error that:
    "Invalid user or team names found in the OWNER property"
    I also tried these syntaxes:
    BPC\MyTeam
    BPC \MyTeam
    These do not work either.  Does anyone know the correct syntax to get this to process properly?

    Carlos,
    Thank you for the reply.  That solved my problem.  I used MyTeam enclosed by square brackets
    as the value in the OWNER property of the dimension and the dimension processed successfully.
    Thanks.
    Edited by: Brownlee Field on Jun 27, 2009 2:16 PM
    Edited by: Brownlee Field on Jun 27, 2009 2:17 PM

  • How to use a table to fill an array

    I have a cFP 2110 with a couple of relay modules I'm using to automate a process.  I'm  using an array of a cluster of elements to turn the relays on and off with a time delay for each step.  This was the first version I started with and I have since built a state machine around.  What I would like to do is add a table or array to the front pannel and move the relay control and time delay to the front panel and allow the user to specify which relays are on or off and for how long.  I also want to allow the user to save the table and have the option to select other saved versions of the table to operate the module with different.   I also need to add a string control to the table so I will need to use shared variables for to communicate between the target Vi and the host vi the user is working from.  Is a table the correct approach to do this?  I have never used the table functions.  How do I go about building a table and sending the data to an array?  Do I need to send the table contents to file OI first, then have the array read the specified file?
    Thank for the help.
    Danny
    Attachments:
    array.vi ‏40 KB

    Hi Danny,
    Instead of using a constant array on your block diagram, you could use a control array so that the elements show up on the front panel. Then your user will have the ability to change the relays and time delay. You can then use Datalog files (see Help >> Find Examples... and search Datalog) to save individual clusters. Otherwise if you want to save entire arrays, you could just save them to a binary file. 
    Using the array of controls eliminates the need for a table and its conversion, and also provides a front panel interface for your user to control. Does the string control need to be part of these array as well, or can it be separate?
    If you are reading a file back to be used with your program, you will need to read the file to get its contents before using it to control your loop.
    Will
    Certified LabVIEW Architect, Certified Professional Instructor
    Choose Movement Consulting
    choose-mc.com

  • How to use a WebService Model with String Arrays as its input  parameter

    Hi All,
    I am facing the following scenario -
    From WebDynpro Java i need to pass 2 String Arrays to a Webservice.
    The Webservice takes in 2 input String Arrays , say, Str_Arr1[] and Str_Arr2[] and returns a string output , say Str_Return.
    I am consuming this WebService in WebDynpro Java using WEB SERVICE MODEL. (NWDS 04).
    Can you please help out in how to consume a WSModel in WD where the WS requires String Arrays?

    Hi Hajra..
    chec this link...
    http://mail-archives.apache.org/mod_mbox/beehive-commits/200507.mbox/<[email protected]>
    http://www.theserverside.com/tt/articles/article.tss?l=MonsonHaefel-Column2
    Urs GS

  • How to use list of data in an array as an input?

    Hi,
    I had an array with quite a number of complex data in it. I wanted to use it as an input to a function and plot it. I want the data in the array to be input one by one start from the top of the array till the bottom and feed it to the function accordingly. I'm having problem to do this. I tried 'for loop' but it will only output it after the loop finish running which not really desirable as the output from the function are to be use in other function and this introduce lagging. Any other method?

    Yeap.. thats the problem. I used this for loop before but it only update the value within the loop.. To use the transfer function I need to use another loop called Control and Simulation Loop. Attached is the modified file. I tried using global or local variable but it wont update until the for loop finish all the iteration which only gives out the final value in the array to the transfer function.
    Attachments:
    chart[1].vi ‏57 KB

  • How to use NewObjectArray method to create an array?

    This is my code:
    #include <jni.h>
    JNIEXPORT void JNICALL test(JNIEnv *env,jclass jcls)
         jobjectArray array=(env)->NewObjectArray(10,jcls,NULL);
    }I use g++ compiler got this error:
    test.cpp: In function `void test(JNIEnv, __jclass*)':*
    test.cpp:5: invalid conversion from `__jarray' to `__jobjectArray*'*
    Why?

    I don't know why you're getting this error (VC++ and gcc are both fine for me with the Java 1.6 includes), but I do notice that some of the Sun documentation explicitly casts the result of NewObjectArray:
    ret= (jobjectArray)env->NewObjectArray(5,
    env->FindClass("java/lang/String"),
    env->NewStringUTF(""));
    From: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jnistring.html
    Does your function work correctly after a class cast? Which JVM version are you using?

  • [SOLVED] How to use Linux Bash to Create an Array of Files in a Dir...

    So I created a bash script which executes at random one PHP script in a directory,
    scripts=(
    flag_videos_which_need_grabbing.php
    grab_video.php
    grab_speaker_image.php
    php -f /home/rt_cron/${scripts[$((RANDOM%${#scripts[*]}))]} > /dev/null 2>&1;
    However, because I change the PHP scripts in that directory frequently I'd like this bash script to actually create its 'scripts' array from the current contents of the /home/rt_cron directory. Basically I need something like this,
    scripts = $(ls /home/rt_cron/*.php)
    Any ideas anyone?
    Last edited by tony5429 (2010-02-10 03:32:35)

    scripts=(`ls /home/rt_cron/*.php`)
    Methinks.
    tony5429 wrote:
    Well just minutes after posting that I found a solution with awk,
    scripts=($(ls /home/rt_cron/*.php | awk -F" " '{$1=$1; print}'));
    You don't need that awk in there at all.
    Last edited by Peasantoid (2010-02-10 03:32:03)

  • How can I uses byte[] to represent the length of a message?

    hihi,
    I want to using 3-bytes to represent the length of a message that send over a socket,
    I don't know how to using byte to represent the length, should I parse integer to byte?
    thank you

    int length;
    DataOutputStream dos = ...;
    dos.writeByte(length >>> 16);
    dos.writeByte(length >>> 8);
    dos.writeByte(length & 0xff);But why 3? Why not 2 or 4 like everybody else? with DataOutputStream.writeShort() or writeInt()?

  • How to use JSTL varriable in to XML

    1. how to use JSTL varriable into Xml Tag.
    for example :
    java value I am passing to XML.
    <eztag:companytag pgm_sname="<%= strpgm_name%>" dbase="<%= strd%>"
    dbpass="<%= strp%>" dburl="<%= stru%>" session="<%= session%>" />
    After modified in JSTL
    <eztag:companytag pgm_sname="${pgm_name}" dbase="${strd}"
    dbpass="${strp}" dburl="${stru}" session="${session}" />
    but its Not working. How to use this
    2.How to use ArrayLIst in JSTL
    For example
    IN Java scriplet code in JSP
    <%for(int i=0;i<alist.size();i++) {
    String str = String.valueOf(alist.get(i));
    String str1 = String.valueOf(alist.get(i+1));
    %>
    <TD>STR - <%=str%> </TD>
    <TD>STR1 - <%=str1%> </TD>
    <% } %>
    This code How to Use in JSTL.
    thanks in advance

    thanks for reply
    But in this article it describes how to passing the value of function.
    I need how to assign the JSTL varriable to xml tag attribute.
    for example
    In my TLD File
    <tag>
    <name>companytag</name>
    <tag-class>bas.CompanyTag</tag-class>
    <attribute>
    <name>dbase</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>java.lang.String</type>
    </attribute>
    <attribute>
    <name>dbpass</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>java.lang.String</type>
    </attribute>
    <attribute>
    <name>dburl</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>java.lang.String</type>
    </attribute>
    <attribute>
    <name>pgm_sname</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>java.lang.String</type>
    </attribute>
    <attribute>
    <name>session</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    <type>java.lang.String</type>
    </attribute>
    </tag>
    Html code
    old code :
    <%@ taglib uri="/ezerptags.tld" prefix="eztag" %>
    <eztag:companytag pgm_sname="<%= strpgm_name%>" dbase="<%= strd%>"
    dbpass="<%= strp%>" dburl="<%= stru%>" session="<%= session%>" />
    After modified in JSTL
    <%@ taglib uri="/ezerptags.tld" prefix="eztag" %>
    <eztag:companytag pgm_sname="${pgm_name}" dbase="${strd}"
    dbpass="${strp}" dburl="${stru}" session="${session}" />
    but its Not working. How to use this
    the "eztag" and "companytag" are the customtag. these tages available in eztaglib.tld file. I am passing the value through XML Tag.
    Please suggest me . how to use.
    is there any article describes how to pass jstl varriable to XML Tag attribute.
    thanks in advance

  • How to use the sharing function with other pc on the Finder sidebar?

    I discver my housemates' pc's names under "sharing" on the Finder sidebar. We all use the same wifi network at home.  Neither they nor I have enabled anything so I'm just wondering what is that for and where am I able to control sharing options?
    Also I can even access their iTunes libraries. How do these all work? Am I able to set any security options at all?

    On the doc page (this is also in the download package),
    http://download.oracle.com/docs/cd/E17277_02/html/index.html
    see:
    Getting Started Guide
    Java Collections Tutorial
    Direct Persistence Layer (DPL)
    All of these describe how to use data types other than byte arrays.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for