How to store logical operator in an array in java

how to store logical operator in an array in java.
Array should not be String type if i pass an element of that array it should be considered as logical operator

my exact requirment is like this, i need some logic
to convert string like this "2 Equals 3 AND 4 greater
than 7" to condition like this
2 == 3 && 4 >7 which i can pass to if
condition.So you want to create an expression parser?
No need for something as ugly as what you think you need, a simple nested conditional will do it for just the few logical operations.

Similar Messages

  • How to achieve logical operator on [Authorize(Roles = ] in MVC

    For example, I need to make a controller accessible a user with two roles; role "Admin" and "Editor". How to achieve it.
       [Authorize(Roles = "Admins")]
        public class SampleController : BaseController
    How to do logical operator, such as AND and OR (maybe || and &&)
    Thanks!
      

    Hello klouapple,
    Please post your question to ASP.NET forum instead of here.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to change logical operator

    Hi
    I am trying to determine Employee Responsible(ER) based on territory attributes. Determination should work on 4 attributes as Country,Region,Postal Code and Prod cat. But i could find that first 3 attributes(Country,Region,Postal Code) are grouped together by "And" operator but Prod cat is by"OR" operator.
    So in a way for correctly determined ER based in this order Prod Cat.,Cty,REGN,PCDE. How we can chnage the logical operator or grp togther these attribute so they are connected by "and" operator and as a set is evaluated in transaction to determine the correct Employee Responsible when prod. is entered.
    thanks
    chap

    Hello ,
    We too are facing the same problem of using the logical operator.
    We want to use ' "Country" AND "Product Hier/Cat" '  but can only use OR instead.
    Please advice.
    Rgds,
    Ak-

  • How to store spry data in php array

    I am trying to store spry data in php array like this:
    <? $foo= array();?>
      <div spry:region="dsCALC">
        <div spry:repeat="dsCALC">
          <?php
    $foo[]='{dsCALC::DataPrice}';
    ?>
          </div>
      </div>
    <?var_dump($foo);?>
    Outputs:
    Array (     [0] => {dsCALC::DataPrice} )
    If I tried a variable, it works ok... The array, not... Any ideas?

    Outputs:
    Array (     [0] => {dsCALC::DataPrice} )
    And so it should, because that is what you told the PHP-script to do in the following line of code.
    $foo[]='{dsCALC::DataPrice}';
    Please remember that PHP code is handled on the server, whereas JavaScript (Spry) is handeld on the client (browser) end. JavaScript cannot be handeld by PHP nor can JavaScript handel PHP.
    My question to you is, why do you want to store the data in a PHP-array and how is the Spry data obtained?
    Ben

  • How to store (non-persistent) multiple float[] arrays.

    Hi;
    In a situation where an object needs to store multiple float arrays, how can I use a 2 dimensional array to store them? I can't use a collection since an array is a primitive.
    I would use a 2 dimensional array, but my keys to get/set these arrays are ints. So I cant do a "int i[][]", nor a "float f[][]".
    Any ideas?
    Thanks;
    -nat

    You could make a Map (such as HashMap) with an
    Integer (java.lang.Integer) key and a "int []" or "float []" as a value (an array is an Object, so can be put as a value).You kid me not! I need to review my basics.
    I simply didn't know that an array of primitives can be stored as a value in a map.
    Thank you!
    -nat

  • How to store grid points in a file using Java Swing?

    Please someone help me with any suggestions about how to store the grid points in a file using Java Swing

    Actually i have designed a gridlayout in Java Swing and have added some components to it such as buttons or images....My problem is when I click on any of the cell of the grid,the corresponding cell number should be stored in an external file....Do u have any suggestions on how to do it?

  • How to use logical operator

    Hi ,
    I hava a problem while using logical operators.
    I wrote a procedure to compare two strings.please check the following.
    CREATE OR REPLACE PROCEDURE comp_str(sour_str IN varchar2,targ_str IN varchar2) AS
    leng_sour_str number:=NVL(length(sour_str),0);
    leng_targ_str number:=NVL(length(targ_str),0);
    leng_str number:=NULL;
    BEGIN
    IF sour_str IS NULL THEN
    dbms_output.put_line(leng_targ_str);
    elsif targ_str IS NULL THEN
         dbms_output.put_line(leng_sour_str);
    ELSE
         select utl_match.edit_distance(leng_sour_str,leng_targ_str) into leng_str from dual;
    END IF;
    dbms_output.put_line(leng_str);
    IF (leng_str > 0) OR (leng_sour_str > 0) OR (leng_targ_str > 0) THEN
    dbms_output.put_line('Strings are not same');
    ELSE
    dbms_output.put_line('Strings are same');
    END IF;     
    END comp_str;
    IF (leng_str > 0) OR (leng_sour_str > 0) OR (leng_targ_str > 0) statement is not verifying the conditions properly.
    Please suggest me that how to write multiple conditions with OR Operator or any alternative.
    thanks in advance.

    They are working exactly as you expect it. The problem in your code is probably the "utl_match.edit_distance"-procedure. Do you know the outcome of this procedure?
    Why don't you try something like
    declare
      l_string1   varchar2(255) := 'String1';
      l_string2   varchar2(255) := 'String 2';
    begin
      if length(l_string1) > length(l_string2) then
        dbms_output.put_line('String 1 is longer than String 2');
      else
        dbms_output.put_line('String 1 is shorter than String 2');
      end if;
    end;This way, you can change one string or the other and see, how it works. With utl_match.edit_distance you need to know what exactly they are computing to see what the logical comparison is doing.

  • How to use logical operator in struts logic:equal

    Hi All,
    I need to translate:
    if ( a == 'option1' || a == 'option2' )
    to struts code....
    I don't know how to put || or && in <logic:equal.... ?&#65533;?&#65533;?&#65533;?
    Many thanks

    Must it really be Struts? If so, try asking this question at their own forum/mailinglist at apache.org.
    Can it be JSP? If so:${a == 'option1' || a == 'option2' ? 'outputThis' : 'outputElse'}Can it be JSTL? If so:<c:if test="${a == 'option1' || a == 'option2'}">
        <!-- Do your thing. -->
    </c:if>And please don't mark threads as answered if the question is not answered. I almost ignored this thread.

  • How to store select query output in arrays.

    i created a varray type variables and now want to assign some data though select query output in pl/sql code as well as in reports 6i.

    You're in the wrong forum (this one is for issues with the SQL Developer tool). You were in the right one where you posted first, but don't reuse unrelated threads as you did.
    Regards,
    K.

  • How to store the certificate file by using import java.security package?

    Hi,
    I have a certificate file whose extension is .p12(So, it conforms to pkcs 12 standart).
    I wanna store this file which is in my file system in my pc. and I wann to store this file to smart card?
    // this two row just load the specified file
    KeyStore keyStore = KeyStore.getInstance("PKCS12");
    keyStore.load(new java.io.FileInputStream(pkcs12File), keyPassword);
    // I need to store keyStore object to smart card. but I do not know how to? Any idea????

    This is not adding external p12 f�le inside the smart card ? Am I right? I want a p12 f�le to add this this file to smart card indside

  • How to store the data read from excel using java code in Ms access database

    Hi. I wrote a code to read the data from excel. May i know how can i save it to Ms access database using java. Also i have many excels. So i should not connect the database using DSN. So is there any other way to achieve this?

    kramish wrote:
    Im pretty sure that Access does support JDBCNo it does not. It supports ODBC.
    just doing a quick Google came up with some pages:
    http://blog.taragana.com/index.php/archive/access-microsoft-access-database-from-java-using-jdbc-odbc-bridge-sample-code/
    http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html
    Both articles explains how to use the jdbc-odbc bridge. I think I've seen a pure jdbc driver for access but it wasn't from Microsoft and it wasn't free.
    Kaj

  • How to store a data on txt file through java program

    that means i want a coding for write data on txt file using java program.that storing data is stored like this formate,
    sathees
    krishnan
    rama
    suresh
    Stored on one by one. not like this
    sathees krishnan rama suresh.........

    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class rsk1{
    public static void main (String argv []){
    try {
    String sr[] = new String[100];
                   String s1=" ";
                   int j=0;
                   DataInputStream in = new DataInputStream(System.in);
                   OutputStream f1 = new FileOutputStream("file1.txt");
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse (new File("book.xml"));
    // normalize text representation
    doc.getDocumentElement ().normalize ();
    System.out.println ("Root element of the doc is " +
    doc.getDocumentElement().getNodeName());
    NodeList listOfPersons = doc.getElementsByTagName("person");
    int totalPersons = listOfPersons.getLength();
    System.out.println("Total no of people : " + totalPersons);
    for(int s=0; s<listOfPersons.getLength() ; s++){
    Node firstPersonNode = listOfPersons.item(s);
    if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
    Element firstPersonElement = (Element)firstPersonNode;
    NodeList firstNameList = firstPersonElement.getElementsByTagName("first");
    Element firstNameElement = (Element)firstNameList.item(0);
    NodeList textFNList = firstNameElement.getChildNodes();
    sr[++j]=((Node)textFNList.item(0)).getNodeValue().trim();
    NodeList lastNameList = firstPersonElement.getElementsByTagName("last");
    Element lastNameElement = (Element)lastNameList.item(0);
    NodeList textLNList = lastNameElement.getChildNodes();
    sr[++j]=((Node)textLNList.item(0)).getNodeValue().trim();
    NodeList ageList = firstPersonElement.getElementsByTagName("age");
    Element ageElement = (Element)ageList.item(0);
    NodeList textAgeList = ageElement.getChildNodes();
    sr[++j]=((Node)textAgeList.item(0)).getNodeValue().trim();
    NodeList stuList = firstPersonElement.getElementsByTagName("stu");
    Element stuElement = (Element)stuList.item(0);
    NodeList textstuList = stuElement.getChildNodes();
    sr[++j]=((Node)textstuList.item(0)).getNodeValue().trim();
    }//end of if clause
    }//end of for loop with s var
    System.out.println("Process completed");
    for(int i=1;i<=j;i++)
                   byte buf[] = sr.getBytes();
                                       byte buf1[] = s1.getBytes();
         f1.write(buf);
                                       f1.write(buf1);
    f1.close();
    }catch (SAXParseException err) {
    System.out.println ("** Parsing error" + ", line "
    + err.getLineNumber () + ", uri " + err.getSystemId ());
    System.out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    }//end of main

  • How to store a file in windows registry

    Hi, I'm a student of java and I've a problem, can any body tell me that how to store a file in windows registry in java.

    Store the file on disk and put the path in the registry.

  • How to store the output of a analog to digital converter into an 2D array

    Hi
    I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.

    nitinkajay wrote:
    I want to know how to store the output of a analog to digital converter into an 2D labview array.
    How exactly are you performing 'Analog to Digital'???
    Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • How to store array of data into a single row of  table ,using any of Stmts

    HI Friends,
    Based on my requirements ,i have retrived a set of data from a XXX.jsp page using a request.getParameter() and stored into single dimenssional array . Now i am paassing that array to JAVA class to store a into some table .
    In JSP page users can add text boxes dynamically based on his intrest then those attributes will store in table .it means table attributes are not conatant , it table attributes may change at any time when user adds any textboxs or any fields on JSP page ....thats my module ..
    Now i wanted to store all array of data into Table in a single row .......thats is my requirements .
    How can we use prepareStatement and Statement to store array of results intoo table row ...on each iteration i wanted to store array of results into table atributes ..It means entire array of results should to into table row at time .....coule any one write sytax ,how we do this...
    could any one suggest me stps that i can impliment ......?....please reply ASAP

    Well ..you code can be works for constant number of attributes in table .oopss here my requirement is table attributes not fixed ,we cant put constant number of place holder(? ) in a statement ,because those are not fixed ,
    Let me explain here :
    i am doing in that way only. As i mentioned you Table attributes are not constant .It may very if users add any fields dynamically on JSP page .If users have option to add any text box on Jsp page ,then that attribute will store in table as a attribute .
    Now i amable fetching the all dyamic form data and stored in a Result Array below ...in this iteration all form result data are from jsp page as suggestion form ,it should stored in table in single row on corrsponding attribtes ......next time when users fills FROM ,then those data i am fetching and storing in a Result Array as below and need to store in corrsponding table attributes in a single row ....
    for(int i=0;i<result.length;i++)
                   System.out.println(result);
                   pst3=connection.prepareStatement("insert into *emprecord* values(?)");
                   if(!result[i].equals(""))
                        System.out.println(result[i]);
                             pst3.setString(1,result[i]);
                             pst3.executeUpdate();
    Thnks in advance ....let me know the the way we can store dynamic form data into dyanamic table ...

Maybe you are looking for