Is it possible to create exception rule in Comparator sort order?

I have been working on trying to learn how to use Comparators to sort Collections... In one of my recent experiments, I tried to order a PriorityQueue of String elements alphabetically, in ascending order, with one exception: any word beginning with the letter "z" should be given a higher priority than any other word. I haven't been able to find a way to do this, nor to discern whether or not it's possible.
Any help is appreciated.

Try something like this:public class MyComparator implements Comparator<String> {
    @Override
    public int compare(String s1, String s2) {
        boolean s1StartsWithZ = s1.startsWith("z");
        boolean s2StartsWithZ = s2.startsWith("z");
        if (s1StartsWithZ && !s2StartsWithZ) return 1;
        if (s2StartsWithZ && !s1StartsWithZ) return -1;
        return s1.compareTo(s2);
}

Similar Messages

  • Is it possible to create a rule across 2 models?

    Is it possible to create a rule across 2 models? I added Jack as a creator of an articles in articles model and then I added a row to make creator a subclass of person. So now I'm trying to query across 2 models. I was trying the following query. Give me the grandfather of the author of the article with the title ERNIEX
    SELECT m grandfater, c creator, t title
    FROM TABLE(SDO_RDF_MATCH(
    '(?t :title "ERNIEX") (?m fam:grandParentOf ?c)',
    SDO_RDF_Models('articles2', 'family'),
    SDO_RDF_Rulebases('RDFS', 'family_rb'),
    SDO_RDF_Aliases(SDO_RDF_Alias('','http://purl.org/dc/elements/1.1/'), SDO_RDF_Alias('fam','http://www.example.org/family/')),
    null));
    When I run the query about I get the error
    ORA-20000: We do not have a valid rules index for this Model-Rulebase combination
    So I thought to create a index but I'm not sure how. I tired the following code but I think I'm doing something wrong. Can anyone point me in the right direction. Or for that matter does anyone know of a more extensive tutorial to using the database? Thanks
    BEGIN
    SDO_RDF_INFERENCE.CREATE_RULES_INDEX(
    'rdfs_rix_articles2_faily',
    SDO_RDF_Models('family', 'articles2'),
    SDO_RDF_Rulebases('RDFS','family_rb')
    END;
    Ernest Lim

    You are right, a rules index would have to be created for the rulebases and both the models you use in the query. The example in the rules index creation you have shown at the end of your post does exactly that - creates a rules index for the set of rulebases and models: RDFS, family_rb, family, articles2. Once that rules index is created you should be able to run the query without getting the error.
    Did you get an error while trying to create a rules index using the code shown in your post?
    FYI, a forum for posting semantics questions is at RDF Semantic Graph

  • Possibility of creating Settlement Rule in Background?

    Hi Gurus,
               When I am doing TECO of the Maintenance Order everytime I have to create Settlement Rule.
               My settlement receiver Category (Cost Center) and Cost Center are fixed for  Order Type.
               Is it possible to create Settlement rule in the background while doing TECO of the Order.
               Please suggest if any User Exit is there.
    With best regards,
    Narendra

    Narendra,
    We are looking at exactly the same issue.
    As you are aware, you can only default one cost centre via the equip/floc...
    The only way we can see to have a pre-defined cost centre by order type/plant is to use user-exit [IWO10027|http://pjatkin.users.btopenworld.com/documents/PMCSUserExits.pdf] (default settlement rules).
    PeteA

  • Is possible to create a TO automatically after production order confirmation?

    Hi all
    I have just a question in order to know if we can configurate a procedure to a Production Order, so my question
    is possible to create a TO automatically after production order confirmation in a standard enviroment?
    Thanks in advance for all your comments

    Hi Gurus,
    Thank you for your help in this case.
    Process:
    The customer create a production order in CO01 and then they confirm the order in CO15, after confirmation TR is created ( we can see this in LB10 ) and negative stock is created (  we can see this in LS24 ).
    Requirement:
    They are asking to create the TO automatically after the production order confirmation. Negative stock is afecting the process.
    Workaround:
    They are creating the TO in background in LB10. ( negative is fixed )
    Question:
    Can we create the TO automatically after confirmation in standard configuration?
    if no ,  how can we confirm this TO .using a JOB option?
    TR created after confirmation
        TR header
    LS24 negative units.
    Regards!!
    Ronald

  • Is it possible to create invoice for Free of Charge order

    Dear All,
    Is it required to create a Billing document for an Free of charge order as far as Indian scenario is concerned.
    We are not charging any value to the customer for Free of Charge. Free of Charge order value will be Zero only.
    In this case, is it required to abide with invoice while sending the materials to the customer.
    Regards,
    Mullairaja

    Dear Reazuddin,
    But in FOC orders value will be zero.
    PR00 value will be compensated with R100 condition type.
    But Excise condition type will be calculated on Basic price.
    When the basic price value, how the system calculates the Excise condition type values.
    Could you please clarify?
    Regards,
    Mullairaja

  • Creating a custom or random sort order

    I would like to be able to drag and drop my images in any given order, and then rename them sequentially. This is useful for creating albums, etc. Will Lightroom enable me to do this? If so, HOW? I have not seen this topic, nor does it appear possible with the current version.

    Ah Hah! I discovered the problem. You cannot use this function unless you are in the specific folder of the photo shoot. In other words, if there are any subfolders, you have to be viewing only the group of images in the subfolder to create a user order. If you are viewing a folder that has an arrow to the left of it, you must twirl the arrow down and click on one of the subfolders below it (which are slightly indented in the Library list.

  • Create a rule on mail delivery failure

    Hello,
    Is it possible to create a rule in the Groupwise client, that when a message bounce back (mail delivery failure) from our relay provider, that the email will be forwarded to an internal recipient.
    At the moment I cant get it to work. Moving that bounced email to a folder in Groupwise does work.

    Originally Posted by laurabuckley
    Hi,
    I've just created a rule to test the above scenario and have built the rule as follows:
    When new mail is received and subject contains "mail delivery failure"
    then
    Move mail to folder called Undeliverable
    then
    Forward message as attachment (my preferred forward method to preserve mime header information) to [designated address]
    End Rule Processing
    I've tested the above rule and it works perfectly on my GW8.0.2HP2 system with GW8.0.2HP3 client.
    Perhaps post more details of your rule here and we can assist you with troubleshooting it.
    Cheers,
    I have a very similar issue to this. If I have a bounce back, I want to have that email address extracted to another doc... can be anything... TXT file, Word, Excel.... just something where I can maintain bad emails. Any Ideas anyone?

  • Is it possible to create a deposit for RMA Order instead of Credit Memo?

    Hi,
    We are on R12.1.1 and at customer location, they have developed some customization which is bringing S.O. on HOLD Status if customer has not paid the amount in advance? (Prepayment scenario)
    Now, what they want is : If there is an RMA Order from the customer, then instead of creating credit memo and send back the money to customer, they want to use this amount in the next order from that customer so that S.O. will not go on a HOLD status.
    I was exploring Deposit functionality which we can use it as S.O. line level but just wondering, if is it possible to create Deposit as and when RMA order is created in stead of Credit memo?
    Also, while using Prepayment functionality in R12.1, I am getting some error related to "Please enter receipt number" when I press Process Payment button.
    Any help will be highly appreciated.

    Copy Name is one of the editable fields in metadata panel on right side of Library module.

  • Create an Applescript to change focus order in browser

    Hey all,
    I'm curious if it is possible to create an Applescript to change the order focus within a browser.
    I have a bulk of data that needs to be entered into a database online.
    The focus order of the website design is not logical hence pressing tab to move from one field to the next results in confusion.
    (It includes buttons in headers, footers and empty fields making this extremely frustrating as I have to continuously use the mouse)
    Google search has not really given me any results, so I was hoping to build one.
    Thanks,
    Cheebs

    I think it is unlikely that you will get far with AppleScript as this normally involves reverse engineering the web page HTML/JavaScript and perhaps having a modified local copy of some or all of it.
    Are you able to paste the URL here without security implications?
    You could try looking at the source HTML of the web page.
    I am not sure if anybody makes a special web page viewer which has more control than a standard browser.

  • Is it possible to create a wip sample with inventory valdity rule in spec

    Hi friends
    Can anyone please tell me
    Is it possible to create a wip sample with inventory validity rule in the item Specification?
    I have an item which is a wip (product) item and has validity rule defined for inventory. can i create a sample from the batch for it with inventory validity rule in the specification.
    Thanks in advance
    Prem.

    Hi Jay
    How are you.
    Yes, in process sampling only.
    Is it not neccessary to have a wip validity rule for wip products in the specs. I am able to create samples for wip products with inventory validity rule.
    Regards
    Prem.

  • Is it possible to create this type of 'Rule'....

    Hi,
    The spammers have got me good this time!! I am getting tens of emails a day asking if I want to buy gold. The problem is that I can't seem to create a rule to filter these out. The subject and sender are always different, and usually garbage. Also the email has no content, rather a gif image which is 8kb in size. I do tend to get a lot of emails from people who are not in my address book, so that option is not available to me. The only way I could imagine filtering these messages was to create a rule that if message contains attatchment 8kb (they are always the same size in my experience), then move to junk. Of course this rule seems impossible. How do you guys filter these messages out. I was already at the end of my tether with the gold stock options, but now I am also getting emails asking to buy a ring of some sorts!!!..... Any help please! Thanks

    Hello Gwyn.
    No single strategy is completely effective when it comes to managing spam. People who are intent on sending spam are ingenious at coming up with ways around any filtration schemes.
    You can add a number of rules in an attempt to resolve the problem but doing so in regards to spam is like a dog chasing his tail.
    In case you have unintentionally/unknowingly added to the problem regarding this increase in spam received, check Why was I "spammed" at my .Mac Mail address? which applies to any email account and How HTML Email Messages Relate to Unsolicited Commercial Email ("spam") which applies to any email client such as the Mail.app.

  • Is it possible to create rules in Mail outside of Preferences?

    Having used Mail/Preferences/Rules as the route to create new rules for messages in Mail, I have often thought that there may well be a simpler method which I have not yet discovered, to create new rules (as opposed to applying them) by highlighting the message in the inbox (or whichever mailbox you happen to be using) and creating the rule directly without having to mess around going through the Prefs routine. Anybody found a shortcut?

    Thanks for your helpful suggestion andyBall_uk.
    I've had a quick look at the second link you included (
    http://www.andreasamann.com/MacOSX/Mail_Scripts)but the developer seems to have stopped updated the scripts since Mountain Lion, so I probably won't tangle with one of those as I use 10.8.3.
    However I'm going to trial MailActOn and see how I get on. I'll update once I have had a play.
    Thanks again - always grateful for constructive replies.

  • Is there a way to create a rule that sends and Auto Response for a shared mailbox?

    I have a shared mailbox set up that receives emails that are sent to 3 different addresses:
    [email protected]
    [email protected]
    [email protected]
    I would like to create a rule that would send an auto response when someone emails one of these addresses.  However, I don't want an auto response sent to [email protected] so I can't just set up an "out of office" reply for the mailbox.
    Is there a way that I can create a rule to send an automated response to 2 of the 3 addresses?
    Nate

    Hi 
    we can enable the shared mailbox in ADUC and create Outlook rules for it in Outlook to achieve it. please follow these steps:
    1. In Active Directory Users and Computers, right-click the shared mailbox and click Enable Account.
    2. Configure the Outlook account for the shared mailbox in Outlook.
    3. Click Rules > Manage Rules & Alerts.
    4. Create a rule like the following format:
         Apply this rule after the message arrives
         Have server reply using a specific message
         Except if the subject contains specific words
         Select exception(s) (if necessary) of the Outlook Rule - (“except if from people or public group“)
    5. Apply the auto reply rules for this shared mailbox.
    Then users can receive auto reply of the shared mailbox except the exceptions we have set  when they send messages to this shared mailbox.
    Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you

  • Is it possible to create LSMW for PQ10, PQ13?

    Hi Fridz,
    I have created the OM actions, now I'm trying to create LSMW for the actions PQ10 (creation of org unit), PQ13 (Creation of Position) but while recording LSMW relationships are not creating under - Maintain Field Mapping and Conversion Rules in LSMW. Please advice on this whether these transactions are possible to create LSMW with fore & backgroung.
    $Narayana

    Hi Narayana,
    Use BDC's for better maintainance of relationship. which worked fine for me.
    thanks,
    vasu.

  • Unable to create the Rule Index (SEM_APIS.CREATE_RULES_INDEX) getting error

    Hi,
    I am trying to create the Rule Index with the below script its giving the temp table space error.
    The number of records in that specific table is 17473708 (17+ M) and the available temp space is 120GB.
    Execute SEM_APIS.CREATE_RULEBASE('ecc_md_rb')
    --Insert to mdsys.semr_ecc_md_rb Values(.............)
    BEGIN
    SEM_APIS.CREATE_RULES_INDEX(
    'ecc_rule_indx',
    SEM_Models('FOUNDATION'),
    SEM_Rulebases('RDFS','ecc_dm_rb'));
    END;
    Create rule index statement is running more than 8hrs and i tried with the sem_apis.create_entailment its also giving the same Temp table space error.
    Please find the below error details
    BEGIN sem_apis.create_entailment('ecc_rule_inx', sem_models('FOUNDATION'), sem_rulebases('OWLPRIME','ecc_dm_rb'),SEM_APIS.REACH_CLOSURE,'RDFS2-, RDFS3-, RDFS4a-, RDFS4b-, RDFS5-, RDFS6-, RDFS7-, RDFS8-, RDFS9-, RDFS10-, RDFS11-, RDFS12-, RDFS13-','USER_RULES=T'); END;
    Error at line 1
    ORA-29532: Java call terminated by uncaught Java exception: oracle.jdbc.driver.OracleSQLException: ORA-01652: unable to extend temp segment by 64 in tablespace TEMP
    ORA-06512: at "MDSYS.SDO_SEM_INFERENCE";, line 4866
    ORA-06512: at "MDSYS.RDF_APIS";, line 16
    ORA-06512: at line 1
    Please Help me to create rule index.
    Note: I am using Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    Regards,
    Kavitha.

    Hi,
    Please use the create_entailment API.
    As far as temp tablespace goes, please create a bigfile temp tablespace. You can follow Slide #36 of the
    following document.
    http://download.oracle.com/otndocs/tech/semantic_web/pdf/2010_ora_semtech_wkshp.pdf
    Thanks,
    Zhe Wu

Maybe you are looking for

  • Problem with Photoshop CS6. If I open a file using Camera RAW

    I have a new problem with Photoshop CS6.  If I open a file using Camera RAW, and process it as usual, CS6 doesn't want to save it the way it used to.  I don't know if I changed something by accident or not.  Here's what happens now: After opening fro

  • [SOLVED] Conky, Gmail, and STDOUT Question

    I currently have Conky working with a script to check my gmail (gmail.pl).  It works as intended in conky, but it saves all the output from the script to STDOUT.  This isn't a problem until I log out of openbox and my screen is filled with these thin

  • Error when trying to retrieve Document Library in Sharepoint Hosted App using REST

    I have created the following REST request in order to retrieve the root folder of a Document Library added to a Sharepoint Hosted App getProductDocumentFolder: function () { $.ajax({ url: _spPageContextInfo.webServerRelativeUrl + "/_api/web/GetFolder

  • Upgrade XE10 to XE11?

    Installation is openSUSE 11.2 32bit (XE10 WE) and 64bit (XE11 Universal) I did it as described: - install XE 10 in 32bit linux - install XE 11 on 64bit linux - copied gen_inst.sql from 64bit linux(XE11) to 32bit linux(XE10) - run gen_inst.sql on 32bi

  • Oracle/java timestamp data type error.. please help

    Im having trouble with a SQL query of mine. Im trying to get a timestamp using JDBC from an oracle database however i get the following error: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected %s got %s Now when i put the java.util.t