Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ali
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tie
ohj2
esimerkit
ali
Commits
6a72aa72
Commit
6a72aa72
authored
2 years ago
by
Vesa Lappalainen
Browse files
Options
Downloads
Patches
Plain Diff
turhat testit pois, s1 vertailut rauhoittamaan kääntäjää
parent
729d7688
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/fi/jyu/mit/ohj2/Suuntaaja.java
+0
-1
0 additions, 1 deletion
src/fi/jyu/mit/ohj2/Suuntaaja.java
src/fi/jyu/mit/ohj2/VertaaTiedosto.java
+7
-9
7 additions, 9 deletions
src/fi/jyu/mit/ohj2/VertaaTiedosto.java
with
7 additions
and
10 deletions
src/fi/jyu/mit/ohj2/Suuntaaja.java
+
0
−
1
View file @
6a72aa72
...
...
@@ -390,7 +390,6 @@ public class Suuntaaja {
* Palauttaa alkuperäisen tietovirran
* @return alkuperäinen tietovirta
*/
@SuppressWarnings
(
"static-method"
)
public
PrintStream
getOrigOut
()
{
return
origOut
;
}
...
...
This diff is collapsed.
Click to expand it.
src/fi/jyu/mit/ohj2/VertaaTiedosto.java
+
7
−
9
View file @
6a72aa72
...
...
@@ -65,7 +65,7 @@ public class VertaaTiedosto {
*
* </pre>
*/
@SuppressWarnings
({
"resource"
,
"null"
})
// finally hoitaa sulkemisen, s1 ei ole null s1.compare-lauseessa
@SuppressWarnings
({
"resource"
})
// finally hoitaa sulkemisen, s1 ei ole null s1.compare-lauseessa
public
static
String
vertaaFileFile
(
String
nimi1
,
String
nimi2
)
throws
IOException
{
BufferedReader
f1
=
null
;
BufferedReader
f2
=
null
;
...
...
@@ -82,7 +82,7 @@ public class VertaaTiedosto {
if
(
s1
==
null
&&
s2
==
null
)
return
null
;
if
(
s1
!=
null
&&
s2
==
null
)
return
"Rivi "
+
n
+
": "
+
nimi2
+
" loppui ensin, "
+
nimi1
+
" on "
+
s1
;
if
(
s1
==
null
&&
s2
!=
null
)
return
"Rivi "
+
n
+
": "
+
nimi1
+
" loppui ensin, "
+
nimi2
+
" on "
+
s2
;
if
(
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
if
(
s1
!=
null
&&
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
n
++;
}
}
finally
{
...
...
@@ -126,11 +126,10 @@ public class VertaaTiedosto {
*
* </pre>
*/
@SuppressWarnings
({
"null"
,
"resource"
})
// finally sulkee, s1 ei ole null s1.compare-lauseessa
@SuppressWarnings
({
"resource"
})
// finally sulkee, s1 ei ole null s1.compare-lauseessa
public
static
String
vertaaFileString
(
String
nimi1
,
String
ss2
)
throws
IOException
{
if
(
ss2
==
null
)
return
"Jono on null"
;
BufferedReader
f1
=
null
;
@SuppressWarnings
(
"resource"
)
Scanner
f2
=
new
Scanner
(
ss2
);
int
n
=
1
;
try
{
...
...
@@ -145,7 +144,7 @@ public class VertaaTiedosto {
if
(
s1
==
null
&&
!
b2
)
return
null
;
if
(
s1
!=
null
&&
!
b2
)
return
"Rivi "
+
n
+
": "
+
"Jono loppui ensin, "
+
nimi1
+
" on "
+
s1
;
if
(
s1
==
null
&&
b2
)
return
"Rivi "
+
n
+
": "
+
nimi1
+
" loppui ensin, "
+
"jono on "
+
s2
;
if
(
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
if
(
s1
!=
null
&&
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
n
++;
}
}
finally
{
...
...
@@ -178,7 +177,7 @@ public class VertaaTiedosto {
* vertaaString2(" ",null) === "2. on null";
* </pre>
*/
@SuppressWarnings
({
"null"
,
"resource"
})
@SuppressWarnings
({
"resource"
})
public
static
String
vertaaString2
(
String
ss1
,
String
ss2
)
{
if
(
ss1
==
null
&
ss2
==
null
)
return
null
;
if
(
ss1
==
null
)
return
"1. on null"
;
...
...
@@ -197,7 +196,7 @@ public class VertaaTiedosto {
if
(!
b1
&&
!
b2
)
return
null
;
if
(
b1
&&
!
b2
)
return
"Rivi "
+
n
+
": "
+
"2. loppui ensin, 1. on "
+
s1
;
if
(!
b1
&&
b2
)
return
"Rivi "
+
n
+
": "
+
"1. loppui ensin, 2. on "
+
s2
;
if
(
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
if
(
s1
!=
null
&&
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
n
++;
}
}
finally
{
...
...
@@ -231,7 +230,6 @@ public class VertaaTiedosto {
* vertaaString(" ",null) === "2. on null";
* </pre>
*/
@SuppressWarnings
(
"null"
)
public
static
String
vertaaString
(
String
ss1
,
String
ss2
)
{
String
st1
=
ss1
;
String
st2
=
ss2
;
...
...
@@ -256,7 +254,7 @@ public class VertaaTiedosto {
if
(!
b1
&&
!
b2
)
return
null
;
if
(
b1
&&
!
b2
)
return
"Rivi "
+
n
+
": "
+
"2. loppui ensin, 1. on "
+
s1
;
if
(!
b1
&&
b2
)
return
"Rivi "
+
n
+
": "
+
"1. loppui ensin, 2. on "
+
s2
;
if
(
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
if
(
s1
!=
null
&&
s1
.
compareTo
(
s2
)
!=
0
)
return
"Ero riveissä "
+
n
+
": "
+
s1
+
" ja "
+
s2
;
n
++;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment