Want Linked Node to return self in getNext(0)

I'm trying to make a getNext for my linked list that can return anywhere from several nodes ahead to itself.
How do I make a method that can return itself? I don't want to pass the calling object in with the parameters, that seems rather messy. I can't do previous.next or next.previous because sometimes those values will be empty.
Sample code follows, with highlighting for attempted legibility:
I included the whole class at once since I didn't want it to be spread about if more was asked for.
Session is an enormous user-defined class that stores a lot of data of widely varying types.
class NodeSession
private Session value;
private NodeSession next;
private NodeSession prev;
*{color:#0000ff}//constructors{color}*
{color:#008000}public NodeSession()
Session defaultSession = new Session();
value = defaultSession;
public NodeSession(Session q, NodeSession r)
value = q;
prev = r;
public NodeSession(Session q, NodeSession p, NodeSession r)
setValue(q);
setNext(r);
setPrev(p);
{color}*{color:#0000ff}//gets{color}*
{color:#999999}public Session getValue()
return value;
public NodeSession getNext()
return next;
public NodeSession getPrev()
return prev;
{color}*{color:#0000ff}//sets{color}*
{color:#999999}public void setValue(Session q{color}{color:#999999})
{color}{color:#999999}{
value = q;
{color}{color:#999999}}
public void setNext(NodeSession r{color}{color:#999999}*)*
{color}{color:#999999}*{*
next = r;
{color}{color:#999999}*}*
public void setPrev(NodeSession p{color}{color:#999999})
{color}{color:#999999}{
prev = p;
{color}{color:#999999}}{color}
{color:#0000ff}*//attempted jumps*{color}
public NodeSession getNext(int i)
NodeSession newNext = next.getPrev();
+{color:#0000ff}//newNext = current nodeSession, but only if next exists+
+{color}{color:#0000ff}//need some way to refer to the object I'm trying to manipulate so I can return it.+
+{color}+for(int j = 0; j < i; j++)
newNext = newNext.getNext();
return newNext;
{color:#0000ff}//more of the same
{color}{color:#999999}public NodeSession getPrev(int i)
NodeSession newPrev = prev.getNext();
for(int j = 0; j < i; j++)
newPrev = newPrev.getPrev();
return newPrev;
{color}*}*
Comments on legibility are also welcome.  How are indents done in this forum?
Edited by: SothaSil on Mar 22, 2008 4:30 PM

Comments on legibility are also welcome. How are indents done in this forum?To post code, use the code tags -- [code]Your Code[/code]will display
asYour CodeOr use the code button above the editing area and paste your code
between the {code}{code} tags it generates.
db

Similar Messages

  • Maintain the link node in a hierarchy

    Hello,
    I have loaded 2 hierarchies H1 and H2 from ERP system and maintained a hierarchy Z in BW consists of H1 and H2. The node names are exactly the same of the 2 loaded hierarchies. Now I want to maintain the “link node flag” for the 2 nodes H1, H2.
    When I maintain the hierarchy this field is only displayed (and it is blank).
    How can I change this field to ‘X’.
    Thanks!

    Hi
    Did you solve this? Im facing the same problem
    Thanks!

  • Removed node history returns after an unspecified interval

    Hi Folks,
    I'm using the simpleChatModel::clear() to remove the history node as OWNER.    Everything looks fine from a web base client.  I check it in the AFCS Developer console and all the history nodes are gone.  Everything is working fine.  I reconnect to the chat no problem, I check in the AFCS Dev console, the history is as I would expect.  persistItems is checked as is allowPrivateMessages.
    I come back some time afterwards and all the history nodes have returned.
    As before I have a working chat deployed for a customer and it's been reasonably stable.    I've gone back to the simple chat as an install as a prototype and now I'm having this problem.
    Any suggestions on what I'm doing wrong?
    --Doug

    Hi DaddyDog,
    I have some good news and some bad news.
    Good news is that I could reproduce your issue many times trying from this morning from a network outside Adobe(from home). I couldn't reproduced it within Adobe Network last time. But I can now reproduce the issue many times. Moreover, I could reproduce this issue both in new rooms (created after april or ones with new domain) and also in old rooms. So, its independant of room creation timings.
    Bad news is that, even after scratching from morning, I havent been able to generate a clean fix, primarily because the clean fix isn't on the client SDK. This bug happens in my opinion as a race condition when you clear chat history, the nodes are deleted and recreated immediately inside model.clear() function. But all the items may not have been deleted on the server by the time we recreate the nodes.So, this could be mostly a bug on the server side.
    But I actually could create a hack with the model class and I am attaching the file for your reference. Try this file and let me know if you can still reproduce, hopefully not .  The file is of SImpleChatModel.as in player 10. If you are using player 9, let me know I can provide that file for player 9. You can diff with your SimpleChatModel.as in player 10 source and can see the difference and the hack in case you are interested. I can't guarantee that it will definitely work but at least it can let you going( you need to link to the source files and not use player 10 swc in your app).
    Meanwhile, we have started discussions internally on this issue and we should be able to come up with a cleaner fix in future release. I will keep you posted on that. In the meanwhile, go ahead and give it a try and let me know.
    Thanks again for finding. Issues like this are almost impossible to find without active help from user community.
    Regards
    Hironmay Basu

  • I just bought an iPod nano 7th gen.  When I connect it to my laptop, it doesn't recognize the ipod.  I tried charging it, but now it won't turn on when i push the power button.  Please help me!  I don't want to have to return it.

    I just bought an iPod nano 7th Generation.  When i connect it to my laptop, it doesn't recognize the ipod.  I tried charging it but when I hold the power button, nothing happens.  I don't want to have to return it.  Please help me!

    Hi dnix257,
    Welcome to the Support Communities!
    What version of the Windows Operating System do you have?
    What version of the iTunes software?
    The troubleshooting steps below may help you with this:
    Apple - Support - iPod nano - iTunes Troubleshooting Assistant
    http://www.apple.com/support/ipodnano/assistant/itunes/#section_1
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/TS1369
    Cheers,
    - Judy

  • Calculation in BEx on Hierarchy Link Nodes

    Hello everyone. I am working on a BEx query that involves a hierarchy based on Controlling Area, Cost Center, and Cost Element. There is a case where I have 5 Cost Elements that belong to 2 Cost Centers. I can successfully create the duplicate nodes at the different Cost Center levels and activate the hierarchy. Where I am having difficulty is assigning a percentage factor to the key-figure at the parent-node (80%) and the link-node (20%). The high-level node at CO_AREA is correct. However, the COST_CENTER nodes show the total original value. I would like to apply these factors dynamically in the BEx query. I have tried structures and cell definitions and was able to apply the 80% and 20% factors correctly to the corresponding hierarchy nodes. Unfortunately, the amounts are not broken down as I would like to see them.
    I have looked at the documentation on "Link Nodes" and "Modeling Nodes and Leaves: at help.sap.com.
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/fa3d3806136268e10000009b38f8cf/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a6743e07211d2acb80000e829fbfe/content.htm
    This is from one of the above links:
    "For both duplicate leaves and leaves in subtrees under link nodes, the values of the duplicate leaves are only considered once by the system internally. When aggregating, the system automatically calculates what are called correction leaves for the superordinate node.
    If a leaf Lo lies three times amongst the descendants of a node No, the value is added three times internally and then subtracted twice by the ’correction node’."
    I'm wondering if it is even possible to do what I would like to accomplish.
    I would appreciate any feedback and suggestions on how to solve this issue if you have done something similar.
    Best Regards,
    Albert Pecoraro
    Sr.SAP BW Specialist
    Ferro Corporation
    Example:
    CO_AREA_1000 = Total = <u><b>$1000</b></u> (AAAA = $800, BBBB = $200)
    --><u><b>COST_CENTER_AAAA</b></u> = $1000 @ 80% = <u><b>$800</b></u>
    >COST_ELEMENT_100 = 100 @ 80% = $80
    >COST_ELEMENT_101 = 200 @ 80% = $160
    >COST_ELEMENT_102 = 300 @ 80% = $240
    >COST_ELEMENT_103 = 150 @ 80% = $120
    >COST_ELEMENT_104 = 250 @ 80% = $200
    --><u><b>COST_CENTER_BBBB</b></u> = $1000 @ 20% = <u><b>$200</b></u>
    >COST_ELEMENT_100 = 100 @ 20% = $20
    >COST_ELEMENT_101 = 200 @ 20% = $40
    >COST_ELEMENT_102 = 300 @ 20% = $60
    >COST_ELEMENT_103 = 150 @ 20% = $30
    >COST_ELEMENT_104 = 250 @ 20% = $50

    Hi Alberto,
    Would you please post the resolution of the issue with the hierarchy node calculation? I too have a simillar requirement. It would be helpful if you share the solution for tha issue that you had.
    Saravana

  • If i bought the one to one membership today with my macbook pro but decided i don't really want it can i return it?

    If i bought the one to one membership today with my macbook pro but decided i don't really want it can i return it???

    only if you return the mac if it is within the 14 day return policy:
    "If you return your Apple Product under the terms of Apple’s Sales & Refund Policy, you will receive a full refund on your One to One membership and your account will be deactivated."
    http://www.apple.com/retail/learn/one-to-one/terms.html

  • Linked Server :: OLE DB provider "OraOLEDB.Oracle" for linked server "ABC" returned message "New transaction cannot enlist in the specified transaction coordinator. ".

    Hello All,
    As mentioned in title, i am stuck up with that articular error from last three days,
    i have following scenario, my SQL server 2008, my oracle 10g are on both same machine with OS Windows Server 2008.
    the following error generated on my management studio when i execute my procedure written in my SQL server. Following is original source code snippet after error massage.
    OLE DB provider "OraOLEDB.Oracle" for linked server "ORCL" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
    Msg 50000, Level 16, State 2, Procedure PROC_MIGRATE_MST_FRM_ORA_SQLSERVER, Line 43
    The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "ORCL" was unable to begin a distributed transaction.
    BEGIN TRY
    -- MIGRATION OF PR_COMPANY_MH START
    BEGIN TRANSACTION T1
    PRINT 'mILAN NNNNNNNNN 11'
    INSERT INTO PROD.PR_COMPANY_MH
    SELECT * FROM OPENQUERY(ORCL, 'SELECT * FROM PR_COMPANY_MH WHERE SQL_FLG = ''N'' ')
    PRINT 'mILAN NNNNNNNNN 12'
    UPDATE OPENQUERY(ORCL, 'SELECT SQL_FLG FROM PR_COMPANY_MH WHERE SQL_FLG = ''N''')
    SET SQL_FLG = 'Y'
    --EXECUTE ('UPDATE PROD.PR_COMPANY_MH SET SQL_FLG = ''Y'' ') AT [ORCL]
    PRINT 'mILAN NNNNNNNNN 13'
    COMMIT TRANSACTION T1
    -- MIGRATION OF PR_COMPANY_MH END
    END TRY
    BEGIN CATCH
    PRINT 'mILAN NNNNNNNNN 14'
    ROLLBACK TRANSACTION T1
    PRINT 'mILAN NNNNNNNNN 15'
    SELECT
    @ErrorNumber = ERROR_NUMBER(),
    @ErrorSeverity = ERROR_SEVERITY(),
    @ErrorState = ERROR_STATE(),
    @ErrorLine = ERROR_LINE(),
    @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-');
    PRINT 'mILAN NNNNNNNNN 16'
    SELECT @ErrorMessage = ERROR_MESSAGE();
    RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState, @ErrorNumber, @ErrorProcedure)
    PRINT 'mILAN NNNNNNNNN 17'
    END CATCH
    this perticular part is raising that error, and i had tried every configuartion on my local machine related to MS DTC.
    When i remove my transaction code, its work just fine no exception raise, but when i use then i.e. BEGIN TRAN, COMMITE TRAN, AND ROLLBACK TRAN. its giving me error, other wise its fine.
    Please Help or disscus or suggest why my transaction base code is not woking????
    thanks in advance.
    Regards,
    Milan

    Sorry again, I am new on any kind of forum, so i am learning now, following is the error massage generated by SQL Server. and its not
    an architecture problem, i had just included my complete architecture to be more informative while asking for the solution or suggestion. My real problem is T-SQL, i think and its related to Distributed queries raise in SQL Server in Oracle Link Server.
    OLE DB provider "OraOLEDB.Oracle"
    for linked server "ORCL" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
    Msg 50000, Level 16, State 2, Procedure PROC_MIGRATE_MST_FRM_ORA_SQLSERVER,
    Line 43
    The operation could not be performed because OLE
    DB provider "OraOLEDB.Oracle" for linked server "ORCL" was unable to begin a distributed transaction.

  • I have purchased iPhone 5on 13.02.2013. It is supply from Dubai. I want facetime in it. If not possible, I want to replace OR return. Pl advise

    Dear friends,
    I have purchased iPhone 5on 13.02.2013m in BAHRAIN from authorized distributor fono of AXIOM, Dubai.. It is supply from Dubai.
    This I purchased again exchange offer of my OLD 4S. In my OLD phone, Facetime was working nicely from Bahrain and I used to use it to talk with my son in Australia. Now in iPhone 55, it is not there.
    I want facetime in it. If not possible, I want to replace OR return. Pl advise
    Jayant Joshi

    Facetime is permanentely disabled from all phones legitametely sold in KSA and UAE. You will not be able to get FT working even if you are out of the UAE. Contact the seller to see if they will accept the phone as a return. There is nothing anyone here can do. This is between you and the seller.

  • Server Side Links (Node Link): caught exception

    HI ,
    Following error is showing up in System Audit Trace Logs:
    Server Side Links (Node Link): caught exception
    I am not able to figure is out why this error is coming.
    Can any please explain the reason of this error..
    thanks

    Hi
    Thanks for the link, it is indeed a good example. However, whilst it has some interesting points, it seems to narrowly skirt around the issue i am having (as do most examples in fact).
    Perhaps i should have been more clear that the problem i am having relates specifically to entities that have already been persisted, and all i am trying to do is edit them. In the example you sent, if bean-validation fails then the entity is not persisted, so no problems. However, when editing an already persisted entity, form submissions trigger an automatic database update via the EntityManager (provided JSF validations are passed), so my real problem is avoiding this.
    Any input appreciated.
    -Rich

  • I want link between draw and qmel or qmsm tables

    Hi all,
        I want link betwwn draw and qmsm or qmel tables means for particular notification number (notification type is repair means ZC) i want document number and document type. how i get this information from draw table .

    Hi Himmam,
      a good way is to run tx ST05 and activate a trace. Then go to the standard transaction, check the documents and come back to tx ST05 to deactivate and display the trace.
    You will obtain all the tables and perhaps the relationship between them.
    Regards,
    Carlos.

  • How to make query base delivery monthly report  link with delivery return

    Hi,
    I have facing some problem in Sales delivery report monthly. Problem is:
    1) When i make Monthly query delivery report without any delivery return and AR Credit memo, it is Fine.
    2) When i make Monthly query delivery report with any delivery return and AR Credit memo, it is not showing proper. Its showing in report including return quantity or AR Credit memo quantity.
    So, How to make query base delivery monthly report  link with delivery return and AR Credit Memo?
    Please help me regarding this.
    Mizan
    Edited by: mizan700 on Dec 18, 2010 2:50 PM
    Edited by: mizan700 on Dec 18, 2010 2:50 PM

    Hi,
    try this.
    SELECT DISTINCt T1.CARDCODE, T1.CARDNAME , T1.DOCNUM DELIVERY#,T1.DocStatus 'DELIVERY STATUS', T1.DOCDATE 'DELIVERY Date', T1.DocTotal 'DELIVERY Total', T3.DOCNUM Return#,T3.DocStatus 'Return Status', T3.DOCDATE 'Return Date', T3.DocTotal 'Return Total',T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date', (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due', T7.DOCNUM AS 'CREDIT MEMO#', T7.DOCDATE
    FROM DBO.DLN1 T0
    INNER JOIN DBO.ODLN T1 ON T1.DOCENTRY = T0.DOCENTRY
    LEFT JOIN DBO.RDN1 T2 ON T2.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.ORDN T3 ON T2.DOCENTRY = T3.DOCENTRY
    LEFT JOIN DBO.INV1 T4 ON T4.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.OINV T5 ON T5.DOCENTRY = T4.DOCENTRY
    LEFT JOIN DBO.RIN1 T6 ON T6.BASEENTRY = T5.DOCENTRY
    LEFT JOIN DBO.ORIN T7 ON T7.DOCENTRY = T6.DOCENTRY
    WHERE  T1.DOCDATE >= [%0] AND  T1.DOCDATE <= [%1]
    Thanks,
    Joseph

  • Wanted getRemoteUser method to return the network login Id(Windows Login)

    Hi,
    I have an application running on websphere 3.5,
    where the method HttpServletRequest.getRemoteUser() returns the users(client's) window login(the application is used across the network).
    I have migrated the application to the Webshere5.0.
    The problem I am facing here is the method
    HttpServletRequest.getRemoteUser() return null.
    I want this method to return the network login (Windows Login) id.
    I did create a user(tom) in the windows(2000 Professional) registry and change the setting to custom registry in the admin console(websphere 5.0), here the getRemoteUser returns the value 'tom'.
    I want this method(getRemoteUser) to return my windows login id.
    For eg: If I login into the system with the id 'Anupam', it should return the id 'Anupam'. If somebody else accesses the application from another system in the network then the method should return his login id.
    Please let me know if you know the solution for this.
    Note: The same is working fine with Websphere 3.5.

    Hi Pramod,
    There's a Function Module called <b>GUI_GET_DESKTOP_INFO</b> which you could use. The Function Module has got documentation so you should not have any problem using it.
    Do let me know if it helped.
    Regards,
    Anand Mandalika.

  • How to specify AND/OR relationships while linking nodes in uCMDB Java API

    Hi,
    I am trying to build a TQL via the uCMDB Java API. The structure that I am trying to build is of this type:
    |- Server
        |- Disk
        |- FileSystem
        |- NIC(Interface)
            |-IPAddress
    In the TQL I want to specify the relationship between server and  nic (interface) as composition or containment. So if either relationship matches, it should return me data.
    To build this, I used the following code:
    //server node
    QueryNode serverNode = queryDefinition.addNode("ServerNode").ofType("node");
    //nic (interface) node, uses containment link
    QueryNode nicNode = queryDefinition.addNode("NICNode").ofType("interface");
    //nic (interface) node, uses composition link
    QueryNode nicNode1 = queryDefinition.addNode("NICNode1").ofType("interface");
    // now add relationships
    serverNode.linkedTo(nicNode).withLinkOfType("containment").atLeast(0);
    serverNode.linkedTo(nicNode1).withLinkOfType("composition").atLeast(0);
    My guess is that when I am adding relationships using "withLinkOfType()", it directly ANDs the conditions. Is there a way I could OR conditions which says:
                        Give me NIC Interfaces which either have a composition or containment relation with my server.
    Thanks in advance!

    Hi,
    You need to create a ejb-jar.xml and jboss.xml files to deploy the application on the servers.
    Also, put these lines of codes after getting System Properties.
    prop.put(Context.PROVIDER_URL, "iiop://localhost:[port_no]");Thanks,
    Srikant

  • Link on report returns no value when record containts '&' or '' (space)

    I have created a report based on a sql script. I want to link this report to a form. With the standard LINK, the records that contain a space or '&' sign aren't linked to the form.
    Is there a way to resolve this? I know that there is a way to add html in the sql script and set the column to display as HTML.
    But what script do i need to manually set the link, and not using the standard Portal LINK?
    Thx.

    Hi,
    In the sql based report you can make a column a html link.
    Here is an example
    select ''||empno||'' empno,
    ename
    from scott.emp
    The above query returns a html link which points to a chart and takes empno as a parameter.
    Thanks,
    Sharmila

  • Frequently, when I click on a link, try to return to the previous screen or close a tab, an option box comes up that requires a choice rather than simply doing whatever was originally requested. How can these option boxes be prevented?

    Frequently, when I click on a link, an option box will pop up asking whether to open in a new tab or new window and several other options, rather than simply opening in the same window or tab. When I try to return to the previous screen, it often will not let me, or provides options that I do not want. When I try to close a tab, an option box comes up that has several choices that I do not want and "close tab" at the bottom of the box. How to prevent these option boxes from popping up?

    Turn of JavaScript. These are "per site" and generated by the site. They are not the normal function of the browser. This usually occurs on attack sites. I'd stay away from them.
    The only "trusted" site I ever saw do something like this is Google, which asks me if I'm sure I want to close the tab that has their search results. I really pisses me off, but I have yet to find a way to stop it.
    It is certainly bad coding behavior on the part of whomever designed the site. When a user clicks an action, it should be presumed, unless the action is potentially very destructive, that they intended to perform that action. A UI should never incessantly second guess the intentions of a user.

Maybe you are looking for