diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..c805922 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..6a95d65 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/project-template/README.md b/README.md similarity index 100% rename from project-template/README.md rename to README.md diff --git a/project-template/checkstyle.xml b/checkstyle.xml similarity index 100% rename from project-template/checkstyle.xml rename to checkstyle.xml diff --git a/lections/01/Main.java b/lections/01/Main.java deleted file mode 100644 index 196dc24..0000000 --- a/lections/01/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -package tinkoff; - -public class Main { - - public static void main(String[] args) { - System.out.println("Hello world"); - } -} diff --git a/lections/01/conditions/If.java b/lections/01/conditions/If.java deleted file mode 100644 index 5ba766b..0000000 --- a/lections/01/conditions/If.java +++ /dev/null @@ -1,27 +0,0 @@ -package tinkoff.conditions; - -public class If { - public static void main(String[] args) { -/* - if (Любое условие) { - - } else if (Другое условие) { - - } else { - - } -*/ - - int a = 3; - int b = 5; - int c; - if (a < b) { - c = a; - } else { - c = b; - } - - // Тернарный оператор - expression => можно присвоить результат - c = (a < b) ? a : b; - } -} diff --git a/lections/01/conditions/Switch.java b/lections/01/conditions/Switch.java deleted file mode 100644 index 7167198..0000000 --- a/lections/01/conditions/Switch.java +++ /dev/null @@ -1,57 +0,0 @@ -package tinkoff.conditions; - -public class Switch { - public static void main(String[] args) { - String str = "a"; - - int res; - - if (str.equals("a") || str.equals("b")) { - res = 0; - } else if (str.equals("ab") || str.equals("bc")) { - res = 1; - } else if (str.equals("abc")) { - res = 2; - } else { - res = 100; - }; - - // Равносильно - - switch (str) { - case "a", "b": - res = 0; - break; - case "ab", "bc": - res = 1; - break; - case "abc": - res = 2; - break; - default: - res = 100; - }; - - // Равносильно - - res = switch (str) { - case "a", "b": - yield 0; - case "ab", "bc": - yield 1; - case "abc": - yield 2; - default: - yield 100; - }; - - // Равносильно - - res = switch (str) { - case "a", "b" -> 0; - case "ab", "bc" -> 1; - case "abc" -> 2; - default -> 100; - }; - } -} diff --git a/lections/01/cycles/For.java b/lections/01/cycles/For.java deleted file mode 100644 index 2a0d772..0000000 --- a/lections/01/cycles/For.java +++ /dev/null @@ -1,30 +0,0 @@ -package tinkoff.cycles; - -public class For { - public static void main(String[] args) { - -/* - for ( Перед циклом ; Условие итерации ; После итерации ) { - - } -*/ - - for (int i = 0; i < 10; i++) { - System.out.println(i); - } - - for (int i = 0; i < 10; i++) { - if (i % 2 == 0) { - continue; - } - System.out.println(i); - } - - for (int i = 1; i < 10; i++) { - if (i % 6 == 0) { - break; - } - System.out.println(i); - } - } -} diff --git a/lections/01/cycles/Foreach.java b/lections/01/cycles/Foreach.java deleted file mode 100644 index 7e5f651..0000000 --- a/lections/01/cycles/Foreach.java +++ /dev/null @@ -1,32 +0,0 @@ -package tinkoff.cycles; - -public class Foreach { - public static void main(String[] args) { -/* - for(тип имя : итерируемая сущность) { - - } - */ - int[] v = new int[6]; - for(int el : v) { - System.out.print(el + ", "); - } - - System.out.println(); - System.out.println(); - - - int[][] m = new int[][] { - {1, 2}, - {3, 4, 5, 6}, - {7, 8, 9} - }; - - for(int[] vTemp : m) { - for(int el : vTemp) { - System.out.print(el + ", "); - } - System.out.println(); - } - } -} diff --git a/lections/01/cycles/While.java b/lections/01/cycles/While.java deleted file mode 100644 index a0c9c32..0000000 --- a/lections/01/cycles/While.java +++ /dev/null @@ -1,25 +0,0 @@ -package tinkoff.cycles; - -public class While { - public static void main(String[] args) { -/* - while (Любое условие) { - - } - */ - - int a = 100; - int n = 1; - while (n < a) { - n *= 2; - } - - System.out.println(n); - - do { - n *= 2; - } while (n < a); - - System.out.println(n); - } -} diff --git a/lections/01/finalvarstatic/Example.java b/lections/01/finalvarstatic/Example.java deleted file mode 100644 index 12f369d..0000000 --- a/lections/01/finalvarstatic/Example.java +++ /dev/null @@ -1,18 +0,0 @@ -package tinkoff.finalvarstatic; - -import java.util.LinkedList; -import java.util.List; - -public class Example { - public static int common; - public int x; - - public static void printCommon() { - System.out.println(common); - } -/* - public static void printX() { - System.out.println(x); - } - */ -} diff --git a/lections/01/finalvarstatic/Final.java b/lections/01/finalvarstatic/Final.java deleted file mode 100644 index f3fe303..0000000 --- a/lections/01/finalvarstatic/Final.java +++ /dev/null @@ -1,31 +0,0 @@ -package tinkoff.finalvarstatic; - -import java.util.LinkedList; -import java.util.List; - -public class Final { - public static void main(String[] args) { - final int a = 1; -/* - a = 2; Для примитивов значение - */ - - - final int[] ints = new int[3]; - ints[0] = 1; - ints[1] = 2; - ints[2] = 3; -/* - ints = new int[5]; Нельзя менять ссылку - */ - - - final List ints2 = new LinkedList<>(); - ints2.add(1); - ints2.add(2); - ints2.add(3); -/* - ints = new LinkedList<>(); Нельзя менять ссылку - */ - } -} diff --git a/lections/01/finalvarstatic/Static.java b/lections/01/finalvarstatic/Static.java deleted file mode 100644 index 88c6f35..0000000 --- a/lections/01/finalvarstatic/Static.java +++ /dev/null @@ -1,23 +0,0 @@ -package tinkoff.finalvarstatic; - -import java.util.LinkedList; -import java.util.List; - -public class Static { - public static void main(String[] args) { - Example example1 = new Example(); - Example example2 = new Example(); - example1.x = 2; - example2.x = 3; - - System.out.println(example1.x); - System.out.println(example2.x); - - System.out.println(); - - example1.common = 2; - example2.common = 3; - - System.out.println(example1.common); - } -} diff --git a/lections/01/finalvarstatic/Var.java b/lections/01/finalvarstatic/Var.java deleted file mode 100644 index 62deb44..0000000 --- a/lections/01/finalvarstatic/Var.java +++ /dev/null @@ -1,19 +0,0 @@ -package tinkoff.finalvarstatic; - -import java.util.LinkedList; -import java.util.List; - -public class Var { - - //var a = "123"; - - public static void main(String[] args) { - var str = "123"; - var i = 1; - var l = 1L; - var d = 1D; - var d2 = 1.0; - - var ints = new int[5]; - } -} diff --git a/lections/01/function/Exception.java b/lections/01/function/Exception.java deleted file mode 100644 index 5a8072a..0000000 --- a/lections/01/function/Exception.java +++ /dev/null @@ -1,23 +0,0 @@ -package tinkoff.function; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; - -public class Exception { - - public static void main(String[] args) throws IOException { - readFromFile("fileName.txt"); - } - - - public static void createReader(String fileName) throws FileNotFoundException { - FileReader fileReader = new FileReader(fileName); - } - - public static void readFromFile(String fileName) throws IOException { - FileReader fileReader = new FileReader(fileName); - fileReader.read(); - } -} diff --git a/lections/01/function/Functions.java b/lections/01/function/Functions.java deleted file mode 100644 index 3f3491d..0000000 --- a/lections/01/function/Functions.java +++ /dev/null @@ -1,24 +0,0 @@ -package tinkoff.function; - -public class Functions { - - public static void main(String[] args) { - printSum(1, 2); - } - - public static void printSum(int a, int b) { - System.out.println(a + b); - } - - public static int binPow(int n, int pow) { - if (pow == 0) { - return 1; - } - if (pow % 2 == 0) { - int res = binPow(n, pow / 2); - return res * res; - } else { - return n * binPow(n, pow - 1); - } - } -} diff --git a/lections/01/function/SumFunctions.java b/lections/01/function/SumFunctions.java deleted file mode 100644 index 6764cda..0000000 --- a/lections/01/function/SumFunctions.java +++ /dev/null @@ -1,27 +0,0 @@ -package tinkoff.function; - -public class SumFunctions { - - public static void main(String[] args) { - int res1 = sum(1); - int res2 = sum(1, 2); - int res3 = sum(1, 2, 3); - int res4 = sum(1, 2, 3, 4); - } - - public static int sum(int a, int b) { - return a + b; - } - - public static int sum(Integer a, int b) { - return a + b; - } - - public static int sum(int a, int... more) { // На самом деле создается массив - int res = a; - for (int b: more) { - a += b; - } - return res; - } -} diff --git a/lections/01/memory/HeapStack.java b/lections/01/memory/HeapStack.java deleted file mode 100644 index 833f0a6..0000000 --- a/lections/01/memory/HeapStack.java +++ /dev/null @@ -1,15 +0,0 @@ -package tinkoff.memory; - -public class HeapStack { - - public static void main(String[] args) { - int id = 23; - String name = "John"; - Person person = null; - person = buildPerson(id, name); - } - - private static Person buildPerson(int id, String name) { - return new Person(id, name); - } -} diff --git a/lections/01/memory/HeapStackError.java b/lections/01/memory/HeapStackError.java deleted file mode 100644 index 7f1b4d3..0000000 --- a/lections/01/memory/HeapStackError.java +++ /dev/null @@ -1,24 +0,0 @@ -package tinkoff.memory; - -import java.util.LinkedList; -import java.util.List; - -public class HeapStackError { - private static final List arrays = new LinkedList<>(); - - public static void main(String[] args) { - -// outOfMemory(); -// stackOverFlow(); - } - - public static void stackOverFlow() { - stackOverFlow(); - } - - public static void outOfMemory() { - for (; ; ) { - arrays.add(new Object[10000]); - } - } -} diff --git a/lections/01/memory/Person.java b/lections/01/memory/Person.java deleted file mode 100644 index 64270a3..0000000 --- a/lections/01/memory/Person.java +++ /dev/null @@ -1,11 +0,0 @@ -package tinkoff.memory; - -public class Person { - public int id; - - public String name; - public Person(int id, String name) { - this.id = id; - this.name = name; - } -} diff --git a/lections/01/primitives/Cache.java b/lections/01/primitives/Cache.java deleted file mode 100644 index 8556d53..0000000 --- a/lections/01/primitives/Cache.java +++ /dev/null @@ -1,18 +0,0 @@ -package tinkoff.primitives; - -public class Cache { - public static void main(String[] args) { - Long l11 = 111L; - Long l12 = 111L; - - Long l21 = 222L; - Long l22 = 222L; - - Long l31 = Long.valueOf(111); - Long l32 = Long.valueOf(111); - - System.out.println(l11 == l12); - System.out.println(l21 == l22); - System.out.println(l31 == l32); - } -} diff --git a/lections/01/primitives/MyArrays.java b/lections/01/primitives/MyArrays.java deleted file mode 100644 index 0146a97..0000000 --- a/lections/01/primitives/MyArrays.java +++ /dev/null @@ -1,20 +0,0 @@ -package tinkoff.primitives; - -import java.util.Arrays; - -public class MyArrays { - public static void main(String[] args) { - int[] v1 = new int[5]; - - v1[0] = 1; - v1[1] = 2; - - System.out.println(v1); - System.out.println(Arrays.toString(v1)); - - - int[] v2 = new int[] {1, 2, 3, 4, 5}; - - System.out.println(Arrays.toString(v2)); - } -} diff --git a/lections/01/primitives/MyMatrices.java b/lections/01/primitives/MyMatrices.java deleted file mode 100644 index 9bdc55f..0000000 --- a/lections/01/primitives/MyMatrices.java +++ /dev/null @@ -1,34 +0,0 @@ -package tinkoff.primitives; - -import java.util.Arrays; - -public class MyMatrices { - public static void main(String[] args) { - int[][] m1 = new int[5][5]; - m1[0][0] = 1; - m1[0][1] = 1; - m1[0][2] = 1; - m1[0][3] = 1; - m1[0][4] = 1; - - System.out.println(Arrays.toString(m1)); - System.out.println(Arrays.toString(m1[0])); - - int[][] m2 = new int[5][]; - m2[0] = new int[1]; - m2[1] = new int[2]; - m2[2] = new int[3]; - m2[3] = new int[4]; - m2[4] = new int[5]; - - System.out.println(); - System.out.println(Arrays.toString(m2[0])); - System.out.println(Arrays.toString(m2[1])); - - int[][] m3 = new int[][] { - {4, 9, 2}, - {3, 5, 7}, - {8, 1, 6} - }; - } -} diff --git a/lections/01/primitives/Operations.java b/lections/01/primitives/Operations.java deleted file mode 100644 index e4e419e..0000000 --- a/lections/01/primitives/Operations.java +++ /dev/null @@ -1,30 +0,0 @@ -package tinkoff.primitives; - -public class Operations { - public static void main(String[] args) { - int num1 = 13; // = 1101 - int num2 = 9; // = 1001 - - System.out.println(num1 + num2); - System.out.println(num1 - num2); - System.out.println(num1 * num2); - System.out.println(num1 / num2); - System.out.println(num1 % num2); - - System.out.println(); - - System.out.println(num1 & num2); - System.out.println(num1 | num2); - System.out.println(num1 ^ num2); - System.out.println(~num1); - - System.out.println(); - - System.out.println(num1 == num2); - System.out.println(num1 < num2); - System.out.println(num1 > num2); - System.out.println(num1 <= num2); - System.out.println(num1 >= num2); - System.out.println(num1 != num2); - } -} diff --git a/lections/01/primitives/Primitives.java b/lections/01/primitives/Primitives.java deleted file mode 100644 index 3b6cac9..0000000 --- a/lections/01/primitives/Primitives.java +++ /dev/null @@ -1,31 +0,0 @@ -package tinkoff.primitives; - -public class Primitives { - public static void main(String[] args) { - - byte b = 1; // [-128, 128) - Byte b1 = 1; - - short s = 1; // [-2^15, 2^15) - Short s1 = 1; - - int i = 1; // [-2^31, 2^31-1) - Integer i1 = 1; - - long l = 1L; // [-2^63, 2^63-1) - Long l1 = 1L; - - - float f = 1f; // 32-битный - Float f1 = 1f; - - double d = 1.0; // 64-битный - Double d1 = 1.0; - - boolean bool = true; - Boolean bool1 = true; - - char c = 'c'; // UTF-16 - Character c1 = 'c'; - } -} diff --git a/lections/01/primitives/TypeFunctions.java b/lections/01/primitives/TypeFunctions.java deleted file mode 100644 index 18b1c1e..0000000 --- a/lections/01/primitives/TypeFunctions.java +++ /dev/null @@ -1,20 +0,0 @@ -package tinkoff.primitives; - -public class TypeFunctions { - public static void main(String[] args) { - Integer num1 = 130; - Integer num2 = 130; - Integer num3 = 9; - - double d = num1.doubleValue(); - short s = num1.shortValue(); - - System.out.println(num1.equals(num3)); - System.out.println(num1.equals(num2)); - - System.out.println(); - - System.out.println(num1 == num3); - System.out.println(num1 == num2); - } -} diff --git a/lections/01/string/StringBuilderExample.java b/lections/01/string/StringBuilderExample.java deleted file mode 100644 index 239fe66..0000000 --- a/lections/01/string/StringBuilderExample.java +++ /dev/null @@ -1,23 +0,0 @@ -package tinkoff.string; - -public class StringBuilderExample { - public static void main(String[] args) { - String str = ""; - - for (int i = 0; i < 1000; i++) { - str += i + ", "; - } - - System.out.println(str); - - // Аналогично - - StringBuilder stringBuilder = new StringBuilder(); - - for (int i = 0; i < 1000; i++) { - stringBuilder.append(i).append(", "); - } - - System.out.println(stringBuilder); - } -} diff --git a/lections/01/string/StringFunctions.java b/lections/01/string/StringFunctions.java deleted file mode 100644 index e600ff3..0000000 --- a/lections/01/string/StringFunctions.java +++ /dev/null @@ -1,26 +0,0 @@ -package tinkoff.string; - -import java.lang.reflect.Array; -import java.util.Arrays; - -public class StringFunctions { - public static void main(String[] args) { - String str = "aabbbcdddd"; - - System.out.println("Длина строки: " + str.length()); - - System.out.println("Разделение по 'b': " + Arrays.toString(str.split("b"))); - - System.out.println("Индекс 'bc': " + str.indexOf("bc")); - - System.out.println("Индекс 'e': " + str.indexOf("e")); - - System.out.println("Заменили 'b' на 'd': " + str.replace('b', 'd')); - - System.out.println("Массив чаров: " + Arrays.toString(str.toCharArray())); - - System.out.println("Сравнение без регистра: " + str.equalsIgnoreCase("AaBbBcDdDd")); - - System.out.println("Форматирование строк: " + "%s %s".formatted("Hello", "world")); - } -} diff --git a/lections/01/string/StringPool.java b/lections/01/string/StringPool.java deleted file mode 100644 index 8ba9b83..0000000 --- a/lections/01/string/StringPool.java +++ /dev/null @@ -1,23 +0,0 @@ -package tinkoff.string; - -public class StringPool { - public static void main(String[] args) { - String a = "str"; - String b = "str"; - String c = new String("str"); - String d = new String("str").intern(); - - System.out.println(a == b); - System.out.println(a == c); - System.out.println(b == c); - System.out.println(a == d); - - System.out.println(); - - String ab1 = "strstr"; - String ab2 = "str" + "str"; - String ab3 = a + b; - System.out.println(ab1 == ab2); - System.out.println(ab1 == ab3); - } -} diff --git a/project-template/mvnw b/mvnw similarity index 100% rename from project-template/mvnw rename to mvnw diff --git a/project-template/mvnw.cmd b/mvnw.cmd similarity index 97% rename from project-template/mvnw.cmd rename to mvnw.cmd index c4586b5..f80fbad 100644 --- a/project-template/mvnw.cmd +++ b/mvnw.cmd @@ -1,205 +1,205 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.2.0 -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %WRAPPER_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file -SET WRAPPER_SHA_256_SUM="" -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B -) -IF NOT %WRAPPER_SHA_256_SUM%=="" ( - powershell -Command "&{"^ - "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ - "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ - " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ - " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ - " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ - " exit 1;"^ - "}"^ - "}" - if ERRORLEVEL 1 goto error -) - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.2.0 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/project-template/pom.xml b/pom.xml similarity index 100% rename from project-template/pom.xml rename to pom.xml diff --git a/project-template/.editorconfig b/project-template/.editorconfig deleted file mode 100644 index 547de1b..0000000 --- a/project-template/.editorconfig +++ /dev/null @@ -1,80 +0,0 @@ -root = true - -[*] -charset = utf-8 -tab_width = 4 -indent_size = 4 -indent_style = space -max_line_length = 120 -insert_final_newline = true -trim_trailing_whitespace = true -ij_continuation_indent_size = 4 - -[*.java] -ij_java_imports_layout = *, $* -ij_java_packages_to_use_import_on_demand = "" -ij_java_class_count_to_use_import_on_demand = 999 -ij_java_names_count_to_use_import_on_demand = 999 - -ij_java_array_initializer_wrap = normal -ij_java_assert_statement_wrap = normal -ij_java_assignment_wrap = normal -ij_java_binary_operation_wrap = normal -ij_java_enum_constants_wrap = normal -ij_java_extends_keyword_wrap = normal -ij_java_extends_list_wrap = normal -ij_java_for_statement_wrap = normal -ij_java_method_call_chain_wrap = normal -ij_java_parameter_annotation_wrap = normal -ij_java_resource_list_wrap = normal -ij_java_ternary_operation_wrap = normal -ij_java_throws_keyword_wrap = normal -ij_java_throws_list_wrap = normal -ij_java_variable_annotation_wrap = normal -ij_java_class_annotation_wrap = normal -ij_java_field_annotation_wrap = normal -ij_java_method_annotation_wrap = normal - -ij_java_call_parameters_wrap = on_every_item -ij_java_call_parameters_new_line_after_left_paren = true -ij_java_call_parameters_right_paren_on_new_line = true - -ij_java_annotation_parameter_wrap = on_every_item -ij_java_align_multiline_annotation_parameters = true - -ij_java_method_parameters_wrap = on_every_item -ij_java_method_parameters_new_line_after_left_paren = true -ij_java_method_parameters_right_paren_on_new_line = true - -ij_java_space_before_array_initializer_left_brace = true -ij_java_align_multiline_parameters = false -ij_java_spaces_within_record_header = false - -ij_java_do_while_brace_force = always -ij_java_for_brace_force = always -ij_java_if_brace_force = always -ij_java_while_brace_force = always - -ij_java_blank_lines_before_package = 1 -ij_java_keep_blank_lines_before_right_brace = 1 -ij_java_keep_blank_lines_between_package_declaration_and_header = 1 -ij_java_keep_blank_lines_in_code = 1 -ij_java_keep_blank_lines_in_declarations = 1 - -ij_java_doc_do_not_wrap_if_one_line = true -ij_java_doc_indent_on_continuation = true -ij_java_doc_keep_empty_parameter_tag = false -ij_java_doc_keep_empty_return_tag = false -ij_java_doc_keep_empty_throws_tag = false - -[*.{bat,cmd,ps1}] -end_of_line = crlf - -[*.sh] -end_of_line = lf - -[*.md] -trim_trailing_whitespace = false - -[*.{yml,yaml}] -indent_size = 2 diff --git a/project-template/.gitattributes b/project-template/.gitattributes deleted file mode 100644 index a2a7b02..0000000 --- a/project-template/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -*.bat text eol=crlf -*.cmd text eol=crlf -*.ps1 text eol=crlf -*.sh text eol=lf diff --git a/project-template/.github/workflows/build.yml b/project-template/.github/workflows/build.yml deleted file mode 100644 index 7ba8168..0000000 --- a/project-template/.github/workflows/build.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build - -on: - workflow_dispatch: - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - name: Build - permissions: - contents: read - pull-requests: write - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'oracle' - cache: maven - - - name: maven build - run: mvn package - - - id: jacoco - uses: madrapps/jacoco-report@v1.6.1 - if: ( github.event_name != 'workflow_dispatch' ) - with: - paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml - token: ${{ secrets.GITHUB_TOKEN }} - min-coverage-overall: 30 - min-coverage-changed-files: 30 - title: Code Coverage - update-comment: true - - checkstyle: - name: checkstyle - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'oracle' - cache: maven - - - run: mvn checkstyle:check diff --git a/project-template/.gitignore b/project-template/.gitignore deleted file mode 100644 index 7ed0d6b..0000000 --- a/project-template/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/project-template/.mvn/jvm.config b/project-template/.mvn/jvm.config deleted file mode 100644 index 9a69781..0000000 --- a/project-template/.mvn/jvm.config +++ /dev/null @@ -1,6 +0,0 @@ --Xms512m --Xmx1G --Djava.awt.headless=true --Duser.country=US --Duser.language=en --Dfile.encoding=UTF-8 diff --git a/project-template/.mvn/maven.config b/project-template/.mvn/maven.config deleted file mode 100644 index 12a682d..0000000 --- a/project-template/.mvn/maven.config +++ /dev/null @@ -1,8 +0,0 @@ --Duser.timezone=UTC --Dorg.slf4j.simpleLogger.showDateTime=true --Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss ---batch-mode ---no-transfer-progress ---errors ---fail-at-end ---show-version diff --git a/project-template/.mvn/wrapper/maven-wrapper.jar b/project-template/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index cb28b0e..0000000 Binary files a/project-template/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/project-template/.mvn/wrapper/maven-wrapper.properties b/project-template/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 3c6fda8..0000000 --- a/project-template/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/project-template/src/main/java/edu/hw1/Task1.java b/project-template/src/main/java/edu/hw1/Task1.java deleted file mode 100644 index 190a180..0000000 --- a/project-template/src/main/java/edu/hw1/Task1.java +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/project-template/src/main/java/edu/hw1/EvenArrayUtils.java b/src/main/java/edu/hw1/EvenArrayUtils.java similarity index 100% rename from project-template/src/main/java/edu/hw1/EvenArrayUtils.java rename to src/main/java/edu/hw1/EvenArrayUtils.java diff --git a/project-template/src/main/java/edu/hw1/Main.java b/src/main/java/edu/hw1/Main.java similarity index 100% rename from project-template/src/main/java/edu/hw1/Main.java rename to src/main/java/edu/hw1/Main.java diff --git a/src/main/java/edu/hw1/Task0.java b/src/main/java/edu/hw1/Task0.java new file mode 100644 index 0000000..5d2f2d4 --- /dev/null +++ b/src/main/java/edu/hw1/Task0.java @@ -0,0 +1,16 @@ +package edu.hw1; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public final class Task0 { + private final static Logger LOGGER = LogManager.getLogger(); + + private Task0() { + + } + + public static void ogo(String[] args) { + LOGGER.info("Привет, мир!"); + } +} diff --git a/src/main/java/edu/hw1/Task1.java b/src/main/java/edu/hw1/Task1.java new file mode 100644 index 0000000..a25a918 --- /dev/null +++ b/src/main/java/edu/hw1/Task1.java @@ -0,0 +1,33 @@ +package edu.hw1; + +public class Task1 { + + public static final int SECONDS_MINETS = 60; + + public int time(String args) { + + StringBuilder minets = new StringBuilder(""); + StringBuilder seconds = new StringBuilder(""); + int ch = 0; + + for (int i = 0; i < args.length(); i++) { + + if (args.charAt(i) == ':') { + ch = 1; + } else if (ch == 0) { + minets.append(args.charAt(i)); + } else { + seconds.append(args.charAt(i)); + } + } + int minet = Integer.parseInt(String.valueOf(minets)); + int second = Integer.parseInt(String.valueOf(seconds)); + // именно здесь String преобразуется в int + if (second < SECONDS_MINETS) { + return (minet * SECONDS_MINETS + second); + } else { + return (-1); + } + // выведем на экран значение после конвертации + } +} diff --git a/src/main/java/edu/hw1/Task2.java b/src/main/java/edu/hw1/Task2.java new file mode 100644 index 0000000..077a352 --- /dev/null +++ b/src/main/java/edu/hw1/Task2.java @@ -0,0 +1,22 @@ +package edu.hw1; + +public class Task2 { + + public static final int MINN = 9; + + public static final int NEXT_NUMBER = 10; + + public int countDigits(int args) { + + int r = args; + int ch = 0; + + while (r > MINN) { + ch += 1; + r /= NEXT_NUMBER; + + } + ch += 1; + return ch; + } +} diff --git a/src/main/java/edu/hw1/Task3.java b/src/main/java/edu/hw1/Task3.java new file mode 100644 index 0000000..2a863c6 --- /dev/null +++ b/src/main/java/edu/hw1/Task3.java @@ -0,0 +1,32 @@ +package edu.hw1; + +public class Task3 { + + public boolean isNestable(int[] args, int[] vlog) { + + int maxargs = args[0]; + int minargs = args[0]; + + int maxvlog = vlog[0]; + int minvlog = vlog[0]; + + for (int i = 0; i < args.length; i++) { + if (args[i] > maxargs) { + maxargs = args[i]; + } + if (args[i] < minargs) { + minargs = args[i]; + } + } + + for (int i = 0; i < vlog.length; i++) { + if (vlog[i] > maxvlog) { + maxvlog = vlog[i]; + } + if (vlog[i] < minvlog) { + minvlog = vlog[i]; + } + } + return (minargs > minvlog && maxargs < maxvlog); + } +} diff --git a/src/main/java/edu/hw1/Task4.java b/src/main/java/edu/hw1/Task4.java new file mode 100644 index 0000000..1cc4931 --- /dev/null +++ b/src/main/java/edu/hw1/Task4.java @@ -0,0 +1,19 @@ +package edu.hw1; + +public class Task4 { + + public static final int INDEX_CHAR = 48; + + public String fixString(String swap) { + + StringBuilder answer = new StringBuilder(""); + for (int i = 0; i < swap.length() - 1; i += 2) { + answer.append(swap.charAt(i + 1)); + answer.append(swap.charAt(i)); + } + if (swap.length() % 2 == 1) { + answer.append(swap.charAt(swap.length() - 1)); + } + return answer.toString(); + } +} diff --git a/src/main/java/edu/hw1/Task5.java b/src/main/java/edu/hw1/Task5.java new file mode 100644 index 0000000..82674f6 --- /dev/null +++ b/src/main/java/edu/hw1/Task5.java @@ -0,0 +1,58 @@ +package edu.hw1; + +public class Task5 { + + public static final int MAX_SIZE = 9; + + public boolean isPalindromeDescendant(Integer palindrom) { + + String ans = String.valueOf(palindrom); + + int half = ans.length() / 2; + + StringBuilder sb = new StringBuilder(ans.substring(half, ans.length())); + if (ans.substring(0, half).equals(sb.reverse().toString())) { + return true; + } else { + return (proverochka(palindrom)); + } + + } + + public static final int INDEX_CHAR = 48; + + private boolean proverochka(Integer x) { + + if (x > MAX_SIZE && (String.valueOf(x)).length() % 2 == 0) { + String palindrom = String.valueOf(x); + + String ans = ""; + + for (int i = 0; i < palindrom.length(); i += 2) { + ans += String.valueOf(palindrom.charAt(i) + palindrom.charAt(i + 1) - 2 * INDEX_CHAR); + } + + int half = ans.length() / 2; + + StringBuilder sb = new StringBuilder(ans.substring(half, ans.length())); + if (ans.substring(0, half).equals(sb.reverse().toString())) { + return true; + } else { + + return (proverochka(Integer.valueOf(ans))); + } + } else { + + String ans = String.valueOf(x); + + int half = ans.length() / 2; + + StringBuilder sb = new StringBuilder(ans.substring(half, ans.length())); + if (ans.substring(0, half).equals(sb.reverse().toString())) { + return true; + } else { + return (false); + } + } + } +} diff --git a/src/main/java/edu/hw1/Task6.java b/src/main/java/edu/hw1/Task6.java new file mode 100644 index 0000000..b9cec89 --- /dev/null +++ b/src/main/java/edu/hw1/Task6.java @@ -0,0 +1,49 @@ +package edu.hw1; + +import java.util.Arrays; + +class Task6 { + + public static final int MASSIV_SIZE = 4; + + public static final int TEN = 10; + + public static final int ANSWER = 6174; + + public int swap(Integer x) { + + Integer x1 = x; + int[] massiv = new int[MASSIV_SIZE]; + for (int i = 0; i < MASSIV_SIZE; i++) { + massiv[i] = x1 % TEN; + x1 /= TEN; + } + Arrays.sort(massiv); + // Сумма элементов + Integer first = 0; + + //Отрицательная сумма + + Integer second = 0; + + first = massiv[MASSIV_SIZE - 1] * TEN * TEN * TEN + massiv[2] * TEN * TEN + massiv[1] * TEN + massiv[0]; + + second = massiv[MASSIV_SIZE - 1] + massiv[2] * TEN + massiv[1] * TEN * TEN + massiv[0] * TEN * TEN * TEN; + + //Разность + x1 = first - second; + + return countK(x1); + + } + + public int countK(Integer kaprekar) { + + if (kaprekar.equals(ANSWER)) { + return 0; + } else { + return (1 + swap(kaprekar)); + } + } + +} diff --git a/src/main/java/edu/hw1/Task7.java b/src/main/java/edu/hw1/Task7.java new file mode 100644 index 0000000..ecc4b99 --- /dev/null +++ b/src/main/java/edu/hw1/Task7.java @@ -0,0 +1,66 @@ +package edu.hw1; + +public class Task7 { + + public static final int LAST_ELEMENT = 10; + + public Integer rotateRight(Integer m, Integer shift) { + + String number = Integer.toBinaryString(m); + + int lenn = number.length(); + + Integer n = Integer.valueOf(number); + + int[] sdvig = new int[lenn]; + + for (int i = lenn - 1; i > -1; i--) { + sdvig[i] = n % LAST_ELEMENT; + n /= LAST_ELEMENT; + } + + for (int i = 0; i < shift; i++) { + int last = sdvig[lenn - 1]; + + for (int j = lenn - 1; j > 0; j--) { + sdvig[j] = sdvig[j - 1]; + } + sdvig[0] = last; + } + String ans = ""; + for (int i = 0; i < lenn; i++) { + ans += sdvig[i]; + } + return (Integer.parseInt(ans, 2)); + } + + public Integer rotateLeft(Integer m, Integer shift) { + + String number = Integer.toBinaryString(m); + + Integer n = Integer.valueOf(number); + + int lenn = number.length(); + + int[] sdvig = new int[lenn]; + + for (int i = lenn - 1; i > -1; i--) { + sdvig[i] = n % LAST_ELEMENT; + n /= LAST_ELEMENT; + } + + for (int i = 0; i < shift; i++) { + int last = sdvig[0]; + + for (int j = 0; j < lenn - 1; j++) { + sdvig[j] = sdvig[j + 1]; + } + sdvig[lenn - 1] = last; + } + String ans = ""; + for (int i = 0; i < lenn; i++) { + ans += sdvig[i]; + } + return (Integer.parseInt(ans, 2)); + } +} diff --git a/src/main/java/edu/hw1/Task8.java b/src/main/java/edu/hw1/Task8.java new file mode 100644 index 0000000..f5704bc --- /dev/null +++ b/src/main/java/edu/hw1/Task8.java @@ -0,0 +1,68 @@ +package edu.hw1; + +public class Task8 { + + public static final int DESK_SIZE = 8; + + public boolean knightBoardCapture(int[][] desk) { + + int ch = 0; + for (int i = 0; i < DESK_SIZE; i++) { + for (int j = 0; j < DESK_SIZE; j++) { + if (desk[i][j] == (1)) { + + if (i - 2 > -1 && j - 1 > -1) { + if (desk[i - 2][j - 1] == 1) { + ch = 1; + } + } + + if (i - 2 > -1 && j + 1 < DESK_SIZE) { + if (desk[i - 2][j + 1] == 1) { + ch = 1; + } + } + + if (j - 2 > -1 && i - 1 > -1) { + if (desk[i - 1][j - 2] == 1) { + ch = 1; + } + } + + if (j - 2 > -1 && i + 1 < DESK_SIZE) { + if (desk[i + 1][j - 2] == 1) { + ch = 1; + } + } + if (i + 2 < DESK_SIZE && j - 1 > -1) { + if (desk[i + 2][j - 1] == 1) { + ch = 1; + } + } + if (i + 2 < DESK_SIZE && j + 1 < DESK_SIZE) { + if (desk[i + 2][j + 1] == 1) { + ch = 1; + } + } + if (i + 1 < DESK_SIZE && j + 2 < DESK_SIZE) { + if (desk[i + 1][j + 2] == 1) { + ch = 1; + } + } + if (i - 1 > -1 && j + 2 < DESK_SIZE) { + if (desk[i - 1][j + 2] == 1) { + ch = 1; + } + } + + } + + } + } + if (ch == 1) { + return (false); + } else { + return (true); + } + } +} diff --git a/src/main/java/edu/hw2/Expr.java b/src/main/java/edu/hw2/Expr.java new file mode 100644 index 0000000..1ab6f7a --- /dev/null +++ b/src/main/java/edu/hw2/Expr.java @@ -0,0 +1,23 @@ +//package edu.hw2; + + +//public sealed interface Expr { + // double evaluate(); + // public record Constant implements Expr (Integer age){ + + // } + + + + // public record Negate (Constant age){ + // public Constant name() { + // return age; + //} + //} + + // public record Exponent implements Expr {} + + //public record Addition implements Expr {} + + //public record Multiplication implements Expr {} +//} \ No newline at end of file diff --git a/src/main/java/edu/hw2/Task1_saport.java b/src/main/java/edu/hw2/Task1_saport.java new file mode 100644 index 0000000..c70d5cb --- /dev/null +++ b/src/main/java/edu/hw2/Task1_saport.java @@ -0,0 +1,24 @@ +//package edu.hw2; + +//import static edu.hw2.Expr.*; + +//public class Task1_saport { + // public static void main (String[] args) { + + // var two = new Constant(2); + + // var four = new Constant(4); + + //var negOne = new Negate(new Constant(1)); + + // var sumTwoFour = new Addition(two, four); + + // var mult = new Multiplication(sumTwoFour, negOne); + + //var exp = new Exponent(mult, 2); + + //var res = new Addition(exp, new Constant(1)); + + //System.out.println(res + " = " + res.evaluate()); +// } +//} \ No newline at end of file diff --git a/src/main/java/edu/project1/Generate_Words.java b/src/main/java/edu/project1/Generate_Words.java new file mode 100644 index 0000000..8e1685d --- /dev/null +++ b/src/main/java/edu/project1/Generate_Words.java @@ -0,0 +1,15 @@ +package edu.project1; + +import java.util.Random; + +public class Generate_Words{ + + public static String GenerateRandomWord(){ + String [] dictionary = new String[] {"рюкзак"}; + + Random random = new Random(); + int Word_for_Gallows = random.nextInt(1); + String ans = dictionary[Word_for_Gallows]; + return ans; + } +} diff --git a/project-template/src/main/java/edu/project1/Main.java b/src/main/java/edu/project1/Main.java similarity index 100% rename from project-template/src/main/java/edu/project1/Main.java rename to src/main/java/edu/project1/Main.java diff --git a/src/main/java/edu/project1/Main_Consol.java b/src/main/java/edu/project1/Main_Consol.java new file mode 100644 index 0000000..6758315 --- /dev/null +++ b/src/main/java/edu/project1/Main_Consol.java @@ -0,0 +1,116 @@ +package edu.project1; + +import java.util.HashMap; +import java.util.Scanner; +import java.util.Arrays; +import java.util.Map; + +public class Main_Consol { + public static final String Question = "Какая буква ещё не открыта?"; + + public static final Integer Maximum_Mistake = 9; + + public static String Final_Phrase = "Ой, ой. Зря сдались, вы почти угадали слово"; + + public static String Eror_Input = "Нужно ввести одну букву, а не слово"; + + public static String Repeat_Word = "Вы уже вводили эту буку"; + + public static String Wrong_Answer = "Missed, mistake"; + + public static String Game_Over = "Ахаха слабо, слабо, проиграл."; + + public static String Game_Win = "Молодец, ты победил!"; + + public static String More_Try = "Дать тебе ёще 5 попыток?"; + + + public static void main(String[] args) throws Exception { + + + Map dictionary = new HashMap(); + + String HiddenWord; + HiddenWord = Generate_Words.GenerateRandomWord(); + + int quantity_mistake = 0; + + Scanner scanner = new Scanner(System.in); + + // String[] Answe = new String[HiddenWord.length()]; + + for (int i = 0; i < HiddenWord.length(); i++) { + dictionary.put(String.valueOf(HiddenWord.charAt(i)), "*"); + } + + int win = 0; + + while (Maximum_Mistake > quantity_mistake) { + + System.out.println(Question); + + String inputWord = scanner.nextLine(); + + if (inputWord.equals("stop")) { + System.err.println(Final_Phrase); + System.exit(1); + + } else if (inputWord.length() != 1) { + System.out.println(Eror_Input); + + } else { + if (HiddenWord.contains(inputWord)) { + + if (dictionary.get(inputWord).equals("*")) { + win += find.count_element(inputWord, HiddenWord); + + System.out.println("Hit!"); + } else { + System.out.println(Repeat_Word); + } + + if (dictionary.containsKey(inputWord)) { + dictionary.put(inputWord, inputWord); + } + + + if (dictionary.containsKey(inputWord)) { + dictionary.put(inputWord, inputWord); + } + + } else { + quantity_mistake++; + System.out.println(Wrong_Answer + " " + quantity_mistake + " of " + Maximum_Mistake); + } + + for (int i = 0; i < HiddenWord.length(); i++) { + System.out.print(dictionary.get(String.valueOf(HiddenWord.charAt(i)))); + + } + + System.out.println(); + + if (win == HiddenWord.length()) { + System.out.println(Game_Win); + System.exit(0); + + } + } + if (quantity_mistake == Maximum_Mistake) { + + System.out.println(More_Try); + String input = scanner.nextLine(); + + if (input.equals("да")) { + quantity_mistake -= 5; + } + } + + } + if (Maximum_Mistake == quantity_mistake) { + System.out.println(Game_Over); + + } + } + +} diff --git a/src/main/java/edu/project1/find.java b/src/main/java/edu/project1/find.java new file mode 100644 index 0000000..ce2862b --- /dev/null +++ b/src/main/java/edu/project1/find.java @@ -0,0 +1,17 @@ +package edu.project1; + +public class find { + + public static int count_element(String element, String str){ + int count = 0; + + for(int j = 0; j < str.length(); j ++){ + + if (str.charAt(j) == element.charAt(0) ){ + + count ++; + } + } + return count; + } +} \ No newline at end of file diff --git a/project-template/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml similarity index 100% rename from project-template/src/main/resources/log4j2.xml rename to src/main/resources/log4j2.xml diff --git a/src/test/java/edu/hw1/Constant_Test.java b/src/test/java/edu/hw1/Constant_Test.java new file mode 100644 index 0000000..36dd007 --- /dev/null +++ b/src/test/java/edu/hw1/Constant_Test.java @@ -0,0 +1,25 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Constant_Test { + @Test + @DisplayName("Минуты и секунды") + void test_time() { + Task1 chek; + chek = new Task1(); + assertEquals(60, chek.time("01:00")); + assertEquals(836, chek.time("13:56")); + assertEquals(-1, chek.time("10:60")); + assertEquals(599999, chek.time("9999:59")); + assertEquals(0, chek.time("00:00")); + assertEquals(-1, chek.time("0:60")); + assertEquals(606, chek.time("10:06")); + assertEquals(606, chek.time("10:6")); + + } +} diff --git a/project-template/src/test/java/edu/hw1/SampleTest.java b/src/test/java/edu/hw1/SampleTest.java similarity index 100% rename from project-template/src/test/java/edu/hw1/SampleTest.java rename to src/test/java/edu/hw1/SampleTest.java diff --git a/src/test/java/edu/hw1/Task2_Test.java b/src/test/java/edu/hw1/Task2_Test.java new file mode 100644 index 0000000..bda044b --- /dev/null +++ b/src/test/java/edu/hw1/Task2_Test.java @@ -0,0 +1,22 @@ +package edu.hw1; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.DisplayName; + +import static org.junit.jupiter.api.Assertions.*; + +class Task2_Test { + + @Test + @DisplayName("Минуты и секунды") + void test_countDigits() { + Task2 lenn; + lenn = new Task2(); + assertEquals(4, lenn.countDigits(4666)); + //rofle = new Task1 (0); + assertEquals(3, lenn.countDigits(544)); + assertEquals(1, lenn.countDigits(0)); + assertEquals(8, lenn.countDigits(10000000)); + assertEquals(3, lenn.countDigits(123)); + } +} diff --git a/src/test/java/edu/hw1/Task3_Test.java b/src/test/java/edu/hw1/Task3_Test.java new file mode 100644 index 0000000..f258a0d --- /dev/null +++ b/src/test/java/edu/hw1/Task3_Test.java @@ -0,0 +1,23 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task3_Test { + @Test + @DisplayName("Минуты и секунды") + void test_isNestable() { + Task3 massiv = new Task3(); + assertEquals(true, massiv.isNestable(new int[] {1, 2, 3, 4}, new int[] {0, 6})); + assertEquals(true, massiv.isNestable(new int[] {3, 1}, new int[] {4, 0})); + assertEquals(false, massiv.isNestable(new int[] {9, 9, 8}, new int[] {8, 9})); + assertEquals(false, massiv.isNestable(new int[] {1, 2, 3, 4}, new int[] {2, 3})); + assertEquals(false, massiv.isNestable(new int[] {1, 4}, new int[] {4, 1})); + assertEquals(false, massiv.isNestable(new int[] {1, 2, 3}, new int[] {5, 6})); + assertEquals(false, massiv.isNestable(new int[] {1, 5}, new int[] {1, 6})); + + } +} diff --git a/src/test/java/edu/hw1/Task4_Test.java b/src/test/java/edu/hw1/Task4_Test.java new file mode 100644 index 0000000..2d99416 --- /dev/null +++ b/src/test/java/edu/hw1/Task4_Test.java @@ -0,0 +1,21 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task4_Test { + + @Test + @DisplayName("Исправление строки") + void test_fixString() { + Task4 fix; + fix = new Task4(); + assertEquals("214365", fix.fixString("123456")); + assertEquals("This is a mixed up string.", fix.fixString("hTsii s aimex dpus rtni.g")); + assertEquals("abcde", fix.fixString("badce")); + assertEquals("21435", fix.fixString("12345")); + } +} diff --git a/src/test/java/edu/hw1/Task5_Test.java b/src/test/java/edu/hw1/Task5_Test.java new file mode 100644 index 0000000..e407162 --- /dev/null +++ b/src/test/java/edu/hw1/Task5_Test.java @@ -0,0 +1,24 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task5_Test { + @Test + @DisplayName("палиндром") + void test_isPalindromeDescendant() { + Task5 palindrom; + palindrom = new Task5(); + assertEquals(true, palindrom.isPalindromeDescendant(11211230)); + assertEquals(true, palindrom.isPalindromeDescendant(13001120)); + assertEquals(true, palindrom.isPalindromeDescendant(23336014)); + assertEquals(true, palindrom.isPalindromeDescendant(11)); + assertEquals(true, palindrom.isPalindromeDescendant(123321)); + assertEquals(false, palindrom.isPalindromeDescendant(123322)); + assertEquals(false, palindrom.isPalindromeDescendant(11211231)); + //assertEquals(true, palindrom.isPalindromeDescendant(1223542312)); + } +} diff --git a/src/test/java/edu/hw1/Task6_Test.java b/src/test/java/edu/hw1/Task6_Test.java new file mode 100644 index 0000000..9dc1bb4 --- /dev/null +++ b/src/test/java/edu/hw1/Task6_Test.java @@ -0,0 +1,20 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task6_Test { + @Test + @DisplayName("countK") + void test_countK() { + Task6 chislo; + chislo = new Task6(); + assertEquals(5, chislo.countK(6621)); + assertEquals(4, chislo.countK(6554)); + assertEquals(3, chislo.countK(1234)); + assertEquals(0, chislo.countK(6174)); + } +} diff --git a/src/test/java/edu/hw1/Task7_Test.java b/src/test/java/edu/hw1/Task7_Test.java new file mode 100644 index 0000000..f4a93bc --- /dev/null +++ b/src/test/java/edu/hw1/Task7_Test.java @@ -0,0 +1,20 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task7_Test { + + @Test + @DisplayName("rotate") + void test_rotate() { + Task7 rotate; + rotate = new Task7(); + assertEquals(4, rotate.rotateRight(8, 1)); + assertEquals(1, rotate.rotateLeft(16, 1)); + assertEquals(6, rotate.rotateLeft(17, 2)); + } +} diff --git a/src/test/java/edu/hw1/Task8_Test.java b/src/test/java/edu/hw1/Task8_Test.java new file mode 100644 index 0000000..d435db6 --- /dev/null +++ b/src/test/java/edu/hw1/Task8_Test.java @@ -0,0 +1,48 @@ +package edu.hw1; + +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class Task8_Test { + @Test + @DisplayName("Конь") + void test_knightBoardCapture() { + Task8 knight; + knight = new Task8(); + assertEquals(true, knight.knightBoardCapture(new int[][] {{0, 0, 0, 1, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 1, 0, 1, 0}, + {0, 1, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0, 1}, + {0, 0, 0, 0, 1, 0, 0, 0}})); + assertEquals(false, knight.knightBoardCapture(new int[][] {{1, 0, 1, 0, 1, 0, 1, 0}, + {0, 1, 0, 1, 0, 1, 0, 1}, + {0, 0, 0, 0, 1, 0, 1, 0}, + {0, 0, 1, 0, 0, 1, 0, 1}, + {1, 0, 0, 0, 1, 0, 1, 0}, + {0, 0, 0, 0, 0, 1, 0, 1}, + {1, 0, 0, 0, 1, 0, 1, 0}, + {0, 0, 0, 1, 0, 1, 0, 1}})); + assertEquals(false, knight.knightBoardCapture(new int[][] {{0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 1, 0, 0}, + {0, 0, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 1, 1, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}})); + assertEquals(true, knight.knightBoardCapture(new int[][] {{0, 0, 0, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 1, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 1, 0, 0}, + {0, 0, 0, 0, 1, 1, 0, 0}, + {1, 0, 0, 0, 0, 0, 0, 0}})); + } +} diff --git a/project-template/src/test/java/edu/project1/SampleTest.java b/src/test/java/edu/project1/SampleTest.java similarity index 100% rename from project-template/src/test/java/edu/project1/SampleTest.java rename to src/test/java/edu/project1/SampleTest.java diff --git a/target/checkstyle-cachefile b/target/checkstyle-cachefile new file mode 100644 index 0000000..b6ba659 --- /dev/null +++ b/target/checkstyle-cachefile @@ -0,0 +1,13 @@ +#Sun Oct 22 18:36:13 YEKT 2023 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/EvenArrayUtils.java=1696962643605 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Main.java=1696962643605 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task0.java=1697370232146 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task1.java=1697819361653 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task2.java=1697818906214 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task3.java=1697818953563 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task4.java=1697819361661 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task5.java=1697819821013 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task6.java=1697819873541 +/home/logan/hometask/java-course-2023/src/main/java/edu/hw1/Task7.java=1697819361665 +/home/logan/hometask/java-course-2023/src/main/java/edu/project1/Main.java=1696962643605 +configuration*?=FA99C88E326CC425664C46266B7C356567A65CF5 diff --git a/target/checkstyle-checker.xml b/target/checkstyle-checker.xml new file mode 100644 index 0000000..96b2f27 --- /dev/null +++ b/target/checkstyle-checker.xml @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/checkstyle-result.xml b/target/checkstyle-result.xml new file mode 100644 index 0000000..de4a22c --- /dev/null +++ b/target/checkstyle-result.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/classes/edu/hw1/EvenArrayUtils.class b/target/classes/edu/hw1/EvenArrayUtils.class new file mode 100644 index 0000000..e799104 Binary files /dev/null and b/target/classes/edu/hw1/EvenArrayUtils.class differ diff --git a/target/classes/edu/hw1/Main.class b/target/classes/edu/hw1/Main.class new file mode 100644 index 0000000..9e8f00c Binary files /dev/null and b/target/classes/edu/hw1/Main.class differ diff --git a/target/classes/edu/hw1/Task0.class b/target/classes/edu/hw1/Task0.class new file mode 100644 index 0000000..66e6463 Binary files /dev/null and b/target/classes/edu/hw1/Task0.class differ diff --git a/target/classes/edu/hw1/Task1.class b/target/classes/edu/hw1/Task1.class new file mode 100644 index 0000000..dd0e9a2 Binary files /dev/null and b/target/classes/edu/hw1/Task1.class differ diff --git a/target/classes/edu/hw1/Task2.class b/target/classes/edu/hw1/Task2.class new file mode 100644 index 0000000..1d73062 Binary files /dev/null and b/target/classes/edu/hw1/Task2.class differ diff --git a/target/classes/edu/hw1/Task3.class b/target/classes/edu/hw1/Task3.class new file mode 100644 index 0000000..fcd4110 Binary files /dev/null and b/target/classes/edu/hw1/Task3.class differ diff --git a/target/classes/edu/hw1/Task4.class b/target/classes/edu/hw1/Task4.class new file mode 100644 index 0000000..40a8f4c Binary files /dev/null and b/target/classes/edu/hw1/Task4.class differ diff --git a/target/classes/edu/hw1/Task5.class b/target/classes/edu/hw1/Task5.class new file mode 100644 index 0000000..fe37885 Binary files /dev/null and b/target/classes/edu/hw1/Task5.class differ diff --git a/target/classes/edu/hw1/Task6.class b/target/classes/edu/hw1/Task6.class new file mode 100644 index 0000000..53b952d Binary files /dev/null and b/target/classes/edu/hw1/Task6.class differ diff --git a/target/classes/edu/hw1/Task7.class b/target/classes/edu/hw1/Task7.class new file mode 100644 index 0000000..63c216c Binary files /dev/null and b/target/classes/edu/hw1/Task7.class differ diff --git a/target/classes/edu/hw1/Task8.class b/target/classes/edu/hw1/Task8.class new file mode 100644 index 0000000..7a2dd59 Binary files /dev/null and b/target/classes/edu/hw1/Task8.class differ diff --git a/target/classes/edu/project1/Generate_Words.class b/target/classes/edu/project1/Generate_Words.class new file mode 100644 index 0000000..4839d4d Binary files /dev/null and b/target/classes/edu/project1/Generate_Words.class differ diff --git a/target/classes/edu/project1/Main.class b/target/classes/edu/project1/Main.class new file mode 100644 index 0000000..e41ff12 Binary files /dev/null and b/target/classes/edu/project1/Main.class differ diff --git a/target/classes/edu/project1/Main_Consol.class b/target/classes/edu/project1/Main_Consol.class new file mode 100644 index 0000000..eff0bc4 Binary files /dev/null and b/target/classes/edu/project1/Main_Consol.class differ diff --git a/target/classes/edu/project1/find.class b/target/classes/edu/project1/find.class new file mode 100644 index 0000000..90fd176 Binary files /dev/null and b/target/classes/edu/project1/find.class differ diff --git a/target/classes/log4j2.xml b/target/classes/log4j2.xml new file mode 100644 index 0000000..27940f5 --- /dev/null +++ b/target/classes/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/target/test-classes/edu/hw1/SampleTest.class b/target/test-classes/edu/hw1/SampleTest.class new file mode 100644 index 0000000..b4cc055 Binary files /dev/null and b/target/test-classes/edu/hw1/SampleTest.class differ diff --git a/target/test-classes/edu/hw1/Task1_Test.class b/target/test-classes/edu/hw1/Task1_Test.class new file mode 100644 index 0000000..704426f Binary files /dev/null and b/target/test-classes/edu/hw1/Task1_Test.class differ diff --git a/target/test-classes/edu/hw1/Task2_Test.class b/target/test-classes/edu/hw1/Task2_Test.class new file mode 100644 index 0000000..407ffe4 Binary files /dev/null and b/target/test-classes/edu/hw1/Task2_Test.class differ diff --git a/target/test-classes/edu/hw1/Task3_Test.class b/target/test-classes/edu/hw1/Task3_Test.class new file mode 100644 index 0000000..7bae4a3 Binary files /dev/null and b/target/test-classes/edu/hw1/Task3_Test.class differ diff --git a/target/test-classes/edu/hw1/Task4_Test.class b/target/test-classes/edu/hw1/Task4_Test.class new file mode 100644 index 0000000..da0b942 Binary files /dev/null and b/target/test-classes/edu/hw1/Task4_Test.class differ diff --git a/target/test-classes/edu/hw1/Task5_Test.class b/target/test-classes/edu/hw1/Task5_Test.class new file mode 100644 index 0000000..1908848 Binary files /dev/null and b/target/test-classes/edu/hw1/Task5_Test.class differ diff --git a/target/test-classes/edu/hw1/Task6_Test.class b/target/test-classes/edu/hw1/Task6_Test.class new file mode 100644 index 0000000..72123a0 Binary files /dev/null and b/target/test-classes/edu/hw1/Task6_Test.class differ diff --git a/target/test-classes/edu/hw1/Task7_Test.class b/target/test-classes/edu/hw1/Task7_Test.class new file mode 100644 index 0000000..fcf17cd Binary files /dev/null and b/target/test-classes/edu/hw1/Task7_Test.class differ diff --git a/target/test-classes/edu/hw1/Task8_Test.class b/target/test-classes/edu/hw1/Task8_Test.class new file mode 100644 index 0000000..f1ffff3 Binary files /dev/null and b/target/test-classes/edu/hw1/Task8_Test.class differ diff --git a/target/test-classes/edu/project1/SampleTest.class b/target/test-classes/edu/project1/SampleTest.class new file mode 100644 index 0000000..ccf1db0 Binary files /dev/null and b/target/test-classes/edu/project1/SampleTest.class differ