ToClause.java
/*
** Module : ToClause.java
** Abstract : represents an incrementing or decrementing loop construct
**
** Copyright (c) 2013-2025, Golden Code Development Corporation.
**
** -#- -I- --Date-- --JPRM-- --------------------------Description---------------------------
** 001 GES 20080526 @38527 Created initial version which represents an incrementing or
** decrementing loop construct.
** 002 GES 20080702 @39064 Added constructors.
** 003 GES 20080821 @39521 Fix for a boundary case where the direction of the clause was being
** improperly determined.
** 004 OM 20130420 @39521 Added int64 and datetime/tz support. Cosmetic changes.
** 005 EVL 20211025 Fixed the issue when loop direction can not be detected from start to end options.
** This is the case when we moving from N to N. Must be excluded from the fast exit.
** 006 ICP 20250123 Used integer.of and int64.of to leverage caches instances.
*/
/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program 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 Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
**
** Additional terms under GNU Affero GPL version 3 section 7:
**
** Under Section 7 of the GNU Affero GPL version 3, the following additional
** terms apply to the works covered under the License. These additional terms
** are non-permissive additional terms allowed under Section 7 of the GNU
** Affero GPL version 3 and may not be removed by you.
**
** 0. Attribution Requirement.
**
** You must preserve all legal notices or author attributions in the covered
** work or Appropriate Legal Notices displayed by works containing the covered
** work. You may not remove from the covered work any author or developer
** credit already included within the covered work.
**
** 1. No License To Use Trademarks.
**
** This license does not grant any license or rights to use the trademarks
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
** of Golden Code Development Corporation. You are not authorized to use the
** name Golden Code, FWD, or the names of any author or contributor, for
** publicity purposes without written authorization.
**
** 2. No Misrepresentation of Affiliation.
**
** You may not represent yourself as Golden Code Development Corporation or FWD.
**
** You may not represent yourself for publicity purposes as associated with
** Golden Code Development Corporation, FWD, or any author or contributor to
** the covered work, without written authorization.
**
** 3. No Misrepresentation of Source or Origin.
**
** You may not represent the covered work as solely your work. All modified
** versions of the covered work must be marked in a reasonable way to make it
** clear that the modified work is not originating from Golden Code Development
** Corporation or FWD. All modified versions must contain the notices of
** attribution required in this license.
*/
package com.goldencode.p2j.util;
/**
* Represents an incrementing or decrementing loop construct that can be
* passed to the block manager allowing a loop to be implemented on a
* delegated basis.
*/
public class ToClause
{
/** A cached decimal zero. */
private static final decimal DEC_ZERO = new decimal(0);
/** A cached integer zero. */
private static final integer INT_ZERO = new integer(0);
/** A cached integer one. */
private static final integer INT_ONE = new integer(1);
/** A cached decimal <code>.5</code>. */
private static final decimal HALF = new decimal(".5");
/** A cached decimal <code>-.5</code>. */
private static final decimal NEG_HALF = new decimal("-.5");
/** The value being incremented or decremented. */
private Accessor var = null;
/** Termination condition for the loop. */
private Resolvable term = null;
/** Original initial value for the loop control variable. */
private BaseDataType original = null;
/** Increment or decrement factor. */
private NumberType factor = null;
/** <code>true</code> if the loop control variable is numeric. */
private boolean num = true;
/** <code>true</code> if the initial value is less than the term value. */
private boolean up = true;
/** <code>true</code> if the initial value is more than the term value. */
private boolean down = false;
/** <code>true</code> if the raw factor was negative. */
private boolean neg = false;
/** <code>true</code> until the loop increment and test has been called. */
private boolean first = true;
/**
* Core constructor that handles the real work of creating a new instance.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, Resolvable term, BaseDataType factor)
{
this.var = var;
this.term = term;
boolean isNum = factor instanceof NumberType;
if (factor == null || factor.isUnknown() || !isNum)
{
this.factor = new integer(1);
}
else
{
this.factor = (NumberType) factor;
}
// test for whether this is a number or a date
BaseDataType val = var.get();
num = (val instanceof NumberType);
// this must be calculated off the "raw" factor since it may be
// modified below, yet we need to remember if the original value
// was negative
neg = CompareOps.lessThan(factor, DEC_ZERO);
// cache off the unmodified initial value
original = init;
// there is a "quirk" for specific negative decimal factors when the
// base number is an integer (warning: both the initial value and the
// factor may change during this call)
if (init instanceof NumberType)
init = factorQuirk((NumberType) init);
// set the initial value
var.set(init);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, Resolvable term, long factor)
{
this(var, init, term, new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, Resolvable term, double factor)
{
this(var, init, term, new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, Resolvable term)
{
this(var, init, term, new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, Resolvable term, BaseDataType factor)
{
this(var, new int64(init), term, factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, Resolvable term, long factor)
{
this(var, new int64(init), term, new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, Resolvable term, double factor)
{
this(var, new int64(init), term, new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, long init, Resolvable term)
{
this(var, new int64(init), term, new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, Resolvable term, BaseDataType factor)
{
this(var, new decimal(init), term, factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, Resolvable term, long factor)
{
this(var, new decimal(init), term, new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, Resolvable term, double factor)
{
this(var, new decimal(init), term, new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, double init, Resolvable term)
{
this(var, new decimal(init), term, new integer(1));
}
/**
* Core constructor that handles the real work of creating a new instance.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, BaseDataType term, BaseDataType factor)
{
this(var, init, genExpr(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, BaseDataType term, long factor)
{
this(var, init, genExpr(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, BaseDataType term, double factor)
{
this(var, init, genExpr(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, BaseDataType term)
{
this(var, init, genExpr(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, BaseDataType term, BaseDataType factor)
{
this(var, new int64(init), genExpr(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, BaseDataType term, long factor)
{
this(var, new int64(init), genExpr(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, BaseDataType term, double factor)
{
this(var, new int64(init), genExpr(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, long init, BaseDataType term)
{
this(var, new int64(init), genExpr(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, BaseDataType term, BaseDataType factor)
{
this(var, new decimal(init), genExpr(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, BaseDataType term, long factor)
{
this(var, new decimal(init), genExpr(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, BaseDataType term, double factor)
{
this(var, new decimal(init), genExpr(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, double init, BaseDataType term)
{
this(var, new decimal(init), genExpr(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, long term, BaseDataType factor)
{
this(var, init, new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, long term, long factor)
{
this(var, init, new Int64Expression(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, long term, double factor)
{
this(var, init, new Int64Expression(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, long term)
{
this(var, init, new Int64Expression(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, long term, BaseDataType factor)
{
this(var, new int64(init), new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, long term, long factor)
{
this(var, new int64(init), new Int64Expression(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, long term, double factor)
{
this(var, new int64(init), new Int64Expression(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, long init, long term)
{
this(var, new int64(init), new Int64Expression(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, long term, BaseDataType factor)
{
this(var, new decimal(init), new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, long term, long factor)
{
this(var, new decimal(init), new Int64Expression(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, long term, double factor)
{
this(var, new decimal(init), new Int64Expression(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, double init, long term)
{
this(var, new decimal(init), new Int64Expression(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, double term, BaseDataType factor)
{
this(var, init, new DecimalExpression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, double term, long factor)
{
this(var, init, new DecimalExpression(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, double term, double factor)
{
this(var, init, new DecimalExpression(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, BaseDataType init, double term)
{
this(var, init, new DecimalExpression(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, double term, BaseDataType factor)
{
this(var, new int64(init), new DecimalExpression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, double term, long factor)
{
this(var,
new int64(init),
new DecimalExpression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, long init, double term, double factor)
{
this(var,
new int64(init),
new DecimalExpression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, long init, double term)
{
this(var,
new int64(init),
new DecimalExpression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, double term, BaseDataType factor)
{
this(var, new decimal(init), new DecimalExpression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, double term, long factor)
{
this(var,
new decimal(init),
new DecimalExpression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(Accessor var, double init, double term, double factor)
{
this(var,
new decimal(init),
new DecimalExpression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(Accessor var, double init, double term)
{
this(var,
new decimal(init),
new DecimalExpression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, Resolvable term, BaseDataType factor)
{
this(new AccessorWrapper(var), init, term, factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, Resolvable term, long factor)
{
this(new AccessorWrapper(var), init, term, new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, Resolvable term, double factor)
{
this(new AccessorWrapper(var), init, term, new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, Resolvable term)
{
this(new AccessorWrapper(var), init, term, new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, Resolvable term, BaseDataType factor)
{
this(new AccessorWrapper(var), new int64(init), term, factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, Resolvable term, long factor)
{
this(new AccessorWrapper(var),
new int64(init),
term,
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, Resolvable term, double factor)
{
this(new AccessorWrapper(var),
new int64(init),
term,
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, long init, Resolvable term)
{
this(new AccessorWrapper(var), int64.of(init), term, integer.of(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, Resolvable term, BaseDataType factor)
{
this(new AccessorWrapper(var), new decimal(init), term, factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, Resolvable term, long factor)
{
this(new AccessorWrapper(var),
new decimal(init),
term,
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, Resolvable term, double factor)
{
this(new AccessorWrapper(var),
new decimal(init),
term,
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, double init, Resolvable term)
{
this(new AccessorWrapper(var),
new decimal(init),
term,
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, BaseDataType term, BaseDataType factor)
{
this(new AccessorWrapper(var), init, genExpr(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, BaseDataType term, long factor)
{
this(new AccessorWrapper(var),
init,
genExpr(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, BaseDataType term, double factor)
{
this(new AccessorWrapper(var),
init,
genExpr(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, BaseDataType term)
{
this(new AccessorWrapper(var), init, genExpr(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, BaseDataType term, BaseDataType factor)
{
this(new AccessorWrapper(var),
new int64(init),
genExpr(term),
factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, BaseDataType term, long factor)
{
this(new AccessorWrapper(var),
new int64(init),
genExpr(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, BaseDataType term, double factor)
{
this(new AccessorWrapper(var),
new int64(init),
genExpr(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, long init, BaseDataType term)
{
this(new AccessorWrapper(var),
int64.of(init),
genExpr(term),
integer.of(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, BaseDataType term, BaseDataType factor)
{
this(new AccessorWrapper(var), new decimal(init), genExpr(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, BaseDataType term, long factor)
{
this(new AccessorWrapper(var),
new decimal(init),
genExpr(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, BaseDataType term, double factor)
{
this(new AccessorWrapper(var),
new decimal(init),
genExpr(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be evaluated each time the
* loop body will be executed. This newly evaluated value (which
* may change on each pass through the loop) will be compared
* to the loop variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, double init, BaseDataType term)
{
this(new AccessorWrapper(var),
new decimal(init),
genExpr(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, long term, BaseDataType factor)
{
this(new AccessorWrapper(var), init, new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, long term, long factor)
{
this(new AccessorWrapper(var), init, new Int64Expression(term), new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, long term, double factor)
{
this(new AccessorWrapper(var), init, new Int64Expression(term), new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, long term)
{
this(new AccessorWrapper(var), init, new Int64Expression(term), new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, long term, BaseDataType factor)
{
this(new AccessorWrapper(var), new int64(init), new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, long term, long factor)
{
this(new AccessorWrapper(var),
new int64(init),
new Int64Expression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, long term, double factor)
{
this(new AccessorWrapper(var),
new int64(init),
new Int64Expression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, long init, long term)
{
this(new AccessorWrapper(var),
new int64(init),
new Int64Expression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, long term, BaseDataType factor)
{
this(new AccessorWrapper(var), new decimal(init), new Int64Expression(term), factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, long term, long factor)
{
this(new AccessorWrapper(var),
new decimal(init),
new Int64Expression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, long term, double factor)
{
this(new AccessorWrapper(var),
new decimal(init),
new Int64Expression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, double init, long term)
{
this(new AccessorWrapper(var),
new decimal(init),
new Int64Expression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, double term, BaseDataType factor)
{
this(new AccessorWrapper(var),
init,
new DecimalExpression(term),
factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, double term, long factor)
{
this(new AccessorWrapper(var),
init,
new DecimalExpression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, double term, double factor)
{
this(new AccessorWrapper(var),
init,
new DecimalExpression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, BaseDataType init, double term)
{
this(new AccessorWrapper(var),
init,
new DecimalExpression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, double term, BaseDataType factor)
{
this(new AccessorWrapper(var),
new int64(init),
new DecimalExpression(term),
factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, double term, long factor)
{
this(new AccessorWrapper(var),
new int64(init),
new DecimalExpression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, long init, double term, double factor)
{
this(new AccessorWrapper(var),
new int64(init),
new DecimalExpression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, long init, double term)
{
this(new AccessorWrapper(var),
new int64(init),
new DecimalExpression(term),
new integer(1));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, double term, BaseDataType factor)
{
this(new AccessorWrapper(var),
new decimal(init),
new DecimalExpression(term),
factor);
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, double term, long factor)
{
this(new AccessorWrapper(var),
new decimal(init),
new DecimalExpression(term),
new int64(factor));
}
/**
* Constructor.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
* @param factor
* The amount (and direction) of change for each time through
* the loop. A positive value will increment the loop control
* value and a negative value decrements the loop control value.
*/
public ToClause(BaseDataType var, double init, double term, double factor)
{
this(new AccessorWrapper(var),
new decimal(init),
new DecimalExpression(term),
new decimal(factor));
}
/**
* Constructor with a default factor of 1.
*
* @param var
* The variable or field whose value is used for loop control.
* This value will be incremented or decremented in each pass
* through the loop. The comparison of this value with the
* termination value will be used to exit the loop. The value
* may be of either date or numeric types.
* @param init
* The initial value which will be assigned to the loop control
* variable. The type of this value must be assignable to the
* type of the loop control variable.
* @param term
* The termination value which will be compared to the loop
* control variable to determine when the loop must exit.
* The type of this value must be comparable with the type of
* the loop control value.
*/
public ToClause(BaseDataType var, double init, double term)
{
this(new AccessorWrapper(var),
new decimal(init),
new DecimalExpression(term),
new integer(1));
}
/**
* Increment (or decrement if using a negative factor) the loop control
* variable and return the result of the test of whether the loop should
* continue or not.
* <p>
* This method's behavior depends on the "direction" of the to clause. If
* the initial value of the clause is less than the termination value, then
* the direction will be considered an "up" or incrementing direction. If
* the initial value is greater than the termination value, then the
* direction of the to clause will be considered to be a "down" or
* decrementing direction. This matters because the loop will immediately
* exit (this method will return <code>false</code>) if either of the
* following conditions occur:
* <p>
* <ol>
* <li> down direction and the original decrement factor is non-negative
* <li> up direction and the original increment factor is negative
* </ol>
* <p>
* If the direction based immediate exit does not occur, then for each
* call to this method, the factor (possibly modified during construction)
* will be added to the loop control value. This updated loop control
* value will be compared to the termination value based on the direction
* of the to clause. The following conditions cause the loop to exit (by
* returning <code>false</code> from this method):
* <p>
* <ol>
* <li> down direction and the updated loop control variable is greater
* than or equal to the termination value
* <li> up direction and the updated loop control variable is less than
* or equal to the termination value
* </ol>
*
* @return <code>true</code> if the loop body should execute again and
* <code>false</code> if the loop should exit.
*/
public boolean incrementAndTest()
{
BaseDataType end = null;
BaseDataType val = null;
// one time processing the first time through
if (first)
{
first = false;
// cache the termination condition so we only call this once the
// first time through
end = term.resolve();
// calculate the direction
up = CompareOps.lessThan(original, end);
down = CompareOps.greaterThan(original, end);
// quick exit (the loop never executes) if the direction doesn't
// match the "direction" of the factor
if ((up && neg) || (down && !neg))
{
return false;
}
}
else
{
// get the current loop control value
val = var.get();
// calculate the new loop control value
if (num)
{
NumberType number = (NumberType) val;
val = MathOps.plus(number, factor);
}
else if (val instanceof datetime) // datetime-tz also
{
datetime dd = (datetime) val;
val = datetime.plusMillis(dd, factor);
}
else if (val instanceof date)
{
date dd = (date) val;
val = date.plusDays(dd, factor);
}
// else some incorrect looping datatype, probably should throw an exception
// update the loop control var
var.set(val);
}
// resolve the loop control value (on the first time through this will
// not yet have been obtained)
if (val == null)
val = var.get();
// resolve the termination value (which can change during each loop
// iteration
if (end == null)
end = term.resolve();
// test for loop continuation
return up ? CompareOps.lessThanOrEqual(val, end)
: down ? CompareOps.greaterThanOrEqual(val, end) : CompareOps.equals(val, end);
}
/**
* Generate a resolvable instance from a base data type.
*
* @param bdt
* The instance to wrap in a resolvable.
*
* @return The result.
*/
private static Resolvable genExpr(BaseDataType bdt)
{
if (bdt instanceof integer)
{
return new IntegerExpression((integer) bdt);
}
else if (bdt instanceof int64)
{
return new Int64Expression((int64) bdt);
}
else if (bdt instanceof decimal)
{
return new DecimalExpression((decimal) bdt);
}
else if (bdt instanceof datetimetz)
{
return new DatetimeTzExpression((datetimetz) bdt);
}
else if (bdt instanceof datetime)
{
return new DatetimeExpression((datetime) bdt);
}
else if (bdt instanceof date)
{
return new DateExpression((date) bdt);
}
return null;
}
/**
* Modify the initial value and the factor in cases where the factor
* is a special decimal value AND the variable being incremented is an
* integer/int64. In such cases, the factor is recalculated and the initial
* value may be changed. This is a bug in Progress, but one that exists
* in all known versions.
* <p>
* The following rules apply:
* <p>
* <pre>
* Factor Initial Value Factor Initial Value
* (on input) (on input) (on output) (on output)
* ---------- ------------- ------------ -------------
* 3.5 (*) non-positive 4 (rounded) value - 1
* 3.5 (*) positive 4 (rounded) value + 1
* 2.5 non-positive 3 (rounded) value - 1
* 2.5 positive 3 (rounded) value + 1
* 1.5 non-positive 2 (rounded) value - 1
* 1.5 positive 2 (rounded) value + 1
* .5 non-positive 0 value - 1
* .5 positive 1 (rounded) value + 1
* -.5 negative -1 value - 1
* -.5 non-negative 0 (rounded) value + 1
* -1.5 negative -1 (rounded) value - 1
* -1.5 non-negative -1 (rounded) value + 1
* -2.5 (*) negative -2 (rounded) value - 1
* -2.5 (*) non-negative -2 (rounded) value + 1
*
* (*) All similar numbers on the .5 "boundary" will have this same
* behavior. So 3.5, 4.5, 5.5... will all have the same behavior.
* Likewise, -2.5, -3.5, -4.5... will all have the same behavior.
* In particular, the factor on output will be rounded to the nearest
* integer and the initial value will be increased or decreased by 1
* depending on the sign of the original initial value.
* </pre>
* <p>
* None of this makes any logical sense, it is just a buggy implementation
* of the 4GL. We match those bugs so that dependent code will work.
*
* @param init
* The original initial value which may be modified based on the
* rules above.
*
* @return The new initial value which may have been modified.
*/
private BaseDataType factorQuirk(NumberType init)
{
if (factor instanceof decimal && var.get() instanceof int64)
{
boolean adjust = false;
decimal val = (decimal) factor;
decimal ival = new decimal(val.longValue());
// is this exactly a .5 value (e.g. 2.5, 1.5, .5, -.5, -1.5, -2.5 and so on)?
if (CompareOps.equals(val, MathOps.minus(ival, HALF)))
{
boolean negInit = CompareOps.lessThan(init, INT_ZERO);
boolean nonPosInit = !CompareOps.greaterThan(init, INT_ZERO);
boolean isHalf = CompareOps.equals(val, HALF);
boolean isNegHalf = CompareOps.equals(val, NEG_HALF);
// QUIRK ALERT!
// modify the initial value
// a negative factor with an initial value that is negative OR
// a positive factor with an initial value that is non-positive
if ((neg && negInit) || (!neg && nonPosInit))
{
// reduce the initial value by 1
init = MathOps.minus(init, INT_ONE);
}
else
{
// increase the initial value by 1
init = MathOps.plus(init, INT_ONE);
}
// modify the factor (convert it to an int64 and possibly
// arbitrarily warp it based on a match to a special factor)
if (isHalf)
{
factor = nonPosInit ? new integer(0) : new integer(1);
}
else if (isNegHalf)
{
factor = negInit ? new integer(-1) : new integer(0);
}
else
{
// round to nearest int
factor = new int64(val);
}
}
}
return init;
}
}