code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @SuppressWarnings("unchecked") public void start() { log.trace("start()"); // classes pool is not sorted; it is a hash map for performance reasons // also, a managed class may appear multiple times if have multiple interfaces // bellow sorted set is used to ensure ascending order on managed classes instantiation // comparison is based on managed class key that is created incrementally Set<ManagedClassSPI> sortedClasses = new TreeSet<>(new Comparator<ManagedClassSPI>() { @Override public int compare(ManagedClassSPI o1, ManagedClassSPI o2) { // compare first with second to ensure ascending sorting return o1.getKey().compareTo(o2.getKey()); } }); for (ManagedClassSPI managedClass : classesPool.values()) { if (managedClass.isAutoInstanceCreation()) { sortedClasses.add(managedClass); } // process only implementations of managed life cycle interface // if (Types.isKindOf(managedClass.getImplementationClass(), ManagedLifeCycle.class)) { // sortedClasses.add(managedClass); // } } for (ManagedClassSPI managedClass : sortedClasses) { // call getInstance to ensure managed instance with managed life cycle is started // if there are more than one single interface peek one, no matter which; the simple way is to peek the first // getInstance() will create instance only if not already exist; returned value is ignored log.debug("Create managed instance with managed life cycle |%s|.", managedClass.getInterfaceClass()); getInstance((Class<? super Object>) managedClass.getInterfaceClass()); } } }
public class class_name { @SuppressWarnings("unchecked") public void start() { log.trace("start()"); // classes pool is not sorted; it is a hash map for performance reasons // also, a managed class may appear multiple times if have multiple interfaces // bellow sorted set is used to ensure ascending order on managed classes instantiation // comparison is based on managed class key that is created incrementally Set<ManagedClassSPI> sortedClasses = new TreeSet<>(new Comparator<ManagedClassSPI>() { @Override public int compare(ManagedClassSPI o1, ManagedClassSPI o2) { // compare first with second to ensure ascending sorting return o1.getKey().compareTo(o2.getKey()); } }); for (ManagedClassSPI managedClass : classesPool.values()) { if (managedClass.isAutoInstanceCreation()) { sortedClasses.add(managedClass); // depends on control dependency: [if], data = [none] } // process only implementations of managed life cycle interface // if (Types.isKindOf(managedClass.getImplementationClass(), ManagedLifeCycle.class)) { // sortedClasses.add(managedClass); // } } for (ManagedClassSPI managedClass : sortedClasses) { // call getInstance to ensure managed instance with managed life cycle is started // if there are more than one single interface peek one, no matter which; the simple way is to peek the first // getInstance() will create instance only if not already exist; returned value is ignored log.debug("Create managed instance with managed life cycle |%s|.", managedClass.getInterfaceClass()); // depends on control dependency: [for], data = [managedClass] getInstance((Class<? super Object>) managedClass.getInterfaceClass()); // depends on control dependency: [for], data = [managedClass] } } }
public class class_name { public void start(Fragment fragment) { Intent i = new Intent(fragment.getContext(), CalculatorActivity.class); if (!TextUtils.isEmpty(activityTitle)) { i.putExtra(CalculatorActivity.TITLE_ACTIVITY, activityTitle); } if (!TextUtils.isEmpty(value)) { i.putExtra(CalculatorActivity.VALUE, value); } fragment.startActivityForResult(i, CalculatorActivity.REQUEST_RESULT_SUCCESSFUL); } }
public class class_name { public void start(Fragment fragment) { Intent i = new Intent(fragment.getContext(), CalculatorActivity.class); if (!TextUtils.isEmpty(activityTitle)) { i.putExtra(CalculatorActivity.TITLE_ACTIVITY, activityTitle); // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(value)) { i.putExtra(CalculatorActivity.VALUE, value); // depends on control dependency: [if], data = [none] } fragment.startActivityForResult(i, CalculatorActivity.REQUEST_RESULT_SUCCESSFUL); } }
public class class_name { @Nonnull public String printLog4jEffectiveConfiguration() { try { StringWriter writer = new StringWriter(); PropertyPrinter propertyPrinter = new PropertyPrinter(new PrintWriter(writer)); propertyPrinter.print(new PrintWriter(writer)); return writer.toString(); } catch (RuntimeException e) { logger.warn("Exception generating log4j configuration", e); throw e; } } }
public class class_name { @Nonnull public String printLog4jEffectiveConfiguration() { try { StringWriter writer = new StringWriter(); PropertyPrinter propertyPrinter = new PropertyPrinter(new PrintWriter(writer)); propertyPrinter.print(new PrintWriter(writer)); // depends on control dependency: [try], data = [none] return writer.toString(); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { logger.warn("Exception generating log4j configuration", e); throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Optional<ImmutableSubstitution<ImmutableTerm>> computeMGUS(ImmutableSubstitution<? extends ImmutableTerm> substitution1, ImmutableSubstitution<? extends ImmutableTerm> substitution2) { ImmutableList.Builder<ImmutableTerm> firstArgListBuilder = ImmutableList.builder(); ImmutableList.Builder<ImmutableTerm> secondArgListBuilder = ImmutableList.builder(); for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution1.getImmutableMap().entrySet()) { firstArgListBuilder.add(entry.getKey()); secondArgListBuilder.add(entry.getValue()); } for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution2.getImmutableMap().entrySet()) { firstArgListBuilder.add(entry.getKey()); secondArgListBuilder.add(entry.getValue()); } ImmutableList<ImmutableTerm> firstArgList = firstArgListBuilder.build(); ImmutableList<ImmutableTerm> secondArgList = secondArgListBuilder.build(); return computeMGU(firstArgList, secondArgList); } }
public class class_name { public Optional<ImmutableSubstitution<ImmutableTerm>> computeMGUS(ImmutableSubstitution<? extends ImmutableTerm> substitution1, ImmutableSubstitution<? extends ImmutableTerm> substitution2) { ImmutableList.Builder<ImmutableTerm> firstArgListBuilder = ImmutableList.builder(); ImmutableList.Builder<ImmutableTerm> secondArgListBuilder = ImmutableList.builder(); for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution1.getImmutableMap().entrySet()) { firstArgListBuilder.add(entry.getKey()); // depends on control dependency: [for], data = [entry] secondArgListBuilder.add(entry.getValue()); // depends on control dependency: [for], data = [entry] } for (Map.Entry<Variable, ? extends ImmutableTerm> entry : substitution2.getImmutableMap().entrySet()) { firstArgListBuilder.add(entry.getKey()); // depends on control dependency: [for], data = [entry] secondArgListBuilder.add(entry.getValue()); // depends on control dependency: [for], data = [entry] } ImmutableList<ImmutableTerm> firstArgList = firstArgListBuilder.build(); ImmutableList<ImmutableTerm> secondArgList = secondArgListBuilder.build(); return computeMGU(firstArgList, secondArgList); } }
public class class_name { public Axis addLabel(String label, double location) { if (labels == null) { labels = new HashMap<>(); } labels.put(label, location); setSlice(); initGridLines(); initGridLabels(); return this; } }
public class class_name { public Axis addLabel(String label, double location) { if (labels == null) { labels = new HashMap<>(); // depends on control dependency: [if], data = [none] } labels.put(label, location); setSlice(); initGridLines(); initGridLabels(); return this; } }
public class class_name { public static IAtomContainer getAtomContainer(IMolecularFormula formula, IAtomContainer atomContainer) { for (IIsotope isotope : formula.isotopes()) { int occur = formula.getIsotopeCount(isotope); for (int i = 0; i < occur; i++) { IAtom atom = formula.getBuilder().newInstance(IAtom.class, isotope); atom.setImplicitHydrogenCount(0); atomContainer.addAtom(atom); } } return atomContainer; } }
public class class_name { public static IAtomContainer getAtomContainer(IMolecularFormula formula, IAtomContainer atomContainer) { for (IIsotope isotope : formula.isotopes()) { int occur = formula.getIsotopeCount(isotope); for (int i = 0; i < occur; i++) { IAtom atom = formula.getBuilder().newInstance(IAtom.class, isotope); atom.setImplicitHydrogenCount(0); // depends on control dependency: [for], data = [none] atomContainer.addAtom(atom); // depends on control dependency: [for], data = [none] } } return atomContainer; } }
public class class_name { public void setTimes(java.util.Collection<String> times) { if (times == null) { this.times = null; return; } this.times = new java.util.ArrayList<String>(times); } }
public class class_name { public void setTimes(java.util.Collection<String> times) { if (times == null) { this.times = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.times = new java.util.ArrayList<String>(times); } }
public class class_name { private void associate() { if (cm instanceof LazyAssociatableConnectionManager) { try { LazyAssociatableConnectionManager lacm = (LazyAssociatableConnectionManager)cm; lacm.associateConnection(this, mcf, cri); } catch (Throwable t) { log.severe("Associate" + t.getMessage()); } } } }
public class class_name { private void associate() { if (cm instanceof LazyAssociatableConnectionManager) { try { LazyAssociatableConnectionManager lacm = (LazyAssociatableConnectionManager)cm; lacm.associateConnection(this, mcf, cri); // depends on control dependency: [try], data = [none] } catch (Throwable t) { log.severe("Associate" + t.getMessage()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public OCommandRequest command(final OCommandRequest iCommand) { checkSecurity(ORule.ResourceGeneric.COMMAND, ORole.PERMISSION_READ); checkIfActive(); final OCommandRequestInternal command = (OCommandRequestInternal) iCommand; try { command.reset(); return command; } catch (Exception e) { throw OException.wrapException(new ODatabaseException("Error on command execution"), e); } } }
public class class_name { public OCommandRequest command(final OCommandRequest iCommand) { checkSecurity(ORule.ResourceGeneric.COMMAND, ORole.PERMISSION_READ); checkIfActive(); final OCommandRequestInternal command = (OCommandRequestInternal) iCommand; try { command.reset(); // depends on control dependency: [try], data = [none] return command; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw OException.wrapException(new ODatabaseException("Error on command execution"), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Matcher<?> getMatcher(String matcherName, String[] matcherParameter) { try { if (noArgumentMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null); } } if (noArgumentCollectionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null); } } Assert.isTrue(matcherParameter.length > 0, "Missing matcher parameter"); if (containerMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Matcher.class); if (matcherMethod != null) { String matcherExpression = matcherParameter[0]; if (matcherExpression.contains("(") && matcherExpression.contains(")")) { String nestedMatcherName = matcherExpression.trim().substring(0, matcherExpression.trim().indexOf("(")); String[] nestedMatcherParameter = matcherExpression.trim().substring(nestedMatcherName.length() + 1, matcherExpression.trim().length() - 1).split(","); return (Matcher) matcherMethod.invoke(null, getMatcher(nestedMatcherName, nestedMatcherParameter)); } } } if (iterableMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Iterable.class); if (matcherMethod != null) { List<Matcher> nestedMatchers = new ArrayList<>(); for (String matcherExpression : matcherParameter) { String nestedMatcherName = matcherExpression.trim().substring(0, matcherExpression.trim().indexOf("(")); String nestedMatcherParameter = matcherExpression.trim().substring(nestedMatcherName.length() + 1, matcherExpression.trim().length() - 1); nestedMatchers.add(getMatcher(nestedMatcherName, new String[] { nestedMatcherParameter })); } return (Matcher) matcherMethod.invoke(null, nestedMatchers); } } Optional<HamcrestMatcherProvider> matcherProvider = customMatchers.stream() .filter(provider -> provider.getName().equals(matcherName)) .findFirst(); if (matcherProvider.isPresent()) { return matcherProvider.get().provideMatcher(matcherParameter[0]); } if (matchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, String.class); if (matcherMethod == null) { matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); } if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); } } if (numericMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, double.class, double.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, Double.valueOf(matcherParameter[0]), matcherParameter.length > 1 ? Double.valueOf(matcherParameter[1]) : 0.0D); } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Comparable.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); } } if (collectionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, int.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, Integer.valueOf(matcherParameter[0])); } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object[].class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { matcherParameter }); } } if (mapMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class, Object.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0], matcherParameter[1]); } } if (optionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object[].class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { matcherParameter }); } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Collection.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { getCollection(StringUtils.arrayToCommaDelimitedString(matcherParameter)) }); } } } catch (InvocationTargetException | IllegalAccessException e) { throw new CitrusRuntimeException("Failed to invoke matcher", e); } throw new CitrusRuntimeException("Unsupported matcher: " + matcherName); } }
public class class_name { private Matcher<?> getMatcher(String matcherName, String[] matcherParameter) { try { if (noArgumentMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null); // depends on control dependency: [if], data = [null)] } } if (noArgumentCollectionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null); // depends on control dependency: [if], data = [null)] } } Assert.isTrue(matcherParameter.length > 0, "Missing matcher parameter"); // depends on control dependency: [try], data = [none] if (containerMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Matcher.class); if (matcherMethod != null) { String matcherExpression = matcherParameter[0]; if (matcherExpression.contains("(") && matcherExpression.contains(")")) { String nestedMatcherName = matcherExpression.trim().substring(0, matcherExpression.trim().indexOf("(")); String[] nestedMatcherParameter = matcherExpression.trim().substring(nestedMatcherName.length() + 1, matcherExpression.trim().length() - 1).split(","); return (Matcher) matcherMethod.invoke(null, getMatcher(nestedMatcherName, nestedMatcherParameter)); // depends on control dependency: [if], data = [none] } } } if (iterableMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Iterable.class); if (matcherMethod != null) { List<Matcher> nestedMatchers = new ArrayList<>(); for (String matcherExpression : matcherParameter) { String nestedMatcherName = matcherExpression.trim().substring(0, matcherExpression.trim().indexOf("(")); String nestedMatcherParameter = matcherExpression.trim().substring(nestedMatcherName.length() + 1, matcherExpression.trim().length() - 1); nestedMatchers.add(getMatcher(nestedMatcherName, new String[] { nestedMatcherParameter })); // depends on control dependency: [for], data = [none] } return (Matcher) matcherMethod.invoke(null, nestedMatchers); // depends on control dependency: [if], data = [none] } } Optional<HamcrestMatcherProvider> matcherProvider = customMatchers.stream() .filter(provider -> provider.getName().equals(matcherName)) .findFirst(); if (matcherProvider.isPresent()) { return matcherProvider.get().provideMatcher(matcherParameter[0]); // depends on control dependency: [if], data = [none] } if (matchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, String.class); if (matcherMethod == null) { matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); // depends on control dependency: [if], data = [none] } if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); // depends on control dependency: [if], data = [none] } } if (numericMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, double.class, double.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, Double.valueOf(matcherParameter[0]), matcherParameter.length > 1 ? Double.valueOf(matcherParameter[1]) : 0.0D); // depends on control dependency: [if], data = [none] } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Comparable.class); // depends on control dependency: [if], data = [none] if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); // depends on control dependency: [if], data = [none] } } if (collectionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, int.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, Integer.valueOf(matcherParameter[0])); // depends on control dependency: [if], data = [none] } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); // depends on control dependency: [if], data = [none] if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); // depends on control dependency: [if], data = [none] } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object[].class); // depends on control dependency: [if], data = [none] if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { matcherParameter }); // depends on control dependency: [if], data = [none] } } if (mapMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0]); // depends on control dependency: [if], data = [none] } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object.class, Object.class); // depends on control dependency: [if], data = [none] if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, matcherParameter[0], matcherParameter[1]); // depends on control dependency: [if], data = [none] } } if (optionMatchers.contains(matcherName)) { Method matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Object[].class); if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { matcherParameter }); // depends on control dependency: [if], data = [none] } matcherMethod = ReflectionUtils.findMethod(Matchers.class, matcherName, Collection.class); // depends on control dependency: [if], data = [none] if (matcherMethod != null) { return (Matcher) matcherMethod.invoke(null, new Object[] { getCollection(StringUtils.arrayToCommaDelimitedString(matcherParameter)) }); // depends on control dependency: [if], data = [none] } } } catch (InvocationTargetException | IllegalAccessException e) { throw new CitrusRuntimeException("Failed to invoke matcher", e); } // depends on control dependency: [catch], data = [none] throw new CitrusRuntimeException("Unsupported matcher: " + matcherName); } }
public class class_name { public void moveCoordinate(Coordinate coordinate, int index) { if (index < coordinates.length) { coordinates[index] = (Coordinate) coordinate.clone(); } setCoordinates(coordinates); } }
public class class_name { public void moveCoordinate(Coordinate coordinate, int index) { if (index < coordinates.length) { coordinates[index] = (Coordinate) coordinate.clone(); // depends on control dependency: [if], data = [none] } setCoordinates(coordinates); } }
public class class_name { public int fieldChanged(boolean bDisplayOption, int iMoveMode) { String string = this.getOwner().toString(); if (Utility.isNumeric(string)) { Task task = null; if (this.getOwner() != null) if (this.getOwner().getRecord() != null) if (this.getOwner().getRecord().getRecordOwner() != null) task = this.getOwner().getRecord().getRecordOwner().getTask(); if (task == null) task = BaseApplet.getSharedInstance(); return task.setLastError("Must be non-numeric"); } return super.fieldChanged(bDisplayOption, iMoveMode); } }
public class class_name { public int fieldChanged(boolean bDisplayOption, int iMoveMode) { String string = this.getOwner().toString(); if (Utility.isNumeric(string)) { Task task = null; if (this.getOwner() != null) if (this.getOwner().getRecord() != null) if (this.getOwner().getRecord().getRecordOwner() != null) task = this.getOwner().getRecord().getRecordOwner().getTask(); if (task == null) task = BaseApplet.getSharedInstance(); return task.setLastError("Must be non-numeric"); // depends on control dependency: [if], data = [none] } return super.fieldChanged(bDisplayOption, iMoveMode); } }
public class class_name { protected static @NotNull AssertionError comparisonFailed( @Nullable Description description, @Nullable Object actual, @Nullable Object expected) { AssertionError comparisonFailure = comparisonFailure(valueOf(description), expected, actual); if (comparisonFailure != null) { return comparisonFailure; } return failure(format(description, unexpectedNotEqual(actual, expected))); } }
public class class_name { protected static @NotNull AssertionError comparisonFailed( @Nullable Description description, @Nullable Object actual, @Nullable Object expected) { AssertionError comparisonFailure = comparisonFailure(valueOf(description), expected, actual); if (comparisonFailure != null) { return comparisonFailure; // depends on control dependency: [if], data = [none] } return failure(format(description, unexpectedNotEqual(actual, expected))); } }
public class class_name { protected INode computeHighlightRangeSourceReference() { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return null; StyledText styledText = sourceViewer.getTextWidget(); if (styledText == null) return null; int caret = 0; if (sourceViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer; caret = extension.widgetOffset2ModelOffset(styledText .getCaretOffset()); } else { int offset = sourceViewer.getVisibleRegion().getOffset(); caret = offset + styledText.getCaretOffset(); } // System.out.println("Compute element at "+caret); INode element = getElementAt(caret, false); // if (!(element instanceof INode)) // return null; // if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) { // // IImportDeclaration declaration= (IImportDeclaration) element; // IImportContainer container= (IImportContainer) // declaration.getParent(); // ISourceRange srcRange= null; // // try { // srcRange= container.getSourceRange(); // } catch (JavaModelException e) { // } // // if (srcRange != null && srcRange.getOffset() == caret) // return container; // } return element; } }
public class class_name { protected INode computeHighlightRangeSourceReference() { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return null; StyledText styledText = sourceViewer.getTextWidget(); if (styledText == null) return null; int caret = 0; if (sourceViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer; caret = extension.widgetOffset2ModelOffset(styledText .getCaretOffset()); // depends on control dependency: [if], data = [none] } else { int offset = sourceViewer.getVisibleRegion().getOffset(); caret = offset + styledText.getCaretOffset(); // depends on control dependency: [if], data = [none] } // System.out.println("Compute element at "+caret); INode element = getElementAt(caret, false); // if (!(element instanceof INode)) // return null; // if (element.getElementType() == IJavaElement.IMPORT_DECLARATION) { // // IImportDeclaration declaration= (IImportDeclaration) element; // IImportContainer container= (IImportContainer) // declaration.getParent(); // ISourceRange srcRange= null; // // try { // srcRange= container.getSourceRange(); // } catch (JavaModelException e) { // } // // if (srcRange != null && srcRange.getOffset() == caret) // return container; // } return element; } }
public class class_name { private String collectEnvironmentInfo(final Environment environment, final Class<?> sourceClass) { val properties = System.getProperties(); if (properties.containsKey("CAS_BANNER_SKIP")) { try (val formatter = new Formatter()) { formatter.format("CAS Version: %s%n", CasVersion.getVersion()); return formatter.toString(); } } try (val formatter = new Formatter()) { val sysInfo = SystemUtils.getSystemInfo(); sysInfo.forEach((k, v) -> { if (k.startsWith(SEPARATOR_CHAR)) { formatter.format("%s%n", LINE_SEPARATOR); } else { formatter.format("%s: %s%n", k, v); } }); formatter.format("%s%n", LINE_SEPARATOR); injectEnvironmentInfoIntoBanner(formatter, environment, sourceClass); return formatter.toString(); } } }
public class class_name { private String collectEnvironmentInfo(final Environment environment, final Class<?> sourceClass) { val properties = System.getProperties(); if (properties.containsKey("CAS_BANNER_SKIP")) { try (val formatter = new Formatter()) { formatter.format("CAS Version: %s%n", CasVersion.getVersion()); return formatter.toString(); // depends on control dependency: [if], data = [none] } } try (val formatter = new Formatter()) { val sysInfo = SystemUtils.getSystemInfo(); sysInfo.forEach((k, v) -> { if (k.startsWith(SEPARATOR_CHAR)) { formatter.format("%s%n", LINE_SEPARATOR); // depends on control dependency: [if], data = [none] } else { formatter.format("%s: %s%n", k, v); // depends on control dependency: [if], data = [none] } }); formatter.format("%s%n", LINE_SEPARATOR); injectEnvironmentInfoIntoBanner(formatter, environment, sourceClass); return formatter.toString(); } } }
public class class_name { Index getIndexForColumns(int[] cols) { int i = bestIndexForColumn[cols[0]]; if (i > -1) { return indexList[i]; } switch (tableType) { case TableBase.SYSTEM_SUBQUERY : case TableBase.SYSTEM_TABLE : case TableBase.VIEW_TABLE : case TableBase.TEMP_TABLE : { Index index = createIndexForColumns(cols); return index; } } return null; } }
public class class_name { Index getIndexForColumns(int[] cols) { int i = bestIndexForColumn[cols[0]]; if (i > -1) { return indexList[i]; // depends on control dependency: [if], data = [none] } switch (tableType) { case TableBase.SYSTEM_SUBQUERY : case TableBase.SYSTEM_TABLE : case TableBase.VIEW_TABLE : case TableBase.TEMP_TABLE : { Index index = createIndexForColumns(cols); return index; } } return null; } }
public class class_name { public static boolean checkNameing(String str) { char[] commonArray = new char[str.length()]; int len = 0; if (str == null || (len = str.length()) == 0) { return false; } str.getChars(0, len, commonArray, 0); int index = 0; char word = commonArray[index++]; //首字母判断 不为数字 , . if (word >= 46 && word <= 57) setLog(1, word); //尾字母判断 else if (commonArray[len - 1] == 46) setLog(len, 46); else while (true) { if (word < 36 || word > 122 || chars[word - 36] == 0) { setLog(index + 1, word); return false; } if (index == len) return true; word = commonArray[index++]; } return false; } }
public class class_name { public static boolean checkNameing(String str) { char[] commonArray = new char[str.length()]; int len = 0; if (str == null || (len = str.length()) == 0) { return false; // depends on control dependency: [if], data = [none] } str.getChars(0, len, commonArray, 0); int index = 0; char word = commonArray[index++]; //首字母判断 不为数字 , . if (word >= 46 && word <= 57) setLog(1, word); //尾字母判断 else if (commonArray[len - 1] == 46) setLog(len, 46); else while (true) { if (word < 36 || word > 122 || chars[word - 36] == 0) { setLog(index + 1, word); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (index == len) return true; word = commonArray[index++]; // depends on control dependency: [while], data = [none] } return false; } }
public class class_name { protected static Long getUnusedExternalStorage() { try { if (isExternalStorageMounted()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); return availableBlocks * blockSize; } } catch (Exception e) { Log.e(TAG, "Error getting unused external storage amount.", e); } return null; } }
public class class_name { protected static Long getUnusedExternalStorage() { try { if (isExternalStorageMounted()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); return availableBlocks * blockSize; // depends on control dependency: [if], data = [none] } } catch (Exception e) { Log.e(TAG, "Error getting unused external storage amount.", e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public Packer setAnchorNorthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHEAST; } else { gc.anchor &= ~GridBagConstraints.NORTHEAST; } setConstraints(comp, gc); return this; } }
public class class_name { public Packer setAnchorNorthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHEAST; // depends on control dependency: [if], data = [none] } else { gc.anchor &= ~GridBagConstraints.NORTHEAST; // depends on control dependency: [if], data = [none] } setConstraints(comp, gc); return this; } }
public class class_name { public String htmlComponents() { StringBuffer html = new StringBuffer(1024); Iterator<CmsSetupComponent> itComponents = CmsCollectionsGenericWrapper.<CmsSetupComponent> list( m_components.elementList()).iterator(); while (itComponents.hasNext()) { CmsSetupComponent component = itComponents.next(); html.append(htmlComponent(component)); } return html.toString(); } }
public class class_name { public String htmlComponents() { StringBuffer html = new StringBuffer(1024); Iterator<CmsSetupComponent> itComponents = CmsCollectionsGenericWrapper.<CmsSetupComponent> list( m_components.elementList()).iterator(); while (itComponents.hasNext()) { CmsSetupComponent component = itComponents.next(); html.append(htmlComponent(component)); // depends on control dependency: [while], data = [none] } return html.toString(); } }
public class class_name { private OHLCSeries addSeries( String seriesName, double[] xData, double[] openData, double[] highData, double[] lowData, double[] closeData, DataType dataType) { if (seriesMap.keySet().contains(seriesName)) { throw new IllegalArgumentException( "Series name >" + seriesName + "< has already been used. Use unique names for each series!!!"); } // Sanity checks sanityCheck(seriesName, openData, highData, lowData, closeData); final double[] xDataToUse; if (xData != null) { // Sanity check checkDataLengths(seriesName, "X-Axis", "Close", xData, closeData); xDataToUse = xData; } else { // generate xData xDataToUse = Utils.getGeneratedDataAsArray(closeData.length); } OHLCSeries series = new OHLCSeries(seriesName, xDataToUse, openData, highData, lowData, closeData, dataType); ; seriesMap.put(seriesName, series); return series; } }
public class class_name { private OHLCSeries addSeries( String seriesName, double[] xData, double[] openData, double[] highData, double[] lowData, double[] closeData, DataType dataType) { if (seriesMap.keySet().contains(seriesName)) { throw new IllegalArgumentException( "Series name >" + seriesName + "< has already been used. Use unique names for each series!!!"); } // Sanity checks sanityCheck(seriesName, openData, highData, lowData, closeData); final double[] xDataToUse; if (xData != null) { // Sanity check checkDataLengths(seriesName, "X-Axis", "Close", xData, closeData); // depends on control dependency: [if], data = [none] xDataToUse = xData; // depends on control dependency: [if], data = [none] } else { // generate xData xDataToUse = Utils.getGeneratedDataAsArray(closeData.length); // depends on control dependency: [if], data = [none] } OHLCSeries series = new OHLCSeries(seriesName, xDataToUse, openData, highData, lowData, closeData, dataType); ; seriesMap.put(seriesName, series); return series; } }
public class class_name { public void foreachPartition(final Action1<PartitionState> action) { int len = partitionStates.length(); for (int i = 0; i < len; i++) { PartitionState ps = partitionStates.get(i); if (ps == null) { continue; } action.call(ps); } } }
public class class_name { public void foreachPartition(final Action1<PartitionState> action) { int len = partitionStates.length(); for (int i = 0; i < len; i++) { PartitionState ps = partitionStates.get(i); if (ps == null) { continue; } action.call(ps); // depends on control dependency: [for], data = [none] } } }
public class class_name { public void registerNamespace(String prefix, String uri) throws NamespaceException, RepositoryException { validateNamespace(prefix, uri); registerNamespace(prefix, uri, true); if (started && rpcService != null) { try { rpcService.executeCommandOnAllNodes(registerNamespace, false, id, prefix, uri); } catch (Exception e) { LOG.warn("Could not register the namespace '" + uri + "' on other cluster nodes", e); } } } }
public class class_name { public void registerNamespace(String prefix, String uri) throws NamespaceException, RepositoryException { validateNamespace(prefix, uri); registerNamespace(prefix, uri, true); if (started && rpcService != null) { try { rpcService.executeCommandOnAllNodes(registerNamespace, false, id, prefix, uri); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.warn("Could not register the namespace '" + uri + "' on other cluster nodes", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected List<Intervalable> checkForOverlaps(Intervalable interval, Direction direction) { List<Intervalable> overlaps = new ArrayList<Intervalable>(); for (Intervalable currentInterval : this.intervals) { switch (direction) { case LEFT: if (currentInterval.getStart() <= interval.getEnd()) { overlaps.add(currentInterval); } break; case RIGHT: if (currentInterval.getEnd() >= interval.getStart()) { overlaps.add(currentInterval); } break; } } return overlaps; } }
public class class_name { protected List<Intervalable> checkForOverlaps(Intervalable interval, Direction direction) { List<Intervalable> overlaps = new ArrayList<Intervalable>(); for (Intervalable currentInterval : this.intervals) { switch (direction) { case LEFT: if (currentInterval.getStart() <= interval.getEnd()) { overlaps.add(currentInterval); // depends on control dependency: [if], data = [none] } break; case RIGHT: if (currentInterval.getEnd() >= interval.getStart()) { overlaps.add(currentInterval); // depends on control dependency: [if], data = [none] } break; } } return overlaps; } }
public class class_name { public Field createFieldDateTimeDateAndTime(Field routeFieldParam) { if(routeFieldParam != null && this.serviceTicket != null) { routeFieldParam.setServiceTicket(this.serviceTicket); } if(routeFieldParam != null) { routeFieldParam.setTypeAsEnum(Field.Type.DateTime); routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE_AND_TIME); } return new Field(this.putJson( routeFieldParam, Version1.routeFieldCreate())); } }
public class class_name { public Field createFieldDateTimeDateAndTime(Field routeFieldParam) { if(routeFieldParam != null && this.serviceTicket != null) { routeFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } if(routeFieldParam != null) { routeFieldParam.setTypeAsEnum(Field.Type.DateTime); // depends on control dependency: [if], data = [none] routeFieldParam.setTypeMetaData(FieldMetaData.DateTime.DATE_AND_TIME); // depends on control dependency: [if], data = [none] } return new Field(this.putJson( routeFieldParam, Version1.routeFieldCreate())); } }
public class class_name { @Override protected void tryReset(boolean added) { additions += step; if (!added) { return; } if (additions < period) { return; } int count = 0; for (int i = 0; i < table.length; i++) { count += Long.bitCount(table[i] & ONE_MASK); table[i] = (table[i] >>> 1) & RESET_MASK; } additions = (additions >>> 1) - (count >>> 2); doorkeeper.clear(); } }
public class class_name { @Override protected void tryReset(boolean added) { additions += step; if (!added) { return; // depends on control dependency: [if], data = [none] } if (additions < period) { return; // depends on control dependency: [if], data = [none] } int count = 0; for (int i = 0; i < table.length; i++) { count += Long.bitCount(table[i] & ONE_MASK); // depends on control dependency: [for], data = [i] table[i] = (table[i] >>> 1) & RESET_MASK; // depends on control dependency: [for], data = [i] } additions = (additions >>> 1) - (count >>> 2); doorkeeper.clear(); } }
public class class_name { @Override public final <T> AbstractConfig put(final IKey<T> key, final T value) { if (!key.isDefaultValue(value)) { config.put(key.key(), value); } else { remove(key); } return this; } }
public class class_name { @Override public final <T> AbstractConfig put(final IKey<T> key, final T value) { if (!key.isDefaultValue(value)) { config.put(key.key(), value); // depends on control dependency: [if], data = [none] } else { remove(key); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { void handleAmbiguousVertexes(List<ChessboardCorner> corners) { List<Vertex> candidates = new ArrayList<>(); for (int idx = 0; idx < vertexes.size(); idx++) { Vertex target = vertexes.get(idx); // median distance was previously found based on the closer neighbors. In an actual chessboard // there are solid white and black squares with no features, in theory double threshold = target.neighborDistance *ambiguousTol; candidates.clear(); // only need to search parallel since perpendicular nodes won't be confused for the target for (int i = 0; i < target.parallel.size(); i++) { Edge c = target.parallel.get(i); if( c.distance <= threshold ) { candidates.add(c.dst); } } if( candidates.size() > 0 ) { candidates.add(target); int bestIndex = -1; double bestScore = 0; // System.out.println("==== Resolving ambiguity. src="+target.index); for (int i = 0; i < candidates.size(); i++) { Vertex v = candidates.get(i); // System.out.println(" candidate = "+v.index); double intensity = corners.get(v.index).intensity; if( intensity > bestScore ) { bestScore = intensity; bestIndex = i; } } // System.out.println("==== Resolved ambiguity. Selected "+candidates.get(bestIndex).index); for (int i = 0; i < candidates.size(); i++) { if( i == bestIndex ) continue; removeReferences(candidates.get(i),EdgeType.PARALLEL); removeReferences(candidates.get(i),EdgeType.PERPENDICULAR); } } } } }
public class class_name { void handleAmbiguousVertexes(List<ChessboardCorner> corners) { List<Vertex> candidates = new ArrayList<>(); for (int idx = 0; idx < vertexes.size(); idx++) { Vertex target = vertexes.get(idx); // median distance was previously found based on the closer neighbors. In an actual chessboard // there are solid white and black squares with no features, in theory double threshold = target.neighborDistance *ambiguousTol; candidates.clear(); // depends on control dependency: [for], data = [none] // only need to search parallel since perpendicular nodes won't be confused for the target for (int i = 0; i < target.parallel.size(); i++) { Edge c = target.parallel.get(i); if( c.distance <= threshold ) { candidates.add(c.dst); // depends on control dependency: [if], data = [none] } } if( candidates.size() > 0 ) { candidates.add(target); // depends on control dependency: [if], data = [none] int bestIndex = -1; double bestScore = 0; // System.out.println("==== Resolving ambiguity. src="+target.index); for (int i = 0; i < candidates.size(); i++) { Vertex v = candidates.get(i); // System.out.println(" candidate = "+v.index); double intensity = corners.get(v.index).intensity; if( intensity > bestScore ) { bestScore = intensity; // depends on control dependency: [if], data = [none] bestIndex = i; // depends on control dependency: [if], data = [none] } } // System.out.println("==== Resolved ambiguity. Selected "+candidates.get(bestIndex).index); for (int i = 0; i < candidates.size(); i++) { if( i == bestIndex ) continue; removeReferences(candidates.get(i),EdgeType.PARALLEL); // depends on control dependency: [for], data = [i] removeReferences(candidates.get(i),EdgeType.PERPENDICULAR); // depends on control dependency: [for], data = [i] } } } } }
public class class_name { public static boolean isPortAvailable(int port) { try { ServerSocket socket = new ServerSocket(port); socket.close(); return true; } catch (IOException e) { return false; } } }
public class class_name { public static boolean isPortAvailable(int port) { try { ServerSocket socket = new ServerSocket(port); socket.close(); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IOException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); } else { super.setDefaultRenderer(defaultRenderer); } } }
public class class_name { @Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); // depends on control dependency: [if], data = [none] } else { super.setDefaultRenderer(defaultRenderer); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void fireRootCause(Throwable t) { Throwable root = t; while (root != null) { Throwable cause = root.getCause(); if (cause == null) { break; } root = cause; } fire(root); } }
public class class_name { public static void fireRootCause(Throwable t) { Throwable root = t; while (root != null) { Throwable cause = root.getCause(); if (cause == null) { break; } root = cause; // depends on control dependency: [while], data = [none] } fire(root); } }
public class class_name { public static String encode( String url, String encoding ) { String encodedURL = null; try { encodedURL = URLCodec.encode( url, encoding ); } catch ( java.io.UnsupportedEncodingException e ) { // try utf-8 as a default encoding try { encodedURL = URLCodec.encode( url, DEFAULT_ENCODING ); } catch ( java.io.UnsupportedEncodingException ignore ) { } } return encodedURL; } }
public class class_name { public static String encode( String url, String encoding ) { String encodedURL = null; try { encodedURL = URLCodec.encode( url, encoding ); // depends on control dependency: [try], data = [none] } catch ( java.io.UnsupportedEncodingException e ) { // try utf-8 as a default encoding try { encodedURL = URLCodec.encode( url, DEFAULT_ENCODING ); // depends on control dependency: [try], data = [none] } catch ( java.io.UnsupportedEncodingException ignore ) { } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] return encodedURL; } }
public class class_name { protected String removeQueryAndFragment(String url) { if (url == null) { return url; } String cleanUrl = url; int queryIndex = url.indexOf("?"); int fragmentIndex = url.indexOf("#"); if (queryIndex > 0) { if (fragmentIndex > 0 && fragmentIndex < queryIndex) { // Found fragment before the query string; remove everything after fragment cleanUrl = url.substring(0, fragmentIndex); } else { // Didn't find fragment or fragment is after query string; remove everything after query string cleanUrl = url.substring(0, queryIndex); } } else if (fragmentIndex > 0) { // No query string, but did find a fragment cleanUrl = url.substring(0, fragmentIndex); } return cleanUrl; } }
public class class_name { protected String removeQueryAndFragment(String url) { if (url == null) { return url; // depends on control dependency: [if], data = [none] } String cleanUrl = url; int queryIndex = url.indexOf("?"); int fragmentIndex = url.indexOf("#"); if (queryIndex > 0) { if (fragmentIndex > 0 && fragmentIndex < queryIndex) { // Found fragment before the query string; remove everything after fragment cleanUrl = url.substring(0, fragmentIndex); // depends on control dependency: [if], data = [none] } else { // Didn't find fragment or fragment is after query string; remove everything after query string cleanUrl = url.substring(0, queryIndex); // depends on control dependency: [if], data = [none] } } else if (fragmentIndex > 0) { // No query string, but did find a fragment cleanUrl = url.substring(0, fragmentIndex); // depends on control dependency: [if], data = [none] } return cleanUrl; } }
public class class_name { private static String replaceInvalidChars(String substring) { StringBuilder builder = new StringBuilder(); for(char c : substring.toCharArray()) { if(c < 32) { builder.append('.'); } else { builder.append(c); } } return builder.toString(); } }
public class class_name { private static String replaceInvalidChars(String substring) { StringBuilder builder = new StringBuilder(); for(char c : substring.toCharArray()) { if(c < 32) { builder.append('.'); // depends on control dependency: [if], data = [none] } else { builder.append(c); // depends on control dependency: [if], data = [(c] } } return builder.toString(); } }
public class class_name { public void removeFilter(ClassNameFilter classNameFilter) { writeLock.lock(); try { if (filters != null) { filters.remove(classNameFilter); // 删除不用重新排序 } } finally { writeLock.unlock(); } } }
public class class_name { public void removeFilter(ClassNameFilter classNameFilter) { writeLock.lock(); try { if (filters != null) { filters.remove(classNameFilter); // depends on control dependency: [if], data = [none] // 删除不用重新排序 } } finally { writeLock.unlock(); } } }
public class class_name { public static MutableRoaringBitmap priorityqueue_or(ImmutableRoaringBitmap... bitmaps) { if (bitmaps.length == 0) { return new MutableRoaringBitmap(); } else if (bitmaps.length == 1) { return bitmaps[0].toMutableRoaringBitmap(); } // we buffer the call to getLongSizeInBytes(), hence the code complexity final ImmutableRoaringBitmap[] buffer = Arrays.copyOf(bitmaps, bitmaps.length); final int[] sizes = new int[buffer.length]; final boolean[] istmp = new boolean[buffer.length]; for (int k = 0; k < sizes.length; ++k) { sizes[k] = buffer[k].serializedSizeInBytes(); } PriorityQueue<Integer> pq = new PriorityQueue<>(128, new Comparator<Integer>() { @Override public int compare(Integer a, Integer b) { return sizes[a] - sizes[b]; } }); for (int k = 0; k < sizes.length; ++k) { pq.add(k); } while (pq.size() > 1) { Integer x1 = pq.poll(); Integer x2 = pq.poll(); if (istmp[x1] && istmp[x2]) { buffer[x1] = MutableRoaringBitmap.lazyorfromlazyinputs((MutableRoaringBitmap) buffer[x1], (MutableRoaringBitmap) buffer[x2]); sizes[x1] = buffer[x1].serializedSizeInBytes(); pq.add(x1); } else if (istmp[x2]) { ((MutableRoaringBitmap) buffer[x2]).lazyor(buffer[x1]); sizes[x2] = buffer[x2].serializedSizeInBytes(); pq.add(x2); } else if (istmp[x1]) { ((MutableRoaringBitmap) buffer[x1]).lazyor(buffer[x2]); sizes[x1] = buffer[x1].serializedSizeInBytes(); pq.add(x1); } else { buffer[x1] = ImmutableRoaringBitmap.lazyor(buffer[x1], buffer[x2]); sizes[x1] = buffer[x1].serializedSizeInBytes(); istmp[x1] = true; pq.add(x1); } } MutableRoaringBitmap answer = (MutableRoaringBitmap) buffer[pq.poll()]; answer.repairAfterLazy(); return answer; } }
public class class_name { public static MutableRoaringBitmap priorityqueue_or(ImmutableRoaringBitmap... bitmaps) { if (bitmaps.length == 0) { return new MutableRoaringBitmap(); // depends on control dependency: [if], data = [none] } else if (bitmaps.length == 1) { return bitmaps[0].toMutableRoaringBitmap(); // depends on control dependency: [if], data = [none] } // we buffer the call to getLongSizeInBytes(), hence the code complexity final ImmutableRoaringBitmap[] buffer = Arrays.copyOf(bitmaps, bitmaps.length); final int[] sizes = new int[buffer.length]; final boolean[] istmp = new boolean[buffer.length]; for (int k = 0; k < sizes.length; ++k) { sizes[k] = buffer[k].serializedSizeInBytes(); // depends on control dependency: [for], data = [k] } PriorityQueue<Integer> pq = new PriorityQueue<>(128, new Comparator<Integer>() { @Override public int compare(Integer a, Integer b) { return sizes[a] - sizes[b]; } }); for (int k = 0; k < sizes.length; ++k) { pq.add(k); // depends on control dependency: [for], data = [k] } while (pq.size() > 1) { Integer x1 = pq.poll(); Integer x2 = pq.poll(); if (istmp[x1] && istmp[x2]) { buffer[x1] = MutableRoaringBitmap.lazyorfromlazyinputs((MutableRoaringBitmap) buffer[x1], (MutableRoaringBitmap) buffer[x2]); // depends on control dependency: [if], data = [none] sizes[x1] = buffer[x1].serializedSizeInBytes(); // depends on control dependency: [if], data = [none] pq.add(x1); // depends on control dependency: [if], data = [none] } else if (istmp[x2]) { ((MutableRoaringBitmap) buffer[x2]).lazyor(buffer[x1]); // depends on control dependency: [if], data = [none] sizes[x2] = buffer[x2].serializedSizeInBytes(); // depends on control dependency: [if], data = [none] pq.add(x2); // depends on control dependency: [if], data = [none] } else if (istmp[x1]) { ((MutableRoaringBitmap) buffer[x1]).lazyor(buffer[x2]); // depends on control dependency: [if], data = [none] sizes[x1] = buffer[x1].serializedSizeInBytes(); // depends on control dependency: [if], data = [none] pq.add(x1); // depends on control dependency: [if], data = [none] } else { buffer[x1] = ImmutableRoaringBitmap.lazyor(buffer[x1], buffer[x2]); // depends on control dependency: [if], data = [none] sizes[x1] = buffer[x1].serializedSizeInBytes(); // depends on control dependency: [if], data = [none] istmp[x1] = true; // depends on control dependency: [if], data = [none] pq.add(x1); // depends on control dependency: [if], data = [none] } } MutableRoaringBitmap answer = (MutableRoaringBitmap) buffer[pq.poll()]; answer.repairAfterLazy(); return answer; } }
public class class_name { public int setProperty(String strProperty, String strValue, boolean bDisplayOption, int iMoveMode) { if (m_setPropertiesDescriptions != null) if (m_setPropertiesDescriptions.contains(strProperty)) { byte[] rgbValue = strValue.getBytes(); rgbValue = XorEncryptedConverter.encrypt(rgbValue, key); char[] chars = Base64.encode(rgbValue); strValue = new String(chars); } return super.setProperty(strProperty, strValue, bDisplayOption, iMoveMode); } }
public class class_name { public int setProperty(String strProperty, String strValue, boolean bDisplayOption, int iMoveMode) { if (m_setPropertiesDescriptions != null) if (m_setPropertiesDescriptions.contains(strProperty)) { byte[] rgbValue = strValue.getBytes(); rgbValue = XorEncryptedConverter.encrypt(rgbValue, key); // depends on control dependency: [if], data = [none] char[] chars = Base64.encode(rgbValue); strValue = new String(chars); // depends on control dependency: [if], data = [none] } return super.setProperty(strProperty, strValue, bDisplayOption, iMoveMode); } }
public class class_name { private Document makeDocument() { Element rootElem = new Element("featureDataset"); Document doc = new Document(rootElem); rootElem.setAttribute("location", ds.getLocation()); rootElem.addContent( new Element("analyser").setAttribute("class", getName())); if (ft != null) rootElem.setAttribute("featureType", ft.toString()); for (NestedTable nt : leaves) { writeTable( rootElem, nt.getLeaf()); } return doc; } }
public class class_name { private Document makeDocument() { Element rootElem = new Element("featureDataset"); Document doc = new Document(rootElem); rootElem.setAttribute("location", ds.getLocation()); rootElem.addContent( new Element("analyser").setAttribute("class", getName())); if (ft != null) rootElem.setAttribute("featureType", ft.toString()); for (NestedTable nt : leaves) { writeTable( rootElem, nt.getLeaf()); // depends on control dependency: [for], data = [nt] } return doc; } }
public class class_name { void checkWritableDir(String tempPath) { try { File tempFile = File.createTempFile("check", "tmp", new File(tempPath)); deleteQuietly(tempFile); } catch (IOException e) { throw new IllegalStateException(format("Temp directory is not writable: %s", tempPath), e); } } }
public class class_name { void checkWritableDir(String tempPath) { try { File tempFile = File.createTempFile("check", "tmp", new File(tempPath)); deleteQuietly(tempFile); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalStateException(format("Temp directory is not writable: %s", tempPath), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static List<ProjectDefinition> collectProjects(ProjectDefinition def, List<ProjectDefinition> collected) { collected.add(def); for (ProjectDefinition child : def.getSubProjects()) { collectProjects(child, collected); } return collected; } }
public class class_name { private static List<ProjectDefinition> collectProjects(ProjectDefinition def, List<ProjectDefinition> collected) { collected.add(def); for (ProjectDefinition child : def.getSubProjects()) { collectProjects(child, collected); // depends on control dependency: [for], data = [child] } return collected; } }
public class class_name { public boolean contains(String name) { if (name == null) { throw new IllegalArgumentException("Other cannot be null"); } if (this.name.equals(name)) { return true; } if (hasReferences()) { for (Marker ref : referenceList) { if (ref.contains(name)) { return true; } } } return false; } }
public class class_name { public boolean contains(String name) { if (name == null) { throw new IllegalArgumentException("Other cannot be null"); } if (this.name.equals(name)) { return true; // depends on control dependency: [if], data = [none] } if (hasReferences()) { for (Marker ref : referenceList) { if (ref.contains(name)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { private void checkArgumentRange(final Object argumentValue) { // Only validate numeric types because we have already ensured at constructor time that only numeric types have bounds if (!Number.class.isAssignableFrom(getUnderlyingFieldClass())) { return; } final Double argumentDoubleValue = (argumentValue == null) ? null : ((Number)argumentValue).doubleValue(); // Check hard limits first, if specified if (hasBoundedRange() && isValueOutOfRange(argumentDoubleValue)) { throw new CommandLineException.OutOfRangeArgumentValue(getLongName(), getMinValue(), getMaxValue(), argumentValue); } // Check recommended values if (hasRecommendedRange() && isValueOutOfRange(argumentDoubleValue)) { final boolean outMinValue = getMinRecommendedValue() != Double.NEGATIVE_INFINITY; final boolean outMaxValue = getMaxRecommendedValue() != Double.POSITIVE_INFINITY; if (outMinValue && outMaxValue) { logger.warn("Argument --{} has value {}, but recommended within range ({},{})", getLongName(), argumentDoubleValue, getMinRecommendedValue(), getMaxRecommendedValue()); } else if (outMinValue) { logger.warn("Argument --{} has value {}, but minimum recommended is {}", getLongName(), argumentDoubleValue, getMinRecommendedValue()); } else if (outMaxValue) { logger.warn("Argument --{} has value {}, but maximum recommended is {}", getLongName(), argumentDoubleValue, getMaxRecommendedValue()); } // if there is no recommended value, do not log anything } } }
public class class_name { private void checkArgumentRange(final Object argumentValue) { // Only validate numeric types because we have already ensured at constructor time that only numeric types have bounds if (!Number.class.isAssignableFrom(getUnderlyingFieldClass())) { return; // depends on control dependency: [if], data = [none] } final Double argumentDoubleValue = (argumentValue == null) ? null : ((Number)argumentValue).doubleValue(); // Check hard limits first, if specified if (hasBoundedRange() && isValueOutOfRange(argumentDoubleValue)) { throw new CommandLineException.OutOfRangeArgumentValue(getLongName(), getMinValue(), getMaxValue(), argumentValue); } // Check recommended values if (hasRecommendedRange() && isValueOutOfRange(argumentDoubleValue)) { final boolean outMinValue = getMinRecommendedValue() != Double.NEGATIVE_INFINITY; final boolean outMaxValue = getMaxRecommendedValue() != Double.POSITIVE_INFINITY; if (outMinValue && outMaxValue) { logger.warn("Argument --{} has value {}, but recommended within range ({},{})", getLongName(), argumentDoubleValue, getMinRecommendedValue(), getMaxRecommendedValue()); // depends on control dependency: [if], data = [none] } else if (outMinValue) { logger.warn("Argument --{} has value {}, but minimum recommended is {}", getLongName(), argumentDoubleValue, getMinRecommendedValue()); // depends on control dependency: [if], data = [none] } else if (outMaxValue) { logger.warn("Argument --{} has value {}, but maximum recommended is {}", getLongName(), argumentDoubleValue, getMaxRecommendedValue()); // depends on control dependency: [if], data = [none] } // if there is no recommended value, do not log anything } } }
public class class_name { public static ImmutableList<String> toCodepointStrings(final String s) { final ImmutableList.Builder<String> ret = ImmutableList.builder(); for (int codePoint : toCodepoints(s)) { ret.add(new String(Character.toChars(codePoint))); } return ret.build(); } }
public class class_name { public static ImmutableList<String> toCodepointStrings(final String s) { final ImmutableList.Builder<String> ret = ImmutableList.builder(); for (int codePoint : toCodepoints(s)) { ret.add(new String(Character.toChars(codePoint))); // depends on control dependency: [for], data = [codePoint] } return ret.build(); } }
public class class_name { private SimpleHashSetEntry<T>[] doubleCapacity() { SimpleHashSetEntry<T>[] oldTable = mTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return oldTable; } int newCapacity = oldCapacity * 2; SimpleHashSetEntry<T>[] newTable = makeTable(newCapacity); if (mSize == 0) { return newTable; } for (int j = 0; j < oldCapacity; j++) { /* * Rehash the bucket using the minimum number of field writes. * This is the most subtle and delicate code in the class. */ SimpleHashSetEntry<T> e = oldTable[j]; if (e == null) { continue; } int highBit = e.mHash & oldCapacity; SimpleHashSetEntry<T> broken = null; newTable[j | highBit] = e; for (SimpleHashSetEntry<T> n = e.mNext; n != null; e = n, n = n.mNext) { int nextHighBit = n.mHash & oldCapacity; if (nextHighBit != highBit) { if (broken == null) { newTable[j | nextHighBit] = n; } else { broken.mNext = n; } broken = e; highBit = nextHighBit; } } if (broken != null) broken.mNext = null; } return newTable; } }
public class class_name { private SimpleHashSetEntry<T>[] doubleCapacity() { SimpleHashSetEntry<T>[] oldTable = mTable; int oldCapacity = oldTable.length; if (oldCapacity == MAXIMUM_CAPACITY) { return oldTable; // depends on control dependency: [if], data = [none] } int newCapacity = oldCapacity * 2; SimpleHashSetEntry<T>[] newTable = makeTable(newCapacity); if (mSize == 0) { return newTable; // depends on control dependency: [if], data = [none] } for (int j = 0; j < oldCapacity; j++) { /* * Rehash the bucket using the minimum number of field writes. * This is the most subtle and delicate code in the class. */ SimpleHashSetEntry<T> e = oldTable[j]; if (e == null) { continue; } int highBit = e.mHash & oldCapacity; SimpleHashSetEntry<T> broken = null; newTable[j | highBit] = e; // depends on control dependency: [for], data = [j] for (SimpleHashSetEntry<T> n = e.mNext; n != null; e = n, n = n.mNext) { int nextHighBit = n.mHash & oldCapacity; if (nextHighBit != highBit) { if (broken == null) { newTable[j | nextHighBit] = n; // depends on control dependency: [if], data = [none] } else { broken.mNext = n; // depends on control dependency: [if], data = [none] } broken = e; // depends on control dependency: [if], data = [none] highBit = nextHighBit; // depends on control dependency: [if], data = [none] } } if (broken != null) broken.mNext = null; } return newTable; } }
public class class_name { protected void applyThreshold( T input, GrayU8 output ) { for (int blockY = 0; blockY < stats.height; blockY++) { for (int blockX = 0; blockX < stats.width; blockX++) { original.thresholdBlock(blockX,blockY,input,stats,output); } } } }
public class class_name { protected void applyThreshold( T input, GrayU8 output ) { for (int blockY = 0; blockY < stats.height; blockY++) { for (int blockX = 0; blockX < stats.width; blockX++) { original.thresholdBlock(blockX,blockY,input,stats,output); // depends on control dependency: [for], data = [blockX] } } } }
public class class_name { private void updateIndexTermTargetName() { if (defaultTitle == null) { defaultTitle = targetFile; } for (final IndexTerm indexterm : indexTermList) { updateIndexTermTargetName(indexterm); } } }
public class class_name { private void updateIndexTermTargetName() { if (defaultTitle == null) { defaultTitle = targetFile; // depends on control dependency: [if], data = [none] } for (final IndexTerm indexterm : indexTermList) { updateIndexTermTargetName(indexterm); // depends on control dependency: [for], data = [indexterm] } } }
public class class_name { public <E> E get(PartitionKey key, GetModifier getModifier, EntityMapper<E> entityMapper) { byte[] keyBytes = entityMapper.getKeySerDe().serialize(key); Get get = new Get(keyBytes); HBaseUtils.addColumnsToGet(entityMapper.getRequiredColumns(), get); Result result = get(get, getModifier); if (result.isEmpty()) { return null; } else { return entityMapper.mapToEntity(result); } } }
public class class_name { public <E> E get(PartitionKey key, GetModifier getModifier, EntityMapper<E> entityMapper) { byte[] keyBytes = entityMapper.getKeySerDe().serialize(key); Get get = new Get(keyBytes); HBaseUtils.addColumnsToGet(entityMapper.getRequiredColumns(), get); Result result = get(get, getModifier); if (result.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } else { return entityMapper.mapToEntity(result); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void computeVariablesFromObject(MtasParserObject object, Map<String, List<MtasParserObject>> currentList, Map<String, Map<String, String>> variables) { MtasParserType<MtasParserVariable> parserType = object.getType(); String id = object.getId(); if (id != null) { for (MtasParserVariable variable : parserType.getItems()) { if (!variables.containsKey(variable.variable)) { variables.put(variable.variable, new HashMap<String, String>()); } StringBuilder builder = new StringBuilder(); for (MtasParserVariableValue variableValue : variable.values) { if (variableValue.type.equals("attribute")) { String subValue = object.getAttribute(variableValue.name); if (subValue != null) { builder.append(subValue); } } } variables.get(variable.variable).put(id, builder.toString()); } } } }
public class class_name { protected void computeVariablesFromObject(MtasParserObject object, Map<String, List<MtasParserObject>> currentList, Map<String, Map<String, String>> variables) { MtasParserType<MtasParserVariable> parserType = object.getType(); String id = object.getId(); if (id != null) { for (MtasParserVariable variable : parserType.getItems()) { if (!variables.containsKey(variable.variable)) { variables.put(variable.variable, new HashMap<String, String>()); // depends on control dependency: [if], data = [none] } StringBuilder builder = new StringBuilder(); for (MtasParserVariableValue variableValue : variable.values) { if (variableValue.type.equals("attribute")) { String subValue = object.getAttribute(variableValue.name); if (subValue != null) { builder.append(subValue); // depends on control dependency: [if], data = [(subValue] } } } variables.get(variable.variable).put(id, builder.toString()); // depends on control dependency: [for], data = [variable] } } } }
public class class_name { public static <A extends Annotation> A getAnnotation(final Method m, final Class<A> type) { A result = m.getAnnotation(type); if (result == null) { for (Annotation a : m.getAnnotations()) { result = getAnnotation(a, type); if (result != null) { break; } } } if (result == null) { result = getAnnotation(m.getDeclaringClass(), type); } return result; } }
public class class_name { public static <A extends Annotation> A getAnnotation(final Method m, final Class<A> type) { A result = m.getAnnotation(type); if (result == null) { for (Annotation a : m.getAnnotations()) { result = getAnnotation(a, type); // depends on control dependency: [for], data = [a] if (result != null) { break; } } } if (result == null) { result = getAnnotation(m.getDeclaringClass(), type); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @SuppressWarnings("unchecked") public synchronized <E> E getComponent(int code) { switch (code) { case REMOTE_PROFILE: if (spfRemoteProfile == null) { spfRemoteProfile = new SPFRemoteProfile(getContext(), this); } return (E) spfRemoteProfile; case SEARCH: if (spfSearch == null) { spfSearch = new SPFSearch(getContext(), this); } return (E) spfSearch; case SERVICE_EXECUTION: if (spfServiceExecutor == null) { spfServiceExecutor = new SPFServiceExecutor(getContext(), this); } return (E) spfServiceExecutor; default: throw new IllegalArgumentException("Component code " + code + " not found."); } } }
public class class_name { @SuppressWarnings("unchecked") public synchronized <E> E getComponent(int code) { switch (code) { case REMOTE_PROFILE: if (spfRemoteProfile == null) { spfRemoteProfile = new SPFRemoteProfile(getContext(), this); // depends on control dependency: [if], data = [none] } return (E) spfRemoteProfile; case SEARCH: if (spfSearch == null) { spfSearch = new SPFSearch(getContext(), this); // depends on control dependency: [if], data = [none] } return (E) spfSearch; case SERVICE_EXECUTION: if (spfServiceExecutor == null) { spfServiceExecutor = new SPFServiceExecutor(getContext(), this); // depends on control dependency: [if], data = [none] } return (E) spfServiceExecutor; default: throw new IllegalArgumentException("Component code " + code + " not found."); } } }
public class class_name { public void clearSpans() { for (int i = mSpanCount - 1; i >= 0; i--) { Object what = mSpans[i]; int ostart = mSpanStarts[i]; int oend = mSpanEnds[i]; if (ostart > mGapStart) ostart -= mGapLength; if (oend > mGapStart) oend -= mGapLength; mSpanCount = i; mSpans[i] = null; sendSpanRemoved(what, ostart, oend); } } }
public class class_name { public void clearSpans() { for (int i = mSpanCount - 1; i >= 0; i--) { Object what = mSpans[i]; int ostart = mSpanStarts[i]; int oend = mSpanEnds[i]; if (ostart > mGapStart) ostart -= mGapLength; if (oend > mGapStart) oend -= mGapLength; mSpanCount = i; // depends on control dependency: [for], data = [i] mSpans[i] = null; // depends on control dependency: [for], data = [i] sendSpanRemoved(what, ostart, oend); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static void register(Class<?> clazz, Function<Object, ?> converter) { if (clazz == null || converter == null) { log.warn("Trying to register either a null class ({0}) or a null converter ({1}). Ignoring!", clazz, converter); return; } converters.put(clazz, converter); } }
public class class_name { public static void register(Class<?> clazz, Function<Object, ?> converter) { if (clazz == null || converter == null) { log.warn("Trying to register either a null class ({0}) or a null converter ({1}). Ignoring!", clazz, converter); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } converters.put(clazz, converter); } }
public class class_name { @SuppressWarnings("unchecked") private void restoreDescendantComponentStates(UIComponent parent, boolean iterateFacets, Object state, boolean restoreChildFacets) { int descendantStateIndex = -1; List<? extends Object[]> stateCollection = null; if (iterateFacets && parent.getFacetCount() > 0) { Iterator<UIComponent> childIterator = parent.getFacets().values().iterator(); while (childIterator.hasNext()) { UIComponent component = childIterator.next(); // reset the client id (see spec 3.1.6) component.setId(component.getId()); if (!component.isTransient()) { if (descendantStateIndex == -1) { stateCollection = ((List<? extends Object[]>) state); descendantStateIndex = stateCollection.isEmpty() ? -1 : 0; } if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size()) { Object[] object = stateCollection.get(descendantStateIndex); if (object[0] != null && component instanceof EditableValueHolder) { ((SavedState) object[0]).restoreState((EditableValueHolder) component); } // If there is descendant state to restore, call it recursively, otherwise // it is safe to skip iteration. if (object[1] != null) { restoreDescendantComponentStates(component, restoreChildFacets, object[1], true); } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } descendantStateIndex++; } } } if (parent.getChildCount() > 0) { for (int i = 0; i < parent.getChildCount(); i++) { UIComponent component = parent.getChildren().get(i); // reset the client id (see spec 3.1.6) component.setId(component.getId()); if (!component.isTransient()) { if (descendantStateIndex == -1) { stateCollection = ((List<? extends Object[]>) state); descendantStateIndex = stateCollection.isEmpty() ? -1 : 0; } if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size()) { Object[] object = stateCollection.get(descendantStateIndex); if (object[0] != null && component instanceof EditableValueHolder) { ((SavedState) object[0]).restoreState((EditableValueHolder) component); } // If there is descendant state to restore, call it recursively, otherwise // it is safe to skip iteration. if (object[1] != null) { restoreDescendantComponentStates(component, restoreChildFacets, object[1], true); } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); } descendantStateIndex++; } } } } }
public class class_name { @SuppressWarnings("unchecked") private void restoreDescendantComponentStates(UIComponent parent, boolean iterateFacets, Object state, boolean restoreChildFacets) { int descendantStateIndex = -1; List<? extends Object[]> stateCollection = null; if (iterateFacets && parent.getFacetCount() > 0) { Iterator<UIComponent> childIterator = parent.getFacets().values().iterator(); while (childIterator.hasNext()) { UIComponent component = childIterator.next(); // reset the client id (see spec 3.1.6) component.setId(component.getId()); // depends on control dependency: [while], data = [none] if (!component.isTransient()) { if (descendantStateIndex == -1) { stateCollection = ((List<? extends Object[]>) state); // depends on control dependency: [if], data = [none] descendantStateIndex = stateCollection.isEmpty() ? -1 : 0; // depends on control dependency: [if], data = [none] } if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size()) { Object[] object = stateCollection.get(descendantStateIndex); if (object[0] != null && component instanceof EditableValueHolder) { ((SavedState) object[0]).restoreState((EditableValueHolder) component); // depends on control dependency: [if], data = [none] } // If there is descendant state to restore, call it recursively, otherwise // it is safe to skip iteration. if (object[1] != null) { restoreDescendantComponentStates(component, restoreChildFacets, object[1], true); // depends on control dependency: [if], data = [none] } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); // depends on control dependency: [if], data = [none] } } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); // depends on control dependency: [if], data = [none] } descendantStateIndex++; // depends on control dependency: [if], data = [none] } } } if (parent.getChildCount() > 0) { for (int i = 0; i < parent.getChildCount(); i++) { UIComponent component = parent.getChildren().get(i); // reset the client id (see spec 3.1.6) component.setId(component.getId()); // depends on control dependency: [for], data = [none] if (!component.isTransient()) { if (descendantStateIndex == -1) { stateCollection = ((List<? extends Object[]>) state); // depends on control dependency: [if], data = [none] descendantStateIndex = stateCollection.isEmpty() ? -1 : 0; // depends on control dependency: [if], data = [none] } if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size()) { Object[] object = stateCollection.get(descendantStateIndex); if (object[0] != null && component instanceof EditableValueHolder) { ((SavedState) object[0]).restoreState((EditableValueHolder) component); // depends on control dependency: [if], data = [none] } // If there is descendant state to restore, call it recursively, otherwise // it is safe to skip iteration. if (object[1] != null) { restoreDescendantComponentStates(component, restoreChildFacets, object[1], true); // depends on control dependency: [if], data = [none] } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); // depends on control dependency: [if], data = [none] } } else { restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true); // depends on control dependency: [if], data = [none] } descendantStateIndex++; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public Interaction getApplicableInteraction(String eventLabel, boolean verbose) { String targetsString = getTargets(); if (targetsString != null) { try { Targets targets = new Targets(getTargets()); String interactionId = targets.getApplicableInteraction(eventLabel, verbose); if (interactionId != null) { String interactionsString = getInteractions(); if (interactionsString != null) { Interactions interactions = new Interactions(interactionsString); return interactions.getInteraction(interactionId); } } } catch (JSONException e) { ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel); logException(e); } } return null; } }
public class class_name { public Interaction getApplicableInteraction(String eventLabel, boolean verbose) { String targetsString = getTargets(); if (targetsString != null) { try { Targets targets = new Targets(getTargets()); String interactionId = targets.getApplicableInteraction(eventLabel, verbose); if (interactionId != null) { String interactionsString = getInteractions(); if (interactionsString != null) { Interactions interactions = new Interactions(interactionsString); return interactions.getInteraction(interactionId); // depends on control dependency: [if], data = [none] } } } catch (JSONException e) { ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel); logException(e); } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static String indentBlock(String block, Indent indent) { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new StringReader(block)); String line; try { while((line = br.readLine()) != null) sb.append(indent).append(line).append('\n'); } catch(IOException ex) { // on a String ? I doubt... } return sb.toString(); } }
public class class_name { public static String indentBlock(String block, Indent indent) { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new StringReader(block)); String line; try { while((line = br.readLine()) != null) sb.append(indent).append(line).append('\n'); } catch(IOException ex) { // on a String ? I doubt... } // depends on control dependency: [catch], data = [none] return sb.toString(); } }
public class class_name { protected String ensureFieldDeclarationKeyword(CodeElementExtractor.ElementDescription memberDescription) { final List<String> modifiers = getCodeBuilderConfig().getModifiers().get(memberDescription.getName()); if (modifiers != null && !modifiers.isEmpty()) { return modifiers.get(0); } return getExpressionConfig().getFieldDeclarationKeyword(); } }
public class class_name { protected String ensureFieldDeclarationKeyword(CodeElementExtractor.ElementDescription memberDescription) { final List<String> modifiers = getCodeBuilderConfig().getModifiers().get(memberDescription.getName()); if (modifiers != null && !modifiers.isEmpty()) { return modifiers.get(0); // depends on control dependency: [if], data = [none] } return getExpressionConfig().getFieldDeclarationKeyword(); } }
public class class_name { public List<DelegateListener<? extends BaseDelegateExecution>> getListeners(String eventName) { List<DelegateListener<? extends BaseDelegateExecution>> listenerList = getListeners().get(eventName); if (listenerList != null) { return listenerList; } return Collections.emptyList(); } }
public class class_name { public List<DelegateListener<? extends BaseDelegateExecution>> getListeners(String eventName) { List<DelegateListener<? extends BaseDelegateExecution>> listenerList = getListeners().get(eventName); if (listenerList != null) { return listenerList; // depends on control dependency: [if], data = [none] } return Collections.emptyList(); } }
public class class_name { private SchemaFactory _newFactory(String schemaLanguage) { SchemaFactory sf; String propertyName = SERVICE_CLASS.getName() + ":" + schemaLanguage; // system property look up try { if (debug) debugPrintln("Looking up system property '"+propertyName+"'" ); String r = System.getProperty(propertyName); if (r != null && r.length() > 0) { if (debug) debugPrintln("The value is '"+r+"'"); sf = createInstance(r); if(sf!=null) return sf; } else if (debug) { debugPrintln("The property is undefined."); } } // The VM ran out of memory or there was some other serious problem. Re-throw. catch (VirtualMachineError vme) { throw vme; } // ThreadDeath should always be re-thrown catch (ThreadDeath td) { throw td; } catch (Throwable t) { if( debug ) { debugPrintln("failed to look up system property '"+propertyName+"'" ); t.printStackTrace(); } } // try to read from $java.home/lib/jaxp.properties try { String factoryClassName = CacheHolder.cacheProps.getProperty(propertyName); if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); if (factoryClassName != null) { sf = createInstance(factoryClassName); if(sf != null){ return sf; } } } catch (Exception ex) { if (debug) { ex.printStackTrace(); } } // try META-INF/services files for (URL resource : createServiceFileIterator()) { if (debug) debugPrintln("looking into " + resource); try { sf = loadFromServicesFile(schemaLanguage,resource.toExternalForm(), resource.openStream()); if(sf!=null) return sf; } catch(IOException e) { if( debug ) { debugPrintln("failed to read "+resource); e.printStackTrace(); } } } // platform defaults if (schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI) || schemaLanguage.equals(W3C_XML_SCHEMA10_NS_URI)) { if (debug) debugPrintln("attempting to use the platform default XML Schema 1.0 validator"); return createInstance("org.apache.xerces.jaxp.validation.XMLSchemaFactory"); } else if (schemaLanguage.equals(W3C_XML_SCHEMA11_NS_URI)) { if (debug) debugPrintln("attempting to use the platform default XML Schema 1.1 validator"); return createInstance("org.apache.xerces.jaxp.validation.XMLSchema11Factory"); } if (debug) debugPrintln("all things were tried, but none was found. bailing out."); return null; } }
public class class_name { private SchemaFactory _newFactory(String schemaLanguage) { SchemaFactory sf; String propertyName = SERVICE_CLASS.getName() + ":" + schemaLanguage; // system property look up try { if (debug) debugPrintln("Looking up system property '"+propertyName+"'" ); String r = System.getProperty(propertyName); if (r != null && r.length() > 0) { if (debug) debugPrintln("The value is '"+r+"'"); sf = createInstance(r); // depends on control dependency: [if], data = [(r] if(sf!=null) return sf; } else if (debug) { debugPrintln("The property is undefined."); // depends on control dependency: [if], data = [none] } } // The VM ran out of memory or there was some other serious problem. Re-throw. catch (VirtualMachineError vme) { throw vme; } // depends on control dependency: [catch], data = [none] // ThreadDeath should always be re-thrown catch (ThreadDeath td) { throw td; } // depends on control dependency: [catch], data = [none] catch (Throwable t) { if( debug ) { debugPrintln("failed to look up system property '"+propertyName+"'" ); // depends on control dependency: [if], data = [none] t.printStackTrace(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] // try to read from $java.home/lib/jaxp.properties try { String factoryClassName = CacheHolder.cacheProps.getProperty(propertyName); if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties"); if (factoryClassName != null) { sf = createInstance(factoryClassName); if(sf != null){ return sf; // depends on control dependency: [if], data = [none] } } } catch (Exception ex) { if (debug) { ex.printStackTrace(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] // try META-INF/services files for (URL resource : createServiceFileIterator()) { if (debug) debugPrintln("looking into " + resource); try { sf = loadFromServicesFile(schemaLanguage,resource.toExternalForm(), resource.openStream()); // depends on control dependency: [try], data = [none] if(sf!=null) return sf; } catch(IOException e) { if( debug ) { debugPrintln("failed to read "+resource); // depends on control dependency: [if], data = [none] e.printStackTrace(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } // platform defaults if (schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI) || schemaLanguage.equals(W3C_XML_SCHEMA10_NS_URI)) { if (debug) debugPrintln("attempting to use the platform default XML Schema 1.0 validator"); return createInstance("org.apache.xerces.jaxp.validation.XMLSchemaFactory"); // depends on control dependency: [if], data = [none] } else if (schemaLanguage.equals(W3C_XML_SCHEMA11_NS_URI)) { if (debug) debugPrintln("attempting to use the platform default XML Schema 1.1 validator"); return createInstance("org.apache.xerces.jaxp.validation.XMLSchema11Factory"); // depends on control dependency: [if], data = [none] } if (debug) debugPrintln("all things were tried, but none was found. bailing out."); return null; } }
public class class_name { public static boolean createTableIfNotExists(final Connection conn, final String tableName, final String schema) { if (doesTableExist(conn, tableName)) { return false; } try { execute(conn, schema); return true; } catch (SQLException e) { return false; } } }
public class class_name { public static boolean createTableIfNotExists(final Connection conn, final String tableName, final String schema) { if (doesTableExist(conn, tableName)) { return false; // depends on control dependency: [if], data = [none] } try { execute(conn, schema); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (SQLException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Cholesky CholeskyOfAtA() { DenseMatrix VD = Matrix.zeros(V.nrows(), V.ncols()); for (int i = 0; i < V.nrows(); i++) { for (int j = 0; j < V.ncols(); j++) { VD.set(i, j, V.get(i, j) * s[j]); } } return new Cholesky(VD.aat()); } }
public class class_name { public Cholesky CholeskyOfAtA() { DenseMatrix VD = Matrix.zeros(V.nrows(), V.ncols()); for (int i = 0; i < V.nrows(); i++) { for (int j = 0; j < V.ncols(); j++) { VD.set(i, j, V.get(i, j) * s[j]); // depends on control dependency: [for], data = [j] } } return new Cholesky(VD.aat()); } }
public class class_name { public CmsResource getConfigurationFile(CmsObject cms, String containerPageUri) { String cfgPath = null; try { // get the resource type configuration file from the vfs tree cfgPath = cms.readPropertyObject(containerPageUri, m_propertyName, true).getValue(); } catch (CmsException e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(cfgPath)) { // if not found try at the template try { // retrieve the template uri String templateUri = cms.readPropertyObject( containerPageUri, CmsPropertyDefinition.PROPERTY_TEMPLATE, true).getValue(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(templateUri)) { // get the resource type configuration file from the template itself cfgPath = cms.readPropertyObject(templateUri, m_propertyName, true).getValue(); } } catch (CmsException e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } } if (CmsStringUtil.isEmptyOrWhitespaceOnly(cfgPath)) { // configuration could not be found LOG.warn(Messages.get().getBundle().key(Messages.ERR_CONFIG_NOT_SET_2, containerPageUri, m_propertyName)); return null; } try { // read configuration file return cms.readResource(cfgPath); } catch (Exception e1) { try { CmsResource baseResource = cms.readResource(containerPageUri); String baseRootPath = baseResource.getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(baseRootPath); String rootCfgPath = CmsStringUtil.joinPaths(siteRoot, cfgPath); return cms.readResource(rootCfgPath); } catch (Exception e2) { throw new CmsIllegalStateException( Messages.get().container( Messages.ERR_CONFIG_NOT_FOUND_3, containerPageUri, m_propertyName, cfgPath)); } } } }
public class class_name { public CmsResource getConfigurationFile(CmsObject cms, String containerPageUri) { String cfgPath = null; try { // get the resource type configuration file from the vfs tree cfgPath = cms.readPropertyObject(containerPageUri, m_propertyName, true).getValue(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] if (CmsStringUtil.isEmptyOrWhitespaceOnly(cfgPath)) { // if not found try at the template try { // retrieve the template uri String templateUri = cms.readPropertyObject( containerPageUri, CmsPropertyDefinition.PROPERTY_TEMPLATE, true).getValue(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(templateUri)) { // get the resource type configuration file from the template itself cfgPath = cms.readPropertyObject(templateUri, m_propertyName, true).getValue(); // depends on control dependency: [if], data = [none] } } catch (CmsException e) { // should never happen LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } if (CmsStringUtil.isEmptyOrWhitespaceOnly(cfgPath)) { // configuration could not be found LOG.warn(Messages.get().getBundle().key(Messages.ERR_CONFIG_NOT_SET_2, containerPageUri, m_propertyName)); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } try { // read configuration file return cms.readResource(cfgPath); // depends on control dependency: [try], data = [none] } catch (Exception e1) { try { CmsResource baseResource = cms.readResource(containerPageUri); String baseRootPath = baseResource.getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(baseRootPath); String rootCfgPath = CmsStringUtil.joinPaths(siteRoot, cfgPath); return cms.readResource(rootCfgPath); // depends on control dependency: [try], data = [none] } catch (Exception e2) { throw new CmsIllegalStateException( Messages.get().container( Messages.ERR_CONFIG_NOT_FOUND_3, containerPageUri, m_propertyName, cfgPath)); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setCharset(String to) { // Validate the character set. try { new String(new byte[97], to); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } charset = to; } }
public class class_name { public void setCharset(String to) { // Validate the character set. try { new String(new byte[97], to); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] charset = to; } }
public class class_name { private String addHeadWordsToTreebank(final List<String> inputTrees) { final StringBuffer parsedDoc = new StringBuffer(); for (final String parseSent : inputTrees) { final Parse parsedSentence = Parse.parseParse(parseSent); this.headFinder.printHeads(parsedSentence); parsedSentence.show(parsedDoc); parsedDoc.append("\n"); } return parsedDoc.toString(); } }
public class class_name { private String addHeadWordsToTreebank(final List<String> inputTrees) { final StringBuffer parsedDoc = new StringBuffer(); for (final String parseSent : inputTrees) { final Parse parsedSentence = Parse.parseParse(parseSent); this.headFinder.printHeads(parsedSentence); // depends on control dependency: [for], data = [none] parsedSentence.show(parsedDoc); // depends on control dependency: [for], data = [none] parsedDoc.append("\n"); // depends on control dependency: [for], data = [none] } return parsedDoc.toString(); } }
public class class_name { public TypeCode type() { if (typeCode == null) { short modifier = VM_NONE.value; if (is_custom) modifier = VM_CUSTOM.value; else if (is_abstract) modifier = VM_ABSTRACT.value; typeCode = getORB().create_value_tc(id, name, modifier, baseValueTypeCode, getValueMembersForTypeCode()); } return typeCode; } }
public class class_name { public TypeCode type() { if (typeCode == null) { short modifier = VM_NONE.value; if (is_custom) modifier = VM_CUSTOM.value; else if (is_abstract) modifier = VM_ABSTRACT.value; typeCode = getORB().create_value_tc(id, name, modifier, baseValueTypeCode, getValueMembersForTypeCode()); // depends on control dependency: [if], data = [none] } return typeCode; } }
public class class_name { int grabFlowControlBytes(int bytesToGrab) { if(bytesToGrab <= 0) { return 0; } int min; synchronized (flowControlLock) { min = (int) Math.min(bytesToGrab, sendWindowSize); if (bytesToGrab > FLOW_CONTROL_MIN_WINDOW && min <= FLOW_CONTROL_MIN_WINDOW) { //this can cause problems with padding, so we just return 0 return 0; } min = Math.min(sendMaxFrameSize, min); sendWindowSize -= min; } return min; } }
public class class_name { int grabFlowControlBytes(int bytesToGrab) { if(bytesToGrab <= 0) { return 0; // depends on control dependency: [if], data = [none] } int min; synchronized (flowControlLock) { min = (int) Math.min(bytesToGrab, sendWindowSize); if (bytesToGrab > FLOW_CONTROL_MIN_WINDOW && min <= FLOW_CONTROL_MIN_WINDOW) { //this can cause problems with padding, so we just return 0 return 0; // depends on control dependency: [if], data = [none] } min = Math.min(sendMaxFrameSize, min); sendWindowSize -= min; } return min; } }
public class class_name { protected int getDigestOffset2(byte[] handshake, int bufferOffset) { bufferOffset += 772; int offset = handshake[bufferOffset] & 0xff; // & 0x0ff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = Math.abs((offset % 728) + 776); if (res + DIGEST_LENGTH > 1535) { log.error("Invalid digest offset calc: {}", res); } return res; } }
public class class_name { protected int getDigestOffset2(byte[] handshake, int bufferOffset) { bufferOffset += 772; int offset = handshake[bufferOffset] & 0xff; // & 0x0ff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; bufferOffset++; offset += handshake[bufferOffset] & 0xff; int res = Math.abs((offset % 728) + 776); if (res + DIGEST_LENGTH > 1535) { log.error("Invalid digest offset calc: {}", res); // depends on control dependency: [if], data = [none] } return res; } }
public class class_name { @Override String getRequestString() { StringBuilder requestString = new StringBuilder(); if (station != null && station.trim().length() != 0) { requestString.append("station=").append(station).append('&'); } if (actual != null) { requestString.append("actual=").append(actual).append('&'); } if (unplanned != null) { requestString.append("unplanned=").append(unplanned).append('&'); } return requestString.toString(); } }
public class class_name { @Override String getRequestString() { StringBuilder requestString = new StringBuilder(); if (station != null && station.trim().length() != 0) { requestString.append("station=").append(station).append('&'); // depends on control dependency: [if], data = [(station] } if (actual != null) { requestString.append("actual=").append(actual).append('&'); // depends on control dependency: [if], data = [(actual] } if (unplanned != null) { requestString.append("unplanned=").append(unplanned).append('&'); // depends on control dependency: [if], data = [(unplanned] } return requestString.toString(); } }
public class class_name { private void offsetMonth(int newMoon, int dom, int delta) { // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); } } else { set(JULIAN_DAY, jd); } } }
public class class_name { private void offsetMonth(int newMoon, int dom, int delta) { // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // depends on control dependency: [if], data = [none] // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); // depends on control dependency: [if], data = [none] if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); // depends on control dependency: [if], data = [none] } } else { set(JULIAN_DAY, jd); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { m_searchManager.removeSearchIndex(getSearchIndexIndex()); clearDialogObject(); writeConfiguration(); // if we go back to /searchindex/singleindex (overview) the deleted searchindex is not // there any more in the CmsSearchManager and CmsOverviewSearchIndex.getUserObject will // find null -> defineWidgets will provide null as bean... setParamCloseLink(CmsToolManager.linkForToolPath(getJsp(), getParentPath())); } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { m_searchManager.removeSearchIndex(getSearchIndexIndex()); // depends on control dependency: [try], data = [none] clearDialogObject(); // depends on control dependency: [try], data = [none] writeConfiguration(); // depends on control dependency: [try], data = [none] // if we go back to /searchindex/singleindex (overview) the deleted searchindex is not // there any more in the CmsSearchManager and CmsOverviewSearchIndex.getUserObject will // find null -> defineWidgets will provide null as bean... setParamCloseLink(CmsToolManager.linkForToolPath(getJsp(), getParentPath())); // depends on control dependency: [try], data = [none] } catch (Throwable t) { errors.add(t); } // depends on control dependency: [catch], data = [none] // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }
public class class_name { public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean isImplementationOf(@SlashedClassName String clsName, JavaClass inf) { try { if (clsName.startsWith("java/lang/")) { return false; } JavaClass cls = Repository.lookupClass(clsName); return isImplementationOf(cls, inf); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } return false; } }
public class class_name { private boolean isImplementationOf(@SlashedClassName String clsName, JavaClass inf) { try { if (clsName.startsWith("java/lang/")) { return false; // depends on control dependency: [if], data = [none] } JavaClass cls = Repository.lookupClass(clsName); return isImplementationOf(cls, inf); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public boolean containsBeforeSchemaOrder(String field) { if (schemaOrderIndex == null) { return containsFieldName(field); } for (int i = 0; i < schemaOrderIndex; i++) { if (elements.get(i).getName().equals(field)) { return true; } } return false; } }
public class class_name { public boolean containsBeforeSchemaOrder(String field) { if (schemaOrderIndex == null) { return containsFieldName(field); // depends on control dependency: [if], data = [none] } for (int i = 0; i < schemaOrderIndex; i++) { if (elements.get(i).getName().equals(field)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private BudgetYearDataType getBudgetYearDataType(BudgetPeriodDto periodInfo) { BudgetYearDataType budgetYear = BudgetYearDataType.Factory.newInstance(); if (periodInfo != null) { budgetYear.setBudgetPeriodStartDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getStartDate())); budgetYear.setBudgetPeriodEndDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getEndDate())); BudgetPeriod.Enum budgetPeriod = BudgetPeriod.Enum.forInt(periodInfo.getBudgetPeriod()); budgetYear.setBudgetPeriod(budgetPeriod); budgetYear.setKeyPersons(getKeyPersons(periodInfo)); budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo)); SummaryDataType summary = SummaryDataType.Factory.newInstance(); if (periodInfo.getTotalCompensation() != null) { summary.setFederalSummary(periodInfo.getTotalCompensation().bigDecimalValue()); } if (periodInfo.getTotalCompensationCostSharing() != null) { summary.setNonFederalSummary(periodInfo.getTotalCompensationCostSharing().bigDecimalValue()); if (periodInfo.getTotalCompensation() != null) { summary.setTotalFedNonFedSummary(periodInfo.getTotalCompensation().add( periodInfo.getTotalCompensationCostSharing()).bigDecimalValue()); } else { summary.setTotalFedNonFedSummary(periodInfo.getTotalCompensationCostSharing().bigDecimalValue()); } } budgetYear.setTotalCompensation(summary); budgetYear.setEquipment(getEquipment(periodInfo)); budgetYear.setTravel(getTravel(periodInfo)); budgetYear.setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo)); budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo)); SummaryDataType summaryDirect = SummaryDataType.Factory.newInstance(); if (periodInfo.getDirectCostsTotal() != null) { summaryDirect.setFederalSummary(periodInfo.getDirectCostsTotal().bigDecimalValue()); } if (periodInfo.getTotalDirectCostSharing() != null) { summaryDirect.setNonFederalSummary(periodInfo.getTotalDirectCostSharing().bigDecimalValue()); if (periodInfo.getDirectCostsTotal() != null) { summaryDirect.setTotalFedNonFedSummary(periodInfo.getDirectCostsTotal().add( periodInfo.getTotalDirectCostSharing()).bigDecimalValue()); } else { summaryDirect.setTotalFedNonFedSummary(periodInfo.getTotalDirectCostSharing().bigDecimalValue()); } } budgetYear.setDirectCosts(summaryDirect); IndirectCosts indirectCosts = getIndirectCosts(periodInfo); if (indirectCosts != null) { budgetYear.setIndirectCosts(indirectCosts); } budgetYear.setCognizantFederalAgency(periodInfo.getCognizantFedAgency()); SummaryDataType summaryTotal = SummaryDataType.Factory.newInstance(); if (periodInfo.getTotalCosts() != null) { summaryTotal.setFederalSummary(periodInfo.getTotalCosts().bigDecimalValue()); } if (periodInfo.getCostSharingAmount() != null) { summaryTotal.setNonFederalSummary(periodInfo.getCostSharingAmount().bigDecimalValue()); if (periodInfo.getTotalCosts() != null) { summaryTotal.setTotalFedNonFedSummary(periodInfo.getTotalCosts().add(periodInfo.getCostSharingAmount()) .bigDecimalValue()); } else { summaryTotal.setTotalFedNonFedSummary(periodInfo.getCostSharingAmount().bigDecimalValue()); } } budgetYear.setTotalCosts(summaryTotal); } return budgetYear; } }
public class class_name { private BudgetYearDataType getBudgetYearDataType(BudgetPeriodDto periodInfo) { BudgetYearDataType budgetYear = BudgetYearDataType.Factory.newInstance(); if (periodInfo != null) { budgetYear.setBudgetPeriodStartDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getStartDate())); // depends on control dependency: [if], data = [(periodInfo] budgetYear.setBudgetPeriodEndDate(s2SDateTimeService.convertDateToCalendar(periodInfo.getEndDate())); // depends on control dependency: [if], data = [(periodInfo] BudgetPeriod.Enum budgetPeriod = BudgetPeriod.Enum.forInt(periodInfo.getBudgetPeriod()); budgetYear.setBudgetPeriod(budgetPeriod); // depends on control dependency: [if], data = [none] budgetYear.setKeyPersons(getKeyPersons(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] SummaryDataType summary = SummaryDataType.Factory.newInstance(); if (periodInfo.getTotalCompensation() != null) { summary.setFederalSummary(periodInfo.getTotalCompensation().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getTotalCompensation()] } if (periodInfo.getTotalCompensationCostSharing() != null) { summary.setNonFederalSummary(periodInfo.getTotalCompensationCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getTotalCompensationCostSharing()] if (periodInfo.getTotalCompensation() != null) { summary.setTotalFedNonFedSummary(periodInfo.getTotalCompensation().add( periodInfo.getTotalCompensationCostSharing()).bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getTotalCompensation()] } else { summary.setTotalFedNonFedSummary(periodInfo.getTotalCompensationCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [none] } } budgetYear.setTotalCompensation(summary); // depends on control dependency: [if], data = [none] budgetYear.setEquipment(getEquipment(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] budgetYear.setTravel(getTravel(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] budgetYear.setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo)); // depends on control dependency: [if], data = [(periodInfo] SummaryDataType summaryDirect = SummaryDataType.Factory.newInstance(); if (periodInfo.getDirectCostsTotal() != null) { summaryDirect.setFederalSummary(periodInfo.getDirectCostsTotal().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getDirectCostsTotal()] } if (periodInfo.getTotalDirectCostSharing() != null) { summaryDirect.setNonFederalSummary(periodInfo.getTotalDirectCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getTotalDirectCostSharing()] if (periodInfo.getDirectCostsTotal() != null) { summaryDirect.setTotalFedNonFedSummary(periodInfo.getDirectCostsTotal().add( periodInfo.getTotalDirectCostSharing()).bigDecimalValue()); // depends on control dependency: [if], data = [none] } else { summaryDirect.setTotalFedNonFedSummary(periodInfo.getTotalDirectCostSharing().bigDecimalValue()); // depends on control dependency: [if], data = [none] } } budgetYear.setDirectCosts(summaryDirect); // depends on control dependency: [if], data = [none] IndirectCosts indirectCosts = getIndirectCosts(periodInfo); if (indirectCosts != null) { budgetYear.setIndirectCosts(indirectCosts); // depends on control dependency: [if], data = [(indirectCosts] } budgetYear.setCognizantFederalAgency(periodInfo.getCognizantFedAgency()); // depends on control dependency: [if], data = [(periodInfo] SummaryDataType summaryTotal = SummaryDataType.Factory.newInstance(); if (periodInfo.getTotalCosts() != null) { summaryTotal.setFederalSummary(periodInfo.getTotalCosts().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getTotalCosts()] } if (periodInfo.getCostSharingAmount() != null) { summaryTotal.setNonFederalSummary(periodInfo.getCostSharingAmount().bigDecimalValue()); // depends on control dependency: [if], data = [(periodInfo.getCostSharingAmount()] if (periodInfo.getTotalCosts() != null) { summaryTotal.setTotalFedNonFedSummary(periodInfo.getTotalCosts().add(periodInfo.getCostSharingAmount()) .bigDecimalValue()); // depends on control dependency: [if], data = [none] } else { summaryTotal.setTotalFedNonFedSummary(periodInfo.getCostSharingAmount().bigDecimalValue()); // depends on control dependency: [if], data = [none] } } budgetYear.setTotalCosts(summaryTotal); // depends on control dependency: [if], data = [none] } return budgetYear; } }
public class class_name { @SafeVarargs public static <T> T mode(final T... items) { if (ArrayUtils.isNotEmpty(items)) { final HashMap<T, MutableInt> occurrences = new HashMap<>(items.length); for (final T t : items) { final MutableInt count = occurrences.get(t); if (count == null) { occurrences.put(t, new MutableInt(1)); } else { count.increment(); } } T result = null; int max = 0; for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) { final int cmp = e.getValue().intValue(); if (cmp == max) { result = null; } else if (cmp > max) { max = cmp; result = e.getKey(); } } return result; } return null; } }
public class class_name { @SafeVarargs public static <T> T mode(final T... items) { if (ArrayUtils.isNotEmpty(items)) { final HashMap<T, MutableInt> occurrences = new HashMap<>(items.length); for (final T t : items) { final MutableInt count = occurrences.get(t); if (count == null) { occurrences.put(t, new MutableInt(1)); // depends on control dependency: [if], data = [none] } else { count.increment(); // depends on control dependency: [if], data = [none] } } T result = null; int max = 0; for (final Map.Entry<T, MutableInt> e : occurrences.entrySet()) { final int cmp = e.getValue().intValue(); if (cmp == max) { result = null; // depends on control dependency: [if], data = [none] } else if (cmp > max) { max = cmp; // depends on control dependency: [if], data = [none] result = e.getKey(); // depends on control dependency: [if], data = [none] } } return result; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public <OUT> IPromise<OUT> catchError(final Function<Object, IPromise<OUT>> function) { Promise res = new Promise<>(); then( new Callback<T>() { @Override public void complete(T result, Object error) { if ( ! Actor.isError(error) ) { res.complete(null, error); } else { function.apply(error).then(res); } } }); return res; } }
public class class_name { @Override public <OUT> IPromise<OUT> catchError(final Function<Object, IPromise<OUT>> function) { Promise res = new Promise<>(); then( new Callback<T>() { @Override public void complete(T result, Object error) { if ( ! Actor.isError(error) ) { res.complete(null, error); // depends on control dependency: [if], data = [none] } else { function.apply(error).then(res); // depends on control dependency: [if], data = [none] } } }); return res; } }
public class class_name { protected JSONObject dataItemAt(JSONObject jsonItem, RequestType requestType, ActionType action) { JSONObject eachRow = null; if (requestType == RequestType.GROUPBY) { eachRow = jsonItem.getJSONObject("event"); } else if (requestType == RequestType.TIMESERIES) { eachRow = jsonItem.getJSONObject("result"); } else if (requestType == RequestType.TOPN) { eachRow = jsonItem; } return eachRow; } }
public class class_name { protected JSONObject dataItemAt(JSONObject jsonItem, RequestType requestType, ActionType action) { JSONObject eachRow = null; if (requestType == RequestType.GROUPBY) { eachRow = jsonItem.getJSONObject("event"); // depends on control dependency: [if], data = [none] } else if (requestType == RequestType.TIMESERIES) { eachRow = jsonItem.getJSONObject("result"); // depends on control dependency: [if], data = [none] } else if (requestType == RequestType.TOPN) { eachRow = jsonItem; // depends on control dependency: [if], data = [none] } return eachRow; } }
public class class_name { public Query getOptimizedQuery() { // if (isOptimizable()) { // return _baseQuery; // } // create a copy/clone of the original query Query q = _baseQuery.clone(); Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet(); for (Entry<FilterConsumer, FilterOutcome> entry : entries) { FilterConsumer consumer = entry.getKey(); FilterOutcome outcome = entry.getValue(); Filter<?> filter = consumer.getComponent(); @SuppressWarnings("rawtypes") QueryOptimizedFilter queryOptimizedFilter = (QueryOptimizedFilter) filter; @SuppressWarnings("unchecked") Query newQuery = queryOptimizedFilter.optimizeQuery(q, outcome.getCategory()); q = newQuery; } return q; } }
public class class_name { public Query getOptimizedQuery() { // if (isOptimizable()) { // return _baseQuery; // } // create a copy/clone of the original query Query q = _baseQuery.clone(); Set<Entry<FilterConsumer, FilterOutcome>> entries = _optimizedFilters.entrySet(); for (Entry<FilterConsumer, FilterOutcome> entry : entries) { FilterConsumer consumer = entry.getKey(); FilterOutcome outcome = entry.getValue(); Filter<?> filter = consumer.getComponent(); @SuppressWarnings("rawtypes") QueryOptimizedFilter queryOptimizedFilter = (QueryOptimizedFilter) filter; @SuppressWarnings("unchecked") Query newQuery = queryOptimizedFilter.optimizeQuery(q, outcome.getCategory()); q = newQuery; // depends on control dependency: [for], data = [none] } return q; } }
public class class_name { protected void setForInsertId(final MODEL model) { BeanDescriptor descriptor = getModelBeanDescriptor(); EntityBeanIntercept intercept = ((EntityBean) model)._ebean_getIntercept(); BeanProperty idProp = descriptor.getIdProperty(); if (idProp != null) { idProp.setValue((EntityBean) model, null); intercept.setPropertyUnloaded(idProp.getPropertyIndex()); } } }
public class class_name { protected void setForInsertId(final MODEL model) { BeanDescriptor descriptor = getModelBeanDescriptor(); EntityBeanIntercept intercept = ((EntityBean) model)._ebean_getIntercept(); BeanProperty idProp = descriptor.getIdProperty(); if (idProp != null) { idProp.setValue((EntityBean) model, null); // depends on control dependency: [if], data = [null)] intercept.setPropertyUnloaded(idProp.getPropertyIndex()); // depends on control dependency: [if], data = [(idProp] } } }
public class class_name { protected final boolean validateCaptcha(String text) { if (captchaSupport != null) { String id = Stapler.getCurrentRequest().getSession().getId(); return captchaSupport.validateCaptcha(id, text); } // If no Captcha Support then bogus validation always returns true return true; } }
public class class_name { protected final boolean validateCaptcha(String text) { if (captchaSupport != null) { String id = Stapler.getCurrentRequest().getSession().getId(); return captchaSupport.validateCaptcha(id, text); // depends on control dependency: [if], data = [none] } // If no Captcha Support then bogus validation always returns true return true; } }
public class class_name { @Override public synchronized void flush() { if (trouble) { return; } if (isDestinationActivated()) { try { getOut().flush(); } catch (IOException e) { handleIOException(e); } } } }
public class class_name { @Override public synchronized void flush() { if (trouble) { return; // depends on control dependency: [if], data = [none] } if (isDestinationActivated()) { try { getOut().flush(); // depends on control dependency: [try], data = [none] } catch (IOException e) { handleIOException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public <T> T findByName(String name, Class<T> clazz) { for (Entry<String, Object> entry : contextMap.entrySet()) { if (entry.getKey().equals(name) && clazz.isInstance(entry.getValue())) { return clazz.cast(entry.getValue()); } } return null; } }
public class class_name { public <T> T findByName(String name, Class<T> clazz) { for (Entry<String, Object> entry : contextMap.entrySet()) { if (entry.getKey().equals(name) && clazz.isInstance(entry.getValue())) { return clazz.cast(entry.getValue()); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static Expect4j telnet(String hostname, int port) throws Exception { // This library has trouble with EOF final TelnetClient client = new TelnetClient(); TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT100", false, false, true, true); EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false); SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(false, false, false, false); client.addOptionHandler( ttopt ); client.addOptionHandler( echoopt ); client.addOptionHandler( gaopt ); client.connect(hostname, port); InputStream is = new FromNetASCIIInputStream( client.getInputStream() ); // null until client connected OutputStream os = new ToNetASCIIOutputStream( client.getOutputStream() ); /* URL url=new URL("telnet", hostname, port, "", new thor.net.URLStreamHandler()); final URLConnection urlConnection=url.openConnection(); urlConnection.connect(); if (urlConnection instanceof TelnetURLConnection) { ((TelnetURLConnection)urlConnection).setTelnetTerminalHandler(new SimpleTelnetTerminalHandler()); } OutputStream os=urlConnection.getOutputStream(); InputStream is=urlConnection.getInputStream(); StreamPair pair = new StreamPair(is, os) { public void close() { try { ((TelnetURLConnection)urlConnection).disconnect(); }catch(Exception e) { } } }; */ return new Expect4j(is, os) { public void close() { super.close(); try { client.disconnect(); } catch (IOException e) { logger.error("Failed to close telnet session", e); } } }; } }
public class class_name { public static Expect4j telnet(String hostname, int port) throws Exception { // This library has trouble with EOF final TelnetClient client = new TelnetClient(); TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT100", false, false, true, true); EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false); SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(false, false, false, false); client.addOptionHandler( ttopt ); client.addOptionHandler( echoopt ); client.addOptionHandler( gaopt ); client.connect(hostname, port); InputStream is = new FromNetASCIIInputStream( client.getInputStream() ); // null until client connected OutputStream os = new ToNetASCIIOutputStream( client.getOutputStream() ); /* URL url=new URL("telnet", hostname, port, "", new thor.net.URLStreamHandler()); final URLConnection urlConnection=url.openConnection(); urlConnection.connect(); if (urlConnection instanceof TelnetURLConnection) { ((TelnetURLConnection)urlConnection).setTelnetTerminalHandler(new SimpleTelnetTerminalHandler()); } OutputStream os=urlConnection.getOutputStream(); InputStream is=urlConnection.getInputStream(); StreamPair pair = new StreamPair(is, os) { public void close() { try { ((TelnetURLConnection)urlConnection).disconnect(); }catch(Exception e) { } } }; */ return new Expect4j(is, os) { public void close() { super.close(); try { client.disconnect(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("Failed to close telnet session", e); } // depends on control dependency: [catch], data = [none] } }; } }
public class class_name { @Override protected File cloneRepository(File dest) { Git git = null; try { // set branch name String branchName = MASTER;; String branch = getBranch(); if (StringUtils.isNotBlank(branch)) { branchName = branch; } String tag = getTag(); if (StringUtils.isNotBlank(tag)) { branchName = tag; } CloneCommand cloneCommand = Git.cloneRepository(); // use private key if available final String privateKey = getPrivateKey(); if (StringUtils.isNotBlank(privateKey)) { final SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { // set password if available String password = getPassword(); if (StringUtils.isNotBlank(password)) { session.setPassword(password); } } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey); return defaultJSch; } }; cloneCommand.setTransportConfigCallback(new TransportConfigCallback() { @Override public void configure(Transport transport) { if( transport instanceof SshTransport ) { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); } else { logger.warn("you are not using ssh protocol while using scm.ppk"); } } }); cloneCommand.setCredentialsProvider(new passphraseCredentialsProvider(getPassword())); } else { if (getUrlName() != null && getPassword() != null) { cloneCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(getUsername(), getPassword())); } } // clone repository git = cloneCommand.setURI(getUrl()) .setBranch(branchName) .setDirectory(dest) .call(); } catch (InvalidPathException e) { logger.warn("Error cloning git repository: {}", e.getMessage()); } catch (GitAPIException e) { logger.warn("Error processing git repository: {}", e.getMessage()); } finally { if (git != null) { git.close(); } } return dest; } }
public class class_name { @Override protected File cloneRepository(File dest) { Git git = null; try { // set branch name String branchName = MASTER;; String branch = getBranch(); if (StringUtils.isNotBlank(branch)) { branchName = branch; // depends on control dependency: [if], data = [none] } String tag = getTag(); if (StringUtils.isNotBlank(tag)) { branchName = tag; // depends on control dependency: [if], data = [none] } CloneCommand cloneCommand = Git.cloneRepository(); // use private key if available final String privateKey = getPrivateKey(); if (StringUtils.isNotBlank(privateKey)) { final SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { // set password if available String password = getPassword(); if (StringUtils.isNotBlank(password)) { session.setPassword(password); // depends on control dependency: [if], data = [none] } } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey); return defaultJSch; } }; cloneCommand.setTransportConfigCallback(new TransportConfigCallback() { @Override public void configure(Transport transport) { if( transport instanceof SshTransport ) { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); // depends on control dependency: [if], data = [none] } else { logger.warn("you are not using ssh protocol while using scm.ppk"); // depends on control dependency: [if], data = [none] } } }); // depends on control dependency: [if], data = [none] cloneCommand.setCredentialsProvider(new passphraseCredentialsProvider(getPassword())); // depends on control dependency: [if], data = [none] } else { if (getUrlName() != null && getPassword() != null) { cloneCommand.setCredentialsProvider(new UsernamePasswordCredentialsProvider(getUsername(), getPassword())); // depends on control dependency: [if], data = [none] } } // clone repository git = cloneCommand.setURI(getUrl()) .setBranch(branchName) .setDirectory(dest) .call(); // depends on control dependency: [try], data = [none] } catch (InvalidPathException e) { logger.warn("Error cloning git repository: {}", e.getMessage()); } catch (GitAPIException e) { // depends on control dependency: [catch], data = [none] logger.warn("Error processing git repository: {}", e.getMessage()); } finally { // depends on control dependency: [catch], data = [none] if (git != null) { git.close(); // depends on control dependency: [if], data = [none] } } return dest; } }
public class class_name { public void uniquify(StorableKey<S> key) { if (key == null) { throw new IllegalArgumentException(); } // Replace indexes which were are implied unique, even if they are not // declared as such. { Map<StorableIndex<S>, StorableIndex<S>> replacements = null; for (StorableIndex<S> index : this) { if (!index.isUnique() && isUniqueImplied(index)) { if (replacements == null) { replacements = new HashMap<StorableIndex<S>, StorableIndex<S>>(); } replacements.put(index, index.unique(true)); } } replaceEntries(replacements); } // Now augment with key properties. { Map<StorableIndex<S>, StorableIndex<S>> replacements = null; for (StorableIndex<S> index : this) { StorableIndex<S> replacement = index.uniquify(key); if (replacement != index) { if (replacements == null) { replacements = new HashMap<StorableIndex<S>, StorableIndex<S>>(); } replacements.put(index, replacement); } } replaceEntries(replacements); } } }
public class class_name { public void uniquify(StorableKey<S> key) { if (key == null) { throw new IllegalArgumentException(); } // Replace indexes which were are implied unique, even if they are not // declared as such. { Map<StorableIndex<S>, StorableIndex<S>> replacements = null; for (StorableIndex<S> index : this) { if (!index.isUnique() && isUniqueImplied(index)) { if (replacements == null) { replacements = new HashMap<StorableIndex<S>, StorableIndex<S>>(); // depends on control dependency: [if], data = [none] } replacements.put(index, index.unique(true)); // depends on control dependency: [if], data = [none] } } replaceEntries(replacements); } // Now augment with key properties. { Map<StorableIndex<S>, StorableIndex<S>> replacements = null; for (StorableIndex<S> index : this) { StorableIndex<S> replacement = index.uniquify(key); if (replacement != index) { if (replacements == null) { replacements = new HashMap<StorableIndex<S>, StorableIndex<S>>(); // depends on control dependency: [if], data = [none] } replacements.put(index, replacement); // depends on control dependency: [if], data = [none] } } replaceEntries(replacements); } } }
public class class_name { public static void setFieldValue(Object object, String fieldName, Object value) { try { getDeclaredFieldInHierarchy(object.getClass(), fieldName).set(object, value); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }
public class class_name { public static void setFieldValue(Object object, String fieldName, Object value) { try { getDeclaredFieldInHierarchy(object.getClass(), fieldName).set(object, value); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Configuration create(InputStream stream) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setIgnoringElementContentWhitespace(true); factory.setNamespaceAware(true); DocumentBuilder documentBuilder = factory.newDocumentBuilder(); Document document = documentBuilder.parse(stream); return domConfigurationFactory.create(document); } catch (ParserConfigurationException e) { throw new TextProcessorFactoryException(e); } catch (IOException e) { throw new TextProcessorFactoryException(e); } catch (SAXException e) { throw new TextProcessorFactoryException(e); } } }
public class class_name { public Configuration create(InputStream stream) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); // depends on control dependency: [try], data = [none] factory.setIgnoringElementContentWhitespace(true); // depends on control dependency: [try], data = [none] factory.setNamespaceAware(true); // depends on control dependency: [try], data = [none] DocumentBuilder documentBuilder = factory.newDocumentBuilder(); Document document = documentBuilder.parse(stream); return domConfigurationFactory.create(document); // depends on control dependency: [try], data = [none] } catch (ParserConfigurationException e) { throw new TextProcessorFactoryException(e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new TextProcessorFactoryException(e); } catch (SAXException e) { // depends on control dependency: [catch], data = [none] throw new TextProcessorFactoryException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Float convertStringToFloat(String value) { Float result; try { result = Float.valueOf(value); } catch (NumberFormatException e) { result = DEFAULT_FLOAT_VALUE; } return result; } }
public class class_name { public Float convertStringToFloat(String value) { Float result; try { result = Float.valueOf(value); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { result = DEFAULT_FLOAT_VALUE; } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { private LocatorSelectionStrategy getLocatorSelectionStrategy(String locatorSelectionStrategy) { if (null == locatorSelectionStrategy) { return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance(); } if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Strategy " + locatorSelectionStrategy + " was set for LocatorClientRegistrar."); } if (locatorSelectionStrategyMap.containsKey(locatorSelectionStrategy)) { return locatorSelectionStrategyMap.get(locatorSelectionStrategy).getInstance(); } else { if (LOG.isLoggable(Level.WARNING)) { LOG.log(Level.WARNING, "LocatorSelectionStrategy " + locatorSelectionStrategy + " not registered at LocatorClientEnabler."); } return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance(); } } }
public class class_name { private LocatorSelectionStrategy getLocatorSelectionStrategy(String locatorSelectionStrategy) { if (null == locatorSelectionStrategy) { return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance(); // depends on control dependency: [if], data = [none] } if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Strategy " + locatorSelectionStrategy + " was set for LocatorClientRegistrar."); // depends on control dependency: [if], data = [none] } if (locatorSelectionStrategyMap.containsKey(locatorSelectionStrategy)) { return locatorSelectionStrategyMap.get(locatorSelectionStrategy).getInstance(); // depends on control dependency: [if], data = [none] } else { if (LOG.isLoggable(Level.WARNING)) { LOG.log(Level.WARNING, "LocatorSelectionStrategy " + locatorSelectionStrategy + " not registered at LocatorClientEnabler."); // depends on control dependency: [if], data = [none] } return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setSectionTextVisible(final boolean VISIBLE) { if (null == sectionTextVisible) { _sectionTextVisible = VISIBLE; fireUpdateEvent(REDRAW_EVENT); } else { sectionTextVisible.set(VISIBLE); } } }
public class class_name { public void setSectionTextVisible(final boolean VISIBLE) { if (null == sectionTextVisible) { _sectionTextVisible = VISIBLE; // depends on control dependency: [if], data = [none] fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { sectionTextVisible.set(VISIBLE); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public boolean preVisit(Operator<?> node) { // check if node was already visited if (!this.visitedNodes.add(node)) { return false; } // apply the appropriate check method if (node instanceof FileDataSinkBase) { checkFileDataSink((FileDataSinkBase<?>) node); } else if (node instanceof FileDataSourceBase) { checkFileDataSource((FileDataSourceBase<?>) node); } else if (node instanceof GenericDataSinkBase) { checkDataSink((GenericDataSinkBase<?>) node); } else if (node instanceof BulkIterationBase) { checkBulkIteration((BulkIterationBase<?>) node); } else if (node instanceof SingleInputOperator) { checkSingleInputContract((SingleInputOperator<?, ?, ?>) node); } else if (node instanceof DualInputOperator<?, ?, ?, ?>) { checkDualInputContract((DualInputOperator<?, ?, ?, ?>) node); } if(node instanceof Validatable) { ((Validatable) node).check(); } return true; } }
public class class_name { @Override public boolean preVisit(Operator<?> node) { // check if node was already visited if (!this.visitedNodes.add(node)) { return false; // depends on control dependency: [if], data = [none] } // apply the appropriate check method if (node instanceof FileDataSinkBase) { checkFileDataSink((FileDataSinkBase<?>) node); // depends on control dependency: [if], data = [none] } else if (node instanceof FileDataSourceBase) { checkFileDataSource((FileDataSourceBase<?>) node); // depends on control dependency: [if], data = [none] } else if (node instanceof GenericDataSinkBase) { checkDataSink((GenericDataSinkBase<?>) node); // depends on control dependency: [if], data = [none] } else if (node instanceof BulkIterationBase) { checkBulkIteration((BulkIterationBase<?>) node); // depends on control dependency: [if], data = [none] } else if (node instanceof SingleInputOperator) { checkSingleInputContract((SingleInputOperator<?, ?, ?>) node); // depends on control dependency: [if], data = [none] } else if (node instanceof DualInputOperator<?, ?, ?, ?>) { checkDualInputContract((DualInputOperator<?, ?, ?, ?>) node); // depends on control dependency: [if], data = [)] } if(node instanceof Validatable) { ((Validatable) node).check(); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { static Optional<Context> union(Context a, Context b) { // NOTE: Avoid the temptation to return early; instead, rely on the equals() check at the end // to ensure all properties match. Checking equals() at the end ensures that when new // properties are added, they get checked automatically. // Try to reconcile each property one-by-one. if (a.slashType != b.slashType) { a = a.derive(JsFollowingSlash.UNKNOWN); b = b.derive(JsFollowingSlash.UNKNOWN); } if (a.uriPart != b.uriPart) { UriPart unionedUriPart = unionUriParts(a.uriPart, b.uriPart); a = a.derive(unionedUriPart); b = b.derive(unionedUriPart); } if (a.state != b.state) { // Order by state so that we don't have to duplicate tests below. if (a.state.compareTo(b.state) > 0) { Context swap = a; a = b; b = swap; } // consider <div foo=bar{if $p} onclick=foo(){/if} x=y> // if both branches need a space or tag end to complete, and their states aren't compatible // switch to TAG_NAME to require a space if (a.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END && b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END && a.state != b.state) { // we need to switch to a state that requires a space // TODO(lukes): given this usecase, HTML_TAG_NAME is poorly named, consider // AFTER_TAG_OR_UNQUOTED_ATTR? maybe just HTML_TAG_NEEDS_SPACE a = a.toBuilder().withState(HtmlContext.HTML_TAG_NAME).withoutAttrContext().build(); // The next block will clean up b. } // consider <input{if $foo} disabled{/if}> or <input{$if foo} disabled=true{/if} // if we start in a tag name and end in an attribute name or value, assume we are still in a // tag name. if (a.state == HtmlContext.HTML_TAG_NAME) { if (b.state == HtmlContext.HTML_ATTRIBUTE_NAME || b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END) { // clear attributes from a also, this is counterintuitive because tagnames shouldn't have // attrccontext at all, but prior reconciliation of slashtype may have added one. so // clear it. a = a.toBuilder().withoutAttrContext().build(); b = b.toBuilder().withState(HtmlContext.HTML_TAG_NAME).withoutAttrContext().build(); } } // If we start in a tag name and end between attributes, then treat us as between attributes. // This handles <b{if $bool} attrName="value"{/if}>. if (a.state == HtmlContext.HTML_TAG_NAME && b.state == HtmlContext.HTML_TAG) { // Note we only change the state; if the element type is different, we don't want it to // join. // TODO(gboyer): The withoutAttrContext() doesn't make any sense, since HTML_TAG_NAME can't // have an attribute context. a = a.toBuilder().withState(HtmlContext.HTML_TAG).withoutAttrContext().build(); } if (a.state == HtmlContext.HTML_TAG) { // If one branch is waiting for an attribute name, and the other is waiting for an equal // sign before an attribute value OR the end of an unquoted attribute value, then commit to // the view that the attribute name was a valueless attribute and transition to a state // waiting for another attribute name or the end of a tag. // Examples: // - state == HTML_ATTRIBUTE_NAME: <input {if $x}disabled{/if} // - delimType == SPACE_TAG_OR_END: <input {if $x}type=text{/if} if (b.state == HtmlContext.HTML_ATTRIBUTE_NAME || b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END) { // TODO(gboyer): do we need to require a space before any new attribute name after an // unquoted attribute? b = b.toBuilder().withState(HtmlContext.HTML_TAG).withoutAttrContext().build(); } } } return a.equals(b) ? Optional.of(a) : Optional.absent(); } }
public class class_name { static Optional<Context> union(Context a, Context b) { // NOTE: Avoid the temptation to return early; instead, rely on the equals() check at the end // to ensure all properties match. Checking equals() at the end ensures that when new // properties are added, they get checked automatically. // Try to reconcile each property one-by-one. if (a.slashType != b.slashType) { a = a.derive(JsFollowingSlash.UNKNOWN); // depends on control dependency: [if], data = [none] b = b.derive(JsFollowingSlash.UNKNOWN); // depends on control dependency: [if], data = [none] } if (a.uriPart != b.uriPart) { UriPart unionedUriPart = unionUriParts(a.uriPart, b.uriPart); a = a.derive(unionedUriPart); // depends on control dependency: [if], data = [none] b = b.derive(unionedUriPart); // depends on control dependency: [if], data = [none] } if (a.state != b.state) { // Order by state so that we don't have to duplicate tests below. if (a.state.compareTo(b.state) > 0) { Context swap = a; a = b; // depends on control dependency: [if], data = [none] b = swap; // depends on control dependency: [if], data = [none] } // consider <div foo=bar{if $p} onclick=foo(){/if} x=y> // if both branches need a space or tag end to complete, and their states aren't compatible // switch to TAG_NAME to require a space if (a.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END && b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END && a.state != b.state) { // we need to switch to a state that requires a space // TODO(lukes): given this usecase, HTML_TAG_NAME is poorly named, consider // AFTER_TAG_OR_UNQUOTED_ATTR? maybe just HTML_TAG_NEEDS_SPACE a = a.toBuilder().withState(HtmlContext.HTML_TAG_NAME).withoutAttrContext().build(); // depends on control dependency: [if], data = [none] // The next block will clean up b. } // consider <input{if $foo} disabled{/if}> or <input{$if foo} disabled=true{/if} // if we start in a tag name and end in an attribute name or value, assume we are still in a // tag name. if (a.state == HtmlContext.HTML_TAG_NAME) { if (b.state == HtmlContext.HTML_ATTRIBUTE_NAME || b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END) { // clear attributes from a also, this is counterintuitive because tagnames shouldn't have // attrccontext at all, but prior reconciliation of slashtype may have added one. so // clear it. a = a.toBuilder().withoutAttrContext().build(); // depends on control dependency: [if], data = [none] b = b.toBuilder().withState(HtmlContext.HTML_TAG_NAME).withoutAttrContext().build(); // depends on control dependency: [if], data = [none] } } // If we start in a tag name and end between attributes, then treat us as between attributes. // This handles <b{if $bool} attrName="value"{/if}>. if (a.state == HtmlContext.HTML_TAG_NAME && b.state == HtmlContext.HTML_TAG) { // Note we only change the state; if the element type is different, we don't want it to // join. // TODO(gboyer): The withoutAttrContext() doesn't make any sense, since HTML_TAG_NAME can't // have an attribute context. a = a.toBuilder().withState(HtmlContext.HTML_TAG).withoutAttrContext().build(); // depends on control dependency: [if], data = [none] } if (a.state == HtmlContext.HTML_TAG) { // If one branch is waiting for an attribute name, and the other is waiting for an equal // sign before an attribute value OR the end of an unquoted attribute value, then commit to // the view that the attribute name was a valueless attribute and transition to a state // waiting for another attribute name or the end of a tag. // Examples: // - state == HTML_ATTRIBUTE_NAME: <input {if $x}disabled{/if} // - delimType == SPACE_TAG_OR_END: <input {if $x}type=text{/if} if (b.state == HtmlContext.HTML_ATTRIBUTE_NAME || b.delimType == AttributeEndDelimiter.SPACE_OR_TAG_END) { // TODO(gboyer): do we need to require a space before any new attribute name after an // unquoted attribute? b = b.toBuilder().withState(HtmlContext.HTML_TAG).withoutAttrContext().build(); // depends on control dependency: [if], data = [none] } } } return a.equals(b) ? Optional.of(a) : Optional.absent(); } }
public class class_name { @Override public boolean isValidRequest(Context context) { // Check if we are executing an unsafe method if (!isUnsafe(context)) { return true; } if (checkCsrfBypass(context)) { LOGGER.debug("Bypassing CSRF check for {} {}", context.route().getHttpMethod(), context.route().getUrl()); return true; } else { String tokenFromRequest = extractTokenFromRequest(context); if (tokenFromRequest == null) { LOGGER.error("CSRF Check failed because there is no token in the incoming request headers"); return false; } String tokenFromContent = extractTokenFromContent(context); if (tokenFromContent == null) { LOGGER.error("CSRF Check failed because we are unable to find a token in the incoming request query " + "string or body"); return false; } if (compareTokens(tokenFromRequest, tokenFromContent)) { return true; } else { LOGGER.error("CSRF Check failed because the given token is invalid"); return false; } } } }
public class class_name { @Override public boolean isValidRequest(Context context) { // Check if we are executing an unsafe method if (!isUnsafe(context)) { return true; // depends on control dependency: [if], data = [none] } if (checkCsrfBypass(context)) { LOGGER.debug("Bypassing CSRF check for {} {}", context.route().getHttpMethod(), context.route().getUrl()); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { String tokenFromRequest = extractTokenFromRequest(context); if (tokenFromRequest == null) { LOGGER.error("CSRF Check failed because there is no token in the incoming request headers"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } String tokenFromContent = extractTokenFromContent(context); if (tokenFromContent == null) { LOGGER.error("CSRF Check failed because we are unable to find a token in the incoming request query " + "string or body"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (compareTokens(tokenFromRequest, tokenFromContent)) { return true; // depends on control dependency: [if], data = [none] } else { LOGGER.error("CSRF Check failed because the given token is invalid"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setPaused (boolean paused) { // sanity check if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) { log.warning("Requested to pause when paused or vice-versa", "paused", paused); return; } _paused = paused; if (_paused) { // make a note of our pause time _pauseTime = _framemgr.getTimeStamp(); } else { // let the animation and sprite managers know that we just warped into the future long delta = _framemgr.getTimeStamp() - _pauseTime; _animmgr.fastForward(delta); _spritemgr.fastForward(delta); // clear out our pause time _pauseTime = 0; } } }
public class class_name { public void setPaused (boolean paused) { // sanity check if ((paused && (_pauseTime != 0)) || (!paused && (_pauseTime == 0))) { log.warning("Requested to pause when paused or vice-versa", "paused", paused); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } _paused = paused; if (_paused) { // make a note of our pause time _pauseTime = _framemgr.getTimeStamp(); // depends on control dependency: [if], data = [none] } else { // let the animation and sprite managers know that we just warped into the future long delta = _framemgr.getTimeStamp() - _pauseTime; _animmgr.fastForward(delta); // depends on control dependency: [if], data = [none] _spritemgr.fastForward(delta); // depends on control dependency: [if], data = [none] // clear out our pause time _pauseTime = 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { public CpuAcctMetric snapshot() { final File cpuacct; try { cpuacct = new File( cgroupDiscoverer.discover(CGROUP).toFile(), CGROUP_ACCT_FILE ); } catch (RuntimeException re) { LOG.error(re, "Unable to fetch snapshot"); return new CpuAcctMetric(new long[0], new long[0]); } try { return parse(Files.readAllLines(cpuacct.toPath(), StandardCharsets.UTF_8)); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public CpuAcctMetric snapshot() { final File cpuacct; try { cpuacct = new File( cgroupDiscoverer.discover(CGROUP).toFile(), CGROUP_ACCT_FILE ); // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { LOG.error(re, "Unable to fetch snapshot"); return new CpuAcctMetric(new long[0], new long[0]); } // depends on control dependency: [catch], data = [none] try { return parse(Files.readAllLines(cpuacct.toPath(), StandardCharsets.UTF_8)); // 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 Observable<ServiceResponse<String>> getContentWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String configurationName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (automationAccountName == null) { throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."); } if (configurationName == null) { throw new IllegalArgumentException("Parameter configurationName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2015-10-31"; return service.getContent(resourceGroupName, automationAccountName, configurationName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<String>>>() { @Override public Observable<ServiceResponse<String>> call(Response<ResponseBody> response) { try { ServiceResponse<String> clientResponse = getContentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<String>> getContentWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String configurationName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (automationAccountName == null) { throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."); } if (configurationName == null) { throw new IllegalArgumentException("Parameter configurationName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2015-10-31"; return service.getContent(resourceGroupName, automationAccountName, configurationName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<String>>>() { @Override public Observable<ServiceResponse<String>> call(Response<ResponseBody> response) { try { ServiceResponse<String> clientResponse = getContentDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private boolean getAnchorMetadataFromData(ValueMap resourceProps, Element element) { boolean foundAny = false; List<Attribute> attributes = element.getAttributes(); for (Attribute attribute : attributes) { if (DataPropertyUtil.isHtml5DataName(attribute.getName())) { String value = attribute.getValue(); if (StringUtils.isNotEmpty(value)) { String property = DataPropertyUtil.toHeadlessCamelCaseName(attribute.getName()); if (StringUtils.startsWith(value, "[") && StringUtils.endsWith(value, "]")) { try { JSONArray jsonArray = new JSONArray(value); String[] values = new String[jsonArray.length()]; for (int i = 0; i < jsonArray.length(); i++) { values[i] = jsonArray.optString(i); } resourceProps.put(property, values); } catch (JSONException ex) { // ignore } } else { // decode if required value = decodeIfEncoded(value); resourceProps.put(property, value); } foundAny = true; } } } return foundAny; } }
public class class_name { private boolean getAnchorMetadataFromData(ValueMap resourceProps, Element element) { boolean foundAny = false; List<Attribute> attributes = element.getAttributes(); for (Attribute attribute : attributes) { if (DataPropertyUtil.isHtml5DataName(attribute.getName())) { String value = attribute.getValue(); if (StringUtils.isNotEmpty(value)) { String property = DataPropertyUtil.toHeadlessCamelCaseName(attribute.getName()); if (StringUtils.startsWith(value, "[") && StringUtils.endsWith(value, "]")) { try { JSONArray jsonArray = new JSONArray(value); String[] values = new String[jsonArray.length()]; for (int i = 0; i < jsonArray.length(); i++) { values[i] = jsonArray.optString(i); // depends on control dependency: [for], data = [i] } resourceProps.put(property, values); // depends on control dependency: [try], data = [none] } catch (JSONException ex) { // ignore } // depends on control dependency: [catch], data = [none] } else { // decode if required value = decodeIfEncoded(value); // depends on control dependency: [if], data = [none] resourceProps.put(property, value); // depends on control dependency: [if], data = [none] } foundAny = true; // depends on control dependency: [if], data = [none] } } } return foundAny; } }
public class class_name { public static UTF8String concatWs(UTF8String separator, UTF8String... inputs) { if (separator == null) { return null; } int numInputBytes = 0; // total number of bytes from the inputs int numInputs = 0; // number of non-null inputs for (int i = 0; i < inputs.length; i++) { if (inputs[i] != null) { numInputBytes += inputs[i].numBytes; numInputs++; } } if (numInputs == 0) { // Return an empty string if there is no input, or all the inputs are null. return EMPTY_UTF8; } // Allocate a new byte array, and copy the inputs one by one into it. // The size of the new array is the size of all inputs, plus the separators. final byte[] result = new byte[numInputBytes + (numInputs - 1) * separator.numBytes]; int offset = 0; for (int i = 0, j = 0; i < inputs.length; i++) { if (inputs[i] != null) { int len = inputs[i].numBytes; copyMemory( inputs[i].base, inputs[i].offset, result, BYTE_ARRAY_OFFSET + offset, len); offset += len; j++; // Add separator if this is not the last input. if (j < numInputs) { copyMemory( separator.base, separator.offset, result, BYTE_ARRAY_OFFSET + offset, separator.numBytes); offset += separator.numBytes; } } } return fromBytes(result); } }
public class class_name { public static UTF8String concatWs(UTF8String separator, UTF8String... inputs) { if (separator == null) { return null; // depends on control dependency: [if], data = [none] } int numInputBytes = 0; // total number of bytes from the inputs int numInputs = 0; // number of non-null inputs for (int i = 0; i < inputs.length; i++) { if (inputs[i] != null) { numInputBytes += inputs[i].numBytes; // depends on control dependency: [if], data = [none] numInputs++; // depends on control dependency: [if], data = [none] } } if (numInputs == 0) { // Return an empty string if there is no input, or all the inputs are null. return EMPTY_UTF8; // depends on control dependency: [if], data = [none] } // Allocate a new byte array, and copy the inputs one by one into it. // The size of the new array is the size of all inputs, plus the separators. final byte[] result = new byte[numInputBytes + (numInputs - 1) * separator.numBytes]; int offset = 0; for (int i = 0, j = 0; i < inputs.length; i++) { if (inputs[i] != null) { int len = inputs[i].numBytes; copyMemory( inputs[i].base, inputs[i].offset, result, BYTE_ARRAY_OFFSET + offset, len); // depends on control dependency: [if], data = [none] offset += len; // depends on control dependency: [if], data = [none] j++; // depends on control dependency: [if], data = [none] // Add separator if this is not the last input. if (j < numInputs) { copyMemory( separator.base, separator.offset, result, BYTE_ARRAY_OFFSET + offset, separator.numBytes); // depends on control dependency: [if], data = [none] offset += separator.numBytes; // depends on control dependency: [if], data = [none] } } } return fromBytes(result); } }
public class class_name { protected void computeEntityViaSuperColumns(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities, Map<ByteBuffer, List<SuperColumn>> qResults) { for (ByteBuffer key : qResults.keySet()) { onSuperColumn(m, isRelation, relations, entities, qResults.get(key), key); } } }
public class class_name { protected void computeEntityViaSuperColumns(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities, Map<ByteBuffer, List<SuperColumn>> qResults) { for (ByteBuffer key : qResults.keySet()) { onSuperColumn(m, isRelation, relations, entities, qResults.get(key), key); // depends on control dependency: [for], data = [key] } } }
public class class_name { public CustomSerializer getCustomSerializer() { if (this.customSerializer != null) { return customSerializer; } if (this.requestClass != null) { this.customSerializer = CustomSerializerManager.getCustomSerializer(this.requestClass); } if (this.customSerializer == null) { this.customSerializer = CustomSerializerManager.getCustomSerializer(this.getCmdCode()); } return this.customSerializer; } }
public class class_name { public CustomSerializer getCustomSerializer() { if (this.customSerializer != null) { return customSerializer; // depends on control dependency: [if], data = [none] } if (this.requestClass != null) { this.customSerializer = CustomSerializerManager.getCustomSerializer(this.requestClass); // depends on control dependency: [if], data = [(this.requestClass] } if (this.customSerializer == null) { this.customSerializer = CustomSerializerManager.getCustomSerializer(this.getCmdCode()); // depends on control dependency: [if], data = [none] } return this.customSerializer; } }
public class class_name { public T invoke(RT receiver, Object... arguments) { assert receiver != null; final Method method; synchronized (this) { if (this.method == null) { this.method = getMethod(receiver, arguments); method = this.method; } else { method = this.method; } } try { return this.returnType.cast(method.invoke(receiver, arguments)); } catch (RuntimeException | Error exception) { throw exception; } catch (Throwable exception) { throw new RuntimeException(exception); } } }
public class class_name { public T invoke(RT receiver, Object... arguments) { assert receiver != null; final Method method; synchronized (this) { if (this.method == null) { this.method = getMethod(receiver, arguments); // depends on control dependency: [if], data = [none] method = this.method; // depends on control dependency: [if], data = [none] } else { method = this.method; // depends on control dependency: [if], data = [none] } } try { return this.returnType.cast(method.invoke(receiver, arguments)); // depends on control dependency: [try], data = [none] } catch (RuntimeException | Error exception) { throw exception; } catch (Throwable exception) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(exception); } // depends on control dependency: [catch], data = [none] } }