code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected boolean isOneShotQuery(CachedQuery cachedQuery) { if (cachedQuery == null) { return true; } cachedQuery.increaseExecuteCount(); if ((mPrepareThreshold == 0 || cachedQuery.getExecuteCount() < mPrepareThreshold) && !getForceBinaryTransfer()) { return true; } return false; } }
public class class_name { protected boolean isOneShotQuery(CachedQuery cachedQuery) { if (cachedQuery == null) { return true; // depends on control dependency: [if], data = [none] } cachedQuery.increaseExecuteCount(); if ((mPrepareThreshold == 0 || cachedQuery.getExecuteCount() < mPrepareThreshold) && !getForceBinaryTransfer()) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static int parse(String duration) { if (StringUtil.blank(duration)) return 1800; int lastChar = duration.length()-1; char suffix = duration.charAt(lastChar); try { int value = Integer.parseInt(duration.substring(0, lastChar), 10); if (suffix == 'm') { return value * 60; } else if (suffix == 's') { return value; } else if (suffix == 'h') { return value * 60 * 60; } else if (suffix == 'd') { return value *24 * 60 * 60; } } catch (NumberFormatException ignore) {} return 1800; } }
public class class_name { public static int parse(String duration) { if (StringUtil.blank(duration)) return 1800; int lastChar = duration.length()-1; char suffix = duration.charAt(lastChar); try { int value = Integer.parseInt(duration.substring(0, lastChar), 10); if (suffix == 'm') { return value * 60; // depends on control dependency: [if], data = [none] } else if (suffix == 's') { return value; // depends on control dependency: [if], data = [none] } else if (suffix == 'h') { return value * 60 * 60; // depends on control dependency: [if], data = [none] } else if (suffix == 'd') { return value *24 * 60 * 60; // depends on control dependency: [if], data = [none] } } catch (NumberFormatException ignore) {} // depends on control dependency: [catch], data = [none] return 1800; } }
public class class_name { private NumberSelectionResult findByNumber(List<String> numberQueries, Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) { Boolean orgFiltered = false; NumberSelectionResult matchedNumber = new NumberSelectionResult(null, orgFiltered, null); int i = 0; while (matchedNumber.getNumber() == null && i < numberQueries.size()) { matchedNumber = findSingleNumber(numberQueries.get(i), sourceOrganizationSid, destinationOrganizationSid, modifiers); //preserve the orgFiltered flag along the queries if (matchedNumber.getOrganizationFiltered()) { orgFiltered = true; } i = i + 1; } matchedNumber.setOrganizationFiltered(orgFiltered); return matchedNumber; } }
public class class_name { private NumberSelectionResult findByNumber(List<String> numberQueries, Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) { Boolean orgFiltered = false; NumberSelectionResult matchedNumber = new NumberSelectionResult(null, orgFiltered, null); int i = 0; while (matchedNumber.getNumber() == null && i < numberQueries.size()) { matchedNumber = findSingleNumber(numberQueries.get(i), sourceOrganizationSid, destinationOrganizationSid, modifiers); // depends on control dependency: [while], data = [none] //preserve the orgFiltered flag along the queries if (matchedNumber.getOrganizationFiltered()) { orgFiltered = true; // depends on control dependency: [if], data = [none] } i = i + 1; // depends on control dependency: [while], data = [none] } matchedNumber.setOrganizationFiltered(orgFiltered); return matchedNumber; } }
public class class_name { public ModelNodeFormBuilder requiresAtLeastOne(String... attributeName) { if (attributeName != null && attributeName.length != 0) { this.requiresAtLeastOne.addAll(asList(attributeName)); } return this; } }
public class class_name { public ModelNodeFormBuilder requiresAtLeastOne(String... attributeName) { if (attributeName != null && attributeName.length != 0) { this.requiresAtLeastOne.addAll(asList(attributeName)); // depends on control dependency: [if], data = [(attributeName] } return this; } }
public class class_name { public double set(long index, double value) { compact(); int i = findIndexMatching(index); if(i < 0) { add(index, value); compacted = false; return 0; } else { double old = vals[i]; vals[i] = value; return old; } } }
public class class_name { public double set(long index, double value) { compact(); int i = findIndexMatching(index); if(i < 0) { add(index, value); // depends on control dependency: [if], data = [(i] compacted = false; // depends on control dependency: [if], data = [none] return 0; // depends on control dependency: [if], data = [none] } else { double old = vals[i]; vals[i] = value; // depends on control dependency: [if], data = [none] return old; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean setAppVar(final String name, final String val, final HashMap<String, String> appVars) { if (val == null) { appVars.remove(name); return true; } if (appVars.size() > maxAppVars) { return false; } appVars.put(name, val); return true; } }
public class class_name { public boolean setAppVar(final String name, final String val, final HashMap<String, String> appVars) { if (val == null) { appVars.remove(name); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } if (appVars.size() > maxAppVars) { return false; // depends on control dependency: [if], data = [none] } appVars.put(name, val); return true; } }
public class class_name { protected void processReader(IModule module, ModuleBuildReader reader) throws IOException { // Add the cache key generator list to the result list List<ICacheKeyGenerator> keyGenList = reader.getCacheKeyGenerators(); if (keyGenList != null) { keyGens.addAll(keyGenList); } if (smGen != null) { // If we're generating a source map, then merge the source map for the module // into the layer source map. SourceMap moduleSourceMap = reader.getSourceMap(); if (moduleSourceMap != null && writer instanceof LineCountingStringWriter) { sectionCount++; LineCountingStringWriter lcWriter = (LineCountingStringWriter)writer; try { smGen.mergeMapSection(lcWriter.getLine(), lcWriter.getColumn(), moduleSourceMap.map); } catch (SourceMapParseException e) { throw new IOException(e); } // Save the sources content, indexed by the module name, so that we can // add the 'sourcesContent' property to the layer map after the map // has been generated. We need to do this because SourceMapGeneratorV3 // does not merge the sourcesContent properties from module source maps into // the merged layer source map. sourcesMap.put(moduleSourceMap.name, moduleSourceMap.source); } } // Add the reader contents to the result try { IOUtils.copy(reader, writer); } finally { IOUtils.closeQuietly(reader); } if (reader.isError()) { errorMessages.add(reader.getErrorMessage()); } } }
public class class_name { protected void processReader(IModule module, ModuleBuildReader reader) throws IOException { // Add the cache key generator list to the result list List<ICacheKeyGenerator> keyGenList = reader.getCacheKeyGenerators(); if (keyGenList != null) { keyGens.addAll(keyGenList); } if (smGen != null) { // If we're generating a source map, then merge the source map for the module // into the layer source map. SourceMap moduleSourceMap = reader.getSourceMap(); if (moduleSourceMap != null && writer instanceof LineCountingStringWriter) { sectionCount++; // depends on control dependency: [if], data = [none] LineCountingStringWriter lcWriter = (LineCountingStringWriter)writer; try { smGen.mergeMapSection(lcWriter.getLine(), lcWriter.getColumn(), moduleSourceMap.map); // depends on control dependency: [try], data = [none] } catch (SourceMapParseException e) { throw new IOException(e); } // depends on control dependency: [catch], data = [none] // Save the sources content, indexed by the module name, so that we can // add the 'sourcesContent' property to the layer map after the map // has been generated. We need to do this because SourceMapGeneratorV3 // does not merge the sourcesContent properties from module source maps into // the merged layer source map. sourcesMap.put(moduleSourceMap.name, moduleSourceMap.source); // depends on control dependency: [if], data = [(moduleSourceMap] } } // Add the reader contents to the result try { IOUtils.copy(reader, writer); } finally { IOUtils.closeQuietly(reader); } if (reader.isError()) { errorMessages.add(reader.getErrorMessage()); } } }
public class class_name { private void init(Configuration cfg) throws IOException { Settings settings = HadoopSettingsManager.loadFrom(cfg); Assert.hasText(settings.getResourceWrite(), String.format("No resource ['%s'] (index/query/location) specified", ES_RESOURCE)); // Need to discover the ESVersion before checking if index exists. InitializationUtils.discoverClusterInfo(settings, log); InitializationUtils.checkIdForOperation(settings); InitializationUtils.checkIndexExistence(settings); if (HadoopCfgUtils.getReduceTasks(cfg) != null) { if (HadoopCfgUtils.getSpeculativeReduce(cfg)) { log.warn("Speculative execution enabled for reducer - consider disabling it to prevent data corruption"); } } else { if (HadoopCfgUtils.getSpeculativeMap(cfg)) { log.warn("Speculative execution enabled for mapper - consider disabling it to prevent data corruption"); } } //log.info(String.format("Starting to write/index to [%s][%s]", settings.getTargetUri(), settings.getTargetResource())); } }
public class class_name { private void init(Configuration cfg) throws IOException { Settings settings = HadoopSettingsManager.loadFrom(cfg); Assert.hasText(settings.getResourceWrite(), String.format("No resource ['%s'] (index/query/location) specified", ES_RESOURCE)); // Need to discover the ESVersion before checking if index exists. InitializationUtils.discoverClusterInfo(settings, log); InitializationUtils.checkIdForOperation(settings); InitializationUtils.checkIndexExistence(settings); if (HadoopCfgUtils.getReduceTasks(cfg) != null) { if (HadoopCfgUtils.getSpeculativeReduce(cfg)) { log.warn("Speculative execution enabled for reducer - consider disabling it to prevent data corruption"); // depends on control dependency: [if], data = [none] } } else { if (HadoopCfgUtils.getSpeculativeMap(cfg)) { log.warn("Speculative execution enabled for mapper - consider disabling it to prevent data corruption"); // depends on control dependency: [if], data = [none] } } //log.info(String.format("Starting to write/index to [%s][%s]", settings.getTargetUri(), settings.getTargetResource())); } }
public class class_name { public EClass getLNC() { if (lncEClass == null) { lncEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(285); } return lncEClass; } }
public class class_name { public EClass getLNC() { if (lncEClass == null) { lncEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(285); // depends on control dependency: [if], data = [none] } return lncEClass; } }
public class class_name { private List<String> removeSeLionArgumentsAndValues(List<String> args) { // assume all of the ProcessLauncherConfiguration and LauncherConfiguration arguments should not be forwarded Set<Field> fields = new HashSet<>(); fields.addAll(Arrays.asList(ProcessLauncherConfiguration.class.getDeclaredFields())); fields.addAll(Arrays.asList(LauncherConfiguration.class.getDeclaredFields())); for (Field field : fields) { // we need jcommander parameter fields only Parameter parameter = field.getAnnotation(Parameter.class); if (parameter == null) { continue; } // get the "arity" (how many values it can have on the command line) of the parameter/argument. // for example "-foo bar bar2" --> argument = -foo --> arity = 2 --> values = {bar, bar2} final Class<?> fieldType = field.getType(); final int arity = (parameter.arity() != -1) ? parameter.arity() : (fieldType.equals(Integer.class) || fieldType.equals(Long.class) || fieldType.equals(String.class) || fieldType.equals(int.class) || fieldType.equals(long.class)) ? 1 : 0; if (arity > 0) { for (String arg : args) { // when the arg we are processing is one of the @Parameter names if (Arrays.asList(parameter.names()).contains(arg)) { // replace each value with "" for (int x = 1; x <= arity; x += 1 ) { args.set(args.indexOf(arg) + x, ""); } // replace the argument with "" args.set(args.indexOf(arg), ""); } } // remove all "" args.removeAll(Arrays.asList("")); } else { // the "arity" of the argument 0. there are no values to worry about. // remove all instances of the argument (and/or one of its names) from args args.removeAll(Arrays.asList(parameter.names())); } } return args; } }
public class class_name { private List<String> removeSeLionArgumentsAndValues(List<String> args) { // assume all of the ProcessLauncherConfiguration and LauncherConfiguration arguments should not be forwarded Set<Field> fields = new HashSet<>(); fields.addAll(Arrays.asList(ProcessLauncherConfiguration.class.getDeclaredFields())); fields.addAll(Arrays.asList(LauncherConfiguration.class.getDeclaredFields())); for (Field field : fields) { // we need jcommander parameter fields only Parameter parameter = field.getAnnotation(Parameter.class); if (parameter == null) { continue; } // get the "arity" (how many values it can have on the command line) of the parameter/argument. // for example "-foo bar bar2" --> argument = -foo --> arity = 2 --> values = {bar, bar2} final Class<?> fieldType = field.getType(); final int arity = (parameter.arity() != -1) ? parameter.arity() : (fieldType.equals(Integer.class) || fieldType.equals(Long.class) || fieldType.equals(String.class) || fieldType.equals(int.class) || fieldType.equals(long.class)) ? 1 : 0; if (arity > 0) { for (String arg : args) { // when the arg we are processing is one of the @Parameter names if (Arrays.asList(parameter.names()).contains(arg)) { // replace each value with "" for (int x = 1; x <= arity; x += 1 ) { args.set(args.indexOf(arg) + x, ""); // depends on control dependency: [for], data = [x] } // replace the argument with "" args.set(args.indexOf(arg), ""); // depends on control dependency: [if], data = [none] } } // remove all "" args.removeAll(Arrays.asList("")); // depends on control dependency: [if], data = [none] } else { // the "arity" of the argument 0. there are no values to worry about. // remove all instances of the argument (and/or one of its names) from args args.removeAll(Arrays.asList(parameter.names())); // depends on control dependency: [if], data = [none] } } return args; } }
public class class_name { public static void serverSend(NettyHttpResponse response, Throwable throwable) { try { SofaRequest sofaRequest = new SofaRequest(); SofaResponse sofaResponse = new SofaResponse(); if (response == null) { sofaResponse.setErrorMsg("rest path ends with /favicon.ico"); } else if (throwable != null) { if (response.getStatus() == 500) { sofaResponse.setAppResponse(throwable); } else { sofaResponse.setErrorMsg(throwable.getMessage()); } Object method = RpcInternalContext.getContext().getAttachment(METHOD_TYPE_STRING); if (method != null) { Class[] parameterTypes = ((Method) method).getParameterTypes(); String[] methodTypeString = new String[parameterTypes.length]; for (int i = 0; i < methodTypeString.length; i++) { methodTypeString[i] = (parameterTypes[i].getName()); } sofaRequest.setMethodArgSigs(methodTypeString); } } SofaTraceContext sofaTraceContext = SofaTraceContextHolder.getSofaTraceContext(); SofaTracerSpan serverSpan = sofaTraceContext.getCurrentSpan(); RpcInternalContext context = RpcInternalContext.getContext(); if (serverSpan != null) { serverSpan.setTag(RpcSpanTags.SERVER_BIZ_TIME, (Number) context.getAttachment(RpcConstants.INTERNAL_KEY_IMPL_ELAPSE)); } Tracers.serverSend(sofaRequest, sofaResponse, null); } catch (Throwable t) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("the process of rest tracer server send occur error ", t); } } } }
public class class_name { public static void serverSend(NettyHttpResponse response, Throwable throwable) { try { SofaRequest sofaRequest = new SofaRequest(); SofaResponse sofaResponse = new SofaResponse(); if (response == null) { sofaResponse.setErrorMsg("rest path ends with /favicon.ico"); // depends on control dependency: [if], data = [none] } else if (throwable != null) { if (response.getStatus() == 500) { sofaResponse.setAppResponse(throwable); // depends on control dependency: [if], data = [none] } else { sofaResponse.setErrorMsg(throwable.getMessage()); // depends on control dependency: [if], data = [none] } Object method = RpcInternalContext.getContext().getAttachment(METHOD_TYPE_STRING); if (method != null) { Class[] parameterTypes = ((Method) method).getParameterTypes(); String[] methodTypeString = new String[parameterTypes.length]; for (int i = 0; i < methodTypeString.length; i++) { methodTypeString[i] = (parameterTypes[i].getName()); // depends on control dependency: [for], data = [i] } sofaRequest.setMethodArgSigs(methodTypeString); // depends on control dependency: [if], data = [(method] } } SofaTraceContext sofaTraceContext = SofaTraceContextHolder.getSofaTraceContext(); SofaTracerSpan serverSpan = sofaTraceContext.getCurrentSpan(); RpcInternalContext context = RpcInternalContext.getContext(); if (serverSpan != null) { serverSpan.setTag(RpcSpanTags.SERVER_BIZ_TIME, (Number) context.getAttachment(RpcConstants.INTERNAL_KEY_IMPL_ELAPSE)); // depends on control dependency: [if], data = [none] } Tracers.serverSend(sofaRequest, sofaResponse, null); // depends on control dependency: [try], data = [none] } catch (Throwable t) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("the process of rest tracer server send occur error ", t); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <V> Set<V> getIncomingVertices(DirectedGraph<V, DefaultEdge> graph, V target) { Set<DefaultEdge> edges = graph.incomingEdgesOf(target); Set<V> sources = new LinkedHashSet<V>(); for (DefaultEdge edge : edges) { sources.add(graph.getEdgeSource(edge)); } return sources; } }
public class class_name { public static <V> Set<V> getIncomingVertices(DirectedGraph<V, DefaultEdge> graph, V target) { Set<DefaultEdge> edges = graph.incomingEdgesOf(target); Set<V> sources = new LinkedHashSet<V>(); for (DefaultEdge edge : edges) { sources.add(graph.getEdgeSource(edge)); // depends on control dependency: [for], data = [edge] } return sources; } }
public class class_name { public void learnAndSave() { System.out.println("======== Learning Classifier"); // Either load pre-computed words or compute the words from the training images AssignCluster<double[]> assignment; if( new File(CLUSTER_FILE_NAME).exists() ) { assignment = UtilIO.load(CLUSTER_FILE_NAME); } else { System.out.println(" Computing clusters"); assignment = computeClusters(); } // Use these clusters to assign features to words FeatureToWordHistogram_F64 featuresToHistogram = new FeatureToWordHistogram_F64(assignment,HISTOGRAM_HARD); // Storage for the work histogram in each image in the training set and their label List<HistogramScene> memory; if( !new File(HISTOGRAM_FILE_NAME).exists() ) { System.out.println(" computing histograms"); memory = computeHistograms(featuresToHistogram); UtilIO.save(memory,HISTOGRAM_FILE_NAME); } } }
public class class_name { public void learnAndSave() { System.out.println("======== Learning Classifier"); // Either load pre-computed words or compute the words from the training images AssignCluster<double[]> assignment; if( new File(CLUSTER_FILE_NAME).exists() ) { assignment = UtilIO.load(CLUSTER_FILE_NAME); // depends on control dependency: [if], data = [none] } else { System.out.println(" Computing clusters"); // depends on control dependency: [if], data = [none] assignment = computeClusters(); // depends on control dependency: [if], data = [none] } // Use these clusters to assign features to words FeatureToWordHistogram_F64 featuresToHistogram = new FeatureToWordHistogram_F64(assignment,HISTOGRAM_HARD); // Storage for the work histogram in each image in the training set and their label List<HistogramScene> memory; if( !new File(HISTOGRAM_FILE_NAME).exists() ) { System.out.println(" computing histograms"); // depends on control dependency: [if], data = [none] memory = computeHistograms(featuresToHistogram); // depends on control dependency: [if], data = [none] UtilIO.save(memory,HISTOGRAM_FILE_NAME); // depends on control dependency: [if], data = [none] } } }
public class class_name { private synchronized ReceiveAllowedThread getReceiveAllowedThread(DestinationHandler destinationHandler) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getReceiveAllowedThread", destinationHandler); if (_receiveAllowedThread == null) { _receiveAllowedThread = new ReceiveAllowedThread(destinationHandler); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getReceiveAllowedThread", _receiveAllowedThread); return _receiveAllowedThread; } _receiveAllowedThread.markForUpdate(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getReceiveAllowedThread", null); return null; } }
public class class_name { private synchronized ReceiveAllowedThread getReceiveAllowedThread(DestinationHandler destinationHandler) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getReceiveAllowedThread", destinationHandler); if (_receiveAllowedThread == null) { _receiveAllowedThread = new ReceiveAllowedThread(destinationHandler); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getReceiveAllowedThread", _receiveAllowedThread); return _receiveAllowedThread; // depends on control dependency: [if], data = [none] } _receiveAllowedThread.markForUpdate(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getReceiveAllowedThread", null); return null; } }
public class class_name { private String limitStringLength(String str) { if (str.length() > MAX_STRING_LENGTH) { str = str.substring(0, MAX_STRING_LENGTH) + " ..."; } return str; } }
public class class_name { private String limitStringLength(String str) { if (str.length() > MAX_STRING_LENGTH) { str = str.substring(0, MAX_STRING_LENGTH) + " ..."; // depends on control dependency: [if], data = [MAX_STRING_LENGTH)] } return str; } }
public class class_name { public Properties getLables(JKLocale locale) { Properties properties = lables.get(locale); if (properties == null) { properties = new Properties(); lables.put(locale, properties); } return properties; } }
public class class_name { public Properties getLables(JKLocale locale) { Properties properties = lables.get(locale); if (properties == null) { properties = new Properties(); // depends on control dependency: [if], data = [none] lables.put(locale, properties); // depends on control dependency: [if], data = [none] } return properties; } }
public class class_name { Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym))); localEnv.enclMethod = tree; if (tree.sym.type != null) { //when this is called in the enter stage, there's no type to be set localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL, tree.sym.type.getReturnType()); } if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; } }
public class class_name { Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym))); localEnv.enclMethod = tree; if (tree.sym.type != null) { //when this is called in the enter stage, there's no type to be set localEnv.info.returnResult = attr.new ResultInfo(KindSelector.VAL, tree.sym.type.getReturnType()); // depends on control dependency: [if], data = [none] } if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; } }
public class class_name { public void addListener(UpdateCheckListener newListener) { if (newListener == null) { throw new IllegalArgumentException("newListener"); } GatewayVersion latestGatewayVersion = getLatestGatewayVersion(); if (latestGatewayVersion != null && latestGatewayVersion.compareTo(currentVersion) > 0) { newListener.newVersionAvailable(currentVersion, latestGatewayVersion); } listeners.add(newListener); } }
public class class_name { public void addListener(UpdateCheckListener newListener) { if (newListener == null) { throw new IllegalArgumentException("newListener"); } GatewayVersion latestGatewayVersion = getLatestGatewayVersion(); if (latestGatewayVersion != null && latestGatewayVersion.compareTo(currentVersion) > 0) { newListener.newVersionAvailable(currentVersion, latestGatewayVersion); // depends on control dependency: [if], data = [none] } listeners.add(newListener); } }
public class class_name { public void cmsEvent(org.opencms.main.CmsEvent event) { if (!isEnabled()) { return; } switch (event.getType()) { case I_CmsEventListener.EVENT_PUBLISH_PROJECT: if (LOG.isDebugEnabled()) { LOG.debug("FlexCache: Received event PUBLISH_PROJECT"); } String publishIdStr = (String)(event.getData().get(I_CmsEventListener.KEY_PUBLISHID)); if (!CmsUUID.isValidUUID(publishIdStr)) { clear(); } else { try { CmsUUID publishId = new CmsUUID(publishIdStr); List<CmsPublishedResource> publishedResources = m_cmsObject.readPublishedResources(publishId); boolean updateConfiguration = false; for (CmsPublishedResource res : publishedResources) { if (res.getRootPath().equals(CONFIG_PATH)) { updateConfiguration = true; break; } } CmsFlexBucketConfiguration bucketConfig = m_bucketConfiguration; if (updateConfiguration) { LOG.info("Flex bucket configuration was updated, re-initializing configuration..."); try { m_bucketConfiguration = CmsFlexBucketConfiguration.loadFromVfsFile( m_cmsObject, CONFIG_PATH); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } // Make sure no entries built for the old configuration remain in the cache clear(); } else if (bucketConfig != null) { boolean bucketClearOk = clearBucketsForPublishList( bucketConfig, publishId, publishedResources); if (!bucketClearOk) { clear(); } } else { clear(); } } catch (CmsException e1) { LOG.error(e1.getLocalizedMessage(), e1); clear(); } } break; case I_CmsEventListener.EVENT_CLEAR_CACHES: if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_0)); } clear(); break; case I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY: if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_PURGE_REPOSITORY_0)); } purgeJspRepository(); break; case I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR: if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_PARTIALLY_0)); } Map<String, ?> m = event.getData(); if (m == null) { break; } Integer it = null; try { it = (Integer)m.get(CACHE_ACTION); } catch (Exception e) { // it will be null } if (it == null) { break; } int i = it.intValue(); switch (i) { case CLEAR_ALL: clear(); break; case CLEAR_ENTRIES: clearEntries(); break; case CLEAR_ONLINE_ALL: clearOnline(); break; case CLEAR_ONLINE_ENTRIES: clearOnlineEntries(); break; case CLEAR_OFFLINE_ALL: clearOffline(); break; case CLEAR_OFFLINE_ENTRIES: clearOfflineEntries(); break; default: // no operation } break; default: // no operation } } }
public class class_name { public void cmsEvent(org.opencms.main.CmsEvent event) { if (!isEnabled()) { return; // depends on control dependency: [if], data = [none] } switch (event.getType()) { case I_CmsEventListener.EVENT_PUBLISH_PROJECT: if (LOG.isDebugEnabled()) { LOG.debug("FlexCache: Received event PUBLISH_PROJECT"); // depends on control dependency: [if], data = [none] } String publishIdStr = (String)(event.getData().get(I_CmsEventListener.KEY_PUBLISHID)); if (!CmsUUID.isValidUUID(publishIdStr)) { clear(); // depends on control dependency: [if], data = [none] } else { try { CmsUUID publishId = new CmsUUID(publishIdStr); List<CmsPublishedResource> publishedResources = m_cmsObject.readPublishedResources(publishId); boolean updateConfiguration = false; for (CmsPublishedResource res : publishedResources) { if (res.getRootPath().equals(CONFIG_PATH)) { updateConfiguration = true; // depends on control dependency: [if], data = [none] break; } } CmsFlexBucketConfiguration bucketConfig = m_bucketConfiguration; if (updateConfiguration) { LOG.info("Flex bucket configuration was updated, re-initializing configuration..."); // depends on control dependency: [if], data = [none] try { m_bucketConfiguration = CmsFlexBucketConfiguration.loadFromVfsFile( m_cmsObject, CONFIG_PATH); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] // Make sure no entries built for the old configuration remain in the cache clear(); // depends on control dependency: [if], data = [none] } else if (bucketConfig != null) { boolean bucketClearOk = clearBucketsForPublishList( bucketConfig, publishId, publishedResources); if (!bucketClearOk) { clear(); // depends on control dependency: [if], data = [none] } } else { clear(); // depends on control dependency: [if], data = [none] } } catch (CmsException e1) { LOG.error(e1.getLocalizedMessage(), e1); clear(); } // depends on control dependency: [catch], data = [none] } break; case I_CmsEventListener.EVENT_CLEAR_CACHES: if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_0)); // depends on control dependency: [if], data = [none] } clear(); break; case I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY: if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_PURGE_REPOSITORY_0)); } purgeJspRepository(); break; case I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR: if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_PARTIALLY_0)); } Map<String, ?> m = event.getData(); if (m == null) { break; } Integer it = null; try { it = (Integer)m.get(CACHE_ACTION); } catch (Exception e) { // it will be null } if (it == null) { break; } int i = it.intValue(); switch (i) { case CLEAR_ALL: clear(); break; case CLEAR_ENTRIES: clearEntries(); break; case CLEAR_ONLINE_ALL: clearOnline(); break; case CLEAR_ONLINE_ENTRIES: clearOnlineEntries(); break; case CLEAR_OFFLINE_ALL: clearOffline(); break; case CLEAR_OFFLINE_ENTRIES: clearOfflineEntries(); break; default: // no operation } break; default: // no operation } } }
public class class_name { public static double[][] pseudoInverse(double[][] matrix){ if(isSolverUseApacheCommonsMath) { // Use LU from common math SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix)); double[][] matrixInverse = svd.getSolver().getInverse().getData(); return matrixInverse; } else { return org.jblas.Solve.pinv(new org.jblas.DoubleMatrix(matrix)).toArray2(); } } }
public class class_name { public static double[][] pseudoInverse(double[][] matrix){ if(isSolverUseApacheCommonsMath) { // Use LU from common math SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix)); double[][] matrixInverse = svd.getSolver().getInverse().getData(); return matrixInverse; // depends on control dependency: [if], data = [none] } else { return org.jblas.Solve.pinv(new org.jblas.DoubleMatrix(matrix)).toArray2(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isLink() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isLink"); SibTr.exit(tc, "isLink", new Boolean(_isLink)); } return _isLink; } }
public class class_name { public boolean isLink() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "isLink"); // depends on control dependency: [if], data = [none] SibTr.exit(tc, "isLink", new Boolean(_isLink)); // depends on control dependency: [if], data = [none] } return _isLink; } }
public class class_name { public Result run(Database database, Relation<O> relation, Relation<NumberVector> radrel) { if(queries != null) { throw new AbortException("This 'run' method will not use the given query set!"); } // Get a distance and kNN query instance. DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction()); RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery); final DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random); FiniteProgress prog = LOG.isVeryVerbose() ? new FiniteProgress("kNN queries", sample.size(), LOG) : null; int hash = 0; MeanVariance mv = new MeanVariance(); for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance()) { double r = radrel.get(iditer).doubleValue(0); DoubleDBIDList rres = rangeQuery.getRangeForDBID(iditer, r); int ichecksum = 0; for(DBIDIter it = rres.iter(); it.valid(); it.advance()) { ichecksum += DBIDUtil.asInteger(it); } hash = Util.mixHashCodes(hash, ichecksum); mv.put(rres.size()); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); if(LOG.isStatistics()) { LOG.statistics("Result hashcode: " + hash); LOG.statistics("Mean number of results: " + mv.getMean() + " +- " + mv.getNaiveStddev()); } return null; } }
public class class_name { public Result run(Database database, Relation<O> relation, Relation<NumberVector> radrel) { if(queries != null) { throw new AbortException("This 'run' method will not use the given query set!"); } // Get a distance and kNN query instance. DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction()); RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery); final DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random); FiniteProgress prog = LOG.isVeryVerbose() ? new FiniteProgress("kNN queries", sample.size(), LOG) : null; int hash = 0; MeanVariance mv = new MeanVariance(); for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance()) { double r = radrel.get(iditer).doubleValue(0); DoubleDBIDList rres = rangeQuery.getRangeForDBID(iditer, r); int ichecksum = 0; for(DBIDIter it = rres.iter(); it.valid(); it.advance()) { ichecksum += DBIDUtil.asInteger(it); // depends on control dependency: [for], data = [it] } hash = Util.mixHashCodes(hash, ichecksum); // depends on control dependency: [for], data = [none] mv.put(rres.size()); // depends on control dependency: [for], data = [none] LOG.incrementProcessed(prog); // depends on control dependency: [for], data = [none] } LOG.ensureCompleted(prog); if(LOG.isStatistics()) { LOG.statistics("Result hashcode: " + hash); // depends on control dependency: [if], data = [none] LOG.statistics("Mean number of results: " + mv.getMean() + " +- " + mv.getNaiveStddev()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public Query<T> build() { QueryBean<T> queryBean = new QueryBean<T>(); queryBean.setStatement(genStatement()); queryBean.setParams(getParams()); if (null != limit) { queryBean.setLimit(new PageLimit(limit.getPageIndex(), limit.getPageSize())); } queryBean.setCountStatement(genCountStatement()); queryBean.setCacheable(cacheable); queryBean.setLang(getLang()); return queryBean; } }
public class class_name { public Query<T> build() { QueryBean<T> queryBean = new QueryBean<T>(); queryBean.setStatement(genStatement()); queryBean.setParams(getParams()); if (null != limit) { queryBean.setLimit(new PageLimit(limit.getPageIndex(), limit.getPageSize())); // depends on control dependency: [if], data = [none] } queryBean.setCountStatement(genCountStatement()); queryBean.setCacheable(cacheable); queryBean.setLang(getLang()); return queryBean; } }
public class class_name { @Override public void preloadResources() { final List<? extends ResourceItem<?, ?, ?>> resourceList = getResourceToPreload(); if (resourceList != null) { for (final ResourceItem<?, ?, ?> resource : resourceList) { // Access the font to load it and allow it to be used by CSS resource.get(); } } } }
public class class_name { @Override public void preloadResources() { final List<? extends ResourceItem<?, ?, ?>> resourceList = getResourceToPreload(); if (resourceList != null) { for (final ResourceItem<?, ?, ?> resource : resourceList) { // Access the font to load it and allow it to be used by CSS resource.get(); // depends on control dependency: [for], data = [resource] } } } }
public class class_name { public void appendLine(final Line line) { if (this.lineTail == null) { this.lines = this.lineTail = line; } else { this.lineTail.nextEmpty = line.isEmpty; line.prevEmpty = this.lineTail.isEmpty; line.previous = this.lineTail; this.lineTail.next = line; this.lineTail = line; } } }
public class class_name { public void appendLine(final Line line) { if (this.lineTail == null) { this.lines = this.lineTail = line; // depends on control dependency: [if], data = [none] } else { this.lineTail.nextEmpty = line.isEmpty; // depends on control dependency: [if], data = [none] line.prevEmpty = this.lineTail.isEmpty; // depends on control dependency: [if], data = [none] line.previous = this.lineTail; // depends on control dependency: [if], data = [none] this.lineTail.next = line; // depends on control dependency: [if], data = [none] this.lineTail = line; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void createControl(Composite parent) { comp = new Composite(parent, SWT.BORDER); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_HORIZONTAL); gd.heightHint = 400; gd.widthHint = 400; comp.setLayoutData(gd); setControl(comp); Label label = new Label(comp, SWT.NONE); label.setText("Sort by:"); final Combo sortByCombo = new Combo(comp, SWT.READ_ONLY); final String[] items = new String[] { "Name", "Not filtered bug count", "Overall bug count" }; sortByCombo.setItems(items); String sortOrder = FindbugsPlugin.getDefault().getPreferenceStore().getString(FindBugsConstants.EXPORT_SORT_ORDER); if (FindBugsConstants.ORDER_BY_NOT_FILTERED_BUGS_COUNT.equals(sortOrder)) { sortByCombo.select(1); } else if (FindBugsConstants.ORDER_BY_OVERALL_BUGS_COUNT.equals(sortOrder)) { sortByCombo.select(2); } else { sortByCombo.select(0); } sortBy = sortByCombo.getSelectionIndex(); sortByCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(SelectionEvent e) { sortBy = sortByCombo.getSelectionIndex(); } }); label = new Label(comp, SWT.NONE); label.setText("Filter bug ids:"); Button button = new Button(comp, SWT.PUSH); button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); button.setText("Browse..."); button.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(SelectionEvent e) { Set<BugPattern> filtered = FindbugsPlugin.getFilteredPatterns(); Set<BugCode> filteredTypes = FindbugsPlugin.getFilteredPatternTypes(); FilterBugsDialog dialog = new FilterBugsDialog(getShell(), filtered, filteredTypes); dialog.setTitle("Bug Filter Configuration"); int result = dialog.open(); if (result != Window.OK) { return; } String selectedIds = dialog.getSelectedIds(); FindbugsPlugin.getDefault().getPreferenceStore().setValue(FindBugsConstants.LAST_USED_EXPORT_FILTER, selectedIds); filteredBugIdsText.setText(selectedIds); } }); label = new Label(comp, SWT.NONE); label.setText(""); filteredBugIdsText = new Text(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP | SWT.READ_ONLY); GridData layoutData = new GridData(GridData.FILL_BOTH); layoutData.heightHint = 200; layoutData.widthHint = 400; filteredBugIdsText.setLayoutData(layoutData); filteredBugIdsText.setText(FindbugsPlugin.getDefault().getPreferenceStore() .getString(FindBugsConstants.LAST_USED_EXPORT_FILTER)); filteredBugIdsText.setToolTipText("Bug ids to filter, separated by comma or space"); } }
public class class_name { @Override public void createControl(Composite parent) { comp = new Composite(parent, SWT.BORDER); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; comp.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_HORIZONTAL); gd.heightHint = 400; gd.widthHint = 400; comp.setLayoutData(gd); setControl(comp); Label label = new Label(comp, SWT.NONE); label.setText("Sort by:"); final Combo sortByCombo = new Combo(comp, SWT.READ_ONLY); final String[] items = new String[] { "Name", "Not filtered bug count", "Overall bug count" }; sortByCombo.setItems(items); String sortOrder = FindbugsPlugin.getDefault().getPreferenceStore().getString(FindBugsConstants.EXPORT_SORT_ORDER); if (FindBugsConstants.ORDER_BY_NOT_FILTERED_BUGS_COUNT.equals(sortOrder)) { sortByCombo.select(1); // depends on control dependency: [if], data = [none] } else if (FindBugsConstants.ORDER_BY_OVERALL_BUGS_COUNT.equals(sortOrder)) { sortByCombo.select(2); // depends on control dependency: [if], data = [none] } else { sortByCombo.select(0); // depends on control dependency: [if], data = [none] } sortBy = sortByCombo.getSelectionIndex(); sortByCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(SelectionEvent e) { sortBy = sortByCombo.getSelectionIndex(); } }); label = new Label(comp, SWT.NONE); label.setText("Filter bug ids:"); Button button = new Button(comp, SWT.PUSH); button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); button.setText("Browse..."); button.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } @Override public void widgetSelected(SelectionEvent e) { Set<BugPattern> filtered = FindbugsPlugin.getFilteredPatterns(); Set<BugCode> filteredTypes = FindbugsPlugin.getFilteredPatternTypes(); FilterBugsDialog dialog = new FilterBugsDialog(getShell(), filtered, filteredTypes); dialog.setTitle("Bug Filter Configuration"); int result = dialog.open(); if (result != Window.OK) { return; // depends on control dependency: [if], data = [none] } String selectedIds = dialog.getSelectedIds(); FindbugsPlugin.getDefault().getPreferenceStore().setValue(FindBugsConstants.LAST_USED_EXPORT_FILTER, selectedIds); filteredBugIdsText.setText(selectedIds); } }); label = new Label(comp, SWT.NONE); label.setText(""); filteredBugIdsText = new Text(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.WRAP | SWT.READ_ONLY); GridData layoutData = new GridData(GridData.FILL_BOTH); layoutData.heightHint = 200; layoutData.widthHint = 400; filteredBugIdsText.setLayoutData(layoutData); filteredBugIdsText.setText(FindbugsPlugin.getDefault().getPreferenceStore() .getString(FindBugsConstants.LAST_USED_EXPORT_FILTER)); filteredBugIdsText.setToolTipText("Bug ids to filter, separated by comma or space"); } }
public class class_name { public static List<TextElement> findAllTextElements(XmlElement xmlElement){ List<TextElement> textElements = new ArrayList<>(); for (Element element : xmlElement.getElements()){ if (element instanceof XmlElement){ textElements.addAll(findAllTextElements((XmlElement) element)); } else if (element instanceof TextElement){ textElements.add((TextElement) element); } } return textElements; } }
public class class_name { public static List<TextElement> findAllTextElements(XmlElement xmlElement){ List<TextElement> textElements = new ArrayList<>(); for (Element element : xmlElement.getElements()){ if (element instanceof XmlElement){ textElements.addAll(findAllTextElements((XmlElement) element)); // depends on control dependency: [if], data = [none] } else if (element instanceof TextElement){ textElements.add((TextElement) element); // depends on control dependency: [if], data = [none] } } return textElements; } }
public class class_name { public static void create( int dimensions, int numElements, Collection<? super MutableLongTuple> target) { for (int i=0; i<numElements; i++) { target.add(LongTuples.create(dimensions)); } } }
public class class_name { public static void create( int dimensions, int numElements, Collection<? super MutableLongTuple> target) { for (int i=0; i<numElements; i++) { target.add(LongTuples.create(dimensions)); // depends on control dependency: [for], data = [none] } } }
public class class_name { private boolean startsWithDelimiter(String word, String[] delimiters) { boolean delim = false; for (int i = 0; i < delimiters.length; i++) { if (word.startsWith(delimiters[i])) { delim = true; break; } } return delim; } }
public class class_name { private boolean startsWithDelimiter(String word, String[] delimiters) { boolean delim = false; for (int i = 0; i < delimiters.length; i++) { if (word.startsWith(delimiters[i])) { delim = true; // depends on control dependency: [if], data = [none] break; } } return delim; } }
public class class_name { void decompileObjectLiteral(ObjectLiteral node) { decompiler.addToken(Token.LC); List<ObjectProperty> props = node.getElements(); int size = props.size(); for (int i = 0; i < size; i++) { ObjectProperty prop = props.get(i); boolean destructuringShorthand = Boolean.TRUE.equals(prop.getProp(Node.DESTRUCTURING_SHORTHAND)); decompile(prop.getLeft()); if (!destructuringShorthand) { decompiler.addToken(Token.COLON); decompile(prop.getRight()); } if (i < size - 1) { decompiler.addToken(Token.COMMA); } } decompiler.addToken(Token.RC); } }
public class class_name { void decompileObjectLiteral(ObjectLiteral node) { decompiler.addToken(Token.LC); List<ObjectProperty> props = node.getElements(); int size = props.size(); for (int i = 0; i < size; i++) { ObjectProperty prop = props.get(i); boolean destructuringShorthand = Boolean.TRUE.equals(prop.getProp(Node.DESTRUCTURING_SHORTHAND)); decompile(prop.getLeft()); // depends on control dependency: [for], data = [none] if (!destructuringShorthand) { decompiler.addToken(Token.COLON); // depends on control dependency: [if], data = [none] decompile(prop.getRight()); // depends on control dependency: [if], data = [none] } if (i < size - 1) { decompiler.addToken(Token.COMMA); // depends on control dependency: [if], data = [none] } } decompiler.addToken(Token.RC); } }
public class class_name { public boolean checkedAdd(final int x) { final short hb = BufferUtil.highbits(x); final int i = highLowContainer.getIndex(hb); if (i >= 0) { MappeableContainer C = highLowContainer.getContainerAtIndex(i); int oldcard = C.getCardinality(); C = C.add(BufferUtil.lowbits(x)); getMappeableRoaringArray().setContainerAtIndex(i, C); return C.getCardinality() > oldcard; } else { final MappeableArrayContainer newac = new MappeableArrayContainer(); getMappeableRoaringArray().insertNewKeyValueAt(-i - 1, hb, newac.add(BufferUtil.lowbits(x))); return true; } } }
public class class_name { public boolean checkedAdd(final int x) { final short hb = BufferUtil.highbits(x); final int i = highLowContainer.getIndex(hb); if (i >= 0) { MappeableContainer C = highLowContainer.getContainerAtIndex(i); int oldcard = C.getCardinality(); C = C.add(BufferUtil.lowbits(x)); // depends on control dependency: [if], data = [none] getMappeableRoaringArray().setContainerAtIndex(i, C); // depends on control dependency: [if], data = [(i] return C.getCardinality() > oldcard; // depends on control dependency: [if], data = [none] } else { final MappeableArrayContainer newac = new MappeableArrayContainer(); getMappeableRoaringArray().insertNewKeyValueAt(-i - 1, hb, newac.add(BufferUtil.lowbits(x))); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings({"deprecation", "WeakerAccess"}) protected void removeShutdownHook(ClassLoaderLeakPreventor preventor, Thread shutdownHook) { final String displayString = "'" + shutdownHook + "' of type " + shutdownHook.getClass().getName(); preventor.error("Removing shutdown hook: " + displayString); Runtime.getRuntime().removeShutdownHook(shutdownHook); if(executeShutdownHooks) { // Shutdown hooks should be executed preventor.info("Executing shutdown hook now: " + displayString); // Make sure it's from protected ClassLoader shutdownHook.start(); // Run cleanup immediately if(shutdownHookWaitMs > 0) { // Wait for shutdown hook to finish try { shutdownHook.join(shutdownHookWaitMs); // Wait for thread to run } catch (InterruptedException e) { // Do nothing } if(shutdownHook.isAlive()) { preventor.warn(shutdownHook + "still running after " + shutdownHookWaitMs + " ms - Stopping!"); shutdownHook.stop(); } } } } }
public class class_name { @SuppressWarnings({"deprecation", "WeakerAccess"}) protected void removeShutdownHook(ClassLoaderLeakPreventor preventor, Thread shutdownHook) { final String displayString = "'" + shutdownHook + "' of type " + shutdownHook.getClass().getName(); preventor.error("Removing shutdown hook: " + displayString); Runtime.getRuntime().removeShutdownHook(shutdownHook); if(executeShutdownHooks) { // Shutdown hooks should be executed preventor.info("Executing shutdown hook now: " + displayString); // depends on control dependency: [if], data = [none] // Make sure it's from protected ClassLoader shutdownHook.start(); // Run cleanup immediately // depends on control dependency: [if], data = [none] if(shutdownHookWaitMs > 0) { // Wait for shutdown hook to finish try { shutdownHook.join(shutdownHookWaitMs); // Wait for thread to run // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // Do nothing } // depends on control dependency: [catch], data = [none] if(shutdownHook.isAlive()) { preventor.warn(shutdownHook + "still running after " + shutdownHookWaitMs + " ms - Stopping!"); // depends on control dependency: [if], data = [none] shutdownHook.stop(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public boolean isAllAuthorized(final WebContext context, final List<U> profiles) { for (final U profile : profiles) { if (!isProfileAuthorized(context, profile)) { return handleError(context); } } return true; } }
public class class_name { public boolean isAllAuthorized(final WebContext context, final List<U> profiles) { for (final U profile : profiles) { if (!isProfileAuthorized(context, profile)) { return handleError(context); // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void setDefaultWorkManager(WorkManager wm) { if (trace) log.tracef("Default WorkManager: %s", wm); String currentName = null; if (defaultWorkManager != null) currentName = defaultWorkManager.getName(); defaultWorkManager = wm; if (wm != null) { workmanagers.put(wm.getName(), wm); } else if (currentName != null) { workmanagers.remove(currentName); } } }
public class class_name { public void setDefaultWorkManager(WorkManager wm) { if (trace) log.tracef("Default WorkManager: %s", wm); String currentName = null; if (defaultWorkManager != null) currentName = defaultWorkManager.getName(); defaultWorkManager = wm; if (wm != null) { workmanagers.put(wm.getName(), wm); // depends on control dependency: [if], data = [(wm] } else if (currentName != null) { workmanagers.remove(currentName); // depends on control dependency: [if], data = [(currentName] } } }
public class class_name { protected Distribution findBestFit(final List<V> col, Adapter adapter, int d, double[] test) { if(estimators.size() == 1) { return estimators.get(0).estimate(col, adapter); } Distribution best = null; double bestq = Double.POSITIVE_INFINITY; trials: for(DistributionEstimator<?> est : estimators) { try { Distribution dist = est.estimate(col, adapter); for(int i = 0; i < test.length; i++) { test[i] = dist.cdf(col.get(i).doubleValue(d)); if(Double.isNaN(test[i])) { LOG.warning("Got NaN after fitting " + est + ": " + dist); continue trials; } if(Double.isInfinite(test[i])) { LOG.warning("Got infinite value after fitting " + est + ": " + dist); continue trials; } } Arrays.sort(test); double q = KolmogorovSmirnovTest.simpleTest(test); if(LOG.isVeryVerbose()) { LOG.veryverbose("Estimator " + est + " (" + dist + ") has maximum deviation " + q + " for dimension " + d); } if(best == null || q < bestq) { best = dist; bestq = q; } } catch(ArithmeticException e) { if(LOG.isVeryVerbose()) { LOG.veryverbose("Fitting distribution " + est + " failed: " + e.getMessage()); } continue trials; } } if(LOG.isVerbose()) { LOG.verbose("Best fit for dimension " + d + ": " + best); } return best; } }
public class class_name { protected Distribution findBestFit(final List<V> col, Adapter adapter, int d, double[] test) { if(estimators.size() == 1) { return estimators.get(0).estimate(col, adapter); // depends on control dependency: [if], data = [none] } Distribution best = null; double bestq = Double.POSITIVE_INFINITY; trials: for(DistributionEstimator<?> est : estimators) { try { Distribution dist = est.estimate(col, adapter); for(int i = 0; i < test.length; i++) { test[i] = dist.cdf(col.get(i).doubleValue(d)); // depends on control dependency: [for], data = [i] if(Double.isNaN(test[i])) { LOG.warning("Got NaN after fitting " + est + ": " + dist); // depends on control dependency: [if], data = [none] continue trials; } if(Double.isInfinite(test[i])) { LOG.warning("Got infinite value after fitting " + est + ": " + dist); // depends on control dependency: [if], data = [none] continue trials; } } Arrays.sort(test); // depends on control dependency: [try], data = [none] double q = KolmogorovSmirnovTest.simpleTest(test); if(LOG.isVeryVerbose()) { LOG.veryverbose("Estimator " + est + " (" + dist + ") has maximum deviation " + q + " for dimension " + d); // depends on control dependency: [if], data = [none] } if(best == null || q < bestq) { best = dist; // depends on control dependency: [if], data = [none] bestq = q; // depends on control dependency: [if], data = [none] } } catch(ArithmeticException e) { if(LOG.isVeryVerbose()) { LOG.veryverbose("Fitting distribution " + est + " failed: " + e.getMessage()); // depends on control dependency: [if], data = [none] } continue trials; } // depends on control dependency: [catch], data = [none] } if(LOG.isVerbose()) { LOG.verbose("Best fit for dimension " + d + ": " + best); // depends on control dependency: [if], data = [none] } return best; } }
public class class_name { public void setTypes(java.util.Collection<String> types) { if (types == null) { this.types = null; return; } this.types = new java.util.ArrayList<String>(types); } }
public class class_name { public void setTypes(java.util.Collection<String> types) { if (types == null) { this.types = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.types = new java.util.ArrayList<String>(types); } }
public class class_name { public void marshall(CreateConnectorDefinitionRequest createConnectorDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createConnectorDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createConnectorDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); protocolMarshaller.marshall(createConnectorDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); protocolMarshaller.marshall(createConnectorDefinitionRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(createConnectorDefinitionRequest.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(CreateConnectorDefinitionRequest createConnectorDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createConnectorDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createConnectorDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createConnectorDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createConnectorDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createConnectorDefinitionRequest.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 { void selectConnections( Vertex target ) { // There needs to be at least two corners if( target.perpendicular.size() <= 1 ) return; // if( target.index == 16 ) { // System.out.println("ASDSAD"); // } // System.out.println("======= Connecting "+target.index); double bestError = Double.MAX_VALUE; List<Edge> bestSolution = target.connections.edges; // Greedily select one vertex at a time to connect to. findNext() looks at all possible // vertexes it can connect too and minimizes an error function based on projectively invariant features for (int i = 0; i < target.perpendicular.size(); i++) { Edge e = target.perpendicular.get(i); solution.clear(); solution.add(e); double sumDistance = solution.get(0).distance; double minDistance = sumDistance; if( !findNext(i,target.parallel,target.perpendicular,Double.NaN,results) ) { continue; } solution.add(target.perpendicular.get(results.index)); sumDistance += solution.get(1).distance; minDistance = Math.min(minDistance,solution.get(1).distance); // Use knowledge that solution[0] and solution[2] form a line. // Lines are straight under projective distortion if( findNext(results.index,target.parallel,target.perpendicular,solution.get(0).direction,results) ) { solution.add(target.perpendicular.get(results.index)); sumDistance += solution.get(2).distance; minDistance = Math.min(minDistance,solution.get(2).distance); // Use knowledge that solution[1] and solution[3] form a line. if( findNext(results.index,target.parallel,target.perpendicular,solution.get(1).direction,results) ) { solution.add(target.perpendicular.get(results.index)); sumDistance += solution.get(3).distance; minDistance = Math.min(minDistance,solution.get(3).distance); } } // Prefer closer valid sets of edges and larger sets. // the extra + minDistance was needed to bias it against smaller sets which would be more likely // to have a smaller average error. Division by the square of set/solution size biases it towards larger sets double error = (sumDistance+minDistance)/(solution.size()*solution.size()); // System.out.println(" first="+solution.get(0).dst.index+" size="+solution.size()+" error="+error); if( error < bestError ) { bestError = error; bestSolution.clear(); bestSolution.addAll(solution); } } } }
public class class_name { void selectConnections( Vertex target ) { // There needs to be at least two corners if( target.perpendicular.size() <= 1 ) return; // if( target.index == 16 ) { // System.out.println("ASDSAD"); // } // System.out.println("======= Connecting "+target.index); double bestError = Double.MAX_VALUE; List<Edge> bestSolution = target.connections.edges; // Greedily select one vertex at a time to connect to. findNext() looks at all possible // vertexes it can connect too and minimizes an error function based on projectively invariant features for (int i = 0; i < target.perpendicular.size(); i++) { Edge e = target.perpendicular.get(i); solution.clear(); // depends on control dependency: [for], data = [none] solution.add(e); // depends on control dependency: [for], data = [none] double sumDistance = solution.get(0).distance; double minDistance = sumDistance; if( !findNext(i,target.parallel,target.perpendicular,Double.NaN,results) ) { continue; } solution.add(target.perpendicular.get(results.index)); // depends on control dependency: [for], data = [none] sumDistance += solution.get(1).distance; // depends on control dependency: [for], data = [none] minDistance = Math.min(minDistance,solution.get(1).distance); // depends on control dependency: [for], data = [none] // Use knowledge that solution[0] and solution[2] form a line. // Lines are straight under projective distortion if( findNext(results.index,target.parallel,target.perpendicular,solution.get(0).direction,results) ) { solution.add(target.perpendicular.get(results.index)); // depends on control dependency: [if], data = [none] sumDistance += solution.get(2).distance; // depends on control dependency: [if], data = [none] minDistance = Math.min(minDistance,solution.get(2).distance); // depends on control dependency: [if], data = [none] // Use knowledge that solution[1] and solution[3] form a line. if( findNext(results.index,target.parallel,target.perpendicular,solution.get(1).direction,results) ) { solution.add(target.perpendicular.get(results.index)); // depends on control dependency: [if], data = [none] sumDistance += solution.get(3).distance; // depends on control dependency: [if], data = [none] minDistance = Math.min(minDistance,solution.get(3).distance); // depends on control dependency: [if], data = [none] } } // Prefer closer valid sets of edges and larger sets. // the extra + minDistance was needed to bias it against smaller sets which would be more likely // to have a smaller average error. Division by the square of set/solution size biases it towards larger sets double error = (sumDistance+minDistance)/(solution.size()*solution.size()); // System.out.println(" first="+solution.get(0).dst.index+" size="+solution.size()+" error="+error); if( error < bestError ) { bestError = error; // depends on control dependency: [if], data = [none] bestSolution.clear(); // depends on control dependency: [if], data = [none] bestSolution.addAll(solution); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(CloudFormationStackRecord cloudFormationStackRecord, ProtocolMarshaller protocolMarshaller) { if (cloudFormationStackRecord == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cloudFormationStackRecord.getName(), NAME_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getArn(), ARN_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getCreatedAt(), CREATEDAT_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getLocation(), LOCATION_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getResourceType(), RESOURCETYPE_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getState(), STATE_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getSourceInfo(), SOURCEINFO_BINDING); protocolMarshaller.marshall(cloudFormationStackRecord.getDestinationInfo(), DESTINATIONINFO_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CloudFormationStackRecord cloudFormationStackRecord, ProtocolMarshaller protocolMarshaller) { if (cloudFormationStackRecord == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cloudFormationStackRecord.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getSourceInfo(), SOURCEINFO_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cloudFormationStackRecord.getDestinationInfo(), DESTINATIONINFO_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Twilight getTwilight(double sunDistanceRadians) { double altDegrees = 90.0 - Math.toDegrees(sunDistanceRadians); if (altDegrees >= 0.0) { return Twilight.DAYLIGHT; } else if (altDegrees >= -6.0) { return Twilight.CIVIL; } else if (altDegrees >= -12.0) { return Twilight.NAUTICAL; } else if (altDegrees >= -18.0) { return Twilight.ASTRONOMICAL; } return Twilight.NIGHT; } }
public class class_name { public static Twilight getTwilight(double sunDistanceRadians) { double altDegrees = 90.0 - Math.toDegrees(sunDistanceRadians); if (altDegrees >= 0.0) { return Twilight.DAYLIGHT; // depends on control dependency: [if], data = [none] } else if (altDegrees >= -6.0) { return Twilight.CIVIL; // depends on control dependency: [if], data = [none] } else if (altDegrees >= -12.0) { return Twilight.NAUTICAL; // depends on control dependency: [if], data = [none] } else if (altDegrees >= -18.0) { return Twilight.ASTRONOMICAL; // depends on control dependency: [if], data = [none] } return Twilight.NIGHT; } }
public class class_name { @Override public EClass getIfcGeometricSet() { if (ifcGeometricSetEClass == null) { ifcGeometricSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(306); } return ifcGeometricSetEClass; } }
public class class_name { @Override public EClass getIfcGeometricSet() { if (ifcGeometricSetEClass == null) { ifcGeometricSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(306); // depends on control dependency: [if], data = [none] } return ifcGeometricSetEClass; } }
public class class_name { protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, JMethod method) { StringBuilder arguments = new StringBuilder(); for (JParameter parameter : method.getParameters()) { if (arguments.length() > 0) { arguments.append(", "); } arguments.append(parameter.getType().getQualifiedSourceName()); arguments.append(" "); arguments.append(parameter.getName()); } generateSourcePublicMethodDeclaration(sourceWriter, method.getReturnType().getQualifiedSourceName(), method.getName(), arguments.toString(), false); } }
public class class_name { protected final void generateSourcePublicMethodDeclaration(SourceWriter sourceWriter, JMethod method) { StringBuilder arguments = new StringBuilder(); for (JParameter parameter : method.getParameters()) { if (arguments.length() > 0) { arguments.append(", "); // depends on control dependency: [if], data = [none] } arguments.append(parameter.getType().getQualifiedSourceName()); // depends on control dependency: [for], data = [parameter] arguments.append(" "); // depends on control dependency: [for], data = [none] arguments.append(parameter.getName()); // depends on control dependency: [for], data = [parameter] } generateSourcePublicMethodDeclaration(sourceWriter, method.getReturnType().getQualifiedSourceName(), method.getName(), arguments.toString(), false); } }
public class class_name { public void replaceLast(AbstractDrawer newDrawer, AjaxRequestTarget target) { if (!drawers.isEmpty()) { ListItem last = drawers.getFirst(); last.drawer.replaceWith(newDrawer); last.drawer = newDrawer; newDrawer.setManager(this); target.add(newDrawer); } } }
public class class_name { public void replaceLast(AbstractDrawer newDrawer, AjaxRequestTarget target) { if (!drawers.isEmpty()) { ListItem last = drawers.getFirst(); last.drawer.replaceWith(newDrawer); // depends on control dependency: [if], data = [none] last.drawer = newDrawer; // depends on control dependency: [if], data = [none] newDrawer.setManager(this); // depends on control dependency: [if], data = [none] target.add(newDrawer); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte[] calculate(final Data[] data) throws IOException { int bitSize = 0; for (final Data target : data) { bitSize += target.numOfBits; } int pos = 0; final FastBitSet bitSet = new FastBitSet(bitSize); for (final Data target : data) { int count = 0; final byte[] bytes = calculate(target); for (final byte b : bytes) { byte bits = b; for (int j = 0; j < 8; j++) { bitSet.set(pos, (bits & 0x1) == 0x1); pos++; count++; if (count >= target.numOfBits) { break; } bits >>= 1; } } } return bitSet.toByteArray(); } }
public class class_name { public static byte[] calculate(final Data[] data) throws IOException { int bitSize = 0; for (final Data target : data) { bitSize += target.numOfBits; } int pos = 0; final FastBitSet bitSet = new FastBitSet(bitSize); for (final Data target : data) { int count = 0; final byte[] bytes = calculate(target); for (final byte b : bytes) { byte bits = b; for (int j = 0; j < 8; j++) { bitSet.set(pos, (bits & 0x1) == 0x1); // depends on control dependency: [for], data = [none] pos++; // depends on control dependency: [for], data = [none] count++; // depends on control dependency: [for], data = [none] if (count >= target.numOfBits) { break; } bits >>= 1; // depends on control dependency: [for], data = [none] } } } return bitSet.toByteArray(); } }
public class class_name { public final EObject ruleXConstructorCall() throws RecognitionException { EObject current = null; Token otherlv_2=null; Token otherlv_4=null; EObject this_XbaseConstructorCall_0 = null; EObject lv_members_3_0 = null; enterRule(); try { // InternalSARL.g:10109:2: ( (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) ) // InternalSARL.g:10110:2: (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) { // InternalSARL.g:10110:2: (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) // InternalSARL.g:10111:3: this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXConstructorCallAccess().getXbaseConstructorCallParserRuleCall_0()); } pushFollow(FOLLOW_10); this_XbaseConstructorCall_0=ruleXbaseConstructorCall(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_XbaseConstructorCall_0; afterParserOrEnumRuleCall(); } // InternalSARL.g:10119:3: ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? int alt259=2; alt259 = dfa259.predict(input); switch (alt259) { case 1 : // InternalSARL.g:10120:4: ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' { // InternalSARL.g:10120:4: ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) // InternalSARL.g:10121:5: ( ( () '{' ) )=> ( () otherlv_2= '{' ) { // InternalSARL.g:10127:5: ( () otherlv_2= '{' ) // InternalSARL.g:10128:6: () otherlv_2= '{' { // InternalSARL.g:10128:6: () // InternalSARL.g:10129:7: { if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getXConstructorCallAccess().getAnonymousClassConstructorCallAction_1_0_0_0(), current); } } otherlv_2=(Token)match(input,29,FOLLOW_29); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_2, grammarAccess.getXConstructorCallAccess().getLeftCurlyBracketKeyword_1_0_0_1()); } } } // InternalSARL.g:10141:4: ( (lv_members_3_0= ruleMember ) )* loop258: do { int alt258=2; int LA258_0 = input.LA(1); if ( (LA258_0==25||LA258_0==39||(LA258_0>=42 && LA258_0<=45)||LA258_0==48||(LA258_0>=65 && LA258_0<=66)||(LA258_0>=78 && LA258_0<=91)||LA258_0==105) ) { alt258=1; } switch (alt258) { case 1 : // InternalSARL.g:10142:5: (lv_members_3_0= ruleMember ) { // InternalSARL.g:10142:5: (lv_members_3_0= ruleMember ) // InternalSARL.g:10143:6: lv_members_3_0= ruleMember { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXConstructorCallAccess().getMembersMemberParserRuleCall_1_1_0()); } pushFollow(FOLLOW_29); lv_members_3_0=ruleMember(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXConstructorCallRule()); } add( current, "members", lv_members_3_0, "io.sarl.lang.SARL.Member"); afterParserOrEnumRuleCall(); } } } break; default : break loop258; } } while (true); otherlv_4=(Token)match(input,30,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_4, grammarAccess.getXConstructorCallAccess().getRightCurlyBracketKeyword_1_2()); } } break; } } } if ( state.backtracking==0 ) { leaveRule(); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleXConstructorCall() throws RecognitionException { EObject current = null; Token otherlv_2=null; Token otherlv_4=null; EObject this_XbaseConstructorCall_0 = null; EObject lv_members_3_0 = null; enterRule(); try { // InternalSARL.g:10109:2: ( (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) ) // InternalSARL.g:10110:2: (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) { // InternalSARL.g:10110:2: (this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? ) // InternalSARL.g:10111:3: this_XbaseConstructorCall_0= ruleXbaseConstructorCall ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXConstructorCallAccess().getXbaseConstructorCallParserRuleCall_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_10); this_XbaseConstructorCall_0=ruleXbaseConstructorCall(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_XbaseConstructorCall_0; // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } // InternalSARL.g:10119:3: ( ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' )? int alt259=2; alt259 = dfa259.predict(input); switch (alt259) { case 1 : // InternalSARL.g:10120:4: ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) ( (lv_members_3_0= ruleMember ) )* otherlv_4= '}' { // InternalSARL.g:10120:4: ( ( ( () '{' ) )=> ( () otherlv_2= '{' ) ) // InternalSARL.g:10121:5: ( ( () '{' ) )=> ( () otherlv_2= '{' ) { // InternalSARL.g:10127:5: ( () otherlv_2= '{' ) // InternalSARL.g:10128:6: () otherlv_2= '{' { // InternalSARL.g:10128:6: () // InternalSARL.g:10129:7: { if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getXConstructorCallAccess().getAnonymousClassConstructorCallAction_1_0_0_0(), current); // depends on control dependency: [if], data = [none] } } otherlv_2=(Token)match(input,29,FOLLOW_29); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_2, grammarAccess.getXConstructorCallAccess().getLeftCurlyBracketKeyword_1_0_0_1()); // depends on control dependency: [if], data = [none] } } } // InternalSARL.g:10141:4: ( (lv_members_3_0= ruleMember ) )* loop258: do { int alt258=2; int LA258_0 = input.LA(1); if ( (LA258_0==25||LA258_0==39||(LA258_0>=42 && LA258_0<=45)||LA258_0==48||(LA258_0>=65 && LA258_0<=66)||(LA258_0>=78 && LA258_0<=91)||LA258_0==105) ) { alt258=1; // depends on control dependency: [if], data = [none] } switch (alt258) { case 1 : // InternalSARL.g:10142:5: (lv_members_3_0= ruleMember ) { // InternalSARL.g:10142:5: (lv_members_3_0= ruleMember ) // InternalSARL.g:10143:6: lv_members_3_0= ruleMember { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXConstructorCallAccess().getMembersMemberParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_29); lv_members_3_0=ruleMember(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { if (current==null) { current = createModelElementForParent(grammarAccess.getXConstructorCallRule()); // depends on control dependency: [if], data = [none] } add( current, "members", lv_members_3_0, "io.sarl.lang.SARL.Member"); // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } } } break; default : break loop258; } } while (true); otherlv_4=(Token)match(input,30,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(otherlv_4, grammarAccess.getXConstructorCallAccess().getRightCurlyBracketKeyword_1_2()); // depends on control dependency: [if], data = [none] } } break; } } } if ( state.backtracking==0 ) { leaveRule(); // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { @Override public final String getFor(final Class<?> pClass, final String pThingName) { if ("list".equals(pThingName)) { return PrcEntitiesPage.class.getSimpleName(); } else if ("about".equals(pThingName)) { return PrcAbout.class.getSimpleName(); } return null; } }
public class class_name { @Override public final String getFor(final Class<?> pClass, final String pThingName) { if ("list".equals(pThingName)) { return PrcEntitiesPage.class.getSimpleName(); // depends on control dependency: [if], data = [none] } else if ("about".equals(pThingName)) { return PrcAbout.class.getSimpleName(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public synchronized void sendQueuedEvents(KeenProject project, KeenCallback callback) { if (!isActive) { handleLibraryInactive(callback); return; } if (project == null && defaultProject == null) { handleFailure(null, new IllegalStateException("No project specified, but no default project found")); return; } if (!isNetworkConnected()) { KeenLogging.log("Not sending events because there is no network connection. " + "Events will be retried next time `sendQueuedEvents` is called."); handleFailure(callback, new Exception("Network not connected.")); return; } KeenProject useProject = (project == null ? defaultProject : project); try { String projectId = useProject.getProjectId(); Map<String, List<Object>> eventHandles = eventStore.getHandles(projectId); Map<String, List<Map<String, Object>>> events = buildEventMap(projectId, eventHandles); String response = publishAll(useProject, events); if (response != null) { try { handleAddEventsResponse(eventHandles, response); } catch (Exception e) { // Errors handling the response are non-fatal; just log them. KeenLogging.log("Error handling response to batch publish: " + e.getMessage()); } } handleSuccess(callback); } catch (Exception e) { handleFailure(callback, e); } } }
public class class_name { public synchronized void sendQueuedEvents(KeenProject project, KeenCallback callback) { if (!isActive) { handleLibraryInactive(callback); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (project == null && defaultProject == null) { handleFailure(null, new IllegalStateException("No project specified, but no default project found")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (!isNetworkConnected()) { KeenLogging.log("Not sending events because there is no network connection. " + "Events will be retried next time `sendQueuedEvents` is called."); // depends on control dependency: [if], data = [none] handleFailure(callback, new Exception("Network not connected.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } KeenProject useProject = (project == null ? defaultProject : project); try { String projectId = useProject.getProjectId(); Map<String, List<Object>> eventHandles = eventStore.getHandles(projectId); Map<String, List<Map<String, Object>>> events = buildEventMap(projectId, eventHandles); String response = publishAll(useProject, events); if (response != null) { try { handleAddEventsResponse(eventHandles, response); // depends on control dependency: [try], data = [none] } catch (Exception e) { // Errors handling the response are non-fatal; just log them. KeenLogging.log("Error handling response to batch publish: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } handleSuccess(callback); // depends on control dependency: [try], data = [none] } catch (Exception e) { handleFailure(callback, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(SearchProfilesRequest searchProfilesRequest, ProtocolMarshaller protocolMarshaller) { if (searchProfilesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(searchProfilesRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(searchProfilesRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(searchProfilesRequest.getFilters(), FILTERS_BINDING); protocolMarshaller.marshall(searchProfilesRequest.getSortCriteria(), SORTCRITERIA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SearchProfilesRequest searchProfilesRequest, ProtocolMarshaller protocolMarshaller) { if (searchProfilesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(searchProfilesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(searchProfilesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(searchProfilesRequest.getFilters(), FILTERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(searchProfilesRequest.getSortCriteria(), SORTCRITERIA_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 setExpiration(String expiration) { if (expiration == null) { _properties.remove(AMQP_PROP_EXPIRATION); return; } _properties.put(AMQP_PROP_EXPIRATION, expiration); } }
public class class_name { public void setExpiration(String expiration) { if (expiration == null) { _properties.remove(AMQP_PROP_EXPIRATION); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } _properties.put(AMQP_PROP_EXPIRATION, expiration); } }
public class class_name { public final boolean login() throws LoginException { boolean ret = false; final Callback[] callbacks = new Callback[3]; callbacks[0] = new ActionCallback(); callbacks[1] = new NameCallback("Username: "); callbacks[2] = new PasswordCallback("Password: ", false); // Interact with the user to retrieve the username and password String userName = null; String password = null; try { this.callbackHandler.handle(callbacks); this.mode = ((ActionCallback) callbacks[0]).getMode(); userName = ((NameCallback) callbacks[1]).getName(); if (((PasswordCallback) callbacks[2]).getPassword() != null) { password = new String(((PasswordCallback) callbacks[2]).getPassword()); } } catch (final IOException e) { throw new LoginException(e.toString()); } catch (final UnsupportedCallbackException e) { throw new LoginException(e.toString()); } if (this.mode == ActionCallback.Mode.ALL_PERSONS) { ret = true; } else if (this.mode == ActionCallback.Mode.PERSON_INFORMATION) { this.person = this.allPersons.get(userName); if (this.person != null) { if (XMLUserLoginModule.LOG.isDebugEnabled()) { XMLUserLoginModule.LOG.debug("found '" + this.person + "'"); } ret = true; } } else { this.person = this.allPersons.get(userName); if (this.person != null) { if ((password == null) || ((password != null) && !password.equals(this.person.getPassword()))) { XMLUserLoginModule.LOG.error("person '" + this.person + "' tried to log in with wrong password"); this.person = null; throw new FailedLoginException("Username or password is incorrect"); } if (XMLUserLoginModule.LOG.isDebugEnabled()) { XMLUserLoginModule.LOG.debug("log in of '" + this.person + "'"); } this.mode = ActionCallback.Mode.LOGIN; ret = true; } } return ret; } }
public class class_name { public final boolean login() throws LoginException { boolean ret = false; final Callback[] callbacks = new Callback[3]; callbacks[0] = new ActionCallback(); callbacks[1] = new NameCallback("Username: "); callbacks[2] = new PasswordCallback("Password: ", false); // Interact with the user to retrieve the username and password String userName = null; String password = null; try { this.callbackHandler.handle(callbacks); this.mode = ((ActionCallback) callbacks[0]).getMode(); userName = ((NameCallback) callbacks[1]).getName(); if (((PasswordCallback) callbacks[2]).getPassword() != null) { password = new String(((PasswordCallback) callbacks[2]).getPassword()); // depends on control dependency: [if], data = [(((PasswordCallback) callbacks[2]).getPassword()] } } catch (final IOException e) { throw new LoginException(e.toString()); } catch (final UnsupportedCallbackException e) { throw new LoginException(e.toString()); } if (this.mode == ActionCallback.Mode.ALL_PERSONS) { ret = true; } else if (this.mode == ActionCallback.Mode.PERSON_INFORMATION) { this.person = this.allPersons.get(userName); if (this.person != null) { if (XMLUserLoginModule.LOG.isDebugEnabled()) { XMLUserLoginModule.LOG.debug("found '" + this.person + "'"); } ret = true; } } else { this.person = this.allPersons.get(userName); if (this.person != null) { if ((password == null) || ((password != null) && !password.equals(this.person.getPassword()))) { XMLUserLoginModule.LOG.error("person '" + this.person + "' tried to log in with wrong password"); this.person = null; throw new FailedLoginException("Username or password is incorrect"); } if (XMLUserLoginModule.LOG.isDebugEnabled()) { XMLUserLoginModule.LOG.debug("log in of '" + this.person + "'"); } this.mode = ActionCallback.Mode.LOGIN; ret = true; } } return ret; } }
public class class_name { private void updateSelection(Object node) { State newState = getSelectionState(node); List<Object> descendants = JTrees.getAllDescendants(getModel(), node); for (Object descendant : descendants) { setSelectionState(descendant, newState, false); } Object ancestor = JTrees.getParent(getModel(), node); while (ancestor != null) { List<Object> childrenOfAncestor = JTrees.getChildren(getModel(), ancestor); State stateForAncestor = computeState(childrenOfAncestor); setSelectionState(ancestor, stateForAncestor, false); ancestor = JTrees.getParent(getModel(), ancestor); } } }
public class class_name { private void updateSelection(Object node) { State newState = getSelectionState(node); List<Object> descendants = JTrees.getAllDescendants(getModel(), node); for (Object descendant : descendants) { setSelectionState(descendant, newState, false); // depends on control dependency: [for], data = [descendant] } Object ancestor = JTrees.getParent(getModel(), node); while (ancestor != null) { List<Object> childrenOfAncestor = JTrees.getChildren(getModel(), ancestor); State stateForAncestor = computeState(childrenOfAncestor); setSelectionState(ancestor, stateForAncestor, false); // depends on control dependency: [while], data = [(ancestor] ancestor = JTrees.getParent(getModel(), ancestor); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static void setFieldIfPossible(Class type, String name, Object value) { Optional<Field> declaredField = findDeclaredField(type, name); if (declaredField.isPresent()) { Field field = declaredField.get(); Optional<?> converted = ConversionService.SHARED.convert(value, field.getType()); if (converted.isPresent()) { field.setAccessible(true); try { field.set(type, converted.get()); } catch (IllegalAccessException e) { // ignore } } else { field.setAccessible(true); try { field.set(type, null); } catch (IllegalAccessException e) { // ignore } } } } }
public class class_name { public static void setFieldIfPossible(Class type, String name, Object value) { Optional<Field> declaredField = findDeclaredField(type, name); if (declaredField.isPresent()) { Field field = declaredField.get(); Optional<?> converted = ConversionService.SHARED.convert(value, field.getType()); if (converted.isPresent()) { field.setAccessible(true); // depends on control dependency: [if], data = [none] try { field.set(type, converted.get()); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { // ignore } // depends on control dependency: [catch], data = [none] } else { field.setAccessible(true); // depends on control dependency: [if], data = [none] try { field.set(type, null); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { // ignore } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override public EClass getIfcUShapeProfileDef() { if (ifcUShapeProfileDefEClass == null) { ifcUShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(741); } return ifcUShapeProfileDefEClass; } }
public class class_name { @Override public EClass getIfcUShapeProfileDef() { if (ifcUShapeProfileDefEClass == null) { ifcUShapeProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(741); // depends on control dependency: [if], data = [none] } return ifcUShapeProfileDefEClass; } }
public class class_name { protected final String findErrorDesc(int errorType, int currEvent) { String msg = getErrorDesc(errorType, currEvent); if (msg != null) { return msg; } switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return "Current state not START_ELEMENT when calling getElementText()"; case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token"; case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag()"; case ERR_NEXTTAG_WRONG_TYPE: return "Should only encounter START_ELEMENT/END_ELEMENT, SPACE, or all-white-space CHARACTERS"; } // should never happen, but it'd be bad to throw another exception... return "Internal error (unrecognized error type: "+errorType+")"; } }
public class class_name { protected final String findErrorDesc(int errorType, int currEvent) { String msg = getErrorDesc(errorType, currEvent); if (msg != null) { return msg; // depends on control dependency: [if], data = [none] } switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return "Current state not START_ELEMENT when calling getElementText()"; case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token"; case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag()"; case ERR_NEXTTAG_WRONG_TYPE: return "Should only encounter START_ELEMENT/END_ELEMENT, SPACE, or all-white-space CHARACTERS"; } // should never happen, but it'd be bad to throw another exception... return "Internal error (unrecognized error type: "+errorType+")"; } }
public class class_name { @Override void throwInternalError(String message, Throwable cause) { String finalMessage = "INTERNAL COMPILER ERROR.\nPlease report this problem.\n\n" + message; RuntimeException e = new RuntimeException(finalMessage, cause); if (cause != null) { e.setStackTrace(cause.getStackTrace()); } throw e; } }
public class class_name { @Override void throwInternalError(String message, Throwable cause) { String finalMessage = "INTERNAL COMPILER ERROR.\nPlease report this problem.\n\n" + message; RuntimeException e = new RuntimeException(finalMessage, cause); if (cause != null) { e.setStackTrace(cause.getStackTrace()); // depends on control dependency: [if], data = [(cause] } throw e; } }
public class class_name { @SuppressWarnings("deprecation") public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { LocatedFileStatus[] files = listLocatedStatus(job); long totalSize = 0; // compute total size for (FileStatus file: files) { // check we have valid files if (file.isDir()) { throw new IOException("Not a file: "+ file.getPath()); } totalSize += file.getLen(); } long goalSize = totalSize / (numSplits == 0 ? 1 : numSplits); long minSize = Math.max(job.getLong("mapred.min.split.size", 1), minSplitSize); // generate splits ArrayList<FileSplit> splits = new ArrayList<FileSplit>(numSplits); NetworkTopology clusterMap = new NetworkTopology(); for (LocatedFileStatus file: files) { Path path = file.getPath(); FileSystem fs = path.getFileSystem(job); long length = file.getLen(); BlockLocation[] blkLocations = file.getBlockLocations(); if ((length != 0) && isSplitable(fs, path)) { long blockSize = file.getBlockSize(); long splitSize = computeSplitSize(goalSize, minSize, blockSize); long bytesRemaining = length; while (((double) bytesRemaining)/splitSize > SPLIT_SLOP) { String[] splitHosts = getSplitHosts(blkLocations, length-bytesRemaining, splitSize, clusterMap); splits.add(new FileSplit(path, length-bytesRemaining, splitSize, splitHosts)); bytesRemaining -= splitSize; } if (bytesRemaining != 0) { splits.add(new FileSplit(path, length-bytesRemaining, bytesRemaining, blkLocations[blkLocations.length-1].getHosts())); } } else if (length != 0) { String[] splitHosts = getSplitHosts(blkLocations,0,length,clusterMap); splits.add(new FileSplit(path, 0, length, splitHosts)); } else { //Create empty hosts array for zero length files splits.add(new FileSplit(path, 0, length, new String[0])); } } LOG.debug("Total # of splits: " + splits.size()); return splits.toArray(new FileSplit[splits.size()]); } }
public class class_name { @SuppressWarnings("deprecation") public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { LocatedFileStatus[] files = listLocatedStatus(job); long totalSize = 0; // compute total size for (FileStatus file: files) { // check we have valid files if (file.isDir()) { throw new IOException("Not a file: "+ file.getPath()); } totalSize += file.getLen(); } long goalSize = totalSize / (numSplits == 0 ? 1 : numSplits); long minSize = Math.max(job.getLong("mapred.min.split.size", 1), minSplitSize); // generate splits ArrayList<FileSplit> splits = new ArrayList<FileSplit>(numSplits); NetworkTopology clusterMap = new NetworkTopology(); for (LocatedFileStatus file: files) { Path path = file.getPath(); FileSystem fs = path.getFileSystem(job); long length = file.getLen(); BlockLocation[] blkLocations = file.getBlockLocations(); if ((length != 0) && isSplitable(fs, path)) { long blockSize = file.getBlockSize(); long splitSize = computeSplitSize(goalSize, minSize, blockSize); long bytesRemaining = length; while (((double) bytesRemaining)/splitSize > SPLIT_SLOP) { String[] splitHosts = getSplitHosts(blkLocations, length-bytesRemaining, splitSize, clusterMap); splits.add(new FileSplit(path, length-bytesRemaining, splitSize, splitHosts)); // depends on control dependency: [while], data = [none] bytesRemaining -= splitSize; // depends on control dependency: [while], data = [none] } if (bytesRemaining != 0) { splits.add(new FileSplit(path, length-bytesRemaining, bytesRemaining, blkLocations[blkLocations.length-1].getHosts())); // depends on control dependency: [if], data = [none] } } else if (length != 0) { String[] splitHosts = getSplitHosts(blkLocations,0,length,clusterMap); splits.add(new FileSplit(path, 0, length, splitHosts)); // depends on control dependency: [if], data = [none] } else { //Create empty hosts array for zero length files splits.add(new FileSplit(path, 0, length, new String[0])); // depends on control dependency: [if], data = [none] } } LOG.debug("Total # of splits: " + splits.size()); return splits.toArray(new FileSplit[splits.size()]); } }
public class class_name { private void getBatchSize(String persistenceUnit, Map<String, Object> puProperties) { String batch_Size = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE) : null; if (batch_Size != null) { setBatchSize(Integer.valueOf(batch_Size)); } else { PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, persistenceUnit); setBatchSize(puMetadata.getBatchSize()); } } }
public class class_name { private void getBatchSize(String persistenceUnit, Map<String, Object> puProperties) { String batch_Size = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE) : null; if (batch_Size != null) { setBatchSize(Integer.valueOf(batch_Size)); // depends on control dependency: [if], data = [(batch_Size] } else { PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, persistenceUnit); setBatchSize(puMetadata.getBatchSize()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<String> commands(boolean sys, boolean app) { C.List<String> list = C.newList(); Act.Mode mode = Act.mode(); boolean all = !sys && !app; for (String s : registry.keySet()) { boolean isSysCmd = s.startsWith("act."); if (isSysCmd && !sys && !all) { continue; } if (!isSysCmd && !app && !all) { continue; } CliHandler h = registry.get(s); if (h.appliedIn(mode)) { list.add(s); } } return list.sorted(new $.Comparator<String>() { @Override public int compare(String o1, String o2) { boolean b1 = (o1.startsWith("act.")); boolean b2 = (o2.startsWith("act.")); if (b1 & !b2) { return -1; } if (!b1 & b2) { return 1; } return o1.compareTo(o2); } }); } }
public class class_name { public List<String> commands(boolean sys, boolean app) { C.List<String> list = C.newList(); Act.Mode mode = Act.mode(); boolean all = !sys && !app; for (String s : registry.keySet()) { boolean isSysCmd = s.startsWith("act."); if (isSysCmd && !sys && !all) { continue; } if (!isSysCmd && !app && !all) { continue; } CliHandler h = registry.get(s); if (h.appliedIn(mode)) { list.add(s); // depends on control dependency: [if], data = [none] } } return list.sorted(new $.Comparator<String>() { @Override public int compare(String o1, String o2) { boolean b1 = (o1.startsWith("act.")); boolean b2 = (o2.startsWith("act.")); if (b1 & !b2) { return -1; // depends on control dependency: [if], data = [none] } if (!b1 & b2) { return 1; // depends on control dependency: [if], data = [none] } return o1.compareTo(o2); } }); } }
public class class_name { private void setEntityIdValue(final Object entity, final BigDecimal id, final MappingColumn column) { Class<?> rawType = column.getJavaType().getRawType(); if (int.class.equals(rawType) || Integer.class.equals(rawType)) { column.setValue(entity, id.intValue()); } else if (long.class.equals(rawType) || Long.class.equals(rawType)) { column.setValue(entity, id.longValue()); } else if (BigInteger.class.equals(rawType)) { column.setValue(entity, id.toBigInteger()); } else if (BigDecimal.class.equals(rawType)) { column.setValue(entity, id); } else if (String.class.equals(rawType)) { column.setValue(entity, id.toPlainString()); } else { throw new UroborosqlRuntimeException( "Column is not correct as ID type. column=" + column.getCamelName() + ", type=" + rawType); } } }
public class class_name { private void setEntityIdValue(final Object entity, final BigDecimal id, final MappingColumn column) { Class<?> rawType = column.getJavaType().getRawType(); if (int.class.equals(rawType) || Integer.class.equals(rawType)) { column.setValue(entity, id.intValue()); // depends on control dependency: [if], data = [none] } else if (long.class.equals(rawType) || Long.class.equals(rawType)) { column.setValue(entity, id.longValue()); // depends on control dependency: [if], data = [none] } else if (BigInteger.class.equals(rawType)) { column.setValue(entity, id.toBigInteger()); // depends on control dependency: [if], data = [none] } else if (BigDecimal.class.equals(rawType)) { column.setValue(entity, id); // depends on control dependency: [if], data = [none] } else if (String.class.equals(rawType)) { column.setValue(entity, id.toPlainString()); // depends on control dependency: [if], data = [none] } else { throw new UroborosqlRuntimeException( "Column is not correct as ID type. column=" + column.getCamelName() + ", type=" + rawType); } } }
public class class_name { public static String read(Reader reader, int length) { try { char[] buffer = new char[length]; int offset = 0; int rest = length; int len; while ((len = reader.read(buffer, offset, rest)) != -1) { rest -= len; offset += len; if (rest == 0) { break; } } return new String(buffer, 0, length - rest); } catch (IOException ex) { throw new IllegalStateException("read error", ex); } } }
public class class_name { public static String read(Reader reader, int length) { try { char[] buffer = new char[length]; int offset = 0; int rest = length; int len; while ((len = reader.read(buffer, offset, rest)) != -1) { rest -= len; // depends on control dependency: [while], data = [none] offset += len; // depends on control dependency: [while], data = [none] if (rest == 0) { break; } } return new String(buffer, 0, length - rest); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new IllegalStateException("read error", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public synchronized void removeAssociation() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "removeAssociation"); _activeAssociations--; if (_activeAssociations <= 0) { startInactivityTimer(); } else { _mostRecentThread.pop(); } notifyAll(); //LIDB1673.23 if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "removeAssociation"); } }
public class class_name { @Override public synchronized void removeAssociation() { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "removeAssociation"); _activeAssociations--; if (_activeAssociations <= 0) { startInactivityTimer(); // depends on control dependency: [if], data = [none] } else { _mostRecentThread.pop(); // depends on control dependency: [if], data = [none] } notifyAll(); //LIDB1673.23 if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "removeAssociation"); } }
public class class_name { private Node<K,V> lookup(final Object data, final int index) { Node<K,V> rval = null; Node<K,V> node = rootNode[index]; while (node != null) { int cmp = compare(Node.NO_CHANGE, data, node.getStatus(), node.getData(index), index); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; } }
public class class_name { private Node<K,V> lookup(final Object data, final int index) { Node<K,V> rval = null; Node<K,V> node = rootNode[index]; while (node != null) { int cmp = compare(Node.NO_CHANGE, data, node.getStatus(), node.getData(index), index); if (cmp == 0) { rval = node; // depends on control dependency: [if], data = [none] break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); // depends on control dependency: [if], data = [(cmp] } } return rval; } }
public class class_name { private static boolean hasPhosphat(MonomerNotationUnitRNA monomerNotationUnitRNA) { if (monomerNotationUnitRNA.getContents().get(monomerNotationUnitRNA.getContents().size() - 1).getUnit() .endsWith("P")) { LOG.info("MonomerNotationUnitRNA " + monomerNotationUnitRNA.getUnit() + " has a phosphate"); return true; } LOG.info("MonomerNotationUnitRNA " + monomerNotationUnitRNA.getUnit() + " has no phosphate"); return false; } }
public class class_name { private static boolean hasPhosphat(MonomerNotationUnitRNA monomerNotationUnitRNA) { if (monomerNotationUnitRNA.getContents().get(monomerNotationUnitRNA.getContents().size() - 1).getUnit() .endsWith("P")) { LOG.info("MonomerNotationUnitRNA " + monomerNotationUnitRNA.getUnit() + " has a phosphate"); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } LOG.info("MonomerNotationUnitRNA " + monomerNotationUnitRNA.getUnit() + " has no phosphate"); return false; } }
public class class_name { public boolean shouldTerminate(PopulationData<?> populationData) { if (natural) { // If we're using "natural" fitness scores, higher values are better. return populationData.getBestCandidateFitness() >= targetFitness; } else { // If we're using "non-natural" fitness scores, lower values are better. return populationData.getBestCandidateFitness() <= targetFitness; } } }
public class class_name { public boolean shouldTerminate(PopulationData<?> populationData) { if (natural) { // If we're using "natural" fitness scores, higher values are better. return populationData.getBestCandidateFitness() >= targetFitness; // depends on control dependency: [if], data = [none] } else { // If we're using "non-natural" fitness scores, lower values are better. return populationData.getBestCandidateFitness() <= targetFitness; // depends on control dependency: [if], data = [none] } } }
public class class_name { private Code parseCode(Element codeElement, Map<String, Scope> scopes) { // Code name Code code = new Code(nodeAttribute(codeElement, TAG_CODE_ATTR_NAME, Utils.generateRandomName())); // Code priority code.setPriority(nodeAttribute(codeElement, TAG_CODE_ATTR_PRIORITY, Code.DEFAULT_PRIORITY)); // Do show variables outside the code? code.setTransparent(nodeAttribute(codeElement, TAG_CODE_ATTR_TRANSPARENT, true)); // Template to building NodeList templateElements = codeElement.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_TEMPLATE); if (templateElements.getLength() > 0) { code.setTemplate(parseTemplate(templateElements.item(0))); } else { throw new TextProcessorFactoryException("Illegal configuration. Can't find template of code."); } // Pattern to parsing NodeList patternElements = codeElement.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_PATTERN); if (patternElements.getLength() > 0) { for (int i = 0; i < patternElements.getLength(); i++) { code.addPattern(parsePattern(patternElements.item(i), scopes)); } } else { throw new TextProcessorFactoryException("Illegal configuration. Can't find pattern of code."); } // return code return code; } }
public class class_name { private Code parseCode(Element codeElement, Map<String, Scope> scopes) { // Code name Code code = new Code(nodeAttribute(codeElement, TAG_CODE_ATTR_NAME, Utils.generateRandomName())); // Code priority code.setPriority(nodeAttribute(codeElement, TAG_CODE_ATTR_PRIORITY, Code.DEFAULT_PRIORITY)); // Do show variables outside the code? code.setTransparent(nodeAttribute(codeElement, TAG_CODE_ATTR_TRANSPARENT, true)); // Template to building NodeList templateElements = codeElement.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_TEMPLATE); if (templateElements.getLength() > 0) { code.setTemplate(parseTemplate(templateElements.item(0))); // depends on control dependency: [if], data = [0)] } else { throw new TextProcessorFactoryException("Illegal configuration. Can't find template of code."); } // Pattern to parsing NodeList patternElements = codeElement.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_PATTERN); if (patternElements.getLength() > 0) { for (int i = 0; i < patternElements.getLength(); i++) { code.addPattern(parsePattern(patternElements.item(i), scopes)); // depends on control dependency: [for], data = [i] } } else { throw new TextProcessorFactoryException("Illegal configuration. Can't find pattern of code."); } // return code return code; } }
public class class_name { public static Fraction of(int numerator, int denominator, boolean reduce) { if (denominator == 0) { throw new ArithmeticException("The denominator must not be zero"); } if (reduce) { // allow 2^k/-2^31 as a valid fraction (where k>0) if (denominator == Integer.MIN_VALUE && (numerator & 1) == 0) { numerator /= 2; denominator /= 2; } } if (denominator < 0) { if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) { throw new ArithmeticException("overflow: can't negate"); } numerator = -numerator; denominator = -denominator; } if (reduce) { if (numerator == 0) { return ZERO; // normalize zero. } // simplify fraction. final int gcd = greatestCommonDivisor(numerator, denominator); numerator /= gcd; denominator /= gcd; return new Fraction(numerator, denominator); } else { return new Fraction(numerator, denominator); } } }
public class class_name { public static Fraction of(int numerator, int denominator, boolean reduce) { if (denominator == 0) { throw new ArithmeticException("The denominator must not be zero"); } if (reduce) { // allow 2^k/-2^31 as a valid fraction (where k>0) if (denominator == Integer.MIN_VALUE && (numerator & 1) == 0) { numerator /= 2; // depends on control dependency: [if], data = [none] denominator /= 2; // depends on control dependency: [if], data = [none] } } if (denominator < 0) { if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) { throw new ArithmeticException("overflow: can't negate"); } numerator = -numerator; // depends on control dependency: [if], data = [none] denominator = -denominator; // depends on control dependency: [if], data = [none] } if (reduce) { if (numerator == 0) { return ZERO; // normalize zero. // depends on control dependency: [if], data = [none] } // simplify fraction. final int gcd = greatestCommonDivisor(numerator, denominator); numerator /= gcd; // depends on control dependency: [if], data = [none] denominator /= gcd; // depends on control dependency: [if], data = [none] return new Fraction(numerator, denominator); // depends on control dependency: [if], data = [none] } else { return new Fraction(numerator, denominator); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getReportUpdate() { A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread); if (thread != null) { return thread.getReportUpdate(); } else { return ""; } } }
public class class_name { public String getReportUpdate() { A_CmsReportThread thread = OpenCms.getThreadStore().retrieveThread(m_paramThread); if (thread != null) { return thread.getReportUpdate(); // depends on control dependency: [if], data = [none] } else { return ""; // depends on control dependency: [if], data = [none] } } }
public class class_name { private Collection<RequestMapperBean> initializeRequestMappers(final Request request) { final Set<RequestMapperBean> mapperBeans = new TreeSet<>(getComparator()); for (final IRequestMapper requestMapper : this.requestMappers) { mapperBeans.add( new RequestMapperBean(requestMapper, requestMapper.getCompatibilityScore(request))); } return mapperBeans; } }
public class class_name { private Collection<RequestMapperBean> initializeRequestMappers(final Request request) { final Set<RequestMapperBean> mapperBeans = new TreeSet<>(getComparator()); for (final IRequestMapper requestMapper : this.requestMappers) { mapperBeans.add( new RequestMapperBean(requestMapper, requestMapper.getCompatibilityScore(request))); // depends on control dependency: [for], data = [none] } return mapperBeans; } }
public class class_name { public Indexer getIndexer(Field field) { PropertyIndexer indexerAnnotation = field.getAnnotation(PropertyIndexer.class); if (indexerAnnotation != null) { Class<? extends Indexer> indexerClass = indexerAnnotation.value(); return getIndexer(indexerClass); } return getDefaultIndexer(field); } }
public class class_name { public Indexer getIndexer(Field field) { PropertyIndexer indexerAnnotation = field.getAnnotation(PropertyIndexer.class); if (indexerAnnotation != null) { Class<? extends Indexer> indexerClass = indexerAnnotation.value(); return getIndexer(indexerClass); // depends on control dependency: [if], data = [none] } return getDefaultIndexer(field); } }
public class class_name { @Override public RegistrationManager getRegistrationManager(){ if(registrationManager == null){ synchronized(this){ if(registrationManager == null){ RegistrationManagerImpl registration = new RegistrationManagerImpl(getDirectoryServiceClientManager()); registration.start(); registrationManager = registration; } } } return registrationManager; } }
public class class_name { @Override public RegistrationManager getRegistrationManager(){ if(registrationManager == null){ synchronized(this){ // depends on control dependency: [if], data = [none] if(registrationManager == null){ RegistrationManagerImpl registration = new RegistrationManagerImpl(getDirectoryServiceClientManager()); registration.start(); // depends on control dependency: [if], data = [none] registrationManager = registration; // depends on control dependency: [if], data = [none] } } } return registrationManager; } }
public class class_name { public static void mult( double a[] , int offsetA , DMatrixSparseCSC B , double c[] , int offsetC ) { if( a.length-offsetA < B.numRows) throw new IllegalArgumentException("Length of 'a' isn't long enough"); if( c.length-offsetC < B.numCols) throw new IllegalArgumentException("Length of 'c' isn't long enough"); for (int k = 0; k < B.numCols; k++) { int idx0 = B.col_idx[k ]; int idx1 = B.col_idx[k+1]; double sum = 0; for (int indexB = idx0; indexB < idx1; indexB++) { sum += a[offsetA+B.nz_rows[indexB]]*B.nz_values[indexB]; } c[offsetC+k] = sum; } } }
public class class_name { public static void mult( double a[] , int offsetA , DMatrixSparseCSC B , double c[] , int offsetC ) { if( a.length-offsetA < B.numRows) throw new IllegalArgumentException("Length of 'a' isn't long enough"); if( c.length-offsetC < B.numCols) throw new IllegalArgumentException("Length of 'c' isn't long enough"); for (int k = 0; k < B.numCols; k++) { int idx0 = B.col_idx[k ]; int idx1 = B.col_idx[k+1]; double sum = 0; for (int indexB = idx0; indexB < idx1; indexB++) { sum += a[offsetA+B.nz_rows[indexB]]*B.nz_values[indexB]; // depends on control dependency: [for], data = [indexB] } c[offsetC+k] = sum; // depends on control dependency: [for], data = [k] } } }
public class class_name { public static CongestionControlSupplier congestionControlSupplier() { CongestionControlSupplier supplier = null; try { final String className = getProperty(CONGESTION_CONTROL_STRATEGY_SUPPLIER_PROP_NAME); if (null == className) { return new DefaultCongestionControlSupplier(); } supplier = (CongestionControlSupplier)Class.forName(className).getConstructor().newInstance(); } catch (final Exception ex) { LangUtil.rethrowUnchecked(ex); } return supplier; } }
public class class_name { public static CongestionControlSupplier congestionControlSupplier() { CongestionControlSupplier supplier = null; try { final String className = getProperty(CONGESTION_CONTROL_STRATEGY_SUPPLIER_PROP_NAME); if (null == className) { return new DefaultCongestionControlSupplier(); // depends on control dependency: [if], data = [none] } supplier = (CongestionControlSupplier)Class.forName(className).getConstructor().newInstance(); // depends on control dependency: [try], data = [none] } catch (final Exception ex) { LangUtil.rethrowUnchecked(ex); } // depends on control dependency: [catch], data = [none] return supplier; } }
public class class_name { public WindowDeclarationDescr windowDeclaration(DeclareDescrBuilder ddb) throws RecognitionException { WindowDeclarationDescrBuilder declare = null; try { declare = helper.start(ddb, WindowDeclarationDescrBuilder.class, null); setAnnotationsOn(declare); String window = ""; match(input, DRL6Lexer.ID, DroolsSoftKeywords.WINDOW, null, DroolsEditorType.KEYWORD); if (state.failed) return null; Token id = match(input, DRL6Lexer.ID, null, null, DroolsEditorType.IDENTIFIER); if (state.failed) return null; window = id.getText(); if (state.backtracking == 0) { declare.name(window); } lhsPatternBind(declare, false); match(input, DRL6Lexer.ID, DroolsSoftKeywords.END, null, DroolsEditorType.KEYWORD); if (state.failed) return null; } catch (RecognitionException re) { reportError(re); } finally { helper.end(WindowDeclarationDescrBuilder.class, declare); } return (declare != null) ? declare.getDescr() : null; } }
public class class_name { public WindowDeclarationDescr windowDeclaration(DeclareDescrBuilder ddb) throws RecognitionException { WindowDeclarationDescrBuilder declare = null; try { declare = helper.start(ddb, WindowDeclarationDescrBuilder.class, null); setAnnotationsOn(declare); String window = ""; match(input, DRL6Lexer.ID, DroolsSoftKeywords.WINDOW, null, DroolsEditorType.KEYWORD); if (state.failed) return null; Token id = match(input, DRL6Lexer.ID, null, null, DroolsEditorType.IDENTIFIER); if (state.failed) return null; window = id.getText(); if (state.backtracking == 0) { declare.name(window); // depends on control dependency: [if], data = [none] } lhsPatternBind(declare, false); match(input, DRL6Lexer.ID, DroolsSoftKeywords.END, null, DroolsEditorType.KEYWORD); if (state.failed) return null; } catch (RecognitionException re) { reportError(re); } finally { helper.end(WindowDeclarationDescrBuilder.class, declare); } return (declare != null) ? declare.getDescr() : null; } }
public class class_name { public AT_Row setPadding(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPadding(padding); } } return this; } }
public class class_name { public AT_Row setPadding(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPadding(padding); // depends on control dependency: [for], data = [cell] } } return this; } }
public class class_name { public void marshall(ResolvedTargets resolvedTargets, ProtocolMarshaller protocolMarshaller) { if (resolvedTargets == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resolvedTargets.getParameterValues(), PARAMETERVALUES_BINDING); protocolMarshaller.marshall(resolvedTargets.getTruncated(), TRUNCATED_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResolvedTargets resolvedTargets, ProtocolMarshaller protocolMarshaller) { if (resolvedTargets == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resolvedTargets.getParameterValues(), PARAMETERVALUES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resolvedTargets.getTruncated(), TRUNCATED_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 setAsText(final String text) { if (PropertyEditors.isNull(text)) { setValue(null); return; } Object newValue = Long.valueOf(text); setValue(newValue); } }
public class class_name { public void setAsText(final String text) { if (PropertyEditors.isNull(text)) { setValue(null); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } Object newValue = Long.valueOf(text); setValue(newValue); } }
public class class_name { public static base_responses add(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip addresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nsip(); addresources[i].ipaddress = resources[i].ipaddress; addresources[i].netmask = resources[i].netmask; addresources[i].type = resources[i].type; addresources[i].arp = resources[i].arp; addresources[i].icmp = resources[i].icmp; addresources[i].vserver = resources[i].vserver; addresources[i].telnet = resources[i].telnet; addresources[i].ftp = resources[i].ftp; addresources[i].gui = resources[i].gui; addresources[i].ssh = resources[i].ssh; addresources[i].snmp = resources[i].snmp; addresources[i].mgmtaccess = resources[i].mgmtaccess; addresources[i].restrictaccess = resources[i].restrictaccess; addresources[i].dynamicrouting = resources[i].dynamicrouting; addresources[i].ospf = resources[i].ospf; addresources[i].bgp = resources[i].bgp; addresources[i].rip = resources[i].rip; addresources[i].hostroute = resources[i].hostroute; addresources[i].hostrtgw = resources[i].hostrtgw; addresources[i].metric = resources[i].metric; addresources[i].vserverrhilevel = resources[i].vserverrhilevel; addresources[i].ospflsatype = resources[i].ospflsatype; addresources[i].ospfarea = resources[i].ospfarea; addresources[i].state = resources[i].state; addresources[i].vrid = resources[i].vrid; addresources[i].icmpresponse = resources[i].icmpresponse; addresources[i].ownernode = resources[i].ownernode; addresources[i].arpresponse = resources[i].arpresponse; addresources[i].td = resources[i].td; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip addresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new nsip(); // depends on control dependency: [for], data = [i] addresources[i].ipaddress = resources[i].ipaddress; // depends on control dependency: [for], data = [i] addresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i] addresources[i].type = resources[i].type; // depends on control dependency: [for], data = [i] addresources[i].arp = resources[i].arp; // depends on control dependency: [for], data = [i] addresources[i].icmp = resources[i].icmp; // depends on control dependency: [for], data = [i] addresources[i].vserver = resources[i].vserver; // depends on control dependency: [for], data = [i] addresources[i].telnet = resources[i].telnet; // depends on control dependency: [for], data = [i] addresources[i].ftp = resources[i].ftp; // depends on control dependency: [for], data = [i] addresources[i].gui = resources[i].gui; // depends on control dependency: [for], data = [i] addresources[i].ssh = resources[i].ssh; // depends on control dependency: [for], data = [i] addresources[i].snmp = resources[i].snmp; // depends on control dependency: [for], data = [i] addresources[i].mgmtaccess = resources[i].mgmtaccess; // depends on control dependency: [for], data = [i] addresources[i].restrictaccess = resources[i].restrictaccess; // depends on control dependency: [for], data = [i] addresources[i].dynamicrouting = resources[i].dynamicrouting; // depends on control dependency: [for], data = [i] addresources[i].ospf = resources[i].ospf; // depends on control dependency: [for], data = [i] addresources[i].bgp = resources[i].bgp; // depends on control dependency: [for], data = [i] addresources[i].rip = resources[i].rip; // depends on control dependency: [for], data = [i] addresources[i].hostroute = resources[i].hostroute; // depends on control dependency: [for], data = [i] addresources[i].hostrtgw = resources[i].hostrtgw; // depends on control dependency: [for], data = [i] addresources[i].metric = resources[i].metric; // depends on control dependency: [for], data = [i] addresources[i].vserverrhilevel = resources[i].vserverrhilevel; // depends on control dependency: [for], data = [i] addresources[i].ospflsatype = resources[i].ospflsatype; // depends on control dependency: [for], data = [i] addresources[i].ospfarea = resources[i].ospfarea; // depends on control dependency: [for], data = [i] addresources[i].state = resources[i].state; // depends on control dependency: [for], data = [i] addresources[i].vrid = resources[i].vrid; // depends on control dependency: [for], data = [i] addresources[i].icmpresponse = resources[i].icmpresponse; // depends on control dependency: [for], data = [i] addresources[i].ownernode = resources[i].ownernode; // depends on control dependency: [for], data = [i] addresources[i].arpresponse = resources[i].arpresponse; // depends on control dependency: [for], data = [i] addresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public void setListeners(StatsStorageRouter statsStorage, Collection<? extends TrainingListener> listeners) { //Check if we have any RoutingIterationListener instances that need a StatsStorage implementation... if (listeners != null) { for (TrainingListener l : listeners) { if (l instanceof RoutingIterationListener) { RoutingIterationListener rl = (RoutingIterationListener) l; if (statsStorage == null && rl.getStorageRouter() == null) { log.warn("RoutingIterationListener provided without providing any StatsStorage instance. Iterator may not function without one. Listener: {}", l); } } } this.listeners.addAll(listeners); } else { this.listeners.clear(); } this.storageRouter = statsStorage; } }
public class class_name { public void setListeners(StatsStorageRouter statsStorage, Collection<? extends TrainingListener> listeners) { //Check if we have any RoutingIterationListener instances that need a StatsStorage implementation... if (listeners != null) { for (TrainingListener l : listeners) { if (l instanceof RoutingIterationListener) { RoutingIterationListener rl = (RoutingIterationListener) l; if (statsStorage == null && rl.getStorageRouter() == null) { log.warn("RoutingIterationListener provided without providing any StatsStorage instance. Iterator may not function without one. Listener: {}", l); // depends on control dependency: [if], data = [none] } } } this.listeners.addAll(listeners); // depends on control dependency: [if], data = [(listeners] } else { this.listeners.clear(); // depends on control dependency: [if], data = [none] } this.storageRouter = statsStorage; } }
public class class_name { private static String parameterizedTypeToString(final ParameterizedType p) { final StringBuilder buf = new StringBuilder(); final Type useOwner = p.getOwnerType(); final Class<?> raw = (Class<?>) p.getRawType(); if (useOwner == null) { buf.append(raw.getName()); } else { if (useOwner instanceof Class<?>) { buf.append(((Class<?>) useOwner).getName()); } else { buf.append(useOwner.toString()); } buf.append('.').append(raw.getSimpleName()); } final int[] recursiveTypeIndexes = findRecursiveTypes(p); if (recursiveTypeIndexes.length > 0) { appendRecursiveTypes(buf, recursiveTypeIndexes, p.getActualTypeArguments()); } else { appendAllTo(buf.append('<'), ", ", p.getActualTypeArguments()).append('>'); } return buf.toString(); } }
public class class_name { private static String parameterizedTypeToString(final ParameterizedType p) { final StringBuilder buf = new StringBuilder(); final Type useOwner = p.getOwnerType(); final Class<?> raw = (Class<?>) p.getRawType(); if (useOwner == null) { buf.append(raw.getName()); } else { if (useOwner instanceof Class<?>) { buf.append(((Class<?>) useOwner).getName()); // depends on control dependency: [if], data = [)] } else { buf.append(useOwner.toString()); // depends on control dependency: [if], data = [)] } buf.append('.').append(raw.getSimpleName()); } final int[] recursiveTypeIndexes = findRecursiveTypes(p); if (recursiveTypeIndexes.length > 0) { appendRecursiveTypes(buf, recursiveTypeIndexes, p.getActualTypeArguments()); // depends on control dependency: [if], data = [none] } else { appendAllTo(buf.append('<'), ", ", p.getActualTypeArguments()).append('>'); // depends on control dependency: [if], data = [none] } return buf.toString(); } }
public class class_name { protected Integer getFontSizeForZoom(double zoom) { double lower = -1; for (double upper : this.zoomToFontSizeMap.keySet()) { if (lower == -1) { lower = upper; if (zoom <= lower) return this.zoomToFontSizeMap.get(upper); continue; } if (zoom > lower && zoom <= upper) { return this.zoomToFontSizeMap.get(upper); } lower = upper; } return this.zoomToFontSizeMap.get(lower); } }
public class class_name { protected Integer getFontSizeForZoom(double zoom) { double lower = -1; for (double upper : this.zoomToFontSizeMap.keySet()) { if (lower == -1) { lower = upper; // depends on control dependency: [if], data = [none] if (zoom <= lower) return this.zoomToFontSizeMap.get(upper); continue; } if (zoom > lower && zoom <= upper) { return this.zoomToFontSizeMap.get(upper); // depends on control dependency: [if], data = [none] } lower = upper; // depends on control dependency: [for], data = [upper] } return this.zoomToFontSizeMap.get(lower); } }
public class class_name { private void repartitionSplitState( Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> nameToDistributeState, int newParallelism, List<Map<StreamStateHandle, OperatorStateHandle>> mergeMapList) { int startParallelOp = 0; // Iterate all named states and repartition one named state at a time per iteration for (Map.Entry<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> e : nameToDistributeState.entrySet()) { List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> current = e.getValue(); // Determine actual number of partitions for this named state int totalPartitions = 0; for (Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> offsets : current) { totalPartitions += offsets.f1.getOffsets().length; } // Repartition the state across the parallel operator instances int lstIdx = 0; int offsetIdx = 0; int baseFraction = totalPartitions / newParallelism; int remainder = totalPartitions % newParallelism; int newStartParallelOp = startParallelOp; for (int i = 0; i < newParallelism; ++i) { // Preparation: calculate the actual index considering wrap around int parallelOpIdx = (i + startParallelOp) % newParallelism; // Now calculate the number of partitions we will assign to the parallel instance in this round ... int numberOfPartitionsToAssign = baseFraction; // ... and distribute odd partitions while we still have some, one at a time if (remainder > 0) { ++numberOfPartitionsToAssign; --remainder; } else if (remainder == 0) { // We are out of odd partitions now and begin our next redistribution round with the current // parallel operator to ensure fair load balance newStartParallelOp = parallelOpIdx; --remainder; } // Now start collection the partitions for the parallel instance into this list while (numberOfPartitionsToAssign > 0) { Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> handleWithOffsets = current.get(lstIdx); long[] offsets = handleWithOffsets.f1.getOffsets(); int remaining = offsets.length - offsetIdx; // Repartition offsets long[] offs; if (remaining > numberOfPartitionsToAssign) { offs = Arrays.copyOfRange(offsets, offsetIdx, offsetIdx + numberOfPartitionsToAssign); offsetIdx += numberOfPartitionsToAssign; } else { if (OPTIMIZE_MEMORY_USE) { handleWithOffsets.f1 = null; // GC } offs = Arrays.copyOfRange(offsets, offsetIdx, offsets.length); offsetIdx = 0; ++lstIdx; } numberOfPartitionsToAssign -= remaining; // As a last step we merge partitions that use the same StreamStateHandle in a single // OperatorStateHandle Map<StreamStateHandle, OperatorStateHandle> mergeMap = mergeMapList.get(parallelOpIdx); OperatorStateHandle operatorStateHandle = mergeMap.get(handleWithOffsets.f0); if (operatorStateHandle == null) { operatorStateHandle = new OperatorStreamStateHandle( new HashMap<>(nameToDistributeState.size()), handleWithOffsets.f0); mergeMap.put(handleWithOffsets.f0, operatorStateHandle); } operatorStateHandle.getStateNameToPartitionOffsets().put( e.getKey(), new OperatorStateHandle.StateMetaInfo(offs, OperatorStateHandle.Mode.SPLIT_DISTRIBUTE)); } } startParallelOp = newStartParallelOp; e.setValue(null); } } }
public class class_name { private void repartitionSplitState( Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> nameToDistributeState, int newParallelism, List<Map<StreamStateHandle, OperatorStateHandle>> mergeMapList) { int startParallelOp = 0; // Iterate all named states and repartition one named state at a time per iteration for (Map.Entry<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> e : nameToDistributeState.entrySet()) { List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> current = e.getValue(); // Determine actual number of partitions for this named state int totalPartitions = 0; for (Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> offsets : current) { totalPartitions += offsets.f1.getOffsets().length; // depends on control dependency: [for], data = [offsets] } // Repartition the state across the parallel operator instances int lstIdx = 0; int offsetIdx = 0; int baseFraction = totalPartitions / newParallelism; int remainder = totalPartitions % newParallelism; int newStartParallelOp = startParallelOp; for (int i = 0; i < newParallelism; ++i) { // Preparation: calculate the actual index considering wrap around int parallelOpIdx = (i + startParallelOp) % newParallelism; // Now calculate the number of partitions we will assign to the parallel instance in this round ... int numberOfPartitionsToAssign = baseFraction; // ... and distribute odd partitions while we still have some, one at a time if (remainder > 0) { ++numberOfPartitionsToAssign; // depends on control dependency: [if], data = [none] --remainder; // depends on control dependency: [if], data = [none] } else if (remainder == 0) { // We are out of odd partitions now and begin our next redistribution round with the current // parallel operator to ensure fair load balance newStartParallelOp = parallelOpIdx; // depends on control dependency: [if], data = [none] --remainder; // depends on control dependency: [if], data = [none] } // Now start collection the partitions for the parallel instance into this list while (numberOfPartitionsToAssign > 0) { Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> handleWithOffsets = current.get(lstIdx); long[] offsets = handleWithOffsets.f1.getOffsets(); int remaining = offsets.length - offsetIdx; // Repartition offsets long[] offs; if (remaining > numberOfPartitionsToAssign) { offs = Arrays.copyOfRange(offsets, offsetIdx, offsetIdx + numberOfPartitionsToAssign); // depends on control dependency: [if], data = [numberOfPartitionsToAssign)] offsetIdx += numberOfPartitionsToAssign; // depends on control dependency: [if], data = [none] } else { if (OPTIMIZE_MEMORY_USE) { handleWithOffsets.f1 = null; // GC // depends on control dependency: [if], data = [none] } offs = Arrays.copyOfRange(offsets, offsetIdx, offsets.length); // depends on control dependency: [if], data = [none] offsetIdx = 0; // depends on control dependency: [if], data = [none] ++lstIdx; // depends on control dependency: [if], data = [none] } numberOfPartitionsToAssign -= remaining; // depends on control dependency: [while], data = [none] // As a last step we merge partitions that use the same StreamStateHandle in a single // OperatorStateHandle Map<StreamStateHandle, OperatorStateHandle> mergeMap = mergeMapList.get(parallelOpIdx); OperatorStateHandle operatorStateHandle = mergeMap.get(handleWithOffsets.f0); if (operatorStateHandle == null) { operatorStateHandle = new OperatorStreamStateHandle( new HashMap<>(nameToDistributeState.size()), handleWithOffsets.f0); // depends on control dependency: [if], data = [none] mergeMap.put(handleWithOffsets.f0, operatorStateHandle); // depends on control dependency: [if], data = [none] } operatorStateHandle.getStateNameToPartitionOffsets().put( e.getKey(), new OperatorStateHandle.StateMetaInfo(offs, OperatorStateHandle.Mode.SPLIT_DISTRIBUTE)); // depends on control dependency: [while], data = [none] } } startParallelOp = newStartParallelOp; // depends on control dependency: [for], data = [e] e.setValue(null); // depends on control dependency: [for], data = [e] } } }
public class class_name { static byte[] toBytes(final String s) { try { return (byte[]) toBytes.invoke(null, s); } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } } }
public class class_name { static byte[] toBytes(final String s) { try { return (byte[]) toBytes.invoke(null, s); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Optional<CmsResource> getDetailOnlyPage( CmsObject cms, CmsResource detailContent, String contentLocale) { try { CmsObject rootCms = OpenCms.initCmsObject(cms); rootCms.getRequestContext().setSiteRoot(""); String path = getDetailOnlyPageNameWithoutLocaleCheck(detailContent.getRootPath(), contentLocale); if (rootCms.existsResource(path, CmsResourceFilter.ALL)) { CmsResource detailOnlyRes = rootCms.readResource(path, CmsResourceFilter.ALL); return Optional.of(detailOnlyRes); } return Optional.absent(); } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return Optional.absent(); } } }
public class class_name { public static Optional<CmsResource> getDetailOnlyPage( CmsObject cms, CmsResource detailContent, String contentLocale) { try { CmsObject rootCms = OpenCms.initCmsObject(cms); rootCms.getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none] String path = getDetailOnlyPageNameWithoutLocaleCheck(detailContent.getRootPath(), contentLocale); if (rootCms.existsResource(path, CmsResourceFilter.ALL)) { CmsResource detailOnlyRes = rootCms.readResource(path, CmsResourceFilter.ALL); return Optional.of(detailOnlyRes); // depends on control dependency: [if], data = [none] } return Optional.absent(); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn(e.getLocalizedMessage(), e); return Optional.absent(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static PayPalAccountNonce fromJson(String jsonString) throws JSONException { JSONObject jsonObj = new JSONObject(jsonString); PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce(); if(jsonObj.has(PayPalAccountNonce.API_RESOURCE_KEY)) { payPalAccountNonce.fromJson(PayPalAccountNonce.getJsonObjectForType(API_RESOURCE_KEY, jsonObj)); } else if(jsonObj.has(PayPalAccountNonce.PAYMENT_METHOD_DATA_KEY)) { JSONObject tokenObj = new JSONObject(new JSONObject(jsonString) .getJSONObject(PayPalAccountNonce.PAYMENT_METHOD_DATA_KEY) .getJSONObject(PayPalAccountNonce.TOKENIZATION_DATA_KEY) .getString(PayPalAccountNonce.TOKEN_KEY)); payPalAccountNonce.fromJson(PayPalAccountNonce.getJsonObjectForType(API_RESOURCE_KEY, tokenObj)); JSONObject shippingAddress = jsonObj.optJSONObject(SHIPPING_ADDRESS_KEY); if (shippingAddress != null) { payPalAccountNonce.mShippingAddress = PostalAddressParser.fromJson(shippingAddress); } } else { throw new JSONException("Could not parse JSON for a payment method nonce"); } return payPalAccountNonce; } }
public class class_name { public static PayPalAccountNonce fromJson(String jsonString) throws JSONException { JSONObject jsonObj = new JSONObject(jsonString); PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce(); if(jsonObj.has(PayPalAccountNonce.API_RESOURCE_KEY)) { payPalAccountNonce.fromJson(PayPalAccountNonce.getJsonObjectForType(API_RESOURCE_KEY, jsonObj)); } else if(jsonObj.has(PayPalAccountNonce.PAYMENT_METHOD_DATA_KEY)) { JSONObject tokenObj = new JSONObject(new JSONObject(jsonString) .getJSONObject(PayPalAccountNonce.PAYMENT_METHOD_DATA_KEY) .getJSONObject(PayPalAccountNonce.TOKENIZATION_DATA_KEY) .getString(PayPalAccountNonce.TOKEN_KEY)); payPalAccountNonce.fromJson(PayPalAccountNonce.getJsonObjectForType(API_RESOURCE_KEY, tokenObj)); JSONObject shippingAddress = jsonObj.optJSONObject(SHIPPING_ADDRESS_KEY); if (shippingAddress != null) { payPalAccountNonce.mShippingAddress = PostalAddressParser.fromJson(shippingAddress); // depends on control dependency: [if], data = [(shippingAddress] } } else { throw new JSONException("Could not parse JSON for a payment method nonce"); } return payPalAccountNonce; } }
public class class_name { private double[][] determineBasis(double[] alpha) { final int dim = alpha.length; // Primary vector: double[] nn = new double[dim + 1]; for(int i = 0; i < nn.length; i++) { double alpha_i = i == alpha.length ? 0 : alpha[i]; nn[i] = ParameterizationFunction.sinusProduct(0, i, alpha) * FastMath.cos(alpha_i); } timesEquals(nn, 1. / euclideanLength(nn)); // Normalize // Find orthogonal system, in transposed form: double[][] basis = new double[dim][]; int found = 0; for(int i = 0; i < nn.length && found < dim; i++) { // ith unit vector. final double[] e_i = new double[nn.length]; e_i[i] = 1.0; minusTimesEquals(e_i, nn, scalarProduct(e_i, nn)); double len = euclideanLength(e_i); // Make orthogonal to earlier (normal) basis vectors: for(int j = 0; j < found; j++) { if(len < 1e-9) { // Disappeared, probably linear dependent break; } minusTimesEquals(e_i, basis[j], scalarProduct(e_i, basis[j])); len = euclideanLength(e_i); } if(len < 1e-9) { continue; } timesEquals(e_i, 1. / len); // Normalize basis[found++] = e_i; } if(found < dim) { // Likely some numerical instability, should not happen. for(int i = found; i < dim; i++) { basis[i] = new double[nn.length]; // Append zero vectors } } return transpose(basis); } }
public class class_name { private double[][] determineBasis(double[] alpha) { final int dim = alpha.length; // Primary vector: double[] nn = new double[dim + 1]; for(int i = 0; i < nn.length; i++) { double alpha_i = i == alpha.length ? 0 : alpha[i]; nn[i] = ParameterizationFunction.sinusProduct(0, i, alpha) * FastMath.cos(alpha_i); // depends on control dependency: [for], data = [i] } timesEquals(nn, 1. / euclideanLength(nn)); // Normalize // Find orthogonal system, in transposed form: double[][] basis = new double[dim][]; int found = 0; for(int i = 0; i < nn.length && found < dim; i++) { // ith unit vector. final double[] e_i = new double[nn.length]; e_i[i] = 1.0; // depends on control dependency: [for], data = [i] minusTimesEquals(e_i, nn, scalarProduct(e_i, nn)); // depends on control dependency: [for], data = [none] double len = euclideanLength(e_i); // Make orthogonal to earlier (normal) basis vectors: for(int j = 0; j < found; j++) { if(len < 1e-9) { // Disappeared, probably linear dependent break; } minusTimesEquals(e_i, basis[j], scalarProduct(e_i, basis[j])); // depends on control dependency: [for], data = [j] len = euclideanLength(e_i); // depends on control dependency: [for], data = [none] } if(len < 1e-9) { continue; } timesEquals(e_i, 1. / len); // Normalize // depends on control dependency: [for], data = [none] basis[found++] = e_i; // depends on control dependency: [for], data = [none] } if(found < dim) { // Likely some numerical instability, should not happen. for(int i = found; i < dim; i++) { basis[i] = new double[nn.length]; // Append zero vectors // depends on control dependency: [for], data = [i] } } return transpose(basis); } }
public class class_name { @SuppressWarnings("rawtypes") private void removeMisleadingType(Slider2 slider) { try { Method method = getClass().getMethod("getPassThroughAttributes", (Class[]) null); if (null != method) { Object map = method.invoke(this, (Object[]) null); if (null != map) { Map attributes = (Map) map; if (attributes.containsKey("type")) attributes.remove("type"); } } } catch (Exception ignoreMe) { // we don't really have to care about this error } } }
public class class_name { @SuppressWarnings("rawtypes") private void removeMisleadingType(Slider2 slider) { try { Method method = getClass().getMethod("getPassThroughAttributes", (Class[]) null); if (null != method) { Object map = method.invoke(this, (Object[]) null); if (null != map) { Map attributes = (Map) map; if (attributes.containsKey("type")) attributes.remove("type"); } } } catch (Exception ignoreMe) { // we don't really have to care about this error } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static String getUUID(int length, UUID uuid) { int groupLength = 32 / length; StringBuilder sb = new StringBuilder(); String id = uuid.toString().replace("-", ""); for (int i = 0; i < length; i++) { String str = id.substring(i * groupLength, i * groupLength + groupLength); int x = Integer.parseInt(str, 16); sb.append(chars[x % 0x3E]); } return sb.toString(); } }
public class class_name { private static String getUUID(int length, UUID uuid) { int groupLength = 32 / length; StringBuilder sb = new StringBuilder(); String id = uuid.toString().replace("-", ""); for (int i = 0; i < length; i++) { String str = id.substring(i * groupLength, i * groupLength + groupLength); int x = Integer.parseInt(str, 16); sb.append(chars[x % 0x3E]); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { private void requestPageAlbums(final Queue<PageAccount> pageAccounts, final List<Object[]> pageAlbums) { final PageAccount account = pageAccounts.poll(); if (account != null) { Callback callback = new Callback() { @Override public void onCompleted(Response response) { FacebookSettingsActivity activity = (FacebookSettingsActivity) getActivity(); if (activity == null || activity.isFinishing()) { return; } if (response != null && response.getError() == null) { GraphObject graphObject = response.getGraphObject(); if (graphObject != null) { JSONObject jsonObject = graphObject.getInnerJSONObject(); try { JSONArray jsonArray = jsonObject .getJSONArray(FacebookEndpoint.ALBUMS_LISTING_RESULT_DATA_KEY); long cursorId = 1L + pageAlbums.size(); for (int i = 0; i < jsonArray.length(); i++) { try { // Get data from json. JSONObject album = jsonArray.getJSONObject(i); String id = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_ID); String name = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_NAME); String type = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_TYPE); String privacy = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_PRIVACY); boolean canUpload = album .getBoolean(FacebookEndpoint.ALBUMS_LISTING_FIELD_CAN_UPLOAD); // Filter out albums that do not allow upload. if (canUpload && id != null && id.length() > 0 && name != null && name.length() > 0 && type != null && type.length() > 0 && privacy != null && privacy.length() > 0) { String graphPath = id + FacebookEndpoint.TO_UPLOAD_PHOTOS_GRAPH_PATH; pageAlbums.add(new Object[]{cursorId, FacebookEndpoint.DestinationId.PAGE_ALBUM, activity.getString(R.string.wings_facebook__destination_page_album_name_template, account.mName, name), graphPath, privacy, account.mPageAccessToken}); cursorId++; } } catch (JSONException e) { // Do nothing. } } // Handle next Page account. requestPageAlbums(pageAccounts, pageAlbums); } catch (JSONException e) { // Do nothing. } } } else { // Finish Activity with error. activity.mHasErrorOccurred = true; activity.tryFinish(); } } }; mFacebookEndpoint.requestAlbums(account.mId, callback); } else { // Exit recursively calls and move on to requesting Profile albums. requestProfileAlbums(pageAlbums); } } }
public class class_name { private void requestPageAlbums(final Queue<PageAccount> pageAccounts, final List<Object[]> pageAlbums) { final PageAccount account = pageAccounts.poll(); if (account != null) { Callback callback = new Callback() { @Override public void onCompleted(Response response) { FacebookSettingsActivity activity = (FacebookSettingsActivity) getActivity(); if (activity == null || activity.isFinishing()) { return; // depends on control dependency: [if], data = [none] } if (response != null && response.getError() == null) { GraphObject graphObject = response.getGraphObject(); if (graphObject != null) { JSONObject jsonObject = graphObject.getInnerJSONObject(); try { JSONArray jsonArray = jsonObject .getJSONArray(FacebookEndpoint.ALBUMS_LISTING_RESULT_DATA_KEY); long cursorId = 1L + pageAlbums.size(); for (int i = 0; i < jsonArray.length(); i++) { try { // Get data from json. JSONObject album = jsonArray.getJSONObject(i); String id = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_ID); String name = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_NAME); String type = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_TYPE); String privacy = album.getString(FacebookEndpoint.ALBUMS_LISTING_FIELD_PRIVACY); boolean canUpload = album .getBoolean(FacebookEndpoint.ALBUMS_LISTING_FIELD_CAN_UPLOAD); // Filter out albums that do not allow upload. if (canUpload && id != null && id.length() > 0 && name != null && name.length() > 0 && type != null && type.length() > 0 && privacy != null && privacy.length() > 0) { String graphPath = id + FacebookEndpoint.TO_UPLOAD_PHOTOS_GRAPH_PATH; pageAlbums.add(new Object[]{cursorId, FacebookEndpoint.DestinationId.PAGE_ALBUM, activity.getString(R.string.wings_facebook__destination_page_album_name_template, account.mName, name), graphPath, privacy, account.mPageAccessToken}); // depends on control dependency: [if], data = [none] cursorId++; // depends on control dependency: [if], data = [none] } } catch (JSONException e) { // Do nothing. } // depends on control dependency: [catch], data = [none] } // Handle next Page account. requestPageAlbums(pageAccounts, pageAlbums); // depends on control dependency: [try], data = [none] } catch (JSONException e) { // Do nothing. } // depends on control dependency: [catch], data = [none] } } else { // Finish Activity with error. activity.mHasErrorOccurred = true; // depends on control dependency: [if], data = [none] activity.tryFinish(); // depends on control dependency: [if], data = [none] } } }; mFacebookEndpoint.requestAlbums(account.mId, callback); // depends on control dependency: [if], data = [(account] } else { // Exit recursively calls and move on to requesting Profile albums. requestProfileAlbums(pageAlbums); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(CreateLoggerDefinitionRequest createLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createLoggerDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createLoggerDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); protocolMarshaller.marshall(createLoggerDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); protocolMarshaller.marshall(createLoggerDefinitionRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(createLoggerDefinitionRequest.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(CreateLoggerDefinitionRequest createLoggerDefinitionRequest, ProtocolMarshaller protocolMarshaller) { if (createLoggerDefinitionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createLoggerDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createLoggerDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createLoggerDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createLoggerDefinitionRequest.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 static Decimal128 parse(final String value) { String lowerCasedValue = value.toLowerCase(); if (NaN_STRINGS.contains(lowerCasedValue)) { return NaN; } if (NEGATIVE_NaN_STRINGS.contains(lowerCasedValue)) { return NEGATIVE_NaN; } if (POSITIVE_INFINITY_STRINGS.contains(lowerCasedValue)) { return POSITIVE_INFINITY; } if (NEGATIVE_INFINITY_STRINGS.contains(lowerCasedValue)) { return NEGATIVE_INFINITY; } return new Decimal128(new BigDecimal(value), value.charAt(0) == '-'); } }
public class class_name { public static Decimal128 parse(final String value) { String lowerCasedValue = value.toLowerCase(); if (NaN_STRINGS.contains(lowerCasedValue)) { return NaN; // depends on control dependency: [if], data = [none] } if (NEGATIVE_NaN_STRINGS.contains(lowerCasedValue)) { return NEGATIVE_NaN; // depends on control dependency: [if], data = [none] } if (POSITIVE_INFINITY_STRINGS.contains(lowerCasedValue)) { return POSITIVE_INFINITY; // depends on control dependency: [if], data = [none] } if (NEGATIVE_INFINITY_STRINGS.contains(lowerCasedValue)) { return NEGATIVE_INFINITY; // depends on control dependency: [if], data = [none] } return new Decimal128(new BigDecimal(value), value.charAt(0) == '-'); } }
public class class_name { public void marshall(CancelMaintenanceWindowExecutionRequest cancelMaintenanceWindowExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (cancelMaintenanceWindowExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cancelMaintenanceWindowExecutionRequest.getWindowExecutionId(), WINDOWEXECUTIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CancelMaintenanceWindowExecutionRequest cancelMaintenanceWindowExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (cancelMaintenanceWindowExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cancelMaintenanceWindowExecutionRequest.getWindowExecutionId(), WINDOWEXECUTIONID_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 final void unaryExpression() throws RecognitionException { int unaryExpression_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 124) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1196:5: ( '+' unaryExpression | '-' unaryExpression | '++' primary | '--' primary | unaryExpressionNotPlusMinus ) int alt156=5; switch ( input.LA(1) ) { case 40: { alt156=1; } break; case 44: { alt156=2; } break; case 41: { alt156=3; } break; case 45: { alt156=4; } break; case CharacterLiteral: case DecimalLiteral: case FloatingPointLiteral: case HexLiteral: case Identifier: case OctalLiteral: case StringLiteral: case 29: case 36: case 53: case 65: case 67: case 70: case 71: case 77: case 79: case 80: case 82: case 85: case 92: case 94: case 97: case 98: case 105: case 108: case 111: case 115: case 118: case 126: { alt156=5; } break; default: if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 156, 0, input); throw nvae; } switch (alt156) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1196:9: '+' unaryExpression { match(input,40,FOLLOW_40_in_unaryExpression5484); if (state.failed) return; pushFollow(FOLLOW_unaryExpression_in_unaryExpression5486); unaryExpression(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1197:7: '-' unaryExpression { match(input,44,FOLLOW_44_in_unaryExpression5494); if (state.failed) return; pushFollow(FOLLOW_unaryExpression_in_unaryExpression5496); unaryExpression(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1198:9: '++' primary { match(input,41,FOLLOW_41_in_unaryExpression5506); if (state.failed) return; pushFollow(FOLLOW_primary_in_unaryExpression5508); primary(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1199:9: '--' primary { match(input,45,FOLLOW_45_in_unaryExpression5518); if (state.failed) return; pushFollow(FOLLOW_primary_in_unaryExpression5520); primary(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1200:9: unaryExpressionNotPlusMinus { pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_unaryExpression5530); unaryExpressionNotPlusMinus(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 124, unaryExpression_StartIndex); } } } }
public class class_name { public final void unaryExpression() throws RecognitionException { int unaryExpression_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 124) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1196:5: ( '+' unaryExpression | '-' unaryExpression | '++' primary | '--' primary | unaryExpressionNotPlusMinus ) int alt156=5; switch ( input.LA(1) ) { case 40: { alt156=1; } break; case 44: { alt156=2; } break; case 41: { alt156=3; } break; case 45: { alt156=4; } break; case CharacterLiteral: case DecimalLiteral: case FloatingPointLiteral: case HexLiteral: case Identifier: case OctalLiteral: case StringLiteral: case 29: case 36: case 53: case 65: case 67: case 70: case 71: case 77: case 79: case 80: case 82: case 85: case 92: case 94: case 97: case 98: case 105: case 108: case 111: case 115: case 118: case 126: { alt156=5; } break; default: if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 156, 0, input); throw nvae; } switch (alt156) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1196:9: '+' unaryExpression { match(input,40,FOLLOW_40_in_unaryExpression5484); if (state.failed) return; pushFollow(FOLLOW_unaryExpression_in_unaryExpression5486); unaryExpression(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1197:7: '-' unaryExpression { match(input,44,FOLLOW_44_in_unaryExpression5494); if (state.failed) return; pushFollow(FOLLOW_unaryExpression_in_unaryExpression5496); unaryExpression(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1198:9: '++' primary { match(input,41,FOLLOW_41_in_unaryExpression5506); if (state.failed) return; pushFollow(FOLLOW_primary_in_unaryExpression5508); primary(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1199:9: '--' primary { match(input,45,FOLLOW_45_in_unaryExpression5518); if (state.failed) return; pushFollow(FOLLOW_primary_in_unaryExpression5520); primary(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1200:9: unaryExpressionNotPlusMinus { pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_unaryExpression5530); unaryExpressionNotPlusMinus(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 124, unaryExpression_StartIndex); } } } }
public class class_name { @SuppressWarnings("unchecked") private static void handleFlatteningForField(Field classField, JsonNode jsonNode) { final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class); if (jsonProperty != null) { final String jsonPropValue = jsonProperty.value(); if (containsFlatteningDots(jsonPropValue)) { JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue); ((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode); } } } }
public class class_name { @SuppressWarnings("unchecked") private static void handleFlatteningForField(Field classField, JsonNode jsonNode) { final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class); if (jsonProperty != null) { final String jsonPropValue = jsonProperty.value(); if (containsFlatteningDots(jsonPropValue)) { JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue); ((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String getPage(String url) { try { // get the full url, and replace the query string with and empty // string url = url.toLowerCase(Locale.ROOT); String queryStr = new URL(url).getQuery(); return (queryStr != null) ? url.replace("?" + queryStr, "") : url; } catch (MalformedURLException e) { return null; } } }
public class class_name { public static String getPage(String url) { try { // get the full url, and replace the query string with and empty // string url = url.toLowerCase(Locale.ROOT); // depends on control dependency: [try], data = [none] String queryStr = new URL(url).getQuery(); return (queryStr != null) ? url.replace("?" + queryStr, "") : url; // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static synchronized void stopAllUploads() { if (uploadTasksMap.isEmpty()) { return; } // using iterator instead for each loop, because it's faster on Android Iterator<String> iterator = uploadTasksMap.keySet().iterator(); while (iterator.hasNext()) { UploadTask taskToCancel = uploadTasksMap.get(iterator.next()); taskToCancel.cancel(); } } }
public class class_name { public static synchronized void stopAllUploads() { if (uploadTasksMap.isEmpty()) { return; // depends on control dependency: [if], data = [none] } // using iterator instead for each loop, because it's faster on Android Iterator<String> iterator = uploadTasksMap.keySet().iterator(); while (iterator.hasNext()) { UploadTask taskToCancel = uploadTasksMap.get(iterator.next()); taskToCancel.cancel(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static void execute(Thread thread, long timeout) { thread.start(); try { thread.join(timeout); } catch (InterruptedException e) { // Should not be interrupted normally. } if (thread.isAlive()) { thread.interrupt(); } } }
public class class_name { public static void execute(Thread thread, long timeout) { thread.start(); try { thread.join(timeout); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // Should not be interrupted normally. } // depends on control dependency: [catch], data = [none] if (thread.isAlive()) { thread.interrupt(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(GetPatchBaselineRequest getPatchBaselineRequest, ProtocolMarshaller protocolMarshaller) { if (getPatchBaselineRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPatchBaselineRequest.getBaselineId(), BASELINEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetPatchBaselineRequest getPatchBaselineRequest, ProtocolMarshaller protocolMarshaller) { if (getPatchBaselineRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPatchBaselineRequest.getBaselineId(), BASELINEID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) { if (length <= 0) { throw new IllegalArgumentException("Invalid input: Empty string"); } int limitedLength = 0; final byte delByte = (byte) delimiter; while (limitedLength < length && bytes[startPos + limitedLength] != delByte) { limitedLength++; } return limitedLength; } }
public class class_name { protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) { if (length <= 0) { throw new IllegalArgumentException("Invalid input: Empty string"); } int limitedLength = 0; final byte delByte = (byte) delimiter; while (limitedLength < length && bytes[startPos + limitedLength] != delByte) { limitedLength++; // depends on control dependency: [while], data = [none] } return limitedLength; } }
public class class_name { public static double inverseRegularizedIncompleteBetaFunction(double alpha, double beta, double p) { final double EPS = 1.0E-8; double pp, t, u, err, x, al, h, w, afac; double a1 = alpha - 1.; double b1 = beta - 1.; if (p <= 0.0) { return 0.0; } if (p >= 1.0) { return 1.0; } if (alpha >= 1. && beta >= 1.) { pp = (p < 0.5) ? p : 1. - p; t = Math.sqrt(-2. * Math.log(pp)); x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t; if (p < 0.5) { x = -x; } al = (x * x - 3.) / 6.; h = 2. / (1. / (2. * alpha - 1.) + 1. / (2. * beta - 1.)); w = (x * Math.sqrt(al + h) / h) - (1. / (2. * beta - 1) - 1. / (2. * alpha - 1.)) * (al + 5. / 6. - 2. / (3. * h)); x = alpha / (alpha + beta * Math.exp(2. * w)); } else { double lna = Math.log(alpha / (alpha + beta)); double lnb = Math.log(beta / (alpha + beta)); t = Math.exp(alpha * lna) / alpha; u = Math.exp(beta * lnb) / beta; w = t + u; if (p < t / w) { x = Math.pow(alpha * w * p, 1. / alpha); } else { x = 1. - Math.pow(beta * w * (1. - p), 1. / beta); } } afac = -Gamma.lgamma(alpha) - Gamma.lgamma(beta) + Gamma.lgamma(alpha + beta); for (int j = 0; j < 10; j++) { if (x == 0. || x == 1.) { return x; } err = regularizedIncompleteBetaFunction(alpha, beta, x) - p; t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1. - x) + afac); u = err / t; x -= (t = u / (1. - 0.5 * Math.min(1., u * (a1 / x - b1 / (1. - x))))); if (x <= 0.) { x = 0.5 * (x + t); } if (x >= 1.) { x = 0.5 * (x + t + 1.); } if (Math.abs(t) < EPS * x && j > 0) { break; } } return x; } }
public class class_name { public static double inverseRegularizedIncompleteBetaFunction(double alpha, double beta, double p) { final double EPS = 1.0E-8; double pp, t, u, err, x, al, h, w, afac; double a1 = alpha - 1.; double b1 = beta - 1.; if (p <= 0.0) { return 0.0; // depends on control dependency: [if], data = [none] } if (p >= 1.0) { return 1.0; // depends on control dependency: [if], data = [none] } if (alpha >= 1. && beta >= 1.) { pp = (p < 0.5) ? p : 1. - p; // depends on control dependency: [if], data = [none] t = Math.sqrt(-2. * Math.log(pp)); // depends on control dependency: [if], data = [none] x = (2.30753 + t * 0.27061) / (1. + t * (0.99229 + t * 0.04481)) - t; // depends on control dependency: [if], data = [none] if (p < 0.5) { x = -x; // depends on control dependency: [if], data = [none] } al = (x * x - 3.) / 6.; // depends on control dependency: [if], data = [none] h = 2. / (1. / (2. * alpha - 1.) + 1. / (2. * beta - 1.)); // depends on control dependency: [if], data = [none] w = (x * Math.sqrt(al + h) / h) - (1. / (2. * beta - 1) - 1. / (2. * alpha - 1.)) * (al + 5. / 6. - 2. / (3. * h)); // depends on control dependency: [if], data = [none] x = alpha / (alpha + beta * Math.exp(2. * w)); // depends on control dependency: [if], data = [(alpha] } else { double lna = Math.log(alpha / (alpha + beta)); double lnb = Math.log(beta / (alpha + beta)); t = Math.exp(alpha * lna) / alpha; // depends on control dependency: [if], data = [(alpha] u = Math.exp(beta * lnb) / beta; // depends on control dependency: [if], data = [none] w = t + u; // depends on control dependency: [if], data = [none] if (p < t / w) { x = Math.pow(alpha * w * p, 1. / alpha); // depends on control dependency: [if], data = [none] } else { x = 1. - Math.pow(beta * w * (1. - p), 1. / beta); // depends on control dependency: [if], data = [none] } } afac = -Gamma.lgamma(alpha) - Gamma.lgamma(beta) + Gamma.lgamma(alpha + beta); for (int j = 0; j < 10; j++) { if (x == 0. || x == 1.) { return x; // depends on control dependency: [if], data = [none] } err = regularizedIncompleteBetaFunction(alpha, beta, x) - p; // depends on control dependency: [for], data = [none] t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1. - x) + afac); // depends on control dependency: [for], data = [none] u = err / t; // depends on control dependency: [for], data = [none] x -= (t = u / (1. - 0.5 * Math.min(1., u * (a1 / x - b1 / (1. - x))))); // depends on control dependency: [for], data = [none] if (x <= 0.) { x = 0.5 * (x + t); // depends on control dependency: [if], data = [(x] } if (x >= 1.) { x = 0.5 * (x + t + 1.); // depends on control dependency: [if], data = [(x] } if (Math.abs(t) < EPS * x && j > 0) { break; } } return x; } }
public class class_name { private static String getMacAddress(@NonNull Context context) { if (isWifiStatePermissionGranted(context)) { WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo != null) { return wifiInfo.getMacAddress(); } } } return null; } }
public class class_name { private static String getMacAddress(@NonNull Context context) { if (isWifiStatePermissionGranted(context)) { WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo != null) { return wifiInfo.getMacAddress(); // depends on control dependency: [if], data = [none] } } } return null; } }