本文整理匯總了Java中com.lightbend.training.coffeehouse.TerminalCommand.Guest類的典型用法代碼示例。如果您正苦於以下問題:Java Guest類的具體用法?Java Guest怎麽用?Java Guest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Guest類屬於com.lightbend.training.coffeehouse.TerminalCommand包,在下文中一共展示了Guest類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import com.lightbend.training.coffeehouse.TerminalCommand.Guest; //導入依賴的package包/類
static TerminalCommand create(final String s) {
final Matcher guestMatcher = createGuestPattern.matcher(s);
if (guestMatcher.matches()) {
final String countGroup = guestMatcher.group(1);
final int count = countGroup != null ? Integer.parseInt(countGroup) : 1;
final String coffeeGroup = guestMatcher.group(2);
final Coffee coffee = coffeeGroup != null ? Coffee.order(coffeeGroup) : new Coffee.Akkaccino();
final String maxCoffeeCountGroup = guestMatcher.group(3);
final int maxCoffeeCount =
maxCoffeeCountGroup != null ? Integer.parseInt(maxCoffeeCountGroup) : Integer.MAX_VALUE;
return new Guest(count, coffee, maxCoffeeCount);
}
if (getStatusPattern.matcher(s).matches()) return Status.Instance;
if (quitPattern.matcher(s).matches()) return Quit.Instance;
return new Unknown(s);
}