-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up some of the static constructors with bounded wildcards
- Loading branch information
1 parent
b6b0c5b
commit 5be6176
Showing
7 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.deriv.expression; | ||
|
||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.function.Function; | ||
import java.util.stream.Stream; | ||
|
||
import static com.deriv.expression.Constant.constant; | ||
|
||
// Sigma.of(3, 4, i -> Sigma.of(1, 5, j -> addID())) | ||
|
||
public class Sigma implements Expression { | ||
private final int _beginRange; | ||
private final int _endRange; | ||
private final Function<Variable, ? extends Expression> _varMap; | ||
|
||
private Sigma(int beginRange, int endRange, Function<Variable, ? extends Expression> varMap) { | ||
this._beginRange = beginRange; | ||
this._endRange = endRange; | ||
this._varMap = varMap; | ||
} | ||
|
||
public static Expression of(int beginRange, int endRange, Function<Variable, ? extends Expression> varMap) { | ||
return new Sigma(beginRange, endRange, varMap); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public Optional<Expression> evaluate(Variable var, Expression input) { | ||
// return of(_beginRange, _endRange, _varMap.andThen(x -> x.evaluate(var, input))); | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<Expression> differentiate(Variable var) { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Set<Variable> getVariables() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toLaTex() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//package com.deriv.util; | ||
// | ||
//@FunctionalInterface | ||
//public interface IndexGenerator { | ||
// apply(); | ||
//} | ||
|
||
// Sigma.of(i -> Sigma.of(j -> addID(), 1, 5), 3, 4) | ||
// Sigma.of(3, 4, i -> Sigma.of(1, 5, j -> addID())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters