Package match.event

Examples of match.event.CreatedMatchEvent


    private Match match;

    public MatchHandler(Match match, EventStore eventStore) {
        this.match = match;
        this.eventStore = eventStore;
        this.eventStore.store(match.getMatchId(), this.match.handle(new CreatedMatchEvent(match.getMatchId(), match.getPlayerSet())));
    }
View Full Code Here


        }
    }

    public void restoreState(EventStream eventStream) {
        Iterator<Event> iterator = eventStream.iterator();
        CreatedMatchEvent createdMatchEvent = (CreatedMatchEvent) iterator.next();
        if (createdMatchEvent == null)
            throw new RuntimeException("Restoring state failed");

        this.match = new Match(UUID.randomUUID(), createdMatchEvent.getPlayersMap());

        // Execute all arisen events.
        while (iterator.hasNext()) {
            Event next = iterator.next();
            next.execute(this.match);
View Full Code Here

TOP

Related Classes of match.event.CreatedMatchEvent

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.