Skip to content

Commit

Permalink
runtime-compute: Remove generic forward references in some traits tha…
Browse files Browse the repository at this point in the history
…t made generated code hard to compile
  • Loading branch information
lawesson committed May 24, 2018
1 parent 3f14dba commit 2bb96b6
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 100 deletions.
Expand Up @@ -54,9 +54,9 @@ public interface ToBigDecimal<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToBigDecimal<T>>, HasNegate<ToBigDecimal<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasPlus<T>,
HasMinus<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasMinus<T>,
HasMultiply<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, UnaryOperator<BigDecimal>, ToBigDecimal<T>>, HasMap<T, UnaryOperator<BigDecimal>, ToBigDecimal<T>>,
HasMapToDouble<T, ToDoubleFunction<BigDecimal>>, HasMapToDouble<T, ToDoubleFunction<BigDecimal>>,
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToByte<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToByte<T>>, HasNegate<ToByte<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToShort<T>, ToInt<T>, ToLong<T>>, HasPlus<T>,
HasMinus<T, ToShort<T>, ToInt<T>, ToLong<T>>, HasMinus<T>,
HasMultiply<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, ByteUnaryOperator, ToByte<T>>, HasMap<T, ByteUnaryOperator, ToByte<T>>,
HasMapToDouble<T, ByteToDoubleFunction>, HasMapToDouble<T, ByteToDoubleFunction>,
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToDouble<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToDouble<T>>, HasNegate<ToDouble<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasPlus<T>,
HasMinus<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasMinus<T>,
HasMultiply<T, ToDouble<T>, ToDouble<T>, ToDouble<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, DoubleUnaryOperator, ToDouble<T>>, HasMap<T, DoubleUnaryOperator, ToDouble<T>>,
HasHash<T>, HasHash<T>,
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToFloat<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToFloat<T>>, HasNegate<ToFloat<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToFloat<T>, ToFloat<T>, ToDouble<T>>, HasPlus<T>,
HasMinus<T, ToFloat<T>, ToFloat<T>, ToDouble<T>>, HasMinus<T>,
HasMultiply<T, ToFloat<T>, ToFloat<T>, ToDouble<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, FloatUnaryOperator, ToFloat<T>>, HasMap<T, FloatUnaryOperator, ToFloat<T>>,
HasMapToDouble<T, FloatToDoubleFunction>, HasMapToDouble<T, FloatToDoubleFunction>,
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToInt<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToInt<T>>, HasNegate<ToInt<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasPlus<T>,
HasMinus<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasMinus<T>,
HasMultiply<T, ToLong<T>, ToLong<T>, ToLong<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, IntUnaryOperator, ToInt<T>>, HasMap<T, IntUnaryOperator, ToInt<T>>,
HasMapToDouble<T, IntToDoubleFunction>, HasMapToDouble<T, IntToDoubleFunction>,
Expand Down Expand Up @@ -231,23 +231,23 @@ default ToDouble<T> minus(ToDouble<T> other) {
} }


@Override @Override
default ToLong<T> multiply(byte other) { default ToInt<T> multiply(byte other) {
return Expressions.multiply(this.asLong(), other); return Expressions.multiply(this, other);
} }


@Override @Override
default ToLong<T> multiply(ToByte<T> other) { default ToInt<T> multiply(ToByte<T> other) {
return Expressions.multiply(this.asLong(), other.asLong()); return Expressions.multiply(this, other.asInt());
} }


@Override @Override
default ToLong<T> multiply(int other) { default ToInt<T> multiply(int other) {
return Expressions.multiply(this.asLong(), other); return Expressions.multiply(this, other);
} }


@Override @Override
default ToLong<T> multiply(ToInt<T> other) { default ToInt<T> multiply(ToInt<T> other) {
return Expressions.multiply(this.asLong(), other); return Expressions.multiply(this, other);
} }


@Override @Override
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToLong<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToLong<T>>, HasNegate<ToLong<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToLong<T>, ToLong<T>, ToLong<T>>, HasPlus<T>,
HasMinus<T, ToLong<T>, ToLong<T>, ToLong<T>>, HasMinus<T>,
HasMultiply<T, ToLong<T>, ToLong<T>, ToLong<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, LongUnaryOperator, ToLong<T>>, HasMap<T, LongUnaryOperator, ToLong<T>>,
HasMapToDouble<T, LongToDoubleFunction>, HasMapToDouble<T, LongToDoubleFunction>,
Expand Down
Expand Up @@ -53,9 +53,9 @@ public interface ToShort<T>
HasSqrt<ToDouble<T>>, HasSqrt<ToDouble<T>>,
HasNegate<ToShort<T>>, HasNegate<ToShort<T>>,
HasPow<T>, HasPow<T>,
HasPlus<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasPlus<T>,
HasMinus<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasMinus<T>,
HasMultiply<T, ToInt<T>, ToInt<T>, ToLong<T>>, HasMultiply<T>,
HasDivide<T>, HasDivide<T>,
HasMap<T, ShortUnaryOperator, ToShort<T>>, HasMap<T, ShortUnaryOperator, ToShort<T>>,
HasMapToDouble<T, ShortToDoubleFunction>, HasMapToDouble<T, ShortToDoubleFunction>,
Expand Down
Expand Up @@ -27,20 +27,10 @@
* between this value and something else. * between this value and something else.
* *
* @param <T> the input type * @param <T> the input type
* @param <MINUS_BYTE> the expression type one would get if subtracting a
* {@code byte} value from the result of the current
* expression
* @param <MINUS_INT> the expression type one would get if subtracting an
* {@code int} value from the result of the current
* expression
* @param <MINUS_LONG> the expression type one would get if subtracting a
* {@code long} value from the result of the current
* expression
*
* @author Emil Forslund * @author Emil Forslund
* @since 3.1.0 * @since 3.1.0
*/ */
public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> { public interface HasMinus<T> {


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -55,7 +45,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_BYTE minus(byte other); HasMinus<T> minus(byte other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -70,7 +60,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_BYTE minus(ToByte<T> other); HasMinus<T> minus(ToByte<T> other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -85,7 +75,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_INT minus(int other); HasMinus<T> minus(int other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -100,7 +90,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_INT minus(ToInt<T> other); HasMinus<T> minus(ToInt<T> other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -115,7 +105,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_LONG minus(long other); HasMinus<T> minus(long other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand All @@ -130,7 +120,7 @@ public interface HasMinus<T, MINUS_BYTE, MINUS_INT, MINUS_LONG> {
* @param other the other term used for the subtraction * @param other the other term used for the subtraction
* @return the new expression * @return the new expression
*/ */
MINUS_LONG minus(ToLong<T> other); HasMinus<T> minus(ToLong<T> other);


/** /**
* Creates and returns an expression that returns the difference of the * Creates and returns an expression that returns the difference of the
Expand Down
Expand Up @@ -27,20 +27,11 @@
* of this value and something else. * of this value and something else.
* *
* @param <T> the input type * @param <T> the input type
* @param <MULT_BYTE> the expression type one would get if multiplying a
* {@code byte} value with the result of the current
* expression
* @param <MULT_INT> the expression type one would get if multiplying an
* {@code int} value with the result of the current
* expression
* @param <MULT_LONG> the expression type one would get if multiplying a
* {@code long} value with the result of the current
* expression
* *
* @author Emil Forslund * @author Emil Forslund
* @since 3.1.0 * @since 3.1.0
*/ */
public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> { public interface HasMultiply<T> {


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -55,7 +46,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_BYTE multiply(byte other); HasMultiply<T> multiply(byte other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -70,7 +61,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_BYTE multiply(ToByte<T> other); HasMultiply<T> multiply(ToByte<T> other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -85,7 +76,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_INT multiply(int other); HasMultiply<T> multiply(int other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -100,7 +91,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_INT multiply(ToInt<T> other); HasMultiply<T> multiply(ToInt<T> other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -115,7 +106,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_LONG multiply(long other); HasMultiply<T> multiply(long other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand All @@ -130,7 +121,7 @@ public interface HasMultiply<T, MULT_BYTE, MULT_INT, MULT_LONG> {
* @param other the other factor used for the multiplication * @param other the other factor used for the multiplication
* @return the new expression * @return the new expression
*/ */
MULT_LONG multiply(ToLong<T> other); HasMultiply<T> multiply(ToLong<T> other);


/** /**
* Creates and returns an expression that returns the product of the result * Creates and returns an expression that returns the product of the result
Expand Down
Expand Up @@ -27,17 +27,10 @@
* value and something else. * value and something else.
* *
* @param <T> the input type * @param <T> the input type
* @param <PLUS_BYTE> the expression type one would get if adding a {@code byte}
* value to the result of the current expression
* @param <PLUS_INT> the expression type one would get if adding an {@code int}
* value to the result of the current expression
* @param <PLUS_LONG> the expression type one would get if adding a {@code long}
* value to the result of the current expression
*
* @author Emil Forslund * @author Emil Forslund
* @since 3.1.0 * @since 3.1.0
*/ */
public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> { public interface HasPlus<T> {


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -52,7 +45,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_BYTE plus(byte other); HasPlus<T> plus(byte other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -67,7 +60,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_BYTE plus(ToByte<T> other); HasPlus<T> plus(ToByte<T> other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -82,7 +75,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_INT plus(int other); HasPlus<T> plus(int other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -97,7 +90,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_INT plus(ToInt<T> other); HasPlus<T> plus(ToInt<T> other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -112,7 +105,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_LONG plus(long other); HasPlus<T> plus(long other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand All @@ -127,7 +120,7 @@ public interface HasPlus<T, PLUS_BYTE, PLUS_INT, PLUS_LONG> {
* @param other the other term used for the addition * @param other the other term used for the addition
* @return the new expression * @return the new expression
*/ */
PLUS_LONG plus(ToLong<T> other); HasPlus<T> plus(ToLong<T> other);


/** /**
* Creates and returns an expression that returns the sum of the result from * Creates and returns an expression that returns the sum of the result from
Expand Down

0 comments on commit 2bb96b6

Please sign in to comment.