⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 countvalues.java

📁 A framework written in Java for implementing high-level and dynamic languages, compiling them into J
💻 JAVA
字号:
// Copyright (c) 2001  Per M.A. Bothner and Brainfood Inc.// This is free software;  for terms and warranty disclaimer see ./COPYING.package gnu.kawa.functions;import gnu.mapping.*;import gnu.lists.Consumer;/** Return the number of values in the argument. */public class CountValues extends Procedure1{  public static final CountValues countValues = new CountValues();  public static int countValues(Object arg)  {    return arg instanceof Values ? ((Values) arg).size() : 1;  }  public Object apply1(Object arg)  {    return gnu.math.IntNum.make(countValues(arg));  }  public void apply (CallContext ctx)  {    Consumer consumer = ctx.consumer;    Object arg = ctx.getNextArg();    ctx.lastArg();    consumer.writeInt(countValues(arg));  }}

⌨️ 快捷键说明

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