diff --git a/.circleci/config.yml b/.circleci/config.yml index 76c1f0c3dc53..2153c0d436b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: docker: # specify the version you desire here - - image: circleci/openjdk:8-jdk + - image: cimg/openjdk:21.0.0 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..097f9f98d9ee --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/.gitignore b/.gitignore index ae3c1726048c..2c40bade53d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ /bin/ + +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build diff --git a/.gradle/3.5/file-changes/last-build.bin b/.gradle/3.5/file-changes/last-build.bin deleted file mode 100644 index f76dd238ade0..000000000000 Binary files a/.gradle/3.5/file-changes/last-build.bin and /dev/null differ diff --git a/.gradle/3.5/taskHistory/taskHistory.lock b/.gradle/3.5/taskHistory/taskHistory.lock deleted file mode 100644 index 2b792ef1e526..000000000000 Binary files a/.gradle/3.5/taskHistory/taskHistory.lock and /dev/null differ diff --git a/.gradle/buildOutputCleanup/built.bin b/.gradle/buildOutputCleanup/built.bin deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties index eaff4c40f728..541149d60ff9 100644 --- a/.gradle/buildOutputCleanup/cache.properties +++ b/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Mon Jan 27 20:33:56 EST 2020 -gradle.version=3.5 +#Sun Dec 10 00:00:07 EST 2023 +gradle.version=8.5 diff --git a/.gradle/buildOutputCleanup/cache.properties.lock b/.gradle/buildOutputCleanup/cache.properties.lock deleted file mode 100644 index 40fdece9d24d..000000000000 --- a/.gradle/buildOutputCleanup/cache.properties.lock +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000000..26d33521af10 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000000..919ce1f1f772 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000000..a55e7a179bde --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000000..1706379d5797 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 000000000000..f3716ac5987a --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/google-java-format.xml b/.idea/google-java-format.xml new file mode 100644 index 000000000000..2aa056da349d --- /dev/null +++ b/.idea/google-java-format.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 000000000000..7d3b3e857acb --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 000000000000..fdc392fe877c --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml new file mode 100644 index 000000000000..966d5f56a995 --- /dev/null +++ b/.idea/jpa-buddy.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000000..1d750a67f07a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000000..35eb1ddfbbc0 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7d330d64b9da..c1b4e4596bd2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,72 +1,88 @@ -buildscript -{ - repositories - { - jcenter() - mavenCentral() - maven - { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "ru.vyarus:gradle-animalsniffer-plugin:1.2.0" - classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.13.1" - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3" - classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.5.2" - classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0' - } +import com.github.spotbugs.snom.Confidence +import com.github.spotbugs.snom.Effort +import com.github.spotbugs.snom.SpotBugsTask + +import java.lang.management.ManagementFactory + +plugins { + id 'build-dashboard' + id 'jacoco' + id 'java-library' + id 'project-report' + id 'maven-publish' + id 'com.dorongold.task-tree' + id 'com.github.andygoossens.gradle-modernizer-plugin' + id 'com.github.ben-manes.versions' + id 'com.github.hierynomus.license-base' + id 'com.github.spotbugs' + id 'com.jfrog.bintray' + id 'org.kordamp.gradle.coveralls' + id 'org.kordamp.gradle.jdeps' + id 'ru.vyarus.animalsniffer' } group = "org.drip" ext.githubProjectName = "DROP" - version = project.properties["release.version"] +description = "DROP implements the model libraries and provides systems for fixed income valuation and adjustments, asset allocation and transaction cost analytics, and supporting libraries in numerical optimization and statistical learning." -def releaseTag = System.getenv("TRAVIS_TAG"); -if (releaseTag != null && !releaseTag.isEmpty()) -{ - if (releaseTag.startsWith("v")) - { - releaseTag = releaseTag.substring(1); +def releaseTag = System.getenv("TRAVIS_TAG") +if (releaseTag != null && !releaseTag.isEmpty()) { + if (releaseTag.startsWith("v")) { + releaseTag = releaseTag.substring(1) } - version = releaseTag; - project.properties.put("release.version", releaseTag); + version = releaseTag + project.properties.put("release.version", releaseTag) - println("Releasing with version " + version); + println("Releasing with version " + version) } -description = "DROP implements the model libraries and provides systems for fixed income valuation and adjustments, asset allocation and transaction cost analytics, and supporting libraries in numerical optimization and statistical learning." +repositories { + mavenCentral() +} -apply plugin: "java-library" -apply plugin: "jacoco" -apply plugin: "maven" -apply plugin: "osgi" -apply plugin: "com.github.hierynomus.license" -apply plugin: "com.jfrog.bintray" -apply plugin: "com.jfrog.artifactory" -apply plugin: "com.github.kt3k.coveralls" +dependencies { + compileOnly "com.github.spotbugs:spotbugs-annotations:$spotbugsVersion" + compileOnly "com.github.stephenc.jcip:jcip-annotations:$jcipAnnotationsVersion" + compileOnly "com.google.code.findbugs:findbugs-annotations:$findbugsAnnotationsVersion" + compileOnly "org.apache.commons:commons-math3:$commonsMathVersion" + compileOnly "org.gaul:modernizer-maven-annotations:$modernizerVersion" -repositories -{ - mavenCentral() + testCompileOnly "com.google.code.findbugs:findbugs-annotations:$findbugsAnnotationsVersion" + + testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" + testImplementation "org.assertj:assertj-core:$assertJVersion" + testImplementation "org.mockito:mockito-core:$mockitoVersion" + + // Quiet build -- build works without this, but JUnit complains + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion" + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + + spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:$findsecbugsPluginVersion" } -dependencies -{ - api 'org.apache.commons:commons-math3:3.6.1' - testImplementation 'junit:junit:4.12' +sourceSets { + integrationTest { + compileClasspath += sourceSets.main.output + compileClasspath += sourceSets.test.output + runtimeClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.test.output + } } -javadoc -{ +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of("$jdkVersion")) + } +} + +javadoc { failOnError = false exclude "**/internal/**" exclude "**/perf/**" exclude "**/test/**" exclude "**/zen/**" - options - { + options { windowTitle = "DROP Javadoc ${project.version}" } options.addStringOption("top").value = "" @@ -76,178 +92,214 @@ javadoc options.links("http://docs.oracle.com/javase/7/docs/api/") } -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = "javadoc" - from javadoc.destinationDir -} - -artifacts { - archives jar - archives sourcesJar - archives javadocJar -} - -jar { - manifest { - instruction "Bundle-Vendor", "DROP Contributors" - instruction "Bundle-DocURL", "https://github.com/lakshmiDRIP/DROP" - instruction "Import-Package", "!org.junit,!junit.framework,*" - instruction "Eclipse-ExtensibleAPI", "true" - instruction "Automatic-Module-Name", "org.drip" - } -} - -license -{ - header rootProject.file("HEADER") - ext.year = Calendar.getInstance().get(Calendar.YEAR) - skipExistingHeaders true - ignoreFailures true - excludes(["**/*.md", "**/*.txt"]) +tasks.withType(JavaCompile).configureEach { + // commented out for now to allow empty statement, lossy-conversions related issues + // options.compilerArgs += ["-Werror", "-Xlint:all,-processing", "-parameters"] + options.encoding = 'Cp1252' } -apply plugin: "maven-publish" - -install -{ - repositories.mavenInstaller.pom.project - { - name "DROP" - description "Fixed Income, Portfolio Construction, XVA, TCost Libraries" - url "https://github.com/lakshmiDRIP/DROP" - licenses - { - license - { - name "The Apache Software License, Version 2.0" - url "http://www.apache.org/licenses/LICENSE-2.0.txt" - distribution "repo" - } - } - developers - { - developer - { - id "lakshmiDRIP" - name "Lakshmi Krishnamurthy" - email "lakshmimv7977@gmail.com" - } - } - scm - { - connection "scm:git:git@github.com:lakshmiDRIP/DROP.git" - url "scm:git:git@github.com:lakshmiDRIP/DROP.git" - developerConnection "scm:git:git@github.com:lakshmiDRIP/DROP.git" - } - issueManagement - { - system "github" - url "https://github.com/lakshmiDRIP/DROP/issues" - } - } -} - -publishing -{ - publications - { - mavenJava(MavenPublication) - { - from components.java - artifact (sourcesJar) - { - classifier = "sources" - } - } - } -} - -publishing.publications.all -{ - pom.withXml - { - asNode().dependencies."*".findAll() - { - it.scope.text() == "runtime" && project.configurations.compile.allDependencies.find { dep -> - dep.name == it.artifactId.text() - } - }.each { it.scope*.value = "compile"} - } -} - -plugins.withType(EclipsePlugin) -{ - project.eclipse.classpath.plusConfigurations += [ configurations.jmh ] -} - -test -{ - testLogging - { - events=["skipped", "failed"] - exceptionFormat="full" +test { + // NB -- JaCoCo draws from _unit tests_, not integration tests + // When tests fail, you still have a coverage report + finalizedBy jacocoTestReport + testLogging { + events = ["skipped", "failed"] + exceptionFormat = "full" debug.events = ["skipped", "failed"] - debug.exceptionFormat="full" + debug.exceptionFormat = "full" info.events = ["failed", "skipped"] - info.exceptionFormat="full" - + info.exceptionFormat = "full" + warn.events = ["failed", "skipped"] - warn.exceptionFormat="full" + warn.exceptionFormat = "full" } maxHeapSize = "1200m" - if (System.getenv("CI") == null) - { + if (System.getenv("CI") == null) { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 } } -jacoco -{ - toolVersion = "0.7.9" // See http://www.eclemma.org/jacoco/. +tasks.withType(Test).configureEach { + // Quieter builds when JUL is in use (you or another library or tool) + // TODO: Keep builds noisy in CI + systemProperty "java.util.logging.config.file", "$projectDir/config/logging.properties" + // This idiom ensures JUnit5 for integration tests, not just unit tests + useJUnitPlatform() } task GCandMem(dependsOn: "check") doLast { print("Memory usage before: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) + println(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) System.gc() Thread.sleep(200) print("Memory usage: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) + println(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) } task GCandMem2(dependsOn: "test") doLast { print("Memory usage before: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) + println(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) System.gc() Thread.sleep(200) print("Memory usage: ") - println(java.lang.management.ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) + println(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1024.0 / 1024.0) +} + +spotbugs { + toolVersion = spotbugsVersion + effort = Effort.valueOf('MAX') + reportLevel = Confidence.valueOf('HIGH') + // TODO: Set to false later + ignoreFailures = true + showProgress = true + showStackTraces = true +} + +tasks.withType(SpotBugsTask).configureEach { + reports { + html { + enabled = true + } + xml { + enabled = true + } + } +} + +modernizer { + failOnViolations = true + includeTestClasses = true + javaVersion = "$jdkVersion" +} + +jacoco { + toolVersion = jacocoVersion } jacocoTestReport { + dependsOn GCandMem + reports { - xml.enabled true - html.enabled true + xml.required = true + html.required = true } afterEvaluate { classDirectories = files(classDirectories.files.collect - { - fileTree(dir: it, - exclude: ["org/drip/tck/**"]) - }) + { + fileTree(dir: it, + exclude: ["org/drip/tck/**"]) + }) } } -jacocoTestReport.dependsOn GCandMem +jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 1.00 + } + } + } +} build.dependsOn jacocoTestReport + +jdepsReport { + // TODO: Report shows a big mess with dependencies + // TODO: Why mess with multi-release jars? + multiReleaseJars = [".*": "$jdkVersion"] +} + +jar { + manifest { + attributes( + "Bundle-Vendor": "DROP Contributors", + "Bundle-DocURL": "https://github.com/lakshmiDRIP/DROP", + "Import-Package": "!org.junit,!junit.framework,*", + "Eclipse-ExtensibleAPI": "true", + "Automatic-Module-Name": "org.drip" + ) + } +} + +check { + dependsOn += jacocoTestCoverageVerification +} + +license { + header rootProject.file("HEADER") + ext.year = Calendar.getInstance().get(Calendar.YEAR) + skipExistingHeaders true + ignoreFailures true + excludes(["**/*.md", "**/*.txt"]) +} + +tasks.register('sourceJar', Jar) { + from sourceSets.main.allJava + archiveClassifier = "sources" +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact sourceJar + pom { + name = "DROP" + description= "Fixed Income, Portfolio Construction, XVA, TCost Libraries" + url= "https://github.com/lakshmiDRIP/DROP" + licenses { + license { + name= "The Apache Software License, Version 2.0" + url= "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution= "repo" + } + } + developers { + developer { + id= "lakshmiDRIP" + name= "Lakshmi Krishnamurthy" + email= "lakshmimv7977@gmail.com" + } + } + scm { + connection= "scm:git:git@github.com:lakshmiDRIP/DROP.git" + url= "scm:git:git@github.com:lakshmiDRIP/DROP.git" + developerConnection= "scm:git:git@github.com:lakshmiDRIP/DROP.git" + } + issueManagement { + system= "github" + url= "https://github.com/lakshmiDRIP/DROP/issues" + } + } + } + } +} + +publishing.publications.all { + pom.withXml { + asNode().dependencies."*".findAll() { + it.scope.text() == "runtime" && project.configurations.compile.allDependencies.find { dep -> + dep.name == it.artifactId.text() + } + }.each { it.scope*.value = "compile"} + } +} + +plugins.withType(EclipsePlugin).configureEach { + project.eclipse.classpath.plusConfigurations += [configurations.jmh] +} + +static def isStable(version) { + def stableKeyword = ["RELEASE", "FINAL", "GA"].any { + version.uppercase().contains(it) + } + def otherReleasePattern = version ==~ '^[0-9,.v-]+(-r)?$' + + return stableKeyword || otherReleasePattern +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0ec5d4f19cc1..a1712825b8b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,38 @@ release.scope=patch release.version=4.66.0-SNAPSHOT -org.gradle.jvmargs=-Xmx4000m +# Gradle +gradleWrapperVersion=8.5 +org.gradle.jvmargs=-Xmx4000m --add-opens java.base/java.lang=ALL-UNNAMED +# Java +jdkVersion=21 +# Versions +assertJVersion=3.24.2 +junitVersion=5.9.3 +mockitoVersion=5.6.0 +commonsMathVersion=3.6.1 +# Plugins +dependencyAniimalSnifferPluginVersion=1.7.1 + +dependencyCoverallPluginVersion=0.53.0 + +dependencyJFrogBintrayPluginVersion=1.8.5 + +dependencyLicenseBasePluginVersion=0.16.1 + +jacocoVersion=0.8.11 + +jdepsPluginVersion=0.20.0 + +modernizerPluginVersion=1.9.0 +modernizerVersion=2.7.0 + +spotbugsPluginVersion=6.0.2 +spotbugsVersion=4.8.2 +dependencyCheckPluginVersion=8.4.2 +jcipAnnotationsVersion=1.0-1 +findbugsAnnotationsVersion=3.0.1 +findsecbugsPluginVersion=1.12.0 + +systemLambdaVersion=1.2.1 +taskTreePluginVersion=2.1.1 +versionsPluginVersion=0.46.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 248283f746f9..d64cd4917707 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 85f7f506e802..e6aba2515d54 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Mon Dec 04 11:27:33 EST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 4453ccea33d9..1aa94a426907 --- a/gradlew +++ b/gradlew @@ -1,78 +1,127 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f9553162f122..93e3f59f135d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,20 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,19 +25,23 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 74c4a8d73ac0..3ec2021a6b58 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,16 @@ +pluginManagement { + plugins { + id "com.dorongold.task-tree" version "$taskTreePluginVersion" + id "com.github.andygoossens.gradle-modernizer-plugin" version "$modernizerPluginVersion" + id "com.github.ben-manes.versions" version "$versionsPluginVersion" + id "com.github.hierynomus.license-base" version "$dependencyLicenseBasePluginVersion" + id "com.github.spotbugs" version "$spotbugsPluginVersion" + id "com.jfrog.bintray" version "$dependencyJFrogBintrayPluginVersion" + id "org.kordamp.gradle.coveralls" version "$dependencyCoverallPluginVersion" + id "org.kordamp.gradle.jdeps" version "$jdepsPluginVersion" + id "org.owasp.dependencycheck" version "$dependencyCheckPluginVersion" + id "ru.vyarus.animalsniffer" version "$dependencyAniimalSnifferPluginVersion" + } +} + rootProject.name = 'DROP' diff --git a/src/main/java/org/drip/analytics/support/Helper.java b/src/main/java/org/drip/analytics/support/Helper.java index 972f4ed2f8d3..54618bf666a7 100644 --- a/src/main/java/org/drip/analytics/support/Helper.java +++ b/src/main/java/org/drip/analytics/support/Helper.java @@ -720,11 +720,11 @@ public static final double TenorToYearFraction ( if ('d' == chTenor || 'D' == chTenor) return ((double) iTimeUnit) / 365.25; - if ('w' == chTenor || 'W' == chTenor) return ((double) (7. * iTimeUnit)) / 365.25; + if ('w' == chTenor || 'W' == chTenor) return (7. * iTimeUnit) / 365.25; if ('w' == chTenor || 'W' == chTenor) return ((double) (iTimeUnit)) / 52.; - if ('l' == chTenor || 'L' == chTenor) return ((double) (28. * iTimeUnit)) / 365.25; + if ('l' == chTenor || 'L' == chTenor) return (28. * iTimeUnit) / 365.25; if ('l' == chTenor || 'L' == chTenor) return ((double) (iTimeUnit)) / 13.; diff --git a/src/main/java/org/drip/capital/feed/CapitalUnitStressScenarioLoader.java b/src/main/java/org/drip/capital/feed/CapitalUnitStressScenarioLoader.java index 924d10a9b919..e4b7b307cc67 100644 --- a/src/main/java/org/drip/capital/feed/CapitalUnitStressScenarioLoader.java +++ b/src/main/java/org/drip/capital/feed/CapitalUnitStressScenarioLoader.java @@ -118,7 +118,7 @@ public class CapitalUnitStressScenarioLoader try { - return new java.lang.Double (string).doubleValue(); + return java.lang.Double.parseDouble (string); } catch (java.lang.Exception e) { diff --git a/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java b/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java index 5382fb2dfd60..fcf2df08cc00 100644 --- a/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java +++ b/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java @@ -161,8 +161,7 @@ private ContinuousCoordinatedVariationDeterministic ( @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = - (org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters) priceEvolutionParameters(); + org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = priceEvolutionParameters(); org.drip.execution.profiletime.BackgroundParticipationRate bprTemporary = apep.temporaryExpectation(); diff --git a/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java b/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java index fe84a432a53a..df46336b9066 100644 --- a/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java +++ b/src/main/java/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java @@ -161,8 +161,7 @@ private ContinuousCoordinatedVariationStochastic ( @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = - (org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters) priceEvolutionParameters(); + org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = priceEvolutionParameters(); org.drip.execution.profiletime.BackgroundParticipationRate bprTemporary = apep.temporaryExpectation(); diff --git a/src/main/java/org/drip/measure/gamma/ErlangDistribution.java b/src/main/java/org/drip/measure/gamma/ErlangDistribution.java index ad49b39fcb21..c3c0995f8c0d 100644 --- a/src/main/java/org/drip/measure/gamma/ErlangDistribution.java +++ b/src/main/java/org/drip/measure/gamma/ErlangDistribution.java @@ -164,7 +164,7 @@ public ErlangDistribution ( org.drip.measure.gamma.ShapeScaleParameters shapeScaleParameters = shapeScaleParameters(); - double rate = (double) shapeScaleParameters.rate(); + double rate = shapeScaleParameters.rate(); int shape = (int) shapeScaleParameters.shape(); diff --git a/src/main/java/org/drip/numerical/common/NumberUtil.java b/src/main/java/org/drip/numerical/common/NumberUtil.java index 575298320f30..c9746ed8ed59 100644 --- a/src/main/java/org/drip/numerical/common/NumberUtil.java +++ b/src/main/java/org/drip/numerical/common/NumberUtil.java @@ -199,7 +199,7 @@ private static final java.util.List StringToDigitList ( while (index < stringLength) { integerToDigitList.add ( - (int) (charArray[index++] - '0') + charArray[index++] - '0' ); } diff --git a/src/main/java/org/drip/sample/heap/BinaryHeapMeld.java b/src/main/java/org/drip/sample/heap/BinaryHeapMeld.java index e5fb18fcdb71..682d6a9a04a0 100644 --- a/src/main/java/org/drip/sample/heap/BinaryHeapMeld.java +++ b/src/main/java/org/drip/sample/heap/BinaryHeapMeld.java @@ -130,16 +130,12 @@ private static , V> String PrintNode ( { BinaryTreeNode parent = binaryTreeNode.parent(); - return "[" + FormatUtil.FormatDouble ( - (double) binaryTreeNode.entry().key(), 1, 3, 1. - ) + " | " + + return "[" + binaryTreeNode.entry().key() + " | " + binaryTreeNode.level() + " | " + ( binaryTreeNode.isRightChild() ? "R" : "L" ) + " | " + ( - null != parent ? FormatUtil.FormatDouble ( - (double) parent.entry().key(), 1, 3, 1. - ) : " " + null != parent ? parent.entry().key(): " " ) + "]"; } diff --git a/src/main/java/org/drip/service/common/StringUtil.java b/src/main/java/org/drip/service/common/StringUtil.java index 39b83b83016f..76ae0838f878 100644 --- a/src/main/java/org/drip/service/common/StringUtil.java +++ b/src/main/java/org/drip/service/common/StringUtil.java @@ -397,7 +397,7 @@ private static final boolean ValidIPv6 ( private static final int CharToDigit ( final int c) { - return (int) c - (int) '0'; + return c - (int) '0'; } private static final java.util.List StringToNumber ( diff --git a/src/main/java/org/drip/specialfunction/property/DigammaEqualityLemma.java b/src/main/java/org/drip/specialfunction/property/DigammaEqualityLemma.java index 7576a6e7cf73..9eadedaffa9c 100644 --- a/src/main/java/org/drip/specialfunction/property/DigammaEqualityLemma.java +++ b/src/main/java/org/drip/specialfunction/property/DigammaEqualityLemma.java @@ -204,7 +204,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r <= m; ++r) { - summation = summation + abramowitzStegun2007.evaluate (((double) r) / ((double) m)); + summation = summation + abramowitzStegun2007.evaluate (((double) r) / m); } return summation; @@ -271,7 +271,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + abramowitzStegun2007.evaluate (z) * java.lang.Math.cos (2. * java.lang.Math.PI * k * z); @@ -341,7 +341,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + abramowitzStegun2007.evaluate (z) * java.lang.Math.sin (2. * java.lang.Math.PI * k * z); @@ -545,7 +545,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + abramowitzStegun2007.evaluate (z) / java.lang.Math.tan (java.lang.Math.PI * z); @@ -611,7 +611,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + z * abramowitzStegun2007.evaluate (z); } @@ -635,7 +635,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + z / java.lang.Math.tan (java.lang.Math.PI * z); } @@ -695,7 +695,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + abramowitzStegun2007.evaluate (z) * java.lang.Math.cos ((2. * l + 1.) * java.lang.Math.PI * z); @@ -720,7 +720,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; double theta = 2. * java.lang.Math.PI * z; @@ -783,7 +783,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + double z = ((double) r) / m; summation = summation + abramowitzStegun2007.evaluate (z) * java.lang.Math.sin ((2. * l + 1.) * java.lang.Math.PI * z); @@ -811,7 +811,8 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double z = ((double) r) / ((double) m); + + double z = ((double) r) / m; double theta = java.lang.Math.PI * z; @@ -868,7 +869,7 @@ public static final org.drip.function.definition.R1ToR1Property SummationIdentit for (int r = 1; r < m; ++r) { - double digamma = abramowitzStegun2007.evaluate ((double) r) / ((double) m); + double digamma = abramowitzStegun2007.evaluate (r) / m; summation = summation + digamma * digamma; } diff --git a/src/main/java/org/drip/state/nonlinear/FlatForwardDiscountCurve.java b/src/main/java/org/drip/state/nonlinear/FlatForwardDiscountCurve.java index 6d99f1eed358..6761d319c091 100644 --- a/src/main/java/org/drip/state/nonlinear/FlatForwardDiscountCurve.java +++ b/src/main/java/org/drip/state/nonlinear/FlatForwardDiscountCurve.java @@ -332,7 +332,7 @@ public java.lang.String compoundingDayCount() int iStartDate = _iEpochDate; int iNumDate = _aiDate.length; - while (i < iNumDate && (int) iDate >= (int) _aiDate[i]) { + while (i < iNumDate && iDate >= _aiDate[i]) { if (_bDiscreteCompounding) dblDF *= java.lang.Math.pow (1. + (_adblForwardRate[i] / _iCompoundingFreq), -1. * yearFract (iStartDate, _aiDate[i]) * _iCompoundingFreq); @@ -538,7 +538,7 @@ public java.lang.String compoundingDayCount() return null; } - while (i < _adblForwardRate.length && (int) iDate >= (int) _aiDate[i]) { + while (i < _adblForwardRate.length && iDate >= _aiDate[i]) { if (!wj.accumulatePartialFirstDerivative (0, i, dblDF * (iStartDate - _aiDate[i]) / 365.25)) return null; diff --git a/src/main/java/org/drip/state/nonlinear/FlatForwardGovvieCurve.java b/src/main/java/org/drip/state/nonlinear/FlatForwardGovvieCurve.java index 58769843bbe4..29fb55b874ca 100644 --- a/src/main/java/org/drip/state/nonlinear/FlatForwardGovvieCurve.java +++ b/src/main/java/org/drip/state/nonlinear/FlatForwardGovvieCurve.java @@ -159,7 +159,7 @@ public FlatForwardGovvieCurve ( org.drip.analytics.daycount.ActActDCParams aap = org.drip.analytics.daycount.ActActDCParams.FromFrequency (iFreq); - while (i < iNumDate && (int) iDate >= (int) _aiDate[i]) { + while (i < iNumDate && iDate >= _aiDate[i]) { dblDF *= java.lang.Math.pow (1. + (_adblForwardYield[i] / iFreq), -1. * yearFract (iStartDate, _aiDate[i], aap, strDayCount) * iFreq);