Trouble removing some elements of a TreeSet/SortedSet

I've been stuck with this for quite a while, having been able to work around it, but now it's really getting annoying.
I'm using a TreeSet (using a SortedSet to have it synchronized) containing a list of nodes. Each node has a priority value, which is used as a key to sort the set.
I can use this successfully but after some time, when I want to remove a certain node, the call to remove doesn't succeed in removing the element from the set, the element is still in the set after the call. I checked my comparator manytimes, and everything seems to work fine there, I tracked the call and although my node is in the set, when the comparator is called, all the elements of the set don't seem to be tested, and the actual position of the node in the set "ignored" as several other elements.
in fact, I use two TreeSets, but they aren't not using the same comparator, so I don't think I have a conflit in there.
here is a very light version of the node class and the comparators (won't run, but give you an idea of what I'm doing)
Node Class
public class Node {
     protected double priority1;
     protected double priority2;
     int nodeID;
Comparators
private class Comparator1 implements Comparator
  public int compare(Object o1, Object o2)
    Node t1 = (Node)o1;
    Node t2 = (Node)o2;
    if (t1.nodeID == t2.nodeID)
      return 0;
    int diff = (int) (PRIORITY_SAMPLING * (t1.priority1 - t2.priority1));
    if (diff == 0)
      return t1.nodeID - t2.nodeID;
    else
      return diff;
private class Comparator2 implements Comparator
  public int compare(Object o1, Object o2)
    Node t1 = (Node)o1;
    Node t2 = (Node)o2;
    if (t1.nodeID == t2.nodeID)
      return 0;
    int diff = (int) (PRIORITY_SAMPLING * (t1.priority2 - t2.priority2));
    if (diff == 0)
      return t1.nodeID - t2.nodeID;
    else
      return diff;
}at some point, I use the following code to access my sets and exploit their data, having various treatments and stuff
maxPriority1Node = (Node) Queue1.last();
minPriority2Node = (Node) Queue2.first();
while (maxPriority1Node.priority1 > minPriority2Node.priority2)
  if (Count > desiredCount)
    minPriority2Node.merge();
  else
    maxPriority1Node.split();
    maxPriority1Node = (Node) Queue1.last();
    minPriority2Node = (Node) Queue2.first();
}at some point, I'm in the case : Count > desiredCount so I call the merge part, which adds the current node to the Queue1 while removing it from Queue2, but the removal is never done, so the node is still present in Queue2. When I get back from the call, the minPriority2Node is still the same node because it's still in the list, and I end up stuck in an infinite loop.
Can someone help me with this, or explain me what exactly happen when I try to remove the node from the set, which would explain why the node is still in the list after I tried to remove it ?
if you need some more details to understand my problem, just ask, I'll try to give you more informations then.

thanks for you help but, as you have guessed, merge and split do much more things than just dealing with the queues.
But I've found where the problem was.
I had wrongly assuming that the value returned by the comparator was used by the TreeSet, wether in fact, it's only the sign of it which is useful.
In my code, I was using a constant called PRIORITY_SAMPLING, which was an arbitrary int (0xFFFFFF) to convert my double values (the double values could be any value, not just normalized 0.0 to 1.0 values, so I could not use a bigger int value). This constant was used to convert my double value to an int, trying to have enough precision to differenciate approaching value. In fact, the precision of this constant was not sufficient.
now, I don't use the constant, which, in fact, was useless. Because what is important in the comparator result is not the value but the sign, so I can do a simple test between my double values and return -1 or 1.
I had to had a special case for nodes whose priority are equal, so that they get sorted by ID, which is consistent over time.
here are the new comparators :
private class Comparator1 implements Comparator
     public int compare(Object o1, Object o2)
          Node t1 = (Node)o1;
          Node t2 = (Node)o2;
          if (t1.nodeID == t2.nodeID)
               return 0;
          if (t1.priority1 == t2.priority1)
               return t1.nodeID - t2.nodeID;
          else if (t1.priority1 < t2.priority1)
               return -1;
          else
               return 1;
private class Comparator2 implements Comparator
     public int compare(Object o1, Object o2)
          Node t1 = (Node)o1;
          Node t2 = (Node)o2;
          if (t1.nodeID == t2.nodeID)
               return 0;
          if (t1.priority2 == t2.priority2)
               return t1.nodeID - t2.nodeID;
          else if (t1.priority2 < t2.priority2)
               return -1;
          else
               return 1;
}

Similar Messages

  • Thread FAQ:findind removed collection elements

    Hi All
    i have two threads and one collection with some elements ,The problem is one removed some elements in collections now i want to find out elements removed by thread one with thread two

    Well they're not in the collection any more, are they? so the thread that removed them will have to remember them somewhere, or else the other thread will need a copy of the original collection.
    It's not a Thread FAQ question. Any two classes that used the collection would have the same issue.

  • Removing XML elements

    Hi all!
    I have a problem about an xml. I have to eliminate redundancy
    So from this xml:
    <xml1>
    <Property>
    <Parameters1>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>B</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters1>
    <Parameters2>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>D</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters2>
    </Property>
    </xml1>
    I want to obtain this xml:
    <xml2>
    <Property>
    <Parameters1>
    <Param>
    <name>A</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>B</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    <Param>
    <name>C</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters1>
    <Parameters2>
    <!--Parameters A and C are missing-->
    <Param>
    <name>D</name>
    <prop></prop> <!--this doesn't matter-->
    </Param>
    </Parameters2>
    </Property>
    </xml2>
    There are just parameters without repeting.
    My code until now is:
    private String numeParam;
    private Vector elParam = new Vector();
    for (int i=0;i<rootlist2.getLength();i++)
    Element element2 = (Element)rootlist2.item(i); // rootlist is my doc xml
    if (element2.getLocalName()==Property)
    NodeList childrenName2 = element2.getChildNodes();
    for (j=0;j<childrenName2.getLength();j++)
    Element elemm = (Element)childrenName2.item(j);
    if ((elemm.getLocalName() == "Parameters1")||(elemm.getLocalName() == "Parameters2"))
    NodeList param = elemm.getChildNodes();
    for(int y=0;y<param.getLength();y++)
    bn=true;
    bas=true;
    Element childInProperty2 = (Element)param.item(m2); // acesta e de sters
    if (childInProperty2.getLocalName() == Param)
    NodeList tlist =childInProperty2.getChildNodes();
    for (int y = 0;y<tlist.length();y++)
    Element childInPUParam2 = (Element)tlist.item(y);
    if (childInPUParam2.getLocalName()== "name")
    numeParam = childInPUParam2.getTextContent();
    bas=false;
    if (bas==false)
    if (!elParam.contains(numeParam))
    elParam.addElement(numeParam);
    if (elParam.contains(numeParam))
    bn=false;
    break;
    } end if
    } // end for
    if (bn==false)
    ba = false;
    if (bn==false)
    System.out.println("C");
    ba = false;
    elParam.clear();
    this is working I a kind of way, but this remove some elements that is not god. I wonder... Is like elParam contains some strings but, after me is imposible.
    Thanks all

    Why don't you use XPath? Anyway.
    -> Get a List of the documents Node
    -> Get a List of all children
    You have to check each Node:
    -> if the node is not null
    -> if the node's name is not null
    -> if the node's content is not null
    -> if the node's name is equals (<name>)
    If the Node-Element is found, store it in a Collection (the reference of the node object).
    Later you could iterate the collection and remove all Nodes from the Document.
    Afterwards you can transfer the document to a xml file.
    btw: if you use XPath you have to be sure to use at least Java 1.5
    Regards,
    Florian

  • Photoshop Elements 12 has been wiped of my laptop when they removed some viruses. How do I get it back because I bought it online and downloaded it instead of having the program disc?

    How do I recover the program for Photoshop Elements 12 that was wiped off my computer when they removed some viruses? I no longer have the program because I bought it on-line and downloaded it instead of having the program disc. I bought it last year and can't seem to contact anyone at Adobe or find out who to call.

    You can download it here:
    http://prodesigntools.com/photoshop-elements-12-direct-download-links-premiere.html
    Follow the Very Important Instructions exactly, even when they don't seem to make much sense. Of course you will need your serial number.

  • I am having trouble removing songs from my iPhone.  i have unchecked songs in the library on my mac, but they still show up on phone after syncing.  how do I remove them?

    I am having trouble removing songs from my iPhone.  i have unchecked songs in the library on my mac, but they still show up on phone after syncing.  how do I remove them?

    Hi asims01,
    Welcome to the Support Communities!
    The information below may be able to answer your questions about how to delete songs from your iPhone:
    Deleting songs downloaded to your device
    Tap the Music app.
    Tap More > Songs at the bottom.
    Scroll or search for the song you would like to delete from your device.
    Swipe right to left on the song, and then tap Delete.
    Note: You must be in Artists, Songs, or Albums view to delete songs from your device. Deleting from a playlist won't remove a song from your iOS device.
    Also, this information can be found on page 64 of the iPhone User Guide for iOS 7
    http://manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Remove a song from iPhone. Tap Songs, swipe the song, then tap Delete. The song is deleted from iPhone, but not from your iTunes library on your Mac or PC, or from iCloud.
    If you have iOS 7, this will delete the song from local storage, but the song will still appear with a cloud symbol in the Music app, as you've noticed. To hide the iTunes in the Cloud purchases, navigate to Settings > iTunes & App Store, and disable "Show All: Music”
    There may be a few orphaned songs on your iPhone that were partially downloaded or corrupted in some way. If that is the case, you can erase all of the music from your phone.  Follow the instructions below and select the Music app under Usage:
    iPhone, iPad, and iPod: Understanding capacity
    http://support.apple.com/kb/ht1867
    I hope this information helps ....
    - Judy

  • Remove xml element using JS[CS3]

    Hi, I have an xml structure where i want to remove some paritcular element named "extlink".
    I do have one script with me but it doesn't wipe out all specific xml element from structure.
    var myDoc = app.activeDocument;
    var foundtext = 0
    Query_Remove (myDoc);
    alert ("You have removed " + foundtext + " " +" Link !!")
    exit (0);
    function Query_Remove(elm)
    try
    for(var i=elm.xmlElements.length-1; i>=0; i--)
         if((elm.xmlElements[i].markupTag.name == "extlink") && (elm.xmlElements[i].xmlElements[0].markupTag.name == "http"))
        var Store_CitAttri = elm.xmlElements[i].xmlElements[0].xmlAttributes.item("c_style").value;
         if(Store_CitAttri == "URL")
          elm.xmlElements[i].remove();
         foundtext = foundtext + 1;
       Query_Remove(elm.xmlElements[i]);
    catch (e){
    Some time it skip the element from all figure captions and some time from body text and some time it works perfectly
    Could any one figure it out why this script behaviour is not consistent as i am new to scripting and not getting any idea about this.
    Thanks
    Mac

    Okay, after peering over your code and trying a few things out I see one immediate problem and one possible improvement.
    The problem lies in this:
    1. if condition is true, remove item
    2. check recursively
    The problem is .. if an item is removed, the following recursive check will always fail. However, the entire loop is wrapped into a try..catch, so InDesign will not alert you that it failed. Instead, it will continue with what's after the loop, exactly because the try..catch is around the entire loop!
    Change the loop code to this
    if((elm.xmlElements[i].markupTag.name == "http") && (elm.xmlElements[i].parent.markupTag.name == "extlink"))
        var Store_CitAttri = elm.xmlElements[i].xmlAttributes.item("c_style").value;
        if(Store_CitAttri == "URL")
          elm.xmlElements[i].remove();
           foundtext = foundtext + 1;
           continue;
    Query_Remove(elm.xmlElements[i]);
    so the recursive checking is skipped. You can also remove the entire try..catch block, as this may hide additional errors ...
    The improvement is: as I started reading this thread from the top again, shouldn't you be removing the "extlink" items, rather than just the "http" ones inside?
    If so, remove the parent of the found item (which is always the "extlink"):
          elm.xmlElements[i].parent.remove();
    -- and, as this will break the loop (because you just removed the set of elements it was working in!), replace 'continue' with 'return'.
    Hope this helps

  • Removing specific element from a list

    Hello, I'm very new to java, and to programming in general.
    I'm trying to write a secret santa app for my family for christmas. Essentially the idea is that 7 names are put into a list, and each time a name is "pulled" (i.e. randomly assigned to a name /= itself) it will be removed from the list of available names to assign.
    String[] nList = { name2, name3, name4, name5, name6, name7 }; // store names for random use
    Random r = new Random();
    name1assign = nList[r.nextInt(nList.length)];
    String[] nList2 = { name1, name3, name4, name5, name6, name7 };
    name2assign = nList2[r.nextInt(nList2.length)];
    My goal for this is to take the string that is equal to name1assign, and remove an element with that string from nList2.
    Can anyone give me some advice in this matter?
    Thanks.

    Sometimes a null value is used to indicate an 'empty' array element, but it would be better to try collections instead.
    You could use an ArrayList instead of an array. This has methods to remove items by index or value.
    An ArrayList also works with Collections.shuffle, which allows you to simply iterate over the list and not deal with random or removing elements at all.

  • Im having trouble making some changes to our webite. Im using DW CC 2014, 8.1 , HP Pavillion pc. Id be happy to pay someone to help.

    im trying to make some changes on our website (oilfiltercrushers.com). Im using DW CC 2014, 8.8, HP Pavion pc. The problems include:trying to move an image farther to the left & also to remove too much vertical  space, trying to remove "AAAs tht show up on a webpage table even they don't show on the local file that was put, a webpage that I cant see on the website even though it was put & appears in the remote files folder. Id be happy to pay someone to help me fix these problems. Thanx, Paul ([email protected], 4146514636)

    Hi Nancy
    Thanx for your response and commenting on our homepage. I wasn't aware of the problems you mentioned. However it has ranked on the first page of Google, etc for 20 years, so that's not my concern at this point.
    The 2 most immediate things are getting rid of the  A"s showing up on the table on oilfiltercrushers/truck_ofc.aspx and on /defaultnew.aspx , (the intended home page when I get it fixed,) I get a server error highlighting line 293 
    &nsp;
    . Im not sure what to do about that...
    I hope you can help me with this. If its more convenient, you can call me at 414-651-4636. I'll pay you for your input.
    Paul
    I look forward to hearing from you.
    Paul
    "Nancy O." <[email protected]> wrote:
    Nancy O.  created the discussion
    "Im having trouble making some changes to our webite. Im using DW CC 2014, 8.1 , HP Pavillion pc. Id be happy to pay someone to help."
    To view the discussion, visit: https://forums.adobe.com/message/7034503#7034503
    >

  • Manually remove Premiere Elements 11

    I have a Windows 7 PC and Office 2007 Home Premium with Adobe CS6 and Premiere Elements installed.  I recently upgraded to an SSD and Elements didn't take well to it.  I wanted to uninstall it and then do a clean install onto the new SSD.  When I try do remove  it, though, I get a 1316 error message that "Adobe Premiere Elements.msi" is missing.  Interestingly, I searched for this on both of my drives and couln't find it, then went to my mirror back-up from before the SSD install and couldn't find it there either!
    It seems the best solution is to manually remove the folders and files, although I don't know what or where they are.  I did find a list of PSE 8 files and folders, but was concerned about going back three revisions.
    I would like a list of the files and folders used by Premiere Elements 11.  Also, are all of the "Media, People, Places, Events", etc. in Elements safely saved with the photos?  I definitely wouldn't want to loose all that information!

    http://helpx.adobe.com/photoshop-elements/kb/manually-remove-photoshop-elements-11.html.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • Removing DOM element effectively

    How can i efficiently remove child element from a Node? I have a scenario like this I have an xml doc given below
    <menudocument>
    <parentmenu name="menu">
    <item title="Home" url="http://localhost:8081/struts" permission="home.show"; />
    <menu name="create menus">
    <item title="Create Person" url="/struts/jsp/Personcreate.jsp"; permission="Hide" />
    <item title="Create Shop" url="/struts/jsp/ShopCreate.jsp"; permission="Hide" />
    <item title="Create Book" url="/struts/jsp/BookCreate.jsp"; permission="Hide" />
    </menu>
    <menu name="search">
    <item title="Search Book" url="/jsp/book!startSearch.action"; permission="book.search"; />
    <item title="Search Person" url="/jsp/person!startSearch.action"; permission="Hide" />
    </menu>
    <menu name="sample menu">
    <item title="Item Text1" url="itemurl.do"; permission="text1.item"; />
    <item title="Item Text1" url="itemurl.do"; permission="Hide" />
    </menu>
    <menu name="dummy menu">
    <item title="Dummy Title" rul="dummyurl" permission="title.dummy"; />
    </menu>
    </parentmenu>
    </menudocument> Here if the permission attribute of an element is 'Hide' I have to remove that element from the document
    I have a code snippet like below but i don't know why it is not removing all the elements with attribute value 'Hide'
    File menuFile = new File("XMLmenuFile.xml";);
    DocumentBuilder builder = Document().newDocumentBuilder();
    Document menuDocument = builder.parse(menuFile);
    NodeList nodes = menuDocument.getElementsByTagName("item");
    for (int i = 0; i < nodes.getLength(); i++) {
    Element itemTag = (Element) nodes.item(i);
    if (itemTag.getAttribute("permission")).equalsIgnoreCase("Hide")) {
    // remove the corresponding nodes from the new tree
    itemTag.getParentNode().removeChild(itemTag);
    } Any help will be greatly appreciated.
    Thanks,

    Is it only removing some of them? Then you are encountering the classic gotcha that when you remove an entry from a numbered list, you renumber all the entries after that one. But your code, which simply goes from 0 to n, doesn't account for that. If you traverse the entries from n to 0 then the problem doesn't arise.

  • Using the instructions posted, I am not able to customize the add-on bar. I cannot move or remove the elements there.

    I went to the instructions about how to customize the add-on bar. These were basically the same as for the other bars which appear on the top of the browser which I've done many times before. I wanted to move some items to the left of the bar and I wanted to remove some items. I was not able to do either of these things. The icon which is the moveable hand would not appear when mousing over the elements on the bar. I was able to add and remove a separator element but it would place only to the left of all the elements. I was not able to place it in any other spot.

    Some (possible) bug reports have been filed on the inability to rearrange all of the icons on the Add-on Bar. There may be some involvement of other add-ons causing that problem, but that is yet to be determined.
    I have not tried the latest version or Organize Status Bar (OSB) that '''silkphoenix''' pointed to in the post above. The note on that page indicates that the only update was changing the <max-version> to 4.0. I had already done that in the previous version of OSB that I have installed and doing just that did not solve the problem. In my case, some of the add-on icons are grouped together with a gray background in Customize mode and those seem unmovable.
    To move items to the left, you can try inserting Flexible spaces (or spaces) from the Customize palette.
    <br />
    <br />
    '''Other issues needing your attention'''
    The information submitted with your question indicates that you have out of date plugins with known security and stability issues that should be updated. To see the plugins submitted with your question, click "More system details..." to the right of your original question post. You can also see your plugins from the Firefox menu, Tools > Add-ons > Plugins.<br />
    <br />
    *Adobe Shockwave for Director Netscape plug-in, version 11.5.9.615
    **Current security update version is 11.5.6.620
    *Adobe PDF Plug-In For Firefox and Netscape "9.4.2"
    **Current security update versions are 9.4.3 and 10.0.2 released on 2011-03-21
    *Shockwave Flash 10.2 r152
    **Security update version10.2 r153 released on 2011-03-21
    #'''''Check your plugin versions''''' on either of the following links':
    #*http://www.mozilla.com/en-US/plugincheck/
    #*https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Shockwave for Director'''
    #*NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    #*Use Firefox to download and SAVE the installer to your hard drive from the link in the article below (Desktop is a good place so you can find it).
    #*When the download is complete, exit Firefox (File > Exit)
    #*locate and double-click in the installer you just downloaded, let the install complete.
    #*Restart Firefox and check your plugins again.
    #*'''<u>Download link and more information</u>''': http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox
    #'''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**SAVE the installer to your hard drive (save to your Desktop so that you can find it after the download). Exit/Close Firefox. Run the installer you just downloaded.
    #**Use either of the links below:
    #***https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox ''(click on "Installing and updating Adobe Reader")''
    #***''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #*After the installation, start Firefox and check your version again.
    #'''Update the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "'''Download and information'''" or "'''Download Manual installers'''" below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*'''Download and information''': http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    #*'''Download Manual installers'''.
    #**http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller
    #**Note separate links for:
    #***Plugin for Firefox and most other browsers
    #***ActiveX for IE

  • Kill a thread and remove the element from the vector

    Hi All
    I have attached each Vector element to a thread which I later want to kill and remove that element from the Vector.
    Thread.join(milliseconds) allows this functionality to let the thread die after n milliseconds.
    However, I want to delete this element from the Vector now.
    Can someone please throw some light on this?
    Here the code I have written for this:
    try
         System.out.println(counter);
         int xCoord = generator.irand(25,200);     // X-coord of AP
         int yCoord = generator.irand(25,200);     // Y coord of AP
         listMN.addElement(new MobileNode((int)mnId,new Point2D.Double(xCoord,yCoord)));
         listMNcoords.addElement(new Point2D.Double(xCoord,yCoord));
         for(int i=0;i<vnuBS.returnBSList().size();i++)
              if(vnuBS.returnBSListCoords().get(i).contains(xCoord,yCoord)&&(vnuBS.returnBSList().get(i).getChannelCounter()<=3)&&(vnuBS.returnBSList().get(i).getChannelCounter()>0))
                   double c = exponential() * 10000;
                   long timeToService = (long)c;
                   System.out.println("BS "+vnuBS.returnBSList().get(i).id+" is connected to MN ");
                   vnuBS.returnBSList().get(i).reduceChannelCounter();
                   System.out.println("Channel Counter Value Now: "+vnuBS.returnBSList().get(i).getChannelCounter());
                   mobileNodesThread.addElement(new Thread(listMN.elementAt(mobileNodeCounter)));
                   mobileNodesThread.elementAt(mobileNodeCounter).setName(mobileNodeCounter+"");
                   mobileNodesThread.elementAt(mobileNodeCounter).start();
                   mobileNodesThread.elementAt(mobileNodeCounter).join(100);
    //                              System.out.println("Died");// thread dies after join(t) milliseconds.
                   System.out.println("ListMN getting generated : " + mobileNodesThread.get(mobileNodeCounter));
              else if(vnuBS.returnBSListCoords().get(i).contains(xCoord,yCoord)&&(vnuBS.returnBSList().get(i).getChannelCounter()<=0))
                   listMN.remove(this.listMN.lastElement());                         //dropcall
                   System.out.println("Removed "+mnId);
                   removeCounter++;
                   mnId = mnId--;
                   mobileNodeCounter--;
              mnId = mnId+1;
         Thanks a lot.

    I'm not sure if what you are trying to accomplish is correctly implemented.
    The method join does not kill the thread. It will wait for the specified time for the thread to exit. If you want the thread to run for a specified ammount of time, develop the run method of that thread with that in mind. Do not try to kill it from the outside, but let it terminate itself (gracefull termination).
    Now for your question regarding the vector (you should probably be using ArrayList nowadays): I would implement the observer pattern for this job. Make the threads post an event on the interface when they are done, let the main thread register itself with the threads and synchronize the method that handles the events. In that method you can remove the object from your list.
    I'm not sure if you want to use thread anyhow, could you tell us what it is that you are trying to accomplish?

  • Trouble removing the screws

    I have a "new" (Open Box) Mac Mini 2.0 ghz Intel Core 2 Duo that I bought through PowerMax. I want to upgrade the RAM, and I'm having trouble removing the four screws around the base of the inner chassis. I'm using a Phillips-head PH-00 screwdriver. Last night, I was able to get three of the screws out, but couldn't get the last one. I gave up and just put the computer back together. I'm trying again tonight, and I'm having the same problem. Am I missing something? Is there a preferred order for removing the screws or something? The screws giving me the most problem just won't come out. No matter how long I turn, they just won't move. It feels like the screwdriver has good placement, and I can feel something moving. I've watched several videos online of this procedure, and it seems like most people can just pop them right out. Any advice?

    I was watching a video on some web site, and some of the screws in a mac book pro have a magnent holding it very very tightly! Perhaps that will solve your problem!
    -Devin

  • Trouble removing screws on Powerbook...What helps?

    I'm having trouble removing the screws on both of the sides of the powerbook:
    http://www.ifixit.com/Guide/Mac/PowerBook-G4-Al-12-Inch-867-MHz/Metal-Framework/ 53/15/Page-4#top
    They're very tight and nothing seems to help.
    What can I use or do?

    J.F.
    These screws are very stubborn. You need to be very careful not to damage the head of the screw. I did that the other day and was fortunate that I had it out a bit and my son-in-law, who has a steadier hand than I, used a thin cutting disk on a dremel tool to make it a slotted screw. So, what can you do? You could try a tiny drop of WD40 or penetrating oil, and give it time to penetrate. If you can't get it, take it to the Genius Bar and get some help.
    cornelius

  • How do I remove Photoshop Elements help files?

    Greetings,
    I removed Photoshop Elements 9, but the help files are still in Adobe Community Help 3.5.0.23. How do I remove the PSE9 files from Community Help?
    I'm using Windows 7 Home Premium SP1 64-bit.
    Thanks,
    Shane.

    Thanks. Tried the FAQ before posting.  Perhaps you are better at wording a query; my attempts were unsuccessful. Am using the 30 day trial to see if I wish to purchase PE as the Oranizer function is my primary interest. Still would greatly appreciate some guideance so that I might proceed with importing contents of my HD as part my trial.
    Regards,
    OMPS

Maybe you are looking for

  • Concept of Interactive Report by click on filed displaying next screen

    Hi, I want to know the concept of Interactive report i have work on simple and ALV reports, as per my present requirement of vendor outstanding balance  i have made a report as per my requirement i have data in 3 final tables  itab1  itab2   itab3, i

  • How do i insert an image on a panel or anything?

    so for example i already have this           Toolkit tkit=Toolkit.getDefaultToolkit();           icon = tkit.getImage(ClassLoader.getSystemClassLoader().getResource("images\\icon.gif")); how do i insert it to let's say Panel Panel1 = new Panel(); or

  • Quicklook doesn't preview .docx files

    QuickLook works great on .doc files but doesn't work on .docx files. 

  • Browser plugin controls don't work

    I've been trying to install Reader 10.1.3 on a Windows 7 Pro x64 system.   My primary browser is Firefox 13, but the same issue happens in IE 9 I've tried installing and uninstalling several times. I've used AdobeAirCleaner.exe to remove any traces o

  • Partition Fail / Error

    I've noticed when I try to load Arch Linux on any drive that was previously installed with Debian Linux, it fails. I don't know if Debian just partitions the disk differently but the cfdisk utility that is built into the 2010-05 netinst ISO gives the