The question about Multiple key

Hey all:
I'm having a problem trying to create the multiple key (just like the c++)
In C++ , it looks like the following
typedef pair<short,short> Bipair;
map<Bipair,double> P_WD_MAP;
In Java
public class someclass{
private class Bipair implements Comparable{
short a,b;
public Bipair(short a,short b){
this.a=a;
this.b=b;}
public int compareTo(Object o){
if(((Bipair)o).a==this.a&&((Bipair)o).b==this.b)
return 0;
else if(this.a+this.b>((Bipair)o).a+((Bipair)o).b)
return 1;
else
return -1;}
HashMap<Bipair,Double> P_WD_MAP=new HashMap<Bipair,Double>();
It's ok to use the usage. But it needs the huge memory.
Because it needs to create the huge instances of the class Bipair.
Besides to use the symbol to connect the multiple key
( String.valueof(a)+"_"+String.valueof(b) ==> key )
Does it have the more effective method to create it ?
Thanks a lot.

You mean if Bipair must implement the Comparable
interface in this case?
Not really, but you can as well keep it just in case
you use the Bipair objects in a situation where you
want them in sorted order.I get it.
Because I don't implement the equal function.
So it creates the duplicate objects. (So it need the huge memory ^^|| )
The compareTo function only provides the orderly object, and don't provide
to avoid the duplicate object.
By the same way , if I use the TreeMap to contain it.
It's ok , too . (implement compareTo,equal,hashcode )
Thanks a lot . ^_____________________^

Similar Messages

  • I want to ask the question about phasor measurement.

    I want to ask the question about phasor measurement.the first one is that how can I accomplish the sychronized sampling with GPS?The other question is that how can I adjust the sampling rate for DAQ when the system frequency alter continuously.(if I used the DFT,due to the altering of frequency,I can't get the completed waveform)"

    Synchronising DAQ with GPS depends on the DAQ sampling rate. If the rate is higher than 2 Hz you can sample the 1PPS pulse of your GPS receiver together with your data.
    You change the sampling rate with the AI Clock Config.vi. You cannot do this on the fly so you must stop DAQ with AI Control.vi reconfigure the sampling rate and then start it again.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Hi, I have answered no to the question about saving password for one spesific site. I have changed my mind and would like Firefox to save the password. How do I reactivate the password saver for one spesific site?

    Hi, I have answered no to the question about saving password for one spesific site. I have changed my mind and would like Firefox to save the password. How do I reactivate the password saver for one spesific site?

    Check exception list of your Firefox password Manager and check if your site is there or not?
    * http://kb.mozillazine.org/User_name_and_password_not_remembered#Password_Manager_settings

  • HT5312 In itune I need to fill up the questions about card but i dont have credit card,what can i do?

    In itunes i need to fill up the questions about card but i dont have a credit card, what can i do about that?

    Hi Huyen1110,
    You can use the steps in this article to create an iTunes Store account that does not use a credit or debit card for payment -
    Create an iTunes Store, App Store, or iBooks Store account without a credit card or other payment method - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • A question about foreign key to multiple tables

    Hello everybody,
    I have a question about creating foreign key and I would appreciate if you could kindly give me a hand. Here are my tables:
    CREATE TABLE TEAM1(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM1 ADD CONSTRAINT PK_TEAM1 PRIMARY KEY(team_id);
    CREATE TABLE TEAM2(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM2 ADD CONSTRAINT PK_TEAM2 PRIMARY KEY(team_id);although the structure of both the tables is exactly the same, the values (in particular team_id) in both tables are different.
    Also I have another table named AGENT
    CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
    ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id)Now the problem is that the column team_id in AGENT table is actually a foreign key, but the value can be in either TEAM1 or TEAM2. As far as I know a foreign key points only to one table.
    How can I deal with this problem? Whenever there is an INSERT or UPDATE I have to make sure that the value of the column "team_id" in the table "AGENT" is a valid value either in "TEAM1" or "TEAM2"
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Do you have the ability to change the data model? If so a more appropriate structure may be something like this:
    CREATE TABLE TEAM(team_id VARCHAR2(20), team_name VARCHAR2(20));
    ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM PRIMARY KEY(team_id);
    ALTER TABLE TEAM ADD CONSTRAINT UK_TEAM UNIQUE (team_name);
    CREATE TABLE TEAM_PROJECT(team_id VARCHAR2(20), project_id VARCHAR2(20));
    ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM_PROJECT PRIMARY KEY(team_id, project_id);
    ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM_PROJECT1 FOREIGN KEY (team_id) REFERENCES TEAM(team_id);
    CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
    ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id);
    ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM FOREIGN KEY (team_id) REFERENCES TEAM(team_id);Edited by: Centinul on Jun 25, 2010 10:50 AM

  • Question about multiple LTS

    Hi,
    I am currently working with the rpd and a general doubt pops up... in the physical layer I have dimensions related, like for example Person, related to another dimension City and for example Age (with Foreign Key join):
    City -< Person
    Age -< Person
    So in order to have a true star schema in the BMM, I need to create a single logical table with these three physical tables, right? The question is how.
    I can add the physical tables as 3 logical table sources, or have one single logical table source, mapped to these three physical tables.
    What is the difference, if any? Can someone explain, please? I always use the first choice (multiple logical table sources, each of them mapped to one physical table), but is it better to have just one single logical table source?
    Thanks in advanced :)

    I'm not surprised that it works fine, but there is a chance that it can lead to some problems. Let me explain.
    You now have three LTS in your Logical dimension table Person.
    Person
    Age
    City
    When you create a report with columns from City and the Fact table, the BI Server will need to set up a join path between Fact and City table. There is no other option then via the physical Person table. So the BI Server decides for you to create a join between fact and person and person and city.
    When the City is joined to other tables in the physical layer then the BI Server might create another join path between Fact and City, because it thinks it is more efficient. This can lead to inccorect results.
    When you add the three physical tables to one LTS, you explicitly tell the BI Server, to create a join path from Fact to City table via the Person table.

  • Some basic questions about foriegn key , and relationships.

    Hi
    Thank you for reading my post
    I read some documents about foreugn key and tables relation ships.
    but i still can not understnad some stuff.
    1-when we have a foreign key , we have two tables that we want to relate them together
    in a way that one of ? table columns forced to be a value from ?? table column.
    what is name of those two tables , i saw , child-parent , ..... which confuse me.
    can some one please tell me correct name of those two tables ?
    2-some times we need some kind of master details relation like :
    one-to-many : i this case MANY table will have a column to point a record in ONE table , can this relation be a foreign key relation ?
    3-we can achieve many-to-many relation only by using a helper table to host both tables primary keys in a record to relate them together.
    can you point me to some resources that help me to find answers to this questions ?
    or explain them to me ?
    thank you for your time.

    These are critical database basics that you need to understand. I would seriously recommend getting some study in, because proper relational database design relies on the basic principle of data and relationships and a process called normalization.
    In reality, you only really need one gigantic table to host data. It would include everything you would want to know about something - let's take a sales order for example. You would have to record the customer's name, address, etc. along with every item they ordered, etc. You would have a HUGE table full of data that appeared over and over and over again. This is bad design for two basic reasons: it is difficult to query, and it is very easy to have minor mistakes like capitalization or alternate spellings that prevent things from matching up properly. For example, let's say Bob orders 40 widgets and 40 digits. In our hypothetical table, we could put it in as Bob - 40 widgets and Robert - 40 digits. See how confusing this can get even in a simple example? And let's say you wanted to correct all of Robert's orders to say Bob and you found out there were 40 orders from "Robert" How would you know which ones to change?
    The process of normalization helps to reduce the chance for these types of errors in addition to creating a good basis for indexes. You normalize the data by creating sets of parent/child tables with a "key" value to match them. In our hypothetical situation, you could create a table for orders and a table for customers. In the customers table you give all the detail for the customer in one place, and you assign each customer a unique number or ID. In the orders table we add the customer ID (NOT the name) and we ensure that we are getting the customer we want, in addition to saving a lot of space and eliminating redundancy. In our example, the customers table is the "parent" table and the orders table is the "child" table. The child table references the unique entries in the parent table via that id. That reference is referred to as a foreign key. The foreign key in the child table points back to the original and complete record in the parent table and eliminates the redundancy of keeping all that extra data for every order. Foreign keys in child tables always refer to a primary/unique key in the parent field.
    That help?

  • I bought a Canon 8400F scanner- question about multiple photos being scanne

    Hi,
    I have a question about about scanning photos. It was posted that if you scan something with multiple photos, it will separate the pictures.
    If I put 6 pictures on the scanner, will it automatically scan them and separate them, or is there something in the software where I select it to separate each picture.
    Thank you

    I'm not at my Mac right now but it should be real obvious in the CanoScan software. Open it up and play around. It will jump out at you.
    You don't tell it to select "each" picture. You merely tell it that there are multiple pictures and it then does everything automatically.

  • The question about parameter in ECC 6.0 system.

    hi
    T-code RZ10 ,  I checked  the parameters about  DEFAULT.
    but  there are one error and three Warns.
    ---one error
         there is [E:j2ee/dbname changes not permitted]   below  the parameter of  j2ee/dbname.
         PS: the background is red.
    ---three warns
         j2ee/scs/host
         W: Unknown parameter j2ee/scs/host , a check cannot be performed
         j2ee/scs/system
         W: Unknown parameter j2ee/scs/system , a check cannot be performed      
         j2ee/ms/port
         W: Unknown parameter j2ee/ms/port , a check cannot be performed      
         PS: the three parameters  are not  in T-code  RZ11.
    could you help me solution these question.
    thanks and regards

    hi,MIchael
       ---one error
            there is E:j2ee/dbname changes not permitted below the parameter of j2ee/dbname.
            solution:
                      the value of j2ee/dbname  was BS2.   just now, i deleted  the value of j2ee/dbname.                 
                     the error message does not come out,now.
       ---three warns
           j2ee/scs/host
           j2ee/scs/system
          j2ee/ms/port
        solution:
                  there is not the scs in the system. but there is the ms in system.
                  why they are specified , i dont konw.
                  if  those parameter doesn't exist, would i  be going to delete those parameter.
        thanks and regards.
        chu

  • The question about EDI in scenario 'Cross-Company Code Sales Processing'?

    I'm doing the exercise with IDES system for the scenario 'Cross-Company Code Sales Processing'.
    But when posting the EDI, it gave me the error as followings:
    there are related data in table EDPP1, including customer and vendor data, but it still informed me the questions.
    pls help!
    Object 0090033869
    Output type: tst IV for MM by ken
    Processing log for program RSNASTED routine EDI_PROCESSING
    EDI: Partner profile not available
    EDI: Partner profile not available
        Message no. E0332
    Diagnosis
        A partner profile could not be found with the following key:
        /0000000000/LI/
        This involves the key fields of the table EDPP1:
        -PARNUM  partner number
        -PARTYP  partner type
    Procedure
        Please check the EDI partner profiles.
        Execute function

    Hi
    Partner profile is not seems to be maintained in tcode WE20.
    Please maintain in WE20.
    Kind Regards
    sandeep

  • The question about the sharepoint server 2010 install

    Hi Friends,
    i have a question about the sharepoint server 2010 install. 
    my computer is used the windows server 2008 service pack 1. in order to install the sharepoint 2010 server, i need to choose to windows server 2008 service pack 2. my question is when i install the windows server 2008 service pack 2,whether the inside
    of my computer  information will be lost or change? 
    thank you in advance. 
    Qearl

    Hi ,
    No data will be lost either from your Windows program files or other drives as long as it is an upgrade.
    After upgrade you will still be able to see your old program files under windows.ol folder in the C: Drive of the new OS.
    The data will be lost only when you perform a clean install like complete formatting the HArd disk and installing from scratch.
    As mentioned it always good to maintain a backup preferable important files in a skydrive as there is a good chance of external drives crashing.

  • The question about portlet customization and synchronization

    I have a question about portlet customization and synchronization.
    When I call
    NameValuePersonalizationObject data = (NameValuePersonalizationObject) PortletRendererUtil.getEditData(portletRenderRequest);
    portletRenderRequest.setPortletTitle(str);
    portletRenderRequest.putString(aKey, aValue);
    PortletRendererUtil.submitEditData(portletRenderRequest, data);
    Should I make any synchronization myself (use "synchronized" blocks or something else) or this procedure is made thread-safe on the level of the Portal API?

    HI Dimitry,
    I dont think you have to synchronize the block. i guess the code is synchronized internally.
    regards,
    Harsha

  • Question about Multiple Choice Quiz

    I have multiple choice quiz that I'd like make more complex. The quiz is based on a movie clip with a series of questions on different frames and the same set of answer buttons on each frame (no keyframes on the answer button layer). The user clicks a button to go from one question to the next. There’s a scoring mechanism that displays the number of correct answers (score), the total number of answers clicked (right or wrong), and the percentage of right answers.
    For each question, only the first answer counts toward the score. If you click correctly the first time, a point is added to the score and to the total. If you click incorrectly the first time, a point is added to the total only. After you give the first answer, right or wrong, you can still click on all the answers to see which answer was correct; the correct answer button changes in appearance and the correct sound cue plays but no point is added to the score or total. If you click on a wrong answer after you’ve given the first answer, the incorrect sound cue plays but no point is added to the total. In other words, you can’t help or hurt your score after clicking on the first answer, but you can determine which answer was correct.
    This all works fine.
    But now I want to make a similar exercise that has TWO questions on each frame. The answers both come from the same set of answer buttons. The question is how to preserve the “only the first click counts” mechanism for each of the two answers, since clicking on the answer to the first question will mark the frame as “answer has been given” and prevent any further scoring. There needs to be a point given for each correct answer on the frame.
    Here’s the code from an answer button in the existing quiz. How would I modify this to allow for two answers per frame?
    on (press) {
                    /* This code executes whether this is the first click on the answer button or a subsequent click. If the answer is correct (if this is frame 1 or 3), the correct sound cue plays and the answer button changes its appearance, and if the answer is incorrect (if this is any other frame), the incorrect sound cue plays */
                    if (_currentframe == 1){
                            _parent.snd_obj.playsound("correct", "cue1");
                            answer1_mc.gotoAndStop(2);
                    }else if (_currentframe == 3){
                            _parent.snd_obj.playsound("correct", "cue1");
                            answer1_mc.gotoAndStop(2);
                    }else{
                            _parent.snd_obj.playsound("incorrect", "cue2");
                    /* This code executes only if this is the first click on the answer button. It checks to see if an answer has been clicked in this frame, and if not, it marks the answer as given (so this code will be executed only once) and then adds one point to the total, one point to the score for correct answers, and re-calculates the percentage */
                    if (!_parent.answerGiven[_currentframe]) {
                            _parent.answerGiven[_currentframe] = true;
                            _parent.total = _parent.total + 1;
                            _parent.percent = Math.round((_parent.score / _parent.total) * 100);
                           if (_currentframe == 1){
                                   answer1_mc.gotoAndStop(2);
                                   _parent.score = _parent.score + 1;
                                   _parent.percent = Math.round((_parent.score / _parent.total) * 100);
                          }else if (_currentframe == 3){
                               answer1_mc.gotoAndStop(2);
                               _parent.score = _parent.score + 1;
                               _parent.percent = Math.round((_parent.score / _parent.total) * 100);
                           }else{
                               _parent.snd_obj.playsound("incorrect", "cue2");

    This is indeed a very random issue. I have seen this in earlier versions of Captivate as well. I always create my template files from the blank theme, so I don't think it is specific to the theme.
    As for solutions, sometimes changing the quality of slide to high worked, other times just reopening Captivate worked. Here are some of the solutions I have found on these forums:
    1.  Create one more answer than I need (ie for a 4 answer question, create 5 answers) and then delete answer B.
    2.  Uninstalled/reinstalled my Captivate 6 software
    Sreekanth

  • Question about multiple application modules.

    Hello,
    Suppose I have 2 database schema’s. For both schemas I have 1 application module. All view objects are in the same project.
    For each application module I have an application definition.
    Is it possible to link between these two applications? Because sometimes these database schema’s link to each other and you would like to jump from one application directly to the other.
    For example you have orders locates in 1 DB schema and customers in another DB schema.
    You would want to jump from the order directly to the customer details in the second schema.
    Is this possible? Or do I need to make nested application modules etc?
    I can find very little info about this; the JHS def guide does not offer much information about multiple application modules etc.
    -Anton

    Anton,
    Yes, you can jump aroundd as you like.
    You just can't use view links between VO's based on different db schema tables.
    Nesting AM's doesn't help there, the DB connection of the top-level AM will be used.
    Why don't you create synomyms for the tables in the other schema?
    Steven Davelaar,
    JHeadstart Team.

  • The question about subquery

    Which statement about multiple column subquery is true?
    A. A pairwiese comparison produces a cross product
    B. A nonpairwise comparison produces a cross product
    C. In a pairwise subquery, the value return from the subquery is
    compared individually to the values in the outer query
    D. In a nonpairwise subquery, the value return from the subquery is
    compared grouply to the values in the outer query
    null

    The correct answer is:
    B. A nonpairwise comparison produces a cross product
    Consider the following:
    SELECT ename, job, deptno
    FROM emp
    WHERE ename IN ('MILLER','SCOTT')
    ORDER BY job, deptno;
    ENAME_____ JOB______ DEPTNO
    SCOTT_____ ANALYST__ ________20
    MILLER____ CLERK____ ________10
    If we use the above in a subquery and do a pairwise comparison to look for all the values returned from the subquery as a group (job, deptno), which are ('ANALYST', 20) and ('CLERK', 10), in the outer query, we get:
    SELECT ename, job, deptno
    FROM emp
    WHERE (job, deptno) IN
    (SELECT job, deptno
    FROM emp
    WHERE ename IN ('MILLER','SCOTT'))
    ORDER BY job, deptno;
    ENAME_____ JOB______ DEPTNO
    SCOTT_____ ANALYST__ ________20
    FORD______ ANALYST__ ________20
    MILLER____ CLERK____ ________10
    If we do a nonpairwise comparison to compare the values of job and deptno individually through individual sub-queries, we get a cross product, consisting of all of the combinations of job (ANALYST or CLERK) and deptno (10 or 20), which includes not just ('ANALYST', 20) and ('CLERK', 10), but also ('CLERK', 20) and ('ANALYST', 10), if they exist, in the outer query:
    SELECT ename, job, deptno
    FROM emp
    WHERE job IN
    (SELECT job
    FROM emp
    WHERE ename IN ('MILLER','SCOTT'))
    AND deptno IN
    (SELECT deptno
    FROM emp
    WHERE ename IN ('MILLER','SCOTT'))
    ORDER BY job, deptno;
    ENAME_____ JOB______ DEPTNO
    FORD______ ANALYST__ ________20
    SCOTT_____ ANALYST__ ________20
    MILLER____ CLERK____ ________10
    ADAMS_____ CLERK____ ________20
    SMITH_____ CLERK____ ________20
    In a pairwise subquery, the value returned from the subquery is compared grouply to the values in the outer query and does not produce a cross product.
    In a nonpairwise subquery, the value returned from the subquery is
    compared individually to the values in the outer query and produces a cross product.
    Therefore, the correct answer is:
    B. A nonpairwise comparison produces a cross product
    null

Maybe you are looking for

  • Change the inspection stock of material in qm only

    Hi All, Error I am getting while doing a Goods Movement is "change the inspection stock of material in qm only". Let me explain you what exactly happend. We moved transports, some how moved transports deleted the existing Inspection types in Producti

  • Is this good or bad in terms of battery life?

    So I have a question, my usage is 1 hour, 11 minutes; standby is 13 hours, 29 minutes. This is since the last full charge on my iphone4s and now the battery is at 68%. Is this good or bad, and the thing is when I used certain apps like words with fri

  • Unicode value of a non-ASCII character

    Hi, Suppose, the unicode value of the character ् is '\u094d'. Is there any Java function which can get this unicode value of a non-ASCII character. Like: char c='्'; String s=convertToUnicode(c); System.out.println("The unicode value is "+ s); Outpu

  • Cant specify the Java Build Path in the Web Module Project

    hi, I have a problem while specify  the project dependencies in the Web Module Project.While opening the properties of the web module project i cant choose the Java Build Path.The only two options i have are design root path and web service consisten

  • Customer Aging / Differe

    Dear Gurus, At sales order level my sold to party is different compare to rest of the mandatory partner function. Invoice post against payer. which is different as compare to sold to party. is there standard way so that system can also check the agin