This commit is contained in:
2017-04-14 17:39:38 +08:00
commit bb1cf0bc87
64 changed files with 3940 additions and 0 deletions
Vendored
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
build
@@ -0,0 +1 @@
#Wed Apr 05 09:15:28 CST 2017
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+97
View File
@@ -0,0 +1,97 @@
installApp
startScripts
run
assemble
build
jacocoTestReport
buildDependents
buildNeeded
classes
compileJava
processResources
clean
jar
testClasses
compileTestJava
processTestResources
init
wrapper
assembleDist
distTar
startScripts
distZip
startScripts
installDist
startScripts
javadoc
buildEnvironment
components
dependencies
dependencyInsight
help
model
projects
properties
tasks
cleanIdea
cleanIdeaModule
cleanIdeaProject
idea
ideaModule
ideaProject
ideaWorkspace
check
checkstyleMain
checkstyleTest
test
cleanIdeaWorkspace
Pattern:
Pattern:
Pattern:
installApp
startScripts
run
assemble
build
jacocoTestReport
buildDependents
buildNeeded
classes
compileJava
processResources
clean
jar
testClasses
compileTestJava
processTestResources
init
wrapper
assembleDist
distTar
startScripts
distZip
startScripts
installDist
startScripts
javadoc
buildEnvironment
components
dependencies
dependencyInsight
help
model
projects
properties
tasks
cleanIdea
cleanIdeaModule
cleanIdeaProject
idea
ideaModule
ideaProject
ideaWorkspace
check
checkstyleMain
checkstyleTest
test
cleanIdeaWorkspace
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel>
<module name="RobotSimulator_main" target="1.8" />
<module name="RobotSimulator_test" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/local/Cellar/gradle/2.14.1" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>
+11
View File
@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: com.google.guava:guava:21.0">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/3a3d111be1be1b745edfa7d91678a12d7ed38709/guava-21.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/b9ed26b8c23fe7cd3e6b463b34e54e5c6d9536d5/guava-21.0-sources.jar!/" />
</SOURCES>
</library>
</component>
+11
View File
@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: junit:junit:4.11">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/28e0ad201304e4a4abf999ca0570b7cffc352c3c/junit-4.11-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="Gradle: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>
+60
View File
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClientPropertiesManager">
<properties class="javax.swing.AbstractButton">
<property name="hideActionText" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JComponent">
<property name="html.disable" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JEditorPane">
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
<property name="charset" class="java.lang.String" />
</properties>
<properties class="javax.swing.JList">
<property name="List.isFileList" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JPasswordField">
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JSlider">
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
<property name="JSlider.isFilled" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTable">
<property name="Table.isFileList" class="java.lang.Boolean" />
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JToolBar">
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTree">
<property name="JTree.lineStyle" class="java.lang.String" />
</properties>
<properties class="javax.swing.text.JTextComponent">
<property name="caretAspectRatio" class="java.lang.Double" />
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.7</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/RobotSimulator.iml" filepath="$PROJECT_DIR$/.idea/modules/RobotSimulator.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/RobotSimulator_main.iml" filepath="$PROJECT_DIR$/.idea/modules/RobotSimulator_main.iml" group="RobotSimulator" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/RobotSimulator_test.iml" filepath="$PROJECT_DIR$/.idea/modules/RobotSimulator_test.iml" group="RobotSimulator" />
</modules>
</component>
</project>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="RobotSimulator" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="au.com.seek" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../..">
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="RobotSimulator:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="au.com.seek" external.system.module.type="sourceSet" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../build/classes/main" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/main">
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.google.guava:guava:21.0" level="project" />
</component>
</module>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="RobotSimulator:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="au.com.seek" external.system.module.type="sourceSet" external.system.module.version="1.0-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../src/test">
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="RobotSimulator_main" />
<orderEntry type="library" name="Gradle: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" name="Gradle: junit:junit:4.11" level="project" />
<orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
<component name="TestModuleProperties" production-module="RobotSimulator_main" />
</module>
+124
View File
@@ -0,0 +1,124 @@
<?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>
+1921
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
# RobotSimulator
### How to run the program
* Please make sure you have Java 8 SDK installed first.
* If you have `gradle` installed, then just run `gradle build`. Otherwise type `./gradlew build` or `./gradlew.bat
build` in your terminal to
build the project. Then open `build/reports` folder to see checkstyle, unit test, code coverage results. Jacoco
html reports in the folder of `build/jacocoHtml`.
* Type `gradle run` to run the Robot Simulator Application, and you will see some output based on the
`src/main/resources/input.txt`
file. (`
./gradlew
run` or `
./gradlew.bat run`)
### Features
* Checkstyle for code style
* Gradle for project build
* 100% code coverage (Jacoco)
* All tests passed with Junit.
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output/>
<orderEntry type="inheritedJdk"/>
<content url="file://$MODULE_DIR$/">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false"/>
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false"/>
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true"/>
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true"/>
<excludeFolder url="file://$MODULE_DIR$/build"/>
<excludeFolder url="file://$MODULE_DIR$/.gradle"/>
</content>
<orderEntry type="sourceFolder" forTests="false"/>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/3a3d111be1be1b745edfa7d91678a12d7ed38709/guava-21.0.jar!/"/>
</CLASSES>
<JAVADOC/>
<SOURCES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/b9ed26b8c23fe7cd3e6b463b34e54e5c6d9536d5/guava-21.0-sources.jar!/"/>
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library>
<CLASSES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar!/"/>
</CLASSES>
<JAVADOC/>
<SOURCES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/28e0ad201304e4a4abf999ca0570b7cffc352c3c/junit-4.11-sources.jar!/"/>
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library>
<CLASSES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar!/"/>
</CLASSES>
<JAVADOC/>
<SOURCES>
<root url="jar:///Users/junv/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b/hamcrest-core-1.3-sources.jar!/"/>
</SOURCES>
</library>
</orderEntry>
</component>
<component name="ModuleRootManager"/>
</module>
+104
View File
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac"/>
<resourceExtensions>
<entry name=".+\.(properties|xml|html|dtd|tld)"/>
<entry name=".+\.(gif|png|jpeg|jpg)"/>
</resourceExtensions>
<wildcardResourcePatterns>
<entry name="!?*.class"/>
<entry name="!?*.scala"/>
<entry name="!?*.groovy"/>
<entry name="!?*.java"/>
</wildcardResourcePatterns>
<annotationProcessing enabled="false" useClasspath="true"/>
<bytecodeTargetLevel target="1.8"/>
</component>
<component name="CopyrightManager" default="">
<module2copyright/>
</component>
<component name="DependencyValidationManager">
<option name="SKIP_IMPORT_STATEMENTS" value="false"/>
</component>
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false"/>
<component name="GradleUISettings">
<setting name="root"/>
</component>
<component name="GradleUISettings2">
<setting name="root"/>
</component>
<component name="IdProvider" IDEtalkID="11DA1DB66DD62DDA1ED602B7079FE97C"/>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY"/>
<option name="OPTION_SCOPE" value="protected"/>
<option name="OPTION_HIERARCHY" value="true"/>
<option name="OPTION_NAVIGATOR" value="true"/>
<option name="OPTION_INDEX" value="true"/>
<option name="OPTION_SEPARATE_INDEX" value="true"/>
<option name="OPTION_DOCUMENT_TAG_USE" value="false"/>
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/>
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/>
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true"/>
<option name="OPTION_DEPRECATED_LIST" value="true"/>
<option name="OTHER_OPTIONS" value=""/>
<option name="HEAP_SIZE"/>
<option name="LOCALE"/>
<option name="OPEN_IN_BROWSER" value="true"/>
</component>
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/RobotSimulator.iml" fileurl="file://$PROJECT_DIR$/RobotSimulator.iml"/>
</modules>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-type="JavaSDK" assert-jdk-15="true" project-jdk-name="1.8">
<output url="file://$PROJECT_DIR$/out"/>
</component>
<component name="SvnBranchConfigurationManager">
<option name="mySupportsUserInfoFilter" value="true"/>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs=""/>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<UIState>
<splitter-proportions>
<SplitterProportionsDataImpl/>
</splitter-proportions>
<settings/>
</UIState>
</state>
<state key="Copyright.UI">
<UIState>
<splitter-proportions>
<SplitterProportionsDataImpl/>
</splitter-proportions>
</UIState>
</state>
<state key="ProjectJDKs.UI">
<UIState>
<splitter-proportions>
<SplitterProportionsDataImpl>
<option name="proportions">
<list>
<option value="0.2"/>
</list>
</option>
</SplitterProportionsDataImpl>
</splitter-proportions>
<last-edited>1.6</last-edited>
</UIState>
</state>
<state key="ScopeChooserConfigurable.UI">
<UIState>
<splitter-proportions>
<SplitterProportionsDataImpl/>
</splitter-proportions>
<settings/>
</UIState>
</state>
</states>
</component>
</project>
+207
View File
@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<option name="TRACKING_ENABLED" value="true"/>
<option name="SHOW_DIALOG" value="false"/>
<option name="HIGHLIGHT_CONFLICTS" value="true"/>
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false"/>
<option name="LAST_RESOLUTION" value="IGNORE"/>
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false"/>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value=""/>
<option name="REVERSE_PATCH" value="false"/>
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints/>
</component>
<component name="DebuggerManager">
<breakpoint_any>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true"/>
<option name="NOTIFY_UNCAUGHT" value="true"/>
<option name="ENABLED" value="false"/>
<option name="LOG_ENABLED" value="false"/>
<option name="LOG_EXPRESSION_ENABLED" value="false"/>
<option name="SUSPEND_POLICY" value="SuspendAll"/>
<option name="COUNT_FILTER_ENABLED" value="false"/>
<option name="COUNT_FILTER" value="0"/>
<option name="CONDITION_ENABLED" value="false"/>
<option name="CLASS_FILTERS_ENABLED" value="false"/>
<option name="INSTANCE_FILTERS_ENABLED" value="false"/>
<option name="CONDITION" value=""/>
<option name="LOG_MESSAGE" value=""/>
</breakpoint>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true"/>
<option name="NOTIFY_UNCAUGHT" value="true"/>
<option name="ENABLED" value="false"/>
<option name="LOG_ENABLED" value="false"/>
<option name="LOG_EXPRESSION_ENABLED" value="false"/>
<option name="SUSPEND_POLICY" value="SuspendAll"/>
<option name="COUNT_FILTER_ENABLED" value="false"/>
<option name="COUNT_FILTER" value="0"/>
<option name="CONDITION_ENABLED" value="false"/>
<option name="CLASS_FILTERS_ENABLED" value="false"/>
<option name="INSTANCE_FILTERS_ENABLED" value="false"/>
<option name="CONDITION" value=""/>
<option name="LOG_MESSAGE" value=""/>
</breakpoint>
</breakpoint_any>
<breakpoint_rules/>
<ui_properties/>
</component>
<component name="ModuleEditorState">
<option name="LAST_EDITED_MODULE_NAME"/>
<option name="LAST_EDITED_TAB_NAME"/>
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state/>
</entry>
</component>
<component name="ProjectLevelVcsManager">
<OptionsSetting value="true" id="Add"/>
<OptionsSetting value="true" id="Remove"/>
<OptionsSetting value="true" id="Checkout"/>
<OptionsSetting value="true" id="Update"/>
<OptionsSetting value="true" id="Status"/>
<OptionsSetting value="true" id="Edit"/>
<ConfirmationsSetting value="0" id="Add"/>
<ConfirmationsSetting value="0" id="Remove"/>
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0"/>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false"/>
<property name="GoToClass.toSaveIncludeLibraries" value="false"/>
<property name="MemberChooser.sorted" value="false"/>
<property name="MemberChooser.showClasses" value="true"/>
<property name="GoToClass.includeLibraries" value="false"/>
<property name="MemberChooser.copyJavadoc" value="false"/>
</component>
<component name="RunManager">
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true"/>
<option name="SERVER_MODE" value="false"/>
<option name="SHMEM_ADDRESS" value="javadebug"/>
<option name="HOST" value="localhost"/>
<option name="PORT" value="5005"/>
<method>
<option name="BuildArtifacts" enabled="false"/>
</method>
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name=""/>
<option name="MAIN_CLASS_NAME"/>
<option name="HTML_FILE_NAME"/>
<option name="HTML_USED" value="false"/>
<option name="WIDTH" value="400"/>
<option name="HEIGHT" value="300"/>
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy"/>
<option name="VM_PARAMETERS"/>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/>
<option name="ALTERNATIVE_JRE_PATH"/>
<method>
<option name="BuildArtifacts" enabled="false"/>
<option name="Make" enabled="true"/>
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false"/>
<option name="MAIN_CLASS_NAME"/>
<option name="VM_PARAMETERS"/>
<option name="PROGRAM_PARAMETERS"/>
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/>
<option name="ALTERNATIVE_JRE_PATH"/>
<option name="ENABLE_SWING_INSPECTOR" value="false"/>
<option name="ENV_VARIABLES"/>
<option name="PASS_PARENT_ENVS" value="true"/>
<module name=""/>
<envs/>
<method>
<option name="BuildArtifacts" enabled="false"/>
<option name="Make" enabled="true"/>
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false"/>
<module name=""/>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"/>
<option name="ALTERNATIVE_JRE_PATH"/>
<option name="PACKAGE_NAME"/>
<option name="MAIN_CLASS_NAME"/>
<option name="METHOD_NAME"/>
<option name="TEST_OBJECT" value="class"/>
<option name="VM_PARAMETERS"/>
<option name="PARAMETERS"/>
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
<option name="ENV_VARIABLES"/>
<option name="PASS_PARENT_ENVS" value="true"/>
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies"/>
</option>
<envs/>
<method>
<option name="BuildArtifacts" enabled="false"/>
<option name="Make" enabled="true"/>
</method>
</configuration>
<list size="0"/>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false"/>
<component name="SvnConfiguration" maxAnnotateRevisions="500">
<option name="USER" value=""/>
<option name="PASSWORD" value=""/>
<option name="LAST_MERGED_REVISION"/>
<option name="UPDATE_RUN_STATUS" value="false"/>
<option name="MERGE_DRY_RUN" value="false"/>
<option name="MERGE_DIFF_USE_ANCESTRY" value="true"/>
<option name="UPDATE_LOCK_ON_DEMAND" value="false"/>
<option name="IGNORE_SPACES_IN_MERGE" value="false"/>
<option name="DETECT_NESTED_COPIES" value="true"/>
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true"/>
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true"/>
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task"/>
<servers/>
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true"/>
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true"/>
<option name="PERFORM_UPDATE_IN_BACKGROUND" value="true"/>
<option name="PERFORM_COMMIT_IN_BACKGROUND" value="true"/>
<option name="PERFORM_EDIT_IN_BACKGROUND" value="true"/>
<option name="PERFORM_CHECKOUT_IN_BACKGROUND" value="true"/>
<option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true"/>
<option name="PERFORM_ROLLBACK_IN_BACKGROUND" value="false"/>
<option name="CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND" value="false"/>
<option name="ENABLE_BACKGROUND_PROCESSES" value="false"/>
<option name="CHANGED_ON_SERVER_INTERVAL" value="60"/>
<option name="FORCE_NON_EMPTY_COMMENT" value="false"/>
<option name="LAST_COMMIT_MESSAGE"/>
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true"/>
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/>
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false"/>
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/>
<option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/>
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/>
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/>
<option name="ACTIVE_VCS_NAME"/>
<option name="UPDATE_GROUP_BY_PACKAGES" value="false"/>
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false"/>
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false"/>
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6"/>
</component>
<component name="XDebuggerManager">
<breakpoint-manager/>
</component>
</project>
+40
View File
@@ -0,0 +1,40 @@
group 'au.com.seek'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'application'
sourceCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
repositories {
maven { url 'http://182.140.210.215:8081/repository/maven-public/' }
mavenCentral()
}
dependencies {
compile 'com.google.guava:guava:21.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled true
html.destination "${buildDir}/jacocoHtml"
}
}
build {
dependsOn jacocoTestReport
}
checkstyle {
configFile = new File("${project.projectDir}/checkstyle_rules.xml")
checkstyleMain.exclude "**/src/test"
}
mainClassName = "au.com.seek.RobotSimulator"
+14
View File
@@ -0,0 +1,14 @@
#Thu Apr 06 08:41:33 CST 2017
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/command/ReportCommand.java=1491383770000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/command/TurnRightCommand.java=1491383770000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/RobotSimulator.java=1491386986000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/domain/Robot.java=1491385232000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/executor/Executor.java=1491386727000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/command/MoveForwardCommand.java=1491383770000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/command/TurnLeftCommand.java=1491383770000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/domain/Tabletop.java=1491385286000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/domain/Coordinate.java=1491359857000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/domain/Direction.java=1491362416000
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/command/RobotCommand.java=1491383770000
configuration*?=D4253C640606282CC41CCBFE1BA2D21B121751B2
/Users/junv/code/RobotSimulator/src/main/java/au/com/seek/parser/InputParser.java=1491385972000
+113
View File
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: build-pipeline-checkstyle
Description: none
-->
<module name="Checker">
<property name="severity" value="error"/>
<module name="TreeWalker">
<property name="cacheFile" value="checkstyle-cachefile"/>
<property name="tabWidth" value="4"/>
<module name="ConstantName"/>
<module name="EmptyBlock"/>
<module name="EmptyForIteratorPad"/>
<module name="EqualsHashCode"/>
<module name="IllegalImport"/>
<module name="IllegalInstantiation"/>
<module name="IllegalThrows"/>
<module name="InnerAssignment"/>
<module name="LeftCurly">
<property name="tokens" value="CLASS_DEF,INTERFACE_DEF,METHOD_DEF,CTOR_DEF"/>
</module>
<module name="LeftCurly">
<property name="tokens"
value="LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE"/>
</module>
<module name="OuterTypeNumber"/>
<module name="LineLength">
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
<property name="max" value="140"/>
</module>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodLength"/>
<module name="MethodName"/>
<module name="MethodParamPad"/>
<module name="ModifierOrder"/>
<module name="NeedBraces"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="NoWhitespaceBefore">
<property name="allowLineBreaks" value="true"/>
<property name="tokens" value="DOT"/>
</module>
<module name="OperatorWrap"/>
<module name="OperatorWrap">
<property name="option" value="eol"/>
<property name="tokens"
value="ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN"/>
</module>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="ParameterNumber">
<property name="id" value="paramNum"/>
<property name="max" value="8"/>
</module>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="RightCurly"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="UnusedImports"/>
<module name="UpperEll"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="GenericWhitespace"/>
<module name="FinalClass"/>
<module name="MissingSwitchDefault"/>
<!-- removed since it does not play well with eclipse
<module name="Indentation">
<property name="caseIndent" value="0"/>
</module>
-->
<module name="EqualsAvoidNull"/>
<!--<module name="CyclomaticComplexity">-->
<!--<property name="severity" value="warning"/>-->
<!--</module>-->
<module name="NestedIfDepth">
<property name="max" value="3"/>
</module>
<module name="NestedTryDepth"/>
<module name="ExplicitInitialization"/>
<module name="AnnotationUseStyle"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride">
<property name="javaFiveCompatibility" value="true"/>
</module>
<module name="PackageAnnotation"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${basedir}/checkstyle_suppressions.xml"/>
</module>
<module name="Translation">
<property name="severity" value="warning"/>
</module>
<module name="FileTabCharacter"/>
<module name="FileLength"/>
</module>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!--
Turn off all checks for Generated and Test code. Fixes issues with using
Eclipse plug-in.
-->
<suppress checks="." files=".*[\\/]src[\\/]test[\\/]"/>
<suppress checks="." files=".*[\\/]checkstyle[\\/]gui[\\/]"/>
</suppressions>
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
#Wed Apr 05 09:18:07 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Vendored Executable
+164
View File
@@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## 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
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Vendored
+90
View File
@@ -0,0 +1,90 @@
@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
if "%@eval[2+2]" == "4" goto 4NT_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=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
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
+2
View File
@@ -0,0 +1,2 @@
rootProject.name = 'RobotSimulator'
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -0,0 +1,18 @@
package au.com.seek;
import au.com.seek.executor.Executor;
import au.com.seek.parser.InputParser;
import java.io.IOException;
public class RobotSimulator {
private static final String INPUT_FILE = "input.txt";
public static void main(String[] args) throws IOException {
new RobotSimulator().run(new InputParser(INPUT_FILE));
}
private void run(InputParser parser) {
new Executor(parser.getRobot()).execute(parser.parseCommands());
}
}
@@ -0,0 +1,11 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
public class MoveForwardCommand implements RobotCommand {
@Override
public void execute(Robot robot) {
robot.moveForward();
}
}
@@ -0,0 +1,11 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
public class ReportCommand implements RobotCommand {
@Override
public void execute(Robot robot) {
System.out.println(robot.report());
}
}
@@ -0,0 +1,8 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
public interface RobotCommand {
void execute(Robot robot);
}
@@ -0,0 +1,11 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
public class TurnLeftCommand implements RobotCommand {
@Override
public void execute(Robot robot) {
robot.turnLeft();
}
}
@@ -0,0 +1,11 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
public class TurnRightCommand implements RobotCommand {
@Override
public void execute(Robot robot) {
robot.turnRight();
}
}
@@ -0,0 +1,28 @@
package au.com.seek.domain;
public class Coordinate {
private int xAxis;
private int yAxis;
public Coordinate(int xAxis, int yAxis) {
this.xAxis = xAxis;
this.yAxis = yAxis;
}
int getXAxis() {
return xAxis;
}
void setXAxis(int xAxis) {
this.xAxis = xAxis;
}
int getYAxis() {
return yAxis;
}
void setYAxis(int yAxis) {
this.yAxis = yAxis;
}
}
@@ -0,0 +1,100 @@
package au.com.seek.domain;
public enum Direction {
NORTH {
@Override
public Direction turnRight() {
return EAST;
}
@Override
public Direction turnLeft() {
return WEST;
}
@Override
public int stepValueOnXAxis() {
return 0;
}
@Override
public int stepValueOnYAxis() {
return STEP_VALUE;
}
},
EAST {
@Override
public Direction turnRight() {
return SOUTH;
}
@Override
public Direction turnLeft() {
return NORTH;
}
@Override
public int stepValueOnXAxis() {
return STEP_VALUE;
}
@Override
public int stepValueOnYAxis() {
return 0;
}
},
SOUTH {
@Override
public Direction turnRight() {
return WEST;
}
@Override
public Direction turnLeft() {
return EAST;
}
@Override
public int stepValueOnXAxis() {
return 0;
}
@Override
public int stepValueOnYAxis() {
return NEGATIVE_STEP_VALUE;
}
},
WEST {
@Override
public Direction turnRight() {
return NORTH;
}
@Override
public Direction turnLeft() {
return SOUTH;
}
@Override
public int stepValueOnXAxis() {
return NEGATIVE_STEP_VALUE;
}
@Override
public int stepValueOnYAxis() {
return 0;
}
};
private static final int NEGATIVE_STEP_VALUE = -1;
private static final int STEP_VALUE = 1;
public abstract Direction turnRight();
public abstract Direction turnLeft();
public abstract int stepValueOnXAxis();
public abstract int stepValueOnYAxis();
}
@@ -0,0 +1,54 @@
package au.com.seek.domain;
public class Robot {
private Coordinate coordinate;
private Direction direction;
public Robot(Coordinate coordinate, Direction direction) {
this.coordinate = coordinate;
this.direction = direction;
}
public String report() {
return String.format("%s,%s,%s", getCoordinate().getXAxis(),
getCoordinate().getYAxis(), getDirection().toString());
}
public void turnLeft() {
this.direction = getDirection().turnLeft();
}
public void turnRight() {
this.direction = getDirection().turnRight();
}
public void moveForward() {
if (isGoingToFallingWhenMove()) {
return;
}
getCoordinate().setXAxis(moveOnXAxis());
getCoordinate().setYAxis(moveOnYAxis());
}
private int moveOnYAxis() {
return getCoordinate().getYAxis() + getDirection().stepValueOnYAxis();
}
private int moveOnXAxis() {
return getCoordinate().getXAxis() + getDirection().stepValueOnXAxis();
}
private boolean isGoingToFallingWhenMove() {
return Tabletop.isCoordinateOutOfTabletop(new Coordinate(moveOnXAxis(), moveOnYAxis()));
}
private Coordinate getCoordinate() {
return this.coordinate;
}
private Direction getDirection() {
return this.direction;
}
}
@@ -0,0 +1,11 @@
package au.com.seek.domain;
public class Tabletop {
public static final int X_AXIS_MAXIMUM = 5;
public static final int Y_AXIS_MAXIMUM = 5;
public static boolean isCoordinateOutOfTabletop(Coordinate coordinate) {
return (coordinate.getXAxis() > X_AXIS_MAXIMUM) || (coordinate.getYAxis() > Y_AXIS_MAXIMUM);
}
}
@@ -0,0 +1,20 @@
package au.com.seek.executor;
import au.com.seek.command.RobotCommand;
import au.com.seek.domain.Robot;
import java.util.List;
public class Executor {
private final Robot robot;
public Executor(Robot robot) {
this.robot = robot;
}
public void execute(List<RobotCommand> commands) {
commands.forEach(command -> command.execute(robot));
}
}
@@ -0,0 +1,82 @@
package au.com.seek.parser;
import au.com.seek.command.*;
import au.com.seek.domain.Coordinate;
import au.com.seek.domain.Direction;
import au.com.seek.domain.Robot;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import static java.lang.Integer.valueOf;
public class InputParser {
private static final int BUFFER_SIZE = 1024;
private static final String PLACE_COMMAND = "PLACE";
private static final String SEPARATOR = ",";
private static final String LEFT = "LEFT";
private static final String RIGHT = "RIGHT";
private static final String MOVE = "MOVE";
private static final int BLANK_LENGTH = 1;
private static final String REPORT = "REPORT";
private static final Map<String, RobotCommand> COMMAND_STRING_MAP =
ImmutableMap.of(LEFT, new TurnLeftCommand(),
RIGHT, new TurnRightCommand(),
MOVE, new MoveForwardCommand(),
REPORT, new ReportCommand());
private String file;
private List<RobotCommand> commands = Lists.newArrayList();
private Robot robot;
public InputParser(String file) throws IOException {
this.file = file;
parse();
}
public List<RobotCommand> parseCommands() {
return commands;
}
public Robot getRobot() {
return robot;
}
private void parse() throws IOException {
InputStream in = getClass().getClassLoader().getResourceAsStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(in), BUFFER_SIZE);
String line;
while ((line = reader.readLine()) != null) {
if (line.startsWith(PLACE_COMMAND)) {
parseRobot(line);
continue;
}
if (robot == null) {
continue;
}
commands.add(getCommand(line));
}
}
private RobotCommand getCommand(String line) {
return COMMAND_STRING_MAP.get(line);
}
private void parseRobot(String line) {
String robotString = line.substring(PLACE_COMMAND.length() + BLANK_LENGTH);
String[] split = robotString.split(SEPARATOR);
robot = new Robot(new Coordinate(valueOf(split[0]), valueOf(split[1])), Direction.valueOf(split[2]));
//reset all the commands
commands = Lists.newArrayList();
}
}
+6
View File
@@ -0,0 +1,6 @@
PLACE 1,2,EAST
MOVE
MOVE
LEFT
MOVE
REPORT
BIN
View File
Binary file not shown.
@@ -0,0 +1,32 @@
package au.com.seek;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
public class RobotSimulatorTest {
private final ByteArrayOutputStream outputContent = new ByteArrayOutputStream();
@Before
public void setUpStreams() {
System.setOut(new PrintStream(outputContent));
}
@After
public void cleanUpStreams() {
System.setOut(null);
}
@Test
public void should_run_commands_and_print_result_when_use_simple_input_file() throws Exception {
RobotSimulator.main(new String[]{});
assertThat(outputContent.toString(), containsString("3,3,NORTH"));
}
}
@@ -0,0 +1,24 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
import au.com.seek.domain.Coordinate;
import au.com.seek.domain.Direction;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class MoveForwardCommandTest {
@Test
public void should_update_place_after_execute() throws Exception {
Coordinate coordinate = new Coordinate(0, 0);
Robot robot = new Robot(coordinate, Direction.NORTH);
assertThat(robot.report(), equalTo("0,0,NORTH"));
MoveForwardCommand command = new MoveForwardCommand();
command.execute(robot);
assertThat(robot.report(), equalTo("0,1,NORTH"));
}
}
@@ -0,0 +1,39 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
import au.com.seek.domain.Coordinate;
import au.com.seek.domain.Direction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
public class ReportCommandTest {
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@Before
public void setUpStreams() {
System.setOut(new PrintStream(outContent));
}
@After
public void cleanUpStreams() {
System.setOut(null);
}
@Test
public void should_print_location_after_execute() throws Exception {
Coordinate coordinate = new Coordinate(0, 0);
Robot robot = new Robot(coordinate, Direction.NORTH);
ReportCommand command = new ReportCommand();
command.execute(robot);
assertThat(outContent.toString(), containsString("0,0,NORTH"));
}
}
@@ -0,0 +1,25 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
import au.com.seek.domain.Coordinate;
import au.com.seek.domain.Direction;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class TurnLeftCommandTest {
@Test
public void should_update_place_after_execute() throws Exception {
Coordinate coordinate = new Coordinate(0, 0);
Robot robot = new Robot(coordinate, Direction.NORTH);
assertThat(robot.report(), equalTo("0,0,NORTH"));
TurnLeftCommand command = new TurnLeftCommand();
command.execute(robot);
assertThat(robot.report(), equalTo("0,0,WEST"));
}
}
@@ -0,0 +1,24 @@
package au.com.seek.command;
import au.com.seek.domain.Robot;
import au.com.seek.domain.Coordinate;
import au.com.seek.domain.Direction;
import org.junit.Test;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
public class TurnRightCommandTest {
@Test
public void should_update_place_after_execute() throws Exception {
Coordinate coordinate = new Coordinate(0, 0);
Robot robot = new Robot(coordinate, Direction.NORTH);
assertThat(robot.report(), equalTo("0,0,NORTH"));
TurnRightCommand command = new TurnRightCommand();
command.execute(robot);
assertThat(robot.report(), equalTo("0,0,EAST"));
}
}
@@ -0,0 +1,84 @@
package au.com.seek.domain;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class DirectionTest {
@Test
public void should_return_new_direction_when_do_turn_left() throws Exception {
assertThat(Direction.NORTH.turnLeft(), is(Direction.WEST));
assertThat(Direction.WEST.turnLeft(), is(Direction.SOUTH));
assertThat(Direction.SOUTH.turnLeft(), is(Direction.EAST));
assertThat(Direction.EAST.turnLeft(), is(Direction.NORTH));
}
@Test
public void should_return_new_direction_when_do_turn_right() throws Exception {
assertThat(Direction.NORTH.turnRight(), is(Direction.EAST));
assertThat(Direction.EAST.turnRight(), is(Direction.SOUTH));
assertThat(Direction.SOUTH.turnRight(), is(Direction.WEST));
assertThat(Direction.WEST.turnRight(), is(Direction.NORTH));
}
@Test
public void should_return_step_value_on_x_axis() throws Exception {
assertThat(Direction.NORTH.stepValueOnXAxis(), is(0));
assertThat(Direction.EAST.stepValueOnXAxis(), is(1));
assertThat(Direction.SOUTH.stepValueOnXAxis(), is(0));
assertThat(Direction.WEST.stepValueOnXAxis(), is(-1));
}
@Test
public void should_return_step_value_on_y_axis() throws Exception {
assertThat(Direction.NORTH.stepValueOnYAxis(), is(1));
assertThat(Direction.EAST.stepValueOnYAxis(), is(0));
assertThat(Direction.SOUTH.stepValueOnYAxis(), is(-1));
assertThat(Direction.WEST.stepValueOnYAxis(), is(0));
}
@Test
public void should_return_direction_string_as_enum() throws Exception {
assertThat(Direction.NORTH.toString(), equalTo("NORTH"));
assertThat(Direction.WEST.toString(), equalTo("WEST"));
assertThat(Direction.SOUTH.toString(), equalTo("SOUTH"));
assertThat(Direction.EAST.toString(), equalTo("EAST"));
}
@Test
public void should_return_all_the_values_of_direction() throws Exception {
Direction[] directions = {Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST};
assertThat(Direction.values(), equalTo(directions));
}
@Test
public void test_value_of() throws Exception {
Direction east = Direction.valueOf("EAST");
assertThat(east, is(Direction.EAST));
}
}
@@ -0,0 +1,83 @@
package au.com.seek.domain;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class RobotTest {
@Test
public void should_report_robot_location() throws Exception {
Coordinate coordinate = new Coordinate(0, 0);
Robot robot = new Robot(coordinate, Direction.EAST);
String report = robot.report();
assertThat(report, equalTo("0,0,EAST"));
}
@Test
public void should_report_robot_location_when_x_and_y_axis_is_not_zero() throws Exception {
Coordinate coordinate = new Coordinate(3, 5);
Robot robot = new Robot(coordinate, Direction.SOUTH);
String report = robot.report();
assertThat(report, equalTo("3,5,SOUTH"));
}
@Test
public void should_change_direction_when_do_turn_left() throws Exception {
Coordinate coordinate = new Coordinate(3, 3);
Robot robot = new Robot(coordinate, Direction.NORTH);
robot.turnLeft();
assertThat(robot.report(), equalTo("3,3,WEST"));
}
@Test
public void should_change_direction_when_do_turn_right() throws Exception {
Coordinate coordinate = new Coordinate(0, 1);
Robot robot = new Robot(coordinate, Direction.NORTH);
robot.turnRight();
assertThat(robot.report(), equalTo("0,1,EAST"));
}
@Test
public void should_change_coordinates_when_do_move_and_facing_north() throws Exception {
Coordinate coordinate = new Coordinate(0, 1);
Robot robot = new Robot(coordinate, Direction.NORTH);
robot.moveForward();
assertThat(robot.report(), equalTo("0,2,NORTH"));
}
@Test
public void should_change_coordinates_when_do_move_and_facing_east() throws Exception {
Coordinate coordinate = new Coordinate(0, 1);
Robot robot = new Robot(coordinate, Direction.EAST);
robot.moveForward();
assertThat(robot.report(), equalTo("1,1,EAST"));
}
@Test
public void should_remain_same_coordinates_if_robot_is_going_to_falling_in_x_axis() throws Exception {
Coordinate coordinate = new Coordinate(5, 0);
Robot robot = new Robot(coordinate, Direction.EAST);
robot.moveForward();
assertThat(robot.report(), equalTo("5,0,EAST"));
}
@Test
public void should_remain_same_coordinates_if_robot_is_going_to_falling_in_y_axis() throws Exception {
Coordinate coordinate = new Coordinate(0, 5);
Robot robot = new Robot(coordinate, Direction.NORTH);
robot.moveForward();
assertThat(robot.report(), equalTo("0,5,NORTH"));
}
}
@@ -0,0 +1,33 @@
package au.com.seek.domain;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class TabletopTest {
@Test
public void just_for_coverage() throws Exception {
Tabletop tabletop = new Tabletop();
assertThat(tabletop == null, is(false));
}
@Test
public void should_return_true_if_coordinate_are_too_large() throws Exception {
Coordinate coordinate = new Coordinate(6, 5);
assertThat(Tabletop.isCoordinateOutOfTabletop(coordinate), is(true));
}
@Test
public void should_return_false_if_coordinate_is_on_the_border_tabletop() throws Exception {
Coordinate coordinate = new Coordinate(5, 5);
assertThat(Tabletop.isCoordinateOutOfTabletop(coordinate), is(false));
}
@Test
public void should_return_false_if_coordinate_is_within_tabletop() throws Exception {
Coordinate coordinate = new Coordinate(3, 1);
assertThat(Tabletop.isCoordinateOutOfTabletop(coordinate), is(false));
}
}
@@ -0,0 +1,57 @@
package au.com.seek.parser;
import au.com.seek.domain.Robot;
import au.com.seek.command.RobotCommand;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class InputParserTest {
@Test
public void should_return_commands_and_robot() throws Exception {
InputParser parser = new InputParser("simple_input.txt");
Robot robot = parser.getRobot();
List<RobotCommand> commands = parser.parseCommands();
assertThat(robot.report(), equalTo("0,0,NORTH"));
assertThat(commands.size(),is(3));
assertThat(commands.get(0).getClass().getSimpleName(), equalTo("MoveForwardCommand"));
assertThat(commands.get(1).getClass().getSimpleName(), equalTo("TurnRightCommand"));
assertThat(commands.get(2).getClass().getSimpleName(), equalTo("ReportCommand"));
}
@Test
public void should_skip_the_commands_before_place_robot() throws Exception {
InputParser parser = new InputParser("has_invalid_inputs.txt");
Robot robot = parser.getRobot();
List<RobotCommand> commands = parser.parseCommands();
assertThat(robot.report(), equalTo("2,4,EAST"));
assertThat(commands.size(),is(3));
assertThat(commands.get(0).getClass().getSimpleName(), equalTo("TurnLeftCommand"));
assertThat(commands.get(1).getClass().getSimpleName(), equalTo("MoveForwardCommand"));
assertThat(commands.get(2).getClass().getSimpleName(), equalTo("ReportCommand"));
}
@Test
public void should_replace_the_robot_when_there_is_another_place_command() throws Exception {
InputParser parser = new InputParser("double_place_commands.txt");
Robot robot = parser.getRobot();
List<RobotCommand> commands = parser.parseCommands();
assertThat(robot.report(), equalTo("3,3,EAST"));
assertThat(commands.size(),is(4));
assertThat(commands.get(0).getClass().getSimpleName(), equalTo("MoveForwardCommand"));
assertThat(commands.get(1).getClass().getSimpleName(), equalTo("TurnRightCommand"));
assertThat(commands.get(2).getClass().getSimpleName(), equalTo("MoveForwardCommand"));
assertThat(commands.get(3).getClass().getSimpleName(), equalTo("ReportCommand"));
}
// @Test
// public void should_throw_exception_if_file_is_not_found() throws Exception {
// InputParser parser = new InputParser("empty.txt");
// }
}
@@ -0,0 +1,7 @@
PLACE 0,0,NORTH
MOVE
PLACE 3,3,EAST
MOVE
RIGHT
MOVE
REPORT
View File
@@ -0,0 +1,6 @@
RIGHT
MOVE
PLACE 2,4,EAST
LEFT
MOVE
REPORT
+4
View File
@@ -0,0 +1,4 @@
PLACE 0,0,NORTH
MOVE
RIGHT
REPORT