#37 Completed lab

Otwarty
Xcuello chce scalić 2 commity/ów z Xcuello/JavaStringCheese:master do master

+ 9
- 0
.idea/JavaStringCheese.iml Wyświetl plik

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$" />
6
+    <orderEntry type="inheritedJdk" />
7
+    <orderEntry type="sourceFolder" forTests="false" />
8
+  </component>
9
+</module>

+ 6
- 0
.idea/misc.xml Wyświetl plik

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="JavaScriptSettings">
4
+    <option name="languageLevel" value="ES6" />
5
+  </component>
6
+</project>

+ 8
- 0
.idea/modules.xml Wyświetl plik

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/JavaStringCheese.iml" filepath="$PROJECT_DIR$/.idea/JavaStringCheese.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 6
- 0
.idea/vcs.xml Wyświetl plik

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="" vcs="Git" />
5
+  </component>
6
+</project>

+ 196
- 0
.idea/workspace.xml Wyświetl plik

@@ -0,0 +1,196 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="62956067-07f0-4013-b5ec-a36752b14a56" name="Default Changelist" comment="">
5
+      <change beforePath="$PROJECT_DIR$/StringParser.java" beforeDir="false" afterPath="$PROJECT_DIR$/StringParser.java" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/package.bluej" beforeDir="false" afterPath="$PROJECT_DIR$/package.bluej" afterDir="false" />
7
+    </list>
8
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9
+    <option name="SHOW_DIALOG" value="false" />
10
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
11
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12
+    <option name="LAST_RESOLUTION" value="IGNORE" />
13
+  </component>
14
+  <component name="FUSProjectUsageTrigger">
15
+    <session id="-1622128631">
16
+      <usages-collector id="statistics.lifecycle.project">
17
+        <counts>
18
+          <entry key="project.closed" value="13" />
19
+          <entry key="project.open.time.0" value="8" />
20
+          <entry key="project.open.time.1" value="4" />
21
+          <entry key="project.open.time.7" value="1" />
22
+          <entry key="project.opened" value="13" />
23
+        </counts>
24
+      </usages-collector>
25
+      <usages-collector id="statistics.file.extensions.open">
26
+        <counts>
27
+          <entry key="java" value="1" />
28
+        </counts>
29
+      </usages-collector>
30
+      <usages-collector id="statistics.file.types.open">
31
+        <counts>
32
+          <entry key="JAVA" value="1" />
33
+        </counts>
34
+      </usages-collector>
35
+      <usages-collector id="statistics.file.extensions.edit">
36
+        <counts>
37
+          <entry key="java" value="6" />
38
+        </counts>
39
+      </usages-collector>
40
+      <usages-collector id="statistics.file.types.edit">
41
+        <counts>
42
+          <entry key="JAVA" value="6" />
43
+        </counts>
44
+      </usages-collector>
45
+    </session>
46
+  </component>
47
+  <component name="FileEditorManager">
48
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
49
+      <file pinned="false" current-in-tab="true">
50
+        <entry file="file://$PROJECT_DIR$/StringParser.java">
51
+          <provider selected="true" editor-type-id="text-editor">
52
+            <state relative-caret-position="-548">
53
+              <caret line="55" column="20" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
54
+            </state>
55
+          </provider>
56
+        </entry>
57
+      </file>
58
+    </leaf>
59
+  </component>
60
+  <component name="Git.Settings">
61
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
62
+  </component>
63
+  <component name="IdeDocumentHistory">
64
+    <option name="CHANGED_PATHS">
65
+      <list>
66
+        <option value="$PROJECT_DIR$/StringParser.java" />
67
+      </list>
68
+    </option>
69
+  </component>
70
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
71
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
72
+  <component name="JsGulpfileManager">
73
+    <detection-done>true</detection-done>
74
+    <sorting>DEFINITION_ORDER</sorting>
75
+  </component>
76
+  <component name="ProjectFrameBounds" extendedState="6">
77
+    <option name="y" value="23" />
78
+    <option name="width" value="1280" />
79
+    <option name="height" value="701" />
80
+  </component>
81
+  <component name="ProjectView">
82
+    <navigator proportions="" version="1">
83
+      <foldersAlwaysOnTop value="true" />
84
+    </navigator>
85
+    <panes>
86
+      <pane id="ProjectPane">
87
+        <subPane>
88
+          <expand>
89
+            <path>
90
+              <item name="JavaStringCheese" type="b2602c69:ProjectViewProjectNode" />
91
+              <item name="JavaStringCheese" type="462c0819:PsiDirectoryNode" />
92
+            </path>
93
+          </expand>
94
+          <select />
95
+        </subPane>
96
+      </pane>
97
+      <pane id="PackagesPane" />
98
+      <pane id="Scope" />
99
+    </panes>
100
+  </component>
101
+  <component name="PropertiesComponent">
102
+    <property name="WebServerToolWindowFactoryState" value="false" />
103
+    <property name="aspect.path.notification.shown" value="true" />
104
+    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
105
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
106
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
107
+  </component>
108
+  <component name="RunDashboard">
109
+    <option name="ruleStates">
110
+      <list>
111
+        <RuleState>
112
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
113
+        </RuleState>
114
+        <RuleState>
115
+          <option name="name" value="StatusDashboardGroupingRule" />
116
+        </RuleState>
117
+      </list>
118
+    </option>
119
+  </component>
120
+  <component name="SvnConfiguration">
121
+    <configuration />
122
+  </component>
123
+  <component name="TaskManager">
124
+    <task active="true" id="Default" summary="Default task">
125
+      <changelist id="62956067-07f0-4013-b5ec-a36752b14a56" name="Default Changelist" comment="" />
126
+      <created>1543515782350</created>
127
+      <option name="number" value="Default" />
128
+      <option name="presentableId" value="Default" />
129
+      <updated>1543515782350</updated>
130
+      <workItem from="1543515783797" duration="196000" />
131
+      <workItem from="1543520289002" duration="18000" />
132
+      <workItem from="1543524945494" duration="21000" />
133
+      <workItem from="1543525061754" duration="1000" />
134
+      <workItem from="1543623377419" duration="46000" />
135
+      <workItem from="1543623846897" duration="3000" />
136
+      <workItem from="1543965182872" duration="18000" />
137
+      <workItem from="1544110458234" duration="7000" />
138
+      <workItem from="1544133368618" duration="16000" />
139
+      <workItem from="1544133906957" duration="15000" />
140
+      <workItem from="1544455658165" duration="16000" />
141
+      <workItem from="1544455741665" duration="12000" />
142
+      <workItem from="1546640933433" duration="16000" />
143
+    </task>
144
+    <servers />
145
+  </component>
146
+  <component name="TimeTrackingManager">
147
+    <option name="totallyTimeSpent" value="385000" />
148
+  </component>
149
+  <component name="ToolWindowManager">
150
+    <frame x="0" y="23" width="1280" height="698" extended-state="6" />
151
+    <layout>
152
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.30048466" />
153
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
154
+      <window_info id="Image Layers" order="2" />
155
+      <window_info id="Designer" order="3" />
156
+      <window_info id="UI Designer" order="4" />
157
+      <window_info id="Capture Tool" order="5" />
158
+      <window_info id="Favorites" order="6" side_tool="true" />
159
+      <window_info anchor="bottom" id="Message" order="0" />
160
+      <window_info anchor="bottom" id="Find" order="1" />
161
+      <window_info anchor="bottom" id="Run" order="2" />
162
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
163
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
164
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
165
+      <window_info anchor="bottom" id="TODO" order="6" />
166
+      <window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
167
+      <window_info anchor="bottom" id="Terminal" order="8" />
168
+      <window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
169
+      <window_info anchor="bottom" id="Version Control" order="10" />
170
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
171
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
172
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
173
+      <window_info anchor="right" id="Palette" order="3" />
174
+      <window_info anchor="right" id="Capture Analysis" order="4" />
175
+      <window_info anchor="right" id="Theme Preview" order="5" />
176
+      <window_info anchor="right" id="Palette&#9;" order="6" />
177
+      <window_info anchor="right" id="Database" order="7" />
178
+      <window_info anchor="right" id="Maven Projects" order="8" />
179
+    </layout>
180
+  </component>
181
+  <component name="TypeScriptGeneratedFilesManager">
182
+    <option name="version" value="1" />
183
+  </component>
184
+  <component name="VcsContentAnnotationSettings">
185
+    <option name="myLimit" value="2678400000" />
186
+  </component>
187
+  <component name="editorHistoryManager">
188
+    <entry file="file://$PROJECT_DIR$/StringParser.java">
189
+      <provider selected="true" editor-type-id="text-editor">
190
+        <state relative-caret-position="-548">
191
+          <caret line="55" column="20" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
192
+        </state>
193
+      </provider>
194
+    </entry>
195
+  </component>
196
+</project>

BIN
StringParser.class Wyświetl plik


+ 1
- 1
StringParser.ctxt Wyświetl plik

@@ -24,7 +24,7 @@ comment6.target=java.lang.String\ camelCaseString(java.lang.String)
24 24
 comment6.text=\n\ Takes\ a\ String\ and\ returns\ that\ string\ with\ the\ first\ character\ of\ each\ word\ in\ it\ uppercased\n\ and\ then\ joined.\n\ E.G.\ dog\ whistle\ would\ return\ DogWhistle.\ adjuNCT\ pRoFessOR\ would\ return\ AdjuctProfessor.\n\n\ @param\ s\n\ @return\ String\n
25 25
 comment7.params=s
26 26
 comment7.target=java.lang.String\ snakeCaseString(java.lang.String)
27
-comment7.text=\n\ Takes\ a\ String\ and\ returns\ that\ string\ with\ each\ character\ lowercased\n\ and\ then\ joined\ with\ an\ underscore\n\ E.G.\ dog\ whistle\ would\ return\ dog_whistle.\ adjuNCT\ pRoFessOR\ would\ return\ adjuct_professor.\n\n\ @param\ s\n\ @return\ String\n
27
+comment7.text=\n\ Takes\ a\ String\ and\ returns\ that\ string\ with\ each\ character\ lowercased\n\ and\ then\ joined\ with\ an\ underscore\n\ E.G.\ "dog\ whistle"\ would\ return\ dog_whistle.\ adjuNCT\ pRoFessOR\ would\ return\ adjuct_professor.\n\n\ @param\ s\n\ @return\ String\n
28 28
 comment8.params=s
29 29
 comment8.target=java.lang.Integer\ getLength(java.lang.String)
30 30
 comment8.text=\n\ Takes\ a\ String\ and\ returns\ the\ length\ of\ that\ string\n\ E.G.\ cat\ would\ return\ 3.\ extra\ would\ return\ 5.\n\n\ @param\ s\n\ @return\ String\n

+ 33
- 11
StringParser.java Wyświetl plik

@@ -15,7 +15,8 @@ public class StringParser
15 15
      */
16 16
     public static String upperCaseString(String s)
17 17
     {
18
-        return null;
18
+
19
+        return s.toUpperCase();
19 20
     }
20 21
 
21 22
     /**
@@ -26,7 +27,8 @@ public class StringParser
26 27
      * @return String
27 28
      */
28 29
     public static String lowerCaseString(String s) {
29
-        return null;
30
+
31
+        return s.toLowerCase();
30 32
     }
31 33
 
32 34
     /**
@@ -37,7 +39,8 @@ public class StringParser
37 39
      * @return String
38 40
      */
39 41
     public static Character getFirstCharacter(String s) {
40
-        return null;
42
+
43
+        return s.charAt(0);
41 44
     }
42 45
 
43 46
     /**
@@ -49,7 +52,8 @@ public class StringParser
49 52
      * @return String
50 53
      */
51 54
     public static Character getNthCharacter(String s, Integer n) {
52
-        return null;
55
+
56
+        return s.charAt(n);
53 57
     }
54 58
 
55 59
     /**
@@ -60,7 +64,8 @@ public class StringParser
60 64
      * @return String
61 65
      */
62 66
     public static String upperCaseFirstCharacter(String s) {
63
-        return null;
67
+
68
+        return s = Character.toUpperCase(s.charAt(0)) + s.substring(1);
64 69
     }
65 70
 
66 71
     /**
@@ -72,19 +77,33 @@ public class StringParser
72 77
      * @return String
73 78
      */
74 79
     public static String camelCaseString(String s) {
75
-        return null;
80
+
81
+        String camalCase2 = "";
82
+
83
+        String camalCase3 = s.toLowerCase();
84
+
85
+        String[] camalCase = camalCase3.split(" ");
86
+
87
+        for(int i = 0; i < camalCase.length; i++){
88
+
89
+            camalCase2 += camalCase[i].substring(0,1).toUpperCase();
90
+
91
+            camalCase2 += camalCase[i].substring(1);
92
+        }
93
+        return camalCase2;
76 94
     }
77 95
 
78 96
     /**
79 97
      * Takes a String and returns that string with each character lowercased
80 98
      * and then joined with an underscore
81
-     * E.G. dog whistle would return dog_whistle. adjuNCT pRoFessOR would return adjuct_professor.
99
+     * E.G. "dog whistle" would return dog_whistle. adjuNCT pRoFessOR would return adjuct_professor.
82 100
      *
83 101
      * @param s
84 102
      * @return String
85 103
      */
86 104
     public static String snakeCaseString(String s) {
87
-        return null;
105
+
106
+        return s.replace(" ","_").toLowerCase();
88 107
     }
89 108
 
90 109
     /**
@@ -95,7 +114,8 @@ public class StringParser
95 114
      * @return String
96 115
      */
97 116
     public static Integer getLength(String s) {
98
-        return null;
117
+
118
+        return s.length();
99 119
     }
100 120
 
101 121
     /**
@@ -109,7 +129,8 @@ public class StringParser
109 129
      * @return String
110 130
      */
111 131
     public static Boolean isEqual(String s1, String s2) {
112
-        return null;
132
+
133
+        return  s1.equals(s2);
113 134
     }
114 135
 
115 136
     /**
@@ -123,6 +144,7 @@ public class StringParser
123 144
      * @return String
124 145
      */
125 146
     public static Boolean isEqualIgnoreCase(String s1, String s2) {
126
-        return null;
147
+
148
+        return s1.equalsIgnoreCase(s2);
127 149
     }
128 150
 }

BIN
StringParserTest.class Wyświetl plik


+ 1
- 1
StringParserTest.java Wyświetl plik

@@ -72,7 +72,7 @@ public class StringParserTest {
72 72
     @Test
73 73
     public void camelCaseString() {
74 74
         //Given
75
-        String string1 = "tEsT sTrInG";
75
+        String string1 = "test sTrInG";
76 76
         String expected = "TestString";
77 77
 
78 78
         //When

+ 4
- 4
package.bluej Wyświetl plik

@@ -2,10 +2,10 @@
2 2
 dependency1.from=StringParserTest
3 3
 dependency1.to=StringParser
4 4
 dependency1.type=UsesDependency
5
-editor.fx.0.height=722
6
-editor.fx.0.width=800
7
-editor.fx.0.x=455
8
-editor.fx.0.y=51
5
+editor.fx.0.height=0
6
+editor.fx.0.width=0
7
+editor.fx.0.x=0
8
+editor.fx.0.y=0
9 9
 objectbench.height=164
10 10
 objectbench.width=776
11 11
 package.divider.horizontal=0.6