diff --git a/project/.bloop/scala-build.json b/project/.bloop/scala-build.json new file mode 100644 index 0000000..d301d09 --- /dev/null +++ b/project/.bloop/scala-build.json @@ -0,0 +1,1047 @@ +{ + "version": "1.4.0", + "project": { + "name": "scala-build", + "directory": "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project", + "workspaceDir": "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project", + "sources": [ + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\src\\main\\scala-2.12", + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\src\\main\\scala", + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\src\\main\\java", + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\src\\main\\scala-sbt-1.0", + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\target\\scala-2.12\\sbt-1.0\\src_managed\\main" + ], + "dependencies": [ + + ], + "classpath": [ + "C:\\Users\\lenovo\\.ivy2\\cache\\scala_2.12\\sbt_1.0\\org.scalameta\\sbt-metals\\jars\\sbt-metals-0.7.6.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\scala_2.12\\sbt_1.0\\ch.epfl.scala\\sbt-bloop\\jars\\sbt-bloop-1.4.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\net.java.dev.jna\\jna\\jars\\jna-4.5.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\net.java.dev.jna\\jna-platform\\jars\\jna-platform-4.5.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.code.gson\\gson\\jars\\gson-2.7.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.code.findbugs\\jsr305\\jars\\jsr305-3.0.2.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-library.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\sbt\\jars\\sbt-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\main_2.12\\jars\\main_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\logic_2.12\\jars\\logic_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\collections_2.12\\jars\\collections_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-scalajson_2.12\\jars\\sjson-new-scalajson_2.12-0.8.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-core_2.12\\jars\\sjson-new-core_2.12-0.8.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\shaded-scalajson_2.12\\jars\\shaded-scalajson_2.12-1.0.0-M4.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.spire-math\\jawn-parser_2.12\\jars\\jawn-parser_2.12-0.10.4.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-position_2.12\\jars\\util-position_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-relation_2.12\\jars\\util-relation_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\actions_2.12\\jars\\actions_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\completion_2.12\\jars\\completion_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\jline\\jline\\jars\\jline-2.14.4.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\io_2.12\\jars\\io_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-control_2.12\\jars\\util-control_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\run_2.12\\jars\\run_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-logging_2.12\\jars\\util-logging_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-interface\\jars\\util-interface-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-api\\jars\\log4j-api-2.8.1.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-core\\jars\\log4j-core-2.8.1.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.lmax\\disruptor\\jars\\disruptor-3.3.6.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-reflect.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-classpath_2.12\\jars\\zinc-classpath_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-compiler.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-lang.modules\\scala-xml_2.12\\bundles\\scala-xml_2.12-1.0.6.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\compiler-interface\\jars\\compiler-interface-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\launcher-interface\\jars\\launcher-interface-1.0.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\task-system_2.12\\jars\\task-system_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\tasks_2.12\\jars\\tasks_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-cache_2.12\\jars\\util-cache_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-murmurhash_2.12\\jars\\sjson-new-murmurhash_2.12-0.8.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\testing_2.12\\jars\\testing_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\test-agent\\jars\\test-agent-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\test-interface\\jars\\test-interface-1.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-tracking_2.12\\jars\\util-tracking_2.12-1.0.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-apiinfo_2.12\\jars\\zinc-apiinfo_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-classfile_2.12\\jars\\zinc-classfile_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\librarymanagement-core_2.12\\jars\\librarymanagement-core_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.jcraft\\jsch\\jars\\jsch-0.1.46.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\gigahorse-okhttp_2.12\\jars\\gigahorse-okhttp_2.12-0.3.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\gigahorse-core_2.12\\jars\\gigahorse-core_2.12-0.3.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.typesafe\\ssl-config-core_2.12\\bundles\\ssl-config-core_2.12-0.2.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.typesafe\\config\\bundles\\config-1.2.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.reactivestreams\\reactive-streams\\jars\\reactive-streams-1.0.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.slf4j\\slf4j-api\\jars\\slf4j-api-1.7.25.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okhttp3\\okhttp\\jars\\okhttp-3.7.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okio\\okio\\jars\\okio-1.12.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okhttp3\\okhttp-urlconnection\\jars\\okhttp-urlconnection-3.7.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-ivy-integration_2.12\\jars\\zinc-ivy-integration_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-compile-core_2.12\\jars\\zinc-compile-core_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-lang.modules\\scala-parser-combinators_2.12\\bundles\\scala-parser-combinators_2.12-1.0.5.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc_2.12\\jars\\zinc_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-core_2.12\\jars\\zinc-core_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-persist_2.12\\jars\\zinc-persist_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.trueaccord.scalapb\\scalapb-runtime_2.12\\jars\\scalapb-runtime_2.12-0.6.0.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.trueaccord.lenses\\lenses_2.12\\jars\\lenses_2.12-0.4.12.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\fastparse_2.12\\jars\\fastparse_2.12-0.4.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\fastparse-utils_2.12\\jars\\fastparse-utils_2.12-0.4.2.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\sourcecode_2.12\\jars\\sourcecode_2.12-0.1.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.protobuf\\protobuf-java\\bundles\\protobuf-java-3.3.1.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\sbinary_2.12\\jars\\sbinary_2.12-0.4.4.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\main-settings_2.12\\jars\\main-settings_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\command_2.12\\jars\\command_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\protocol_2.12\\jars\\protocol_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\template-resolver\\jars\\template-resolver-0.1.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\core-macros_2.12\\jars\\core-macros_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-slf4j-impl\\jars\\log4j-slf4j-impl-2.8.1.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\librarymanagement-ivy_2.12\\jars\\librarymanagement-ivy_2.12-1.0.3.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt.ivy\\ivy\\jars\\ivy-2.3.0-sbt-1b57d3bbc08ecf671169fd548918da18c91f77be.jar", + "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-compile_2.12\\jars\\zinc-compile_2.12-1.0.3.jar" + ], + "out": "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\.bloop\\scala-build", + "classesDir": "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\.bloop\\scala-build\\scala-2.12\\sbt-1.0\\classes", + "resources": [ + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\src\\main\\resources", + "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\target\\scala-2.12\\sbt-1.0\\resource_managed\\main" + ], + "scala": { + "organization": "org.scala-lang", + "name": "scala-compiler", + "version": "2.12.4", + "options": [ + "-deprecation" + ], + "jars": [ + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\jline.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-compiler.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-library.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-reflect.jar", + "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-xml_2.12.jar" + ], + "analysis": "C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project\\target\\streams\\compile\\bloopAnalysisOut\\$global\\streams\\inc_compile_2.12.zip", + "setup": { + "order": "mixed", + "addLibraryToBootClasspath": true, + "addCompilerToClasspath": false, + "addExtraJarsToClasspath": false, + "manageBootClasspath": true, + "filterLibraryFromClasspath": true + } + }, + "java": { + "options": [ + + ] + }, + "sbt": { + "sbtVersion": "1.0.3", + "autoImports": [ + "import _root_.scala.xml.{TopScope=>$scope}", + "import _root_.sbt._", + "import _root_.sbt.Keys._", + "import _root_.bloop.integrations.sbt.BloopPlugin.autoImport._", + "import _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin, _root_.sbt.plugins.Giter8TemplatePlugin, _root_.scala.meta.metals.MetalsPlugin, _root_.bloop.integrations.sbt.BloopPlugin" + ] + }, + "test": { + "frameworks": [ + { + "names": [ + "org.scalacheck.ScalaCheckFramework" + ] + }, + { + "names": [ + "org.specs2.runner.Specs2Framework", + "org.specs2.runner.SpecsFramework" + ] + }, + { + "names": [ + "org.specs.runner.SpecsFramework" + ] + }, + { + "names": [ + "org.scalatest.tools.Framework", + "org.scalatest.tools.ScalaTestFramework" + ] + }, + { + "names": [ + "com.novocode.junit.JUnitFramework" + ] + } + ], + "options": { + "excludes": [ + + ], + "arguments": [ + + ] + } + }, + "platform": { + "name": "jvm", + "config": { + "home": "C:\\Program Files\\Java\\jdk1.8.0_152\\jre", + "options": [ + "-Duser.dir=C:\\Users\\lenovo\\Documents\\code\\scala\\projectz\\Scala\\project" + ] + }, + "mainClass": [ + + ] + }, + "resolution": { + "modules": [ + { + "organization": "org.scalameta", + "name": "sbt-metals", + "version": "0.7.6", + "artifacts": [ + { + "name": "sbt-metals", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\scala_2.12\\sbt_1.0\\org.scalameta\\sbt-metals\\jars\\sbt-metals-0.7.6.jar" + } + ] + }, + { + "organization": "ch.epfl.scala", + "name": "sbt-bloop", + "version": "1.4.3", + "artifacts": [ + { + "name": "sbt-bloop", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\scala_2.12\\sbt_1.0\\ch.epfl.scala\\sbt-bloop\\jars\\sbt-bloop-1.4.3.jar" + } + ] + }, + { + "organization": "net.java.dev.jna", + "name": "jna", + "version": "4.5.0", + "artifacts": [ + { + "name": "jna", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\net.java.dev.jna\\jna\\jars\\jna-4.5.0.jar" + } + ] + }, + { + "organization": "net.java.dev.jna", + "name": "jna-platform", + "version": "4.5.0", + "artifacts": [ + { + "name": "jna-platform", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\net.java.dev.jna\\jna-platform\\jars\\jna-platform-4.5.0.jar" + } + ] + }, + { + "organization": "com.google.code.gson", + "name": "gson", + "version": "2.7", + "artifacts": [ + { + "name": "gson", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.code.gson\\gson\\jars\\gson-2.7.jar" + } + ] + }, + { + "organization": "com.google.code.findbugs", + "name": "jsr305", + "version": "3.0.2", + "artifacts": [ + { + "name": "jsr305", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.code.findbugs\\jsr305\\jars\\jsr305-3.0.2.jar" + } + ] + }, + { + "organization": "org.scala-lang", + "name": "scala-library", + "version": "2.12.4", + "artifacts": [ + { + "name": "scala-library", + "path": "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-library.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "sbt", + "version": "1.0.3", + "artifacts": [ + { + "name": "sbt", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\sbt\\jars\\sbt-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "main_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "main_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\main_2.12\\jars\\main_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "logic_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "logic_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\logic_2.12\\jars\\logic_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "collections_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "collections_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\collections_2.12\\jars\\collections_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "sjson-new-scalajson_2.12", + "version": "0.8.0", + "artifacts": [ + { + "name": "sjson-new-scalajson_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-scalajson_2.12\\jars\\sjson-new-scalajson_2.12-0.8.0.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "sjson-new-core_2.12", + "version": "0.8.0", + "artifacts": [ + { + "name": "sjson-new-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-core_2.12\\jars\\sjson-new-core_2.12-0.8.0.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "shaded-scalajson_2.12", + "version": "1.0.0-M4", + "artifacts": [ + { + "name": "shaded-scalajson_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\shaded-scalajson_2.12\\jars\\shaded-scalajson_2.12-1.0.0-M4.jar" + } + ] + }, + { + "organization": "org.spire-math", + "name": "jawn-parser_2.12", + "version": "0.10.4", + "artifacts": [ + { + "name": "jawn-parser_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.spire-math\\jawn-parser_2.12\\jars\\jawn-parser_2.12-0.10.4.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-position_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-position_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-position_2.12\\jars\\util-position_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-relation_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-relation_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-relation_2.12\\jars\\util-relation_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "actions_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "actions_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\actions_2.12\\jars\\actions_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "completion_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "completion_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\completion_2.12\\jars\\completion_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "jline", + "name": "jline", + "version": "2.14.4", + "artifacts": [ + { + "name": "jline", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\jline\\jline\\jars\\jline-2.14.4.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "io_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "io_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\io_2.12\\jars\\io_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-control_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-control_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-control_2.12\\jars\\util-control_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "run_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "run_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\run_2.12\\jars\\run_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-logging_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-logging_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-logging_2.12\\jars\\util-logging_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-interface", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-interface", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-interface\\jars\\util-interface-1.0.2.jar" + } + ] + }, + { + "organization": "org.apache.logging.log4j", + "name": "log4j-api", + "version": "2.8.1", + "artifacts": [ + { + "name": "log4j-api", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-api\\jars\\log4j-api-2.8.1.jar" + } + ] + }, + { + "organization": "org.apache.logging.log4j", + "name": "log4j-core", + "version": "2.8.1", + "artifacts": [ + { + "name": "log4j-core", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-core\\jars\\log4j-core-2.8.1.jar" + } + ] + }, + { + "organization": "com.lmax", + "name": "disruptor", + "version": "3.3.6", + "artifacts": [ + { + "name": "disruptor", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.lmax\\disruptor\\jars\\disruptor-3.3.6.jar" + } + ] + }, + { + "organization": "org.scala-lang", + "name": "scala-reflect", + "version": "2.12.4", + "artifacts": [ + { + "name": "scala-reflect", + "path": "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-reflect.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-classpath_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-classpath_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-classpath_2.12\\jars\\zinc-classpath_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-lang", + "name": "scala-compiler", + "version": "2.12.4", + "artifacts": [ + { + "name": "scala-compiler", + "path": "C:\\Users\\lenovo\\.sbt\\boot\\scala-2.12.4\\lib\\scala-compiler.jar" + } + ] + }, + { + "organization": "org.scala-lang.modules", + "name": "scala-xml_2.12", + "version": "1.0.6", + "artifacts": [ + { + "name": "scala-xml_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-lang.modules\\scala-xml_2.12\\bundles\\scala-xml_2.12-1.0.6.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "compiler-interface", + "version": "1.0.3", + "artifacts": [ + { + "name": "compiler-interface", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\compiler-interface\\jars\\compiler-interface-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "launcher-interface", + "version": "1.0.0", + "artifacts": [ + { + "name": "launcher-interface", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\launcher-interface\\jars\\launcher-interface-1.0.0.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "task-system_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "task-system_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\task-system_2.12\\jars\\task-system_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "tasks_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "tasks_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\tasks_2.12\\jars\\tasks_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-cache_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-cache_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-cache_2.12\\jars\\util-cache_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "sjson-new-murmurhash_2.12", + "version": "0.8.0", + "artifacts": [ + { + "name": "sjson-new-murmurhash_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\sjson-new-murmurhash_2.12\\jars\\sjson-new-murmurhash_2.12-0.8.0.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "testing_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "testing_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\testing_2.12\\jars\\testing_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "test-agent", + "version": "1.0.3", + "artifacts": [ + { + "name": "test-agent", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\test-agent\\jars\\test-agent-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "test-interface", + "version": "1.0", + "artifacts": [ + { + "name": "test-interface", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\test-interface\\jars\\test-interface-1.0.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "util-tracking_2.12", + "version": "1.0.2", + "artifacts": [ + { + "name": "util-tracking_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\util-tracking_2.12\\jars\\util-tracking_2.12-1.0.2.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-apiinfo_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-apiinfo_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-apiinfo_2.12\\jars\\zinc-apiinfo_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-classfile_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-classfile_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-classfile_2.12\\jars\\zinc-classfile_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "librarymanagement-core_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "librarymanagement-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\librarymanagement-core_2.12\\jars\\librarymanagement-core_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "com.jcraft", + "name": "jsch", + "version": "0.1.46", + "artifacts": [ + { + "name": "jsch", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.jcraft\\jsch\\jars\\jsch-0.1.46.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "gigahorse-okhttp_2.12", + "version": "0.3.0", + "artifacts": [ + { + "name": "gigahorse-okhttp_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\gigahorse-okhttp_2.12\\jars\\gigahorse-okhttp_2.12-0.3.0.jar" + } + ] + }, + { + "organization": "com.eed3si9n", + "name": "gigahorse-core_2.12", + "version": "0.3.0", + "artifacts": [ + { + "name": "gigahorse-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.eed3si9n\\gigahorse-core_2.12\\jars\\gigahorse-core_2.12-0.3.0.jar" + } + ] + }, + { + "organization": "com.typesafe", + "name": "ssl-config-core_2.12", + "version": "0.2.2", + "artifacts": [ + { + "name": "ssl-config-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.typesafe\\ssl-config-core_2.12\\bundles\\ssl-config-core_2.12-0.2.2.jar" + } + ] + }, + { + "organization": "com.typesafe", + "name": "config", + "version": "1.2.0", + "artifacts": [ + { + "name": "config", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.typesafe\\config\\bundles\\config-1.2.0.jar" + } + ] + }, + { + "organization": "org.reactivestreams", + "name": "reactive-streams", + "version": "1.0.0", + "artifacts": [ + { + "name": "reactive-streams", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.reactivestreams\\reactive-streams\\jars\\reactive-streams-1.0.0.jar" + } + ] + }, + { + "organization": "org.slf4j", + "name": "slf4j-api", + "version": "1.7.25", + "artifacts": [ + { + "name": "slf4j-api", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.slf4j\\slf4j-api\\jars\\slf4j-api-1.7.25.jar" + } + ] + }, + { + "organization": "com.squareup.okhttp3", + "name": "okhttp", + "version": "3.7.0", + "artifacts": [ + { + "name": "okhttp", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okhttp3\\okhttp\\jars\\okhttp-3.7.0.jar" + } + ] + }, + { + "organization": "com.squareup.okio", + "name": "okio", + "version": "1.12.0", + "artifacts": [ + { + "name": "okio", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okio\\okio\\jars\\okio-1.12.0.jar" + } + ] + }, + { + "organization": "com.squareup.okhttp3", + "name": "okhttp-urlconnection", + "version": "3.7.0", + "artifacts": [ + { + "name": "okhttp-urlconnection", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.squareup.okhttp3\\okhttp-urlconnection\\jars\\okhttp-urlconnection-3.7.0.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-ivy-integration_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-ivy-integration_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-ivy-integration_2.12\\jars\\zinc-ivy-integration_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-compile-core_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-compile-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-compile-core_2.12\\jars\\zinc-compile-core_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-lang.modules", + "name": "scala-parser-combinators_2.12", + "version": "1.0.5", + "artifacts": [ + { + "name": "scala-parser-combinators_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-lang.modules\\scala-parser-combinators_2.12\\bundles\\scala-parser-combinators_2.12-1.0.5.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc_2.12\\jars\\zinc_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-core_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-core_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-core_2.12\\jars\\zinc-core_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-persist_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-persist_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-persist_2.12\\jars\\zinc-persist_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "com.trueaccord.scalapb", + "name": "scalapb-runtime_2.12", + "version": "0.6.0", + "artifacts": [ + { + "name": "scalapb-runtime_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.trueaccord.scalapb\\scalapb-runtime_2.12\\jars\\scalapb-runtime_2.12-0.6.0.jar" + } + ] + }, + { + "organization": "com.trueaccord.lenses", + "name": "lenses_2.12", + "version": "0.4.12", + "artifacts": [ + { + "name": "lenses_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.trueaccord.lenses\\lenses_2.12\\jars\\lenses_2.12-0.4.12.jar" + } + ] + }, + { + "organization": "com.lihaoyi", + "name": "fastparse_2.12", + "version": "0.4.2", + "artifacts": [ + { + "name": "fastparse_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\fastparse_2.12\\jars\\fastparse_2.12-0.4.2.jar" + } + ] + }, + { + "organization": "com.lihaoyi", + "name": "fastparse-utils_2.12", + "version": "0.4.2", + "artifacts": [ + { + "name": "fastparse-utils_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\fastparse-utils_2.12\\jars\\fastparse-utils_2.12-0.4.2.jar" + } + ] + }, + { + "organization": "com.lihaoyi", + "name": "sourcecode_2.12", + "version": "0.1.3", + "artifacts": [ + { + "name": "sourcecode_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.lihaoyi\\sourcecode_2.12\\jars\\sourcecode_2.12-0.1.3.jar" + } + ] + }, + { + "organization": "com.google.protobuf", + "name": "protobuf-java", + "version": "3.3.1", + "artifacts": [ + { + "name": "protobuf-java", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\com.google.protobuf\\protobuf-java\\bundles\\protobuf-java-3.3.1.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "sbinary_2.12", + "version": "0.4.4", + "artifacts": [ + { + "name": "sbinary_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\sbinary_2.12\\jars\\sbinary_2.12-0.4.4.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "main-settings_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "main-settings_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\main-settings_2.12\\jars\\main-settings_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "command_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "command_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\command_2.12\\jars\\command_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "protocol_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "protocol_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\protocol_2.12\\jars\\protocol_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "template-resolver", + "version": "0.1", + "artifacts": [ + { + "name": "template-resolver", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\template-resolver\\jars\\template-resolver-0.1.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "core-macros_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "core-macros_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\core-macros_2.12\\jars\\core-macros_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.apache.logging.log4j", + "name": "log4j-slf4j-impl", + "version": "2.8.1", + "artifacts": [ + { + "name": "log4j-slf4j-impl", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.apache.logging.log4j\\log4j-slf4j-impl\\jars\\log4j-slf4j-impl-2.8.1.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "librarymanagement-ivy_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "librarymanagement-ivy_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\librarymanagement-ivy_2.12\\jars\\librarymanagement-ivy_2.12-1.0.3.jar" + } + ] + }, + { + "organization": "org.scala-sbt.ivy", + "name": "ivy", + "version": "2.3.0-sbt-1b57d3bbc08ecf671169fd548918da18c91f77be", + "artifacts": [ + { + "name": "ivy", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt.ivy\\ivy\\jars\\ivy-2.3.0-sbt-1b57d3bbc08ecf671169fd548918da18c91f77be.jar" + } + ] + }, + { + "organization": "org.scala-sbt", + "name": "zinc-compile_2.12", + "version": "1.0.3", + "artifacts": [ + { + "name": "zinc-compile_2.12", + "path": "C:\\Users\\lenovo\\.ivy2\\cache\\org.scala-sbt\\zinc-compile_2.12\\jars\\zinc-compile_2.12-1.0.3.jar" + } + ] + } + ] + }, + "tags": [ + "library" + ] + } +} \ No newline at end of file diff --git a/src/main/scala/Mathematics/Abs.scala b/src/main/scala/Mathematics/Abs.scala index 181c0ca..34341fa 100644 --- a/src/main/scala/Mathematics/Abs.scala +++ b/src/main/scala/Mathematics/Abs.scala @@ -5,13 +5,9 @@ object Abs { /** * Method returns absolute value of the number * - * @param Int - * @return + * @param number the number to find the abs value for + * @return the abs value of number */ - def abs(number : Int): Int = { - if (number < 0) - return number * -1 - return number; - } + def abs(number : Int): Int = if (number < 0) number * -1 else number } diff --git a/src/main/scala/Mathematics/AbsMax.scala b/src/main/scala/Mathematics/AbsMax.scala index fd2f02b..0df4c95 100644 --- a/src/main/scala/Mathematics/AbsMax.scala +++ b/src/main/scala/Mathematics/AbsMax.scala @@ -1,15 +1,15 @@ package Mathematics -object AbsMax { +import math.abs - /** - * Method returns absolute Maximum Element from the list - * - * @param listOfElements - * @return - */ - def abs: Int => Int = Abs.abs +object AbsMax { - def absMax(elements: List[Int]): Int = abs(elements.maxBy(x => abs(x))) + /** + * Method returns absolute Maximum Element from the list + * + * @param elements the list to consider + * @return the absolute value of the maximum element in the list + */ + def absMax(elements : List[Int]): Int = abs(elements.maxBy(x => abs(x))) } diff --git a/src/main/scala/Mathematics/AbsMin.scala b/src/main/scala/Mathematics/AbsMin.scala index f624c68..902aea0 100644 --- a/src/main/scala/Mathematics/AbsMin.scala +++ b/src/main/scala/Mathematics/AbsMin.scala @@ -1,15 +1,15 @@ package Mathematics -object AbsMin { +import math.abs - /** - * Method returns Absolute minimum Element from the list - * - * @param listOfElements - * @return - */ - def abs: Int => Int = Abs.abs +object AbsMin { - def absMin(elements: List[Int]): Int = abs(elements.minBy(x => abs(x))) + /** + * Method returns Absolute minimum Element from the list + * + * @param elements the list to consider + * @return the absolute value of the minimum element in the list + */ + def absMin(elements : List[Int]): Int = abs(elements.minBy(x => abs(x))) } diff --git a/src/main/scala/Mathematics/BinaryExponentiation.scala b/src/main/scala/Mathematics/BinaryExponentiation.scala index 5986c3f..77d294e 100644 --- a/src/main/scala/Mathematics/BinaryExponentiation.scala +++ b/src/main/scala/Mathematics/BinaryExponentiation.scala @@ -1,22 +1,22 @@ package Mathematics object BinaryExponentiation { - /** - * Method returns the binary exponentiation of a given number - * when base and power are passed the parameters - * - * @param Int , Int - * @return - */ - - def binaryExponentiation(base: Int, power: Int): Int = { - if (power == 0) { - return 1 - } else if (power % 2 == 1) { - return binaryExponentiation(base, power - 1) * base - } else { - val answer: Int = binaryExponentiation(base, power / 2) - return answer * answer - } - } + /** + * Method returns the binary exponentiation of a given number + when base and power are passed the parameters + * + * @param base the base to use + * @param power the power to raise it to + * @return the binary exponentiation of the given number + */ + + def binaryExponentiation(base : Int, power : Int): Int = { + power match { + case _==0 => 1 + case _%2==1 => binaryExponentiation(base, power - 1) * base + case _ => + val answer: Int = binaryExponentiation(base, power / 2) + answer * answer + } + } } diff --git a/src/main/scala/Mathematics/Fibonacci.scala b/src/main/scala/Mathematics/Fibonacci.scala index f694467..731a374 100644 --- a/src/main/scala/Mathematics/Fibonacci.scala +++ b/src/main/scala/Mathematics/Fibonacci.scala @@ -1,14 +1,14 @@ package Mathematics object Fibonacci { - private val allFibonacci: Stream[Int] = 1 #:: 1 #:: allFibonacci.zip(allFibonacci.tail).map(t => t._1 + t._2) + private val allFibonacci: Stream[Long] = 1L #:: 1L #:: allFibonacci.zip(allFibonacci.tail).map(t => t._1 + t._2) /** * Method to use the allFibonacci stream to take the first total numbers * Using streams is both an easy and efficient way to generate fibonacci numbers (streams are memoized) * - * @param total - * @return + * @param total is the number of fibonacci numbers to generate + * @return the first total fibonacci numbers */ - def fibGenerate(total: Int): Seq[Int] = allFibonacci.take(total) + def fibGenerate(total: Int): Seq[Long] = allFibonacci.take(total) } diff --git a/src/main/scala/Mathematics/FindMax.scala b/src/main/scala/Mathematics/FindMax.scala index ec45f72..db61637 100644 --- a/src/main/scala/Mathematics/FindMax.scala +++ b/src/main/scala/Mathematics/FindMax.scala @@ -2,11 +2,11 @@ package Mathematics object FindMax { - /** - * Method returns Max Element from the list - * - * @param listOfElements - * @return - */ - def findMax(elements: List[Int]): Int = elements.foldLeft(elements.head) { (acc, i) => if (acc > i) acc else i } + /** + * Method returns Max Element from the list + * + * @param elements the list to consider + * @return the maximum element in the list + */ + def findMax(elements : List[Int]): Int = elements.foldLeft(elements.head){(acc, i) => if (acc > i) acc else i} } diff --git a/src/main/scala/Mathematics/FindMin.scala b/src/main/scala/Mathematics/FindMin.scala index 16f0c89..ede0a84 100644 --- a/src/main/scala/Mathematics/FindMin.scala +++ b/src/main/scala/Mathematics/FindMin.scala @@ -2,11 +2,11 @@ package Mathematics object FindMin { - /** - * Method returns Minimum Element from the list - * - * @param listOfElements - * @return - */ - def findMin(elements: List[Int]): Int = elements.foldLeft(elements.head) { (acc, i) => if (acc < i) acc else i } + /** + * Method returns Minimum Element from the list + * + * @param elements the list to find the min element for + * @return the minimum element in the list + */ + def findMin(elements : List[Int]): Int = elements.foldLeft(elements.head){(acc, i) => if (acc < i) acc else i} } diff --git a/src/main/scala/Mathematics/GreaterCommonDivisor.scala b/src/main/scala/Mathematics/GreaterCommonDivisor.scala deleted file mode 100644 index b1745d9..0000000 --- a/src/main/scala/Mathematics/GreaterCommonDivisor.scala +++ /dev/null @@ -1,17 +0,0 @@ -package Mathematics - -object GreaterCommonDivisor { - - /** - * Method returns the Greatest Common Divisor of two numbers n, m - * - * @param num1 , num2 - * @return - */ - - def gcd(num1: Long, num2: Long): Long = { - if (num2 == 0) num1 - else gcd(num2, num1 % num2) - } - -} diff --git a/src/main/scala/Mathematics/GreatestCommonDivisor.scala b/src/main/scala/Mathematics/GreatestCommonDivisor.scala new file mode 100644 index 0000000..be8130c --- /dev/null +++ b/src/main/scala/Mathematics/GreatestCommonDivisor.scala @@ -0,0 +1,18 @@ +package Mathematics + +import scala.annotation.tailrec + +object GreatestCommonDivisor { + + /** + * Method returns the Greatest Common Divisor of two numbers n, m + * + * @param n the first number + * @param m the second number + * @return the greatest common divisor of n and m + */ + + @tailrec + def gcd(n: Long, m: Long): Long = if (m == 0) n else gcd(m, n % m) + +} diff --git a/src/main/scala/Mathematics/LinearSieve.scala b/src/main/scala/Mathematics/LinearSieve.scala index 060f852..1d9941d 100644 --- a/src/main/scala/Mathematics/LinearSieve.scala +++ b/src/main/scala/Mathematics/LinearSieve.scala @@ -4,16 +4,16 @@ object LinearSieve { /** * Method returns sequence of prime numbers which all are not greater than n * - * @param n - * @return + * @param n the number of prime numbers to generate + * @return the first n prime numbers */ - def getPrimeNumbers(n: Int): Seq[Int] = { - var primeNumbers = Seq.empty[Int] - val lowestPrimeDivisor: Array[Int] = Array.fill(n + 1)(0) + def getPrimeNumbers(n: Int): Seq[Long] = { + var primeNumbers = Seq.empty[Long] + val lowestPrimeDivisor: Array[Long] = Array.fill(n + 1)(0L) for (i <- 2 to n) { if (lowestPrimeDivisor(i) == 0) { - lowestPrimeDivisor(i) = i - primeNumbers :+= i + lowestPrimeDivisor(i) = i.toLong + primeNumbers :+= i.toLong } var j = 0 while (j < primeNumbers.length && primeNumbers(j) <= lowestPrimeDivisor(i) && i * primeNumbers(j) <= n) { diff --git a/src/main/scala/Mathematics/PrimeFactors.scala b/src/main/scala/Mathematics/PrimeFactors.scala index 9e6e92b..1215842 100644 --- a/src/main/scala/Mathematics/PrimeFactors.scala +++ b/src/main/scala/Mathematics/PrimeFactors.scala @@ -2,19 +2,18 @@ package Mathematics object PrimeFactors { - /** - * Method returns list of prime factors of number n - * - * @param num - * @return - */ + /** + * Method returns list of prime factors of number n + * + * @param number the number to consider + * @return a list containing the prime factors of the number given + */ - def primeFactors(number: Long): List[Long] = { - val exists = (2L to math.sqrt(number).toLong).find(number % _ == 0) - exists match { - case None => List(number) - case Some(factor) => factor :: primeFactors(number / factor) - - } - } + def primeFactors(number: Long): List[Long] = { + val exists = (2L to math.sqrt(number).toLong).find(number % _ == 0) + exists match { + case None => List(number) + case Some(factor) => factor :: primeFactors(number / factor) + } + } } diff --git a/src/main/scala/Mathematics/StreamSieve.scala b/src/main/scala/Mathematics/StreamSieve.scala index c9f84e6..8211358 100644 --- a/src/main/scala/Mathematics/StreamSieve.scala +++ b/src/main/scala/Mathematics/StreamSieve.scala @@ -2,9 +2,9 @@ package Mathematics object StreamSieve { - private val allPrimes: Stream[Int] = 2 #:: Stream.from(3).filter { c => - val primesUptoSqrt = allPrimes.takeWhile(p => p <= math.sqrt(c)) - !primesUptoSqrt.exists(p => c % p == 0) + private val allPrimes: Stream[Long] = 2L #:: Stream.from(3).filter { c => + val primesUpToSqrt = allPrimes.takeWhile(p => p <= math.sqrt(c)) + !primesUpToSqrt.exists(p => c % p == 0) } /** @@ -13,8 +13,8 @@ object StreamSieve { * Using streams as opposed to the classic sieve ensures that we stay following functional principles * and not change states * - * @param total - * @return + * @param n number of primes to generate + * @return List of the first n primes */ - def getPrimeNumbers(n: Int): Seq[Int] = allPrimes.take(n) + def getPrimeNumbers(n: Int): Seq[Long] = allPrimes.take(n) } diff --git a/src/main/scala/Search/BinarySearch.scala b/src/main/scala/Search/BinarySearch.scala index af97530..6a77cdf 100644 --- a/src/main/scala/Search/BinarySearch.scala +++ b/src/main/scala/Search/BinarySearch.scala @@ -35,8 +35,8 @@ object BinarySearch { else { val mid: Int = lo + (hi - lo) / 2 arr(mid) match { - case mv if (mv == elem) => mid - case mv if (mv <= elem) => SearchImpl(mid + 1, hi) + case mv if mv == elem => mid + case mv if mv <= elem => SearchImpl(mid + 1, hi) case _ => SearchImpl(lo, mid - 1) } } @@ -63,13 +63,14 @@ object BinarySearch { * @param hi - highest value index * @return */ + @tailrec def lowerBound(arr: List[Int], elem: Int, lo: Int, hi: Int): Int = { if (lo == hi) lo else { val m: Int = lo + (hi - lo) / 2 arr(m) match { - case mv if (mv < elem) => lowerBound(arr, elem, m + 1, hi) - case mv if (mv >= elem) => lowerBound(arr, elem, lo, m) + case mv if mv < elem => lowerBound(arr, elem, m + 1, hi) + case mv if mv >= elem => lowerBound(arr, elem, lo, m) } } } diff --git a/src/main/scala/Search/JumpSearch.scala b/src/main/scala/Search/JumpSearch.scala index d183484..30a6ee4 100644 --- a/src/main/scala/Search/JumpSearch.scala +++ b/src/main/scala/Search/JumpSearch.scala @@ -25,22 +25,22 @@ object JumpSearch { a = b b = b + floor(sqrt(len)).toInt if (a >= len) { - return -1 + -1 } } while (arr(a) < elem) { a = a + 1 if (a == min(b, len)) { - return -1 + -1 } } if (arr(a) == elem) { - return a + a } else { - return -1 + -1 } } diff --git a/src/main/scala/Search/LinearSearch.scala b/src/main/scala/Search/LinearSearch.scala index ad5a2f0..811abd8 100644 --- a/src/main/scala/Search/LinearSearch.scala +++ b/src/main/scala/Search/LinearSearch.scala @@ -6,20 +6,17 @@ package Search object LinearSearch { /** * - * @param arr - a sequence of integers + * @param arr - a sequence of integers * @param elem - a integer to search for in the @args * @return - index of the @elem or -1 if elem is not fount in the @arr */ def linearSearch(arr: List[Int], elem: Int): Int = { - def iter(index: Int): Int = { - if (index != arr.length) { - if (arr(index) != elem) iter(index + 1) - else index - } else - -1 + //the functional way, common in scala would be: + //args.indexOf(target) + for (i <- arr.indices if arr(i) == elem) { + i } - - iter(0) + -1 } } \ No newline at end of file diff --git a/src/main/scala/Sort/BubbleSort.scala b/src/main/scala/Sort/BubbleSort.scala index 73af6a2..9c7b16d 100644 --- a/src/main/scala/Sort/BubbleSort.scala +++ b/src/main/scala/Sort/BubbleSort.scala @@ -12,9 +12,8 @@ object BubbleSort { def bubbleSort(array: Array[Int]): Array[Int] = { breakable { - for (i <- 0 to array.length - 1) { + for (i <- array.indices) { var swap = false - for (j <- 0 to array.length - 2) { if (array(j) > array(j + 1)) { val temp = array(j) @@ -23,13 +22,11 @@ object BubbleSort { swap = true } } - if (!swap) { break } } } - array } diff --git a/src/main/scala/Sort/HeapSort.scala b/src/main/scala/Sort/HeapSort.scala index bc8c330..e49f978 100644 --- a/src/main/scala/Sort/HeapSort.scala +++ b/src/main/scala/Sort/HeapSort.scala @@ -1,9 +1,11 @@ package Sort +import scala.util.control.Breaks.{break, breakable} + object HeapSort { /** - * @param array - a sequence of unsorted integers + * @param arr - a sequence of unsorted integers * @return - sequence of sorted integers @array */ @@ -13,22 +15,24 @@ object HeapSort { def sift(start: Int, count: Int): Unit = { var root = start - while (root * 2 + 1 < count) { - var child = root * 2 + 1 - if (child < count - 1 && sortedArray(child) < sortedArray(child + 1)) { - child += 1 - } - if (sortedArray(root) < sortedArray(child)) { - val t = sortedArray(root) - sortedArray(root) = sortedArray(child) - sortedArray(child) = t - root = child + breakable{ + while (root * 2 + 1 < count) { + var child = root * 2 + 1 + if (child < count - 1 && sortedArray(child) < sortedArray(child + 1)) { + child += 1 + } + if (sortedArray(root) < sortedArray(child)) { + val t = sortedArray(root) + sortedArray(root) = sortedArray(child) + sortedArray(child) = t + root = child + } + else break } - else return } } - var count = sortedArray.length + val count = sortedArray.length var start = count / 2 - 1 var end = count - 1 diff --git a/src/main/scala/Sort/InsertionSort.scala b/src/main/scala/Sort/InsertionSort.scala index 8a029b4..d07feb0 100644 --- a/src/main/scala/Sort/InsertionSort.scala +++ b/src/main/scala/Sort/InsertionSort.scala @@ -4,21 +4,21 @@ object InsertionSort { /** * - * @param array - a sequence of unsorted integers + * @param array - a sequence of unsorted integers * @return - sequence of sorted integers @array */ - def insertionSort(array: Array[Int]): Array[Int] = { + def insertionSort(array: Array[Int]) : Array[Int] = { - for (i <- 0 to array.length - 1) { - val temp: Int = array(i) - var j = i - 1 - while (j >= 0 && temp < array(j)) { - array(j + 1) = array(j) - j -= 1 + for(i <- array.indices) { + val temp:Int=array(i) + var j=i-1 + while(j>=0 && temp if (x <= x2) x :: xs else x2 :: ins(x, xs2) } } - insertion(array) } } \ No newline at end of file diff --git a/src/main/scala/Sort/SelectionSort.scala b/src/main/scala/Sort/SelectionSort.scala index 72fe535..6bc923b 100644 --- a/src/main/scala/Sort/SelectionSort.scala +++ b/src/main/scala/Sort/SelectionSort.scala @@ -9,21 +9,21 @@ object SelectionSort { */ def selectionSort(array: Array[Int]): Array[Int] = { - for (i <- 0 to array.length - 1) { + for(i <- array.indices) { var min: Int = i var minVal = array(i) - for (j <- i + 1 to array.length - 1) { - if (array(j) < minVal) { + for(j <- i + 1 until array.length) { + if(array(j) < minVal) { min = j minVal = array(j) } } val temp: Int = array(i) - array(i) = array(min) - array(min) = temp + array(i)=array(min) + array(min)=temp } diff --git a/src/test/scala/Mathematics/GreaterCommonDivisorSpec.scala b/src/test/scala/Mathematics/GreatestCommonDivisorSpec.scala similarity index 66% rename from src/test/scala/Mathematics/GreaterCommonDivisorSpec.scala rename to src/test/scala/Mathematics/GreatestCommonDivisorSpec.scala index ab0341b..8c77f5b 100644 --- a/src/test/scala/Mathematics/GreaterCommonDivisorSpec.scala +++ b/src/test/scala/Mathematics/GreatestCommonDivisorSpec.scala @@ -2,14 +2,14 @@ package Mathematics import org.scalatest.FlatSpec -class GreaterCommonDivisorSpec extends FlatSpec { +class GreatestCommonDivisorSpec extends FlatSpec { "GreaterCommonDivisorSpec 1" should "output the correct Integer as a result Greatest Common Divisor of two numbers" in { - assert(GreaterCommonDivisor.gcd(80, 10) === 10) + assert(GreatestCommonDivisor.gcd(80, 10) === 10) } "GreaterCommonDivisorSpec 2" should "output the correct Integer as a result Greatest Common Divisor of two numbers" in { - assert(GreaterCommonDivisor.gcd(7, 95) === 1) + assert(GreatestCommonDivisor.gcd(7, 95) === 1) } } diff --git a/src/test/scala/Mathematics/LinearSieveSpec.scala b/src/test/scala/Mathematics/LinearSieveSpec.scala index 8076fe1..e19e15f 100644 --- a/src/test/scala/Mathematics/LinearSieveSpec.scala +++ b/src/test/scala/Mathematics/LinearSieveSpec.scala @@ -13,8 +13,8 @@ class LinearSieveSpec extends FlatSpec { LinearSieve.getPrimeNumbers(n).foreach(x => assert(isPrime(x))) } - def isPrime(n: Int): Boolean = { - for (i <- 2 until n) if (n % i == 0) return false + def isPrime(n: Long): Boolean = { + for (i <- 2 until n) if (n % i == 0) false true } }