|
/**
|
|
*
|
|
* OOAS Compiler (Deprecated)
|
|
*
|
|
* Copyright 2015, Institute for Software Technology, Graz University of
|
|
* Technology. Portions are copyright 2015 by the AIT Austrian Institute
|
|
* of Technology. All rights reserved.
|
|
*
|
|
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
|
*
|
|
* Please notice that this version of the OOAS compiler is considered de-
|
|
* precated. Only the Java version is maintained.
|
|
*
|
|
* Contributors:
|
|
* Willibald Krenn (TU Graz/AIT)
|
|
* Stefan Tiran (TU Graz/AIT)
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace TUG.Mogentes
|
|
{
|
|
|
|
public delegate Range<T> RangeConstructor<T>(T max, T min);
|
|
|
|
public abstract class AbstractRange
|
|
{
|
|
}
|
|
|
|
public class Range<T> : AbstractRange
|
|
{
|
|
protected RangeConstructor<T> m_constructor;
|
|
|
|
public T max;
|
|
public T min;
|
|
public T precision;
|
|
public T typemax;
|
|
public T typemin;
|
|
|
|
public Range<T> Create(T amax, T amin)
|
|
{
|
|
return m_constructor(amax, amin);
|
|
}
|
|
|
|
public Range(T amax, T amin, T aprecision, T atypemax, T atypemin, RangeConstructor<T> aconstr)
|
|
{
|
|
max = amax;
|
|
min = amin;
|
|
precision = aprecision;
|
|
typemax = atypemax;
|
|
typemin = atypemin;
|
|
m_constructor = aconstr;
|
|
}
|
|
|
|
}
|
|
|
|
public sealed class IntegerRange : Range<int>
|
|
{
|
|
public IntegerRange(int max, int min)
|
|
: base(max, min, 1, int.MaxValue, int.MinValue, (a, b) => new IntegerRange(a, b))
|
|
{ }
|
|
}
|
|
|
|
public sealed class DoubleRange : Range<double>
|
|
{
|
|
public DoubleRange(double max, double min)
|
|
: base(max, min, double.Epsilon, double.MaxValue, double.MinValue, (a, b) => new DoubleRange(a, b))
|
|
{ }
|
|
}
|
|
}
|