How to make a function take a specific group of constants

I know i asked this before, maybe a year ago, but I totally forgot how to do it, and I haven't been programming much lately. But I was wondering if somebody can tell me how to make a certain function take specific constants. For example there are java functions, of which I can not remember that will only take certain values. So the function might look like:
public getInfo(String INFONAME){}Where INFONAME has to be like one of two names or something, and they are constants that are defined somewhere else. If anybody knows what I mean by this, and knows how to create functions like that please let me know. Thank you.

here's an overkill,
import java.util.*;
abstract class DoWhatever {
    public static Hashtable ht = null;
    public static Object DoWhat( String s, Object obj ) {
     if( null == ht ) {
         ht = new Hashtable();
         ht.put( ThisDoWhatever.NAME, new ThisDoWhatever() );
         ht.put( ThatDoWhatever.NAME, new ThatDoWhatever() );        
     return ( (DoWhatever) ht.get( s ) ).doWhatever( obj );
    public abstract Object doWhatever( Object obj );
class ThisDoWhatever extends DoWhatever {
    public final static String NAME = "this";
    public Object doWhatever( Object obj ) {
     System.out.println( NAME );
     return null;
class ThatDoWhatever extends DoWhatever {
    public final static String NAME = "that";
    public Object doWhatever( Object obj ) {
     System.out.println( NAME );
     return null;
public class DoThisOrThat {
    public static void main( String[] args ) {
     DoWhatever.DoWhat( args[ 0 ], null );
}

Similar Messages

  • How to make a function return number(10,0) data type (ORACLE 10g)?

    With 10g, how to make a function return number(10,0) data type?
    here is the function, it returns a number type :
    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN v_Id;
    END Get_portfolio_Id3;
    Thanks.
    Message was edited by:
    user631701

    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN round(v_Id);
    END Get_portfolio_Id3;

  • How to make a loop run for specific period of time ?

    hello !
    i'm new to labview and could'nt found how to make a loop run for 2 sec for example, and then to exit.
    Solved!
    Go to Solution.

    Hi Hookso,
    You can do it using the different loops like While loop and For Loop. Roderic has already stated how to do it using a for loop. I have illustrated in the attached vi how to do it using a while loop and Elapsed Time function. Take a look.
    Regards,
    Nitzz
    (Give kudos to good Answers and Mark it as a Solution if your problem is Solved) 
    Attachments:
    Untitled 2.vi ‏36 KB

  • How to make an indicator takes more than one input

    Hello,
    I want to know how to make an indicator ( like gauge for example) response to more than one case strrcuture result. In other words, how the indicator can take more than one input and move based on different input values ( the arrow of the gauge moves to different angles basesed on the logic structure and not only to one degree).
    Thanks in advance,
     

    YES, you got it right Coastal !
    This is what i want to do,
    I dont know how to establish this output in the software, i am still learning LabVIEW.
    I put a merge block to join the outputs but it didnt work.
    check it in the attached VI file.
    I am sure it is an easy thing but I dont know how to implement it.
    Any help you provide is appreciated,
    Best wishes 

  • PL/SQL: How to make a function accessible to all users?

    How can I make a function accessible to all users?
    I have written a stored function called GET_NET_BALANCE.
    I can run it but my users cannot.
    I have tried the following, but my users still cannot
    run the function:
    GRANT EXECUTE ON GET_NET_BALANCE TO PUBLIC;
    Thanks, Eileen

    Hi,
    You can try creating a public synonym on the function so that it is accessible to all.
    To get greater response.. please post your question at
    PL/SQL
    Regards,
    Anupama

  • Mailing list form, how to make it functional?

    I'm trying to add the typical "Join our Mailing List" form into a website where users can submit their email addresses.  I've built the form and now I need to make it functional.  I don't know a lick of php or databasing, and after investigating it on the web and the forum there seems to be a bunch of different answers and I'm not sure which direction to go in.  Is there an easy way to do this with a premade script somewhere?  Would I have to get it from the company that's hosting the site?  How do I implement it?
    Thanks in advance!!!!

    Awesome, thanks so much for the help CanonBoy.  So I can use this for both my mailing list form and my contact message form?  I opened Dreamweaver and on the contact page I set the form to this:
    <div id="ContactForm">
      <form id="form1" name="form1" method="post" action="contact.php">
        <table width="300">
          <tr>
            <td colspan="2"><span class="MainText">All information will be kept private</span></td>
          </tr>
          <tr>
            <td width="61"><span class="MainText">Name:</span></td>
            <td width="227"><span class="MainText">
              <input name="Name" type="text" id="Name" size="25" />
            </span></td>
          </tr>
          <tr>
            <td><span class="MainText">Email:</span></td>
            <td><span class="MainText">
              <input name="Email" type="text" id="Email" size="25" />
            </span></td>
          </tr>
          <tr>
            <td><span class="MainText">Phone:</span></td>
            <td><span class="MainText">
              <input name="Phone" type="text" id="Phone" size="25" />
            </span></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td><span class="MainText">Message:</span></td>
            <td><span class="MainText">
              <textarea name="Message" id="Message" cols="23" rows="5"></textarea>
            </span></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td><input name="Clear" type="reset" class="MainText" id="Clear" value="Clear" />
            <input name="Submit" type="submit" class="MainText" id="Submit" value="Submit" /></td>
          </tr>
        </table>
      </form>
    </div>
    Do I have to change the form ID and the name in line 2?  And also I'm not sure what you meant about the hidden field, what exactly do I copy and paste and where do I put it?  And is there a generic form on the tectite site I can add the client's email address to, change it to contact.php and upload it?  Thanks big time!!!

  • How to make textfield to take only numbers, & it wont allow us to enter any other characters

    make textfield to take only numbers, & it wont allow us to enter any other characters

    Clean up the code a little (credit goes to Sakthivel
    var oInput = new sap.ui.commons.TextField();
    oInput.onAfterRendering = function() {
      if (sap.ui.commons.TextField.prototype.onAfterRendering) {
        sap.ui.commons.TextField.prototype.onAfterRendering.apply(this, arguments);
      this.$().keydown(function(event) {
        var ctrlKey = event.ctrlKey;
        var altKey = event.altKey;
        var shiftKey = event.shiftKey;
        var key = event.keyCode;
        return (
          ctrlKey ||
          altKey  ||
          ( 47 < key && key < 58 && shiftKey === false) ||
          ( 95 < key && key < 106 ) ||
          ( key === 8) || (key === 9) ||  
          ( key > 34 && key < 40) ||
          ( key === 46)
    oInput.placeAt('content');
    -D

  • How to make a function in separate thread

    i need to make a function that is running in a separate thread
    Thank's in advance

    Thank's
    but in my program i have a main class which is a server it runs forever.
    from the main class when i call a function it runs in a separate thread and returns the result to the callee and the main function continue it's work
    class server
    //this function when called must be in separate thread
    public int function(int x)
    //there could be wait here or sleep
    return x*2;
    public static void main(String[] args)
    // Run RMI server
    i hope u understand me!!!
    Thank's

  • How can I share contacts in a specific group

    I want to share a specific group of contacts without having to share each of the contacts individually.

    iPad
    Yes, her contacts show up on her iPad, but only on her iPad
    iCloud
    She has her own iCloud ID but none of the contacts show up on it because they are in a group called 'Hotmail' and it is impossible on her iPad to change their group to 'iCloud'
    Mac
    I had already set up an account for her on my Mac, so her iPad is backed up.  But when she syncs her contacts to Mail on my Mac, none of the contacts come across, because they are not iCloud contacts.
    My question is still how do I get these contacts off the iPad and onto either the cloud or the mac so I can change their group so they sync in future and so that we can send a group email advising her friends and relatives of her change of email address.  If this is not possible it means emailing a hundred or so people individually.
    How sad that it is not possible on the ipad to select all contacts and assign them to a different group.

  • How to add a contact to a specific group in iOS6

    Whenever I add a new contact to Contacts (address book), the contact just gets added to default list. Is there an option in iOS6 to add the contact to a specific group within my contacts or to move a contact from one group to another? I know how to do this on my iMac, but do not how to do it on either the iPad or iPhone.

    Hi,We are having a problem with one of our users Outlook2013, his Inbox is not showing the count of unread emails.When the PC is booted up you can see the folder flashup with the number of unread emails but then the count quickly disappears. Ihave tried all the solutions mentioned in the below Microsoft Forum, all are temporaryuntil we reboot the PC and start Outlook again, but nothing seems to be permanent.http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/outlook-2013-inbox-not-showing-count-of-unread/5fc4f9e0-b3b6-4d51-b599-b4a624e8047d?page=1&tm=1436346526332We are using Exchange 2010 with Outlook 2013, so I am unsure if this iscausing the problem.The user has mentioned that when he is looking at the properties of thefolder throughout the day and selects the Synchronization Tab the Server andOffline folder...

  • How to add a contact to a specific group while on the go away from desktop.

    I too am frustrated with that. I've come up with a little work around that works for me though so see what you guys think.
    I most often run into this right after I have spoken to a prospect about Windsurfing gear and so I immediately want to put them into my Windsurfing gear prospects. I would do this by adding them as a contact and putting windsurf as the company in the contact so that when I got back to my desktop I would do a search for windsurf and add the contacts from that day to the Windsurf group.
    Today I discovered, if you go into the specific group, you can click the plus sign at the top right and add a new contact right into that group. Unfortunately you cannot grab their number from recent calls, BUT, you can go to recent calls once you have made this new contact in whatever group you wanted to create it in and click add to existing contact and voila, there ya go.
    It could be easier for sure but this works while on the go.
    Let me know if it worked for you guys.
    Tim

    awanjee wrote:
    Hello,
    I am a new user of Nokia E72. I just want to know that how can i add the number from log. I mean i want to send a message and contact is not in my contact list but it is in my call log history?
    Regards,
    Message Edited by awanjee on 02-Dec-2009 09:38 AM
    Open the log and the specific number-> options-> save to contacts
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • How to make clone of active directory security group

    Hi
    i am having one Security group in AD, i want to make copy or clone of that group with same members in different name in AD.
    Anybody help me out...

    Hi Vino1985,
    Just do it with ds-tools.
    dsquery group -samid %SamidOfYourReferenceGroup% | dsget group -members |  dsmod group %distinguishedNameOfYourNewGroup% -addmbr -c
    This should work as
    "dsquery group -samid " will return the distinguished name of your reference group and pipe it to dsget group
    "dsget group -members" will return all distinguished-names of the members and pipe it to dsmod group
    "dsmod group -addmbr" will all DN's to the membership-attribute of the new group the switch "-c" will continue on errors.
    best regards
    Switch
    MCITP Enterprise Administrator
    MCSA Windows Server 2012
    MCTS Windows 7 Configuration
    Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights.

  • How to make a function out of a query

    Hi,
    I have the following query:
    select
    to_date(sysdate, 'DD.MM.YYYY') as "FULL_DATE",
    to_number(to_char(sysdate, 'D')) as "DAY_OF_WEEK",
    to_number(to_char(sysdate, 'DD')) as "DAY_NUMBER_IN CALENDAR_MONTH",
    to_number(to_char(sysdate, 'DDD')) as "DAY_NUMBER_IN CALENDAR_YEAR"
    from
    dual
    how to I make a funtion where I can input a start and an ending date and it calculates allt the rows fow the days in between?
    Thanks,
    Walter

    drop type mytabletype;
    create or replace type mytype as object (
    full_date date,
    dow number,
    daynum_m number,
    daynum_y number
    create or replace type mytabletype as table of mytype;
    create or replace function myfunc (p_date in date) return mytabletype pipelined as
      cursor cur_mycur is
      select
        to_date(p_date, 'DD.MM.YYYY') as "FULL_DATE",
        to_number(to_char(p_date, 'D')) as "DAY_OF_WEEK",
        to_number(to_char(p_date, 'DD')) as "DAY_NUMBER_IN_CALENDAR_MONTH",
        to_number(to_char(p_date, 'DDD')) as "DAY_NUMBER_IN_CALENDAR_YEAR"
        from dual;
      x mytype := mytype(null,null,null,null);
    begin
      for i in cur_mycur
      loop
        x := mytype(i.full_date,i.day_of_week,i.day_number_in_calendar_month,i.day_number_in_calendar_year);
        pipe row(x);
      end loop;
    end;
    sho err
    select * from table(myfunc(sysdate));
    select * from table(myfunc(to_date('15/09/2006','dd/mm/yyyy')));is this what you're after.
    If so I suggest you take it away, and get an understanding for it. It's a very useful technique to know.
    I know it doesn't do all the days between 2 dates, but that should be something you can do with a little thought.
    Regards
    Message was edited by:
    blushadow

  • How to make this function module as RFC to get data from different system?

    Hi
    I am trying to use following function module . This function module is used to copy data from one cube to another cube within same system however I need a this should happen across two different system. How can I use this function module to make it remote call to different system and do the same function what it is doing ?
    Name of function module -
    RSDRT_INFOCUBE_DATA_COPY
    Any help would be really helpful
    AG

    HI,
      let us say you want to copy the data of a cube in system A to a cube in system B .
      1) create a RFC function module in system B (in this function module  call the function module RSDRI_CUBE_WRITE_PACKAGE to update the data), this RFC function module should have same parametersa as RSDRI_CUBE_WRITE_PACKAGE .
    2) write a program in system A .. read the data from the infocube using the function module RSDRI_INFOPROV_READ and call the RFC function module in system B that you have created..
    for the details of the parameters to pass to these two function modules use the RSDRT_INFOCUBE_DATA_COPY and get the required code
    Thanks
    mahesh

  • How to make a function call.

    Hello ,
    I tried to call the function in Form Calc but there are some error. can any one say the right syntax to be used.Please find example what i tried
    if(x eq 1) then
    values()
    endif
    func values()
    xfa.host.messageBox("test")
    endfunc
    Kindly any one let me know where i went wrong
    Best Regards,
    Rakesh

    Hi Rakesh,
    If you look at page 966 of the XFA specification (http://partners.adobe.com/public/developer/xml/index_arch.html#xfa_28), then you will see how to decalre and call a function in FormCalc:
    func MyFunction(param1) do param1*param1 endfunc // Declares a function
    MyFunction(3) //Invokes the function, which returns 9
    It looks like your previous FormCalc function was missing the "do" call.
    Bear in mind that if you start putting functions in script objects, you will have to revert to Javascript.
    Good luck,
    Niall

Maybe you are looking for