From ff253c31dda8ad7583dd13ce6796dc7d303fe9ec Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 16 Oct 2017 14:22:38 +0300 Subject: [PATCH 1/3] codestyle format --- kek2/Java | 1 + 1 file changed, 1 insertion(+) create mode 160000 kek2/Java diff --git a/kek2/Java b/kek2/Java new file mode 160000 index 0000000..d207fbc --- /dev/null +++ b/kek2/Java @@ -0,0 +1 @@ +Subproject commit d207fbc8f6316ee94011c17d43e488e48f2e61eb From 66865afcebe7d64f67ad9e3b530bbcdceee4545f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 16 Oct 2017 14:23:18 +0300 Subject: [PATCH 2/3] codestyle format --- Untitled Folder 2/Java/.gitignore | 49 +++++++++++ Untitled Folder 2/Java/.idea/compiler.xml | 16 ++++ Untitled Folder 2/Java/.idea/misc.xml | 13 +++ Untitled Folder 2/Java/.idea/modules.xml | 8 ++ Untitled Folder 2/Java/Maybe.iml | 17 ++++ Untitled Folder 2/Java/pom.xml | 36 ++++++++ .../java/ru/spbau/mit/kazakov/Maybe/Main.java | 63 +++++++++++++ .../ru/spbau/mit/kazakov/Maybe/Maybe.java | 83 ++++++++++++++++++ .../kazakov/Maybe/getNothingException.java | 7 ++ .../ru/spbau/mit/kazakov/Maybe/MainTest.java | 47 ++++++++++ .../ru/spbau/mit/kazakov/Maybe/MaybeTest.java | 60 +++++++++++++ .../ru/spbau/mit/kazakov/Maybe/Main.class | Bin 0 -> 3978 bytes .../ru/spbau/mit/kazakov/Maybe/Maybe.class | Bin 0 -> 2100 bytes .../kazakov/Maybe/getNothingException.class | Bin 0 -> 339 bytes .../compile/default-compile/createdFiles.lst | 3 + .../compile/default-compile/inputFiles.lst | 3 + .../default-testCompile/createdFiles.lst | 2 + .../default-testCompile/inputFiles.lst | 2 + ...ST-ru.spbau.mit.kazakov.Maybe.MainTest.xml | 64 ++++++++++++++ ...T-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml | 70 +++++++++++++++ .../ru.spbau.mit.kazakov.Maybe.MainTest.txt | 4 + .../ru.spbau.mit.kazakov.Maybe.MaybeTest.txt | 4 + .../ru/spbau/mit/kazakov/Maybe/MainTest.class | Bin 0 -> 2225 bytes .../spbau/mit/kazakov/Maybe/MaybeTest.class | Bin 0 -> 3912 bytes 24 files changed, 551 insertions(+) create mode 100644 Untitled Folder 2/Java/.gitignore create mode 100644 Untitled Folder 2/Java/.idea/compiler.xml create mode 100644 Untitled Folder 2/Java/.idea/misc.xml create mode 100644 Untitled Folder 2/Java/.idea/modules.xml create mode 100644 Untitled Folder 2/Java/Maybe.iml create mode 100644 Untitled Folder 2/Java/pom.xml create mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java create mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java create mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java create mode 100644 Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java create mode 100644 Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java create mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class create mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Maybe.class create mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/getNothingException.class create mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst create mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst create mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst create mode 100644 Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MainTest.xml create mode 100644 Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml create mode 100644 Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt create mode 100644 Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt create mode 100644 Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class create mode 100644 Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class diff --git a/Untitled Folder 2/Java/.gitignore b/Untitled Folder 2/Java/.gitignore new file mode 100644 index 0000000..345e61a --- /dev/null +++ b/Untitled Folder 2/Java/.gitignore @@ -0,0 +1,49 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/Untitled Folder 2/Java/.idea/compiler.xml b/Untitled Folder 2/Java/.idea/compiler.xml new file mode 100644 index 0000000..067d5ff --- /dev/null +++ b/Untitled Folder 2/Java/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/.idea/misc.xml b/Untitled Folder 2/Java/.idea/misc.xml new file mode 100644 index 0000000..e8942bd --- /dev/null +++ b/Untitled Folder 2/Java/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/.idea/modules.xml b/Untitled Folder 2/Java/.idea/modules.xml new file mode 100644 index 0000000..65c89bb --- /dev/null +++ b/Untitled Folder 2/Java/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/Maybe.iml b/Untitled Folder 2/Java/Maybe.iml new file mode 100644 index 0000000..57f498f --- /dev/null +++ b/Untitled Folder 2/Java/Maybe.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/pom.xml b/Untitled Folder 2/Java/pom.xml new file mode 100644 index 0000000..fe36c91 --- /dev/null +++ b/Untitled Folder 2/Java/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + ru.spbau.mit.kazakov.Maybe + Maybe + 1.0-SNAPSHOT + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + junit + junit + 4.8 + + + org.jetbrains + annotations + 13.0 + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java new file mode 100644 index 0000000..8bd1447 --- /dev/null +++ b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java @@ -0,0 +1,63 @@ +package ru.spbau.mit.kazakov.Maybe; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.*; +import java.util.ArrayList; +import java.util.Scanner; + +/** + * Reads numbers from input file and writes squared values to output file. If read data isn't a number writes "null" instead. + */ +public class Main { + /** + * Primary method. + * + * @param args the first argument is input file and the second one is output file + */ + public static void main(@NotNull String[] args) throws IOException, getNothingException { + ArrayList> readData = new ArrayList<>(); + try (Scanner scanner = new Scanner(new File(args[0]))) { + while (scanner.hasNextLine()) { + Integer value = tryParse(scanner.nextLine()); + if (value == null) { + readData.add(Maybe.nothing()); + } else { + readData.add(Maybe.just(value)); + } + } + } + + ArrayList> squaredNumber = new ArrayList<>(); + for (Maybe maybeInt : readData) { + squaredNumber.add(maybeInt.map(value -> value * value)); + } + + try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(args[1]))) { + for (Maybe maybeInt : squaredNumber) { + if (maybeInt.isPresent()) { + bufferedWriter.write(maybeInt.get().toString()); + } else { + bufferedWriter.write("null"); + } + bufferedWriter.newLine(); + } + } + } + + /** + * Parses specified String to Integer. + * + * @return Integer if String was a number, and null otherwise + */ + @Nullable + private static Integer tryParse(@NotNull String parsingString) { + try { + return Integer.parseInt(parsingString); + } catch (NumberFormatException e) { + return null; + } + } + +} diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java new file mode 100644 index 0000000..b0216f4 --- /dev/null +++ b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java @@ -0,0 +1,83 @@ +package ru.spbau.mit.kazakov.Maybe; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Function; + +/** + * Generic container for storing a value or nothing. + */ +public class Maybe { + @Nullable + private final T value; + + /** + * Assigns specified value to class's storing field. + * + * @param t specified value + */ + private Maybe(T t) { + value = t; + } + + /** + * Creates an object for storing specified value. + * + * @param t specified value + * @return new object + */ + @NotNull + public static Maybe just(T t) { + return new Maybe(t); + } + + /** + * Creates an object for strong nothing. + * + * @return new object + */ + @NotNull + public static Maybe nothing() { + return new Maybe(null); + } + + /** + * Returns stored value or throws exception if there is no value. + * + * @return stored value + * @throws getNothingException if there is no stored value + */ + @NotNull + public T get() throws getNothingException { + if (isPresent()) { + return value; + } else { + throw new getNothingException(); + } + } + + /** + * Checks if there is stored value. + * + * @return true if there is stored value, and false otherwise + */ + public boolean isPresent() { + return value != null; + } + + /** + * Maps stored value of type T to another value of type U. + * + * @param mapper a function acting from T to V + * @param image's type + * @return Maybe object storing mapped value if there is a storing value, and Maybe object storing nothing otherwise + */ + @NotNull + public Maybe map(@NotNull Function mapper) { + if (!isPresent()) { + return nothing(); + } + return just(mapper.apply(value)); + } +} diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java new file mode 100644 index 0000000..7789bf9 --- /dev/null +++ b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java @@ -0,0 +1,7 @@ +package ru.spbau.mit.kazakov.Maybe; + +/** + * Exception thrown when there is no value to return. + */ +public class getNothingException extends Exception { +} diff --git a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java new file mode 100644 index 0000000..90c6fe1 --- /dev/null +++ b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java @@ -0,0 +1,47 @@ +package ru.spbau.mit.kazakov.Maybe; + +import org.junit.Test; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Scanner; + +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; + +import static org.junit.Assert.*; + +public class MainTest { + @Rule + public TemporaryFolder testFolder = new TemporaryFolder(); + + @Test + public void testMain() throws IOException, getNothingException { + File input = testFolder.newFile("input.txt"); + File output = testFolder.newFile("output.txt"); + + try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(input))) { + bufferedWriter.write("1\n0\n-3\nj\njava\n1b\n11 22\n"); + } + + Main.main(new String[]{input.getAbsolutePath(), output.getAbsolutePath()}); + + + assertEquals("1\n0\n9\nnull\nnull\nnull\nnull\n", new String(Files.readAllBytes(Paths.get(output.getAbsolutePath())))); + } + + @Test + public void testMainEmpty() throws IOException, getNothingException { + File input = testFolder.newFile("input.txt"); + File output = testFolder.newFile("output.txt"); + + Main.main(new String[]{input.getAbsolutePath(), output.getAbsolutePath()}); + + assertEquals("", new String(Files.readAllBytes(Paths.get(output.getAbsolutePath())))); + } + +} \ No newline at end of file diff --git a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java new file mode 100644 index 0000000..54b7846 --- /dev/null +++ b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java @@ -0,0 +1,60 @@ +package ru.spbau.mit.kazakov.Maybe; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class MaybeTest { + @Test + public void testJustInteger() throws getNothingException { + Maybe maybeInteger = Maybe.just(5); + int storedValue = maybeInteger.get(); + assertEquals(5, storedValue); + } + + @Test + public void testNothingBoolean() { + Maybe maybeBoolean = Maybe.nothing(); + assertFalse(maybeBoolean.isPresent()); + } + + @Test + public void testGetDouble() throws getNothingException { + Maybe maybeDouble = Maybe.just(-7.0); + double storedValue = maybeDouble.get(); + assertEquals(-7.0, storedValue, 0.000000001); + } + + @Test(expected = getNothingException.class) + public void testGetCharacterThrowsException() throws getNothingException { + Maybe maybeCharacter = Maybe.nothing(); + char storedValue = maybeCharacter.get(); + } + + @Test + public void testIsPresentFalse() { + Maybe maybeBoolean = Maybe.nothing(); + assertFalse(maybeBoolean.isPresent()); + } + + @Test + public void testIsPresentTrue() { + Maybe maybeString = Maybe.just("abacaba"); + assertTrue(maybeString.isPresent()); + } + + @Test + public void testMapJust() throws getNothingException { + Maybe maybeInteger = Maybe.just(10); + Maybe mappedMaybeInteger = maybeInteger.map(value -> value * value); + int mappedValue = mappedMaybeInteger.get(); + assertEquals(100, mappedValue); + } + + @Test + public void testMapNothing() throws getNothingException { + Maybe maybeInteger = Maybe.nothing(); + Maybe mappedMaybeInteger = maybeInteger.map(value -> value * value); + assertFalse(mappedMaybeInteger.isPresent()); + } +} \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class b/Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..6bafd51dadac3eb34fc19d52644fad85854c4d65 GIT binary patch literal 3978 zcmbVP>sMS?75^QWnL7-Zgg~Gf@&ZBpE!L{;-q^kyh``#J27#3#v;hx7n`|Q{G?S0Pu z+x=Uw19&@LkD(Rs*YHdXWzv5@!v|vs!-ye-QEA4c8IR#0%ow&~LKr7yG$jj`hUpl# zVn)d6N@S3g#@3Llp@LaqysF`vhPfDah}cK)tPr1*=6MYtieWcCEaVrWcv1R~NMi~4 zqtd*j;bYQ&T*D_cd{QBD+{#++35D|3wu=g(K6~6$*qXGmW~z`GHJuB_XquFoq&;S& zFB*;|^CB_iPFZ<{rleCyqlC29^i1t~qHs+^yxujBM6)R@V!zl}-%%M6O3OqKo_r z&6^uTHu7&7Elf<9jyZnGv0M?m!&htBiBs!V#B#%#q?5H97*55GX^fvXTtlJG7vWjf z>o~?-(#pHsUzNX7FsRB8CquA4l5@FIG>`pH%a3mmoD)=$+DP^B|5Ka@tQvNWv6(?5 z=N&Ww?O}PE0MpQ;;Zq(4a|*FD*T&48YuVYnhEHqwj6%!#Le{l1Jd9Z@ZxJi!49Ccr zjB;-_YrBTWtgtU>JCliN(;amPjC_K}TUtz{Y&TU%r)fvjb>_G~PhcEu4LDx{PJpxq z7Deu+z=|LEe%r|y?y9}wWR8-FKVO(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d9=LCkF{4^TaZby`n*@b%SY&a? z@itn}famy2^%zmOKueF}7-{#=;*BEs7vCk1;~hjFF^6vSaDP-y)2??Cqp#o}IKfdF z-bH#lclt6;uF5z`y!!mTtNgv>KSlmm(QqHTH1ugWt>MgD*sG!cO;nVnIE(eOc{jfm zR3oB+!y+F@gc6qW6-p}e*MNUR_jt~}iT(G{pn-+&jE1vsA)(XgBG#=t0Chs{vKXI9~GSVvBm#}XMEjNHB7(JbYj0uCNix)&)ysRWa8E@c)h=8kARw24ew90+!WXCv=Oj45>O8h7K z2Ym4XtGw-6wfp9SKg#laGZP>XiBOsD{=V*W&Ufkl`t9HU09?WES@dHvgCwR5T+MR4 zCZFpDZe)?hq%5ZUQN&G|%^0|)(6_2GO0_%jLzb30k{j}=n48-J5>aKUly#h_lcy^)4p`pE)EywcrI- zt6A28Rd;-AMZeH1jaBQuUMt(tm(Wfx~8Y8@@sMA{EDo!E6vyc<*pj95bJhd_wNjIu{YG2n9w% zIy2f7k{~46vH+%_@nLwZF_iKB=a5EWlwq+TPHd=nnujA?!g`@jx%v9#Iykm#Qk#BrR9!+jAq z#IS_>3dSewSsxd+e~?Mw6S7jMtuZe$<_GM%KSI{1KZavguyE%wL4wWx5MR_E;>X@eR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml b/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml new file mode 100644 index 0000000..8af6efe --- /dev/null +++ b/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt new file mode 100644 index 0000000..adbb610 --- /dev/null +++ b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: ru.spbau.mit.kazakov.Maybe.MainTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec - in ru.spbau.mit.kazakov.Maybe.MainTest diff --git a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt new file mode 100644 index 0000000..15d544e --- /dev/null +++ b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: ru.spbau.mit.kazakov.Maybe.MaybeTest +------------------------------------------------------------------------------- +Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec - in ru.spbau.mit.kazakov.Maybe.MaybeTest diff --git a/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class b/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class new file mode 100644 index 0000000000000000000000000000000000000000..3f48d60837c6182b50031c73aeaf1e02f1a8ebe6 GIT binary patch literal 2225 zcma)7*-{%v6g`b3MvMou8Y4Ri;3aGZ0nTEC?SwUUB9;KbmdQ4f1{fI4$fFr!@{o^6 z-s0C(`6;P#RRUC~#BYAcM}?f85kgSdNr8H~ef#ve=icu5`=3Al0`MM6DlTJGK}tmp zM(c11V{zP;lRI(TRq&C5k5$xRTtyrcaZJj7N;cC9W>hrb69xBF+{dRXK0`W=Srv1b zSFwQ4RWxBy#S)g|_(H*of(HVsXOz4d$I2V7Kv&vv*OQyRZF))9w~SJ9*(ekpS9f

nBUatnMcZWVWS$r*An=lC%0w)?jPe z%Z!0%#bqpVE^t2UudNxbk$>Qto(!!$y{SLZlctlLII+TQG1D&k9`{sSX3UVg<9oqM z{gS8Wwr2HWz$=jMVUUa&3OM~VXA}bg6l4@UIw?b$TKy5V=|a)l;jSgecXNh3NTB{G zhC#_uLnpcfI{qUS8s5U&0(AlTLGP)jVHIBzIV3GD0&QmpO}UR2B!f^RdG1%T`C8!O zusWm;+*CJJ>8B27)#2gJkr7qHH~3bAE(x{-5SDJQCzm%|XIth?Ll!v-aJ;nSxu(6Y z;Gu>*3BEE}R7`*K?Lrk_Dva^GklQ=o+Pxk!P`2`&W_^KsGRf@odSl ze9u_WJ!Yb{r_8XLH0$pTDuj0|S_rOMThHnlLCcr|v2BLA#v)6~(|DO9Bp@(W&9E%g zSui2;2@KxYQ^-<9B5SUp=f^E;VuzRQScH?Cdsio@ThHo*)VJ~Yj*U|}S5}A~45lCZ zxc#-SPGO&6BzbILi}MA(XL2416zQWTKs(z6TB&q5RUV+u3mj+I ze@~r%q$0o2TPoH^?XKYwdeBP*>QmNE#m`*pr-rTg2{$;ZArAOej31ItOu?XnWbi+v zU>JhUxfwS1_&ekmR5|TY@roQ0D^gh|=m>wcG~VQ={iqz?r%f>Uasu%KrH}-t&Pw3f vvL;?H>rnx<5fv0kr2wrAxR;?$GEgZ^XLw#kkW@vGp|T*a=lvn~*WlK_9R~(P literal 0 HcmV?d00001 diff --git a/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class b/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class new file mode 100644 index 0000000000000000000000000000000000000000..fe9ccbf84598e037745c1e9f962681c7c236ddc4 GIT binary patch literal 3912 zcmb7HX;;){6nIA23#v>5l37`TkD3>D!5<=wMuDg?Gk1p1cqcxGAP#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gitignore | 0 .../Java => Streams}/.idea/compiler.xml | 4 +- .../Maven__com_google_guava_guava_19_0.xml | 13 + .../libraries/Maven__junit_junit_4_12.xml | 13 + .../Maven__org_hamcrest_hamcrest_core_1_3.xml | 13 + .../Maven__org_jetbrains_annotations_13_0.xml | 13 + .../Java => Streams}/.idea/misc.xml | 0 .../Java => Streams}/.idea/modules.xml | 2 +- Streams/.idea/uiDesigner.xml | 124 +++ Streams/.idea/workspace.xml | 858 ++++++++++++++++++ .../Java/Maybe.iml => Streams/Streams.iml | 4 +- {Untitled Folder 2/Java => Streams}/pom.xml | 11 +- .../ru/spbau/mit/kazakov/Streams/Album.java | 29 + .../ru/spbau/mit/kazakov/Streams/Artist.java | 14 + .../mit/kazakov/Streams/FirstPartTasks.java | 117 +++ .../mit/kazakov/Streams/SecondPartTasks.java | 86 ++ .../ru/spbau/mit/kazakov/Streams/Track.java | 20 + .../kazakov/Streams/FirstPartTasksTest.java | 206 +++++ .../kazakov/Streams/SecondPartTasksTest.java | 108 +++ .../java/ru/spbau/mit/kazakov/Maybe/Main.java | 63 -- .../ru/spbau/mit/kazakov/Maybe/Maybe.java | 83 -- .../kazakov/Maybe/getNothingException.java | 7 - .../ru/spbau/mit/kazakov/Maybe/MainTest.java | 47 - .../ru/spbau/mit/kazakov/Maybe/MaybeTest.java | 60 -- .../ru/spbau/mit/kazakov/Maybe/Main.class | Bin 3978 -> 0 bytes .../ru/spbau/mit/kazakov/Maybe/Maybe.class | Bin 2100 -> 0 bytes .../kazakov/Maybe/getNothingException.class | Bin 339 -> 0 bytes .../compile/default-compile/createdFiles.lst | 3 - .../compile/default-compile/inputFiles.lst | 3 - .../default-testCompile/createdFiles.lst | 2 - .../default-testCompile/inputFiles.lst | 2 - ...ST-ru.spbau.mit.kazakov.Maybe.MainTest.xml | 64 -- ...T-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml | 70 -- .../ru.spbau.mit.kazakov.Maybe.MainTest.txt | 4 - .../ru.spbau.mit.kazakov.Maybe.MaybeTest.txt | 4 - .../ru/spbau/mit/kazakov/Maybe/MainTest.class | Bin 2225 -> 0 bytes .../spbau/mit/kazakov/Maybe/MaybeTest.class | Bin 3912 -> 0 bytes kek2/Java | 1 - 38 files changed, 1628 insertions(+), 420 deletions(-) rename {Untitled Folder 2/Java => Streams}/.gitignore (100%) rename {Untitled Folder 2/Java => Streams}/.idea/compiler.xml (87%) create mode 100644 Streams/.idea/libraries/Maven__com_google_guava_guava_19_0.xml create mode 100644 Streams/.idea/libraries/Maven__junit_junit_4_12.xml create mode 100644 Streams/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 Streams/.idea/libraries/Maven__org_jetbrains_annotations_13_0.xml rename {Untitled Folder 2/Java => Streams}/.idea/misc.xml (100%) rename {Untitled Folder 2/Java => Streams}/.idea/modules.xml (61%) create mode 100644 Streams/.idea/uiDesigner.xml create mode 100644 Streams/.idea/workspace.xml rename Untitled Folder 2/Java/Maybe.iml => Streams/Streams.iml (77%) rename {Untitled Folder 2/Java => Streams}/pom.xml (78%) create mode 100644 Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Album.java create mode 100644 Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Artist.java create mode 100644 Streams/src/main/java/ru/spbau/mit/kazakov/Streams/FirstPartTasks.java create mode 100644 Streams/src/main/java/ru/spbau/mit/kazakov/Streams/SecondPartTasks.java create mode 100644 Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Track.java create mode 100644 Streams/src/test/java/ru/spbau/mit/kazakov/Streams/FirstPartTasksTest.java create mode 100644 Streams/src/test/java/ru/spbau/mit/kazakov/Streams/SecondPartTasksTest.java delete mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java delete mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java delete mode 100644 Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java delete mode 100644 Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java delete mode 100644 Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java delete mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class delete mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Maybe.class delete mode 100644 Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/getNothingException.class delete mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst delete mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst delete mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst delete mode 100644 Untitled Folder 2/Java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst delete mode 100644 Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MainTest.xml delete mode 100644 Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml delete mode 100644 Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt delete mode 100644 Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt delete mode 100644 Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class delete mode 100644 Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class delete mode 160000 kek2/Java diff --git a/Untitled Folder 2/Java/.gitignore b/Streams/.gitignore similarity index 100% rename from Untitled Folder 2/Java/.gitignore rename to Streams/.gitignore diff --git a/Untitled Folder 2/Java/.idea/compiler.xml b/Streams/.idea/compiler.xml similarity index 87% rename from Untitled Folder 2/Java/.idea/compiler.xml rename to Streams/.idea/compiler.xml index 067d5ff..7b00039 100644 --- a/Untitled Folder 2/Java/.idea/compiler.xml +++ b/Streams/.idea/compiler.xml @@ -6,11 +6,11 @@ - + - + \ No newline at end of file diff --git a/Streams/.idea/libraries/Maven__com_google_guava_guava_19_0.xml b/Streams/.idea/libraries/Maven__com_google_guava_guava_19_0.xml new file mode 100644 index 0000000..68e23cc --- /dev/null +++ b/Streams/.idea/libraries/Maven__com_google_guava_guava_19_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Streams/.idea/libraries/Maven__junit_junit_4_12.xml b/Streams/.idea/libraries/Maven__junit_junit_4_12.xml new file mode 100644 index 0000000..d411041 --- /dev/null +++ b/Streams/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Streams/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/Streams/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/Streams/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Streams/.idea/libraries/Maven__org_jetbrains_annotations_13_0.xml b/Streams/.idea/libraries/Maven__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..e2c8297 --- /dev/null +++ b/Streams/.idea/libraries/Maven__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/.idea/misc.xml b/Streams/.idea/misc.xml similarity index 100% rename from Untitled Folder 2/Java/.idea/misc.xml rename to Streams/.idea/misc.xml diff --git a/Untitled Folder 2/Java/.idea/modules.xml b/Streams/.idea/modules.xml similarity index 61% rename from Untitled Folder 2/Java/.idea/modules.xml rename to Streams/.idea/modules.xml index 65c89bb..a361b3a 100644 --- a/Untitled Folder 2/Java/.idea/modules.xml +++ b/Streams/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/Streams/.idea/uiDesigner.xml b/Streams/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/Streams/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Streams/.idea/workspace.xml b/Streams/.idea/workspace.xml new file mode 100644 index 0000000..3392bd5 --- /dev/null +++ b/Streams/.idea/workspace.xml @@ -0,0 +1,858 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + entr + count + mapp + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1511358932626 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No facets are configured + + + + + + + + + + + + + + + 1.8 + + + + + + + + Streams + + + + + + + + Maven: com.google.guava:guava:19.0 + + + + + + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/Maybe.iml b/Streams/Streams.iml similarity index 77% rename from Untitled Folder 2/Java/Maybe.iml rename to Streams/Streams.iml index 57f498f..7541fb6 100644 --- a/Untitled Folder 2/Java/Maybe.iml +++ b/Streams/Streams.iml @@ -11,7 +11,9 @@ - + + + \ No newline at end of file diff --git a/Untitled Folder 2/Java/pom.xml b/Streams/pom.xml similarity index 78% rename from Untitled Folder 2/Java/pom.xml rename to Streams/pom.xml index fe36c91..52bdcae 100644 --- a/Untitled Folder 2/Java/pom.xml +++ b/Streams/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - ru.spbau.mit.kazakov.Maybe - Maybe + ru.spbau.mit.kazakov + Streams 1.0-SNAPSHOT @@ -24,13 +24,18 @@ junit junit - 4.8 + 4.12 org.jetbrains annotations 13.0 + + com.google.guava + guava + 19.0 + \ No newline at end of file diff --git a/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Album.java b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Album.java new file mode 100644 index 0000000..983c69b --- /dev/null +++ b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Album.java @@ -0,0 +1,29 @@ +package ru.spbau.mit.kazakov.Streams; + +import java.util.Arrays; +import java.util.List; + +public class Album { + + private final String name; + private final List tracks; + private final Artist artist; + + public Album(Artist artist, String name, Track... tracks) { + this.name = name; + this.tracks = Arrays.asList(tracks); + this.artist = artist; + } + + public String getName() { + return name; + } + + public List getTracks() { + return tracks; + } + + public Artist getArtist() { + return artist; + } +} \ No newline at end of file diff --git a/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Artist.java b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Artist.java new file mode 100644 index 0000000..f5bfbb1 --- /dev/null +++ b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Artist.java @@ -0,0 +1,14 @@ +package ru.spbau.mit.kazakov.Streams; + +public class Artist { + + private final String name; + + public Artist(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/FirstPartTasks.java b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/FirstPartTasks.java new file mode 100644 index 0000000..aa9eac1 --- /dev/null +++ b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/FirstPartTasks.java @@ -0,0 +1,117 @@ +package ru.spbau.mit.kazakov.Streams; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +public final class FirstPartTasks { + + private FirstPartTasks() { + } + + /** + * Список названий альбомов + */ + public static List allNames(Stream albums) { + return albums.map(Album::getName).collect(Collectors.toList()); + } + + /** + * Список названий альбомов, отсортированный лексикографически по названию + */ + public static List allNamesSorted(Stream albums) { + return albums + .map(Album::getName) + .sorted() + .collect(Collectors.toList()); + } + + /** + * Список треков, отсортированный лексикографически по названию, включающий все треки альбомов из 'albums' + */ + public static List allTracksSorted(Stream albums) { + return albums + .flatMap(album -> album.getTracks().stream()) + .map(Track::getName) + .sorted() + .collect(Collectors.toList()); + } + + /** + * Список альбомов, в которых есть хотя бы один трек с рейтингом более 95, отсортированный по названию + */ + public static List sortedFavorites(Stream s) { + return s + .filter(album -> album.getTracks().stream().anyMatch(track -> track.getRating() > 95)) + .sorted(Comparator.comparing(Album::getName)) + .collect(Collectors.toList()); + } + + /** + * Сгруппировать альбомы по артистам + */ + public static Map> groupByArtist(Stream albums) { + return albums.collect(Collectors.groupingBy(Album::getArtist)); + } + + /** + * Сгруппировать альбомы по артистам (в качестве значения вместо объекта 'Artist' использовать его имя) + */ + public static Map> groupByArtistMapName(Stream albums) { + return albums.collect(Collectors.groupingBy(Album::getArtist, + Collectors.mapping(Album::getName, Collectors.toList()))); + } + + /** + * Число повторяющихся альбомов в потоке + */ + public static long countAlbumDuplicates(Stream albums) { + return albums + .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) + .entrySet().stream() + .filter(e -> e.getValue() > 1).count(); + } + + /** + * Альбом, в котором максимум рейтинга минимален + * (если в альбоме нет ни одного трека, считать, что максимум рейтинга в нем --- 0) + */ + public static Optional minMaxRating(Stream albums) { + return albums.min(Comparator.comparingInt(a -> a.getTracks().stream().mapToInt(Track::getRating).max().orElse(0))); + } + + /** + * Список альбомов, отсортированный по убыванию среднего рейтинга его треков (0, если треков нет) + */ + public static List sortByAverageRating(Stream albums) { + return albums + .sorted(Comparator.comparingDouble(a -> -a.getTracks().stream() + .mapToDouble(Track::getRating) + .average().orElse(0))) + .collect(Collectors.toList()); + } + + /** + * Произведение всех чисел потока по модулю 'modulo' + * (все числа от 0 до 10000) + */ + public static int moduloProduction(IntStream stream, int modulo) { + return stream.reduce((n1, n2) -> n1 * n2 % modulo).orElse(0); + } + + /** + * Вернуть строку, состояющую из конкатенаций переданного массива, и окруженную строками "<", ">" + */ + public static String joinTo(String... strings) { + return Arrays.stream(strings).collect(Collectors.joining(", ", "<", ">")); + } + + /** + * Вернуть поток из объектов класса 'clazz' + */ + public static Stream filterIsInstance(Stream s, Class clazz) { + return s.filter(clazz::isInstance).map(clazz::cast); + } +} \ No newline at end of file diff --git a/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/SecondPartTasks.java b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/SecondPartTasks.java new file mode 100644 index 0000000..bb146a8 --- /dev/null +++ b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/SecondPartTasks.java @@ -0,0 +1,86 @@ +package ru.spbau.mit.kazakov.Streams; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public final class SecondPartTasks { + + private SecondPartTasks() { + } + + /** + * Найти строки из переданных файлов, в которых встречается указанная подстрока. + */ + public static List findQuotes(List paths, CharSequence sequence) throws java.io.IOException { + return paths.stream() + .map(Paths::get) + .flatMap(SecondPartTasks::safeLines) + .filter(s -> s.contains(sequence)) + .collect(Collectors.toList()); + } + + /** + * Converts specified path to stream of String. Throws unchecked RuntimeException, if couldn't read from file. + * + * @param path specified path + * @return stream of Strings + */ + private static Stream safeLines(Path path) { + try { + return Files.lines(path); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * В квадрат с длиной стороны 1 вписана мишень. + * Стрелок атакует мишень и каждый раз попадает в произвольную точку квадрата. + * Надо промоделировать этот процесс с помощью класса java.util.Random и посчитать, какова вероятность попасть в мишень. + */ + public static double piDividedBy4() { + return Stream.generate(new Supplier() { + Random random = new Random(); + + @Override + public Double get() { + return Math.pow(random.nextDouble() - 0.5, 2) + Math.pow(random.nextDouble() - 0.5, 2); + } + }) + .limit(1000000) + .filter(d -> d <= 0.25) + .count() / 1000000.0; + } + + /** + * Дано отображение из имени автора в список с содержанием его произведений. + * Надо вычислить, чья общая длина произведений наибольшая. + */ + public static String findPrinter(Map> compositions) { + return compositions.entrySet().stream() + .max(Comparator + .comparingInt(e -> e.getValue().stream() + .mapToInt(String::length) + .sum())) + .map(Map.Entry::getKey).orElse(""); + } + + /** + * Вы крупный поставщик продуктов. Каждая торговая сеть делает вам заказ в виде Map<Товар, Количество>. + * Необходимо вычислить, какой товар и в каком количестве надо поставить. + */ + public static Map calculateGlobalOrder(List> orders) { + return orders.stream() + .flatMap(m -> m.entrySet().stream()) + .collect(Collectors.groupingBy( + Map.Entry::getKey, + Collectors.summingInt(Map.Entry::getValue) + )); + } +} diff --git a/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Track.java b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Track.java new file mode 100644 index 0000000..4cc194d --- /dev/null +++ b/Streams/src/main/java/ru/spbau/mit/kazakov/Streams/Track.java @@ -0,0 +1,20 @@ +package ru.spbau.mit.kazakov.Streams; + +public class Track { + + private final String name; + private final int rating; + + public Track(String name, int rating) { + this.name = name; + this.rating = rating; + } + + public String getName() { + return name; + } + + public int getRating() { + return rating; + } +} \ No newline at end of file diff --git a/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/FirstPartTasksTest.java b/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/FirstPartTasksTest.java new file mode 100644 index 0000000..56166c8 --- /dev/null +++ b/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/FirstPartTasksTest.java @@ -0,0 +1,206 @@ +package ru.spbau.mit.kazakov.Streams; + +import com.google.common.collect.ImmutableMap; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.junit.Assert.*; +import static ru.spbau.mit.kazakov.Streams.FirstPartTasks.*; + +public class FirstPartTasksTest { + + @Test + public void testAllNames() { + assertEquals( + Arrays.asList("Sun Structures", "Keep In The Dark"), + allNames(Stream.of(ALBUM_0, ALBUM_1))); + + assertEquals( + Collections.emptyList(), + allNames(Stream.of())); + } + + @Test + public void testAllNamesSorted() { + assertEquals( + Arrays.asList("Keep In The Dark", "Sun Structures"), + allNamesSorted(Stream.of(ALBUM_0, ALBUM_1))); + + assertEquals( + Collections.emptyList(), + allNamesSorted(Stream.of())); + } + + @Test + public void testAllTracksSorted() { + assertEquals( + Arrays.asList( + "A Question Isn't Answered", "Colours to Life", "Fragment's Light", + "Jewel of Mine Eye", "Keep in the Dark", "Keep in the Dark", "Mesmerise", + "Move With The Season", "Sand Dance", "Shelter Song", "Sun Structures", + "Test of Time", "The Golden Throne", "The Guesser"), + allTracksSorted(Stream.of(ALBUM_0, ALBUM_1))); + + assertEquals( + Collections.emptyList(), + allTracksSorted(Stream.of())); + } + + @Test + public void testSortedFavorites() { + assertEquals( + Arrays.asList(ALBUM_13, ALBUM_18, ALBUM_10, ALBUM_5, ALBUM_12, ALBUM_4), + sortedFavorites(Stream.of(ALL_ALBUMS))); + + assertEquals( + Collections.emptyList(), + sortedFavorites(Stream.of())); + } + + @Test + public void testGroupByArtist() { + assertEquals( + ImmutableMap.of( + ARTIST_0, Arrays.asList(ALBUM_2, ALBUM_3), + ARTIST_3, Arrays.asList(ALBUM_9, ALBUM_10), + ARTIST_7, Arrays.asList(ALBUM_17, ALBUM_19)), + groupByArtist(Stream.of(ALBUM_2, ALBUM_9, ALBUM_3, ALBUM_10, ALBUM_17, ALBUM_19))); + + assertEquals( + Collections.emptyMap(), + groupByArtist(Stream.of())); + } + + @Test + public void testGroupByArtistMapName() { + assertEquals( + ImmutableMap.of( + ARTIST_0, Arrays.asList(ALBUM_2.getName(), ALBUM_3.getName()), + ARTIST_3, Arrays.asList(ALBUM_9.getName(), ALBUM_10.getName()), + ARTIST_7, Arrays.asList(ALBUM_17.getName(), ALBUM_19.getName())), + groupByArtistMapName(Stream.of(ALBUM_2, ALBUM_9, ALBUM_3, ALBUM_10, ALBUM_17, ALBUM_19))); + + assertEquals( + Collections.emptyMap(), + groupByArtistMapName(Stream.of())); + } + + @Test + public void testCountAlbumDuplicates() { + assertEquals( + 0, + countAlbumDuplicates(Stream.of(ALBUM_0, ALBUM_1, ALBUM_4))); + + assertEquals( + 0, + countAlbumDuplicates(Stream.of())); + + assertEquals( + 3, + countAlbumDuplicates(Stream.of(ALBUM_0, ALBUM_1, ALBUM_2, ALBUM_3, ALBUM_4, ALBUM_5, ALBUM_6, + ALBUM_7, ALBUM_8, ALBUM_9, ALBUM_10, ALBUM_11, ALBUM_12, ALBUM_13, ALBUM_14, ALBUM_15, ALBUM_16, + ALBUM_17, ALBUM_4, ALBUM_1, ALBUM_3, ALBUM_18, ALBUM_19))); + } + + @Test + public void testMinMaxRating() { + assertEquals( + Optional.of(ALBUM_9), + minMaxRating(Stream.of(ALBUM_2, ALBUM_9, ALBUM_3, ALBUM_10, ALBUM_17, ALBUM_19))); + + assertEquals( + Optional.empty(), + minMaxRating(Stream.of())); + } + + @Test + public void testSortByAverageRating() { + assertEquals( + Arrays.asList(ALBUM_10, ALBUM_3, ALBUM_2, ALBUM_9), + sortByAverageRating(Stream.of(ALBUM_2, ALBUM_9, ALBUM_3, ALBUM_10))); + + assertEquals( + Collections.emptyList(), + sortByAverageRating(Stream.of())); + } + + @Test + public void testModuloProduction() { + assertEquals( + 2, + moduloProduction(IntStream.of(1, 3, 5, 7, 2), 4)); + + assertEquals( + 720, + moduloProduction(IntStream.of(1, 2, 3, 4, 5, 6), 10000)); + } + + @Test + public void testJoinTo() { + assertEquals( + "", + joinTo("abc", "cde")); + + assertEquals( + "", + joinTo("abc")); + + assertEquals( + "<>", + joinTo()); + } + + @Test + public void testFilterIsInstance() { + assertEquals( + Arrays.asList("", "cde"), + filterIsInstance(Stream.of("", 1, 2.0, "cde"), CharSequence.class).collect(Collectors.toList())); + + assertEquals( + Collections.emptyList(), + filterIsInstance(Stream.of("", 1, 2.0, "cde"), Void.class).collect(Collectors.toList())); + + assertEquals( + Arrays.asList("", 1, 2.0, "cde"), + filterIsInstance(Stream.of("", 1, 2.0, "cde"), Object.class).collect(Collectors.toList())); + } + + private static final Artist ARTIST_0 = new Artist("Morcheeba"); + private static final Artist ARTIST_1 = new Artist("Temples"); + private static final Artist ARTIST_2 = new Artist("God Help the Girl"); + private static final Artist ARTIST_3 = new Artist("All India Radio"); + private static final Artist ARTIST_4 = new Artist("UNKLE"); + private static final Artist ARTIST_5 = new Artist("Bonobo"); + private static final Artist ARTIST_6 = new Artist("Grimes"); + private static final Artist ARTIST_7 = new Artist("Massive Attack"); + private static final Album ALBUM_0 = new Album(ARTIST_0, "Sun Structures", new Track("Shelter Song", 85), new Track("Sun Structures", 53), new Track("The Golden Throne", 72), new Track("Keep in the Dark", 49), new Track("Mesmerise", 85), new Track("Move With The Season", 16), new Track("Colours to Life", 37), new Track("A Question Isn't Answered", 50), new Track("The Guesser", 53), new Track("Test of Time", 92), new Track("Sand Dance", 21), new Track("Fragment's Light", 61)); + private static final Album ALBUM_1 = new Album(ARTIST_0, "Keep In The Dark", new Track("Keep in the Dark", 89), new Track("Jewel of Mine Eye", 83)); + private static final Album ALBUM_2 = new Album(ARTIST_0, "Big Calm", new Track("The Sea", 72), new Track("Shoulder Holster", 26), new Track("Part of the Process", 31), new Track("Blindfold", 84), new Track("Let Me See", 55), new Track("Bullet Proof", 24), new Track("Over and Over", 1), new Track("Friction", 56), new Track("diggin' in a watery grave", 53), new Track("Fear and Love", 5), new Track("Big Calm", 37)); + private static final Album ALBUM_3 = new Album(ARTIST_0, "Charango", new Track("Slow Down", 0), new Track("Otherwise", 36), new Track("Aqualung", 82), new Track("Sao Paulo", 44), new Track("Charango (Feat: Pace Won)", 20), new Track("What New York Couples Fight About (Feat: Kurt Wagner)", 50), new Track("Undress Me Now", 26), new Track("Way Beyond", 4), new Track("Women Lose Weight (Feat: Slick Rick)", 76), new Track("Get Along (Feat: Pace Won)", 88), new Track("Public Displays of Affection", 15), new Track("The Great London Traffic Warden Massacre", 43), new Track("Slow Down (Instrumental)", 94), new Track("Otherwise (Instrumental)", 52), new Track("Aqualung (Instrumental)", 19), new Track("Sao Paulo (Instrumental)", 21), new Track("Charango (Feat: Pace Won) (Instrumental)", 32), new Track("What New York Couples Fight About (Instrumental)", 47), new Track("Undress Me Now (Instrumental)", 55), new Track("Way Beyond (Instrumental)", 81), new Track("Women Lose Weight (Feat: Slick Rick) (Instrumental)", 77), new Track("Get Along (Feat: Pace Won) (Instrumental)", 76), new Track("Public Displays Of Affection (Instrumental)", 35), new Track("The Great London Traffic Warden Massacre (Instrumental)", 58)); + private static final Album ALBUM_4 = new Album(ARTIST_1, "Shelter Song", new Track("Shelter Song", 99), new Track("Prisms", 87)); + private static final Album ALBUM_5 = new Album(ARTIST_2, "God Help The Girl", new Track("I Suppose That Was A Prayer", 30), new Track("Act of the Apostle", 33), new Track("I Dumped You First", 52), new Track("Pretty When The Wind Blows", 75), new Track("I Know I Have To Eat", 53), new Track("God Help the Girl", 34), new Track("The Psychiatrist Is In", 35), new Track("The God Of Music", 86), new Track("If You Could Speak", 48), new Track("The Catwalk Of The Dukes", 42), new Track("Perfection as a Hipster", 43), new Track("Fuck This Shit", 50), new Track("Pretty Eve in the Tub", 14), new Track("A loving Kind Of Boy", 36), new Track("What Do You Want This Band To Sound Like", 43), new Track("Come Monday Night", 50), new Track("Collective Idiocy", 68), new Track("I'm Not Rich", 90), new Track("I'll Have to Dance With Cassie", 6), new Track("Stalinist Russia", 14), new Track("Baby’s Just Waiting", 50), new Track("Partick Whistle", 54), new Track("Musician, Please Take Heed", 33), new Track("I Just Want Your Jeans", 21), new Track("Invisible", 72), new Track("The World's Last Cassette", 98), new Track("A Down and Dusky Blonde", 51), new Track("Dress Up In You", 17)); + private static final Album ALBUM_6 = new Album(ARTIST_2, "God Help The Girl sd (Original Motion Picture Soundtrack)"); + private static final Album ALBUM_7 = new Album(ARTIST_2, "Stills EP"); + private static final Album ALBUM_8 = new Album(ARTIST_3, "Echo Other", new Track("Tropic of Unicorn", 18), new Track("Four Three", 86), new Track("The Time", 36), new Track("Sunshine Briefly", 33), new Track("Elizabethland", 41), new Track("The Quiet Ambient", 21), new Track("Song of the See", 95), new Track("Mexicola", 36), new Track("Ghost Dirt", 49), new Track("Whistle", 2), new Track("Echo Other", 13), new Track("Endless Highway", 89)); + private static final Album ALBUM_9 = new Album(ARTIST_3, "Permanent Evolutions", new Track("Open Sky Experiment (St-244 Remix)", 11), new Track("Permanent Revolutions (Don Meers remix)", 14), new Track("Little Mexico", 2), new Track("How Many, For How Long (Morphodic Bliss Mix)", 59), new Track("Dark Ambient (am mix)", 53), new Track("Life and How to Do It", 19), new Track("For Angel (All India Radio vs. Don Meers Mix)", 24), new Track("Lo Fi Groovy", 67), new Track("Walking On A.I.R.", 47), new Track("Delhi Dub", 64), new Track("Pray To The TV Funk (Left Brain Mix)", 69), new Track("A Moment (TV Version)", 1), new Track("Old India", 4), new Track("The Long Goodbye", 79)); + private static final Album ALBUM_10 = new Album(ARTIST_3, "Film Musik", new Track("The Quiet Ambient", 7), new Track("Last Port Of Call", 17), new Track("Permanent Revolutions", 84), new Track("Sunshine Briefly", 76), new Track("Mexicola", 86), new Track("Evening Star", 97), new Track("Horse Groove", 30), new Track("Waukaringa", 95), new Track("Deady Boy", 67), new Track("The Time", 57), new Track("Doing Stuff", 70), new Track("Far Away (Instrumental)", 37), new Track("Harmonium Across The Sea", 34), new Track("Dry (film mix)", 22), new Track("Gunslinger 3", 29), new Track("Its Happy Time", 35)); + private static final Album ALBUM_11 = new Album(ARTIST_4, "Psyence Fiction", new Track("Guns Blazing (Drums Of Death Pt. 1)", 17), new Track("U.N.K.L.E. Main Title Theme", 80), new Track("Lonely Soul", 51), new Track("Getting Ahead In The Lucrative Field Of Artist Management", 49), new Track("Nursery Rhyme/ Breather", 9), new Track("Celestial Annihilation", 36), new Track("The Knock (Drums Of Death Pt. 2)", 13), new Track("Chaos", 51), new Track("Rabbit in Your Headlights", 49), new Track("Outro (Mandatory)", 21)); + private static final Album ALBUM_12 = new Album(ARTIST_4, "Never, Never, Land", new Track("Back And Forth", 79), new Track("Eye for an Eye", 59), new Track("In A State", 47), new Track("Safe In Mind (Please Get This Gun From Out My Face)", 99), new Track("I Need Something Stronger", 39), new Track("What Are You To Me?", 14), new Track("Panic Attack", 88), new Track("Invasion", 49), new Track("Reign", 91), new Track("Glow", 87), new Track("Inside", 76)); + private static final Album ALBUM_13 = new Album(ARTIST_5, "Black Sands", new Track("Prelude", 43), new Track("Kiara", 29), new Track("Kong", 0), new Track("Eyesdown", 97), new Track("El Toro", 98), new Track("We Could Forever", 18), new Track("1009", 27), new Track("All in Forms", 20), new Track("The Keeper", 90), new Track("Stay the Same", 88), new Track("Animals", 49), new Track("Black Sands", 14)); + private static final Album ALBUM_14 = new Album(ARTIST_5, "Days to Come", new Track("Intro", 68), new Track("Days To Come", 41), new Track("Between The Lines", 79), new Track("The Fever", 81), new Track("Ketto", 6), new Track("Nightlite feat. Bajka", 32), new Track("Transmission 94 (Parts 1 & 2)", 19), new Track("On Your Marks", 3), new Track("If You Stayed Over", 7), new Track("Walk In The Sky", 74), new Track("Recurring", 32)); + private static final Album ALBUM_15 = new Album(ARTIST_6, "Visions", new Track("Infinite ❤ Without Fulfillment", 37), new Track("Genesis", 39), new Track("Oblivion", 26), new Track("Eight", 65), new Track("Circumambient", 37), new Track("Vowels = Space and Time", 20), new Track("Visiting Statue", 54), new Track("Be a Body (侘寂)", 22), new Track("Colour Of Moonlight (Antiochus) (Ft. Doldrums)", 36), new Track("Symphonia IX (My Wait Is U)", 78), new Track("Nightmusic (Ft. Majical Cloudz)", 8), new Track("Skin", 44), new Track("Know the Way", 72)); + private static final Album ALBUM_16 = new Album(ARTIST_6, "Art Angels"); + private static final Album ALBUM_17 = new Album(ARTIST_7, "Mezzanine", new Track("Angel", 75), new Track("Risingson", 26), new Track("Teardrop", 93), new Track("Inertia Creeps", 65), new Track("Exchange", 76), new Track("Dissolved Girl", 87), new Track("Man Next Door", 50), new Track("Black Milk", 45), new Track("Mezzanine", 5), new Track("Group Four", 95), new Track("(Exchange)", 89)); + private static final Album ALBUM_18 = new Album(ARTIST_7, "Blue Lines", new Track("Safe From Harm", 99), new Track("One Love", 71), new Track("Blue Lines", 89), new Track("Be Thankful for What You've Got", 20), new Track("Five Man Army", 10), new Track("Unfinished Sympathy", 58), new Track("Daydreaming", 60), new Track("Lately", 27), new Track("Hymn Of The Big Wheel", 27)); + private static final Album ALBUM_19 = new Album(ARTIST_7, "Heligoland", new Track("Pray for Rain", 61), new Track("Babel", 26), new Track("Splitting the Atom", 37), new Track("Girl I Love You", 2), new Track("Psyche", 37), new Track("Flat of the Blade", 74), new Track("Paradise Circus", 11), new Track("Rush Minute", 53), new Track("Saturday Come Slow", 91), new Track("Atlas Air (Instrumental)", 41), new Track("Paradise Circus (Gui Boratto Remix)", 69), new Track("Fatalism (Ryuichi Sakamoto & Yukihiro Takahashi Remix)", 24), new Track("Girl I Love You (She is Danger Remix)", 7), new Track("Paradise Circus (Breakage's Tight Rope Remix)", 92)); + private static final Album[] ALL_ALBUMS = new Album[]{ALBUM_0, ALBUM_1, ALBUM_2, ALBUM_3, ALBUM_4, ALBUM_5, ALBUM_6, + ALBUM_7, ALBUM_8, ALBUM_9, ALBUM_10, ALBUM_11, ALBUM_12, ALBUM_13, ALBUM_14, ALBUM_15, ALBUM_16, ALBUM_17, + ALBUM_18, ALBUM_19 + }; +} diff --git a/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/SecondPartTasksTest.java b/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/SecondPartTasksTest.java new file mode 100644 index 0000000..f7a2219 --- /dev/null +++ b/Streams/src/test/java/ru/spbau/mit/kazakov/Streams/SecondPartTasksTest.java @@ -0,0 +1,108 @@ +package ru.spbau.mit.kazakov.Streams; + +import static org.junit.Assert.*; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +import java.io.*; +import java.util.*; + + +public class SecondPartTasksTest { + @Rule + public TemporaryFolder testFolder = new TemporaryFolder(); + + /** + * Writes specified string to specified file. + * + * @param file specified file + * @param content specified string + */ + private void writeToFile(File file, String content) throws IOException { + try (Writer fileWriter = new FileWriter(file)) { + fileWriter.write(content); + } + } + + @Test + public void testFindQuotes() throws IOException { + File testFile1 = testFolder.newFile("test_file1"); + writeToFile(testFile1, "Some text\nNew line text\nEOF\n"); + File testFile2 = testFolder.newFile("test_file2"); + writeToFile(testFile2, "Some line\ntext to match\nBye\n"); + File testFile3 = testFolder.newFile("test_file3"); + writeToFile(testFile3, "No text\n"); + + List paths = Arrays.asList(testFile1.getAbsolutePath(), testFile2.getAbsolutePath(), testFile3.getAbsolutePath()); + List quote = SecondPartTasks.findQuotes(paths, "text"); + assertEquals(Arrays.asList("Some text", "New line text", "text to match", "No text"), quote); + } + + @Test + public void testPiDividedBy4() { + assertEquals(0.785, SecondPartTasks.piDividedBy4(), 0.001); + } + + @Test + public void testFindPrinter() { + Map> scraps = new HashMap<>(); + scraps.put("Nathaniel Hawthorne", Arrays.asList("In the depths of every heart there is a tomb and a dungeon,though the lights, " + + "the music and revelry, above may cause us to forget their existence and the buried ones or prisoners whom they hide." + + "But sometimes, and oftenest at midnight, those dark receptacles are flung wide open.", + "What a singular moment is the first one, when you have hardly begun to recollect yourself, " + + "after starting from midnight slumber!" + + "By unclosing your eyes so suddenly you seem to have surprised the personages of your dream in full convocation round your bed, " + + "and catch one broad glance at them before they can flit into obscurity.")); + scraps.put("O. Henry", Collections.singletonList("Night had fallen on that great and beautiful city known as Bagdad-on-the-Subway." + + "And with the night came the enchanted glamour that belongs not to Arabia alone. In different masquerade the streets, " + + "bazaars and walled houses of the occidental city of romance were filled with the same kind of folk that so much interested our interesting old friend, " + + "the late Mr. H. A. Rashid. They wore clothes eleven hundred years nearer to the latest styles than H. A. saw in old Bagdad; " + + "but they were about the same people underneath. With the eye of faith, you could have seen the Little Hunchback, " + + "Sinbad the Sailor, Fitbad the Tailor, the Beautiful Persian, the one-eyed Calenders, Ali Baba and Forty Robbers on every block, " + + "and the Barber and his Six Brothers, and all the old Arabian gang easily. But let us revenue to our lamb chops. Old Tom Crowley was a caliph." + + "He had $42,000,000 in preferred stocks and bonds with solid gold edges. In these times, to be called a caliph you must have money." + + "The old-style caliph business as conducted by Mr. Rashid is not safe. If you hold up a person nowadays in a bazaar or a Turkish bath or a side street, " + + "and inquire into his private and personal affairs, the police court'll get you.")); + scraps.put("Jack London", Collections.singletonList("Day had broken cold and grey, exceedingly cold and grey, " + + "when the man turned aside from the main Yukon trail and climbed the high earth- bank, " + + "where a dim and little-travelled trail led eastward through the fat spruce timberland. It was a steep bank, and he paused for breath at the top, " + + "excusing the act to himself by looking at his watch. It was nine o'clock.")); + + assertEquals("O. Henry", SecondPartTasks.findPrinter(scraps)); + } + + @Test + public void testCalculateGlobalOrder() { + Map order1 = new HashMap<>(); + order1.put("Darkness", 3); + order1.put("Dreadful fate", 888); + order1.put("Despair", 42); + + Map order2 = new HashMap<>(); + order2.put("Coldness", 32); + order2.put("Blackened", 97); + order2.put("Despair", 32); + + Map order3 = new HashMap<>(); + order3.put("Helplessness", 565); + order3.put("Powerlessness", 7); + order3.put("Lifeless", 9898); + order3.put("Darkness", 9); + order3.put("Dreadful fate", 8); + + Map expected = new HashMap<>(); + expected.put("Darkness", 12); + expected.put("Dreadful fate", 896); + expected.put("Despair", 74); + expected.put("Coldness", 32); + expected.put("Blackened", 97); + expected.put("Helplessness", 565); + expected.put("Powerlessness", 7); + expected.put("Lifeless", 9898); + + Map order = SecondPartTasks.calculateGlobalOrder(Arrays.asList(order1, order2, order3)); + assertEquals(expected, order); + } +} \ No newline at end of file diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java deleted file mode 100644 index 8bd1447..0000000 --- a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -package ru.spbau.mit.kazakov.Maybe; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.*; -import java.util.ArrayList; -import java.util.Scanner; - -/** - * Reads numbers from input file and writes squared values to output file. If read data isn't a number writes "null" instead. - */ -public class Main { - /** - * Primary method. - * - * @param args the first argument is input file and the second one is output file - */ - public static void main(@NotNull String[] args) throws IOException, getNothingException { - ArrayList> readData = new ArrayList<>(); - try (Scanner scanner = new Scanner(new File(args[0]))) { - while (scanner.hasNextLine()) { - Integer value = tryParse(scanner.nextLine()); - if (value == null) { - readData.add(Maybe.nothing()); - } else { - readData.add(Maybe.just(value)); - } - } - } - - ArrayList> squaredNumber = new ArrayList<>(); - for (Maybe maybeInt : readData) { - squaredNumber.add(maybeInt.map(value -> value * value)); - } - - try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(args[1]))) { - for (Maybe maybeInt : squaredNumber) { - if (maybeInt.isPresent()) { - bufferedWriter.write(maybeInt.get().toString()); - } else { - bufferedWriter.write("null"); - } - bufferedWriter.newLine(); - } - } - } - - /** - * Parses specified String to Integer. - * - * @return Integer if String was a number, and null otherwise - */ - @Nullable - private static Integer tryParse(@NotNull String parsingString) { - try { - return Integer.parseInt(parsingString); - } catch (NumberFormatException e) { - return null; - } - } - -} diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java deleted file mode 100644 index b0216f4..0000000 --- a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/Maybe.java +++ /dev/null @@ -1,83 +0,0 @@ -package ru.spbau.mit.kazakov.Maybe; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Function; - -/** - * Generic container for storing a value or nothing. - */ -public class Maybe { - @Nullable - private final T value; - - /** - * Assigns specified value to class's storing field. - * - * @param t specified value - */ - private Maybe(T t) { - value = t; - } - - /** - * Creates an object for storing specified value. - * - * @param t specified value - * @return new object - */ - @NotNull - public static Maybe just(T t) { - return new Maybe(t); - } - - /** - * Creates an object for strong nothing. - * - * @return new object - */ - @NotNull - public static Maybe nothing() { - return new Maybe(null); - } - - /** - * Returns stored value or throws exception if there is no value. - * - * @return stored value - * @throws getNothingException if there is no stored value - */ - @NotNull - public T get() throws getNothingException { - if (isPresent()) { - return value; - } else { - throw new getNothingException(); - } - } - - /** - * Checks if there is stored value. - * - * @return true if there is stored value, and false otherwise - */ - public boolean isPresent() { - return value != null; - } - - /** - * Maps stored value of type T to another value of type U. - * - * @param mapper a function acting from T to V - * @param image's type - * @return Maybe object storing mapped value if there is a storing value, and Maybe object storing nothing otherwise - */ - @NotNull - public Maybe map(@NotNull Function mapper) { - if (!isPresent()) { - return nothing(); - } - return just(mapper.apply(value)); - } -} diff --git a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java b/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java deleted file mode 100644 index 7789bf9..0000000 --- a/Untitled Folder 2/Java/src/main/java/ru/spbau/mit/kazakov/Maybe/getNothingException.java +++ /dev/null @@ -1,7 +0,0 @@ -package ru.spbau.mit.kazakov.Maybe; - -/** - * Exception thrown when there is no value to return. - */ -public class getNothingException extends Exception { -} diff --git a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java deleted file mode 100644 index 90c6fe1..0000000 --- a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MainTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package ru.spbau.mit.kazakov.Maybe; - -import org.junit.Test; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Scanner; - -import org.junit.Rule; -import org.junit.rules.TemporaryFolder; - -import static org.junit.Assert.*; - -public class MainTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); - - @Test - public void testMain() throws IOException, getNothingException { - File input = testFolder.newFile("input.txt"); - File output = testFolder.newFile("output.txt"); - - try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(input))) { - bufferedWriter.write("1\n0\n-3\nj\njava\n1b\n11 22\n"); - } - - Main.main(new String[]{input.getAbsolutePath(), output.getAbsolutePath()}); - - - assertEquals("1\n0\n9\nnull\nnull\nnull\nnull\n", new String(Files.readAllBytes(Paths.get(output.getAbsolutePath())))); - } - - @Test - public void testMainEmpty() throws IOException, getNothingException { - File input = testFolder.newFile("input.txt"); - File output = testFolder.newFile("output.txt"); - - Main.main(new String[]{input.getAbsolutePath(), output.getAbsolutePath()}); - - assertEquals("", new String(Files.readAllBytes(Paths.get(output.getAbsolutePath())))); - } - -} \ No newline at end of file diff --git a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java b/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java deleted file mode 100644 index 54b7846..0000000 --- a/Untitled Folder 2/Java/src/test/java/ru/spbau/mit/kazakov/Maybe/MaybeTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package ru.spbau.mit.kazakov.Maybe; - -import org.junit.Test; - -import static org.junit.Assert.*; - -public class MaybeTest { - @Test - public void testJustInteger() throws getNothingException { - Maybe maybeInteger = Maybe.just(5); - int storedValue = maybeInteger.get(); - assertEquals(5, storedValue); - } - - @Test - public void testNothingBoolean() { - Maybe maybeBoolean = Maybe.nothing(); - assertFalse(maybeBoolean.isPresent()); - } - - @Test - public void testGetDouble() throws getNothingException { - Maybe maybeDouble = Maybe.just(-7.0); - double storedValue = maybeDouble.get(); - assertEquals(-7.0, storedValue, 0.000000001); - } - - @Test(expected = getNothingException.class) - public void testGetCharacterThrowsException() throws getNothingException { - Maybe maybeCharacter = Maybe.nothing(); - char storedValue = maybeCharacter.get(); - } - - @Test - public void testIsPresentFalse() { - Maybe maybeBoolean = Maybe.nothing(); - assertFalse(maybeBoolean.isPresent()); - } - - @Test - public void testIsPresentTrue() { - Maybe maybeString = Maybe.just("abacaba"); - assertTrue(maybeString.isPresent()); - } - - @Test - public void testMapJust() throws getNothingException { - Maybe maybeInteger = Maybe.just(10); - Maybe mappedMaybeInteger = maybeInteger.map(value -> value * value); - int mappedValue = mappedMaybeInteger.get(); - assertEquals(100, mappedValue); - } - - @Test - public void testMapNothing() throws getNothingException { - Maybe maybeInteger = Maybe.nothing(); - Maybe mappedMaybeInteger = maybeInteger.map(value -> value * value); - assertFalse(mappedMaybeInteger.isPresent()); - } -} \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class b/Untitled Folder 2/Java/target/classes/ru/spbau/mit/kazakov/Maybe/Main.class deleted file mode 100644 index 6bafd51dadac3eb34fc19d52644fad85854c4d65..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3978 zcmbVP>sMS?75^QWnL7-Zgg~Gf@&ZBpE!L{;-q^kyh``#J27#3#v;hx7n`|Q{G?S0Pu z+x=Uw19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<*pj95bJhd_wNjIu{YG2n9w% zIy2f7k{~46vH+%_@nLwZF_iKB=a5EWlwq+TPHd=nnujA?!g`@jx%v9#Iykm#Qk#BrR9!+jAq z#IS_>3dSewSsxd+e~?Mw6S7jMtuZe$<_GM%KSI{1KZavguyE%wL4wWx5MR_E;>X@eR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml b/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml deleted file mode 100644 index 8af6efe..0000000 --- a/Untitled Folder 2/Java/target/surefire-reports/TEST-ru.spbau.mit.kazakov.Maybe.MaybeTest.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt deleted file mode 100644 index adbb610..0000000 --- a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MainTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: ru.spbau.mit.kazakov.Maybe.MainTest -------------------------------------------------------------------------------- -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec - in ru.spbau.mit.kazakov.Maybe.MainTest diff --git a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt b/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt deleted file mode 100644 index 15d544e..0000000 --- a/Untitled Folder 2/Java/target/surefire-reports/ru.spbau.mit.kazakov.Maybe.MaybeTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: ru.spbau.mit.kazakov.Maybe.MaybeTest -------------------------------------------------------------------------------- -Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.07 sec - in ru.spbau.mit.kazakov.Maybe.MaybeTest diff --git a/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class b/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MainTest.class deleted file mode 100644 index 3f48d60837c6182b50031c73aeaf1e02f1a8ebe6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2225 zcma)7*-{%v6g`b3MvMou8Y4Ri;3aGZ0nTEC?SwUUB9;KbmdQ4f1{fI4$fFr!@{o^6 z-s0C(`6;P#RRUC~#BYAcM}?f85kgSdNr8H~ef#ve=icu5`=3Al0`MM6DlTJGK}tmp zM(c11V{zP;lRI(TRq&C5k5$xRTtyrcaZJj7N;cC9W>hrb69xBF+{dRXK0`W=Srv1b zSFwQ4RWxBy#S)g|_(H*of(HVsXOz4d$I2V7Kv&vv*OQyRZF))9w~SJ9*(ekpS9f

nBUatnMcZWVWS$r*An=lC%0w)?jPe z%Z!0%#bqpVE^t2UudNxbk$>Qto(!!$y{SLZlctlLII+TQG1D&k9`{sSX3UVg<9oqM z{gS8Wwr2HWz$=jMVUUa&3OM~VXA}bg6l4@UIw?b$TKy5V=|a)l;jSgecXNh3NTB{G zhC#_uLnpcfI{qUS8s5U&0(AlTLGP)jVHIBzIV3GD0&QmpO}UR2B!f^RdG1%T`C8!O zusWm;+*CJJ>8B27)#2gJkr7qHH~3bAE(x{-5SDJQCzm%|XIth?Ll!v-aJ;nSxu(6Y z;Gu>*3BEE}R7`*K?Lrk_Dva^GklQ=o+Pxk!P`2`&W_^KsGRf@odSl ze9u_WJ!Yb{r_8XLH0$pTDuj0|S_rOMThHnlLCcr|v2BLA#v)6~(|DO9Bp@(W&9E%g zSui2;2@KxYQ^-<9B5SUp=f^E;VuzRQScH?Cdsio@ThHo*)VJ~Yj*U|}S5}A~45lCZ zxc#-SPGO&6BzbILi}MA(XL2416zQWTKs(z6TB&q5RUV+u3mj+I ze@~r%q$0o2TPoH^?XKYwdeBP*>QmNE#m`*pr-rTg2{$;ZArAOej31ItOu?XnWbi+v zU>JhUxfwS1_&ekmR5|TY@roQ0D^gh|=m>wcG~VQ={iqz?r%f>Uasu%KrH}-t&Pw3f vvL;?H>rnx<5fv0kr2wrAxR;?$GEgZ^XLw#kkW@vGp|T*a=lvn~*WlK_9R~(P diff --git a/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class b/Untitled Folder 2/Java/target/test-classes/ru/spbau/mit/kazakov/Maybe/MaybeTest.class deleted file mode 100644 index fe9ccbf84598e037745c1e9f962681c7c236ddc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3912 zcmb7HX;;){6nIA23#v>5l37`TkD3>D!5<=wMuDg?Gk1p1cqcxGAP#8Zg$^W zyV)PnexV#c^!T}_pZgp7D|-68Z!(#gf+(CbN#5n&`@GM6?oIgf-+O-m*oR* z{e4I7c{PUDG<4$iMi_EDk)XwtbYYcT=MoT@ieV;(yg;}+9iVZtb;XDvTHW85%ioVoO< zF+X7j*D=%c2k6%4{Y=sGM{M7mG+hCGR&I)hTOR6(UYb4Man0PgkuMUM7!l~I1~*?Q z0X*PvcBn#O}WlBFJeQWRRxRInSmjJL#v7x8LNTnm?*{ch~Ui4jN za<#k$R?2m=bUkVmr1}YZ)+iLroI(`Gq*BX> zc>6MQ0`+r2)pRVonyd~XvG(p^EnIYpZq__$$wttsK#%b>yJh9*=)qNA7qozOQF?^ynP(Uh>lP2sgBR^IVZjl=zWy- zRR!+c#55HvuzLl|W#merivM$0*t1e2%crPk1)qw0cIj!QqWzV546|Q;#U1GTfp2Iq>OI?zFJ5$4zP{Ve`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