org.cpsolver.ifs.util

## Class Query

- java.lang.Object
- - org.cpsolver.ifs.util.Query

- All Implemented Interfaces:
    Serializable

      public class Query
      extends Object
      implements Serializable

  A representation of a boolean query. Besides of AND, OR, and NOT, the query may also contain terms (such as major:M1) that are evaluated by the `Query.TermMatcher`.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2024 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `Query.AmbigousTermMatcher` Ambigous term matcher.
    `static class` | `Query.AndTerm` Representation of an AND between two or more terms.
    `static class` | `Query.AtomTerm` Representation of one attribute:value term
    `static class` | `Query.CompositeTerm` Composition of one or more terms in a query (e.g., A and B and C)
    `static class` | `Query.NotTerm` Representation of a NOT term
    `static class` | `Query.OrTerm` Representation of an OR between two or more terms.
    `static interface` | `Query.QueryFormatter` Query formatter class
    `static interface` | `Query.Term` Representation of a term in the query, that is attribute:value.
    `static interface` | `Query.TermMatcher` Term matcher interface.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Query(Query.Term query)`
    `Query(String query)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Query.Term` | `getQuery()`
    `boolean` | `hasAttribute(Collection<String> attr)`
    `boolean` | `hasAttribute(String... attr)`
    `static void` | `main(String[] args)`
    `boolean` | `match(Query.AmbigousTermMatcher m)` Evaluate if the query using the provided term matcher.
    `boolean` | `match(Query.TermMatcher m)` Evaluate if the query using the provided term matcher.
    `String` | `toString()`
    `String` | `toString(Query.QueryFormatter f)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Query

          public Query(String query)

    - #### Query

          public Query(Query.Term query)

  - ### Method Detail

    - #### getQuery

          public Query.Term getQuery()

    - #### match

          public boolean match(Query.TermMatcher m)

      Evaluate if the query using the provided term matcher.

    - #### match

          public boolean match(Query.AmbigousTermMatcher m)

      Evaluate if the query using the provided term matcher.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString(Query.QueryFormatter f)

    - #### hasAttribute

          public boolean hasAttribute(String... attr)

    - #### hasAttribute

          public boolean hasAttribute(Collection<String> attr)

    - #### main

          public static void main(String[] args)