diff --git a/.circleci/config.yml b/.circleci/config.yml index 48de984..a5e876c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,42 +1,9 @@ -# Java Gradle CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details -# -version: 2 -jobs: - build: - docker: - # specify the version you desire here - - image: circleci/openjdk:8-jdk +version: 2.1 - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 +orbs: + maven: circleci/maven@0.0.12 - working_directory: ~/repo - - environment: - # Customize the JVM maximum heap limit - JVM_OPTS: -Xmx3200m - TERM: dumb - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "build.gradle" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: gradle dependencies - - - save_cache: - paths: - - ~/.gradle - key: v1-dependencies-{{ checksum "build.gradle" }} - - # run tests! - - run: gradle test +workflows: + maven_test: + jobs: + - maven/test # checkout, build, test, and upload test results diff --git a/.gitignore b/.gitignore index ca92a1f..4e0b621 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,32 @@ -.idea/ -out/ -.gradle/ + +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### 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/ -**.iml -**.ipr -**.iws \ No newline at end of file +### VS Code ### +.vscode/ \ No newline at end of file diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index 0dd6397..0000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectCodeStyleSettingsManager"> - <option name="PER_PROJECT_SETTINGS"> - <value /> - </option> - <option name="PREFERRED_PROJECT_CODE_STYLE" value="rassoll" /> - </component> -</project> \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 31086cd..43befef 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,19 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CompilerConfiguration"> - <wildcardResourcePatterns> - <entry name="!?*.java" /> - <entry name="!?*.form" /> - <entry name="!?*.class" /> - <entry name="!?*.groovy" /> - <entry name="!?*.scala" /> - <entry name="!?*.flex" /> - <entry name="!?*.kt" /> - <entry name="!?*.clj" /> - </wildcardResourcePatterns> + <annotationProcessing> + <profile name="Maven default annotation processors profile" enabled="true"> + <sourceOutputDir name="target/generated-sources/annotations" /> + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> + <outputRelativeToContentRoot value="true" /> + <module name="DataStructuresAndAlgorithmsInJava2ndEdition" /> + </profile> + </annotationProcessing> <bytecodeTargetLevel> - <module name="Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_main" target="1.8" /> - <module name="Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_test" target="1.8" /> + <module name="DataStructuresAndAlgorithmsInJava2ndEdition" target="1.8" /> </bytecodeTargetLevel> </component> </project> \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<component name="CopyrightManager"> - <settings default="" /> -</component> \ No newline at end of file diff --git a/.idea/description.html b/.idea/description.html deleted file mode 100644 index db5f129..0000000 --- a/.idea/description.html +++ /dev/null @@ -1 +0,0 @@ -<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html> \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e206d70..aa00ffa 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> -</project> - + <component name="Encoding"> + <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> + <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/markdown-navigator.xml b/.idea/markdown-navigator.xml deleted file mode 100644 index 3efe9d6..0000000 --- a/.idea/markdown-navigator.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="MarkdownProjectSettings"> - <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true"> - <PanelProvider> - <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" /> - </PanelProvider> - </PreviewSettings> - <ParserSettings gitHubSyntaxChange="false"> - <PegdownExtensions> - <option name="ABBREVIATIONS" value="false" /> - <option name="ANCHORLINKS" value="true" /> - <option name="ASIDE" value="false" /> - <option name="ATXHEADERSPACE" value="true" /> - <option name="AUTOLINKS" value="true" /> - <option name="DEFINITIONS" value="false" /> - <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" /> - <option name="FENCED_CODE_BLOCKS" value="true" /> - <option name="FOOTNOTES" value="false" /> - <option name="HARDWRAPS" value="false" /> - <option name="INSERTED" value="false" /> - <option name="QUOTES" value="false" /> - <option name="RELAXEDHRULES" value="true" /> - <option name="SMARTS" value="false" /> - <option name="STRIKETHROUGH" value="true" /> - <option name="SUBSCRIPT" value="false" /> - <option name="SUPERSCRIPT" value="false" /> - <option name="SUPPRESS_HTML_BLOCKS" value="false" /> - <option name="SUPPRESS_INLINE_HTML" value="false" /> - <option name="TABLES" value="true" /> - <option name="TASKLISTITEMS" value="true" /> - <option name="TOC" value="false" /> - <option name="WIKILINKS" value="true" /> - </PegdownExtensions> - <ParserOptions> - <option name="COMMONMARK_LISTS" value="true" /> - <option name="DUMMY" value="false" /> - <option name="EMOJI_SHORTCUTS" value="true" /> - <option name="FLEXMARK_FRONT_MATTER" value="false" /> - <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" /> - <option name="GFM_TABLE_RENDERING" value="true" /> - <option name="GITBOOK_URL_ENCODING" value="false" /> - <option name="GITHUB_EMOJI_URL" value="false" /> - <option name="GITHUB_LISTS" value="false" /> - <option name="GITHUB_WIKI_LINKS" value="true" /> - <option name="JEKYLL_FRONT_MATTER" value="false" /> - <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" /> - </ParserOptions> - </ParserSettings> - <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true"> - <GeneratorProvider> - <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" /> - </GeneratorProvider> - <headerTop /> - <headerBottom /> - <bodyTop /> - <bodyBottom /> - </HtmlSettings> - <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true"> - <StylesheetProvider> - <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" /> - </StylesheetProvider> - <ScriptProviders /> - <cssText /> - </CssSettings> - <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" /> - <LinkMapSettings> - <textMaps /> - </LinkMapSettings> - </component> -</project> \ No newline at end of file diff --git a/.idea/markdown-navigator/profiles_settings.xml b/.idea/markdown-navigator/profiles_settings.xml deleted file mode 100644 index 57927c5..0000000 --- a/.idea/markdown-navigator/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<component name="MarkdownNavigator.ProfileManager"> - <settings default="" pdf-export="" /> -</component> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3651a57..68694a4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,9 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="ProjectKey"> - <option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" /> + <component name="MavenProjectsManager"> + <option name="originalFiles"> + <list> + <option value="$PROJECT_DIR$/pom.xml" /> + </list> + </option> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/out" /> </component> </project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 477387c..4841aa9 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,9 +2,7 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/Data Structures and Algorithms in Java (2nd Edition).iml" filepath="$PROJECT_DIR$/.idea/modules/Data Structures and Algorithms in Java (2nd Edition).iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_main.iml" filepath="$PROJECT_DIR$/.idea/modules/Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_main.iml" group="Data Structures and Algorithms in Java (2nd Edition)" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_test.iml" filepath="$PROJECT_DIR$/.idea/modules/Data_Structures_and_Algorithms_in_Java_(2nd_Edition)_test.iml" group="Data Structures and Algorithms in Java (2nd Edition)" /> + <module fileurl="file://$PROJECT_DIR$/.idea/DataStructuresAndAlgorithmsInJava2ndEdition.iml" filepath="$PROJECT_DIR$/.idea/DataStructuresAndAlgorithmsInJava2ndEdition.iml" /> </modules> </component> </project> \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index e96534f..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Palette2"> - <group name="Swing"> - <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> - </item> - <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> - </item> - <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> - <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> - <initial-values> - <property name="text" value="Button" /> - </initial-values> - </item> - <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="RadioButton" /> - </initial-values> - </item> - <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="CheckBox" /> - </initial-values> - </item> - <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> - <initial-values> - <property name="text" value="Label" /> - </initial-values> - </item> - <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> - <preferred-size width="150" height="-1" /> - </default-constraints> - </item> - <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> - <preferred-size width="150" height="50" /> - </default-constraints> - </item> - <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> - <preferred-size width="200" height="200" /> - </default-constraints> - </item> - <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> - <preferred-size width="200" height="200" /> - </default-constraints> - </item> - <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> - </item> - <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> - </item> - <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> - </item> - <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> - <preferred-size width="-1" height="20" /> - </default-constraints> - </item> - <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> - <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> - </item> - <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> - <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> - </item> - </group> - </component> -</project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$" vcs="Git" /> + <mapping directory="" vcs="Git" /> </component> </project> \ No newline at end of file diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..e76d1f3 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..2cc7d4a Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..642d572 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/README.md b/README.md index 0dd5c46..9073316 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Структуры данных и алгоритмы Java (2е Издание) Роберт Лафоре # Data Structures and Algorithms in Java (2nd Edition) Robert Lafore +[](https://circleci.com/gh/RakhmedovRS/DataStructuresAndAlgorithmsInJava2ndEdition) +  Исходный код с решением задач из книги "Структуры данных и Алгоритмы Java(Второе издание) Роберт Лафоре", местами немного доработан. ISBN(rus) 978-5-496-00740-5 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 5b964f5..0000000 --- a/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'java' -apply plugin: 'idea' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 -compileJava.options.encoding = 'UTF-8' -compileTestJava.options.encoding = 'UTF-8' - -compileJava { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" -} - -buildscript { - repositories { - maven { url 'http://repo1.maven.org/maven2' } - jcenter { url "http://jcenter.bintray.com/" } - } -} - -repositories { - maven { url 'http://repo1.maven.org/maven2' } - jcenter { url "http://jcenter.bintray.com/" } -} - -dependencies { - testCompile group: 'junit', name: 'junit', version: '4.11' -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 93a29c0..0000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index bcb0e88..0000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Nov 01 21:05:42 MSK 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-3.4-all.zip diff --git a/gradlew b/gradlew deleted file mode 100644 index 4453cce..0000000 --- a/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save ( ) { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100644 index f955316..0000000 --- a/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..a16b543 --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@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 https://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 Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@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 "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\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 DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_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 DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_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('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@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 "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\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% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..54f4d85 --- /dev/null +++ b/pom.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.github.rakhmedovrs</groupId> + <artifactId>DataStructuresAndAlgorithmsInJava2ndEdition</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>1.8</java.version> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> diff --git a/rassoll.xml b/rassoll.xml deleted file mode 100644 index 80a7614..0000000 --- a/rassoll.xml +++ /dev/null @@ -1,558 +0,0 @@ -<code_scheme name="rassoll"> - <option name="OTHER_INDENT_OPTIONS"> - <value> - <option name="INDENT_SIZE" value="4" /> - <option name="CONTINUATION_INDENT_SIZE" value="8" /> - <option name="TAB_SIZE" value="4" /> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - <option name="LABEL_INDENT_SIZE" value="0" /> - <option name="LABEL_INDENT_ABSOLUTE" value="false" /> - <option name="USE_RELATIVE_INDENTS" value="false" /> - </value> - </option> - <option name="IMPORT_LAYOUT_TABLE"> - <value> - <package name="" withSubpackages="true" static="false" /> - <emptyLine /> - <package name="java" withSubpackages="true" static="false" /> - <package name="javax" withSubpackages="true" static="false" /> - <emptyLine /> - <package name="" withSubpackages="true" static="true" /> - </value> - </option> - <option name="RIGHT_MARGIN" value="200" /> - <option name="ENABLE_JAVADOC_FORMATTING" value="false" /> - <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" /> - <option name="JD_P_AT_EMPTY_LINES" value="false" /> - <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" /> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" /> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" /> - <option name="BRACE_STYLE" value="2" /> - <option name="CLASS_BRACE_STYLE" value="2" /> - <option name="METHOD_BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="WHILE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="FINALLY_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" /> - <option name="LABELED_STATEMENT_WRAP" value="0" /> - <option name="WRAP_COMMENTS" value="true" /> - <option name="METHOD_ANNOTATION_WRAP" value="0" /> - <option name="CLASS_ANNOTATION_WRAP" value="0" /> - <option name="FIELD_ANNOTATION_WRAP" value="0" /> - <MarkdownNavigatorCodeStyleSettings> - <option name="RIGHT_MARGIN" value="72" /> - </MarkdownNavigatorCodeStyleSettings> - <XML> - <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> - </XML> - <codeStyleSettings language="CFML"> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="WHILE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - </codeStyleSettings> - <codeStyleSettings language="CSS"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="CoffeeScript"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="ECMA Script Level 4"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="GSP"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="Gherkin"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="Groovy"> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" /> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" /> - <option name="BLANK_LINES_AFTER_PACKAGE" value="0" /> - <option name="BRACE_STYLE" value="2" /> - <option name="CLASS_BRACE_STYLE" value="2" /> - <option name="METHOD_BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="FINALLY_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="METHOD_ANNOTATION_WRAP" value="0" /> - <option name="CLASS_ANNOTATION_WRAP" value="0" /> - <option name="FIELD_ANNOTATION_WRAP" value="0" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="HAML"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="HTML"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="JAVA"> - <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" /> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" /> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" /> - <option name="BRACE_STYLE" value="2" /> - <option name="CLASS_BRACE_STYLE" value="2" /> - <option name="METHOD_BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="WHILE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="FINALLY_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="SPACE_BEFORE_METHOD_LBRACE" value="false" /> - <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" /> - <option name="LABELED_STATEMENT_WRAP" value="0" /> - <option name="IF_BRACE_FORCE" value="3" /> - <option name="DOWHILE_BRACE_FORCE" value="3" /> - <option name="WHILE_BRACE_FORCE" value="3" /> - <option name="PARAMETER_ANNOTATION_WRAP" value="2" /> - <option name="VARIABLE_ANNOTATION_WRAP" value="2" /> - <option name="ENUM_CONSTANTS_WRAP" value="2" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="4" /> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - <arrangement> - <rules> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PUBLIC>true</PUBLIC> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PROTECTED>true</PROTECTED> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PRIVATE>true</PRIVATE> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PUBLIC>true</PUBLIC> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PROTECTED>true</PROTECTED> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PRIVATE>true</PRIVATE> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <INITIALIZER_BLOCK>true</INITIALIZER_BLOCK> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PUBLIC>true</PUBLIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PROTECTED>true</PROTECTED> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <FINAL>true</FINAL> - <PRIVATE>true</PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PUBLIC>true</PUBLIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PROTECTED>true</PROTECTED> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FIELD>true</FIELD> - <PRIVATE>true</PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <FIELD>true</FIELD> - </match> - </rule> - </section> - <section> - <rule> - <match> - <INITIALIZER_BLOCK>true</INITIALIZER_BLOCK> - </match> - </rule> - </section> - <section> - <rule> - <match> - <CONSTRUCTOR>true</CONSTRUCTOR> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <METHOD>true</METHOD> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <FINAL>true</FINAL> - <METHOD>true</METHOD> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <METHOD>true</METHOD> - <PUBLIC>true</PUBLIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <ABSTRACT>true</ABSTRACT> - <METHOD>true</METHOD> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <METHOD>true</METHOD> - <PROTECTED>true</PROTECTED> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <METHOD>true</METHOD> - <PACKAGE_PRIVATE>true</PACKAGE_PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <METHOD>true</METHOD> - <PRIVATE>true</PRIVATE> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <ENUM>true</ENUM> - </match> - </rule> - </section> - <section> - <rule> - <match> - <INTERFACE>true</INTERFACE> - </match> - </rule> - </section> - <section> - <rule> - <match> - <AND> - <CLASS>true</CLASS> - <STATIC>true</STATIC> - </AND> - </match> - </rule> - </section> - <section> - <rule> - <match> - <CLASS>true</CLASS> - </match> - </rule> - </section> - </rules> - </arrangement> - </codeStyleSettings> - <codeStyleSettings language="JSON"> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="JSP"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="JSPX"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="JavaScript"> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="BRACE_STYLE" value="2" /> - <option name="METHOD_BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="WHILE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="FINALLY_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="8" /> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="LESS"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="SASS"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="SCSS"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="SQL"> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="8" /> - <option name="TAB_SIZE" value="4" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="Stylus"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="TypeScript"> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> - <option name="BRACE_STYLE" value="2" /> - <option name="CLASS_BRACE_STYLE" value="2" /> - <option name="METHOD_BRACE_STYLE" value="2" /> - <option name="ELSE_ON_NEW_LINE" value="true" /> - <option name="WHILE_ON_NEW_LINE" value="true" /> - <option name="CATCH_ON_NEW_LINE" value="true" /> - <option name="FINALLY_ON_NEW_LINE" value="true" /> - <option name="ALIGN_MULTILINE_FOR" value="false" /> - <option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" /> - <option name="WRAP_COMMENTS" value="true" /> - <option name="PARENT_SETTINGS_INSTALLED" value="true" /> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="XML"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="kotlin"> - <indentOptions> - <option name="USE_TAB_CHARACTER" value="true" /> - <option name="SMART_TABS" value="true" /> - </indentOptions> - </codeStyleSettings> -</code_scheme> \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 029f18a..0000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'Data Structures and Algorithms in Java (2nd Edition)' diff --git a/src/main/java/chapter10/BTree.java b/src/main/java/chapter10/BTree.java index 24af53f..39aacfe 100644 --- a/src/main/java/chapter10/BTree.java +++ b/src/main/java/chapter10/BTree.java @@ -1,9 +1,10 @@ package chapter10; import base.items.Item; -import javafx.util.Pair; +import java.util.AbstractMap; import java.util.List; +import java.util.Map; import static chapter10.BTreeOrder3Constants.*; import static chapter10.Order.TREE_3_ORDER; @@ -321,7 +322,7 @@ private void splitNodeOrder3(BNode brokenBNode, Item newItem) /*разбиваемый узел имеет потомков*/ else { - Pair<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); + Map.Entry<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); /*присоединяем новых потомков к новому корню*/ newRoot.connectChild(LEFT_CHILD, childNodes.getKey()); @@ -358,7 +359,7 @@ private void splitNodeOrder3(BNode brokenBNode, Item newItem) /*разбиваемый узел имеет потомков*/ else { - Pair<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); + Map.Entry<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); /*присоединяем новых потомком к разбиваемому узлу*/ brokenBNode.connectChild(LEFT_CHILD, childNodes.getKey()); @@ -401,7 +402,7 @@ else if (highOrderNode.getItem(CENTRAL_ITEM).getKey() > parentNode.getItem(LEFT_ /*разбиваемый узел имеет потомков*/ else { - Pair<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); + Map.Entry<BNode, BNode> childNodes = getNewChildNodes(highOrderNode, brokenBNode, newItem); /*распределяем дочерние элементы родителького узла*/ if (parentNode.getItem(LEFT_ITEM).getKey() > childNodes.getValue().getItem(LEFT_ITEM).getKey()) @@ -435,7 +436,7 @@ else if (highOrderNode.getItem(CENTRAL_ITEM).getKey() > parentNode.getItem(LEFT_ * @param newItem новый элемент данных * @return пара содержащая новую левую и правую ноды */ - private Pair<BNode, BNode> getNewChildNodes(BNode highOrderNode, BNode brokenBNode, Item newItem) + private Map.Entry<BNode, BNode> getNewChildNodes(BNode highOrderNode, BNode brokenBNode, Item newItem) { BNode newLeftChild = getNewNode(); BNode newRightChild = getNewNode(); @@ -535,7 +536,7 @@ else if (highOrderNode.getItem(CENTRAL_ITEM).getKey() == newItem.getKey()) newRightChild.connectChild(CENTRAL_CHILD, brokenBNode.disconnectChild(RIGHT_CHILD)); } - return new Pair<>(newLeftChild, newRightChild); + return new AbstractMap.SimpleEntry<>(newLeftChild, newRightChild); } /**