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

gate.sql.condition.CompiledPredicate Maven / Gradle / Ivy

There is a newer version: 12.3.1
Show newest version
package gate.sql.condition;

import gate.sql.Clause;
import java.util.function.Supplier;

/**
 * A single predicate of a compiled condition.
 */
public abstract class CompiledPredicate extends Predicate implements
	ConstantPredicateMethods,
	CompiledPredicateMethods
{

	CompiledPredicate(Clause clause)
	{
		super(clause);
	}

	@Override
	public CompiledCondition isNull()
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " is null";
			}
		};
	}

	@Override
	public CompiledCondition isNotNull()
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " is not null";
			}
		};
	}

	@Override
	public CompiledCondition isEq(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " = " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isNe(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " <> " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isLt(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " < " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isLe(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " <= " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isGt(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " > " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isGe(String expression)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " >= " + expression;
			}
		};
	}

	@Override
	public CompiledCondition isBw(String expression1, String expression2)
	{
		return new CompiledCondition(this)
		{
			@Override
			public String toString()
			{
				return getClause() + " between " + expression1 + " and " + expression2;
			}
		};
	}

	static class Rollback extends CompiledPredicate implements CompiledPredicateMethods.Rollback
	{

		public Rollback(Clause clause)
		{
			super(clause);
		}

		@Override
		public CompiledCondition isNull()
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isNotNull()
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isEq(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isNe(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isLt(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isLe(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isGt(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isGe(String expression)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition isBw(String expression1, String expression2)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition eqGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition neGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition ltGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition leGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition gtGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition geGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition lkGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}

		@Override
		public CompiledCondition rxGet(Supplier supplier)
		{
			return new CompiledCondition(getClause().rollback());
		}
	}
}