随机获取一个代理
@return
186610
@Override
    public ProxyTuple randomProxy(){
        synchronized (this.proxys){
            if (this.proxys.size() == 0) {
                return null;
            }
            Map.Entry<String,Integer> entity = this.proxys.entrySet().stream().collect(Collectors.toList()).get(random.nextInt(proxys.size()));
            return new ProxyTuple(entity.getKey(), entity.getValue());
        }
    }
589470
public final String getProxyScript() {
        StringBuilder buf = new StringBuilder("makeStaplerProxy('").append(getURL()).append("','").append(
                WebApp.getCurrent().getCrumbIssuer().issueCrumb()
        ).append("',[");

        boolean first=true;
        for (Method m : getTarget().getClass().getMethods()) {
            Collection<String> names;
            if (m.getName().startsWith("js")) {
                names = Collections.singleton(camelize(m.getName().substring(2)));
            } else {
                JavaScriptMethod a = m.getAnnotation(JavaScriptMethod.class);
                if (a!=null) {
                    names = Arrays.asList(a.name());
                    if (names.isEmpty())
                        names = Collections.singleton(m.getName());
                } else
                    continue;
            }

            for (String n : names) {
                if (first)  first = false;
                else        buf.append(',');
                buf.append('\'').append(n).append('\'');
            }
        }
        buf.append("])");
        
        return buf.toString();
    }
1114108
public function compile()
    {
        $condition_fragments = array();
        $arguments = array();

        $conditions = $this->conditions;
        //没有条件直接返回null
        if ($this->count() < 1) {
            $this->conditionString = '';
            $this->arguments = [];
            return $this;
        }

        //条件操作
        $conditionOperator = $conditions['#conditionOperator'];
        unset($conditions['#conditionOperator']);
        foreach ($conditions as $condition) {

            switch (true) {
                case $condition['field'] instanceof Condition:
                    $condition['field']->compile();
                    if((string) $condition['field']){
                        $condition_fragments[] = '(' . (string) $condition['field'] . ')';
                        $arguments = ArrayLib::array_add($arguments, $condition['field']->arguments());
                    }

                    break;
                case empty($condition['operator']):
                    $condition_fragments[] = '(' . $condition['field'] . ')';
                    $arguments = ArrayLib::array_add($arguments, $condition['value']);
                    break;
                default:
                    $operator_defaults = array(
                        'prefix' => '',
                        'postfix' => '',
                        'delimiter' => '',
                        'operator' => $condition['operator'],
                        'use_value' => TRUE,
                    );
                    $operator = $this->mapConditionOperator($condition['operator']);
                    if (!isset($operator)) {
                        $operator = $this->mapConditionOperator($condition['operator']);
                    }
                    $isSingleValue = false;
                    $operator += $operator_defaults;
                    if (!$operator['delimiter']) {
                        $condition['value'] = array($condition['value']);
                        $isSingleValue = true;
                    }
                    if ($operator['use_value']) {
                        foreach ($condition['value'] as $value) {
                            $arguments[] = $value;
                        }
                    }
                    $condition_fragments[] = $isSingleValue ? sprintf(
                        "%s %s %s",
                        $condition['field'],
                        $operator['operator'],
                        implode(',', array_pad([], count($condition['value']), '?'))
                    ) : sprintf(
                        "%s %s %s %s %s",
                        $condition['field'],
                        $operator['operator'],
                        $operator['prefix'],
                        implode(',', array_pad([], count($condition['value']), '?')),
                        $operator['postfix']
                    );
                    break;
            }

        }
        $this->conditionString = implode(" $conditionOperator ", $condition_fragments);
        $this->arguments = $arguments;

        return $this;
    }
1175854
public Record getMainRecord()
    {
        Record record = null;
        if (this.size() > 0)
        {
            record = (Record)this.firstElement();
            if (record != null) if (record == this.getScreenRecord())
            {
                record = null;
                if (this.size() >= 2)
                    record = (Record)this.elementAt(1);
            }
        }
        return record;
    }
656308
private ThriftConnection<T> obtainRawInternalConnection(ThriftServerInfo serverInfo)
			throws ThriftConnectionPoolException {
		// 判断单服务还是多服务模式
		ThriftConnection<T> connection;
		if (this.thriftServiceType == ThriftServiceType.SINGLE_INTERFACE) {
			connection = new DefaultThriftConnection<>(serverInfo.getHost(), serverInfo.getPort(),
					this.connectionTimeOut, this.config.getThriftProtocol(), this.config.getClientClass());
		} else {
			connection = new MulitServiceThriftConnecion<>(serverInfo.getHost(), serverInfo.getPort(),
					this.connectionTimeOut, this.config.getThriftProtocol(), this.config.getThriftClientClasses());
		}
		return connection;
	}
916660
public HelpTopicNode getPreviousSibling() {
        int i = getIndex() - 1;
        return i < 0 ? null : parent.children.get(i);
    }
215406
function () {
                var self = this, cs = [], i, c = self.constructor, attrs = self.getAttrs();
                while (c) {
                    cs.push(c);
                    c = c.superclass && c.superclass.constructor;
                }
                cs.reverse();    // from super class to sub class
                // from super class to sub class
                for (i = 0; i < cs.length; i++) {
                    var ATTRS = cs[i].ATTRS || {};
                    for (var attributeName in ATTRS) {
                        if (attributeName in attrs) {
                            var attributeValue, onSetMethod;
                            var onSetMethodName = ON_SET + ucfirst(attributeName);    // 存在方法，并且用户设置了初始值或者存在默认值，就同步状态
                            // 存在方法，并且用户设置了初始值或者存在默认值，就同步状态
                            if ((onSetMethod = self[onSetMethodName]) && // 用户如果设置了显式不同步，就不同步，
                                // 比如一些值从 html 中读取，不需要同步再次设置
                                attrs[attributeName].sync !== 0 && (attributeValue = self.get(attributeName)) !== undefined) {
                                onSetMethod.call(self, attributeValue);
                            }
                        }
                    }
                }
            }
224435
public Iterator iterator() {
        return new Iterator() {
            private LeftTupleSinkNode currentNode = null;
            private LeftTupleSinkNode nextNode    = getFirst();

            public boolean hasNext() {
                return (this.nextNode != null);
            }

            public Object next() {
                this.currentNode = this.nextNode;
                if ( this.currentNode != null ) {
                    this.nextNode = this.currentNode.getNextLeftTupleSinkNode();
                } else {
                    throw new NoSuchElementException( "No more elements to return" );
                }
                return this.currentNode;
            }

            public void remove() {
                if ( this.currentNode != null ) {
                    LeftTupleSinkNodeList.this.remove( this.currentNode );
                    this.currentNode = null;
                } else {
                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
                }
            }
        };
    }
240118
public Iterator<Symbol> iterator() {
        return scope.getSymbols(t -> !unwanted(t), NON_RECURSIVE).iterator();
    }
104480
@Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {

            private int index = start;
            private int lastReturnedIndex = -1;
            private boolean isFirst = full;

            @Override
            public boolean hasNext() {
                return isFirst || index != end;
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                isFirst = false;
                lastReturnedIndex = index;
                index = increment(index);
                return elements[lastReturnedIndex];
            }

            @Override
            public void remove() {
                if (lastReturnedIndex == -1) {
                    throw new IllegalStateException();
                }

                // First element can be removed quickly
                if (lastReturnedIndex == start) {
                    CircularFifoQueue.this.remove();
                    lastReturnedIndex = -1;
                    return;
                }

                int pos = lastReturnedIndex + 1;
                if (start < lastReturnedIndex && pos < end) {
                    // shift in one part
                    System.arraycopy(elements, pos, elements, lastReturnedIndex, end - pos);
                } else {
                    // Other elements require us to shift the subsequent elements
                    while (pos != end) {
                        if (pos >= maxElements) {
                            elements[pos - 1] = elements[0];
                            pos = 0;
                        } else {
                            elements[decrement(pos)] = elements[pos];
                            pos = increment(pos);
                        }
                    }
                }

                lastReturnedIndex = -1;
                end = decrement(end);
                elements[end] = null;
                full = false;
                index = decrement(index);
            }

        };
    }
305426
public PathTemplate withoutVars() {
    StringBuilder result = new StringBuilder();
    ListIterator<Segment> iterator = segments.listIterator();
    boolean start = true;
    while (iterator.hasNext()) {
      Segment seg = iterator.next();
      switch (seg.kind()) {
        case BINDING:
        case END_BINDING:
          break;
        default:
          if (!start) {
            result.append(seg.separator());
          } else {
            start = false;
          }
          result.append(seg.value());
      }
    }
    return create(result.toString(), urlEncoding);
  }
67965
public int getSeconds() {
		// TODO ahai 未做测试
		Calendar cld = Calendar.getInstance();
		cld.set(Calendar.DAY_OF_WEEK, this.weekday + 1);
		cld.set(Calendar.HOUR_OF_DAY, this.hour);
		cld.set(Calendar.MINUTE, this.minute);
		cld.set(Calendar.SECOND, this.second);
		long time = cld.getTimeInMillis();
		// System.out.println("time:" +
		// DateUtil.getTime(DateUtil.toDate(time)));
		long diff = time - System.currentTimeMillis();
		if (diff <= 0) {// 一定要小于等于0
			// 本周的时间已过，下周再执行
			diff += 7 * 24 * 60 * 60 * 1000L;
		}
		int seconds = (int) (diff / 1000);
		return seconds;
	}
224272
public final ProcessorDependencyGraph getProcessorGraph() {
        if (this.processorGraph == null) {
            synchronized (this) {
                if (this.processorGraph == null) {
                    final Map<String, Class<?>> attcls = new HashMap<>();
                    for (Map.Entry<String, Attribute> attribute: this.attributes.entrySet()) {
                        attcls.put(attribute.getKey(), attribute.getValue().getValueType());
                    }
                    this.processorGraph = this.processorGraphFactory.build(this.processors, attcls);
                }
            }
        }
        return this.processorGraph;
    }
1040424
private static String selectSlave() {
		//  无从库则路由到主库
		if (slaves.isEmpty()) {
			logger.debug("current no slave found ,default use [{}]!",master);
			return master;
		}
		if (slaves.size() == 1)
			return slaves.get(0);
		
		int selectIndex = (int) (counter.getAndIncrement() % slaves.size());
		String slaveKey = slaves.get(selectIndex);
		return slaveKey;
	}
197414
public Class<T> getProxyClass() {
        String suffix = "_$$_Weld" + getProxyNameSuffix();
        String proxyClassName = getBaseProxyName();
        if (!proxyClassName.endsWith(suffix)) {
            proxyClassName = proxyClassName + suffix;
        }
        if (proxyClassName.startsWith(JAVA)) {
            proxyClassName = proxyClassName.replaceFirst(JAVA, "org.jboss.weld");
        }
        Class<T> proxyClass = null;
        Class<?> originalClass = bean != null ? bean.getBeanClass() : proxiedBeanType;
        BeanLogger.LOG.generatingProxyClass(proxyClassName);
        try {
            // First check to see if we already have this proxy class
            proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName));
        } catch (ClassNotFoundException e) {
            // Create the proxy class for this instance
            try {
                proxyClass = createProxyClass(originalClass, proxyClassName);
            } catch (Throwable e1) {
                //attempt to load the class again, just in case another thread
                //defined it between the check and the create method
                try {
                    proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName));
                } catch (ClassNotFoundException e2) {
                    BeanLogger.LOG.catchingDebug(e1);
                    throw BeanLogger.LOG.unableToLoadProxyClass(bean, proxiedBeanType, e1);
                }
            }
        }
        return proxyClass;
    }
198783
public Object next()
    {
        String result = null;

        if ( _literal != null )
        {
            result = _literal;
            _literal = null;
        }
        else if ( _token != null )
        {
            result = _token;
            _token = null;
        }
        return result;
    }
1086763
public Iterator<ElementType> iterator() {
        return new Iterator<ElementType>() {
            int idx = getIdx;
            int N = size;

            public boolean hasNext() {
                return N > 0;
            }

            public ElementType next() {
                ElementType x = (ElementType) elements[idx];
                idx = (idx + 1) % elements.length;
                N--;
                return x;
            }

            public void remove() {
                throw new UnsupportedOperationException("remove");
            }
        };
    }