net.anotheria.anodoc.query2.QueryModProperty Maven / Gradle / Ivy
package net.anotheria.anodoc.query2;
/**
*
* IMPORTANT:Tested only in postgressql!
*
* @author denis
* @version $Id: $Id
*/
public class QueryModProperty extends QueryProperty{
private long mod;
/**
* Constructor for QueryModProperty.
*
* @param aName a {@link java.lang.String} object.
* @param aMod a long.
* @param aValue a long.
* @param a T object.
*/
public QueryModProperty(String aName, long aMod, long aValue){
super(aName, aValue);
mod = aMod;
}
/** {@inheritDoc} */
@Override
public boolean doesMatch(Object o) {
return o == null ?getOriginalValue() == null :
((Long)o) % mod == (Long)getValue();
}
/** {@inheritDoc} */
@Override
public String getComparator() {
return " % " + mod + " = ";
}
/** {@inheritDoc} */
@Override
public boolean unprepaireable() {
return false;
}
/**
* Getter for the field mod
.
*
* @return a long.
*/
public long getMod() {
return mod;
}
/**
* Setter for the field mod
.
*
* @param mod a long.
*/
public void setMod(long mod) {
this.mod = mod;
}
}