code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void readUDFTypes(FieldContainer mpxj, List<UDFAssignmentType> udfs) { for (UDFAssignmentType udf : udfs) { FieldType fieldType = m_fieldTypeMap.get(Integer.valueOf(udf.getTypeObjectId())); if (fieldType != null) { mpxj.set(fieldType, getUdfValue(udf)); } } } }
public class class_name { private void readUDFTypes(FieldContainer mpxj, List<UDFAssignmentType> udfs) { for (UDFAssignmentType udf : udfs) { FieldType fieldType = m_fieldTypeMap.get(Integer.valueOf(udf.getTypeObjectId())); if (fieldType != null) { mpxj.set(fieldType, getUdfValue(udf)); // depends on control dependency: [if], data = [(fieldType] } } } }
public class class_name { public static void extractFile(File zipFile, String entryName, File destination) throws IOException { ZipFile zip = new ZipFile(zipFile); try { ZipEntry entry = zip.getEntry(entryName); if (entry != null) { // Get an input stream for the entry. InputStream entryStream = zip.getInputStream(entry); try { // Create the output file File parent = destination.getParentFile(); if (parent != null) { parent.mkdirs(); } FileOutputStream file = new FileOutputStream(destination); try { // Allocate a buffer for reading the entry data. byte[] data = new byte[BUFFER]; int bytesRead; // Read the entry data and write it to the output file. while ((bytesRead = entryStream.read(data)) != -1) { file.write(data, 0, bytesRead); } } finally { file.close(); } } finally { entryStream.close(); } } else { throw new IOException(zipFile.getName() + " does not contain: " + entryName); } } finally { zip.close(); } } }
public class class_name { public static void extractFile(File zipFile, String entryName, File destination) throws IOException { ZipFile zip = new ZipFile(zipFile); try { ZipEntry entry = zip.getEntry(entryName); if (entry != null) { // Get an input stream for the entry. InputStream entryStream = zip.getInputStream(entry); try { // Create the output file File parent = destination.getParentFile(); if (parent != null) { parent.mkdirs(); // depends on control dependency: [if], data = [none] } FileOutputStream file = new FileOutputStream(destination); try { // Allocate a buffer for reading the entry data. byte[] data = new byte[BUFFER]; int bytesRead; // Read the entry data and write it to the output file. while ((bytesRead = entryStream.read(data)) != -1) { file.write(data, 0, bytesRead); // depends on control dependency: [while], data = [none] } } finally { file.close(); } } finally { entryStream.close(); } } else { throw new IOException(zipFile.getName() + " does not contain: " + entryName); } } finally { zip.close(); } } }
public class class_name { @Override PaxDate plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } long calcMonths = Math.addExact(getProlepticMonth(), monthsToAdd); // "Regularize" the month count, as if years were all 13 months long. long monthsRegularized = calcMonths - getLeapMonthsBefore(calcMonths); int newYear = YEAR.checkValidIntValue(Math.floorDiv(monthsRegularized, MONTHS_IN_YEAR)); int newMonth = Math.toIntExact(calcMonths - ((long) newYear * MONTHS_IN_YEAR + getLeapYearsBefore(newYear)) + 1); return resolvePreviousValid(newYear, newMonth, getDayOfMonth()); } }
public class class_name { @Override PaxDate plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; // depends on control dependency: [if], data = [none] } long calcMonths = Math.addExact(getProlepticMonth(), monthsToAdd); // "Regularize" the month count, as if years were all 13 months long. long monthsRegularized = calcMonths - getLeapMonthsBefore(calcMonths); int newYear = YEAR.checkValidIntValue(Math.floorDiv(monthsRegularized, MONTHS_IN_YEAR)); int newMonth = Math.toIntExact(calcMonths - ((long) newYear * MONTHS_IN_YEAR + getLeapYearsBefore(newYear)) + 1); return resolvePreviousValid(newYear, newMonth, getDayOfMonth()); } }
public class class_name { public <U, E extends Exception> List<Pair<T, U>> rightJoin(final Collection<U> b, final Try.BiPredicate<? super T, ? super U, E> predicate) throws E { final List<Pair<T, U>> result = new ArrayList<>(N.size(b)); if (N.isNullOrEmpty(b)) { return result; } else if (N.isNullOrEmpty(coll)) { for (U right : b) { result.add(Pair.of((T) null, right)); } } else { for (U right : b) { boolean joined = false; for (T left : coll) { if (predicate.test(left, right)) { result.add(Pair.of(left, right)); joined = true; } } if (joined == false) { result.add(Pair.of((T) null, right)); } } } return result; } }
public class class_name { public <U, E extends Exception> List<Pair<T, U>> rightJoin(final Collection<U> b, final Try.BiPredicate<? super T, ? super U, E> predicate) throws E { final List<Pair<T, U>> result = new ArrayList<>(N.size(b)); if (N.isNullOrEmpty(b)) { return result; } else if (N.isNullOrEmpty(coll)) { for (U right : b) { result.add(Pair.of((T) null, right)); // depends on control dependency: [for], data = [right] } } else { for (U right : b) { boolean joined = false; for (T left : coll) { if (predicate.test(left, right)) { result.add(Pair.of(left, right)); // depends on control dependency: [if], data = [none] joined = true; // depends on control dependency: [if], data = [none] } } if (joined == false) { result.add(Pair.of((T) null, right)); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public OffsetDateTime getOffsetDateTime(final String fieldName) { try { if (_jsonObject.isNull(fieldName)) { return null; } else { return OffsetDateTime.parse(_jsonObject.getString(fieldName), DATE_TIME_FORMATTER); } } catch (JSONException ex) { throw new QuandlRuntimeException("Cannot find field", ex); } } }
public class class_name { public OffsetDateTime getOffsetDateTime(final String fieldName) { try { if (_jsonObject.isNull(fieldName)) { return null; // depends on control dependency: [if], data = [none] } else { return OffsetDateTime.parse(_jsonObject.getString(fieldName), DATE_TIME_FORMATTER); // depends on control dependency: [if], data = [none] } } catch (JSONException ex) { throw new QuandlRuntimeException("Cannot find field", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static InsnList tableSwitch(InsnList indexInsnList, InsnList defaultInsnList, int caseStartIdx, InsnList... caseInsnLists) { Validate.notNull(defaultInsnList); Validate.notNull(indexInsnList); Validate.isTrue(caseStartIdx >= 0); Validate.notNull(caseInsnLists); Validate.noNullElements(caseInsnLists); Validate.isTrue(caseInsnLists.length > 0); InsnList ret = new InsnList(); LabelNode defaultLabelNode = new LabelNode(); LabelNode[] caseLabelNodes = new LabelNode[caseInsnLists.length]; for (int i = 0; i < caseInsnLists.length; i++) { caseLabelNodes[i] = new LabelNode(); } ret.add(indexInsnList); ret.add(new TableSwitchInsnNode(caseStartIdx, caseStartIdx + caseInsnLists.length - 1, defaultLabelNode, caseLabelNodes)); for (int i = 0; i < caseInsnLists.length; i++) { LabelNode caseLabelNode = caseLabelNodes[i]; InsnList caseInsnList = caseInsnLists[i]; if (caseInsnList != null) { ret.add(caseLabelNode); ret.add(caseInsnList); } } if (defaultInsnList != null) { ret.add(defaultLabelNode); ret.add(defaultInsnList); } return ret; } }
public class class_name { public static InsnList tableSwitch(InsnList indexInsnList, InsnList defaultInsnList, int caseStartIdx, InsnList... caseInsnLists) { Validate.notNull(defaultInsnList); Validate.notNull(indexInsnList); Validate.isTrue(caseStartIdx >= 0); Validate.notNull(caseInsnLists); Validate.noNullElements(caseInsnLists); Validate.isTrue(caseInsnLists.length > 0); InsnList ret = new InsnList(); LabelNode defaultLabelNode = new LabelNode(); LabelNode[] caseLabelNodes = new LabelNode[caseInsnLists.length]; for (int i = 0; i < caseInsnLists.length; i++) { caseLabelNodes[i] = new LabelNode(); // depends on control dependency: [for], data = [i] } ret.add(indexInsnList); ret.add(new TableSwitchInsnNode(caseStartIdx, caseStartIdx + caseInsnLists.length - 1, defaultLabelNode, caseLabelNodes)); for (int i = 0; i < caseInsnLists.length; i++) { LabelNode caseLabelNode = caseLabelNodes[i]; InsnList caseInsnList = caseInsnLists[i]; if (caseInsnList != null) { ret.add(caseLabelNode); // depends on control dependency: [if], data = [none] ret.add(caseInsnList); // depends on control dependency: [if], data = [(caseInsnList] } } if (defaultInsnList != null) { ret.add(defaultLabelNode); // depends on control dependency: [if], data = [none] ret.add(defaultInsnList); // depends on control dependency: [if], data = [(defaultInsnList] } return ret; } }
public class class_name { protected final HtmlTemplate findTemplate(final List<HtmlTemplate> pHtmlTemplates, final Long pId) throws Exception { for (HtmlTemplate tmpl : pHtmlTemplates) { if (tmpl.getItsId().equals(pId)) { return tmpl; } } throw new Exception("Algorithm error/or template deleted: template not found for ID" + pId); } }
public class class_name { protected final HtmlTemplate findTemplate(final List<HtmlTemplate> pHtmlTemplates, final Long pId) throws Exception { for (HtmlTemplate tmpl : pHtmlTemplates) { if (tmpl.getItsId().equals(pId)) { return tmpl; // depends on control dependency: [if], data = [none] } } throw new Exception("Algorithm error/or template deleted: template not found for ID" + pId); } }
public class class_name { public void marshall(GetConnectionRequest getConnectionRequest, ProtocolMarshaller protocolMarshaller) { if (getConnectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getConnectionRequest.getCatalogId(), CATALOGID_BINDING); protocolMarshaller.marshall(getConnectionRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(getConnectionRequest.getHidePassword(), HIDEPASSWORD_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetConnectionRequest getConnectionRequest, ProtocolMarshaller protocolMarshaller) { if (getConnectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getConnectionRequest.getCatalogId(), CATALOGID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getConnectionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getConnectionRequest.getHidePassword(), HIDEPASSWORD_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static boolean isAssignableFrom(TypeVariable<?> type1, TypeVariable<?> type2) { if (type1.equals(type2)) { return true; } // if a type variable extends another type variable, it cannot declare other bounds if (type2.getBounds()[0] instanceof TypeVariable<?>) { return isAssignableFrom(type1, (TypeVariable<?>) type2.getBounds()[0]); } return false; } }
public class class_name { private static boolean isAssignableFrom(TypeVariable<?> type1, TypeVariable<?> type2) { if (type1.equals(type2)) { return true; // depends on control dependency: [if], data = [none] } // if a type variable extends another type variable, it cannot declare other bounds if (type2.getBounds()[0] instanceof TypeVariable<?>) { return isAssignableFrom(type1, (TypeVariable<?>) type2.getBounds()[0]); // depends on control dependency: [if], data = [)] } return false; } }
public class class_name { public static boolean equalsIgnoreCase(String name, Iterable<String> patterns) { for (String pattern : patterns) { if (name.equalsIgnoreCase(pattern)) { return true; } } return false; } }
public class class_name { public static boolean equalsIgnoreCase(String name, Iterable<String> patterns) { for (String pattern : patterns) { if (name.equalsIgnoreCase(pattern)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override public final InternalQueryCache createNew(String cacheId) { try { QueryCacheConfig queryCacheConfig = initQueryCacheConfig(request, cacheId); if (queryCacheConfig == null) { // no matching configuration was found, `null` will // be returned to user from IMap#getQueryCache call. return NULL_QUERY_CACHE; } queryCache = createUnderlyingQueryCache(queryCacheConfig, request, cacheId); AccumulatorInfo info = toAccumulatorInfo(queryCacheConfig, mapName, cacheId, predicate); addInfoToSubscriberContext(info); info.setPublishable(true); String publisherListenerId = queryCache.getPublisherListenerId(); if (publisherListenerId == null) { createSubscriberAccumulator(info); } createPublisherAccumulator(info); queryCache.setPublisherListenerId(this.publisherListenerId); } catch (Throwable throwable) { removeQueryCacheConfig(mapName, request.getCacheName()); throw rethrow(throwable); } return queryCache; } }
public class class_name { @Override public final InternalQueryCache createNew(String cacheId) { try { QueryCacheConfig queryCacheConfig = initQueryCacheConfig(request, cacheId); if (queryCacheConfig == null) { // no matching configuration was found, `null` will // be returned to user from IMap#getQueryCache call. return NULL_QUERY_CACHE; // depends on control dependency: [if], data = [none] } queryCache = createUnderlyingQueryCache(queryCacheConfig, request, cacheId); // depends on control dependency: [try], data = [none] AccumulatorInfo info = toAccumulatorInfo(queryCacheConfig, mapName, cacheId, predicate); addInfoToSubscriberContext(info); // depends on control dependency: [try], data = [none] info.setPublishable(true); // depends on control dependency: [try], data = [none] String publisherListenerId = queryCache.getPublisherListenerId(); if (publisherListenerId == null) { createSubscriberAccumulator(info); // depends on control dependency: [if], data = [none] } createPublisherAccumulator(info); // depends on control dependency: [try], data = [none] queryCache.setPublisherListenerId(this.publisherListenerId); // depends on control dependency: [try], data = [none] } catch (Throwable throwable) { removeQueryCacheConfig(mapName, request.getCacheName()); throw rethrow(throwable); } // depends on control dependency: [catch], data = [none] return queryCache; } }
public class class_name { public int[] updateBatch(@SQL @NotNull String sql, @NotNull List<? extends List<?>> argumentLists) { SqlQuery query = SqlQuery.query(sql, "<batch-update>"); return withCurrentTransaction(query, tx -> { logQuery(query); try (PreparedStatement ps = tx.getConnection().prepareStatement(sql)) { bindQueryParameters(ps, query); for (List<?> arguments : argumentLists) { bindArguments(ps, arguments); ps.addBatch(); } long startTime = currentTimeMillis(); int[] counts = ps.executeBatch(); logQueryExecution(query, currentTimeMillis() - startTime); return counts; } }); } }
public class class_name { public int[] updateBatch(@SQL @NotNull String sql, @NotNull List<? extends List<?>> argumentLists) { SqlQuery query = SqlQuery.query(sql, "<batch-update>"); return withCurrentTransaction(query, tx -> { logQuery(query); try (PreparedStatement ps = tx.getConnection().prepareStatement(sql)) { bindQueryParameters(ps, query); for (List<?> arguments : argumentLists) { bindArguments(ps, arguments); // depends on control dependency: [for], data = [arguments] ps.addBatch(); // depends on control dependency: [for], data = [none] } long startTime = currentTimeMillis(); int[] counts = ps.executeBatch(); logQueryExecution(query, currentTimeMillis() - startTime); return counts; } }); } }
public class class_name { public boolean isTransitionRequired(@Nullable TransitionValues startValues, @Nullable TransitionValues endValues) { boolean valuesChanged = false; // if startValues null, then transition didn't care to stash values, // and won't get canceled if (startValues != null && endValues != null) { String[] properties = getTransitionProperties(); if (properties != null) { int count = properties.length; for (int i = 0; i < count; i++) { if (isValueChanged(startValues, endValues, properties[i])) { valuesChanged = true; break; } } } else { for (String key : startValues.values.keySet()) { if (isValueChanged(startValues, endValues, key)) { valuesChanged = true; break; } } } } return valuesChanged; } }
public class class_name { public boolean isTransitionRequired(@Nullable TransitionValues startValues, @Nullable TransitionValues endValues) { boolean valuesChanged = false; // if startValues null, then transition didn't care to stash values, // and won't get canceled if (startValues != null && endValues != null) { String[] properties = getTransitionProperties(); if (properties != null) { int count = properties.length; for (int i = 0; i < count; i++) { if (isValueChanged(startValues, endValues, properties[i])) { valuesChanged = true; // depends on control dependency: [if], data = [none] break; } } } else { for (String key : startValues.values.keySet()) { if (isValueChanged(startValues, endValues, key)) { valuesChanged = true; // depends on control dependency: [if], data = [none] break; } } } } return valuesChanged; } }
public class class_name { public ListApplicationsResult withApplications(String... applications) { if (this.applications == null) { setApplications(new com.amazonaws.internal.SdkInternalList<String>(applications.length)); } for (String ele : applications) { this.applications.add(ele); } return this; } }
public class class_name { public ListApplicationsResult withApplications(String... applications) { if (this.applications == null) { setApplications(new com.amazonaws.internal.SdkInternalList<String>(applications.length)); // depends on control dependency: [if], data = [none] } for (String ele : applications) { this.applications.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static List<AbstractPlugin> getActiveScanRules(AddOn addOn, AddOnClassLoader addOnClassLoader) { validateNotNull(addOn, "addOn"); validateNotNull(addOnClassLoader, "addOnClassLoader"); synchronized (addOn) { if (addOn.isLoadedAscanrulesSet()) { return addOn.getLoadedAscanrules(); } List<AbstractPlugin> ascanrules = loadDeclaredClasses( addOnClassLoader, addOn.getAscanrules(), AbstractPlugin.class, "ascanrule"); addOn.setLoadedAscanrules(ascanrules); addOn.setLoadedAscanrulesSet(true); return Collections.unmodifiableList(ascanrules); } } }
public class class_name { public static List<AbstractPlugin> getActiveScanRules(AddOn addOn, AddOnClassLoader addOnClassLoader) { validateNotNull(addOn, "addOn"); validateNotNull(addOnClassLoader, "addOnClassLoader"); synchronized (addOn) { if (addOn.isLoadedAscanrulesSet()) { return addOn.getLoadedAscanrules(); // depends on control dependency: [if], data = [none] } List<AbstractPlugin> ascanrules = loadDeclaredClasses( addOnClassLoader, addOn.getAscanrules(), AbstractPlugin.class, "ascanrule"); addOn.setLoadedAscanrules(ascanrules); addOn.setLoadedAscanrulesSet(true); return Collections.unmodifiableList(ascanrules); } } }
public class class_name { public int calculateDxToMakeVisible(View view, int snapPreference) { final RecyclerView.LayoutManager layoutManager = getLayoutManager(); if (!layoutManager.canScrollHorizontally()) { return 0; } final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); final int left = layoutManager.getDecoratedLeft(view) - params.leftMargin; final int right = layoutManager.getDecoratedRight(view) + params.rightMargin; final int start = layoutManager.getPaddingLeft(); final int end = layoutManager.getWidth() - layoutManager.getPaddingRight(); return calculateDtToFit(left, right, start, end, snapPreference); } }
public class class_name { public int calculateDxToMakeVisible(View view, int snapPreference) { final RecyclerView.LayoutManager layoutManager = getLayoutManager(); if (!layoutManager.canScrollHorizontally()) { return 0; // depends on control dependency: [if], data = [none] } final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); final int left = layoutManager.getDecoratedLeft(view) - params.leftMargin; final int right = layoutManager.getDecoratedRight(view) + params.rightMargin; final int start = layoutManager.getPaddingLeft(); final int end = layoutManager.getWidth() - layoutManager.getPaddingRight(); return calculateDtToFit(left, right, start, end, snapPreference); } }
public class class_name { @Override public CommerceWishList fetchByU_LtC_First(long userId, Date createDate, OrderByComparator<CommerceWishList> orderByComparator) { List<CommerceWishList> list = findByU_LtC(userId, createDate, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { @Override public CommerceWishList fetchByU_LtC_First(long userId, Date createDate, OrderByComparator<CommerceWishList> orderByComparator) { List<CommerceWishList> list = findByU_LtC(userId, createDate, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private static final String encode(String s) { try { return URLEncoder.encode(s, UTF_8); } catch (UnsupportedEncodingException e) { throw new Error("JVM unable to handle UTF-8"); } } }
public class class_name { private static final String encode(String s) { try { return URLEncoder.encode(s, UTF_8); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new Error("JVM unable to handle UTF-8"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static int combineBins( int leftBinCount, float[] leftPositions, long[] leftBins, int rightBinCount, float[] rightPositions, long[] rightBins, float[] mergedPositions, long[] mergedBins, float[] deltas ) { int i = 0; int j = 0; int k = 0; while (j < leftBinCount || k < rightBinCount) { if (j < leftBinCount && (k == rightBinCount || leftPositions[j] < rightPositions[k])) { mergedPositions[i] = leftPositions[j]; mergedBins[i] = leftBins[j]; ++j; } else if (k < rightBinCount && (j == leftBinCount || leftPositions[j] > rightPositions[k])) { mergedPositions[i] = rightPositions[k]; mergedBins[i] = rightBins[k]; ++k; } else { // combine overlapping bins mergedPositions[i] = leftPositions[j]; mergedBins[i] = leftBins[j] + rightBins[k]; ++j; ++k; } if (deltas != null && i > 0) { deltas[i - 1] = mergedPositions[i] - mergedPositions[i - 1]; } ++i; } return i; } }
public class class_name { private static int combineBins( int leftBinCount, float[] leftPositions, long[] leftBins, int rightBinCount, float[] rightPositions, long[] rightBins, float[] mergedPositions, long[] mergedBins, float[] deltas ) { int i = 0; int j = 0; int k = 0; while (j < leftBinCount || k < rightBinCount) { if (j < leftBinCount && (k == rightBinCount || leftPositions[j] < rightPositions[k])) { mergedPositions[i] = leftPositions[j]; // depends on control dependency: [if], data = [none] mergedBins[i] = leftBins[j]; // depends on control dependency: [if], data = [none] ++j; // depends on control dependency: [if], data = [none] } else if (k < rightBinCount && (j == leftBinCount || leftPositions[j] > rightPositions[k])) { mergedPositions[i] = rightPositions[k]; // depends on control dependency: [if], data = [none] mergedBins[i] = rightBins[k]; // depends on control dependency: [if], data = [none] ++k; // depends on control dependency: [if], data = [none] } else { // combine overlapping bins mergedPositions[i] = leftPositions[j]; // depends on control dependency: [if], data = [none] mergedBins[i] = leftBins[j] + rightBins[k]; // depends on control dependency: [if], data = [none] ++j; // depends on control dependency: [if], data = [none] ++k; // depends on control dependency: [if], data = [none] } if (deltas != null && i > 0) { deltas[i - 1] = mergedPositions[i] - mergedPositions[i - 1]; // depends on control dependency: [if], data = [none] } ++i; // depends on control dependency: [while], data = [none] } return i; } }
public class class_name { public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { if (api < Opcodes.ASM5) { throw new UnsupportedOperationException(REQUIRES_ASM5); } if (mv != null) { return mv.visitTypeAnnotation(typeRef, typePath, descriptor, visible); } return null; } }
public class class_name { public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { if (api < Opcodes.ASM5) { throw new UnsupportedOperationException(REQUIRES_ASM5); } if (mv != null) { return mv.visitTypeAnnotation(typeRef, typePath, descriptor, visible); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public void evaluate(DoubleSolution solution) { int numberOfVariables = solution.getNumberOfVariables(); int numberOfObjectives = solution.getNumberOfObjectives(); double[] x = new double[numberOfVariables]; double[] f = new double[numberOfObjectives]; for (int i = 0; i < numberOfVariables; i++) { x[i] = solution.getVariableValue(i); } // evaluate g,h double g = 0, h = 0, sub1; for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) { g += x[i]; } g = 1 + 9 * g / (numberOfVariables - numberOfObjectives + 1); sub1 = 1 + g; for (int i = 0; i < numberOfObjectives - 1; i++) { h += (x[i] * (1 + Math.sin(3 * Math.PI * x[i])) / sub1); } h = numberOfObjectives - h; // evaluate f1,...,m-1,m for (int i = 0; i < numberOfObjectives; i++) { f[i] = x[i]; } f[numberOfObjectives - 1] = h * sub1; for (int i = 0; i < numberOfObjectives; i++) { solution.setObjective(i, f[i]); } } }
public class class_name { @Override public void evaluate(DoubleSolution solution) { int numberOfVariables = solution.getNumberOfVariables(); int numberOfObjectives = solution.getNumberOfObjectives(); double[] x = new double[numberOfVariables]; double[] f = new double[numberOfObjectives]; for (int i = 0; i < numberOfVariables; i++) { x[i] = solution.getVariableValue(i); // depends on control dependency: [for], data = [i] } // evaluate g,h double g = 0, h = 0, sub1; for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) { g += x[i]; // depends on control dependency: [for], data = [i] } g = 1 + 9 * g / (numberOfVariables - numberOfObjectives + 1); sub1 = 1 + g; for (int i = 0; i < numberOfObjectives - 1; i++) { h += (x[i] * (1 + Math.sin(3 * Math.PI * x[i])) / sub1); // depends on control dependency: [for], data = [i] } h = numberOfObjectives - h; // evaluate f1,...,m-1,m for (int i = 0; i < numberOfObjectives; i++) { f[i] = x[i]; // depends on control dependency: [for], data = [i] } f[numberOfObjectives - 1] = h * sub1; for (int i = 0; i < numberOfObjectives; i++) { solution.setObjective(i, f[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public void addListener(Record record, FileListener listener) { super.addListener(record, listener); if (listener.getOwner() == this.getRecord()) // Only replicate listeners added to base. { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { FileListener newBehavior = null; // Clone the file behaviors try { newBehavior = (FileListener)listener.clone(); // Clone the file behaviors } catch (CloneNotSupportedException ex) { newBehavior = null; } record = table.getRecord(); if (newBehavior != null) table.addListener(record, newBehavior); // Add them to the new query } } } } }
public class class_name { public void addListener(Record record, FileListener listener) { super.addListener(record, listener); if (listener.getOwner() == this.getRecord()) // Only replicate listeners added to base. { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { FileListener newBehavior = null; // Clone the file behaviors try { newBehavior = (FileListener)listener.clone(); // Clone the file behaviors // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException ex) { newBehavior = null; } // depends on control dependency: [catch], data = [none] record = table.getRecord(); // depends on control dependency: [if], data = [none] if (newBehavior != null) table.addListener(record, newBehavior); // Add them to the new query } } } } }
public class class_name { @Override public int countMissing() { int count = 0; for (int i = 0; i < size(); i++) { if (valueIsMissing(getByte(i))) { count++; } } return count; } }
public class class_name { @Override public int countMissing() { int count = 0; for (int i = 0; i < size(); i++) { if (valueIsMissing(getByte(i))) { count++; // depends on control dependency: [if], data = [none] } } return count; } }
public class class_name { public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); } catch (Exception e) {} if (v != null) { break; } this.sleep(RETRY_PERIOD); } return v; } }
public class class_name { public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); // depends on control dependency: [try], data = [none] } catch (Exception e) {} // depends on control dependency: [catch], data = [none] if (v != null) { break; } this.sleep(RETRY_PERIOD); // depends on control dependency: [for], data = [none] } return v; } }
public class class_name { void get_cluster_features(final Context ctx, final List<Integer> cluster4, final List<Integer> cluster6, final List<Integer> cluster, List<Integer> features) { if (!use_cluster) { return; } PUSH(features, CLUSTER(cluster, ctx.S0)); PUSH(features, CLUSTER4(cluster4, ctx.S0)); PUSH(features, CLUSTER6(cluster6, ctx.S0)); PUSH(features, CLUSTER(cluster, ctx.S1)); PUSH(features, CLUSTER(cluster, ctx.S2)); PUSH(features, CLUSTER(cluster, ctx.N0)); PUSH(features, CLUSTER4(cluster4, ctx.N0)); PUSH(features, CLUSTER6(cluster6, ctx.N0)); PUSH(features, CLUSTER(cluster, ctx.N1)); PUSH(features, CLUSTER(cluster, ctx.N2)); PUSH(features, CLUSTER(cluster, ctx.S0L)); PUSH(features, CLUSTER(cluster, ctx.S0R)); PUSH(features, CLUSTER(cluster, ctx.S0L2)); PUSH(features, CLUSTER(cluster, ctx.S0R2)); PUSH(features, CLUSTER(cluster, ctx.S0LL)); PUSH(features, CLUSTER(cluster, ctx.S0RR)); PUSH(features, CLUSTER(cluster, ctx.S1L)); PUSH(features, CLUSTER(cluster, ctx.S1R)); PUSH(features, CLUSTER(cluster, ctx.S1L2)); PUSH(features, CLUSTER(cluster, ctx.S1R2)); PUSH(features, CLUSTER(cluster, ctx.S1LL)); PUSH(features, CLUSTER(cluster, ctx.S1RR)); } }
public class class_name { void get_cluster_features(final Context ctx, final List<Integer> cluster4, final List<Integer> cluster6, final List<Integer> cluster, List<Integer> features) { if (!use_cluster) { return; // depends on control dependency: [if], data = [none] } PUSH(features, CLUSTER(cluster, ctx.S0)); PUSH(features, CLUSTER4(cluster4, ctx.S0)); PUSH(features, CLUSTER6(cluster6, ctx.S0)); PUSH(features, CLUSTER(cluster, ctx.S1)); PUSH(features, CLUSTER(cluster, ctx.S2)); PUSH(features, CLUSTER(cluster, ctx.N0)); PUSH(features, CLUSTER4(cluster4, ctx.N0)); PUSH(features, CLUSTER6(cluster6, ctx.N0)); PUSH(features, CLUSTER(cluster, ctx.N1)); PUSH(features, CLUSTER(cluster, ctx.N2)); PUSH(features, CLUSTER(cluster, ctx.S0L)); PUSH(features, CLUSTER(cluster, ctx.S0R)); PUSH(features, CLUSTER(cluster, ctx.S0L2)); PUSH(features, CLUSTER(cluster, ctx.S0R2)); PUSH(features, CLUSTER(cluster, ctx.S0LL)); PUSH(features, CLUSTER(cluster, ctx.S0RR)); PUSH(features, CLUSTER(cluster, ctx.S1L)); PUSH(features, CLUSTER(cluster, ctx.S1R)); PUSH(features, CLUSTER(cluster, ctx.S1L2)); PUSH(features, CLUSTER(cluster, ctx.S1R2)); PUSH(features, CLUSTER(cluster, ctx.S1LL)); PUSH(features, CLUSTER(cluster, ctx.S1RR)); } }
public class class_name { public List<Group> getGroupsNotInPathProfile( int profileId, int pathId) { ArrayList<Group> allGroups = new ArrayList<Group>(findAllGroups()); ArrayList<Group> groupsNotInProfile = new ArrayList<Group>(); int[] groupIds = Utils.arrayFromStringOfIntegers(getGroupIdsInPathProfile(profileId, pathId)); // go though each group, if groupIds does not match any of them, then // the group must not be added, so we add it for (int j = 0; j < allGroups.size(); j++) { boolean add = true; for (int i = 0; i < groupIds.length; i++) { if (allGroups.get(j).getId() == groupIds[i]) { add = false; } } if (add) { groupsNotInProfile.add(allGroups.get(j)); } } return groupsNotInProfile; } }
public class class_name { public List<Group> getGroupsNotInPathProfile( int profileId, int pathId) { ArrayList<Group> allGroups = new ArrayList<Group>(findAllGroups()); ArrayList<Group> groupsNotInProfile = new ArrayList<Group>(); int[] groupIds = Utils.arrayFromStringOfIntegers(getGroupIdsInPathProfile(profileId, pathId)); // go though each group, if groupIds does not match any of them, then // the group must not be added, so we add it for (int j = 0; j < allGroups.size(); j++) { boolean add = true; for (int i = 0; i < groupIds.length; i++) { if (allGroups.get(j).getId() == groupIds[i]) { add = false; // depends on control dependency: [if], data = [none] } } if (add) { groupsNotInProfile.add(allGroups.get(j)); // depends on control dependency: [if], data = [none] } } return groupsNotInProfile; } }
public class class_name { public void marshall(DescribeComplianceByConfigRuleRequest describeComplianceByConfigRuleRequest, ProtocolMarshaller protocolMarshaller) { if (describeComplianceByConfigRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getConfigRuleNames(), CONFIGRULENAMES_BINDING); protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getComplianceTypes(), COMPLIANCETYPES_BINDING); protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeComplianceByConfigRuleRequest describeComplianceByConfigRuleRequest, ProtocolMarshaller protocolMarshaller) { if (describeComplianceByConfigRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getConfigRuleNames(), CONFIGRULENAMES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getComplianceTypes(), COMPLIANCETYPES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeComplianceByConfigRuleRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void showOptions() { showOptionsHeader(); for (Option option : options) { System.out.println(option.getInformation()); } } }
public class class_name { public void showOptions() { showOptionsHeader(); for (Option option : options) { System.out.println(option.getInformation()); // depends on control dependency: [for], data = [option] } } }
public class class_name { protected void onDDPConnect(DDPStateSingleton ddp) { if (!ddp.isLoggedIn()) { // override this to handle first time connection (usually to subscribe) // if we have a login resume token, use it String resumeToken = ddp.getResumeToken(); if (resumeToken != null) { ddp.login(resumeToken); } } } }
public class class_name { protected void onDDPConnect(DDPStateSingleton ddp) { if (!ddp.isLoggedIn()) { // override this to handle first time connection (usually to subscribe) // if we have a login resume token, use it String resumeToken = ddp.getResumeToken(); if (resumeToken != null) { ddp.login(resumeToken); // depends on control dependency: [if], data = [(resumeToken] } } } }
public class class_name { public void findRouteWith(NavigationRoute.Builder builder) { if (builder != null) { navigationRoute = builder.build(); navigationRoute.getRoute(directionsResponseCallback); } } }
public class class_name { public void findRouteWith(NavigationRoute.Builder builder) { if (builder != null) { navigationRoute = builder.build(); // depends on control dependency: [if], data = [none] navigationRoute.getRoute(directionsResponseCallback); // depends on control dependency: [if], data = [none] } } }
public class class_name { public SingleFieldConstraint getLHSBoundField(final String var) { if (this.lhs == null) { return null; } for (int i = 0; i < this.lhs.length; i++) { IPattern pat = this.lhs[i]; SingleFieldConstraint fieldConstraint = getLHSBoundField(pat, var); if (fieldConstraint != null) { return fieldConstraint; } } return null; } }
public class class_name { public SingleFieldConstraint getLHSBoundField(final String var) { if (this.lhs == null) { return null; // depends on control dependency: [if], data = [none] } for (int i = 0; i < this.lhs.length; i++) { IPattern pat = this.lhs[i]; SingleFieldConstraint fieldConstraint = getLHSBoundField(pat, var); if (fieldConstraint != null) { return fieldConstraint; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected Response ok(List<Object> entityList) { for (int i = 0; i < entityList.size(); i++) { entityList.set(i, mapResponseEntity(entityList.get(i))); } return buildResponse(Response.ok(entityList)); } }
public class class_name { protected Response ok(List<Object> entityList) { for (int i = 0; i < entityList.size(); i++) { entityList.set(i, mapResponseEntity(entityList.get(i))); // depends on control dependency: [for], data = [i] } return buildResponse(Response.ok(entityList)); } }
public class class_name { @Override public void persistJoinTable(JoinTableData joinTableData) { String joinTableName = joinTableData.getJoinTableName(); String joinColumnName = joinTableData.getJoinColumnName(); String invJoinColumnName = joinTableData.getInverseJoinColumnName(); Map<Key, List<TableOperation>> operations = new HashMap<Key, List<TableOperation>>(); Table schemaTable = tableAPI.getTable(joinTableName); Row row = schemaTable.createRow(); // String primaryKey = joinColumnName + SEPERATOR + invJoinColumnName; KunderaCoreUtils.printQuery("Persist Join Table:" + joinTableName, showQuery); Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords(); try { for (Object pk : joinTableRecords.keySet()) { // here pk is join column name and it's values would become // inverse join columns NoSqlDBUtils.add(schemaTable.getField(joinColumnName), row, pk, joinColumnName); Set<Object> values = joinTableRecords.get(pk); for (Object childId : values) { // what if join or inverse join column is null? Not handling // as ideally it should be handled in core itself! NoSqlDBUtils.add(schemaTable.getField(invJoinColumnName), row, childId, invJoinColumnName); NoSqlDBUtils.add(schemaTable.getField(JOIN_TABLE_PRIMARY_KEY_NAME), row, pk.toString() + SEPERATOR + childId.toString(), JOIN_TABLE_PRIMARY_KEY_NAME); addOps(operations, schemaTable, row); } } execute(operations); } finally { operations.clear(); operations = null; } } }
public class class_name { @Override public void persistJoinTable(JoinTableData joinTableData) { String joinTableName = joinTableData.getJoinTableName(); String joinColumnName = joinTableData.getJoinColumnName(); String invJoinColumnName = joinTableData.getInverseJoinColumnName(); Map<Key, List<TableOperation>> operations = new HashMap<Key, List<TableOperation>>(); Table schemaTable = tableAPI.getTable(joinTableName); Row row = schemaTable.createRow(); // String primaryKey = joinColumnName + SEPERATOR + invJoinColumnName; KunderaCoreUtils.printQuery("Persist Join Table:" + joinTableName, showQuery); Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords(); try { for (Object pk : joinTableRecords.keySet()) { // here pk is join column name and it's values would become // inverse join columns NoSqlDBUtils.add(schemaTable.getField(joinColumnName), row, pk, joinColumnName); // depends on control dependency: [for], data = [pk] Set<Object> values = joinTableRecords.get(pk); for (Object childId : values) { // what if join or inverse join column is null? Not handling // as ideally it should be handled in core itself! NoSqlDBUtils.add(schemaTable.getField(invJoinColumnName), row, childId, invJoinColumnName); // depends on control dependency: [for], data = [childId] NoSqlDBUtils.add(schemaTable.getField(JOIN_TABLE_PRIMARY_KEY_NAME), row, pk.toString() + SEPERATOR + childId.toString(), JOIN_TABLE_PRIMARY_KEY_NAME); // depends on control dependency: [for], data = [none] addOps(operations, schemaTable, row); // depends on control dependency: [for], data = [none] } } execute(operations); // depends on control dependency: [try], data = [none] } finally { operations.clear(); operations = null; } } }
public class class_name { public static Options getOptions() { final Options options = new Options(); options.addOption(CLI_OPTION_CLASSPATH_SHORT, CLI_OPTION_CLASSPATH_LONG, true, Messages.Boot_24); options.addOption(CLI_OPTION_EMBEDDED_SHORT, CLI_OPTION_EMBEDDED_LONG, false, Messages.Boot_5); options.addOption(CLI_OPTION_BOOTID_SHORT, CLI_OPTION_BOOTID_LONG, false, MessageFormat.format(Messages.Boot_6, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); options.addOption(CLI_OPTION_FILE_SHORT, CLI_OPTION_FILE_LONG, true, Messages.Boot_7); options.addOption(CLI_OPTION_HELP_SHORT, CLI_OPTION_HELP_LONG, false, Messages.Boot_8); options.addOption(null, CLI_OPTION_NOLOGO_LONG, false, Messages.Boot_9); options.addOption(CLI_OPTION_OFFLINE_SHORT, CLI_OPTION_OFFLINE_LONG, false, MessageFormat.format(Messages.Boot_10, JanusConfig.OFFLINE)); options.addOption(CLI_OPTION_QUIET_SHORT, CLI_OPTION_QUIET_LONG, false, Messages.Boot_11); options.addOption(CLI_OPTION_RANDOMID_SHORT, CLI_OPTION_RANDOMID_LONG, false, MessageFormat.format(Messages.Boot_12, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); options.addOption(CLI_OPTION_SHOWDEFAULTS_SHORT, CLI_OPTION_SHOWDEFAULTS_LONG, false, Messages.Boot_13); options.addOption(CLI_OPTION_SHOWCLASSPATH, false, Messages.Boot_23); options.addOption(null, CLI_OPTION_SHOWCLIARGUMENTS_LONG, false, Messages.Boot_14); options.addOption(CLI_OPTION_VERBOSE_SHORT, CLI_OPTION_VERBOSE_LONG, false, Messages.Boot_15); options.addOption(CLI_OPTION_VERSION, false, Messages.Boot_25); options.addOption(CLI_OPTION_WORLDID_SHORT, CLI_OPTION_WORLDID_LONG, false, MessageFormat.format(Messages.Boot_16, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); final StringBuilder b = new StringBuilder(); int level = 0; for (final String logLevel : LoggerCreator.getLevelStrings()) { if (b.length() > 0) { b.append(", "); //$NON-NLS-1$ } b.append(logLevel); b.append(" ("); //$NON-NLS-1$ b.append(level); b.append(")"); //$NON-NLS-1$ ++level; } Option opt = new Option(CLI_OPTION_LOG_SHORT, CLI_OPTION_LOG_LONG, true, MessageFormat.format(Messages.Boot_17, JanusConfig.VERBOSE_LEVEL_VALUE, b)); opt.setArgs(1); options.addOption(opt); opt = new Option(CLI_OPTION_DEFINE_SHORT, CLI_OPTION_DEFINE_LONG, true, Messages.Boot_18); opt.setArgs(2); opt.setValueSeparator('='); opt.setArgName(Messages.Boot_19); options.addOption(opt); return options; } }
public class class_name { public static Options getOptions() { final Options options = new Options(); options.addOption(CLI_OPTION_CLASSPATH_SHORT, CLI_OPTION_CLASSPATH_LONG, true, Messages.Boot_24); options.addOption(CLI_OPTION_EMBEDDED_SHORT, CLI_OPTION_EMBEDDED_LONG, false, Messages.Boot_5); options.addOption(CLI_OPTION_BOOTID_SHORT, CLI_OPTION_BOOTID_LONG, false, MessageFormat.format(Messages.Boot_6, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); options.addOption(CLI_OPTION_FILE_SHORT, CLI_OPTION_FILE_LONG, true, Messages.Boot_7); options.addOption(CLI_OPTION_HELP_SHORT, CLI_OPTION_HELP_LONG, false, Messages.Boot_8); options.addOption(null, CLI_OPTION_NOLOGO_LONG, false, Messages.Boot_9); options.addOption(CLI_OPTION_OFFLINE_SHORT, CLI_OPTION_OFFLINE_LONG, false, MessageFormat.format(Messages.Boot_10, JanusConfig.OFFLINE)); options.addOption(CLI_OPTION_QUIET_SHORT, CLI_OPTION_QUIET_LONG, false, Messages.Boot_11); options.addOption(CLI_OPTION_RANDOMID_SHORT, CLI_OPTION_RANDOMID_LONG, false, MessageFormat.format(Messages.Boot_12, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); options.addOption(CLI_OPTION_SHOWDEFAULTS_SHORT, CLI_OPTION_SHOWDEFAULTS_LONG, false, Messages.Boot_13); options.addOption(CLI_OPTION_SHOWCLASSPATH, false, Messages.Boot_23); options.addOption(null, CLI_OPTION_SHOWCLIARGUMENTS_LONG, false, Messages.Boot_14); options.addOption(CLI_OPTION_VERBOSE_SHORT, CLI_OPTION_VERBOSE_LONG, false, Messages.Boot_15); options.addOption(CLI_OPTION_VERSION, false, Messages.Boot_25); options.addOption(CLI_OPTION_WORLDID_SHORT, CLI_OPTION_WORLDID_LONG, false, MessageFormat.format(Messages.Boot_16, JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME)); final StringBuilder b = new StringBuilder(); int level = 0; for (final String logLevel : LoggerCreator.getLevelStrings()) { if (b.length() > 0) { b.append(", "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } b.append(logLevel); // depends on control dependency: [for], data = [logLevel] b.append(" ("); //$NON-NLS-1$ // depends on control dependency: [for], data = [none] b.append(level); // depends on control dependency: [for], data = [none] b.append(")"); //$NON-NLS-1$ // depends on control dependency: [for], data = [none] ++level; // depends on control dependency: [for], data = [none] } Option opt = new Option(CLI_OPTION_LOG_SHORT, CLI_OPTION_LOG_LONG, true, MessageFormat.format(Messages.Boot_17, JanusConfig.VERBOSE_LEVEL_VALUE, b)); opt.setArgs(1); options.addOption(opt); opt = new Option(CLI_OPTION_DEFINE_SHORT, CLI_OPTION_DEFINE_LONG, true, Messages.Boot_18); opt.setArgs(2); opt.setValueSeparator('='); opt.setArgName(Messages.Boot_19); options.addOption(opt); return options; } }
public class class_name { public void setRootNode(TreeElement rootNode) { _rootNode = rootNode; if (rootNode.getName() == null) { rootNode.setName("0"); } } }
public class class_name { public void setRootNode(TreeElement rootNode) { _rootNode = rootNode; if (rootNode.getName() == null) { rootNode.setName("0"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean simpleMatch(Collection<String> patterns, String str) { if (patterns != null) { for (String pattern : patterns) { if (simpleMatch(pattern, str)) { return true; } } } return false; } }
public class class_name { public static boolean simpleMatch(Collection<String> patterns, String str) { if (patterns != null) { for (String pattern : patterns) { if (simpleMatch(pattern, str)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public ClusterParameterGroupStatus withClusterParameterStatusList(ClusterParameterStatus... clusterParameterStatusList) { if (this.clusterParameterStatusList == null) { setClusterParameterStatusList(new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>(clusterParameterStatusList.length)); } for (ClusterParameterStatus ele : clusterParameterStatusList) { this.clusterParameterStatusList.add(ele); } return this; } }
public class class_name { public ClusterParameterGroupStatus withClusterParameterStatusList(ClusterParameterStatus... clusterParameterStatusList) { if (this.clusterParameterStatusList == null) { setClusterParameterStatusList(new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>(clusterParameterStatusList.length)); // depends on control dependency: [if], data = [none] } for (ClusterParameterStatus ele : clusterParameterStatusList) { this.clusterParameterStatusList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private static StringBuilder displayServiceProperties(ServiceReference reference) { StringBuilder sb = new StringBuilder(); for (String propertyKey : reference.getPropertyKeys()) { sb.append(String.format("%s = %s%n", propertyKey, reference.getProperty(propertyKey))); } if (reference.getPropertyKeys().length == 0) { sb.append("EMPTY"); } return sb; } }
public class class_name { private static StringBuilder displayServiceProperties(ServiceReference reference) { StringBuilder sb = new StringBuilder(); for (String propertyKey : reference.getPropertyKeys()) { sb.append(String.format("%s = %s%n", propertyKey, reference.getProperty(propertyKey))); // depends on control dependency: [for], data = [propertyKey] } if (reference.getPropertyKeys().length == 0) { sb.append("EMPTY"); // depends on control dependency: [if], data = [none] } return sb; } }
public class class_name { @Override public List<Object> findByRelation(String colName, Object colValue, Class entityClazz) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz); String tableName = HBaseUtils.getHTableName(m.getSchema(), m.getTableName()); String columnFamilyName = m.getTableName(); byte[] valueInBytes = HBaseUtils.getBytes(colValue); SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(columnFamilyName), Bytes.toBytes(colName), CompareOp.EQUAL, valueInBytes); filter.setFilterIfMissing(true); try { return ((HBaseDataHandler) handler).readData(tableName, m, null, null, null, null, getFilterList(filter)); } catch (IOException ex) { log.error("Error during find By Relation, Caused by: .", ex); throw new KunderaException("Error during find By Relation, Caused by: .", ex); } } }
public class class_name { @Override public List<Object> findByRelation(String colName, Object colValue, Class entityClazz) { EntityMetadata m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz); String tableName = HBaseUtils.getHTableName(m.getSchema(), m.getTableName()); String columnFamilyName = m.getTableName(); byte[] valueInBytes = HBaseUtils.getBytes(colValue); SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes(columnFamilyName), Bytes.toBytes(colName), CompareOp.EQUAL, valueInBytes); filter.setFilterIfMissing(true); try { return ((HBaseDataHandler) handler).readData(tableName, m, null, null, null, null, getFilterList(filter)); // depends on control dependency: [try], data = [none] } catch (IOException ex) { log.error("Error during find By Relation, Caused by: .", ex); throw new KunderaException("Error during find By Relation, Caused by: .", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final DSLMapParser.value_chunk_return value_chunk() throws RecognitionException { DSLMapParser.value_chunk_return retval = new DSLMapParser.value_chunk_return(); retval.start = input.LT(1); Object root_0 = null; Token EQUALS21=null; Token COMMA22=null; Token DOT23=null; ParserRuleReturnScope literal20 =null; Object EQUALS21_tree=null; Object COMMA22_tree=null; Object DOT23_tree=null; try { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:5: ( ( literal | EQUALS | COMMA | DOT )+ ) // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+ { root_0 = (Object)adaptor.nil(); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+ int cnt13=0; loop13: while (true) { int alt13=5; switch ( input.LA(1) ) { case COLON: case LEFT_SQUARE: case LITERAL: case RIGHT_SQUARE: { int LA13_2 = input.LA(2); if ( (synpred15_DSLMap()) ) { alt13=1; } } break; case EQUALS: { int LA13_3 = input.LA(2); if ( (synpred16_DSLMap()) ) { alt13=2; } } break; case COMMA: { int LA13_4 = input.LA(2); if ( (synpred17_DSLMap()) ) { alt13=3; } } break; case DOT: { int LA13_5 = input.LA(2); if ( (synpred18_DSLMap()) ) { alt13=4; } } break; } switch (alt13) { case 1 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:8: literal { pushFollow(FOLLOW_literal_in_value_chunk742); literal20=literal(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, literal20.getTree()); } break; case 2 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:16: EQUALS { EQUALS21=(Token)match(input,EQUALS,FOLLOW_EQUALS_in_value_chunk744); if (state.failed) return retval; if ( state.backtracking==0 ) { EQUALS21_tree = (Object)adaptor.create(EQUALS21); adaptor.addChild(root_0, EQUALS21_tree); } } break; case 3 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:23: COMMA { COMMA22=(Token)match(input,COMMA,FOLLOW_COMMA_in_value_chunk746); if (state.failed) return retval; if ( state.backtracking==0 ) { COMMA22_tree = (Object)adaptor.create(COMMA22); adaptor.addChild(root_0, COMMA22_tree); } } break; case 4 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:29: DOT { DOT23=(Token)match(input,DOT,FOLLOW_DOT_in_value_chunk748); if (state.failed) return retval; if ( state.backtracking==0 ) { DOT23_tree = (Object)adaptor.create(DOT23); adaptor.addChild(root_0, DOT23_tree); } } break; default : if ( cnt13 >= 1 ) break loop13; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(13, input); throw eee; } cnt13++; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public final DSLMapParser.value_chunk_return value_chunk() throws RecognitionException { DSLMapParser.value_chunk_return retval = new DSLMapParser.value_chunk_return(); retval.start = input.LT(1); Object root_0 = null; Token EQUALS21=null; Token COMMA22=null; Token DOT23=null; ParserRuleReturnScope literal20 =null; Object EQUALS21_tree=null; Object COMMA22_tree=null; Object DOT23_tree=null; try { // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:5: ( ( literal | EQUALS | COMMA | DOT )+ ) // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+ { root_0 = (Object)adaptor.nil(); // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+ int cnt13=0; loop13: while (true) { int alt13=5; switch ( input.LA(1) ) { case COLON: case LEFT_SQUARE: case LITERAL: case RIGHT_SQUARE: { int LA13_2 = input.LA(2); if ( (synpred15_DSLMap()) ) { alt13=1; // depends on control dependency: [if], data = [none] } } break; case EQUALS: { int LA13_3 = input.LA(2); if ( (synpred16_DSLMap()) ) { alt13=2; // depends on control dependency: [if], data = [none] } } break; case COMMA: { int LA13_4 = input.LA(2); if ( (synpred17_DSLMap()) ) { alt13=3; // depends on control dependency: [if], data = [none] } } break; case DOT: { int LA13_5 = input.LA(2); if ( (synpred18_DSLMap()) ) { alt13=4; // depends on control dependency: [if], data = [none] } } break; } switch (alt13) { case 1 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:8: literal { pushFollow(FOLLOW_literal_in_value_chunk742); literal20=literal(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) adaptor.addChild(root_0, literal20.getTree()); } break; case 2 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:16: EQUALS { EQUALS21=(Token)match(input,EQUALS,FOLLOW_EQUALS_in_value_chunk744); if (state.failed) return retval; if ( state.backtracking==0 ) { EQUALS21_tree = (Object)adaptor.create(EQUALS21); adaptor.addChild(root_0, EQUALS21_tree); } } break; case 3 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:23: COMMA { COMMA22=(Token)match(input,COMMA,FOLLOW_COMMA_in_value_chunk746); if (state.failed) return retval; if ( state.backtracking==0 ) { COMMA22_tree = (Object)adaptor.create(COMMA22); adaptor.addChild(root_0, COMMA22_tree); } } break; case 4 : // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:29: DOT { DOT23=(Token)match(input,DOT,FOLLOW_DOT_in_value_chunk748); if (state.failed) return retval; if ( state.backtracking==0 ) { DOT23_tree = (Object)adaptor.create(DOT23); adaptor.addChild(root_0, DOT23_tree); } } break; default : if ( cnt13 >= 1 ) break loop13; if (state.backtracking>0) {state.failed=true; return retval;} EarlyExitException eee = new EarlyExitException(13, input); throw eee; } cnt13++; } } retval.stop = input.LT(-1); if ( state.backtracking==0 ) { retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public String format(INDArray arr, boolean summarize) { if(arr.isEmpty()) return EMPTY_ARRAY_STR; this.scientificFormat = "0."; int addPrecision = this.precision; while (addPrecision > 0) { this.scientificFormat += "#"; addPrecision -= 1; } this.scientificFormat = this.scientificFormat + "E0"; if (this.scientificFormat.length() + 2 > this.padding) this.padding = this.scientificFormat.length() + 2; this.maxToPrintWithoutSwitching = Math.pow(10,this.precision); this.minToPrintWithoutSwitching = 1.0/(this.maxToPrintWithoutSwitching); return format(arr, 0, summarize && arr.length() > maxPrintElements); } }
public class class_name { public String format(INDArray arr, boolean summarize) { if(arr.isEmpty()) return EMPTY_ARRAY_STR; this.scientificFormat = "0."; int addPrecision = this.precision; while (addPrecision > 0) { this.scientificFormat += "#"; addPrecision -= 1; // depends on control dependency: [while], data = [none] } this.scientificFormat = this.scientificFormat + "E0"; if (this.scientificFormat.length() + 2 > this.padding) this.padding = this.scientificFormat.length() + 2; this.maxToPrintWithoutSwitching = Math.pow(10,this.precision); this.minToPrintWithoutSwitching = 1.0/(this.maxToPrintWithoutSwitching); return format(arr, 0, summarize && arr.length() > maxPrintElements); } }
public class class_name { private void addRelevantProjectDependenciesToClasspath( List<Path> path ) throws MojoExecutionException { if ( this.includeProjectDependencies ) { getLog().debug( "Project Dependencies will be included." ); List<Artifact> artifacts = new ArrayList<>(); List<Path> theClasspathFiles = new ArrayList<>(); collectProjectArtifactsAndClasspath( artifacts, theClasspathFiles ); for ( Path classpathFile : theClasspathFiles ) { getLog().debug( "Adding to classpath : " + classpathFile ); path.add( classpathFile ); } for ( Artifact classPathElement : artifacts ) { getLog().debug( "Adding project dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); path.add( classPathElement.getFile().toPath() ); } } else { getLog().debug( "Project Dependencies will be excluded." ); } } }
public class class_name { private void addRelevantProjectDependenciesToClasspath( List<Path> path ) throws MojoExecutionException { if ( this.includeProjectDependencies ) { getLog().debug( "Project Dependencies will be included." ); List<Artifact> artifacts = new ArrayList<>(); List<Path> theClasspathFiles = new ArrayList<>(); collectProjectArtifactsAndClasspath( artifacts, theClasspathFiles ); for ( Path classpathFile : theClasspathFiles ) { getLog().debug( "Adding to classpath : " + classpathFile ); // depends on control dependency: [for], data = [classpathFile] path.add( classpathFile ); // depends on control dependency: [for], data = [classpathFile] } for ( Artifact classPathElement : artifacts ) { getLog().debug( "Adding project dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); // depends on control dependency: [for], data = [none] path.add( classPathElement.getFile().toPath() ); // depends on control dependency: [for], data = [classPathElement] } } else { getLog().debug( "Project Dependencies will be excluded." ); } } }
public class class_name { @Override protected void configure(ValueParser values) { String altkey = values.getString("key"); if (altkey != null) { setKey(altkey); } // allow changing skin key in the configuration String altSkinKey = values.getString("skinKey"); if (altSkinKey != null) { this.skinKey = altSkinKey; } // retrieve the decoration model from Velocity context Object velocityContext = values.get("velocityContext"); if (!(velocityContext instanceof ToolContext)) { return; } ToolContext ctxt = (ToolContext)velocityContext; Object projectObj = ctxt.get("project"); if (projectObj instanceof MavenProject) { MavenProject project = (MavenProject)projectObj; String artifactId = project.getArtifactId(); // use artifactId "sluggified" as the projectId projectId = HtmlTool.slug(artifactId); } // calculate the page ID from the current file name Object currentFileObj = ctxt.get("currentFileName"); if (currentFileObj instanceof String) { String currentFile = (String)currentFileObj; // drop the extension int lastDot = currentFile.lastIndexOf("."); if (lastDot >= 0) { currentFile = currentFile.substring(0, lastDot); } // full file ID includes the nested dirs // replace nesting "/" with "-" fileId = HtmlTool.slug(currentFile.replace("/", "-").replace("\\", "-")); } Object decorationObj = ctxt.get("decoration"); if (!(decorationObj instanceof DecorationModel)) { return; } DecorationModel decoration = (DecorationModel)decorationObj; Object customObj = decoration.getCustom(); if (!(customObj instanceof Xpp3Dom)) { return; } // Now that we have the custom node, get the global properties // under the skin tag Xpp3Dom customNode = (Xpp3Dom)customObj; Xpp3Dom skinNode = customNode.getChild(skinKey); String namespaceKey = ":" + skinKey; if (skinNode == null) { // try searching with any namespace for (Xpp3Dom child : customNode.getChildren()) { if (child.getName().endsWith(namespaceKey)) { skinNode = child; break; } } } if (skinNode != null) { globalProperties = skinNode; if (skinNode.getName().endsWith(namespaceKey)) { // extract the namespace (including the colon) namespace = skinNode.getName().substring(0, skinNode.getName().length() - namespaceKey.length() + 1); } // for page properties, retrieve the file name and drop the `.html` // extension - this will be used, i.e. `index` instead of `index.html` Xpp3Dom pagesNode = getChild(skinNode, "pages"); if (pagesNode != null) { // Get the page for the file // TODO try fileShortId as well? Xpp3Dom page = getChild(pagesNode, fileId); // Now check if the project artifact ID is set, and if so, if it matches the // current project. This allows preventing accidental reuse of parent page // configs in children modules if (page != null && projectId != null) { String pageProject = page.getAttribute("project"); if (pageProject != null && !projectId.equals(pageProject)) { // project ID indicated, and is different - do not use the config page = null; } } if (page != null) { pageProperties = page; } } } } }
public class class_name { @Override protected void configure(ValueParser values) { String altkey = values.getString("key"); if (altkey != null) { setKey(altkey); // depends on control dependency: [if], data = [(altkey] } // allow changing skin key in the configuration String altSkinKey = values.getString("skinKey"); if (altSkinKey != null) { this.skinKey = altSkinKey; // depends on control dependency: [if], data = [none] } // retrieve the decoration model from Velocity context Object velocityContext = values.get("velocityContext"); if (!(velocityContext instanceof ToolContext)) { return; // depends on control dependency: [if], data = [none] } ToolContext ctxt = (ToolContext)velocityContext; Object projectObj = ctxt.get("project"); if (projectObj instanceof MavenProject) { MavenProject project = (MavenProject)projectObj; String artifactId = project.getArtifactId(); // use artifactId "sluggified" as the projectId projectId = HtmlTool.slug(artifactId); // depends on control dependency: [if], data = [none] } // calculate the page ID from the current file name Object currentFileObj = ctxt.get("currentFileName"); if (currentFileObj instanceof String) { String currentFile = (String)currentFileObj; // drop the extension int lastDot = currentFile.lastIndexOf("."); if (lastDot >= 0) { currentFile = currentFile.substring(0, lastDot); // depends on control dependency: [if], data = [none] } // full file ID includes the nested dirs // replace nesting "/" with "-" fileId = HtmlTool.slug(currentFile.replace("/", "-").replace("\\", "-")); // depends on control dependency: [if], data = [none] } Object decorationObj = ctxt.get("decoration"); if (!(decorationObj instanceof DecorationModel)) { return; // depends on control dependency: [if], data = [none] } DecorationModel decoration = (DecorationModel)decorationObj; Object customObj = decoration.getCustom(); if (!(customObj instanceof Xpp3Dom)) { return; // depends on control dependency: [if], data = [none] } // Now that we have the custom node, get the global properties // under the skin tag Xpp3Dom customNode = (Xpp3Dom)customObj; Xpp3Dom skinNode = customNode.getChild(skinKey); String namespaceKey = ":" + skinKey; if (skinNode == null) { // try searching with any namespace for (Xpp3Dom child : customNode.getChildren()) { if (child.getName().endsWith(namespaceKey)) { skinNode = child; // depends on control dependency: [if], data = [none] break; } } } if (skinNode != null) { globalProperties = skinNode; // depends on control dependency: [if], data = [none] if (skinNode.getName().endsWith(namespaceKey)) { // extract the namespace (including the colon) namespace = skinNode.getName().substring(0, skinNode.getName().length() - namespaceKey.length() + 1); // depends on control dependency: [if], data = [none] } // for page properties, retrieve the file name and drop the `.html` // extension - this will be used, i.e. `index` instead of `index.html` Xpp3Dom pagesNode = getChild(skinNode, "pages"); if (pagesNode != null) { // Get the page for the file // TODO try fileShortId as well? Xpp3Dom page = getChild(pagesNode, fileId); // Now check if the project artifact ID is set, and if so, if it matches the // current project. This allows preventing accidental reuse of parent page // configs in children modules if (page != null && projectId != null) { String pageProject = page.getAttribute("project"); if (pageProject != null && !projectId.equals(pageProject)) { // project ID indicated, and is different - do not use the config page = null; // depends on control dependency: [if], data = [none] } } if (page != null) { pageProperties = page; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { static int adjustEnd(String msg, int start, int originEnd) { if (originEnd == msg.length()) { // Already end of message. return originEnd; } if (msg.charAt(originEnd) == '\n') { // Already prior to '\n'. return originEnd; } // Search back for '\n'. int last = originEnd - 1; while (start < last) { if (msg.charAt(last) == '\n') { return last + 1; } last--; } return originEnd; } }
public class class_name { static int adjustEnd(String msg, int start, int originEnd) { if (originEnd == msg.length()) { // Already end of message. return originEnd; // depends on control dependency: [if], data = [none] } if (msg.charAt(originEnd) == '\n') { // Already prior to '\n'. return originEnd; // depends on control dependency: [if], data = [none] } // Search back for '\n'. int last = originEnd - 1; while (start < last) { if (msg.charAt(last) == '\n') { return last + 1; // depends on control dependency: [if], data = [none] } last--; // depends on control dependency: [while], data = [none] } return originEnd; } }
public class class_name { public void copyProviderDataToBuilder(TemplateBuilder builder, TemplateBuilderDataProvider templateBuilderDataProvider) { PageSize size = templateBuilderDataProvider.getPageSize(); if (templateBuilderDataProvider.isLandscape()) { builder.setPageHeight(size.getWidth()); builder.setPageWidth(size.getHeight()); } else { builder.setPageHeight(size.getHeight()); builder.setPageWidth(size.getWidth()); } builder.setTitleText(templateBuilderDataProvider.getTitle()); builder.setWithArrow(templateBuilderDataProvider.isWithArrow()); builder.setWithScaleBar(templateBuilderDataProvider.isWithScaleBar()); builder.setRasterDpi(templateBuilderDataProvider.getRasterDpi()); builder.setDpi(templateBuilderDataProvider.getDpi()); } }
public class class_name { public void copyProviderDataToBuilder(TemplateBuilder builder, TemplateBuilderDataProvider templateBuilderDataProvider) { PageSize size = templateBuilderDataProvider.getPageSize(); if (templateBuilderDataProvider.isLandscape()) { builder.setPageHeight(size.getWidth()); // depends on control dependency: [if], data = [none] builder.setPageWidth(size.getHeight()); // depends on control dependency: [if], data = [none] } else { builder.setPageHeight(size.getHeight()); // depends on control dependency: [if], data = [none] builder.setPageWidth(size.getWidth()); // depends on control dependency: [if], data = [none] } builder.setTitleText(templateBuilderDataProvider.getTitle()); builder.setWithArrow(templateBuilderDataProvider.isWithArrow()); builder.setWithScaleBar(templateBuilderDataProvider.isWithScaleBar()); builder.setRasterDpi(templateBuilderDataProvider.getRasterDpi()); builder.setDpi(templateBuilderDataProvider.getDpi()); } }
public class class_name { public static Config getFixedConfig(@Nullable final AbstractConfiguration ... configs) { final CombinedConfiguration cc = new CombinedConfiguration(new OverrideCombiner()); if (configs != null) { for (final AbstractConfiguration config : configs) { cc.addConfiguration(config); } } return new Config(cc); } }
public class class_name { public static Config getFixedConfig(@Nullable final AbstractConfiguration ... configs) { final CombinedConfiguration cc = new CombinedConfiguration(new OverrideCombiner()); if (configs != null) { for (final AbstractConfiguration config : configs) { cc.addConfiguration(config); // depends on control dependency: [for], data = [config] } } return new Config(cc); } }
public class class_name { private boolean checkBuffer(long offset) throws IOException { if (offset - bufferOffset < 0 || offset - bufferOffset >= currentBufferSize) { // the given offset is not contained in the buffer bufferOffset = offset; int index = 0; input.seek(offset); try { //input.read(buffer, 0, maxBufferSize); for (long pos = offset; pos < offset + maxBufferSize; pos++) { int ch = input.read(); if (ch > -1) { buffer[index] = (byte)ch; index++; } } } catch (IOException ex) { // not possible ex.printStackTrace(); } currentBufferSize = index; return true; } return false; } }
public class class_name { private boolean checkBuffer(long offset) throws IOException { if (offset - bufferOffset < 0 || offset - bufferOffset >= currentBufferSize) { // the given offset is not contained in the buffer bufferOffset = offset; int index = 0; input.seek(offset); try { //input.read(buffer, 0, maxBufferSize); for (long pos = offset; pos < offset + maxBufferSize; pos++) { int ch = input.read(); if (ch > -1) { buffer[index] = (byte)ch; // depends on control dependency: [if], data = [none] index++; // depends on control dependency: [if], data = [none] } } } catch (IOException ex) { // not possible ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] currentBufferSize = index; return true; } return false; } }
public class class_name { public static CmsResource getResourceWithHistory(CmsObject cms, String resourceUri) throws CmsException { CmsResource resource = null; if (resourceUri.contains(CmsRequestUtil.URL_DELIMITER)) { int pos = resourceUri.indexOf(CmsRequestUtil.URL_DELIMITER); Map<String, String[]> params = CmsRequestUtil.createParameterMap(resourceUri.substring(pos)); if (params.containsKey(CmsHistoryResourceHandler.PARAM_VERSION)) { int version = Integer.parseInt(params.get(CmsHistoryResourceHandler.PARAM_VERSION)[0]); String sitemapPath = resourceUri.substring(0, pos); resource = cms.readResource(sitemapPath); resource = (CmsResource)cms.readResource(resource.getStructureId(), version); } } if (resource == null) { resource = cms.readResource(resourceUri); } return resource; } }
public class class_name { public static CmsResource getResourceWithHistory(CmsObject cms, String resourceUri) throws CmsException { CmsResource resource = null; if (resourceUri.contains(CmsRequestUtil.URL_DELIMITER)) { int pos = resourceUri.indexOf(CmsRequestUtil.URL_DELIMITER); Map<String, String[]> params = CmsRequestUtil.createParameterMap(resourceUri.substring(pos)); if (params.containsKey(CmsHistoryResourceHandler.PARAM_VERSION)) { int version = Integer.parseInt(params.get(CmsHistoryResourceHandler.PARAM_VERSION)[0]); String sitemapPath = resourceUri.substring(0, pos); resource = cms.readResource(sitemapPath); // depends on control dependency: [if], data = [none] resource = (CmsResource)cms.readResource(resource.getStructureId(), version); // depends on control dependency: [if], data = [none] } } if (resource == null) { resource = cms.readResource(resourceUri); } return resource; } }
public class class_name { protected boolean narrowArguments(Object[] args) { boolean narrowed = false; for (int a = 0; a < args.length; ++a) { Object arg = args[a]; if (arg instanceof Number) { Object narg = narrow((Number) arg); if (narg != arg) { narrowed = true; } args[a] = narg; } } return narrowed; } }
public class class_name { protected boolean narrowArguments(Object[] args) { boolean narrowed = false; for (int a = 0; a < args.length; ++a) { Object arg = args[a]; if (arg instanceof Number) { Object narg = narrow((Number) arg); if (narg != arg) { narrowed = true; // depends on control dependency: [if], data = [none] } args[a] = narg; // depends on control dependency: [if], data = [none] } } return narrowed; } }
public class class_name { public Shape[] union(Shape target, Shape other) { target = target.transform(new Transform()); other = other.transform(new Transform()); if (!target.intersects(other)) { return new Shape[] {target, other}; } // handle the case where intersects is true but really we're talking // about edge points boolean touches = false; int buttCount = 0; for (int i=0;i<target.getPointCount();i++) { if (other.contains(target.getPoint(i)[0], target.getPoint(i)[1])) { if (!other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { touches = true; break; } } if (other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { buttCount++; } } for (int i=0;i<other.getPointCount();i++) { if (target.contains(other.getPoint(i)[0], other.getPoint(i)[1])) { if (!target.hasVertex(other.getPoint(i)[0], other.getPoint(i)[1])) { touches = true; break; } } } if ((!touches) && (buttCount < 2)) { return new Shape[] {target, other}; } // so they are definitely touching, consider the union return combine(target, other, false); } }
public class class_name { public Shape[] union(Shape target, Shape other) { target = target.transform(new Transform()); other = other.transform(new Transform()); if (!target.intersects(other)) { return new Shape[] {target, other}; // depends on control dependency: [if], data = [none] } // handle the case where intersects is true but really we're talking // about edge points boolean touches = false; int buttCount = 0; for (int i=0;i<target.getPointCount();i++) { if (other.contains(target.getPoint(i)[0], target.getPoint(i)[1])) { if (!other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { touches = true; // depends on control dependency: [if], data = [none] break; } } if (other.hasVertex(target.getPoint(i)[0], target.getPoint(i)[1])) { buttCount++; // depends on control dependency: [if], data = [none] } } for (int i=0;i<other.getPointCount();i++) { if (target.contains(other.getPoint(i)[0], other.getPoint(i)[1])) { if (!target.hasVertex(other.getPoint(i)[0], other.getPoint(i)[1])) { touches = true; // depends on control dependency: [if], data = [none] break; } } } if ((!touches) && (buttCount < 2)) { return new Shape[] {target, other}; // depends on control dependency: [if], data = [none] } // so they are definitely touching, consider the union return combine(target, other, false); } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(boostExpr); sb.append(dm).append(createdBy); sb.append(dm).append(createdTime); sb.append(dm).append(sortOrder); sb.append(dm).append(updatedBy); sb.append(dm).append(updatedTime); sb.append(dm).append(urlExpr); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(boostExpr); sb.append(dm).append(createdBy); sb.append(dm).append(createdTime); sb.append(dm).append(sortOrder); sb.append(dm).append(updatedBy); sb.append(dm).append(updatedTime); sb.append(dm).append(urlExpr); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); // depends on control dependency: [if], data = [dm.length())] } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { public static Object toPrimitiveDoubleArray(List<?> values) { double[] array = new double[values.size()]; int cursor = 0; for(Object o : values) { array[cursor] = (Double) o; cursor ++; } return array; } }
public class class_name { public static Object toPrimitiveDoubleArray(List<?> values) { double[] array = new double[values.size()]; int cursor = 0; for(Object o : values) { array[cursor] = (Double) o; // depends on control dependency: [for], data = [o] cursor ++; // depends on control dependency: [for], data = [o] } return array; } }
public class class_name { public static YearWeek from(TemporalAccessor temporal) { if (temporal instanceof YearWeek) { return (YearWeek) temporal; } Objects.requireNonNull(temporal, "temporal"); try { if (!IsoChronology.INSTANCE.equals(Chronology.from(temporal))) { temporal = LocalDate.from(temporal); } // need to use getLong() as JDK Parsed class get() doesn't work properly int year = Math.toIntExact(temporal.getLong(WEEK_BASED_YEAR)); int week = Math.toIntExact(temporal.getLong(WEEK_OF_WEEK_BASED_YEAR)); return of(year, week); } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain YearWeek from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName(), ex); } } }
public class class_name { public static YearWeek from(TemporalAccessor temporal) { if (temporal instanceof YearWeek) { return (YearWeek) temporal; // depends on control dependency: [if], data = [none] } Objects.requireNonNull(temporal, "temporal"); try { if (!IsoChronology.INSTANCE.equals(Chronology.from(temporal))) { temporal = LocalDate.from(temporal); // depends on control dependency: [if], data = [none] } // need to use getLong() as JDK Parsed class get() doesn't work properly int year = Math.toIntExact(temporal.getLong(WEEK_BASED_YEAR)); int week = Math.toIntExact(temporal.getLong(WEEK_OF_WEEK_BASED_YEAR)); return of(year, week); // depends on control dependency: [try], data = [none] } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain YearWeek from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName(), ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static WriteableSymbolTable symbolTableEffectiveCopy(SymbolTable syms) { if (syms instanceof ImmutableSymbolTable) { return new UnionSymbolTable(syms); } if (syms instanceof UnionSymbolTable) { return UnionSymbolTable.copyFrom((UnionSymbolTable) syms); } if (syms instanceof FrozenSymbolTable) { return (FrozenSymbolTable) syms; } // maybe consider the size and if its "big" return a union of the mutable version? return new MutableSymbolTable(syms); } }
public class class_name { public static WriteableSymbolTable symbolTableEffectiveCopy(SymbolTable syms) { if (syms instanceof ImmutableSymbolTable) { return new UnionSymbolTable(syms); // depends on control dependency: [if], data = [none] } if (syms instanceof UnionSymbolTable) { return UnionSymbolTable.copyFrom((UnionSymbolTable) syms); // depends on control dependency: [if], data = [none] } if (syms instanceof FrozenSymbolTable) { return (FrozenSymbolTable) syms; // depends on control dependency: [if], data = [none] } // maybe consider the size and if its "big" return a union of the mutable version? return new MutableSymbolTable(syms); } }
public class class_name { @Override public boolean onEvent(EventMessage<?> event) { AuthorizationResultEvent resultEvent; if (event.getPayload() instanceof AuthorizationResultEvent) { resultEvent = (AuthorizationResultEvent) event.getPayload(); this.setResult(new AuthorizationResult(resultEvent.getIdentifyingToken().getToken(), resultEvent.getAuthenticationStatus())); this.countDownLatch(); if (continuation != null) { // no need to wait for the continuation timeout, resume it now continuation.resume(); } return true; } else { // not the right type of event... not 'handled' return false; } } }
public class class_name { @Override public boolean onEvent(EventMessage<?> event) { AuthorizationResultEvent resultEvent; if (event.getPayload() instanceof AuthorizationResultEvent) { resultEvent = (AuthorizationResultEvent) event.getPayload(); // depends on control dependency: [if], data = [none] this.setResult(new AuthorizationResult(resultEvent.getIdentifyingToken().getToken(), resultEvent.getAuthenticationStatus())); // depends on control dependency: [if], data = [none] this.countDownLatch(); // depends on control dependency: [if], data = [none] if (continuation != null) { // no need to wait for the continuation timeout, resume it now continuation.resume(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { // not the right type of event... not 'handled' return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public JSONObject getGroupUsers(String groupId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.GROUP_GETUSERS); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); } }
public class class_name { public JSONObject getGroupUsers(String groupId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); // depends on control dependency: [if], data = [(options] } request.setUri(FaceConsts.GROUP_GETUSERS); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); } }
public class class_name { public String validateEnumValue(char[] cbuf, int start, int end, boolean normalize, WordResolver res) { /* Better NOT to build temporary Strings quite yet; can resolve * matches via resolver more efficiently. */ // Note: at this point, should only have real spaces... if (normalize) { while (start < end && cbuf[start] <= CHAR_SPACE) { ++start; } while (--end > start && cbuf[end] <= CHAR_SPACE) { ; } ++end; // so it'll point to the first char (or beyond end of buffer) } // Empty String is never legal for enums: if (start >= end) { return null; } return res.find(cbuf, start, end); } }
public class class_name { public String validateEnumValue(char[] cbuf, int start, int end, boolean normalize, WordResolver res) { /* Better NOT to build temporary Strings quite yet; can resolve * matches via resolver more efficiently. */ // Note: at this point, should only have real spaces... if (normalize) { while (start < end && cbuf[start] <= CHAR_SPACE) { ++start; // depends on control dependency: [while], data = [none] } while (--end > start && cbuf[end] <= CHAR_SPACE) { ; } ++end; // so it'll point to the first char (or beyond end of buffer) // depends on control dependency: [if], data = [none] } // Empty String is never legal for enums: if (start >= end) { return null; // depends on control dependency: [if], data = [none] } return res.find(cbuf, start, end); } }
public class class_name { private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String comment = cfProperties.getProperty(CassandraConstants.COMMENT); if (comment != null) { if (builder != null) { String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT); builder.append(comment_Str); builder.append(CQLTranslator.EQ_CLAUSE); builder.append(CQLTranslator.QUOTE_STR); builder.append(comment); builder.append(CQLTranslator.QUOTE_STR); builder.append(CQLTranslator.AND_CLAUSE); } else { cfDef.setComment(comment); } } } }
public class class_name { private void onSetComment(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String comment = cfProperties.getProperty(CassandraConstants.COMMENT); if (comment != null) { if (builder != null) { String comment_Str = CQLTranslator.getKeyword(CassandraConstants.COMMENT); builder.append(comment_Str); // depends on control dependency: [if], data = [none] builder.append(CQLTranslator.EQ_CLAUSE); // depends on control dependency: [if], data = [none] builder.append(CQLTranslator.QUOTE_STR); // depends on control dependency: [if], data = [none] builder.append(comment); // depends on control dependency: [if], data = [none] builder.append(CQLTranslator.QUOTE_STR); // depends on control dependency: [if], data = [none] builder.append(CQLTranslator.AND_CLAUSE); // depends on control dependency: [if], data = [none] } else { cfDef.setComment(comment); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private String buildTemplates() { String[] templateString = new String[model.getTemplates().size()]; for (int i = 0; i < (model.getTemplates().size()); i++) { String templateLoaded = loadTemplateFile( model.getTemplates().get(i)); if (templateLoaded != null) { templateString[i] = templateLoaded; } } return implode(templateString, File.pathSeparator); } }
public class class_name { private String buildTemplates() { String[] templateString = new String[model.getTemplates().size()]; for (int i = 0; i < (model.getTemplates().size()); i++) { String templateLoaded = loadTemplateFile( model.getTemplates().get(i)); if (templateLoaded != null) { templateString[i] = templateLoaded; // depends on control dependency: [if], data = [none] } } return implode(templateString, File.pathSeparator); } }
public class class_name { private void captureUploadStateIfPossible() { if (origReq.getSSECustomerKey() == null) { persistableUpload = new PersistableUpload(origReq.getBucketName(), origReq.getKey(), origReq.getFile() .getAbsolutePath(), multipartUploadId, configuration.getMinimumUploadPartSize(), configuration.getMultipartUploadThreshold()); notifyPersistableTransferAvailability(); } } }
public class class_name { private void captureUploadStateIfPossible() { if (origReq.getSSECustomerKey() == null) { persistableUpload = new PersistableUpload(origReq.getBucketName(), origReq.getKey(), origReq.getFile() .getAbsolutePath(), multipartUploadId, configuration.getMinimumUploadPartSize(), configuration.getMultipartUploadThreshold()); // depends on control dependency: [if], data = [none] notifyPersistableTransferAvailability(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private List<Token> convertFactor(final Token.Factor factor) { final String item = factor.getValue(); final int itemLength = item.length(); final List<Token> list = new ArrayList<>(); int idx = 0; StringBuilder noTermChar = new StringBuilder(); // フォーマット以外の文字列を積む。 while(idx < itemLength) { String matchChars = null; for(String chars : SORTED_DATE_CHARS) { if(Utils.startsWithIgnoreCase(item, chars, idx)) { matchChars = item.substring(idx, idx + chars.length()); break; } } if(matchChars == null) { // フォーマットでない場合は、文字列としてバッファに追加する。 noTermChar.append(item.charAt(idx)); idx++; } else { if(noTermChar.length() > 0) { // 今まで積んだバッファを、文字列として分割する。 list.add(Token.factor(noTermChar.toString())); noTermChar = new StringBuilder(); } list.add(Token.formatter(matchChars)); idx += matchChars.length(); } } if(noTermChar.length() > 0) { list.add(Token.factor(noTermChar.toString())); } return list; } }
public class class_name { private List<Token> convertFactor(final Token.Factor factor) { final String item = factor.getValue(); final int itemLength = item.length(); final List<Token> list = new ArrayList<>(); int idx = 0; StringBuilder noTermChar = new StringBuilder(); // フォーマット以外の文字列を積む。 while(idx < itemLength) { String matchChars = null; for(String chars : SORTED_DATE_CHARS) { if(Utils.startsWithIgnoreCase(item, chars, idx)) { matchChars = item.substring(idx, idx + chars.length()); // depends on control dependency: [if], data = [none] break; } } if(matchChars == null) { // フォーマットでない場合は、文字列としてバッファに追加する。 noTermChar.append(item.charAt(idx)); // depends on control dependency: [if], data = [none] idx++; // depends on control dependency: [if], data = [none] } else { if(noTermChar.length() > 0) { // 今まで積んだバッファを、文字列として分割する。 list.add(Token.factor(noTermChar.toString())); // depends on control dependency: [if], data = [none] noTermChar = new StringBuilder(); // depends on control dependency: [if], data = [none] } list.add(Token.formatter(matchChars)); // depends on control dependency: [if], data = [(matchChars] idx += matchChars.length(); // depends on control dependency: [if], data = [none] } } if(noTermChar.length() > 0) { list.add(Token.factor(noTermChar.toString())); // depends on control dependency: [if], data = [none] } return list; } }
public class class_name { private boolean isScrollUpEvent(final float x, final float y, @NonNull final ViewGroup viewGroup) { int location[] = new int[2]; viewGroup.getLocationOnScreen(location); if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] && y <= location[1] + viewGroup.getHeight()) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (view.canScrollVertically(-1)) { return true; } else if (view instanceof ViewGroup) { return isScrollUpEvent(x, y, (ViewGroup) view); } } } return false; } }
public class class_name { private boolean isScrollUpEvent(final float x, final float y, @NonNull final ViewGroup viewGroup) { int location[] = new int[2]; viewGroup.getLocationOnScreen(location); if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] && y <= location[1] + viewGroup.getHeight()) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (view.canScrollVertically(-1)) { return true; // depends on control dependency: [if], data = [none] } else if (view instanceof ViewGroup) { return isScrollUpEvent(x, y, (ViewGroup) view); // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { protected void arrangeHookPreparedAccessContext(AccessContextArranger arranger, Object hook, Method hookMethod, Cron4jJob job) { final String moduleName = DfTypeUtil.toClassTitle(hook.getClass()); final AccessContext context = arranger.arrangePreparedAccessContext(new AccessContextResource(moduleName, hookMethod)); if (context == null) { String msg = "Cannot return null from access context arranger: " + arranger + " job=" + job.toIdentityDisp(); throw new IllegalStateException(msg); } PreparedAccessContext.setAccessContextOnThread(context); } }
public class class_name { protected void arrangeHookPreparedAccessContext(AccessContextArranger arranger, Object hook, Method hookMethod, Cron4jJob job) { final String moduleName = DfTypeUtil.toClassTitle(hook.getClass()); final AccessContext context = arranger.arrangePreparedAccessContext(new AccessContextResource(moduleName, hookMethod)); if (context == null) { String msg = "Cannot return null from access context arranger: " + arranger + " job=" + job.toIdentityDisp(); // depends on control dependency: [if], data = [none] throw new IllegalStateException(msg); } PreparedAccessContext.setAccessContextOnThread(context); } }
public class class_name { private void closeDeletion(int d) { // Adapted from Knuth Section 6.4 Algorithm R Object[] tab = table; int len = tab.length; // Look for items to swap into newly vacated slot // starting at index immediately following deletion, // and continuing until a null slot is seen, indicating // the end of a run of possibly-colliding keys. Object item; for (int i = nextKeyIndex(d, len); (item = tab[i]) != null; i = nextKeyIndex(i, len) ) { // The following test triggers if the item at slot i (which // hashes to be at slot r) should take the spot vacated by d. // If so, we swap it in, and then continue with d now at the // newly vacated i. This process will terminate when we hit // the null slot at the end of this run. // The test is messy because we are using a circular table. int r = hash(item, len); if ((i < r && (r <= d || d <= i)) || (r <= d && d <= i)) { tab[d] = item; tab[d + 1] = tab[i + 1]; tab[i] = null; tab[i + 1] = null; d = i; } } } }
public class class_name { private void closeDeletion(int d) { // Adapted from Knuth Section 6.4 Algorithm R Object[] tab = table; int len = tab.length; // Look for items to swap into newly vacated slot // starting at index immediately following deletion, // and continuing until a null slot is seen, indicating // the end of a run of possibly-colliding keys. Object item; for (int i = nextKeyIndex(d, len); (item = tab[i]) != null; i = nextKeyIndex(i, len) ) { // The following test triggers if the item at slot i (which // hashes to be at slot r) should take the spot vacated by d. // If so, we swap it in, and then continue with d now at the // newly vacated i. This process will terminate when we hit // the null slot at the end of this run. // The test is messy because we are using a circular table. int r = hash(item, len); if ((i < r && (r <= d || d <= i)) || (r <= d && d <= i)) { tab[d] = item; // depends on control dependency: [if], data = [none] tab[d + 1] = tab[i + 1]; // depends on control dependency: [if], data = [none] tab[i] = null; // depends on control dependency: [if], data = [none] tab[i + 1] = null; // depends on control dependency: [if], data = [none] d = i; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public UserPoolClientType withAllowedOAuthScopes(String... allowedOAuthScopes) { if (this.allowedOAuthScopes == null) { setAllowedOAuthScopes(new java.util.ArrayList<String>(allowedOAuthScopes.length)); } for (String ele : allowedOAuthScopes) { this.allowedOAuthScopes.add(ele); } return this; } }
public class class_name { public UserPoolClientType withAllowedOAuthScopes(String... allowedOAuthScopes) { if (this.allowedOAuthScopes == null) { setAllowedOAuthScopes(new java.util.ArrayList<String>(allowedOAuthScopes.length)); // depends on control dependency: [if], data = [none] } for (String ele : allowedOAuthScopes) { this.allowedOAuthScopes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void setValues(PropertyValuesHolder... values) { int numValues = values.length; mValues = values; mValuesMap = new HashMap<String, PropertyValuesHolder>(numValues); for (int i = 0; i < numValues; ++i) { PropertyValuesHolder valuesHolder = values[i]; mValuesMap.put(valuesHolder.getPropertyName(), valuesHolder); } // New property/values/target should cause re-initialization prior to starting mInitialized = false; } }
public class class_name { public void setValues(PropertyValuesHolder... values) { int numValues = values.length; mValues = values; mValuesMap = new HashMap<String, PropertyValuesHolder>(numValues); for (int i = 0; i < numValues; ++i) { PropertyValuesHolder valuesHolder = values[i]; mValuesMap.put(valuesHolder.getPropertyName(), valuesHolder); // depends on control dependency: [for], data = [none] } // New property/values/target should cause re-initialization prior to starting mInitialized = false; } }
public class class_name { public static int findMaxCol(Sheet sheet) { int maxCol = 0; for (int i = 0, ii = sheet.getLastRowNum(); i <= ii; ++i) { val row = sheet.getRow(i); if (row == null) continue; for (int j = row.getLastCellNum() - 1; j > maxCol; --j) { val cell = row.getCell(j); if (cell == null) continue; val value = getCellStringValue(cell); if (StringUtils.isNotEmpty(value)) { maxCol = j; break; } } } return maxCol; } }
public class class_name { public static int findMaxCol(Sheet sheet) { int maxCol = 0; for (int i = 0, ii = sheet.getLastRowNum(); i <= ii; ++i) { val row = sheet.getRow(i); if (row == null) continue; for (int j = row.getLastCellNum() - 1; j > maxCol; --j) { val cell = row.getCell(j); if (cell == null) continue; val value = getCellStringValue(cell); if (StringUtils.isNotEmpty(value)) { maxCol = j; // depends on control dependency: [if], data = [none] break; } } } return maxCol; } }
public class class_name { @Override public final <V> T fromValue(V value) { checkStatus(Status.INITIALIZED); try { @SuppressWarnings("unchecked") TypeAdapter<T,V> adapter = (TypeAdapter<T, V>) TypeAdapter.createAdapter(this.termClass,value.getClass()); for(T candidate:this.terms.values()) { if(value.equals(adapter.adapt(candidate))) { return candidate; } } return null; } catch (CannotAdaptClassesException e) { throw new UnsupportedOperationException("Class '"+this.termClass.getCanonicalName()+" cannot be transformed to '"+value.getClass().getCanonicalName()+"'",e); } } }
public class class_name { @Override public final <V> T fromValue(V value) { checkStatus(Status.INITIALIZED); try { @SuppressWarnings("unchecked") TypeAdapter<T,V> adapter = (TypeAdapter<T, V>) TypeAdapter.createAdapter(this.termClass,value.getClass()); for(T candidate:this.terms.values()) { if(value.equals(adapter.adapt(candidate))) { return candidate; // depends on control dependency: [if], data = [none] } } return null; // depends on control dependency: [try], data = [none] } catch (CannotAdaptClassesException e) { throw new UnsupportedOperationException("Class '"+this.termClass.getCanonicalName()+" cannot be transformed to '"+value.getClass().getCanonicalName()+"'",e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(VoiceConnector voiceConnector, ProtocolMarshaller protocolMarshaller) { if (voiceConnector == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(voiceConnector.getVoiceConnectorId(), VOICECONNECTORID_BINDING); protocolMarshaller.marshall(voiceConnector.getName(), NAME_BINDING); protocolMarshaller.marshall(voiceConnector.getOutboundHostName(), OUTBOUNDHOSTNAME_BINDING); protocolMarshaller.marshall(voiceConnector.getRequireEncryption(), REQUIREENCRYPTION_BINDING); protocolMarshaller.marshall(voiceConnector.getCreatedTimestamp(), CREATEDTIMESTAMP_BINDING); protocolMarshaller.marshall(voiceConnector.getUpdatedTimestamp(), UPDATEDTIMESTAMP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(VoiceConnector voiceConnector, ProtocolMarshaller protocolMarshaller) { if (voiceConnector == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(voiceConnector.getVoiceConnectorId(), VOICECONNECTORID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(voiceConnector.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(voiceConnector.getOutboundHostName(), OUTBOUNDHOSTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(voiceConnector.getRequireEncryption(), REQUIREENCRYPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(voiceConnector.getCreatedTimestamp(), CREATEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(voiceConnector.getUpdatedTimestamp(), UPDATEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Complex_F64 getEigenvalue(int index ) { if( is64 ) return ((EigenDecomposition_F64)eig).getEigenvalue(index); else { Complex_F64 c = ((EigenDecomposition_F64)eig).getEigenvalue(index); return new Complex_F64(c.real, c.imaginary); } } }
public class class_name { public Complex_F64 getEigenvalue(int index ) { if( is64 ) return ((EigenDecomposition_F64)eig).getEigenvalue(index); else { Complex_F64 c = ((EigenDecomposition_F64)eig).getEigenvalue(index); return new Complex_F64(c.real, c.imaginary); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String toQualifiedName(QName qName) { String prefix = qName.getPrefix(); if (!StringUtils.hasLength(prefix)) { return qName.getLocalPart(); } else { return prefix + ":" + qName.getLocalPart(); } } }
public class class_name { protected String toQualifiedName(QName qName) { String prefix = qName.getPrefix(); if (!StringUtils.hasLength(prefix)) { return qName.getLocalPart(); // depends on control dependency: [if], data = [none] } else { return prefix + ":" + qName.getLocalPart(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @ObjectiveCName("formatFullServiceMessageWithSenderId:withContent:withIsChannel:") public String formatFullServiceMessage(int senderId, ServiceContent content, boolean isChannel) { String groupKey = isChannel ? "channels" : "groups"; if (content instanceof ServiceUserRegistered) { return getTemplateNamed(senderId, "content.service.registered.full") .replace("{app_name}", getAppName()); } else if (content instanceof ServiceGroupCreated) { return getTemplateNamed(senderId, "content.service." + groupKey + ".created"); } else if (content instanceof ServiceGroupUserInvited) { return getTemplateNamed(senderId, "content.service." + groupKey + ".invited") .replace("{name_added}", getSubjectName(((ServiceGroupUserInvited) content).getAddedUid())); } else if (content instanceof ServiceGroupUserKicked) { return getTemplateNamed(senderId, "content.service." + groupKey + ".kicked") .replace("{name_kicked}", getSubjectName(((ServiceGroupUserKicked) content).getKickedUid())); } else if (content instanceof ServiceGroupUserLeave) { return getTemplateNamed(senderId, "content.service." + groupKey + ".left"); } else if (content instanceof ServiceGroupTitleChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".title_changed.full") .replace("{title}", ((ServiceGroupTitleChanged) content).getNewTitle()); } else if (content instanceof ServiceGroupTopicChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".topic_changed.full") .replace("{topic}", ((ServiceGroupTopicChanged) content).getNewTopic()); } else if (content instanceof ServiceGroupAboutChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".about_changed.full") .replace("{about}", ((ServiceGroupAboutChanged) content).getNewAbout()); } else if (content instanceof ServiceGroupAvatarChanged) { if (((ServiceGroupAvatarChanged) content).getNewAvatar() != null) { return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_changed"); } else { return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_removed"); } } else if (content instanceof ServiceGroupUserJoined) { return getTemplateNamed(senderId, "content.service." + groupKey + ".joined"); } else if (content instanceof ServiceCallEnded) { return get("content.service.calls.ended"); } else if (content instanceof ServiceCallMissed) { return get("content.service.calls.missed"); } return content.getCompatText(); } }
public class class_name { @ObjectiveCName("formatFullServiceMessageWithSenderId:withContent:withIsChannel:") public String formatFullServiceMessage(int senderId, ServiceContent content, boolean isChannel) { String groupKey = isChannel ? "channels" : "groups"; if (content instanceof ServiceUserRegistered) { return getTemplateNamed(senderId, "content.service.registered.full") .replace("{app_name}", getAppName()); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupCreated) { return getTemplateNamed(senderId, "content.service." + groupKey + ".created"); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupUserInvited) { return getTemplateNamed(senderId, "content.service." + groupKey + ".invited") .replace("{name_added}", getSubjectName(((ServiceGroupUserInvited) content).getAddedUid())); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupUserKicked) { return getTemplateNamed(senderId, "content.service." + groupKey + ".kicked") .replace("{name_kicked}", getSubjectName(((ServiceGroupUserKicked) content).getKickedUid())); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupUserLeave) { return getTemplateNamed(senderId, "content.service." + groupKey + ".left"); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupTitleChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".title_changed.full") .replace("{title}", ((ServiceGroupTitleChanged) content).getNewTitle()); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupTopicChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".topic_changed.full") .replace("{topic}", ((ServiceGroupTopicChanged) content).getNewTopic()); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupAboutChanged) { return getTemplateNamed(senderId, "content.service." + groupKey + ".about_changed.full") .replace("{about}", ((ServiceGroupAboutChanged) content).getNewAbout()); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceGroupAvatarChanged) { if (((ServiceGroupAvatarChanged) content).getNewAvatar() != null) { return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_changed"); // depends on control dependency: [if], data = [none] } else { return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_removed"); // depends on control dependency: [if], data = [none] } } else if (content instanceof ServiceGroupUserJoined) { return getTemplateNamed(senderId, "content.service." + groupKey + ".joined"); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceCallEnded) { return get("content.service.calls.ended"); // depends on control dependency: [if], data = [none] } else if (content instanceof ServiceCallMissed) { return get("content.service.calls.missed"); // depends on control dependency: [if], data = [none] } return content.getCompatText(); } }
public class class_name { public InvCatalogImpl readXML(org.jdom2.Document jdomDoc, URI uri) { // decide on converter based on namespace Element root = jdomDoc.getRootElement(); if (!root.getName().equalsIgnoreCase("catalog")) { throw new IllegalArgumentException("not a catalog"); } String namespace = root.getNamespaceURI(); InvCatalogConvertIF fac = converters.get(namespace); if (fac == null) { fac = defaultConverter; // LOOK if (debugVersion) System.out.println("use default converter " + fac.getClass().getName() + "; no namespace " + namespace); } else if (debugVersion) System.out.println("use converter " + fac.getClass().getName() + " based on namespace " + namespace); InvCatalogImpl cat = fac.parseXML(this, jdomDoc, uri); cat.setCreateFrom(uri.toString()); // cat.setCatalogFactory(this); //cat.setCatalogConverter(fac); cat.finish(); /* if (showCatalogXML) { System.out.println("*** catalog/showCatalogXML"); try { writeXML(cat, System.out); } catch (IOException ex) { log.warn("Error writing catalog for debugging", ex); } } */ if (fatalMessages.length() > 0) cat.appendErrorMessage(fatalMessages.toString(), true); // makes it invalid if (errMessages.length() > 0) cat.appendErrorMessage(errMessages.toString(), false); // doesnt make it invalid if (warnMessages.length() > 0) cat.appendErrorMessage(warnMessages.toString(), false); // doesnt make it invalid return cat; } }
public class class_name { public InvCatalogImpl readXML(org.jdom2.Document jdomDoc, URI uri) { // decide on converter based on namespace Element root = jdomDoc.getRootElement(); if (!root.getName().equalsIgnoreCase("catalog")) { throw new IllegalArgumentException("not a catalog"); } String namespace = root.getNamespaceURI(); InvCatalogConvertIF fac = converters.get(namespace); if (fac == null) { fac = defaultConverter; // LOOK // depends on control dependency: [if], data = [none] if (debugVersion) System.out.println("use default converter " + fac.getClass().getName() + "; no namespace " + namespace); } else if (debugVersion) System.out.println("use converter " + fac.getClass().getName() + " based on namespace " + namespace); InvCatalogImpl cat = fac.parseXML(this, jdomDoc, uri); cat.setCreateFrom(uri.toString()); // cat.setCatalogFactory(this); //cat.setCatalogConverter(fac); cat.finish(); /* if (showCatalogXML) { System.out.println("*** catalog/showCatalogXML"); try { writeXML(cat, System.out); } catch (IOException ex) { log.warn("Error writing catalog for debugging", ex); } } */ if (fatalMessages.length() > 0) cat.appendErrorMessage(fatalMessages.toString(), true); // makes it invalid if (errMessages.length() > 0) cat.appendErrorMessage(errMessages.toString(), false); // doesnt make it invalid if (warnMessages.length() > 0) cat.appendErrorMessage(warnMessages.toString(), false); // doesnt make it invalid return cat; } }
public class class_name { public static int getPid() { String pid = ManagementFactory.getRuntimeMXBean().getName(); int indexOf = pid.indexOf('@'); if (indexOf > 0) { pid = pid.substring(0, indexOf); } return Integer.parseInt(pid); } }
public class class_name { public static int getPid() { String pid = ManagementFactory.getRuntimeMXBean().getName(); int indexOf = pid.indexOf('@'); if (indexOf > 0) { pid = pid.substring(0, indexOf); // depends on control dependency: [if], data = [none] } return Integer.parseInt(pid); } }
public class class_name { public static void registerLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { if (mLogBroadcastReceiver == null) { mLogBroadcastReceiver = new LogBroadcastReceiver(); final IntentFilter filter = new IntentFilter(); filter.addAction(DfuBaseService.BROADCAST_LOG); LocalBroadcastManager.getInstance(context).registerReceiver(mLogBroadcastReceiver, filter); } mLogBroadcastReceiver.setLogListener(listener); } }
public class class_name { public static void registerLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) { if (mLogBroadcastReceiver == null) { mLogBroadcastReceiver = new LogBroadcastReceiver(); // depends on control dependency: [if], data = [none] final IntentFilter filter = new IntentFilter(); filter.addAction(DfuBaseService.BROADCAST_LOG); // depends on control dependency: [if], data = [none] LocalBroadcastManager.getInstance(context).registerReceiver(mLogBroadcastReceiver, filter); // depends on control dependency: [if], data = [(mLogBroadcastReceiver] } mLogBroadcastReceiver.setLogListener(listener); } }
public class class_name { public void addMemberSummary(TypeElement tElement, Element member, List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter) { HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); tdSummaryType.addStyle(HtmlStyle.colFirst); writer.addSummaryType(this, member, tdSummaryType); HtmlTree tr = HtmlTree.TR(tdSummaryType); HtmlTree thSummaryLink = new HtmlTree(HtmlTag.TH); setSummaryColumnStyleAndScope(thSummaryLink); addSummaryLink(tElement, member, thSummaryLink); tr.addContent(thSummaryLink); HtmlTree tdDesc = new HtmlTree(HtmlTag.TD); tdDesc.addStyle(HtmlStyle.colLast); writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc); tr.addContent(tdDesc); if (utils.isMethod(member) && !utils.isAnnotationType(member)) { int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() : MethodTypes.INSTANCE.tableTabs().value(); if (utils.isInterface(member.getEnclosingElement())) { methodType = utils.isAbstract(member) ? methodType | MethodTypes.ABSTRACT.tableTabs().value() : methodType | MethodTypes.DEFAULT.tableTabs().value(); } else { methodType = utils.isAbstract(member) ? methodType | MethodTypes.ABSTRACT.tableTabs().value() : methodType | MethodTypes.CONCRETE.tableTabs().value(); } if (utils.isDeprecated(member) || utils.isDeprecated(typeElement)) { methodType = methodType | MethodTypes.DEPRECATED.tableTabs().value(); } methodTypesOr = methodTypesOr | methodType; String tableId = "i" + counter; typeMap.put(tableId, methodType); tr.addAttr(HtmlAttr.ID, tableId); } if (counter%2 == 0) tr.addStyle(HtmlStyle.altColor); else tr.addStyle(HtmlStyle.rowColor); tableContents.add(tr); } }
public class class_name { public void addMemberSummary(TypeElement tElement, Element member, List<? extends DocTree> firstSentenceTags, List<Content> tableContents, int counter) { HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); tdSummaryType.addStyle(HtmlStyle.colFirst); writer.addSummaryType(this, member, tdSummaryType); HtmlTree tr = HtmlTree.TR(tdSummaryType); HtmlTree thSummaryLink = new HtmlTree(HtmlTag.TH); setSummaryColumnStyleAndScope(thSummaryLink); addSummaryLink(tElement, member, thSummaryLink); tr.addContent(thSummaryLink); HtmlTree tdDesc = new HtmlTree(HtmlTag.TD); tdDesc.addStyle(HtmlStyle.colLast); writer.addSummaryLinkComment(this, member, firstSentenceTags, tdDesc); tr.addContent(tdDesc); if (utils.isMethod(member) && !utils.isAnnotationType(member)) { int methodType = utils.isStatic(member) ? MethodTypes.STATIC.tableTabs().value() : MethodTypes.INSTANCE.tableTabs().value(); if (utils.isInterface(member.getEnclosingElement())) { methodType = utils.isAbstract(member) ? methodType | MethodTypes.ABSTRACT.tableTabs().value() : methodType | MethodTypes.DEFAULT.tableTabs().value(); // depends on control dependency: [if], data = [none] } else { methodType = utils.isAbstract(member) ? methodType | MethodTypes.ABSTRACT.tableTabs().value() : methodType | MethodTypes.CONCRETE.tableTabs().value(); // depends on control dependency: [if], data = [none] } if (utils.isDeprecated(member) || utils.isDeprecated(typeElement)) { methodType = methodType | MethodTypes.DEPRECATED.tableTabs().value(); // depends on control dependency: [if], data = [none] } methodTypesOr = methodTypesOr | methodType; // depends on control dependency: [if], data = [none] String tableId = "i" + counter; typeMap.put(tableId, methodType); // depends on control dependency: [if], data = [none] tr.addAttr(HtmlAttr.ID, tableId); // depends on control dependency: [if], data = [none] } if (counter%2 == 0) tr.addStyle(HtmlStyle.altColor); else tr.addStyle(HtmlStyle.rowColor); tableContents.add(tr); } }
public class class_name { public static <T extends Comparable<T>> String toSortedByKeysString(Counter<T> counter, String itemFormat, String joiner, String wrapperFormat) { List<String> strings = new ArrayList<String>(); for (T key : CollectionUtils.sorted(counter.keySet())) { strings.add(String.format(itemFormat, key, counter.getCount(key))); } return String.format(wrapperFormat, StringUtils.join(strings, joiner)); } }
public class class_name { public static <T extends Comparable<T>> String toSortedByKeysString(Counter<T> counter, String itemFormat, String joiner, String wrapperFormat) { List<String> strings = new ArrayList<String>(); for (T key : CollectionUtils.sorted(counter.keySet())) { strings.add(String.format(itemFormat, key, counter.getCount(key))); // depends on control dependency: [for], data = [key] } return String.format(wrapperFormat, StringUtils.join(strings, joiner)); } }
public class class_name { private void addEs6ModuleImportToGraph(NodeTraversal t, Node n) { String moduleName = getEs6ModuleNameFromImportNode(t, n); if (moduleName.startsWith("goog.")) { t.getInput().addOrderedRequire(Require.BASE); } t.getInput().addOrderedRequire(Require.es6Import(moduleName, n.getLastChild().getString())); } }
public class class_name { private void addEs6ModuleImportToGraph(NodeTraversal t, Node n) { String moduleName = getEs6ModuleNameFromImportNode(t, n); if (moduleName.startsWith("goog.")) { t.getInput().addOrderedRequire(Require.BASE); // depends on control dependency: [if], data = [none] } t.getInput().addOrderedRequire(Require.es6Import(moduleName, n.getLastChild().getString())); } }
public class class_name { public static int checkPostconditionI( final int value, final IntPredicate predicate, final IntFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { throw failed( e, Integer.valueOf(value), singleViolation(failedPredicate(e))); } return innerCheckI(value, ok, describer); } }
public class class_name { public static int checkPostconditionI( final int value, final IntPredicate predicate, final IntFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); // depends on control dependency: [try], data = [none] } catch (final Throwable e) { throw failed( e, Integer.valueOf(value), singleViolation(failedPredicate(e))); } // depends on control dependency: [catch], data = [none] return innerCheckI(value, ok, describer); } }
public class class_name { public final CompletionStage<V> getOrTimeout(Duration timeout, ScheduledExecutorService timeoutExecutor) { if (GATE_UPDATER.get(this) == GATE_OPEN && timeoutScheduleFuture == null) { this.timeoutScheduleFuture = timeoutExecutor.schedule(this::emit, timeout.toNanos(), TimeUnit.NANOSECONDS); } return selfFuture; } }
public class class_name { public final CompletionStage<V> getOrTimeout(Duration timeout, ScheduledExecutorService timeoutExecutor) { if (GATE_UPDATER.get(this) == GATE_OPEN && timeoutScheduleFuture == null) { this.timeoutScheduleFuture = timeoutExecutor.schedule(this::emit, timeout.toNanos(), TimeUnit.NANOSECONDS); // depends on control dependency: [if], data = [none] } return selfFuture; } }
public class class_name { protected final void populate() { final int size = size(); mInternalItemList.clear(); mInternalItemList.ensureCapacity(size); for (int a = 0; a < size; a++) { mInternalItemList.add(createItem(a)); } mInternalItemDisplayedList = null; } }
public class class_name { protected final void populate() { final int size = size(); mInternalItemList.clear(); mInternalItemList.ensureCapacity(size); for (int a = 0; a < size; a++) { mInternalItemList.add(createItem(a)); // depends on control dependency: [for], data = [a] } mInternalItemDisplayedList = null; } }
public class class_name { public String getNamespaceURI(String prefix) { String uri = null; try { uri = namespaceRegistry.getURI(prefix); } catch (NamespaceException exc) { uri = namespaces.get(prefix); } catch (RepositoryException exc) { log.error(exc.getMessage(), exc); } return uri; } }
public class class_name { public String getNamespaceURI(String prefix) { String uri = null; try { uri = namespaceRegistry.getURI(prefix); // depends on control dependency: [try], data = [none] } catch (NamespaceException exc) { uri = namespaces.get(prefix); } // depends on control dependency: [catch], data = [none] catch (RepositoryException exc) { log.error(exc.getMessage(), exc); } // depends on control dependency: [catch], data = [none] return uri; } }
public class class_name { public static boolean isAligned(Instant instant, Schedule schedule) { // executionTime.isMatch ignores seconds for unix cron // so we fail the check immediately if there is a sub-minute value if (!instant.truncatedTo(ChronoUnit.MINUTES).equals(instant)) { return false; } final ExecutionTime executionTime = ExecutionTime.forCron(cron(schedule)); final ZonedDateTime utcDateTime = instant.atZone(UTC); return executionTime.isMatch(utcDateTime); } }
public class class_name { public static boolean isAligned(Instant instant, Schedule schedule) { // executionTime.isMatch ignores seconds for unix cron // so we fail the check immediately if there is a sub-minute value if (!instant.truncatedTo(ChronoUnit.MINUTES).equals(instant)) { return false; // depends on control dependency: [if], data = [none] } final ExecutionTime executionTime = ExecutionTime.forCron(cron(schedule)); final ZonedDateTime utcDateTime = instant.atZone(UTC); return executionTime.isMatch(utcDateTime); } }
public class class_name { public synchronized boolean isLoaderFor(final ProviderIdent ident) { final String[] strings = getClassnames(); for (final String classname : strings) { try { if (matchesProviderDeclaration(ident, loadClass(classname))) { return true; } } catch (PluginException e) { e.printStackTrace(); } } return false; } }
public class class_name { public synchronized boolean isLoaderFor(final ProviderIdent ident) { final String[] strings = getClassnames(); for (final String classname : strings) { try { if (matchesProviderDeclaration(ident, loadClass(classname))) { return true; // depends on control dependency: [if], data = [none] } } catch (PluginException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { protected boolean hasStereotype(Element element, List<String> stereotypes) { if (element == null) { return false; } if (stereotypes.contains(element.toString())) { return true; } AnnotationMetadata annotationMetadata = getAnnotationMetadata(element); for (String stereotype : stereotypes) { if (annotationMetadata.hasStereotype(stereotype)) { return true; } } return false; } }
public class class_name { protected boolean hasStereotype(Element element, List<String> stereotypes) { if (element == null) { return false; // depends on control dependency: [if], data = [none] } if (stereotypes.contains(element.toString())) { return true; // depends on control dependency: [if], data = [none] } AnnotationMetadata annotationMetadata = getAnnotationMetadata(element); for (String stereotype : stereotypes) { if (annotationMetadata.hasStereotype(stereotype)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private Object addNTServiceParameter(NTService ntService, String key, String value) { if ("runAsNT".equals(key)) { ntService.setRunAsNT(Boolean.parseBoolean(value)); } else if ("startupType".equals(key)) { ntService.setStartupType(value); } else if ("loginAs".equals(key)) { ntService.setLoginAs(value); } else if ("password".equals(key)) { ntService.setPassword(value); } return ntService; } }
public class class_name { private Object addNTServiceParameter(NTService ntService, String key, String value) { if ("runAsNT".equals(key)) { ntService.setRunAsNT(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none] } else if ("startupType".equals(key)) { ntService.setStartupType(value); // depends on control dependency: [if], data = [none] } else if ("loginAs".equals(key)) { ntService.setLoginAs(value); // depends on control dependency: [if], data = [none] } else if ("password".equals(key)) { ntService.setPassword(value); // depends on control dependency: [if], data = [none] } return ntService; } }
public class class_name { public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); } return points; } }
public class class_name { public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); // depends on control dependency: [for], data = [marker] } return points; } }
public class class_name { @SuppressWarnings("unused") private static final void dump(HttpClient client, HttpUriRequest req) { if (logger.isTraceEnabled()) { StringBuilder sb = new StringBuilder("\n=== Request ==="); sb.append("\n").append(req.getRequestLine()); for (Header h : req.getAllHeaders()) { sb.append("\n").append(h.getName()).append(": ").append(h.getValue()); } logger.trace(sb.toString()); HttpResponse resp = null; try { resp = client.execute(req); } catch (Exception e) { logger.trace("Error executing request", e); return; } sb = new StringBuilder("\n=== Response ==="); sb.append("\n").append(resp.getStatusLine()); for (Header h : resp.getAllHeaders()) { sb.append("\n").append(h.getName()).append(": ").append(h.getValue()); } logger.trace(sb.toString()); HttpEntity entity = resp.getEntity(); if (entity != null) { sb = new StringBuilder("\n=== Content ==="); try { int len = (int) entity.getContentLength(); if (len < 0) len = 100; ByteArrayOutputStream baos = new ByteArrayOutputStream(len); entity.writeTo(baos); sb.append("\n").append(baos.toString("UTF-8")); logger.trace(sb.toString()); } catch (IOException e) { logger.trace("Error reading content", e); } } } } }
public class class_name { @SuppressWarnings("unused") private static final void dump(HttpClient client, HttpUriRequest req) { if (logger.isTraceEnabled()) { StringBuilder sb = new StringBuilder("\n=== Request ==="); sb.append("\n").append(req.getRequestLine()); // depends on control dependency: [if], data = [none] for (Header h : req.getAllHeaders()) { sb.append("\n").append(h.getName()).append(": ").append(h.getValue()); // depends on control dependency: [for], data = [h] } logger.trace(sb.toString()); // depends on control dependency: [if], data = [none] HttpResponse resp = null; try { resp = client.execute(req); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.trace("Error executing request", e); return; } // depends on control dependency: [catch], data = [none] sb = new StringBuilder("\n=== Response ==="); // depends on control dependency: [if], data = [none] sb.append("\n").append(resp.getStatusLine()); // depends on control dependency: [if], data = [none] for (Header h : resp.getAllHeaders()) { sb.append("\n").append(h.getName()).append(": ").append(h.getValue()); // depends on control dependency: [for], data = [h] } logger.trace(sb.toString()); // depends on control dependency: [if], data = [none] HttpEntity entity = resp.getEntity(); if (entity != null) { sb = new StringBuilder("\n=== Content ==="); // depends on control dependency: [if], data = [none] try { int len = (int) entity.getContentLength(); if (len < 0) len = 100; ByteArrayOutputStream baos = new ByteArrayOutputStream(len); entity.writeTo(baos); // depends on control dependency: [try], data = [none] sb.append("\n").append(baos.toString("UTF-8")); // depends on control dependency: [try], data = [none] logger.trace(sb.toString()); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.trace("Error reading content", e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private List<LoadBalancer> findLoadBalancers(@Nullable String loadBalancerId) throws CloudException, InternalException { APITrace.begin(getProvider(), "LB.listLoadBalancers"); try { // get all vips, optionally filtered by lbId List<JSONObject> listeners = findAllVips(loadBalancerId); // get all members, optionally filtered by lbId List<JSONObject> members = findAllMembers(loadBalancerId); NovaMethod method = new NovaMethod(getProvider()); // Unlike Horizon the OS LB API returns all tenants' load balancers, so we must filter JSONObject result = method.getNetworks(getLoadBalancersResource(), loadBalancerId, false, "?tenant_id="+getContext().getAccountNumber()); List<LoadBalancer> results = new ArrayList<LoadBalancer>(); if( loadBalancerId == null && result != null && result.has("pools") ) { try { JSONArray loadbalancers = result.getJSONArray("pools"); for( int i = 0; i < loadbalancers.length(); i++ ) { JSONObject lb = loadbalancers.getJSONObject(i); results.add(toLoadBalancer(lb, listeners, members)); } } catch( JSONException e ) { logger.error("Unable to understand listPools response: " + e.getMessage()); throw new CloudException(e); } } else if( result != null && result.has("pool")) { try { return Collections.singletonList(toLoadBalancer(result.getJSONObject("pool"), listeners, members)); } catch( JSONException e ) { logger.error("Unable to understand getPool response: " + e.getMessage()); throw new CloudException(e); } } return results; } finally { APITrace.end(); } } }
public class class_name { private List<LoadBalancer> findLoadBalancers(@Nullable String loadBalancerId) throws CloudException, InternalException { APITrace.begin(getProvider(), "LB.listLoadBalancers"); try { // get all vips, optionally filtered by lbId List<JSONObject> listeners = findAllVips(loadBalancerId); // get all members, optionally filtered by lbId List<JSONObject> members = findAllMembers(loadBalancerId); NovaMethod method = new NovaMethod(getProvider()); // Unlike Horizon the OS LB API returns all tenants' load balancers, so we must filter JSONObject result = method.getNetworks(getLoadBalancersResource(), loadBalancerId, false, "?tenant_id="+getContext().getAccountNumber()); List<LoadBalancer> results = new ArrayList<LoadBalancer>(); if( loadBalancerId == null && result != null && result.has("pools") ) { try { JSONArray loadbalancers = result.getJSONArray("pools"); for( int i = 0; i < loadbalancers.length(); i++ ) { JSONObject lb = loadbalancers.getJSONObject(i); results.add(toLoadBalancer(lb, listeners, members)); // depends on control dependency: [for], data = [none] } } catch( JSONException e ) { logger.error("Unable to understand listPools response: " + e.getMessage()); throw new CloudException(e); } // depends on control dependency: [catch], data = [none] } else if( result != null && result.has("pool")) { try { return Collections.singletonList(toLoadBalancer(result.getJSONObject("pool"), listeners, members)); } catch( JSONException e ) { logger.error("Unable to understand getPool response: " + e.getMessage()); throw new CloudException(e); } } return results; } finally { APITrace.end(); } } }
public class class_name { private InputSource getCMLType(String type) { try { InputStream ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/io/cml/data/" + type); return new InputSource(new BufferedReader(new InputStreamReader(ins))); } catch (Exception e) { logger.error("Error while trying to read CML DTD (" + type + "): ", e.getMessage()); logger.debug(e); return null; } } }
public class class_name { private InputSource getCMLType(String type) { try { InputStream ins = this.getClass().getClassLoader() .getResourceAsStream("org/openscience/cdk/io/cml/data/" + type); return new InputSource(new BufferedReader(new InputStreamReader(ins))); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Error while trying to read CML DTD (" + type + "): ", e.getMessage()); logger.debug(e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void firePropertyChanged(T property) { PropertyEvent<T> event = null; for (PropertyListener<T> l : listeners) { if (event == null) { event = new PropertyEvent<T>(this, property); } l.changed(event); } } }
public class class_name { private void firePropertyChanged(T property) { PropertyEvent<T> event = null; for (PropertyListener<T> l : listeners) { if (event == null) { event = new PropertyEvent<T>(this, property); // depends on control dependency: [if], data = [none] } l.changed(event); // depends on control dependency: [for], data = [l] } } }
public class class_name { private PreparedStatement prepareStatement(PreparedStatementCveDb key) throws DatabaseException { PreparedStatement preparedStatement = null; try { final String statementString = statementBundle.getString(key.name()); if (key == INSERT_VULNERABILITY || key == INSERT_CPE) { preparedStatement = connection.prepareStatement(statementString, Statement.RETURN_GENERATED_KEYS); } else { preparedStatement = connection.prepareStatement(statementString); } } catch (SQLException ex) { throw new DatabaseException(ex); } catch (MissingResourceException ex) { if (!ex.getMessage().contains("key MERGE_PROPERTY")) { throw new DatabaseException(ex); } } return preparedStatement; } }
public class class_name { private PreparedStatement prepareStatement(PreparedStatementCveDb key) throws DatabaseException { PreparedStatement preparedStatement = null; try { final String statementString = statementBundle.getString(key.name()); if (key == INSERT_VULNERABILITY || key == INSERT_CPE) { preparedStatement = connection.prepareStatement(statementString, Statement.RETURN_GENERATED_KEYS); // depends on control dependency: [if], data = [none] } else { preparedStatement = connection.prepareStatement(statementString); // depends on control dependency: [if], data = [none] } } catch (SQLException ex) { throw new DatabaseException(ex); } catch (MissingResourceException ex) { if (!ex.getMessage().contains("key MERGE_PROPERTY")) { throw new DatabaseException(ex); } } return preparedStatement; } }
public class class_name { public List<JasperException> getJSPCompilationErrors() { ArrayList<JasperException> ret = null; Collection<JasperException> c = jspErrors.values(); if (c != null) { ret = new ArrayList<JasperException>(); Iterator<JasperException> it = c.iterator(); while (it.hasNext()) { ret.add(it.next()); } } return ret; } }
public class class_name { public List<JasperException> getJSPCompilationErrors() { ArrayList<JasperException> ret = null; Collection<JasperException> c = jspErrors.values(); if (c != null) { ret = new ArrayList<JasperException>(); // depends on control dependency: [if], data = [none] Iterator<JasperException> it = c.iterator(); while (it.hasNext()) { ret.add(it.next()); // depends on control dependency: [while], data = [none] } } return ret; } }
public class class_name { private final static void checkEnvironment() { // Check java support.! boolean javaSupport = EnvUtil.isJDK7OrHigher(); if (!javaSupport) { Log.error("Your Java version (", EnvUtil.getJavaersion(), ") is not supported for Audit4j. ", ErrorGuide.getGuide(ErrorGuide.JAVA_VERSION_ERROR)); throw new InitializationException("Java version is not supported."); } } }
public class class_name { private final static void checkEnvironment() { // Check java support.! boolean javaSupport = EnvUtil.isJDK7OrHigher(); if (!javaSupport) { Log.error("Your Java version (", EnvUtil.getJavaersion(), ") is not supported for Audit4j. ", ErrorGuide.getGuide(ErrorGuide.JAVA_VERSION_ERROR)); // depends on control dependency: [if], data = [none] throw new InitializationException("Java version is not supported."); } } }
public class class_name { public boolean isConnected(String clusterName) { boolean isConnected = false; synchronized (connections) { if (connections.containsKey(clusterName)) { isConnected = connections.get(clusterName).isConnected(); } } return isConnected; } }
public class class_name { public boolean isConnected(String clusterName) { boolean isConnected = false; synchronized (connections) { if (connections.containsKey(clusterName)) { isConnected = connections.get(clusterName).isConnected(); // depends on control dependency: [if], data = [none] } } return isConnected; } }
public class class_name { protected <T extends Annotation> T extractPropertyAnnotation(Method writeMethod, Method readMethod, Class<T> annotationClass) { T parameterDescription = writeMethod.getAnnotation(annotationClass); if (parameterDescription == null && readMethod != null) { parameterDescription = readMethod.getAnnotation(annotationClass); } return parameterDescription; } }
public class class_name { protected <T extends Annotation> T extractPropertyAnnotation(Method writeMethod, Method readMethod, Class<T> annotationClass) { T parameterDescription = writeMethod.getAnnotation(annotationClass); if (parameterDescription == null && readMethod != null) { parameterDescription = readMethod.getAnnotation(annotationClass); // depends on control dependency: [if], data = [none] } return parameterDescription; } }
public class class_name { public String createInsertValueStr4ModelEntry(Map dbColMap0,Map<String,MicroDbModelEntry> modelEntryMap){ if(dbColMap0==null){ return null; } //add 201902 ning Map dbColMap=new CaseInsensitiveKeyMap(); if(dbColMap0!=null){ dbColMap.putAll(dbColMap0); } Cobj crealValues=Cutil.createCobj(); Map metaFlagMap=new TreeMap(); String tempDbType=calcuDbType(); Iterator it=dbColMap.keySet().iterator(); while(it.hasNext()){ String key=(String) it.next(); MicroDbModelEntry modelEntry=modelEntryMap.get(key); if(modelEntry==null){ continue; } if(CheckModelTypeUtil.isRealCol(modelEntry)==false){ String value=(String) dbColMap.get(key); String metaName=modelEntry.getMetaContentId(); Map metaMap=(Map) metaFlagMap.get(metaName); String realKey=CheckModelTypeUtil.getRealColName(key); if(metaMap==null){ metaMap=new HashMap(); metaFlagMap.put(metaName, metaMap); } if(CheckModelTypeUtil.isNumber(modelEntry)){ if(value.contains(".")){ metaMap.put(realKey, new BigDecimal(value)); }else{ metaMap.put(realKey, Long.valueOf(value)); } }else if(CheckModelTypeUtil.isDate(modelEntry)){ metaMap.put(realKey, value); }else{ metaMap.put(realKey, value); } }else{ //add 20170830 by ninghao Object vobj=dbColMap.get(key); if(vobj instanceof MicroColObj){ String colInfoStr=((MicroColObj)vobj).getColInfo(); crealValues.append(key+"="+colInfoStr); continue; } //end String value=(String) dbColMap.get(key); String whereValue=""; //add 201807 ning if(value!=null && MICRO_DB_NULL.equals(value)){ if(tempDbType!=null && "oracle".equals(tempDbType)){ whereValue="NULL"; }else{ whereValue="null"; }//end }else if(CheckModelTypeUtil.isNumber(modelEntry)){ whereValue=Cutil.rep("<REPLACE>",value); }else if(CheckModelTypeUtil.isDate(modelEntry)){ //add for oracle String temp="str_to_date('<REPLACE>','%Y-%m-%d %H:%i:%s')"; if(tempDbType!=null && "oracle".equals(tempDbType)){ temp="to_date('<REPLACE>','"+ORCL_DATE_FORMAT+"')"; } whereValue=Cutil.rep(temp,value); }else{ whereValue=Cutil.rep("'<REPLACE>'",value); } crealValues.append(whereValue,value!=null); } } String dynamic=null; Iterator iter = metaFlagMap.keySet().iterator(); while(iter.hasNext()){ String key=(String) iter.next(); Map metaMap=(Map) metaFlagMap.get(key); Gson gson=new Gson(); dynamic=gson.toJson(metaMap); crealValues.append(Cutil.rep("'<REPLACE>'",dynamic,dynamic!=null )); } return crealValues.getStr(); } }
public class class_name { public String createInsertValueStr4ModelEntry(Map dbColMap0,Map<String,MicroDbModelEntry> modelEntryMap){ if(dbColMap0==null){ return null; // depends on control dependency: [if], data = [none] } //add 201902 ning Map dbColMap=new CaseInsensitiveKeyMap(); if(dbColMap0!=null){ dbColMap.putAll(dbColMap0); // depends on control dependency: [if], data = [(dbColMap0] } Cobj crealValues=Cutil.createCobj(); Map metaFlagMap=new TreeMap(); String tempDbType=calcuDbType(); Iterator it=dbColMap.keySet().iterator(); while(it.hasNext()){ String key=(String) it.next(); MicroDbModelEntry modelEntry=modelEntryMap.get(key); if(modelEntry==null){ continue; } if(CheckModelTypeUtil.isRealCol(modelEntry)==false){ String value=(String) dbColMap.get(key); String metaName=modelEntry.getMetaContentId(); Map metaMap=(Map) metaFlagMap.get(metaName); String realKey=CheckModelTypeUtil.getRealColName(key); if(metaMap==null){ metaMap=new HashMap(); // depends on control dependency: [if], data = [none] metaFlagMap.put(metaName, metaMap); // depends on control dependency: [if], data = [none] } if(CheckModelTypeUtil.isNumber(modelEntry)){ if(value.contains(".")){ metaMap.put(realKey, new BigDecimal(value)); // depends on control dependency: [if], data = [none] }else{ metaMap.put(realKey, Long.valueOf(value)); // depends on control dependency: [if], data = [none] } }else if(CheckModelTypeUtil.isDate(modelEntry)){ metaMap.put(realKey, value); // depends on control dependency: [if], data = [none] }else{ metaMap.put(realKey, value); // depends on control dependency: [if], data = [none] } }else{ //add 20170830 by ninghao Object vobj=dbColMap.get(key); if(vobj instanceof MicroColObj){ String colInfoStr=((MicroColObj)vobj).getColInfo(); crealValues.append(key+"="+colInfoStr); // depends on control dependency: [if], data = [none] continue; } //end String value=(String) dbColMap.get(key); String whereValue=""; //add 201807 ning if(value!=null && MICRO_DB_NULL.equals(value)){ if(tempDbType!=null && "oracle".equals(tempDbType)){ whereValue="NULL"; // depends on control dependency: [if], data = [none] }else{ whereValue="null"; // depends on control dependency: [if], data = [none] }//end }else if(CheckModelTypeUtil.isNumber(modelEntry)){ whereValue=Cutil.rep("<REPLACE>",value); // depends on control dependency: [if], data = [none] }else if(CheckModelTypeUtil.isDate(modelEntry)){ //add for oracle String temp="str_to_date('<REPLACE>','%Y-%m-%d %H:%i:%s')"; if(tempDbType!=null && "oracle".equals(tempDbType)){ temp="to_date('<REPLACE>','"+ORCL_DATE_FORMAT+"')"; // depends on control dependency: [if], data = [none] } whereValue=Cutil.rep(temp,value); // depends on control dependency: [if], data = [none] }else{ whereValue=Cutil.rep("'<REPLACE>'",value); } crealValues.append(whereValue,value!=null); } } String dynamic=null; Iterator iter = metaFlagMap.keySet().iterator(); while(iter.hasNext()){ String key=(String) iter.next(); Map metaMap=(Map) metaFlagMap.get(key); Gson gson=new Gson(); dynamic=gson.toJson(metaMap); crealValues.append(Cutil.rep("'<REPLACE>'",dynamic,dynamic!=null )); // depends on control dependency: [if], data = [none] } return crealValues.getStr(); // depends on control dependency: [if], data = [none] } }
public class class_name { void restoreDynacacheProviderDefaults() { // restore commonConfig to Dynacache defaults if (restoreDynacacheDefaults) { if (cacheProviderName != CacheConfig.CACHE_PROVIDER_DYNACACHE) { cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE; enableCacheReplication = false; if (tc.isDebugEnabled()) { Tr.debug(tc, "OVERRIDING Object Grid default for " + cacheName); } } } } }
public class class_name { void restoreDynacacheProviderDefaults() { // restore commonConfig to Dynacache defaults if (restoreDynacacheDefaults) { if (cacheProviderName != CacheConfig.CACHE_PROVIDER_DYNACACHE) { cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE; // depends on control dependency: [if], data = [none] enableCacheReplication = false; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "OVERRIDING Object Grid default for " + cacheName); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public void clean() throws IOException { if (this.isDatasetBlacklisted) { this.log.info("Dataset blacklisted. Cleanup skipped for " + datasetRoot()); return; } boolean atLeastOneFailureSeen = false; for (VersionFinderAndPolicy<T> versionFinderAndPolicy : getVersionFindersAndPolicies()) { VersionSelectionPolicy<T> selectionPolicy = versionFinderAndPolicy.getVersionSelectionPolicy(); VersionFinder<? extends T> versionFinder = versionFinderAndPolicy.getVersionFinder(); if (!selectionPolicy.versionClass().isAssignableFrom(versionFinder.versionClass())) { throw new IOException("Incompatible dataset version classes."); } this.log.info(String.format("Cleaning dataset %s. Using version finder %s and policy %s", this, versionFinder.getClass().getName(), selectionPolicy)); List<T> versions = Lists.newArrayList(versionFinder.findDatasetVersions(this)); if (versions.isEmpty()) { this.log.warn("No dataset version can be found. Ignoring."); continue; } Collections.sort(versions, Collections.reverseOrder()); Collection<T> deletableVersions = selectionPolicy.listSelectedVersions(versions); cleanImpl(deletableVersions); List<DatasetVersion> allVersions = Lists.newArrayList(); for (T ver : versions) { allVersions.add(ver); } for (RetentionAction retentionAction : versionFinderAndPolicy.getRetentionActions()) { try { retentionAction.execute(allVersions); } catch (Throwable t) { atLeastOneFailureSeen = true; log.error(String.format("RetentionAction %s failed for dataset %s", retentionAction.getClass().getName(), this.datasetRoot()), t); } } } if (atLeastOneFailureSeen) { throw new RuntimeException(String.format( "At least one failure happened while processing %s. Look for previous logs for failures", datasetRoot())); } } }
public class class_name { @Override public void clean() throws IOException { if (this.isDatasetBlacklisted) { this.log.info("Dataset blacklisted. Cleanup skipped for " + datasetRoot()); return; } boolean atLeastOneFailureSeen = false; for (VersionFinderAndPolicy<T> versionFinderAndPolicy : getVersionFindersAndPolicies()) { VersionSelectionPolicy<T> selectionPolicy = versionFinderAndPolicy.getVersionSelectionPolicy(); VersionFinder<? extends T> versionFinder = versionFinderAndPolicy.getVersionFinder(); if (!selectionPolicy.versionClass().isAssignableFrom(versionFinder.versionClass())) { throw new IOException("Incompatible dataset version classes."); } this.log.info(String.format("Cleaning dataset %s. Using version finder %s and policy %s", this, versionFinder.getClass().getName(), selectionPolicy)); List<T> versions = Lists.newArrayList(versionFinder.findDatasetVersions(this)); if (versions.isEmpty()) { this.log.warn("No dataset version can be found. Ignoring."); // depends on control dependency: [if], data = [none] continue; } Collections.sort(versions, Collections.reverseOrder()); Collection<T> deletableVersions = selectionPolicy.listSelectedVersions(versions); cleanImpl(deletableVersions); List<DatasetVersion> allVersions = Lists.newArrayList(); for (T ver : versions) { allVersions.add(ver); // depends on control dependency: [for], data = [ver] } for (RetentionAction retentionAction : versionFinderAndPolicy.getRetentionActions()) { try { retentionAction.execute(allVersions); // depends on control dependency: [try], data = [none] } catch (Throwable t) { atLeastOneFailureSeen = true; log.error(String.format("RetentionAction %s failed for dataset %s", retentionAction.getClass().getName(), this.datasetRoot()), t); } // depends on control dependency: [catch], data = [none] } } if (atLeastOneFailureSeen) { throw new RuntimeException(String.format( "At least one failure happened while processing %s. Look for previous logs for failures", datasetRoot())); } } }
public class class_name { public EEnum getIfcTubeBundleTypeEnum() { if (ifcTubeBundleTypeEnumEEnum == null) { ifcTubeBundleTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(922); } return ifcTubeBundleTypeEnumEEnum; } }
public class class_name { public EEnum getIfcTubeBundleTypeEnum() { if (ifcTubeBundleTypeEnumEEnum == null) { ifcTubeBundleTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(922); // depends on control dependency: [if], data = [none] } return ifcTubeBundleTypeEnumEEnum; } }