code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override protected Properties createSessionProperties() { final Properties props = super.createSessionProperties(); props.setProperty(MAIL_TRANSPORT_PROTOCOL, PROTOCOL_SMTP); props.setProperty(MAIL_HOST, host); props.setProperty(MAIL_SMTP_HOST, host); props.setProperty(MAIL_SMTP_PORT, String.valueOf(port)); if (authenticator != null) { props.setProperty(MAIL_SMTP_AUTH, TRUE); } if (timeout > 0) { final String timeoutValue = String.valueOf(timeout); props.put(MAIL_SMTP_CONNECTIONTIMEOUT, timeoutValue); props.put(MAIL_SMTP_TIMEOUT, timeoutValue); props.put(MAIL_SMTP_WRITETIMEOUT, timeoutValue); } return props; } }
public class class_name { @Override protected Properties createSessionProperties() { final Properties props = super.createSessionProperties(); props.setProperty(MAIL_TRANSPORT_PROTOCOL, PROTOCOL_SMTP); props.setProperty(MAIL_HOST, host); props.setProperty(MAIL_SMTP_HOST, host); props.setProperty(MAIL_SMTP_PORT, String.valueOf(port)); if (authenticator != null) { props.setProperty(MAIL_SMTP_AUTH, TRUE); // depends on control dependency: [if], data = [none] } if (timeout > 0) { final String timeoutValue = String.valueOf(timeout); props.put(MAIL_SMTP_CONNECTIONTIMEOUT, timeoutValue); // depends on control dependency: [if], data = [none] props.put(MAIL_SMTP_TIMEOUT, timeoutValue); // depends on control dependency: [if], data = [none] props.put(MAIL_SMTP_WRITETIMEOUT, timeoutValue); // depends on control dependency: [if], data = [none] } return props; } }
public class class_name { @RequirePOST public synchronized void doCreateItem( StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String mode, @QueryParameter String from ) throws IOException, ServletException { final Jenkins app = Jenkins.getInstance(); app.checkPermission(Computer.CREATE); if(mode!=null && mode.equals("copy")) { name = checkName(name); Node src = app.getNode(from); if(src==null) { if (Util.fixEmpty(from) == null) { throw new Failure(Messages.ComputerSet_SpecifySlaveToCopy()); } else { throw new Failure(Messages.ComputerSet_NoSuchSlave(from)); } } // copy through XStream String xml = Jenkins.XSTREAM.toXML(src); Node result = (Node) Jenkins.XSTREAM.fromXML(xml); result.setNodeName(name); if(result instanceof Slave){ //change userId too User user = User.current(); ((Slave)result).setUserId(user==null ? "anonymous" : user.getId()); } result.holdOffLaunchUntilSave = true; app.addNode(result); // send the browser to the config page rsp.sendRedirect2(result.getNodeName()+"/configure"); } else { // proceed to step 2 if (mode == null) { throw new Failure("No mode given"); } NodeDescriptor d = NodeDescriptor.all().findByName(mode); if (d == null) { throw new Failure("No node type ‘" + mode + "’ is known"); } d.handleNewNodePage(this,name,req,rsp); } } }
public class class_name { @RequirePOST public synchronized void doCreateItem( StaplerRequest req, StaplerResponse rsp, @QueryParameter String name, @QueryParameter String mode, @QueryParameter String from ) throws IOException, ServletException { final Jenkins app = Jenkins.getInstance(); app.checkPermission(Computer.CREATE); if(mode!=null && mode.equals("copy")) { name = checkName(name); Node src = app.getNode(from); if(src==null) { if (Util.fixEmpty(from) == null) { throw new Failure(Messages.ComputerSet_SpecifySlaveToCopy()); } else { throw new Failure(Messages.ComputerSet_NoSuchSlave(from)); } } // copy through XStream String xml = Jenkins.XSTREAM.toXML(src); Node result = (Node) Jenkins.XSTREAM.fromXML(xml); result.setNodeName(name); if(result instanceof Slave){ //change userId too User user = User.current(); ((Slave)result).setUserId(user==null ? "anonymous" : user.getId()); // depends on control dependency: [if], data = [none] } result.holdOffLaunchUntilSave = true; app.addNode(result); // send the browser to the config page rsp.sendRedirect2(result.getNodeName()+"/configure"); } else { // proceed to step 2 if (mode == null) { throw new Failure("No mode given"); } NodeDescriptor d = NodeDescriptor.all().findByName(mode); if (d == null) { throw new Failure("No node type ‘" + mode + "’ is known"); } d.handleNewNodePage(this,name,req,rsp); } } }
public class class_name { public void handle(final WebSocketSession session, byte[] bytes) { if (session == null) { throw new NullPointerException("session"); } try { JsonRpcMessage msg = jsonRpcControl.receive(bytes); if (msg instanceof JsonRpcRequest) { handleRequest(session, (JsonRpcRequest) msg); } else if (msg instanceof JsonRpcResponse) { handleResponse(session, (JsonRpcResponse) msg); } } catch (Exception e) { config.getErrorProcessor().onError(session.getId(), e); } } }
public class class_name { public void handle(final WebSocketSession session, byte[] bytes) { if (session == null) { throw new NullPointerException("session"); } try { JsonRpcMessage msg = jsonRpcControl.receive(bytes); if (msg instanceof JsonRpcRequest) { handleRequest(session, (JsonRpcRequest) msg); // depends on control dependency: [if], data = [none] } else if (msg instanceof JsonRpcResponse) { handleResponse(session, (JsonRpcResponse) msg); // depends on control dependency: [if], data = [none] } } catch (Exception e) { config.getErrorProcessor().onError(session.getId(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String getBaseUri(HttpServletRequest req, CmsObject cms) { String baseUri = req.getParameter(PARAM_BASE_URI); if (CmsStringUtil.isEmptyOrWhitespaceOnly(baseUri)) { String referer = req.getHeader(HEADER_REFERER_KEY); CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(cms.getRequestContext().getSiteRoot()); if (site != null) { String prefix = site.getServerPrefix(cms, "/") + OpenCms.getStaticExportManager().getVfsPrefix(); if ((referer != null) && referer.startsWith(prefix)) { baseUri = referer.substring(prefix.length()); } } } return baseUri; } }
public class class_name { private String getBaseUri(HttpServletRequest req, CmsObject cms) { String baseUri = req.getParameter(PARAM_BASE_URI); if (CmsStringUtil.isEmptyOrWhitespaceOnly(baseUri)) { String referer = req.getHeader(HEADER_REFERER_KEY); CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(cms.getRequestContext().getSiteRoot()); if (site != null) { String prefix = site.getServerPrefix(cms, "/") + OpenCms.getStaticExportManager().getVfsPrefix(); if ((referer != null) && referer.startsWith(prefix)) { baseUri = referer.substring(prefix.length()); // depends on control dependency: [if], data = [none] } } } return baseUri; } }
public class class_name { public static boolean isPublicMethodFinal(Class clazz, String name, TypeDesc retType, TypeDesc[] params) { if (!clazz.isInterface()) { Class[] paramClasses; if (params == null || params.length == 0) { paramClasses = null; } else { paramClasses = new Class[params.length]; for (int i=0; i<params.length; i++) { paramClasses[i] = params[i].toClass(); } } try { Method existing = clazz.getMethod(name, paramClasses); if (Modifier.isFinal(existing.getModifiers())) { if (retType == null) { retType = TypeDesc.forClass(void.class); } if (TypeDesc.forClass(existing.getReturnType()) == retType) { // Method is already implemented and is final. return true; } } } catch (NoSuchMethodException e) { } } return false; } }
public class class_name { public static boolean isPublicMethodFinal(Class clazz, String name, TypeDesc retType, TypeDesc[] params) { if (!clazz.isInterface()) { Class[] paramClasses; if (params == null || params.length == 0) { paramClasses = null; // depends on control dependency: [if], data = [none] } else { paramClasses = new Class[params.length]; // depends on control dependency: [if], data = [none] for (int i=0; i<params.length; i++) { paramClasses[i] = params[i].toClass(); // depends on control dependency: [for], data = [i] } } try { Method existing = clazz.getMethod(name, paramClasses); if (Modifier.isFinal(existing.getModifiers())) { if (retType == null) { retType = TypeDesc.forClass(void.class); // depends on control dependency: [if], data = [none] } if (TypeDesc.forClass(existing.getReturnType()) == retType) { // Method is already implemented and is final. return true; // depends on control dependency: [if], data = [none] } } } catch (NoSuchMethodException e) { } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { private InputStream locateStreamFromJar(final String uri, final File jarPath) throws IOException { JarFile jarFile = null; try { LOG.debug("Locating stream from jar: {}", jarPath); final WildcardContext wildcardContext = new WildcardContext(uri, jarPath); String classPath = FilenameUtils.getPath(uri); if (classPath.startsWith(ClasspathUriLocator.PREFIX)) { classPath = substringAfter(classPath, ClasspathUriLocator.PREFIX); } jarFile = open(jarPath); final List<JarEntry> jarEntryList = Collections.list(jarFile.entries()); final List<JarEntry> filteredJarEntryList = new ArrayList<JarEntry>(); final List<File> allFiles = new ArrayList<File>(); for (final JarEntry entry : jarEntryList) { final String entryName = entry.getName(); // ignore the parent folder itself and accept only child resources final boolean isSupportedEntry = entryName.startsWith(classPath) && !entryName.equals(classPath) && accept(entryName, wildcardContext.getWildcard()); if (isSupportedEntry) { allFiles.add(new File(entryName)); LOG.debug("\tfound jar entry: {}", entryName); filteredJarEntryList.add(entry); } } final ByteArrayOutputStream out = new ByteArrayOutputStream(); triggerWildcardExpander(allFiles, wildcardContext); for (final JarEntry entry : filteredJarEntryList) { final InputStream is = jarFile.getInputStream(entry); IOUtils.copy(is, out); is.close(); } return new BufferedInputStream(new ByteArrayInputStream(out.toByteArray())); } finally { IOUtils.closeQuietly(jarFile); } } }
public class class_name { private InputStream locateStreamFromJar(final String uri, final File jarPath) throws IOException { JarFile jarFile = null; try { LOG.debug("Locating stream from jar: {}", jarPath); final WildcardContext wildcardContext = new WildcardContext(uri, jarPath); String classPath = FilenameUtils.getPath(uri); if (classPath.startsWith(ClasspathUriLocator.PREFIX)) { classPath = substringAfter(classPath, ClasspathUriLocator.PREFIX); // depends on control dependency: [if], data = [none] } jarFile = open(jarPath); final List<JarEntry> jarEntryList = Collections.list(jarFile.entries()); final List<JarEntry> filteredJarEntryList = new ArrayList<JarEntry>(); final List<File> allFiles = new ArrayList<File>(); for (final JarEntry entry : jarEntryList) { final String entryName = entry.getName(); // ignore the parent folder itself and accept only child resources final boolean isSupportedEntry = entryName.startsWith(classPath) && !entryName.equals(classPath) && accept(entryName, wildcardContext.getWildcard()); if (isSupportedEntry) { allFiles.add(new File(entryName)); // depends on control dependency: [if], data = [none] LOG.debug("\tfound jar entry: {}", entryName); // depends on control dependency: [if], data = [none] filteredJarEntryList.add(entry); // depends on control dependency: [if], data = [none] } } final ByteArrayOutputStream out = new ByteArrayOutputStream(); triggerWildcardExpander(allFiles, wildcardContext); for (final JarEntry entry : filteredJarEntryList) { final InputStream is = jarFile.getInputStream(entry); IOUtils.copy(is, out); // depends on control dependency: [for], data = [none] is.close(); // depends on control dependency: [for], data = [none] } return new BufferedInputStream(new ByteArrayInputStream(out.toByteArray())); } finally { IOUtils.closeQuietly(jarFile); } } }
public class class_name { @Action(name = "Invoke AWS Lambda Function", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = REGION, required = true) String region, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD) String proxyPassword, @Param(value = FUNCTION_NAME, required = true) String function, @Param(value = FUNCTION_QUALIFIER) String qualifier, @Param(value = FUNCTION_PAYLOAD) String payload, @Param(value = CONNECT_TIMEOUT) String connectTimeoutMs, @Param(value = EXECUTION_TIMEOUT) String execTimeoutMs) { proxyPort = defaultIfEmpty(proxyPort, DefaultValues.PROXY_PORT); connectTimeoutMs = defaultIfEmpty(connectTimeoutMs, DefaultValues.CONNECT_TIMEOUT); execTimeoutMs = defaultIfBlank(execTimeoutMs, DefaultValues.EXEC_TIMEOUT); qualifier = defaultIfBlank(qualifier, DefaultValues.DEFAULT_FUNCTION_QUALIFIER); ClientConfiguration lambdaClientConf = AmazonWebServiceClientUtil.getClientConfiguration(proxyHost, proxyPort, proxyUsername, proxyPassword, connectTimeoutMs, execTimeoutMs); AWSLambdaAsyncClient client = (AWSLambdaAsyncClient) AWSLambdaAsyncClientBuilder.standard() .withClientConfiguration(lambdaClientConf) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(identity, credential))) .withRegion(region) .build(); InvokeRequest invokeRequest = new InvokeRequest() .withFunctionName(function) .withQualifier(qualifier) .withPayload(payload) .withSdkClientExecutionTimeout(Integer.parseInt(execTimeoutMs)); try { InvokeResult invokeResult = client.invoke(invokeRequest); return OutputUtilities.getSuccessResultsMap(new String(invokeResult.getPayload().array())); } catch (Exception e) { return OutputUtilities.getFailureResultsMap(e); } } }
public class class_name { @Action(name = "Invoke AWS Lambda Function", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = REGION, required = true) String region, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD) String proxyPassword, @Param(value = FUNCTION_NAME, required = true) String function, @Param(value = FUNCTION_QUALIFIER) String qualifier, @Param(value = FUNCTION_PAYLOAD) String payload, @Param(value = CONNECT_TIMEOUT) String connectTimeoutMs, @Param(value = EXECUTION_TIMEOUT) String execTimeoutMs) { proxyPort = defaultIfEmpty(proxyPort, DefaultValues.PROXY_PORT); connectTimeoutMs = defaultIfEmpty(connectTimeoutMs, DefaultValues.CONNECT_TIMEOUT); execTimeoutMs = defaultIfBlank(execTimeoutMs, DefaultValues.EXEC_TIMEOUT); qualifier = defaultIfBlank(qualifier, DefaultValues.DEFAULT_FUNCTION_QUALIFIER); ClientConfiguration lambdaClientConf = AmazonWebServiceClientUtil.getClientConfiguration(proxyHost, proxyPort, proxyUsername, proxyPassword, connectTimeoutMs, execTimeoutMs); AWSLambdaAsyncClient client = (AWSLambdaAsyncClient) AWSLambdaAsyncClientBuilder.standard() .withClientConfiguration(lambdaClientConf) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(identity, credential))) .withRegion(region) .build(); InvokeRequest invokeRequest = new InvokeRequest() .withFunctionName(function) .withQualifier(qualifier) .withPayload(payload) .withSdkClientExecutionTimeout(Integer.parseInt(execTimeoutMs)); try { InvokeResult invokeResult = client.invoke(invokeRequest); return OutputUtilities.getSuccessResultsMap(new String(invokeResult.getPayload().array())); // depends on control dependency: [try], data = [none] } catch (Exception e) { return OutputUtilities.getFailureResultsMap(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(ApplySchemaRequest applySchemaRequest, ProtocolMarshaller protocolMarshaller) { if (applySchemaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(applySchemaRequest.getPublishedSchemaArn(), PUBLISHEDSCHEMAARN_BINDING); protocolMarshaller.marshall(applySchemaRequest.getDirectoryArn(), DIRECTORYARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ApplySchemaRequest applySchemaRequest, ProtocolMarshaller protocolMarshaller) { if (applySchemaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(applySchemaRequest.getPublishedSchemaArn(), PUBLISHEDSCHEMAARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applySchemaRequest.getDirectoryArn(), DIRECTORYARN_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 LocalDateTime getStartDateTime() { if (startDateTime == null) { startDateTime = LocalDateTime.of(getStartDate(), getStartTime()); } return startDateTime; } }
public class class_name { public LocalDateTime getStartDateTime() { if (startDateTime == null) { startDateTime = LocalDateTime.of(getStartDate(), getStartTime()); // depends on control dependency: [if], data = [none] } return startDateTime; } }
public class class_name { private static String replaceChars(String e, String chars1, String chars2) { assert chars1.length() == chars2.length(); String[] parts = e.split(","); for (int i = 0; i < parts.length; ++i) { String[] elems = parts[i].split("/"); for (int j = 0; j < chars1.length(); ++j) { elems[0] = elems[0].replace(chars1.charAt(j), chars2.charAt(j)); } parts[i] = concat('/', elems); } return concat(',', parts); } }
public class class_name { private static String replaceChars(String e, String chars1, String chars2) { assert chars1.length() == chars2.length(); String[] parts = e.split(","); for (int i = 0; i < parts.length; ++i) { String[] elems = parts[i].split("/"); for (int j = 0; j < chars1.length(); ++j) { elems[0] = elems[0].replace(chars1.charAt(j), chars2.charAt(j)); // depends on control dependency: [for], data = [j] } parts[i] = concat('/', elems); // depends on control dependency: [for], data = [i] } return concat(',', parts); } }
public class class_name { private JsonError handleObject(final ObjectNode node, final OutputStream output) throws IOException { logger.debug("Request: {}", node); if (!isValidRequest(node)) { return writeAndFlushValueError(output, createResponseError(VERSION, NULL, JsonError.INVALID_REQUEST)); } Object id = parseId(node.get(ID)); String jsonRpc = hasNonNullData(node, JSONRPC) ? node.get(JSONRPC).asText() : VERSION; if (!hasNonNullData(node, METHOD)) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_NOT_FOUND)); } final String fullMethodName = node.get(METHOD).asText(); final String partialMethodName = getMethodName(fullMethodName); final String serviceName = getServiceName(fullMethodName); Set<Method> methods = findCandidateMethods(getHandlerInterfaces(serviceName), partialMethodName); if (methods.isEmpty()) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_NOT_FOUND)); } AMethodWithItsArgs methodArgs = findBestMethodByParamsNode(methods, node.get(PARAMS)); if (methodArgs == null) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_PARAMS_INVALID)); } try (InvokeListenerHandler handler = new InvokeListenerHandler(methodArgs, invocationListener)) { try { if (this.requestInterceptor != null) { this.requestInterceptor.interceptRequest(node); } Object target = getHandler(serviceName); // interceptors preHandle for (JsonRpcInterceptor interceptor : interceptorList) { interceptor.preHandle(target, methodArgs.method, methodArgs.arguments); } // invocation JsonNode result = invoke(target, methodArgs.method, methodArgs.arguments); handler.result = result; // interceptors postHandle for (JsonRpcInterceptor interceptor : interceptorList) { interceptor.postHandle(target, methodArgs.method, methodArgs.arguments, result); } if (!isNotificationRequest(id)) { ObjectNode response = createResponseSuccess(jsonRpc, id, handler.result); writeAndFlushValue(output, response); } return JsonError.OK; } catch (Throwable e) { handler.error = e; return handleError(output, id, jsonRpc, methodArgs, e); } } } }
public class class_name { private JsonError handleObject(final ObjectNode node, final OutputStream output) throws IOException { logger.debug("Request: {}", node); if (!isValidRequest(node)) { return writeAndFlushValueError(output, createResponseError(VERSION, NULL, JsonError.INVALID_REQUEST)); } Object id = parseId(node.get(ID)); String jsonRpc = hasNonNullData(node, JSONRPC) ? node.get(JSONRPC).asText() : VERSION; if (!hasNonNullData(node, METHOD)) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_NOT_FOUND)); } final String fullMethodName = node.get(METHOD).asText(); final String partialMethodName = getMethodName(fullMethodName); final String serviceName = getServiceName(fullMethodName); Set<Method> methods = findCandidateMethods(getHandlerInterfaces(serviceName), partialMethodName); if (methods.isEmpty()) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_NOT_FOUND)); } AMethodWithItsArgs methodArgs = findBestMethodByParamsNode(methods, node.get(PARAMS)); if (methodArgs == null) { return writeAndFlushValueError(output, createResponseError(jsonRpc, id, JsonError.METHOD_PARAMS_INVALID)); } try (InvokeListenerHandler handler = new InvokeListenerHandler(methodArgs, invocationListener)) { try { if (this.requestInterceptor != null) { this.requestInterceptor.interceptRequest(node); // depends on control dependency: [if], data = [none] } Object target = getHandler(serviceName); // interceptors preHandle for (JsonRpcInterceptor interceptor : interceptorList) { interceptor.preHandle(target, methodArgs.method, methodArgs.arguments); // depends on control dependency: [for], data = [interceptor] } // invocation JsonNode result = invoke(target, methodArgs.method, methodArgs.arguments); handler.result = result; // depends on control dependency: [try], data = [none] // interceptors postHandle for (JsonRpcInterceptor interceptor : interceptorList) { interceptor.postHandle(target, methodArgs.method, methodArgs.arguments, result); // depends on control dependency: [for], data = [interceptor] } if (!isNotificationRequest(id)) { ObjectNode response = createResponseSuccess(jsonRpc, id, handler.result); writeAndFlushValue(output, response); // depends on control dependency: [if], data = [none] } return JsonError.OK; // depends on control dependency: [try], data = [none] } catch (Throwable e) { handler.error = e; return handleError(output, id, jsonRpc, methodArgs, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static void populateDefaultsAndExtensions( Map<String, Descriptors.FileDescriptor> fileDescriptorMap, Map<String, Set<Descriptors.FieldDescriptor>> typeToExtensionMap, Map<String, Object> defaultValueMap ) { for (Descriptors.FileDescriptor f : fileDescriptorMap.values()) { // go over every file descriptor and look for extensions and default values of those extensions for (Descriptors.FieldDescriptor fieldDescriptor : f.getExtensions()) { String containingType = fieldDescriptor.getContainingType().getFullName(); Set<Descriptors.FieldDescriptor> fieldDescriptors = typeToExtensionMap.get(containingType); if (fieldDescriptors == null) { fieldDescriptors = new LinkedHashSet<>(); typeToExtensionMap.put(containingType, fieldDescriptors); } fieldDescriptors.add(fieldDescriptor); if (fieldDescriptor.hasDefaultValue()) { defaultValueMap.put(containingType + "." + fieldDescriptor.getName(), fieldDescriptor.getDefaultValue()); } } // go over messages within file descriptor and look for all fields and extensions and their defaults for (Descriptors.Descriptor d : f.getMessageTypes()) { addDefaultsAndExtensions(typeToExtensionMap, defaultValueMap, d); } } } }
public class class_name { public static void populateDefaultsAndExtensions( Map<String, Descriptors.FileDescriptor> fileDescriptorMap, Map<String, Set<Descriptors.FieldDescriptor>> typeToExtensionMap, Map<String, Object> defaultValueMap ) { for (Descriptors.FileDescriptor f : fileDescriptorMap.values()) { // go over every file descriptor and look for extensions and default values of those extensions for (Descriptors.FieldDescriptor fieldDescriptor : f.getExtensions()) { String containingType = fieldDescriptor.getContainingType().getFullName(); Set<Descriptors.FieldDescriptor> fieldDescriptors = typeToExtensionMap.get(containingType); if (fieldDescriptors == null) { fieldDescriptors = new LinkedHashSet<>(); // depends on control dependency: [if], data = [none] typeToExtensionMap.put(containingType, fieldDescriptors); // depends on control dependency: [if], data = [none] } fieldDescriptors.add(fieldDescriptor); // depends on control dependency: [for], data = [fieldDescriptor] if (fieldDescriptor.hasDefaultValue()) { defaultValueMap.put(containingType + "." + fieldDescriptor.getName(), fieldDescriptor.getDefaultValue()); // depends on control dependency: [if], data = [none] } } // go over messages within file descriptor and look for all fields and extensions and their defaults for (Descriptors.Descriptor d : f.getMessageTypes()) { addDefaultsAndExtensions(typeToExtensionMap, defaultValueMap, d); // depends on control dependency: [for], data = [d] } } } }
public class class_name { protected Bucket getBucketForValue(long value) { Bucket bucket; if (value < min) { bucket = buckets[0]; } else { if (value >= max) { bucket = buckets[bucketNb + 1]; } else { // Linear interpolation int bucketIndex = 1 + (int) ((value - min) * (bucketNb - 1) / (max - min)); bucket = buckets[bucketIndex]; // As the division above was round at floor, bucket may be the next one if (value > bucket.getMax()) { bucketIndex++; bucket = buckets[bucketIndex]; } } } return bucket; } }
public class class_name { protected Bucket getBucketForValue(long value) { Bucket bucket; if (value < min) { bucket = buckets[0]; // depends on control dependency: [if], data = [none] } else { if (value >= max) { bucket = buckets[bucketNb + 1]; // depends on control dependency: [if], data = [none] } else { // Linear interpolation int bucketIndex = 1 + (int) ((value - min) * (bucketNb - 1) / (max - min)); bucket = buckets[bucketIndex]; // depends on control dependency: [if], data = [none] // As the division above was round at floor, bucket may be the next one if (value > bucket.getMax()) { bucketIndex++; // depends on control dependency: [if], data = [none] bucket = buckets[bucketIndex]; // depends on control dependency: [if], data = [none] } } } return bucket; } }
public class class_name { public List<Blob> get(String blobName1, String blobName2, String... blobNames) { List<BlobId> blobIds = Lists.newArrayListWithCapacity(blobNames.length + 2); blobIds.add(BlobId.of(getName(), blobName1)); blobIds.add(BlobId.of(getName(), blobName2)); for (String blobName : blobNames) { blobIds.add(BlobId.of(getName(), blobName)); } return storage.get(blobIds); } }
public class class_name { public List<Blob> get(String blobName1, String blobName2, String... blobNames) { List<BlobId> blobIds = Lists.newArrayListWithCapacity(blobNames.length + 2); blobIds.add(BlobId.of(getName(), blobName1)); blobIds.add(BlobId.of(getName(), blobName2)); for (String blobName : blobNames) { blobIds.add(BlobId.of(getName(), blobName)); // depends on control dependency: [for], data = [blobName] } return storage.get(blobIds); } }
public class class_name { public void setEnvironmentNames(java.util.Collection<String> environmentNames) { if (environmentNames == null) { this.environmentNames = null; return; } this.environmentNames = new com.amazonaws.internal.SdkInternalList<String>(environmentNames); } }
public class class_name { public void setEnvironmentNames(java.util.Collection<String> environmentNames) { if (environmentNames == null) { this.environmentNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.environmentNames = new com.amazonaws.internal.SdkInternalList<String>(environmentNames); } }
public class class_name { protected Template load(Class<?> pageClass, Show methodShow) { // // try to find the template name // String template = null; String extension = null; Show show = pageClass.getAnnotation(Show.class); if (null != show) { template = show.value(); } if (methodShow != null) { if (template != null) { template = template + methodShow.value(); } else { template = methodShow.value(); } } // // an empty string means no template name was given // if (template == null || template.length() == 0) { // use the default name for the page class template = pageClass.getSimpleName(); } else { // Check and see if the supplied template value has a supported file extension for (String ext : templateSystem.getTemplateExtensions()) { String type = ext.replace("%s.", "."); if (template.endsWith(type)) { extension = type; break; } } } if (null == template) { throw new MissingTemplateException(String.format("Could not determine the base template name for %s", Show.class)); } TemplateSource templateSource = null; String text; boolean appendExtension = false; try { final ServletContext servletContext = context.get(); InputStream stream = null; // // If there was a matching file extension, short-circuit the deep search // if (template.contains(".") || null != extension) { // Check class neighborhood for direct match stream = pageClass.getResourceAsStream(template); // Check url conventions for direct match if (null == stream) { stream = open(template, servletContext); } // Same as above, but checks in WEB-INF if (null == stream) { stream = openWebInf(template, servletContext); } // Finally, try to get the resource from the servlet context internally if (null == stream) { stream = servletContext.getResourceAsStream(template); } } // // No direct match, so start hunting. // First, look in class neighborhood for template // if (null == stream) { appendExtension = true; for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, template); stream = pageClass.getResourceAsStream(name); if (null != stream) { extension = ext; break; } } } // // Check for qualified file paths in context // TODO: I think this is redundant, but make sure before deleting // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, pageClass.getSimpleName()); stream = open(name, servletContext); if (null != stream) { extension = ext; break; } } } // // Same thing, but check in WEB-INF // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, pageClass.getSimpleName()); stream = openWebInf(name, servletContext); if (null != stream) { extension = ext; break; } } } // // Finally, look in the ServletContext resource path if not in classpath // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, template); stream = servletContext.getResourceAsStream(name); if (null != stream) { extension = ext; break; } } } // //if there's still no template, then error out // if (null == stream) { throw new MissingTemplateException(String.format( "Could not find a suitable template for %s, did you remember to place an @Show? None of " + Arrays.toString(templateSystem.getTemplateExtensions()).replace("%s.", ".") + " could be found in either package [%s], in the root of the resource dir OR in WEB-INF/.", pageClass.getName(), pageClass.getSimpleName(), pageClass.getPackage().getName())); } text = read(stream); } catch (IOException e) { throw new TemplateLoadingException("Could not load template for (i/o error): " + pageClass, e); } if (appendExtension) template += "." + extension; return new Template(template, text, templateSource); } }
public class class_name { protected Template load(Class<?> pageClass, Show methodShow) { // // try to find the template name // String template = null; String extension = null; Show show = pageClass.getAnnotation(Show.class); if (null != show) { template = show.value(); // depends on control dependency: [if], data = [none] } if (methodShow != null) { if (template != null) { template = template + methodShow.value(); // depends on control dependency: [if], data = [none] } else { template = methodShow.value(); // depends on control dependency: [if], data = [none] } } // // an empty string means no template name was given // if (template == null || template.length() == 0) { // use the default name for the page class template = pageClass.getSimpleName(); // depends on control dependency: [if], data = [none] } else { // Check and see if the supplied template value has a supported file extension for (String ext : templateSystem.getTemplateExtensions()) { String type = ext.replace("%s.", "."); if (template.endsWith(type)) { extension = type; // depends on control dependency: [if], data = [none] break; } } } if (null == template) { throw new MissingTemplateException(String.format("Could not determine the base template name for %s", Show.class)); } TemplateSource templateSource = null; String text; boolean appendExtension = false; try { final ServletContext servletContext = context.get(); InputStream stream = null; // // If there was a matching file extension, short-circuit the deep search // if (template.contains(".") || null != extension) { // Check class neighborhood for direct match stream = pageClass.getResourceAsStream(template); // depends on control dependency: [if], data = [none] // Check url conventions for direct match if (null == stream) { stream = open(template, servletContext); // depends on control dependency: [if], data = [none] } // Same as above, but checks in WEB-INF if (null == stream) { stream = openWebInf(template, servletContext); // depends on control dependency: [if], data = [none] } // Finally, try to get the resource from the servlet context internally if (null == stream) { stream = servletContext.getResourceAsStream(template); // depends on control dependency: [if], data = [none] } } // // No direct match, so start hunting. // First, look in class neighborhood for template // if (null == stream) { appendExtension = true; // depends on control dependency: [if], data = [none] for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, template); stream = pageClass.getResourceAsStream(name); // depends on control dependency: [for], data = [none] if (null != stream) { extension = ext; // depends on control dependency: [if], data = [none] break; } } } // // Check for qualified file paths in context // TODO: I think this is redundant, but make sure before deleting // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, pageClass.getSimpleName()); stream = open(name, servletContext); // depends on control dependency: [for], data = [ext] if (null != stream) { extension = ext; // depends on control dependency: [if], data = [none] break; } } } // // Same thing, but check in WEB-INF // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, pageClass.getSimpleName()); stream = openWebInf(name, servletContext); // depends on control dependency: [for], data = [ext] if (null != stream) { extension = ext; // depends on control dependency: [if], data = [none] break; } } } // // Finally, look in the ServletContext resource path if not in classpath // if (null == stream) { for (String ext : templateSystem.getTemplateExtensions()) { String name = String.format(ext, template); stream = servletContext.getResourceAsStream(name); // depends on control dependency: [for], data = [ext] if (null != stream) { extension = ext; // depends on control dependency: [if], data = [none] break; } } } // //if there's still no template, then error out // if (null == stream) { throw new MissingTemplateException(String.format( "Could not find a suitable template for %s, did you remember to place an @Show? None of " + Arrays.toString(templateSystem.getTemplateExtensions()).replace("%s.", ".") + " could be found in either package [%s], in the root of the resource dir OR in WEB-INF/.", // depends on control dependency: [if], data = [none] pageClass.getName(), pageClass.getSimpleName(), pageClass.getPackage().getName())); // depends on control dependency: [if], data = [none] } text = read(stream); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new TemplateLoadingException("Could not load template for (i/o error): " + pageClass, e); } // depends on control dependency: [catch], data = [none] if (appendExtension) template += "." + extension; return new Template(template, text, templateSource); } }
public class class_name { Expression XreadRowValueConstructor() { Expression e; e = XreadExplicitRowValueConstructorOrNull(); if (e != null) { return e; } e = XreadRowOrCommonValueExpression(); if (e != null) { return e; } return XreadBooleanValueExpression(); } }
public class class_name { Expression XreadRowValueConstructor() { Expression e; e = XreadExplicitRowValueConstructorOrNull(); if (e != null) { return e; // depends on control dependency: [if], data = [none] } e = XreadRowOrCommonValueExpression(); if (e != null) { return e; // depends on control dependency: [if], data = [none] } return XreadBooleanValueExpression(); } }
public class class_name { public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, algorithm); Cipher cipher = Cipher.getInstance(transformation); SecureRandom random = new SecureRandom(); cipher.init(isEncrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); return cipher.doFinal(data); } catch (Throwable e) { e.printStackTrace(); return null; } } }
public class class_name { public static byte[] desTemplate(byte[] data, byte[] key, String algorithm, String transformation, boolean isEncrypt) { if (data == null || data.length == 0 || key == null || key.length == 0) return null; try { SecretKeySpec keySpec = new SecretKeySpec(key, algorithm); Cipher cipher = Cipher.getInstance(transformation); SecureRandom random = new SecureRandom(); cipher.init(isEncrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE, keySpec, random); // depends on control dependency: [try], data = [none] return cipher.doFinal(data); // depends on control dependency: [try], data = [none] } catch (Throwable e) { e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static String getLeadingZeros(int i, int size) { assert i <= size; int w1 = (int) Math.floor(Math.log10(size)); int w2 = (int) Math.floor(Math.log10(i)); String s = ""; for (int j = w2; j < w1; j++) { s += "0"; } return s; } }
public class class_name { private static String getLeadingZeros(int i, int size) { assert i <= size; int w1 = (int) Math.floor(Math.log10(size)); int w2 = (int) Math.floor(Math.log10(i)); String s = ""; for (int j = w2; j < w1; j++) { s += "0"; // depends on control dependency: [for], data = [none] } return s; } }
public class class_name { private String[] createDisplayedValues() { int steps = 1 + (int) Math.ceil((double) getRange() / (double) getStepSize()); String[] values = new String[steps]; int current = getMinNumber(); for (int i = 0; i < steps; i++) { values[i] = String.valueOf(current); current = Math.min(current + getStepSize(), getMaxNumber()); } return values; } }
public class class_name { private String[] createDisplayedValues() { int steps = 1 + (int) Math.ceil((double) getRange() / (double) getStepSize()); String[] values = new String[steps]; int current = getMinNumber(); for (int i = 0; i < steps; i++) { values[i] = String.valueOf(current); // depends on control dependency: [for], data = [i] current = Math.min(current + getStepSize(), getMaxNumber()); // depends on control dependency: [for], data = [none] } return values; } }
public class class_name { public <T> Iterator<T> limit(final Iterator<T> iter) { return new AbstractIterator<T>() { @Override protected T computeNext() { if (_remaining > 0 && iter.hasNext()) { _remaining--; return iter.next(); } return endOfData(); } }; } }
public class class_name { public <T> Iterator<T> limit(final Iterator<T> iter) { return new AbstractIterator<T>() { @Override protected T computeNext() { if (_remaining > 0 && iter.hasNext()) { _remaining--; // depends on control dependency: [if], data = [none] return iter.next(); // depends on control dependency: [if], data = [none] } return endOfData(); } }; } }
public class class_name { public static <E> Counter<E> multiplyInPlace(Counter<E> target, double multiplier) { for (Entry<E, Double> entry : target.entrySet()) { target.setCount(entry.getKey(), entry.getValue() * multiplier); } return target; } }
public class class_name { public static <E> Counter<E> multiplyInPlace(Counter<E> target, double multiplier) { for (Entry<E, Double> entry : target.entrySet()) { target.setCount(entry.getKey(), entry.getValue() * multiplier); // depends on control dependency: [for], data = [entry] } return target; } }
public class class_name { public String replaceAll(String replacement) { reset(); StringBuffer buffer = new StringBuffer(input.length()); while (find()) { appendReplacement(buffer, replacement); } return appendTail(buffer).toString(); } }
public class class_name { public String replaceAll(String replacement) { reset(); StringBuffer buffer = new StringBuffer(input.length()); while (find()) { appendReplacement(buffer, replacement); // depends on control dependency: [while], data = [none] } return appendTail(buffer).toString(); } }
public class class_name { public void parseClassificationsFiles(List<String> propertiesFiles) { if (isNotEmpty(propertiesFiles)) { for (String propertyFile : propertiesFiles) { if (StringUtils.isNotEmpty(propertyFile)) { processClassificationFile(propertyFile); } } } } }
public class class_name { public void parseClassificationsFiles(List<String> propertiesFiles) { if (isNotEmpty(propertiesFiles)) { for (String propertyFile : propertiesFiles) { if (StringUtils.isNotEmpty(propertyFile)) { processClassificationFile(propertyFile); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static boolean intArrayContains(int[] array, int numToCheck) { for (int i = 0; i < array.length; i++) { if (array[i] == numToCheck) { return true; } } return false; } }
public class class_name { public static boolean intArrayContains(int[] array, int numToCheck) { for (int i = 0; i < array.length; i++) { if (array[i] == numToCheck) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override public void begin(String namespaceURI, String name, Attributes attributes) throws Exception { XMLReader xmlReader = getDigester().getXMLReader(); Document doc = documentBuilder.newDocument(); NodeBuilder builder = null; if (nodeType == Node.ELEMENT_NODE) { Element element = null; if (getDigester().getNamespaceAware()) { element = doc.createElementNS(namespaceURI, name); for (int i = 0; i < attributes.getLength(); i++) { element.setAttributeNS(attributes.getURI(i), attributes.getLocalName(i), attributes.getValue(i)); } } else { element = doc.createElement(name); for (int i = 0; i < attributes.getLength(); i++) { element.setAttribute(attributes.getQName(i), attributes.getValue(i)); } } builder = new NodeBuilder(doc, element); } else { builder = new NodeBuilder(doc, doc.createDocumentFragment()); } xmlReader.setContentHandler(builder); } }
public class class_name { @Override public void begin(String namespaceURI, String name, Attributes attributes) throws Exception { XMLReader xmlReader = getDigester().getXMLReader(); Document doc = documentBuilder.newDocument(); NodeBuilder builder = null; if (nodeType == Node.ELEMENT_NODE) { Element element = null; if (getDigester().getNamespaceAware()) { element = doc.createElementNS(namespaceURI, name); // depends on control dependency: [if], data = [none] for (int i = 0; i < attributes.getLength(); i++) { element.setAttributeNS(attributes.getURI(i), attributes.getLocalName(i), attributes.getValue(i)); // depends on control dependency: [for], data = [i] } } else { element = doc.createElement(name); // depends on control dependency: [if], data = [none] for (int i = 0; i < attributes.getLength(); i++) { element.setAttribute(attributes.getQName(i), attributes.getValue(i)); // depends on control dependency: [for], data = [i] } } builder = new NodeBuilder(doc, element); } else { builder = new NodeBuilder(doc, doc.createDocumentFragment()); } xmlReader.setContentHandler(builder); } }
public class class_name { protected Boolean _hasSideEffects(XForLoopExpression expression, ISideEffectContext context) { context.open(); if (hasSideEffects(expression.getForExpression(), context)) { return true; } context.close(); return hasSideEffects(expression.getEachExpression(), context.branch()); } }
public class class_name { protected Boolean _hasSideEffects(XForLoopExpression expression, ISideEffectContext context) { context.open(); if (hasSideEffects(expression.getForExpression(), context)) { return true; // depends on control dependency: [if], data = [none] } context.close(); return hasSideEffects(expression.getEachExpression(), context.branch()); } }
public class class_name { public static void download(String type, int unitCount, String path) { int timeout = 300000; Set<String> hrefs = new HashSet<>(); System.out.println("【"+type+"】*** starting... "); for(int i=1; i<=unitCount; i++) { int times=0; boolean success = false; while (!success && (times++) < 3) { try { String url = "http://www.bbc.co.uk/learningenglish/english/course/" + type + "/unit-" + i + "/downloads"; System.out.println("unit " + i + "、connect " + url); for (Element element : Jsoup.connect(url).timeout(timeout).get().select("a")) { String href = element.attr("href").trim(); //只下载mp3、mp4、wav和pdf文件 if (href.endsWith(".mp3") || href.endsWith(".wav") || href.endsWith(".mp4") || href.endsWith(".pdf")) { hrefs.add(href); } } success = true; } catch (Exception e) { System.out.println(e.getMessage()+" retry..."); } } } AtomicInteger i = new AtomicInteger(1); count += hrefs.size(); hrefs.stream().sorted().forEach(href -> { int times=0; boolean success = false; while (!success && (times++) < 3) { try { //提取文件名称 String[] attr = href.split("/"); String fileName = attr[attr.length - 2] + "_" + attr[attr.length - 1].replace(attr[attr.length - 2], ""); if(attr[attr.length - 1].endsWith(attr[attr.length - 2])){ fileName = attr[attr.length - 1]; } fileName = fileName.replace("_download", ""); System.out.println(hrefs.size() + "/" + i.get() + "、find resource: " + href); //确保本地路径存储 Path dir = Paths.get(path, type); if (!Files.exists(dir)) { //不存在则新建 dir.toFile().mkdirs(); } //保存文件的完整本地路径 Path out = Paths.get(path, type, fileName); //如果文件存在则表示之前已经下载过,本次不用下载 //因为BBC的访问不稳定,所以可能需要执行程序多次才能完整下载完毕,所以这里要处理已存在文件的问题 if (!Files.exists(out)) { //下载文件 Connection.Response response = Jsoup.connect(href).maxBodySize(0).ignoreContentType(true).timeout(timeout).execute(); //将文件保存到本地 Files.write(out, response.bodyAsBytes()); System.out.println(hrefs.size() + "/" + i.get() + "、save resource to: " + out); } else { System.out.println(hrefs.size() + "/" + i.get() + "、resource exist, don't need to download"); } i.incrementAndGet(); success = true; } catch (Exception e) { System.out.println(e.getMessage()+" retry..."); } } }); } }
public class class_name { public static void download(String type, int unitCount, String path) { int timeout = 300000; Set<String> hrefs = new HashSet<>(); System.out.println("【"+type+"】*** starting... "); for(int i=1; i<=unitCount; i++) { int times=0; boolean success = false; while (!success && (times++) < 3) { try { String url = "http://www.bbc.co.uk/learningenglish/english/course/" + type + "/unit-" + i + "/downloads"; System.out.println("unit " + i + "、connect " + url); for (Element element : Jsoup.connect(url).timeout(timeout).get().select("a")) { String href = element.attr("href").trim(); //只下载mp3、mp4、wav和pdf文件 if (href.endsWith(".mp3") || href.endsWith(".wav") || href.endsWith(".mp4") || href.endsWith(".pdf")) { hrefs.add(href); } } success = true; } catch (Exception e) { System.out.println(e.getMessage()+" retry..."); } // depends on control dependency: [catch], data = [none] } } AtomicInteger i = new AtomicInteger(1); count += hrefs.size(); hrefs.stream().sorted().forEach(href -> { int times=0; boolean success = false; while (!success && (times++) < 3) { try { //提取文件名称 String[] attr = href.split("/"); String fileName = attr[attr.length - 2] + "_" + attr[attr.length - 1].replace(attr[attr.length - 2], ""); if(attr[attr.length - 1].endsWith(attr[attr.length - 2])){ fileName = attr[attr.length - 1]; // depends on control dependency: [if], data = [none] } fileName = fileName.replace("_download", ""); // depends on control dependency: [try], data = [none] System.out.println(hrefs.size() + "/" + i.get() + "、find resource: " + href); // depends on control dependency: [try], data = [none] //确保本地路径存储 Path dir = Paths.get(path, type); if (!Files.exists(dir)) { //不存在则新建 dir.toFile().mkdirs(); // depends on control dependency: [if], data = [none] } //保存文件的完整本地路径 Path out = Paths.get(path, type, fileName); //如果文件存在则表示之前已经下载过,本次不用下载 //因为BBC的访问不稳定,所以可能需要执行程序多次才能完整下载完毕,所以这里要处理已存在文件的问题 if (!Files.exists(out)) { //下载文件 Connection.Response response = Jsoup.connect(href).maxBodySize(0).ignoreContentType(true).timeout(timeout).execute(); //将文件保存到本地 Files.write(out, response.bodyAsBytes()); // depends on control dependency: [if], data = [none] System.out.println(hrefs.size() + "/" + i.get() + "、save resource to: " + out); // depends on control dependency: [if], data = [none] } else { System.out.println(hrefs.size() + "/" + i.get() + "、resource exist, don't need to download"); // depends on control dependency: [if], data = [none] } i.incrementAndGet(); // depends on control dependency: [try], data = [none] success = true; // depends on control dependency: [try], data = [none] } catch (Exception e) { System.out.println(e.getMessage()+" retry..."); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void addToCell(int index, int element) { if (cells.size() < index + 1) { addSingletonCell(element); } else { cells.get(index).add(element); } } }
public class class_name { public void addToCell(int index, int element) { if (cells.size() < index + 1) { addSingletonCell(element); // depends on control dependency: [if], data = [none] } else { cells.get(index).add(element); // depends on control dependency: [if], data = [none] } } }
public class class_name { private BufferedImage resample(BufferedImage pSource, BufferedImage pDest, InterpolationFilter pFilter) { final int dstWidth = pDest.getWidth(); final int dstHeight = pDest.getHeight(); final int srcWidth = pSource.getWidth(); final int srcHeight = pSource.getHeight(); /* create intermediate column to hold horizontal dst column zoom */ final ColorModel cm = pSource.getColorModel(); // final WritableRaster work = cm.createCompatibleWritableRaster(1, srcHeight); final WritableRaster work = ImageUtil.createCompatibleWritableRaster(pSource, cm, 1, srcHeight); double xscale = (double) dstWidth / (double) srcWidth; double yscale = (double) dstHeight / (double) srcHeight; ContributorList[] contribY = new ContributorList[dstHeight]; for (int i = 0; i < contribY.length; i++) { contribY[i] = new ContributorList(); } // TODO: What to do when fwidth > srcHeight or dstHeight double fwidth = pFilter.support(); if (yscale < 1.0) { double width = fwidth / yscale; double fscale = 1.0 / yscale; if (width <= .5) { // Reduce to point sampling. width = .5 + 1.0e-6; fscale = 1.0; } for (int i = 0; i < dstHeight; i++) { //contribY[i].n = 0; contribY[i].p = new Contributor[(int) (width * 2.0 + 1 + 0.5)]; double center = (double) i / yscale; int left = (int) Math.ceil(center - width); int right = (int) Math.floor(center + width); double density = 0.0; for (int j = left; j <= right; j++) { double weight = center - (double) j; weight = pFilter.filter(weight / fscale) / fscale; int n; if (j < 0) { n = -j; } else if (j >= srcHeight) { n = (srcHeight - j) + srcHeight - 1; } else { n = j; } /**/ if (n >= srcHeight) { n = n % srcHeight; } else if (n < 0) { n = srcHeight - 1; } /**/ int k = contribY[i].n++; contribY[i].p[k] = new Contributor(); contribY[i].p[k].pixel = n; contribY[i].p[k].weight = weight; density += weight; } if ((density != 0.0) && (density != 1.0)) { //Normalize. density = 1.0 / density; for (int k = 0; k < contribY[i].n; k++) { contribY[i].p[k].weight *= density; } } } } else { for (int i = 0; i < dstHeight; ++i) { //contribY[i].n = 0; contribY[i].p = new Contributor[(int) (fwidth * 2 + 1 + 0.5)]; double center = (double) i / yscale; double left = Math.ceil(center - fwidth); double right = Math.floor(center + fwidth); for (int j = (int) left; j <= right; ++j) { double weight = center - (double) j; weight = pFilter.filter(weight); int n; if (j < 0) { n = -j; } else if (j >= srcHeight) { n = (srcHeight - j) + srcHeight - 1; } else { n = j; } /**/ if (n >= srcHeight) { n = n % srcHeight; } else if (n < 0) { n = srcHeight - 1; } /**/ int k = contribY[i].n++; contribY[i].p[k] = new Contributor(); contribY[i].p[k].pixel = n; contribY[i].p[k].weight = weight; } } } final Raster raster = pSource.getRaster(); final WritableRaster out = pDest.getRaster(); // TODO: This is not optimal for non-byte-packed rasters... // (What? Maybe I implemented the fix, but forgot to remove the TODO?) final int numChannels = raster.getNumBands(); final int[] channelMax = new int[numChannels]; for (int k = 0; k < numChannels; k++) { channelMax[k] = (1 << pSource.getColorModel().getComponentSize(k)) - 1; } for (int xx = 0; xx < dstWidth; xx++) { ContributorList contribX = calcXContrib(xscale, fwidth, srcWidth, pFilter, xx); /* Apply horiz filter to make dst column in tmp. */ for (int k = 0; k < srcHeight; k++) { for (int channel = 0; channel < numChannels; channel++) { double weight = 0.0; boolean bPelDelta = false; // TODO: This line throws index out of bounds, if the image // is smaller than filter.support() double pel = raster.getSample(contribX.p[0].pixel, k, channel); for (int j = 0; j < contribX.n; j++) { double pel2 = j == 0 ? pel : raster.getSample(contribX.p[j].pixel, k, channel); if (pel2 != pel) { bPelDelta = true; } weight += pel2 * contribX.p[j].weight; } weight = bPelDelta ? round(weight) : pel; if (weight < 0) { weight = 0; } else if (weight > channelMax[channel]) { weight = channelMax[channel]; } work.setSample(0, k, channel, weight); } }/* next row in temp column */ /* The temp column has been built. Now stretch it vertically into dst column. */ for (int i = 0; i < dstHeight; i++) { for (int channel = 0; channel < numChannels; channel++) { double weight = 0.0; boolean bPelDelta = false; double pel = work.getSample(0, contribY[i].p[0].pixel, channel); for (int j = 0; j < contribY[i].n; j++) { // TODO: This line throws index out of bounds, if the image // is smaller than filter.support() double pel2 = j == 0 ? pel : work.getSample(0, contribY[i].p[j].pixel, channel); if (pel2 != pel) { bPelDelta = true; } weight += pel2 * contribY[i].p[j].weight; } weight = bPelDelta ? round(weight) : pel; if (weight < 0) { weight = 0; } else if (weight > channelMax[channel]) { weight = channelMax[channel]; } out.setSample(xx, i, channel, weight); } }/* next dst row */ }/* next dst column */ return pDest; } }
public class class_name { private BufferedImage resample(BufferedImage pSource, BufferedImage pDest, InterpolationFilter pFilter) { final int dstWidth = pDest.getWidth(); final int dstHeight = pDest.getHeight(); final int srcWidth = pSource.getWidth(); final int srcHeight = pSource.getHeight(); /* create intermediate column to hold horizontal dst column zoom */ final ColorModel cm = pSource.getColorModel(); // final WritableRaster work = cm.createCompatibleWritableRaster(1, srcHeight); final WritableRaster work = ImageUtil.createCompatibleWritableRaster(pSource, cm, 1, srcHeight); double xscale = (double) dstWidth / (double) srcWidth; double yscale = (double) dstHeight / (double) srcHeight; ContributorList[] contribY = new ContributorList[dstHeight]; for (int i = 0; i < contribY.length; i++) { contribY[i] = new ContributorList(); // depends on control dependency: [for], data = [i] } // TODO: What to do when fwidth > srcHeight or dstHeight double fwidth = pFilter.support(); if (yscale < 1.0) { double width = fwidth / yscale; double fscale = 1.0 / yscale; if (width <= .5) { // Reduce to point sampling. width = .5 + 1.0e-6; // depends on control dependency: [if], data = [none] fscale = 1.0; // depends on control dependency: [if], data = [none] } for (int i = 0; i < dstHeight; i++) { //contribY[i].n = 0; contribY[i].p = new Contributor[(int) (width * 2.0 + 1 + 0.5)]; // depends on control dependency: [for], data = [i] double center = (double) i / yscale; int left = (int) Math.ceil(center - width); int right = (int) Math.floor(center + width); double density = 0.0; for (int j = left; j <= right; j++) { double weight = center - (double) j; weight = pFilter.filter(weight / fscale) / fscale; // depends on control dependency: [for], data = [none] int n; if (j < 0) { n = -j; // depends on control dependency: [if], data = [none] } else if (j >= srcHeight) { n = (srcHeight - j) + srcHeight - 1; // depends on control dependency: [if], data = [none] } else { n = j; // depends on control dependency: [if], data = [none] } /**/ if (n >= srcHeight) { n = n % srcHeight; // depends on control dependency: [if], data = [none] } else if (n < 0) { n = srcHeight - 1; // depends on control dependency: [if], data = [none] } /**/ int k = contribY[i].n++; contribY[i].p[k] = new Contributor(); // depends on control dependency: [for], data = [none] contribY[i].p[k].pixel = n; // depends on control dependency: [for], data = [none] contribY[i].p[k].weight = weight; // depends on control dependency: [for], data = [none] density += weight; // depends on control dependency: [for], data = [none] } if ((density != 0.0) && (density != 1.0)) { //Normalize. density = 1.0 / density; // depends on control dependency: [if], data = [none] for (int k = 0; k < contribY[i].n; k++) { contribY[i].p[k].weight *= density; // depends on control dependency: [for], data = [k] } } } } else { for (int i = 0; i < dstHeight; ++i) { //contribY[i].n = 0; contribY[i].p = new Contributor[(int) (fwidth * 2 + 1 + 0.5)]; // depends on control dependency: [for], data = [i] double center = (double) i / yscale; double left = Math.ceil(center - fwidth); double right = Math.floor(center + fwidth); for (int j = (int) left; j <= right; ++j) { double weight = center - (double) j; weight = pFilter.filter(weight); // depends on control dependency: [for], data = [none] int n; if (j < 0) { n = -j; // depends on control dependency: [if], data = [none] } else if (j >= srcHeight) { n = (srcHeight - j) + srcHeight - 1; // depends on control dependency: [if], data = [none] } else { n = j; // depends on control dependency: [if], data = [none] } /**/ if (n >= srcHeight) { n = n % srcHeight; // depends on control dependency: [if], data = [none] } else if (n < 0) { n = srcHeight - 1; // depends on control dependency: [if], data = [none] } /**/ int k = contribY[i].n++; contribY[i].p[k] = new Contributor(); // depends on control dependency: [for], data = [none] contribY[i].p[k].pixel = n; // depends on control dependency: [for], data = [none] contribY[i].p[k].weight = weight; // depends on control dependency: [for], data = [none] } } } final Raster raster = pSource.getRaster(); final WritableRaster out = pDest.getRaster(); // TODO: This is not optimal for non-byte-packed rasters... // (What? Maybe I implemented the fix, but forgot to remove the TODO?) final int numChannels = raster.getNumBands(); final int[] channelMax = new int[numChannels]; for (int k = 0; k < numChannels; k++) { channelMax[k] = (1 << pSource.getColorModel().getComponentSize(k)) - 1; // depends on control dependency: [for], data = [k] } for (int xx = 0; xx < dstWidth; xx++) { ContributorList contribX = calcXContrib(xscale, fwidth, srcWidth, pFilter, xx); /* Apply horiz filter to make dst column in tmp. */ for (int k = 0; k < srcHeight; k++) { for (int channel = 0; channel < numChannels; channel++) { double weight = 0.0; boolean bPelDelta = false; // TODO: This line throws index out of bounds, if the image // is smaller than filter.support() double pel = raster.getSample(contribX.p[0].pixel, k, channel); for (int j = 0; j < contribX.n; j++) { double pel2 = j == 0 ? pel : raster.getSample(contribX.p[j].pixel, k, channel); if (pel2 != pel) { bPelDelta = true; // depends on control dependency: [if], data = [none] } weight += pel2 * contribX.p[j].weight; // depends on control dependency: [for], data = [j] } weight = bPelDelta ? round(weight) : pel; // depends on control dependency: [for], data = [none] if (weight < 0) { weight = 0; // depends on control dependency: [if], data = [none] } else if (weight > channelMax[channel]) { weight = channelMax[channel]; // depends on control dependency: [if], data = [none] } work.setSample(0, k, channel, weight); // depends on control dependency: [for], data = [channel] } }/* next row in temp column */ /* The temp column has been built. Now stretch it vertically into dst column. */ for (int i = 0; i < dstHeight; i++) { for (int channel = 0; channel < numChannels; channel++) { double weight = 0.0; boolean bPelDelta = false; double pel = work.getSample(0, contribY[i].p[0].pixel, channel); for (int j = 0; j < contribY[i].n; j++) { // TODO: This line throws index out of bounds, if the image // is smaller than filter.support() double pel2 = j == 0 ? pel : work.getSample(0, contribY[i].p[j].pixel, channel); if (pel2 != pel) { bPelDelta = true; // depends on control dependency: [if], data = [none] } weight += pel2 * contribY[i].p[j].weight; // depends on control dependency: [for], data = [j] } weight = bPelDelta ? round(weight) : pel; // depends on control dependency: [for], data = [none] if (weight < 0) { weight = 0; // depends on control dependency: [if], data = [none] } else if (weight > channelMax[channel]) { weight = channelMax[channel]; // depends on control dependency: [if], data = [none] } out.setSample(xx, i, channel, weight); // depends on control dependency: [for], data = [channel] } }/* next dst row */ }/* next dst column */ return pDest; } }
public class class_name { @RequestMapping(method = RequestMethod.POST, value = "/workflowInstance/{woinRefNum}", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE}) public ResponseEntity<WorkflowInstanceRestModel> updateIntance( @PathVariable long woinRefNum, @RequestBody UpdateInstanceStatusForm form ){ WorkflowInstanceState woin = facade.findWorkflowInstance( woinRefNum, true ); if( woin == null ){ return new ResponseEntity<>( HttpStatus.NOT_FOUND ); } try{ if( WorkflowInstanceStatus.ABORT.name().equals( form.getStatus() ) ){ facade.abortWorkflowInstance( woinRefNum ); } else if( WorkflowInstanceStatus.SUSPENDED.name().equals( form.getStatus() ) ){ facade.suspendWorkflowInstance( woinRefNum ); } else if( WorkflowInstanceStatus.EXECUTING.name().equals( form.getStatus() ) ){ facade.resumeWorkflowInstance( woinRefNum ); } else{ return new ResponseEntity<>( HttpStatus.BAD_REQUEST ); } } catch( UnexpectedStatusException e ){ return new ResponseEntity<>( HttpStatus.CONFLICT ); } woin = facade.findWorkflowInstance( woinRefNum, true ); return new ResponseEntity<>( createInstanceModel( woin ), HttpStatus.OK ); } }
public class class_name { @RequestMapping(method = RequestMethod.POST, value = "/workflowInstance/{woinRefNum}", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE}) public ResponseEntity<WorkflowInstanceRestModel> updateIntance( @PathVariable long woinRefNum, @RequestBody UpdateInstanceStatusForm form ){ WorkflowInstanceState woin = facade.findWorkflowInstance( woinRefNum, true ); if( woin == null ){ return new ResponseEntity<>( HttpStatus.NOT_FOUND ); // depends on control dependency: [if], data = [none] } try{ if( WorkflowInstanceStatus.ABORT.name().equals( form.getStatus() ) ){ facade.abortWorkflowInstance( woinRefNum ); // depends on control dependency: [if], data = [none] } else if( WorkflowInstanceStatus.SUSPENDED.name().equals( form.getStatus() ) ){ facade.suspendWorkflowInstance( woinRefNum ); // depends on control dependency: [if], data = [none] } else if( WorkflowInstanceStatus.EXECUTING.name().equals( form.getStatus() ) ){ facade.resumeWorkflowInstance( woinRefNum ); // depends on control dependency: [if], data = [none] } else{ return new ResponseEntity<>( HttpStatus.BAD_REQUEST ); // depends on control dependency: [if], data = [none] } } catch( UnexpectedStatusException e ){ return new ResponseEntity<>( HttpStatus.CONFLICT ); } // depends on control dependency: [catch], data = [none] woin = facade.findWorkflowInstance( woinRefNum, true ); return new ResponseEntity<>( createInstanceModel( woin ), HttpStatus.OK ); } }
public class class_name { private static By getBy(By currentBy, SearchContext currentContent) { if (!ContentMappedBy.class.isAssignableFrom(currentBy.getClass())) { return currentBy; } return ContentMappedBy.class.cast(currentBy) .useContent(getCurrentContentType(currentContent)); } }
public class class_name { private static By getBy(By currentBy, SearchContext currentContent) { if (!ContentMappedBy.class.isAssignableFrom(currentBy.getClass())) { return currentBy; // depends on control dependency: [if], data = [none] } return ContentMappedBy.class.cast(currentBy) .useContent(getCurrentContentType(currentContent)); } }
public class class_name { private int parseListItem (int start) { start = skipSpacesToNewline(start, wikiLength); // skip spaces int end=parseItem(start, null, ContextType.LIST_ITEM); if ((listLevels[listLevel]=='>' || listLevels[listLevel]==':') && wikiText.substring(start, end).trim().length()==0) { // empty line within blockquote/div if (!blockquoteBR) { sb.append("<br/><br/>"); blockquoteBR=true; } } else { blockquoteBR=false; } return end; } }
public class class_name { private int parseListItem (int start) { start = skipSpacesToNewline(start, wikiLength); // skip spaces int end=parseItem(start, null, ContextType.LIST_ITEM); if ((listLevels[listLevel]=='>' || listLevels[listLevel]==':') && wikiText.substring(start, end).trim().length()==0) { // empty line within blockquote/div if (!blockquoteBR) { sb.append("<br/><br/>"); // depends on control dependency: [if], data = [none] blockquoteBR=true; // depends on control dependency: [if], data = [none] } } else { blockquoteBR=false; // depends on control dependency: [if], data = [none] } return end; } }
public class class_name { @Override public void deenrichResponse(HttpRequest request, HttpResponse response) { final WarpContext context = WarpContextStore.get(); try { long serialId = getSerialId(request); ResponsePayload payload = retrieveResponsePayload(serialId); if (context != null) { verifyResponsePayload.fire(new VerifyResponsePayload(payload)); context.pushResponsePayload(payload); } } catch (Exception originalException) { if (context != null) { WarpExecutionException explainingException; if (originalException instanceof WarpExecutionException) { explainingException = (WarpExecutionException) originalException; } else { explainingException = new ClientWarpExecutionException("deenriching response failed: " + originalException.getMessage(), originalException); } context.pushException(explainingException); } else { log.log(Level.WARNING, "Unable to push exception to WarpContext", originalException); } } } }
public class class_name { @Override public void deenrichResponse(HttpRequest request, HttpResponse response) { final WarpContext context = WarpContextStore.get(); try { long serialId = getSerialId(request); ResponsePayload payload = retrieveResponsePayload(serialId); if (context != null) { verifyResponsePayload.fire(new VerifyResponsePayload(payload)); // depends on control dependency: [if], data = [none] context.pushResponsePayload(payload); // depends on control dependency: [if], data = [none] } } catch (Exception originalException) { if (context != null) { WarpExecutionException explainingException; if (originalException instanceof WarpExecutionException) { explainingException = (WarpExecutionException) originalException; // depends on control dependency: [if], data = [none] } else { explainingException = new ClientWarpExecutionException("deenriching response failed: " + originalException.getMessage(), originalException); // depends on control dependency: [if], data = [none] } context.pushException(explainingException); // depends on control dependency: [if], data = [none] } else { log.log(Level.WARNING, "Unable to push exception to WarpContext", originalException); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static synchronized IDGenerator generatorFor(ZooKeeperConnection zooKeeperConnection, String znode, Mode mode) throws IOException { if (!instances.containsKey(znode)) { final int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode); SynchronizedGeneratorIdentity generatorIdentityHolder = new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, null); return generatorFor(generatorIdentityHolder, mode); } return instances.get(znode); } }
public class class_name { public static synchronized IDGenerator generatorFor(ZooKeeperConnection zooKeeperConnection, String znode, Mode mode) throws IOException { if (!instances.containsKey(znode)) { final int clusterId = ClusterID.get(zooKeeperConnection.getActiveConnection(), znode); SynchronizedGeneratorIdentity generatorIdentityHolder = new SynchronizedGeneratorIdentity(zooKeeperConnection, znode, clusterId, null); return generatorFor(generatorIdentityHolder, mode); // depends on control dependency: [if], data = [none] } return instances.get(znode); } }
public class class_name { public void marshall(TagsModel tagsModel, ProtocolMarshaller protocolMarshaller) { if (tagsModel == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tagsModel.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(TagsModel tagsModel, ProtocolMarshaller protocolMarshaller) { if (tagsModel == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(tagsModel.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 void undeploy(String deploymentName, Set<String> serverGroups, boolean removeContent) { if (serverGroups == null) { serverGroups = Collections.emptySet(); } DeploymentResult result = null; try { DeploymentManager dm = DeploymentManager.Factory.create(getModelControllerClient()); UndeployDescription undeployDescription = UndeployDescription.of(deploymentName) .addServerGroups(serverGroups) .setFailOnMissing(false) .setRemoveContent(removeContent); result = dm.undeploy(undeployDescription); } catch (Exception e) { String errMsg; if (serverGroups.isEmpty()) { errMsg = String.format("Failed to undeploy [%s] (standalone mode)", deploymentName); } else { errMsg = String.format("Failed to undeploy [%s] from server groups: %s", deploymentName, serverGroups); } throw new FailureException(errMsg, e); } if (!result.successful()) { String errMsg; if (serverGroups.isEmpty()) { errMsg = String.format("Failed to undeploy [%s] (standalone mode)", deploymentName); } else { errMsg = String.format("Failed to undeploy [%s] from server groups [%s]", deploymentName, serverGroups); } throw new FailureException(errMsg + ": " + result.getFailureMessage()); } return; // everything is OK } }
public class class_name { public void undeploy(String deploymentName, Set<String> serverGroups, boolean removeContent) { if (serverGroups == null) { serverGroups = Collections.emptySet(); // depends on control dependency: [if], data = [none] } DeploymentResult result = null; try { DeploymentManager dm = DeploymentManager.Factory.create(getModelControllerClient()); UndeployDescription undeployDescription = UndeployDescription.of(deploymentName) .addServerGroups(serverGroups) .setFailOnMissing(false) .setRemoveContent(removeContent); result = dm.undeploy(undeployDescription); // depends on control dependency: [try], data = [none] } catch (Exception e) { String errMsg; if (serverGroups.isEmpty()) { errMsg = String.format("Failed to undeploy [%s] (standalone mode)", deploymentName); // depends on control dependency: [if], data = [none] } else { errMsg = String.format("Failed to undeploy [%s] from server groups: %s", deploymentName, serverGroups); // depends on control dependency: [if], data = [none] } throw new FailureException(errMsg, e); } // depends on control dependency: [catch], data = [none] if (!result.successful()) { String errMsg; if (serverGroups.isEmpty()) { errMsg = String.format("Failed to undeploy [%s] (standalone mode)", deploymentName); // depends on control dependency: [if], data = [none] } else { errMsg = String.format("Failed to undeploy [%s] from server groups [%s]", deploymentName, serverGroups); // depends on control dependency: [if], data = [none] } throw new FailureException(errMsg + ": " + result.getFailureMessage()); } return; // everything is OK } }
public class class_name { public Observable<ServiceResponse<Page<JobExecutionInner>>> listByStepNextWithServiceResponseAsync(final String nextPageLink) { return listByStepNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() { @Override public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByStepNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<JobExecutionInner>>> listByStepNextWithServiceResponseAsync(final String nextPageLink) { return listByStepNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<JobExecutionInner>>, Observable<ServiceResponse<Page<JobExecutionInner>>>>() { @Override public Observable<ServiceResponse<Page<JobExecutionInner>>> call(ServiceResponse<Page<JobExecutionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listByStepNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public synchronized void put(String path, long value, String taskId) { Point p; int last = windowNum - 1; if (value == RECOVERY_FAIL) { p = new Point(value, path, System.currentTimeMillis(), taskId); AtomicInteger counter = failedRecoveredFiles.get(path); if (counter == null) { counter = new AtomicInteger(0); failedRecoveredFiles.put(path, counter); } if (counter.incrementAndGet() == 1) { totalFailedPaths.get(last).incrementAndGet(); } } else { value /= dividend; p = new Point(value, path, System.currentTimeMillis(), taskId); CounterArray counters = histo.get(value); if (counters == null) { counters = new CounterArray(windowNum); histo.put(value, counters); } counters.incrementAndGet(last); totalPoints.incrementAndGet(last); } points.add(p); InjectionHandler.processEvent(InjectionEvent.RAID_SEND_RECOVERY_TIME, this, path, value, taskId); } }
public class class_name { public synchronized void put(String path, long value, String taskId) { Point p; int last = windowNum - 1; if (value == RECOVERY_FAIL) { p = new Point(value, path, System.currentTimeMillis(), taskId); // depends on control dependency: [if], data = [(value] AtomicInteger counter = failedRecoveredFiles.get(path); if (counter == null) { counter = new AtomicInteger(0); // depends on control dependency: [if], data = [none] failedRecoveredFiles.put(path, counter); // depends on control dependency: [if], data = [none] } if (counter.incrementAndGet() == 1) { totalFailedPaths.get(last).incrementAndGet(); // depends on control dependency: [if], data = [none] } } else { value /= dividend; // depends on control dependency: [if], data = [none] p = new Point(value, path, System.currentTimeMillis(), taskId); // depends on control dependency: [if], data = [(value] CounterArray counters = histo.get(value); if (counters == null) { counters = new CounterArray(windowNum); // depends on control dependency: [if], data = [none] histo.put(value, counters); // depends on control dependency: [if], data = [none] } counters.incrementAndGet(last); // depends on control dependency: [if], data = [none] totalPoints.incrementAndGet(last); // depends on control dependency: [if], data = [none] } points.add(p); InjectionHandler.processEvent(InjectionEvent.RAID_SEND_RECOVERY_TIME, this, path, value, taskId); } }
public class class_name { protected UrlState determineUrlState( final IPortletWindow portletWindow, final IPortletUrlBuilder targetedPortletUrlBuilder) { final WindowState requestedWindowState; if (targetedPortletUrlBuilder == null) { requestedWindowState = null; } else { requestedWindowState = targetedPortletUrlBuilder.getWindowState(); } return determineUrlState(portletWindow, requestedWindowState); } }
public class class_name { protected UrlState determineUrlState( final IPortletWindow portletWindow, final IPortletUrlBuilder targetedPortletUrlBuilder) { final WindowState requestedWindowState; if (targetedPortletUrlBuilder == null) { requestedWindowState = null; // depends on control dependency: [if], data = [none] } else { requestedWindowState = targetedPortletUrlBuilder.getWindowState(); // depends on control dependency: [if], data = [none] } return determineUrlState(portletWindow, requestedWindowState); } }
public class class_name { protected List<Date> loadAttempts(File home) { List<Date> dates = new ArrayList<>(); if (home!=null) { File f = getBootFailureFile(home); try { if (f.exists()) { try (BufferedReader failureFileReader = new BufferedReader(new FileReader(f))) { String line; while ((line=failureFileReader.readLine())!=null) { try { dates.add(new Date(line)); } catch (Exception e) { // ignore any parse error } } } } } catch (IOException e) { LOGGER.log(Level.WARNING,"Failed to parse "+f,e); } } return dates; } }
public class class_name { protected List<Date> loadAttempts(File home) { List<Date> dates = new ArrayList<>(); if (home!=null) { File f = getBootFailureFile(home); try { if (f.exists()) { try (BufferedReader failureFileReader = new BufferedReader(new FileReader(f))) { String line; while ((line=failureFileReader.readLine())!=null) { try { dates.add(new Date(line)); // depends on control dependency: [try], data = [none] } catch (Exception e) { // ignore any parse error } // depends on control dependency: [catch], data = [none] } } } } catch (IOException e) { LOGGER.log(Level.WARNING,"Failed to parse "+f,e); } // depends on control dependency: [catch], data = [none] } return dates; } }
public class class_name { public void setLaunchTemplateVersions(java.util.Collection<LaunchTemplateVersion> launchTemplateVersions) { if (launchTemplateVersions == null) { this.launchTemplateVersions = null; return; } this.launchTemplateVersions = new com.amazonaws.internal.SdkInternalList<LaunchTemplateVersion>(launchTemplateVersions); } }
public class class_name { public void setLaunchTemplateVersions(java.util.Collection<LaunchTemplateVersion> launchTemplateVersions) { if (launchTemplateVersions == null) { this.launchTemplateVersions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.launchTemplateVersions = new com.amazonaws.internal.SdkInternalList<LaunchTemplateVersion>(launchTemplateVersions); } }
public class class_name { public void addSplit(long timestampInMs, long durationInNs) { last = durationInNs; total += durationInNs; squareTotal += durationInNs * durationInNs; if (durationInNs > max) { max = durationInNs; } if (durationInNs < min) { min = durationInNs; } counter++; lastTimestamp = timestampInMs; } }
public class class_name { public void addSplit(long timestampInMs, long durationInNs) { last = durationInNs; total += durationInNs; squareTotal += durationInNs * durationInNs; if (durationInNs > max) { max = durationInNs; // depends on control dependency: [if], data = [none] } if (durationInNs < min) { min = durationInNs; // depends on control dependency: [if], data = [none] } counter++; lastTimestamp = timestampInMs; } }
public class class_name { private String getModuleFromClass(Class<?> klass, Map<String, ModuleProperties> moduleMap) { String file = getClassFileLocation(klass); if (tc.isDebugEnabled()) { Tr.debug(tc, "File name : " + file); } String moduleName = null; for (Map.Entry<String, ModuleProperties> entry : moduleMap.entrySet()) { URL location = entry.getValue().getLocation(); String filePath = location.getFile(); if (tc.isDebugEnabled()) { Tr.debug(tc, "location : " + filePath); } if (location.getProtocol().equals("file") && file.startsWith(filePath)) { moduleName = entry.getKey(); if (tc.isDebugEnabled()) { Tr.debug(tc, "module name from the list : " + moduleName); } break; } } if (moduleName == null) { moduleName = file; if (tc.isDebugEnabled()) { Tr.debug(tc, "no match. use filename as module name : " + moduleName); } } return moduleName; } }
public class class_name { private String getModuleFromClass(Class<?> klass, Map<String, ModuleProperties> moduleMap) { String file = getClassFileLocation(klass); if (tc.isDebugEnabled()) { Tr.debug(tc, "File name : " + file); // depends on control dependency: [if], data = [none] } String moduleName = null; for (Map.Entry<String, ModuleProperties> entry : moduleMap.entrySet()) { URL location = entry.getValue().getLocation(); String filePath = location.getFile(); if (tc.isDebugEnabled()) { Tr.debug(tc, "location : " + filePath); // depends on control dependency: [if], data = [none] } if (location.getProtocol().equals("file") && file.startsWith(filePath)) { moduleName = entry.getKey(); // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "module name from the list : " + moduleName); // depends on control dependency: [if], data = [none] } break; } } if (moduleName == null) { moduleName = file; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) { Tr.debug(tc, "no match. use filename as module name : " + moduleName); // depends on control dependency: [if], data = [none] } } return moduleName; } }
public class class_name { @Override public void render(Graphic g) { for (final MessageData messageData : messages) { text.draw(g, messageData.x, messageData.y, messageData.message); } } }
public class class_name { @Override public void render(Graphic g) { for (final MessageData messageData : messages) { text.draw(g, messageData.x, messageData.y, messageData.message); // depends on control dependency: [for], data = [messageData] } } }
public class class_name { private Token doctype() { String val = scan1("^!!! *([^\\n]+)?"); if (StringUtils.isNotBlank(val)) { throw new JadeLexerException("`!!!` is deprecated, you must now use `doctype`", filename, getLineno(), templateLoader); } Matcher matcher = scanner.getMatcherForPattern("^(?:doctype) *([^\\n]+)?"); if (matcher.find(0) && matcher.groupCount()>0) { int end = matcher.end(); consume(end); String name = matcher.group(1); if(name != null && "5".equals(name.trim())) throw new JadeLexerException("`doctype 5` is deprecated, you must now use `doctype html`", filename, getLineno(), templateLoader); return new Doctype(name, lineno); } return null; } }
public class class_name { private Token doctype() { String val = scan1("^!!! *([^\\n]+)?"); if (StringUtils.isNotBlank(val)) { throw new JadeLexerException("`!!!` is deprecated, you must now use `doctype`", filename, getLineno(), templateLoader); } Matcher matcher = scanner.getMatcherForPattern("^(?:doctype) *([^\\n]+)?"); if (matcher.find(0) && matcher.groupCount()>0) { int end = matcher.end(); consume(end); // depends on control dependency: [if], data = [none] String name = matcher.group(1); if(name != null && "5".equals(name.trim())) throw new JadeLexerException("`doctype 5` is deprecated, you must now use `doctype html`", filename, getLineno(), templateLoader); return new Doctype(name, lineno); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected Component getRoot (Component comp) { for (Component c = comp; c != null; c = c.getParent()) { boolean hidden = !c.isDisplayable(); // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and allow all invisible components to be // invalidated and revalidated if (!RunAnywhere.isMacOS()) { hidden |= !c.isVisible(); } if (hidden) { return null; } if (c instanceof Window || c instanceof Applet) { return c; } } return null; } }
public class class_name { protected Component getRoot (Component comp) { for (Component c = comp; c != null; c = c.getParent()) { boolean hidden = !c.isDisplayable(); // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and allow all invisible components to be // invalidated and revalidated if (!RunAnywhere.isMacOS()) { hidden |= !c.isVisible(); // depends on control dependency: [if], data = [none] } if (hidden) { return null; // depends on control dependency: [if], data = [none] } if (c instanceof Window || c instanceof Applet) { return c; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void marshall(RedshiftDatabaseCredentials redshiftDatabaseCredentials, ProtocolMarshaller protocolMarshaller) { if (redshiftDatabaseCredentials == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(redshiftDatabaseCredentials.getUsername(), USERNAME_BINDING); protocolMarshaller.marshall(redshiftDatabaseCredentials.getPassword(), PASSWORD_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RedshiftDatabaseCredentials redshiftDatabaseCredentials, ProtocolMarshaller protocolMarshaller) { if (redshiftDatabaseCredentials == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(redshiftDatabaseCredentials.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(redshiftDatabaseCredentials.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private LogRepositoryBrowser findNext(long cur, long timelimit) { File[] files = listFiles(instanceFilter); if (files == null) { return null; } File result = null; long min = Long.MAX_VALUE; for (File file : files) { long time = parseTimeStamp(file.getName()); // Select directory with a smallest time stamp bigger than time stamp of the 'current'. if (cur < time && time < min) { min = time; result = file; } } // return 'null' if found directory has time stamp outside of the time limit. if (result == null || (timelimit > 0 && timelimit < min)) { return null; } return new LogRepositoryBrowserImpl(result, new String[] { result.getName() }); } }
public class class_name { private LogRepositoryBrowser findNext(long cur, long timelimit) { File[] files = listFiles(instanceFilter); if (files == null) { return null; // depends on control dependency: [if], data = [none] } File result = null; long min = Long.MAX_VALUE; for (File file : files) { long time = parseTimeStamp(file.getName()); // Select directory with a smallest time stamp bigger than time stamp of the 'current'. if (cur < time && time < min) { min = time; // depends on control dependency: [if], data = [none] result = file; // depends on control dependency: [if], data = [none] } } // return 'null' if found directory has time stamp outside of the time limit. if (result == null || (timelimit > 0 && timelimit < min)) { return null; // depends on control dependency: [if], data = [none] } return new LogRepositoryBrowserImpl(result, new String[] { result.getName() }); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer atomContainer) { int nSpiro = 0; try { IAtomContainer local = atomContainer.clone(); Cycles.markRingAtomsAndBonds(local); for (IAtom atom : local.atoms()) { if (getSpiroDegree(local, atom) != 0) nSpiro++; } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(nSpiro), getDescriptorNames()); } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer atomContainer) { int nSpiro = 0; try { IAtomContainer local = atomContainer.clone(); Cycles.markRingAtomsAndBonds(local); // depends on control dependency: [try], data = [none] for (IAtom atom : local.atoms()) { if (getSpiroDegree(local, atom) != 0) nSpiro++; } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(nSpiro), getDescriptorNames()); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Deprecated public static RoaringBitmap flip(RoaringBitmap rb, final int rangeStart, final int rangeEnd) { if (rangeStart >= 0) { return flip(rb, (long) rangeStart, (long) rangeEnd); } // rangeStart being -ve and rangeEnd being positive is not expected) // so assume both -ve return flip(rb, rangeStart & 0xFFFFFFFFL, rangeEnd & 0xFFFFFFFFL); } }
public class class_name { @Deprecated public static RoaringBitmap flip(RoaringBitmap rb, final int rangeStart, final int rangeEnd) { if (rangeStart >= 0) { return flip(rb, (long) rangeStart, (long) rangeEnd); // depends on control dependency: [if], data = [none] } // rangeStart being -ve and rangeEnd being positive is not expected) // so assume both -ve return flip(rb, rangeStart & 0xFFFFFFFFL, rangeEnd & 0xFFFFFFFFL); } }
public class class_name { static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee); } int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } }
public class class_name { static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); // depends on control dependency: [try], data = [none] } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.smb1.encoding=US-ASCII", uee); } // depends on control dependency: [catch], data = [none] int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; // depends on control dependency: [if], data = [none] } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } }
public class class_name { private String getDatabaseProductName(WSDataSource dataSource) throws Exception { String dbProductName = dataSource.getDatabaseProductName(); if (dbProductName == null) { // Query the metadata under a new transaction and commit right away LocalTransactionCurrent localTranCurrent = this.localTranCurrent; LocalTransactionCoordinator suspendedLTC = localTranCurrent.suspend(); EmbeddableWebSphereTransactionManager tranMgr = this.tranMgr; Transaction suspendedTran = suspendedLTC == null ? tranMgr.suspend() : null; boolean tranStarted = false; try { tranMgr.begin(); tranStarted = true; Connection con = dataSource.getConnection(); try { dbProductName = con.getMetaData().getDatabaseProductName(); } finally { con.close(); } } finally { try { if (tranStarted) tranMgr.commit(); } finally { // resume if (suspendedTran != null) tranMgr.resume(suspendedTran); else if (suspendedLTC != null) localTranCurrent.resume(suspendedLTC); } } } return dbProductName; } }
public class class_name { private String getDatabaseProductName(WSDataSource dataSource) throws Exception { String dbProductName = dataSource.getDatabaseProductName(); if (dbProductName == null) { // Query the metadata under a new transaction and commit right away LocalTransactionCurrent localTranCurrent = this.localTranCurrent; LocalTransactionCoordinator suspendedLTC = localTranCurrent.suspend(); EmbeddableWebSphereTransactionManager tranMgr = this.tranMgr; Transaction suspendedTran = suspendedLTC == null ? tranMgr.suspend() : null; boolean tranStarted = false; try { tranMgr.begin(); tranStarted = true; Connection con = dataSource.getConnection(); try { dbProductName = con.getMetaData().getDatabaseProductName(); // depends on control dependency: [try], data = [none] } finally { con.close(); } } finally { try { if (tranStarted) tranMgr.commit(); } finally { // resume if (suspendedTran != null) tranMgr.resume(suspendedTran); else if (suspendedLTC != null) localTranCurrent.resume(suspendedLTC); } } } return dbProductName; } }
public class class_name { public void initScheme() { // set the scheme based on whether the socket is secure or not if (null == getServiceContext() || null == getServiceContext().getTSC()) { // discrimination path, not ready for this yet return; } if (getServiceContext().isSecure()) { this.myScheme = SchemeValues.HTTPS; } else { this.myScheme = SchemeValues.HTTP; } } }
public class class_name { public void initScheme() { // set the scheme based on whether the socket is secure or not if (null == getServiceContext() || null == getServiceContext().getTSC()) { // discrimination path, not ready for this yet return; // depends on control dependency: [if], data = [none] } if (getServiceContext().isSecure()) { this.myScheme = SchemeValues.HTTPS; // depends on control dependency: [if], data = [none] } else { this.myScheme = SchemeValues.HTTP; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <S extends Storable> Filter<S> filterFor(Class<S> type, String expression) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(expression); if (filter == null) { filter = new FilterParser<S>(type, expression).parseRoot(); filterCache.put(expression, filter); } return filter; } } }
public class class_name { public static <S extends Storable> Filter<S> filterFor(Class<S> type, String expression) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(expression); if (filter == null) { filter = new FilterParser<S>(type, expression).parseRoot(); // depends on control dependency: [if], data = [none] filterCache.put(expression, filter); // depends on control dependency: [if], data = [none] } return filter; } } }
public class class_name { @Override public SetAttribute<? super X, ?> getSet(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; } declaredAttrib = getPluralAttriute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); } }
public class class_name { @Override public SetAttribute<? super X, ?> getSet(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; // depends on control dependency: [if], data = [none] } declaredAttrib = getPluralAttriute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); } }
public class class_name { private Long getLanguageId(final String _language) { Long ret = null; try { final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language); queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language); final InstanceQuery query = queryBldr.getQuery(); query.executeWithoutAccessCheck(); if (query.next()) { ret = query.getCurrentValue().getId(); } else { ret = insertNewLanguage(_language); } } catch (final EFapsException e) { DBPropertiesUpdate.LOG.error("getLanguageId()", e); } return ret; } }
public class class_name { private Long getLanguageId(final String _language) { Long ret = null; try { final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language); queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language); // depends on control dependency: [try], data = [none] final InstanceQuery query = queryBldr.getQuery(); query.executeWithoutAccessCheck(); // depends on control dependency: [try], data = [none] if (query.next()) { ret = query.getCurrentValue().getId(); // depends on control dependency: [if], data = [none] } else { ret = insertNewLanguage(_language); // depends on control dependency: [if], data = [none] } } catch (final EFapsException e) { DBPropertiesUpdate.LOG.error("getLanguageId()", e); } // depends on control dependency: [catch], data = [none] return ret; } }
public class class_name { public boolean removePolicy(String sec, String ptype, List<String> rule) { for (int i = 0; i < model.get(sec).get(ptype).policy.size(); i ++) { List<String> r = model.get(sec).get(ptype).policy.get(i); if (Util.arrayEquals(rule, r)) { model.get(sec).get(ptype).policy.remove(i); return true; } } return false; } }
public class class_name { public boolean removePolicy(String sec, String ptype, List<String> rule) { for (int i = 0; i < model.get(sec).get(ptype).policy.size(); i ++) { List<String> r = model.get(sec).get(ptype).policy.get(i); if (Util.arrayEquals(rule, r)) { model.get(sec).get(ptype).policy.remove(i); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private void setConsistencylevel(Object value) { if (value instanceof String) { this.cassandraClientBase.setConsistencyLevel(ConsistencyLevel.valueOf((String) value)); } else if (value instanceof ConsistencyLevel) { this.cassandraClientBase.setConsistencyLevel((ConsistencyLevel) value); } } }
public class class_name { private void setConsistencylevel(Object value) { if (value instanceof String) { this.cassandraClientBase.setConsistencyLevel(ConsistencyLevel.valueOf((String) value)); // depends on control dependency: [if], data = [none] } else if (value instanceof ConsistencyLevel) { this.cassandraClientBase.setConsistencyLevel((ConsistencyLevel) value); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void mergeForceCollapse() { while (stackSize > 1) { int n = stackSize - 2; if (n > 0 && runLen[n - 1] < runLen[n + 1]) n--; mergeAt(n); } } }
public class class_name { private void mergeForceCollapse() { while (stackSize > 1) { int n = stackSize - 2; if (n > 0 && runLen[n - 1] < runLen[n + 1]) n--; mergeAt(n); // depends on control dependency: [while], data = [none] } } }
public class class_name { @Override public void write (@Nonnull final String sStr, @Nonnegative final int nOfs, @Nonnegative final int nLen) { if (nLen > 0) { final int newcount = m_nCount + nLen; if (newcount > m_aBuf.length) { m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, newcount)); } sStr.getChars (nOfs, nOfs + nLen, m_aBuf, m_nCount); m_nCount = newcount; } } }
public class class_name { @Override public void write (@Nonnull final String sStr, @Nonnegative final int nOfs, @Nonnegative final int nLen) { if (nLen > 0) { final int newcount = m_nCount + nLen; if (newcount > m_aBuf.length) { m_aBuf = Arrays.copyOf (m_aBuf, Math.max (m_aBuf.length << 1, newcount)); // depends on control dependency: [if], data = [none] } sStr.getChars (nOfs, nOfs + nLen, m_aBuf, m_nCount); // depends on control dependency: [if], data = [none] m_nCount = newcount; // depends on control dependency: [if], data = [none] } } }
public class class_name { public final boolean addConstraints(Constraint... c) { if (c == null || c.length == 0){ return true; } ArrayList<Constraint> incomp = new ArrayList<Constraint>(c.length); for (Constraint con : c) { if (isCompatible(con) && !con.isSkippableSolver(this)) { } else incomp.add(con); } ArrayList<Constraint> toAdd = new ArrayList<Constraint>(c.length); for (Constraint con : c) if (!incomp.contains(con)) toAdd.add(con); //if there is no constraint left to add, just return successfully if (toAdd.size() == 0) return true; Constraint[] toAddArray = toAdd.toArray(new Constraint[toAdd.size()]); //call solver-specific procedures for adding constraints, then propagate this.maskConstraints(c); if (addConstraintsSub(toAddArray)) { //NOTE: must add new cons before attempting propagation, because some solvers call //constraint network methods in their implementation of propagate()... for (Constraint con : toAddArray) this.theNetwork.addConstraint(con); if (!skipPropagation && autoprop && checkDomainsInstantiated()) { if (this.propagate()) { logger.finest("Added and propagated constraints " + Arrays.toString(toAddArray)); this.unmaskConstraints(c); return true; } //... and then remove new cons if propagation not successful... this.removeConstraints(toAddArray); // for (Constraint con : toAddArray) { // this.theNetwork.removeConstraint(con); // } logger.finest("Failed to add constraints " + Arrays.toString(toAddArray)); } else { logger.finest("Added constraints " + Arrays.toString(toAddArray) + " BUT DELAYED PROPAGATION (autoprop = " + autoprop + ")"); this.unmaskConstraints(c); return true; } } //... and finally re-propagate if not successful to put everything back the way it was if (!skipPropagation && autoprop && checkDomainsInstantiated()) this.propagate(); this.unmaskConstraints(c); return false; } }
public class class_name { public final boolean addConstraints(Constraint... c) { if (c == null || c.length == 0){ return true; // depends on control dependency: [if], data = [none] } ArrayList<Constraint> incomp = new ArrayList<Constraint>(c.length); for (Constraint con : c) { if (isCompatible(con) && !con.isSkippableSolver(this)) { } else incomp.add(con); } ArrayList<Constraint> toAdd = new ArrayList<Constraint>(c.length); for (Constraint con : c) if (!incomp.contains(con)) toAdd.add(con); //if there is no constraint left to add, just return successfully if (toAdd.size() == 0) return true; Constraint[] toAddArray = toAdd.toArray(new Constraint[toAdd.size()]); //call solver-specific procedures for adding constraints, then propagate this.maskConstraints(c); if (addConstraintsSub(toAddArray)) { //NOTE: must add new cons before attempting propagation, because some solvers call //constraint network methods in their implementation of propagate()... for (Constraint con : toAddArray) this.theNetwork.addConstraint(con); if (!skipPropagation && autoprop && checkDomainsInstantiated()) { if (this.propagate()) { logger.finest("Added and propagated constraints " + Arrays.toString(toAddArray)); // depends on control dependency: [if], data = [none] this.unmaskConstraints(c); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } //... and then remove new cons if propagation not successful... this.removeConstraints(toAddArray); // for (Constraint con : toAddArray) { // this.theNetwork.removeConstraint(con); // } logger.finest("Failed to add constraints " + Arrays.toString(toAddArray)); } else { logger.finest("Added constraints " + Arrays.toString(toAddArray) + " BUT DELAYED PROPAGATION (autoprop = " + autoprop + ")"); this.unmaskConstraints(c); return true; } } //... and finally re-propagate if not successful to put everything back the way it was if (!skipPropagation && autoprop && checkDomainsInstantiated()) this.propagate(); this.unmaskConstraints(c); return false; } }
public class class_name { public Object remove(Object locator) { if (locator == null) return null; synchronized (_lock) { for (int index = _references.size() - 1; index >= 0; index--) { Reference reference = _references.get(index); if (reference.match(locator)) { _references.remove(index); return reference.getComponent(); } } } return null; } }
public class class_name { public Object remove(Object locator) { if (locator == null) return null; synchronized (_lock) { for (int index = _references.size() - 1; index >= 0; index--) { Reference reference = _references.get(index); if (reference.match(locator)) { _references.remove(index); // depends on control dependency: [if], data = [none] return reference.getComponent(); // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { protected int checkJournals(String status) throws IOException { boolean abort = false; int journalsAvailable = 0; int nonLocalJournalsAvailable = 0; for(JournalAndStream jas : journals) { if(jas.isDisabled() && jas.isRequired()) { abort = true; } else if (jas.isResourceAvailable()) { journalsAvailable++; if (jas.isRemote() || jas.isShared()) { nonLocalJournalsAvailable++; } } } // update metrics updateJournalMetrics(); if (abort || journalsAvailable < minimumNumberOfJournals || nonLocalJournalsAvailable < minimumNumberOfNonLocalJournals) { forceJournalCheck = true; String message = status + " failed for too many journals, minimum: " + minimumNumberOfJournals + " current: " + journalsAvailable + ", non-local: " + minimumNumberOfNonLocalJournals + " current: " + nonLocalJournalsAvailable; LOG.error(message); throw new IOException(message); } return journalsAvailable; } }
public class class_name { protected int checkJournals(String status) throws IOException { boolean abort = false; int journalsAvailable = 0; int nonLocalJournalsAvailable = 0; for(JournalAndStream jas : journals) { if(jas.isDisabled() && jas.isRequired()) { abort = true; // depends on control dependency: [if], data = [none] } else if (jas.isResourceAvailable()) { journalsAvailable++; // depends on control dependency: [if], data = [none] if (jas.isRemote() || jas.isShared()) { nonLocalJournalsAvailable++; // depends on control dependency: [if], data = [none] } } } // update metrics updateJournalMetrics(); if (abort || journalsAvailable < minimumNumberOfJournals || nonLocalJournalsAvailable < minimumNumberOfNonLocalJournals) { forceJournalCheck = true; String message = status + " failed for too many journals, minimum: " + minimumNumberOfJournals + " current: " + journalsAvailable + ", non-local: " + minimumNumberOfNonLocalJournals + " current: " + nonLocalJournalsAvailable; LOG.error(message); throw new IOException(message); } return journalsAvailable; } }
public class class_name { public List<Locale> getDefaultLocales(CmsObject cms, CmsResource resource) { String defaultNames = null; try { defaultNames = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue(); } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.ERR_READ_ENCODING_PROP_1, cms.getSitePath(resource)), e); } return getDefaultLocales(defaultNames); } }
public class class_name { public List<Locale> getDefaultLocales(CmsObject cms, CmsResource resource) { String defaultNames = null; try { defaultNames = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn(Messages.get().getBundle().key(Messages.ERR_READ_ENCODING_PROP_1, cms.getSitePath(resource)), e); } // depends on control dependency: [catch], data = [none] return getDefaultLocales(defaultNames); } }
public class class_name { private InstanceType matchHardwareDescriptionWithInstanceType(final HardwareDescription hardwareDescription) { // Assumes that the available instance types are ordered by number of CPU cores in descending order for (int i = 0; i < this.availableInstanceTypes.length; i++) { final InstanceType candidateInstanceType = this.availableInstanceTypes[i]; // Check if number of CPU cores match if (candidateInstanceType.getNumberOfCores() > hardwareDescription.getNumberOfCPUCores()) { continue; } // Check if size of physical memory matches final int memoryInMB = (int) (hardwareDescription.getSizeOfPhysicalMemory() / (1024L * 1024L)); if (candidateInstanceType.getMemorySize() > memoryInMB) { continue; } return candidateInstanceType; } LOG.error("Cannot find matching instance type for hardware description (" + hardwareDescription.getNumberOfCPUCores() + " cores, " + hardwareDescription.getSizeOfPhysicalMemory() + " bytes of memory)"); return null; } }
public class class_name { private InstanceType matchHardwareDescriptionWithInstanceType(final HardwareDescription hardwareDescription) { // Assumes that the available instance types are ordered by number of CPU cores in descending order for (int i = 0; i < this.availableInstanceTypes.length; i++) { final InstanceType candidateInstanceType = this.availableInstanceTypes[i]; // Check if number of CPU cores match if (candidateInstanceType.getNumberOfCores() > hardwareDescription.getNumberOfCPUCores()) { continue; } // Check if size of physical memory matches final int memoryInMB = (int) (hardwareDescription.getSizeOfPhysicalMemory() / (1024L * 1024L)); if (candidateInstanceType.getMemorySize() > memoryInMB) { continue; } return candidateInstanceType; // depends on control dependency: [for], data = [none] } LOG.error("Cannot find matching instance type for hardware description (" + hardwareDescription.getNumberOfCPUCores() + " cores, " + hardwareDescription.getSizeOfPhysicalMemory() + " bytes of memory)"); return null; } }
public class class_name { public java.util.List<LogGroupField> getLogGroupFields() { if (logGroupFields == null) { logGroupFields = new com.amazonaws.internal.SdkInternalList<LogGroupField>(); } return logGroupFields; } }
public class class_name { public java.util.List<LogGroupField> getLogGroupFields() { if (logGroupFields == null) { logGroupFields = new com.amazonaws.internal.SdkInternalList<LogGroupField>(); // depends on control dependency: [if], data = [none] } return logGroupFields; } }
public class class_name { private BeanConfiguration invokeBeanDefiningMethod(String name, Object[] args) { BeanConfiguration old = currentBeanConfig; try { if(args[0] instanceof Class) { Class beanClass = args[0] instanceof Class ? (Class)args[0] : args[0].getClass(); if(args.length >= 1) { if(args[args.length-1] instanceof Closure) { if(args.length-1 != 1) { Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length-1); filterGStringReferences(constructorArgs); if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs)); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs)); } else { if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass); } } else { Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length); filterGStringReferences(constructorArgs); if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs)); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs)); } } } else if(args[0] instanceof RuntimeBeanReference) { currentBeanConfig = springConfig.addSingletonBean(name); currentBeanConfig.setFactoryBean(((RuntimeBeanReference)args[0]).getBeanName()); } else if(args[0] instanceof Map) { currentBeanConfig = springConfig.addSingletonBean(name); Map.Entry factoryBeanEntry = (Map.Entry)((Map)args[0]).entrySet().iterator().next(); currentBeanConfig.setFactoryBean(factoryBeanEntry.getKey().toString()); currentBeanConfig.setFactoryMethod(factoryBeanEntry.getValue().toString()); } else if(args[0] instanceof Closure) { currentBeanConfig = springConfig.addAbstractBean(name); } else { Object[] constructorArgs; if(args[args.length-1] instanceof Closure) { constructorArgs= ArrayUtils.subarray(args, 0, args.length-1); } else { constructorArgs= ArrayUtils.subarray(args, 0, args.length); } filterGStringReferences(constructorArgs); currentBeanConfig = new DefaultBeanConfiguration(name, null, Arrays.asList(constructorArgs)); springConfig.addBeanConfiguration(name,currentBeanConfig); } if(args[args.length-1] instanceof Closure) { Closure callable = (Closure)args[args.length-1]; callable.setDelegate(this); callable.setResolveStrategy(Closure.DELEGATE_FIRST); callable.call(new Object[]{currentBeanConfig}); } return currentBeanConfig; } finally { currentBeanConfig = old; } } }
public class class_name { private BeanConfiguration invokeBeanDefiningMethod(String name, Object[] args) { BeanConfiguration old = currentBeanConfig; try { if(args[0] instanceof Class) { Class beanClass = args[0] instanceof Class ? (Class)args[0] : args[0].getClass(); // depends on control dependency: [if], data = [none] if(args.length >= 1) { if(args[args.length-1] instanceof Closure) { if(args.length-1 != 1) { Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length-1); filterGStringReferences(constructorArgs); // depends on control dependency: [if], data = [none] if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs)); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs)); } else { if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass); } } else { Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length); filterGStringReferences(constructorArgs); // depends on control dependency: [if], data = [none] if(name.equals(ANONYMOUS_BEAN)) currentBeanConfig = springConfig.createSingletonBean(beanClass,Arrays.asList(constructorArgs)); else currentBeanConfig = springConfig.addSingletonBean(name, beanClass, Arrays.asList(constructorArgs)); } } } else if(args[0] instanceof RuntimeBeanReference) { currentBeanConfig = springConfig.addSingletonBean(name); // depends on control dependency: [if], data = [none] currentBeanConfig.setFactoryBean(((RuntimeBeanReference)args[0]).getBeanName()); // depends on control dependency: [if], data = [none] } else if(args[0] instanceof Map) { currentBeanConfig = springConfig.addSingletonBean(name); // depends on control dependency: [if], data = [none] Map.Entry factoryBeanEntry = (Map.Entry)((Map)args[0]).entrySet().iterator().next(); currentBeanConfig.setFactoryBean(factoryBeanEntry.getKey().toString()); // depends on control dependency: [if], data = [none] currentBeanConfig.setFactoryMethod(factoryBeanEntry.getValue().toString()); // depends on control dependency: [if], data = [none] } else if(args[0] instanceof Closure) { currentBeanConfig = springConfig.addAbstractBean(name); // depends on control dependency: [if], data = [none] } else { Object[] constructorArgs; if(args[args.length-1] instanceof Closure) { constructorArgs= ArrayUtils.subarray(args, 0, args.length-1); // depends on control dependency: [if], data = [none] } else { constructorArgs= ArrayUtils.subarray(args, 0, args.length); // depends on control dependency: [if], data = [none] } filterGStringReferences(constructorArgs); // depends on control dependency: [if], data = [none] currentBeanConfig = new DefaultBeanConfiguration(name, null, Arrays.asList(constructorArgs)); // depends on control dependency: [if], data = [none] springConfig.addBeanConfiguration(name,currentBeanConfig); // depends on control dependency: [if], data = [none] } if(args[args.length-1] instanceof Closure) { Closure callable = (Closure)args[args.length-1]; callable.setDelegate(this); // depends on control dependency: [if], data = [none] callable.setResolveStrategy(Closure.DELEGATE_FIRST); // depends on control dependency: [if], data = [none] callable.call(new Object[]{currentBeanConfig}); // depends on control dependency: [if], data = [none] } return currentBeanConfig; // depends on control dependency: [try], data = [none] } finally { currentBeanConfig = old; } } }
public class class_name { public Principal getLocalPrincipal() { Principal principal; try { principal = session.getLocalPrincipal(); } catch (AbstractMethodError e) { principal = null; // if the provider does not support it, fallback to local certs. // return the X500Principal of the end-entity cert. Certificate[] certs = getLocalCertificates(); if (certs != null) { principal = ((X509Certificate)certs[0]).getSubjectX500Principal(); } } return principal; } }
public class class_name { public Principal getLocalPrincipal() { Principal principal; try { principal = session.getLocalPrincipal(); // depends on control dependency: [try], data = [none] } catch (AbstractMethodError e) { principal = null; // if the provider does not support it, fallback to local certs. // return the X500Principal of the end-entity cert. Certificate[] certs = getLocalCertificates(); if (certs != null) { principal = ((X509Certificate)certs[0]).getSubjectX500Principal(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return principal; } }
public class class_name { @Override public void setUserLayout( IPerson person, IUserProfile profile, Document layoutXML, boolean channelsAdded, boolean updateFragmentCache) { final Document plf = (Document) person.getAttribute(Constants.PLF); if (logger.isDebugEnabled()) { logger.debug( "PLF for {}\n{}", person.getAttribute(IPerson.USERNAME), XmlUtilitiesImpl.toString(plf)); } super.setUserLayout(person, profile, plf, channelsAdded); if (updateFragmentCache) { final FragmentDefinition fragment = this.fragmentUtils.getFragmentDefinitionByOwner(person); if (fragment != null) { this.updateCachedLayout(plf, profile, fragment); } } } }
public class class_name { @Override public void setUserLayout( IPerson person, IUserProfile profile, Document layoutXML, boolean channelsAdded, boolean updateFragmentCache) { final Document plf = (Document) person.getAttribute(Constants.PLF); if (logger.isDebugEnabled()) { logger.debug( "PLF for {}\n{}", person.getAttribute(IPerson.USERNAME), XmlUtilitiesImpl.toString(plf)); // depends on control dependency: [if], data = [none] } super.setUserLayout(person, profile, plf, channelsAdded); if (updateFragmentCache) { final FragmentDefinition fragment = this.fragmentUtils.getFragmentDefinitionByOwner(person); if (fragment != null) { this.updateCachedLayout(plf, profile, fragment); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private int bucketLowInterval(final int index) { if (index <= num_linear_buckets) { return index * interval; } else { return cutoff + (1 << (index - num_linear_buckets + exp_bucket_shift)); } } }
public class class_name { private int bucketLowInterval(final int index) { if (index <= num_linear_buckets) { return index * interval; // depends on control dependency: [if], data = [none] } else { return cutoff + (1 << (index - num_linear_buckets + exp_bucket_shift)); // depends on control dependency: [if], data = [(index] } } }
public class class_name { @Override public void queueEvent(final FacesEvent event) { final FacesContext fc = FacesContext.getCurrentInstance(); if (isSelfRequest(fc) && event instanceof AjaxBehaviorEvent) { final Map<String, String> params = fc.getExternalContext().getRequestParameterMap(); final String eventName = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); final String clientId = this.getClientId(fc); final AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event; final String action = params.get(clientId + "_action"); final String trigger = params.get(clientId + "_trigger"); if (ClipboardSuccessEvent.NAME.equals(eventName)) { final String text = params.get(clientId + "_text"); final ClipboardSuccessEvent successEvent = new ClipboardSuccessEvent(this, behaviorEvent.getBehavior(), action, text, trigger); successEvent.setPhaseId(event.getPhaseId()); super.queueEvent(successEvent); return; } else if (ClipboardErrorEvent.NAME.equals(eventName)) { final ClipboardErrorEvent errorEvent = new ClipboardErrorEvent(this, behaviorEvent.getBehavior(), action, trigger); errorEvent.setPhaseId(event.getPhaseId()); super.queueEvent(errorEvent); return; } } super.queueEvent(event); } }
public class class_name { @Override public void queueEvent(final FacesEvent event) { final FacesContext fc = FacesContext.getCurrentInstance(); if (isSelfRequest(fc) && event instanceof AjaxBehaviorEvent) { final Map<String, String> params = fc.getExternalContext().getRequestParameterMap(); final String eventName = params.get(Constants.RequestParams.PARTIAL_BEHAVIOR_EVENT_PARAM); final String clientId = this.getClientId(fc); final AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event; final String action = params.get(clientId + "_action"); final String trigger = params.get(clientId + "_trigger"); if (ClipboardSuccessEvent.NAME.equals(eventName)) { final String text = params.get(clientId + "_text"); final ClipboardSuccessEvent successEvent = new ClipboardSuccessEvent(this, behaviorEvent.getBehavior(), action, text, trigger); successEvent.setPhaseId(event.getPhaseId()); // depends on control dependency: [if], data = [none] super.queueEvent(successEvent); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (ClipboardErrorEvent.NAME.equals(eventName)) { final ClipboardErrorEvent errorEvent = new ClipboardErrorEvent(this, behaviorEvent.getBehavior(), action, trigger); errorEvent.setPhaseId(event.getPhaseId()); // depends on control dependency: [if], data = [none] super.queueEvent(errorEvent); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } super.queueEvent(event); } }
public class class_name { public boolean deselectFeature(Feature feature) { if (selectedFeatures.containsKey(feature.getId())) { Feature org = selectedFeatures.remove(feature.getId()); handlerManager.fireEvent(new FeatureDeselectedEvent(org)); return true; } else { return false; } } }
public class class_name { public boolean deselectFeature(Feature feature) { if (selectedFeatures.containsKey(feature.getId())) { Feature org = selectedFeatures.remove(feature.getId()); handlerManager.fireEvent(new FeatureDeselectedEvent(org)); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public Deployment deploy(URL url, Context context, ClassLoader parent) throws DeployException { File archive = (File)context.get(Constants.ATTACHMENT_ARCHIVE); if (archive == null) throw new DeployException("Deployment " + url.toExternalForm() + " not found"); FileInputStream fis = null; try { File ijXml = new File(archive, "META-INF/ironjacamar.xml"); if (ijXml.exists()) { IronJacamarParser parser = new IronJacamarParser(); fis = new FileInputStream(ijXml); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(fis); Activation a = parser.parse(xsr); Connector c = (Connector)context.get(Constants.ATTACHMENT_MERGED_METADATA); if (c == null) c = (Connector)context.get(Constants.ATTACHMENT_RA_XML_METADATA); KernelClassLoader cl = (KernelClassLoader)context.get(Constants.ATTACHMENT_CLASSLOADER); Merger merger = new Merger(); Connector actC = merger.merge(c.copy(), a); activate(actC, a, archive.getName(), archive, cl); } return null; } catch (Throwable t) { log.error(t.getMessage(), t); throw new DeployException("Deployment " + url.toExternalForm() + " failed", t); } finally { if (fis != null) { try { fis.close(); } catch (IOException ignore) { // Ignore } } } } }
public class class_name { public Deployment deploy(URL url, Context context, ClassLoader parent) throws DeployException { File archive = (File)context.get(Constants.ATTACHMENT_ARCHIVE); if (archive == null) throw new DeployException("Deployment " + url.toExternalForm() + " not found"); FileInputStream fis = null; try { File ijXml = new File(archive, "META-INF/ironjacamar.xml"); if (ijXml.exists()) { IronJacamarParser parser = new IronJacamarParser(); fis = new FileInputStream(ijXml); XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(fis); Activation a = parser.parse(xsr); Connector c = (Connector)context.get(Constants.ATTACHMENT_MERGED_METADATA); if (c == null) c = (Connector)context.get(Constants.ATTACHMENT_RA_XML_METADATA); KernelClassLoader cl = (KernelClassLoader)context.get(Constants.ATTACHMENT_CLASSLOADER); Merger merger = new Merger(); Connector actC = merger.merge(c.copy(), a); activate(actC, a, archive.getName(), archive, cl); } return null; } catch (Throwable t) { log.error(t.getMessage(), t); throw new DeployException("Deployment " + url.toExternalForm() + " failed", t); } finally { if (fis != null) { try { fis.close(); // depends on control dependency: [try], data = [none] } catch (IOException ignore) { // Ignore } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override public void removeByGroupId(long groupId) { for (CommerceUserSegmentEntry commerceUserSegmentEntry : findByGroupId( groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceUserSegmentEntry); } } }
public class class_name { @Override public void removeByGroupId(long groupId) { for (CommerceUserSegmentEntry commerceUserSegmentEntry : findByGroupId( groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceUserSegmentEntry); // depends on control dependency: [for], data = [commerceUserSegmentEntry] } } }
public class class_name { private String pathToKey(Path path) { if (!path.isAbsolute()) { path = new Path(workingDir, path); } if (path.toUri().getScheme() != null && path.toUri().getPath().isEmpty()) { return ""; } return path.toUri().getPath().substring(1); } }
public class class_name { private String pathToKey(Path path) { if (!path.isAbsolute()) { path = new Path(workingDir, path); // depends on control dependency: [if], data = [none] } if (path.toUri().getScheme() != null && path.toUri().getPath().isEmpty()) { return ""; // depends on control dependency: [if], data = [none] } return path.toUri().getPath().substring(1); } }
public class class_name { public void warnIfOpen() { if (allocationSite == null || !ENABLED) { return; } String message = ("A resource was acquired at attached stack trace but never released. " + "See java.io.Closeable for information on avoiding resource leaks."); REPORTER.report(message, allocationSite); } }
public class class_name { public void warnIfOpen() { if (allocationSite == null || !ENABLED) { return; // depends on control dependency: [if], data = [none] } String message = ("A resource was acquired at attached stack trace but never released. " + "See java.io.Closeable for information on avoiding resource leaks."); REPORTER.report(message, allocationSite); } }
public class class_name { public int writeTemplateEntry(String template, Object entry) { int returnCode = htod.writeTemplateEntry(template, entry); if (returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); } return returnCode; } }
public class class_name { public int writeTemplateEntry(String template, Object entry) { int returnCode = htod.writeTemplateEntry(template, entry); if (returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); // depends on control dependency: [if], data = [none] } return returnCode; } }
public class class_name { public void addImportExportHandler(I_CmsImportExportHandler handler) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_ADDED_IMPORTEXPORT_HANDLER_1, handler)); } m_importExportHandlers.add(handler); } }
public class class_name { public void addImportExportHandler(I_CmsImportExportHandler handler) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_ADDED_IMPORTEXPORT_HANDLER_1, handler)); // depends on control dependency: [if], data = [none] } m_importExportHandlers.add(handler); } }
public class class_name { public void serializeInternally( JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params, IdentitySerializationInfo<T> defaultIdentityInfo, TypeSerializationInfo<T> defaultTypeInfo ) { // Processing the parameters. We fallback to default if parameter is not present. final IdentitySerializationInfo identityInfo = null == params.getIdentityInfo() ? defaultIdentityInfo : params.getIdentityInfo(); final TypeSerializationInfo typeInfo = null == params.getTypeInfo() ? defaultTypeInfo : params.getTypeInfo(); final Set<String> ignoredProperties = null == params.getIgnoredProperties() ? Collections.<String>emptySet() : params .getIgnoredProperties(); if ( params.isUnwrapped() ) { // if unwrapped, we serialize the properties inside the current object serializeProperties( writer, value, ctx, ignoredProperties, identityInfo ); return; } ObjectIdSerializer<?> idWriter = null; if ( null != identityInfo ) { idWriter = ctx.getObjectId( value ); if ( null != idWriter ) { // the bean has already been serialized, we just serialize the id idWriter.serializeId( writer, ctx ); return; } idWriter = identityInfo.getObjectId( value, ctx ); if ( identityInfo.isAlwaysAsId() ) { idWriter.serializeId( writer, ctx ); return; } ctx.addObjectId( value, idWriter ); } if ( null != typeInfo ) { String typeInformation = typeInfo.getTypeInfo( value.getClass() ); if ( null == typeInformation ) { ctx.getLogger().log( Level.WARNING, "Cannot find type info for class " + value.getClass() ); } else { switch ( typeInfo.getInclude() ) { case PROPERTY: // type info is included as a property of the object serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter, typeInfo .getPropertyName(), typeInformation ); return; case WRAPPER_OBJECT: // type info is included in a wrapper object that contains only one property. The name of this property is the type // info and the value the object writer.beginObject(); writer.name( typeInformation ); serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); writer.endObject(); return; case WRAPPER_ARRAY: // type info is included in a wrapper array that contains two elements. First one is the type // info and the second one the object writer.beginArray(); writer.value( typeInformation ); serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); writer.endArray(); return; default: ctx.getLogger().log( Level.SEVERE, "JsonTypeInfo.As." + typeInfo.getInclude() + " is not supported" ); } } } serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); } }
public class class_name { public void serializeInternally( JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params, IdentitySerializationInfo<T> defaultIdentityInfo, TypeSerializationInfo<T> defaultTypeInfo ) { // Processing the parameters. We fallback to default if parameter is not present. final IdentitySerializationInfo identityInfo = null == params.getIdentityInfo() ? defaultIdentityInfo : params.getIdentityInfo(); final TypeSerializationInfo typeInfo = null == params.getTypeInfo() ? defaultTypeInfo : params.getTypeInfo(); final Set<String> ignoredProperties = null == params.getIgnoredProperties() ? Collections.<String>emptySet() : params .getIgnoredProperties(); if ( params.isUnwrapped() ) { // if unwrapped, we serialize the properties inside the current object serializeProperties( writer, value, ctx, ignoredProperties, identityInfo ); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } ObjectIdSerializer<?> idWriter = null; if ( null != identityInfo ) { idWriter = ctx.getObjectId( value ); // depends on control dependency: [if], data = [none] if ( null != idWriter ) { // the bean has already been serialized, we just serialize the id idWriter.serializeId( writer, ctx ); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } idWriter = identityInfo.getObjectId( value, ctx ); // depends on control dependency: [if], data = [none] if ( identityInfo.isAlwaysAsId() ) { idWriter.serializeId( writer, ctx ); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } ctx.addObjectId( value, idWriter ); // depends on control dependency: [if], data = [none] } if ( null != typeInfo ) { String typeInformation = typeInfo.getTypeInfo( value.getClass() ); if ( null == typeInformation ) { ctx.getLogger().log( Level.WARNING, "Cannot find type info for class " + value.getClass() ); // depends on control dependency: [if], data = [none] } else { switch ( typeInfo.getInclude() ) { case PROPERTY: // type info is included as a property of the object serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter, typeInfo .getPropertyName(), typeInformation ); return; case WRAPPER_OBJECT: // type info is included in a wrapper object that contains only one property. The name of this property is the type // info and the value the object writer.beginObject(); writer.name( typeInformation ); serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); writer.endObject(); return; case WRAPPER_ARRAY: // type info is included in a wrapper array that contains two elements. First one is the type // info and the second one the object writer.beginArray(); writer.value( typeInformation ); serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); writer.endArray(); return; default: ctx.getLogger().log( Level.SEVERE, "JsonTypeInfo.As." + typeInfo.getInclude() + " is not supported" ); } } } serializeObject( writer, value, ctx, ignoredProperties, identityInfo, idWriter ); } }
public class class_name { public static boolean npmVersionsMatch(String current, String next) { String left = current; String right = next; if (left == null || right == null) { return false; } if (left.equals(right) || "*".equals(left) || "*".equals(right)) { return true; } if (left.contains(" ")) { // we have a version string from package.json if (right.contains(" ")) { // we can't evaluate this ">=1.5.4 <2.0.0" vs "2 || 3" return false; } if (!right.matches("^\\d.*$")) { right = stripLeadingNonNumeric(right); if (right == null) { return false; } } try { final Semver v = new Semver(right, SemverType.NPM); return v.satisfies(left); } catch (SemverException ex) { LOGGER.trace("ignore", ex); } } else { if (!left.matches("^\\d.*$")) { left = stripLeadingNonNumeric(left); if (left == null || left.isEmpty()) { return false; } } try { Semver v = new Semver(left, SemverType.NPM); if (!right.isEmpty() && v.satisfies(right)) { return true; } if (!right.contains(" ")) { left = current; right = stripLeadingNonNumeric(right); if (right != null) { v = new Semver(right, SemverType.NPM); return v.satisfies(left); } } } catch (SemverException ex) { LOGGER.trace("ignore", ex); } catch (NullPointerException ex) { LOGGER.error("SemVer comparison error: left:\"{}\", right:\"{}\"", left, right); LOGGER.debug("SemVer comparison resulted in NPE", ex); } } return false; } }
public class class_name { public static boolean npmVersionsMatch(String current, String next) { String left = current; String right = next; if (left == null || right == null) { return false; // depends on control dependency: [if], data = [none] } if (left.equals(right) || "*".equals(left) || "*".equals(right)) { return true; // depends on control dependency: [if], data = [none] } if (left.contains(" ")) { // we have a version string from package.json if (right.contains(" ")) { // we can't evaluate this ">=1.5.4 <2.0.0" vs "2 || 3" return false; // depends on control dependency: [if], data = [none] } if (!right.matches("^\\d.*$")) { right = stripLeadingNonNumeric(right); // depends on control dependency: [if], data = [none] if (right == null) { return false; // depends on control dependency: [if], data = [none] } } try { final Semver v = new Semver(right, SemverType.NPM); return v.satisfies(left); // depends on control dependency: [try], data = [none] } catch (SemverException ex) { LOGGER.trace("ignore", ex); } // depends on control dependency: [catch], data = [none] } else { if (!left.matches("^\\d.*$")) { left = stripLeadingNonNumeric(left); // depends on control dependency: [if], data = [none] if (left == null || left.isEmpty()) { return false; // depends on control dependency: [if], data = [none] } } try { Semver v = new Semver(left, SemverType.NPM); if (!right.isEmpty() && v.satisfies(right)) { return true; // depends on control dependency: [if], data = [none] } if (!right.contains(" ")) { left = current; // depends on control dependency: [if], data = [none] right = stripLeadingNonNumeric(right); // depends on control dependency: [if], data = [none] if (right != null) { v = new Semver(right, SemverType.NPM); // depends on control dependency: [if], data = [(right] return v.satisfies(left); // depends on control dependency: [if], data = [none] } } } catch (SemverException ex) { LOGGER.trace("ignore", ex); } catch (NullPointerException ex) { // depends on control dependency: [catch], data = [none] LOGGER.error("SemVer comparison error: left:\"{}\", right:\"{}\"", left, right); LOGGER.debug("SemVer comparison resulted in NPE", ex); } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { public void marshall(CreateRule createRule, ProtocolMarshaller protocolMarshaller) { if (createRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createRule.getInterval(), INTERVAL_BINDING); protocolMarshaller.marshall(createRule.getIntervalUnit(), INTERVALUNIT_BINDING); protocolMarshaller.marshall(createRule.getTimes(), TIMES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateRule createRule, ProtocolMarshaller protocolMarshaller) { if (createRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createRule.getInterval(), INTERVAL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createRule.getIntervalUnit(), INTERVALUNIT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createRule.getTimes(), TIMES_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 Policies withAppCookieStickinessPolicies(AppCookieStickinessPolicy... appCookieStickinessPolicies) { if (this.appCookieStickinessPolicies == null) { setAppCookieStickinessPolicies(new com.amazonaws.internal.SdkInternalList<AppCookieStickinessPolicy>(appCookieStickinessPolicies.length)); } for (AppCookieStickinessPolicy ele : appCookieStickinessPolicies) { this.appCookieStickinessPolicies.add(ele); } return this; } }
public class class_name { public Policies withAppCookieStickinessPolicies(AppCookieStickinessPolicy... appCookieStickinessPolicies) { if (this.appCookieStickinessPolicies == null) { setAppCookieStickinessPolicies(new com.amazonaws.internal.SdkInternalList<AppCookieStickinessPolicy>(appCookieStickinessPolicies.length)); // depends on control dependency: [if], data = [none] } for (AppCookieStickinessPolicy ele : appCookieStickinessPolicies) { this.appCookieStickinessPolicies.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public EList<JvmTypeReference> getFiredEvents() { if (firedEvents == null) { firedEvents = new EObjectContainmentEList<JvmTypeReference>(JvmTypeReference.class, this, SarlPackage.SARL_ACTION__FIRED_EVENTS); } return firedEvents; } }
public class class_name { @Override public EList<JvmTypeReference> getFiredEvents() { if (firedEvents == null) { firedEvents = new EObjectContainmentEList<JvmTypeReference>(JvmTypeReference.class, this, SarlPackage.SARL_ACTION__FIRED_EVENTS); // depends on control dependency: [if], data = [none] } return firedEvents; } }
public class class_name { public void marshall(UserPoolDescriptionType userPoolDescriptionType, ProtocolMarshaller protocolMarshaller) { if (userPoolDescriptionType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(userPoolDescriptionType.getId(), ID_BINDING); protocolMarshaller.marshall(userPoolDescriptionType.getName(), NAME_BINDING); protocolMarshaller.marshall(userPoolDescriptionType.getLambdaConfig(), LAMBDACONFIG_BINDING); protocolMarshaller.marshall(userPoolDescriptionType.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(userPoolDescriptionType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); protocolMarshaller.marshall(userPoolDescriptionType.getCreationDate(), CREATIONDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UserPoolDescriptionType userPoolDescriptionType, ProtocolMarshaller protocolMarshaller) { if (userPoolDescriptionType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(userPoolDescriptionType.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(userPoolDescriptionType.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(userPoolDescriptionType.getLambdaConfig(), LAMBDACONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(userPoolDescriptionType.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(userPoolDescriptionType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(userPoolDescriptionType.getCreationDate(), CREATIONDATE_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 { String formatUnits(int units) { switch (unitType) { case ENGLISH: return NumberFormat.getDecimalFormat().format(units) + (widthInUnitsIsMiles ? " mi" : " yd"); case ENGLISH_FOOT: return NumberFormat.getDecimalFormat().format(units) + (widthInUnitsIsMiles ? " mi" : " ft"); case METRIC: if (units < 10000) { return NumberFormat.getDecimalFormat().format(units) + " m"; } else { return NumberFormat.getDecimalFormat().format((double) units / 1000) + " km"; } case CRS: return NumberFormat.getDecimalFormat().format(units) + " u"; default: throw new IllegalStateException("Unknown unit type " + unitType); } } }
public class class_name { String formatUnits(int units) { switch (unitType) { case ENGLISH: return NumberFormat.getDecimalFormat().format(units) + (widthInUnitsIsMiles ? " mi" : " yd"); case ENGLISH_FOOT: return NumberFormat.getDecimalFormat().format(units) + (widthInUnitsIsMiles ? " mi" : " ft"); case METRIC: if (units < 10000) { return NumberFormat.getDecimalFormat().format(units) + " m"; // depends on control dependency: [if], data = [(units] } else { return NumberFormat.getDecimalFormat().format((double) units / 1000) + " km"; // depends on control dependency: [if], data = [none] } case CRS: return NumberFormat.getDecimalFormat().format(units) + " u"; default: throw new IllegalStateException("Unknown unit type " + unitType); } } }
public class class_name { public final void mDecimalLiteral() throws RecognitionException { try { int _type = DecimalLiteral; int _channel = DEFAULT_TOKEN_CHANNEL; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:16: ( ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0=='0') ) { alt5=1; } else if ( ((LA5_0 >= '1' && LA5_0 <= '9')) ) { alt5=2; } else { NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:19: '0' { match('0'); } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:25: NonZeroDigit ( ( Digits )? | Underscores Digits ) { mNonZeroDigit(); // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:38: ( ( Digits )? | Underscores Digits ) int alt4=2; int LA4_0 = input.LA(1); if ( (LA4_0=='_') ) { alt4=2; } else { alt4=1; } switch (alt4) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )? { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )? int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) { alt3=1; } switch (alt3) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: Digits { mDigits(); } break; } } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:49: Underscores Digits { mUnderscores(); mDigits(); } break; } } break; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:70: ( IntegerTypeSuffix )? int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0=='L'||LA6_0=='l') ) { alt6=1; } switch (alt6) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g: { if ( input.LA(1)=='L'||input.LA(1)=='l' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public final void mDecimalLiteral() throws RecognitionException { try { int _type = DecimalLiteral; int _channel = DEFAULT_TOKEN_CHANNEL; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:16: ( ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) ( IntegerTypeSuffix )? { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:18: ( '0' | NonZeroDigit ( ( Digits )? | Underscores Digits ) ) int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0=='0') ) { alt5=1; // depends on control dependency: [if], data = [none] } else if ( ((LA5_0 >= '1' && LA5_0 <= '9')) ) { alt5=2; // depends on control dependency: [if], data = [none] } else { NoViableAltException nvae = new NoViableAltException("", 5, 0, input); throw nvae; } switch (alt5) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:19: '0' { match('0'); } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:25: NonZeroDigit ( ( Digits )? | Underscores Digits ) { mNonZeroDigit(); // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:38: ( ( Digits )? | Underscores Digits ) int alt4=2; int LA4_0 = input.LA(1); if ( (LA4_0=='_') ) { alt4=2; // depends on control dependency: [if], data = [none] } else { alt4=1; // depends on control dependency: [if], data = [none] } switch (alt4) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )? { // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: ( Digits )? int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) { alt3=1; // depends on control dependency: [if], data = [none] } switch (alt3) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:39: Digits { mDigits(); } break; } } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:49: Underscores Digits { mUnderscores(); mDigits(); } break; } } break; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1304:70: ( IntegerTypeSuffix )? int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0=='L'||LA6_0=='l') ) { alt6=1; // depends on control dependency: [if], data = [none] } switch (alt6) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g: { if ( input.LA(1)=='L'||input.LA(1)=='l' ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { private void getSubArray(byte[] b, int traceDataOffset) { for (int x = 0; x <= b.length - 1; x++) { b[x] = traceData[traceDataOffset + x]; } } }
public class class_name { private void getSubArray(byte[] b, int traceDataOffset) { for (int x = 0; x <= b.length - 1; x++) { b[x] = traceData[traceDataOffset + x]; // depends on control dependency: [for], data = [x] } } }
public class class_name { public void appendAllParametersDetails(StringBuilder out, int indentCount, String indent, List<ParameterDescription> sortedParameters) { if (sortedParameters.size() > 0) { out.append(indent).append(" Options:\n"); } for (ParameterDescription pd : sortedParameters) { WrappedParameter parameter = pd.getParameter(); String description = pd.getDescription(); boolean hasDescription = !description.isEmpty(); // First line, command name out.append(indent) .append(" ") .append(parameter.required() ? "* " : " ") .append(pd.getNames()) .append("\n"); if (hasDescription) { wrapDescription(out, indentCount, s(indentCount) + description); } Object def = pd.getDefault(); if (pd.isDynamicParameter()) { String syntax = "Syntax: " + parameter.names()[0] + "key" + parameter.getAssignment() + "value"; if (hasDescription) { out.append(newLineAndIndent(indentCount)); } else { out.append(s(indentCount)); } out.append(syntax); } if (def != null && !pd.isHelp()) { String displayedDef = Strings.isStringEmpty(def.toString()) ? "<empty string>" : def.toString(); String defaultText = "Default: " + (parameter.password() ? "********" : displayedDef); if (hasDescription) { out.append(newLineAndIndent(indentCount)); } else { out.append(s(indentCount)); } out.append(defaultText); } Class<?> type = pd.getParameterized().getType(); if (type.isEnum()) { String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString(); String possibleValues = "Possible Values: " + valueList; // Prevent duplicate values list, since it is set as 'Options: [values]' if the description // of an enum field is empty in ParameterDescription#init(..) if (!description.contains("Options: " + valueList)) { if (hasDescription) { out.append(newLineAndIndent(indentCount)); } else { out.append(s(indentCount)); } out.append(possibleValues); } } out.append("\n"); } } }
public class class_name { public void appendAllParametersDetails(StringBuilder out, int indentCount, String indent, List<ParameterDescription> sortedParameters) { if (sortedParameters.size() > 0) { out.append(indent).append(" Options:\n"); // depends on control dependency: [if], data = [none] } for (ParameterDescription pd : sortedParameters) { WrappedParameter parameter = pd.getParameter(); String description = pd.getDescription(); boolean hasDescription = !description.isEmpty(); // First line, command name out.append(indent) .append(" ") .append(parameter.required() ? "* " : " ") .append(pd.getNames()) .append("\n"); // depends on control dependency: [for], data = [none] if (hasDescription) { wrapDescription(out, indentCount, s(indentCount) + description); // depends on control dependency: [if], data = [none] } Object def = pd.getDefault(); if (pd.isDynamicParameter()) { String syntax = "Syntax: " + parameter.names()[0] + "key" + parameter.getAssignment() + "value"; if (hasDescription) { out.append(newLineAndIndent(indentCount)); // depends on control dependency: [if], data = [none] } else { out.append(s(indentCount)); // depends on control dependency: [if], data = [none] } out.append(syntax); // depends on control dependency: [if], data = [none] } if (def != null && !pd.isHelp()) { String displayedDef = Strings.isStringEmpty(def.toString()) ? "<empty string>" : def.toString(); String defaultText = "Default: " + (parameter.password() ? "********" : displayedDef); if (hasDescription) { out.append(newLineAndIndent(indentCount)); // depends on control dependency: [if], data = [none] } else { out.append(s(indentCount)); // depends on control dependency: [if], data = [none] } out.append(defaultText); // depends on control dependency: [if], data = [(def] } Class<?> type = pd.getParameterized().getType(); if (type.isEnum()) { String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString(); String possibleValues = "Possible Values: " + valueList; // Prevent duplicate values list, since it is set as 'Options: [values]' if the description // of an enum field is empty in ParameterDescription#init(..) if (!description.contains("Options: " + valueList)) { if (hasDescription) { out.append(newLineAndIndent(indentCount)); // depends on control dependency: [if], data = [none] } else { out.append(s(indentCount)); // depends on control dependency: [if], data = [none] } out.append(possibleValues); // depends on control dependency: [if], data = [none] } } out.append("\n"); // depends on control dependency: [for], data = [none] } } }
public class class_name { public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor) { SubMonitor sub = SubMonitor.convert(monitor, 100); try { DbgpException error = session.getInfo().getError(); if (error != null) { throw error; } session.configure(target.getOptions()); session.getStreamManager().addListener(this); final boolean breakOnFirstLine = // target.breakOnFirstLineEnabled() // || isAnyThreadInStepInto(); VdmThread thread = new VdmThread(target, session, this); thread.initialize(sub.newChild(25)); addThread(thread); final boolean isFirstThread = waitingForThreads; if (isFirstThread) { waitingForThreads = false; } if (isFirstThread || !isSupportsThreads(thread)) { SubMonitor child = sub.newChild(25); target.breakpointManager.initializeSession(thread.getDbgpSession(), child); child = sub.newChild(25); if (configurator != null) { configurator.initializeBreakpoints(thread, child); } } DebugEventHelper.fireCreateEvent(thread); final boolean stopBeforeCode = thread.getDbgpSession().getDebugOptions().get(DebugOption.ENGINE_STOP_BEFORE_CODE); boolean executed = false; if (!breakOnFirstLine) { if (stopBeforeCode || !hasBreakpointAtCurrentPosition(thread)) { thread.resumeAfterAccept(); executed = true; } } else { if (stopBeforeCode || !isValidStack(thread)) { thread.initialStepInto(); executed = true; } } if (!executed) { if (!thread.isStackInitialized()) { thread.updateStack(); } DebugEventHelper.fireChangeEvent(thread); DebugEventHelper.fireSuspendEvent(thread, DebugEvent.CLIENT_REQUEST); } sub.worked(25); fireThreadAccepted(thread, isFirstThread); } catch (Exception e) { try { target.terminate(); } catch (DebugException e1) { } VdmDebugPlugin.log(e); } finally { sub.done(); } } }
public class class_name { public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor) { SubMonitor sub = SubMonitor.convert(monitor, 100); try { DbgpException error = session.getInfo().getError(); if (error != null) { throw error; } session.configure(target.getOptions()); // depends on control dependency: [try], data = [none] session.getStreamManager().addListener(this); // depends on control dependency: [try], data = [none] final boolean breakOnFirstLine = // target.breakOnFirstLineEnabled() // || isAnyThreadInStepInto(); VdmThread thread = new VdmThread(target, session, this); thread.initialize(sub.newChild(25)); // depends on control dependency: [try], data = [none] addThread(thread); // depends on control dependency: [try], data = [none] final boolean isFirstThread = waitingForThreads; if (isFirstThread) { waitingForThreads = false; // depends on control dependency: [if], data = [none] } if (isFirstThread || !isSupportsThreads(thread)) { SubMonitor child = sub.newChild(25); target.breakpointManager.initializeSession(thread.getDbgpSession(), child); // depends on control dependency: [if], data = [none] child = sub.newChild(25); // depends on control dependency: [if], data = [none] if (configurator != null) { configurator.initializeBreakpoints(thread, child); // depends on control dependency: [if], data = [none] } } DebugEventHelper.fireCreateEvent(thread); // depends on control dependency: [try], data = [none] final boolean stopBeforeCode = thread.getDbgpSession().getDebugOptions().get(DebugOption.ENGINE_STOP_BEFORE_CODE); boolean executed = false; if (!breakOnFirstLine) { if (stopBeforeCode || !hasBreakpointAtCurrentPosition(thread)) { thread.resumeAfterAccept(); // depends on control dependency: [if], data = [none] executed = true; // depends on control dependency: [if], data = [none] } } else { if (stopBeforeCode || !isValidStack(thread)) { thread.initialStepInto(); // depends on control dependency: [if], data = [none] executed = true; // depends on control dependency: [if], data = [none] } } if (!executed) { if (!thread.isStackInitialized()) { thread.updateStack(); // depends on control dependency: [if], data = [none] } DebugEventHelper.fireChangeEvent(thread); // depends on control dependency: [if], data = [none] DebugEventHelper.fireSuspendEvent(thread, DebugEvent.CLIENT_REQUEST); // depends on control dependency: [if], data = [none] } sub.worked(25); // depends on control dependency: [try], data = [none] fireThreadAccepted(thread, isFirstThread); // depends on control dependency: [try], data = [none] } catch (Exception e) { try { target.terminate(); // depends on control dependency: [try], data = [none] } catch (DebugException e1) { } // depends on control dependency: [catch], data = [none] VdmDebugPlugin.log(e); } finally // depends on control dependency: [catch], data = [none] { sub.done(); } } }
public class class_name { @Nullable public static <T extends Annotation> T extract(Class<?> targetClass, Class<T> annotationClass) { T annotation = null; if (targetClass.isAnnotationPresent(annotationClass)) { annotation = targetClass.getAnnotation(annotationClass); if (annotation == null && logger.isDebugEnabled()) { logger.debug("TargetClass has no annotation '{}'", annotationClass.getSimpleName()); annotation = targetClass.getDeclaredAnnotation(annotationClass); if (annotation == null && logger.isDebugEnabled()) { logger.debug("TargetClass has no declared annotation '{}'", annotationClass.getSimpleName()); } } } return annotation; } }
public class class_name { @Nullable public static <T extends Annotation> T extract(Class<?> targetClass, Class<T> annotationClass) { T annotation = null; if (targetClass.isAnnotationPresent(annotationClass)) { annotation = targetClass.getAnnotation(annotationClass); // depends on control dependency: [if], data = [none] if (annotation == null && logger.isDebugEnabled()) { logger.debug("TargetClass has no annotation '{}'", annotationClass.getSimpleName()); // depends on control dependency: [if], data = [none] annotation = targetClass.getDeclaredAnnotation(annotationClass); // depends on control dependency: [if], data = [(annotation] if (annotation == null && logger.isDebugEnabled()) { logger.debug("TargetClass has no declared annotation '{}'", annotationClass.getSimpleName()); // depends on control dependency: [if], data = [none] } } } return annotation; } }
public class class_name { private static Node buildNodeForPath( String path ) { // The path cannot be empty, guaranteed by AllHelper final String[] elements = path.split(PATH_SEPARATOR, -1); final int last = elements.length - 1; // Iterate in reverse order, as the instances we want are those on the right side of the path. AndNode rootNode = null; AndNode parentNode = null; for (int i = last; i >= 0; i--) { final String element = elements[i]; // Sanity checks if( element.isEmpty()) { Logger logger = Logger.getLogger( InstanceFilter.class.getName()); logger.warning( "An invalid component path was found in templates. Wrong part is: '" + path + "'." ); rootNode = null; break; } // Node for the current element. final AndNode currentNode = new AndNode(); // Type name filter if (!JOKER.equals(element)) currentNode.delegates.add(new TypeNode(element)); // Special handling if the path begins with a leading '/'. // It means that the instance must be a root instance. // In this case the first element is empty "", despite the component path remains valid. // The following element (at index 1) must match root instances only. if (i == 1 && elements[0].isEmpty()) { currentNode.delegates.add(new RootInstanceNode()); // The next element is an empty string. // If we don't shortcut it, it will make the next iteration fail. // Skip it by forcing the index to its ending bound. i = 0; } if (rootNode == null) { // The current node is the root node. We have no parent node yet. rootNode = currentNode; } else { // Chain the current node with its parent node. parentNode.delegates.add(new ParentInstanceNode(currentNode)); } // Shift and reiterate. parentNode = currentNode; } return rootNode != null ? rootNode : new ErrorNode(); } }
public class class_name { private static Node buildNodeForPath( String path ) { // The path cannot be empty, guaranteed by AllHelper final String[] elements = path.split(PATH_SEPARATOR, -1); final int last = elements.length - 1; // Iterate in reverse order, as the instances we want are those on the right side of the path. AndNode rootNode = null; AndNode parentNode = null; for (int i = last; i >= 0; i--) { final String element = elements[i]; // Sanity checks if( element.isEmpty()) { Logger logger = Logger.getLogger( InstanceFilter.class.getName()); logger.warning( "An invalid component path was found in templates. Wrong part is: '" + path + "'." ); // depends on control dependency: [if], data = [none] rootNode = null; // depends on control dependency: [if], data = [none] break; } // Node for the current element. final AndNode currentNode = new AndNode(); // Type name filter if (!JOKER.equals(element)) currentNode.delegates.add(new TypeNode(element)); // Special handling if the path begins with a leading '/'. // It means that the instance must be a root instance. // In this case the first element is empty "", despite the component path remains valid. // The following element (at index 1) must match root instances only. if (i == 1 && elements[0].isEmpty()) { currentNode.delegates.add(new RootInstanceNode()); // depends on control dependency: [if], data = [none] // The next element is an empty string. // If we don't shortcut it, it will make the next iteration fail. // Skip it by forcing the index to its ending bound. i = 0; // depends on control dependency: [if], data = [none] } if (rootNode == null) { // The current node is the root node. We have no parent node yet. rootNode = currentNode; // depends on control dependency: [if], data = [none] } else { // Chain the current node with its parent node. parentNode.delegates.add(new ParentInstanceNode(currentNode)); // depends on control dependency: [if], data = [none] } // Shift and reiterate. parentNode = currentNode; // depends on control dependency: [for], data = [none] } return rootNode != null ? rootNode : new ErrorNode(); } }
public class class_name { public URLConnection getResourceConnection(String resourceName) throws ResourceException { // Get the URLConnection URLConnection groovyScriptConn = null; ResourceException se = null; for (URL root : roots) { URL scriptURL = null; try { scriptURL = new URL(root, resourceName); groovyScriptConn = openConnection(scriptURL); break; // Now this is a bit unusual } catch (MalformedURLException e) { String message = "Malformed URL: " + root + ", " + resourceName; if (se == null) { se = new ResourceException(message); } else { se = new ResourceException(message, se); } } catch (IOException e1) { String message = "Cannot open URL: " + root + resourceName; groovyScriptConn = null; if (se == null) { se = new ResourceException(message); } else { se = new ResourceException(message, se); } } } if (se == null) se = new ResourceException("No resource for " + resourceName + " was found"); // If we didn't find anything, report on all the exceptions that occurred. if (groovyScriptConn == null) throw se; return groovyScriptConn; } }
public class class_name { public URLConnection getResourceConnection(String resourceName) throws ResourceException { // Get the URLConnection URLConnection groovyScriptConn = null; ResourceException se = null; for (URL root : roots) { URL scriptURL = null; try { scriptURL = new URL(root, resourceName); // depends on control dependency: [try], data = [none] groovyScriptConn = openConnection(scriptURL); // depends on control dependency: [try], data = [none] break; // Now this is a bit unusual } catch (MalformedURLException e) { String message = "Malformed URL: " + root + ", " + resourceName; if (se == null) { se = new ResourceException(message); // depends on control dependency: [if], data = [none] } else { se = new ResourceException(message, se); // depends on control dependency: [if], data = [none] } } catch (IOException e1) { // depends on control dependency: [catch], data = [none] String message = "Cannot open URL: " + root + resourceName; groovyScriptConn = null; if (se == null) { se = new ResourceException(message); // depends on control dependency: [if], data = [none] } else { se = new ResourceException(message, se); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } if (se == null) se = new ResourceException("No resource for " + resourceName + " was found"); // If we didn't find anything, report on all the exceptions that occurred. if (groovyScriptConn == null) throw se; return groovyScriptConn; } }
public class class_name { public void setParallelized(boolean parallelized) { for(Trainable t : bundle.values()) { if (t !=null && t instanceof Parallelizable) { ((Parallelizable)t).setParallelized(parallelized); } } } }
public class class_name { public void setParallelized(boolean parallelized) { for(Trainable t : bundle.values()) { if (t !=null && t instanceof Parallelizable) { ((Parallelizable)t).setParallelized(parallelized); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected RequestInfoInstanceList convertToRequestInfoList(List<RequestInfo> requests, boolean withErrors, boolean withData) { RequestInfoInstance[] requestInfos = new RequestInfoInstance[requests.size()]; int index = 0; for (RequestInfo request : requests) { requestInfos[index] = convertToRequestInfo(request, withErrors, withData); index++; } return new RequestInfoInstanceList(requestInfos); } }
public class class_name { protected RequestInfoInstanceList convertToRequestInfoList(List<RequestInfo> requests, boolean withErrors, boolean withData) { RequestInfoInstance[] requestInfos = new RequestInfoInstance[requests.size()]; int index = 0; for (RequestInfo request : requests) { requestInfos[index] = convertToRequestInfo(request, withErrors, withData); // depends on control dependency: [for], data = [request] index++; // depends on control dependency: [for], data = [none] } return new RequestInfoInstanceList(requestInfos); } }
public class class_name { public boolean isPermit(boolean reload) { if (reload) {// 判断是否需要重新reload reload(); } boolean result = channelStatus.isStart() && mainStemStatus.isOverTake(); if (existOpposite) {// 判断是否存在反向同步 result &= oppositeMainStemStatus.isOverTake(); } return result; } }
public class class_name { public boolean isPermit(boolean reload) { if (reload) {// 判断是否需要重新reload reload(); // depends on control dependency: [if], data = [none] } boolean result = channelStatus.isStart() && mainStemStatus.isOverTake(); if (existOpposite) {// 判断是否存在反向同步 result &= oppositeMainStemStatus.isOverTake(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static URI concatPath(URI base, String relPath) { String resultPath = base.getPath() + StringUtils.stripStart(relPath, "/"); try { return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), resultPath, null, null); } catch (URISyntaxException e) { throw new InvalidUriException(e); } } }
public class class_name { public static URI concatPath(URI base, String relPath) { String resultPath = base.getPath() + StringUtils.stripStart(relPath, "/"); try { return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), resultPath, null, null); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new InvalidUriException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static BitfinexCurrencyPair fromSymbolString(final String symbolString) { for (final BitfinexCurrencyPair currency : BitfinexCurrencyPair.values()) { if (currency.toBitfinexString().equalsIgnoreCase(symbolString)) { return currency; } } throw new IllegalArgumentException("Unable to find currency pair for: " + symbolString); } }
public class class_name { public static BitfinexCurrencyPair fromSymbolString(final String symbolString) { for (final BitfinexCurrencyPair currency : BitfinexCurrencyPair.values()) { if (currency.toBitfinexString().equalsIgnoreCase(symbolString)) { return currency; // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException("Unable to find currency pair for: " + symbolString); } }
public class class_name { public void classifyIncremental() { if(as.isEmpty()) return; // Clear any state from previous incremental classifications newContexts.clear(); affectedContexts.clear(); int numNewConcepts = 0; // Determine which contexts are affected for (NF1a i : as.getNf1aAxioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF1b i : as.getNf1bAxioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF2 i : as.getNf2Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF3 i : as.getNf3Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF4 i : as.getNf4Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF5 i : as.getNf5Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF6 i : as.getNf6Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF7 i : as.getNf7Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } for (NF8 i : as.getNf8Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); } if(log.isInfoEnabled()) log.info("Added " + numNewConcepts + " new concepts to the ontology"); // TODO: this is potentially slow IConceptMap<IConceptSet> subsumptions = getSubsumptions(); rePrimeNF1(as, subsumptions); rePrimeNF2(as, subsumptions); rePrimeNF3(as, subsumptions); rePrimeNF4(as, subsumptions); rePrimeNF5(as, subsumptions); rePrimeNF6(as, subsumptions); rePrimeNF7(as, subsumptions); rePrimeNF8(as, subsumptions); // Classify if(log.isInfoEnabled()) log.info("Classifying incrementally with " + numThreads + " threads"); if(log.isInfoEnabled()) log.info("Running saturation"); ExecutorService executor = Executors.newFixedThreadPool(numThreads, THREAD_FACTORY); for (int j = 0; j < numThreads; j++) { Runnable worker = new Worker(todo); executor.execute(worker); } executor.shutdown(); while (!executor.isTerminated()) { try { executor.awaitTermination(100, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } } assert (todo.isEmpty()); // Stop tracking changes in reactivated contexts for (Context ctx : affectedContexts) { ctx.endTracking(); } affectedContexts.removeAll(newContexts); hasBeenIncrementallyClassified = true; as.clear(); if(log.isTraceEnabled()) log.trace("Processed " + contextIndex.size() + " contexts"); } }
public class class_name { public void classifyIncremental() { if(as.isEmpty()) return; // Clear any state from previous incremental classifications newContexts.clear(); affectedContexts.clear(); int numNewConcepts = 0; // Determine which contexts are affected for (NF1a i : as.getNf1aAxioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF1b i : as.getNf1bAxioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF2 i : as.getNf2Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF3 i : as.getNf3Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF4 i : as.getNf4Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF5 i : as.getNf5Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF6 i : as.getNf6Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF7 i : as.getNf7Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } for (NF8 i : as.getNf8Axioms()) { numNewConcepts = processInclusion(numNewConcepts, i); // depends on control dependency: [for], data = [i] } if(log.isInfoEnabled()) log.info("Added " + numNewConcepts + " new concepts to the ontology"); // TODO: this is potentially slow IConceptMap<IConceptSet> subsumptions = getSubsumptions(); rePrimeNF1(as, subsumptions); rePrimeNF2(as, subsumptions); rePrimeNF3(as, subsumptions); rePrimeNF4(as, subsumptions); rePrimeNF5(as, subsumptions); rePrimeNF6(as, subsumptions); rePrimeNF7(as, subsumptions); rePrimeNF8(as, subsumptions); // Classify if(log.isInfoEnabled()) log.info("Classifying incrementally with " + numThreads + " threads"); if(log.isInfoEnabled()) log.info("Running saturation"); ExecutorService executor = Executors.newFixedThreadPool(numThreads, THREAD_FACTORY); for (int j = 0; j < numThreads; j++) { Runnable worker = new Worker(todo); executor.execute(worker); // depends on control dependency: [for], data = [none] } executor.shutdown(); while (!executor.isTerminated()) { try { executor.awaitTermination(100, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } assert (todo.isEmpty()); // Stop tracking changes in reactivated contexts for (Context ctx : affectedContexts) { ctx.endTracking(); // depends on control dependency: [for], data = [ctx] } affectedContexts.removeAll(newContexts); hasBeenIncrementallyClassified = true; as.clear(); if(log.isTraceEnabled()) log.trace("Processed " + contextIndex.size() + " contexts"); } }
public class class_name { private void dispatchLegacyEventIfNeeded(ManagerEvent event) { if (event instanceof DialBeginEvent) { DialEvent legacyEvent = new DialEvent((DialBeginEvent) event); dispatchEvent(legacyEvent); } } }
public class class_name { private void dispatchLegacyEventIfNeeded(ManagerEvent event) { if (event instanceof DialBeginEvent) { DialEvent legacyEvent = new DialEvent((DialBeginEvent) event); dispatchEvent(legacyEvent); // depends on control dependency: [if], data = [none] } } }