Ordered.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Behaviors;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import Hoot.Collections.*;
import Hoot.Collections.String;
import Smalltalk.Core.Subject;
import Smalltalk.Magnitudes.Scalar;
import Hoot.Collections.Interval;
public interface Ordered extends Comparable, Scalar
{
public static interface Metatype extends Scalar.Metatype
{
}
/**
* @return
*/
public Boolean equals(final Subject aBound);
/**
* @return
*/
public Boolean notMore(final Scalar upperBound);
/**
* @return
*/
public Boolean lessThan(final Scalar upperBound);
/**
* @return
*/
public Boolean moreThan(final Scalar lowerBound);
/**
* @return
*/
public Boolean notLess(final Scalar lowerBound);
/**
* @return
*/
@Override public default Boolean between_and(final Scalar lowerBound, final Scalar upperBound)
{
java.lang.String exitID = "Ordered>>between_and";
Frame f0 = new Frame(exitID);
return (Boolean)((Boolean)(lowerBound.notMore(this)).and(Predicate.with(f2 -> {
return (this.notMore(upperBound));
}, "")));
}
/**
* @return
*/
public default Boolean in(final Interval aRange)
{
java.lang.String exitID = "Ordered>>in";
Frame f0 = new Frame(exitID);
return (Boolean)aRange.includes(this);
}
/**
* @return
*/
public default Boolean inside_and(final Scalar lowerBound, final Scalar upperBound)
{
java.lang.String exitID = "Ordered>>inside_and";
Frame f0 = new Frame(exitID);
return (Boolean)((Boolean)(lowerBound.lessThan(this)).and(Predicate.with(f2 -> {
return (this.lessThan(upperBound));
}, "")));
}
/**
* @return
*/
public default Ordered max(final Scalar value)
{
java.lang.String exitID = "Ordered>>max";
Frame f0 = new Frame(exitID);
return f0.evaluate(() -> {
(this.moreThan(value)).ifTrue(Closure.with(f2 -> {
return (Ordered)f0.exit(exitID, this);
}, ""));
return (Ordered)f0.exit(exitID, ((Ordered)value));
});
}
/**
* @return
*/
public default Ordered min(final Scalar value)
{
java.lang.String exitID = "Ordered>>min";
Frame f0 = new Frame(exitID);
return f0.evaluate(() -> {
(this.lessThan(value)).ifTrue(Closure.with(f2 -> {
return (Ordered)f0.exit(exitID, this);
}, ""));
return (Ordered)f0.exit(exitID, ((Ordered)value));
});
}
}