How to remove a DoubleLinkedNode ?

Hi all,
I am very new to Java and have a question to you.
Currently I am trying to understand how Doublelinkedlists are working.
I was very happy because I could solved a lot of problems I had with the implementation of some methods.
There is just one of them left. It is the method which removes a DoubleLinkedNode. Although I thought I had a lot of idears I couldn't solve this problem.
It would be pretty nice if someone could take a look at my code below
* Diese Klasse implementiert das Interface Hitliste mit einer doppelt
* verketteten Liste.
* @author
public class LinkedHitliste implements Hitliste
     // Der Kopf der verketteten Liste
    private DoubleLinkNode _listenkopf;
     // Das Ende der verketteten Liste
    private DoubleLinkNode _listenende;
    // Die L?nge der Liste (Kardinalit?t).
    private int _laenge;
     * Erzeuge eine neue LinkedHitliste.
    public LinkedHitliste()
        // Diese Implementierung verwendet zwei W?chter-Knoten,
        // einen f?r den Listenanfang, einen f?r das Ende.
        // Sie markieren technisch die Grenzen der Liste und
        // enthalten keine Elemente.
        // Sie erleichtern das Durchlaufen der Liste, weil
        // viele Sonderf?lle entfallen.
        _listenkopf = new DoubleLinkNode();
        _listenende = new DoubleLinkNode();
        _listenkopf.setNext(_listenende);
        _listenende.setPrev(_listenkopf);
        _laenge = 0;
     * @see Hitliste#fuegeEin(java.lang.String, int)
    public void fuegeEin(String hit, int position)
            throws IndexOutOfBoundsException
        // Beim Einf?gen ist ausnahmsweise auch die Position
        // hinter dem letzten Element erlaubt.
        if (position!=_laenge)
            kontrollierePosition(position);
        // TODO fuegeEin               
        if (_laenge == 0)
            DoubleLinkNode _temp = new DoubleLinkNode(hit, _listenkopf, _listenende);
            _listenkopf.setNext(_temp);
            _listenende.setPrev(_temp);
        else if (position == 0)
            DoubleLinkNode _temp = new DoubleLinkNode(hit, _listenkopf, _listenkopf.getNext());
            _listenkopf.getNext().setPrev(_temp);
            _listenkopf.setNext(_temp);           
        else if (position == _laenge)
            DoubleLinkNode _temp = new DoubleLinkNode(hit, _listenende.getPrev(), _listenende);
            _listenende.getPrev().setNext(_temp);
            _listenende.setPrev(_temp);           
        else
            DoubleLinkNode _pos = _listenkopf.getNext();
            for(int i = 0; i < position; i++)
                _pos = _pos.getNext();
            DoubleLinkNode _temp = new DoubleLinkNode(hit, _pos.getPrev(), _pos);
            _pos.getPrev().setNext(_temp);
            _pos.setPrev(_temp);           
        _laenge++;
     * @see Hitliste#enthaelt(java.lang.String)
    public boolean enthaelt(String hit)
        // TODO enthaelt
        DoubleLinkNode _pos = _listenkopf;
        for(int i = 0; i < _laenge; i++)
            _pos = _pos.getNext();
            if (_pos.getElement().equals(hit))
                return true;
        return false;
     * @see Hitliste#gib(int)
    public String gib(int position) throws IndexOutOfBoundsException
        kontrollierePosition(position);
        DoubleLinkNode knoten = _listenkopf;
        for (int i = 0; i <= position; i++)
            knoten = knoten.getNext();
        return knoten.getElement();
     * @see Hitliste#entferne(int)
    public void entferne(int position) throws IndexOutOfBoundsException
        kontrollierePosition(position);
        // TODO entferne
     * @see Hitliste#gibLaenge()
    public int gibLaenge()
        return _laenge;
     * @see Hitliste#leere()
    public void leere()
        // TODO leeren
     * Schreibt den Listeninhalt auf die Konsole
    public void schreibeAufKonsole()
        for (int i = 0; i < _laenge; i++)
            System.out.println(gib(i));
     * Pr?ft, ob sich die angegebene Position im g?ltigen Bereich befindet.
     * Der g?ltige Bereich ist von 0 bis gibLaenge()-1.
     * @param position
     *            Eine Position.
     * @throws IndexOutOfBoundsException
     *             Wenn die Position nicht im g?ltigen Bereich ist.
    private void kontrollierePosition(int position)
            throws IndexOutOfBoundsException
        if (position < 0 || position >= _laenge)
            throw new IndexOutOfBoundsException(
                    "Position au?erhalb des g?ltigen Bereichs: " + position);
}

You'll get better help if you provide details about what problems you're having. In general, the process is like this, if you want to delete node cur.
cur.prev.next = cur.next; // tell the node before cur to point to the node after cur as its next
cur.next.prev = cur.prev; // same as above, in reverse

Similar Messages

  • Firefox hangs on opening requiring force quit I have snow leopard mac It hangs when I try safe mode. I need to know how to remove all traces of firefox on my mac so I can reinstall. I have tried terminal as advised on firefox webpage. Please advise m

    Firefox hangs on opening requiring force quit I have snow leopard Mac It even hangs when I try safe mode. I need to know how to remove all traces of firefox on my mac so I can reinstall. I have tried terminal as advised on firefox webpage. Please advise me
    == This happened ==
    Every time Firefox opened
    == I tried to update firefox add-ons ==
    == User Agent ==
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7

    Try a new profile. See [[Recovering important data from an old profile]]

  • ALV .  How to remove the sort buttons on toolbar in ALV report?

    Hi,experts
      As you know, in default case , the alv report will display two sort buttons(ascending ,descending) on its toolbar , So How to remove the sort buttons on toolbar in ALV report?
      Thanks for your help .

    Hi guixin,
    1. Before calling REUSE_ALV_LIST_DISPLAY
    2. Write this code :
    data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.
    exclwa = '&OUP'.
    append exclwa to excl.
    exclwa = '&ODN'.
    append exclwa to excl.
    3. Then while calling the FM,
       pass this parameter also .
    IT_EXCLUDING     = excl
    It will work fantastic.
    regards,
    amit m.

  • How to remove blank pages from WebI Report in view page layout option

    Hi,
             I am working in Business Objects XIR2 environment. I have a WebI report with several sections. I need to show the report as a book with 69 sections (each section on new page). there are 69 sections on cost center and each cost center section has almost 10 sections embedded in it. When i see in regular view - I only see 69 pages but when I try to see in "View Page Lay out" option, there is one blank page added after each results page.
    Please let me know how to remove this blank page. I need to give users the option to download the book as PDF on to their machine. Now, when I download to my machine, I see one blank page after each results page.
    Thanks in advance.

    Jus convert your report in Page Layout mode and see if your first pafe is getting expand in the second page.
    Now check if there are any cell going into second page.
    - if there are any blank cell which is there after table.
    you have to check formating very carefull.

  • How to remove credit card from iphone4s

    how to remove credit card from iphone4s

    Not sure what you mean by this. Are you trying to remove your credit card information from the App Store/iTunes store?

  • How to remove calendar in ical

    I clicked on a link that added a calendar to my ical which has now synced with my Google calendar and added all the events to it as well.  Unfortunately, I did not realize that this was going to add every single instance (multiple events per day) to all my calendars.
    I'd like to reverse this action but there is not easy way to do this in ical it seems.  I cannot "delete" the calendar because it does not appear in the list of subscribed calendars in ical.
    I subscribed to two calendars this way and I'd like to remove them both.  I also have to now deal with how to remove hundreds of entries in my Google calendar....and it seems there is no batch delete there either unless I pay for a third party program....arrrgh
    If anyone can shed some light on this I'd be most grateful.

    Thanks for your reply.  I "subscribed" to a couple of motorsports calendars in iCal by visiting a direct link on the Apple website like this one: http://www.apple.com/downloads/macosx/calendars/2011motogpworldchampionshipcalen darprovisional_gpticketltd.html    
    This adds the events contained in this calendar directly to iCal and I can't for the life of me find a way to "unsubscribe" or eliminate these entries short of erasing them manually one by one.  Unfortunately, there are many of them.
    If you know how I may go about doing this in an efficient manner, please let me know!

  • Adobe Creative Cloud (Desktop) does not work properly. The application is blocked : it could not be launch neither stopped. I'm on MAC Yosemite OS, does anyone know how to remove it properly or to force its stop. It does not appear in the launched applica

    Adobe Creative Cloud (Desktop) does not work properly. The application is blocked : it could not be launch neither stopped. I'm on MAC Yosemite OS, does anyone know how to remove it properly or to force its stop. It does not appear in the launched applications.

    I received no error message. The application was just trying to find applications unsuccessfully.
    I am using MAC OS 10.10.1
    I tried to uninstall the application  but it seems that a kind of deamon is still installed thus providing me to reinstall properly. Do you know where are the elements to remove in order to get my machine just like before ?
    Otherwise I would have to reinstall everything and this would be a pain.
    Thanks for your help.

  • How to remove folder and leaf icons from a tree

    Hi,
    I know how to remove when we have a mx component i.e.,
    <mx:Tree folderOpenIcon={null} ...../> similarly for
    closed and default leaf icon.
    But how do i achieve this from an action script like say i
    have,
    var tree:Tree = new Tree();
    tree.setFolderOpenIcon(null); ///is there something like this
    or any other alternative.
    Please advice.
    Thanks,
    Lucky

    the folderOpenIcon is a style so you have to set it with the
    setStyle method
    try:
    tree.setStyle("folderOpenIcon",null);

  • There is a transparent color over my file in muse whenever I'm editing the file, does anyone know how to remove this?

    Here's a screenshot. I've tried everything to make it go away, including changing the browser fill color, but this just wont change. It does disappear when I preview the site online, though. Does anyone know how to remove this color? Thank you in advance!

    Hi Jessica,
    Please go to View > Click "Hide grid overlay".
    Regards,
    Aish

  • How to remove % sign from List of Values

    Hi ,
    I have shared list of values thats is based on SQL query. At runtime the select list default value is showing as "%". Can someone suggest how to remove % and replace with null (blank)
    Thanks
    Aali

    In ist of Values region, if you select display null as 'Yes', in 'null display value' area use space tab or type something like ' - Select-' to replace %. Or, choose Display null as 'No.

  • How to remove available downloads from the list

    how to remove available downloads from the list without it resuming when i open itunes or check for available downloads?

    There is not a way to remove them from the list.  Just let them download, and then delete them from your library when they are done.

  • My ipod wont let me buy any apps because it says i have an invalid security code for my moms credit card but its the right one. and it also says i owe money for upgrading an app does anyone know how to remove my moms credit card cause i cant figure itout

    my ipod wont let me buy any appps because it says i have an invalid security code for my moms credit card but its the right one. and it also says i owe money for upgrading an app does anyone know how to remove my moms credit card cause i cant figure itout

    To change asccount information see:
    Changing Account Information
    For the code issue this may help.
    iTunes Store: My credit card's security code or zip code does not match my bank's records
    For a standard iTunes account you need a valid payment method even for free apps and app updates.
    What is making it think that you own money for an app upgrade?

  • Please explain me, how to remove an usb stick or memory chip? With experiences only in pc:s, I do not find on my first apple e.g. MacBook Air a solution. Until now I have succeeded to destroy one chip full of photos and - there's no life more in the port.

    Please explain me, how to remove an usb stick or memory chip? With experiences only in pc:s, I do not find on my first apple e.g. MacBook Air a solution. Until now I have succeeded to destroy one chip full of photos and - there's no life more in the port...
    Someone told me just to remove the chip in clicking it to the trash can and voilá - it would be done. But as I did so, on the screen appeared a text which let me know, that that way had been the wrong one...
    I should have clicked Finder plus something.... which I do not now remember but which was then not found behind the Finder.
    So please would someone be so kind and tell me, where I can find explanations for the most simple functions. The manual I got does not include a clue.
    Thank you!

    First make sure that no application is using or has open any files on the disk. Then:
    Click and drag the disk icon on the desktop to the trash. Wait for the system to recognize the action, and the icon should disappear from the desktop. It is then safe to remove the device.
    Alternatively, you can secondary click on the disk icon, and then primary click "Eject (name of disk)". Wait for the icon to disappear off the desktop, and then it is safe to remove the drive.
    Here is a detailed help document on the subject.
    http://docs.info.apple.com/article.html?path=Mac/10.7/en/mchlp1056.html

  • How to remove account balance so that i can change countries

    How to remove account balance so that i can change countries

    Click here and ask the iTunes Store staff to zero your account balance.
    (114163)

  • How to remove blank lines in the end of list .

    hi,
    in a complex report ,when there are only 20 pages,and linecount is 65(2) ,in the last page only 27 lines are filled and data is completed.then blank lines are printing from 27th line to 63 line.then end of page is triggering.
    so plz help me how to remove the blank lines here and immediately print the endof page.

    Hi,
    will this work for you.
    SET BLANK LINES OFF.
    These statements allow you to specify whether you want to output blank lines or not. Use SET BLANK LINES ON to output blank lines or SET BLANK LINES OFF to suppress them.
    Regards
    Viswanath Babu

Maybe you are looking for

  • OfficeJet 4620 regularly loses connection with HP drivers - but is still connected to network

    Hello, I recommended an HP OfficeJet 4620 printer for my parents a few months ago. I'm about to leave for a new job and want to make sure it's working properly before I do. Their home network uses a Motorola SBG6580 cable modem as a WAP, but the foll

  • The same 5 devices with one account, one is broken down and bought a new one

    hi, my question is: i have the same 5 devices on my itunes account, and one of this devices is broken down, and I buy a new one. Now the problem: There are only 5 same devices for one account, can I delete one of theses devices to use the new one wit

  • All selected 'n' consecutive rows in retrieved in a single query

    hello, I have table T with 50,000 rows create table T (student_id number, class_id number, quiz_id number, marks number) some sample rows like INSERT INTO T VALUES (1,1, 1, 50); INSERT INTO T VALUES (2,2, 2, 40); INSERT INTO T VALUES (3,1, 3, 34); IN

  • External break point in sap r/3 system

    i want to set external debugging to rfc in r/3 i tried to set it its getting set but when i call rfc from external system(webdynpro) its not gng to that break point i.e its not linking to that break point what could be the reason and how we can set e

  • Jstack - error occurred during stack walking

    Trying to use jstack to debug a deadlock on Solaris 8, using jdk/jre 1.5.0-08, I get the following error on stderr: $ sudo -u apache jstack 17453 > stack Attaching to process ID 17453, please wait... Debugger attached successfully. Client compiler de