Representing in a collection

I have some data in a table like the following
date1 date2 date3
id1 10 12 13
id2 11 12 9
id3 7 9 4
I need to store this in a way so that a value can be easily retrieved by calling something like get(id1,date3), which should return 13.
I am currently thinking off something like this
Hashmap<int, HashMap<Date, value>>
But just wondering if there is an easier/better approach to do this?
But just wondering if there is an easier/better approach to do this?

Personally, I would set up a class that contains proper Java variables to store your data, eg:public class myTableData {
private int id; // assuming your id is a number;
private Calendar date = new Calendar();
public myTableData(String[] data) {
  id = Integer.parseInt(data[0]).intValue;
  // assuming your date1, date2 and date3 are year, month, day
  date.set(Integer.parseInt(data[1]).intValue, Integer.parseInt(data[2]).intValue, Integer.parseInt(data[3]).intValue);
... // getter and setter methods
}then you simply need a HashMap<myTableData>.

Similar Messages

  • Smart collections not reading correct number of images inside

    I have an issue with smart collections for the first time. I have just set up a new workflow with 4 stages and the number counter next to the collection is counting wrong despite the images being represented in the collection. For example if I click on the smart colection I can see 10 images inside but the counter reads 3. Does anybody have this experience?
    I have optimised my cataloge, however I do have some 20,000 images inside... will this reduce the ability of LR to keep up to running speed with such smart collection operations, giving incorrect readings.
    What are best practices for image numbers and the arguement for running multiple cats. I've just tried in a fresh catalogue and the results were perfect. Is this an inherent limitation of Lightroom? I was under the impression that I could manage my whole archive and current projects under one roof, as it were.
    Thanks,
    Graeme

    I suppose it would be worth optimising the catalog, if you haven't already done so.
    Another idea, may be to make a fresh catalog and "import from another catalog" your current one, into that. This transfers pictures and keywords, collections, smart collections etc. But if there is something "structural" or "infrastructural" wrong with your live catalog, I'd expect that to get left behind by this process - since everyting should AFAIK get re-indexed after being brought in.
    Then you'd go forward with the new catalog, if successful. Doing this makes no change to your present catalog so can do no harm to try - the various pictures' source files are simply shared across both catalogs - single file referenced by both, IOW.
    One thing in your post (which I did not fully understand) suggested to me that your workflow relies at some point, on external metadata being written. If your workflow and smart collections criteria rely on the LR tracking of the status of external metadata, such as "is up to date", I believe this specific aspect has been found quite buggy and unreliable by many people: the metadata status badges etc, being sometimes rather approximate in their correspondence to reality . So if some other criterion could be found on which to base your workflow, that would probably go more smoothly . 
    However, if you do have more than one catalog pointing to just one set of photo source files, that aspect of writing metadata out, will of course be a little problematic - since the latest catalog to have written to the file will "overwrite", and the other catalog(s) will regard that same image as having been externally modified meanwhile.
    regards, RP

  • How to access PL/SQL code using JDBC

    Hi,
    We have stored procedures written in PL/SQL. These stored procs take both IN and OUT parameters. The parameter types are both regular datatypes like NUMBER, VARCHAR etc. So far so good. I know how to handle these data types.
    Some of the stored procs also use parameters that are defined as composite data types like %ROWTYPE or %RECORD. How would I set the values of these data types? Can I use the oracle extension - support for Oracle Objects to accomplish this. If so please let me know with an example. If not any other suggestions or help will be greatly appreciated.
    Thanks
    Karthik

    JDBC (and SQLJ) only support SQL types as stored procedure arguments, not PL/SQL types.
    If your stored procedure uses a PL/SQL-only type, such as BOOLEAN, record types, or index-by tables, then you cannot call it from Java (or, for that matter, from other languages as well).
    There is one exception: scalar index-by table arguments have been supported since JDBC 8.1.7 in the JDBC-OCI driver (refer to the JDBC manual for specifics).
    One workaround is to create wrapper PL/SQL stored procedures that take SQL arguments and convert them to PL/SQL -and vice versa- and call the original PL/SQL stored procedures. For example, a record type could be exploded into individual arguments, or it could be converted into a SQL object type, index-by tables could be represented as SQL collection types, etc.
    You can find a small example of this in the back of the JPublisher manual, where an example is given how to call a PL/SQL stored procedure that takes BOOLEAN arguments.

  • How to access PL/SQL data types through JDBC

    Hi,
    We have stored procedures written in PL/SQL. These stored procs take both IN and OUT parameters. The parameter types are both regular datatypes like NUMBER, VARCHAR etc. So far so good. I know how to handle these data types.
    Some of the stored procs also use parameters that are defined as composite data types like %ROWTYPE or %RECORD. How would I set the values of these data types? Can I use the oracle extension - support for Oracle Objects to accomplish this. If so please let me know with an example. If not any other suggestions or help will be greatly appreciated.
    Thanks
    Karthik
    null

    JDBC (and SQLJ) only support SQL types as stored procedure arguments, not PL/SQL types.
    If your stored procedure uses a PL/SQL-only type, such as BOOLEAN, record types, or index-by tables, then you cannot call it from Java (or, for that matter, from other languages as well).
    There is one exception: scalar index-by table arguments have been supported since JDBC 8.1.7 in the JDBC-OCI driver (refer to the JDBC manual for specifics).
    One workaround is to create wrapper PL/SQL stored procedures that take SQL arguments and convert them to PL/SQL -and vice versa- and call the original PL/SQL stored procedures. For example, a record type could be exploded into individual arguments, or it could be converted into a SQL object type, index-by tables could be represented as SQL collection types, etc.
    You can find a small example of this in the back of the JPublisher manual, where an example is given how to call a PL/SQL stored procedure that takes BOOLEAN arguments.

  • How to use PL/SQL procs with portlet enabled CA's?

    I have written some PL/SQL procedures in a package.
    Now I would like to use this in a FOLDER-portlet (a new CA created for this purpose).
    But when I select the 'Open Item In Folder' (which should show the PL/SQL procedure results in the portlet I hope) I get:
    Call to utl_http failed (WWS-32136)
    ORA-1: User-Defined Exception (WWC-36000)
    If instead the option 'Open in new browser window' (or something like that) I get no error.
    My CA calls the PL/SQL pkg using a URL item like this:
    http://myserver/pls/dad/schema.package.procedure?p_arg=...
    It works entered directly in the address bar and if the item opens in a new window.
    But I want it to display in the SAME portlet as the link I click on.
    How is this done?
    null

    JDBC (and SQLJ) only support SQL types as stored procedure arguments, not PL/SQL types.
    If your stored procedure uses a PL/SQL-only type, such as BOOLEAN, record types, or index-by tables, then you cannot call it from Java (or, for that matter, from other languages as well).
    There is one exception: scalar index-by table arguments have been supported since JDBC 8.1.7 in the JDBC-OCI driver (refer to the JDBC manual for specifics).
    One workaround is to create wrapper PL/SQL stored procedures that take SQL arguments and convert them to PL/SQL -and vice versa- and call the original PL/SQL stored procedures. For example, a record type could be exploded into individual arguments, or it could be converted into a SQL object type, index-by tables could be represented as SQL collection types, etc.
    You can find a small example of this in the back of the JPublisher manual, where an example is given how to call a PL/SQL stored procedure that takes BOOLEAN arguments.

  • Why is there no graph?

    Why doesn't the collections API include a graph implementation? A single/double edged and weighted graph might prove useful at times. Is it because these things can be represented with existing collections? If not, does anybody know of open source implementations of these types of structures? All I can seem to find are academic examples used for CS homework assignments.

    you might look for a "charting" project instead. they tend to include abstract graph structures, e.g. www.jgraph.com (no affiliation, just the first link i hit).

  • JAXB: Is semantic awkwardness inherent, or am I doing something wrong?

    I've successfully worked Sun's examples, and applied lessons learned to my actual problem domain, but am a little frustrated with some aspects of the generated classes, in that their API is semantically counterintuitive in places.
    For example, suppose we have the following XML instance:
      <?xml version="1.0"?>
      <books>
        <book title="David Copperfield" author="Dickens, Chuck" />
        <book title="Bell Jar, The" author="Plath, Sylvia" />
      </books>Reverse-engineering schema (I used trang.jar) yields:
      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xs:element name="books">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" ref="book"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="book">
          <xs:complexType>
            <xs:attribute name="author" use="required"/>
            <xs:attribute name="title" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:schema>Generating with xjc yields the following Books class:
      public class Books {
          protected List<Book> book;
          protected List<Book> _getBook() {
              if (book == null) {
                  book = new ArrayList<Book>();
              return book;
          public List<Book> getBook() {
              return this._getBook();
      }Calling Books.getBook() to retrieve a List of Books is semantically counterintuitive. Is there a way, by tweaking the schema or through other mean, to cause elements like <books> -- whose sole purpose is to aggregate a set of child elements -- to be represented using ordinary Collections? I would much rather be able to write code that reads like this:
      for (Iterator it=Books.iterator(); it.hasNext(); ) {
        Book b = (Book) it.next();
        // do stuff
      }I won't lose any sleep, if I'm asking the impossible (or merely unsupported) -- I understand how to work with what's currently being returned. It would just be nice to present a more intuitive API for consumers of JAXB-generated classes, and I was hoping that achieving this might be as simple as learning a new trick.
    TIA,
    Eric Adamson
    Lansing, Michigan

    >When you use the includeIn command, by default the object will only be created when it is needed. Hence, you will execute a creationComplete
    >event, and therefore atleast 100 million (sometimes 400 million) loops, when each required Button state is needed. Obviously, once each button
    >state has been created the creationComplete handler (invalidateDisplayList) will not usually be called again.
    So are you saying there is a better way or another way to do that? Or are you just telling me that's how it works? Because I know that the includeIn isn't creating the other buttons untill they are needed. I need them created when the button is created. That is my question, how do I get the other states to be created when the button is created so that I don't see the button flash black?
    >As written, bioStyleChanged will always remain true
    >if(!bioStyleChanged) {
    >       bioStyleChanged = false;
    >}    
    >this code does nothing for you.
    Sorry, I missed that when cleaning up the code to ask for help.
    Thanks,
    cdman52

  • URGENT! Sorting double value in Vector

    Suppose VaggCost is a Vector store something like [752.5467, 834.4564, 1000.567, 65.5767]
    The following codes have error after sortAggCost(), CAN YOU GIVE ME A HAND???
    I am using JDK 1.4.1, Sun ONE Studio Update 1
    Thanks,
    David
    public void sortAggCost(Vector VaggCost){
    for(int p = 1; p < supplierCount; p++){
    double keyValue = ((Double)(VaggCost.elementAt(p))).doubleValue();
    int j = p;
    for(; j > 0 && keyValue < ((Double)(VaggCost.elementAt(j-1))).doubleValue(); j--)
    VaggCost.setElementAt(VaggCost.elementAt(j-1), j);
    } // End of second For loop
    VaggCost.setElementAt(keyValue +"", j);
    } // End of first For loop

    Is that really a vector of Doubles, or a Vector of Strings representing Doubles?
    Collections.sort() will sort a vector of Doubles correctly.
    If you actually have a Vector of Strings representing doubles, you'll have to do something else. Java won't automatically convert from one to the other, like, say, Perl.
    One option would be to use the two-arg version of Collections.sort(), and define a class for the second arg. See the docs.

  • Collection to represent ol ul il structures in recursive function

    Hello
    Im trying to write a terminal based web-browser and have a little problem when it comes to presentation of <ul><ol><li> tags.
    Im using recursion to step through the tags and the main function looks something like this (just wrote down a simplified version) It reads an xhtml document.
    private boolean  inBody= false;
    private int numberOfB = 0;
    private int numberOfEm = 0;
    public void printNodeLeaves(Node N)
         switch (N.getNodeType())
    case Node.DOCUMENT_NODE:
    case Node.ELEMENT_NODE:
    String nName = N.getNodeName(); //F�r ut taggar som B,P,EM osv
    if (nName.equalsIgnoreCase("body")) inBody= true;
    if (nName.equalsIgnoreCase("b")){
      numberOfB++;
      //Print out boldtext
    if (nName.equalsIgnoreCase("p")) itw.newline(2);
    if (nName.equalsIgnoreCase("em")){
         numberOfEm++;          
         //Print out italic text                    
    //Recursion      
    NodeList children= N.getChildNodes();
    if (children != null)
        for (int i=0; i<children.getLength(); ++i){              
             printNodeLeaves(children.item(i));              
    if (nName.equalsIgnoreCase("b")){
         numberOfB--;
         if(numberOfB==0) // Turn of the bold
         if(numberOfEm>0) // Turn on the italic
    if (nName.equalsIgnoreCase("em")) {
         numberOfEm--;
         if(numberOfEm==0) //Turn of the italic
         if(numberOfB>0) //Turn on bold
    if (nName.equalsIgnoreCase("p")) itw.newline(2);
         break;
         case Node.TEXT_NODE:
         if (inBody){                   
             itw.print(N.getNodeValue().replaceAll("\n", " "));                    
    }My problem is when it comes to the lists, both <ul> and <ol> tags contains <il>, im looking for a way to represent
    the lists in some kind of collection, linkedlist maybe. I was thinking of making a class that contains a list and property that tells me if the list is a <ul> or <ol>. The problem is that a <ul> could containt a <ol> and vice verca, ant of course they must be able to be nested. Why i need the ul and the ol in the same collection is because <il> in a <ol> should be outprinted with the number first followed by a dott, and <ul> should have a * in front of each <il>.
    Anyone that have any thoughts on this?

    Odd question. Why do you need to represent them in a collection? Seems like they're probably as well organized as they will be in the DOM. You should just process nodes recursively and if the current node is a "ol" then each child should be displayed with an integer that counts up from 1. If you hit an "ul" while processing the "ol" it shouldn't matter, you should process it then continue processing the "ol".
    One suggestion:
    use:
    String nName = N.getNodeName().toLowerCase().intern();
    then do if(nName == "tagname")
    as is, you are converting each character to lower case and comparing everytime. If you internalize, then == will work and is a simple reference comparison.
    More about internalization:
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#19369

  • Collection representing a relation of arity two?

    hi,
    does anyone know of a Collection style class for representing a relation of arity two?
    you would be able to search by either the LHS or RHS of each tuple of the relation
    to give a better idea...Association assoc = new Association();
    assoc.add("magnolia","tom cruise");
    assoc.add("war of worlds", "tom cruise");
    assoc.add("war of worlds", "tripods");
    assoc.add("doctor who","tripods");
    assoc.getRHS("doctor who"); // gets a set of things associated with "doctor who"
    assoc.getLHS("tom cruise"); // gets a set of things associated with "tom cruise"the application i need this functionality for does not justify a database backend.. and before writing this thought i'd query if anyone else has one available?
    thanks,
    asjf

    Use a Set for the values part of the key/value tuples and use two Maps:
    one for the key/value directions and one for the value/key direction.
    A bit of fiddling w.r.t. deletes and updates will do the rest.
    kind regards,
    Jos

  • Create a Collection of machines missing a single patch MS07-042

    Good Morning All,
       I am trying to create a collection for all machines missing a single patch.  MS07-042.  This patch has multiple KB numbers. 
    I noticed a couple of odd occurances.
    1) Console query builder does not expose the Updates classes.
    2) Console query builder does expose all the ITMU classes.  I am not sure if these are populated with the WSUS information gathered by the WUA.
    I did create the following query
    select * 
    from  SMS_R_System inner join SMS_UpdateComplianceStatus on SMS_UpdateComplianceStatus.MachineID = SMS_R_System.ResourceId
       inner join SMS_Softwareupdate on  SMS_Softwareupdate.CI_ID = SMS_UpdateComplianceStatus.CI_ID
    where SMS_Softwareupdate.BulletinID = "MS07-042"
    However, I am unable to locate any documentation on what the Status Fields indicate in SMS_UpdateComplianceStatus.
    My Questions
    1) Is there an easier way to do this?
    2) Is there any documentation on what the fields mean in SQL?
    I look forward to blogging about this as soon as I am sure of an answer.
    Best
    Shaun Cassells
    http://myitforum.com/cs2/blogs/scassells/default.aspx

    Torsten, do you have a refrence for the SMS_UpdateComplianceStatus table?  I want to know what the Status Field values represent.
    I realize this is an old thread, but I just wanted to put in my $0.02 in case someone else stumbles upon it looking for info.
    So, the SMS_UpdateComplianceStatus class (cuz we're talking collections here, which is WQL and pulls from WMI classes) is really the equivalent of the v_UpdateComplianceStatus view.  So if you want to see what's in that, go to SQL and query it.
    Also, if you want to know what the Status field values are, you can find those by looking at the v_StateNames view from SQL too where TopicType = 400 I believe.
    State 0 = Unknown
    State 1 = Not Required (meaning doesn't have patch and doesn't need it)
    State 2 = Not Detected (meaning it doesn't have patch but needs it)
    State 3 = Detected (meaning it has this patch)
    So, if you want to create a collection of machines that are missing a patch, you could do something like this:
    SELECT
      SMS_R_SYSTEM.ResourceID,
      SMS_R_SYSTEM.ResourceType,
      SMS_R_SYSTEM.Name,
      SMS_R_SYSTEM.SMSUniqueIdentifier,
      SMS_R_SYSTEM.ResourceDomainORWorkgroup,
      SMS_R_SYSTEM.Client
    FROM
      SMS_R_System
      JOIN SMS_UpdateComplianceStatus
        ON SMS_R_System.ResourceID = SMS_UpdateComplianceStatus.MachineID
        AND SMS_UpdateComplianceStatus.Status = 2
      JOIN SMS_SoftwareUpdate
        ON SMS_UpdateComplianceStatus.CI_ID = SMS_SoftwareUpdate.CI_ID
        AND SMS_SoftwareUpdate.ArticleID = 832671
    Number2 - (John Nelson)
    Microsoft MVP (2009) - System Center Configuration Manager
    http://number2blog.com

  • Creating new Enterprise wiki site collection or creating a new subsite, or creating a new library

    I have SharePoint 2013 web application, which has enterprise wiki site collection for our finance department. Now I need to create a new site for our HR department.
    The two sites will differ in the following:-
    Each department have different permission. For example each department have different users for who can approve, edit/create.
    Each department will use different EnterpriseWiki page layout. As each department will have different wiki category columns (different site columns).
    Also each department will use different metadata navigation.
    The two sites will have the following in common:-
    The same master page. Seatle.html.
    So I can not determine which approach I should follow:-
    To create a new enterprise wiki site collection for our HR department.
    Create a new enterprise wiki library inside the current site collection representing the HR enterprise wiki.
    To create a new subsite ?
    Can anyone advice on these please? Thanks

    Given that each will have different permissions I would go with a separate site collection.  That will provide the best security basis.  You could do it with a sub site, but it will be easier to maintain the security as a separate site
    collection.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.
    Yes i know that having different permission & different page layouts will push toward creating separate site collections. but i found a major linking problem when using different site collections (i mean adding links which reference other site collections
    pages), let take the following example:-
    1. I have Site collection A & site collection B.
    2. now inside SCA i create a new wiki page named "Test.aspx" page.
    3. then inside SCA i add a link to this wiki page from another wiki page.
    4. also inside SCB i also add a link to the Test.aspx page.
    After that let say i modify the Test.asxp page name & title to be "NewTest.aspx" , which will affect the page URL which will be
    http:.../NewTest.aspx/ instead of
    http.../Test.aspx/. now inside SCA all the links to the old Test.aspx page will automatically updated to reference the NewTest.aspx so that the links will not break. but inside SCB pages, the links will not be modified and will keep referencing Test.asxp
    which no more exists ... so can you advice please if there is a way to overcome this problem , and if i create sub-site representing Site collection B will this solve the problem ?

  • How to trigger creation of collective orders

    Hi,
    How to trigger the creation of Collective orders.
    regards

    Hi,
    Collective Orders
    Use
    In a collective order, planned orders or production orders are linked to one another over several production levels. Each order in the collective order has its own order number. If subassemblies are produced directly for superior orders within a production process, without physically entering the warehouse, it is useful to have a representation via collective orders.
    The components for which separate production orders are created in the collective order are called directly produced components (see Creating Collective Orders)
    Prerequisites
    A collective order cannot be created for components that have one of the following indicators set:
    · Co-product
    · By-product
    · Alternative item with strategy 2
    · Alternative item with usage probability 0
    · Discontinued
    · Follow-up material
    · Intra material
    Features
    Collective orders offer the following advantages:
    · Integrated view of a production process
    Collective orders make it possible to represent different levels of the production process together in the system. The production process can be viewed as an integrated whole.
    · Separate order number for every order
    Every level in a collective order represents a separate production order/planned order. Every production order/planned order has its own order number. This enables you to process the entire collective order, a subtree in the collective order or an individual order.
    · No placements in storage or removals from storage between production levels
    Within a collective order stock movements only take place for the leading order (that is, the order that is at the highest production level) and not for directly produced components. This makes it easier to maintain the collective order in comparison with several individual orders. A further advantage is a more realistic representation of the costs of the production process, since subordinate orders can be directly assigned and settled to superior orders.
    · Business functions simultaneously for several orders
    Certain business transactions can be carried out simultaneously for several orders. Releasing an order that belongs to a collective order has the effect that all the hierarchically subordinate orders are released simultaneously.
    · Automatic change to dependent orders
    Changes to an order automatically affect dependent orders / components affecting orders. For example, if you change the order quantity in an order then
    ¡ the relevant quantity changes are automatically made to dependent orders
    ¡ the requirements quantity of the directly produced component is automatically changed.
    In the collective order, you also have the option of manufacturing directly produced material in a different plant to the planning plant.
    · Set status in leading order
    If you make changes in subordinate orders that have an affect on the status, then the system sets the corresponding status in the order header of the leading order in the collective order as follows:
    u2013 CFCO Confirmation in collective order
    u2013 GMCO Goods movements in collective order
    u2013 RLNE Release taken place in network
    In this way you are informed about changes in the whole collective order.
    · Reading master data
    You can copy the routing data and BOM data to the order again. You can find more information in Read master data.
    Example
    You want to produce a pump. The BOM for the pump contains a pressure regulating valve and a spiral casing. You want to enter these two components in separate production orders, but you do not want them to be posted to stock.
    You set the special procurement type to direct production in the material master record for the pressure regulating valve and the spiral casing, so that production occurs using a collective order.
    When you create a production order for the pump, a collective order is automatically created, which contains subordinate production orders for the pressure regulating valve and the spiral casing.
    Creation of Collective Orders
    Use
    Collective orders are only created if the special procurement type is set to direct production in the components for which the separate production orders are to be created (materials planning area in the material master).
    In the standard system, 52 is the special procurement type for direct production (that is, for components that are produced within a collective order).
    To create a collective order, you must use an order type with internal number assignment.
    Hope this helps.
    Regards,
    Tejas

  • How do I assign a timer to the DAQ module so that it counts the time from the start of the collection?

    Hi Everybody,
    I'm new to LabVIEW and need some help!
    I have setup a system that acquires the data from 4 thermocouples. I have then split the data to provide 4 temperature versus time graphs. The temperature fluctuates up and down but the time values at the bottom do not change? What I would like is for the time values to represent the amount of time the data has been collected for!
    I have attached my program, so please give me any ideas! Also any other improvements that you feel would make it better, please dont be shy!
    Alex
    Attachments:
    Thermocouple Temperatures21.vi ‏365 KB

    The time is not increasing/changing because you have "Ignore Timestamp" Checked  (right click on a graph to uncheck)  This should fix the problem
    Kenny

  • Applying a query language to collections

    Hi, we handed in a project a while ago that was essentially to read in data from a .DAT file, store it in appropriate collections, then use a basic query language to filter through the stored data. I wasn't really happy with my querying though, as it was basically a huge succession of control statements. The queries were of the form "select OBJECTNAME where ATRIBUTE OPERATOR VALUE and ATRIBUTE OPERATOR VALUE", there could be as many sub clauses as desired (0... 200 whatever). For example "select elephant where height > 360 and weight <= 1000".
    We had a comment back that we should use a Query interface and a two subclasses to represent a simple query (e.g. height > 360) and then a conjunctive query (ie simplequery1 AND simplequery2 ). The Query interface would then have a match method. I'm struggling to get my head around how I do this, does anyone have a simple example or explaination that might help me out?
    Cheers.

    I've done something like this a couple times. Your need to get a better idea of what you want your query language to look like. For example, if you're given a list of elephants, the "select elephant" part is unnecessary (your query will just return a list of matching elephants). You should decide if you want it to handle things like (height > (weight / 2)), whether conditions can be nested "((a and b) or (c and d)) and (e or f)". Will you need to support the conditional operator (a ? b : c) or a unary operator (-)? How complex will your order of operations rules be?
    If you keep it simple (always two operands), you could go with something like this:
    public interface QueryOperator
      public boolean eval(Object leftParam, Object rightParam);
    public enum BasicOperators implements QueryOperator
    public class  QueryElement
      private QueryOperator operator;
      private Object leftParam;
      private Object rightParam;
    }

Maybe you are looking for