code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected void populateCounterValues(Map<String, Metric> operations, Map<String, Counter> rpcInvocations, HttpServletRequest request) { for (Map.Entry<String, Metric> entry : operations.entrySet()) { if (entry.getValue() instanceof Gauge) { request.setAttribute(entry.getKey(), ((Gauge<?>) entry.getValue()).getValue()); } else if (entry.getValue() instanceof Counter) { request.setAttribute(entry.getKey(), ((Counter) entry.getValue()).getCount()); } } for (Map.Entry<String, Counter> entry : rpcInvocations.entrySet()) { request.setAttribute(entry.getKey(), entry.getValue().getCount()); } } }
public class class_name { protected void populateCounterValues(Map<String, Metric> operations, Map<String, Counter> rpcInvocations, HttpServletRequest request) { for (Map.Entry<String, Metric> entry : operations.entrySet()) { if (entry.getValue() instanceof Gauge) { request.setAttribute(entry.getKey(), ((Gauge<?>) entry.getValue()).getValue()); // depends on control dependency: [if], data = [none] } else if (entry.getValue() instanceof Counter) { request.setAttribute(entry.getKey(), ((Counter) entry.getValue()).getCount()); // depends on control dependency: [if], data = [none] } } for (Map.Entry<String, Counter> entry : rpcInvocations.entrySet()) { request.setAttribute(entry.getKey(), entry.getValue().getCount()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public void addEm(String sessionToken, EntityManager em) { if (emMap == null) { emMap = new HashMap<String, EntityManager>(); } emMap.put(sessionToken, em); } }
public class class_name { public void addEm(String sessionToken, EntityManager em) { if (emMap == null) { emMap = new HashMap<String, EntityManager>(); // depends on control dependency: [if], data = [none] } emMap.put(sessionToken, em); } }
public class class_name { @VisibleForTesting Counter getCounter(Level level, StackTraceElement stackTraceElement) { final String fullyQualifiedClassName = changePeriodsToDashes(stackTraceElement.getClassName()); //final String lineNumber = Integer.toString(stackTraceElement.getLineNumber()); @SuppressWarnings("UnnecessaryLocalVariable") final String key = fullyQualifiedClassName/* + ':' + lineNumber*/; if (!ERRORS_COUNTERS.containsKey(key)) { final Counter counter = factory.createCounter( metricObjects, subsystem, fullyQualifiedClassName, /*lineNumber, */level.toString()); // It is possible but highly unlikely that two threads are in this if() block at the same time; if that // occurs, only one of the calls to ERRORS_COUNTERS.putIfAbsent(hashCode, counter) in the next line of code // will succeed, but the increment of the thread whose call did not succeed will not be lost, because the // value returned by this method will be the Counter put successfully by the other thread. ERRORS_COUNTERS.putIfAbsent(key, counter); } return ERRORS_COUNTERS.get(key); } }
public class class_name { @VisibleForTesting Counter getCounter(Level level, StackTraceElement stackTraceElement) { final String fullyQualifiedClassName = changePeriodsToDashes(stackTraceElement.getClassName()); //final String lineNumber = Integer.toString(stackTraceElement.getLineNumber()); @SuppressWarnings("UnnecessaryLocalVariable") final String key = fullyQualifiedClassName/* + ':' + lineNumber*/; if (!ERRORS_COUNTERS.containsKey(key)) { final Counter counter = factory.createCounter( metricObjects, subsystem, fullyQualifiedClassName, /*lineNumber, */level.toString()); // It is possible but highly unlikely that two threads are in this if() block at the same time; if that // occurs, only one of the calls to ERRORS_COUNTERS.putIfAbsent(hashCode, counter) in the next line of code // will succeed, but the increment of the thread whose call did not succeed will not be lost, because the // value returned by this method will be the Counter put successfully by the other thread. ERRORS_COUNTERS.putIfAbsent(key, counter); // depends on control dependency: [if], data = [none] } return ERRORS_COUNTERS.get(key); } }
public class class_name { private boolean printMissingRules(CollectRulesVisitor visitor) { Set<String> missingConcepts = visitor.getMissingConcepts(); if (!missingConcepts.isEmpty()) { logger.info("Missing concepts [" + missingConcepts.size() + "]"); for (String missingConcept : missingConcepts) { logger.warn(LOG_LINE_PREFIX + missingConcept); } } Set<String> missingConstraints = visitor.getMissingConstraints(); if (!missingConstraints.isEmpty()) { logger.info("Missing constraints [" + missingConstraints.size() + "]"); for (String missingConstraint : missingConstraints) { logger.warn(LOG_LINE_PREFIX + missingConstraint); } } Set<String> missingGroups = visitor.getMissingGroups(); if (!missingGroups.isEmpty()) { logger.info("Missing groups [" + missingGroups.size() + "]"); for (String missingGroup : missingGroups) { logger.warn(LOG_LINE_PREFIX + missingGroup); } } return missingConcepts.isEmpty() && missingConstraints.isEmpty() && missingGroups.isEmpty(); } }
public class class_name { private boolean printMissingRules(CollectRulesVisitor visitor) { Set<String> missingConcepts = visitor.getMissingConcepts(); if (!missingConcepts.isEmpty()) { logger.info("Missing concepts [" + missingConcepts.size() + "]"); // depends on control dependency: [if], data = [none] for (String missingConcept : missingConcepts) { logger.warn(LOG_LINE_PREFIX + missingConcept); // depends on control dependency: [for], data = [missingConcept] } } Set<String> missingConstraints = visitor.getMissingConstraints(); if (!missingConstraints.isEmpty()) { logger.info("Missing constraints [" + missingConstraints.size() + "]"); // depends on control dependency: [if], data = [none] for (String missingConstraint : missingConstraints) { logger.warn(LOG_LINE_PREFIX + missingConstraint); // depends on control dependency: [for], data = [missingConstraint] } } Set<String> missingGroups = visitor.getMissingGroups(); if (!missingGroups.isEmpty()) { logger.info("Missing groups [" + missingGroups.size() + "]"); // depends on control dependency: [if], data = [none] for (String missingGroup : missingGroups) { logger.warn(LOG_LINE_PREFIX + missingGroup); // depends on control dependency: [for], data = [missingGroup] } } return missingConcepts.isEmpty() && missingConstraints.isEmpty() && missingGroups.isEmpty(); } }
public class class_name { private IAtomContainer setAntiFlags(IAtomContainer container, IAtomContainer ac, int number, boolean b) { IBond bond = ac.getBond(number); if (!container.contains(bond)) { bond.setFlag(CDKConstants.REACTIVE_CENTER, b); bond.getBegin().setFlag(CDKConstants.REACTIVE_CENTER, b); bond.getEnd().setFlag(CDKConstants.REACTIVE_CENTER, b); } else return null; return ac; } }
public class class_name { private IAtomContainer setAntiFlags(IAtomContainer container, IAtomContainer ac, int number, boolean b) { IBond bond = ac.getBond(number); if (!container.contains(bond)) { bond.setFlag(CDKConstants.REACTIVE_CENTER, b); // depends on control dependency: [if], data = [none] bond.getBegin().setFlag(CDKConstants.REACTIVE_CENTER, b); // depends on control dependency: [if], data = [none] bond.getEnd().setFlag(CDKConstants.REACTIVE_CENTER, b); // depends on control dependency: [if], data = [none] } else return null; return ac; } }
public class class_name { private org.apache.log4j.Level toLog4j(Level level) { if (Level.SEVERE == level) { return org.apache.log4j.Level.ERROR; } else if (Level.WARNING == level) { return org.apache.log4j.Level.WARN; } else if (Level.INFO == level) { return org.apache.log4j.Level.INFO; } else if (Level.FINE == level) { return org.apache.log4j.Level.DEBUG; } else if (Level.FINER == level) { return org.apache.log4j.Level.TRACE; } else if (Level.OFF == level) { return org.apache.log4j.Level.OFF; } return org.apache.log4j.Level.OFF; } }
public class class_name { private org.apache.log4j.Level toLog4j(Level level) { if (Level.SEVERE == level) { return org.apache.log4j.Level.ERROR; // depends on control dependency: [if], data = [none] } else if (Level.WARNING == level) { return org.apache.log4j.Level.WARN; // depends on control dependency: [if], data = [none] } else if (Level.INFO == level) { return org.apache.log4j.Level.INFO; // depends on control dependency: [if], data = [none] } else if (Level.FINE == level) { return org.apache.log4j.Level.DEBUG; // depends on control dependency: [if], data = [none] } else if (Level.FINER == level) { return org.apache.log4j.Level.TRACE; // depends on control dependency: [if], data = [none] } else if (Level.OFF == level) { return org.apache.log4j.Level.OFF; // depends on control dependency: [if], data = [none] } return org.apache.log4j.Level.OFF; } }
public class class_name { private void setNegotiatedExtensions(String extensionsHeader) { if ((extensionsHeader == null) || (extensionsHeader.trim().length() == 0)) { _negotiatedExtensions = null; return; } String[] extns = extensionsHeader.split(","); List<String> extnNames = new ArrayList<String>(); for (String extn : extns) { String[] properties = extn.split(";"); String extnName = properties[0].trim(); if (!getEnabledExtensions().contains(extnName)) { String s = String.format("Extension '%s' is not an enabled " + "extension so it should not have been negotiated", extnName); setException(new WebSocketException(s)); return; } WebSocketExtension extension = WebSocketExtension.getWebSocketExtension(extnName); WsExtensionParameterValuesSpiImpl paramValues = _negotiatedParameters.get(extnName); Collection<Parameter<?>> anonymousParams = extension.getParameters(Metadata.ANONYMOUS); // Start from the second(0-based) property to parse the name-value // pairs as the first(or 0th) is the extension name. for (int i = 1; i < properties.length; i++) { String property = properties[i].trim(); String[] pair = property.split("="); Parameter<?> parameter = null; String paramValue = null; if (pair.length == 1) { // We are dealing with an anonymous parameter. Since the // Collection is actually an ArrayList, we are guaranteed to // iterate the parameters in the definition/creation order. // As there is no parameter name, we will just get the next // anonymous Parameter instance and use it for setting the // value. The onus is on the extension implementor to either // use only named parameters or ensure that the anonymous // parameters are defined in the order in which the server // will send them back during negotiation. parameter = anonymousParams.iterator().next(); paramValue = pair[0].trim(); } else { parameter = extension.getParameter(pair[0].trim()); paramValue = pair[1].trim(); } if (parameter.type() != String.class) { String paramName = parameter.name(); String s = String.format("Negotiated Extension '%s': " + "Type of parameter '%s' should be String", extnName, paramName); setException(new WebSocketException(s)); return; } if (paramValues == null) { paramValues = new WsExtensionParameterValuesSpiImpl(); _negotiatedParameters.put(extnName, paramValues); } paramValues.setParameterValue(parameter, paramValue); } extnNames.add(extnName); } HashSet<String> extnsSet = new HashSet<String>(extnNames); _negotiatedExtensions = unmodifiableCollection(extnsSet); } }
public class class_name { private void setNegotiatedExtensions(String extensionsHeader) { if ((extensionsHeader == null) || (extensionsHeader.trim().length() == 0)) { _negotiatedExtensions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } String[] extns = extensionsHeader.split(","); List<String> extnNames = new ArrayList<String>(); for (String extn : extns) { String[] properties = extn.split(";"); String extnName = properties[0].trim(); if (!getEnabledExtensions().contains(extnName)) { String s = String.format("Extension '%s' is not an enabled " + "extension so it should not have been negotiated", extnName); setException(new WebSocketException(s)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } WebSocketExtension extension = WebSocketExtension.getWebSocketExtension(extnName); WsExtensionParameterValuesSpiImpl paramValues = _negotiatedParameters.get(extnName); Collection<Parameter<?>> anonymousParams = extension.getParameters(Metadata.ANONYMOUS); // depends on control dependency: [for], data = [none] // Start from the second(0-based) property to parse the name-value // pairs as the first(or 0th) is the extension name. for (int i = 1; i < properties.length; i++) { String property = properties[i].trim(); String[] pair = property.split("="); Parameter<?> parameter = null; String paramValue = null; if (pair.length == 1) { // We are dealing with an anonymous parameter. Since the // Collection is actually an ArrayList, we are guaranteed to // iterate the parameters in the definition/creation order. // As there is no parameter name, we will just get the next // anonymous Parameter instance and use it for setting the // value. The onus is on the extension implementor to either // use only named parameters or ensure that the anonymous // parameters are defined in the order in which the server // will send them back during negotiation. parameter = anonymousParams.iterator().next(); // depends on control dependency: [if], data = [none] paramValue = pair[0].trim(); // depends on control dependency: [if], data = [none] } else { parameter = extension.getParameter(pair[0].trim()); // depends on control dependency: [if], data = [none] paramValue = pair[1].trim(); // depends on control dependency: [if], data = [none] } if (parameter.type() != String.class) { String paramName = parameter.name(); String s = String.format("Negotiated Extension '%s': " + "Type of parameter '%s' should be String", extnName, paramName); setException(new WebSocketException(s)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (paramValues == null) { paramValues = new WsExtensionParameterValuesSpiImpl(); // depends on control dependency: [if], data = [none] _negotiatedParameters.put(extnName, paramValues); // depends on control dependency: [if], data = [none] } paramValues.setParameterValue(parameter, paramValue); // depends on control dependency: [for], data = [none] } extnNames.add(extnName); // depends on control dependency: [for], data = [extn] } HashSet<String> extnsSet = new HashSet<String>(extnNames); _negotiatedExtensions = unmodifiableCollection(extnsSet); } }
public class class_name { public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug) { // Server debug mode String sDebug = Boolean.toString (bServerDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug); // Client debug mode sDebug = Boolean.toString (bClientDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug); // Enlarge dump size if (bServerDebug || bClientDebug) { final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue); } else { SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold"); SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold"); } } }
public class class_name { public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug) { // Server debug mode String sDebug = Boolean.toString (bServerDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug); // Client debug mode sDebug = Boolean.toString (bClientDebug); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug); SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug); // Enlarge dump size if (bServerDebug || bClientDebug) { final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE); SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue); // depends on control dependency: [if], data = [none] SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue); // depends on control dependency: [if], data = [none] } else { SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold"); // depends on control dependency: [if], data = [none] SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ViewHolder findViewHolderForItemId(long id) { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder != null && holder.getItemId() == id) { return holder; } } return mRecycler.findViewHolderForItemId(id); } }
public class class_name { public ViewHolder findViewHolderForItemId(long id) { final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder != null && holder.getItemId() == id) { return holder; // depends on control dependency: [if], data = [none] } } return mRecycler.findViewHolderForItemId(id); } }
public class class_name { public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value, WritableRaster[] writableRasterHolder ) { RegionMap regionMap = getRegionParamsFromGridCoverage(template); double xRes = regionMap.getXres(); double yRes = regionMap.getYres(); double west = subregion.getMinX(); double south = subregion.getMinY(); double east = subregion.getMaxX(); double north = subregion.getMaxY(); int cols = (int) ((east - west) / xRes); int rows = (int) ((north - south) / yRes); ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0}); WritableRaster writableRaster = RasterFactory.createWritableRaster(sampleModel, null); if (value != null) { // autobox only once double v = value; for( int y = 0; y < rows; y++ ) { for( int x = 0; x < cols; x++ ) { writableRaster.setSample(x, y, 0, v); } } } if (writableRasterHolder != null) writableRasterHolder[0] = writableRaster; Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create("newraster", writableRaster, writeEnvelope); return coverage2D; } }
public class class_name { public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value, WritableRaster[] writableRasterHolder ) { RegionMap regionMap = getRegionParamsFromGridCoverage(template); double xRes = regionMap.getXres(); double yRes = regionMap.getYres(); double west = subregion.getMinX(); double south = subregion.getMinY(); double east = subregion.getMaxX(); double north = subregion.getMaxY(); int cols = (int) ((east - west) / xRes); int rows = (int) ((north - south) / yRes); ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0}); WritableRaster writableRaster = RasterFactory.createWritableRaster(sampleModel, null); if (value != null) { // autobox only once double v = value; for( int y = 0; y < rows; y++ ) { for( int x = 0; x < cols; x++ ) { writableRaster.setSample(x, y, 0, v); // depends on control dependency: [for], data = [x] } } } if (writableRasterHolder != null) writableRasterHolder[0] = writableRaster; Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west, north - south); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D coverage2D = factory.create("newraster", writableRaster, writeEnvelope); return coverage2D; } }
public class class_name { private static boolean implementsMap(ClassDescriptor d) { while (d != null) { try { // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration if ("java.util.EnumMap".equals(d.getDottedClassName())) { return false; } // True if variable is itself declared as a Map if ("java.util.Map".equals(d.getDottedClassName())) { return true; } XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d); ClassDescriptor is[] = classNameAndInfo.getInterfaceDescriptorList(); d = classNameAndInfo.getSuperclassDescriptor(); for (ClassDescriptor i : is) { if ("java.util.Map".equals(i.getDottedClassName())) { return true; } } } catch (CheckedAnalysisException e) { d = null; } } return false; } }
public class class_name { private static boolean implementsMap(ClassDescriptor d) { while (d != null) { try { // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration if ("java.util.EnumMap".equals(d.getDottedClassName())) { return false; // depends on control dependency: [if], data = [none] } // True if variable is itself declared as a Map if ("java.util.Map".equals(d.getDottedClassName())) { return true; // depends on control dependency: [if], data = [none] } XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d); ClassDescriptor is[] = classNameAndInfo.getInterfaceDescriptorList(); d = classNameAndInfo.getSuperclassDescriptor(); // depends on control dependency: [try], data = [none] for (ClassDescriptor i : is) { if ("java.util.Map".equals(i.getDottedClassName())) { return true; // depends on control dependency: [if], data = [none] } } } catch (CheckedAnalysisException e) { d = null; } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { public void commitMeasurements() { if (!getFilter().noMeasurementsAvailable()) { double runningAverage = getFilter().calculateRssi(); mBeacon.setRunningAverageRssi(runningAverage); mBeacon.setRssiMeasurementCount(getFilter().getMeasurementCount()); LogManager.d(TAG, "calculated new runningAverageRssi: %s", runningAverage); } else { LogManager.d(TAG, "No measurements available to calculate running average"); } mBeacon.setPacketCount(packetCount); packetCount = 0; } }
public class class_name { public void commitMeasurements() { if (!getFilter().noMeasurementsAvailable()) { double runningAverage = getFilter().calculateRssi(); mBeacon.setRunningAverageRssi(runningAverage); // depends on control dependency: [if], data = [none] mBeacon.setRssiMeasurementCount(getFilter().getMeasurementCount()); // depends on control dependency: [if], data = [none] LogManager.d(TAG, "calculated new runningAverageRssi: %s", runningAverage); // depends on control dependency: [if], data = [none] } else { LogManager.d(TAG, "No measurements available to calculate running average"); // depends on control dependency: [if], data = [none] } mBeacon.setPacketCount(packetCount); packetCount = 0; } }
public class class_name { public Observable<ServiceResponse<List<BatchLabelExample>>> batchWithServiceResponseAsync(UUID appId, String versionId, List<ExampleLabelObject> exampleLabelObjectArray) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (exampleLabelObjectArray == null) { throw new IllegalArgumentException("Parameter exampleLabelObjectArray is required and cannot be null."); } Validator.validate(exampleLabelObjectArray); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.batch(appId, versionId, exampleLabelObjectArray, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<BatchLabelExample>>>>() { @Override public Observable<ServiceResponse<List<BatchLabelExample>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<BatchLabelExample>> clientResponse = batchDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<List<BatchLabelExample>>> batchWithServiceResponseAsync(UUID appId, String versionId, List<ExampleLabelObject> exampleLabelObjectArray) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (exampleLabelObjectArray == null) { throw new IllegalArgumentException("Parameter exampleLabelObjectArray is required and cannot be null."); } Validator.validate(exampleLabelObjectArray); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.batch(appId, versionId, exampleLabelObjectArray, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<BatchLabelExample>>>>() { @Override public Observable<ServiceResponse<List<BatchLabelExample>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<BatchLabelExample>> clientResponse = batchDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static int lineEnd(ByteBuffer buffer, int maxLength) { int primitivePosition = buffer.position(); boolean canEnd = false; int charIndex = primitivePosition; byte b; while (buffer.hasRemaining()) { b = buffer.get(); charIndex++; if (b == StrUtil.C_CR) { canEnd = true; } else if (b == StrUtil.C_LF) { return canEnd ? charIndex - 2 : charIndex - 1; } else { // 只有\r无法确认换行 canEnd = false; } if (charIndex - primitivePosition > maxLength) { // 查找到尽头,未找到,还原位置 buffer.position(primitivePosition); throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength)); } } // 查找到buffer尽头,未找到,还原位置 buffer.position(primitivePosition); // 读到结束位置 return -1; } }
public class class_name { public static int lineEnd(ByteBuffer buffer, int maxLength) { int primitivePosition = buffer.position(); boolean canEnd = false; int charIndex = primitivePosition; byte b; while (buffer.hasRemaining()) { b = buffer.get(); // depends on control dependency: [while], data = [none] charIndex++; // depends on control dependency: [while], data = [none] if (b == StrUtil.C_CR) { canEnd = true; // depends on control dependency: [if], data = [none] } else if (b == StrUtil.C_LF) { return canEnd ? charIndex - 2 : charIndex - 1; // depends on control dependency: [if], data = [none] } else { // 只有\r无法确认换行 canEnd = false; // depends on control dependency: [if], data = [none] } if (charIndex - primitivePosition > maxLength) { // 查找到尽头,未找到,还原位置 buffer.position(primitivePosition); // depends on control dependency: [if], data = [none] throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength)); } } // 查找到buffer尽头,未找到,还原位置 buffer.position(primitivePosition); // 读到结束位置 return -1; } }
public class class_name { @Override public boolean hasPermission(User user, E entity, Permission permission) { // always grant READ access to own user object (of the logged in user) if (user != null && user.equals(entity) && permission.equals(Permission.READ)) { LOG.trace("Granting READ access on own user object"); return true; } // call parent implementation return super.hasPermission(user, entity, permission); } }
public class class_name { @Override public boolean hasPermission(User user, E entity, Permission permission) { // always grant READ access to own user object (of the logged in user) if (user != null && user.equals(entity) && permission.equals(Permission.READ)) { LOG.trace("Granting READ access on own user object"); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // call parent implementation return super.hasPermission(user, entity, permission); } }
public class class_name { @SuppressWarnings("unchecked") private void fixGetSet(HashMap<String, HashMap> propertyTable) { if (propertyTable == null) { return; } for (Map.Entry<String, HashMap> entry : propertyTable.entrySet()) { HashMap<String, Object> table = entry.getValue(); ArrayList<Method> getters = (ArrayList<Method>) table.get(STR_GETTERS); ArrayList<Method> setters = (ArrayList<Method>) table.get(STR_SETTERS); Method normalGetter = null; Method normalSetter = null; Class<?> normalPropType = null; if (getters == null) { getters = new ArrayList<>(); } if (setters == null) { setters = new ArrayList<>(); } // retrieve getters Class<?>[] paramTypes; String methodName; for (Method getter : getters) { paramTypes = getter.getParameterTypes(); methodName = getter.getName(); // checks if it's a normal getter if (paramTypes == null || paramTypes.length == 0) { // normal getter found if (normalGetter == null || methodName.startsWith(PREFIX_IS)) { normalGetter = getter; } } } // retrieve normal setter if (normalGetter != null) { // Now we will try to look for normal setter of the same type. Class<?> propertyType = normalGetter.getReturnType(); for (Method setter : setters) { if (setter.getParameterTypes().length == 1 && propertyType.equals(setter.getParameterTypes()[0])) { normalSetter = setter; break; } } } else { // Normal getter wasn't defined. Let's look for the last // defined setter for (Method setter : setters) { if (setter.getParameterTypes().length == 1) { normalSetter = setter; } } } // determine property type if (normalGetter != null) { normalPropType = normalGetter.getReturnType(); } else if (normalSetter != null) { normalPropType = normalSetter.getParameterTypes()[0]; } // RULES // These rules were created after performing extensive black-box // testing of RI // RULE1 // Both normal getter and setter of the same type were defined; // no indexed getter/setter *PAIR* of the other type defined if (normalGetter != null && normalSetter != null) { table.put(STR_NORMAL, STR_VALID); table.put(STR_NORMAL + PREFIX_GET, normalGetter); table.put(STR_NORMAL + PREFIX_SET, normalSetter); table.put(STR_NORMAL + STR_PROPERTY_TYPE, normalPropType); continue; } // RULE2 // normal getter and/or setter was defined; no indexed // getters & setters defined if ((normalGetter != null || normalSetter != null)) { table.put(STR_NORMAL, STR_VALID); table.put(STR_NORMAL + PREFIX_GET, normalGetter); table.put(STR_NORMAL + PREFIX_SET, normalSetter); table.put(STR_NORMAL + STR_PROPERTY_TYPE, normalPropType); continue; } // default rule - invalid property table.put(STR_NORMAL, STR_INVALID); } } }
public class class_name { @SuppressWarnings("unchecked") private void fixGetSet(HashMap<String, HashMap> propertyTable) { if (propertyTable == null) { return; // depends on control dependency: [if], data = [none] } for (Map.Entry<String, HashMap> entry : propertyTable.entrySet()) { HashMap<String, Object> table = entry.getValue(); ArrayList<Method> getters = (ArrayList<Method>) table.get(STR_GETTERS); ArrayList<Method> setters = (ArrayList<Method>) table.get(STR_SETTERS); Method normalGetter = null; Method normalSetter = null; Class<?> normalPropType = null; // depends on control dependency: [for], data = [none] if (getters == null) { getters = new ArrayList<>(); // depends on control dependency: [if], data = [none] } if (setters == null) { setters = new ArrayList<>(); // depends on control dependency: [if], data = [none] } // retrieve getters Class<?>[] paramTypes; String methodName; for (Method getter : getters) { paramTypes = getter.getParameterTypes(); // depends on control dependency: [for], data = [getter] methodName = getter.getName(); // depends on control dependency: [for], data = [getter] // checks if it's a normal getter if (paramTypes == null || paramTypes.length == 0) { // normal getter found if (normalGetter == null || methodName.startsWith(PREFIX_IS)) { normalGetter = getter; // depends on control dependency: [if], data = [none] } } } // retrieve normal setter if (normalGetter != null) { // Now we will try to look for normal setter of the same type. Class<?> propertyType = normalGetter.getReturnType(); for (Method setter : setters) { if (setter.getParameterTypes().length == 1 && propertyType.equals(setter.getParameterTypes()[0])) { normalSetter = setter; // depends on control dependency: [if], data = [none] break; } } } else { // Normal getter wasn't defined. Let's look for the last // defined setter for (Method setter : setters) { if (setter.getParameterTypes().length == 1) { normalSetter = setter; // depends on control dependency: [if], data = [none] } } } // determine property type if (normalGetter != null) { normalPropType = normalGetter.getReturnType(); // depends on control dependency: [if], data = [none] } else if (normalSetter != null) { normalPropType = normalSetter.getParameterTypes()[0]; // depends on control dependency: [if], data = [none] } // RULES // These rules were created after performing extensive black-box // testing of RI // RULE1 // Both normal getter and setter of the same type were defined; // no indexed getter/setter *PAIR* of the other type defined if (normalGetter != null && normalSetter != null) { table.put(STR_NORMAL, STR_VALID); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + PREFIX_GET, normalGetter); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + PREFIX_SET, normalSetter); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + STR_PROPERTY_TYPE, normalPropType); // depends on control dependency: [if], data = [none] continue; } // RULE2 // normal getter and/or setter was defined; no indexed // getters & setters defined if ((normalGetter != null || normalSetter != null)) { table.put(STR_NORMAL, STR_VALID); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + PREFIX_GET, normalGetter); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + PREFIX_SET, normalSetter); // depends on control dependency: [if], data = [none] table.put(STR_NORMAL + STR_PROPERTY_TYPE, normalPropType); // depends on control dependency: [if], data = [none] continue; } // default rule - invalid property table.put(STR_NORMAL, STR_INVALID); // depends on control dependency: [for], data = [none] } } }
public class class_name { public Observable<ServiceResponse<SearchResponse>> searchWithServiceResponseAsync(String query, String acceptLanguage, String pragma, String userAgent, String clientId, String clientIp, String location, String countryCode, String market, List<AnswerType> responseFilter, List<ResponseFormat> responseFormat, SafeSearch safeSearch, String setLang) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } Validator.validate(responseFilter); Validator.validate(responseFormat); final String xBingApisSDK = "true"; String responseFilterConverted = this.client.serializerAdapter().serializeList(responseFilter, CollectionFormat.CSV); String responseFormatConverted = this.client.serializerAdapter().serializeList(responseFormat, CollectionFormat.CSV); return service.search(xBingApisSDK, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, query, responseFilterConverted, responseFormatConverted, safeSearch, setLang) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SearchResponse>>>() { @Override public Observable<ServiceResponse<SearchResponse>> call(Response<ResponseBody> response) { try { ServiceResponse<SearchResponse> clientResponse = searchDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<SearchResponse>> searchWithServiceResponseAsync(String query, String acceptLanguage, String pragma, String userAgent, String clientId, String clientIp, String location, String countryCode, String market, List<AnswerType> responseFilter, List<ResponseFormat> responseFormat, SafeSearch safeSearch, String setLang) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } Validator.validate(responseFilter); Validator.validate(responseFormat); final String xBingApisSDK = "true"; String responseFilterConverted = this.client.serializerAdapter().serializeList(responseFilter, CollectionFormat.CSV); String responseFormatConverted = this.client.serializerAdapter().serializeList(responseFormat, CollectionFormat.CSV); return service.search(xBingApisSDK, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, query, responseFilterConverted, responseFormatConverted, safeSearch, setLang) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SearchResponse>>>() { @Override public Observable<ServiceResponse<SearchResponse>> call(Response<ResponseBody> response) { try { ServiceResponse<SearchResponse> clientResponse = searchDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) { E pivot = array[end]; int index = start - 1; for(int j = start; j < end; j++) { if(array[j].compareTo(pivot) >= 0) { index++; TrivialSwap.swap(array, index, j); } } TrivialSwap.swap(array, index + 1, end); return index + 1; } }
public class class_name { private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) { E pivot = array[end]; int index = start - 1; for(int j = start; j < end; j++) { if(array[j].compareTo(pivot) >= 0) { index++; // depends on control dependency: [if], data = [none] TrivialSwap.swap(array, index, j); // depends on control dependency: [if], data = [none] } } TrivialSwap.swap(array, index + 1, end); return index + 1; } }
public class class_name { public Container lazyIOR(Container x) { if (this instanceof ArrayContainer) { if (x instanceof ArrayContainer) { return ((ArrayContainer)this).lazyor((ArrayContainer) x); } else if (x instanceof BitmapContainer) { return ior((BitmapContainer) x); } return ((RunContainer) x).lazyor((ArrayContainer) this); } else if (this instanceof RunContainer) { if (x instanceof ArrayContainer) { return ((RunContainer) this).ilazyor((ArrayContainer) x); } else if (x instanceof BitmapContainer) { return ior((BitmapContainer) x); } return ior((RunContainer) x); } else { if (x instanceof ArrayContainer) { return ((BitmapContainer) this).ilazyor((ArrayContainer) x); } else if (x instanceof BitmapContainer) { return ((BitmapContainer) this).ilazyor((BitmapContainer) x); } return ((BitmapContainer) this).ilazyor((RunContainer) x); } } }
public class class_name { public Container lazyIOR(Container x) { if (this instanceof ArrayContainer) { if (x instanceof ArrayContainer) { return ((ArrayContainer)this).lazyor((ArrayContainer) x); // depends on control dependency: [if], data = [none] } else if (x instanceof BitmapContainer) { return ior((BitmapContainer) x); // depends on control dependency: [if], data = [none] } return ((RunContainer) x).lazyor((ArrayContainer) this); // depends on control dependency: [if], data = [none] } else if (this instanceof RunContainer) { if (x instanceof ArrayContainer) { return ((RunContainer) this).ilazyor((ArrayContainer) x); // depends on control dependency: [if], data = [none] } else if (x instanceof BitmapContainer) { return ior((BitmapContainer) x); // depends on control dependency: [if], data = [none] } return ior((RunContainer) x); // depends on control dependency: [if], data = [none] } else { if (x instanceof ArrayContainer) { return ((BitmapContainer) this).ilazyor((ArrayContainer) x); // depends on control dependency: [if], data = [none] } else if (x instanceof BitmapContainer) { return ((BitmapContainer) this).ilazyor((BitmapContainer) x); // depends on control dependency: [if], data = [none] } return ((BitmapContainer) this).ilazyor((RunContainer) x); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(GetClientCertificateRequest getClientCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (getClientCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getClientCertificateRequest.getClientCertificateId(), CLIENTCERTIFICATEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetClientCertificateRequest getClientCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (getClientCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getClientCertificateRequest.getClientCertificateId(), CLIENTCERTIFICATEID_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 EEnum getIfcTimeSeriesScheduleTypeEnum() { if (ifcTimeSeriesScheduleTypeEnumEEnum == null) { ifcTimeSeriesScheduleTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(917); } return ifcTimeSeriesScheduleTypeEnumEEnum; } }
public class class_name { public EEnum getIfcTimeSeriesScheduleTypeEnum() { if (ifcTimeSeriesScheduleTypeEnumEEnum == null) { ifcTimeSeriesScheduleTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(917); // depends on control dependency: [if], data = [none] } return ifcTimeSeriesScheduleTypeEnumEEnum; } }
public class class_name { public static List<Element> elements(Element element, String tagName) { if (element == null || !element.hasChildNodes()) { return Collections.emptyList(); } List<Element> elements = new ArrayList<Element>(); for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element) child; String childTagName = childElement.getNodeName(); if (tagName.equals(childTagName)) elements.add(childElement); } } return elements; } }
public class class_name { public static List<Element> elements(Element element, String tagName) { if (element == null || !element.hasChildNodes()) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<Element> elements = new ArrayList<Element>(); for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element) child; String childTagName = childElement.getNodeName(); if (tagName.equals(childTagName)) elements.add(childElement); } } return elements; } }
public class class_name { public void marshall(RoutingProfileSummary routingProfileSummary, ProtocolMarshaller protocolMarshaller) { if (routingProfileSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(routingProfileSummary.getId(), ID_BINDING); protocolMarshaller.marshall(routingProfileSummary.getArn(), ARN_BINDING); protocolMarshaller.marshall(routingProfileSummary.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RoutingProfileSummary routingProfileSummary, ProtocolMarshaller protocolMarshaller) { if (routingProfileSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(routingProfileSummary.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(routingProfileSummary.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(routingProfileSummary.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void writeMetaDataFile(Configuration configuration, Path outputPath) { JobSummaryLevel level = ParquetOutputFormat.getJobSummaryLevel(configuration); if (level == JobSummaryLevel.NONE) { return; } try { final FileSystem fileSystem = outputPath.getFileSystem(configuration); FileStatus outputStatus = fileSystem.getFileStatus(outputPath); List<Footer> footers; switch (level) { case ALL: footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, false); // don't skip row groups break; case COMMON_ONLY: footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, true); // skip row groups break; default: throw new IllegalArgumentException("Unrecognized job summary level: " + level); } // If there are no footers, _metadata file cannot be written since there is no way to determine schema! // Onus of writing any summary files lies with the caller in this case. if (footers.isEmpty()) { return; } try { ParquetFileWriter.writeMetadataFile(configuration, outputPath, footers, level); } catch (Exception e) { LOG.warn("could not write summary file(s) for " + outputPath, e); final Path metadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_METADATA_FILE); try { if (fileSystem.exists(metadataPath)) { fileSystem.delete(metadataPath, true); } } catch (Exception e2) { LOG.warn("could not delete metadata file" + outputPath, e2); } try { final Path commonMetadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_COMMON_METADATA_FILE); if (fileSystem.exists(commonMetadataPath)) { fileSystem.delete(commonMetadataPath, true); } } catch (Exception e2) { LOG.warn("could not delete metadata file" + outputPath, e2); } } } catch (Exception e) { LOG.warn("could not write summary file for " + outputPath, e); } } }
public class class_name { public static void writeMetaDataFile(Configuration configuration, Path outputPath) { JobSummaryLevel level = ParquetOutputFormat.getJobSummaryLevel(configuration); if (level == JobSummaryLevel.NONE) { return; // depends on control dependency: [if], data = [none] } try { final FileSystem fileSystem = outputPath.getFileSystem(configuration); FileStatus outputStatus = fileSystem.getFileStatus(outputPath); List<Footer> footers; switch (level) { case ALL: footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, false); // don't skip row groups break; case COMMON_ONLY: footers = ParquetFileReader.readAllFootersInParallel(configuration, outputStatus, true); // skip row groups break; default: throw new IllegalArgumentException("Unrecognized job summary level: " + level); } // If there are no footers, _metadata file cannot be written since there is no way to determine schema! // Onus of writing any summary files lies with the caller in this case. if (footers.isEmpty()) { return; // depends on control dependency: [if], data = [none] } try { ParquetFileWriter.writeMetadataFile(configuration, outputPath, footers, level); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.warn("could not write summary file(s) for " + outputPath, e); final Path metadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_METADATA_FILE); try { if (fileSystem.exists(metadataPath)) { fileSystem.delete(metadataPath, true); // depends on control dependency: [if], data = [none] } } catch (Exception e2) { LOG.warn("could not delete metadata file" + outputPath, e2); } // depends on control dependency: [catch], data = [none] try { final Path commonMetadataPath = new Path(outputPath, ParquetFileWriter.PARQUET_COMMON_METADATA_FILE); if (fileSystem.exists(commonMetadataPath)) { fileSystem.delete(commonMetadataPath, true); // depends on control dependency: [if], data = [none] } } catch (Exception e2) { LOG.warn("could not delete metadata file" + outputPath, e2); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } catch (Exception e) { LOG.warn("could not write summary file for " + outputPath, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SafeVarargs public static <T> Iterable<List<T>> cartesianProduct(final Iterable<T>... iterables) { if (iterables.length == 0) { return Collections.singletonList(Collections.emptyList()); } return () -> new AllCombinationsIterator<>(iterables); } }
public class class_name { @SafeVarargs public static <T> Iterable<List<T>> cartesianProduct(final Iterable<T>... iterables) { if (iterables.length == 0) { return Collections.singletonList(Collections.emptyList()); // depends on control dependency: [if], data = [none] } return () -> new AllCombinationsIterator<>(iterables); } }
public class class_name { public FileDeleteFromTaskOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public FileDeleteFromTaskOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }
public class class_name { public void setTime(final long time) { // need to check for null format due to Android java.util.Date(long) constructor // calling this method.. if (format != null) { super.setTime(Dates.round(time, precision, format.getTimeZone())); } else { // XXX: what do we do here?? super.setTime(time); } } }
public class class_name { public void setTime(final long time) { // need to check for null format due to Android java.util.Date(long) constructor // calling this method.. if (format != null) { super.setTime(Dates.round(time, precision, format.getTimeZone())); // depends on control dependency: [if], data = [none] } else { // XXX: what do we do here?? super.setTime(time); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void doPaintComponent(Graphics g) {/* * if (isOpaque() || isDesignTime()) { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); } */ if (isDesignTime()) { // do nothing } else { int z = getZoom(); Rectangle viewportBounds = getViewportBounds(); drawMapTiles(g, z, viewportBounds); drawOverlays(z, g, viewportBounds); } super.paintBorder(g); } }
public class class_name { private void doPaintComponent(Graphics g) {/* * if (isOpaque() || isDesignTime()) { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); } */ if (isDesignTime()) { // do nothing } else { int z = getZoom(); Rectangle viewportBounds = getViewportBounds(); drawMapTiles(g, z, viewportBounds); // depends on control dependency: [if], data = [none] drawOverlays(z, g, viewportBounds); // depends on control dependency: [if], data = [none] } super.paintBorder(g); } }
public class class_name { public void sendInBackground(final SendCallback callback) { sendInBackground().subscribe(new Observer<JSONObject>() { @Override public void onSubscribe(Disposable disposable) { } @Override public void onNext(JSONObject jsonObject) { notification = new AVObject("_Notification"); notification.resetServerData(jsonObject.getInnerMap()); if (null != callback) { callback.internalDone(null); } } @Override public void onError(Throwable throwable) { if (null != callback) { callback.internalDone(new AVException(throwable)); } } @Override public void onComplete() { } }); } }
public class class_name { public void sendInBackground(final SendCallback callback) { sendInBackground().subscribe(new Observer<JSONObject>() { @Override public void onSubscribe(Disposable disposable) { } @Override public void onNext(JSONObject jsonObject) { notification = new AVObject("_Notification"); notification.resetServerData(jsonObject.getInnerMap()); if (null != callback) { callback.internalDone(null); // depends on control dependency: [if], data = [(null] } } @Override public void onError(Throwable throwable) { if (null != callback) { callback.internalDone(new AVException(throwable)); // depends on control dependency: [if], data = [none] } } @Override public void onComplete() { } }); } }
public class class_name { public Long countByQueryFieldQueryRepliesInAndData(QueryField queryField, Collection<QueryReply> queryReplies, Double data) { if (queryReplies == null || queryReplies.isEmpty()) { return 0l; } EntityManager entityManager = getEntityManager(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteria = criteriaBuilder.createQuery(Long.class); Root<QueryQuestionNumericAnswer> root = criteria.from(QueryQuestionNumericAnswer.class); Join<QueryQuestionNumericAnswer, QueryReply> replyJoin = root.join(QueryQuestionNumericAnswer_.queryReply); criteria.select(criteriaBuilder.count(root)); criteria.where( criteriaBuilder.and( criteriaBuilder.equal(root.get(QueryQuestionNumericAnswer_.queryField), queryField), root.get(QueryQuestionNumericAnswer_.queryReply).in(queryReplies), criteriaBuilder.equal(root.get(QueryQuestionNumericAnswer_.data), data), criteriaBuilder.equal(replyJoin.get(QueryReply_.archived), Boolean.FALSE) ) ); return entityManager.createQuery(criteria).getSingleResult(); } }
public class class_name { public Long countByQueryFieldQueryRepliesInAndData(QueryField queryField, Collection<QueryReply> queryReplies, Double data) { if (queryReplies == null || queryReplies.isEmpty()) { return 0l; // depends on control dependency: [if], data = [none] } EntityManager entityManager = getEntityManager(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> criteria = criteriaBuilder.createQuery(Long.class); Root<QueryQuestionNumericAnswer> root = criteria.from(QueryQuestionNumericAnswer.class); Join<QueryQuestionNumericAnswer, QueryReply> replyJoin = root.join(QueryQuestionNumericAnswer_.queryReply); criteria.select(criteriaBuilder.count(root)); criteria.where( criteriaBuilder.and( criteriaBuilder.equal(root.get(QueryQuestionNumericAnswer_.queryField), queryField), root.get(QueryQuestionNumericAnswer_.queryReply).in(queryReplies), criteriaBuilder.equal(root.get(QueryQuestionNumericAnswer_.data), data), criteriaBuilder.equal(replyJoin.get(QueryReply_.archived), Boolean.FALSE) ) ); return entityManager.createQuery(criteria).getSingleResult(); } }
public class class_name { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latlon.getLatitude()); double theta = Math.toRadians(latlon.getLongitude()); if (projectionLongitude != 0 && !Double.isNaN(theta)) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); } ProjectionPointImpl out = new ProjectionPointImpl(); project(theta, fromLat, out); result.setLocation(totalScale * out.getX() + falseEasting, totalScale * out.getY() + falseNorthing); return result; } }
public class class_name { @Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latlon.getLatitude()); double theta = Math.toRadians(latlon.getLongitude()); if (projectionLongitude != 0 && !Double.isNaN(theta)) { theta = MapMath.normalizeLongitude(theta - projectionLongitude); // depends on control dependency: [if], data = [none] } ProjectionPointImpl out = new ProjectionPointImpl(); project(theta, fromLat, out); result.setLocation(totalScale * out.getX() + falseEasting, totalScale * out.getY() + falseNorthing); return result; } }
public class class_name { public final void addException(final SgClass clasz) { if (clasz == null) { throw new IllegalArgumentException("The argument 'clasz' cannot be null!"); } // TODO Check if any superclass is of type Exception. if (!exceptions.contains(clasz)) { exceptions.add(clasz); } } }
public class class_name { public final void addException(final SgClass clasz) { if (clasz == null) { throw new IllegalArgumentException("The argument 'clasz' cannot be null!"); } // TODO Check if any superclass is of type Exception. if (!exceptions.contains(clasz)) { exceptions.add(clasz); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") @Override public <T> T invoke(Object object, Object... args) throws AuthorizationException, IllegalArgumentException, InvocationException { if (remotelyAccessible && !isPublic() && !container.isAuthenticated()) { log.info("Reject not authenticated access to |%s|.", method); throw new AuthorizationException(); } // arguments processor converts <args> to empty array if it is null // it can be null if on invocation chain there is Proxy invoked with no arguments args = argumentsProcessor.preProcessArguments(this, args); if (object instanceof Proxy) { // if object is a Java Proxy does not apply method services implemented by below block // instead directly invoke Java method on the Proxy instance // container will call again this method but with the real object instance, in which case executes the next logic try { return (T) method.invoke(object, args); } catch (InvocationTargetException e) { throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { throw new BugError("Illegal access on method with accessibility set true."); } } if (meter == null) { try { return (T) invoker.invoke(object, args); } catch (InvocationTargetException e) { throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { throw new BugError("Illegal access on method with accessibility set true."); } } meter.incrementInvocationsCount(); meter.startProcessing(); T returnValue = null; try { returnValue = (T) invoker.invoke(object, args); } catch (InvocationTargetException e) { meter.incrementExceptionsCount(); throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { // this condition is a bug; do not increment exceptions count throw new BugError("Illegal access on method with accessibility set true."); } meter.stopProcessing(); return returnValue; } }
public class class_name { @SuppressWarnings("unchecked") @Override public <T> T invoke(Object object, Object... args) throws AuthorizationException, IllegalArgumentException, InvocationException { if (remotelyAccessible && !isPublic() && !container.isAuthenticated()) { log.info("Reject not authenticated access to |%s|.", method); // depends on control dependency: [if], data = [none] throw new AuthorizationException(); } // arguments processor converts <args> to empty array if it is null // it can be null if on invocation chain there is Proxy invoked with no arguments args = argumentsProcessor.preProcessArguments(this, args); if (object instanceof Proxy) { // if object is a Java Proxy does not apply method services implemented by below block // instead directly invoke Java method on the Proxy instance // container will call again this method but with the real object instance, in which case executes the next logic try { return (T) method.invoke(object, args); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new BugError("Illegal access on method with accessibility set true."); } // depends on control dependency: [catch], data = [none] } if (meter == null) { try { return (T) invoker.invoke(object, args); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new BugError("Illegal access on method with accessibility set true."); } // depends on control dependency: [catch], data = [none] } meter.incrementInvocationsCount(); meter.startProcessing(); T returnValue = null; try { returnValue = (T) invoker.invoke(object, args); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { meter.incrementExceptionsCount(); throw new InvocationException(e.getTargetException()); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] // this condition is a bug; do not increment exceptions count throw new BugError("Illegal access on method with accessibility set true."); } // depends on control dependency: [catch], data = [none] meter.stopProcessing(); return returnValue; } }
public class class_name { public static ApplicationClassLoader getJarApplicationClassLoader(String jarFilePath) { ApplicationClassLoader jarApplicationClassLoader = jarApplicationClassLoaderCache.get(jarFilePath); if (jarApplicationClassLoader != null) { return jarApplicationClassLoader; } synchronized (jarApplicationClassLoaderCache) { jarApplicationClassLoader = jarApplicationClassLoaderCache.get(jarFilePath); if (jarApplicationClassLoader != null) { return jarApplicationClassLoader; } jarApplicationClassLoader = new ApplicationClassLoader(nodeApplicationClassLoader, false); jarApplicationClassLoader.addJarFiles(jarFilePath); jarApplicationClassLoaderCache.put(jarFilePath, jarApplicationClassLoader); return jarApplicationClassLoader; } } }
public class class_name { public static ApplicationClassLoader getJarApplicationClassLoader(String jarFilePath) { ApplicationClassLoader jarApplicationClassLoader = jarApplicationClassLoaderCache.get(jarFilePath); if (jarApplicationClassLoader != null) { return jarApplicationClassLoader; // depends on control dependency: [if], data = [none] } synchronized (jarApplicationClassLoaderCache) { jarApplicationClassLoader = jarApplicationClassLoaderCache.get(jarFilePath); if (jarApplicationClassLoader != null) { return jarApplicationClassLoader; // depends on control dependency: [if], data = [none] } jarApplicationClassLoader = new ApplicationClassLoader(nodeApplicationClassLoader, false); jarApplicationClassLoader.addJarFiles(jarFilePath); jarApplicationClassLoaderCache.put(jarFilePath, jarApplicationClassLoader); return jarApplicationClassLoader; } } }
public class class_name { public Observable<ServiceResponse<DatabaseAccountInner>> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (updateParameters == null) { throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); } Validator.validate(updateParameters); return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DatabaseAccountInner>>>() { @Override public Observable<ServiceResponse<DatabaseAccountInner>> call(Response<ResponseBody> response) { try { ServiceResponse<DatabaseAccountInner> clientResponse = beginPatchDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<DatabaseAccountInner>> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (updateParameters == null) { throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); } Validator.validate(updateParameters); return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DatabaseAccountInner>>>() { @Override public Observable<ServiceResponse<DatabaseAccountInner>> call(Response<ResponseBody> response) { try { ServiceResponse<DatabaseAccountInner> clientResponse = beginPatchDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11") public List<TerrainType> getTerrain() { if (terrain == null) { terrain = new ArrayList<TerrainType>(); } return this.terrain; } }
public class class_name { @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11") public List<TerrainType> getTerrain() { if (terrain == null) { terrain = new ArrayList<TerrainType>(); // depends on control dependency: [if], data = [none] } return this.terrain; } }
public class class_name { void expectSuperType(Node n, ObjectType superObject, ObjectType subObject) { FunctionType subCtor = subObject.getConstructor(); ObjectType implicitProto = subObject.getImplicitPrototype(); ObjectType declaredSuper = implicitProto == null ? null : implicitProto.getImplicitPrototype(); if (declaredSuper != null && declaredSuper.isTemplatizedType()) { declaredSuper = declaredSuper.toMaybeTemplatizedType().getReferencedType(); } if (declaredSuper != null && !(superObject instanceof UnknownType) && !declaredSuper.isEquivalentTo(superObject)) { if (declaredSuper.isEquivalentTo(getNativeType(OBJECT_TYPE))) { registerMismatch( superObject, declaredSuper, report(JSError.make(n, MISSING_EXTENDS_TAG_WARNING, subObject.toString()))); } else { mismatch(n, "mismatch in declaration of superclass type", superObject, declaredSuper); } // Correct the super type. if (!subCtor.hasCachedValues()) { subCtor.setPrototypeBasedOn(superObject); } } } }
public class class_name { void expectSuperType(Node n, ObjectType superObject, ObjectType subObject) { FunctionType subCtor = subObject.getConstructor(); ObjectType implicitProto = subObject.getImplicitPrototype(); ObjectType declaredSuper = implicitProto == null ? null : implicitProto.getImplicitPrototype(); if (declaredSuper != null && declaredSuper.isTemplatizedType()) { declaredSuper = declaredSuper.toMaybeTemplatizedType().getReferencedType(); // depends on control dependency: [if], data = [none] } if (declaredSuper != null && !(superObject instanceof UnknownType) && !declaredSuper.isEquivalentTo(superObject)) { if (declaredSuper.isEquivalentTo(getNativeType(OBJECT_TYPE))) { registerMismatch( superObject, declaredSuper, report(JSError.make(n, MISSING_EXTENDS_TAG_WARNING, subObject.toString()))); // depends on control dependency: [if], data = [none] } else { mismatch(n, "mismatch in declaration of superclass type", superObject, declaredSuper); // depends on control dependency: [if], data = [none] } // Correct the super type. if (!subCtor.hasCachedValues()) { subCtor.setPrototypeBasedOn(superObject); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void cancelHadoopTokens(final Logger logger) { if (tokenFile == null) { return; } try { hadoopSecurityManager.cancelTokens(tokenFile, userToProxy, logger); } catch (HadoopSecurityManagerException e) { logger.error(e.getCause() + e.getMessage()); } catch (Exception e) { logger.error(e.getCause() + e.getMessage()); } if (tokenFile.exists()) { tokenFile.delete(); } } }
public class class_name { public void cancelHadoopTokens(final Logger logger) { if (tokenFile == null) { return; // depends on control dependency: [if], data = [none] } try { hadoopSecurityManager.cancelTokens(tokenFile, userToProxy, logger); // depends on control dependency: [try], data = [none] } catch (HadoopSecurityManagerException e) { logger.error(e.getCause() + e.getMessage()); } catch (Exception e) { // depends on control dependency: [catch], data = [none] logger.error(e.getCause() + e.getMessage()); } // depends on control dependency: [catch], data = [none] if (tokenFile.exists()) { tokenFile.delete(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Runnable getNextTask() { Runnable task = null; synchronized (this.tasks) { if (!this.tasks.isEmpty()) { task = this.tasks.poll(); if (this.tasks.isEmpty()) { this.tasks.notifyAll(); } } } return task; } }
public class class_name { private Runnable getNextTask() { Runnable task = null; synchronized (this.tasks) { if (!this.tasks.isEmpty()) { task = this.tasks.poll(); // depends on control dependency: [if], data = [none] if (this.tasks.isEmpty()) { this.tasks.notifyAll(); // depends on control dependency: [if], data = [none] } } } return task; } }
public class class_name { protected ID convertCookieUserKeyToUserId(String userKey) { final ID userId; try { userId = toTypedUserId(userKey); // as default (override if it needs) } catch (NumberFormatException e) { throw new LoginFailureException("Invalid user key (not ID): " + userKey, e); } return userId; } }
public class class_name { protected ID convertCookieUserKeyToUserId(String userKey) { final ID userId; try { userId = toTypedUserId(userKey); // as default (override if it needs) // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new LoginFailureException("Invalid user key (not ID): " + userKey, e); } // depends on control dependency: [catch], data = [none] return userId; } }
public class class_name { private Observable<HttpClientResponse<O>> submitToServerInURI( HttpClientRequest<I> request, IClientConfig requestConfig, ClientConfig config, RetryHandler errorHandler, ExecutionContext<HttpClientRequest<I>> context) { // First, determine server from the URI URI uri; try { uri = new URI(request.getUri()); } catch (URISyntaxException e) { return Observable.error(e); } String host = uri.getHost(); if (host == null) { return null; } int port = uri.getPort(); if (port < 0) { if (Optional.ofNullable(clientConfig.get(IClientConfigKey.Keys.IsSecure)).orElse(false)) { port = 443; } else { port = 80; } } return LoadBalancerCommand.<HttpClientResponse<O>>builder() .withRetryHandler(errorHandler) .withLoadBalancerContext(lbContext) .withListeners(listeners) .withExecutionContext(context) .withServer(new Server(host, port)) .build() .submit(this.requestToOperation(request, getRxClientConfig(requestConfig, config))); } }
public class class_name { private Observable<HttpClientResponse<O>> submitToServerInURI( HttpClientRequest<I> request, IClientConfig requestConfig, ClientConfig config, RetryHandler errorHandler, ExecutionContext<HttpClientRequest<I>> context) { // First, determine server from the URI URI uri; try { uri = new URI(request.getUri()); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { return Observable.error(e); } // depends on control dependency: [catch], data = [none] String host = uri.getHost(); if (host == null) { return null; // depends on control dependency: [if], data = [none] } int port = uri.getPort(); if (port < 0) { if (Optional.ofNullable(clientConfig.get(IClientConfigKey.Keys.IsSecure)).orElse(false)) { port = 443; // depends on control dependency: [if], data = [none] } else { port = 80; // depends on control dependency: [if], data = [none] } } return LoadBalancerCommand.<HttpClientResponse<O>>builder() .withRetryHandler(errorHandler) .withLoadBalancerContext(lbContext) .withListeners(listeners) .withExecutionContext(context) .withServer(new Server(host, port)) .build() .submit(this.requestToOperation(request, getRxClientConfig(requestConfig, config))); } }
public class class_name { void checkWithinBounds(InferenceContext inferenceContext, Warner warn) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars); List<Type> saved_undet = inferenceContext.save(); try { while (true) { mlistener.reset(); if (!allowGraphInference) { //in legacy mode we lack of transitivity, so bound check //cannot be run in parallel with other incoprporation rounds for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn); } } for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; //bound incorporation EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy; for (IncorporationStep is : incorporationSteps) { if (is.accepts(uv, inferenceContext)) { is.apply(uv, inferenceContext, warn); } } } if (!mlistener.changed || !allowGraphInference) break; } } finally { mlistener.detach(); if (incorporationCache.size() == MAX_INCORPORATION_STEPS) { inferenceContext.rollback(saved_undet); } incorporationCache.clear(); } } }
public class class_name { void checkWithinBounds(InferenceContext inferenceContext, Warner warn) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars); List<Type> saved_undet = inferenceContext.save(); try { while (true) { mlistener.reset(); // depends on control dependency: [while], data = [none] if (!allowGraphInference) { //in legacy mode we lack of transitivity, so bound check //cannot be run in parallel with other incoprporation rounds for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn); // depends on control dependency: [for], data = [t] } } for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; //bound incorporation EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy; for (IncorporationStep is : incorporationSteps) { if (is.accepts(uv, inferenceContext)) { is.apply(uv, inferenceContext, warn); // depends on control dependency: [if], data = [none] } } } if (!mlistener.changed || !allowGraphInference) break; } } finally { mlistener.detach(); if (incorporationCache.size() == MAX_INCORPORATION_STEPS) { inferenceContext.rollback(saved_undet); // depends on control dependency: [if], data = [none] } incorporationCache.clear(); } } }
public class class_name { private void parseRemoveCLHeaderInTempStatusRespRFC7230compat(Map props) { //PI35277 String value = (String) props.get(HttpConfigConstants.REMOVE_CLHEADER_IN_TEMP_STATUS_RFC7230_COMPAT); if (null != value) { this.removeCLHeaderInTempStatusRespRFC7230compat = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: RemoveCLHeaderInTempStatusRespRFC7230compat " + shouldRemoveCLHeaderInTempStatusRespRFC7230compat()); } } } }
public class class_name { private void parseRemoveCLHeaderInTempStatusRespRFC7230compat(Map props) { //PI35277 String value = (String) props.get(HttpConfigConstants.REMOVE_CLHEADER_IN_TEMP_STATUS_RFC7230_COMPAT); if (null != value) { this.removeCLHeaderInTempStatusRespRFC7230compat = convertBoolean(value); // depends on control dependency: [if], data = [value)] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: RemoveCLHeaderInTempStatusRespRFC7230compat " + shouldRemoveCLHeaderInTempStatusRespRFC7230compat()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static List<String> getNamedOutputsList(JobConf conf) { List<String> names = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(conf.get(NAMED_OUTPUTS, ""), " "); while (st.hasMoreTokens()) { names.add(st.nextToken()); } return names; } }
public class class_name { public static List<String> getNamedOutputsList(JobConf conf) { List<String> names = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(conf.get(NAMED_OUTPUTS, ""), " "); while (st.hasMoreTokens()) { names.add(st.nextToken()); // depends on control dependency: [while], data = [none] } return names; } }
public class class_name { public static LinkedHashMap<String, List<String>> getTablesSorted( List<String> allTableNames, boolean doSort ) { LinkedHashMap<String, List<String>> tablesMap = new LinkedHashMap<>(); tablesMap.put(USERDATA, new ArrayList<String>()); tablesMap.put(STYLE, new ArrayList<String>()); tablesMap.put(METADATA, new ArrayList<String>()); tablesMap.put(INTERNALDATA, new ArrayList<String>()); tablesMap.put(SPATIALINDEX, new ArrayList<String>()); for( String tableName : allTableNames ) { tableName = tableName.toLowerCase(); if (spatialindexTables.contains(tableName) || tableName.startsWith(startsWithIndexTables)) { List<String> list = tablesMap.get(SPATIALINDEX); list.add(tableName); continue; } if (tableName.startsWith(startsWithStyleTables)) { List<String> list = tablesMap.get(STYLE); list.add(tableName); continue; } if (metadataTables.contains(tableName)) { List<String> list = tablesMap.get(METADATA); list.add(tableName); continue; } if (internalDataTables.contains(tableName)) { List<String> list = tablesMap.get(INTERNALDATA); list.add(tableName); continue; } List<String> list = tablesMap.get(USERDATA); list.add(tableName); } if (doSort) { for( List<String> values : tablesMap.values() ) { Collections.sort(values); } } return tablesMap; } }
public class class_name { public static LinkedHashMap<String, List<String>> getTablesSorted( List<String> allTableNames, boolean doSort ) { LinkedHashMap<String, List<String>> tablesMap = new LinkedHashMap<>(); tablesMap.put(USERDATA, new ArrayList<String>()); tablesMap.put(STYLE, new ArrayList<String>()); tablesMap.put(METADATA, new ArrayList<String>()); tablesMap.put(INTERNALDATA, new ArrayList<String>()); tablesMap.put(SPATIALINDEX, new ArrayList<String>()); for( String tableName : allTableNames ) { tableName = tableName.toLowerCase(); // depends on control dependency: [for], data = [tableName] if (spatialindexTables.contains(tableName) || tableName.startsWith(startsWithIndexTables)) { List<String> list = tablesMap.get(SPATIALINDEX); list.add(tableName); // depends on control dependency: [if], data = [none] continue; } if (tableName.startsWith(startsWithStyleTables)) { List<String> list = tablesMap.get(STYLE); list.add(tableName); // depends on control dependency: [if], data = [none] continue; } if (metadataTables.contains(tableName)) { List<String> list = tablesMap.get(METADATA); list.add(tableName); // depends on control dependency: [if], data = [none] continue; } if (internalDataTables.contains(tableName)) { List<String> list = tablesMap.get(INTERNALDATA); list.add(tableName); // depends on control dependency: [if], data = [none] continue; } List<String> list = tablesMap.get(USERDATA); list.add(tableName); // depends on control dependency: [for], data = [tableName] } if (doSort) { for( List<String> values : tablesMap.values() ) { Collections.sort(values); // depends on control dependency: [for], data = [values] } } return tablesMap; } }
public class class_name { public Object getLastModified(int iHandleType) throws DBException { if (m_objLastModBookmark != null) return m_objLastModBookmark; // Override this to supply last modified. else { try { return m_tableRemote.getLastModified(iHandleType); } catch (RemoteException ex) { ex.printStackTrace(); throw new DBException(ex.getMessage()); } } } }
public class class_name { public Object getLastModified(int iHandleType) throws DBException { if (m_objLastModBookmark != null) return m_objLastModBookmark; // Override this to supply last modified. else { try { return m_tableRemote.getLastModified(iHandleType); // depends on control dependency: [try], data = [none] } catch (RemoteException ex) { ex.printStackTrace(); throw new DBException(ex.getMessage()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void doTag() throws IOException, JspException { JspContext jspContext = getJspContext(); DataGridTagModel dataGridModel = DataGridUtil.getDataGridTagModel(jspContext); if(dataGridModel == null) throw new JspException(Bundle.getErrorString("DataGridTags_MissingDataGridModel")); if(dataGridModel.getRenderState() == DataGridTagModel.RENDER_STATE_GRID) { StyleModel styleModel = dataGridModel.getStyleModel(); assert styleModel != null; TableRenderer tableRenderer = dataGridModel.getTableRenderer(); assert tableRenderer != null; InternalStringBuilder content = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(content); JspFragment fragment = getJspBody(); if(dataGridModel.isRenderRowGroups()) tableRenderer.openTableBody(_tbodyTag, appender); HttpServletRequest request = JspUtil.getRequest(getJspContext()); while(dataGridModel.hasNextDataItem()) { StringWriter sw = new StringWriter(); /* first things first -- advance to the next data item */ dataGridModel.nextDataItem(); fragment.invoke(sw); String trScript = null; if(_renderRow) { TrTag.State trState = new TrTag.State(); int index = dataGridModel.getCurrentIndex(); if(index % 2 == 0) trState.styleClass = styleModel.getRowClass(); else trState.styleClass = styleModel.getAltRowClass(); if(trState.id != null) trScript = renderNameAndId(request, trState, null); tableRenderer.openTableRow(trState, appender); } content.append(sw.toString()); if(_renderRow) { tableRenderer.closeTableRow(appender); if(trScript != null) appender.append(trScript); } } if(dataGridModel.isRenderRowGroups()) { tableRenderer.closeTableBody(appender); String tbodyScript = null; if(_tbodyTag.id != null) { tbodyScript = renderNameAndId(request, _tbodyTag, null); } if(tbodyScript != null) appender.append(tbodyScript); } jspContext.getOut().write(content.toString()); } } }
public class class_name { public void doTag() throws IOException, JspException { JspContext jspContext = getJspContext(); DataGridTagModel dataGridModel = DataGridUtil.getDataGridTagModel(jspContext); if(dataGridModel == null) throw new JspException(Bundle.getErrorString("DataGridTags_MissingDataGridModel")); if(dataGridModel.getRenderState() == DataGridTagModel.RENDER_STATE_GRID) { StyleModel styleModel = dataGridModel.getStyleModel(); assert styleModel != null; TableRenderer tableRenderer = dataGridModel.getTableRenderer(); assert tableRenderer != null; InternalStringBuilder content = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(content); JspFragment fragment = getJspBody(); if(dataGridModel.isRenderRowGroups()) tableRenderer.openTableBody(_tbodyTag, appender); HttpServletRequest request = JspUtil.getRequest(getJspContext()); while(dataGridModel.hasNextDataItem()) { StringWriter sw = new StringWriter(); /* first things first -- advance to the next data item */ dataGridModel.nextDataItem(); // depends on control dependency: [while], data = [none] fragment.invoke(sw); // depends on control dependency: [while], data = [none] String trScript = null; if(_renderRow) { TrTag.State trState = new TrTag.State(); int index = dataGridModel.getCurrentIndex(); if(index % 2 == 0) trState.styleClass = styleModel.getRowClass(); else trState.styleClass = styleModel.getAltRowClass(); if(trState.id != null) trScript = renderNameAndId(request, trState, null); tableRenderer.openTableRow(trState, appender); // depends on control dependency: [if], data = [none] } content.append(sw.toString()); // depends on control dependency: [while], data = [none] if(_renderRow) { tableRenderer.closeTableRow(appender); // depends on control dependency: [if], data = [none] if(trScript != null) appender.append(trScript); } } if(dataGridModel.isRenderRowGroups()) { tableRenderer.closeTableBody(appender); // depends on control dependency: [if], data = [none] String tbodyScript = null; if(_tbodyTag.id != null) { tbodyScript = renderNameAndId(request, _tbodyTag, null); // depends on control dependency: [if], data = [null)] } if(tbodyScript != null) appender.append(tbodyScript); } jspContext.getOut().write(content.toString()); } } }
public class class_name { private static Optional<String> getSuppliedHeaders(final String[] suppliedHeaders, final int columnNumber) { final int length = suppliedHeaders.length; if(length == 0) { return Optional.empty(); } if(columnNumber < length) { return Optional.ofNullable(suppliedHeaders[columnNumber-1]); } return Optional.empty(); } }
public class class_name { private static Optional<String> getSuppliedHeaders(final String[] suppliedHeaders, final int columnNumber) { final int length = suppliedHeaders.length; if(length == 0) { return Optional.empty(); // depends on control dependency: [if], data = [none] } if(columnNumber < length) { return Optional.ofNullable(suppliedHeaders[columnNumber-1]); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { @Override public void removeByCommerceAccountId(long commerceAccountId) { for (CommerceAccountUserRel commerceAccountUserRel : findByCommerceAccountId( commerceAccountId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAccountUserRel); } } }
public class class_name { @Override public void removeByCommerceAccountId(long commerceAccountId) { for (CommerceAccountUserRel commerceAccountUserRel : findByCommerceAccountId( commerceAccountId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAccountUserRel); // depends on control dependency: [for], data = [commerceAccountUserRel] } } }
public class class_name { static Iterator<MutableIntTuple> mooreNeighborhoodIterator( IntTuple center, int radius, IntTuple min, IntTuple max, Order order) { if (min != null) { Utils.checkForEqualSize(center, max); } if (max != null) { Utils.checkForEqualSize(center, max); } MutableIntTuple resultMin = IntTuples.subtract(center, radius, null); MutableIntTuple resultMax = IntTuples.add(center, radius+1, null); if (min != null) { IntTuples.max(min, resultMin, resultMin); IntTuples.max(min, resultMax, resultMax); } if (max != null) { IntTuples.min(max, resultMin, resultMin); IntTuples.min(max, resultMax, resultMax); } return new IntTupleIterator(resultMin, resultMax, IntTupleIncrementors.incrementor(order)); } }
public class class_name { static Iterator<MutableIntTuple> mooreNeighborhoodIterator( IntTuple center, int radius, IntTuple min, IntTuple max, Order order) { if (min != null) { Utils.checkForEqualSize(center, max); // depends on control dependency: [if], data = [none] } if (max != null) { Utils.checkForEqualSize(center, max); // depends on control dependency: [if], data = [none] } MutableIntTuple resultMin = IntTuples.subtract(center, radius, null); MutableIntTuple resultMax = IntTuples.add(center, radius+1, null); if (min != null) { IntTuples.max(min, resultMin, resultMin); // depends on control dependency: [if], data = [(min] IntTuples.max(min, resultMax, resultMax); // depends on control dependency: [if], data = [(min] } if (max != null) { IntTuples.min(max, resultMin, resultMin); // depends on control dependency: [if], data = [(max] IntTuples.min(max, resultMax, resultMax); // depends on control dependency: [if], data = [(max] } return new IntTupleIterator(resultMin, resultMax, IntTupleIncrementors.incrementor(order)); } }
public class class_name { public static void describe(StringBuffer buffer, Class clazz) { if (clazz == null) buffer.append("**null**"); else { buffer.append("{class=").append(clazz.getName()); Class[] intfs = clazz.getInterfaces(); if (intfs.length > 0) { buffer.append(" intfs="); for (int i = 0; i < intfs.length; ++i) { buffer.append(intfs[i].getName()); if (i < intfs.length-1) buffer.append(", "); } } buffer.append("}"); } } }
public class class_name { public static void describe(StringBuffer buffer, Class clazz) { if (clazz == null) buffer.append("**null**"); else { buffer.append("{class=").append(clazz.getName()); // depends on control dependency: [if], data = [(clazz] Class[] intfs = clazz.getInterfaces(); if (intfs.length > 0) { buffer.append(" intfs="); // depends on control dependency: [if], data = [none] for (int i = 0; i < intfs.length; ++i) { buffer.append(intfs[i].getName()); // depends on control dependency: [for], data = [i] if (i < intfs.length-1) buffer.append(", "); } } buffer.append("}"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T> void setIfPresent(final Environment env, final String key, final Class<T> type, final Consumer<T> function) { final T value = env.getProperty(key, type); if (value != null) { function.accept(value); } } }
public class class_name { public static <T> void setIfPresent(final Environment env, final String key, final Class<T> type, final Consumer<T> function) { final T value = env.getProperty(key, type); if (value != null) { function.accept(value); // depends on control dependency: [if], data = [(value] } } }
public class class_name { @Override public boolean clientUpdateWithVersionByExampleSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { for (IOptimisticLockerPluginHook plugin : this.getPlugins(IOptimisticLockerPluginHook.class)) { if (!plugin.clientUpdateWithVersionByExampleSelectiveMethodGenerated(method, interfaze, introspectedTable)) { return false; } } return true; } }
public class class_name { @Override public boolean clientUpdateWithVersionByExampleSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { for (IOptimisticLockerPluginHook plugin : this.getPlugins(IOptimisticLockerPluginHook.class)) { if (!plugin.clientUpdateWithVersionByExampleSelectiveMethodGenerated(method, interfaze, introspectedTable)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private String getFirstCallParam() { final String param = parseOptionalStringValue(XML_ELEMENT_RELOADED_PARAM); if (param == null) { return DEFAULT_RELOADED_PARAM; } else { return param; } } }
public class class_name { private String getFirstCallParam() { final String param = parseOptionalStringValue(XML_ELEMENT_RELOADED_PARAM); if (param == null) { return DEFAULT_RELOADED_PARAM; // depends on control dependency: [if], data = [none] } else { return param; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void fileNameInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store) { if (this.filenamePattern != null) { Pattern filenameRegex = filenamePattern.getCompiledPattern(store); //in case the filename is the first operation generating result, we can use the graph regex index. That's why we distinguish that in this clause if (vertices.isEmpty() && StringUtils.isBlank(getInputVariablesName())) { FileService fileService = new FileService(event.getGraphContext()); for (FileModel fileModel : fileService.findByFilenameRegex(filenameRegex.pattern())) { vertices.add(fileModel); } } else { ListIterator<FileModel> fileModelIterator = vertices.listIterator(); vertices.removeIf(fileModel -> !filenameRegex.matcher(fileModel.getFileName()).matches()); } } } }
public class class_name { private void fileNameInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store) { if (this.filenamePattern != null) { Pattern filenameRegex = filenamePattern.getCompiledPattern(store); //in case the filename is the first operation generating result, we can use the graph regex index. That's why we distinguish that in this clause if (vertices.isEmpty() && StringUtils.isBlank(getInputVariablesName())) { FileService fileService = new FileService(event.getGraphContext()); for (FileModel fileModel : fileService.findByFilenameRegex(filenameRegex.pattern())) { vertices.add(fileModel); // depends on control dependency: [for], data = [fileModel] } } else { ListIterator<FileModel> fileModelIterator = vertices.listIterator(); vertices.removeIf(fileModel -> !filenameRegex.matcher(fileModel.getFileName()).matches()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private Resource loadSchemas(Definition definition) throws WSDLException, IOException, TransformerException, TransformerFactoryConfigurationError { Types types = definition.getTypes(); Resource targetXsd = null; Resource firstSchemaInWSDL = null; if (types != null) { List<?> schemaTypes = types.getExtensibilityElements(); for (Object schemaObject : schemaTypes) { if (schemaObject instanceof SchemaImpl) { SchemaImpl schema = (SchemaImpl) schemaObject; inheritNamespaces(schema, definition); addImportedSchemas(schema); addIncludedSchemas(schema); if (!importedSchemas.contains(getTargetNamespace(schema))) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Source source = new DOMSource(schema.getElement()); Result result = new StreamResult(bos); TransformerFactory.newInstance().newTransformer().transform(source, result); Resource schemaResource = new ByteArrayResource(bos.toByteArray()); importedSchemas.add(getTargetNamespace(schema)); schemaResources.add(schemaResource); if (definition.getTargetNamespace().equals(getTargetNamespace(schema)) && targetXsd == null) { targetXsd = schemaResource; } else if (targetXsd == null && firstSchemaInWSDL == null) { firstSchemaInWSDL = schemaResource; } } } else { log.warn("Found unsupported schema type implementation " + schemaObject.getClass()); } } } for (Object imports : definition.getImports().values()) { for (Import wsdlImport : (Vector<Import>)imports) { String schemaLocation; URI locationURI = URI.create(wsdlImport.getLocationURI()); if (locationURI.isAbsolute()) { schemaLocation = wsdlImport.getLocationURI(); } else { schemaLocation = definition.getDocumentBaseURI().substring(0, definition.getDocumentBaseURI().lastIndexOf('/') + 1) + wsdlImport.getLocationURI(); } loadSchemas(getWsdlDefinition(new FileSystemResource(schemaLocation))); } } if (targetXsd == null) { // Obviously no schema resource in WSDL did match the targetNamespace, just use the first schema resource found as main schema if (firstSchemaInWSDL != null) { targetXsd = firstSchemaInWSDL; } else if (!CollectionUtils.isEmpty(schemaResources)) { targetXsd = schemaResources.get(0); } } return targetXsd; } }
public class class_name { private Resource loadSchemas(Definition definition) throws WSDLException, IOException, TransformerException, TransformerFactoryConfigurationError { Types types = definition.getTypes(); Resource targetXsd = null; Resource firstSchemaInWSDL = null; if (types != null) { List<?> schemaTypes = types.getExtensibilityElements(); for (Object schemaObject : schemaTypes) { if (schemaObject instanceof SchemaImpl) { SchemaImpl schema = (SchemaImpl) schemaObject; inheritNamespaces(schema, definition); // depends on control dependency: [if], data = [none] addImportedSchemas(schema); // depends on control dependency: [if], data = [none] addIncludedSchemas(schema); // depends on control dependency: [if], data = [none] if (!importedSchemas.contains(getTargetNamespace(schema))) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Source source = new DOMSource(schema.getElement()); Result result = new StreamResult(bos); TransformerFactory.newInstance().newTransformer().transform(source, result); // depends on control dependency: [if], data = [none] Resource schemaResource = new ByteArrayResource(bos.toByteArray()); importedSchemas.add(getTargetNamespace(schema)); // depends on control dependency: [if], data = [none] schemaResources.add(schemaResource); // depends on control dependency: [if], data = [none] if (definition.getTargetNamespace().equals(getTargetNamespace(schema)) && targetXsd == null) { targetXsd = schemaResource; // depends on control dependency: [if], data = [none] } else if (targetXsd == null && firstSchemaInWSDL == null) { firstSchemaInWSDL = schemaResource; // depends on control dependency: [if], data = [none] } } } else { log.warn("Found unsupported schema type implementation " + schemaObject.getClass()); // depends on control dependency: [if], data = [none] } } } for (Object imports : definition.getImports().values()) { for (Import wsdlImport : (Vector<Import>)imports) { String schemaLocation; URI locationURI = URI.create(wsdlImport.getLocationURI()); if (locationURI.isAbsolute()) { schemaLocation = wsdlImport.getLocationURI(); } else { schemaLocation = definition.getDocumentBaseURI().substring(0, definition.getDocumentBaseURI().lastIndexOf('/') + 1) + wsdlImport.getLocationURI(); } loadSchemas(getWsdlDefinition(new FileSystemResource(schemaLocation))); } } if (targetXsd == null) { // Obviously no schema resource in WSDL did match the targetNamespace, just use the first schema resource found as main schema if (firstSchemaInWSDL != null) { targetXsd = firstSchemaInWSDL; } else if (!CollectionUtils.isEmpty(schemaResources)) { targetXsd = schemaResources.get(0); } } return targetXsd; } }
public class class_name { static public BigDecimal mod2pi(BigDecimal x) { /* write x= 2*pi*k+r with the precision in r defined by the precision of x and not * compromised by the precision of 2*pi, so the ulp of 2*pi*k should match the ulp of x. * First getFloat a guess of k to figure out how many digits of 2*pi are needed. */ int k = (int) (0.5 * x.doubleValue() / Math.PI); /* want to have err(2*pi*k)< err(x)=0.5*x.ulp, so err(pi) = err(x)/(4k) with two safety digits */ double err2pi; if (k != 0) { err2pi = 0.25 * Math.abs(x.ulp().doubleValue() / k); } else { err2pi = 0.5 * Math.abs(x.ulp().doubleValue()); } MathContext mc = new MathContext(2 + err2prec(6.283, err2pi)); BigDecimal twopi = pi(mc).multiply(new BigDecimal(2)); /* Delegate the actual operation to the BigDecimal class, which may return * a negative value of x was negative . */ BigDecimal res = x.remainder(twopi); if (res.compareTo(BigDecimal.ZERO) < 0) { res = res.add(twopi); } /* The actual precision is set by the input value, its absolute value of x.ulp()/2. */ mc = new MathContext(err2prec(res.doubleValue(), x.ulp().doubleValue() / 2.)); return res.round(mc); } }
public class class_name { static public BigDecimal mod2pi(BigDecimal x) { /* write x= 2*pi*k+r with the precision in r defined by the precision of x and not * compromised by the precision of 2*pi, so the ulp of 2*pi*k should match the ulp of x. * First getFloat a guess of k to figure out how many digits of 2*pi are needed. */ int k = (int) (0.5 * x.doubleValue() / Math.PI); /* want to have err(2*pi*k)< err(x)=0.5*x.ulp, so err(pi) = err(x)/(4k) with two safety digits */ double err2pi; if (k != 0) { err2pi = 0.25 * Math.abs(x.ulp().doubleValue() / k); // depends on control dependency: [if], data = [none] } else { err2pi = 0.5 * Math.abs(x.ulp().doubleValue()); // depends on control dependency: [if], data = [none] } MathContext mc = new MathContext(2 + err2prec(6.283, err2pi)); BigDecimal twopi = pi(mc).multiply(new BigDecimal(2)); /* Delegate the actual operation to the BigDecimal class, which may return * a negative value of x was negative . */ BigDecimal res = x.remainder(twopi); if (res.compareTo(BigDecimal.ZERO) < 0) { res = res.add(twopi); // depends on control dependency: [if], data = [none] } /* The actual precision is set by the input value, its absolute value of x.ulp()/2. */ mc = new MathContext(err2prec(res.doubleValue(), x.ulp().doubleValue() / 2.)); return res.round(mc); } }
public class class_name { public static void printDebug(final int[] pIntArray, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } if (pIntArray == null) { pPrintStream.println(INTARRAY_IS_NULL_ERROR_MESSAGE); return; } for (int i = 0; i < pIntArray.length; i++) { pPrintStream.println(pIntArray[i]); } } }
public class class_name { public static void printDebug(final int[] pIntArray, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (pIntArray == null) { pPrintStream.println(INTARRAY_IS_NULL_ERROR_MESSAGE); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < pIntArray.length; i++) { pPrintStream.println(pIntArray[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Datatype.Builder addAllValueTypeAnnotations(Spliterator<? extends Excerpt> elements) { if ((elements.characteristics() & Spliterator.SIZED) != 0) { long elementsSize = elements.estimateSize(); if (elementsSize > 0 && elementsSize <= Integer.MAX_VALUE) { if (valueTypeAnnotations instanceof ImmutableList) { valueTypeAnnotations = new ArrayList<>(valueTypeAnnotations); } ((ArrayList<?>) valueTypeAnnotations) .ensureCapacity(valueTypeAnnotations.size() + (int) elementsSize); } } elements.forEachRemaining(this::addValueTypeAnnotations); return (Datatype.Builder) this; } }
public class class_name { public Datatype.Builder addAllValueTypeAnnotations(Spliterator<? extends Excerpt> elements) { if ((elements.characteristics() & Spliterator.SIZED) != 0) { long elementsSize = elements.estimateSize(); if (elementsSize > 0 && elementsSize <= Integer.MAX_VALUE) { if (valueTypeAnnotations instanceof ImmutableList) { valueTypeAnnotations = new ArrayList<>(valueTypeAnnotations); // depends on control dependency: [if], data = [none] } ((ArrayList<?>) valueTypeAnnotations) .ensureCapacity(valueTypeAnnotations.size() + (int) elementsSize); // depends on control dependency: [if], data = [none] } } elements.forEachRemaining(this::addValueTypeAnnotations); return (Datatype.Builder) this; } }
public class class_name { public CoordinateTimeAbstract makeBestFromComplete() { int[] best = new int[time2runtime.length]; int last = -1; int count = 0; for (int i=0; i<time2runtime.length; i++) { int time = time2runtime[i]; if (time >= last) { last = time; best[i] = time; count++; } else { best[i] = -1; } } return makeBestFromComplete(best, count); } }
public class class_name { public CoordinateTimeAbstract makeBestFromComplete() { int[] best = new int[time2runtime.length]; int last = -1; int count = 0; for (int i=0; i<time2runtime.length; i++) { int time = time2runtime[i]; if (time >= last) { last = time; // depends on control dependency: [if], data = [none] best[i] = time; // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] } else { best[i] = -1; // depends on control dependency: [if], data = [none] } } return makeBestFromComplete(best, count); } }
public class class_name { @Override public WarpResult execute() { try { executeWarp.fire(new ExecuteWarp(activity, warpContext)); Exception executionException = warpContext.getFirstException(); if (executionException != null) { propagateException(executionException); } return warpContext.getResult(); } finally { finalizeContext(); } } }
public class class_name { @Override public WarpResult execute() { try { executeWarp.fire(new ExecuteWarp(activity, warpContext)); // depends on control dependency: [try], data = [none] Exception executionException = warpContext.getFirstException(); if (executionException != null) { propagateException(executionException); // depends on control dependency: [if], data = [(executionException] } return warpContext.getResult(); // depends on control dependency: [try], data = [none] } finally { finalizeContext(); } } }
public class class_name { public static ZMsg newStringMsg(String... strings) { ZMsg msg = new ZMsg(); for (String data : strings) { msg.addString(data); } return msg; } }
public class class_name { public static ZMsg newStringMsg(String... strings) { ZMsg msg = new ZMsg(); for (String data : strings) { msg.addString(data); // depends on control dependency: [for], data = [data] } return msg; } }
public class class_name { private void reSubscribeByName(EventChannelStruct eventChannelStruct, String name) { // Get the map and the callback structure for channel Hashtable<String, EventCallBackStruct> callBackMap = EventConsumer.getEventCallbackMap(); EventCallBackStruct callbackStruct = null; Enumeration channelNames = callBackMap.keys(); while (channelNames.hasMoreElements()) { String key = (String) channelNames.nextElement(); EventCallBackStruct eventStruct = callBackMap.get(key); if (eventStruct.channel_name.equals(name)) { callbackStruct = eventStruct; } } // Get the callback structure if (callbackStruct!=null) { callbackStruct.consumer.reSubscribeByName(eventChannelStruct, name); } } }
public class class_name { private void reSubscribeByName(EventChannelStruct eventChannelStruct, String name) { // Get the map and the callback structure for channel Hashtable<String, EventCallBackStruct> callBackMap = EventConsumer.getEventCallbackMap(); EventCallBackStruct callbackStruct = null; Enumeration channelNames = callBackMap.keys(); while (channelNames.hasMoreElements()) { String key = (String) channelNames.nextElement(); EventCallBackStruct eventStruct = callBackMap.get(key); if (eventStruct.channel_name.equals(name)) { callbackStruct = eventStruct; // depends on control dependency: [if], data = [none] } } // Get the callback structure if (callbackStruct!=null) { callbackStruct.consumer.reSubscribeByName(eventChannelStruct, name); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void main(String[] args) { // Parse the command line options ArgumentsLoader.parse(args); // Load the configuration Config config = ArgumentsLoader.getConfig(); // Initialise the system with the given arguments if (!init(config)) { return; } // load all extensions if (!Program.loadExtensions(config)) { return; } // Start the engine start(config); // Wait until the agents become idle waitUntilIdle(); // finish up finish(); } }
public class class_name { public static void main(String[] args) { // Parse the command line options ArgumentsLoader.parse(args); // Load the configuration Config config = ArgumentsLoader.getConfig(); // Initialise the system with the given arguments if (!init(config)) { return; // depends on control dependency: [if], data = [none] } // load all extensions if (!Program.loadExtensions(config)) { return; // depends on control dependency: [if], data = [none] } // Start the engine start(config); // Wait until the agents become idle waitUntilIdle(); // finish up finish(); } }
public class class_name { public Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>> getEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String accountName, String assetName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (assetName == null) { throw new IllegalArgumentException("Parameter assetName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getEncryptionKey(this.client.subscriptionId(), resourceGroupName, accountName, assetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>>>() { @Override public Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>> call(Response<ResponseBody> response) { try { ServiceResponse<StorageEncryptedAssetDecryptionDataInner> clientResponse = getEncryptionKeyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>> getEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String accountName, String assetName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (assetName == null) { throw new IllegalArgumentException("Parameter assetName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getEncryptionKey(this.client.subscriptionId(), resourceGroupName, accountName, assetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>>>() { @Override public Observable<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>> call(Response<ResponseBody> response) { try { ServiceResponse<StorageEncryptedAssetDecryptionDataInner> clientResponse = getEncryptionKeyDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { void processAlterTableAddUniqueConstraint(Table table, HsqlName name, boolean assumeUnique) { boolean isAutogeneratedName = false; if (name == null) { name = database.nameManager.newAutoName("CT", table.getSchemaName(), table.getName(), SchemaObject.CONSTRAINT); isAutogeneratedName = true; } // A VoltDB extension to "readColumnList(table, false)" to support indexed expressions. java.util.List<Expression> indexExprs = XreadExpressions(null); OrderedHashSet set = getSimpleColumnNames(indexExprs); int[] cols = getColumnList(set, table); /* disable 1 line ... int[] cols = this.readColumnList(table, false); ... disabled 1 line */ // End of VoltDB extension session.commit(false); TableWorks tableWorks = new TableWorks(session, table); // A VoltDB extension to support indexed expressions and the assume unique attribute if ((indexExprs != null) && (cols == null)) { // A VoltDB extension to support indexed expressions. // Not just indexing columns. // The meaning of cols shifts here to be // the set of unique base columns for the indexed expressions. set = getBaseColumnNames(indexExprs); cols = getColumnList(set, table); tableWorks.addUniqueExprConstraint(cols, indexExprs.toArray(new Expression[indexExprs.size()]), name, isAutogeneratedName, assumeUnique); return; } tableWorks.addUniqueConstraint(cols, name, isAutogeneratedName, assumeUnique); /* disable 1 line ... tableWorks.addUniqueConstraint(cols, name); ... disabled 1 line */ // End of VoltDB extension } }
public class class_name { void processAlterTableAddUniqueConstraint(Table table, HsqlName name, boolean assumeUnique) { boolean isAutogeneratedName = false; if (name == null) { name = database.nameManager.newAutoName("CT", table.getSchemaName(), table.getName(), SchemaObject.CONSTRAINT); // depends on control dependency: [if], data = [none] isAutogeneratedName = true; // depends on control dependency: [if], data = [none] } // A VoltDB extension to "readColumnList(table, false)" to support indexed expressions. java.util.List<Expression> indexExprs = XreadExpressions(null); OrderedHashSet set = getSimpleColumnNames(indexExprs); int[] cols = getColumnList(set, table); /* disable 1 line ... int[] cols = this.readColumnList(table, false); ... disabled 1 line */ // End of VoltDB extension session.commit(false); TableWorks tableWorks = new TableWorks(session, table); // A VoltDB extension to support indexed expressions and the assume unique attribute if ((indexExprs != null) && (cols == null)) { // A VoltDB extension to support indexed expressions. // Not just indexing columns. // The meaning of cols shifts here to be // the set of unique base columns for the indexed expressions. set = getBaseColumnNames(indexExprs); // depends on control dependency: [if], data = [none] cols = getColumnList(set, table); // depends on control dependency: [if], data = [none] tableWorks.addUniqueExprConstraint(cols, indexExprs.toArray(new Expression[indexExprs.size()]), name, isAutogeneratedName, assumeUnique); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } tableWorks.addUniqueConstraint(cols, name, isAutogeneratedName, assumeUnique); /* disable 1 line ... tableWorks.addUniqueConstraint(cols, name); ... disabled 1 line */ // End of VoltDB extension } }
public class class_name { public static Query logical(LogOp op, Collection<Query> expressions) { Query q = new Query(true); for (Query x : expressions) { ((ArrayNode) q.node).add(x.toJson()); } Query a = new Query(false); a.add(op.toString(), q.toJson()); return a; } }
public class class_name { public static Query logical(LogOp op, Collection<Query> expressions) { Query q = new Query(true); for (Query x : expressions) { ((ArrayNode) q.node).add(x.toJson()); // depends on control dependency: [for], data = [x] } Query a = new Query(false); a.add(op.toString(), q.toJson()); return a; } }
public class class_name { public static Status getStatus(Account account, String authority, boolean create) { Map<Account, Status> map = syncableAccounts.get(authority); if (map == null) { map = new HashMap<>(); syncableAccounts.put(authority, map); } Status status = map.get(account); if (status == null && create) { status = new Status(); map.put(account, status); } return status; } }
public class class_name { public static Status getStatus(Account account, String authority, boolean create) { Map<Account, Status> map = syncableAccounts.get(authority); if (map == null) { map = new HashMap<>(); // depends on control dependency: [if], data = [none] syncableAccounts.put(authority, map); // depends on control dependency: [if], data = [none] } Status status = map.get(account); if (status == null && create) { status = new Status(); // depends on control dependency: [if], data = [none] map.put(account, status); // depends on control dependency: [if], data = [none] } return status; } }
public class class_name { private Document getProjectionDocument() { if ( projections.isEmpty() ) { return null; } Document projectionDocument = new Document(); for ( String projection : projections ) { projectionDocument.put( projection, 1 ); } return projectionDocument; } }
public class class_name { private Document getProjectionDocument() { if ( projections.isEmpty() ) { return null; // depends on control dependency: [if], data = [none] } Document projectionDocument = new Document(); for ( String projection : projections ) { projectionDocument.put( projection, 1 ); // depends on control dependency: [for], data = [projection] } return projectionDocument; } }
public class class_name { public void calculateOverlapsAndReduce(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds) throws CDKException { setSource(molecule1); setTarget(molecule2); setMappings(new ArrayList<Map<Integer, Integer>>()); if ((getSource().getAtomCount() == 1) || (getTarget().getAtomCount() == 1)) { List<CDKRMap> overlaps = CDKMCS.checkSingleAtomCases(getSource(), getTarget()); int nAtomsMatched = overlaps.size(); nAtomsMatched = (nAtomsMatched > 0) ? 1 : 0; if (nAtomsMatched > 0) { /* UnComment this to get one Unique Mapping */ //List reducedList = removeRedundantMappingsForSingleAtomCase(overlaps); //int counter = 0; identifySingleAtomsMatchedParts(overlaps, getSource(), getTarget()); } } else { List<List<CDKRMap>> overlaps = CDKMCS.search(getSource(), getTarget(), new BitSet(), new BitSet(), true, true, shouldMatchBonds); List<List<CDKRMap>> reducedList = removeSubGraph(overlaps); Stack<List<CDKRMap>> allMaxOverlaps = getAllMaximum(reducedList); while (!allMaxOverlaps.empty()) { // System.out.println("source: " + source.getAtomCount() + ", target: " + target.getAtomCount() + ", overl: " + allMaxOverlaps.peek().size()); List<List<CDKRMap>> maxOverlapsAtoms = makeAtomsMapOfBondsMap(allMaxOverlaps.peek(), getSource(), getTarget()); // System.out.println("size of maxOverlaps: " + maxOverlapsAtoms.size()); identifyMatchedParts(maxOverlapsAtoms, getSource(), getTarget()); // identifyMatchedParts(allMaxOverlaps.peek(), source, target); allMaxOverlaps.pop(); } } FinalMappings.getInstance().set(getMappings()); } }
public class class_name { public void calculateOverlapsAndReduce(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds) throws CDKException { setSource(molecule1); setTarget(molecule2); setMappings(new ArrayList<Map<Integer, Integer>>()); if ((getSource().getAtomCount() == 1) || (getTarget().getAtomCount() == 1)) { List<CDKRMap> overlaps = CDKMCS.checkSingleAtomCases(getSource(), getTarget()); int nAtomsMatched = overlaps.size(); nAtomsMatched = (nAtomsMatched > 0) ? 1 : 0; if (nAtomsMatched > 0) { /* UnComment this to get one Unique Mapping */ //List reducedList = removeRedundantMappingsForSingleAtomCase(overlaps); //int counter = 0; identifySingleAtomsMatchedParts(overlaps, getSource(), getTarget()); // depends on control dependency: [if], data = [none] } } else { List<List<CDKRMap>> overlaps = CDKMCS.search(getSource(), getTarget(), new BitSet(), new BitSet(), true, true, shouldMatchBonds); List<List<CDKRMap>> reducedList = removeSubGraph(overlaps); Stack<List<CDKRMap>> allMaxOverlaps = getAllMaximum(reducedList); while (!allMaxOverlaps.empty()) { // System.out.println("source: " + source.getAtomCount() + ", target: " + target.getAtomCount() + ", overl: " + allMaxOverlaps.peek().size()); List<List<CDKRMap>> maxOverlapsAtoms = makeAtomsMapOfBondsMap(allMaxOverlaps.peek(), getSource(), getTarget()); // System.out.println("size of maxOverlaps: " + maxOverlapsAtoms.size()); identifyMatchedParts(maxOverlapsAtoms, getSource(), getTarget()); // depends on control dependency: [while], data = [none] // identifyMatchedParts(allMaxOverlaps.peek(), source, target); allMaxOverlaps.pop(); // depends on control dependency: [while], data = [none] } } FinalMappings.getInstance().set(getMappings()); } }
public class class_name { private static void removeNonApplicableFilters( Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy, EntitySpec entitySpec) { Set<EntitySpec> entitySpecsSet = new HashSet<>(); Set<String> filterPropIds = new HashSet<>(); String[] entitySpecPropIds = entitySpec.getPropositionIds(); for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) { Filter f = itr.next(); Arrays.addAll(filterPropIds, f.getPropositionIds()); for (EntitySpec es : entitySpecs) { if (Collections.containsAny(filterPropIds, es.getPropositionIds())) { entitySpecsSet.add(es); } } if (Collections.containsAny(filterPropIds, entitySpecPropIds)) { return; } if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) { itr.remove(); } entitySpecsSet.clear(); filterPropIds.clear(); } } }
public class class_name { private static void removeNonApplicableFilters( Collection<EntitySpec> entitySpecs, Set<Filter> filtersCopy, EntitySpec entitySpec) { Set<EntitySpec> entitySpecsSet = new HashSet<>(); Set<String> filterPropIds = new HashSet<>(); String[] entitySpecPropIds = entitySpec.getPropositionIds(); for (Iterator<Filter> itr = filtersCopy.iterator(); itr.hasNext();) { Filter f = itr.next(); Arrays.addAll(filterPropIds, f.getPropositionIds()); // depends on control dependency: [for], data = [none] for (EntitySpec es : entitySpecs) { if (Collections.containsAny(filterPropIds, es.getPropositionIds())) { entitySpecsSet.add(es); // depends on control dependency: [if], data = [none] } } if (Collections.containsAny(filterPropIds, entitySpecPropIds)) { return; // depends on control dependency: [if], data = [none] } if (!atLeastOneInInboundReferences(entitySpecsSet, entitySpec)) { itr.remove(); // depends on control dependency: [if], data = [none] } entitySpecsSet.clear(); // depends on control dependency: [for], data = [none] filterPropIds.clear(); // depends on control dependency: [for], data = [none] } } }
public class class_name { @Override public void resolveIncident(final String incidentId) { IncidentEntity incident = (IncidentEntity) Context .getCommandContext() .getIncidentManager() .findIncidentById(incidentId); IncidentHandler incidentHandler = findIncidentHandler(incident.getIncidentType()); if (incidentHandler == null) { incidentHandler = new DefaultIncidentHandler(incident.getIncidentType()); } IncidentContext incidentContext = new IncidentContext(incident); incidentHandler.resolveIncident(incidentContext); } }
public class class_name { @Override public void resolveIncident(final String incidentId) { IncidentEntity incident = (IncidentEntity) Context .getCommandContext() .getIncidentManager() .findIncidentById(incidentId); IncidentHandler incidentHandler = findIncidentHandler(incident.getIncidentType()); if (incidentHandler == null) { incidentHandler = new DefaultIncidentHandler(incident.getIncidentType()); // depends on control dependency: [if], data = [none] } IncidentContext incidentContext = new IncidentContext(incident); incidentHandler.resolveIncident(incidentContext); } }
public class class_name { public synchronized boolean hasReceiveListeners() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasReceiveListeners"); boolean returnValue = false; if (!table.values().isEmpty()) { returnValue = receiveListenerIterator().hasNext(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasReceiveListeners", ""+returnValue); return returnValue; } }
public class class_name { public synchronized boolean hasReceiveListeners() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "hasReceiveListeners"); boolean returnValue = false; if (!table.values().isEmpty()) { returnValue = receiveListenerIterator().hasNext(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "hasReceiveListeners", ""+returnValue); return returnValue; } }
public class class_name { @Override protected void subAppend(LoggingEvent event) { GelfMessage gelf = GelfMessageFactory.makeMessage(layout, event, this); this.qw.write(gelf.toJson()); this.qw.write(Layout.LINE_SEP); if (this.immediateFlush) { this.qw.flush(); } } }
public class class_name { @Override protected void subAppend(LoggingEvent event) { GelfMessage gelf = GelfMessageFactory.makeMessage(layout, event, this); this.qw.write(gelf.toJson()); this.qw.write(Layout.LINE_SEP); if (this.immediateFlush) { this.qw.flush(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void setKeyboardFocus(final Actor actor) { if (actor != null && actor.getStage() != null) { actor.getStage().setKeyboardFocus(actor); } } }
public class class_name { public static void setKeyboardFocus(final Actor actor) { if (actor != null && actor.getStage() != null) { actor.getStage().setKeyboardFocus(actor); // depends on control dependency: [if], data = [(actor] } } }
public class class_name { public long getAndSet(T item, long value) { MutableLong entry = map.get(item); if (entry == null) { entry = MutableLong.valueOf(value); map.put(item, entry); total += value; return 0; } long oldValue = entry.value; total = total - oldValue + value; entry.value = value; return oldValue; } }
public class class_name { public long getAndSet(T item, long value) { MutableLong entry = map.get(item); if (entry == null) { entry = MutableLong.valueOf(value); // depends on control dependency: [if], data = [none] map.put(item, entry); // depends on control dependency: [if], data = [none] total += value; // depends on control dependency: [if], data = [none] return 0; // depends on control dependency: [if], data = [none] } long oldValue = entry.value; total = total - oldValue + value; entry.value = value; return oldValue; } }
public class class_name { public static SentryStackTraceElement[] fromStackTraceElements(StackTraceElement[] stackTraceElements, Frame[] cachedFrames) { /* This loop is a bit hairy because it has to deal with cached frames (from FrameCache, set by the agent if it is in use). - If cachedFrames is null (most commonly: because the agent isn't being used) nothing fancy needs to happen. - If cachedFrames is not null we need to pair frames from stackTraceElements (the exception being captured) to frames found in the FrameCache. The issue is that some frameworks/libraries seem to trim stacktraces in some cases, and so the array in the FrameCache (set when the original exception was *thrown*) may slightly differ (be larger) than the actual exception that is being captured. For this reason we need to iterate cachedFrames separately, sometimes advancing 'further' than the equivalent index in stackTraceElements (thus skipping elements). In addition, the only information we have to "match" frames with is the method name, which is checked for equality between the two arrays at each step. In the worst case, if something is mangled or weird, we just iterate through the cachedFrames immediately (not finding a match) and locals are not set/sent with the event. */ SentryStackTraceElement[] sentryStackTraceElements = new SentryStackTraceElement[stackTraceElements.length]; for (int i = 0, j = 0; i < stackTraceElements.length; i++, j++) { StackTraceElement stackTraceElement = stackTraceElements[i]; Map<String, Object> locals = null; if (cachedFrames != null) { // step through cachedFrames until we hit a match on the method in the stackTraceElement while (j < cachedFrames.length && !cachedFrames[j].getMethod().getName().equals(stackTraceElement.getMethodName())) { j++; } // only use cachedFrame locals if we haven't exhausted the array if (j < cachedFrames.length) { locals = cachedFrames[j].getLocals(); } } sentryStackTraceElements[i] = fromStackTraceElement(stackTraceElement, locals); } return sentryStackTraceElements; } }
public class class_name { public static SentryStackTraceElement[] fromStackTraceElements(StackTraceElement[] stackTraceElements, Frame[] cachedFrames) { /* This loop is a bit hairy because it has to deal with cached frames (from FrameCache, set by the agent if it is in use). - If cachedFrames is null (most commonly: because the agent isn't being used) nothing fancy needs to happen. - If cachedFrames is not null we need to pair frames from stackTraceElements (the exception being captured) to frames found in the FrameCache. The issue is that some frameworks/libraries seem to trim stacktraces in some cases, and so the array in the FrameCache (set when the original exception was *thrown*) may slightly differ (be larger) than the actual exception that is being captured. For this reason we need to iterate cachedFrames separately, sometimes advancing 'further' than the equivalent index in stackTraceElements (thus skipping elements). In addition, the only information we have to "match" frames with is the method name, which is checked for equality between the two arrays at each step. In the worst case, if something is mangled or weird, we just iterate through the cachedFrames immediately (not finding a match) and locals are not set/sent with the event. */ SentryStackTraceElement[] sentryStackTraceElements = new SentryStackTraceElement[stackTraceElements.length]; for (int i = 0, j = 0; i < stackTraceElements.length; i++, j++) { StackTraceElement stackTraceElement = stackTraceElements[i]; Map<String, Object> locals = null; if (cachedFrames != null) { // step through cachedFrames until we hit a match on the method in the stackTraceElement while (j < cachedFrames.length && !cachedFrames[j].getMethod().getName().equals(stackTraceElement.getMethodName())) { j++; // depends on control dependency: [while], data = [none] } // only use cachedFrame locals if we haven't exhausted the array if (j < cachedFrames.length) { locals = cachedFrames[j].getLocals(); // depends on control dependency: [if], data = [none] } } sentryStackTraceElements[i] = fromStackTraceElement(stackTraceElement, locals); // depends on control dependency: [for], data = [i] } return sentryStackTraceElements; } }
public class class_name { public static String getFullRequestUrl(HttpServletRequest request) { StringBuilder buff = new StringBuilder( request.getRequestURL().toString()); String queryString = request.getQueryString(); if (queryString != null) { buff.append("?").append(queryString); } return buff.toString(); } }
public class class_name { public static String getFullRequestUrl(HttpServletRequest request) { StringBuilder buff = new StringBuilder( request.getRequestURL().toString()); String queryString = request.getQueryString(); if (queryString != null) { buff.append("?").append(queryString); // depends on control dependency: [if], data = [(queryString] } return buff.toString(); } }
public class class_name { public void trimToSize(int maxSize) { while (true) { K key; V value; synchronized (this) { if (size < 0 || map.isEmpty() && size != 0) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= safeSizeOf(key, value); evictionCount++; } entryRemoved(true, key, value, null); } } }
public class class_name { public void trimToSize(int maxSize) { while (true) { K key; V value; synchronized (this) { // depends on control dependency: [while], data = [none] if (size < 0 || map.isEmpty() && size != 0) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= safeSizeOf(key, value); evictionCount++; } entryRemoved(true, key, value, null); // depends on control dependency: [while], data = [none] } } }
public class class_name { private static boolean safeSleep(long milliseconds) { boolean interrupted = false; long timeout = (System.currentTimeMillis() + milliseconds); while (System.currentTimeMillis() < timeout) { try { Thread.sleep(milliseconds); } catch (InterruptedException cause) { interrupted = true; } finally { milliseconds = Math.min(timeout - System.currentTimeMillis(), 0); } } if (interrupted) { Thread.currentThread().interrupt(); } return !Thread.currentThread().isInterrupted(); } }
public class class_name { private static boolean safeSleep(long milliseconds) { boolean interrupted = false; long timeout = (System.currentTimeMillis() + milliseconds); while (System.currentTimeMillis() < timeout) { try { Thread.sleep(milliseconds); // depends on control dependency: [try], data = [none] } catch (InterruptedException cause) { interrupted = true; } // depends on control dependency: [catch], data = [none] finally { milliseconds = Math.min(timeout - System.currentTimeMillis(), 0); } } if (interrupted) { Thread.currentThread().interrupt(); // depends on control dependency: [if], data = [none] } return !Thread.currentThread().isInterrupted(); } }
public class class_name { private boolean ensureValidSetter(final Expression expression, final Expression leftExpression, final Expression rightExpression, final SetterInfo setterInfo) { // for expressions like foo = { ... } // we know that the RHS type is a closure // but we must check if the binary expression is an assignment // because we need to check if a setter uses @DelegatesTo VariableExpression ve = new VariableExpression("%", setterInfo.receiverType); MethodCallExpression call = new MethodCallExpression( ve, setterInfo.name, rightExpression ); call.setImplicitThis(false); visitMethodCallExpression(call); MethodNode directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET); if (directSetterCandidate==null) { // this may happen if there's a setter of type boolean/String/Class, and that we are using the property // notation AND that the RHS is not a boolean/String/Class for (MethodNode setter : setterInfo.setters) { ClassNode type = getWrapper(setter.getParameters()[0].getOriginType()); if (Boolean_TYPE.equals(type) || STRING_TYPE.equals(type) || CLASS_Type.equals(type)) { call = new MethodCallExpression( ve, setterInfo.name, new CastExpression(type,rightExpression) ); call.setImplicitThis(false); visitMethodCallExpression(call); directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET); if (directSetterCandidate!=null) { break; } } } } if (directSetterCandidate != null) { for (MethodNode setter : setterInfo.setters) { if (setter == directSetterCandidate) { leftExpression.putNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET, directSetterCandidate); storeType(leftExpression, getType(rightExpression)); break; } } } else { ClassNode firstSetterType = setterInfo.setters.iterator().next().getParameters()[0].getOriginType(); addAssignmentError(firstSetterType, getType(rightExpression), expression); return true; } return false; } }
public class class_name { private boolean ensureValidSetter(final Expression expression, final Expression leftExpression, final Expression rightExpression, final SetterInfo setterInfo) { // for expressions like foo = { ... } // we know that the RHS type is a closure // but we must check if the binary expression is an assignment // because we need to check if a setter uses @DelegatesTo VariableExpression ve = new VariableExpression("%", setterInfo.receiverType); MethodCallExpression call = new MethodCallExpression( ve, setterInfo.name, rightExpression ); call.setImplicitThis(false); visitMethodCallExpression(call); MethodNode directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET); if (directSetterCandidate==null) { // this may happen if there's a setter of type boolean/String/Class, and that we are using the property // notation AND that the RHS is not a boolean/String/Class for (MethodNode setter : setterInfo.setters) { ClassNode type = getWrapper(setter.getParameters()[0].getOriginType()); if (Boolean_TYPE.equals(type) || STRING_TYPE.equals(type) || CLASS_Type.equals(type)) { call = new MethodCallExpression( ve, setterInfo.name, new CastExpression(type,rightExpression) ); // depends on control dependency: [if], data = [none] call.setImplicitThis(false); // depends on control dependency: [if], data = [none] visitMethodCallExpression(call); // depends on control dependency: [if], data = [none] directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET); // depends on control dependency: [if], data = [none] if (directSetterCandidate!=null) { break; } } } } if (directSetterCandidate != null) { for (MethodNode setter : setterInfo.setters) { if (setter == directSetterCandidate) { leftExpression.putNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET, directSetterCandidate); // depends on control dependency: [if], data = [directSetterCandidate)] storeType(leftExpression, getType(rightExpression)); // depends on control dependency: [if], data = [none] break; } } } else { ClassNode firstSetterType = setterInfo.setters.iterator().next().getParameters()[0].getOriginType(); addAssignmentError(firstSetterType, getType(rightExpression), expression); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public IDomainAccess getDomainAccess() { if (this.domainAccess == null) { this.domainAccess = DomainAccessFactory.createDomainAccess(dbAccess, domainName); } return this.domainAccess; } }
public class class_name { public IDomainAccess getDomainAccess() { if (this.domainAccess == null) { this.domainAccess = DomainAccessFactory.createDomainAccess(dbAccess, domainName); // depends on control dependency: [if], data = [none] } return this.domainAccess; } }
public class class_name { protected Object[] getChildren() { if (mDebugVariables == null) { return null; } if (children != null) { return children; } Object[] returnc = new Object[mDebugVariables.size()]; int i = 0; for (DebugVariable debugVariable : mDebugVariables) { VariableNode variableNode = new VariableNode(debugVariable); returnc[i] = variableNode; i++; } children = returnc; return returnc; } }
public class class_name { protected Object[] getChildren() { if (mDebugVariables == null) { return null; // depends on control dependency: [if], data = [none] } if (children != null) { return children; // depends on control dependency: [if], data = [none] } Object[] returnc = new Object[mDebugVariables.size()]; int i = 0; for (DebugVariable debugVariable : mDebugVariables) { VariableNode variableNode = new VariableNode(debugVariable); returnc[i] = variableNode; // depends on control dependency: [for], data = [none] i++; // depends on control dependency: [for], data = [none] } children = returnc; return returnc; } }
public class class_name { public Context setEngine(Engine engine) { checkThread(); if (engine != null) { if (template != null && template.getEngine() != engine) { throw new IllegalStateException("Failed to set the context engine, because is not the same to template engine. template engine: " + template.getEngine().getName() + ", context engine: " + engine.getName() + ", template: " + template.getName() + ", context: " + thread.getName()); } if (parent != null && parent.getEngine() != engine) { parent.setEngine(engine); } if (this.engine == null) { setCurrent(engine.createContext(parent, current)); } } this.engine = engine; return this; } }
public class class_name { public Context setEngine(Engine engine) { checkThread(); if (engine != null) { if (template != null && template.getEngine() != engine) { throw new IllegalStateException("Failed to set the context engine, because is not the same to template engine. template engine: " + template.getEngine().getName() + ", context engine: " + engine.getName() + ", template: " + template.getName() + ", context: " + thread.getName()); } if (parent != null && parent.getEngine() != engine) { parent.setEngine(engine); // depends on control dependency: [if], data = [none] } if (this.engine == null) { setCurrent(engine.createContext(parent, current)); // depends on control dependency: [if], data = [none] } } this.engine = engine; return this; } }
public class class_name { public void add(Distribution anotherDistribution) { if (anotherDistribution != null) { numValues += anotherDistribution.numValues; sumValues += anotherDistribution.sumValues; sumSquareValues += anotherDistribution.sumSquareValues; minValue = (minValue < anotherDistribution.minValue) ? minValue : anotherDistribution.minValue; maxValue = (maxValue > anotherDistribution.maxValue) ? maxValue : anotherDistribution.maxValue; } } }
public class class_name { public void add(Distribution anotherDistribution) { if (anotherDistribution != null) { numValues += anotherDistribution.numValues; // depends on control dependency: [if], data = [none] sumValues += anotherDistribution.sumValues; // depends on control dependency: [if], data = [none] sumSquareValues += anotherDistribution.sumSquareValues; // depends on control dependency: [if], data = [none] minValue = (minValue < anotherDistribution.minValue) ? minValue : anotherDistribution.minValue; // depends on control dependency: [if], data = [none] maxValue = (maxValue > anotherDistribution.maxValue) ? maxValue : anotherDistribution.maxValue; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Object fromThriftRow(Class<?> clazz, EntityMetadata m, Object rowKey, List<String> relationNames, boolean isWrapReq, ConsistencyLevel consistencyLevel) throws Exception { Object e = null; SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 10000)); ByteBuffer key = ByteBuffer.wrap(PropertyAccessorHelper.toBytes(rowKey, m.getIdAttribute().getJavaType())); Connection conn = thriftClient.getConnection(); try { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz()); // For secondary tables. List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation()) .getSecondaryTablesName(); secondaryTables.add(m.getTableName()); for (String tableName : secondaryTables) { List<ColumnOrSuperColumn> columnOrSuperColumns = conn.getClient().get_slice(key, new ColumnParent(tableName), predicate, consistencyLevel); Map<ByteBuffer, List<ColumnOrSuperColumn>> thriftColumnOrSuperColumns = new HashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); thriftColumnOrSuperColumns.put(key, columnOrSuperColumns); if (!columnOrSuperColumns.isEmpty()) { e = populateEntityFromSlice(m, relationNames, isWrapReq, KunderaCoreUtils.getEntity(e), thriftColumnOrSuperColumns); } } return e; } finally { thriftClient.releaseConnection(conn); } } }
public class class_name { @Override public Object fromThriftRow(Class<?> clazz, EntityMetadata m, Object rowKey, List<String> relationNames, boolean isWrapReq, ConsistencyLevel consistencyLevel) throws Exception { Object e = null; SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 10000)); ByteBuffer key = ByteBuffer.wrap(PropertyAccessorHelper.toBytes(rowKey, m.getIdAttribute().getJavaType())); Connection conn = thriftClient.getConnection(); try { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel( m.getPersistenceUnit()); AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz()); // For secondary tables. List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation()) .getSecondaryTablesName(); secondaryTables.add(m.getTableName()); for (String tableName : secondaryTables) { List<ColumnOrSuperColumn> columnOrSuperColumns = conn.getClient().get_slice(key, new ColumnParent(tableName), predicate, consistencyLevel); Map<ByteBuffer, List<ColumnOrSuperColumn>> thriftColumnOrSuperColumns = new HashMap<ByteBuffer, List<ColumnOrSuperColumn>>(); thriftColumnOrSuperColumns.put(key, columnOrSuperColumns); // depends on control dependency: [for], data = [none] if (!columnOrSuperColumns.isEmpty()) { e = populateEntityFromSlice(m, relationNames, isWrapReq, KunderaCoreUtils.getEntity(e), thriftColumnOrSuperColumns); // depends on control dependency: [if], data = [none] } } return e; } finally { thriftClient.releaseConnection(conn); } } }
public class class_name { public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if ((map instanceof ImmutableMap) && !(map instanceof SortedMap)) { @SuppressWarnings("unchecked") // safe since map is not writable ImmutableMap<K, V> kvMap = (ImmutableMap<K, V>) map; if (!kvMap.isPartialView()) { return kvMap; } } return copyOf(map.entrySet()); } }
public class class_name { public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) { if ((map instanceof ImmutableMap) && !(map instanceof SortedMap)) { @SuppressWarnings("unchecked") // safe since map is not writable ImmutableMap<K, V> kvMap = (ImmutableMap<K, V>) map; if (!kvMap.isPartialView()) { return kvMap; // depends on control dependency: [if], data = [none] } } return copyOf(map.entrySet()); } }
public class class_name { private Collection<Facet> filter(Collection<Facet> facets) { if (NotStopWordPredicate == null) { return facets; } return facets.stream() .filter(NotStopWordPredicate) .collect(Collectors.toList()); } }
public class class_name { private Collection<Facet> filter(Collection<Facet> facets) { if (NotStopWordPredicate == null) { return facets; // depends on control dependency: [if], data = [none] } return facets.stream() .filter(NotStopWordPredicate) .collect(Collectors.toList()); } }
public class class_name { private void setVersion(long number) { String result = ""; for (int i = 0; i < 4; i++) { long mod = number % 1000L; number = number / 1000L; if (m_dots >= (4 - i)) { if (m_dots > (4 - i)) { result = '.' + result; } result = "" + mod + result; } } m_version = result; } }
public class class_name { private void setVersion(long number) { String result = ""; for (int i = 0; i < 4; i++) { long mod = number % 1000L; number = number / 1000L; // depends on control dependency: [for], data = [none] if (m_dots >= (4 - i)) { if (m_dots > (4 - i)) { result = '.' + result; // depends on control dependency: [if], data = [none] } result = "" + mod + result; // depends on control dependency: [if], data = [none] } } m_version = result; } }
public class class_name { @GwtIncompatible("NavigableSet") @SuppressWarnings("unchecked") public static <E> NavigableSet<E> filter( NavigableSet<E> unfiltered, Predicate<? super E> predicate) { if (unfiltered instanceof FilteredSet) { // Support clear(), removeAll(), and retainAll() when filtering a filtered // collection. FilteredSet<E> filtered = (FilteredSet<E>) unfiltered; Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate); return new FilteredNavigableSet<E>( (NavigableSet<E>) filtered.unfiltered, combinedPredicate); } return new FilteredNavigableSet<E>( checkNotNull(unfiltered), checkNotNull(predicate)); } }
public class class_name { @GwtIncompatible("NavigableSet") @SuppressWarnings("unchecked") public static <E> NavigableSet<E> filter( NavigableSet<E> unfiltered, Predicate<? super E> predicate) { if (unfiltered instanceof FilteredSet) { // Support clear(), removeAll(), and retainAll() when filtering a filtered // collection. FilteredSet<E> filtered = (FilteredSet<E>) unfiltered; Predicate<E> combinedPredicate = Predicates.<E>and(filtered.predicate, predicate); return new FilteredNavigableSet<E>( (NavigableSet<E>) filtered.unfiltered, combinedPredicate); // depends on control dependency: [if], data = [none] } return new FilteredNavigableSet<E>( checkNotNull(unfiltered), checkNotNull(predicate)); } }
public class class_name { public boolean accept(Versionize componentOrDependency) { boolean accept = getGroupId().equals(componentOrDependency.getGroupId()) && getArtifactId().equals(componentOrDependency.getArtifactId()); if (!accept) return false; if (getVersion() != null) { //有version需要,暂时不知道是否需要支持version的表达式,maven自身好像没有这个机制 accept = getVersion().equals(componentOrDependency.getVersion()); if (!accept) return false; } if( range != null ){ // Temp solution if( componentOrDependency.getVersion() == null ) return true; accept = range.containsVersion(new ComponentVersion(componentOrDependency.getVersion())); if (!accept) return false; } /* if( getClassifier() != null ){ accept = getClassifier().equals(componentOrDependency.getClassifier()); if (!accept) return false; } */ /* if( getType() != null ){ accept = getType().equals(componentOrDependency.getType()); if (!accept) return false; } */ return true; } }
public class class_name { public boolean accept(Versionize componentOrDependency) { boolean accept = getGroupId().equals(componentOrDependency.getGroupId()) && getArtifactId().equals(componentOrDependency.getArtifactId()); if (!accept) return false; if (getVersion() != null) { //有version需要,暂时不知道是否需要支持version的表达式,maven自身好像没有这个机制 accept = getVersion().equals(componentOrDependency.getVersion()); // depends on control dependency: [if], data = [none] if (!accept) return false; } if( range != null ){ // Temp solution if( componentOrDependency.getVersion() == null ) return true; accept = range.containsVersion(new ComponentVersion(componentOrDependency.getVersion())); // depends on control dependency: [if], data = [none] if (!accept) return false; } /* if( getClassifier() != null ){ accept = getClassifier().equals(componentOrDependency.getClassifier()); if (!accept) return false; } */ /* if( getType() != null ){ accept = getType().equals(componentOrDependency.getType()); if (!accept) return false; } */ return true; } }
public class class_name { private void moveTaskOutputs(TaskAttemptContext context, FileSystem fs, Path jobOutputDir, Path taskOutput) throws IOException { TaskAttemptID attemptId = context.getTaskAttemptID(); context.progress(); if (fs.isFile(taskOutput)) { Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput, workPath); if (!fs.rename(taskOutput, finalOutputPath)) { if (!fs.delete(finalOutputPath, true)) { throw new IOException("Failed to delete earlier output of task: " + attemptId); } if (!fs.rename(taskOutput, finalOutputPath)) { throw new IOException("Failed to save output of task: " + attemptId); } } LOG.debug("Moved " + taskOutput + " to " + finalOutputPath); } else if(fs.getFileStatus(taskOutput).isDir()) { FileStatus[] paths = fs.listStatus(taskOutput); Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput, workPath); fs.mkdirs(finalOutputPath); if (paths != null) { for (FileStatus path : paths) { moveTaskOutputs(context, fs, jobOutputDir, path.getPath()); } } } } }
public class class_name { private void moveTaskOutputs(TaskAttemptContext context, FileSystem fs, Path jobOutputDir, Path taskOutput) throws IOException { TaskAttemptID attemptId = context.getTaskAttemptID(); context.progress(); if (fs.isFile(taskOutput)) { Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput, workPath); if (!fs.rename(taskOutput, finalOutputPath)) { if (!fs.delete(finalOutputPath, true)) { throw new IOException("Failed to delete earlier output of task: " + attemptId); } if (!fs.rename(taskOutput, finalOutputPath)) { throw new IOException("Failed to save output of task: " + attemptId); } } LOG.debug("Moved " + taskOutput + " to " + finalOutputPath); } else if(fs.getFileStatus(taskOutput).isDir()) { FileStatus[] paths = fs.listStatus(taskOutput); Path finalOutputPath = getFinalPath(jobOutputDir, taskOutput, workPath); fs.mkdirs(finalOutputPath); if (paths != null) { for (FileStatus path : paths) { moveTaskOutputs(context, fs, jobOutputDir, path.getPath()); // depends on control dependency: [for], data = [path] } } } } }
public class class_name { protected void setFuture(final Future<?> future) { final long stamp = lock.writeLock(); try { this.future = future; } finally { lock.unlockWrite(stamp); } } }
public class class_name { protected void setFuture(final Future<?> future) { final long stamp = lock.writeLock(); try { this.future = future; // depends on control dependency: [try], data = [none] } finally { lock.unlockWrite(stamp); } } }
public class class_name { public void addData(final BenchmarkMethod meth, final AbstractMeter meter, final double data) { final Class<?> clazz = meth.getMethodToBench().getDeclaringClass(); if (!elements.containsKey(clazz)) { elements.put(clazz, new ClassResult(clazz)); } final ClassResult clazzResult = elements.get(clazz); if (!clazzResult.elements.containsKey(meth)) { clazzResult.elements.put(meth, new MethodResult(meth)); } final MethodResult methodResult = clazzResult.elements.get(meth); methodResult.addData(meter, data); clazzResult.addData(meter, data); this.addData(meter, data); for (final AbstractOutput output : outputs) { output.listenToResultSet(meth, meter, data); } } }
public class class_name { public void addData(final BenchmarkMethod meth, final AbstractMeter meter, final double data) { final Class<?> clazz = meth.getMethodToBench().getDeclaringClass(); if (!elements.containsKey(clazz)) { elements.put(clazz, new ClassResult(clazz)); // depends on control dependency: [if], data = [none] } final ClassResult clazzResult = elements.get(clazz); if (!clazzResult.elements.containsKey(meth)) { clazzResult.elements.put(meth, new MethodResult(meth)); // depends on control dependency: [if], data = [none] } final MethodResult methodResult = clazzResult.elements.get(meth); methodResult.addData(meter, data); clazzResult.addData(meter, data); this.addData(meter, data); for (final AbstractOutput output : outputs) { output.listenToResultSet(meth, meter, data); // depends on control dependency: [for], data = [output] } } }
public class class_name { private static synchronized void collectLogEntry(int level, String tag, final String message, final Throwable err) { if (!isReportable(level)) { return; } if (maxOfEntriesInReports > 0 && entries.size() == maxOfEntriesInReports) { entries.remove(0); // Remove the first element. } entries.add(LogHelper.print(level, tag, message, err, addTimestampToReportLogs)); if (level >= reportTriggerLevel) { // Must be in another thread new Thread(new Runnable() { public void run() { try { report(message, err); } catch (Throwable e) { // Ignore } } }).start(); } } }
public class class_name { private static synchronized void collectLogEntry(int level, String tag, final String message, final Throwable err) { if (!isReportable(level)) { return; // depends on control dependency: [if], data = [none] } if (maxOfEntriesInReports > 0 && entries.size() == maxOfEntriesInReports) { entries.remove(0); // Remove the first element. // depends on control dependency: [if], data = [0] } entries.add(LogHelper.print(level, tag, message, err, addTimestampToReportLogs)); if (level >= reportTriggerLevel) { // Must be in another thread new Thread(new Runnable() { public void run() { try { report(message, err); // depends on control dependency: [try], data = [none] } catch (Throwable e) { // Ignore } // depends on control dependency: [catch], data = [none] } }).start(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void convertPKUtoCWS(String inputFolder, String outputFile, final int begin, final int end) throws IOException { final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8")); CorpusLoader.walk(inputFolder, new CorpusLoader.Handler() { int doc = 0; @Override public void handle(Document document) { ++doc; if (doc < begin || doc > end) return; try { List<List<Word>> sentenceList = convertComplexWordToSimpleWord(document.getComplexSentenceList()); if (sentenceList.size() == 0) return; for (List<Word> sentence : sentenceList) { if (sentence.size() == 0) continue; int index = 0; for (IWord iWord : sentence) { bw.write(iWord.getValue()); if (++index != sentence.size()) { bw.write(' '); } } bw.newLine(); } } catch (IOException e) { e.printStackTrace(); } } } ); bw.close(); } }
public class class_name { public static void convertPKUtoCWS(String inputFolder, String outputFile, final int begin, final int end) throws IOException { final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8")); CorpusLoader.walk(inputFolder, new CorpusLoader.Handler() { int doc = 0; @Override public void handle(Document document) { ++doc; if (doc < begin || doc > end) return; try { List<List<Word>> sentenceList = convertComplexWordToSimpleWord(document.getComplexSentenceList()); if (sentenceList.size() == 0) return; for (List<Word> sentence : sentenceList) { if (sentence.size() == 0) continue; int index = 0; for (IWord iWord : sentence) { bw.write(iWord.getValue()); // depends on control dependency: [for], data = [iWord] if (++index != sentence.size()) { bw.write(' '); // depends on control dependency: [if], data = [none] } } bw.newLine(); // depends on control dependency: [for], data = [none] } } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } ); bw.close(); } }
public class class_name { public void marshall(CreateProvisionedProductPlanRequest createProvisionedProductPlanRequest, ProtocolMarshaller protocolMarshaller) { if (createProvisionedProductPlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createProvisionedProductPlanRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPlanName(), PLANNAME_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPlanType(), PLANTYPE_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getNotificationArns(), NOTIFICATIONARNS_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPathId(), PATHID_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProductId(), PRODUCTID_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisioningParameters(), PROVISIONINGPARAMETERS_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING); protocolMarshaller.marshall(createProvisionedProductPlanRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateProvisionedProductPlanRequest createProvisionedProductPlanRequest, ProtocolMarshaller protocolMarshaller) { if (createProvisionedProductPlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createProvisionedProductPlanRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPlanName(), PLANNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPlanType(), PLANTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getNotificationArns(), NOTIFICATIONARNS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getPathId(), PATHID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProductId(), PRODUCTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getProvisioningParameters(), PROVISIONINGPARAMETERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createProvisionedProductPlanRequest.getTags(), TAGS_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 List<SyntacticCategory> getArgumentList() { if (isAtomic()) { return Lists.newArrayList(); } else { List<SyntacticCategory> args = getReturn().getArgumentList(); args.add(getArgument()); return args; } } }
public class class_name { public List<SyntacticCategory> getArgumentList() { if (isAtomic()) { return Lists.newArrayList(); // depends on control dependency: [if], data = [none] } else { List<SyntacticCategory> args = getReturn().getArgumentList(); args.add(getArgument()); // depends on control dependency: [if], data = [none] return args; // depends on control dependency: [if], data = [none] } } }
public class class_name { final void dispatchEvent(final Object event) { executor.execute( new Runnable() { @Override public void run() { try { invokeSubscriberMethod(event); } catch (InvocationTargetException e) { bus.handleSubscriberException(e.getCause(), context(event)); } } }); } }
public class class_name { final void dispatchEvent(final Object event) { executor.execute( new Runnable() { @Override public void run() { try { invokeSubscriberMethod(event); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { bus.handleSubscriberException(e.getCause(), context(event)); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { @Override public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, Artifacts artifacts) { List<ArtiDAO.Data> ladd = new ArrayList<ArtiDAO.Data>(); for(Artifact arti : artifacts.getArtifact()) { ArtiDAO.Data data = new ArtiDAO.Data(); data.mechid = arti.getMechid(); data.machine = arti.getMachine(); data.type(true).addAll(arti.getType()); data.ca = arti.getCa(); data.dir = arti.getDir(); data.os_user = arti.getOsUser(); // Optional (on way in) data.appName = arti.getAppName(); data.renewDays = arti.getRenewDays(); data.notify = arti.getNotification(); // Ignored on way in for create/update data.sponsor = arti.getSponsor(); data.expires = null; // Derive Optional Data from Machine (Domain) if exists if(data.machine!=null) { if(data.ca==null) { if(data.machine.endsWith(".att.com")) { data.ca = "aaf"; // default } } if(data.appName==null ) { data.appName=AAFCon.reverseDomain(data.machine); } } ladd.add(data); } return ladd; } }
public class class_name { @Override public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, Artifacts artifacts) { List<ArtiDAO.Data> ladd = new ArrayList<ArtiDAO.Data>(); for(Artifact arti : artifacts.getArtifact()) { ArtiDAO.Data data = new ArtiDAO.Data(); data.mechid = arti.getMechid(); // depends on control dependency: [for], data = [arti] data.machine = arti.getMachine(); // depends on control dependency: [for], data = [arti] data.type(true).addAll(arti.getType()); // depends on control dependency: [for], data = [arti] data.ca = arti.getCa(); // depends on control dependency: [for], data = [arti] data.dir = arti.getDir(); // depends on control dependency: [for], data = [arti] data.os_user = arti.getOsUser(); // depends on control dependency: [for], data = [arti] // Optional (on way in) data.appName = arti.getAppName(); // depends on control dependency: [for], data = [arti] data.renewDays = arti.getRenewDays(); // depends on control dependency: [for], data = [arti] data.notify = arti.getNotification(); // depends on control dependency: [for], data = [arti] // Ignored on way in for create/update data.sponsor = arti.getSponsor(); // depends on control dependency: [for], data = [arti] data.expires = null; // depends on control dependency: [for], data = [none] // Derive Optional Data from Machine (Domain) if exists if(data.machine!=null) { if(data.ca==null) { if(data.machine.endsWith(".att.com")) { data.ca = "aaf"; // default // depends on control dependency: [if], data = [none] } } if(data.appName==null ) { data.appName=AAFCon.reverseDomain(data.machine); // depends on control dependency: [if], data = [none] } } ladd.add(data); // depends on control dependency: [for], data = [none] } return ladd; } }