Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs2-19wi
lab01
Commits
f270b61c
Commit
f270b61c
authored
6 years ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
fixes spacing issues in student-facing files
parent
2e03ea70
master
No related merge requests found
Pipeline
#3089
failed with stage
in 0 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.idea/encodings.xml
+4
-0
.idea/encodings.xml
.idea/misc.xml
+1
-1
.idea/misc.xml
.idea/workspace.xml
+55
-124
.idea/workspace.xml
src/edu/caltech/cs2/lab01/Main.java
+49
-47
src/edu/caltech/cs2/lab01/Main.java
src/edu/caltech/cs2/lab01/WikipediaPage.java
+42
-42
src/edu/caltech/cs2/lab01/WikipediaPage.java
src/edu/caltech/cs2/lab01/libraries/Wikipedia.java
+74
-74
src/edu/caltech/cs2/lab01/libraries/Wikipedia.java
with
225 additions
and
288 deletions
+225
-288
.idea/encodings.xml
0 → 100644
View file @
f270b61c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
addBOMForNewFiles=
"with NO BOM"
/>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.idea/misc.xml
View file @
f270b61c
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_11"
default=
"true"
project-jdk-name=
"11"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_11"
default=
"true"
project-jdk-name=
"11
.0.1
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
<output
url=
"file://$PROJECT_DIR$/out"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.idea/workspace.xml
View file @
f270b61c
...
@@ -2,8 +2,12 @@
...
@@ -2,8 +2,12 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"9d8f49d5-a7a8-40cd-89b4-170587b4708e"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"9d8f49d5-a7a8-40cd-89b4-170587b4708e"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/.idea/encodings.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/misc.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/misc.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
afterDir=
"false"
/>
</list>
</list>
<ignored
path=
"$PROJECT_DIR$/out/"
/>
<ignored
path=
"$PROJECT_DIR$/out/"
/>
<ignored
path=
"$PROJECT_DIR$/.gradle/"
/>
<ignored
path=
"$PROJECT_DIR$/.gradle/"
/>
...
@@ -41,83 +45,13 @@
...
@@ -41,83 +45,13 @@
<expand
/>
<expand
/>
<select
/>
<select
/>
</component>
</component>
<component
name=
"FUSProjectUsageTrigger"
>
<session
id=
"666900165"
>
<usages-collector
id=
"statistics.lifecycle.project"
>
<counts>
<entry
key=
"project.closed"
value=
"6"
/>
<entry
key=
"project.open.time.1"
value=
"1"
/>
<entry
key=
"project.open.time.2"
value=
"4"
/>
<entry
key=
"project.open.time.20"
value=
"1"
/>
<entry
key=
"project.open.time.21"
value=
"1"
/>
<entry
key=
"project.open.time.25"
value=
"1"
/>
<entry
key=
"project.opened"
value=
"8"
/>
</counts>
</usages-collector>
<usages-collector
id=
"statistics.file.extensions.open"
>
<counts>
<entry
key=
"Aquarius 2"
value=
"1"
/>
<entry
key=
"canis major dwarf galaxy"
value=
"1"
/>
<entry
key=
"class"
value=
"4"
/>
<entry
key=
"iml"
value=
"4"
/>
<entry
key=
"java"
value=
"52"
/>
<entry
key=
"kim 2"
value=
"1"
/>
<entry
key=
"leo v (dwarf galaxy)"
value=
"1"
/>
<entry
key=
"parsec"
value=
"1"
/>
<entry
key=
"txt"
value=
"20"
/>
<entry
key=
"xml"
value=
"3"
/>
<entry
key=
"yml"
value=
"4"
/>
</counts>
</usages-collector>
<usages-collector
id=
"statistics.file.types.open"
>
<counts>
<entry
key=
"CLASS"
value=
"4"
/>
<entry
key=
"IDEA_MODULE"
value=
"4"
/>
<entry
key=
"JAVA"
value=
"52"
/>
<entry
key=
"PLAIN_TEXT"
value=
"25"
/>
<entry
key=
"XML"
value=
"3"
/>
<entry
key=
"YAML"
value=
"4"
/>
</counts>
</usages-collector>
<usages-collector
id=
"statistics.file.extensions.edit"
>
<counts>
<entry
key=
"dummy"
value=
"45"
/>
<entry
key=
"java"
value=
"23381"
/>
<entry
key=
"txt"
value=
"535"
/>
<entry
key=
"xml"
value=
"3"
/>
<entry
key=
"yml"
value=
"150"
/>
</counts>
</usages-collector>
<usages-collector
id=
"statistics.file.types.edit"
>
<counts>
<entry
key=
"JAVA"
value=
"23381"
/>
<entry
key=
"PLAIN_TEXT"
value=
"580"
/>
<entry
key=
"XML"
value=
"3"
/>
<entry
key=
"YAML"
value=
"150"
/>
</counts>
</usages-collector>
</session>
</component>
<component
name=
"FileEditorManager"
>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"358"
>
<state
relative-caret-position=
"645"
>
<caret
line=
"47"
column=
"1"
selection-start-line=
"47"
selection-start-column=
"1"
selection-end-line=
"47"
selection-end-column=
"1"
/>
<caret
line=
"45"
column=
"1"
selection-start-line=
"45"
selection-start-column=
"1"
selection-end-line=
"45"
selection-end-column=
"1"
/>
<folding>
<element
signature=
"e#598#599#0"
expanded=
"true"
/>
<element
signature=
"e#625#626#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"630"
>
<caret
line=
"42"
column=
"39"
selection-start-line=
"42"
selection-start-column=
"39"
selection-end-line=
"42"
selection-end-column=
"39"
/>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
@@ -191,12 +125,12 @@
...
@@ -191,12 +125,12 @@
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
/>
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
/>
<option
value=
"$PROJECT_DIR$/.gitlab-ci.yml"
/>
<option
value=
"$PROJECT_DIR$/.gitlab-ci.yml"
/>
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/helpers/CaptureSystemOutput.java"
/>
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/helpers/CaptureSystemOutput.java"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
/>
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTests.java"
/>
<option
value=
"$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTests.java"
/>
<option
value=
"$PROJECT_DIR$/tests/data/links_for_rsa.txt"
/>
<option
value=
"$PROJECT_DIR$/tests/data/links_for_rsa.txt"
/>
<option
value=
"$PROJECT_DIR$/tests/data/links_for_pizza_farm.txt"
/>
<option
value=
"$PROJECT_DIR$/tests/data/links_for_pizza_farm.txt"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
/>
<option
value=
"$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
/>
</list>
</list>
</option>
</option>
</component>
</component>
...
@@ -238,16 +172,24 @@
...
@@ -238,16 +172,24 @@
<foldersAlwaysOnTop
value=
"true"
/>
<foldersAlwaysOnTop
value=
"true"
/>
</navigator>
</navigator>
<panes>
<panes>
<pane
id=
"PackagesPane"
/>
<pane
id=
"ProjectPane"
>
<pane
id=
"ProjectPane"
>
<subPane>
<subPane>
<expand>
<expand>
<path>
<path>
<item
name=
"lab01-wikipedia"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"lab01"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"lab01-wikipedia"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"lab01"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"lab01"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"lab01"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"src"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
<path>
<path>
<item
name=
"lab01-wikipedia"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"lab01"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"External Libraries"
type=
"cb654da1:ExternalLibrariesNode"
/>
<item
name=
"lab01"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"src"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"lab01"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
</path>
</expand>
</expand>
<select
/>
<select
/>
...
@@ -255,7 +197,6 @@
...
@@ -255,7 +197,6 @@
</pane>
</pane>
<pane
id=
"Scope"
/>
<pane
id=
"Scope"
/>
<pane
id=
"Course"
/>
<pane
id=
"Course"
/>
<pane
id=
"PackagesPane"
/>
</panes>
</panes>
</component>
</component>
<component
name=
"PropertiesComponent"
>
<component
name=
"PropertiesComponent"
>
...
@@ -371,8 +312,8 @@
...
@@ -371,8 +312,8 @@
</configuration>
</configuration>
<list>
<list>
<item
itemvalue=
"Application.Main"
/>
<item
itemvalue=
"Application.Main"
/>
<item
itemvalue=
"JUnit.Minimum Tests"
/>
<item
itemvalue=
"JUnit.Goal Tests"
/>
<item
itemvalue=
"JUnit.Goal Tests"
/>
<item
itemvalue=
"JUnit.Minimum Tests"
/>
<item
itemvalue=
"JUnit.Stretch Goal Tests"
/>
<item
itemvalue=
"JUnit.Stretch Goal Tests"
/>
</list>
</list>
</component>
</component>
...
@@ -558,7 +499,7 @@
...
@@ -558,7 +499,7 @@
<frame
x=
"38"
y=
"35"
width=
"1402"
height=
"834"
extended-state=
"0"
/>
<frame
x=
"38"
y=
"35"
width=
"1402"
height=
"834"
extended-state=
"0"
/>
<editor
active=
"true"
/>
<editor
active=
"true"
/>
<layout>
<layout>
<window_info
active=
"true"
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.27
57353
"
/>
<window_info
active=
"true"
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.27
941176
"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"Image Layers"
order=
"2"
/>
<window_info
id=
"Image Layers"
order=
"2"
/>
<window_info
id=
"Designer"
order=
"3"
/>
<window_info
id=
"Designer"
order=
"3"
/>
...
@@ -581,6 +522,7 @@
...
@@ -581,6 +522,7 @@
<window_info
anchor=
"bottom"
id=
"Log Viewer"
order=
"13"
/>
<window_info
anchor=
"bottom"
id=
"Log Viewer"
order=
"13"
/>
<window_info
anchor=
"bottom"
id=
"Anonymous Apex"
order=
"14"
/>
<window_info
anchor=
"bottom"
id=
"Anonymous Apex"
order=
"14"
/>
<window_info
anchor=
"bottom"
id=
"SOQL Query"
order=
"15"
/>
<window_info
anchor=
"bottom"
id=
"SOQL Query"
order=
"15"
/>
<window_info
anchor=
"right"
id=
"Maven"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
<window_info
anchor=
"right"
id=
"Ant Build"
order=
"1"
weight=
"0.25"
/>
<window_info
anchor=
"right"
id=
"Ant Build"
order=
"1"
weight=
"0.25"
/>
<window_info
anchor=
"right"
content_ui=
"combo"
id=
"Hierarchy"
order=
"2"
weight=
"0.25"
/>
<window_info
anchor=
"right"
content_ui=
"combo"
id=
"Hierarchy"
order=
"2"
weight=
"0.25"
/>
...
@@ -631,9 +573,20 @@
...
@@ -631,9 +573,20 @@
</entry>
</entry>
</map>
</map>
</option>
</option>
</component>
<option
name=
"RECENT_FILTERS"
>
<component
name=
"VcsContentAnnotationSettings"
>
<map>
<option
name=
"myLimit"
value=
"2678400000"
/>
<entry
key=
"Branch"
>
<value>
<list
/>
</value>
</entry>
<entry
key=
"User"
>
<value>
<list
/>
</value>
</entry>
</map>
</option>
</component>
</component>
<component
name=
"VcsManagerConfiguration"
>
<component
name=
"VcsManagerConfiguration"
>
<option
name=
"SHOW_DIRTY_RECURSIVELY"
value=
"true"
/>
<option
name=
"SHOW_DIRTY_RECURSIVELY"
value=
"true"
/>
...
@@ -658,13 +611,7 @@
...
@@ -658,13 +611,7 @@
<component
name=
"editorHistoryManager"
>
<component
name=
"editorHistoryManager"
>
<entry
file=
"file://$PROJECT_DIR$/src/src.iml"
/>
<entry
file=
"file://$PROJECT_DIR$/src/src.iml"
/>
<entry
file=
"file://$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTest.java"
/>
<entry
file=
"file://$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTest.java"
/>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/lang/reflect/Method.java"
>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/lang/reflect/Method.java"
/>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"-24"
>
<caret
line=
"551"
column=
"18"
selection-start-line=
"551"
selection-start-column=
"18"
selection-end-line=
"551"
selection-end-column=
"24"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaFunction.java"
/>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaFunction.java"
/>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaMarkup.java"
/>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaMarkup.java"
/>
<entry
file=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.0-SNAPSHOT/junit-jupiter-api-5.4.0-SNAPSHOT.jar!/org/junit/jupiter/api/extension/Extensions.class"
>
<entry
file=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.0-SNAPSHOT/junit-jupiter-api-5.4.0-SNAPSHOT.jar!/org/junit/jupiter/api/extension/Extensions.class"
>
...
@@ -688,13 +635,7 @@
...
@@ -688,13 +635,7 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/util/stream/IntStream.java"
>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/util/stream/IntStream.java"
/>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"156"
>
<caret
line=
"1040"
column=
"28"
selection-start-line=
"1040"
selection-start-column=
"28"
selection-end-line=
"1040"
selection-end-column=
"28"
/>
</state>
</provider>
</entry>
<entry
file=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.0-SNAPSHOT/junit-jupiter-params-5.4.0-SNAPSHOT.jar!/org/junit/jupiter/params/provider/Arguments.class"
>
<entry
file=
"jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.0-SNAPSHOT/junit-jupiter-params-5.4.0-SNAPSHOT.jar!/org/junit/jupiter/params/provider/Arguments.class"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"296"
>
<state
relative-caret-position=
"296"
>
...
@@ -737,13 +678,7 @@
...
@@ -737,13 +678,7 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/lang/String.java"
>
<entry
file=
"jar:///Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/lib/src.zip!/java.base/java/lang/String.java"
/>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"156"
>
<caret
line=
"2022"
column=
"19"
selection-start-line=
"2022"
selection-start-column=
"19"
selection-end-line=
"2022"
selection-end-column=
"19"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/tests/SanityTests.java"
/>
<entry
file=
"file://$PROJECT_DIR$/tests/SanityTests.java"
/>
<entry
file=
"file://$PROJECT_DIR$/.idea/modules.xml"
>
<entry
file=
"file://$PROJECT_DIR$/.idea/modules.xml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
...
@@ -791,20 +726,6 @@
...
@@ -791,20 +726,6 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"225"
>
<caret
line=
"22"
column=
"42"
selection-start-line=
"22"
selection-start-column=
"42"
selection-end-line=
"22"
selection-end-column=
"42"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"630"
>
<caret
line=
"42"
column=
"39"
selection-start-line=
"42"
selection-start-column=
"39"
selection-end-line=
"42"
selection-end-column=
"39"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTests.java"
>
<entry
file=
"file://$PROJECT_DIR$/tests/edu/caltech/cs2/lab01/WikipediaPageTests.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"354"
>
<state
relative-caret-position=
"354"
>
...
@@ -829,14 +750,24 @@
...
@@ -829,14 +750,24 @@
</state>
</state>
</provider>
</provider>
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/Main.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"585"
>
<caret
line=
"39"
column=
"15"
selection-start-line=
"39"
selection-start-column=
"15"
selection-end-line=
"39"
selection-end-column=
"15"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/libraries/Wikipedia.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"240"
>
<caret
line=
"23"
column=
"52"
lean-forward=
"true"
selection-start-line=
"23"
selection-start-column=
"52"
selection-end-line=
"23"
selection-end-column=
"52"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
>
<entry
file=
"file://$PROJECT_DIR$/src/edu/caltech/cs2/lab01/WikipediaPage.java"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"358"
>
<state
relative-caret-position=
"645"
>
<caret
line=
"47"
column=
"1"
selection-start-line=
"47"
selection-start-column=
"1"
selection-end-line=
"47"
selection-end-column=
"1"
/>
<caret
line=
"45"
column=
"1"
selection-start-line=
"45"
selection-start-column=
"1"
selection-end-line=
"45"
selection-end-column=
"1"
/>
<folding>
<element
signature=
"e#598#599#0"
expanded=
"true"
/>
<element
signature=
"e#625#626#0"
expanded=
"true"
/>
</folding>
</state>
</state>
</provider>
</provider>
</entry>
</entry>
...
...
This diff is collapsed.
Click to expand it.
src/edu/caltech/cs2/lab01/Main.java
View file @
f270b61c
...
@@ -3,60 +3,62 @@ package edu.caltech.cs2.lab01;
...
@@ -3,60 +3,62 @@ package edu.caltech.cs2.lab01;
import
edu.caltech.cs2.lab01.libraries.Wikipedia
;
import
edu.caltech.cs2.lab01.libraries.Wikipedia
;
public
class
Main
{
public
class
Main
{
private
static
String
cleanLink
(
String
link
)
{
private
static
String
cleanLink
(
String
link
)
{
link
=
link
.
substring
(
2
,
link
.
length
()
-
2
);
link
=
link
.
substring
(
2
,
link
.
length
()
-
2
);
if
(
link
.
contains
(
"|"
))
{
if
(
link
.
contains
(
"|"
))
{
link
=
link
.
substring
(
link
.
indexOf
(
"|"
)
+
1
);
link
=
link
.
substring
(
link
.
indexOf
(
"|"
)
+
1
);
}
return
link
;
}
}
return
link
;
}
private
static
String
cleanLinks
(
String
text
)
{
private
static
String
cleanLinks
(
String
text
)
{
text
=
text
.
replace
(
"light-year"
,
"ly"
).
replace
(
"]]s"
,
"]]"
);
text
=
text
.
replace
(
"light-year"
,
"ly"
).
replace
(
"]]s"
,
"]]"
);
String
result
=
""
;
String
result
=
""
;
while
(
text
.
contains
(
"]]"
))
{
while
(
text
.
contains
(
"]]"
))
{
int
start
=
text
.
indexOf
(
"[["
);
int
start
=
text
.
indexOf
(
"[["
);
int
end
=
text
.
indexOf
(
"]]"
,
start
)
+
2
;
int
end
=
text
.
indexOf
(
"]]"
,
start
)
+
2
;
result
+=
text
.
substring
(
0
,
start
);
result
+=
text
.
substring
(
0
,
start
);
result
+=
cleanLink
(
text
.
substring
(
start
,
end
));
result
+=
cleanLink
(
text
.
substring
(
start
,
end
));
text
=
text
.
substring
(
end
);
text
=
text
.
substring
(
end
);
}
return
result
+
text
;
}
}
return
result
+
text
;
}
private
static
String
getDistance
(
WikipediaPage
galaxy
)
{
private
static
String
getDistance
(
WikipediaPage
galaxy
)
{
for
(
String
line
:
galaxy
.
getText
().
split
(
"\n\\|"
,
-
1
))
{
for
(
String
line
:
galaxy
.
getText
().
split
(
"\n\\|"
,
-
1
))
{
String
tline
=
line
.
trim
();
String
tline
=
line
.
trim
();
if
(
tline
.
contains
(
"dist_ly"
))
{
if
(
tline
.
contains
(
"dist_ly"
))
{
int
angle
=
tline
.
indexOf
(
"<"
);
int
angle
=
tline
.
indexOf
(
"<"
);
int
paren
=
tline
.
indexOf
(
"("
);
int
paren
=
tline
.
indexOf
(
"("
);
int
end
;
int
end
;
if
(
angle
==
-
1
&&
paren
==
-
1
)
{
if
(
angle
==
-
1
&&
paren
==
-
1
)
{
end
=
tline
.
length
();
end
=
tline
.
length
();
}
else
if
(
angle
==
-
1
||
paren
==
-
1
)
{
}
end
=
Math
.
max
(
angle
,
paren
);
else
if
(
angle
==
-
1
||
paren
==
-
1
)
{
}
else
{
end
=
Math
.
max
(
angle
,
paren
);
end
=
Math
.
min
(
angle
,
paren
);
}
}
else
{
String
x
=
cleanLinks
(
tline
.
substring
(
tline
.
indexOf
(
"="
)
+
1
,
end
).
trim
());
end
=
Math
.
min
(
angle
,
paren
);
}
String
x
=
cleanLinks
(
tline
.
substring
(
tline
.
indexOf
(
"="
)
+
1
,
end
).
trim
());
return
Wikipedia
.
parseMarkup
(
x
);
return
Wikipedia
.
parseMarkup
(
x
);
}
}
}
return
null
;
}
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
WikipediaPage
list_of_galaxies
=
new
WikipediaPage
(
args
[
0
]);
WikipediaPage
list_of_galaxies
=
new
WikipediaPage
(
args
[
0
]);
while
(
list_of_galaxies
.
hasNextLink
())
{
while
(
list_of_galaxies
.
hasNextLink
())
{
String
link
=
list_of_galaxies
.
nextLink
();
String
link
=
list_of_galaxies
.
nextLink
();
WikipediaPage
galaxy
=
new
WikipediaPage
(
link
);
WikipediaPage
galaxy
=
new
WikipediaPage
(
link
);
if
(
galaxy
.
isValid
()
&&
galaxy
.
isGalaxy
())
{
if
(
galaxy
.
isValid
()
&&
galaxy
.
isGalaxy
())
{
String
dist
=
getDistance
(
galaxy
);
String
dist
=
getDistance
(
galaxy
);
if
(
dist
!=
null
)
{
if
(
dist
!=
null
)
{
System
.
out
.
println
(
galaxy
.
getTitle
()
+
" = "
+
dist
);
System
.
out
.
println
(
galaxy
.
getTitle
()
+
" = "
+
dist
);
}
}
}
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
src/edu/caltech/cs2/lab01/WikipediaPage.java
View file @
f270b61c
package
edu.caltech.cs2.lab01
;
package
edu.caltech.cs2.lab01
;
public
class
WikipediaPage
{
public
class
WikipediaPage
{
public
WikipediaPage
(
String
title
,
boolean
followRedirects
)
{
public
WikipediaPage
(
String
title
,
boolean
followRedirects
)
{
// Fill me in!
// Fill me in!
}
}
public
WikipediaPage
(
String
title
)
{
public
WikipediaPage
(
String
title
)
{
this
(
title
,
true
);
this
(
title
,
true
);
}
}
public
String
getTitle
()
{
public
String
getTitle
()
{
// Fill me in!
// Fill me in!
return
null
;
return
null
;
}
}
public
String
getText
()
{
public
String
getText
()
{
// Fill me in!
// Fill me in!
return
null
;
return
null
;
}
}
public
boolean
isRedirect
()
{
public
boolean
isRedirect
()
{
// Fill me in!
// Fill me in!
return
false
;
return
false
;
}
}
public
boolean
isValid
()
{
public
boolean
isValid
()
{
// Fill me in!
// Fill me in!
return
false
;
return
false
;
}
}
public
boolean
isGalaxy
()
{
public
boolean
isGalaxy
()
{
// Fill me in!
// Fill me in!
return
false
;
return
false
;
}
}
public
boolean
hasNextLink
()
{
public
boolean
hasNextLink
()
{
// Fill me in!
// Fill me in!
return
false
;
return
false
;
}
}
public
String
nextLink
()
{
public
String
nextLink
()
{
// Fill me in!
// Fill me in!
return
null
;
return
null
;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/edu/caltech/cs2/lab01/libraries/Wikipedia.java
View file @
f270b61c
...
@@ -10,88 +10,88 @@ import java.util.stream.Collectors;
...
@@ -10,88 +10,88 @@ import java.util.stream.Collectors;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
public
class
Wikipedia
{
public
class
Wikipedia
{
private
static
String
SITE
=
"en.wikipedia.org"
;
private
static
String
SITE
=
"en.wikipedia.org"
;
public
static
String
getPageText
(
String
title
)
{
public
static
String
getPageText
(
String
title
)
{
try
{
try
{
URLConnection
u
=
new
URL
(
URLConnection
u
=
new
URL
(
"https://"
+
SITE
+
"/w/api.php?action=parse&page="
+
title
.
replace
(
" "
,
"_"
)
+
"&prop=wikitext&format=xml"
"https://"
+
SITE
+
"/w/api.php?action=parse&page="
+
title
.
replace
(
" "
,
"_"
)
+
"&prop=wikitext&format=xml"
).
openConnection
();
).
openConnection
();
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
u
.
getInputStream
(),
StandardCharsets
.
UTF_8
));
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
u
.
getInputStream
(),
StandardCharsets
.
UTF_8
));
String
xmlPage
=
in
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
String
xmlPage
=
in
.
lines
().
collect
(
Collectors
.
joining
(
"\n"
));
int
wikitext
=
xmlPage
.
indexOf
(
"<wikitext"
);
int
wikitext
=
xmlPage
.
indexOf
(
"<wikitext"
);
int
pageStart
=
xmlPage
.
indexOf
(
">"
,
wikitext
);
int
pageStart
=
xmlPage
.
indexOf
(
">"
,
wikitext
);
int
pageEnd
=
xmlPage
.
lastIndexOf
(
"</wikitext"
);
int
pageEnd
=
xmlPage
.
lastIndexOf
(
"</wikitext"
);
if
(
pageStart
==
-
1
||
pageEnd
==
-
1
)
{
if
(
pageStart
==
-
1
||
pageEnd
==
-
1
)
{
return
null
;
return
null
;
}
}
return
decode
(
xmlPage
.
substring
(
pageStart
+
1
,
pageEnd
));
return
decode
(
xmlPage
.
substring
(
pageStart
+
1
,
pageEnd
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
null
;
return
null
;
}
}
}
}
private
static
String
decode
(
String
in
)
{
private
static
String
decode
(
String
in
)
{
in
=
in
.
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
);
// html tags
in
=
in
.
replace
(
"<"
,
"<"
).
replace
(
">"
,
">"
);
// html tags
in
=
in
.
replace
(
"""
,
"\""
);
in
=
in
.
replace
(
"""
,
"\""
);
in
=
in
.
replace
(
"'"
,
"'"
);
in
=
in
.
replace
(
"'"
,
"'"
);
in
=
in
.
replace
(
"&"
,
"&"
);
in
=
in
.
replace
(
"&"
,
"&"
);
in
=
in
.
replace
(
" "
,
" "
);
in
=
in
.
replace
(
" "
,
" "
);
return
in
;
return
in
;
}
public
static
String
parseMarkup
(
String
markup
)
{
if
(
markup
==
null
)
{
return
null
;
}
}
markup
=
markup
.
replaceFirst
(
"\\{\\{nowrap\\|$"
,
""
).
strip
();
public
static
String
parseMarkup
(
String
markup
)
{
if
(
markup
==
null
)
{
return
null
;
}
if
(
markup
.
contains
(
"{{±"
))
{
markup
=
markup
.
replaceFirst
(
"\\{\\{nowrap\\|$"
,
""
).
strip
();
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"{{"
))
+
" ± "
+
markup
.
substring
(
markup
.
indexOf
(
"|"
)
+
1
,
markup
.
indexOf
(
"|"
,
markup
.
indexOf
(
"|"
)
+
1
))
+
markup
.
substring
(
markup
.
indexOf
(
"}}"
)
+
2
);
}
if
(
markup
.
contains
(
"[["
))
{
if
(
markup
.
contains
(
"{{±"
))
{
markup
+=
"]]"
;
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"{{"
))
+
markup
=
markup
.
substring
(
markup
.
indexOf
(
"[["
),
markup
.
indexOf
(
"]]"
)
+
2
);
" ± "
+
}
else
if
(
markup
.
contains
(
"{{"
))
{
markup
.
substring
(
markup
.
indexOf
(
"|"
)
+
1
,
markup
.
indexOf
(
"|"
,
markup
.
indexOf
(
"|"
)
+
1
))
+
markup
+=
"}}"
;
markup
.
substring
(
markup
.
indexOf
(
"}}"
)
+
2
);
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{"
),
markup
.
indexOf
(
"}}"
)
+
2
);
}
}
if
(
markup
.
startsWith
(
"{{"
)
&&
markup
.
endsWith
(
"}}"
))
{
if
(
markup
.
contains
(
"[["
))
{
if
(
markup
.
startsWith
(
"{{val"
))
{
markup
+=
"]]"
;
markup
=
markup
.
substring
(
6
,
markup
.
indexOf
(
"|"
,
6
))
+
" "
+
markup
.
substring
(
markup
.
lastIndexOf
(
"="
)
+
1
,
markup
.
length
()
-
2
);
markup
=
markup
.
substring
(
markup
.
indexOf
(
"[["
),
markup
.
indexOf
(
"]]"
)
+
2
);
}
}
else
if
(
markup
.
contains
(
"{{"
))
{
else
if
(
markup
.
contains
(
"{{convert"
))
{
markup
+=
"}}"
;
int
dividerIndex
=
markup
.
lastIndexOf
(
"|"
,
markup
.
lastIndexOf
(
"|"
,
markup
.
indexOf
(
"="
))
-
1
);
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{"
),
markup
.
indexOf
(
"}}"
)
+
2
);
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{convert"
)
+
10
,
dividerIndex
).
replace
(
"|"
,
" "
);
}
}
else
if
(
markup
.
contains
(
"{{cvt"
))
{
if
(
markup
.
startsWith
(
"{{"
)
&&
markup
.
endsWith
(
"}}"
))
{
int
dividerIndex
=
markup
.
lastIndexOf
(
"|"
,
markup
.
lastIndexOf
(
"|"
,
markup
.
indexOf
(
"="
))
-
1
);
if
(
markup
.
startsWith
(
"{{val"
))
{
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{cvt"
)
+
6
,
dividerIndex
).
replace
(
"|"
,
" "
);
markup
=
markup
.
substring
(
6
,
markup
.
indexOf
(
"|"
,
6
))
+
" "
+
markup
.
substring
(
markup
.
lastIndexOf
(
"="
)
+
1
,
markup
.
length
()
-
2
);
}
else
if
(
markup
.
contains
(
"{{nowrap"
))
{
}
markup
=
markup
.
substring
(
markup
.
lastIndexOf
(
"|"
)
+
1
,
markup
.
lastIndexOf
(
"}}"
));
else
if
(
markup
.
contains
(
"{{convert"
))
{
}
else
if
(
markup
.
contains
(
"{{"
)){
int
dividerIndex
=
markup
.
lastIndexOf
(
"|"
,
markup
.
lastIndexOf
(
"|"
,
markup
.
indexOf
(
"="
))
-
1
);
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"{{"
));
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{convert"
)
+
10
,
dividerIndex
).
replace
(
"|"
,
" "
);
}
}
}
else
if
(
markup
.
contains
(
"{{cvt"
))
{
else
if
(
markup
.
startsWith
(
"[["
)
&&
markup
.
endsWith
(
"]]"
)){
int
dividerIndex
=
markup
.
lastIndexOf
(
"|"
,
markup
.
lastIndexOf
(
"|"
,
markup
.
indexOf
(
"="
))
-
1
);
markup
=
markup
.
substring
(
2
,
markup
.
length
()
-
2
);
markup
=
markup
.
substring
(
markup
.
indexOf
(
"{{cvt"
)
+
6
,
dividerIndex
).
replace
(
"|"
,
" "
);
if
(
markup
.
contains
(
"|"
))
{
}
else
if
(
markup
.
contains
(
"{{nowrap"
))
{
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"|"
));
markup
=
markup
.
substring
(
markup
.
lastIndexOf
(
"|"
)
+
1
,
markup
.
lastIndexOf
(
"}}"
));
}
}
else
if
(
markup
.
contains
(
"{{"
)){
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"{{"
));
}
}
else
if
(
markup
.
startsWith
(
"[["
)
&&
markup
.
endsWith
(
"]]"
)){
markup
=
markup
.
substring
(
2
,
markup
.
length
()
-
2
);
if
(
markup
.
contains
(
"|"
))
{
markup
=
markup
.
substring
(
0
,
markup
.
indexOf
(
"|"
));
}
}
return
markup
;
}
}
return
markup
;
}
public
static
boolean
isSpecialLink
(
String
link
)
{
public
static
boolean
isSpecialLink
(
String
link
)
{
return
link
!=
null
&&
Stream
.
of
(
"Image:"
,
"File:"
,
":File:"
,
"Category:"
,
"Wiktionary:"
,
"wikt:"
,
"#"
,
"s:"
).
anyMatch
(
return
link
!=
null
&&
Stream
.
of
(
"Image:"
,
"File:"
,
":File:"
,
"Category:"
,
"Wiktionary:"
,
"wikt:"
,
"#"
,
"s:"
).
anyMatch
(
(
x
)
->
link
.
strip
().
startsWith
(
x
)
(
x
)
->
link
.
strip
().
startsWith
(
x
)
);
);
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help