repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java | DiscountCurveInterpolation.getZeroRates | public double[] getZeroRates(double[] maturities)
{
double[] values = new double[maturities.length];
for(int i=0; i<maturities.length; i++) {
values[i] = getZeroRate(maturities[i]);
}
return values;
} | java | public double[] getZeroRates(double[] maturities)
{
double[] values = new double[maturities.length];
for(int i=0; i<maturities.length; i++) {
values[i] = getZeroRate(maturities[i]);
}
return values;
} | [
"public",
"double",
"[",
"]",
"getZeroRates",
"(",
"double",
"[",
"]",
"maturities",
")",
"{",
"double",
"[",
"]",
"values",
"=",
"new",
"double",
"[",
"maturities",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"maturit... | Returns the zero rates for a given vector maturities.
@param maturities The given maturities.
@return The zero rates. | [
"Returns",
"the",
"zero",
"rates",
"for",
"a",
"given",
"vector",
"maturities",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java#L427-L436 | train |
finmath/finmath-lib | src/main/java/net/finmath/functions/LinearAlgebra.java | LinearAlgebra.invert | public static double[][] invert(double[][] matrix) {
if(isSolverUseApacheCommonsMath) {
// Use LU from common math
LUDecomposition lu = new LUDecomposition(new Array2DRowRealMatrix(matrix));
double[][] matrixInverse = lu.getSolver().getInverse().getData();
return matrixInverse;
}
else {
return or... | java | public static double[][] invert(double[][] matrix) {
if(isSolverUseApacheCommonsMath) {
// Use LU from common math
LUDecomposition lu = new LUDecomposition(new Array2DRowRealMatrix(matrix));
double[][] matrixInverse = lu.getSolver().getInverse().getData();
return matrixInverse;
}
else {
return or... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"invert",
"(",
"double",
"[",
"]",
"[",
"]",
"matrix",
")",
"{",
"if",
"(",
"isSolverUseApacheCommonsMath",
")",
"{",
"// Use LU from common math",
"LUDecomposition",
"lu",
"=",
"new",
"LUDecomposition",
"(",
... | Returns the inverse of a given matrix.
@param matrix A matrix given as double[n][n].
@return The inverse of the given matrix. | [
"Returns",
"the",
"inverse",
"of",
"a",
"given",
"matrix",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L267-L279 | train |
finmath/finmath-lib | src/main/java/net/finmath/functions/LinearAlgebra.java | LinearAlgebra.factorReductionUsingCommonsMath | public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) {
// Extract factors corresponding to the largest eigenvalues
double[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors);
// Renormalize rows
for (int row = 0; row < correlationMatrix... | java | public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) {
// Extract factors corresponding to the largest eigenvalues
double[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors);
// Renormalize rows
for (int row = 0; row < correlationMatrix... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"factorReductionUsingCommonsMath",
"(",
"double",
"[",
"]",
"[",
"]",
"correlationMatrix",
",",
"int",
"numberOfFactors",
")",
"{",
"// Extract factors corresponding to the largest eigenvalues",
"double",
"[",
"]",
"["... | Returns a correlation matrix which has rank < n and for which the first n factors agree with the factors of correlationMatrix.
@param correlationMatrix The given correlation matrix.
@param numberOfFactors The requested number of factors (Eigenvectors).
@return Factor reduced correlation matrix. | [
"Returns",
"a",
"correlation",
"matrix",
"which",
"has",
"rank",
"<",
";",
"n",
"and",
"for",
"which",
"the",
"first",
"n",
"factors",
"agree",
"with",
"the",
"factors",
"of",
"correlationMatrix",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L438-L466 | train |
finmath/finmath-lib | src/main/java/net/finmath/functions/LinearAlgebra.java | LinearAlgebra.pseudoInverse | public static double[][] pseudoInverse(double[][] matrix){
if(isSolverUseApacheCommonsMath) {
// Use LU from common math
SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix));
double[][] matrixInverse = svd.getSolver().getInverse().getData();
return matrixInver... | java | public static double[][] pseudoInverse(double[][] matrix){
if(isSolverUseApacheCommonsMath) {
// Use LU from common math
SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix));
double[][] matrixInverse = svd.getSolver().getInverse().getData();
return matrixInver... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"pseudoInverse",
"(",
"double",
"[",
"]",
"[",
"]",
"matrix",
")",
"{",
"if",
"(",
"isSolverUseApacheCommonsMath",
")",
"{",
"// Use LU from common math",
"SingularValueDecomposition",
"svd",
"=",
"new",
"Singula... | Pseudo-Inverse of a matrix calculated in the least square sense.
@param matrix The given matrix A.
@return pseudoInverse The pseudo-inverse matrix P, such that A*P*A = A and P*A*P = P | [
"Pseudo",
"-",
"Inverse",
"of",
"a",
"matrix",
"calculated",
"in",
"the",
"least",
"square",
"sense",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L524-L535 | train |
finmath/finmath-lib | src/main/java/net/finmath/functions/LinearAlgebra.java | LinearAlgebra.diag | public static double[][] diag(double[] vector){
// Note: According to the Java Language spec, an array is initialized with the default value, here 0.
double[][] diagonalMatrix = new double[vector.length][vector.length];
for(int index = 0; index < vector.length; index++) {
diagonalMatrix[index][index] = vecto... | java | public static double[][] diag(double[] vector){
// Note: According to the Java Language spec, an array is initialized with the default value, here 0.
double[][] diagonalMatrix = new double[vector.length][vector.length];
for(int index = 0; index < vector.length; index++) {
diagonalMatrix[index][index] = vecto... | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"diag",
"(",
"double",
"[",
"]",
"vector",
")",
"{",
"// Note: According to the Java Language spec, an array is initialized with the default value, here 0.",
"double",
"[",
"]",
"[",
"]",
"diagonalMatrix",
"=",
"new",
... | Generates a diagonal matrix with the input vector on its diagonal
@param vector The given matrix A.
@return diagonalMatrix The matrix with the vectors entries on its diagonal | [
"Generates",
"a",
"diagonal",
"matrix",
"with",
"the",
"input",
"vector",
"on",
"its",
"diagonal"
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L543-L553 | train |
finmath/finmath-lib | src/main/java/net/finmath/fouriermethod/calibration/CalibratedModel.java | CalibratedModel.formatTargetValuesForOptimizer | private double[] formatTargetValuesForOptimizer() {
//Put all values in an array for the optimizer.
int numberOfMaturities = surface.getMaturities().length;
double mats[] = surface.getMaturities();
ArrayList<Double> vals = new ArrayList<Double>();
for(int t = 0; t<numberOfMaturities; t++) {
double mat = ... | java | private double[] formatTargetValuesForOptimizer() {
//Put all values in an array for the optimizer.
int numberOfMaturities = surface.getMaturities().length;
double mats[] = surface.getMaturities();
ArrayList<Double> vals = new ArrayList<Double>();
for(int t = 0; t<numberOfMaturities; t++) {
double mat = ... | [
"private",
"double",
"[",
"]",
"formatTargetValuesForOptimizer",
"(",
")",
"{",
"//Put all values in an array for the optimizer.",
"int",
"numberOfMaturities",
"=",
"surface",
".",
"getMaturities",
"(",
")",
".",
"length",
";",
"double",
"mats",
"[",
"]",
"=",
"surf... | This is a service method that takes care of putting al the target values in a single array.
@return | [
"This",
"is",
"a",
"service",
"method",
"that",
"takes",
"care",
"of",
"putting",
"al",
"the",
"target",
"values",
"in",
"a",
"single",
"array",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/fouriermethod/calibration/CalibratedModel.java#L157-L177 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java | ForwardCurveInterpolation.createForwardCurveFromDiscountFactors | public static ForwardCurveInterpolation createForwardCurveFromDiscountFactors(String name, double[] times, RandomVariable[] givenDiscountFactors, double paymentOffset) {
ForwardCurveInterpolation forwardCurveInterpolation = new ForwardCurveInterpolation(name, paymentOffset, InterpolationEntityForward.FORWARD, null);
... | java | public static ForwardCurveInterpolation createForwardCurveFromDiscountFactors(String name, double[] times, RandomVariable[] givenDiscountFactors, double paymentOffset) {
ForwardCurveInterpolation forwardCurveInterpolation = new ForwardCurveInterpolation(name, paymentOffset, InterpolationEntityForward.FORWARD, null);
... | [
"public",
"static",
"ForwardCurveInterpolation",
"createForwardCurveFromDiscountFactors",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"RandomVariable",
"[",
"]",
"givenDiscountFactors",
",",
"double",
"paymentOffset",
")",
"{",
"ForwardCurveInterpolation... | Create a forward curve from given times and discount factors.
The forward curve will have times.length-1 fixing times from times[0] to times[times.length-2]
<code>
forward[timeIndex] = (givenDiscountFactors[timeIndex]/givenDiscountFactors[timeIndex+1]-1.0) / (times[timeIndex+1] - times[timeIndex]);
</code>
Note: If ti... | [
"Create",
"a",
"forward",
"curve",
"from",
"given",
"times",
"and",
"discount",
"factors",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L261-L282 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java | ForwardCurveInterpolation.createForwardCurveFromMonteCarloLiborModel | public static ForwardCurveInterpolation createForwardCurveFromMonteCarloLiborModel(String name, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{
int timeIndex = model.getTimeIndex(startTime);
// Get all Libors at timeIndex which are not yet fixed (others null) and times for... | java | public static ForwardCurveInterpolation createForwardCurveFromMonteCarloLiborModel(String name, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{
int timeIndex = model.getTimeIndex(startTime);
// Get all Libors at timeIndex which are not yet fixed (others null) and times for... | [
"public",
"static",
"ForwardCurveInterpolation",
"createForwardCurveFromMonteCarloLiborModel",
"(",
"String",
"name",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
",",
"double",
"startTime",
")",
"throws",
"CalculationException",
"{",
"int",
"timeIndex",
"=",
"model",... | Create a forward curve from forwards given by a LIBORMonteCarloModel.
@param name name of the forward curve.
@param model Monte Carlo model providing the forwards.
@param startTime time at which the curve starts, i.e. zero time for the curve
@return a forward curve from forwards given by a LIBORMonteCarloMode... | [
"Create",
"a",
"forward",
"curve",
"from",
"forwards",
"given",
"by",
"a",
"LIBORMonteCarloModel",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L334-L356 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java | ForwardCurveInterpolation.addForward | private void addForward(AnalyticModel model, double fixingTime, RandomVariable forward, boolean isParameter) {
double interpolationEntitiyTime;
RandomVariable interpolationEntityForwardValue;
switch(interpolationEntityForward) {
case FORWARD:
default:
interpolationEntitiyTime = fixingTime;
interpolation... | java | private void addForward(AnalyticModel model, double fixingTime, RandomVariable forward, boolean isParameter) {
double interpolationEntitiyTime;
RandomVariable interpolationEntityForwardValue;
switch(interpolationEntityForward) {
case FORWARD:
default:
interpolationEntitiyTime = fixingTime;
interpolation... | [
"private",
"void",
"addForward",
"(",
"AnalyticModel",
"model",
",",
"double",
"fixingTime",
",",
"RandomVariable",
"forward",
",",
"boolean",
"isParameter",
")",
"{",
"double",
"interpolationEntitiyTime",
";",
"RandomVariable",
"interpolationEntityForwardValue",
";",
"... | Add a forward to this curve.
@param model An analytic model providing a context. The discount curve (if needed) is obtained from this model.
@param fixingTime The given fixing time.
@param forward The given forward.
@param isParameter If true, then this point is server via {@link #getParameter()} and changed via {@lin... | [
"Add",
"a",
"forward",
"to",
"this",
"curve",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L416-L445 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/process/LinearInterpolatedTimeDiscreteProcess.java | LinearInterpolatedTimeDiscreteProcess.add | public LinearInterpolatedTimeDiscreteProcess add(LinearInterpolatedTimeDiscreteProcess process) throws CalculationException {
Map<Double, RandomVariable> sum = new HashMap<>();
for(double time: timeDiscretization) {
sum.put(time, realizations.get(time).add(process.getProcessValue(time, 0)));
}
return new L... | java | public LinearInterpolatedTimeDiscreteProcess add(LinearInterpolatedTimeDiscreteProcess process) throws CalculationException {
Map<Double, RandomVariable> sum = new HashMap<>();
for(double time: timeDiscretization) {
sum.put(time, realizations.get(time).add(process.getProcessValue(time, 0)));
}
return new L... | [
"public",
"LinearInterpolatedTimeDiscreteProcess",
"add",
"(",
"LinearInterpolatedTimeDiscreteProcess",
"process",
")",
"throws",
"CalculationException",
"{",
"Map",
"<",
"Double",
",",
"RandomVariable",
">",
"sum",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
... | Create a new linear interpolated time discrete process by
using the time discretization of this process and the sum of this process and the given one
as its values.
@param process A given process.
@return A new process representing the of this and the given process.
@throws CalculationException Thrown if the given pro... | [
"Create",
"a",
"new",
"linear",
"interpolated",
"time",
"discrete",
"process",
"by",
"using",
"the",
"time",
"discretization",
"of",
"this",
"process",
"and",
"the",
"sum",
"of",
"this",
"process",
"and",
"the",
"given",
"one",
"as",
"its",
"values",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/process/LinearInterpolatedTimeDiscreteProcess.java#L70-L78 | train |
finmath/finmath-lib | src/main/java/net/finmath/optimizer/StochasticPathwiseLevenbergMarquardt.java | StochasticPathwiseLevenbergMarquardt.getCloneWithModifiedTargetValues | public StochasticPathwiseLevenbergMarquardt getCloneWithModifiedTargetValues(List<RandomVariable> newTargetVaues, List<RandomVariable> newWeights, boolean isUseBestParametersAsInitialParameters) throws CloneNotSupportedException {
StochasticPathwiseLevenbergMarquardt clonedOptimizer = clone();
clonedOptimizer.targe... | java | public StochasticPathwiseLevenbergMarquardt getCloneWithModifiedTargetValues(List<RandomVariable> newTargetVaues, List<RandomVariable> newWeights, boolean isUseBestParametersAsInitialParameters) throws CloneNotSupportedException {
StochasticPathwiseLevenbergMarquardt clonedOptimizer = clone();
clonedOptimizer.targe... | [
"public",
"StochasticPathwiseLevenbergMarquardt",
"getCloneWithModifiedTargetValues",
"(",
"List",
"<",
"RandomVariable",
">",
"newTargetVaues",
",",
"List",
"<",
"RandomVariable",
">",
"newWeights",
",",
"boolean",
"isUseBestParametersAsInitialParameters",
")",
"throws",
"Cl... | Create a clone of this LevenbergMarquardt optimizer with a new vector for the
target values and weights.
The clone will use the same objective function than this implementation,
i.e., the implementation of {@link #setValues(RandomVariable[], RandomVariable[])} and
that of {@link #setDerivatives(RandomVariable[], Rando... | [
"Create",
"a",
"clone",
"of",
"this",
"LevenbergMarquardt",
"optimizer",
"with",
"a",
"new",
"vector",
"for",
"the",
"target",
"values",
"and",
"weights",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/optimizer/StochasticPathwiseLevenbergMarquardt.java#L718-L728 | train |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/products/components/Option.java | Option.getBasisFunctions | public RandomVariableInterface[] getBasisFunctions(double exerciseDate, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
ArrayList<RandomVariableInterface> basisFunctions = new ArrayList<RandomVariableInterface>();
RandomVariableInterface basisFunction;
// Constant
basisFunction =... | java | public RandomVariableInterface[] getBasisFunctions(double exerciseDate, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
ArrayList<RandomVariableInterface> basisFunctions = new ArrayList<RandomVariableInterface>();
RandomVariableInterface basisFunction;
// Constant
basisFunction =... | [
"public",
"RandomVariableInterface",
"[",
"]",
"getBasisFunctions",
"(",
"double",
"exerciseDate",
",",
"LIBORModelMonteCarloSimulationInterface",
"model",
")",
"throws",
"CalculationException",
"{",
"ArrayList",
"<",
"RandomVariableInterface",
">",
"basisFunctions",
"=",
"... | Return the regression basis functions.
@param exerciseDate The date w.r.t. which the basis functions should be measurable.
@param model The model.
@return Array of random variables.
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</... | [
"Return",
"the",
"regression",
"basis",
"functions",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/components/Option.java#L267-L339 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/calibration/CalibratedCurves.java | CalibratedCurves.createDiscountCurve | private DiscountCurve createDiscountCurve(String discountCurveName) {
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
if(discountCurve == null) {
discountCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors(discountCurveName, new double[] { 0.0 }, new double[] { 1.0 ... | java | private DiscountCurve createDiscountCurve(String discountCurveName) {
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
if(discountCurve == null) {
discountCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors(discountCurveName, new double[] { 0.0 }, new double[] { 1.0 ... | [
"private",
"DiscountCurve",
"createDiscountCurve",
"(",
"String",
"discountCurveName",
")",
"{",
"DiscountCurve",
"discountCurve",
"=",
"model",
".",
"getDiscountCurve",
"(",
"discountCurveName",
")",
";",
"if",
"(",
"discountCurve",
"==",
"null",
")",
"{",
"discoun... | Get a discount curve from the model, if not existing create a discount curve.
@param discountCurveName The name of the discount curve to create.
@return The discount factor curve associated with the given name. | [
"Get",
"a",
"discount",
"curve",
"from",
"the",
"model",
"if",
"not",
"existing",
"create",
"a",
"discount",
"curve",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/calibration/CalibratedCurves.java#L760-L768 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/locallinearregression/Partition.java | Partition.d | public double d(double x){
int intervalNumber =getIntervalNumber(x);
if (intervalNumber==0 || intervalNumber==points.length) {
return x;
}
return getIntervalReferencePoint(intervalNumber-1);
} | java | public double d(double x){
int intervalNumber =getIntervalNumber(x);
if (intervalNumber==0 || intervalNumber==points.length) {
return x;
}
return getIntervalReferencePoint(intervalNumber-1);
} | [
"public",
"double",
"d",
"(",
"double",
"x",
")",
"{",
"int",
"intervalNumber",
"=",
"getIntervalNumber",
"(",
"x",
")",
";",
"if",
"(",
"intervalNumber",
"==",
"0",
"||",
"intervalNumber",
"==",
"points",
".",
"length",
")",
"{",
"return",
"x",
";",
"... | If a given x is into an interval of the partition, this method returns the reference point of the corresponding interval.
If the given x is not contained in any interval of the partition, this method returns x.
@param x The point of interest.
@return The discretized value. | [
"If",
"a",
"given",
"x",
"is",
"into",
"an",
"interval",
"of",
"the",
"partition",
"this",
"method",
"returns",
"the",
"reference",
"point",
"of",
"the",
"corresponding",
"interval",
".",
"If",
"the",
"given",
"x",
"is",
"not",
"contained",
"in",
"any",
... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/locallinearregression/Partition.java#L84-L90 | train |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/products/Swaption.java | Swaption.getValue | public double getValue(ForwardCurveInterface forwardCurve, double swaprateVolatility) {
double swaprate = swaprates[0];
for (double swaprate1 : swaprates) {
if (swaprate1 != swaprate) {
throw new RuntimeException("Uneven swaprates not allows for analytical pricing.");
}
}
double[] swapTenor = new dou... | java | public double getValue(ForwardCurveInterface forwardCurve, double swaprateVolatility) {
double swaprate = swaprates[0];
for (double swaprate1 : swaprates) {
if (swaprate1 != swaprate) {
throw new RuntimeException("Uneven swaprates not allows for analytical pricing.");
}
}
double[] swapTenor = new dou... | [
"public",
"double",
"getValue",
"(",
"ForwardCurveInterface",
"forwardCurve",
",",
"double",
"swaprateVolatility",
")",
"{",
"double",
"swaprate",
"=",
"swaprates",
"[",
"0",
"]",
";",
"for",
"(",
"double",
"swaprate1",
":",
"swaprates",
")",
"{",
"if",
"(",
... | This method returns the value of the product using a Black-Scholes model for the swap rate
The model is determined by a discount factor curve and a swap rate volatility.
@param forwardCurve The forward curve on which to value the swap.
@param swaprateVolatility The Black volatility.
@return Value of this product | [
"This",
"method",
"returns",
"the",
"value",
"of",
"the",
"product",
"using",
"a",
"Black",
"-",
"Scholes",
"model",
"for",
"the",
"swap",
"rate",
"The",
"model",
"is",
"determined",
"by",
"a",
"discount",
"factor",
"curve",
"and",
"a",
"swap",
"rate",
"... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/Swaption.java#L189-L205 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/products/ForwardRateAgreement.java | ForwardRateAgreement.getRate | public double getRate(AnalyticModel model) {
if(model==null) {
throw new IllegalArgumentException("model==null");
}
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve==null) {
throw new IllegalArgumentException("No forward curve of name '" + forwardCurveName + "' found i... | java | public double getRate(AnalyticModel model) {
if(model==null) {
throw new IllegalArgumentException("model==null");
}
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve==null) {
throw new IllegalArgumentException("No forward curve of name '" + forwardCurveName + "' found i... | [
"public",
"double",
"getRate",
"(",
"AnalyticModel",
"model",
")",
"{",
"if",
"(",
"model",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"model==null\"",
")",
";",
"}",
"ForwardCurve",
"forwardCurve",
"=",
"model",
".",
"getForwar... | Return the par FRA rate for a given curve.
@param model A given model.
@return The par FRA rate. | [
"Return",
"the",
"par",
"FRA",
"rate",
"for",
"a",
"given",
"curve",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/products/ForwardRateAgreement.java#L103-L115 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/models/covariance/AbstractLIBORCovarianceModelParametric.java | AbstractLIBORCovarianceModelParametric.getParameter | public RandomVariable[] getParameter() {
double[] parameterAsDouble = this.getParameterAsDouble();
RandomVariable[] parameter = new RandomVariable[parameterAsDouble.length];
for(int i=0; i<parameter.length; i++) {
parameter[i] = new Scalar(parameterAsDouble[i]);
}
return parameter;
} | java | public RandomVariable[] getParameter() {
double[] parameterAsDouble = this.getParameterAsDouble();
RandomVariable[] parameter = new RandomVariable[parameterAsDouble.length];
for(int i=0; i<parameter.length; i++) {
parameter[i] = new Scalar(parameterAsDouble[i]);
}
return parameter;
} | [
"public",
"RandomVariable",
"[",
"]",
"getParameter",
"(",
")",
"{",
"double",
"[",
"]",
"parameterAsDouble",
"=",
"this",
".",
"getParameterAsDouble",
"(",
")",
";",
"RandomVariable",
"[",
"]",
"parameter",
"=",
"new",
"RandomVariable",
"[",
"parameterAsDouble"... | Get the parameters of determining this parametric
covariance model. The parameters are usually free parameters
which may be used in calibration.
@return Parameter vector. | [
"Get",
"the",
"parameters",
"of",
"determining",
"this",
"parametric",
"covariance",
"model",
".",
"The",
"parameters",
"are",
"usually",
"free",
"parameters",
"which",
"may",
"be",
"used",
"in",
"calibration",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/models/covariance/AbstractLIBORCovarianceModelParametric.java#L89-L96 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java | DiscountCurveInterpolation.createDiscountCurveFromMonteCarloLiborModel | public static DiscountCurveInterface createDiscountCurveFromMonteCarloLiborModel(String forwardCurveName, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{
// Check if the LMM uses a discount curve which is created from a forward curve
if(model.getModel().getDiscountCurve()=... | java | public static DiscountCurveInterface createDiscountCurveFromMonteCarloLiborModel(String forwardCurveName, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{
// Check if the LMM uses a discount curve which is created from a forward curve
if(model.getModel().getDiscountCurve()=... | [
"public",
"static",
"DiscountCurveInterface",
"createDiscountCurveFromMonteCarloLiborModel",
"(",
"String",
"forwardCurveName",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
",",
"double",
"startTime",
")",
"throws",
"CalculationException",
"{",
"// Check if the LMM uses a d... | Create a discount curve from forwards given by a LIBORMonteCarloModel. If the model uses multiple curves, return its discount curve.
@param forwardCurveName name of the forward curve.
@param model Monte Carlo model providing the forwards.
@param startTime time at which the curve starts... | [
"Create",
"a",
"discount",
"curve",
"from",
"forwards",
"given",
"by",
"a",
"LIBORMonteCarloModel",
".",
"If",
"the",
"model",
"uses",
"multiple",
"curves",
"return",
"its",
"discount",
"curve",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java#L401-L412 | train |
finmath/finmath-lib | src/main/java6/net/finmath/time/businessdaycalendar/BusinessdayCalendarExcludingTARGETHolidays.java | BusinessdayCalendarExcludingTARGETHolidays.isEasterSunday | public static boolean isEasterSunday(LocalDate date) {
int y = date.getYear();
int a = y % 19;
int b = y / 100;
int c = y % 100;
int d = b / 4;
int e = b % 4;
int f = (b + 8) / 25;
int g = (b - f + 1) / 3;
int h = (19 * a + b - d - g + 15) % 30;
int i = c / 4;
int k = c % 4;
int l = (32 + 2 * e ... | java | public static boolean isEasterSunday(LocalDate date) {
int y = date.getYear();
int a = y % 19;
int b = y / 100;
int c = y % 100;
int d = b / 4;
int e = b % 4;
int f = (b + 8) / 25;
int g = (b - f + 1) / 3;
int h = (19 * a + b - d - g + 15) % 30;
int i = c / 4;
int k = c % 4;
int l = (32 + 2 * e ... | [
"public",
"static",
"boolean",
"isEasterSunday",
"(",
"LocalDate",
"date",
")",
"{",
"int",
"y",
"=",
"date",
".",
"getYear",
"(",
")",
";",
"int",
"a",
"=",
"y",
"%",
"19",
";",
"int",
"b",
"=",
"y",
"/",
"100",
";",
"int",
"c",
"=",
"y",
"%",... | Test a given date for being easter sunday.
The method uses the algorithms sometimes cited as Meeus,Jones, Butcher Gregorian algorithm.
Taken from http://en.wikipedia.org/wiki/Computus
@param date The date to check.
@return True, if date is easter sunday. | [
"Test",
"a",
"given",
"date",
"for",
"being",
"easter",
"sunday",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/time/businessdaycalendar/BusinessdayCalendarExcludingTARGETHolidays.java#L67-L88 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/FloatingpointDate.java | FloatingpointDate.getDateFromFloatingPointDate | public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) {
if(referenceDate == null) {
return null;
}
Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY));
return referenceDate.plus(duration);
} | java | public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) {
if(referenceDate == null) {
return null;
}
Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY));
return referenceDate.plus(duration);
} | [
"public",
"static",
"LocalDateTime",
"getDateFromFloatingPointDate",
"(",
"LocalDateTime",
"referenceDate",
",",
"double",
"floatingPointDate",
")",
"{",
"if",
"(",
"referenceDate",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Duration",
"duration",
"=",
"... | Convert a floating point date to a LocalDateTime.
Note: This method currently performs a rounding to the next second.
If referenceDate is null, the method returns null.
@param referenceDate The reference date associated with \( t=0 \).
@param floatingPointDate The value to the time offset \( t \).
@return The date r... | [
"Convert",
"a",
"floating",
"point",
"date",
"to",
"a",
"LocalDateTime",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L67-L74 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/FloatingpointDate.java | FloatingpointDate.getFloatingPointDateFromDate | public static double getFloatingPointDateFromDate(LocalDateTime referenceDate, LocalDateTime date) {
Duration duration = Duration.between(referenceDate, date);
return ((double)duration.getSeconds()) / SECONDS_PER_DAY;
} | java | public static double getFloatingPointDateFromDate(LocalDateTime referenceDate, LocalDateTime date) {
Duration duration = Duration.between(referenceDate, date);
return ((double)duration.getSeconds()) / SECONDS_PER_DAY;
} | [
"public",
"static",
"double",
"getFloatingPointDateFromDate",
"(",
"LocalDateTime",
"referenceDate",
",",
"LocalDateTime",
"date",
")",
"{",
"Duration",
"duration",
"=",
"Duration",
".",
"between",
"(",
"referenceDate",
",",
"date",
")",
";",
"return",
"(",
"(",
... | Convert a given date to a floating point date using a given reference date.
@param referenceDate The reference date associated with \( t=0 \).
@param date The given date to be associated with the return value \( T \).
@return The value T measuring the distance of reference date and date by ACT/365 with SECONDS_PER_DAY... | [
"Convert",
"a",
"given",
"date",
"to",
"a",
"floating",
"point",
"date",
"using",
"a",
"given",
"reference",
"date",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L83-L86 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/FloatingpointDate.java | FloatingpointDate.getDateFromFloatingPointDate | public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) {
if(referenceDate == null) {
return null;
}
return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0));
} | java | public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) {
if(referenceDate == null) {
return null;
}
return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0));
} | [
"public",
"static",
"LocalDate",
"getDateFromFloatingPointDate",
"(",
"LocalDate",
"referenceDate",
",",
"double",
"floatingPointDate",
")",
"{",
"if",
"(",
"referenceDate",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"referenceDate",
".",
"plusD... | Convert a floating point date to a LocalDate.
Note: This method currently performs a rounding to the next day.
In a future extension intra-day time offsets may be considered.
If referenceDate is null, the method returns null.
@param referenceDate The reference date associated with \( t=0 \).
@param floatingPointDate... | [
"Convert",
"a",
"floating",
"point",
"date",
"to",
"a",
"LocalDate",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L100-L105 | train |
finmath/finmath-lib | src/main/java6/net/finmath/functions/PoissonDistribution.java | PoissonDistribution.inverseCumulativeDistribution | public double inverseCumulativeDistribution(double x) {
double p = Math.exp(-lambda);
double dp = p;
int k = 0;
while(x > p) {
k++;
dp *= lambda / k;
p += dp;
}
return k;
} | java | public double inverseCumulativeDistribution(double x) {
double p = Math.exp(-lambda);
double dp = p;
int k = 0;
while(x > p) {
k++;
dp *= lambda / k;
p += dp;
}
return k;
} | [
"public",
"double",
"inverseCumulativeDistribution",
"(",
"double",
"x",
")",
"{",
"double",
"p",
"=",
"Math",
".",
"exp",
"(",
"-",
"lambda",
")",
";",
"double",
"dp",
"=",
"p",
";",
"int",
"k",
"=",
"0",
";",
"while",
"(",
"x",
">",
"p",
")",
"... | Return the inverse cumulative distribution function at x.
@param x Argument
@return Inverse cumulative distribution function at x. | [
"Return",
"the",
"inverse",
"cumulative",
"distribution",
"function",
"at",
"x",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/PoissonDistribution.java#L27-L37 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/CurveInterpolation.java | CurveInterpolation.addPoint | protected void addPoint(double time, RandomVariable value, boolean isParameter) {
synchronized (rationalFunctionInterpolationLazyInitLock) {
if(interpolationEntity == InterpolationEntity.LOG_OF_VALUE_PER_TIME && time == 0) {
boolean containsOne = false; int index=0;
for(int i = 0; i< value.size(); i++){if(... | java | protected void addPoint(double time, RandomVariable value, boolean isParameter) {
synchronized (rationalFunctionInterpolationLazyInitLock) {
if(interpolationEntity == InterpolationEntity.LOG_OF_VALUE_PER_TIME && time == 0) {
boolean containsOne = false; int index=0;
for(int i = 0; i< value.size(); i++){if(... | [
"protected",
"void",
"addPoint",
"(",
"double",
"time",
",",
"RandomVariable",
"value",
",",
"boolean",
"isParameter",
")",
"{",
"synchronized",
"(",
"rationalFunctionInterpolationLazyInitLock",
")",
"{",
"if",
"(",
"interpolationEntity",
"==",
"InterpolationEntity",
... | Add a point to this curveFromInterpolationPoints. The method will throw an exception if the point
is already part of the curveFromInterpolationPoints.
@param time The x<sub>i</sub> in <sub>i</sub> = f(x<sub>i</sub>).
@param value The y<sub>i</sub> in <sub>i</sub> = f(x<sub>i</sub>).
@param isParameter If true, then th... | [
"Add",
"a",
"point",
"to",
"this",
"curveFromInterpolationPoints",
".",
"The",
"method",
"will",
"throw",
"an",
"exception",
"if",
"the",
"point",
"is",
"already",
"part",
"of",
"the",
"curveFromInterpolationPoints",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/CurveInterpolation.java#L372-L413 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.getOffsetCodeFromSchedule | public static String getOffsetCodeFromSchedule(Schedule schedule) {
double doubleLength = 0;
for(int i = 0; i < schedule.getNumberOfPeriods(); i ++) {
doubleLength += schedule.getPeriodLength(i);
}
doubleLength /= schedule.getNumberOfPeriods();
doubleLength *= 12;
int periodLength = (int) Math... | java | public static String getOffsetCodeFromSchedule(Schedule schedule) {
double doubleLength = 0;
for(int i = 0; i < schedule.getNumberOfPeriods(); i ++) {
doubleLength += schedule.getPeriodLength(i);
}
doubleLength /= schedule.getNumberOfPeriods();
doubleLength *= 12;
int periodLength = (int) Math... | [
"public",
"static",
"String",
"getOffsetCodeFromSchedule",
"(",
"Schedule",
"schedule",
")",
"{",
"double",
"doubleLength",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"schedule",
".",
"getNumberOfPeriods",
"(",
")",
";",
"i",
"++",
"... | Determines the offset code of a forward contract from a schedule. Rounds the average period length to full months.
@param schedule The schedule.
@return The offset code as String | [
"Determines",
"the",
"offset",
"code",
"of",
"a",
"forward",
"contract",
"from",
"a",
"schedule",
".",
"Rounds",
"the",
"average",
"period",
"length",
"to",
"full",
"months",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L52-L66 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.getOffsetCodeFromCurveName | public static String getOffsetCodeFromCurveName(String curveName) {
if(curveName == null || curveName.length() == 0) {
return null;
}
String[] splits = curveName.split("(?<=\\D)(?=\\d)");
String offsetCode = splits[splits.length-1];
if(!Character.isDigit(offsetCode.charAt(0))) {
return null;
}... | java | public static String getOffsetCodeFromCurveName(String curveName) {
if(curveName == null || curveName.length() == 0) {
return null;
}
String[] splits = curveName.split("(?<=\\D)(?=\\d)");
String offsetCode = splits[splits.length-1];
if(!Character.isDigit(offsetCode.charAt(0))) {
return null;
}... | [
"public",
"static",
"String",
"getOffsetCodeFromCurveName",
"(",
"String",
"curveName",
")",
"{",
"if",
"(",
"curveName",
"==",
"null",
"||",
"curveName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"spli... | Determines the offset code of a forward contract from the name of a forward curve.
This method will extract a group of one or more digits together with the first letter behind them, if any.
If there are multiple groups of digits in the name, this method will extract the last.
If there is no number in the string, this m... | [
"Determines",
"the",
"offset",
"code",
"of",
"a",
"forward",
"contract",
"from",
"the",
"name",
"of",
"a",
"forward",
"curve",
".",
"This",
"method",
"will",
"extract",
"a",
"group",
"of",
"one",
"or",
"more",
"digits",
"together",
"with",
"the",
"first",
... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L77-L90 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.generateScheduleDescriptor | public ScheduleDescriptor generateScheduleDescriptor(LocalDate startDate, LocalDate endDate) {
return new ScheduleDescriptor(startDate, endDate, getFrequency(), getDaycountConvention(), getShortPeriodConvention(), getDateRollConvention(),
getBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), ... | java | public ScheduleDescriptor generateScheduleDescriptor(LocalDate startDate, LocalDate endDate) {
return new ScheduleDescriptor(startDate, endDate, getFrequency(), getDaycountConvention(), getShortPeriodConvention(), getDateRollConvention(),
getBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), ... | [
"public",
"ScheduleDescriptor",
"generateScheduleDescriptor",
"(",
"LocalDate",
"startDate",
",",
"LocalDate",
"endDate",
")",
"{",
"return",
"new",
"ScheduleDescriptor",
"(",
"startDate",
",",
"endDate",
",",
"getFrequency",
"(",
")",
",",
"getDaycountConvention",
"(... | Generate a schedule descriptor for the given start and end date.
@param startDate The start date.
@param endDate The end date.
@return The schedule descriptor | [
"Generate",
"a",
"schedule",
"descriptor",
"for",
"the",
"given",
"start",
"and",
"end",
"date",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L126-L129 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.generateSchedule | public Schedule generateSchedule(LocalDate referenceDate, LocalDate startDate, LocalDate endDate) {
return ScheduleGenerator.createScheduleFromConventions(referenceDate, startDate, endDate, getFrequency(), getDaycountConvention(),
getShortPeriodConvention(), getDateRollConvention(), getBusinessdayCalendar(), ge... | java | public Schedule generateSchedule(LocalDate referenceDate, LocalDate startDate, LocalDate endDate) {
return ScheduleGenerator.createScheduleFromConventions(referenceDate, startDate, endDate, getFrequency(), getDaycountConvention(),
getShortPeriodConvention(), getDateRollConvention(), getBusinessdayCalendar(), ge... | [
"public",
"Schedule",
"generateSchedule",
"(",
"LocalDate",
"referenceDate",
",",
"LocalDate",
"startDate",
",",
"LocalDate",
"endDate",
")",
"{",
"return",
"ScheduleGenerator",
".",
"createScheduleFromConventions",
"(",
"referenceDate",
",",
"startDate",
",",
"endDate"... | Generate a schedule for the given start and end date.
@param referenceDate The reference date (corresponds to \( t = 0 \).
@param startDate The start date.
@param endDate The end date.
@return The schedule | [
"Generate",
"a",
"schedule",
"for",
"the",
"given",
"start",
"and",
"end",
"date",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L139-L142 | train |
finmath/finmath-lib | src/main/java6/net/finmath/time/ScheduleGenerator.java | ScheduleGenerator.createScheduleFromConventions | @Deprecated
public static ScheduleInterface createScheduleFromConventions(
LocalDate referenceDate,
LocalDate startDate,
String frequency,
double maturity,
String daycountConvention,
String shortPeriodConvention
)
{
return createScheduleFromConventions(
referenceDate,
startDate,
fre... | java | @Deprecated
public static ScheduleInterface createScheduleFromConventions(
LocalDate referenceDate,
LocalDate startDate,
String frequency,
double maturity,
String daycountConvention,
String shortPeriodConvention
)
{
return createScheduleFromConventions(
referenceDate,
startDate,
fre... | [
"@",
"Deprecated",
"public",
"static",
"ScheduleInterface",
"createScheduleFromConventions",
"(",
"LocalDate",
"referenceDate",
",",
"LocalDate",
"startDate",
",",
"String",
"frequency",
",",
"double",
"maturity",
",",
"String",
"daycountConvention",
",",
"String",
"sho... | Generates a schedule based on some meta data. The schedule generation
considers short periods. Date rolling is ignored.
@param referenceDate The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
@param startDate The start date of the first period.
@param frequency The... | [
"Generates",
"a",
"schedule",
"based",
"on",
"some",
"meta",
"data",
".",
"The",
"schedule",
"generation",
"considers",
"short",
"periods",
".",
"Date",
"rolling",
"is",
"ignored",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/time/ScheduleGenerator.java#L790-L810 | train |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/calibration/CalibratedCurves.java | CalibratedCurves.getCalibrationProductForSymbol | public AnalyticProductInterface getCalibrationProductForSymbol(String symbol) {
/*
* The internal data structure is not optimal here (a map would make more sense here),
* if the user does not require access to the products, we would allow non-unique symbols.
* Hence we store both in two side by side vectors... | java | public AnalyticProductInterface getCalibrationProductForSymbol(String symbol) {
/*
* The internal data structure is not optimal here (a map would make more sense here),
* if the user does not require access to the products, we would allow non-unique symbols.
* Hence we store both in two side by side vectors... | [
"public",
"AnalyticProductInterface",
"getCalibrationProductForSymbol",
"(",
"String",
"symbol",
")",
"{",
"/*\n\t\t * The internal data structure is not optimal here (a map would make more sense here),\n\t\t * if the user does not require access to the products, we would allow non-unique symbols.\n... | Returns the first product found in the vector of calibration products
which matches the given symbol, where symbol is the String set in
the calibrationSpecs.
@param symbol A given symbol string.
@return The product associated with that symbol. | [
"Returns",
"the",
"first",
"product",
"found",
"in",
"the",
"vector",
"of",
"calibration",
"products",
"which",
"matches",
"the",
"given",
"symbol",
"where",
"symbol",
"is",
"the",
"String",
"set",
"in",
"the",
"calibrationSpecs",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/calibration/CalibratedCurves.java#L649-L664 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/BermudanDigitalOption.java | BermudanDigitalOption.getValue | @Override
public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException {
if(exerciseMethod == ExerciseMethod.UPPER_BOUND_METHOD) {
// Find optimal lambda
GoldenSectionSearch optimizer = new GoldenSectionSearch(-1.0, 1.0);
while(!optimizer.isDon... | java | @Override
public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException {
if(exerciseMethod == ExerciseMethod.UPPER_BOUND_METHOD) {
// Find optimal lambda
GoldenSectionSearch optimizer = new GoldenSectionSearch(-1.0, 1.0);
while(!optimizer.isDon... | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"AssetModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"if",
"(",
"exerciseMethod",
"==",
"ExerciseMethod",
".",
"UPPER_BOUND_METHOD",
")",
... | This method returns the value random variable of the product within the specified model,
evaluated at a given evalutationTime.
Cash-flows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return Th... | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Cash",
"-",
"flows",
"prior",
"evaluationTime",
"are",
"not",
"considered"... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/BermudanDigitalOption.java#L96-L111 | train |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java | HazardCurve.createHazardCurveFromSurvivalProbabilities | public static HazardCurve createHazardCurveFromSurvivalProbabilities(String name, double[] times, double[] givenSurvivalProbabilities){
HazardCurve survivalProbabilities = new HazardCurve(name);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
survivalProbabilities.addSurvivalProbability(times[timeInd... | java | public static HazardCurve createHazardCurveFromSurvivalProbabilities(String name, double[] times, double[] givenSurvivalProbabilities){
HazardCurve survivalProbabilities = new HazardCurve(name);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
survivalProbabilities.addSurvivalProbability(times[timeInd... | [
"public",
"static",
"HazardCurve",
"createHazardCurveFromSurvivalProbabilities",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenSurvivalProbabilities",
")",
"{",
"HazardCurve",
"survivalProbabilities",
"=",
"new",
"HazardCurve",
... | Create a hazard curve from given times and given discount factors using default interpolation and extrapolation methods.
@param name The name of this hazard curve.
@param times Array of times as doubles.
@param givenSurvivalProbabilities Array of corresponding survival probabilities.
@return A new discount factor obje... | [
"Create",
"a",
"hazard",
"curve",
"from",
"given",
"times",
"and",
"given",
"discount",
"factors",
"using",
"default",
"interpolation",
"and",
"extrapolation",
"methods",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java#L152-L160 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.convertLattice | public SwaptionDataLattice convertLattice(QuotingConvention targetConvention, double displacement, AnalyticModel model) {
if(displacement != 0 && targetConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
throw new IllegalArgumentException("SwaptionDataLattice only supports displacement, when using Quot... | java | public SwaptionDataLattice convertLattice(QuotingConvention targetConvention, double displacement, AnalyticModel model) {
if(displacement != 0 && targetConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
throw new IllegalArgumentException("SwaptionDataLattice only supports displacement, when using Quot... | [
"public",
"SwaptionDataLattice",
"convertLattice",
"(",
"QuotingConvention",
"targetConvention",
",",
"double",
"displacement",
",",
"AnalyticModel",
"model",
")",
"{",
"if",
"(",
"displacement",
"!=",
"0",
"&&",
"targetConvention",
"!=",
"QuotingConvention",
".",
"PA... | Convert this lattice to store data in the given convention.
Conversion involving receiver premium assumes zero wide collar.
@param targetConvention The convention to store the data in.
@param displacement The displacement to use, if applicable.
@param model The model for context.
@return The converted lattice. | [
"Convert",
"this",
"lattice",
"to",
"store",
"data",
"in",
"the",
"given",
"convention",
".",
"Conversion",
"involving",
"receiver",
"premium",
"assumes",
"zero",
"wide",
"collar",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L260-L287 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.append | public SwaptionDataLattice append(SwaptionDataLattice other, AnalyticModel model) {
SwaptionDataLattice combined = new SwaptionDataLattice(referenceDate, quotingConvention, displacement,
forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule);
combined.entryMap.putAll(entryMap);
if(qu... | java | public SwaptionDataLattice append(SwaptionDataLattice other, AnalyticModel model) {
SwaptionDataLattice combined = new SwaptionDataLattice(referenceDate, quotingConvention, displacement,
forwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule);
combined.entryMap.putAll(entryMap);
if(qu... | [
"public",
"SwaptionDataLattice",
"append",
"(",
"SwaptionDataLattice",
"other",
",",
"AnalyticModel",
"model",
")",
"{",
"SwaptionDataLattice",
"combined",
"=",
"new",
"SwaptionDataLattice",
"(",
"referenceDate",
",",
"quotingConvention",
",",
"displacement",
",",
"forw... | Append the data of another lattice to this lattice. If the other lattice follows a different quoting convention, it is automatically converted.
However, this method does not check, whether the two lattices are aligned in terms of reference date, curve names and meta schedules.
If the two lattices have shared data point... | [
"Append",
"the",
"data",
"of",
"another",
"lattice",
"to",
"this",
"lattice",
".",
"If",
"the",
"other",
"lattice",
"follows",
"a",
"different",
"quoting",
"convention",
"it",
"is",
"automatically",
"converted",
".",
"However",
"this",
"method",
"does",
"not",... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L299-L313 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getMoneynessAsOffsets | public double[] getMoneynessAsOffsets() {
DoubleStream moneyness = getGridNodesPerMoneyness().keySet().stream().mapToDouble(Integer::doubleValue);
if(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
moneyness = moneyness.map(new DoubleUnaryOperator() {
@Override
public double apply... | java | public double[] getMoneynessAsOffsets() {
DoubleStream moneyness = getGridNodesPerMoneyness().keySet().stream().mapToDouble(Integer::doubleValue);
if(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
moneyness = moneyness.map(new DoubleUnaryOperator() {
@Override
public double apply... | [
"public",
"double",
"[",
"]",
"getMoneynessAsOffsets",
"(",
")",
"{",
"DoubleStream",
"moneyness",
"=",
"getGridNodesPerMoneyness",
"(",
")",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"mapToDouble",
"(",
"Integer",
"::",
"doubleValue",
")",
";",... | Return all levels of moneyness for which data exists.
Moneyness is returned as actual difference strike - par swap rate.
@return The levels of moneyness as difference of strike to par swap rate. | [
"Return",
"all",
"levels",
"of",
"moneyness",
"for",
"which",
"data",
"exists",
".",
"Moneyness",
"is",
"returned",
"as",
"actual",
"difference",
"strike",
"-",
"par",
"swap",
"rate",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L372-L397 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getMaturities | public double[] getMaturities(double moneyness) {
int[] maturitiesInMonths = getMaturities(convertMoneyness(moneyness));
double[] maturities = new double[maturitiesInMonths.length];
for(int index = 0; index < maturities.length; index++) {
maturities[index] = convertMaturity(maturitiesInMonths[index]);
... | java | public double[] getMaturities(double moneyness) {
int[] maturitiesInMonths = getMaturities(convertMoneyness(moneyness));
double[] maturities = new double[maturitiesInMonths.length];
for(int index = 0; index < maturities.length; index++) {
maturities[index] = convertMaturity(maturitiesInMonths[index]);
... | [
"public",
"double",
"[",
"]",
"getMaturities",
"(",
"double",
"moneyness",
")",
"{",
"int",
"[",
"]",
"maturitiesInMonths",
"=",
"getMaturities",
"(",
"convertMoneyness",
"(",
"moneyness",
")",
")",
";",
"double",
"[",
"]",
"maturities",
"=",
"new",
"double"... | Return all valid maturities for a given moneyness.
Uses the fixing times of the fix schedule to determine fractions.
@param moneyness The moneyness as actual offset from par swap rate for which to get the maturities.
@return The maturities as year fraction from reference date. | [
"Return",
"all",
"valid",
"maturities",
"for",
"a",
"given",
"moneyness",
".",
"Uses",
"the",
"fixing",
"times",
"of",
"the",
"fix",
"schedule",
"to",
"determine",
"fractions",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L434-L442 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getTenors | public int[] getTenors() {
Set<Integer> setTenors = new HashSet<>();
for(int moneyness : getGridNodesPerMoneyness().keySet()) {
setTenors.addAll(Arrays.asList((IntStream.of(keyMap.get(moneyness)[1]).boxed().toArray(Integer[]::new))));
}
return setTenors.stream().sorted().mapToInt(Integer::intValue).to... | java | public int[] getTenors() {
Set<Integer> setTenors = new HashSet<>();
for(int moneyness : getGridNodesPerMoneyness().keySet()) {
setTenors.addAll(Arrays.asList((IntStream.of(keyMap.get(moneyness)[1]).boxed().toArray(Integer[]::new))));
}
return setTenors.stream().sorted().mapToInt(Integer::intValue).to... | [
"public",
"int",
"[",
"]",
"getTenors",
"(",
")",
"{",
"Set",
"<",
"Integer",
">",
"setTenors",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"moneyness",
":",
"getGridNodesPerMoneyness",
"(",
")",
".",
"keySet",
"(",
")",
")",
"{",
... | Return all tenors for which data exists.
@return The tenors in months. | [
"Return",
"all",
"tenors",
"for",
"which",
"data",
"exists",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L449-L456 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getTenors | public int[] getTenors(int moneynessBP, int maturityInMonths) {
try {
List<Integer> ret = new ArrayList<>();
for(int tenor : getGridNodesPerMoneyness().get(moneynessBP)[1]) {
if(containsEntryFor(maturityInMonths, tenor, moneynessBP)) {
ret.add(tenor);
}
}
return ret.stream().mapToIn... | java | public int[] getTenors(int moneynessBP, int maturityInMonths) {
try {
List<Integer> ret = new ArrayList<>();
for(int tenor : getGridNodesPerMoneyness().get(moneynessBP)[1]) {
if(containsEntryFor(maturityInMonths, tenor, moneynessBP)) {
ret.add(tenor);
}
}
return ret.stream().mapToIn... | [
"public",
"int",
"[",
"]",
"getTenors",
"(",
"int",
"moneynessBP",
",",
"int",
"maturityInMonths",
")",
"{",
"try",
"{",
"List",
"<",
"Integer",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"tenor",
":",
"getGridNodesPer... | Return all valid tenors for a given moneyness and maturity.
@param moneynessBP The moneyness in bp for which to get the tenors.
@param maturityInMonths The maturities in months for which to get the tenors.
@return The tenors in months. | [
"Return",
"all",
"valid",
"tenors",
"for",
"a",
"given",
"moneyness",
"and",
"maturity",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L465-L478 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.getTenors | public double[] getTenors(double moneyness, double maturity) {
int maturityInMonths = (int) Math.round(maturity * 12);
int[] tenorsInMonths = getTenors(convertMoneyness(moneyness), maturityInMonths);
double[] tenors = new double[tenorsInMonths.length];
for(int index = 0; index < tenors.length; index++) ... | java | public double[] getTenors(double moneyness, double maturity) {
int maturityInMonths = (int) Math.round(maturity * 12);
int[] tenorsInMonths = getTenors(convertMoneyness(moneyness), maturityInMonths);
double[] tenors = new double[tenorsInMonths.length];
for(int index = 0; index < tenors.length; index++) ... | [
"public",
"double",
"[",
"]",
"getTenors",
"(",
"double",
"moneyness",
",",
"double",
"maturity",
")",
"{",
"int",
"maturityInMonths",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"maturity",
"*",
"12",
")",
";",
"int",
"[",
"]",
"tenorsInMonths",
... | Return all valid tenors for a given moneyness and maturity.
Uses the payment times of the fix schedule to determine fractions.
@param moneyness The moneyness as actual offset from par swap rate for which to get the maturities.
@param maturity The maturities as year fraction from the reference date.
@return The tenors ... | [
"Return",
"all",
"valid",
"tenors",
"for",
"a",
"given",
"moneyness",
"and",
"maturity",
".",
"Uses",
"the",
"payment",
"times",
"of",
"the",
"fix",
"schedule",
"to",
"determine",
"fractions",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L488-L497 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.convertMoneyness | private int convertMoneyness(double moneyness) {
if(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
return (int) Math.round(moneyness * 100);
} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {
return - (int) Math.round(moneyness * 10000);
} else {
return (int) Math... | java | private int convertMoneyness(double moneyness) {
if(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
return (int) Math.round(moneyness * 100);
} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {
return - (int) Math.round(moneyness * 10000);
} else {
return (int) Math... | [
"private",
"int",
"convertMoneyness",
"(",
"double",
"moneyness",
")",
"{",
"if",
"(",
"quotingConvention",
"==",
"QuotingConvention",
".",
"PAYERVOLATILITYLOGNORMAL",
")",
"{",
"return",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"moneyness",
"*",
"100",
")"... | Convert moneyness given as difference to par swap rate to moneyness in bp.
Uses the fixing times of the fix schedule to determine fractions.
@param moneyness as offset.
@return Moneyness in bp. | [
"Convert",
"moneyness",
"given",
"as",
"difference",
"to",
"par",
"swap",
"rate",
"to",
"moneyness",
"in",
"bp",
".",
"Uses",
"the",
"fixing",
"times",
"of",
"the",
"fix",
"schedule",
"to",
"determine",
"fractions",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L506-L514 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.convertMaturity | private double convertMaturity(int maturityInMonths) {
Schedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, 12);
return schedule.getFixing(0);
} | java | private double convertMaturity(int maturityInMonths) {
Schedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, 12);
return schedule.getFixing(0);
} | [
"private",
"double",
"convertMaturity",
"(",
"int",
"maturityInMonths",
")",
"{",
"Schedule",
"schedule",
"=",
"fixMetaSchedule",
".",
"generateSchedule",
"(",
"referenceDate",
",",
"maturityInMonths",
",",
"12",
")",
";",
"return",
"schedule",
".",
"getFixing",
"... | Convert maturity given as offset in months to year fraction.
@param maturityInMonths The maturity as offset in months.
@return The maturity as year fraction. | [
"Convert",
"maturity",
"given",
"as",
"offset",
"in",
"months",
"to",
"year",
"fraction",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L522-L525 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.convertTenor | private double convertTenor(int maturityInMonths, int tenorInMonths) {
Schedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, tenorInMonths);
return schedule.getPayment(schedule.getNumberOfPeriods()-1);
} | java | private double convertTenor(int maturityInMonths, int tenorInMonths) {
Schedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, tenorInMonths);
return schedule.getPayment(schedule.getNumberOfPeriods()-1);
} | [
"private",
"double",
"convertTenor",
"(",
"int",
"maturityInMonths",
",",
"int",
"tenorInMonths",
")",
"{",
"Schedule",
"schedule",
"=",
"fixMetaSchedule",
".",
"generateSchedule",
"(",
"referenceDate",
",",
"maturityInMonths",
",",
"tenorInMonths",
")",
";",
"retur... | Convert tenor given as offset in months to year fraction.
@param maturityInMonths The maturity as offset in months.
@param tenorInMonths The tenor as offset in months.
@return THe tenor as year fraction. | [
"Convert",
"tenor",
"given",
"as",
"offset",
"in",
"months",
"to",
"year",
"fraction",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L534-L537 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.containsEntryFor | public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) {
return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP));
} | java | public boolean containsEntryFor(int maturityInMonths, int tenorInMonths, int moneynessBP) {
return entryMap.containsKey(new DataKey(maturityInMonths, tenorInMonths, moneynessBP));
} | [
"public",
"boolean",
"containsEntryFor",
"(",
"int",
"maturityInMonths",
",",
"int",
"tenorInMonths",
",",
"int",
"moneynessBP",
")",
"{",
"return",
"entryMap",
".",
"containsKey",
"(",
"new",
"DataKey",
"(",
"maturityInMonths",
",",
"tenorInMonths",
",",
"moneyne... | Returns true if the lattice contains an entry at the specified location.
@param maturityInMonths The maturity in months to check.
@param tenorInMonths The tenor in months to check.
@param moneynessBP The moneyness in bp to check.
@return True iff there is an entry at the specified location. | [
"Returns",
"true",
"if",
"the",
"lattice",
"contains",
"an",
"entry",
"at",
"the",
"specified",
"location",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L547-L549 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java | SwaptionDataLattice.convertToConvention | private double convertToConvention(double value, DataKey key, QuotingConvention toConvention, double toDisplacement,
QuotingConvention fromConvention, double fromDisplacement, AnalyticModel model) {
if(toConvention == fromConvention) {
if(toConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
r... | java | private double convertToConvention(double value, DataKey key, QuotingConvention toConvention, double toDisplacement,
QuotingConvention fromConvention, double fromDisplacement, AnalyticModel model) {
if(toConvention == fromConvention) {
if(toConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {
r... | [
"private",
"double",
"convertToConvention",
"(",
"double",
"value",
",",
"DataKey",
"key",
",",
"QuotingConvention",
"toConvention",
",",
"double",
"toDisplacement",
",",
"QuotingConvention",
"fromConvention",
",",
"double",
"fromDisplacement",
",",
"AnalyticModel",
"mo... | Convert the value to requested quoting convention.
Conversion involving receiver premium assumes zero wide collar.
@param value The value to convert.
@param key The key of the value.
@param toConvention The convention to convert to.
@param toDisplacement The displacement to be used, if converting to log normal implied... | [
"Convert",
"the",
"value",
"to",
"requested",
"quoting",
"convention",
".",
"Conversion",
"involving",
"receiver",
"premium",
"assumes",
"zero",
"wide",
"collar",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/SwaptionDataLattice.java#L666-L713 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getCouponPayment | public double getCouponPayment(int periodIndex, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {
throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName... | java | public double getCouponPayment(int periodIndex, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {
throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName... | [
"public",
"double",
"getCouponPayment",
"(",
"int",
"periodIndex",
",",
"AnalyticModel",
"model",
")",
"{",
"ForwardCurve",
"forwardCurve",
"=",
"model",
".",
"getForwardCurve",
"(",
"forwardCurveName",
")",
";",
"if",
"(",
"forwardCurve",
"==",
"null",
"&&",
"f... | Returns the coupon payment of the period with the given index. The analytic model is needed in case of floating bonds.
@param periodIndex The index of the period of interest.
@param model The model under which the product is valued.
@return The value of the coupon payment in the given period. | [
"Returns",
"the",
"coupon",
"payment",
"of",
"the",
"period",
"with",
"the",
"given",
"index",
".",
"The",
"analytic",
"model",
"is",
"needed",
"in",
"case",
"of",
"floating",
"bonds",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L209-L222 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getValueWithGivenSpreadOverCurve | public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) {
double value=0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
value+= paymentDate>evaluati... | java | public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) {
double value=0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
value+= paymentDate>evaluati... | [
"public",
"double",
"getValueWithGivenSpreadOverCurve",
"(",
"double",
"evaluationTime",
",",
"Curve",
"referenceCurve",
",",
"double",
"spread",
",",
"AnalyticModel",
"model",
")",
"{",
"double",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"periodIndex",
"=",
"0... | Returns the value of the sum of discounted cash flows of the bond where
the discounting is done with the given reference curve and an additional spread.
This method can be used for optimizer.
@param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
@param refere... | [
"Returns",
"the",
"value",
"of",
"the",
"sum",
"of",
"discounted",
"cash",
"flows",
"of",
"the",
"bond",
"where",
"the",
"discounting",
"is",
"done",
"with",
"the",
"given",
"reference",
"curve",
"and",
"an",
"additional",
"spread",
".",
"This",
"method",
... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L235-L244 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getValueWithGivenYield | public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) {
DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0});
return getValueWithGivenSpreadOverCurve(evaluationTim... | java | public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) {
DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0});
return getValueWithGivenSpreadOverCurve(evaluationTim... | [
"public",
"double",
"getValueWithGivenYield",
"(",
"double",
"evaluationTime",
",",
"double",
"rate",
",",
"AnalyticModel",
"model",
")",
"{",
"DiscountCurve",
"referenceCurve",
"=",
"DiscountCurveInterpolation",
".",
"createDiscountCurveFromDiscountFactors",
"(",
"\"refere... | Returns the value of the sum of discounted cash flows of the bond where
the discounting is done with the given yield curve.
This method can be used for optimizer.
@param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered.
@param rate The yield which is used for di... | [
"Returns",
"the",
"value",
"of",
"the",
"sum",
"of",
"discounted",
"cash",
"flows",
"of",
"the",
"bond",
"where",
"the",
"discounting",
"is",
"done",
"with",
"the",
"given",
"yield",
"curve",
".",
"This",
"method",
"can",
"be",
"used",
"for",
"optimizer",
... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L256-L259 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getSpread | public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) {
GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);
while(search.getAccuracy() > 1E-11 && !search.isDone()) {
double x = search.getNextPoint();
double fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,mo... | java | public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) {
GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);
while(search.getAccuracy() > 1E-11 && !search.isDone()) {
double x = search.getNextPoint();
double fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,mo... | [
"public",
"double",
"getSpread",
"(",
"double",
"bondPrice",
",",
"Curve",
"referenceCurve",
",",
"AnalyticModel",
"model",
")",
"{",
"GoldenSectionSearch",
"search",
"=",
"new",
"GoldenSectionSearch",
"(",
"-",
"2.0",
",",
"2.0",
")",
";",
"while",
"(",
"sear... | Returns the spread value such that the sum of cash flows of the bond discounted with a given reference curve
with the additional spread coincides with a given price.
@param bondPrice The target price as double.
@param referenceCurve The reference curve used for discounting the coupon payments.
@param model The model u... | [
"Returns",
"the",
"spread",
"value",
"such",
"that",
"the",
"sum",
"of",
"cash",
"flows",
"of",
"the",
"bond",
"discounted",
"with",
"a",
"given",
"reference",
"curve",
"with",
"the",
"additional",
"spread",
"coincides",
"with",
"a",
"given",
"price",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L270-L280 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getYield | public double getYield(double bondPrice, AnalyticModel model) {
GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);
while(search.getAccuracy() > 1E-11 && !search.isDone()) {
double x = search.getNextPoint();
double fx=getValueWithGivenYield(0.0,x,model);
double y = (bondPrice-fx)*(bondPrice-fx... | java | public double getYield(double bondPrice, AnalyticModel model) {
GoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);
while(search.getAccuracy() > 1E-11 && !search.isDone()) {
double x = search.getNextPoint();
double fx=getValueWithGivenYield(0.0,x,model);
double y = (bondPrice-fx)*(bondPrice-fx... | [
"public",
"double",
"getYield",
"(",
"double",
"bondPrice",
",",
"AnalyticModel",
"model",
")",
"{",
"GoldenSectionSearch",
"search",
"=",
"new",
"GoldenSectionSearch",
"(",
"-",
"2.0",
",",
"2.0",
")",
";",
"while",
"(",
"search",
".",
"getAccuracy",
"(",
"... | Returns the yield value such that the sum of cash flows of the bond discounted with the yield curve
coincides with a given price.
@param bondPrice The target price as double.
@param model The model under which the product is valued.
@return The optimal yield value. | [
"Returns",
"the",
"yield",
"value",
"such",
"that",
"the",
"sum",
"of",
"cash",
"flows",
"of",
"the",
"bond",
"discounted",
"with",
"the",
"yield",
"curve",
"coincides",
"with",
"a",
"given",
"price",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L290-L300 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getAccruedInterest | public double getAccruedInterest(LocalDate date, AnalyticModel model) {
int periodIndex=schedule.getPeriodIndex(date);
Period period=schedule.getPeriod(periodIndex);
DayCountConvention dcc= schedule.getDaycountconvention();
double accruedInterest=getCouponPayment(periodIndex,model)*(dcc.getDaycountFraction(peri... | java | public double getAccruedInterest(LocalDate date, AnalyticModel model) {
int periodIndex=schedule.getPeriodIndex(date);
Period period=schedule.getPeriod(periodIndex);
DayCountConvention dcc= schedule.getDaycountconvention();
double accruedInterest=getCouponPayment(periodIndex,model)*(dcc.getDaycountFraction(peri... | [
"public",
"double",
"getAccruedInterest",
"(",
"LocalDate",
"date",
",",
"AnalyticModel",
"model",
")",
"{",
"int",
"periodIndex",
"=",
"schedule",
".",
"getPeriodIndex",
"(",
"date",
")",
";",
"Period",
"period",
"=",
"schedule",
".",
"getPeriod",
"(",
"perio... | Returns the accrued interest of the bond for a given date.
@param date The date of interest.
@param model The model under which the product is valued.
@return The accrued interest. | [
"Returns",
"the",
"accrued",
"interest",
"of",
"the",
"bond",
"for",
"a",
"given",
"date",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L309-L315 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getAccruedInterest | public double getAccruedInterest(double time, AnalyticModel model) {
LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time);
return getAccruedInterest(date, model);
} | java | public double getAccruedInterest(double time, AnalyticModel model) {
LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time);
return getAccruedInterest(date, model);
} | [
"public",
"double",
"getAccruedInterest",
"(",
"double",
"time",
",",
"AnalyticModel",
"model",
")",
"{",
"LocalDate",
"date",
"=",
"FloatingpointDate",
".",
"getDateFromFloatingPointDate",
"(",
"schedule",
".",
"getReferenceDate",
"(",
")",
",",
"time",
")",
";",... | Returns the accrued interest of the bond for a given time.
@param time The time of interest as double.
@param model The model under which the product is valued.
@return The accrued interest. | [
"Returns",
"the",
"accrued",
"interest",
"of",
"the",
"bond",
"for",
"a",
"given",
"time",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L324-L327 | train |
finmath/finmath-lib | src/main/java/net/finmath/functions/AnalyticFormulas.java | AnalyticFormulas.blackScholesOptionTheta | public static double blackScholesOptionTheta(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
}
els... | java | public static double blackScholesOptionTheta(
double initialStockValue,
double riskFreeRate,
double volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return 0.0;
}
els... | [
"public",
"static",
"double",
"blackScholesOptionTheta",
"(",
"double",
"initialStockValue",
",",
"double",
"riskFreeRate",
",",
"double",
"volatility",
",",
"double",
"optionMaturity",
",",
"double",
"optionStrike",
")",
"{",
"if",
"(",
"optionStrike",
"<=",
"0.0",... | This static method calculated the vega of a call option under a Black-Scholes model
@param initialStockValue The initial value of the underlying, i.e., the spot.
@param riskFreeRate The risk free rate of the bank account numerarie.
@param volatility The Black-Scholes volatility.
@param optionMaturity The option maturi... | [
"This",
"static",
"method",
"calculated",
"the",
"vega",
"of",
"a",
"call",
"option",
"under",
"a",
"Black",
"-",
"Scholes",
"model"
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/AnalyticFormulas.java#L439-L461 | train |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/AbstractMonteCarloProduct.java | AbstractMonteCarloProduct.getValues | public Map<String, Object> getValues(double evaluationTime, MonteCarloSimulationInterface model) throws CalculationException
{
RandomVariableInterface values = getValue(evaluationTime, model);
if(values == null) {
return null;
}
// Sum up values on path
double value = values.getAverage();
double error... | java | public Map<String, Object> getValues(double evaluationTime, MonteCarloSimulationInterface model) throws CalculationException
{
RandomVariableInterface values = getValue(evaluationTime, model);
if(values == null) {
return null;
}
// Sum up values on path
double value = values.getAverage();
double error... | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getValues",
"(",
"double",
"evaluationTime",
",",
"MonteCarloSimulationInterface",
"model",
")",
"throws",
"CalculationException",
"{",
"RandomVariableInterface",
"values",
"=",
"getValue",
"(",
"evaluationTime",
",... | This method returns the value of the product under the specified model and other information in a key-value map.
@param evaluationTime The time on which this products value should be observed.
@param model A model used to evaluate the product.
@return The values of the product.
@throws net.finmath.exception.Calculatio... | [
"This",
"method",
"returns",
"the",
"value",
"of",
"the",
"product",
"under",
"the",
"specified",
"model",
"and",
"other",
"information",
"in",
"a",
"key",
"-",
"value",
"map",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/AbstractMonteCarloProduct.java#L113-L130 | train |
finmath/finmath-lib | src/main/java6/net/finmath/interpolation/RationalFunctionInterpolation.java | RationalFunctionInterpolation.getValue | public double getValue(double x)
{
synchronized(interpolatingRationalFunctionsLazyInitLock) {
if(interpolatingRationalFunctions == null) {
doCreateRationalFunctions();
}
}
// Get interpolating rational function for the given point x
int pointIndex = java.util.Arrays.binarySearch(points, x);
if(poi... | java | public double getValue(double x)
{
synchronized(interpolatingRationalFunctionsLazyInitLock) {
if(interpolatingRationalFunctions == null) {
doCreateRationalFunctions();
}
}
// Get interpolating rational function for the given point x
int pointIndex = java.util.Arrays.binarySearch(points, x);
if(poi... | [
"public",
"double",
"getValue",
"(",
"double",
"x",
")",
"{",
"synchronized",
"(",
"interpolatingRationalFunctionsLazyInitLock",
")",
"{",
"if",
"(",
"interpolatingRationalFunctions",
"==",
"null",
")",
"{",
"doCreateRationalFunctions",
"(",
")",
";",
"}",
"}",
"/... | Get an interpolated value for a given argument x.
@param x The abscissa at which the interpolation should be performed.
@return The interpolated value (ordinate). | [
"Get",
"an",
"interpolated",
"value",
"for",
"a",
"given",
"argument",
"x",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/interpolation/RationalFunctionInterpolation.java#L186-L228 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java | RandomVariableUniqueVariable.getGradient | public RandomVariable[] getGradient(){
// for now let us take the case for output-dimension equal to one!
int numberOfVariables = getNumberOfVariablesInList();
int numberOfCalculationSteps = factory.getNumberOfEntriesInList();
RandomVariable[] omega_hat = new RandomVariable[numberOfCalculationSteps];
... | java | public RandomVariable[] getGradient(){
// for now let us take the case for output-dimension equal to one!
int numberOfVariables = getNumberOfVariablesInList();
int numberOfCalculationSteps = factory.getNumberOfEntriesInList();
RandomVariable[] omega_hat = new RandomVariable[numberOfCalculationSteps];
... | [
"public",
"RandomVariable",
"[",
"]",
"getGradient",
"(",
")",
"{",
"// for now let us take the case for output-dimension equal to one!\r",
"int",
"numberOfVariables",
"=",
"getNumberOfVariablesInList",
"(",
")",
";",
"int",
"numberOfCalculationSteps",
"=",
"factory",
".",
... | Apply the AAD algorithm to this very variable
NOTE: in this case it is indeed correct to assume that the output dimension is "one"
meaning that there is only one {@link RandomVariableUniqueVariable} as an output.
@return gradient for the built up function | [
"Apply",
"the",
"AAD",
"algorithm",
"to",
"this",
"very",
"variable"
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/automaticdifferentiation/backward/alternative/RandomVariableUniqueVariable.java#L712-L754 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java | AbstractVolatilitySurfaceParametric.getCloneCalibrated | public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFa... | java | public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFa... | [
"public",
"AbstractVolatilitySurfaceParametric",
"getCloneCalibrated",
"(",
"final",
"AnalyticModel",
"calibrationModel",
",",
"final",
"Vector",
"<",
"AnalyticProduct",
">",
"calibrationProducts",
",",
"final",
"List",
"<",
"Double",
">",
"calibrationTargetValues",
",",
... | Create a clone of this volatility surface using a generic calibration
of its parameters to given market data.
@param calibrationModel The model used during calibration (contains additional objects required during valuation, e.g. curves).
@param calibrationProducts The calibration products.
@param calibrationTargetValu... | [
"Create",
"a",
"clone",
"of",
"this",
"volatility",
"surface",
"using",
"a",
"generic",
"calibration",
"of",
"its",
"parameters",
"to",
"given",
"market",
"data",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java#L81-L110 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/SeasonalCurve.java | SeasonalCurve.computeSeasonalAdjustments | public static double[] computeSeasonalAdjustments(double[] realizedCPIValues, int lastMonth, int numberOfYearsToAverage) {
/*
* Cacluate average log returns
*/
double[] averageLogReturn = new double[12];
Arrays.fill(averageLogReturn, 0.0);
for(int arrayIndex = 0; arrayIndex < 12*numberOfYearsToAverage; a... | java | public static double[] computeSeasonalAdjustments(double[] realizedCPIValues, int lastMonth, int numberOfYearsToAverage) {
/*
* Cacluate average log returns
*/
double[] averageLogReturn = new double[12];
Arrays.fill(averageLogReturn, 0.0);
for(int arrayIndex = 0; arrayIndex < 12*numberOfYearsToAverage; a... | [
"public",
"static",
"double",
"[",
"]",
"computeSeasonalAdjustments",
"(",
"double",
"[",
"]",
"realizedCPIValues",
",",
"int",
"lastMonth",
",",
"int",
"numberOfYearsToAverage",
")",
"{",
"/*\n\t\t * Cacluate average log returns\n\t\t */",
"double",
"[",
"]",
"averageL... | Computes annualized seasonal adjustments from given monthly realized CPI values.
@param realizedCPIValues An array of consecutive monthly CPI values (minimum size is 12*numberOfYearsToAverage))
@param lastMonth The index of the last month in the sequence of realizedCPIValues (corresponding to the enums in <code>{@link... | [
"Computes",
"annualized",
"seasonal",
"adjustments",
"from",
"given",
"monthly",
"realized",
"CPI",
"values",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/SeasonalCurve.java#L176-L211 | train |
finmath/finmath-lib | src/main/java/net/finmath/modelling/productfactory/ProductFactoryCascade.java | ProductFactoryCascade.addFactoryBefore | public ProductFactoryCascade<T> addFactoryBefore(ProductFactory<? extends T> factory) {
ArrayList<ProductFactory<? extends T>> factories = new ArrayList<ProductFactory<? extends T>>(this.factories.size()+1);
factories.addAll(this.factories);
factories.add(0, factory);
return new ProductFactoryCascade<>(factorie... | java | public ProductFactoryCascade<T> addFactoryBefore(ProductFactory<? extends T> factory) {
ArrayList<ProductFactory<? extends T>> factories = new ArrayList<ProductFactory<? extends T>>(this.factories.size()+1);
factories.addAll(this.factories);
factories.add(0, factory);
return new ProductFactoryCascade<>(factorie... | [
"public",
"ProductFactoryCascade",
"<",
"T",
">",
"addFactoryBefore",
"(",
"ProductFactory",
"<",
"?",
"extends",
"T",
">",
"factory",
")",
"{",
"ArrayList",
"<",
"ProductFactory",
"<",
"?",
"extends",
"T",
">",
">",
"factories",
"=",
"new",
"ArrayList",
"<"... | Add a given factory to the list of factories at the BEGINNING.
@param factory The factory to be added.
@return Cascade with amended factory list. | [
"Add",
"a",
"given",
"factory",
"to",
"the",
"list",
"of",
"factories",
"at",
"the",
"BEGINNING",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/modelling/productfactory/ProductFactoryCascade.java#L49-L54 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/ForwardRateVolatilitySurfaceCurvature.java | ForwardRateVolatilitySurfaceCurvature.getValues | public RandomVariable getValues(double evaluationTime, LIBORMarketModel model) {
if(evaluationTime > 0) {
throw new RuntimeException("Forward start evaluation currently not supported.");
}
// Fetch the covariance model of the model
LIBORCovarianceModel covarianceModel = model.getCovarianceModel();
// We ... | java | public RandomVariable getValues(double evaluationTime, LIBORMarketModel model) {
if(evaluationTime > 0) {
throw new RuntimeException("Forward start evaluation currently not supported.");
}
// Fetch the covariance model of the model
LIBORCovarianceModel covarianceModel = model.getCovarianceModel();
// We ... | [
"public",
"RandomVariable",
"getValues",
"(",
"double",
"evaluationTime",
",",
"LIBORMarketModel",
"model",
")",
"{",
"if",
"(",
"evaluationTime",
">",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Forward start evaluation currently not supported.\"",
")",
... | Calculates the squared curvature of the LIBOR instantaneous variance.
@param evaluationTime Time at which the product is evaluated.
@param model A model implementing the LIBORModelMonteCarloSimulationModel
@return The squared curvature of the LIBOR instantaneous variance (reduced a possible tolerance). The return valu... | [
"Calculates",
"the",
"squared",
"curvature",
"of",
"the",
"LIBOR",
"instantaneous",
"variance",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/ForwardRateVolatilitySurfaceCurvature.java#L117-L179 | train |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java | AbstractLIBORCovarianceModel.getFactorLoading | public RandomVariableInterface[] getFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {
int componentIndex = liborPeriodDiscretization.getTimeIndex(component);
if(componentIndex < 0) {
componentIndex = -componentIndex - 2;
}
return getFactorLoading(time, component... | java | public RandomVariableInterface[] getFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {
int componentIndex = liborPeriodDiscretization.getTimeIndex(component);
if(componentIndex < 0) {
componentIndex = -componentIndex - 2;
}
return getFactorLoading(time, component... | [
"public",
"RandomVariableInterface",
"[",
"]",
"getFactorLoading",
"(",
"double",
"time",
",",
"double",
"component",
",",
"RandomVariableInterface",
"[",
"]",
"realizationAtTimeIndex",
")",
"{",
"int",
"componentIndex",
"=",
"liborPeriodDiscretization",
".",
"getTimeIn... | Return the factor loading for a given time and a given component.
The factor loading is the vector <i>f<sub>i</sub></i> such that the scalar product <br>
<i>f<sub>j</sub>f<sub>k</sub> = f<sub>j,1</sub>f<sub>k,1</sub> + ... + f<sub>j,m</sub>f<sub>k,m</sub></i> <br>
is the instantaneous covariance of the component <i>j<... | [
"Return",
"the",
"factor",
"loading",
"for",
"a",
"given",
"time",
"and",
"a",
"given",
"component",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java#L63-L69 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java | BermudanSwaptionFromSwapSchedules.getValueUnderlyingNumeraireRelative | private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException {
RandomVariable value = model.getRandomVariableForConstant(0.0);
for(int periodIndex = legSchedule.getNumb... | java | private RandomVariable getValueUnderlyingNumeraireRelative(LIBORModelMonteCarloSimulationModel model, Schedule legSchedule, boolean paysFloat, double swaprate, double notional) throws CalculationException {
RandomVariable value = model.getRandomVariableForConstant(0.0);
for(int periodIndex = legSchedule.getNumb... | [
"private",
"RandomVariable",
"getValueUnderlyingNumeraireRelative",
"(",
"LIBORModelMonteCarloSimulationModel",
"model",
",",
"Schedule",
"legSchedule",
",",
"boolean",
"paysFloat",
",",
"double",
"swaprate",
",",
"double",
"notional",
")",
"throws",
"CalculationException",
... | Calculated the numeraire relative value of an underlying swap leg.
@param model The Monte Carlo model.
@param legSchedule The schedule of the leg.
@param paysFloat If true a floating rate is payed.
@param swaprate The swaprate. May be 0.0 for pure floating leg.
@param notional The notional.
@return The sum of the nume... | [
"Calculated",
"the",
"numeraire",
"relative",
"value",
"of",
"an",
"underlying",
"swap",
"leg",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java#L292-L314 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java | BermudanSwaptionFromSwapSchedules.getConditionalExpectationEstimator | public ConditionalExpectationEstimator getConditionalExpectationEstimator(double exerciseTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
RandomVariable[] regressionBasisFunctions = regressionBasisFunctionProvider.getBasisFunctions(exerciseTime, model);
return conditionalExpectationR... | java | public ConditionalExpectationEstimator getConditionalExpectationEstimator(double exerciseTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
RandomVariable[] regressionBasisFunctions = regressionBasisFunctionProvider.getBasisFunctions(exerciseTime, model);
return conditionalExpectationR... | [
"public",
"ConditionalExpectationEstimator",
"getConditionalExpectationEstimator",
"(",
"double",
"exerciseTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"RandomVariable",
"[",
"]",
"regressionBasisFunctions",
"=",
"regress... | The conditional expectation is calculated using a Monte-Carlo regression technique.
@param exerciseTime The exercise time
@param model The valuation model
@return The condition expectation estimator
@throws CalculationException Thrown if underlying model failed to calculate stochastic process. | [
"The",
"conditional",
"expectation",
"is",
"calculated",
"using",
"a",
"Monte",
"-",
"Carlo",
"regression",
"technique",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java#L324-L327 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/models/LIBORMarketModelStandard.java | LIBORMarketModelStandard.getNumeraire | @Override
public RandomVariable getNumeraire(double time) throws CalculationException {
int timeIndex = getLiborPeriodIndex(time);
if(timeIndex < 0) {
// Interpolation of Numeraire: linear interpolation of the reciprocal.
int lowerIndex = -timeIndex -1;
int upperIndex = -timeIndex;
double alpha = (tim... | java | @Override
public RandomVariable getNumeraire(double time) throws CalculationException {
int timeIndex = getLiborPeriodIndex(time);
if(timeIndex < 0) {
// Interpolation of Numeraire: linear interpolation of the reciprocal.
int lowerIndex = -timeIndex -1;
int upperIndex = -timeIndex;
double alpha = (tim... | [
"@",
"Override",
"public",
"RandomVariable",
"getNumeraire",
"(",
"double",
"time",
")",
"throws",
"CalculationException",
"{",
"int",
"timeIndex",
"=",
"getLiborPeriodIndex",
"(",
"time",
")",
";",
"if",
"(",
"timeIndex",
"<",
"0",
")",
"{",
"// Interpolation o... | Return the numeraire at a given time.
The numeraire is provided for interpolated points. If requested on points which are not
part of the tenor discretization, the numeraire uses a linear interpolation of the reciprocal
value. See ISBN 0470047224 for details.
@param time Time time <i>t</i> for which the numeraire shou... | [
"Return",
"the",
"numeraire",
"at",
"a",
"given",
"time",
".",
"The",
"numeraire",
"is",
"provided",
"for",
"interpolated",
"points",
".",
"If",
"requested",
"on",
"points",
"which",
"are",
"not",
"part",
"of",
"the",
"tenor",
"discretization",
"the",
"numer... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/models/LIBORMarketModelStandard.java#L282-L341 | train |
finmath/finmath-lib | src/main/java/net/finmath/finitedifference/solvers/FDMThetaMethod.java | FDMThetaMethod.u_neg_inf | private double u_neg_inf(double x, double tau) {
return f(boundaryCondition.getValueAtLowerBoundary(model, f_t(tau), f_s(x)), x, tau);
} | java | private double u_neg_inf(double x, double tau) {
return f(boundaryCondition.getValueAtLowerBoundary(model, f_t(tau), f_s(x)), x, tau);
} | [
"private",
"double",
"u_neg_inf",
"(",
"double",
"x",
",",
"double",
"tau",
")",
"{",
"return",
"f",
"(",
"boundaryCondition",
".",
"getValueAtLowerBoundary",
"(",
"model",
",",
"f_t",
"(",
"tau",
")",
",",
"f_s",
"(",
"x",
")",
")",
",",
"x",
",",
"... | Heat Equation Boundary Conditions | [
"Heat",
"Equation",
"Boundary",
"Conditions"
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/finitedifference/solvers/FDMThetaMethod.java#L150-L152 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/conditionalexpectation/LinearRegression.java | LinearRegression.getRegressionCoefficients | public double[] getRegressionCoefficients(RandomVariable value) {
if(basisFunctions.length == 0) {
return new double[] { };
}
else if(basisFunctions.length == 1) {
/*
* Regression with one basis function is just a projection on that vector. <b,x>/<b,b>
*/
return new double[] { value.mult(basisFun... | java | public double[] getRegressionCoefficients(RandomVariable value) {
if(basisFunctions.length == 0) {
return new double[] { };
}
else if(basisFunctions.length == 1) {
/*
* Regression with one basis function is just a projection on that vector. <b,x>/<b,b>
*/
return new double[] { value.mult(basisFun... | [
"public",
"double",
"[",
"]",
"getRegressionCoefficients",
"(",
"RandomVariable",
"value",
")",
"{",
"if",
"(",
"basisFunctions",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"double",
"[",
"]",
"{",
"}",
";",
"}",
"else",
"if",
"(",
"basisFuncti... | Get the vector of regression coefficients.
@param value The random variable to regress.
@return The vector of regression coefficients. | [
"Get",
"the",
"vector",
"of",
"regression",
"coefficients",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/conditionalexpectation/LinearRegression.java#L36-L88 | train |
finmath/finmath-lib | src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java | FPMLParser.getSwapProductDescriptor | private ProductDescriptor getSwapProductDescriptor(Element trade) {
InterestRateSwapLegProductDescriptor legReceiver = null;
InterestRateSwapLegProductDescriptor legPayer = null;
NodeList legs = trade.getElementsByTagName("swapStream");
for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) {
... | java | private ProductDescriptor getSwapProductDescriptor(Element trade) {
InterestRateSwapLegProductDescriptor legReceiver = null;
InterestRateSwapLegProductDescriptor legPayer = null;
NodeList legs = trade.getElementsByTagName("swapStream");
for(int legIndex = 0; legIndex < legs.getLength(); legIndex++) {
... | [
"private",
"ProductDescriptor",
"getSwapProductDescriptor",
"(",
"Element",
"trade",
")",
"{",
"InterestRateSwapLegProductDescriptor",
"legReceiver",
"=",
"null",
";",
"InterestRateSwapLegProductDescriptor",
"legPayer",
"=",
"null",
";",
"NodeList",
"legs",
"=",
"trade",
... | Construct an InterestRateSwapProductDescriptor from a node in a FpML file.
@param trade The node containing the swap.
@return Descriptor of the swap. | [
"Construct",
"an",
"InterestRateSwapProductDescriptor",
"from",
"a",
"node",
"in",
"a",
"FpML",
"file",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java#L101-L120 | train |
finmath/finmath-lib | src/main/java/net/finmath/information/Library.java | Library.getVersionString | public static String getVersionString() {
String versionString = "UNKNOWN";
Properties propeties = getProperites();
if(propeties != null) {
versionString = propeties.getProperty("finmath-lib.version");
}
return versionString;
} | java | public static String getVersionString() {
String versionString = "UNKNOWN";
Properties propeties = getProperites();
if(propeties != null) {
versionString = propeties.getProperty("finmath-lib.version");
}
return versionString;
} | [
"public",
"static",
"String",
"getVersionString",
"(",
")",
"{",
"String",
"versionString",
"=",
"\"UNKNOWN\"",
";",
"Properties",
"propeties",
"=",
"getProperites",
"(",
")",
";",
"if",
"(",
"propeties",
"!=",
"null",
")",
"{",
"versionString",
"=",
"propetie... | Return the version string of this instance of finmath-lib.
@return The version string of this instance of finmath-lib. | [
"Return",
"the",
"version",
"string",
"of",
"this",
"instance",
"of",
"finmath",
"-",
"lib",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/information/Library.java#L40-L47 | train |
finmath/finmath-lib | src/main/java/net/finmath/information/Library.java | Library.getBuildString | public static String getBuildString() {
String versionString = "UNKNOWN";
Properties propeties = getProperites();
if(propeties != null) {
versionString = propeties.getProperty("finmath-lib.build");
}
return versionString;
} | java | public static String getBuildString() {
String versionString = "UNKNOWN";
Properties propeties = getProperites();
if(propeties != null) {
versionString = propeties.getProperty("finmath-lib.build");
}
return versionString;
} | [
"public",
"static",
"String",
"getBuildString",
"(",
")",
"{",
"String",
"versionString",
"=",
"\"UNKNOWN\"",
";",
"Properties",
"propeties",
"=",
"getProperites",
"(",
")",
";",
"if",
"(",
"propeties",
"!=",
"null",
")",
"{",
"versionString",
"=",
"propeties"... | Return the build string of this instance of finmath-lib.
Currently this is the Git commit hash.
@return The build string of this instance of finmath-lib. | [
"Return",
"the",
"build",
"string",
"of",
"this",
"instance",
"of",
"finmath",
"-",
"lib",
".",
"Currently",
"this",
"is",
"the",
"Git",
"commit",
"hash",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/information/Library.java#L55-L62 | train |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java | DiscountCurve.createDiscountCurveFromDiscountFactors | public static DiscountCurve createDiscountCurveFromDiscountFactors(String name, double[] times, double[] givenDiscountFactors) {
DiscountCurve discountFactors = new DiscountCurve(name);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
discountFactors.addDiscountFactor(times[timeIndex], givenDiscountFa... | java | public static DiscountCurve createDiscountCurveFromDiscountFactors(String name, double[] times, double[] givenDiscountFactors) {
DiscountCurve discountFactors = new DiscountCurve(name);
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
discountFactors.addDiscountFactor(times[timeIndex], givenDiscountFa... | [
"public",
"static",
"DiscountCurve",
"createDiscountCurveFromDiscountFactors",
"(",
"String",
"name",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenDiscountFactors",
")",
"{",
"DiscountCurve",
"discountFactors",
"=",
"new",
"DiscountCurve",
"(",
"... | Create a discount curve from given times and given discount factors using default interpolation and extrapolation methods.
@param name The name of this discount curve.
@param times Array of times as doubles.
@param givenDiscountFactors Array of corresponding discount factors.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"times",
"and",
"given",
"discount",
"factors",
"using",
"default",
"interpolation",
"and",
"extrapolation",
"methods",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/DiscountCurve.java#L158-L166 | train |
finmath/finmath-lib | src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java | EuropeanOptionSmile.getDescriptors | public Map<Double, SingleAssetEuropeanOptionProductDescriptor> getDescriptors(LocalDate referenceDate){
int numberOfStrikes = strikes.length;
HashMap<Double, SingleAssetEuropeanOptionProductDescriptor> descriptors = new HashMap<Double, SingleAssetEuropeanOptionProductDescriptor>();
LocalDate maturityDate = Floa... | java | public Map<Double, SingleAssetEuropeanOptionProductDescriptor> getDescriptors(LocalDate referenceDate){
int numberOfStrikes = strikes.length;
HashMap<Double, SingleAssetEuropeanOptionProductDescriptor> descriptors = new HashMap<Double, SingleAssetEuropeanOptionProductDescriptor>();
LocalDate maturityDate = Floa... | [
"public",
"Map",
"<",
"Double",
",",
"SingleAssetEuropeanOptionProductDescriptor",
">",
"getDescriptors",
"(",
"LocalDate",
"referenceDate",
")",
"{",
"int",
"numberOfStrikes",
"=",
"strikes",
".",
"length",
";",
"HashMap",
"<",
"Double",
",",
"SingleAssetEuropeanOpti... | Return a collection of product descriptors for each option in the smile.
@param referenceDate The reference date (translating the maturity floating point date to dates.
@return a collection of product descriptors for each option in the smile. | [
"Return",
"a",
"collection",
"of",
"product",
"descriptors",
"for",
"each",
"option",
"in",
"the",
"smile",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java#L88-L99 | train |
finmath/finmath-lib | src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java | EuropeanOptionSmile.getDescriptor | public SingleAssetEuropeanOptionProductDescriptor getDescriptor(LocalDate referenceDate, int index) throws ArrayIndexOutOfBoundsException{
LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity);
if(index >= strikes.length) {
throw new ArrayIndexOutOfBoundsException("Stri... | java | public SingleAssetEuropeanOptionProductDescriptor getDescriptor(LocalDate referenceDate, int index) throws ArrayIndexOutOfBoundsException{
LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity);
if(index >= strikes.length) {
throw new ArrayIndexOutOfBoundsException("Stri... | [
"public",
"SingleAssetEuropeanOptionProductDescriptor",
"getDescriptor",
"(",
"LocalDate",
"referenceDate",
",",
"int",
"index",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"LocalDate",
"maturityDate",
"=",
"FloatingpointDate",
".",
"getDateFromFloatingPointDate",
"("... | Return a product descriptor for a specific strike.
@param referenceDate The reference date (translating the maturity floating point date to dates.
@param index The index corresponding to the strike grid.
@return a product descriptor for a specific strike.
@throws ArrayIndexOutOfBoundsException Thrown if index is out o... | [
"Return",
"a",
"product",
"descriptor",
"for",
"a",
"specific",
"strike",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java#L109-L116 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/AbstractCurve.java | AbstractCurve.getValues | public RandomVariable[] getValues(double[] times) {
RandomVariable[] values = new RandomVariable[times.length];
for(int i=0; i<times.length; i++) {
values[i] = getValue(null, times[i]);
}
return values;
} | java | public RandomVariable[] getValues(double[] times) {
RandomVariable[] values = new RandomVariable[times.length];
for(int i=0; i<times.length; i++) {
values[i] = getValue(null, times[i]);
}
return values;
} | [
"public",
"RandomVariable",
"[",
"]",
"getValues",
"(",
"double",
"[",
"]",
"times",
")",
"{",
"RandomVariable",
"[",
"]",
"values",
"=",
"new",
"RandomVariable",
"[",
"times",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | Return a vector of values corresponding to a given vector of times.
@param times A given vector of times.
@return A vector of values corresponding to the given vector of times. | [
"Return",
"a",
"vector",
"of",
"values",
"corresponding",
"to",
"a",
"given",
"vector",
"of",
"times",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/AbstractCurve.java#L60-L68 | train |
finmath/finmath-lib | src/main/java6/net/finmath/time/daycount/DayCountConventionFactory.java | DayCountConventionFactory.getDaycount | public static double getDaycount(LocalDate startDate, LocalDate endDate, String convention) {
DayCountConventionInterface daycountConvention = getDayCountConvention(convention);
return daycountConvention.getDaycount(startDate, endDate);
} | java | public static double getDaycount(LocalDate startDate, LocalDate endDate, String convention) {
DayCountConventionInterface daycountConvention = getDayCountConvention(convention);
return daycountConvention.getDaycount(startDate, endDate);
} | [
"public",
"static",
"double",
"getDaycount",
"(",
"LocalDate",
"startDate",
",",
"LocalDate",
"endDate",
",",
"String",
"convention",
")",
"{",
"DayCountConventionInterface",
"daycountConvention",
"=",
"getDayCountConvention",
"(",
"convention",
")",
";",
"return",
"d... | Return the number of days between startDate and endDate given the
specific daycount convention.
@param startDate The start date given as a {@link org.threeten.bp.LocalDate}.
@param endDate The end date given as a {@link org.threeten.bp.LocalDate}.
@param convention A convention string.
@return The number of days withi... | [
"Return",
"the",
"number",
"of",
"days",
"between",
"startDate",
"and",
"endDate",
"given",
"the",
"specific",
"daycount",
"convention",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/time/daycount/DayCountConventionFactory.java#L76-L79 | train |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/CMSOption.java | CMSOption.getValue | public double getValue(ForwardCurve forwardCurve, double swaprateVolatility) {
double[] swapTenor = new double[fixingDates.length+1];
System.arraycopy(fixingDates, 0, swapTenor, 0, fixingDates.length);
swapTenor[swapTenor.length-1] = paymentDates[paymentDates.length-1];
TimeDiscretization fixTenor = new TimeDi... | java | public double getValue(ForwardCurve forwardCurve, double swaprateVolatility) {
double[] swapTenor = new double[fixingDates.length+1];
System.arraycopy(fixingDates, 0, swapTenor, 0, fixingDates.length);
swapTenor[swapTenor.length-1] = paymentDates[paymentDates.length-1];
TimeDiscretization fixTenor = new TimeDi... | [
"public",
"double",
"getValue",
"(",
"ForwardCurve",
"forwardCurve",
",",
"double",
"swaprateVolatility",
")",
"{",
"double",
"[",
"]",
"swapTenor",
"=",
"new",
"double",
"[",
"fixingDates",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",... | This method returns the value of the product using a Black-Scholes model for the swap rate with the Hunt-Kennedy convexity adjustment.
The model is determined by a discount factor curve and a swap rate volatility.
@param forwardCurve The forward curve from which the swap rate is calculated. The discount curve, associa... | [
"This",
"method",
"returns",
"the",
"value",
"of",
"the",
"product",
"using",
"a",
"Black",
"-",
"Scholes",
"model",
"for",
"the",
"swap",
"rate",
"with",
"the",
"Hunt",
"-",
"Kennedy",
"convexity",
"adjustment",
".",
"The",
"model",
"is",
"determined",
"b... | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/CMSOption.java#L132-L143 | train |
finmath/finmath-lib | src/main/java6/net/finmath/marketdata/model/curves/DiscountCurveNelsonSiegelSvensson.java | DiscountCurveNelsonSiegelSvensson.getDiscountFactor | @Override
public double getDiscountFactor(AnalyticModelInterface model, double maturity)
{
// Change time scale
maturity *= timeScaling;
double beta1 = parameter[0];
double beta2 = parameter[1];
double beta3 = parameter[2];
double beta4 = parameter[3];
double tau1 = parameter[4];
double tau2 = para... | java | @Override
public double getDiscountFactor(AnalyticModelInterface model, double maturity)
{
// Change time scale
maturity *= timeScaling;
double beta1 = parameter[0];
double beta2 = parameter[1];
double beta3 = parameter[2];
double beta4 = parameter[3];
double tau1 = parameter[4];
double tau2 = para... | [
"@",
"Override",
"public",
"double",
"getDiscountFactor",
"(",
"AnalyticModelInterface",
"model",
",",
"double",
"maturity",
")",
"{",
"// Change time scale",
"maturity",
"*=",
"timeScaling",
";",
"double",
"beta1",
"=",
"parameter",
"[",
"0",
"]",
";",
"double",
... | Return the discount factor within a given model context for a given maturity.
@param model The model used as a context (not required for this class).
@param maturity The maturity in terms of ACT/365 daycount form this curve reference date. Note that this parameter might get rescaled to a different time parameter.
@see ... | [
"Return",
"the",
"discount",
"factor",
"within",
"a",
"given",
"model",
"context",
"for",
"a",
"given",
"maturity",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/DiscountCurveNelsonSiegelSvensson.java#L71-L93 | train |
finmath/finmath-lib | src/main/java/net/finmath/time/ScheduleGenerator.java | ScheduleGenerator.createScheduleFromConventions | @Deprecated
public static Schedule createScheduleFromConventions(
LocalDate referenceDate,
LocalDate startDate,
String frequency,
double maturity,
String daycountConvention,
String shortPeriodConvention,
String dateRollConvention,
BusinessdayCalendar businessdayCalendar,
int fixingOffsetDays... | java | @Deprecated
public static Schedule createScheduleFromConventions(
LocalDate referenceDate,
LocalDate startDate,
String frequency,
double maturity,
String daycountConvention,
String shortPeriodConvention,
String dateRollConvention,
BusinessdayCalendar businessdayCalendar,
int fixingOffsetDays... | [
"@",
"Deprecated",
"public",
"static",
"Schedule",
"createScheduleFromConventions",
"(",
"LocalDate",
"referenceDate",
",",
"LocalDate",
"startDate",
",",
"String",
"frequency",
",",
"double",
"maturity",
",",
"String",
"daycountConvention",
",",
"String",
"shortPeriodC... | Generates a schedule based on some meta data. The schedule generation
considers short periods.
@param referenceDate The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
@param startDate The start date of the first period.
@param frequency The frequency.
@param maturi... | [
"Generates",
"a",
"schedule",
"based",
"on",
"some",
"meta",
"data",
".",
"The",
"schedule",
"generation",
"considers",
"short",
"periods",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/ScheduleGenerator.java#L745-L774 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/locallinearregression/CurveEstimation.java | CurveEstimation.getRegressionCurve | public Curve getRegressionCurve(){
// @TODO Add threadsafe lazy init.
if(regressionCurve !=null) {
return regressionCurve;
}
DoubleMatrix a = solveEquationSystem();
double[] curvePoints=new double[partition.getLength()];
curvePoints[0]=a.get(0);
for(int i=1;i<curvePoints.length;i++) {
curvePoints[i]... | java | public Curve getRegressionCurve(){
// @TODO Add threadsafe lazy init.
if(regressionCurve !=null) {
return regressionCurve;
}
DoubleMatrix a = solveEquationSystem();
double[] curvePoints=new double[partition.getLength()];
curvePoints[0]=a.get(0);
for(int i=1;i<curvePoints.length;i++) {
curvePoints[i]... | [
"public",
"Curve",
"getRegressionCurve",
"(",
")",
"{",
"// @TODO Add threadsafe lazy init.",
"if",
"(",
"regressionCurve",
"!=",
"null",
")",
"{",
"return",
"regressionCurve",
";",
"}",
"DoubleMatrix",
"a",
"=",
"solveEquationSystem",
"(",
")",
";",
"double",
"["... | Returns the curve resulting from the local linear regression with discrete kernel.
@return The regression curve. | [
"Returns",
"the",
"curve",
"resulting",
"from",
"the",
"local",
"linear",
"regression",
"with",
"discrete",
"kernel",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/locallinearregression/CurveEstimation.java#L123-L142 | train |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/products/Cap.java | Cap.getValueAsPrice | public double getValueAsPrice(double evaluationTime, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
DiscountCurve discountCurveForForward = null;
if(forwardCurve == null && forwardCurveName != ... | java | public double getValueAsPrice(double evaluationTime, AnalyticModel model) {
ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
DiscountCurve discountCurveForForward = null;
if(forwardCurve == null && forwardCurveName != ... | [
"public",
"double",
"getValueAsPrice",
"(",
"double",
"evaluationTime",
",",
"AnalyticModel",
"model",
")",
"{",
"ForwardCurve",
"forwardCurve",
"=",
"model",
".",
"getForwardCurve",
"(",
"forwardCurveName",
")",
";",
"DiscountCurve",
"discountCurve",
"=",
"model",
... | Returns the value of this product under the given model.
@param evaluationTime Evaluation time.
@param model The model.
@return Value of this product und the given model. | [
"Returns",
"the",
"value",
"of",
"this",
"product",
"under",
"the",
"given",
"model",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/products/Cap.java#L115-L183 | train |
finmath/finmath-lib | src/main/java6/net/finmath/optimizer/LevenbergMarquardt.java | LevenbergMarquardt.setDerivatives | public void setDerivatives(double[] parameters, double[][] derivatives) throws SolverException {
// Calculate new derivatives. Note that this method is called only with
// parameters = parameterCurrent, so we may use valueCurrent.
Vector<Future<double[]>> valueFutures = new Vector<Future<double[]>>(parameterCurr... | java | public void setDerivatives(double[] parameters, double[][] derivatives) throws SolverException {
// Calculate new derivatives. Note that this method is called only with
// parameters = parameterCurrent, so we may use valueCurrent.
Vector<Future<double[]>> valueFutures = new Vector<Future<double[]>>(parameterCurr... | [
"public",
"void",
"setDerivatives",
"(",
"double",
"[",
"]",
"parameters",
",",
"double",
"[",
"]",
"[",
"]",
"derivatives",
")",
"throws",
"SolverException",
"{",
"// Calculate new derivatives. Note that this method is called only with",
"// parameters = parameterCurrent, so... | The derivative of the objective function. You may override this method
if you like to implement your own derivative.
@param parameters Input value. The parameter vector.
@param derivatives Output value, where derivatives[i][j] is d(value(j)) / d(parameters(i)
@throws SolverException Thrown if the valuation fails, spec... | [
"The",
"derivative",
"of",
"the",
"objective",
"function",
".",
"You",
"may",
"override",
"this",
"method",
"if",
"you",
"like",
"to",
"implement",
"your",
"own",
"derivative",
"."
] | a3c067d52dd33feb97d851df6cab130e4116759f | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/optimizer/LevenbergMarquardt.java#L547-L613 | train |
spring-cloud/spring-cloud-stream-app-starters | processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfiguration.java | TasklaunchrequestTransformProcessorConfiguration.parseParams | private List<String> parseParams(String param) {
Assert.hasText(param, "param must not be empty nor null");
List<String> paramsToUse = new ArrayList<>();
Matcher regexMatcher = DEPLOYMENT_PARAMS_PATTERN.matcher(param);
int start = 0;
while (regexMatcher.find()) {
String p = removeQuoting(param.substring(st... | java | private List<String> parseParams(String param) {
Assert.hasText(param, "param must not be empty nor null");
List<String> paramsToUse = new ArrayList<>();
Matcher regexMatcher = DEPLOYMENT_PARAMS_PATTERN.matcher(param);
int start = 0;
while (regexMatcher.find()) {
String p = removeQuoting(param.substring(st... | [
"private",
"List",
"<",
"String",
">",
"parseParams",
"(",
"String",
"param",
")",
"{",
"Assert",
".",
"hasText",
"(",
"param",
",",
"\"param must not be empty nor null\"",
")",
";",
"List",
"<",
"String",
">",
"paramsToUse",
"=",
"new",
"ArrayList",
"<>",
"... | Parses a string of space delimited command line parameters and returns a
list of parameters which doesn't contain any special quoting either for
values or whole parameter.
@param param string containing a list
@return the list | [
"Parses",
"a",
"string",
"of",
"space",
"delimited",
"command",
"line",
"parameters",
"and",
"returns",
"a",
"list",
"of",
"parameters",
"which",
"doesn",
"t",
"contain",
"any",
"special",
"quoting",
"either",
"for",
"values",
"or",
"whole",
"parameter",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfigura... | train |
spring-cloud/spring-cloud-stream-app-starters | gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/support/SqlUtils.java | SqlUtils.load | public static String load(LoadConfiguration config, String prefix) {
if (config.getMode() == Mode.INSERT) {
return loadInsert(config, prefix);
}
else if (config.getMode() == Mode.UPDATE) {
return loadUpdate(config, prefix);
}
throw new IllegalArgumentException("Unsupported mode " + config.getMode());
} | java | public static String load(LoadConfiguration config, String prefix) {
if (config.getMode() == Mode.INSERT) {
return loadInsert(config, prefix);
}
else if (config.getMode() == Mode.UPDATE) {
return loadUpdate(config, prefix);
}
throw new IllegalArgumentException("Unsupported mode " + config.getMode());
} | [
"public",
"static",
"String",
"load",
"(",
"LoadConfiguration",
"config",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"config",
".",
"getMode",
"(",
")",
"==",
"Mode",
".",
"INSERT",
")",
"{",
"return",
"loadInsert",
"(",
"config",
",",
"prefix",
")",
... | Builds sql clause to load data into a database.
@param config Load configuration.
@param prefix Prefix for temporary resources.
@return the load DDL | [
"Builds",
"sql",
"clause",
"to",
"load",
"data",
"into",
"a",
"database",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/support/SqlUtils.java#L158-L166 | train |
spring-cloud/spring-cloud-stream-app-starters | triggertask/spring-cloud-starter-stream-source-triggertask/src/main/java/org/springframework/cloud/stream/app/triggertask/source/TriggertaskSourceConfiguration.java | TriggertaskSourceConfiguration.parseProperties | public static Map<String, String> parseProperties(String s) {
Map<String, String> properties = new HashMap<String, String>();
if (!StringUtils.isEmpty(s)) {
Matcher matcher = PROPERTIES_PATTERN.matcher(s);
int start = 0;
while (matcher.find()) {
addKeyValuePairAsProperty(s.substring(start, matcher.star... | java | public static Map<String, String> parseProperties(String s) {
Map<String, String> properties = new HashMap<String, String>();
if (!StringUtils.isEmpty(s)) {
Matcher matcher = PROPERTIES_PATTERN.matcher(s);
int start = 0;
while (matcher.find()) {
addKeyValuePairAsProperty(s.substring(start, matcher.star... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"parseProperties",
"(",
"String",
"s",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",... | Parses a String comprised of 0 or more comma-delimited key=value pairs.
@param s the string to parse
@return the Map of parsed key value pairs | [
"Parses",
"a",
"String",
"comprised",
"of",
"0",
"or",
"more",
"comma",
"-",
"delimited",
"key",
"=",
"value",
"pairs",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/triggertask/spring-cloud-starter-stream-source-triggertask/src/main/java/org/springframework/cloud/stream/app/triggertask/source/TriggertaskSourceConfiguration.java#L93-L105 | train |
spring-cloud/spring-cloud-stream-app-starters | gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/GpfdistServer.java | GpfdistServer.start | public synchronized HttpServer<Buffer, Buffer> start() throws Exception {
if (server == null) {
server = createProtocolListener();
}
return server;
} | java | public synchronized HttpServer<Buffer, Buffer> start() throws Exception {
if (server == null) {
server = createProtocolListener();
}
return server;
} | [
"public",
"synchronized",
"HttpServer",
"<",
"Buffer",
",",
"Buffer",
">",
"start",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"server",
"==",
"null",
")",
"{",
"server",
"=",
"createProtocolListener",
"(",
")",
";",
"}",
"return",
"server",
";",
"... | Start a server.
@return the http server
@throws Exception the exception | [
"Start",
"a",
"server",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/GpfdistServer.java#L82-L87 | train |
spring-cloud/spring-cloud-stream-app-starters | gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/support/ReadableTableFactoryBean.java | ReadableTableFactoryBean.setSegmentReject | public void setSegmentReject(String reject) {
if (!StringUtils.hasText(reject)) {
return;
}
Integer parsedLimit = null;
try {
parsedLimit = Integer.parseInt(reject);
segmentRejectType = SegmentRejectType.ROWS;
} catch (NumberFormatException e) {
}
if (parsedLimit == null && reject.contains("%")) ... | java | public void setSegmentReject(String reject) {
if (!StringUtils.hasText(reject)) {
return;
}
Integer parsedLimit = null;
try {
parsedLimit = Integer.parseInt(reject);
segmentRejectType = SegmentRejectType.ROWS;
} catch (NumberFormatException e) {
}
if (parsedLimit == null && reject.contains("%")) ... | [
"public",
"void",
"setSegmentReject",
"(",
"String",
"reject",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"reject",
")",
")",
"{",
"return",
";",
"}",
"Integer",
"parsedLimit",
"=",
"null",
";",
"try",
"{",
"parsedLimit",
"=",
"Integer... | Sets the segment reject as a string. This method is for convenience
to be able to set percent reject type just by calling with '3%' and
otherwise it uses rows. All this assuming that parsing finds '%' characher
and is able to parse a raw reject number.
@param reject the new segment reject | [
"Sets",
"the",
"segment",
"reject",
"as",
"a",
"string",
".",
"This",
"method",
"is",
"for",
"convenience",
"to",
"be",
"able",
"to",
"set",
"percent",
"reject",
"type",
"just",
"by",
"calling",
"with",
"3%",
"and",
"otherwise",
"it",
"uses",
"rows",
"."... | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/gpfdist/spring-cloud-starter-stream-sink-gpfdist/src/main/java/org/springframework/cloud/stream/app/gpfdist/sink/support/ReadableTableFactoryBean.java#L133-L151 | train |
spring-cloud/spring-cloud-stream-app-starters | twitter/spring-cloud-starter-stream-source-twitterstream/src/main/java/org/springframework/cloud/stream/app/twitterstream/source/AbstractTwitterInboundChannelAdapter.java | AbstractTwitterInboundChannelAdapter.setReadTimeout | public void setReadTimeout(int millis) {
// Hack to get round Spring's dynamic loading of http client stuff
ClientHttpRequestFactory f = getRequestFactory();
if (f instanceof SimpleClientHttpRequestFactory) {
((SimpleClientHttpRequestFactory) f).setReadTimeout(millis);
}
else {
((HttpComponentsClientHtt... | java | public void setReadTimeout(int millis) {
// Hack to get round Spring's dynamic loading of http client stuff
ClientHttpRequestFactory f = getRequestFactory();
if (f instanceof SimpleClientHttpRequestFactory) {
((SimpleClientHttpRequestFactory) f).setReadTimeout(millis);
}
else {
((HttpComponentsClientHtt... | [
"public",
"void",
"setReadTimeout",
"(",
"int",
"millis",
")",
"{",
"// Hack to get round Spring's dynamic loading of http client stuff",
"ClientHttpRequestFactory",
"f",
"=",
"getRequestFactory",
"(",
")",
";",
"if",
"(",
"f",
"instanceof",
"SimpleClientHttpRequestFactory",
... | The read timeout for the underlying URLConnection to the twitter stream. | [
"The",
"read",
"timeout",
"for",
"the",
"underlying",
"URLConnection",
"to",
"the",
"twitter",
"stream",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/twitter/spring-cloud-starter-stream-source-twitterstream/src/main/java/org/springframework/cloud/stream/app/twitterstream/source/AbstractTwitterInboundChannelAdapter.java#L83-L92 | train |
spring-cloud/spring-cloud-stream-app-starters | twitter/spring-cloud-starter-stream-source-twitterstream/src/main/java/org/springframework/cloud/stream/app/twitterstream/source/AbstractTwitterInboundChannelAdapter.java | AbstractTwitterInboundChannelAdapter.setConnectTimeout | public void setConnectTimeout(int millis) {
ClientHttpRequestFactory f = getRequestFactory();
if (f instanceof SimpleClientHttpRequestFactory) {
((SimpleClientHttpRequestFactory) f).setConnectTimeout(millis);
}
else {
((HttpComponentsClientHttpRequestFactory) f).setConnectTimeout(millis);
}
} | java | public void setConnectTimeout(int millis) {
ClientHttpRequestFactory f = getRequestFactory();
if (f instanceof SimpleClientHttpRequestFactory) {
((SimpleClientHttpRequestFactory) f).setConnectTimeout(millis);
}
else {
((HttpComponentsClientHttpRequestFactory) f).setConnectTimeout(millis);
}
} | [
"public",
"void",
"setConnectTimeout",
"(",
"int",
"millis",
")",
"{",
"ClientHttpRequestFactory",
"f",
"=",
"getRequestFactory",
"(",
")",
";",
"if",
"(",
"f",
"instanceof",
"SimpleClientHttpRequestFactory",
")",
"{",
"(",
"(",
"SimpleClientHttpRequestFactory",
")"... | The connection timeout for making a connection to Twitter. | [
"The",
"connection",
"timeout",
"for",
"making",
"a",
"connection",
"to",
"Twitter",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/twitter/spring-cloud-starter-stream-source-twitterstream/src/main/java/org/springframework/cloud/stream/app/twitterstream/source/AbstractTwitterInboundChannelAdapter.java#L97-L105 | train |
spring-cloud/spring-cloud-stream-app-starters | websocket/spring-cloud-starter-stream-sink-websocket/src/main/java/org/springframework/cloud/stream/app/websocket/sink/WebsocketSinkServerHandler.java | WebsocketSinkServerHandler.handleTextWebSocketFrameInternal | private void handleTextWebSocketFrameInternal(TextWebSocketFrame frame, ChannelHandlerContext ctx) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("%s received %s", ctx.channel(), frame.text()));
}
addTraceForFrame(frame, "text");
ctx.channel().write(new TextWebSocketFrame("Echo: " + frame.text(... | java | private void handleTextWebSocketFrameInternal(TextWebSocketFrame frame, ChannelHandlerContext ctx) {
if (logger.isTraceEnabled()) {
logger.trace(String.format("%s received %s", ctx.channel(), frame.text()));
}
addTraceForFrame(frame, "text");
ctx.channel().write(new TextWebSocketFrame("Echo: " + frame.text(... | [
"private",
"void",
"handleTextWebSocketFrameInternal",
"(",
"TextWebSocketFrame",
"frame",
",",
"ChannelHandlerContext",
"ctx",
")",
"{",
"if",
"(",
"logger",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"String",
".",
"format",
"(",
... | simple echo implementation | [
"simple",
"echo",
"implementation"
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/websocket/spring-cloud-starter-stream-sink-websocket/src/main/java/org/springframework/cloud/stream/app/websocket/sink/WebsocketSinkServerHandler.java#L157-L164 | train |
spring-cloud/spring-cloud-stream-app-starters | websocket/spring-cloud-starter-stream-sink-websocket/src/main/java/org/springframework/cloud/stream/app/websocket/sink/WebsocketSinkServerHandler.java | WebsocketSinkServerHandler.addTraceForFrame | private void addTraceForFrame(WebSocketFrame frame, String type) {
Map<String, Object> trace = new LinkedHashMap<>();
trace.put("type", type);
trace.put("direction", "in");
if (frame instanceof TextWebSocketFrame) {
trace.put("payload", ((TextWebSocketFrame) frame).text());
}
if (traceEnabled) {
webs... | java | private void addTraceForFrame(WebSocketFrame frame, String type) {
Map<String, Object> trace = new LinkedHashMap<>();
trace.put("type", type);
trace.put("direction", "in");
if (frame instanceof TextWebSocketFrame) {
trace.put("payload", ((TextWebSocketFrame) frame).text());
}
if (traceEnabled) {
webs... | [
"private",
"void",
"addTraceForFrame",
"(",
"WebSocketFrame",
"frame",
",",
"String",
"type",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"trace",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"trace",
".",
"put",
"(",
"\"type\"",
",",
"type"... | add trace information for received frame | [
"add",
"trace",
"information",
"for",
"received",
"frame"
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/websocket/spring-cloud-starter-stream-sink-websocket/src/main/java/org/springframework/cloud/stream/app/websocket/sink/WebsocketSinkServerHandler.java#L167-L178 | train |
spring-cloud/spring-cloud-stream-app-starters | mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java | MailSourceConfiguration.getFlowBuilder | @SuppressWarnings({ "rawtypes", "unchecked" })
private IntegrationFlowBuilder getFlowBuilder() {
IntegrationFlowBuilder flowBuilder;
URLName urlName = this.properties.getUrl();
if (this.properties.isIdleImap()) {
flowBuilder = getIdleImapFlow(urlName);
}
else {
MailInboundChannelAdapterSpec adapterS... | java | @SuppressWarnings({ "rawtypes", "unchecked" })
private IntegrationFlowBuilder getFlowBuilder() {
IntegrationFlowBuilder flowBuilder;
URLName urlName = this.properties.getUrl();
if (this.properties.isIdleImap()) {
flowBuilder = getIdleImapFlow(urlName);
}
else {
MailInboundChannelAdapterSpec adapterS... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"IntegrationFlowBuilder",
"getFlowBuilder",
"(",
")",
"{",
"IntegrationFlowBuilder",
"flowBuilder",
";",
"URLName",
"urlName",
"=",
"this",
".",
"properties",
".",
"getUrl"... | Method to build Integration Flow for Mail. Suppress Warnings for
MailInboundChannelAdapterSpec.
@return Integration Flow object for Mail Source | [
"Method",
"to",
"build",
"Integration",
"Flow",
"for",
"Mail",
".",
"Suppress",
"Warnings",
"for",
"MailInboundChannelAdapterSpec",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java#L73-L114 | train |
spring-cloud/spring-cloud-stream-app-starters | mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java | MailSourceConfiguration.getIdleImapFlow | private IntegrationFlowBuilder getIdleImapFlow(URLName urlName) {
return IntegrationFlows.from(Mail.imapIdleAdapter(urlName.toString())
.shouldDeleteMessages(this.properties.isDelete())
.javaMailProperties(getJavaMailProperties(urlName))
.selectorExpression(this.properties.getExpression())
.shouldMark... | java | private IntegrationFlowBuilder getIdleImapFlow(URLName urlName) {
return IntegrationFlows.from(Mail.imapIdleAdapter(urlName.toString())
.shouldDeleteMessages(this.properties.isDelete())
.javaMailProperties(getJavaMailProperties(urlName))
.selectorExpression(this.properties.getExpression())
.shouldMark... | [
"private",
"IntegrationFlowBuilder",
"getIdleImapFlow",
"(",
"URLName",
"urlName",
")",
"{",
"return",
"IntegrationFlows",
".",
"from",
"(",
"Mail",
".",
"imapIdleAdapter",
"(",
"urlName",
".",
"toString",
"(",
")",
")",
".",
"shouldDeleteMessages",
"(",
"this",
... | Method to build Integration flow for IMAP Idle configuration.
@param urlName Mail source URL.
@return Integration Flow object IMAP IDLE. | [
"Method",
"to",
"build",
"Integration",
"flow",
"for",
"IMAP",
"Idle",
"configuration",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java#L121-L127 | train |
spring-cloud/spring-cloud-stream-app-starters | mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java | MailSourceConfiguration.getImapFlowBuilder | @SuppressWarnings("rawtypes")
private MailInboundChannelAdapterSpec getImapFlowBuilder(URLName urlName) {
return Mail.imapInboundAdapter(urlName.toString())
.shouldMarkMessagesAsRead(this.properties.isMarkAsRead());
} | java | @SuppressWarnings("rawtypes")
private MailInboundChannelAdapterSpec getImapFlowBuilder(URLName urlName) {
return Mail.imapInboundAdapter(urlName.toString())
.shouldMarkMessagesAsRead(this.properties.isMarkAsRead());
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"MailInboundChannelAdapterSpec",
"getImapFlowBuilder",
"(",
"URLName",
"urlName",
")",
"{",
"return",
"Mail",
".",
"imapInboundAdapter",
"(",
"urlName",
".",
"toString",
"(",
")",
")",
".",
"shouldMarkMes... | Method to build Mail Channel Adapter for IMAP.
@param urlName Mail source URL.
@return Mail Channel for IMAP | [
"Method",
"to",
"build",
"Mail",
"Channel",
"Adapter",
"for",
"IMAP",
"."
] | c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9 | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/mail/spring-cloud-starter-stream-source-mail/src/main/java/org/springframework/cloud/stream/app/mail/source/MailSourceConfiguration.java#L144-L148 | train |
spring-projects/spring-social-facebook | spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/CanvasSignInController.java | CanvasSignInController.postDeclineView | protected View postDeclineView() {
return new TopLevelWindowRedirect() {
@Override
protected String getRedirectUrl(Map<String, ?> model) {
return postDeclineUrl;
}
};
} | java | protected View postDeclineView() {
return new TopLevelWindowRedirect() {
@Override
protected String getRedirectUrl(Map<String, ?> model) {
return postDeclineUrl;
}
};
} | [
"protected",
"View",
"postDeclineView",
"(",
")",
"{",
"return",
"new",
"TopLevelWindowRedirect",
"(",
")",
"{",
"@",
"Override",
"protected",
"String",
"getRedirectUrl",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"model",
")",
"{",
"return",
"postDeclineUrl",
... | View that redirects the top level window to the URL defined in postDeclineUrl property after user declines to authorize application.
May be overridden for custom views, particularly in the case where the post-decline view should be rendered in-canvas.
@return a view to display after a user declines authoriation. Defaul... | [
"View",
"that",
"redirects",
"the",
"top",
"level",
"window",
"to",
"the",
"URL",
"defined",
"in",
"postDeclineUrl",
"property",
"after",
"user",
"declines",
"to",
"authorize",
"application",
".",
"May",
"be",
"overridden",
"for",
"custom",
"views",
"particularl... | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/CanvasSignInController.java#L165-L172 | train |
spring-projects/spring-social-facebook | spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java | SignedRequestDecoder.decodeSignedRequest | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} | java | @SuppressWarnings("unchecked")
public Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {
return decodeSignedRequest(signedRequest, Map.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Map",
"<",
"String",
",",
"?",
">",
"decodeSignedRequest",
"(",
"String",
"signedRequest",
")",
"throws",
"SignedRequestException",
"{",
"return",
"decodeSignedRequest",
"(",
"signedRequest",
",",
"Map",... | Decodes a signed request, returning the payload of the signed request as a Map
@param signedRequest the value of the signed_request parameter sent by Facebook.
@return the payload of the signed request as a Map
@throws SignedRequestException if there is an error decoding the signed request | [
"Decodes",
"a",
"signed",
"request",
"returning",
"the",
"payload",
"of",
"the",
"signed",
"request",
"as",
"a",
"Map"
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java#L58-L61 | train |
spring-projects/spring-social-facebook | spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java | SignedRequestDecoder.decodeSignedRequest | public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException {
String[] split = signedRequest.split("\\.");
String encodedSignature = split[0];
String payload = split[1];
String decoded = base64DecodeToString(payload);
byte[] signature = base64DecodeToBytes(encodedSi... | java | public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException {
String[] split = signedRequest.split("\\.");
String encodedSignature = split[0];
String payload = split[1];
String decoded = base64DecodeToString(payload);
byte[] signature = base64DecodeToBytes(encodedSi... | [
"public",
"<",
"T",
">",
"T",
"decodeSignedRequest",
"(",
"String",
"signedRequest",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"SignedRequestException",
"{",
"String",
"[",
"]",
"split",
"=",
"signedRequest",
".",
"split",
"(",
"\"\\\\.\"",
")",
... | Decodes a signed request, returning the payload of the signed request as a specified type.
@param signedRequest the value of the signed_request parameter sent by Facebook.
@param type the type to bind the signed_request to.
@param <T> the Java type to bind the signed_request to.
@return the payload of the signed reques... | [
"Decodes",
"a",
"signed",
"request",
"returning",
"the",
"payload",
"of",
"the",
"signed",
"request",
"as",
"a",
"specified",
"type",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java#L71-L91 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getString | public String getString(String fieldName) {
return hasValue(fieldName) ? String.valueOf(resultMap.get(fieldName)) : null;
} | java | public String getString(String fieldName) {
return hasValue(fieldName) ? String.valueOf(resultMap.get(fieldName)) : null;
} | [
"public",
"String",
"getString",
"(",
"String",
"fieldName",
")",
"{",
"return",
"hasValue",
"(",
"fieldName",
")",
"?",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
"(",
"fieldName",
")",
")",
":",
"null",
";",
"}"
] | Returns the value of the identified field as a String.
@param fieldName the name of the field
@return the value of the field as a String | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"a",
"String",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L45-L47 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getInteger | public Integer getInteger(String fieldName) {
try {
return hasValue(fieldName) ? Integer.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | java | public Integer getInteger(String fieldName) {
try {
return hasValue(fieldName) ? Integer.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | [
"public",
"Integer",
"getInteger",
"(",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"hasValue",
"(",
"fieldName",
")",
"?",
"Integer",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
"(",
"fieldName",
")",
")",
")"... | Returns the value of the identified field as an Integer.
@param fieldName the name of the field
@return the value of the field as an Integer
@throws FqlException if the field cannot be expressed as an Integer | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"an",
"Integer",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L55-L61 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getLong | public Long getLong(String fieldName) {
try {
return hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | java | public Long getLong(String fieldName) {
try {
return hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | [
"public",
"Long",
"getLong",
"(",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"hasValue",
"(",
"fieldName",
")",
"?",
"Long",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
"(",
"fieldName",
")",
")",
")",
":",
... | Returns the value of the identified field as a Long.
@param fieldName the name of the field
@return the value of the field as a Long
@throws FqlException if the field cannot be expressed as an Long | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"a",
"Long",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L69-L75 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getFloat | public Float getFloat(String fieldName) {
try {
return hasValue(fieldName) ? Float.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | java | public Float getFloat(String fieldName) {
try {
return hasValue(fieldName) ? Float.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a number.", e);
}
} | [
"public",
"Float",
"getFloat",
"(",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"hasValue",
"(",
"fieldName",
")",
"?",
"Float",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
"(",
"fieldName",
")",
")",
")",
":... | Returns the value of the identified field as a Float.
@param fieldName the name of the field
@return the value of the field as a Float
@throws FqlException if the field cannot be expressed as an Float | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"a",
"Float",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L83-L89 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getBoolean | public Boolean getBoolean(String fieldName) {
return hasValue(fieldName) ? Boolean.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} | java | public Boolean getBoolean(String fieldName) {
return hasValue(fieldName) ? Boolean.valueOf(String.valueOf(resultMap.get(fieldName))) : null;
} | [
"public",
"Boolean",
"getBoolean",
"(",
"String",
"fieldName",
")",
"{",
"return",
"hasValue",
"(",
"fieldName",
")",
"?",
"Boolean",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
"(",
"fieldName",
")",
")",
")",
":",
"null... | Returns the value of the identified field as a Boolean.
@param fieldName the name of the field
@return the value of the field as a Boolean | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"a",
"Boolean",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L96-L98 | train |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getTime | public Date getTime(String fieldName) {
try {
if (hasValue(fieldName)) {
return new Date(Long.valueOf(String.valueOf(resultMap.get(fieldName))) * 1000);
} else {
return null;
}
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a time.", e);
}
} | java | public Date getTime(String fieldName) {
try {
if (hasValue(fieldName)) {
return new Date(Long.valueOf(String.valueOf(resultMap.get(fieldName))) * 1000);
} else {
return null;
}
} catch (NumberFormatException e) {
throw new FqlException("Field '" + fieldName +"' is not a time.", e);
}
} | [
"public",
"Date",
"getTime",
"(",
"String",
"fieldName",
")",
"{",
"try",
"{",
"if",
"(",
"hasValue",
"(",
"fieldName",
")",
")",
"{",
"return",
"new",
"Date",
"(",
"Long",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"resultMap",
".",
"get",
... | Returns the value of the identified field as a Date.
Time fields returned from an FQL query are expressed in terms of seconds since midnight, January 1, 1970 UTC.
@param fieldName the name of the field
@return the value of the field as a Date
@throws FqlException if the field's value cannot be expressed as a long value... | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"a",
"Date",
".",
"Time",
"fields",
"returned",
"from",
"an",
"FQL",
"query",
"are",
"expressed",
"in",
"terms",
"of",
"seconds",
"since",
"midnight",
"January",
"1",
"1970",
"UTC",
"."
] | ae2234d94367eaa3adbba251ec7790d5ba7ffa41 | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L107-L117 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.