Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohj2
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
vvlaspa
ohj2
Commits
22e822be
Commit
22e822be
authored
2 weeks ago
by
Läspä Vili Valtteri
Browse files
Options
Downloads
Patches
Plain Diff
puntti tallentaminen ja lukeminen
parent
ecb2e6b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
puntti/src/puntti/Puntti.java
+37
-4
37 additions, 4 deletions
puntti/src/puntti/Puntti.java
with
37 additions
and
4 deletions
puntti/src/puntti/Puntti.java
+
37
−
4
View file @
22e822be
...
...
@@ -3,6 +3,7 @@
*/
package
puntti
;
import
java.io.File
;
import
java.util.List
;
/**
...
...
@@ -27,6 +28,8 @@ public class Puntti {
private
Liikkeet
liikkeet
=
new
Liikkeet
();
private
Tulokset
tulokset
=
new
Tulokset
();
private
String
hakemisto
=
"batman"
;
/**
* Palautaa punti nliikkeiden määrän
...
...
@@ -124,12 +127,42 @@ public class Puntti {
/**
* tallentaa kerhon tiedot tiedostoon
* @param nimi käyttäjän hakemiston nimi
* Lukee käyttäjän tiedot tiedostoista
* @param nimi käyttäjä nimi
* @throws SailoException jos tiedoston lukeminen ei onnistu
*/
public
void
lueTiedostosta
(
String
nimi
)
throws
SailoException
{
File
hake
=
new
File
(
nimi
);
hake
.
mkdir
();
liikkeet
=
new
Liikkeet
();
tulokset
=
new
Tulokset
();
hakemisto
=
nimi
;
liikkeet
.
lueTiedostosta
(
nimi
);
tulokset
.
lueTiedostosta
(
nimi
);
}
/**
* tallentaa käyttäjän tiedot tiedostoon
* @throws SailoException jos tallennus ei onnistu
*/
public
void
tallenna
(
String
nimi
)
throws
SailoException
{
liikkeet
.
tallenna
(
nimi
);
public
void
tallenna
()
throws
SailoException
{
String
virhe
=
""
;
try
{
liikkeet
.
tallenna
(
hakemisto
);
}
catch
(
SailoException
ex
)
{
virhe
=
ex
.
getMessage
();
}
try
{
tulokset
.
tallenna
(
hakemisto
);
}
catch
(
SailoException
ex
)
{
virhe
+=
ex
.
getMessage
();
}
if
(
!
""
.
equals
(
virhe
)
)
throw
new
SailoException
(
virhe
);
}
...
...
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