ProblemLoader

org.ddolibscala.util.testbench.ProblemLoader
object ProblemLoader

Utility object designed to facilitate the loading of problem instances from the file system.

This helper abstracts away the logic of listing files in a directory and handling I/O resources safely.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def loadFromDir[P](pathDir: String)(factory: String => P): List[P]

Loads problem instances from all regular files located in a specific directory.

Loads problem instances from all regular files located in a specific directory.

It scans the provided directory path, filters for regular files (ignoring subdirectories), and transforms each file path into a problem instance using the provided factory function. If the directory does not exist or cannot be read, it returns an empty list.

Type parameters

P

the type of the problem instance to create.

Value parameters

factory

a function that creates a problem instance from a file path string.

pathDir

the string path to the directory containing the problem files.

Attributes

Returns

a list of problem instances loaded from the directory.