001/* 002 $Id: Expression.java 3207 2009-04-09 06:48:11Z gregory $ 003 004 Copyright (C) 2006 Gregory Vincic, Olle Mansson 005 Copyright (C) 2007 Gregory Vincic 006 007 This file is part of Proteios. 008 Available at http://www.proteios.org/ 009 010 Proteios is free software; you can redistribute it and/or modify it 011 under the terms of the GNU General Public License as published by 012 the Free Software Foundation; either version 2 of the License, or 013 (at your option) any later version. 014 015 Proteios is distributed in the hope that it will be useful, but 016 WITHOUT ANY WARRANTY; without even the implied warranty of 017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 018 General Public License for more details. 019 020 You should have received a copy of the GNU General Public License 021 along with this program; if not, write to the Free Software 022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 023 02111-1307, USA. 024*/ 025package org.proteios.core.query; 026 027/** 028 An expression query element. This is a query element that can appear 029 almost anywhere in a query. For example a {@link Select} is usually 030 an expression together with an alias, a {@link Restriction} is 031 a comparison of two or more expressions, etc. 032 <p> 033 There are many types of expressions. The simplest ones just insert a 034 constant value: {@link Expressions#integer(int)} or 035 {@link Expressions#aFloat(float)}. 036 <p> 037 Other expressions create a reference to a property or database column: 038 {@link Hql#property(String, String)}. 039 <p> 040 Expressions can also be combined to form other expressions: 041 {@link Expressions#add(Expression, Expression)} or {@link 042 Expressions#divide(Expression, Expression)} 043 <p> 044 Thus it is possible to form a complex tree of expressions: 045<pre class="code"> 046<b>// The log ratio of foreground intensities: LOG(ch1fg) / LOG(ch2fg)</b> 047Expression logRatio = Expressions.divide( 048 Expressions.log(Hql.property("ch1fg")), 049 Expressions.log(Hql.property("ch2fg")) 050); 051</pre> 052 053 <p> 054 The expressions can then be used to create restrictions: 055<pre class="code"> 056<b>// Return only data with log ratio greater than 2.0</b> 057Restrictions.gt(logRatio, Expressions.aFloat(2.0)); 058</pre> 059 060 <p> 061 The {@link Expressions}, {@link Hql}, {@link Annotations} 062 and {@link Annotations} are factory classes that create expressions. 063 064 065 @author Nicklas 066 @version 2.0 067 @base.modified $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $ 068*/ 069public interface Expression 070 extends QueryElement 071{}