查询集合成员数量
@return
485350
public long count(){
        try {   
        	long count = getJedisCommands(groupName).zcard(key);
			return count;
    	} finally{
			getJedisProvider(groupName).release();
		}
	}
1065250
public VersionInfo merge() {
    if (isReference()) {
      final VersionInfo refVersion = (VersionInfo) getCheckedRef(VersionInfo.class, "VersionInfo");
      return refVersion.merge();
    }
    Reference currentRef = this.getExtends();
    if (currentRef == null) {
      return this;
    }
    final Vector<VersionInfo> stack = new Vector<>(5);
    stack.addElement(this);
    while (currentRef != null) {
      final Object obj = currentRef.getReferencedObject(getProject());
      if (obj instanceof VersionInfo) {
        VersionInfo current = (VersionInfo) obj;
        if (current.isReference()) {
          current = (VersionInfo) current.getCheckedRef(VersionInfo.class, "VersionInfo");
        }
        if (stack.contains(current)) {
          throw this.circularReference();
        }
        stack.addElement(current);
        currentRef = current.getExtends();
      } else {
        throw new BuildException("Referenced element " + currentRef.getRefId() + " is not a versioninfo.");
      }
    }
    return new VersionInfo(stack);
  }
447405
@Override
	public void render() {
		String uri = this.getUri();
		String contextPath = ActionContext.getContextPath();
		if (contextPath != null && uri.indexOf("://") == -1) {
			uri = contextPath + uri;
		}

		if (isWithParamStr) {
			// 加入请求参数
			String paramStr = Request.getServletRequest().getQueryString();
			if (paramStr != null) uri = uri + "?" + paramStr;
		}

		Response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
		Response.setHeader("Location", uri);
		Response.setHeader("Connection", "close");
	}
61512
@Override
    public Input getInput() {
        return new Input()
                .add("content", String.class, "邮件内容")
                .add("subject", String.class, "邮件标题")
                .add("tos", String.class, "使用逗号分隔的多个邮件地址", REQUIRED);
    }
1074950
@Override
	protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request,
			HttpServletResponse response) throws NoSuchBeanDefinitionException, NoUniqueBeanDefinitionException
	{
		// 如果未指定groupTemplate，取上下文中唯一的GroupTemplate对象
		if (groupTemplate == null)
		{
			groupTemplate = getApplicationContext().getBean(GroupTemplate.class);
		}

		// 渲染方法
		WebRender render = new WebRender(groupTemplate) {
			@Override
			protected void modifyTemplate(Template template, String key, HttpServletRequest request,
					HttpServletResponse response, Object... args)
			{
				Map<?, ?> model = (Map<?, ?>) args[0];

				for (Entry<?, ?> entry : model.entrySet())
				{
					String name = (String) entry.getKey();
					Object value = entry.getValue();
					template.binding(name, value);
				}
			}
		};
		String path = getUrl();
		render.render(path, request, response, model);
	}
1297930
public function getModuleModel()
    {
        if ($this->_moduleModel === null) {
            // 默认根据缓存的模块数据生成模块model
            $class = $this->module->moduleModelClass;
            $model = new $class;
            $class::populateRecord($model, ModuleModel::models()[$this->id]);
            $this->setModuleModel($model);
        }
        return $this->_moduleModel;
    }
140156
protected ExqlUnit compileUnit() {

        // 在输入中查找  PREFIX 字符
        Matcher matcher = PATTERN_KEYWORD.matcher(pattern);

        // 输出的单元列表
        ArrayList<ExqlUnit> units = new ArrayList<ExqlUnit>();

        // 组装位置
        int fromIndex = 0;

        while ((position < length) && matcher.find(position)) {

            // 修改当前位置
            position = matcher.end();

            // 检查  :expr | $expr 形式的子句
            String expr = matcher.group(1);
            if (expr != null) {

                // 创建文本子句
                if (matcher.start() > fromIndex) {
                    units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                }

                // 创建  :expr | $expr 形式的子句
                if (expr.charAt(0) == '$') {

                    // 创建  $expr 形式的子句, 作为拼接处理
                    units.add(new JoinExprUnit(expr));
                } else {

                    // 创建  :expr 形式的子句
                    units.add(new ExprUnit(expr));
                }

                fromIndex = position;

                continue;
            }

            // 检查  {...}? 的语法
            String group = matcher.group(2);
            if (group != null) {

                // 创建文本子句
                if (matcher.start() > fromIndex) {
                    units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                }

                // 编译  {...} 内部的子句
                ExqlCompiler compiler = new ExqlCompiler(group);
                System.out.println("DELETE>>>group=" + group);
                ExqlUnit unit = compiler.compileUnit();

                // 创建   {...}? 形式的子句
                units.add(new OptionUnit(unit));

                fromIndex = position;

                continue;
            }

            // 检查  # 后面的关键字
            String keyword = matcher.group(3);

            // 处理  #(:expr) 形式的子句
            if (keyword == null) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  #(:expr) 形式的表达式
                    units.add(new ExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  ##(:expr) 形式的子句
            else if (keyword.equals(SHARP) || keyword.equals(JOIN)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 创建文本子句
                    if (matcher.start() > fromIndex) {
                        units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                    }

                    // 创建  ##(:expr) 形式的表达式
                    units.add(new JoinExprUnit(expr));

                    fromIndex = position;
                }
            }
            // 处理  #if(:expr) {...} #else {...} 形式的子句
            else if (keyword.equals(KEYWORD_IF)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unitIfTrue = compileBlock();
                    if (unitIfTrue != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                        }

                        ExqlUnit unitIfFalse = null;

                        // 匹配  #else {...} 子句
                        if (match(SHARP_ELSE, position)) {

                            // 编译  {...} 单元
                            unitIfFalse = compileBlock();
                        }

                        // 创建  #if(:expr) {...} #else {...} 形式的子句
                        units.add(new ChoiceUnit(expr, unitIfTrue, unitIfFalse));

                        fromIndex = position;
                    }
                }
            }
            // 处理  #for(variant in :expr) {...} 形式的子句
            else if (keyword.equals(KEYWORD_FOR)) {

                // 获取括号内的内容
                expr = findBrace(BRACE_LEFT, BRACE_RIGHT);
                if (expr != null) {

                    // 编译  {...} 单元
                    ExqlUnit unit = compileBlock();
                    if (unit != null) {

                        // 创建文本子句
                        if (matcher.start() > fromIndex) {
                            units.add(new TextUnit(pattern.substring(fromIndex, matcher.start())));
                        }

                        // 循环变量名
                        String variant = null;

                        // 解析  variant in :expr 表达式
                        Matcher matcherIn = PATTERN_IN.matcher(expr);
                        if (matcherIn.matches()) {
                            variant = matcherIn.group(1);
                            expr = matcherIn.group(2);
                        }

                        // 创建  #for(variant in :expr) {...} 形式的子句
                        units.add(new ForEachUnit(expr, variant, unit));

                        fromIndex = position;
                    }
                }
            }
        }

        if (fromIndex < length) {
            // 写入 PREFIX 字符后的内容。
            units.add(new TextUnit(pattern.substring(fromIndex)));
        }

        if (units.size() > 1) {

            // 返回集合对象
            return new BunchUnit(units);

        } else if (!units.isEmpty()) {

            // 返回单个对象
            return units.get(0);

        } else {

            // 返回空对象
            return new EmptyUnit();
        }
    }
170318
public Properties build() {
        Properties buildProperties = new Properties();
        merge(_defaultProperties, buildProperties);
        merge(_modelProperties, buildProperties);
        merge(_overrideProperties, buildProperties);
        return buildProperties;
    }
1027790
private void select(int dataIndex, String[] resultList, int resultIndex, List<String[]> result) {
		int resultLen = resultList.length;
		int resultCount = resultIndex + 1;
		if (resultCount > resultLen) { // 全部选择完时，输出组合结果
			result.add(Arrays.copyOf(resultList, resultList.length));
			return;
		}

		// 递归选择下一个
		for (int i = dataIndex; i < datas.length + resultCount - resultLen; i++) {
			resultList[resultIndex] = datas[i];
			select(i + 1, resultList, resultIndex + 1, result);
		}
	}
889040
public String generate() {
		StringBuilder builder = new StringBuilder();
		int counter = 0;
		generate(builder, this.automaton.getInitialState(), counter);
		return builder.toString();
	}
628510
private BufferedImage generateBlankImg() {
        BufferedImage image = new BufferedImage(w, h,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) image.getGraphics();
        //设置图片背景是白色
        g2.setColor(Color.WHITE);
        g2.fillRect(0, 0, w, h);
        g2.dispose();
        return image;
    }
673880
@Override
	public Object[] toArray() {
		combine();
		if(combined==null) {
			Set<E> emptySet = java.util.Collections.emptySet();
			return emptySet.toArray();
		}
		return combined.toArray();
	}
1176069
public String build() {
    StringBuilder sb = new StringBuilder(funcName + "(");

    // Join args and kwargs into simple strings.
    String args =
        argList.stream()
            .map(PyExpr::getText)
            .filter(Objects::nonNull)
            .collect(Collectors.joining(", "));
    String kwargs =
        kwargMap.entrySet().stream()
            .map(entry -> entry.getKey() + "=" + entry.getValue().getText())
            .filter(Objects::nonNull)
            .collect(Collectors.joining(", "));

    // Strip empty strings.
    args = Strings.emptyToNull(args);
    kwargs = Strings.emptyToNull(kwargs);

    // Join all pieces together.
    Joiner.on(", ").skipNulls().appendTo(sb, args, kwargs, unpackedKwargs);

    sb.append(")");
    return sb.toString();
  }
1285054
private static GroupTemplate createEngine(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}

		switch (config.getResourceMode()) {
		case CLASSPATH:
			return createGroupTemplate(new ClasspathResourceLoader(config.getPath(), config.getCharsetStr()));
		case FILE:
			return createGroupTemplate(new FileResourceLoader(config.getPath(), config.getCharsetStr()));
		case WEB_ROOT:
			return createGroupTemplate(new WebAppResourceLoader(config.getPath(), config.getCharsetStr()));
		case STRING:
			return createGroupTemplate(new StringTemplateResourceLoader());
		case COMPOSITE:
			//TODO 需要定义复合资源加载器
			return createGroupTemplate(new CompositeResourceLoader());
		default:
			return new GroupTemplate();
		}
	}
275034
public Iterable<MultiPart> parts() throws IOException {
        if (!isMultipart()) return emptyIterable;
        final String boundarystr = "--" + this.boundary;
        final Pattern fielnameReg = this.fielnamePattern;
        final String endboundary = boundarystr + "--";
        final byte[] boundarray = ("\n" + boundarystr).getBytes();
        final byte[] buffer = new byte[boundarray.length];
        final InputStream input = this.in;
        final DefaultAnyValue params = this.parameters;
        final AtomicBoolean finaled = new AtomicBoolean(false);
        return () -> new Iterator<MultiPart>() {

            private String boundaryline;

            private MultiPart lastentry;

            @Override
            public boolean hasNext() {
                try {
                    if (lastentry != null) {
                        lastentry.skip();
                        if (finaled.get()) return false;
                    }
                    if (boundaryline == null) boundaryline = readBoundary();
                    //if (debug) System.out.print("boundaryline=" + boundaryline + "  ");
                    if (endboundary.equals(boundaryline) || !boundarystr.equals(boundaryline)) { //结尾或异常
                        lastentry = null;
                        return false;
                    }
                    final String disposition = readLine();
                    //if (debug) System.out.println("disposition=" + disposition);
                    if (disposition.contains("; filename=\"")) { //是上传文件
                        String contentType = "";
                        //读掉HTTP Header和空白行 通常情况下Content-Type后面就是内容，但是有些特殊情况下后面会跟其他如Content-Length: xxx等HTTP header，所以需要循环读取
                        String rl;
                        while (!(rl = readLine()).isEmpty()) {
                            if (rl.startsWith("Content-Type:")) contentType = rl.substring(rl.indexOf(':') + 1).trim();
                        }
                        //if (debug) System.out.println("file.contentType=" + contentType);

                        String name = parseValue(disposition, "name");
                        String filename = parseValue(disposition, "filename");
                        if (filename == null || filename.isEmpty()) { //没有上传
                            readLine(); //读掉空白行
                            this.boundaryline = null;
                            this.lastentry = null;
                            return this.hasNext();
                        } else {
                            int p1 = filename.lastIndexOf('/');
                            if (p1 < 0) p1 = filename.lastIndexOf('\\');
                            if (p1 >= 0) filename = filename.substring(p1 + 1);
                        }
                        final AtomicLong counter = new AtomicLong(0);
                        InputStream source = new InputStream() {

                            private int bufposition = buffer.length;

                            private boolean end;

                            @Override
                            public int read() throws IOException {
                                if (end) return -1;
                                final byte[] buf = buffer;
                                int ch = (this.bufposition < buf.length) ? (buf[this.bufposition++] & 0xff) : input.read();
                                if ((ch == '\r' && readBuffer())) return -1;
                                counter.incrementAndGet();
                                return ch;
                            }

                            private boolean readBuffer() throws IOException {
                                final byte[] buf = buffer;
                                final int pos = this.bufposition;
                                int s = 0;
                                for (int i = pos; i < buf.length; i++) {
                                    buf[s++] = buf[i];
                                }
                                int readed = 0;
                                while ((readed += input.read(buf, s + readed, pos - readed)) != pos);
                                this.bufposition = 0;
                                if (Arrays.equals(boundarray, buf)) {
                                    this.end = true;
                                    int c1 = input.read();
                                    int c2 = input.read();
                                    finaled.set(c1 == '-' && c2 == '-');
                                    return true;
                                }
                                return false;
                            }

                            @Override
                            public long skip(long count) throws IOException {
                                if (end) return -1;
                                if (count <= 0) return 0;
                                long s = 0;
                                while (read() != -1) {
                                    s++;
                                    if (--count <= 0) break;
                                }
                                return s;
                            }
                        };
                        this.lastentry = new MultiPart(filename, name, contentType, counter, source);
                        if (fielnameReg != null && !fielnameReg.matcher(filename).matches()) {
                            return this.hasNext();
                        }
                        return true;
                    } else { //不是文件
                        readLine(); //读掉空白
                        params.addValue(parseValue(disposition, "name"), readLine());
                        this.boundaryline = null;
                        this.lastentry = null;
                        return this.hasNext();
                    }
                } catch (IOException ex) {
                    logger.log(Level.FINER, "list multiparts abort", ex);
                    return false;
                }
            }

            @Override
            public MultiPart next() {
                return lastentry;
            }

        };
    }
1000926
public static Configuration merge(final Iterable<Configuration> configurations) {
    final ConfigurationBuilder configurationBuilder = Tang.Factory.getTang().newConfigurationBuilder();
    for (final Configuration configuration : configurations) {
      configurationBuilder.addConfiguration(configuration);
    }
    return configurationBuilder.build();
  }
1334556
public Action build() {
    Action toReturn = new BuiltAction(driver, new LinkedHashMap<>(sequences), action);
    action = new CompositeAction();
    sequences.clear();
    return toReturn;
  }