Collects information about a pass P after P finishes running, eg, how much
time P took and what was its impact on code size.

@param passName short name of the pass
@param runtime execution time in milliseconds
2934
void recordPassStop(String passName, long runtime) {
    int allocMem = getAllocatedMegabytes();
    Stats logStats = this.currentPass.pop();
    checkState(passName.equals(logStats.pass));
    this.log.add(logStats);

    // Update fields that aren't related to code size
    logStats.runtime = runtime;
    logStats.allocMem = allocMem;
    logStats.runs = 1;
    if (this.codeChange.hasCodeChanged()) {
      logStats.changes = 1;
    }
    if (passName.equals(PassNames.PARSE_INPUTS)) {
      recordParsingStop(logStats);
    } else if (this.codeChange.hasCodeChanged() && tracksAstSize()) {
      recordOtherPassStop(logStats);
    }
  }
51395
@Override
    public R visitVariable(VariableTree node, P p) {
        R r = scan(node.getModifiers(), p);
        r = scanAndReduce(node.getType(), p, r);
        r = scanAndReduce(node.getNameExpression(), p, r);
        r = scanAndReduce(node.getInitializer(), p, r);
        return r;
    }
599620
@Override
    public void runtimeEventOccurred(MPRuntimeEvent event)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "runtimeEventOccurred", new Object[] { event, this });

        // A local q point, fire against the control adapter belonging to the
        // ptoplocalmsgsitemstream
        if (_pToPLocalMsgsItemStream != null)
        {
            _pToPLocalMsgsItemStream.
                            getControlAdapter().
                            runtimeEventOccurred(event);
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "runtimeEventOccurred", "local queue point is null, cannot fire event");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "runtimeEventOccurred");
    }
962461
private String getMandatory(String name) {
		if (!config.containsKey(name)) {
			throw new RuntimeException(name + " parameter is missing.");
		}
		else {
			return config.getString(name);
		}

	}
1301459
public static PassFactory createEmptyPass(String name) {
    return new PassFactory(name, true) {
      @Override
      protected CompilerPass create(final AbstractCompiler compiler) {
        return new CompilerPass() {
          @Override
          public void process(Node externs, Node root) {}
        };
      }

      @Override
      protected FeatureSet featureSet() {
        return FeatureSet.latest();
      }
    };
  }
30219
private Parameter getParameterByName(String name)
    {
        if (getParameters() != null)
        {
            for (Parameter p : parameters)
            {
                if (name.equals(p.getName()))
                {
                    return p;
                }
            }
        }

        return null;
    }
105452
private void addRuntimeNameProperty() throws RepositoryException {
		
		String statement = 
				"/jcr:root" + ISO9075.encodePath(StorageConstants.REPORTS_ROOT) + 
				"//*[@className='ro.nextreports.server.domain.Report']" + 
				"//*[fn:name()='parametersValues']";
		  
		QueryResult queryResult = getTemplate().query(statement);

		NodeIterator nodes = queryResult.getNodes();
		
		LOG.info("RuntimeHistory : Found " + nodes.getSize() + " parameterValues nodes");
		while (nodes.hasNext()) {			
			Node node = nodes.nextNode();
			NodeIterator childrenIt = node.getNodes();
			while (childrenIt.hasNext()) {
				Node child = childrenIt.nextNode();				
				child.setProperty("runtimeName", child.getName());
			}
		}	
		getTemplate().save();		
	}
1331690
@Override
    public String getParameter(String name) {
        String[] vals = getParameterMap().get(name);

        return (vals != null && vals.length > 0) ? vals[0] : null;
    }
669485
@Override
	public void postPass(OptimizedPlan plan) {
		for (SinkPlanNode sink : plan.getDataSinks()) {
			traverse(sink, null, true);
		}
	}
948512
@Override
    public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
        if (index < firstNonParameterSlot) {
            start = methodEntryLabel;
        }
        super.visitLocalVariable(name, desc, signature, start, end, index);
    }
557471
public void init(final MultivaluedMap<String, String> queryParameters) {
        final String scopeCompileParam = queryParameters.getFirst(ServerAPI.SCOPE_COMPILE_PARAM);
        if(scopeCompileParam != null){
            this.scopeComp = Boolean.valueOf(scopeCompileParam);
        }
        final String scopeProvidedParam = queryParameters.getFirst(ServerAPI.SCOPE_PROVIDED_PARAM);
        if(scopeProvidedParam != null){
            this.scopePro = Boolean.valueOf(scopeProvidedParam);
        }
        final String scopeRuntimeParam = queryParameters.getFirst(ServerAPI.SCOPE_RUNTIME_PARAM);
        if(scopeRuntimeParam != null){
            this.scopeRun = Boolean.valueOf(scopeRuntimeParam);
        }
        final String scopeTestParam = queryParameters.getFirst(ServerAPI.SCOPE_TEST_PARAM);
        if(scopeTestParam != null){
            this.scopeTest = Boolean.valueOf(scopeTestParam);
        }
    }
1334264
public void addNamedParameter(String parameterName, int startIndex, int endIndex) {
		delegate.addNamedParameter(parameterName, startIndex, endIndex);
	}
514227
public void map(final UserResource user, final Principal p,
                    final Credential credential) {
        user.setUserName(p.getId());
        if (credential instanceof UsernamePasswordCredential) {
            user.setPassword(UsernamePasswordCredential.class.cast(credential).getPassword());
        }
        user.setActive(Boolean.TRUE);

        user.setNickName(getPrincipalAttributeValue(p, "nickName"));
        user.setDisplayName(getPrincipalAttributeValue(p, "displayName"));

        val name = new Name();
        name.setGivenName(getPrincipalAttributeValue(p, "givenName"));
        name.setFamilyName(getPrincipalAttributeValue(p, "familyName"));
        name.setMiddleName(getPrincipalAttributeValue(p, "middleName"));

        user.setName(name);

        val email = new Email();
        email.setPrimary(Boolean.TRUE);
        email.setValue(getPrincipalAttributeValue(p, "email"));
        user.setEmails(CollectionUtils.wrap(email));

        val phone = new PhoneNumber();
        phone.setPrimary(Boolean.TRUE);
        phone.setValue(getPrincipalAttributeValue(p, "phoneNumber"));
        user.setPhoneNumbers(CollectionUtils.wrap(phone));
    }
1124681
public MultiRuntimeDefinitionBuilder setDefaultRuntimeName(final String runtimeName){
    Validate.isTrue(StringUtils.isNotBlank(runtimeName),
            "runtimeName should be non empty and non blank string");
    this.defaultRuntime = runtimeName;
    return this;
  }
1093577
private static HotSwapPassFactory createFeatureRemovalPass(
      String passName, final Feature featureToRemove, final Feature... moreFeaturesToRemove) {
    return new HotSwapPassFactory(passName) {
      @Override
      protected HotSwapCompilerPass create(final AbstractCompiler compiler) {
        return new HotSwapCompilerPass() {
          @Override
          public void hotSwapScript(Node scriptRoot, Node originalRoot) {
            maybeMarkFeaturesAsTranspiledAway(compiler, featureToRemove, moreFeaturesToRemove);
          }

          @Override
          public void process(Node externs, Node root) {
            maybeMarkFeaturesAsTranspiledAway(compiler, featureToRemove, moreFeaturesToRemove);
          }
        };
      }

      @Override
      protected FeatureSet featureSet() {
        return FeatureSet.latest();
      }
    };
  }
599013
private static <E> void loadIntoCounter(String filename, Class<E> c, Counter<E> counter) throws RuntimeException {
    try {
      Constructor<E> m = c.getConstructor(String.class);
      BufferedReader in = IOUtils.getBufferedFileReader(filename);// new
                                                                  // BufferedReader(new
                                                                  // FileReader(filename));
      String line = in.readLine();
      while (line != null && line.length() > 0) {
        int endPos = Math.max(line.lastIndexOf(' '), line.lastIndexOf('\t'));

        counter.setCount(m.newInstance(line.substring(0, endPos).trim()), Double.parseDouble(line.substring(endPos, line.length()).trim()));

        line = in.readLine();
      }
      in.close();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
677807
private static void assertAllOneTimePasses(List<PassFactory> passes) {
    for (PassFactory pass : passes) {
      checkState(pass.isOneTimePass());
    }
  }