void add(List from, int startInclusive, int endExclusive) {
   for (int i = startInclusive; i < endExclusive; i++) {
     _add(from.item(i));
   }
 }
 void add(List other) {
   for (int i = 0; i < other.length(); i++) {
     _add(other.item(i));
   }
 }
Exemple #3
0
 public static void clearInterval(
     final Context cx, final Scriptable thisObj, Object[] args, Function funObj)
     throws ScriptException {
   JaggeryContext context = CommonManager.getJaggeryContext();
   ServletContext servletContext = (ServletContext) context.getProperty(Constants.SERVLET_CONTEXT);
   String contextPath = servletContext.getContextPath();
   RhinoTopLevel.clearTimeout(cx, thisObj, args, funObj);
   List<String> taskIds = intervals.get(contextPath);
   taskIds.remove(String.valueOf(args[0]));
 }
Exemple #4
0
 private static String resolveScriptPath(List<String> parts, Map<String, Object> map) {
   String part = parts.remove(0);
   if (parts.isEmpty()) {
     return getPath(map, part);
   }
   Object obj = map.get(part);
   if (obj == null) {
     return getPath(map, "/");
   }
   if (obj instanceof Map) {
     return resolveScriptPath(parts, (Map<String, Object>) obj);
   }
   return null;
 }
Exemple #5
0
 public static String setInterval(
     final Context cx, final Scriptable thisObj, Object[] args, Function funObj)
     throws ScriptException {
   JaggeryContext context = CommonManager.getJaggeryContext();
   ServletContext servletContext = (ServletContext) context.getProperty(Constants.SERVLET_CONTEXT);
   String contextPath = servletContext.getContextPath();
   String taskId = RhinoTopLevel.setInterval(cx, thisObj, args, funObj);
   List<String> taskIds = intervals.get(contextPath);
   if (taskIds == null) {
     taskIds = new ArrayList<String>();
     intervals.put(contextPath, taskIds);
   }
   taskIds.add(taskId);
   return taskId;
 }
Exemple #6
0
 private void parseMandatory(String value) {
   StringTokenizer tokenizer = new StringTokenizer(value, Constants.MANDATORY_DELIMITER);
   while (tokenizer.hasMoreTokens()) {
     String token = (String) tokenizer.nextElement();
     token = token.trim();
     if (token.length() > 0) mandatory.add(token);
   }
 }
 private void manMung() { // 手动混淆,即由用户输入混淆变量
   JTable table = AnalyseWarnPanel.table;
   Set<ScriptOrFnScope> scopes = scopeSymbolMaping.keySet();
   Iterator<ScriptOrFnScope> scopesSetIt = scopes.iterator();
   int i = 0;
   while (scopesSetIt.hasNext()) {
     ScriptOrFnScope tmpScope = scopesSetIt.next();
     List<String> symbolList = scopeSymbolMaping.get(tmpScope);
     Iterator<String> symbolListIt = symbolList.iterator();
     while (symbolListIt.hasNext()) {
       String symbol = symbolListIt.next();
       JavaScriptIdentifier identifier = tmpScope.getIdentifier(symbol);
       String mungedValue = table.getValueAt(i, 1).toString().trim();
       if (identifier.isMarkedForMunging() && !mungedValue.equals("null")) {
         identifier.setMungedValue(mungedValue);
       }
       i++;
     }
   }
 }