TreeMap of Points - how do I set the comparator?

I have a treemap containing Points and I know I have to set a comparator for the map.
I also know there is a comparator in class Point because there is an equals method.
How do I set the map comparator to use the Point comparator?

This is an example for the Point comparator
import java.awt.Point;
import java.util.Comparator;
import java.util.Iterator;
import java.util.TreeMap;
public class PointComparator implements Comparator {
    public int compare(Object o1, Object o2) {
        if (o1 == null && o2 == null) {
            return 0;
        } else if (o1 == null) {
            return -1;
        } else if (o2 == null) {
            return 1;
        Point pointFirstPoint = (Point) o1;
        Point pointSecondPoint = (Point) o2;
        int nComparationResult = 0;
        if (pointFirstPoint.x < pointSecondPoint.x
            || (pointFirstPoint.x == pointSecondPoint.x
                && pointFirstPoint.y < pointSecondPoint.y)) {
            nComparationResult = -1;
        } else if (pointFirstPoint.x > pointSecondPoint.x
                   || pointFirstPoint.y > pointSecondPoint.y) {
            nComparationResult = 1;
        return nComparationResult;
    public static void main(String args[]) {
        TreeMap map = new TreeMap(new PointComparator());
        map.put(new Point(0, 1), "some data");
        map.put(new Point(1, 1), "some data");
        map.put(new Point(-1, 3), "some data");
        map.put(new Point(2, 1), "some data");
        map.put(new Point(2, 7), "some data");
        map.put(new Point(2, 1), "some data");
        map.put(new Point(2, 9), "some data");
        map.put(new Point(2, 4), "some data");
        map.put(new Point(-1, -1), "some data");
        map.put(new Point(2, 3), "some data");
        Iterator it = map.keySet().iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
}Foar any more questions please read the documentation for java.util.Comparator and java.lang.Comparable. There is more than enough information for what you need.

Similar Messages

  • How do I set the transition between access points would be fine?

    Hello everyone,
    We have an organization Wirless controller 2504 with 20 aironet access-point (700 series)
    Once I defined  all the access points I noticed that the transition between them is not working fine...
    I mean that clients can not walk around in our organization without having to connect to any access point separately.
    How do I set the transition between access points would be fine?
    Thanks a lot (:

    HI Omri,
    which software version you have on WLC ?
    Is the site survey done propely ?
    Remember: It is the client that decides when to roam and which AP to connect to based on what it perceives the signal to be.
    If your site survey design is perfect and still have problems while roaming then:
    Disable your lower data rates on the 2.4ghz and or 5ghz radio and your clients will roam better. Try to disable everything below 11mbps. and give that a try.May be old device will work in this case.
    Regards
    Dont forget to rate helpful posts

  • How do I set the aspect ration for 4:3  or for 16:9?

    How do I set the aspect ration for 4:3  or for 16:9 in Adobe PE12?

    PulcinellaNM
    What computer operating system is your Premiere Elements 12 running on? Have you updated from 12 to 12.1 Update via a project's Help Menu/Update? If not, please do so. That is all background information for now.
    As for the question that you are posting....
    I think we need to go a lot deeper into what you are doing. Here are some considerations
    The aspect ratio setting is in the import settings. In Premiere Elements 12 Expert workspace, the project automatically sets the project preset based on the properties of the first video file that you drag to the Expert workspace Timeline. If your video's properties include a 16:9 flag, then the project settings will have a 16:9 flag (aspect ratio). If you do not want the project to set the project settings automatically, you can set the project settings yourself manually with File Menu/New/Project and then import your source video.
    If a problem exists where imported 16:9 video is presenting in Premiere Elements as 4:3 instead of 16:9 (typical of the JVC .mod file issue), then you can set the pixel aspect ratio under Interpret Footage feature inside the project workspace.
    At this point, I think it best for you to give more details and background behind your question so that we can be sure that we are giving you the information that you need to succeed in your projects.
    If you need clarification on anything written, please do not hesitate to ask for clarification.
    Thank you.
    ATR

  • How do you set the duration for multiple stills in iMovie 2013?

    How do you set the duration for multiple stills in iMovie 2013?
    Before upgrading to the latest version of iMovie last month, I was able to set the duation of all of the stills included in an iMovie project at one time by clicking the apply to all still box in the adjustment pop up. That option is no longer apparent. If it is available I cannot find it, and I have tried several different ways to accomplish it. I have tried the iMovie help section and can find nothing to help.
    Apple, do I really have to adjust close to 500 pictures to a 5 second duration individually???
    REALLY??!!

    ...why wouldnt people want that level of accuracy when animating, especially when working to music at a specific duration?
    Because often people are animating to words or beats in the music.  Music is rarely performed with a computer-precise beat and tempo.  Musicians aren't robots: they swing the beat sometimes.  They use rubato.  They change tempo.  They change time signatures.  As a result, you have to FIND those words and beats.  It's not a situation where you can say, "There!  I've found the duration of one beat!  Now it's easy to find the rest of them!" 
    If you try it, you will be very disappointed.
    Try finding the precise end of a piece of music that fades or ends on a big chord with a ring-out.  You'll see that it's trial-and-error: what's the point where it becomes inaudible?  It depends on how high your speakers are turned up.  You might have them way up, you set an end point for the layer, and then you do a RAM Preview at a more reasonable volume.  You might say, "Hey!  The music ends before the layer ends!"...  but you KNOW you set the layer's out point when the audio file goes silent.
    AE has layer markers that can be used on an audio layer to mark beats, words, etc. They come in very handy.
    I guess it comes down to this: because AE can do so much different stuff, there are very few automated procedures.  Oh, Adobe tries with effects that convert audio levels to keyframes, but they're not 100% reliable... especially on something like a capella choral works.  For true accuracy, you need  find the timings yourself. 
    If you want something simpler, try a different application. But be prepared for lower level of accuracy.

  • How do I set the default to adobe 9.3?

    How do I set the default to Adobe 9.3?  I have Acrobat 6.0 that tries to open. However, I want the Adobe Reader 9.3 to open.  How do I make this change?

    I had the exact same problem.....iinstalled on a Windows XP machine
    You probably had 9.3 already installed, then you pulled out your 6.0 Acrobat Professional disk and installed that.
    What you need to do is "remove" your Adobe 9.3.
    Re-start your machine.   Then reload Adobe ...try Adobe 8.
    Now it won't use Acrobat 6.0.    At this point, select an existing PDF file, RIGHT click, select "Open With...".    You won't probably see Acrobat 6.0 so you have to "BROWSE" ... find Adobe, then find "6.0".    Select.
    At this point Adobe 8 will be your default, but, you can always select 6.0 by "right clicking" the PDF first, when you want to.

  • How do I set the length of each clip?

    I have just begun trying to build a video with Premiere Elements 10
    I have created many videos with Windows Movie Maker..found it boring for Effects etc.that's why I have this new software.
    Now my question is ..How do I  set the time for each clip?
    I like to add a clip that goes with each lyric in the song.
    Thanks.

    Welcome to the forum.
    As Steve points out, that is "editing."
    One can use either of two Tools in PrE, to Trim the Clip to suit.
    First, one can Dbl-click on the Clip in the Project Panel to open it in the Source Monitor, which looks a bit like the Program Monitor, but it has the In & Out Point settings. When that Clip has been Trimmed, as needed in the Source Monitor, just drag it to the Timeline.
    Or, one can drag the Clip to the Timeline, and then click+drag on the Head of the Clip to set its In Point, and on the Tail, to set the Out Point.
    Good luck,
    Hunt

  • How u will set the external parameters like packet size and number

    How u will set the external parameters like packet size and number of parallel process.

    Dear Karthik,
    <b>ALE:</b>    
    Use Transaction UPSC02         -      ALE Distribution Unit: Packet Types.
    Performance Optimization for <b>ODS</b> Objects:
    To ensure a good ODS object loading performance, take the following into account:
           1.      Creating SIDs
    The creation of SIDs takes a long time and can be avoided in the following cases by:
           Not setting the indicator for BEx Reporting if you are using the ODS object only as a data store. If you do set this indicator, SIDs are created for all new characteristic values.
           If you use line items (for example, document number or time stamp) as characteristics in the ODS object, in the characteristic maintenance, indicate these as Attribute Only.
    SIDs are created in parallel if <b>parallel activation</b> is switched on (see last point). They are then created with the same number of parallel processes as created for the activation.
    However, if you specify a server group or a special server in customizing, these specifications are not only valid for the activation, but also for the SID creation. The creation of SIDs runs on the application server on which the batch job also runs.
           2.      DB partitioning in active data tables (technical A table)
    By partitioning by database level, you can delete data from the ODS object much more quickly. As a partitioning criterion, choose the characteristic by which you want to delete.  For more information on partitioning database tables, see the database documentation (DBMS-CD). Partitioning is supported by the following databases: Oracle, DB2/390, Informix.
           3.      Indexing
    Use selection criteria for queries for ODS objects. If the key fields are specified, the existing primary index is used. The more frequently accessed characteristic should appear on the left-hand side.
    If you did not specify the key fields completely in the selection criteria (visible in the SQL trace), you improve the run time of the query by creating additional indexes. You can create these secondary indexes in the ODS object maintenance.
           4.      Activation of data in an ODS object
    To improve system performance when activating data in the ODS object, you can make the following entries in Customizing under SAP Customizing Implementation Guide -> SAP NetWeaver -> Business Information Warehouse -> General BW Settings ->  ODS Object Settings:
           the maximum number of parallel processes when activating data in the ODS object as when moving SIDs
           the minimum number of data records for each data package when activating data in the ODS object, meaning you define the size of the data packages that are activated
           the maximum wait time in seconds when activating data in the ODS object. This is the time when the main process (batch process) waits for the dialog process that is split before it classifies it as having failed.
           the server group that needs to be used when activating the data in ODS objects in parallel You have to create the server groups beforehand using the following path: Tools -> Administration -> Network -> RFC Destination, RFC -> RFC Groups. If you do not specify anything here, then the activation runs on the server on which the batch process was started for activation. If a server from the server group is not active, then the activation is cancelled.
           5.      Loading unique data records
    If you only load unique data records (meaning data records with nonrecurring key combinations) into the ODS object, then the loading performance is improved when you set the indicator Unique Data Records in the ODS object maintenance.
    The records are then updated more quickly because the system no longer needs to check whether the record already exists. You do have to be sure that there duplicate records are definitely not being loaded, because this will lead to termination.
    Regards,
    Naveen.

  • How do I set the iPhoto library as the Aperture default library?

    I missed the opportunity on first opening Aperture to set the iPhoto library as the one that Aperture uses as the default, and now cannot find out how to do that after that point (it was getting late by the time I had found, installed and updated a copy of Aperture for my Mavericks based system).
    How can I set the iPhoto library as the default, I don't want to have to select the iPhoto library every time I open aperture, but even knowing how to do that would be an improvement on my current knowledge!
    TIA

    That's what I read, but aren't they the minimum specs? Do you know what the upper specs are for using them together? Eg 3.4.5 won't work with iPhoto x.x etc?
    I bought a Retail copy of Aperture 3.0.2 then downloaded the latest Maverick copy of Aperture I could as an upgrade (3.4.5) from the Apple Support site. But there was a newer version 3.5.1 which will also run on Mavericks, but is not currently available either as a retail copy or as an electronic download as Apple will only sell 3.6 now as Yosemite came out a few weeks ago. I really don't want to get Yosemite as then I won't be able to run Filemaker 11 at home for the office. And I can only upgrade Filemaker by getting a whole new set of licences for all the other computers in the office, costing about €2,000 altogether. Then I will have to buy two new Apple Mac minis costing another €1,000. And there are potential issues with other software that I will have to "up"grade to including iWork's watered down products. Wherever I look, Apple is making my life difficult.

  • How do I set the buttons on my website to trigger an iFrame when I hover over them?

    How do I set the buttons on my website to trigger an iFrame when I hover over them?  At the moment they work when I click on them.
    I have tried everything to try and get them to work when I hover over them.
    If anybody could point me in the right direction or give me any help it would be greatly appreciated.
    imbriggy

    I think this would pose a major usability issue for touch screen devices that have no mouse and thus don't respond to mouseover/hover.  In that sense, OnClick is much more reliable.   But to answer your question, you would need to invoke the event with JavaScript.
    Nancy O.

  • How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.

    How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.
    Or how does Premiere 11 determine where to set the image for the video it is exporting? 
    I already know how to use Freeze frame and save the image to my computer by Publish+Share/Computer/ Immage.
    Thanks,
    Mike

    Mike
    This is not Adobe. Rather user to user. We are all visitors here.
    Just a bit of history....back in the days of Premiere Elements 4, you could set a "poster frame" in what was called the Project area. You did this by right clicking a blank area there and, from the drop down menu that appeared, selecting View/Preview Area, and using the poster frame feature there.
    As I said, when a video imports into Premiere Elements, the thumbnail of the import has been presenting as the first frame of the video. With this Preview area "poster frame" option, you could set the video's thumbnail in the Project area so that the first frame was another frame in the video. But, this "perk" was restricted to thumbnails of the video in Project area.
    If you exported to file with the first frame modified video, the export's thumbnail in Windows Explorer would present with other than the real first frame or the poster frame as the first frame.
    Also, in more recent versions, I have observed that the export to file does not display the real first frame of the video in Windows Explorer. Seems random, but I have not kept track.
    And, remember, at the onset I wrote
    As far as I have ever seen, Premiere Elements Windows uses the first frame of the video for its thumbnail in the program.
    I know of no way within Premiere Elements to control what the program opts to do in this matter. In some compatibility
    issues, it opts to give no image but a generic one.
    I did not say that you can expect to have the Premiere Elements' export file's thumbnail in Windows displaying with its real first frame. And, the more you get into this, depending on the versions, more details need to be added to my comment about "...first frame of video for its thumbnail in the program..."
    I would have to look into all this further to get perspective on the contributing factors.
    ATR
    Add On...The Poster Frame feature appeared in versions 4, 7, 8, and 9 by my count.

  • How do you set the time period on IMAP email accounts (razr maxx)

    Hi Guys -
    Does anyone know how you can set the time period that the stock email will keep the already downloaded messages for IMAP email accounts?
    Mine never seems to show more than a couple of days worth at a time. I'd ideally like to be able to see at least 2 weeks worth of messages without needing to download them again!
    On other phones I've had there was a setting in the menu, but either I can't find it...or it's not there. I've found the setting for how OFTEN it checks the accounts, but not the setting I am seeking.
    Your help is appreciated!
    Best Wishes for the Holiday Season.
    -Rich

    Hey Rich.  Once in 'settings,' there should be a "days to sync' under the 'data usage' section.   You don't have that?

  • How i can set the selected item of a dropDown component from java code

    Hi
    Thank you for reading my post
    How i can set the slected item of a DropDown component from backing beans java code ?
    it is binded with a database , so one field determine its display and one other field determine its value , I want to set the selected item of this combobox
    In back code i have both value and display values to use them .
    can some one give me some help ?
    Thanks ,

    See code sample 3 at http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    See also, the selection components row in the table under http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/helloweb.html
    It says
    One way to preselect items is to call setSelectedValue(Object[]) or setSelectedValue(Object) from the prerender() method. You pass in the return values of the items that you want preselected. Be sure to verify that getSelected() returns null before setting the default options, or you will overwrite the user's selections on a post-back.

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • How can I set the page that will open, when I open a new tab, to be the same as the homepage?

    How can I set the page that will open, when I open a new tab, to be the same as the homepage?
    An app changed it to some other search engine, before installing the app, I the tab that would open was the homepage I set.
    In my case it is Google, and I want my new tabs to open on Google like they did before the installation.
    thank you,
    Asaf Privman.

    You can middle-click or Ctrl left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at one of these extensions:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    * New Tab Homepage : https://addons.mozilla.org/firefox/addon/new-tab-homepage/

  • How do I set the audience when I'm using Siri on my iPhone 5 to post to Facebook

    How do I set the audience privacy for when I’m using Siri on my iPhone 5 to post to Facebook?
    When I ask Siri to post a message to my Facebook Siri tells me what I have said and then asks tot post it, I then checked on my computer and the post is visible to "ME ONLY" I can change this on the computer and on my phone via the App but I do not want to be doing that all the time.
    If I post to Facebook via Siri on my iPhone 5 I want it at the default setting of friends only.
    So How do I change this?
    I posted the first one 2 minutes ago then went into Facebook via the App and changed it but did a second one hoping that the default privacy had changed but it was again to me only. As you can see via the padlock. Please help. Thanks

    What if you do need help or emergency situation while Posting FB via Siri is the fastest way to show you or someone is in danger, and he/she is dying because the post is Only visible to Me !?!?!?!???
    Anyone who uses FaceBook to get immediate help for life threatening emergency is mercifully removing themselves from the gene pool.

Maybe you are looking for

  • Deleting calendars in iCal

    Thanks to a app that will remain nameless I have 98 calendars on my computer.  iCloud shows the correct number of calendars.  Is there a way to restore the desktop iCal from the iCloud iCal?  The thought of one by one right clicking to delete them al

  • Crystal Reports 2010 shows error on 64 bit vista/7 machines

    Hello, <br/><br/> I search the threads before posting my problem. I saw number of threads similar to this but none of them is pointing towards solutions to my problem. Thus decided to create new one. I tried various things listed in old post to solve

  • Flash crashes every time I try to use Bickham font

    Flash 8 Professional instantly crashes every time I attempt to use Bickham font or try to change a font to Bickham. Obv I'll just import a graphic of what I need from Photoshop, but I was wondering if anyone has the same problem? Is there a trick one

  • Apple tv proplem

    HI, am using a macbook bro version 10.7 and itunes v 10.6, after installing the new update i cant stream any thing on the apple tv, even from my ipad, the airplay icon dissapered from every where

  • Bash-completion issues after bash upgrade

    Hi. Is it only me or bash-completion stopped working after bash upgrade (3.2.017-2 -> 3.2.025-1)? I also had to remove ". /etc/profile" from all existing .bashrc files to have it properly interpreting /etc/profile and /etc/profile.d/* files, which wa