コード例 #1
0
ファイル: CalcManager.java プロジェクト: ratel/task01
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      if ("getCmdText".equals(method.getName())) {
        return cmd.getCmdText();
      }
      if ("setCmdText".equals(method.getName())) {
        if (args.length > 0) cmd.setCmdText((String) args[0]);
        return (Void.TYPE);
      }
      if ("execute".equals(method.getName())) {
        if (args.length > 0) {
          if (log.isDebugEnabled()) {
            log.debug("Stack before:");
            outStackInLog();
            log.debug("Context:");
            outContextInLog();

            StringBuilder outStr = new StringBuilder();

            log.debug("Arguments:");

            for (Object iArgs : args) {
              outStr.append(iArgs);
              outStr.append(";  ");
            }

            log.debug(outStr);
          }

          cmd.execute((String) args[0]); // Результат реально отработавшей функции.

          if (log.isDebugEnabled()) {
            log.debug("Stack After:");
            outStackInLog();
          }
        }
        return Void.TYPE;
      }

      return null; // To change body of implemented methods use File | Settings | File Templates.
    }
コード例 #2
0
ファイル: CalcManager.java プロジェクト: ratel/task01
  private void outContextInLog() {
    if (log.isDebugEnabled()) {
      StringBuilder outStr = new StringBuilder();

      if (dictionaryDefine != null)
        for (Map.Entry<String, Double> iDictionary : dictionaryDefine.entrySet()) {
          // outStr.append(iDictionary.getKey() + " = " + iDictionary.getValue() + ";  ");
          outStr.append(iDictionary.getKey());
          outStr.append(" = ");
          outStr.append(iDictionary.getValue());
          outStr.append(";  ");
        }
      else outStr.append("Context is null.");

      if (outStr.length() == 0) outStr.append("Context is empty.");

      log.debug(String.valueOf(outStr));
    }
  }
コード例 #3
0
ファイル: CalcManager.java プロジェクト: ratel/task01
  private void outStackInLog() {
    if (log.isDebugEnabled()) {
      StringBuilder outStr = new StringBuilder();

      if (dataStack != null)
        for (Double iStack : dataStack) {
          outStr.append(iStack);
          outStr.append(";  ");
        }
      else outStr.append("Stack is null.");

      if (outStr.length() == 0) outStr.append("Stack is empty.");

      log.debug(String.valueOf(outStr));
    }
  }