sequenceprompt.java

来自「此源代码为java语音识别的开源系统」· Java 代码 · 共 53 行

JAVA
53
字号
/* * Copyright 1999-2002 Carnegie Mellon University.   * Portions Copyright 2002 Sun Microsystems, Inc.   * Portions Copyright 2002 Mitsubishi Electric Research Laboratories. * All Rights Reserved.  Use is subject to license terms. *  * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL  * WARRANTIES. * */package demo.jsapi.cardmatch;/** * An interface that represents a spoken prompt */public class SequencePrompt implements Prompt {    private String[] prompts;    private int curPrompt = 0;    /**     * Creates a sequence prompt     *     * @param an array of prompts     *     */    public SequencePrompt(String[] prompts) {        this.prompts = prompts;    }    /**     * Gets the next text to be spoken     */    public String getText() {        String prompt = prompts[curPrompt++];        if (curPrompt >= prompts.length) {            curPrompt = 0;        }        return prompt;    }    /**     * Resets the prompt to its initial state     */    public void reset() {        curPrompt = 0;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?