All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.trepo.dcap.store.Expression Maven / Gradle / Ivy

The newest version!
package com.github.trepo.dcap.store;

/**
 * @author John Clark.
 */
public class Expression {

    /**
     * The field to use for the first term in the expression.
     */
    private Key key;

    /**
     * The predicate to apply to the expression.
     */
    private Predicate predicate;

    /**
     * The value to compare the keyed field against.
     */
    private Object value;

    /**
     * Create a new expression.
     * @param k The commit field to compare to.
     * @param p The actual comparison.
     * @param o The value to compare against.
     */
    public Expression(Key k, Predicate p, Object o) {
        if(k == null) {
            throw new IllegalArgumentException("key may not be null");
        }
        if(p == null) {
            throw new IllegalArgumentException("predicate may not be null");
        }
        key = k;
        predicate = p;
        value = o;
    }

    /**
     * Gets the key.
     * @return The key.
     */
    public Key getKey() {
        return key;
    }

    /**
     * Gets the predicate.
     * @return The predicate.
     */
    public Predicate getPredicate() {
        return predicate;
    }

    /**
     * Gets the value.
     * @return The value.
     */
    public Object getValue() {
        return value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy