Package barsuift.simLife.universe

Examples of barsuift.simLife.universe.BasicUniverseIO


    public void testOpen() throws OpenException, SaveException {
        // create a tes file to be read
        BasicUniverseFactory factory = new BasicUniverseFactory();
        Universe universe = factory.createRandom();
        BasicUniverseIO io = new BasicUniverseIO(saveFile);
        io.write(universe);
        // now try to read it
        Universe universe2 = application.openUniverse(saveFile);
        assertEquals(universe, universe2);
    }
View Full Code Here


        return currentUniverse;
    }


    public Universe openUniverse(File saveFile) throws OpenException {
        BasicUniverseIO envIO = new BasicUniverseIO(saveFile);
        Universe universe = envIO.read();
        this.currentUniverse = universe;
        this.window.changeUniverse(currentUniverse);
        this.currentSaveFile = saveFile;
        return currentUniverse;
    }
View Full Code Here

            throw new IllegalStateException("No current save file");
        }
        if (currentUniverse == null) {
            throw new IllegalStateException("No current universe to save");
        }
        BasicUniverseIO envIO = new BasicUniverseIO(currentSaveFile);
        envIO.write(currentUniverse);
    }
View Full Code Here

    public void saveUniverseAs(File saveFile) throws SaveException {
        if (currentUniverse == null) {
            throw new IllegalStateException("No current universe to save");
        }
        BasicUniverseIO envIO = new BasicUniverseIO(saveFile);
        envIO.write(currentUniverse);
        this.currentSaveFile = saveFile;
    }
View Full Code Here

TOP

Related Classes of barsuift.simLife.universe.BasicUniverseIO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.