报价、摆盘实时数据变化时，会触发该回调
439456
def on_quote_changed(self, tiny_quote):
        """"""
        # TinyQuoteData
        data = tiny_quote
        symbol = data.symbol
        str_dt = data.datetime.strftime("%Y%m%d %H:%M:%S")

        # 得到日k数据的ArrayManager(vnpy)对象
        am = self.get_kl_day_am(data.symbol)
        array_high = am.high
        array_low = am.low
        array_open = am.open
        array_close = am.close
        array_vol = am.volume

        n = 5
        ma_high = self.sma(array_high, n)
        ma_low = self.sma(array_low, n)
        ma_open = self.sma(array_open, n)
        ma_close = self.sma(array_close, n)
        ma_vol = self.sma(array_vol, n)

        str_log = "on_quote_changed symbol=%s dt=%s sma(%s) open=%s high=%s close=%s low=%s vol=%s" % (
                    symbol, str_dt, n, ma_open, ma_high, ma_close, ma_low, ma_vol)
        self.log(str_log)
1132920
function parseAdjusts(adjusts) {
  // 如果是字符串或者对象转换成数组
  if (Util.isString(adjusts) || Util.isPlainObject(adjusts)) {
    adjusts = [adjusts];
  }
  Util.each(adjusts, function (adjust, index) {
    if (!Util.isObject(adjust)) {
      adjusts[index] = { type: adjust };
    }
  });
  return adjusts;
}
1020087
@Override
    public void recognition(Term[] terms) {
        int length = terms.length - 1;
        Term from = null;
        Term to = null;
        Term temp = null;
        for (int i = 0; i < length; i++) {
            if (terms[i] == null) {
                continue;
            } else if (".".equals(terms[i].getName()) || "．".equals(terms[i].getName())) {
                // 如果是.前后都为数字进行特殊处理
                to = terms[i].to();
                from = terms[i].from();
                if (from.termNatures().numAttr.flag && to.termNatures().numAttr.flag) {
                    from.setName(from.getName() + "." + to.getName());
                    TermUtil.termLink(from, to.to());
                    terms[to.getOffe()] = null;
                    terms[i] = null;
                    i = from.getOffe() - 1;
                }
                continue;
            } else if (!terms[i].termNatures().numAttr.flag) {
                continue;
            }

            temp = terms[i];
            // 将所有的数字合并
            while ((temp = temp.to()).termNatures().numAttr.flag) {
                terms[i].setName(terms[i].getName() + temp.getName());
            }
            // 如果是数字结尾
            if (MyStaticValue.isQuantifierRecognition && temp.termNatures().numAttr.numEndFreq > 0) {
                terms[i].setName(terms[i].getName() + temp.getName());
                temp = temp.to();
            }

            // 如果不等,说明terms[i]发生了改变
            if (terms[i].to() != temp) {
                TermUtil.termLink(terms[i], temp);
                // 将中间无用元素设置为null
                for (int j = i + 1; j < temp.getOffe(); j++) {
                    terms[j] = null;
                }
                i = temp.getOffe() - 1;
            }
        }

    }
464876
private static void combineWords(String[] wordNet, int start, int end, CoreDictionary.Attribute[] attributeArray, CoreDictionary.Attribute value)
    {
        if (start + 1 != end)   // 小优化，如果只有一个词，那就不需要合并，直接应用新属性
        {
            StringBuilder sbTerm = new StringBuilder();
            for (int j = start; j < end; ++j)
            {
                if (wordNet[j] == null) continue;
                sbTerm.append(wordNet[j]);
                wordNet[j] = null;
            }
            wordNet[start] = sbTerm.toString();
        }
        attributeArray[start] = value;
    }
1006796
function (_this) {
    // 抽屉栏滑动手势控制
    var openNavEventHandler;
    var touchStartX;
    var touchStartY;
    var swipeStartX;
    var swiping = false;
    var maybeSwiping = false;
    var $body = $('body');

    // 手势触发的范围
    var swipeAreaWidth = 24;

    function enableSwipeHandling() {
      if (!openNavEventHandler) {
        $body.on('touchstart', onBodyTouchStart);
        openNavEventHandler = onBodyTouchStart;
      }
    }

    function setPosition(translateX, closeTransform) {
      var rtlTranslateMultiplier = _this.position === 'right' ? -1 : 1;
      var transformCSS = 'translate(' + (-1 * rtlTranslateMultiplier * translateX) + 'px, 0) !important;';
      _this.$drawer.css(
        'cssText',
        'transform:' + transformCSS + (closeTransform ? 'transition: initial !important;' : '')
      );
    }

    function cleanPosition() {
      _this.$drawer.css({
        transform: '',
        transition: '',
      });
    }

    function getMaxTranslateX() {
      return _this.$drawer.width() + 10;
    }

    function getTranslateX(currentX) {
      return Math.min(
        Math.max(
          swiping === 'closing' ? (swipeStartX - currentX) : (getMaxTranslateX() + swipeStartX - currentX),
          0
        ),
        getMaxTranslateX()
      );
    }

    function onBodyTouchStart(event) {
      touchStartX = event.touches[0].pageX;
      if (_this.position === 'right') {
        touchStartX = $body.width() - touchStartX;
      }

      touchStartY = event.touches[0].pageY;

      if (_this.state !== 'opened') {
        if (touchStartX > swipeAreaWidth || openNavEventHandler !== onBodyTouchStart) {
          return;
        }
      }

      maybeSwiping = true;

      $body.on({
        touchmove: onBodyTouchMove,
        touchend: onBodyTouchEnd,
        touchcancel: onBodyTouchMove,
      });
    }

    function onBodyTouchMove(event) {
      var touchX = event.touches[0].pageX;
      if (_this.position === 'right') {
        touchX = $body.width() - touchX;
      }

      var touchY = event.touches[0].pageY;

      if (swiping) {
        setPosition(getTranslateX(touchX), true);
      } else if (maybeSwiping) {
        var dXAbs = Math.abs(touchX - touchStartX);
        var dYAbs = Math.abs(touchY - touchStartY);
        var threshold = 8;

        if (dXAbs > threshold && dYAbs <= threshold) {
          swipeStartX = touchX;
          swiping = _this.state === 'opened' ? 'closing' : 'opening';
          $.lockScreen();
          setPosition(getTranslateX(touchX), true);
        } else if (dXAbs <= threshold && dYAbs > threshold) {
          onBodyTouchEnd();
        }
      }
    }

    function onBodyTouchEnd(event) {
      if (swiping) {
        var touchX = event.changedTouches[0].pageX;
        if (_this.position === 'right') {
          touchX = $body.width() - touchX;
        }

        var translateRatio = getTranslateX(touchX) / getMaxTranslateX();

        maybeSwiping = false;
        var swipingState = swiping;
        swiping = null;

        if (swipingState === 'opening') {
          if (translateRatio < 0.92) {
            cleanPosition();
            _this.open();
          } else {
            cleanPosition();
          }
        } else {
          if (translateRatio > 0.08) {
            cleanPosition();
            _this.close();
          } else {
            cleanPosition();
          }
        }

        $.unlockScreen();
      } else {
        maybeSwiping = false;
      }

      $body.off({
        touchmove: onBodyTouchMove,
        touchend: onBodyTouchEnd,
        touchcancel: onBodyTouchMove,
      });
    }

    if (_this.options.swipe) {
      enableSwipeHandling();
    }
  }
252026
function(url, params, onsuccess, onfail) {
    // url中包含 get 参数和 params 合并
    if (_typeof(params) == 'object') params = _params_2_url(params);
    else params = '';

    if (params) url = url + '?' + params;
    return request('GET', url, '', onsuccess, onfail);
  }
553452
function(){
		/* "ものを動かしたように描画する"でなければinputLineと同じ */
		if(this.puzzle.execConfig('dispmove')){
			this.inputMoveLine();
			return;
		}
		
		var pos, border;
		if(!this.board.borderAsLine){
			pos = this.getpos(0);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getnb(pos);
		}
		else{
			pos = this.getpos(0.35);
			if(this.prevPos.equals(pos)){ return;}
			border = this.prevPos.getborderobj(pos);
		}
		
		if(!border.isnull){
			if(this.inputData===null){ this.inputData=(border.isLine()?0:1);}
			if     (this.inputData===1){ border.setLine();}
			else if(this.inputData===0){ border.removeLine();}
			border.draw();
		}
		this.prevPos = pos;
	}
1092388
function () {
	var trans = [
		[ "zh_tw" , "hello" ]
	];
		
	for ( var i in trans){
		console.log(i);
	}
	
	SR.DB.setData(i18nDB, {zh_tw:{hello: "哈囉"}}, function(){}, function(){});
	SR.DB.setData(i18nDB, {zh_tw:{say: "說"}}, function(){}, function(){});
	SR.DB.setData(i18nDB, {zh_tw:{see: "看"}}, function(){}, function(){});
	//SR.DB.setData("language", {"zh_tw":{"hello": "哈囉"}}, function(){}, function(){});
}
605933
private function invokeRoute(): void
    {
        $moduleName = $this->routeInfo->moduleName;
        $controllerName = $this->routeInfo->controllerName;
        $actionName = $this->routeInfo->actionName;
        $controllerClass = $this->config->getValue('CONTROLLER_NAMESPACE') . '\\' . str_replace('.', '\\', $moduleName) . '\\' . $controllerName;
        if (! class_exists($controllerClass)) {
            $event = RouteErrorEvent::createCustom(404, $moduleName . '/' . $controllerName . '/' . $actionName . '对应的控制器类' . $controllerClass . '不存在');
            $event->httpErrorCode = 404;
            $this->dispatchEvent($event);
            return;
        }
        // 执行操作
        $this->invokeAction(new $controllerClass(), $actionName);
    }
836745
@SuppressWarnings("unchecked")
    public static <R> R invoke(Object obj, String methodName, Class<?>[] parameterTypes,
                               Object... args) {
        Assert.isFalse(
            CollectionUtil.safeIsEmpty(parameterTypes) ^ CollectionUtil.safeIsEmpty(args),
            "方法参数类型列表必须和方法参数列表一致");
        Assert.isTrue(parameterTypes == null || parameterTypes.length == args.length,
            "方法参数类型列表长度必须和方法参数列表长度一致");
        Method method;
        if (obj instanceof Class) {
            method = getMethod((Class) obj, methodName, parameterTypes);
        } else {
            method = getMethod(obj.getClass(), methodName, parameterTypes);
        }
        return invoke(obj, method, args);
    }
379968
function on(ele, type, callback) {
    let body = document.body;

    // 注册事件元素和类型
    if (!eventList[ele]) {
        eventList[ele] = {};
    }
    eventList[ele][type] = callback;

    /**
     * 在 body 元素上绑定事件, 统一管理事件
     */
    body.addEventListener(type, (e)=> {
        let eTag     = e.target,
            eleEvent = eventList[ele],
            eleList  = document.querySelectorAll(ele);

        // 向上冒泡匹配元素
        while (!([].indexOf.call(eleList, eTag) !== -1) && eTag !== body) {
            eTag = eTag.parentNode;
        }
        e.stopPropagation();
        e.preventDefault();
        if (eTag !== body && !!eleEvent) {
            if (!!eleEvent[type]) {
                eleEvent[type](eTag);

                // 如果当前元素事件属于需要被移除的事件，则在队列中进行删除
                if (offList.indexOf(ele + type) !== -1) {
                    delete eventList[ele][type];
                }
            }
        }
    });
}
174023
function (uri, fromUri, source) {
        if (!/^\./.test(uri) || EXTNAME_RE.test(uri)) {

            var line;

            // 如果只出现一次这个字符串，很容易确认模板错误行
            if (source.split(uri).length === 2) {
                source.split(/\n/).forEach(function (code, index) {
                    if (code.indexOf(uri) !== -1) {
                        line = index + 1;
                        source = code.trim();
                    }
                });
            }

            var error = {
                name: 'Syntax Error',
                line: line,
                source: source,
                message: 'Template must be a relative path, and can not have a suffix.'
            };

            if (fromUri) {
                error.filename = fromUri;
            }

            throw error;
        }
    }
1204497
public void initContext(Context ctx)
	{
		// 模板静态文本部分
		ctx.staticTextArray = staticTextArray;
		// 模板各种缓存存放地

		// 临时标量所在空间
		ctx.tempVarStartIndex = tempVarStartIndex;
		// 分配变量空间,最后一个为模板的返回值
		ctx.vars = new Object[varIndexSize + 1];
		ctx.vars[varIndexSize] = Context.NOT_EXIST_OBJECT;

		// 将全局变量放到数组
		putGlobaToArray(ctx);

	}
1183957
private static void _injectAnnotationES(ClassUtil.PropertieDescription propertieDescription,Object data ,BaseSearchHit hit,Object id ){
		if(propertieDescription != null && propertieDescription.isEsIdReadSet()){

			try {
				propertieDescription.setValue(data,ValueObjectUtil.typeCast(id,propertieDescription.getPropertyType()));
			} catch (IllegalAccessException e) {
				logger.warn("设置属性失败："+propertieDescription.toString(),e);
			} catch (InvocationTargetException e) {
				logger.warn("设置属性失败："+propertieDescription.toString(),e.getTargetException());
			}

		}

	}
86866
function format(str, args) {
  if (!args) {
    throw new Error("args empty!");
  }
  //判断是否是数组
  if (args.constructor == Array) {
    var l = args.length;
    var reg = /(%[sdf])/;
    for(var i= 0; i<l; i++) {
      str = str.replace(reg, args[i]);
    }
  } else if (typeof args == 'object') {
    for(var key in args) {
      var reg = new RegExp(":"+key);
      str = str.replace(reg, args[key]);
    }
  }
  return str;
}
547647
function wrapCallback(resolver, promise, callback) {
        return function (data) {

            function work() {
                // 可能抛异常
                var res = callback(data);
                // 返回结果与当前的promise对象相同
                // 抛异常
                // see # 2.3.1
                if (res === promise) {
                    throw new TypeError();
                }

                resolve(resolver, res);
            }

            if (captureException) {
                try {
                    work();
                }
                catch (e) {
                    emitExceptionEvent(e);
                    resolver.reject(e);
                }
            }
            else {
                work();
            }

        };
    }
11602
private function listenAfter()
    {
        //监听器结束
        //$_listeners=array_reverse($this->m_listeners);
        $_listeners=$this->m_listeners;
        foreach ($_listeners as $listener){
            $listener->listenAfter($this->m_context);
        }
    }