code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public String getWildcardString() { String result = cachedWildcardString; if(result == null) { synchronized(this) { result = cachedWildcardString; if(result == null) { if(!isPrefixed() || !isMultiple()) { result = getString(); } else if(isFullRange()) { result = IPAddress.SEGMENT_WILDCARD_STR; } else { result = getDefaultRangeString(); } cachedWildcardString = result; } } } return result; } }
public class class_name { @Override public String getWildcardString() { String result = cachedWildcardString; if(result == null) { synchronized(this) { // depends on control dependency: [if], data = [none] result = cachedWildcardString; if(result == null) { if(!isPrefixed() || !isMultiple()) { result = getString(); // depends on control dependency: [if], data = [none] } else if(isFullRange()) { result = IPAddress.SEGMENT_WILDCARD_STR; // depends on control dependency: [if], data = [none] } else { result = getDefaultRangeString(); // depends on control dependency: [if], data = [none] } cachedWildcardString = result; // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { @Override public int filter(double[] eigenValues) { // find the last eigenvector that is considered 'strong' by the weak rule // applied to the remaining vectors only double eigenValueSum = eigenValues[eigenValues.length - 1]; for(int i = eigenValues.length - 2; i >= 0; i--) { eigenValueSum += eigenValues[i]; double needEigenvalue = eigenValueSum / (eigenValues.length - i) * ralpha; if(eigenValues[i] >= needEigenvalue) { return i + 1; } } return eigenValues.length; } }
public class class_name { @Override public int filter(double[] eigenValues) { // find the last eigenvector that is considered 'strong' by the weak rule // applied to the remaining vectors only double eigenValueSum = eigenValues[eigenValues.length - 1]; for(int i = eigenValues.length - 2; i >= 0; i--) { eigenValueSum += eigenValues[i]; // depends on control dependency: [for], data = [i] double needEigenvalue = eigenValueSum / (eigenValues.length - i) * ralpha; if(eigenValues[i] >= needEigenvalue) { return i + 1; // depends on control dependency: [if], data = [none] } } return eigenValues.length; } }
public class class_name { public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) { if (softwareModules == null) { softwareModules = new ArrayList<>(); } softwareModules.add(createSoftwareModule); } }
public class class_name { public void addSoftwareModule(final DmfSoftwareModule createSoftwareModule) { if (softwareModules == null) { softwareModules = new ArrayList<>(); // depends on control dependency: [if], data = [none] } softwareModules.add(createSoftwareModule); } }
public class class_name { private Checkpoints getBWCheckpoints(Bw bwService) { for (Object o : bwService.getRest()) { if (o.getClass().equals(Checkpoints.class)) { return (Checkpoints) o; } } return null; } }
public class class_name { private Checkpoints getBWCheckpoints(Bw bwService) { for (Object o : bwService.getRest()) { if (o.getClass().equals(Checkpoints.class)) { return (Checkpoints) o; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public CmsContainerConfiguration getConfiguration(String name) { Map<String, CmsContainerConfiguration> configurationsForLocale = null; if (m_configurations.containsKey(CmsLocaleManager.MASTER_LOCALE)) { configurationsForLocale = m_configurations.get(CmsLocaleManager.MASTER_LOCALE); } else if (!m_configurations.isEmpty()) { configurationsForLocale = m_configurations.values().iterator().next(); } else { return null; } return configurationsForLocale.get(name); } }
public class class_name { public CmsContainerConfiguration getConfiguration(String name) { Map<String, CmsContainerConfiguration> configurationsForLocale = null; if (m_configurations.containsKey(CmsLocaleManager.MASTER_LOCALE)) { configurationsForLocale = m_configurations.get(CmsLocaleManager.MASTER_LOCALE); // depends on control dependency: [if], data = [none] } else if (!m_configurations.isEmpty()) { configurationsForLocale = m_configurations.values().iterator().next(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } return configurationsForLocale.get(name); } }
public class class_name { private PopupMenu createMenu(View v, String[] menuArray) { PopupMenu popupMenu = new PopupMenu(this, v); Menu menu = popupMenu.getMenu(); for (int i = 0; i < menuArray.length; i++) { String menuText = menuArray[i]; menu.add(0, i, i, menuText); } return popupMenu; } }
public class class_name { private PopupMenu createMenu(View v, String[] menuArray) { PopupMenu popupMenu = new PopupMenu(this, v); Menu menu = popupMenu.getMenu(); for (int i = 0; i < menuArray.length; i++) { String menuText = menuArray[i]; menu.add(0, i, i, menuText); // depends on control dependency: [for], data = [i] } return popupMenu; } }
public class class_name { private static IndexableExpression getIndexableExpressionFromFilters( ExpressionType targetComparator, ExpressionType altTargetComparator, AbstractExpression coveringExpr, int coveringColId, StmtTableScan tableScan, List<AbstractExpression> filtersToCover, boolean allowIndexedJoinFilters, boolean filterAction) { List<AbstractExpression> binding = null; AbstractExpression indexableExpr = null; AbstractExpression otherExpr = null; ComparisonExpression normalizedExpr = null; AbstractExpression originalFilter = null; for (AbstractExpression filter : filtersToCover) { // ENG-8203: Not going to try to use index with sub-query expression if (filter.hasSubquerySubexpression()) { // Including RowSubqueryExpression and SelectSubqueryExpression // SelectSubqueryExpression also can be scalar sub-query continue; } // Expression type must be resolvable by an index scan if ((filter.getExpressionType() == targetComparator) || (filter.getExpressionType() == altTargetComparator)) { normalizedExpr = (ComparisonExpression) filter; indexableExpr = filter.getLeft(); otherExpr = filter.getRight(); binding = bindingIfValidIndexedFilterOperand(tableScan, indexableExpr, otherExpr, coveringExpr, coveringColId); if (binding != null) { if ( ! allowIndexedJoinFilters) { if (otherExpr.hasTupleValueSubexpression()) { // This filter can not be used with the index, possibly due to interactions // wih IN LIST processing that would require a three-way NLIJ. binding = null; continue; } } // Additional restrictions apply to LIKE pattern arguments if (targetComparator == ExpressionType.COMPARE_LIKE) { if (otherExpr instanceof ParameterValueExpression) { ParameterValueExpression pve = (ParameterValueExpression)otherExpr; // Can't use an index for parameterized LIKE filters, // e.g. "T1.column LIKE ?" // UNLESS the parameter was artificially substituted // for a user-specified constant AND that constant was a prefix pattern. // In that case, the parameter has to be added to the bound list // for this index/statement. ConstantValueExpression cve = pve.getOriginalValue(); if (cve == null || ! cve.isPrefixPatternString()) { binding = null; // the filter is not usable, so the binding is invalid continue; } // Remember that the binding list returned by // bindingIfValidIndexedFilterOperand above // is often a "shared object" and is intended to be treated as immutable. // To add a parameter to it, first copy the List. List<AbstractExpression> moreBinding = new ArrayList<>(binding); moreBinding.add(pve); binding = moreBinding; } else if (otherExpr instanceof ConstantValueExpression) { // Can't use an index for non-prefix LIKE filters, // e.g. " T1.column LIKE '%ish' " ConstantValueExpression cve = (ConstantValueExpression)otherExpr; if ( ! cve.isPrefixPatternString()) { // The constant is not an index-friendly prefix pattern. binding = null; // the filter is not usable, so the binding is invalid continue; } } else { // Other cases are not indexable, e.g. " T1.column LIKE T2.column " binding = null; // the filter is not usable, so the binding is invalid continue; } } if (targetComparator == ExpressionType.COMPARE_IN) { if (otherExpr.hasTupleValueSubexpression()) { // This is a fancy edge case where the expression could only be indexed // if it: // A) does not reference the indexed table and // B) has ee support for a three-way NLIJ where the table referenced in // the list element expression feeds values from its current row to the // Materialized scan which then re-evaluates its expressions to // re-populate the temp table that drives the injected NLIJ with // this index scan. // This is a slightly more twisted variant of the three-way NLIJ that // would be needed to support compound key indexing on a combination // of (fixed) IN LIST elements and join key values from other tables. // Punt for now on indexing this IN LIST filter. binding = null; // the filter is not usable, so the binding is invalid continue; } if (otherExpr instanceof ParameterValueExpression) { // It's OK to use an index for a parameterized IN filter, // e.g. "T1.column IN ?" // EVEN if the parameter was -- someday -- artificially substituted // for an entire user-specified list of constants. // As of now, that is beyond the capabilities of the ad hoc statement // parameterizer, so "T1.column IN (3, 4)" can use the plan for // "T1.column IN (?, ?)" that might have been originally cached for // "T1.column IN (1, 2)" but "T1.column IN (1, 2, 3)" would need its own // "T1.column IN (?, ?, ?)" plan, etc. per list element count. } //TODO: Some day, there may be an optimization here that allows an entire // IN LIST of constants to be serialized as a single value instead of a // VectorValue composed of ConstantValue arguments. // What's TBD is whether that would get its own AbstractExpression class or // just be a special case of ConstantValueExpression. else { assert (otherExpr instanceof VectorValueExpression); } } originalFilter = filter; if (filterAction == EXCLUDE_FROM_POST_FILTERS) { filtersToCover.remove(filter); } break; } } if ((filter.getExpressionType() == ComparisonExpression.reverses.get(targetComparator)) || (filter.getExpressionType() == ComparisonExpression.reverses.get(altTargetComparator))) { normalizedExpr = (ComparisonExpression) filter; normalizedExpr = normalizedExpr.reverseOperator(); indexableExpr = filter.getRight(); otherExpr = filter.getLeft(); binding = bindingIfValidIndexedFilterOperand(tableScan, indexableExpr, otherExpr, coveringExpr, coveringColId); if (binding != null) { if ( ! allowIndexedJoinFilters) { if (otherExpr.hasTupleValueSubexpression()) { // This filter can not be used with the index, probably due to interactions // with IN LIST processing of another key component that would require a // three-way NLIJ to be injected. binding = null; continue; } } originalFilter = filter; if (filterAction == EXCLUDE_FROM_POST_FILTERS) { filtersToCover.remove(filter); } break; } } } if (binding == null) { // ran out of candidate filters. return null; } return new IndexableExpression(originalFilter, normalizedExpr, binding); } }
public class class_name { private static IndexableExpression getIndexableExpressionFromFilters( ExpressionType targetComparator, ExpressionType altTargetComparator, AbstractExpression coveringExpr, int coveringColId, StmtTableScan tableScan, List<AbstractExpression> filtersToCover, boolean allowIndexedJoinFilters, boolean filterAction) { List<AbstractExpression> binding = null; AbstractExpression indexableExpr = null; AbstractExpression otherExpr = null; ComparisonExpression normalizedExpr = null; AbstractExpression originalFilter = null; for (AbstractExpression filter : filtersToCover) { // ENG-8203: Not going to try to use index with sub-query expression if (filter.hasSubquerySubexpression()) { // Including RowSubqueryExpression and SelectSubqueryExpression // SelectSubqueryExpression also can be scalar sub-query continue; } // Expression type must be resolvable by an index scan if ((filter.getExpressionType() == targetComparator) || (filter.getExpressionType() == altTargetComparator)) { normalizedExpr = (ComparisonExpression) filter; // depends on control dependency: [if], data = [none] indexableExpr = filter.getLeft(); // depends on control dependency: [if], data = [none] otherExpr = filter.getRight(); // depends on control dependency: [if], data = [none] binding = bindingIfValidIndexedFilterOperand(tableScan, indexableExpr, otherExpr, coveringExpr, coveringColId); // depends on control dependency: [if], data = [none] if (binding != null) { if ( ! allowIndexedJoinFilters) { if (otherExpr.hasTupleValueSubexpression()) { // This filter can not be used with the index, possibly due to interactions // wih IN LIST processing that would require a three-way NLIJ. binding = null; // depends on control dependency: [if], data = [none] continue; } } // Additional restrictions apply to LIKE pattern arguments if (targetComparator == ExpressionType.COMPARE_LIKE) { if (otherExpr instanceof ParameterValueExpression) { ParameterValueExpression pve = (ParameterValueExpression)otherExpr; // Can't use an index for parameterized LIKE filters, // e.g. "T1.column LIKE ?" // UNLESS the parameter was artificially substituted // for a user-specified constant AND that constant was a prefix pattern. // In that case, the parameter has to be added to the bound list // for this index/statement. ConstantValueExpression cve = pve.getOriginalValue(); if (cve == null || ! cve.isPrefixPatternString()) { binding = null; // the filter is not usable, so the binding is invalid // depends on control dependency: [if], data = [none] continue; } // Remember that the binding list returned by // bindingIfValidIndexedFilterOperand above // is often a "shared object" and is intended to be treated as immutable. // To add a parameter to it, first copy the List. List<AbstractExpression> moreBinding = new ArrayList<>(binding); moreBinding.add(pve); // depends on control dependency: [if], data = [none] binding = moreBinding; // depends on control dependency: [if], data = [none] } else if (otherExpr instanceof ConstantValueExpression) { // Can't use an index for non-prefix LIKE filters, // e.g. " T1.column LIKE '%ish' " ConstantValueExpression cve = (ConstantValueExpression)otherExpr; if ( ! cve.isPrefixPatternString()) { // The constant is not an index-friendly prefix pattern. binding = null; // the filter is not usable, so the binding is invalid // depends on control dependency: [if], data = [none] continue; } } else { // Other cases are not indexable, e.g. " T1.column LIKE T2.column " binding = null; // the filter is not usable, so the binding is invalid // depends on control dependency: [if], data = [none] continue; } } if (targetComparator == ExpressionType.COMPARE_IN) { if (otherExpr.hasTupleValueSubexpression()) { // This is a fancy edge case where the expression could only be indexed // if it: // A) does not reference the indexed table and // B) has ee support for a three-way NLIJ where the table referenced in // the list element expression feeds values from its current row to the // Materialized scan which then re-evaluates its expressions to // re-populate the temp table that drives the injected NLIJ with // this index scan. // This is a slightly more twisted variant of the three-way NLIJ that // would be needed to support compound key indexing on a combination // of (fixed) IN LIST elements and join key values from other tables. // Punt for now on indexing this IN LIST filter. binding = null; // the filter is not usable, so the binding is invalid // depends on control dependency: [if], data = [none] continue; } if (otherExpr instanceof ParameterValueExpression) { // It's OK to use an index for a parameterized IN filter, // e.g. "T1.column IN ?" // EVEN if the parameter was -- someday -- artificially substituted // for an entire user-specified list of constants. // As of now, that is beyond the capabilities of the ad hoc statement // parameterizer, so "T1.column IN (3, 4)" can use the plan for // "T1.column IN (?, ?)" that might have been originally cached for // "T1.column IN (1, 2)" but "T1.column IN (1, 2, 3)" would need its own // "T1.column IN (?, ?, ?)" plan, etc. per list element count. } //TODO: Some day, there may be an optimization here that allows an entire // IN LIST of constants to be serialized as a single value instead of a // VectorValue composed of ConstantValue arguments. // What's TBD is whether that would get its own AbstractExpression class or // just be a special case of ConstantValueExpression. else { assert (otherExpr instanceof VectorValueExpression); // depends on control dependency: [if], data = [none] } } originalFilter = filter; // depends on control dependency: [if], data = [none] if (filterAction == EXCLUDE_FROM_POST_FILTERS) { filtersToCover.remove(filter); // depends on control dependency: [if], data = [none] } break; } } if ((filter.getExpressionType() == ComparisonExpression.reverses.get(targetComparator)) || (filter.getExpressionType() == ComparisonExpression.reverses.get(altTargetComparator))) { normalizedExpr = (ComparisonExpression) filter; // depends on control dependency: [if], data = [none] normalizedExpr = normalizedExpr.reverseOperator(); // depends on control dependency: [if], data = [none] indexableExpr = filter.getRight(); // depends on control dependency: [if], data = [none] otherExpr = filter.getLeft(); // depends on control dependency: [if], data = [none] binding = bindingIfValidIndexedFilterOperand(tableScan, indexableExpr, otherExpr, coveringExpr, coveringColId); // depends on control dependency: [if], data = [none] if (binding != null) { if ( ! allowIndexedJoinFilters) { if (otherExpr.hasTupleValueSubexpression()) { // This filter can not be used with the index, probably due to interactions // with IN LIST processing of another key component that would require a // three-way NLIJ to be injected. binding = null; // depends on control dependency: [if], data = [none] continue; } } originalFilter = filter; // depends on control dependency: [if], data = [none] if (filterAction == EXCLUDE_FROM_POST_FILTERS) { filtersToCover.remove(filter); // depends on control dependency: [if], data = [none] } break; } } } if (binding == null) { // ran out of candidate filters. return null; // depends on control dependency: [if], data = [none] } return new IndexableExpression(originalFilter, normalizedExpr, binding); } }
public class class_name { @EnsuresNonNull("compiledScript") private JavaScriptAggregator.ScriptAggregator getCompiledScript() { // JavaScript configuration should be checked when it's actually used because someone might still want Druid // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled. Preconditions.checkState(config.isEnabled(), "JavaScript is disabled"); JavaScriptAggregator.ScriptAggregator syncedCompiledScript = compiledScript; if (syncedCompiledScript == null) { synchronized (config) { syncedCompiledScript = compiledScript; if (syncedCompiledScript == null) { syncedCompiledScript = compileScript(fnAggregate, fnReset, fnCombine); compiledScript = syncedCompiledScript; } } } return syncedCompiledScript; } }
public class class_name { @EnsuresNonNull("compiledScript") private JavaScriptAggregator.ScriptAggregator getCompiledScript() { // JavaScript configuration should be checked when it's actually used because someone might still want Druid // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled. Preconditions.checkState(config.isEnabled(), "JavaScript is disabled"); JavaScriptAggregator.ScriptAggregator syncedCompiledScript = compiledScript; if (syncedCompiledScript == null) { synchronized (config) { // depends on control dependency: [if], data = [none] syncedCompiledScript = compiledScript; if (syncedCompiledScript == null) { syncedCompiledScript = compileScript(fnAggregate, fnReset, fnCombine); // depends on control dependency: [if], data = [none] compiledScript = syncedCompiledScript; // depends on control dependency: [if], data = [none] } } } return syncedCompiledScript; } }
public class class_name { public Float getAsFloat(String key) { Object value = mValues.get(key); try { return value != null ? ((Number) value).floatValue() : null; } catch (ClassCastException e) { if (value instanceof CharSequence) { try { return Float.valueOf(value.toString()); } catch (NumberFormatException e2) { DLog.e(TAG, "Cannot parse Float value for " + value + " at key " + key); return null; } } else { DLog.e(TAG, "Cannot cast value for " + key + " to a Float: " + value, e); return null; } } } }
public class class_name { public Float getAsFloat(String key) { Object value = mValues.get(key); try { return value != null ? ((Number) value).floatValue() : null; // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { if (value instanceof CharSequence) { try { return Float.valueOf(value.toString()); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e2) { DLog.e(TAG, "Cannot parse Float value for " + value + " at key " + key); return null; } // depends on control dependency: [catch], data = [none] } else { DLog.e(TAG, "Cannot cast value for " + key + " to a Float: " + value, e); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; } mFakeDragging = true; setScrollState(SCROLL_STATE_DRAGGING); mInitialMotionY = mLastMotionY = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } else { mVelocityTracker.clear(); } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; } }
public class class_name { public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; // depends on control dependency: [if], data = [none] } mFakeDragging = true; setScrollState(SCROLL_STATE_DRAGGING); mInitialMotionY = mLastMotionY = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); // depends on control dependency: [if], data = [none] } else { mVelocityTracker.clear(); // depends on control dependency: [if], data = [none] } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; } }
public class class_name { private Representation createRepresentation(Representation representation) throws DDFException { Collection<Representation> vertices = this.mReps.values(); //List<GraphPath<Representation<?>, ConvertFunction<?, ?>>> pathList = new ArrayList<GraphPath<Representation<?>, ConvertFunction<?, ?>>>(); double minWeight = Double.MAX_VALUE; GraphPath<Representation, ConvertFunction> minPath = null; for (Representation vertex : vertices) { mLog.info(">>>>>> start vertex = " + vertex.getTypeSpecsString()); mLog.info(">>>>>> end Vertex = " + representation.getTypeSpecsString()); GraphPath<Representation, ConvertFunction> shortestPath = this.mGraph.getShortestPath(vertex, representation); if (shortestPath != null) { mLog.info(">>>> shortestPath != null"); if (shortestPath.getWeight() < minWeight) { minWeight = shortestPath.getWeight(); minPath = shortestPath; } } } if (minPath == null) { return null; } else { Representation startVertex = minPath.getStartVertex(); Representation startRepresentation = null; for (Representation rep : this.mReps.values()) { if (rep.equals(startVertex)) { startRepresentation = rep; } } mLog.info("minPath.getWeight = " + minPath.getWeight()); mLog.info("minPath.lenth = " + minPath.getEdgeList().size()); mLog.info("startVertext = " + minPath.getStartVertex().getTypeSpecsString()); mLog.info("endVertex = " + minPath.getEndVertex().getTypeSpecsString()); List<ConvertFunction> convertFunctions = minPath.getEdgeList(); Representation objectRepresentation = startRepresentation; for (ConvertFunction func : convertFunctions) { objectRepresentation = func.apply(objectRepresentation); } return objectRepresentation; } } }
public class class_name { private Representation createRepresentation(Representation representation) throws DDFException { Collection<Representation> vertices = this.mReps.values(); //List<GraphPath<Representation<?>, ConvertFunction<?, ?>>> pathList = new ArrayList<GraphPath<Representation<?>, ConvertFunction<?, ?>>>(); double minWeight = Double.MAX_VALUE; GraphPath<Representation, ConvertFunction> minPath = null; for (Representation vertex : vertices) { mLog.info(">>>>>> start vertex = " + vertex.getTypeSpecsString()); mLog.info(">>>>>> end Vertex = " + representation.getTypeSpecsString()); GraphPath<Representation, ConvertFunction> shortestPath = this.mGraph.getShortestPath(vertex, representation); if (shortestPath != null) { mLog.info(">>>> shortestPath != null"); // depends on control dependency: [if], data = [none] if (shortestPath.getWeight() < minWeight) { minWeight = shortestPath.getWeight(); // depends on control dependency: [if], data = [none] minPath = shortestPath; // depends on control dependency: [if], data = [none] } } } if (minPath == null) { return null; } else { Representation startVertex = minPath.getStartVertex(); Representation startRepresentation = null; for (Representation rep : this.mReps.values()) { if (rep.equals(startVertex)) { startRepresentation = rep; } } mLog.info("minPath.getWeight = " + minPath.getWeight()); mLog.info("minPath.lenth = " + minPath.getEdgeList().size()); mLog.info("startVertext = " + minPath.getStartVertex().getTypeSpecsString()); mLog.info("endVertex = " + minPath.getEndVertex().getTypeSpecsString()); List<ConvertFunction> convertFunctions = minPath.getEdgeList(); Representation objectRepresentation = startRepresentation; for (ConvertFunction func : convertFunctions) { objectRepresentation = func.apply(objectRepresentation); } return objectRepresentation; } } }
public class class_name { public void clean() { if (!remove(this)) return; try { thunk.run(); } catch (final Throwable x) { AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { if (System.err != null) new Error("Cleaner terminated abnormally", x) .printStackTrace(); System.exit(1); return null; }}); } } }
public class class_name { public void clean() { if (!remove(this)) return; try { thunk.run(); // depends on control dependency: [try], data = [none] } catch (final Throwable x) { AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void run() { if (System.err != null) new Error("Cleaner terminated abnormally", x) .printStackTrace(); System.exit(1); return null; }}); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Expression parseSemVerExpression() { Expression expr; if (tokens.positiveLookahead(NOT)) { tokens.consume(); consumeNextToken(LEFT_PAREN); expr = new Not(parseSemVerExpression()); consumeNextToken(RIGHT_PAREN); } else if (tokens.positiveLookahead(LEFT_PAREN)) { consumeNextToken(LEFT_PAREN); expr = parseSemVerExpression(); consumeNextToken(RIGHT_PAREN); } else { expr = parseExpression(); } return parseBooleanExpression(expr); } }
public class class_name { private Expression parseSemVerExpression() { Expression expr; if (tokens.positiveLookahead(NOT)) { tokens.consume(); // depends on control dependency: [if], data = [none] consumeNextToken(LEFT_PAREN); // depends on control dependency: [if], data = [none] expr = new Not(parseSemVerExpression()); // depends on control dependency: [if], data = [none] consumeNextToken(RIGHT_PAREN); // depends on control dependency: [if], data = [none] } else if (tokens.positiveLookahead(LEFT_PAREN)) { consumeNextToken(LEFT_PAREN); // depends on control dependency: [if], data = [none] expr = parseSemVerExpression(); // depends on control dependency: [if], data = [none] consumeNextToken(RIGHT_PAREN); // depends on control dependency: [if], data = [none] } else { expr = parseExpression(); // depends on control dependency: [if], data = [none] } return parseBooleanExpression(expr); } }
public class class_name { private void setJoin(List<T> models) { if (null == models || models.isEmpty() || joinParams.size() == 0) { return; } models.stream().filter(Objects::nonNull).forEach(this::setJoin); } }
public class class_name { private void setJoin(List<T> models) { if (null == models || models.isEmpty() || joinParams.size() == 0) { return; // depends on control dependency: [if], data = [none] } models.stream().filter(Objects::nonNull).forEach(this::setJoin); } }
public class class_name { private static PermutationParity fill3DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected, Point3d[] coordinates, int offset) { int i = 0; int[] indices = new int[2]; for (IBond bond : connected) { if (!isDoubleBond(bond)) { IAtom other = bond.getOther(a); coordinates[i + offset] = other.getPoint3d(); indices[i] = container.indexOf(other); i++; } } // only one connection, use the coordinate of 'a' if (i == 1) { coordinates[offset + 1] = a.getPoint3d(); return PermutationParity.IDENTITY; } else { return new BasicPermutationParity(indices); } } }
public class class_name { private static PermutationParity fill3DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected, Point3d[] coordinates, int offset) { int i = 0; int[] indices = new int[2]; for (IBond bond : connected) { if (!isDoubleBond(bond)) { IAtom other = bond.getOther(a); coordinates[i + offset] = other.getPoint3d(); // depends on control dependency: [if], data = [none] indices[i] = container.indexOf(other); // depends on control dependency: [if], data = [none] i++; // depends on control dependency: [if], data = [none] } } // only one connection, use the coordinate of 'a' if (i == 1) { coordinates[offset + 1] = a.getPoint3d(); // depends on control dependency: [if], data = [none] return PermutationParity.IDENTITY; // depends on control dependency: [if], data = [none] } else { return new BasicPermutationParity(indices); // depends on control dependency: [if], data = [(i] } } }
public class class_name { public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily().getLength() == 0) { return new RowColumn(row); } Bytes cf = ByteUtil.toBytes(key.getColumnFamily()); if ((key.getColumnQualifier() == null) || key.getColumnQualifier().getLength() == 0) { return new RowColumn(row, new Column(cf)); } Bytes cq = ByteUtil.toBytes(key.getColumnQualifier()); if ((key.getColumnVisibility() == null) || key.getColumnVisibility().getLength() == 0) { return new RowColumn(row, new Column(cf, cq)); } Bytes cv = ByteUtil.toBytes(key.getColumnVisibility()); return new RowColumn(row, new Column(cf, cq, cv)); } }
public class class_name { public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; // depends on control dependency: [if], data = [none] } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; // depends on control dependency: [if], data = [none] } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily().getLength() == 0) { return new RowColumn(row); // depends on control dependency: [if], data = [none] } Bytes cf = ByteUtil.toBytes(key.getColumnFamily()); if ((key.getColumnQualifier() == null) || key.getColumnQualifier().getLength() == 0) { return new RowColumn(row, new Column(cf)); // depends on control dependency: [if], data = [none] } Bytes cq = ByteUtil.toBytes(key.getColumnQualifier()); if ((key.getColumnVisibility() == null) || key.getColumnVisibility().getLength() == 0) { return new RowColumn(row, new Column(cf, cq)); // depends on control dependency: [if], data = [none] } Bytes cv = ByteUtil.toBytes(key.getColumnVisibility()); return new RowColumn(row, new Column(cf, cq, cv)); } }
public class class_name { @Override public void run(final IAction action) { if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) { return; } IStructuredSelection structuredSelection = (IStructuredSelection) selection; IProject project = getProject(structuredSelection); if (project == null) { return; } // Get the file name from a file dialog FileDialog dialog = createFileDialog(project); boolean validFileName = false; do { String fileName = openFileDialog(dialog); if (fileName == null) { // user cancel return; } validFileName = validateSelectedFileName(fileName); if (!validFileName) { MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning", fileName + " is not a file or is not readable!"); continue; } getDialogSettings().put(LOAD_XML_PATH_KEY, fileName); work(project, fileName); } while (!validFileName); } }
public class class_name { @Override public void run(final IAction action) { if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) { return; // depends on control dependency: [if], data = [none] } IStructuredSelection structuredSelection = (IStructuredSelection) selection; IProject project = getProject(structuredSelection); if (project == null) { return; // depends on control dependency: [if], data = [none] } // Get the file name from a file dialog FileDialog dialog = createFileDialog(project); boolean validFileName = false; do { String fileName = openFileDialog(dialog); if (fileName == null) { // user cancel return; // depends on control dependency: [if], data = [none] } validFileName = validateSelectedFileName(fileName); if (!validFileName) { MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning", fileName + " is not a file or is not readable!"); // depends on control dependency: [if], data = [none] continue; } getDialogSettings().put(LOAD_XML_PATH_KEY, fileName); work(project, fileName); } while (!validFileName); } }
public class class_name { private Stream<Quad> fetchContainmentQuads() { if (getInteractionModel().getIRIString().endsWith("Container")) { final Query q = new Query(); q.setQuerySelectType(); q.addResultVar(OBJECT); final ElementPathBlock epb = new ElementPathBlock(); epb.addTriple(create(OBJECT, rdf.asJenaNode(DC.isPartOf), rdf.asJenaNode(identifier))); final ElementNamedGraph ng = new ElementNamedGraph(rdf.asJenaNode(Trellis.PreferServerManaged), epb); final ElementGroup elg = new ElementGroup(); elg.addElement(ng); q.setQueryPattern(elg); final Stream.Builder<Quad> builder = builder(); rdfConnection.querySelect(q, qs -> builder.accept(rdf.createQuad(LDP.PreferContainment, identifier, LDP.contains, getObject(qs)))); return builder.build(); } return Stream.empty(); } }
public class class_name { private Stream<Quad> fetchContainmentQuads() { if (getInteractionModel().getIRIString().endsWith("Container")) { final Query q = new Query(); q.setQuerySelectType(); // depends on control dependency: [if], data = [none] q.addResultVar(OBJECT); // depends on control dependency: [if], data = [none] final ElementPathBlock epb = new ElementPathBlock(); epb.addTriple(create(OBJECT, rdf.asJenaNode(DC.isPartOf), rdf.asJenaNode(identifier))); // depends on control dependency: [if], data = [none] final ElementNamedGraph ng = new ElementNamedGraph(rdf.asJenaNode(Trellis.PreferServerManaged), epb); final ElementGroup elg = new ElementGroup(); elg.addElement(ng); // depends on control dependency: [if], data = [none] q.setQueryPattern(elg); // depends on control dependency: [if], data = [none] final Stream.Builder<Quad> builder = builder(); rdfConnection.querySelect(q, qs -> builder.accept(rdf.createQuad(LDP.PreferContainment, identifier, LDP.contains, getObject(qs)))); // depends on control dependency: [if], data = [none] return builder.build(); // depends on control dependency: [if], data = [none] } return Stream.empty(); } }
public class class_name { public static Buffer[] consumeGenericParam(final Buffer buffer) throws IndexOutOfBoundsException, IOException { final Buffer key = consumeToken(buffer); Buffer value = null; if (key == null) { return new Buffer[2]; } if (consumeEQUAL(buffer) > 0) { // TODO: consume host and quoted string if (isNext(buffer, DOUBLE_QOUTE)) { value = consumeQuotedString(buffer); } else { value = consumeToken(buffer); } } return new Buffer[] { key, value }; } }
public class class_name { public static Buffer[] consumeGenericParam(final Buffer buffer) throws IndexOutOfBoundsException, IOException { final Buffer key = consumeToken(buffer); Buffer value = null; if (key == null) { return new Buffer[2]; } if (consumeEQUAL(buffer) > 0) { // TODO: consume host and quoted string if (isNext(buffer, DOUBLE_QOUTE)) { value = consumeQuotedString(buffer); // depends on control dependency: [if], data = [none] } else { value = consumeToken(buffer); // depends on control dependency: [if], data = [none] } } return new Buffer[] { key, value }; } }
public class class_name { private void parseNamedAttributes(Node parent) throws JasperException { do { Mark start = reader.mark(); Attributes attrs = parseAttributes(); if (attrs == null || attrs.getValue("name") == null) { err.jspError(start, "jsp.error.jspAttribute.missing.name"); } Node.NamedAttribute namedAttributeNode = new Node.NamedAttribute( attrs, start, parent ); reader.skipSpaces(); if (!reader.matches("/>")) { if (!reader.matches(">")) { err.jspError(start, "jsp.error.unterminated", "&lt;jsp:attribute"); } if (namedAttributeNode.isTrim()) { reader.skipSpaces(); } parseBody(namedAttributeNode, "jsp:attribute", getAttributeBodyType(parent, attrs.getValue("name"))); if (namedAttributeNode.isTrim()) { Node.Nodes subElems = namedAttributeNode.getBody(); if (subElems != null) { Node lastNode = subElems.getNode(subElems.size() - 1); if (lastNode instanceof Node.TemplateText) { ((Node.TemplateText)lastNode).rtrim(); } } } } reader.skipSpaces(); } while( reader.matches( "<jsp:attribute" ) ); } }
public class class_name { private void parseNamedAttributes(Node parent) throws JasperException { do { Mark start = reader.mark(); Attributes attrs = parseAttributes(); if (attrs == null || attrs.getValue("name") == null) { err.jspError(start, "jsp.error.jspAttribute.missing.name"); } Node.NamedAttribute namedAttributeNode = new Node.NamedAttribute( attrs, start, parent ); reader.skipSpaces(); if (!reader.matches("/>")) { if (!reader.matches(">")) { err.jspError(start, "jsp.error.unterminated", "&lt;jsp:attribute"); // depends on control dependency: [if], data = [none] } if (namedAttributeNode.isTrim()) { reader.skipSpaces(); // depends on control dependency: [if], data = [none] } parseBody(namedAttributeNode, "jsp:attribute", getAttributeBodyType(parent, attrs.getValue("name"))); if (namedAttributeNode.isTrim()) { Node.Nodes subElems = namedAttributeNode.getBody(); if (subElems != null) { Node lastNode = subElems.getNode(subElems.size() - 1); if (lastNode instanceof Node.TemplateText) { ((Node.TemplateText)lastNode).rtrim(); // depends on control dependency: [if], data = [none] } } } } reader.skipSpaces(); } while( reader.matches( "<jsp:attribute" ) ); } }
public class class_name { public String[] arrayEscapeXml(final Object[] target) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = escapeXml(target[i]); } return result; } }
public class class_name { public String[] arrayEscapeXml(final Object[] target) { if (target == null) { return null; // depends on control dependency: [if], data = [none] } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = escapeXml(target[i]); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { private boolean doTryInsertNoLock(S storable) { // Create a fresh copy to ensure that custom fields are not saved. S copy = (S) storable.prepare(); storable.copyAllProperties(copy); copy.markAllPropertiesClean(); Key<S> key = new Key<S>(copy, mFullComparator); S existing = mMap.get(key); if (existing != null) { return false; } mMap.put(key, copy); storable.markAllPropertiesClean(); return true; } }
public class class_name { private boolean doTryInsertNoLock(S storable) { // Create a fresh copy to ensure that custom fields are not saved. S copy = (S) storable.prepare(); storable.copyAllProperties(copy); copy.markAllPropertiesClean(); Key<S> key = new Key<S>(copy, mFullComparator); S existing = mMap.get(key); if (existing != null) { return false; // depends on control dependency: [if], data = [none] } mMap.put(key, copy); storable.markAllPropertiesClean(); return true; } }
public class class_name { private static boolean hasSingleValueWithDefaultKey(AnnotationMirror annotation) { if (annotation.getElementValues().size() != 1) { return false; } ExecutableElement key = getOnlyElement(annotation.getElementValues().keySet()); return key.getSimpleName().contentEquals("value"); } }
public class class_name { private static boolean hasSingleValueWithDefaultKey(AnnotationMirror annotation) { if (annotation.getElementValues().size() != 1) { return false; // depends on control dependency: [if], data = [none] } ExecutableElement key = getOnlyElement(annotation.getElementValues().keySet()); return key.getSimpleName().contentEquals("value"); } }
public class class_name { public NodeIterator getNodes() throws RepositoryException { if (SessionImpl.FORCE_USE_GET_NODES_LAZILY) { if (LOG.isDebugEnabled()) { LOG .debug("EXPERIMENTAL! Be aware that \"getNodesLazily()\" feature is used instead of JCR API getNodes()" + " invocation.To disable this simply cleanup system property \"org.exoplatform.jcr.forceUserGetNodesLazily\"" + " and restart JCR."); } return getNodesLazily(); } long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getNodes() >>>>>"); } checkValid(); try { List<NodeData> childs = childNodesData(); if (childs.size() < session.getLazyReadThreshold()) { // full iterator List<NodeImpl> nodes = new ArrayList<NodeImpl>(); for (int i = 0, length = childs.size(); i < length; i++) { NodeData child = childs.get(i); if (session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ}, session.getUserState().getIdentity())) { NodeImpl item = (NodeImpl)dataManager.readItem(child, nodeData(), true, false); session.getActionHandler().postRead(item); nodes.add(item); } } return new EntityCollection(nodes); } else { // lazy iterator return new LazyNodeIterator(childs); } } finally { if (LOG.isDebugEnabled()) { LOG.debug("getNodes() <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } } }
public class class_name { public NodeIterator getNodes() throws RepositoryException { if (SessionImpl.FORCE_USE_GET_NODES_LAZILY) { if (LOG.isDebugEnabled()) { LOG .debug("EXPERIMENTAL! Be aware that \"getNodesLazily()\" feature is used instead of JCR API getNodes()" + " invocation.To disable this simply cleanup system property \"org.exoplatform.jcr.forceUserGetNodesLazily\"" + " and restart JCR."); // depends on control dependency: [if], data = [none] } return getNodesLazily(); } long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getNodes() >>>>>"); } checkValid(); try { List<NodeData> childs = childNodesData(); if (childs.size() < session.getLazyReadThreshold()) { // full iterator List<NodeImpl> nodes = new ArrayList<NodeImpl>(); for (int i = 0, length = childs.size(); i < length; i++) { NodeData child = childs.get(i); if (session.getAccessManager().hasPermission(child.getACL(), new String[]{PermissionType.READ}, session.getUserState().getIdentity())) { NodeImpl item = (NodeImpl)dataManager.readItem(child, nodeData(), true, false); session.getActionHandler().postRead(item); // depends on control dependency: [if], data = [none] nodes.add(item); // depends on control dependency: [if], data = [none] } } return new EntityCollection(nodes); // depends on control dependency: [if], data = [none] } else { // lazy iterator return new LazyNodeIterator(childs); // depends on control dependency: [if], data = [none] } } finally { if (LOG.isDebugEnabled()) { LOG.debug("getNodes() <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(S3DestinationUpdate s3DestinationUpdate, ProtocolMarshaller protocolMarshaller) { if (s3DestinationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3DestinationUpdate.getRoleARN(), ROLEARN_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getBucketARN(), BUCKETARN_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getPrefix(), PREFIX_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getErrorOutputPrefix(), ERROROUTPUTPREFIX_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getBufferingHints(), BUFFERINGHINTS_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getCompressionFormat(), COMPRESSIONFORMAT_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getEncryptionConfiguration(), ENCRYPTIONCONFIGURATION_BINDING); protocolMarshaller.marshall(s3DestinationUpdate.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(S3DestinationUpdate s3DestinationUpdate, ProtocolMarshaller protocolMarshaller) { if (s3DestinationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3DestinationUpdate.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getBucketARN(), BUCKETARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getPrefix(), PREFIX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getErrorOutputPrefix(), ERROROUTPUTPREFIX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getBufferingHints(), BUFFERINGHINTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getCompressionFormat(), COMPRESSIONFORMAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getEncryptionConfiguration(), ENCRYPTIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3DestinationUpdate.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public synchronized void clearParameters(final String name) throws DatabaseEngineException, ConnectionResetException { final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { ps.ps.clearParameters(); } catch (final SQLException ex) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException("Error clearing parameters", ex); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } throw new ConnectionResetException("Connection was reset."); } } }
public class class_name { @Override public synchronized void clearParameters(final String name) throws DatabaseEngineException, ConnectionResetException { final PreparedStatementCapsule ps = stmts.get(name); if (ps == null) { throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not exist", name)); } try { ps.ps.clearParameters(); } catch (final SQLException ex) { if (checkConnection(conn) || !properties.isReconnectOnLost()) { throw new DatabaseEngineException("Error clearing parameters", ex); } // At this point maybe it is an error with the connection, so we try to re-establish it. try { getConnection(); // depends on control dependency: [try], data = [none] } catch (final Exception e2) { throw new DatabaseEngineException("Connection is down", e2); } // depends on control dependency: [catch], data = [none] throw new ConnectionResetException("Connection was reset."); } } }
public class class_name { public int update(String sql, Object... paras) { Connection conn = null; try { conn = config.getConnection(); return update(config, conn, sql, paras); } catch (Exception e) { throw new ActiveRecordException(e); } finally { config.close(conn); } } }
public class class_name { public int update(String sql, Object... paras) { Connection conn = null; try { conn = config.getConnection(); // depends on control dependency: [try], data = [none] return update(config, conn, sql, paras); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new ActiveRecordException(e); } finally { // depends on control dependency: [catch], data = [none] config.close(conn); } } }
public class class_name { private void fillCollection(Collection<?> collection) { int count = 0; // 展开 Collection 容器, 输出逗号分隔以支持 IN (...) 语法 // "IN :varlist" --> "IN (?, ?, ...)" if (collection.isEmpty()) { // 输出 "IN (NULL)" 保证不会产生错误 builder.append(NULL); } else { // 输出逗号分隔的参数表 for (Object value : collection) { if (value != null) { if (count > 0) { builder.append(COMMA); } // 输出参数内容 addArg(value); builder.append(QUESTION); count++; } } } } }
public class class_name { private void fillCollection(Collection<?> collection) { int count = 0; // 展开 Collection 容器, 输出逗号分隔以支持 IN (...) 语法 // "IN :varlist" --> "IN (?, ?, ...)" if (collection.isEmpty()) { // 输出 "IN (NULL)" 保证不会产生错误 builder.append(NULL); // depends on control dependency: [if], data = [none] } else { // 输出逗号分隔的参数表 for (Object value : collection) { if (value != null) { if (count > 0) { builder.append(COMMA); // depends on control dependency: [if], data = [none] } // 输出参数内容 addArg(value); // depends on control dependency: [if], data = [(value] builder.append(QUESTION); // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public void save(Object context, Bundle bundle) { Set<Field> fieldsToSave = FieldUtils.getAllFields(context, Stateful.class); for (Field field : fieldsToSave) { try { if(!field.isAccessible()) field.setAccessible(true); Serializable state = (Serializable)field.get(context); bundle.putSerializable(field.getName(), state); } catch (Exception e) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Failed to save state of field "); stringBuilder.append(field.getName()); stringBuilder.append(" in "); stringBuilder.append(context.getClass().getName()); stringBuilder.append(". "); Log.e(getClass().getName(), stringBuilder.toString(), e); } } } }
public class class_name { @Override public void save(Object context, Bundle bundle) { Set<Field> fieldsToSave = FieldUtils.getAllFields(context, Stateful.class); for (Field field : fieldsToSave) { try { if(!field.isAccessible()) field.setAccessible(true); Serializable state = (Serializable)field.get(context); bundle.putSerializable(field.getName(), state); // depends on control dependency: [try], data = [none] } catch (Exception e) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Failed to save state of field "); stringBuilder.append(field.getName()); stringBuilder.append(" in "); stringBuilder.append(context.getClass().getName()); stringBuilder.append(". "); Log.e(getClass().getName(), stringBuilder.toString(), e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter borderPainter = style.getBorderPainter(ctx); if (borderPainter != null) { paint(borderPainter, ctx, g, x, y, w, h, transform); } } }
public class class_name { private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { SeaGlassPainter borderPainter = style.getBorderPainter(ctx); if (borderPainter != null) { paint(borderPainter, ctx, g, x, y, w, h, transform); // depends on control dependency: [if], data = [(borderPainter] } } }
public class class_name { public java.lang.String getVariableName() { java.lang.Object ref = variableName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); variableName_ = s; return s; } } }
public class class_name { public java.lang.String getVariableName() { java.lang.Object ref = variableName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); variableName_ = s; // depends on control dependency: [if], data = [none] return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Func3<P1, P2, P3, R> andThen( final Func3<? super P1, ? super P2, ? super P3, ? extends R>... fs ) { if (0 == fs.length) { return this; } final Func3<P1, P2, P3, R> me = this; return new F3<P1, P2, P3, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3) { R r = me.apply(p1, p2, p3); for (Func3<? super P1, ? super P2, ? super P3, ? extends R> f : fs) { r = f.apply(p1, p2, p3); } return r; } }; } }
public class class_name { public Func3<P1, P2, P3, R> andThen( final Func3<? super P1, ? super P2, ? super P3, ? extends R>... fs ) { if (0 == fs.length) { return this; // depends on control dependency: [if], data = [none] } final Func3<P1, P2, P3, R> me = this; return new F3<P1, P2, P3, R>() { @Override public R apply(P1 p1, P2 p2, P3 p3) { R r = me.apply(p1, p2, p3); for (Func3<? super P1, ? super P2, ? super P3, ? extends R> f : fs) { r = f.apply(p1, p2, p3); } return r; } }; } }
public class class_name { private static void inferPropertyTypesToMatchConstraint( JSType type, JSType constraint) { if (type == null || constraint == null) { return; } type.matchConstraint(constraint); } }
public class class_name { private static void inferPropertyTypesToMatchConstraint( JSType type, JSType constraint) { if (type == null || constraint == null) { return; // depends on control dependency: [if], data = [none] } type.matchConstraint(constraint); } }
public class class_name { public void setActivePage(DialogPage activePage) { DialogPage oldPage = this.activePage; Assert.isTrue(activePage == null || pages.contains(activePage)); if (oldPage == activePage) { return; } this.activePage = activePage; updateMessage(); if (oldPage != null) { updatePageLabels(oldPage); } if (activePage != null) { updatePageLabels(activePage); } } }
public class class_name { public void setActivePage(DialogPage activePage) { DialogPage oldPage = this.activePage; Assert.isTrue(activePage == null || pages.contains(activePage)); if (oldPage == activePage) { return; // depends on control dependency: [if], data = [none] } this.activePage = activePage; updateMessage(); if (oldPage != null) { updatePageLabels(oldPage); // depends on control dependency: [if], data = [(oldPage] } if (activePage != null) { updatePageLabels(activePage); // depends on control dependency: [if], data = [(activePage] } } }
public class class_name { @SuppressWarnings("unchecked") public static <T> Collection<T> findNextByType(FaceletHandler nextHandler, Class<T> type) { List<T> found = new ArrayList<T>(); if (type.isAssignableFrom(nextHandler.getClass())) { found.add((T)nextHandler); } else if (nextHandler instanceof javax.faces.view.facelets.CompositeFaceletHandler) { for (FaceletHandler handler : ((javax.faces.view.facelets.CompositeFaceletHandler)nextHandler).getHandlers()) { if (type.isAssignableFrom(handler.getClass())) { found.add((T)handler); } } } return found; } }
public class class_name { @SuppressWarnings("unchecked") public static <T> Collection<T> findNextByType(FaceletHandler nextHandler, Class<T> type) { List<T> found = new ArrayList<T>(); if (type.isAssignableFrom(nextHandler.getClass())) { found.add((T)nextHandler); // depends on control dependency: [if], data = [none] } else if (nextHandler instanceof javax.faces.view.facelets.CompositeFaceletHandler) { for (FaceletHandler handler : ((javax.faces.view.facelets.CompositeFaceletHandler)nextHandler).getHandlers()) { if (type.isAssignableFrom(handler.getClass())) { found.add((T)handler); // depends on control dependency: [if], data = [none] } } } return found; } }
public class class_name { @SuppressWarnings("unchecked") public <X extends Collection<T>, T> X toCollection(Class<? extends Collection> collectionClass, Class<T> classOfT, String pattern) { if (collectionClass == null || classOfT == null) { return null; } try { // reflectively instantiate the target collection type using the default constructor Constructor<?> constructor = collectionClass.getConstructor(); X collection = (X) constructor.newInstance(); // cheat by not instantiating a ParameterValue for every value ParameterValue parameterValue = newParameterValuePlaceHolder(); List<String> list = toList(); for (String value : list) { parameterValue.values[0] = value; T t = (T) parameterValue.toObject(classOfT, pattern); collection.add(t); } return collection; } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new PippoRuntimeException(e, "Failed to create collection"); } } }
public class class_name { @SuppressWarnings("unchecked") public <X extends Collection<T>, T> X toCollection(Class<? extends Collection> collectionClass, Class<T> classOfT, String pattern) { if (collectionClass == null || classOfT == null) { return null; // depends on control dependency: [if], data = [none] } try { // reflectively instantiate the target collection type using the default constructor Constructor<?> constructor = collectionClass.getConstructor(); X collection = (X) constructor.newInstance(); // cheat by not instantiating a ParameterValue for every value ParameterValue parameterValue = newParameterValuePlaceHolder(); List<String> list = toList(); for (String value : list) { parameterValue.values[0] = value; // depends on control dependency: [for], data = [value] T t = (T) parameterValue.toObject(classOfT, pattern); collection.add(t); // depends on control dependency: [for], data = [none] } return collection; // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new PippoRuntimeException(e, "Failed to create collection"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static boolean isImmutableValue(Node n) { // TODO(johnlenz): rename this function. It is currently being used // in two disjoint cases: // 1) We only care about the result of the expression // (in which case NOT here should return true) // 2) We care that expression is a side-effect free and can't // be side-effected by other expressions. // This should only be used to say the value is immutable and // hasSideEffects and canBeSideEffected should be used for the other case. switch (n.getToken()) { case STRING: case NUMBER: case NULL: case TRUE: case FALSE: return true; case CAST: case NOT: case VOID: case NEG: return isImmutableValue(n.getFirstChild()); case NAME: String name = n.getString(); // We assume here that programs don't change the value of the keyword // undefined to something other than the value undefined. return "undefined".equals(name) || "Infinity".equals(name) || "NaN".equals(name); case TEMPLATELIT: for (Node child = n.getFirstChild(); child != null; child = child.getNext()) { if (child.isTemplateLitSub()) { if (!isImmutableValue(child.getFirstChild())) { return false; } } } return true; default: // TODO(yitingwang) There are probably other tokens that shouldn't get to the default branch checkArgument(!n.isTemplateLitString()); break; } return false; } }
public class class_name { static boolean isImmutableValue(Node n) { // TODO(johnlenz): rename this function. It is currently being used // in two disjoint cases: // 1) We only care about the result of the expression // (in which case NOT here should return true) // 2) We care that expression is a side-effect free and can't // be side-effected by other expressions. // This should only be used to say the value is immutable and // hasSideEffects and canBeSideEffected should be used for the other case. switch (n.getToken()) { case STRING: case NUMBER: case NULL: case TRUE: case FALSE: return true; case CAST: case NOT: case VOID: case NEG: return isImmutableValue(n.getFirstChild()); case NAME: String name = n.getString(); // We assume here that programs don't change the value of the keyword // undefined to something other than the value undefined. return "undefined".equals(name) || "Infinity".equals(name) || "NaN".equals(name); case TEMPLATELIT: for (Node child = n.getFirstChild(); child != null; child = child.getNext()) { if (child.isTemplateLitSub()) { if (!isImmutableValue(child.getFirstChild())) { return false; // depends on control dependency: [if], data = [none] } } } return true; default: // TODO(yitingwang) There are probably other tokens that shouldn't get to the default branch checkArgument(!n.isTemplateLitString()); break; } return false; } }
public class class_name { private Events _getEvents(PhaseId phaseId) { // Gather the events and purge the event list to prevent concurrent modification during broadcasting int size = _events.size(); List<FacesEvent> anyPhase = new ArrayList<FacesEvent>(size); List<FacesEvent> onPhase = new ArrayList<FacesEvent>(size); for (int i = 0; i < size; i++) { FacesEvent event = _events.get(i); if (event.getPhaseId().equals(PhaseId.ANY_PHASE)) { anyPhase.add(event); _events.remove(i); size--; i--; } else if (event.getPhaseId().equals(phaseId)) { onPhase.add(event); _events.remove(i); size--; i--; } } return new Events(anyPhase, onPhase); } }
public class class_name { private Events _getEvents(PhaseId phaseId) { // Gather the events and purge the event list to prevent concurrent modification during broadcasting int size = _events.size(); List<FacesEvent> anyPhase = new ArrayList<FacesEvent>(size); List<FacesEvent> onPhase = new ArrayList<FacesEvent>(size); for (int i = 0; i < size; i++) { FacesEvent event = _events.get(i); if (event.getPhaseId().equals(PhaseId.ANY_PHASE)) { anyPhase.add(event); // depends on control dependency: [if], data = [none] _events.remove(i); // depends on control dependency: [if], data = [none] size--; // depends on control dependency: [if], data = [none] i--; // depends on control dependency: [if], data = [none] } else if (event.getPhaseId().equals(phaseId)) { onPhase.add(event); // depends on control dependency: [if], data = [none] _events.remove(i); // depends on control dependency: [if], data = [none] size--; // depends on control dependency: [if], data = [none] i--; // depends on control dependency: [if], data = [none] } } return new Events(anyPhase, onPhase); } }
public class class_name { public java.util.List<GatewayInfo> getGateways() { if (gateways == null) { gateways = new com.amazonaws.internal.SdkInternalList<GatewayInfo>(); } return gateways; } }
public class class_name { public java.util.List<GatewayInfo> getGateways() { if (gateways == null) { gateways = new com.amazonaws.internal.SdkInternalList<GatewayInfo>(); // depends on control dependency: [if], data = [none] } return gateways; } }
public class class_name { @Path("/{cuid}/rel/{relId}") @ApiOperation(value="Delete a user or remove a user from a workgroup or role", notes="If rel/{relId} is present, user is removed from workgroup or role.", response=StatusMessage.class) public JSONObject delete(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException { String cuid = getSegment(path, 1); String rel = getSegment(path, 2); UserServices userServices = ServiceLocator.getUserServices(); try { if (rel == null) { if (userServices.getUser(cuid) == null) throw new ServiceException(ServiceException.NOT_FOUND, "User not found: " + cuid); userServices.deleteUser(cuid); } else if (rel.equals("workgroups")) { String group = getSegment(path, 3); userServices.removeUserFromWorkgroup(cuid, group); } else if (rel.equals("roles")) { String role = getSegment(path, 3); userServices.removeUserFromRole(cuid, role); } } catch (DataAccessException ex) { throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex); } return null; } }
public class class_name { @Path("/{cuid}/rel/{relId}") @ApiOperation(value="Delete a user or remove a user from a workgroup or role", notes="If rel/{relId} is present, user is removed from workgroup or role.", response=StatusMessage.class) public JSONObject delete(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException { String cuid = getSegment(path, 1); String rel = getSegment(path, 2); UserServices userServices = ServiceLocator.getUserServices(); try { if (rel == null) { if (userServices.getUser(cuid) == null) throw new ServiceException(ServiceException.NOT_FOUND, "User not found: " + cuid); userServices.deleteUser(cuid); // depends on control dependency: [if], data = [none] } else if (rel.equals("workgroups")) { String group = getSegment(path, 3); userServices.removeUserFromWorkgroup(cuid, group); // depends on control dependency: [if], data = [none] } else if (rel.equals("roles")) { String role = getSegment(path, 3); userServices.removeUserFromRole(cuid, role); // depends on control dependency: [if], data = [none] } } catch (DataAccessException ex) { throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex); } return null; } }
public class class_name { public void marshall(ListLoggerDefinitionsRequest listLoggerDefinitionsRequest, ProtocolMarshaller protocolMarshaller) { if (listLoggerDefinitionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listLoggerDefinitionsRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listLoggerDefinitionsRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListLoggerDefinitionsRequest listLoggerDefinitionsRequest, ProtocolMarshaller protocolMarshaller) { if (listLoggerDefinitionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listLoggerDefinitionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listLoggerDefinitionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static long hash(final BsonDocument doc) { if (doc == null) { return 0L; } final byte[] docBytes = toBytes(doc); long hashValue = FNV_64BIT_OFFSET_BASIS; for (int offset = 0; offset < docBytes.length; offset++) { hashValue ^= (0xFF & docBytes[offset]); hashValue *= FNV_64BIT_PRIME; } return hashValue; } }
public class class_name { public static long hash(final BsonDocument doc) { if (doc == null) { return 0L; // depends on control dependency: [if], data = [none] } final byte[] docBytes = toBytes(doc); long hashValue = FNV_64BIT_OFFSET_BASIS; for (int offset = 0; offset < docBytes.length; offset++) { hashValue ^= (0xFF & docBytes[offset]); // depends on control dependency: [for], data = [offset] hashValue *= FNV_64BIT_PRIME; // depends on control dependency: [for], data = [none] } return hashValue; } }
public class class_name { public void marshall(ListOutgoingCertificatesRequest listOutgoingCertificatesRequest, ProtocolMarshaller protocolMarshaller) { if (listOutgoingCertificatesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listOutgoingCertificatesRequest.getPageSize(), PAGESIZE_BINDING); protocolMarshaller.marshall(listOutgoingCertificatesRequest.getMarker(), MARKER_BINDING); protocolMarshaller.marshall(listOutgoingCertificatesRequest.getAscendingOrder(), ASCENDINGORDER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListOutgoingCertificatesRequest listOutgoingCertificatesRequest, ProtocolMarshaller protocolMarshaller) { if (listOutgoingCertificatesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listOutgoingCertificatesRequest.getPageSize(), PAGESIZE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listOutgoingCertificatesRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listOutgoingCertificatesRequest.getAscendingOrder(), ASCENDINGORDER_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected static double computeSigma(int i, DoubleArray pij_row, double perplexity, double log_perp, double[] pij_i) { double max = pij_row.get((int) FastMath.ceil(perplexity)) / Math.E; double beta = 1 / max; // beta = 1. / (2*sigma*sigma) double diff = computeH(pij_row, pij_i, -beta) - log_perp; double betaMin = 0.; double betaMax = Double.POSITIVE_INFINITY; for(int tries = 0; tries < PERPLEXITY_MAXITER && Math.abs(diff) > PERPLEXITY_ERROR; ++tries) { if(diff > 0) { betaMin = beta; beta += (betaMax == Double.POSITIVE_INFINITY) ? beta : ((betaMax - beta) * .5); } else { betaMax = beta; beta -= (beta - betaMin) * .5; } diff = computeH(pij_row, pij_i, -beta) - log_perp; } return beta; } }
public class class_name { protected static double computeSigma(int i, DoubleArray pij_row, double perplexity, double log_perp, double[] pij_i) { double max = pij_row.get((int) FastMath.ceil(perplexity)) / Math.E; double beta = 1 / max; // beta = 1. / (2*sigma*sigma) double diff = computeH(pij_row, pij_i, -beta) - log_perp; double betaMin = 0.; double betaMax = Double.POSITIVE_INFINITY; for(int tries = 0; tries < PERPLEXITY_MAXITER && Math.abs(diff) > PERPLEXITY_ERROR; ++tries) { if(diff > 0) { betaMin = beta; // depends on control dependency: [if], data = [none] beta += (betaMax == Double.POSITIVE_INFINITY) ? beta : ((betaMax - beta) * .5); // depends on control dependency: [if], data = [none] } else { betaMax = beta; // depends on control dependency: [if], data = [none] beta -= (beta - betaMin) * .5; // depends on control dependency: [if], data = [none] } diff = computeH(pij_row, pij_i, -beta) - log_perp; // depends on control dependency: [for], data = [none] } return beta; } }
public class class_name { public void setPercentValue(Pin pin, Number percent){ // validate range if(percent.doubleValue() <= 0){ setValue(pin, getMinSupportedValue()); } else if(percent.doubleValue() >= 100){ setValue(pin, getMaxSupportedValue()); } else{ double value = (getMaxSupportedValue() - getMinSupportedValue()) * (percent.doubleValue()/100f); setValue(pin, value); } } }
public class class_name { public void setPercentValue(Pin pin, Number percent){ // validate range if(percent.doubleValue() <= 0){ setValue(pin, getMinSupportedValue()); // depends on control dependency: [if], data = [none] } else if(percent.doubleValue() >= 100){ setValue(pin, getMaxSupportedValue()); // depends on control dependency: [if], data = [none] } else{ double value = (getMaxSupportedValue() - getMinSupportedValue()) * (percent.doubleValue()/100f); setValue(pin, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void addClassDescription(Content classInfoTree) { if(!configuration.nocomment) { // generate documentation for the class. if (!utils.getFullBody(typeElement).isEmpty()) { addInlineComment(typeElement, classInfoTree); } } } }
public class class_name { @Override public void addClassDescription(Content classInfoTree) { if(!configuration.nocomment) { // generate documentation for the class. if (!utils.getFullBody(typeElement).isEmpty()) { addInlineComment(typeElement, classInfoTree); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(UpdateJobRequest updateJobRequest, ProtocolMarshaller protocolMarshaller) { if (updateJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateJobRequest.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(updateJobRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(updateJobRequest.getPresignedUrlConfig(), PRESIGNEDURLCONFIG_BINDING); protocolMarshaller.marshall(updateJobRequest.getJobExecutionsRolloutConfig(), JOBEXECUTIONSROLLOUTCONFIG_BINDING); protocolMarshaller.marshall(updateJobRequest.getAbortConfig(), ABORTCONFIG_BINDING); protocolMarshaller.marshall(updateJobRequest.getTimeoutConfig(), TIMEOUTCONFIG_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateJobRequest updateJobRequest, ProtocolMarshaller protocolMarshaller) { if (updateJobRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateJobRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateJobRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateJobRequest.getPresignedUrlConfig(), PRESIGNEDURLCONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateJobRequest.getJobExecutionsRolloutConfig(), JOBEXECUTIONSROLLOUTCONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateJobRequest.getAbortConfig(), ABORTCONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateJobRequest.getTimeoutConfig(), TIMEOUTCONFIG_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public SelectorName qualifiedForm(NameFactory nameFactory) { if (expandedForm) { return new SelectorName(nameFactory.create(this.name).getString(nameFactory.getNamespaceRegistry())); } return this; } }
public class class_name { public SelectorName qualifiedForm(NameFactory nameFactory) { if (expandedForm) { return new SelectorName(nameFactory.create(this.name).getString(nameFactory.getNamespaceRegistry())); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private static String badIndexMsg(int index, int size, String desc, Object... params) { if (index < 0) { return StrUtil.format("{} ({}) must not be negative", StrUtil.format(desc, params), index); } else if (size < 0) { throw new IllegalArgumentException("negative size: " + size); } else { // index >= size return StrUtil.format("{} ({}) must be less than size ({})", StrUtil.format(desc, params), index, size); } } }
public class class_name { private static String badIndexMsg(int index, int size, String desc, Object... params) { if (index < 0) { return StrUtil.format("{} ({}) must not be negative", StrUtil.format(desc, params), index); // depends on control dependency: [if], data = [none] } else if (size < 0) { throw new IllegalArgumentException("negative size: " + size); } else { // index >= size return StrUtil.format("{} ({}) must be less than size ({})", StrUtil.format(desc, params), index, size); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setTapes(java.util.Collection<Tape> tapes) { if (tapes == null) { this.tapes = null; return; } this.tapes = new com.amazonaws.internal.SdkInternalList<Tape>(tapes); } }
public class class_name { public void setTapes(java.util.Collection<Tape> tapes) { if (tapes == null) { this.tapes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.tapes = new com.amazonaws.internal.SdkInternalList<Tape>(tapes); } }
public class class_name { public Map<TreeNode, Rectangle2D.Double> getNodeBounds() { if (nodeBounds == null) { nodeBounds = this.useIdentity ? new IdentityHashMap<TreeNode, Rectangle2D.Double>() : new HashMap<TreeNode, Rectangle2D.Double>(); for (Entry<TreeNode, Point2D> entry : positions.entrySet()) { TreeNode node = entry.getKey(); Point2D pos = entry.getValue(); double w = getNodeWidth(node); double h = getNodeHeight(node); double x = pos.getX() - w / 2; double y = pos.getY() - h / 2; nodeBounds.put(node, new Rectangle2D.Double(x, y, w, h)); } } return nodeBounds; } }
public class class_name { public Map<TreeNode, Rectangle2D.Double> getNodeBounds() { if (nodeBounds == null) { nodeBounds = this.useIdentity ? new IdentityHashMap<TreeNode, Rectangle2D.Double>() : new HashMap<TreeNode, Rectangle2D.Double>(); // depends on control dependency: [if], data = [none] for (Entry<TreeNode, Point2D> entry : positions.entrySet()) { TreeNode node = entry.getKey(); Point2D pos = entry.getValue(); double w = getNodeWidth(node); double h = getNodeHeight(node); double x = pos.getX() - w / 2; double y = pos.getY() - h / 2; nodeBounds.put(node, new Rectangle2D.Double(x, y, w, h)); // depends on control dependency: [for], data = [none] } } return nodeBounds; } }
public class class_name { NodeSchema copyAndReplaceWithTVE() { NodeSchema copy = new NodeSchema(); int colIndex = 0; for (SchemaColumn column : m_columns) { copy.addColumn(column.copyAndReplaceWithTVE(colIndex)); ++colIndex; } return copy; } }
public class class_name { NodeSchema copyAndReplaceWithTVE() { NodeSchema copy = new NodeSchema(); int colIndex = 0; for (SchemaColumn column : m_columns) { copy.addColumn(column.copyAndReplaceWithTVE(colIndex)); // depends on control dependency: [for], data = [column] ++colIndex; // depends on control dependency: [for], data = [none] } return copy; } }
public class class_name { public static UIMenuItem getHelpMenuItem() { UIMenuItem ret = null; try { final String cmdStr = Configuration.getAttribute(ConfigAttribute.HELPEDITCMD); final Command cmd = UUIDUtil.isUUID(cmdStr) ? Command.get(UUID.fromString(cmdStr)) : Command.get(cmdStr); ret = new UIMenuItem(cmd.getUUID()); } catch (final EFapsBaseException e) { HelpUtil.LOG.error("ClassNotFoundException", e); } return ret; } }
public class class_name { public static UIMenuItem getHelpMenuItem() { UIMenuItem ret = null; try { final String cmdStr = Configuration.getAttribute(ConfigAttribute.HELPEDITCMD); final Command cmd = UUIDUtil.isUUID(cmdStr) ? Command.get(UUID.fromString(cmdStr)) : Command.get(cmdStr); ret = new UIMenuItem(cmd.getUUID()); // depends on control dependency: [try], data = [none] } catch (final EFapsBaseException e) { HelpUtil.LOG.error("ClassNotFoundException", e); } // depends on control dependency: [catch], data = [none] return ret; } }
public class class_name { public ListSuitesResult withSuites(Suite... suites) { if (this.suites == null) { setSuites(new java.util.ArrayList<Suite>(suites.length)); } for (Suite ele : suites) { this.suites.add(ele); } return this; } }
public class class_name { public ListSuitesResult withSuites(Suite... suites) { if (this.suites == null) { setSuites(new java.util.ArrayList<Suite>(suites.length)); // depends on control dependency: [if], data = [none] } for (Suite ele : suites) { this.suites.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static double inverseRegularizedIncompleteGamma(double a, double p) { if (a <= 0.0) { throw new IllegalArgumentException("a must be pos in invgammap"); } final double EPS = 1.0E-8; double x, err, t, u, pp; double lna1 = 0.0; double afac = 0.0; double a1 = a - 1; double gln = lgamma(a); if (p >= 1.) { return Math.max(100., a + 100. * Math.sqrt(a)); } if (p <= 0.0) { return 0.0; } if (a > 1.0) { lna1 = Math.log(a1); afac = Math.exp(a1 * (lna1 - 1.) - gln); pp = (p < 0.5) ? p : 1. - p; t = Math.sqrt(-2. * Math.log(pp)); x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t; if (p < 0.5) { x = -x; } x = Math.max(1.e-3, a * Math.pow(1. - 1. / (9. * a) - x / (3. * Math.sqrt(a)), 3)); } else { t = 1.0 - a * (0.253 + a * 0.12); if (p < t) { x = Math.pow(p / t, 1. / a); } else { x = 1. - Math.log(1. - (p - t) / (1. - t)); } } for (int j = 0; j < 12; j++) { if (x <= 0.0) { return 0.0; } err = regularizedIncompleteGamma(a, x) - p; if (a > 1.) { t = afac * Math.exp(-(x - a1) + a1 * (Math.log(x) - lna1)); } else { t = Math.exp(-x + a1 * Math.log(x) - gln); } u = err / t; x -= (t = u / (1. - 0.5 * Math.min(1., u * ((a - 1.) / x - 1)))); if (x <= 0.) { x = 0.5 * (x + t); } if (Math.abs(t) < EPS * x) { break; } } return x; } }
public class class_name { public static double inverseRegularizedIncompleteGamma(double a, double p) { if (a <= 0.0) { throw new IllegalArgumentException("a must be pos in invgammap"); } final double EPS = 1.0E-8; double x, err, t, u, pp; double lna1 = 0.0; double afac = 0.0; double a1 = a - 1; double gln = lgamma(a); if (p >= 1.) { return Math.max(100., a + 100. * Math.sqrt(a)); // depends on control dependency: [if], data = [none] } if (p <= 0.0) { return 0.0; // depends on control dependency: [if], data = [none] } if (a > 1.0) { lna1 = Math.log(a1); // depends on control dependency: [if], data = [(a] afac = Math.exp(a1 * (lna1 - 1.) - gln); // depends on control dependency: [if], data = [(a] pp = (p < 0.5) ? p : 1. - p; // depends on control dependency: [if], data = [none] t = Math.sqrt(-2. * Math.log(pp)); // depends on control dependency: [if], data = [none] x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t; // depends on control dependency: [if], data = [none] if (p < 0.5) { x = -x; // depends on control dependency: [if], data = [none] } x = Math.max(1.e-3, a * Math.pow(1. - 1. / (9. * a) - x / (3. * Math.sqrt(a)), 3)); // depends on control dependency: [if], data = [(a] } else { t = 1.0 - a * (0.253 + a * 0.12); // depends on control dependency: [if], data = [none] if (p < t) { x = Math.pow(p / t, 1. / a); // depends on control dependency: [if], data = [(p] } else { x = 1. - Math.log(1. - (p - t) / (1. - t)); // depends on control dependency: [if], data = [(p] } } for (int j = 0; j < 12; j++) { if (x <= 0.0) { return 0.0; // depends on control dependency: [if], data = [none] } err = regularizedIncompleteGamma(a, x) - p; // depends on control dependency: [for], data = [none] if (a > 1.) { t = afac * Math.exp(-(x - a1) + a1 * (Math.log(x) - lna1)); // depends on control dependency: [if], data = [none] } else { t = Math.exp(-x + a1 * Math.log(x) - gln); // depends on control dependency: [if], data = [none] } u = err / t; // depends on control dependency: [for], data = [none] x -= (t = u / (1. - 0.5 * Math.min(1., u * ((a - 1.) / x - 1)))); // depends on control dependency: [for], data = [none] if (x <= 0.) { x = 0.5 * (x + t); // depends on control dependency: [if], data = [(x] } if (Math.abs(t) < EPS * x) { break; } } return x; } }
public class class_name { public static int skipToNextMatchingShort(byte[] buffer, int offset, int value) { int nextOffset = offset; while (getShort(buffer, nextOffset) != value) { ++nextOffset; } nextOffset += 2; return nextOffset; } }
public class class_name { public static int skipToNextMatchingShort(byte[] buffer, int offset, int value) { int nextOffset = offset; while (getShort(buffer, nextOffset) != value) { ++nextOffset; // depends on control dependency: [while], data = [none] } nextOffset += 2; return nextOffset; } }
public class class_name { static void overwrite(StringBuffer sb, int pos, String s) { int len = s.length(); for (int i = 0; i < len; i++) { sb.setCharAt(pos + i, s.charAt(i)); } } }
public class class_name { static void overwrite(StringBuffer sb, int pos, String s) { int len = s.length(); for (int i = 0; i < len; i++) { sb.setCharAt(pos + i, s.charAt(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { @SuppressWarnings({"CheckReturnValue", "MockitoUsage", "unchecked"}) static void verifyInt(MockedVoidMethod method, VerificationMode mode, InOrder instanceInOrder) { if (onMethodCallDuringVerification.get() != null) { throw new IllegalStateException("Verification is already in progress on this " + "thread."); } ArrayList<Method> verifications = new ArrayList<>(); /* Set up callback that is triggered when the next static method is called on this thread. * * This is necessary as we don't know which class the method will be called on. Once the * call is intercepted this will * 1. Remove all matchers (e.g. eq(), any()) from the matcher stack * 2. Call verify on the marker for the class * 3. Add the markers back to the stack */ onMethodCallDuringVerification.set((clazz, verifiedMethod) -> { // TODO: O holy reflection! Let's hope we can integrate this better. try { ArgumentMatcherStorageImpl argMatcherStorage = (ArgumentMatcherStorageImpl) mockingProgress().getArgumentMatcherStorage(); List<LocalizedMatcher> matchers; // Matcher are called before verify, hence remove the from the storage Method resetStackMethod = argMatcherStorage.getClass().getDeclaredMethod("resetStack"); resetStackMethod.setAccessible(true); matchers = (List<LocalizedMatcher>) resetStackMethod.invoke(argMatcherStorage); if (instanceInOrder == null) { verify(staticMockMarker(clazz), mode); } else { instanceInOrder.verify(staticMockMarker(clazz), mode); } // Add the matchers back after verify is called Field matcherStackField = argMatcherStorage.getClass().getDeclaredField("matcherStack"); matcherStackField.setAccessible(true); Method pushMethod = matcherStackField.getType().getDeclaredMethod("push", Object.class); for (LocalizedMatcher matcher : matchers) { pushMethod.invoke(matcherStackField.get(argMatcherStorage), matcher); } } catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | ClassCastException e) { throw new Error("Reflection failed. Do you use a compatible version of " + "mockito?", e); } verifications.add(verifiedMethod); }); try { try { // Trigger the method call. This call will be intercepted and trigger the // onMethodCallDuringVerification callback. method.run(); } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } throw new RuntimeException(t); } if (verifications.isEmpty()) { // Make sure something was intercepted throw new IllegalArgumentException("Nothing was verified. Does the lambda call " + "a static method on a 'static' mock/spy ?"); } else if (verifications.size() > 1) { // A lambda might call several methods. In this case it is not clear what should // be verified. Hence throw an error. throw new IllegalArgumentException("Multiple intercepted calls on methods " + verifications); } } finally { onMethodCallDuringVerification.remove(); } } }
public class class_name { @SuppressWarnings({"CheckReturnValue", "MockitoUsage", "unchecked"}) static void verifyInt(MockedVoidMethod method, VerificationMode mode, InOrder instanceInOrder) { if (onMethodCallDuringVerification.get() != null) { throw new IllegalStateException("Verification is already in progress on this " + "thread."); } ArrayList<Method> verifications = new ArrayList<>(); /* Set up callback that is triggered when the next static method is called on this thread. * * This is necessary as we don't know which class the method will be called on. Once the * call is intercepted this will * 1. Remove all matchers (e.g. eq(), any()) from the matcher stack * 2. Call verify on the marker for the class * 3. Add the markers back to the stack */ onMethodCallDuringVerification.set((clazz, verifiedMethod) -> { // TODO: O holy reflection! Let's hope we can integrate this better. try { ArgumentMatcherStorageImpl argMatcherStorage = (ArgumentMatcherStorageImpl) mockingProgress().getArgumentMatcherStorage(); List<LocalizedMatcher> matchers; // Matcher are called before verify, hence remove the from the storage Method resetStackMethod = argMatcherStorage.getClass().getDeclaredMethod("resetStack"); resetStackMethod.setAccessible(true); // depends on control dependency: [try], data = [none] matchers = (List<LocalizedMatcher>) resetStackMethod.invoke(argMatcherStorage); // depends on control dependency: [try], data = [none] if (instanceInOrder == null) { verify(staticMockMarker(clazz), mode); // depends on control dependency: [if], data = [none] } else { instanceInOrder.verify(staticMockMarker(clazz), mode); // depends on control dependency: [if], data = [none] } // Add the matchers back after verify is called Field matcherStackField = argMatcherStorage.getClass().getDeclaredField("matcherStack"); matcherStackField.setAccessible(true); // depends on control dependency: [try], data = [none] Method pushMethod = matcherStackField.getType().getDeclaredMethod("push", Object.class); for (LocalizedMatcher matcher : matchers) { pushMethod.invoke(matcherStackField.get(argMatcherStorage), matcher); // depends on control dependency: [for], data = [matcher] } } catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | ClassCastException e) { throw new Error("Reflection failed. Do you use a compatible version of " + "mockito?", e); } // depends on control dependency: [catch], data = [none] verifications.add(verifiedMethod); }); try { try { // Trigger the method call. This call will be intercepted and trigger the // onMethodCallDuringVerification callback. method.run(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } throw new RuntimeException(t); } // depends on control dependency: [catch], data = [none] if (verifications.isEmpty()) { // Make sure something was intercepted throw new IllegalArgumentException("Nothing was verified. Does the lambda call " + "a static method on a 'static' mock/spy ?"); } else if (verifications.size() > 1) { // A lambda might call several methods. In this case it is not clear what should // be verified. Hence throw an error. throw new IllegalArgumentException("Multiple intercepted calls on methods " + verifications); } } finally { onMethodCallDuringVerification.remove(); } } }
public class class_name { public EngineResult createNewJob(String jobname) { HttpPost postRequest = new HttpPost(baseUrl); List<NameValuePair> nvp = new LinkedList<NameValuePair>(); nvp.add(new BasicNameValuePair("action", "create")); nvp.add(new BasicNameValuePair("createpath", jobname)); StringEntity postEntity = null; try { postEntity = new UrlEncodedFormEntity(nvp); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } postEntity.setContentType("application/x-www-form-urlencoded"); postRequest.addHeader("Accept", "application/xml"); postRequest.setEntity(postEntity); return engineResult(postRequest); } }
public class class_name { public EngineResult createNewJob(String jobname) { HttpPost postRequest = new HttpPost(baseUrl); List<NameValuePair> nvp = new LinkedList<NameValuePair>(); nvp.add(new BasicNameValuePair("action", "create")); nvp.add(new BasicNameValuePair("createpath", jobname)); StringEntity postEntity = null; try { postEntity = new UrlEncodedFormEntity(nvp); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] postEntity.setContentType("application/x-www-form-urlencoded"); postRequest.addHeader("Accept", "application/xml"); postRequest.setEntity(postEntity); return engineResult(postRequest); } }
public class class_name { public void serialize( JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params, boolean isMapValue ) throws JsonSerializationException { if ( null != params.getInclude() ) { switch ( params.getInclude() ) { case ALWAYS: if ( null == value ) { serializeNullValue( writer, ctx, params ); } else { doSerialize( writer, value, ctx, params ); } return; case NON_DEFAULT: if ( isDefault( value ) && !isMapValue ) { writer.cancelName(); } else { doSerialize( writer, value, ctx, params ); } return; case NON_EMPTY: if ( isEmpty( value ) && !isMapValue ) { writer.cancelName(); } else { doSerialize( writer, value, ctx, params ); } return; case NON_NULL: if ( null == value && !isMapValue) { writer.cancelName(); } else { doSerialize( writer, value, ctx, params ); } return; case NON_ABSENT: if ( isAbsent( value ) && !isMapValue) { writer.cancelName(); } else { doSerialize( writer, value, ctx, params ); } return; } } if ( null == value ) { if ( ctx.isSerializeNulls() || ( isMapValue && ctx.isWriteNullMapValues() ) ) { serializeNullValue( writer, ctx, params ); } else { writer.cancelName(); } } else { doSerialize( writer, value, ctx, params ); } } }
public class class_name { public void serialize( JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params, boolean isMapValue ) throws JsonSerializationException { if ( null != params.getInclude() ) { switch ( params.getInclude() ) { case ALWAYS: if ( null == value ) { serializeNullValue( writer, ctx, params ); // depends on control dependency: [if], data = [none] } else { doSerialize( writer, value, ctx, params ); // depends on control dependency: [if], data = [none] } return; case NON_DEFAULT: if ( isDefault( value ) && !isMapValue ) { writer.cancelName(); // depends on control dependency: [if], data = [none] } else { doSerialize( writer, value, ctx, params ); // depends on control dependency: [if], data = [none] } return; case NON_EMPTY: if ( isEmpty( value ) && !isMapValue ) { writer.cancelName(); // depends on control dependency: [if], data = [none] } else { doSerialize( writer, value, ctx, params ); // depends on control dependency: [if], data = [none] } return; case NON_NULL: if ( null == value && !isMapValue) { writer.cancelName(); // depends on control dependency: [if], data = [none] } else { doSerialize( writer, value, ctx, params ); // depends on control dependency: [if], data = [none] } return; case NON_ABSENT: if ( isAbsent( value ) && !isMapValue) { writer.cancelName(); // depends on control dependency: [if], data = [none] } else { doSerialize( writer, value, ctx, params ); // depends on control dependency: [if], data = [none] } return; } } if ( null == value ) { if ( ctx.isSerializeNulls() || ( isMapValue && ctx.isWriteNullMapValues() ) ) { serializeNullValue( writer, ctx, params ); // depends on control dependency: [if], data = [none] } else { writer.cancelName(); // depends on control dependency: [if], data = [none] } } else { doSerialize( writer, value, ctx, params ); } } }
public class class_name { protected void addToCloseReaderList(final Reader r) { if (readersToClose == null) { readersToClose = new ArrayList<>(); } readersToClose.add(r); } }
public class class_name { protected void addToCloseReaderList(final Reader r) { if (readersToClose == null) { readersToClose = new ArrayList<>(); // depends on control dependency: [if], data = [none] } readersToClose.add(r); } }
public class class_name { public java.util.List<String> getAssociationIds() { if (associationIds == null) { associationIds = new com.amazonaws.internal.SdkInternalList<String>(); } return associationIds; } }
public class class_name { public java.util.List<String> getAssociationIds() { if (associationIds == null) { associationIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return associationIds; } }
public class class_name { public EEnum getColorFidelityRepCoEx() { if (colorFidelityRepCoExEEnum == null) { colorFidelityRepCoExEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(160); } return colorFidelityRepCoExEEnum; } }
public class class_name { public EEnum getColorFidelityRepCoEx() { if (colorFidelityRepCoExEEnum == null) { colorFidelityRepCoExEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(160); // depends on control dependency: [if], data = [none] } return colorFidelityRepCoExEEnum; } }
public class class_name { private void showHistoricVersion() { String resourceStr = getParamResource(); byte[] result = getHistoricalResourceContent(getCms(), resourceStr, getParamVersion()); if (result != null) { // get the top level response to change the content type String contentType = OpenCms.getResourceManager().getMimeType( resourceStr, getCms().getRequestContext().getEncoding()); HttpServletResponse res = getJsp().getResponse(); HttpServletRequest req = getJsp().getRequest(); res.setHeader( CmsRequestUtil.HEADER_CONTENT_DISPOSITION, new StringBuffer("attachment; filename=\"").append(resourceStr).append("\"").toString()); res.setContentLength(result.length); CmsFlexController controller = CmsFlexController.getController(req); res = controller.getTopResponse(); res.setContentType(contentType); try { res.getOutputStream().write(result); res.getOutputStream().flush(); } catch (IOException e) { // can usually be ignored if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage()); } } } } }
public class class_name { private void showHistoricVersion() { String resourceStr = getParamResource(); byte[] result = getHistoricalResourceContent(getCms(), resourceStr, getParamVersion()); if (result != null) { // get the top level response to change the content type String contentType = OpenCms.getResourceManager().getMimeType( resourceStr, getCms().getRequestContext().getEncoding()); HttpServletResponse res = getJsp().getResponse(); HttpServletRequest req = getJsp().getRequest(); res.setHeader( CmsRequestUtil.HEADER_CONTENT_DISPOSITION, new StringBuffer("attachment; filename=\"").append(resourceStr).append("\"").toString()); // depends on control dependency: [if], data = [none] res.setContentLength(result.length); // depends on control dependency: [if], data = [(result] CmsFlexController controller = CmsFlexController.getController(req); res = controller.getTopResponse(); // depends on control dependency: [if], data = [none] res.setContentType(contentType); // depends on control dependency: [if], data = [none] try { res.getOutputStream().write(result); // depends on control dependency: [try], data = [none] res.getOutputStream().flush(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // can usually be ignored if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public <T> List<T> asList() { String cacheKey = null; // is the result of the query cached? if (isCacheable() && transaction == null) { cacheKey = getCacheKey(); List<Key> keys = getCacheManager().get(cacheNamespace, cacheKey); if (keys != null) { if (isKeysOnly()) { return (List) keys; } else { final Map<Key, T> values = entityManager.get(keys); return Lists.transform(keys, new Function<Key, T>() { @Override public T apply(Key key) { return values.get(key); } }); } } } // execute the query List<T> result = Lists.newArrayList((Iterable<T>) asIterable()); if (isCacheable()) { Collection<Key> keys = isKeysOnly()? result : Collections2.transform(result, new EntityToKeyFunction(classMetadata.getPersistentClass())); populateCache(cacheKey, Lists.newArrayList(keys)); } return result; } }
public class class_name { public <T> List<T> asList() { String cacheKey = null; // is the result of the query cached? if (isCacheable() && transaction == null) { cacheKey = getCacheKey(); // depends on control dependency: [if], data = [none] List<Key> keys = getCacheManager().get(cacheNamespace, cacheKey); if (keys != null) { if (isKeysOnly()) { return (List) keys; // depends on control dependency: [if], data = [none] } else { final Map<Key, T> values = entityManager.get(keys); return Lists.transform(keys, new Function<Key, T>() { @Override public T apply(Key key) { return values.get(key); } }); // depends on control dependency: [if], data = [none] } } } // execute the query List<T> result = Lists.newArrayList((Iterable<T>) asIterable()); if (isCacheable()) { Collection<Key> keys = isKeysOnly()? result : Collections2.transform(result, new EntityToKeyFunction(classMetadata.getPersistentClass())); populateCache(cacheKey, Lists.newArrayList(keys)); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static byte[] serialize(Serializable obj, boolean gzipOnSerialize) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out; if (gzipOnSerialize) { out = new ObjectOutputStream(new GZIPOutputStream(baos)); } else { out = new ObjectOutputStream(baos); } out.writeObject(obj); out.flush(); out.close(); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public static byte[] serialize(Serializable obj, boolean gzipOnSerialize) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out; if (gzipOnSerialize) { out = new ObjectOutputStream(new GZIPOutputStream(baos)); // depends on control dependency: [if], data = [none] } else { out = new ObjectOutputStream(baos); // depends on control dependency: [if], data = [none] } out.writeObject(obj); // depends on control dependency: [try], data = [none] out.flush(); // depends on control dependency: [try], data = [none] out.close(); // depends on control dependency: [try], data = [none] return baos.toByteArray(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ExtractFromRow extractRelativePath( final int indexInRow, final Path relativePath, final NodeCache cache, TypeSystem types ) { CheckArg.isNotNull(relativePath, "relativePath"); final TypeFactory<Path> type = types.getPathFactory(); final boolean trace = NodeSequence.LOGGER.isTraceEnabled(); return new ExtractFromRow() { @Override public TypeFactory<Path> getType() { return type; } @Override public Object getValueInRow( RowAccessor row ) { CachedNode node = row.getNode(indexInRow); if (node == null) return null; Path nodePath = node.getPath(cache); try { Path path = nodePath.resolve(relativePath); if (trace) NodeSequence.LOGGER.trace("Extracting relative path {2} from {0}: {2}", node.getPath(cache), relativePath, path); return path; } catch (InvalidPathException e) { return null; } } @Override public String toString() { return "(extract-relative-path)"; } }; } }
public class class_name { public static ExtractFromRow extractRelativePath( final int indexInRow, final Path relativePath, final NodeCache cache, TypeSystem types ) { CheckArg.isNotNull(relativePath, "relativePath"); final TypeFactory<Path> type = types.getPathFactory(); final boolean trace = NodeSequence.LOGGER.isTraceEnabled(); return new ExtractFromRow() { @Override public TypeFactory<Path> getType() { return type; } @Override public Object getValueInRow( RowAccessor row ) { CachedNode node = row.getNode(indexInRow); if (node == null) return null; Path nodePath = node.getPath(cache); try { Path path = nodePath.resolve(relativePath); if (trace) NodeSequence.LOGGER.trace("Extracting relative path {2} from {0}: {2}", node.getPath(cache), relativePath, path); return path; // depends on control dependency: [try], data = [none] } catch (InvalidPathException e) { return null; } // depends on control dependency: [catch], data = [none] } @Override public String toString() { return "(extract-relative-path)"; } }; } }
public class class_name { @EnsuresNonNull("fn") private Function getCompiledScript() { // JavaScript configuration should be checked when it's actually used because someone might still want Druid // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled. Preconditions.checkState(config.isEnabled(), "JavaScript is disabled"); Function syncedFn = fn; if (syncedFn == null) { synchronized (config) { syncedFn = fn; if (syncedFn == null) { syncedFn = compile(function); fn = syncedFn; } } } return syncedFn; } }
public class class_name { @EnsuresNonNull("fn") private Function getCompiledScript() { // JavaScript configuration should be checked when it's actually used because someone might still want Druid // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled. Preconditions.checkState(config.isEnabled(), "JavaScript is disabled"); Function syncedFn = fn; if (syncedFn == null) { synchronized (config) { // depends on control dependency: [if], data = [none] syncedFn = fn; if (syncedFn == null) { syncedFn = compile(function); // depends on control dependency: [if], data = [none] fn = syncedFn; // depends on control dependency: [if], data = [none] } } } return syncedFn; } }
public class class_name { public void setStatements(java.util.Collection<ApplicationPolicyStatement> statements) { if (statements == null) { this.statements = null; return; } this.statements = new java.util.ArrayList<ApplicationPolicyStatement>(statements); } }
public class class_name { public void setStatements(java.util.Collection<ApplicationPolicyStatement> statements) { if (statements == null) { this.statements = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.statements = new java.util.ArrayList<ApplicationPolicyStatement>(statements); } }
public class class_name { @Requires({ "kind != null", "name != null", "desc != null", "extraCount >= 0" }) @Ensures({ "result != null", "!result.contains(null)" }) List<MethodContractHandle> getMethodHandles(ContractKind kind, String name, String desc, int extraCount) { ArrayList<MethodContractHandle> candidates = methodHandles.get(name); if (candidates == null) { return Collections.emptyList(); } ArrayList<MethodContractHandle> matched = new ArrayList<MethodContractHandle>(); for (MethodContractHandle h : candidates) { if (kind.equals(h.getKind()) && descArgumentsMatch(desc, h.getContractMethod().desc, extraCount)) { matched.add(h); } } return matched; } }
public class class_name { @Requires({ "kind != null", "name != null", "desc != null", "extraCount >= 0" }) @Ensures({ "result != null", "!result.contains(null)" }) List<MethodContractHandle> getMethodHandles(ContractKind kind, String name, String desc, int extraCount) { ArrayList<MethodContractHandle> candidates = methodHandles.get(name); if (candidates == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } ArrayList<MethodContractHandle> matched = new ArrayList<MethodContractHandle>(); for (MethodContractHandle h : candidates) { if (kind.equals(h.getKind()) && descArgumentsMatch(desc, h.getContractMethod().desc, extraCount)) { matched.add(h); // depends on control dependency: [if], data = [none] } } return matched; } }
public class class_name { public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) { if (clazz.equals(Graph.class)) return (T) baseGraph; Collection<CHGraphImpl> chGraphs = getAllCHGraphs(); if (chGraphs.isEmpty()) throw new IllegalStateException("Cannot find graph implementation for " + clazz); if (weighting == null) throw new IllegalStateException("Cannot find CHGraph with null weighting"); List<Weighting> existing = new ArrayList<>(); for (CHGraphImpl cg : chGraphs) { if (cg.getWeighting() == weighting) return (T) cg; existing.add(cg.getWeighting()); } throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing); } }
public class class_name { public <T extends Graph> T getGraph(Class<T> clazz, Weighting weighting) { if (clazz.equals(Graph.class)) return (T) baseGraph; Collection<CHGraphImpl> chGraphs = getAllCHGraphs(); if (chGraphs.isEmpty()) throw new IllegalStateException("Cannot find graph implementation for " + clazz); if (weighting == null) throw new IllegalStateException("Cannot find CHGraph with null weighting"); List<Weighting> existing = new ArrayList<>(); for (CHGraphImpl cg : chGraphs) { if (cg.getWeighting() == weighting) return (T) cg; existing.add(cg.getWeighting()); // depends on control dependency: [for], data = [cg] } throw new IllegalStateException("Cannot find CHGraph for specified weighting: " + weighting + ", existing:" + existing); } }
public class class_name { protected static DataBuffer createIndiceBuffer(long[][] indices, long[] shape){ checkNotNull(indices); checkNotNull(shape); if(indices.length == 0){ return Nd4j.getDataBufferFactory().createLong(shape.length); } if (indices.length == shape.length) { return Nd4j.createBuffer(ArrayUtil.flattenF(indices)); } return Nd4j.createBuffer(ArrayUtil.flatten(indices)); } }
public class class_name { protected static DataBuffer createIndiceBuffer(long[][] indices, long[] shape){ checkNotNull(indices); checkNotNull(shape); if(indices.length == 0){ return Nd4j.getDataBufferFactory().createLong(shape.length); // depends on control dependency: [if], data = [none] } if (indices.length == shape.length) { return Nd4j.createBuffer(ArrayUtil.flattenF(indices)); // depends on control dependency: [if], data = [none] } return Nd4j.createBuffer(ArrayUtil.flatten(indices)); } }
public class class_name { @Override public LabelledDocument nextDocument() { LabelledDocument document = currentIterator.next(); for (String label : document.getLabels()) { labels.storeLabel(label); } return document; } }
public class class_name { @Override public LabelledDocument nextDocument() { LabelledDocument document = currentIterator.next(); for (String label : document.getLabels()) { labels.storeLabel(label); // depends on control dependency: [for], data = [label] } return document; } }
public class class_name { public void dump(PrintStream output) { TreeSet<String> keys = new TreeSet<String>(keySet()); for (String key : keys) { output.println(key + ":" + get(key)); } } }
public class class_name { public void dump(PrintStream output) { TreeSet<String> keys = new TreeSet<String>(keySet()); for (String key : keys) { output.println(key + ":" + get(key)); // depends on control dependency: [for], data = [key] } } }
public class class_name { public Entity buildEntity(EntityConfig entityConfig) { Entity entity = applicationContext.getBean(Entity.class); entityConfigFactory.applyFallBacks(entityConfig); entity.setEntityConfig(entityConfig); Table table = getTableStrict(entityConfig); if (table.getType() == TableType.VIEW) { entity.setView(true); } entity.setTable(table); namerDefault(entity); namerExtension(entity, config.getCelerio().getConfiguration()); if (entityConfig.hasInheritance()) { if (entityConfig.is(JOINED)) { buildEntityInvolvedWithJoinedInheritance(entityConfig, entity); } else if (entityConfig.is(SINGLE_TABLE)) { buildEntityInvolvedWithSingleTableInheritance(entityConfig, entity); } else if (entityConfig.is(TABLE_PER_CLASS)) { buildEntityInvolvedWithTablePerClassInheritance(entityConfig, entity); } else { throw new IllegalStateException("An inheritance strategy should have been found in entity (or its ancestor) " + entityConfig.getEntityName()); } } else { buildSimpleEntity(entityConfig, entity); } return entity; } }
public class class_name { public Entity buildEntity(EntityConfig entityConfig) { Entity entity = applicationContext.getBean(Entity.class); entityConfigFactory.applyFallBacks(entityConfig); entity.setEntityConfig(entityConfig); Table table = getTableStrict(entityConfig); if (table.getType() == TableType.VIEW) { entity.setView(true); // depends on control dependency: [if], data = [none] } entity.setTable(table); namerDefault(entity); namerExtension(entity, config.getCelerio().getConfiguration()); if (entityConfig.hasInheritance()) { if (entityConfig.is(JOINED)) { buildEntityInvolvedWithJoinedInheritance(entityConfig, entity); // depends on control dependency: [if], data = [none] } else if (entityConfig.is(SINGLE_TABLE)) { buildEntityInvolvedWithSingleTableInheritance(entityConfig, entity); // depends on control dependency: [if], data = [none] } else if (entityConfig.is(TABLE_PER_CLASS)) { buildEntityInvolvedWithTablePerClassInheritance(entityConfig, entity); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("An inheritance strategy should have been found in entity (or its ancestor) " + entityConfig.getEntityName()); } } else { buildSimpleEntity(entityConfig, entity); // depends on control dependency: [if], data = [none] } return entity; } }
public class class_name { private static void resolveTypeQualifierDefaults(AnnotationValue value, ElementType defaultFor, LinkedList<AnnotationValue> result) { try { XClass c = Global.getAnalysisCache().getClassAnalysis(XClass.class, value.getAnnotationClass()); AnnotationValue defaultAnnotation = c.getAnnotation(typeQualifierDefault); if (defaultAnnotation == null) { return; } for (Object o : (Object[]) defaultAnnotation.getValue("value")) { if (o instanceof EnumValue) { EnumValue e = (EnumValue) o; if (e.desc.equals(elementTypeDescriptor) && e.value.equals(defaultFor.name())) { for (ClassDescriptor d : c.getAnnotationDescriptors()) { if (!d.equals(typeQualifierDefault)) { resolveTypeQualifierNicknames(c.getAnnotation(d), result, new LinkedList<ClassDescriptor>()); } } break; } } } } catch (MissingClassException e) { logMissingAnnotationClass(e); } catch (CheckedAnalysisException e) { AnalysisContext.logError("Error resolving " + value.getAnnotationClass(), e); } catch (ClassCastException e) { AnalysisContext.logError("ClassCastException " + value.getAnnotationClass(), e); } } }
public class class_name { private static void resolveTypeQualifierDefaults(AnnotationValue value, ElementType defaultFor, LinkedList<AnnotationValue> result) { try { XClass c = Global.getAnalysisCache().getClassAnalysis(XClass.class, value.getAnnotationClass()); AnnotationValue defaultAnnotation = c.getAnnotation(typeQualifierDefault); if (defaultAnnotation == null) { return; // depends on control dependency: [if], data = [none] } for (Object o : (Object[]) defaultAnnotation.getValue("value")) { if (o instanceof EnumValue) { EnumValue e = (EnumValue) o; if (e.desc.equals(elementTypeDescriptor) && e.value.equals(defaultFor.name())) { for (ClassDescriptor d : c.getAnnotationDescriptors()) { if (!d.equals(typeQualifierDefault)) { resolveTypeQualifierNicknames(c.getAnnotation(d), result, new LinkedList<ClassDescriptor>()); // depends on control dependency: [if], data = [none] } } break; } } } } catch (MissingClassException e) { logMissingAnnotationClass(e); } catch (CheckedAnalysisException e) { // depends on control dependency: [catch], data = [none] AnalysisContext.logError("Error resolving " + value.getAnnotationClass(), e); } catch (ClassCastException e) { // depends on control dependency: [catch], data = [none] AnalysisContext.logError("ClassCastException " + value.getAnnotationClass(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean includes(MimeType other) { if (other == null) { return false; } if (this.isWildcardType()) { // */* includes anything return true; } else if (getType().equals(other.getType())) { if (getSubtype().equals(other.getSubtype())) { return true; } if (this.isWildcardSubtype()) { // wildcard with suffix, e.g. application/*+xml int thisPlusIdx = getSubtype().indexOf('+'); if (thisPlusIdx == -1) { return true; } else { // application/*+xml includes application/soap+xml int otherPlusIdx = other.getSubtype().indexOf('+'); if (otherPlusIdx != -1) { String thisSubtypeNoSuffix = getSubtype().substring(0, thisPlusIdx); String thisSubtypeSuffix = getSubtype().substring(thisPlusIdx + 1); String otherSubtypeSuffix = other.getSubtype().substring(otherPlusIdx + 1); if (thisSubtypeSuffix.equals(otherSubtypeSuffix) && WILDCARD_TYPE.equals(thisSubtypeNoSuffix)) { return true; } } } } } return false; } }
public class class_name { public boolean includes(MimeType other) { if (other == null) { return false; // depends on control dependency: [if], data = [none] } if (this.isWildcardType()) { // */* includes anything return true; // depends on control dependency: [if], data = [none] } else if (getType().equals(other.getType())) { if (getSubtype().equals(other.getSubtype())) { return true; // depends on control dependency: [if], data = [none] } if (this.isWildcardSubtype()) { // wildcard with suffix, e.g. application/*+xml int thisPlusIdx = getSubtype().indexOf('+'); if (thisPlusIdx == -1) { return true; // depends on control dependency: [if], data = [none] } else { // application/*+xml includes application/soap+xml int otherPlusIdx = other.getSubtype().indexOf('+'); if (otherPlusIdx != -1) { String thisSubtypeNoSuffix = getSubtype().substring(0, thisPlusIdx); String thisSubtypeSuffix = getSubtype().substring(thisPlusIdx + 1); String otherSubtypeSuffix = other.getSubtype().substring(otherPlusIdx + 1); if (thisSubtypeSuffix.equals(otherSubtypeSuffix) && WILDCARD_TYPE.equals(thisSubtypeNoSuffix)) { return true; // depends on control dependency: [if], data = [none] } } } } } return false; } }
public class class_name { private Stat createStat(final WComponent comp) { Stat stat = new Stat(); stat.setClassName(comp.getClass().getName()); stat.setName(comp.getId()); if (stat.getName() == null) { stat.setName("Unknown"); } if (comp instanceof AbstractWComponent) { Object obj = AbstractWComponent.replaceWComponent((AbstractWComponent) comp); if (obj instanceof AbstractWComponent.WComponentRef) { stat.setRef(obj.toString()); } } ComponentModel model = (ComponentModel) uic.getModel(comp); stat.setModelState(Stat.MDL_NONE); if (model != null) { if (comp.isDefaultState()) { stat.setModelState(Stat.MDL_DEFAULT); } else { addSerializationStat(model, stat); } } return stat; } }
public class class_name { private Stat createStat(final WComponent comp) { Stat stat = new Stat(); stat.setClassName(comp.getClass().getName()); stat.setName(comp.getId()); if (stat.getName() == null) { stat.setName("Unknown"); // depends on control dependency: [if], data = [none] } if (comp instanceof AbstractWComponent) { Object obj = AbstractWComponent.replaceWComponent((AbstractWComponent) comp); if (obj instanceof AbstractWComponent.WComponentRef) { stat.setRef(obj.toString()); // depends on control dependency: [if], data = [none] } } ComponentModel model = (ComponentModel) uic.getModel(comp); stat.setModelState(Stat.MDL_NONE); if (model != null) { if (comp.isDefaultState()) { stat.setModelState(Stat.MDL_DEFAULT); // depends on control dependency: [if], data = [none] } else { addSerializationStat(model, stat); // depends on control dependency: [if], data = [none] } } return stat; } }
public class class_name { @Override protected void parseURL(URL url, String spec, int start, int limit) { boolean hasScheme = start != 0 && spec.charAt(start - 1) == ':'; spec = spec.substring(start, limit); String path; if (hasScheme) { // If the "wsjar:" protocol was specified in the spec, then we are // not parsing relative to another URL. The "jar" protocol // requires that the path contain an entry path and that the base // URL be valid. For backwards compatibility, we enforce neither. path = spec; } else { path = parseRelativeURL(url, spec); } setURL(url, "wsjar", url.getHost(), url.getPort(), url.getAuthority(), url.getUserInfo(), path, url.getQuery(), url.getRef()); } }
public class class_name { @Override protected void parseURL(URL url, String spec, int start, int limit) { boolean hasScheme = start != 0 && spec.charAt(start - 1) == ':'; spec = spec.substring(start, limit); String path; if (hasScheme) { // If the "wsjar:" protocol was specified in the spec, then we are // not parsing relative to another URL. The "jar" protocol // requires that the path contain an entry path and that the base // URL be valid. For backwards compatibility, we enforce neither. path = spec; // depends on control dependency: [if], data = [none] } else { path = parseRelativeURL(url, spec); // depends on control dependency: [if], data = [none] } setURL(url, "wsjar", url.getHost(), url.getPort(), url.getAuthority(), url.getUserInfo(), path, url.getQuery(), url.getRef()); } }
public class class_name { private void loadMappings() { for (int i = 0; i < mappings.length; i++) { String[] pair = mappings[i].split(";"); if (pair.length < 2) { try { throw new AnnotatorConfigurationException(); } catch (AnnotatorConfigurationException e) { LOGGER.error("[OpenNLP Parser: ]" + e.getMessage()); e.printStackTrace(); } } else { String consTag = pair[0]; String casTag = pair[1]; mapTable.put(consTag, casTag); } } } }
public class class_name { private void loadMappings() { for (int i = 0; i < mappings.length; i++) { String[] pair = mappings[i].split(";"); if (pair.length < 2) { try { throw new AnnotatorConfigurationException(); } catch (AnnotatorConfigurationException e) { LOGGER.error("[OpenNLP Parser: ]" + e.getMessage()); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } else { String consTag = pair[0]; String casTag = pair[1]; mapTable.put(consTag, casTag); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void checkVersion(GLVersioned required, GLVersioned object) { if (!debug) { return; } final GLVersion requiredVersion = required.getGLVersion(); final GLVersion objectVersion = object.getGLVersion(); if (objectVersion.getMajor() > requiredVersion.getMajor() && objectVersion.getMinor() > requiredVersion.getMinor()) { throw new IllegalStateException("Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion); } } }
public class class_name { public static void checkVersion(GLVersioned required, GLVersioned object) { if (!debug) { return; // depends on control dependency: [if], data = [none] } final GLVersion requiredVersion = required.getGLVersion(); final GLVersion objectVersion = object.getGLVersion(); if (objectVersion.getMajor() > requiredVersion.getMajor() && objectVersion.getMinor() > requiredVersion.getMinor()) { throw new IllegalStateException("Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion); } } }
public class class_name { public void setBorderWidth(final double WIDTH) { if (null == borderWidth) { _borderWidth = clamp(0.0, 50.0, WIDTH); fireTileEvent(REDRAW_EVENT); } else { borderWidth.set(WIDTH); } } }
public class class_name { public void setBorderWidth(final double WIDTH) { if (null == borderWidth) { _borderWidth = clamp(0.0, 50.0, WIDTH); // depends on control dependency: [if], data = [none] fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { borderWidth.set(WIDTH); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean recursiveDelete(VirtualFile root) { boolean ok = true; if (root.isDirectory()) { final List<VirtualFile> files = root.getChildren(); for (VirtualFile file : files) { ok &= recursiveDelete(file); } return ok && (root.delete() || !root.exists()); } else { ok &= root.delete() || !root.exists(); } return ok; } }
public class class_name { public static boolean recursiveDelete(VirtualFile root) { boolean ok = true; if (root.isDirectory()) { final List<VirtualFile> files = root.getChildren(); for (VirtualFile file : files) { ok &= recursiveDelete(file); // depends on control dependency: [for], data = [file] } return ok && (root.delete() || !root.exists()); // depends on control dependency: [if], data = [none] } else { ok &= root.delete() || !root.exists(); // depends on control dependency: [if], data = [none] } return ok; } }
public class class_name { private void multiTouchController() { if (DEBUG) Log.i("MultiTouch", "Got here 6 - " + mMode + " " + mCurrPt.getNumTouchPoints() + " " + mCurrPt.isDown() + mCurrPt.isMultiTouch()); switch (mMode) { case MODE_NOTHING: if (DEBUG) Log.i("MultiTouch", "MODE_NOTHING"); // Not doing anything currently if (mCurrPt.isDown()) { // Start a new single-point drag selectedObject = objectCanvas.getDraggableObjectAtPoint(mCurrPt); if (selectedObject != null) { // Started a new single-point drag mMode = MODE_DRAG; objectCanvas.selectObject(selectedObject, mCurrPt); anchorAtThisPositionAndScale(); // Don't need any settling time if just placing one finger, there is no noise mSettleStartTime = mSettleEndTime = mCurrPt.getEventTime(); } } break; case MODE_DRAG: if (DEBUG) Log.i("MultiTouch", "MODE_DRAG"); // Currently in a single-point drag if (!mCurrPt.isDown()) { // First finger was released, stop dragging mMode = MODE_NOTHING; objectCanvas.selectObject((selectedObject = null), mCurrPt); } else if (mCurrPt.isMultiTouch()) { // Point 1 was already down and point 2 was just placed down mMode = MODE_PINCH; // Restart the drag with the new drag position (that is at the midpoint between the touchpoints) anchorAtThisPositionAndScale(); // Need to let events settle before moving things, to help with event noise on touchdown mSettleStartTime = mCurrPt.getEventTime(); mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; } else { // Point 1 is still down and point 2 did not change state, just do single-point drag to new location if (mCurrPt.getEventTime() < mSettleEndTime) { // Ignore the first few events if we just stopped stretching, because if finger 2 was kept down while // finger 1 is lifted, then point 1 gets mapped to finger 2. Restart the drag from the new position. anchorAtThisPositionAndScale(); } else { // Keep dragging, move to new point performDragOrPinch(); } } break; case MODE_PINCH: if (DEBUG) Log.i("MultiTouch", "MODE_PINCH"); // Two-point pinch-scale/rotate/translate if (!mCurrPt.isMultiTouch() || !mCurrPt.isDown()) { // Dropped one or both points, stop stretching if (!mCurrPt.isDown()) { // Dropped both points, go back to doing nothing mMode = MODE_NOTHING; objectCanvas.selectObject((selectedObject = null), mCurrPt); } else { // Just dropped point 2, downgrade to a single-point drag mMode = MODE_DRAG; // Restart the pinch with the single-finger position anchorAtThisPositionAndScale(); // Ignore the first few events after the drop, in case we dropped finger 1 and left finger 2 down mSettleStartTime = mCurrPt.getEventTime(); mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; } } else { // Still pinching if (Math.abs(mCurrPt.getX() - mPrevPt.getX()) > MAX_MULTITOUCH_POS_JUMP_SIZE || Math.abs(mCurrPt.getY() - mPrevPt.getY()) > MAX_MULTITOUCH_POS_JUMP_SIZE || Math.abs(mCurrPt.getMultiTouchWidth() - mPrevPt.getMultiTouchWidth()) * .5f > MAX_MULTITOUCH_DIM_JUMP_SIZE || Math.abs(mCurrPt.getMultiTouchHeight() - mPrevPt.getMultiTouchHeight()) * .5f > MAX_MULTITOUCH_DIM_JUMP_SIZE) { // Jumped too far, probably event noise, reset and ignore events for a bit anchorAtThisPositionAndScale(); mSettleStartTime = mCurrPt.getEventTime(); mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; } else if (mCurrPt.eventTime < mSettleEndTime) { // Events have not yet settled, reset anchorAtThisPositionAndScale(); } else { // Stretch to new position and size performDragOrPinch(); } } break; } if (DEBUG) Log.i("MultiTouch", "Got here 7 - " + mMode + " " + mCurrPt.getNumTouchPoints() + " " + mCurrPt.isDown() + mCurrPt.isMultiTouch()); } }
public class class_name { private void multiTouchController() { if (DEBUG) Log.i("MultiTouch", "Got here 6 - " + mMode + " " + mCurrPt.getNumTouchPoints() + " " + mCurrPt.isDown() + mCurrPt.isMultiTouch()); switch (mMode) { case MODE_NOTHING: if (DEBUG) Log.i("MultiTouch", "MODE_NOTHING"); // Not doing anything currently if (mCurrPt.isDown()) { // Start a new single-point drag selectedObject = objectCanvas.getDraggableObjectAtPoint(mCurrPt); // depends on control dependency: [if], data = [none] if (selectedObject != null) { // Started a new single-point drag mMode = MODE_DRAG; // depends on control dependency: [if], data = [none] objectCanvas.selectObject(selectedObject, mCurrPt); // depends on control dependency: [if], data = [(selectedObject] anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] // Don't need any settling time if just placing one finger, there is no noise mSettleStartTime = mSettleEndTime = mCurrPt.getEventTime(); // depends on control dependency: [if], data = [none] } } break; case MODE_DRAG: if (DEBUG) Log.i("MultiTouch", "MODE_DRAG"); // Currently in a single-point drag if (!mCurrPt.isDown()) { // First finger was released, stop dragging mMode = MODE_NOTHING; // depends on control dependency: [if], data = [none] objectCanvas.selectObject((selectedObject = null), mCurrPt); // depends on control dependency: [if], data = [none] } else if (mCurrPt.isMultiTouch()) { // Point 1 was already down and point 2 was just placed down mMode = MODE_PINCH; // depends on control dependency: [if], data = [none] // Restart the drag with the new drag position (that is at the midpoint between the touchpoints) anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] // Need to let events settle before moving things, to help with event noise on touchdown mSettleStartTime = mCurrPt.getEventTime(); // depends on control dependency: [if], data = [none] mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; // depends on control dependency: [if], data = [none] } else { // Point 1 is still down and point 2 did not change state, just do single-point drag to new location if (mCurrPt.getEventTime() < mSettleEndTime) { // Ignore the first few events if we just stopped stretching, because if finger 2 was kept down while // finger 1 is lifted, then point 1 gets mapped to finger 2. Restart the drag from the new position. anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] } else { // Keep dragging, move to new point performDragOrPinch(); // depends on control dependency: [if], data = [none] } } break; case MODE_PINCH: if (DEBUG) Log.i("MultiTouch", "MODE_PINCH"); // Two-point pinch-scale/rotate/translate if (!mCurrPt.isMultiTouch() || !mCurrPt.isDown()) { // Dropped one or both points, stop stretching if (!mCurrPt.isDown()) { // Dropped both points, go back to doing nothing mMode = MODE_NOTHING; // depends on control dependency: [if], data = [none] objectCanvas.selectObject((selectedObject = null), mCurrPt); // depends on control dependency: [if], data = [none] } else { // Just dropped point 2, downgrade to a single-point drag mMode = MODE_DRAG; // depends on control dependency: [if], data = [none] // Restart the pinch with the single-finger position anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] // Ignore the first few events after the drop, in case we dropped finger 1 and left finger 2 down mSettleStartTime = mCurrPt.getEventTime(); // depends on control dependency: [if], data = [none] mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; // depends on control dependency: [if], data = [none] } } else { // Still pinching if (Math.abs(mCurrPt.getX() - mPrevPt.getX()) > MAX_MULTITOUCH_POS_JUMP_SIZE || Math.abs(mCurrPt.getY() - mPrevPt.getY()) > MAX_MULTITOUCH_POS_JUMP_SIZE || Math.abs(mCurrPt.getMultiTouchWidth() - mPrevPt.getMultiTouchWidth()) * .5f > MAX_MULTITOUCH_DIM_JUMP_SIZE || Math.abs(mCurrPt.getMultiTouchHeight() - mPrevPt.getMultiTouchHeight()) * .5f > MAX_MULTITOUCH_DIM_JUMP_SIZE) { // Jumped too far, probably event noise, reset and ignore events for a bit anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] mSettleStartTime = mCurrPt.getEventTime(); // depends on control dependency: [if], data = [none] mSettleEndTime = mSettleStartTime + EVENT_SETTLE_TIME_INTERVAL; // depends on control dependency: [if], data = [none] } else if (mCurrPt.eventTime < mSettleEndTime) { // Events have not yet settled, reset anchorAtThisPositionAndScale(); // depends on control dependency: [if], data = [none] } else { // Stretch to new position and size performDragOrPinch(); // depends on control dependency: [if], data = [none] } } break; } if (DEBUG) Log.i("MultiTouch", "Got here 7 - " + mMode + " " + mCurrPt.getNumTouchPoints() + " " + mCurrPt.isDown() + mCurrPt.isMultiTouch()); } }
public class class_name { public FastByteBuffer append(final FastByteBuffer buff) { if (buff.offset == 0) { return this; } append(buff.buffer, 0, buff.offset); return this; } }
public class class_name { public FastByteBuffer append(final FastByteBuffer buff) { if (buff.offset == 0) { return this; // depends on control dependency: [if], data = [none] } append(buff.buffer, 0, buff.offset); return this; } }
public class class_name { @NotNull public static <T> Observable<Response<T>> from(@NotNull final ApolloQueryWatcher<T> watcher, @NotNull Emitter.BackpressureMode backpressureMode) { checkNotNull(backpressureMode, "backpressureMode == null"); checkNotNull(watcher, "watcher == null"); return Observable.create(new Action1<Emitter<Response<T>>>() { @Override public void call(final Emitter<Response<T>> emitter) { final AtomicBoolean canceled = new AtomicBoolean(); emitter.setCancellation(new Cancellable() { @Override public void cancel() throws Exception { canceled.set(true); watcher.cancel(); } }); watcher.enqueueAndWatch(new ApolloCall.Callback<T>() { @Override public void onResponse(@NotNull Response<T> response) { if (!canceled.get()) { emitter.onNext(response); } } @Override public void onFailure(@NotNull ApolloException e) { Exceptions.throwIfFatal(e); if (!canceled.get()) { emitter.onError(e); } } }); } }, backpressureMode); } }
public class class_name { @NotNull public static <T> Observable<Response<T>> from(@NotNull final ApolloQueryWatcher<T> watcher, @NotNull Emitter.BackpressureMode backpressureMode) { checkNotNull(backpressureMode, "backpressureMode == null"); checkNotNull(watcher, "watcher == null"); return Observable.create(new Action1<Emitter<Response<T>>>() { @Override public void call(final Emitter<Response<T>> emitter) { final AtomicBoolean canceled = new AtomicBoolean(); emitter.setCancellation(new Cancellable() { @Override public void cancel() throws Exception { canceled.set(true); watcher.cancel(); } }); watcher.enqueueAndWatch(new ApolloCall.Callback<T>() { @Override public void onResponse(@NotNull Response<T> response) { if (!canceled.get()) { emitter.onNext(response); // depends on control dependency: [if], data = [none] } } @Override public void onFailure(@NotNull ApolloException e) { Exceptions.throwIfFatal(e); if (!canceled.get()) { emitter.onError(e); // depends on control dependency: [if], data = [none] } } }); } }, backpressureMode); } }
public class class_name { @Override public void close() { try { sortAndReduce(); } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } this.outputCollector.close(); } }
public class class_name { @Override public void close() { try { sortAndReduce(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } // depends on control dependency: [catch], data = [none] this.outputCollector.close(); } }
public class class_name { public boolean setReferences (boolean references) { boolean old = this.references; if (references == old) return references; if (old) { referenceResolver.reset(); readObject = null; } this.references = references; if (references && referenceResolver == null) referenceResolver = new MapReferenceResolver(); if (TRACE) trace("kryo", "References: " + references); return !references; } }
public class class_name { public boolean setReferences (boolean references) { boolean old = this.references; if (references == old) return references; if (old) { referenceResolver.reset(); // depends on control dependency: [if], data = [none] readObject = null; // depends on control dependency: [if], data = [none] } this.references = references; if (references && referenceResolver == null) referenceResolver = new MapReferenceResolver(); if (TRACE) trace("kryo", "References: " + references); return !references; } }
public class class_name { private final Command takeExecutingCommand() { try { return this.commandAlreadySent.take(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return null; } }
public class class_name { private final Command takeExecutingCommand() { try { return this.commandAlreadySent.take(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @Override public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { if (!isEnabled()) { return; } try { final MavenArtifact ma = searcher.searchSha1(dependency.getSha1sum()); dependency.addAsEvidence("nexus", ma, Confidence.HIGH); boolean pomAnalyzed = false; LOGGER.debug("POM URL {}", ma.getPomUrl()); for (Evidence e : dependency.getEvidence(EvidenceType.VENDOR)) { if ("pom".equals(e.getSource())) { pomAnalyzed = true; break; } } if (!pomAnalyzed && ma.getPomUrl() != null) { File pomFile = null; try { final File baseDir = getSettings().getTempDirectory(); pomFile = File.createTempFile("pom", ".xml", baseDir); if (!pomFile.delete()) { LOGGER.warn("Unable to fetch pom.xml for {} from Nexus repository; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); LOGGER.debug("Unable to delete temp file"); } LOGGER.debug("Downloading {}", ma.getPomUrl()); final Downloader downloader = new Downloader(getSettings()); downloader.fetchFile(new URL(ma.getPomUrl()), pomFile); PomUtils.analyzePOM(dependency, pomFile); } catch (DownloadFailedException ex) { LOGGER.warn("Unable to download pom.xml for {} from Nexus repository; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); } finally { if (pomFile != null && pomFile.exists() && !FileUtils.deleteQuietly(pomFile)) { LOGGER.debug("Failed to delete temporary pom file {}", pomFile.toString()); pomFile.deleteOnExit(); } } } } catch (IllegalArgumentException iae) { //dependency.addAnalysisException(new AnalysisException("Invalid SHA-1")); LOGGER.info("invalid sha-1 hash on {}", dependency.getFileName()); } catch (FileNotFoundException fnfe) { //dependency.addAnalysisException(new AnalysisException("Artifact not found on repository")); LOGGER.debug("Artifact not found in repository '{}'", dependency.getFileName()); LOGGER.debug(fnfe.getMessage(), fnfe); } catch (IOException ioe) { //dependency.addAnalysisException(new AnalysisException("Could not connect to repository", ioe)); LOGGER.debug("Could not connect to nexus repository", ioe); } } }
public class class_name { @Override public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException { if (!isEnabled()) { return; } try { final MavenArtifact ma = searcher.searchSha1(dependency.getSha1sum()); dependency.addAsEvidence("nexus", ma, Confidence.HIGH); boolean pomAnalyzed = false; LOGGER.debug("POM URL {}", ma.getPomUrl()); for (Evidence e : dependency.getEvidence(EvidenceType.VENDOR)) { if ("pom".equals(e.getSource())) { pomAnalyzed = true; // depends on control dependency: [if], data = [none] break; } } if (!pomAnalyzed && ma.getPomUrl() != null) { File pomFile = null; try { final File baseDir = getSettings().getTempDirectory(); pomFile = File.createTempFile("pom", ".xml", baseDir); // depends on control dependency: [try], data = [none] if (!pomFile.delete()) { LOGGER.warn("Unable to fetch pom.xml for {} from Nexus repository; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); // depends on control dependency: [if], data = [none] LOGGER.debug("Unable to delete temp file"); // depends on control dependency: [if], data = [none] } LOGGER.debug("Downloading {}", ma.getPomUrl()); // depends on control dependency: [try], data = [none] final Downloader downloader = new Downloader(getSettings()); downloader.fetchFile(new URL(ma.getPomUrl()), pomFile); // depends on control dependency: [try], data = [none] PomUtils.analyzePOM(dependency, pomFile); // depends on control dependency: [try], data = [none] } catch (DownloadFailedException ex) { LOGGER.warn("Unable to download pom.xml for {} from Nexus repository; " + "this could result in undetected CPE/CVEs.", dependency.getFileName()); } finally { // depends on control dependency: [catch], data = [none] if (pomFile != null && pomFile.exists() && !FileUtils.deleteQuietly(pomFile)) { LOGGER.debug("Failed to delete temporary pom file {}", pomFile.toString()); // depends on control dependency: [if], data = [none] pomFile.deleteOnExit(); // depends on control dependency: [if], data = [none] } } } } catch (IllegalArgumentException iae) { //dependency.addAnalysisException(new AnalysisException("Invalid SHA-1")); LOGGER.info("invalid sha-1 hash on {}", dependency.getFileName()); } catch (FileNotFoundException fnfe) { //dependency.addAnalysisException(new AnalysisException("Artifact not found on repository")); LOGGER.debug("Artifact not found in repository '{}'", dependency.getFileName()); LOGGER.debug(fnfe.getMessage(), fnfe); } catch (IOException ioe) { //dependency.addAnalysisException(new AnalysisException("Could not connect to repository", ioe)); LOGGER.debug("Could not connect to nexus repository", ioe); } } }
public class class_name { public int invoke() { int workCount = 0; if (isRunning) { try { workCount = agent.doWork(); } catch (final InterruptedException | ClosedByInterruptException ignore) { close(); Thread.currentThread().interrupt(); } catch (final AgentTerminationException ex) { handleError(ex); close(); } catch (final Throwable throwable) { handleError(throwable); } } return workCount; } }
public class class_name { public int invoke() { int workCount = 0; if (isRunning) { try { workCount = agent.doWork(); // depends on control dependency: [try], data = [none] } catch (final InterruptedException | ClosedByInterruptException ignore) { close(); Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] catch (final AgentTerminationException ex) { handleError(ex); close(); } // depends on control dependency: [catch], data = [none] catch (final Throwable throwable) { handleError(throwable); } // depends on control dependency: [catch], data = [none] } return workCount; } }
public class class_name { @Pure public static String getPreferredAttributeNameForRoadType() { final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class); if (prefs != null) { return prefs.get("ROAD_TYPE_ATTR_NAME", DEFAULT_ATTR_ROAD_TYPE); //$NON-NLS-1$ } return DEFAULT_ATTR_ROAD_TYPE; } }
public class class_name { @Pure public static String getPreferredAttributeNameForRoadType() { final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class); if (prefs != null) { return prefs.get("ROAD_TYPE_ATTR_NAME", DEFAULT_ATTR_ROAD_TYPE); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } return DEFAULT_ATTR_ROAD_TYPE; } }
public class class_name { public static void setBackgroundColor(int color, final View view) { if (color == MULTICOLOR) { ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { return new LinearGradient(0, 0, 0, height, new int[]{0xFFFF0000, 0xFF0000FF, 0xFF00FF00}, new float[]{0.1f, 0.5f, 0.9f}, Shader.TileMode.REPEAT); } }; PaintDrawable paintDrawable = new PaintDrawable(); paintDrawable.setShape(new RectShape()); paintDrawable.setShaderFactory(sf); view.setBackgroundDrawable(paintDrawable); } else if (color == BLACK_WHITE) { ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { return new LinearGradient(0, 0, 0, height, new int[]{0xFFFFFFFF, 0xFF000000}, new float[]{0f, 1f}, Shader.TileMode.REPEAT); } }; PaintDrawable paintDrawable = new PaintDrawable(); paintDrawable.setShape(new RectShape()); paintDrawable.setShaderFactory(sf); view.setBackgroundDrawable(paintDrawable); } else { view.setBackgroundColor(color); } } }
public class class_name { public static void setBackgroundColor(int color, final View view) { if (color == MULTICOLOR) { ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { return new LinearGradient(0, 0, 0, height, new int[]{0xFFFF0000, 0xFF0000FF, 0xFF00FF00}, new float[]{0.1f, 0.5f, 0.9f}, Shader.TileMode.REPEAT); } }; PaintDrawable paintDrawable = new PaintDrawable(); paintDrawable.setShape(new RectShape()); // depends on control dependency: [if], data = [none] paintDrawable.setShaderFactory(sf); // depends on control dependency: [if], data = [none] view.setBackgroundDrawable(paintDrawable); // depends on control dependency: [if], data = [none] } else if (color == BLACK_WHITE) { ShapeDrawable.ShaderFactory sf = new ShapeDrawable.ShaderFactory() { @Override public Shader resize(int width, int height) { return new LinearGradient(0, 0, 0, height, new int[]{0xFFFFFFFF, 0xFF000000}, new float[]{0f, 1f}, Shader.TileMode.REPEAT); } }; PaintDrawable paintDrawable = new PaintDrawable(); paintDrawable.setShape(new RectShape()); // depends on control dependency: [if], data = [none] paintDrawable.setShaderFactory(sf); // depends on control dependency: [if], data = [none] view.setBackgroundDrawable(paintDrawable); // depends on control dependency: [if], data = [none] } else { view.setBackgroundColor(color); // depends on control dependency: [if], data = [(color] } } }
public class class_name { public CloseableReference<byte[]> get(int size) { Preconditions.checkArgument(size > 0, "Size must be greater than zero"); Preconditions.checkArgument(size <= mMaxByteArraySize, "Requested size is too big"); mSemaphore.acquireUninterruptibly(); try { byte[] byteArray = getByteArray(size); return CloseableReference.of(byteArray, mResourceReleaser); } catch (Throwable t) { mSemaphore.release(); throw Throwables.propagate(t); } } }
public class class_name { public CloseableReference<byte[]> get(int size) { Preconditions.checkArgument(size > 0, "Size must be greater than zero"); Preconditions.checkArgument(size <= mMaxByteArraySize, "Requested size is too big"); mSemaphore.acquireUninterruptibly(); try { byte[] byteArray = getByteArray(size); return CloseableReference.of(byteArray, mResourceReleaser); // depends on control dependency: [try], data = [none] } catch (Throwable t) { mSemaphore.release(); throw Throwables.propagate(t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean start(String home, File options) { File homeDirectory = new File(home); if (!homeDirectory.exists()) return false; stop(home); try { List<String> command = new ArrayList<String>(); command.add(java); command.add("-Dironjacamar.home=" + home); if (options != null && options.exists()) command.add("-Dironjacamar.options=" + options.getAbsolutePath()); command.add("-Djava.net.preferIPv4Stack=true"); command.add("-Djgroups.bind_addr=127.0.0.1"); command.add("-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"); command.add("-Dlog4j.defaultInitOverride=true"); command.add("-jar"); command.add(home + "/bin/ironjacamar-sjc.jar"); ProcessBuilder pb = new ProcessBuilder(command); pb.redirectErrorStream(true); Map<String, String> environment = pb.environment(); environment.put("ironjacamar.home", home); Process p = pb.start(); instances.put(home, p); return true; } catch (Throwable t) { // Ignore } return false; } }
public class class_name { public boolean start(String home, File options) { File homeDirectory = new File(home); if (!homeDirectory.exists()) return false; stop(home); try { List<String> command = new ArrayList<String>(); command.add(java); // depends on control dependency: [try], data = [none] command.add("-Dironjacamar.home=" + home); // depends on control dependency: [try], data = [none] if (options != null && options.exists()) command.add("-Dironjacamar.options=" + options.getAbsolutePath()); command.add("-Djava.net.preferIPv4Stack=true"); // depends on control dependency: [try], data = [none] command.add("-Djgroups.bind_addr=127.0.0.1"); // depends on control dependency: [try], data = [none] command.add("-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl"); command.add("-Dlog4j.defaultInitOverride=true"); // depends on control dependency: [try], data = [none] command.add("-jar"); // depends on control dependency: [try], data = [none] command.add(home + "/bin/ironjacamar-sjc.jar"); // depends on control dependency: [try], data = [none] ProcessBuilder pb = new ProcessBuilder(command); pb.redirectErrorStream(true); // depends on control dependency: [try], data = [none] Map<String, String> environment = pb.environment(); environment.put("ironjacamar.home", home); // depends on control dependency: [try], data = [none] Process p = pb.start(); instances.put(home, p); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Throwable t) { // Ignore } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { private boolean readMetaData() throws InvalidDataException { final ByteBuffer buf = storage.get(0); int magic1, magic2, t_b_order_leaf, t_b_order_internal, t_blockSize; // sanity boolean isClean = false; magic1 = buf.getInt(); if (magic1 != MAGIC_1) { throw new InvalidDataException("Invalid metadata (MAGIC1)"); } t_blockSize = buf.getInt(); if (t_blockSize != blockSize) { throw new InvalidDataException("Invalid metadata (blockSize) " + t_blockSize + " != " + blockSize); } t_b_order_leaf = buf.getInt(); t_b_order_internal = buf.getInt(); if (t_b_order_leaf != b_order_leaf) { throw new InvalidDataException("Invalid metadata (b-order leaf) " + t_b_order_leaf + " != " + b_order_leaf); } if (t_b_order_internal != b_order_internal) { throw new InvalidDataException("Invalid metadata (b-order internal) " + t_b_order_internal + " != " + b_order_internal); } storageBlock = buf.getInt(); rootIdx = buf.getInt(); lowIdx = buf.getInt(); highIdx = buf.getInt(); elements = buf.getInt(); height = buf.getInt(); maxInternalNodes = buf.getInt(); maxLeafNodes = buf.getInt(); isClean = ((buf.get() == ((byte) 0xEA)) ? true : false); magic2 = buf.getInt(); if (magic2 != MAGIC_2) { throw new InvalidDataException("Invalid metadata (MAGIC2)"); } if (log.isDebugEnabled()) { log.debug(this.getClass().getName() + "::readMetaData() elements=" + elements + " rootIdx=" + rootIdx); } storage.release(buf); // Clear Caches clearReadCaches(); clearWriteCaches(); if (isClean && fileFreeBlocks.exists()) { try { final SimpleBitSet newFreeBlocks = SimpleBitSet.deserializeFromFile(fileFreeBlocks); freeBlocks = newFreeBlocks; } catch (IOException e) { log.error("IOException in readMetaData()", e); } } return isClean; } }
public class class_name { private boolean readMetaData() throws InvalidDataException { final ByteBuffer buf = storage.get(0); int magic1, magic2, t_b_order_leaf, t_b_order_internal, t_blockSize; // sanity boolean isClean = false; magic1 = buf.getInt(); if (magic1 != MAGIC_1) { throw new InvalidDataException("Invalid metadata (MAGIC1)"); } t_blockSize = buf.getInt(); if (t_blockSize != blockSize) { throw new InvalidDataException("Invalid metadata (blockSize) " + t_blockSize + " != " + blockSize); } t_b_order_leaf = buf.getInt(); t_b_order_internal = buf.getInt(); if (t_b_order_leaf != b_order_leaf) { throw new InvalidDataException("Invalid metadata (b-order leaf) " + t_b_order_leaf + " != " + b_order_leaf); } if (t_b_order_internal != b_order_internal) { throw new InvalidDataException("Invalid metadata (b-order internal) " + t_b_order_internal + " != " + b_order_internal); } storageBlock = buf.getInt(); rootIdx = buf.getInt(); lowIdx = buf.getInt(); highIdx = buf.getInt(); elements = buf.getInt(); height = buf.getInt(); maxInternalNodes = buf.getInt(); maxLeafNodes = buf.getInt(); isClean = ((buf.get() == ((byte) 0xEA)) ? true : false); magic2 = buf.getInt(); if (magic2 != MAGIC_2) { throw new InvalidDataException("Invalid metadata (MAGIC2)"); } if (log.isDebugEnabled()) { log.debug(this.getClass().getName() + "::readMetaData() elements=" + elements + " rootIdx=" + rootIdx); } storage.release(buf); // Clear Caches clearReadCaches(); clearWriteCaches(); if (isClean && fileFreeBlocks.exists()) { try { final SimpleBitSet newFreeBlocks = SimpleBitSet.deserializeFromFile(fileFreeBlocks); freeBlocks = newFreeBlocks; // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error("IOException in readMetaData()", e); } // depends on control dependency: [catch], data = [none] } return isClean; } }
public class class_name { public static List<Field> getAllDeclaredFields(Object object) { List<Field> allFields = new ArrayList<>(); Class<?> objClass = object.getClass(); // Loop through the class hierarchy while (objClass != Object.class) { allFields.addAll(Arrays.asList(objClass.getDeclaredFields())); objClass = objClass.getSuperclass(); } allFields.removeIf(Field::isSynthetic); allFields.forEach(f -> f.setAccessible(true)); return allFields; } }
public class class_name { public static List<Field> getAllDeclaredFields(Object object) { List<Field> allFields = new ArrayList<>(); Class<?> objClass = object.getClass(); // Loop through the class hierarchy while (objClass != Object.class) { allFields.addAll(Arrays.asList(objClass.getDeclaredFields())); // depends on control dependency: [while], data = [(objClass] objClass = objClass.getSuperclass(); // depends on control dependency: [while], data = [none] } allFields.removeIf(Field::isSynthetic); allFields.forEach(f -> f.setAccessible(true)); return allFields; } }
public class class_name { private void refineReferenceVector() { referenceVector = new Vector3d(Y_AXIS); if (rotationGroup.getPointGroup().startsWith("C")) { referenceVector = getReferenceAxisCylicWithSubunitAlignment(); } else if (rotationGroup.getPointGroup().startsWith("D")) { referenceVector = getReferenceAxisDihedralWithSubunitAlignment(); } referenceVector = orthogonalize(principalRotationVector, referenceVector); } }
public class class_name { private void refineReferenceVector() { referenceVector = new Vector3d(Y_AXIS); if (rotationGroup.getPointGroup().startsWith("C")) { referenceVector = getReferenceAxisCylicWithSubunitAlignment(); // depends on control dependency: [if], data = [none] } else if (rotationGroup.getPointGroup().startsWith("D")) { referenceVector = getReferenceAxisDihedralWithSubunitAlignment(); // depends on control dependency: [if], data = [none] } referenceVector = orthogonalize(principalRotationVector, referenceVector); } }
public class class_name { private void loadTldFromClassloader(GlobalTagLibConfig globalTagLibConfig, TldParser tldParser) { for (Iterator itr = globalTagLibConfig.getTldPathList().iterator(); itr.hasNext();) { TldPathConfig tldPathConfig = (TldPathConfig) itr.next(); InputStream is = globalTagLibConfig.getClassloader().getResourceAsStream(tldPathConfig.getTldPath()); JspInputSource tldInputSource = new JspInputSourceFromInputStreamImpl(is); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getRelativeURL(): [" + tldInputSource.getRelativeURL() + "]"); logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getAbsoluteURL(): [" + tldInputSource.getAbsoluteURL() + "]"); logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getContextURL(): [" + tldInputSource.getContextURL() + "]"); logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "globalTagLibConfig.getJarURL(): [" + globalTagLibConfig.getJarURL() + "]"); logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldPathConfig.getTldPath(): [" + tldPathConfig.getTldPath() + "]"); } try { TagLibraryInfoImpl tli = tldParser.parseTLD(tldInputSource, is, globalTagLibConfig.getJarURL().toExternalForm()); if (tli.getReliableURN() != null) { if (containsKey(tli.getReliableURN()) == false) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "Global jar tld loaded for {0}", tli.getReliableURN()); } tli.setURI(tli.getReliableURN()); put(tli.getReliableURN(), tli); tldPathConfig.setUri(tli.getReliableURN()); eventListenerList.addAll(tldParser.getEventListenerList()); } } else { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) { logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to find a uri tag in [" + tldInputSource.getAbsoluteURL() + "]"); } } } catch (JspCoreException e) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) { logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to load tld in jar. uri = [" + tldInputSource.getAbsoluteURL() + "]", e); } } } } }
public class class_name { private void loadTldFromClassloader(GlobalTagLibConfig globalTagLibConfig, TldParser tldParser) { for (Iterator itr = globalTagLibConfig.getTldPathList().iterator(); itr.hasNext();) { TldPathConfig tldPathConfig = (TldPathConfig) itr.next(); InputStream is = globalTagLibConfig.getClassloader().getResourceAsStream(tldPathConfig.getTldPath()); JspInputSource tldInputSource = new JspInputSourceFromInputStreamImpl(is); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getRelativeURL(): [" + tldInputSource.getRelativeURL() + "]"); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getAbsoluteURL(): [" + tldInputSource.getAbsoluteURL() + "]"); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldInputSource.getContextURL(): [" + tldInputSource.getContextURL() + "]"); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "globalTagLibConfig.getJarURL(): [" + globalTagLibConfig.getJarURL() + "]"); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "tldPathConfig.getTldPath(): [" + tldPathConfig.getTldPath() + "]"); // depends on control dependency: [if], data = [none] } try { TagLibraryInfoImpl tli = tldParser.parseTLD(tldInputSource, is, globalTagLibConfig.getJarURL().toExternalForm()); if (tli.getReliableURN() != null) { if (containsKey(tli.getReliableURN()) == false) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, "loadTldFromClassloader", "Global jar tld loaded for {0}", tli.getReliableURN()); // depends on control dependency: [if], data = [none] } tli.setURI(tli.getReliableURN()); // depends on control dependency: [if], data = [none] put(tli.getReliableURN(), tli); // depends on control dependency: [if], data = [none] tldPathConfig.setUri(tli.getReliableURN()); // depends on control dependency: [if], data = [none] eventListenerList.addAll(tldParser.getEventListenerList()); // depends on control dependency: [if], data = [none] } } else { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) { logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to find a uri tag in [" + tldInputSource.getAbsoluteURL() + "]"); // depends on control dependency: [if], data = [none] } } } catch (JspCoreException e) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.WARNING)) { logger.logp(Level.WARNING, CLASS_NAME, "loadTldFromClassloader", "jsp warning failed to load tld in jar. uri = [" + tldInputSource.getAbsoluteURL() + "]", e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void addTreeItem(CmsObject cms, CmsResource resource, CmsUUID parentId) { List<Container.Filter> filters = Lists.newArrayList(getContainerFilters()); // getItem only finds an existing item if it isn't filtered out by the container // filters, so we temporarily remove the filters to access the complete data set removeAllContainerFilters(); try { Item resourceItem = getItem(resource.getStructureId()); if (resourceItem == null) { resourceItem = addItem(resource.getStructureId()); } fillProperties(cms, resourceItem, resource, parentId); if (resource.isFile()) { setChildrenAllowed(resource.getStructureId(), false); } if (parentId != null) { setParent(resource.getStructureId(), parentId); } } finally { for (Container.Filter filter : filters) { addContainerFilter(filter); } } } }
public class class_name { public void addTreeItem(CmsObject cms, CmsResource resource, CmsUUID parentId) { List<Container.Filter> filters = Lists.newArrayList(getContainerFilters()); // getItem only finds an existing item if it isn't filtered out by the container // filters, so we temporarily remove the filters to access the complete data set removeAllContainerFilters(); try { Item resourceItem = getItem(resource.getStructureId()); if (resourceItem == null) { resourceItem = addItem(resource.getStructureId()); // depends on control dependency: [if], data = [none] } fillProperties(cms, resourceItem, resource, parentId); // depends on control dependency: [try], data = [none] if (resource.isFile()) { setChildrenAllowed(resource.getStructureId(), false); // depends on control dependency: [if], data = [none] } if (parentId != null) { setParent(resource.getStructureId(), parentId); // depends on control dependency: [if], data = [none] } } finally { for (Container.Filter filter : filters) { addContainerFilter(filter); // depends on control dependency: [for], data = [filter] } } } }