How do you assign multiple values to a single element in an array?

I'm probably not wording the question right.
I have an array, let's call it M[], and for each element in the array (we'll say M[1]), I need assign three integers: row, col and value.
I need to set it up so I can do something like this:
A.row = M[i].col;
A[i].col = M[i].row;
A[i].value = M[i].value;
The algorithm isn't what I need help with, it's assigning .col, .row and .value to an index of an array.
Please help if you can.

You are right. You did not word your question perfectly, but I still think I get what you want.
First of all: A single element in an array always has exactly one value. No more, no less.
But that's not a problem. The element in an array is either of a primitive type (boolean, byte, char, short, int, long, float, double) or it's a reference (to a Object, String, MyClass, ...).
You can simply write a class that holds your three values and create an array of that type:
public class SomeData {
  public int row;
  public int col;
  public int value;
// somewhere else:
SomeData[] a = new SomeData[10];
a[0] = new SomeData();
a[0].row = 10;
a[0].col = 5;
a[0].value = 42;Note how you only assign a single value to the element (a[0]) itself. All other assignment actually go to fields of the object refered to by that element in the array.
Also note that in Java types (such as classes, interfaces, ...) should start with a upper-case letter, while variables (local variables, members, parameters) and method names should start with a lower-case letter.
Edit: I'm getting old ...

Similar Messages

  • How do you set multiple values in "Internal-Properties" in XSLT

    Hi All,
    I'm running SOA 11g with the Oracle B2B Adapter.
    I have a need to dynamically set the InterchangeReceiverID, InterchangeSenderID, GroupSenderID, and GroupReceiverID from within SOA prior to passing the xml to the B2B Adapter. When using the Transform Activity, I don't understand how to set multiple values at the Interchange/Group levels. I am able to set ONE value at each level using the structure below, but have not been able to determine the proper way to set more than one value at each level.
    Any help would be appreciated.
    thanks,
    bw
    <ns4:Internal-Properties>
    <ns4:Data-Structure>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">Interchange</xsl:text>
    </xsl:attribute>
    <ns4:Lookup>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">InterchangeSenderID</xsl:text>
    </xsl:attribute>
    <xsl:text disable-output-escaping="no">1234</xsl:text>
    </ns4:Lookup>
    <ns4:Data-Structure>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">Group</xsl:text>
    </xsl:attribute>
    <ns4:Lookup>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">GroupSenderID</xsl:text>
    </xsl:attribute>
    <xsl:text disable-output-escaping="no">5678</xsl:text>
    </ns4:Lookup>
    <ns4:Data-Structure>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">Transaction</xsl:text>
    </xsl:attribute>
    <ns4:Lookup>
    <xsl:attribute name="Name">
    <xsl:text disable-output-escaping="no">TransactionID</xsl:text>
    </xsl:attribute>
    <xsl:text disable-output-escaping="no">856</xsl:text>
    </ns4:Lookup>
    </ns4:Data-Structure>
    </ns4:Data-Structure>
    </ns4:Data-Structure>
    </ns4:Internal-Properties>

    Hi Anuj,
    Thanks for taking time to consider this. I think I did not explain my problem clearly. I'm not trying to assign more than one value to any one property. My issue is that I cannot figure out the proper syntax within the XSLT to assign a value to more than one property at the Interchange level. For instance, do you have an example of how I would assign one value to the InterchangeSenderID and another value to the InterchangeReceiverID? Constant values (rather than dynamic ones) would be fine for an example. Thanks again for your time.
    thanks,
    bw

  • How do you lookup multiple values in different columns based on variable criteria?

    Essentially, I'd like to be able to do a Vlookup but instead of searching for one value only, search for multiple values in separate columns. A smaller version of my current spreadsheet as an example...
    Attack Type ->
    Fire
    Water
    Grass
    Fire
    1/2x
    2x
    1/2x
    Water
    1/2x
    1/2x
    2x
    Grass
    2x
    1/2x
    1/2x
    Fire/Water
    1/4x
    1x
    1x
    Fire/Grass
    1x
    1x
    1/4x
    Grass/Water
    1x
    1/4x
    1x
    The headers are the attack types and the list of types to the left are the receiving Pokemon. Fire does half damage (1/2x) to fire types, Water does double damage (2x) to fire types, etc. I'd like to be able to search for specific damages for each type. For example, I'd like to find a Typing that recieves half (1/2x) damage from Fire-type attacks but also recieves double (2x) from Grass-type attacks. I do want more than just two search criteria though seeing as the actual table is much, much larger.
    I've tried assigning number values to each damage multiplier and then merging all of them together for a specific typing and doing a VLOOKUP based on checkboxes determining what damage multiplier I want in a few specific types, the rest being filled in to the standard of 1x but the result isn't correct most of the time.

    Hi Mitchell,
    VLOOKUP can be set for accept either an 'exact match' or a 'close match'.  Your 17 digit 'number' is actually a 17 character text string (Numbers can handle numbers to a precision of only 15 places). Provided all 17 digits are present, sorting should be the same as for numerical values—the leftmost character is the most significant.
    As a text string, your 'number' is sorted/evaluated alphabetically. A 'close match' accepts the 'largest value that is less than or equal to the search value'.
    If your search term is 000200000 (a 9 character string), several 'wrong' answers will fit the 'close match' criteria, including all of those listed below:
    000200000 (the 'correct' match)
    0000xxxxx (x may be any of the three acceptable values)
    0001xxxxx (x may be any of the three acceptable values)
    The main problem here is that digits in a number (or characters in a text string) have decreasing significance related to their distance from the beginning of the string/number. You want a search in which each character has the same significance as each of the others when compared to the search key. To do that, you need to compare each character in the search string with the character in the same position in the similar string for each type of Pokemon, then take a count of the matches or a sum of the differences.
    Here's one approach:
    Column A contains labels.
    Column B, the 17 digit search term, created in whatever manner you wish, and the similar 17 digit string for each of the characters.
    Columns C through S contains a formula that detines, using subtraction, the difference between each digit of the search term and the corresponding digit of each character's profile.
    Column C uses SUM() to calculate the total of columns C to S for each row.
    T1 uses =MIN(T) to calculate "least different" profile.
    Column A is a Header column; Row 1 is a Header row.
    Formulas:
    C2, and filled right to S2, then down to the last row of data:
    =ABS(MID($B$1,COLUMN()-2,1)-MID($B2,COLUMN()-2,1))
    T1: =MIN(T)
    T2, and filled down column T: =SUM(C2:S2)
    The conditional formatting rule set for all body cells in column T is shown below the table.
    This may be enough to get you started. Formulas can be tweaked to produce results more closely matching what you're looking for, if necessary.
    Regards,
    Barry

  • How i can assign multiple values to tabuler text item (Help)

    HI
    IM PROGRAMMING ONE FORM AND I PUT THERE TABULER TEXT ITEM
    I WANT ASSIGN 63 VALUES TO THIS TEXT ITEM ONE BY ONE BY CODE I MEAN PUT FIRST VALUE IN THE FIRST TEXT ITEM ROW THEN SECOND TO THE SECOND TEXT ITEM AND LIKE THIS UNTIL I REACH TO THE LAST
    I MAKE LOV PUT I CAN ASSIGN ONE VALUE BY ONE VALUE EACH TIME DOUBLE CLICK ON THE TEXT ITEM ASSIGN ONE VALUE THEN DOUBLE CLICK ON THE SECOND ROW PUT MY BOSS WANT ASSIGN ALL VALUES 63 FROM ONE CLICK ON BUTTON

    Then you will have to create a when-validate-item trigger with a cursor based on your selection of your LOV . Loop through that cursor assigning the next in the next record by using the built-in function next_record. (put you selection for you value in a hidden item for example.
    something like this:
    Declare
    cursor c is
    select returnValueFromLOV
    from <yourtable>
    where yourdisplay value = :hidden_tem;
    begin
    for r in c loop
    next_record;
    item := r. returnValueFromLOV;
    end loop;
    exception
    when no_data_found
    your error handling;
    end;
    Hope it put you on the road to reach what you want
    Erwin

  • How do you assign a value to the APEX field APP_USER

    Application Express 4.0.2.00.07
    Hi
    Is there a special function/procedure to assign a value to the APP_USER field
    or a simple APP_USER := :P1_LOGIN_NAME would do
    Z

    Hello Zac,
    >> or a simple APP_USER := :P1_LOGIN_NAME would do
    The APEX engine is already doing it for you after a successful login – setting the value of APP_USER as the user login name. You can use it as a substitution string or with the bind variable notation (:APP_USER).
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • How can i pass multiple values by a single variable to EXECUTE IMMEDIATE

    Hi All,
    I want to pass multiple values for where condition for execute immediate. Something Like this:-
    bold
    Declare
    v_cond varchar(1000);
    Begin
    v_cond := '''INR','USD'''; --(OPTION 1)
    v_cond := 'INR,USD'; --(OPTION 2)
    EXECUTE IMMEDIATE 'Delete from table where colm in (:v_cond)' using v_cond;
    END;
    bold
    I am using this into a procedure
    Now option 1 gives an error ie a syntax error (; expected or something like that)(I am sorry, i can't tell the exact error here as i am not in the office right now)
    and option 2 makes the procedure execute but obviously doesn't delete the records, as it takes the whole as one.
    Please Help
    Regards
    Neeraj Bansal

    See the links containing examples under
    *7. List of values in an IN clause?*
    SQL and PL/SQL FAQ
    from the SQL and PL/SQL FAQ.

  • How do you print multiple copies of a single photo on one page in iPhoto 9.5?

    Help. Duplicating the photo as many times as I need it and then selecting them to print works, but in the last version of iPhoto you could explicitly choose to do just this. How do you do it now??

    That feature has been removed from the latest version of iPhoto. Send a feature request to Apple via http://www.apple.com/feedback/iphoto.html.
    OT

  • How do you assign a value to an expression in a composite component?

    Hi all,
    I have just started out on JSF 2.0 not too long ago. I am trying to create a composite component that can execute a method defined by the user and then assign the returned results to a bean, also defined by the user.
    Something like the one below:
    <composite:myComponent value="#{someBean.someProperty}"  action="#{someBean.someActionMethod}" />If its just executing the method, I have no problems with that. But I do not know how to assign the returned value. Can anyone enlighten me on how to execute the method in the component and then assign the returned value to the bean?
    Thank you.
    Edited by: honsho on Aug 4, 2010 1:36 AM

    I am not sure about that. Do you mean that all I have to do is provide the interface <cc:attribute name="value" type="lvl1.lvl2.someClass"/> and when I run the method, the returned result will be written into the expression provided in "value"?

  • How do you assign a value for Products in a Pop-up menu?

    I am preparing production cost spread sheet. In one column I2 - I have a pop up menu with lamination types to be selected - ie: None, Standard Film, Vehicle Film, Liquid Coating. I want to be able to associate values of these costs in column J2 - On another table (Laminating Costs) I have set values for each product ie: None = 0, Standard Film = $1, Vehicle Film =$2 and Liquid Coating =$0.5 -
    Therefore if I select Liquid Coating from the from the Pop-up menu in I2 on the main spread sheet - I want to see the associated cost of $0.5 appear in J2 by referencing the Laminating Costs table - I have tried various SUMIF formulas with no luck - Could someone point me in the right direction please.
    Thanks

    You can assign values to the items using a lookup table.
    http://discussions.apple.com/thread.jspa?threadID=2539456&tstart=0

  • How do you run Multiple Files on a single screen?

    Greetings; Please only respond if you've ACTUALLY done this, no opinions requested.
    I'd like to run several /.mov/mp4 files simultaneously on a single screen to simulate a 360deg view.
    If I start 5 cameras filming simultaneously (front, back, left, right,  rover), I'd like to sync the files, then combine the video on a single screen in large crossed  thumbnails/2"X2" format.   For example; Top, Bottom, Left, Right, Center images...
    How can this be done in Premier...?...and then exported to a standard format...?
    Again; Please only respond if you have ACTUALLY done this; no opinions please...
    Thank YOU

    If I start 5 cameras filming simultaneously (front, back, left, right,   rover), I'd like to sync the files, then combine the video on a single  screen in large crossed
    When I did this type of shot before I had to do some tricky stuff....and the hardest part for me was keeping me from shooting the other cameras and those other camera operators, not to mention trying not to see all those reflections of cameras and everything in the car, especially when I flew over the roof on wire !  Eventually I got it done but I had to basiscally use space lights with skirts and diffusion and then tent the car off with silk ( this was in a large football field sized stage )...and then put little holes in the silk for the "lenses"...and then hire a lot of people to walk that silk around as the cameras all dollied on track with the movement of the silk...  took forever to get the shot but it was beautiful if you squinted.
    good luck !
    ps...I when I edited this just like you want to do, with a lot of simutaneous screens within the frame, it looked so 3 dimensional people actually lost their balance watching it !

  • How do you add multiple videos to one single timeline in encore cs6

    please need assistance, i have 10 separate video files that i am trying to burn onto as few of dvd dl's as possible

    I would either put each video on its own timeline or use Premiere to edit them together. Often adding more than one video to a timeline in Encore does not work.

  • How to assigne multiple value in key of read table

    Hi gurus,
    I want read table xxxx with key field1 = ' xxx' or field1 = 'yyy'.
    how to assign multiple value as key for the same field while reading internal table.
    Regards
    sagar

    Hi ,
    You can loop the internal table like
    loop at  <table xxxx> where field1 = ' xxx' or field1 = 'yyy'
    or you can write two read statements to read the internal table in wrk area.
    read table   <table xxxx> with key field1 = ' xxx'.
    if sy-subrc <>0
    read table   <table xxxx> with key field1 = 'yyy'.
    if sy-subrc = 0
    endif.
    else.
    do your data processing.
    endif.
    Thans.

  • How do you assign program changes to external controllers in mainstage 1

    i would like to use 6 specific buttons on my controller to toggle between patches
    i know how to scroll through patches using my controller by assinging the next and previous patch functions to 2 buttons on my controller
    however what i want is to just be able to push button 1 and go to my gladiator AU synth, then push button 3 to go to my sylenth AU synth. basically i want to be able to change in real time on the spot, spontaniously without premeditation or having scroll between multiple patches to get to the one i want to use.
    in the previous posts it says
    on the patch list select the instument
    in the patch inspector go to attributes
    select program change, then assign it a number
    then assign a midi controller button to trigger that program change number
    i can do everything except the last part
    how do you assign a program change to a controller button? i cant see anywhere how to do this,
    i am using mainstage 1.0.2 thank you so much for any support you can give me

    I am not sure about that. Do you mean that all I have to do is provide the interface <cc:attribute name="value" type="lvl1.lvl2.someClass"/> and when I run the method, the returned result will be written into the expression provided in "value"?

  • Solaris 11 IPS:  How do you post multiple versions of the same package?

    How do you post multiple versions of the same software package on a single IPS instance(port)? Oracle was able to do it here with versions 151 and 175 of S11:
    http://pkg.oracle.com/solaris/release/
    Unfortunately, based on my searches, no where in the documentation (http://www.oracle.com/technetwork/server-storage/solaris11/technologies/ips-323421.html) does it explain to the development community how this is done. The best I can do is create pkg repo instances on different ports to host each different software version.
    We are trying to deploy an IPS repository for our drivers and utilities that our customers can link to and pull updates from. We have been able to post a software package to the repository using the command:
    pkgsend publish -s http://localhost:1234 -d ./ Appv1.p5m
    This posts the package on the IPS repository instance at port 1234 on the server. However, we would like to post multiple versions of the package on the server at the same URL. Why the same URL? So that our customers and end-users need only point to a single URL to pull down our software rather than having to add a new URL to the publisher list each time we have an update. We want at least 5 of the previous software versions to be available on the server. Posting each version of the application or driver on a different IPS instance on a different port will require customers to add multiple URLs to their publisher list and they also will not be able to initiate remote scans for updates.
    Has anybody been able to do this? Is any documentation forthcoming?
    Edited by: user13489824 on Jun 25, 2012 10:17 AM

    dhduvall: Thanks for your response. Yes, one would think that as long as the version numbers are different, you should be able to accumulate multiple versions of a package in a repository. It looks like Oracle has done it in their S11 repository unfortunately, as far as I know, they have not shared the steps on how to do this. I would like to publish two versions of the same package. I.E. two different manifests with two different fmri.pkg version strings and two different binaries.
    If I publish one package after another like this:
    pkgsend publish -s http://localhost:1234 Appv1.p5m
    pkgsend publish -s http://localhost:1234 Appv2.p5m
    Then only the second package shows up in the repository, as if it over-wrote the first one.
    Running pkgsend with two manifest, like this:
    pkgsend publish -s http://localhost:1234 Appv1.p5m Appv2.p5m
    Will cause pkgsend to combine the packages and manifests as if they were a single package... not what I am trying to do.
    Both approaches are complete without errors but neither achieves what I am trying to do.
    alan.pae: Thank you. Unfortunately, the link didn't really help. I've read Oracle's white papers and IPS developer guide so I'm familiar with the topics covered.
    Lex: Yes, I know. I specified the versions in the pkg.fmri value string.

  • How can I return multiple values with PL/SQL Web Services

    Hi,
    I'm new to developping Web Services. I'm doing some tests with JDeveloper and OC4J on my local machine with a Web Services based on a PL/SQL function within a package. Right now that function only returns one value. So the xml response only has one output.
    I'd like to know how can I return multiple values with my PL/SQL Web Service. For example, if I want to return an employee's name and id? And that the xml contains two output : <employee>, <empid>?
    Reginald
    ps : I have searched the forum and I couldn't find an answer to this question, if that has been discussed AND answered before, can you please post the link? Thanks

    Alright, I actually found my answer. Since this was asked I think as a followup somewhere else I'll give my answer.
    It is very simple, all you have to do is create an Object Type and then Return that object type. After that, JDeveloper will take care of everything and you will have an xml response with multiple values. Here
    {color:#ff0000}
    create or replace TYPE person AS OBJECT
    ( id_interv number,
    first_name VARCHAR2(50),
    last_name VARCHAR2(50),
    date_birth date
    );{color}
    Then your function used in your Web Service should look something like this :
    {color:#ff0000}
    function info_emp (p_empno IN VARCHAR2) RETURN person AS
    l_emp person := person(-1,'','','');
    BEGIN
    SELECT first_name
    ,last_name
    ,emp_no
    INTO l_emp.first_name
    ,l_emp.last_name
    ,l_emp.emp_no
    FROM emp
    WHERE upper(emp_no) = upper (emp_no);
    {color}
    {color:#ff0000}
    RETURN l_emp;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    l_emp := person (-1,'n/a','n/a','n/a');
    RETURN l_emp ;
    END info_emp;{color}
    {color:#ff0000}{color:#000000}After that, this is what the xml response looks like :{color}{color}
    &lt;first_name xsi:type="xsd:string"&gt;John&lt;/first_name&gt;
    &lt;last_name xsi:type="xsd:string"&gt;Doe&lt;/last_name&gt;
    &lt;emp_no xsi:type="xsd:string"&gt;0250193&lt;/emp_no&gt;

Maybe you are looking for

  • Error: variable XMLInterface not found in class

    Hi, I am creating an XML Publisher Report Output from OAF Page. This is my code in CustAM public void initSunReportVO() SunReportVOImpl vo = getSunReportVO1(); if(vo == null) MessageToken errTokens[] = { new MessageToken("OBJECT_NAME", "SunReportVO1"

  • Search and also Copy failed if "_" is in the second part of a hyphenated word. Is it a Bug?

    Hello, we are using PDF for our technical documentation, so we have a lot of variable names like "var_techUsage_true", etc. We gernerate these pdf files with the apache fop 1.1 processor. In our documents you can find several tables. Sometimes the ce

  • UploadedFile & https Only work first time upload ????

    I am using 10.1.3.4 Jdev. I use UploadedFile interface to upload files from local PC and ftp files to unix server. My "upload" web page works between my local PC and Unix server, but it only works first time upload file and ftp between https server (

  • TOBJ entries missing from upgrade dev and test systems

    Hi, We are in the process of ECC Upgrade from 4.7 to ECC 6.0 and upgraded our dev and test systems. We missing some SAP defined object entries in TOBJ table from dev and test. Because of this some of the roles getting transport errors if the roles co

  • Non existent order number in, "My Orders!" Frustrated!

    So frustrated! My iphone 6 plus order number doesn't exist when i click in "My Orders," yet my internet order number that was emailed to me continues to read "Processing." Anyone know what to do?