Package com.music.web.websocket.dto

Examples of com.music.web.websocket.dto.Instrument


        PossibleAnswers answers = new PossibleAnswers();

        // first select the instrument distractors
        int instrument = piece.getMainInstrument();
        List<Instrument> instruments = new ArrayList<>(ANSWERS_PER_QUESTION);
        instruments.add(new Instrument(instrument, InstrumentNameExtractor.getInstrumentName(instrument)));
        while (instruments.size() < ANSWERS_PER_QUESTION) {
            int[] set = random.nextBoolean() ? InstrumentGroups.MAIN_PART_INSTRUMENTS : InstrumentGroups.MAIN_PART_ONLY_INSTRUMENTS;
            int selectedId = set[random.nextInt(set.length)];
            Instrument newInstrument = new Instrument(selectedId, InstrumentNameExtractor.getInstrumentName(selectedId));
            if (selectedId != instrument && !instruments.contains(newInstrument)) {
                instruments.add(newInstrument);
            }
        }
        Collections.shuffle(instruments, random);
View Full Code Here

TOP

Related Classes of com.music.web.websocket.dto.Instrument

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.