UNPKG

igir

Version:

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.

49 lines (48 loc) • 1.27 kB
/** * A container holding a {@link ROM}, a found input {@link File}, and a desired output {@link File}. */ export default class ROMWithFiles { rom; inputFile; outputFile; constructor(rom, inputFile, outputFile) { this.rom = rom; this.inputFile = inputFile; this.outputFile = outputFile; } getRom() { return this.rom; } getInputFile() { return this.inputFile; } getOutputFile() { return this.outputFile; } // Immutable setters withRom(rom) { if (rom === this.rom) { return this; } return new ROMWithFiles(rom, this.inputFile, this.outputFile); } withInputFile(inputFile) { if (inputFile === this.inputFile) { return this; } return new ROMWithFiles(this.rom, inputFile, this.outputFile); } withOutputFile(outputFile) { if (outputFile === this.outputFile) { return this; } return new ROMWithFiles(this.rom, this.inputFile, outputFile); } // Pseudo Built-Ins /** * A string hash code to uniquely identify this {@link ROMWithFiles}. */ hashCode() { return `${this.rom.hashCode()}|${this.outputFile.toString()}`; } }