Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mappevurderingprog2
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
Tam Minh Le
mappevurderingprog2
Merge requests
!50
Added FileController
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Added FileController
FileController
into
dev
Overview
0
Commits
1
Pipelines
0
Changes
13
Merged
Edvard Granheim Harbo
requested to merge
FileController
into
dev
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
13
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
b15e7a88
1 commit,
1 year ago
13 files
+
110
−
78
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
13
Search (e.g. *.vue) (Ctrl+P)
src/main/java/edu/ntnu/idatt2003/mappevurderingprog2/controllers/FileController.java
0 → 100644
+
53
−
0
Options
package
edu.ntnu.idatt2003.mappevurderingprog2.controllers
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGame
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGameDescription
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGameFileHandler
;
import
java.util.List
;
/**
* The FileController class is a controller class that handles the logic for reading and writing
* ChaosGame transformations to and from files.
*/
public
class
FileController
{
/**
* Reads ChaosGame transformations from a file.
*
* @param name the name of the file to read from
* @throws Exception if an error occurs during reading
*/
public
void
saveFractalToFile
(
String
name
)
throws
Exception
{
ChaosGameFileHandler
.
writeTransformationsToFile
(
ChaosGame
.
getInstance
().
getDescription
(),
name
);
}
/**
* Reads ChaosGame transformations from a file.
*
* @param name the name of the file to read from
* @throws Exception if an error occurs during reading
*/
public
void
readFractalFromFile
(
String
name
)
throws
Exception
{
ChaosGameDescription
description
=
ChaosGameFileHandler
.
readTransformationsFromFile
(
name
);
ChaosGame
.
getInstance
().
setDescription
(
description
);
}
/**
* Checks if a file with the specified name exists.
*
* @param name the name of the file to check
* @return true if the file exists, false otherwise
*/
public
boolean
doesFileExist
(
String
name
)
{
return
ChaosGameFileHandler
.
checkFileExists
(
name
);
}
/**
* Lists all transformation file names.
*
* @return a list of transformation file names
*/
public
List
<
String
>
listTransformationFileNames
()
{
return
ChaosGameFileHandler
.
listTransformationFileNames
();
}
}
Loading