code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public ValidationMode getValidationMode() { // Convert this ValidationMode from the class defined // in JAXB (com.ibm.ws.jpa.pxml20.PersistenceUnitValidationModeType) // to JPA (javax.persistence.ValidationMode). ValidationMode rtnMode = null; PersistenceUnitValidationModeType jaxbMode = null; jaxbMode = ivPUnit.getValidationMode(); if (jaxbMode == PersistenceUnitValidationModeType.AUTO) { rtnMode = ValidationMode.AUTO; } else if (jaxbMode == PersistenceUnitValidationModeType.CALLBACK) { rtnMode = ValidationMode.CALLBACK; } else if (jaxbMode == PersistenceUnitValidationModeType.NONE) { rtnMode = ValidationMode.NONE; } return rtnMode; } }
public class class_name { @Override public ValidationMode getValidationMode() { // Convert this ValidationMode from the class defined // in JAXB (com.ibm.ws.jpa.pxml20.PersistenceUnitValidationModeType) // to JPA (javax.persistence.ValidationMode). ValidationMode rtnMode = null; PersistenceUnitValidationModeType jaxbMode = null; jaxbMode = ivPUnit.getValidationMode(); if (jaxbMode == PersistenceUnitValidationModeType.AUTO) { rtnMode = ValidationMode.AUTO; // depends on control dependency: [if], data = [none] } else if (jaxbMode == PersistenceUnitValidationModeType.CALLBACK) { rtnMode = ValidationMode.CALLBACK; // depends on control dependency: [if], data = [none] } else if (jaxbMode == PersistenceUnitValidationModeType.NONE) { rtnMode = ValidationMode.NONE; // depends on control dependency: [if], data = [none] } return rtnMode; } }
public class class_name { protected ConnectionWrapper checkOutFreePool(Transaction tx) { if (freePool.isEmpty()) { return null; } final FreeItem item = (FreeItem) freePool.removeLast(); final ConnectionWrapper wrapper = item.getConnection(); wrapper.init(tx); item.destroy(); if (validationQuery == null || validationQuery.isEmpty()) { return wrapper; } if (validateConnection(wrapper, item.getPooledTime())) { return wrapper; } return null; } }
public class class_name { protected ConnectionWrapper checkOutFreePool(Transaction tx) { if (freePool.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } final FreeItem item = (FreeItem) freePool.removeLast(); final ConnectionWrapper wrapper = item.getConnection(); wrapper.init(tx); item.destroy(); if (validationQuery == null || validationQuery.isEmpty()) { return wrapper; // depends on control dependency: [if], data = [none] } if (validateConnection(wrapper, item.getPooledTime())) { return wrapper; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public String getLink(CmsObject cms) { if (m_internal) { // if we have a local link, leave it unchanged // cms may be null for unit tests if ((cms == null) || (m_uri.length() == 0) || (m_uri.charAt(0) == '#')) { return m_uri; } checkConsistency(cms); //String target = replaceTargetWithDetailPageIfNecessary(cms, m_resource, m_target); String target = m_target; String uri = computeUri(target, m_query, m_anchor); CmsObjectWrapper wrapper = (CmsObjectWrapper)cms.getRequestContext().getAttribute( CmsObjectWrapper.ATTRIBUTE_NAME); if (wrapper != null) { // if an object wrapper is used, rewrite the URI m_uri = wrapper.rewriteLink(m_uri); uri = wrapper.rewriteLink(uri); } if ((cms.getRequestContext().getSiteRoot().length() == 0) && (cms.getRequestContext().getAttribute(CmsRequestContext.ATTRIBUTE_EDITOR) == null)) { // Explanation why this check is required: // If the site root name length is 0, this means that a user has switched // the site root to the root site "/" in the Workplace. // In this case the workplace site must also be the active site. // If the editor is opened in the root site, because of this code the links are // always generated _with_ server name / port so that the source code looks identical to code // that would normally be created when running in a regular site. // If normal link processing would be used, the site information in the link // would be lost. return OpenCms.getLinkManager().substituteLink(cms, uri); } // get the site root for this URI / link // if there is no site root, we either have a /system link, or the site was deleted, // return the full URI prefixed with the opencms context String siteRoot = getSiteRoot(); if (siteRoot == null) { return OpenCms.getLinkManager().substituteLink(cms, uri); } if (cms.getRequestContext().getAttribute(CmsRequestContext.ATTRIBUTE_FULLLINKS) != null) { // full links should be generated even if we are in the same site return OpenCms.getLinkManager().getServerLink(cms, uri); } // return the link with the server prefix, if necessary return OpenCms.getLinkManager().substituteLink(cms, getSitePath(uri), siteRoot); } else { // don't touch external links return m_uri; } } }
public class class_name { public String getLink(CmsObject cms) { if (m_internal) { // if we have a local link, leave it unchanged // cms may be null for unit tests if ((cms == null) || (m_uri.length() == 0) || (m_uri.charAt(0) == '#')) { return m_uri; // depends on control dependency: [if], data = [none] } checkConsistency(cms); // depends on control dependency: [if], data = [none] //String target = replaceTargetWithDetailPageIfNecessary(cms, m_resource, m_target); String target = m_target; String uri = computeUri(target, m_query, m_anchor); CmsObjectWrapper wrapper = (CmsObjectWrapper)cms.getRequestContext().getAttribute( CmsObjectWrapper.ATTRIBUTE_NAME); if (wrapper != null) { // if an object wrapper is used, rewrite the URI m_uri = wrapper.rewriteLink(m_uri); // depends on control dependency: [if], data = [none] uri = wrapper.rewriteLink(uri); // depends on control dependency: [if], data = [none] } if ((cms.getRequestContext().getSiteRoot().length() == 0) && (cms.getRequestContext().getAttribute(CmsRequestContext.ATTRIBUTE_EDITOR) == null)) { // Explanation why this check is required: // If the site root name length is 0, this means that a user has switched // the site root to the root site "/" in the Workplace. // In this case the workplace site must also be the active site. // If the editor is opened in the root site, because of this code the links are // always generated _with_ server name / port so that the source code looks identical to code // that would normally be created when running in a regular site. // If normal link processing would be used, the site information in the link // would be lost. return OpenCms.getLinkManager().substituteLink(cms, uri); // depends on control dependency: [if], data = [none] } // get the site root for this URI / link // if there is no site root, we either have a /system link, or the site was deleted, // return the full URI prefixed with the opencms context String siteRoot = getSiteRoot(); if (siteRoot == null) { return OpenCms.getLinkManager().substituteLink(cms, uri); // depends on control dependency: [if], data = [none] } if (cms.getRequestContext().getAttribute(CmsRequestContext.ATTRIBUTE_FULLLINKS) != null) { // full links should be generated even if we are in the same site return OpenCms.getLinkManager().getServerLink(cms, uri); // depends on control dependency: [if], data = [none] } // return the link with the server prefix, if necessary return OpenCms.getLinkManager().substituteLink(cms, getSitePath(uri), siteRoot); // depends on control dependency: [if], data = [none] } else { // don't touch external links return m_uri; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T extends Number> double getAverage(Collection<T> values, AVERAGE_TYPE type) { switch(type) { case ARITHMETIC: double sum = 0.0; for(T t: values) { sum += t.doubleValue(); } return sum/values.size(); default: throw new IllegalArgumentException("\""+type+"\" is not a valid verage-type!"); } } }
public class class_name { public static <T extends Number> double getAverage(Collection<T> values, AVERAGE_TYPE type) { switch(type) { case ARITHMETIC: double sum = 0.0; for(T t: values) { sum += t.doubleValue(); // depends on control dependency: [for], data = [t] } return sum/values.size(); default: throw new IllegalArgumentException("\""+type+"\" is not a valid verage-type!"); } } }
public class class_name { protected String classifyWarning(final String message) { if (StringUtils.contains(message, "proprietary")) { return PROPRIETARY_API; } if (StringUtils.contains(message, "deprecated")) { return DEPRECATION; } return StringUtils.EMPTY; } }
public class class_name { protected String classifyWarning(final String message) { if (StringUtils.contains(message, "proprietary")) { return PROPRIETARY_API; // depends on control dependency: [if], data = [none] } if (StringUtils.contains(message, "deprecated")) { return DEPRECATION; // depends on control dependency: [if], data = [none] } return StringUtils.EMPTY; } }
public class class_name { private Response partialUpdateEntityAttrByGuid(String guid, String property, HttpServletRequest request) { String value = null; try { Preconditions.checkNotNull(property, "Entity property cannot be null"); value = Servlets.getRequestPayload(request); Preconditions.checkNotNull(value, "Entity value cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug("Updating entity {} for property {} = {}", guid, property, value); } EntityMutationResponse mutationResponse = entitiesStore.updateEntityAttributeByGuid(guid, property, value); CreateUpdateEntitiesResult result = restAdapters.toCreateUpdateEntitiesResult(mutationResponse); if (LOG.isDebugEnabled()) { LOG.debug("Updated entities: {}", result.getEntityResult()); } JSONObject response = getResponse(result); return Response.ok(response).build(); } catch (AtlasBaseException e) { LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw toWebApplicationException(e); } catch (EntityNotFoundException e) { LOG.error("An entity with GUID={} does not exist {} ", guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND)); } catch (AtlasException | IllegalArgumentException e) { LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (WebApplicationException e) { LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw e; } catch (Throwable e) { LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); } } }
public class class_name { private Response partialUpdateEntityAttrByGuid(String guid, String property, HttpServletRequest request) { String value = null; try { Preconditions.checkNotNull(property, "Entity property cannot be null"); // depends on control dependency: [try], data = [none] value = Servlets.getRequestPayload(request); // depends on control dependency: [try], data = [none] Preconditions.checkNotNull(value, "Entity value cannot be null"); // depends on control dependency: [try], data = [none] if (LOG.isDebugEnabled()) { LOG.debug("Updating entity {} for property {} = {}", guid, property, value); // depends on control dependency: [if], data = [none] } EntityMutationResponse mutationResponse = entitiesStore.updateEntityAttributeByGuid(guid, property, value); CreateUpdateEntitiesResult result = restAdapters.toCreateUpdateEntitiesResult(mutationResponse); if (LOG.isDebugEnabled()) { LOG.debug("Updated entities: {}", result.getEntityResult()); // depends on control dependency: [if], data = [none] } JSONObject response = getResponse(result); return Response.ok(response).build(); // depends on control dependency: [try], data = [none] } catch (AtlasBaseException e) { LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw toWebApplicationException(e); } catch (EntityNotFoundException e) { // depends on control dependency: [catch], data = [none] LOG.error("An entity with GUID={} does not exist {} ", guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND)); } catch (AtlasException | IllegalArgumentException e) { // depends on control dependency: [catch], data = [none] LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (WebApplicationException e) { // depends on control dependency: [catch], data = [none] LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw e; } catch (Throwable e) { // depends on control dependency: [catch], data = [none] LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void run() { while (true) { final long start = System.currentTimeMillis(); long remaining; Cache c; synchronized (lock) { c = cache; remaining = sweepInterval * 1000; while (remaining > 0 && cache != null) { try { lock.wait(remaining); } catch (final InterruptedException e) {} remaining = start + sweepInterval * 1000 - System.currentTimeMillis(); } if (cache == null) break; } c.removeExpired(); } } }
public class class_name { public void run() { while (true) { final long start = System.currentTimeMillis(); long remaining; Cache c; synchronized (lock) { // depends on control dependency: [while], data = [none] c = cache; remaining = sweepInterval * 1000; while (remaining > 0 && cache != null) { try { lock.wait(remaining); // depends on control dependency: [try], data = [none] } catch (final InterruptedException e) {} // depends on control dependency: [catch], data = [none] remaining = start + sweepInterval * 1000 - System.currentTimeMillis(); // depends on control dependency: [while], data = [none] } if (cache == null) break; } c.removeExpired(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public static void premain(String agentArgument, Instrumentation instrumentation) { // We cannot do sanity checks for slf4j here as the jars loaded // by the application are not visible here. LogTransformer.Builder builder = new LogTransformer.Builder(); builder = builder.addEntryExit(true); if (agentArgument != null) { Properties args = parseArguments(agentArgument, ","); if (args.containsKey(AgentOptions.VERBOSE)) { builder = builder.verbose(true); } if (args.containsKey(AgentOptions.TIME)) { printStartStopTimes(); } if (args.containsKey(AgentOptions.IGNORE)) { String ignore = args.getProperty(AgentOptions.IGNORE); builder = builder.ignore(ignore.split(":")); } if (args.containsKey(AgentOptions.LEVEL)) { builder = builder.level(args.getProperty(AgentOptions.LEVEL)); } } instrumentation.addTransformer(builder.build()); } }
public class class_name { public static void premain(String agentArgument, Instrumentation instrumentation) { // We cannot do sanity checks for slf4j here as the jars loaded // by the application are not visible here. LogTransformer.Builder builder = new LogTransformer.Builder(); builder = builder.addEntryExit(true); if (agentArgument != null) { Properties args = parseArguments(agentArgument, ","); if (args.containsKey(AgentOptions.VERBOSE)) { builder = builder.verbose(true); // depends on control dependency: [if], data = [none] } if (args.containsKey(AgentOptions.TIME)) { printStartStopTimes(); // depends on control dependency: [if], data = [none] } if (args.containsKey(AgentOptions.IGNORE)) { String ignore = args.getProperty(AgentOptions.IGNORE); builder = builder.ignore(ignore.split(":")); // depends on control dependency: [if], data = [none] } if (args.containsKey(AgentOptions.LEVEL)) { builder = builder.level(args.getProperty(AgentOptions.LEVEL)); // depends on control dependency: [if], data = [none] } } instrumentation.addTransformer(builder.build()); } }
public class class_name { public void generateFiles(File directory) throws IOException { if (packageName != null && !packageName.trim().isEmpty()) { String packageDir = packageName.replace(".", File.separator); if (!directory.getAbsolutePath().endsWith(packageDir)) { directory = new File(directory, packageDir); } } directory.mkdirs(); HollowAPIClassJavaGenerator apiClassGenerator = new HollowAPIClassJavaGenerator(packageName, apiClassname, dataset, parameterizeClassNames, config); HollowAPIFactoryJavaGenerator apiFactoryGenerator = new HollowAPIFactoryJavaGenerator(packageName, apiClassname, dataset, config); HollowHashIndexGenerator hashIndexGenerator = new HollowHashIndexGenerator(packageName, apiClassname, dataset, config); generateFile(directory, apiClassGenerator); generateFile(directory, apiFactoryGenerator); generateFile(directory, hashIndexGenerator); generateFilesForHollowSchemas(directory); } }
public class class_name { public void generateFiles(File directory) throws IOException { if (packageName != null && !packageName.trim().isEmpty()) { String packageDir = packageName.replace(".", File.separator); if (!directory.getAbsolutePath().endsWith(packageDir)) { directory = new File(directory, packageDir); // depends on control dependency: [if], data = [none] } } directory.mkdirs(); HollowAPIClassJavaGenerator apiClassGenerator = new HollowAPIClassJavaGenerator(packageName, apiClassname, dataset, parameterizeClassNames, config); HollowAPIFactoryJavaGenerator apiFactoryGenerator = new HollowAPIFactoryJavaGenerator(packageName, apiClassname, dataset, config); HollowHashIndexGenerator hashIndexGenerator = new HollowHashIndexGenerator(packageName, apiClassname, dataset, config); generateFile(directory, apiClassGenerator); generateFile(directory, apiFactoryGenerator); generateFile(directory, hashIndexGenerator); generateFilesForHollowSchemas(directory); } }
public class class_name { public void onStoreUpdate( @Observes final ArtifactStorePreUpdateEvent event ) { logger.trace( "Got store-update event: {}", event ); if ( ArtifactStoreUpdateType.UPDATE == event.getType() ) { for ( ArtifactStore store : event ) { removeMetadataCacheContent( store, event.getChangeMap() ); } } } }
public class class_name { public void onStoreUpdate( @Observes final ArtifactStorePreUpdateEvent event ) { logger.trace( "Got store-update event: {}", event ); if ( ArtifactStoreUpdateType.UPDATE == event.getType() ) { for ( ArtifactStore store : event ) { removeMetadataCacheContent( store, event.getChangeMap() ); // depends on control dependency: [for], data = [store] } } } }
public class class_name { private void processDefinition(DestinationAliasDefinition definition) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processDefinition", definition); _definition = definition; // Null for BusHandler (foreign bus) // Null out previous cached settings first _forwardRoutingPath = null; _defaultFrp = null; _replyDest = null; _aliasDestinationAddr = null; _targetDestinationAddr = null; _hasScopedMessagePoints = false; _singleScopedQueuePointME = null; _scopedQueuePointMEs = null; if (_definition != null) { _aliasDestinationAddr = SIMPUtils.createJsDestinationAddress(_definition.getName(), null, getBus()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Alias destination address: " + _aliasDestinationAddr); _targetDestinationAddr = SIMPUtils.createJsDestinationAddress(getTargetName(), null, getTargetBus()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Target destination address: " + _targetDestinationAddr); // Convert array of names to list of jsDestinationAddresses for ForwardRoutingPath QualifiedDestinationName[] names = _definition.getForwardRoutingPath(); if (names != null) { _forwardRoutingPath = new ArrayList<JsDestinationAddress>(names.length); _defaultFrp = new SIDestinationAddress[names.length]; for (int name = 0; name < names.length; name++) { JsDestinationAddress address = SIMPUtils.createJsDestinationAddress(names[name].getDestination(), null, // ME never set via config names[name].getBus()); _forwardRoutingPath.add(address); _defaultFrp[name] = address; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Forward routing path [" + name + "]: " + address); } } // Create a JsDestinationAddress from the qualifiedName of the reply destination QualifiedDestinationName replyName = _definition.getReplyDestination(); if (replyName != null) { _replyDest = SIMPUtils.createJsDestinationAddress(replyName.getDestination(), messageProcessor.getMessagingEngineUuid(), replyName.getBus()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Reply destination: " + _replyDest); } SIBUuid8[] queuePoints = _definition.getScopedQueuePointMEs(); if ((queuePoints != null) && (queuePoints.length > 0)) { _hasScopedMessagePoints = true; if (queuePoints.length == 1) { _singleScopedQueuePointME = queuePoints[0]; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Single scoped Queue Point: " + queuePoints[0]); } else { _scopedQueuePointMEs = new HashSet<SIBUuid8>(); for (int i = 0; i < queuePoints.length; i++) { _scopedQueuePointMEs.add(queuePoints[i]); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Scoped Queue Point: " + queuePoints[i]); } } } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "No scoped Queue Point"); setReceiveAllowed(_definition); } else _isReceiveAllowed = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processDefinition"); } }
public class class_name { private void processDefinition(DestinationAliasDefinition definition) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "processDefinition", definition); _definition = definition; // Null for BusHandler (foreign bus) // Null out previous cached settings first _forwardRoutingPath = null; _defaultFrp = null; _replyDest = null; _aliasDestinationAddr = null; _targetDestinationAddr = null; _hasScopedMessagePoints = false; _singleScopedQueuePointME = null; _scopedQueuePointMEs = null; if (_definition != null) { _aliasDestinationAddr = SIMPUtils.createJsDestinationAddress(_definition.getName(), null, getBus()); // depends on control dependency: [if], data = [(_definition] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Alias destination address: " + _aliasDestinationAddr); _targetDestinationAddr = SIMPUtils.createJsDestinationAddress(getTargetName(), null, getTargetBus()); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Target destination address: " + _targetDestinationAddr); // Convert array of names to list of jsDestinationAddresses for ForwardRoutingPath QualifiedDestinationName[] names = _definition.getForwardRoutingPath(); if (names != null) { _forwardRoutingPath = new ArrayList<JsDestinationAddress>(names.length); // depends on control dependency: [if], data = [(names] _defaultFrp = new SIDestinationAddress[names.length]; // depends on control dependency: [if], data = [none] for (int name = 0; name < names.length; name++) { JsDestinationAddress address = SIMPUtils.createJsDestinationAddress(names[name].getDestination(), null, // ME never set via config names[name].getBus()); _forwardRoutingPath.add(address); // depends on control dependency: [for], data = [none] _defaultFrp[name] = address; // depends on control dependency: [for], data = [name] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Forward routing path [" + name + "]: " + address); } } // Create a JsDestinationAddress from the qualifiedName of the reply destination QualifiedDestinationName replyName = _definition.getReplyDestination(); if (replyName != null) { _replyDest = SIMPUtils.createJsDestinationAddress(replyName.getDestination(), messageProcessor.getMessagingEngineUuid(), replyName.getBus()); // depends on control dependency: [if], data = [(replyName] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Reply destination: " + _replyDest); } SIBUuid8[] queuePoints = _definition.getScopedQueuePointMEs(); if ((queuePoints != null) && (queuePoints.length > 0)) { _hasScopedMessagePoints = true; // depends on control dependency: [if], data = [none] if (queuePoints.length == 1) { _singleScopedQueuePointME = queuePoints[0]; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Single scoped Queue Point: " + queuePoints[0]); } else { _scopedQueuePointMEs = new HashSet<SIBUuid8>(); // depends on control dependency: [if], data = [none] for (int i = 0; i < queuePoints.length; i++) { _scopedQueuePointMEs.add(queuePoints[i]); // depends on control dependency: [for], data = [i] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Scoped Queue Point: " + queuePoints[i]); } } } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "No scoped Queue Point"); setReceiveAllowed(_definition); // depends on control dependency: [if], data = [(_definition] } else _isReceiveAllowed = true; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "processDefinition"); } }
public class class_name { public AbstractPrintQuery addAttribute(final String... _attrNames) throws EFapsException { final Type type = getMainType(); if (type != null) { for (final String attrName : _attrNames) { final Attribute attr = type.getAttribute(attrName); if (attr == null) { final AttributeSet set = AttributeSet.find(type.getName(), attrName); if (set != null) { addAttributeSet(set); } } else { addAttribute(attr); } } } return this; } }
public class class_name { public AbstractPrintQuery addAttribute(final String... _attrNames) throws EFapsException { final Type type = getMainType(); if (type != null) { for (final String attrName : _attrNames) { final Attribute attr = type.getAttribute(attrName); if (attr == null) { final AttributeSet set = AttributeSet.find(type.getName(), attrName); if (set != null) { addAttributeSet(set); // depends on control dependency: [if], data = [(set] } } else { addAttribute(attr); // depends on control dependency: [if], data = [(attr] } } } return this; } }
public class class_name { @Nullable V removeNoWriter(Object key) { Node<K, V> node = data.remove(nodeFactory.newLookupKey(key)); if (node == null) { return null; } V oldValue; synchronized (node) { oldValue = node.getValue(); if (node.isAlive()) { node.retire(); } } RemovalCause cause; if (oldValue == null) { cause = RemovalCause.COLLECTED; } else if (hasExpired(node, expirationTicker().read())) { cause = RemovalCause.EXPIRED; } else { cause = RemovalCause.EXPLICIT; } if (hasRemovalListener()) { @SuppressWarnings("unchecked") K castKey = (K) key; notifyRemoval(castKey, oldValue, cause); } afterWrite(new RemovalTask(node)); return (cause == RemovalCause.EXPLICIT) ? oldValue : null; } }
public class class_name { @Nullable V removeNoWriter(Object key) { Node<K, V> node = data.remove(nodeFactory.newLookupKey(key)); if (node == null) { return null; // depends on control dependency: [if], data = [none] } V oldValue; synchronized (node) { oldValue = node.getValue(); if (node.isAlive()) { node.retire(); // depends on control dependency: [if], data = [none] } } RemovalCause cause; if (oldValue == null) { cause = RemovalCause.COLLECTED; // depends on control dependency: [if], data = [none] } else if (hasExpired(node, expirationTicker().read())) { cause = RemovalCause.EXPIRED; // depends on control dependency: [if], data = [none] } else { cause = RemovalCause.EXPLICIT; // depends on control dependency: [if], data = [none] } if (hasRemovalListener()) { @SuppressWarnings("unchecked") K castKey = (K) key; notifyRemoval(castKey, oldValue, cause); // depends on control dependency: [if], data = [none] } afterWrite(new RemovalTask(node)); return (cause == RemovalCause.EXPLICIT) ? oldValue : null; } }
public class class_name { private int readRawVarint32(ByteBuffer bytes) { byte tmp = bytes.get(); if (tmp >= 0) { return tmp; } int result = tmp & 0x7f; if ((tmp = bytes.get()) >= 0) { result |= tmp << 7; } else { result |= (tmp & 0x7f) << 7; if ((tmp = bytes.get()) >= 0) { result |= tmp << 14; } else { result |= (tmp & 0x7f) << 14; if ((tmp = bytes.get()) >= 0) { result |= tmp << 21; } else { result |= (tmp & 0x7f) << 21; result |= (tmp = bytes.get()) << 28; if (tmp < 0) { // Discard upper 32 bits. for (int i = 0; i < 5; i++) { if (bytes.get() >= 0) { return result; } } connectionHandler.onException(new ScopeException("Error while reading raw int")); } } } } return result; } }
public class class_name { private int readRawVarint32(ByteBuffer bytes) { byte tmp = bytes.get(); if (tmp >= 0) { return tmp; // depends on control dependency: [if], data = [none] } int result = tmp & 0x7f; if ((tmp = bytes.get()) >= 0) { result |= tmp << 7; // depends on control dependency: [if], data = [none] } else { result |= (tmp & 0x7f) << 7; // depends on control dependency: [if], data = [none] if ((tmp = bytes.get()) >= 0) { result |= tmp << 14; // depends on control dependency: [if], data = [none] } else { result |= (tmp & 0x7f) << 14; // depends on control dependency: [if], data = [none] if ((tmp = bytes.get()) >= 0) { result |= tmp << 21; // depends on control dependency: [if], data = [none] } else { result |= (tmp & 0x7f) << 21; // depends on control dependency: [if], data = [none] result |= (tmp = bytes.get()) << 28; // depends on control dependency: [if], data = [none] if (tmp < 0) { // Discard upper 32 bits. for (int i = 0; i < 5; i++) { if (bytes.get() >= 0) { return result; // depends on control dependency: [if], data = [none] } } connectionHandler.onException(new ScopeException("Error while reading raw int")); // depends on control dependency: [if], data = [none] } } } } return result; } }
public class class_name { @Override public void show( Context context, final Entity entity, final SocialNetworkListener socialNetworkListener, final ShareDialogListener shareDialoglistener, final int displayOptions) { showDialog(context, new BeanCreationListener<SharePanelView>() { @Override public void onError(String name, Exception e) {} @Override public void onCreate(SharePanelView bean) { bean.setSocialNetworkListener(socialNetworkListener); bean.setEntity(entity); bean.setShareDialogListener(shareDialoglistener); bean.setDisplayOptions(displayOptions); bean.applyDisplayOptions(); bean.updateNetworkButtonState(); } }, new ShareDialogListener() { @Override public void onShow(Dialog dialog, SharePanelView dialogView) { recordEvent("show"); if(shareDialoglistener != null) { shareDialoglistener.onShow(dialog, dialogView); } } @Override public void onSimpleShare(ShareType type) { recordEvent("share", type.name()); if(shareDialoglistener != null) { shareDialoglistener.onSimpleShare(type); } } @Override public void onCancel(Dialog dialog) { recordEvent("close"); if(shareDialoglistener != null) { shareDialoglistener.onCancel(dialog); } } @Override public boolean onContinue(Dialog dialog, boolean remember, SocialNetwork... networks) { recordEvent("share", networks); return shareDialoglistener != null && shareDialoglistener.onContinue(dialog, remember, networks); } @Override public void onFlowInterrupted(DialogFlowController controller) { if(shareDialoglistener != null) { shareDialoglistener.onFlowInterrupted(controller); } } }); } }
public class class_name { @Override public void show( Context context, final Entity entity, final SocialNetworkListener socialNetworkListener, final ShareDialogListener shareDialoglistener, final int displayOptions) { showDialog(context, new BeanCreationListener<SharePanelView>() { @Override public void onError(String name, Exception e) {} @Override public void onCreate(SharePanelView bean) { bean.setSocialNetworkListener(socialNetworkListener); bean.setEntity(entity); bean.setShareDialogListener(shareDialoglistener); bean.setDisplayOptions(displayOptions); bean.applyDisplayOptions(); bean.updateNetworkButtonState(); } }, new ShareDialogListener() { @Override public void onShow(Dialog dialog, SharePanelView dialogView) { recordEvent("show"); if(shareDialoglistener != null) { shareDialoglistener.onShow(dialog, dialogView); // depends on control dependency: [if], data = [none] } } @Override public void onSimpleShare(ShareType type) { recordEvent("share", type.name()); if(shareDialoglistener != null) { shareDialoglistener.onSimpleShare(type); // depends on control dependency: [if], data = [none] } } @Override public void onCancel(Dialog dialog) { recordEvent("close"); if(shareDialoglistener != null) { shareDialoglistener.onCancel(dialog); // depends on control dependency: [if], data = [none] } } @Override public boolean onContinue(Dialog dialog, boolean remember, SocialNetwork... networks) { recordEvent("share", networks); return shareDialoglistener != null && shareDialoglistener.onContinue(dialog, remember, networks); } @Override public void onFlowInterrupted(DialogFlowController controller) { if(shareDialoglistener != null) { shareDialoglistener.onFlowInterrupted(controller); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public static void warning(String message, Throwable e) { if(message == null && e != null) { message = e.getMessage(); } logExpensive(Level.WARNING, message, e); } }
public class class_name { public static void warning(String message, Throwable e) { if(message == null && e != null) { message = e.getMessage(); // depends on control dependency: [if], data = [none] } logExpensive(Level.WARNING, message, e); } }
public class class_name { @Override public String doOCR(List<IIOImage> imageList, String filename, Rectangle rect) throws TesseractException { init(); setTessVariables(); try { StringBuilder sb = new StringBuilder(); int pageNum = 0; for (IIOImage oimage : imageList) { pageNum++; try { setImage(oimage.getRenderedImage(), rect); sb.append(getOCRText(filename, pageNum)); } catch (IOException ioe) { // skip the problematic image logger.error(ioe.getMessage(), ioe); } } if (renderedFormat == RenderedFormat.HOCR) { sb.insert(0, htmlBeginTag).append(htmlEndTag); } return sb.toString(); } finally { dispose(); } } }
public class class_name { @Override public String doOCR(List<IIOImage> imageList, String filename, Rectangle rect) throws TesseractException { init(); setTessVariables(); try { StringBuilder sb = new StringBuilder(); int pageNum = 0; for (IIOImage oimage : imageList) { pageNum++; // depends on control dependency: [for], data = [none] try { setImage(oimage.getRenderedImage(), rect); // depends on control dependency: [try], data = [none] sb.append(getOCRText(filename, pageNum)); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { // skip the problematic image logger.error(ioe.getMessage(), ioe); } // depends on control dependency: [catch], data = [none] } if (renderedFormat == RenderedFormat.HOCR) { sb.insert(0, htmlBeginTag).append(htmlEndTag); // depends on control dependency: [if], data = [none] } return sb.toString(); } finally { dispose(); } } }
public class class_name { @Override public void messageReceived(T message) { if (responseReceived != null) { if (responseReceived) { log.warn("Received more than one synchronous message reply!"); } else { log.warn("Received response message after timeout was hit!"); } } responseMessage = message; responseReceived = true; synchronized (lock) { lock.notify(); } } }
public class class_name { @Override public void messageReceived(T message) { if (responseReceived != null) { if (responseReceived) { log.warn("Received more than one synchronous message reply!"); // depends on control dependency: [if], data = [none] } else { log.warn("Received response message after timeout was hit!"); // depends on control dependency: [if], data = [none] } } responseMessage = message; responseReceived = true; synchronized (lock) { lock.notify(); } } }
public class class_name { public String getRequiredString(String name) { String value = getString(name, null); if (value != null) { return value.trim(); } throw new PippoRuntimeException("Setting '{}' has not been configured!", name); } }
public class class_name { public String getRequiredString(String name) { String value = getString(name, null); if (value != null) { return value.trim(); // depends on control dependency: [if], data = [none] } throw new PippoRuntimeException("Setting '{}' has not been configured!", name); } }
public class class_name { @Override protected String getFirst() { if (!rules_first.containsKey(getClass())) { for (Method method : getClass().getDeclaredMethods()) { if (method.getDeclaredAnnotation(First.class) != null) { rules_first.put(getClass(), method.getName()); LOG.info("[RuleController" + getClass().getName() + "]的第一步 = " + method.getName()); break; } } } return rules_first.get(getClass()); } }
public class class_name { @Override protected String getFirst() { if (!rules_first.containsKey(getClass())) { for (Method method : getClass().getDeclaredMethods()) { if (method.getDeclaredAnnotation(First.class) != null) { rules_first.put(getClass(), method.getName()); // depends on control dependency: [if], data = [none] LOG.info("[RuleController" + getClass().getName() + "]的第一步 = " + method.getName()); // depends on control dependency: [if], data = [none] break; } } } return rules_first.get(getClass()); } }
public class class_name { public static synchronized void checkMissingConfig() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Checking for missing config"); } if (delayedConfig.isEmpty()) { return; } delayCheckSignaled = false; final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework(); Map<String, Map<String, String[]>> parsed = extractConfig(delayedConfig); // check for missing factories from channel configs for (Entry<String, String[]> entry : parsed.get("channels").entrySet()) { for (String prop : entry.getValue()) { if ("type".equals(extractKey(prop))) { String factory = extractValue(prop); if (null == cf.lookupFactory(factory)) { if (tc.isWarningEnabled()) { Tr.warning(tc, "missing.factory", factory); } } } } } } }
public class class_name { public static synchronized void checkMissingConfig() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Checking for missing config"); // depends on control dependency: [if], data = [none] } if (delayedConfig.isEmpty()) { return; // depends on control dependency: [if], data = [none] } delayCheckSignaled = false; final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework(); Map<String, Map<String, String[]>> parsed = extractConfig(delayedConfig); // check for missing factories from channel configs for (Entry<String, String[]> entry : parsed.get("channels").entrySet()) { for (String prop : entry.getValue()) { if ("type".equals(extractKey(prop))) { String factory = extractValue(prop); if (null == cf.lookupFactory(factory)) { if (tc.isWarningEnabled()) { Tr.warning(tc, "missing.factory", factory); // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { public boolean distributeEnd(int flags) { if (tc.isEntryEnabled()) Tr.entry(tc, "distributeEnd", Util.printFlag(flags)); boolean result = true; for (int i = _resourceObjects.size(); --i >= 0;) { final JTAResource resource = _resourceObjects.get(i); if (!sendEnd(resource, flags)) { result = false; } } if (_sameRMResource != null) { if (!sendEnd(_sameRMResource, flags)) { result = false; } } if (tc.isEntryEnabled()) Tr.exit(tc, "distributeEnd", result); return result; } }
public class class_name { public boolean distributeEnd(int flags) { if (tc.isEntryEnabled()) Tr.entry(tc, "distributeEnd", Util.printFlag(flags)); boolean result = true; for (int i = _resourceObjects.size(); --i >= 0;) { final JTAResource resource = _resourceObjects.get(i); if (!sendEnd(resource, flags)) { result = false; // depends on control dependency: [if], data = [none] } } if (_sameRMResource != null) { if (!sendEnd(_sameRMResource, flags)) { result = false; // depends on control dependency: [if], data = [none] } } if (tc.isEntryEnabled()) Tr.exit(tc, "distributeEnd", result); return result; } }
public class class_name { protected void initDataSource() { if (dataSource == null) { if (dataSourceJndiName != null) { try { dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName); } catch (Exception e) { throw new ProcessEngineException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e); } } else if (jdbcUrl != null) { if ((jdbcDriver == null) || (jdbcUrl == null) || (jdbcUsername == null)) { throw new ProcessEngineException("DataSource or JDBC properties have to be specified in a process engine configuration"); } PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword); if (jdbcMaxActiveConnections > 0) { pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections); } if (jdbcMaxIdleConnections > 0) { pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections); } if (jdbcMaxCheckoutTime > 0) { pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime); } if (jdbcMaxWaitTime > 0) { pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime); } if (jdbcPingEnabled == true) { pooledDataSource.setPoolPingEnabled(true); if (jdbcPingQuery != null) { pooledDataSource.setPoolPingQuery(jdbcPingQuery); } pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor); } dataSource = pooledDataSource; } if (dataSource instanceof PooledDataSource) { // ACT-233: connection pool of Ibatis is not properely initialized if this is not called! ((PooledDataSource) dataSource).forceCloseAll(); } } if (databaseType == null) { initDatabaseType(); } } }
public class class_name { protected void initDataSource() { if (dataSource == null) { if (dataSourceJndiName != null) { try { dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new ProcessEngineException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } else if (jdbcUrl != null) { if ((jdbcDriver == null) || (jdbcUrl == null) || (jdbcUsername == null)) { throw new ProcessEngineException("DataSource or JDBC properties have to be specified in a process engine configuration"); } PooledDataSource pooledDataSource = new PooledDataSource(ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword); if (jdbcMaxActiveConnections > 0) { pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections); // depends on control dependency: [if], data = [(jdbcMaxActiveConnections] } if (jdbcMaxIdleConnections > 0) { pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections); // depends on control dependency: [if], data = [(jdbcMaxIdleConnections] } if (jdbcMaxCheckoutTime > 0) { pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime); // depends on control dependency: [if], data = [(jdbcMaxCheckoutTime] } if (jdbcMaxWaitTime > 0) { pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime); // depends on control dependency: [if], data = [(jdbcMaxWaitTime] } if (jdbcPingEnabled == true) { pooledDataSource.setPoolPingEnabled(true); // depends on control dependency: [if], data = [true)] if (jdbcPingQuery != null) { pooledDataSource.setPoolPingQuery(jdbcPingQuery); // depends on control dependency: [if], data = [(jdbcPingQuery] } pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor); // depends on control dependency: [if], data = [none] } dataSource = pooledDataSource; // depends on control dependency: [if], data = [none] } if (dataSource instanceof PooledDataSource) { // ACT-233: connection pool of Ibatis is not properely initialized if this is not called! ((PooledDataSource) dataSource).forceCloseAll(); // depends on control dependency: [if], data = [none] } } if (databaseType == null) { initDatabaseType(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private CmsAccessControlList getAccessControlList( CmsDbContext dbc, CmsResource resource, boolean inheritedOnly, boolean forFolder, int depth) throws CmsException { String cacheKey = getCacheKey( new String[] { inheritedOnly ? "+" : "-", forFolder ? "+" : "-", Integer.toString(depth), resource.getStructureId().toString()}, dbc); CmsAccessControlList acl = m_monitor.getCachedACL(cacheKey); // return the cached acl if already available if ((acl != null) && dbc.getProjectId().isNullUUID()) { return acl; } List<CmsAccessControlEntry> aces = getUserDriver(dbc).readAccessControlEntries( dbc, dbc.currentProject(), resource.getResourceId(), (depth > 1) || ((depth > 0) && forFolder)); // sort the list of aces boolean overwriteAll = sortAceList(aces); // if no 'overwrite all' ace was found if (!overwriteAll) { // get the acl of the parent CmsResource parentResource = null; try { // try to recurse over the id parentResource = getVfsDriver(dbc).readParentFolder( dbc, dbc.currentProject().getUuid(), resource.getStructureId()); } catch (CmsVfsResourceNotFoundException e) { // should never happen, but try with the path String parentPath = CmsResource.getParentFolder(resource.getRootPath()); if (parentPath != null) { parentResource = getVfsDriver(dbc).readFolder(dbc, dbc.currentProject().getUuid(), parentPath); } } if (parentResource != null) { acl = (CmsAccessControlList)getAccessControlList( dbc, parentResource, inheritedOnly, forFolder, depth + 1).clone(); } } if (acl == null) { acl = new CmsAccessControlList(); } if (!((depth == 0) && inheritedOnly)) { Iterator<CmsAccessControlEntry> itAces = aces.iterator(); while (itAces.hasNext()) { CmsAccessControlEntry acEntry = itAces.next(); if (depth > 0) { acEntry.setFlags(CmsAccessControlEntry.ACCESS_FLAGS_INHERITED); } acl.add(acEntry); // if the overwrite flag is set, reset the allowed permissions to the permissions of this entry // denied permissions are kept or extended if ((acEntry.getFlags() & CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE) > 0) { acl.setAllowedPermissions(acEntry); } } } if (dbc.getProjectId().isNullUUID()) { m_monitor.cacheACL(cacheKey, acl); } return acl; } }
public class class_name { private CmsAccessControlList getAccessControlList( CmsDbContext dbc, CmsResource resource, boolean inheritedOnly, boolean forFolder, int depth) throws CmsException { String cacheKey = getCacheKey( new String[] { inheritedOnly ? "+" : "-", forFolder ? "+" : "-", Integer.toString(depth), resource.getStructureId().toString()}, dbc); CmsAccessControlList acl = m_monitor.getCachedACL(cacheKey); // return the cached acl if already available if ((acl != null) && dbc.getProjectId().isNullUUID()) { return acl; } List<CmsAccessControlEntry> aces = getUserDriver(dbc).readAccessControlEntries( dbc, dbc.currentProject(), resource.getResourceId(), (depth > 1) || ((depth > 0) && forFolder)); // sort the list of aces boolean overwriteAll = sortAceList(aces); // if no 'overwrite all' ace was found if (!overwriteAll) { // get the acl of the parent CmsResource parentResource = null; try { // try to recurse over the id parentResource = getVfsDriver(dbc).readParentFolder( dbc, dbc.currentProject().getUuid(), resource.getStructureId()); // depends on control dependency: [try], data = [none] } catch (CmsVfsResourceNotFoundException e) { // should never happen, but try with the path String parentPath = CmsResource.getParentFolder(resource.getRootPath()); if (parentPath != null) { parentResource = getVfsDriver(dbc).readFolder(dbc, dbc.currentProject().getUuid(), parentPath); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] if (parentResource != null) { acl = (CmsAccessControlList)getAccessControlList( dbc, parentResource, inheritedOnly, forFolder, depth + 1).clone(); // depends on control dependency: [if], data = [none] } } if (acl == null) { acl = new CmsAccessControlList(); } if (!((depth == 0) && inheritedOnly)) { Iterator<CmsAccessControlEntry> itAces = aces.iterator(); while (itAces.hasNext()) { CmsAccessControlEntry acEntry = itAces.next(); if (depth > 0) { acEntry.setFlags(CmsAccessControlEntry.ACCESS_FLAGS_INHERITED); // depends on control dependency: [if], data = [none] } acl.add(acEntry); // depends on control dependency: [while], data = [none] // if the overwrite flag is set, reset the allowed permissions to the permissions of this entry // denied permissions are kept or extended if ((acEntry.getFlags() & CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE) > 0) { acl.setAllowedPermissions(acEntry); // depends on control dependency: [if], data = [none] } } } if (dbc.getProjectId().isNullUUID()) { m_monitor.cacheACL(cacheKey, acl); } return acl; } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); if (!isInitialised()) { rb2.setSelected(true); rb3.setToolTip("This is disabled."); setInitialised(true); } } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); if (!isInitialised()) { rb2.setSelected(true); // depends on control dependency: [if], data = [none] rb3.setToolTip("This is disabled."); // depends on control dependency: [if], data = [none] setInitialised(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { private int determineHeartbeatInterval(Map properties) { // How often should we heartbeat? int heartbeatInterval = JFapChannelConstants.DEFAULT_HEARTBEAT_INTERVAL; try { heartbeatInterval = Integer.parseInt(RuntimeInfo.getProperty(JFapChannelConstants.RUNTIMEINFO_KEY_HEARTBEAT_INTERVAL, "" + heartbeatInterval)); } catch (NumberFormatException nfe) { // No FFDC code needed } if (properties != null) { String intervalStr = (String) properties.get(JFapChannelConstants.CHANNEL_CONFIG_HEARTBEAT_INTERVAL_PROPERTY); if (intervalStr != null) { try { heartbeatInterval = Integer.parseInt(intervalStr); } catch (NumberFormatException nfe) { // No FFDC code needed } } } return heartbeatInterval; } }
public class class_name { private int determineHeartbeatInterval(Map properties) { // How often should we heartbeat? int heartbeatInterval = JFapChannelConstants.DEFAULT_HEARTBEAT_INTERVAL; try { heartbeatInterval = Integer.parseInt(RuntimeInfo.getProperty(JFapChannelConstants.RUNTIMEINFO_KEY_HEARTBEAT_INTERVAL, "" + heartbeatInterval)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { // No FFDC code needed } // depends on control dependency: [catch], data = [none] if (properties != null) { String intervalStr = (String) properties.get(JFapChannelConstants.CHANNEL_CONFIG_HEARTBEAT_INTERVAL_PROPERTY); if (intervalStr != null) { try { heartbeatInterval = Integer.parseInt(intervalStr); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { // No FFDC code needed } // depends on control dependency: [catch], data = [none] } } return heartbeatInterval; } }
public class class_name { public void importGit(ProgressMonitor... monitors) throws IOException { if (inProgress) throw new IOException("Asset already in progress..."); try { inProgress = true; Props props = new Props(this); VcInfo vcInfo = new VcInfo(getGitRoot(), props); getOut().println("Importing from Git into: " + getProjectDir() + "..."); // CLI dependencies Git git = new Git(getReleasesUrl(), vcInfo, "checkVersionConsistency", vcInfo.getBranch(), getAssetLoc()); git.run(monitors); // Check Asset inconsistencies Vercheck vercheck = new Vercheck(); vercheck.setConfigLoc(getConfigLoc()); vercheck.setAssetLoc(getAssetLoc()); vercheck.setGitRoot(getGitRoot()); vercheck.setDebug(true); vercheck.run(); if (vercheck.getErrorCount() > 0) { throw new IOException("Asset version conflict(s). See log for details"); } // perform import (Git pull) git = new Git(getReleasesUrl(), vcInfo, "hardCheckout", vcInfo.getBranch(), isHardReset()); git.run(monitors); // capture new Refs in ASSET_REF after import (Git pull) DbInfo dbInfo = new DbInfo(props); Checkpoint checkpoint = new Checkpoint(getReleasesUrl(), vcInfo, getAssetRoot(), dbInfo); try { checkpoint.run(monitors).updateRefs(); } catch (SQLException ex) { throw new IOException(ex.getMessage(), ex); } } catch (Throwable ex) { if (ex instanceof IOException) throw ex; else throw new IOException(ex.getMessage(), ex); } finally { inProgress = false; } } }
public class class_name { public void importGit(ProgressMonitor... monitors) throws IOException { if (inProgress) throw new IOException("Asset already in progress..."); try { inProgress = true; // depends on control dependency: [try], data = [none] Props props = new Props(this); VcInfo vcInfo = new VcInfo(getGitRoot(), props); getOut().println("Importing from Git into: " + getProjectDir() + "..."); // depends on control dependency: [try], data = [none] // CLI dependencies Git git = new Git(getReleasesUrl(), vcInfo, "checkVersionConsistency", vcInfo.getBranch(), getAssetLoc()); git.run(monitors); // depends on control dependency: [try], data = [none] // Check Asset inconsistencies Vercheck vercheck = new Vercheck(); vercheck.setConfigLoc(getConfigLoc()); // depends on control dependency: [try], data = [none] vercheck.setAssetLoc(getAssetLoc()); // depends on control dependency: [try], data = [none] vercheck.setGitRoot(getGitRoot()); // depends on control dependency: [try], data = [none] vercheck.setDebug(true); // depends on control dependency: [try], data = [none] vercheck.run(); // depends on control dependency: [try], data = [none] if (vercheck.getErrorCount() > 0) { throw new IOException("Asset version conflict(s). See log for details"); } // perform import (Git pull) git = new Git(getReleasesUrl(), vcInfo, "hardCheckout", vcInfo.getBranch(), isHardReset()); // depends on control dependency: [try], data = [none] git.run(monitors); // depends on control dependency: [try], data = [none] // capture new Refs in ASSET_REF after import (Git pull) DbInfo dbInfo = new DbInfo(props); Checkpoint checkpoint = new Checkpoint(getReleasesUrl(), vcInfo, getAssetRoot(), dbInfo); try { checkpoint.run(monitors).updateRefs(); // depends on control dependency: [try], data = [none] } catch (SQLException ex) { throw new IOException(ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] } catch (Throwable ex) { if (ex instanceof IOException) throw ex; else throw new IOException(ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] finally { inProgress = false; } } }
public class class_name { public static int getIdFor(Class<? extends Tag> clazz) { if(!tagToId.containsKey(clazz)) { return -1; } return tagToId.get(clazz); } }
public class class_name { public static int getIdFor(Class<? extends Tag> clazz) { if(!tagToId.containsKey(clazz)) { return -1; // depends on control dependency: [if], data = [none] } return tagToId.get(clazz); } }
public class class_name { public List<WordLemmaTag> getStanfordWordLemmaTags() { List<AgigaToken> tokens = getTokens(); List<WordLemmaTag> labels = new ArrayList<WordLemmaTag>(); for (int i = 0; i < tokens.size(); i++) { AgigaToken at = tokens.get(i); WordLemmaTag curToken; require(prefs.readWord, "AgigaPrefs.readWord must be true for getStanfordWordLemmaTags()"); if (prefs.readWord && prefs.readLemma && prefs.readPos) { curToken = new WordLemmaTag(at.getWord(), at.getLemma(), at.getPosTag()); } else if (prefs.readWord && prefs.readPos) { curToken = new WordLemmaTag(at.getWord(), at.getPosTag()); } else { // if (prefs.readWord) { curToken = new WordLemmaTag(at.getWord()); } labels.add(curToken); } return labels; } }
public class class_name { public List<WordLemmaTag> getStanfordWordLemmaTags() { List<AgigaToken> tokens = getTokens(); List<WordLemmaTag> labels = new ArrayList<WordLemmaTag>(); for (int i = 0; i < tokens.size(); i++) { AgigaToken at = tokens.get(i); WordLemmaTag curToken; require(prefs.readWord, "AgigaPrefs.readWord must be true for getStanfordWordLemmaTags()"); // depends on control dependency: [for], data = [none] if (prefs.readWord && prefs.readLemma && prefs.readPos) { curToken = new WordLemmaTag(at.getWord(), at.getLemma(), at.getPosTag()); // depends on control dependency: [if], data = [none] } else if (prefs.readWord && prefs.readPos) { curToken = new WordLemmaTag(at.getWord(), at.getPosTag()); // depends on control dependency: [if], data = [none] } else { // if (prefs.readWord) { curToken = new WordLemmaTag(at.getWord()); // depends on control dependency: [if], data = [none] } labels.add(curToken); // depends on control dependency: [for], data = [none] } return labels; } }
public class class_name { private List<Event> filterEvents(List<Event> events) { List<Event> filteredEvents = new ArrayList<Event>(); for (Event event : events) { if (!filter(event)) { filteredEvents.add(event); } } return filteredEvents; } }
public class class_name { private List<Event> filterEvents(List<Event> events) { List<Event> filteredEvents = new ArrayList<Event>(); for (Event event : events) { if (!filter(event)) { filteredEvents.add(event); // depends on control dependency: [if], data = [none] } } return filteredEvents; } }
public class class_name { public void marshall(ListEventSubscriptionsRequest listEventSubscriptionsRequest, ProtocolMarshaller protocolMarshaller) { if (listEventSubscriptionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listEventSubscriptionsRequest.getResourceArn(), RESOURCEARN_BINDING); protocolMarshaller.marshall(listEventSubscriptionsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listEventSubscriptionsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListEventSubscriptionsRequest listEventSubscriptionsRequest, ProtocolMarshaller protocolMarshaller) { if (listEventSubscriptionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listEventSubscriptionsRequest.getResourceArn(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listEventSubscriptionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listEventSubscriptionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Object resolveObject(String aKey, UResourceBundle requested) { if (getType() == STRING) { return getString(); } UResourceBundle obj = handleGet(aKey, null, requested); if (obj != null) { if (obj.getType() == STRING) { return obj.getString(); } try { if (obj.getType() == ARRAY) { return obj.handleGetStringArray(); } } catch (UResourceTypeMismatchException ex) { return obj; } } return obj; } }
public class class_name { private Object resolveObject(String aKey, UResourceBundle requested) { if (getType() == STRING) { return getString(); // depends on control dependency: [if], data = [none] } UResourceBundle obj = handleGet(aKey, null, requested); if (obj != null) { if (obj.getType() == STRING) { return obj.getString(); // depends on control dependency: [if], data = [none] } try { if (obj.getType() == ARRAY) { return obj.handleGetStringArray(); // depends on control dependency: [if], data = [none] } } catch (UResourceTypeMismatchException ex) { return obj; } // depends on control dependency: [catch], data = [none] } return obj; } }
public class class_name { @SuppressWarnings("unchecked") public void scrollToTop() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollToTop()"); } View recyclerView = viewFetcher.getRecyclerView(true, 0); if(recyclerView != null){ waiter.waitForViews(true, AbsListView.class, ScrollView.class, WebView.class, recyclerView.getClass()); } else { waiter.waitForViews(true, AbsListView.class, ScrollView.class, WebView.class); } scroller.scroll(Scroller.UP, true); } }
public class class_name { @SuppressWarnings("unchecked") public void scrollToTop() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollToTop()"); // depends on control dependency: [if], data = [none] } View recyclerView = viewFetcher.getRecyclerView(true, 0); if(recyclerView != null){ waiter.waitForViews(true, AbsListView.class, ScrollView.class, WebView.class, recyclerView.getClass()); // depends on control dependency: [if], data = [none] } else { waiter.waitForViews(true, AbsListView.class, ScrollView.class, WebView.class); // depends on control dependency: [if], data = [none] } scroller.scroll(Scroller.UP, true); } }
public class class_name { @Override public void engineReloaded(Object newEngine) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "engineReloaded", newEngine); // At this point, a dynamic configuartion change has occurred, admin // have updated all our // localized destinations and we should now make use of the new // configuration and drive // the update of any remote destinations if needed _engine = (JsMessagingEngine) newEngine; if (_busReloaded) { // The bus-wide definitions did change so we must refresh the // destinations that are // not localised to this ME. _dynamicConfigManager.refreshDestinations(); } // Reset the indicator that bus-wide definitions have changed, now that // the updates have // been made. _busReloaded = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "engineReloaded"); } }
public class class_name { @Override public void engineReloaded(Object newEngine) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "engineReloaded", newEngine); // At this point, a dynamic configuartion change has occurred, admin // have updated all our // localized destinations and we should now make use of the new // configuration and drive // the update of any remote destinations if needed _engine = (JsMessagingEngine) newEngine; if (_busReloaded) { // The bus-wide definitions did change so we must refresh the // destinations that are // not localised to this ME. _dynamicConfigManager.refreshDestinations(); // depends on control dependency: [if], data = [none] } // Reset the indicator that bus-wide definitions have changed, now that // the updates have // been made. _busReloaded = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "engineReloaded"); } }
public class class_name { @Override public Object getDraggableObjectAtPoint(final PointInfo pt) { if (this.isAnimating()) { // Zoom animations use the mMultiTouchScale variables to perform their animations so we // don't want to step on that. return null; } else { setMultiTouchScaleInitPoint(pt.getX(), pt.getY()); return this; } } }
public class class_name { @Override public Object getDraggableObjectAtPoint(final PointInfo pt) { if (this.isAnimating()) { // Zoom animations use the mMultiTouchScale variables to perform their animations so we // don't want to step on that. return null; // depends on control dependency: [if], data = [none] } else { setMultiTouchScaleInitPoint(pt.getX(), pt.getY()); // depends on control dependency: [if], data = [none] return this; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nullable public <R, A> R collect(@NotNull Collector<? super T, A, R> collector) { A container = collector.supplier().get(); while (iterator.hasNext()) { final T value = iterator.next(); collector.accumulator().accept(container, value); } return collector.finisher().apply(container); } }
public class class_name { @Nullable public <R, A> R collect(@NotNull Collector<? super T, A, R> collector) { A container = collector.supplier().get(); while (iterator.hasNext()) { final T value = iterator.next(); collector.accumulator().accept(container, value); // depends on control dependency: [while], data = [none] } return collector.finisher().apply(container); } }
public class class_name { protected Entry<K, V> get(K k) { Entry<K, V> currentNode = mStart; while (currentNode != null) { if (currentNode.mKey.equals(k)) { break; } currentNode = currentNode.mNext; } return currentNode; } }
public class class_name { protected Entry<K, V> get(K k) { Entry<K, V> currentNode = mStart; while (currentNode != null) { if (currentNode.mKey.equals(k)) { break; } currentNode = currentNode.mNext; // depends on control dependency: [while], data = [none] } return currentNode; } }
public class class_name { public static String buildSelectSQL(BeanDescFactory beanDescFactory, EntityOperator entityOperator, Class<?> clazz, NameConverter nameConverter){ StringBuilder sb = new StringBuilder(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); sb.append("SELECT * FROM "); sb.append(MirageUtil.getTableName(clazz, nameConverter)); sb.append(" WHERE "); int count = 0; for(int i=0; i<beanDesc.getPropertyDescSize(); i++){ PropertyDesc pd = beanDesc.getPropertyDesc(i); PrimaryKeyInfo primaryKey = entityOperator.getPrimaryKeyInfo(clazz, pd, nameConverter); if(primaryKey != null){ if(count != 0){ sb.append(" AND "); } sb.append(MirageUtil.getColumnName(entityOperator, clazz, pd, nameConverter)); sb.append(" = ?"); count++; } } if(count == 0){ throw new RuntimeException( "Primary key is not found: " + clazz.getName()); } return sb.toString(); } }
public class class_name { public static String buildSelectSQL(BeanDescFactory beanDescFactory, EntityOperator entityOperator, Class<?> clazz, NameConverter nameConverter){ StringBuilder sb = new StringBuilder(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); sb.append("SELECT * FROM "); sb.append(MirageUtil.getTableName(clazz, nameConverter)); sb.append(" WHERE "); int count = 0; for(int i=0; i<beanDesc.getPropertyDescSize(); i++){ PropertyDesc pd = beanDesc.getPropertyDesc(i); PrimaryKeyInfo primaryKey = entityOperator.getPrimaryKeyInfo(clazz, pd, nameConverter); if(primaryKey != null){ if(count != 0){ sb.append(" AND "); // depends on control dependency: [if], data = [none] } sb.append(MirageUtil.getColumnName(entityOperator, clazz, pd, nameConverter)); // depends on control dependency: [if], data = [none] sb.append(" = ?"); // depends on control dependency: [if], data = [none] count++; // depends on control dependency: [if], data = [none] } } if(count == 0){ throw new RuntimeException( "Primary key is not found: " + clazz.getName()); } return sb.toString(); } }
public class class_name { protected void before(HttpServletRequest request, HttpServletResponse response) { final StringBuilder sb = new StringBuilder(); final String beginDecoration; if (isSubRequestUrl(request)) { beginDecoration = "- - - - - - - - - - {SUB BEGIN}: "; } else { // mainly here beginDecoration = "* * * * * * * * * * {BEGIN}: "; } sb.append(beginDecoration); sb.append(getTitlePath(request)); sb.append(LF).append(IND); buildRequestInfo(sb, request, response, /*showResponse*/false, /*showErrorFlush*/false); logger.debug(sb.toString().trim()); } }
public class class_name { protected void before(HttpServletRequest request, HttpServletResponse response) { final StringBuilder sb = new StringBuilder(); final String beginDecoration; if (isSubRequestUrl(request)) { beginDecoration = "- - - - - - - - - - {SUB BEGIN}: "; // depends on control dependency: [if], data = [none] } else { // mainly here beginDecoration = "* * * * * * * * * * {BEGIN}: "; // depends on control dependency: [if], data = [none] } sb.append(beginDecoration); sb.append(getTitlePath(request)); sb.append(LF).append(IND); buildRequestInfo(sb, request, response, /*showResponse*/false, /*showErrorFlush*/false); logger.debug(sb.toString().trim()); } }
public class class_name { public static String addResourcePathToPackagePath(Class<?> clazz, String resourceName) { Preconditions.checkNotNull(resourceName, "Resource name must not be null"); if (!resourceName.startsWith("/")) { return classPackageAsResourcePath(clazz) + "/" + resourceName; } return classPackageAsResourcePath(clazz) + resourceName; } }
public class class_name { public static String addResourcePathToPackagePath(Class<?> clazz, String resourceName) { Preconditions.checkNotNull(resourceName, "Resource name must not be null"); if (!resourceName.startsWith("/")) { return classPackageAsResourcePath(clazz) + "/" + resourceName; // depends on control dependency: [if], data = [none] } return classPackageAsResourcePath(clazz) + resourceName; } }
public class class_name { @Pure public List<File> getClassPath() { if (this.classpath == null) { return Collections.emptyList(); } return Collections.unmodifiableList(this.classpath); } }
public class class_name { @Pure public List<File> getClassPath() { if (this.classpath == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return Collections.unmodifiableList(this.classpath); } }
public class class_name { public void controlEventHandler(final ControlEventHandler controlEventHandler) { env.setControlEventHandler(new ControlEventHandler() { @Override public void onEvent(ChannelFlowController flowController, ByteBuf event) { if (DcpSnapshotMarkerRequest.is(event)) { // Keep snapshot information in the session state, but also forward event to user short partition = DcpSnapshotMarkerRequest.partition(event); PartitionState ps = sessionState().get(partition); ps.setSnapshotStartSeqno(DcpSnapshotMarkerRequest.startSeqno(event)); ps.setSnapshotEndSeqno(DcpSnapshotMarkerRequest.endSeqno(event)); sessionState().set(partition, ps); } else if (DcpFailoverLogResponse.is(event)) { // Do not forward failover log responses for now since their info is kept // in the session state transparently handleFailoverLogResponse(event); event.release(); return; } else if (RollbackMessage.is(event)) { // even if forwarded to the user, warn in case the user is not // aware of rollback messages. LOGGER.warn( "Received rollback for vbucket {} to seqno {}", RollbackMessage.vbucket(event), RollbackMessage.seqno(event) ); } // Forward event to user. controlEventHandler.onEvent(flowController, event); } }); } }
public class class_name { public void controlEventHandler(final ControlEventHandler controlEventHandler) { env.setControlEventHandler(new ControlEventHandler() { @Override public void onEvent(ChannelFlowController flowController, ByteBuf event) { if (DcpSnapshotMarkerRequest.is(event)) { // Keep snapshot information in the session state, but also forward event to user short partition = DcpSnapshotMarkerRequest.partition(event); PartitionState ps = sessionState().get(partition); ps.setSnapshotStartSeqno(DcpSnapshotMarkerRequest.startSeqno(event)); // depends on control dependency: [if], data = [none] ps.setSnapshotEndSeqno(DcpSnapshotMarkerRequest.endSeqno(event)); // depends on control dependency: [if], data = [none] sessionState().set(partition, ps); // depends on control dependency: [if], data = [none] } else if (DcpFailoverLogResponse.is(event)) { // Do not forward failover log responses for now since their info is kept // in the session state transparently handleFailoverLogResponse(event); // depends on control dependency: [if], data = [none] event.release(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (RollbackMessage.is(event)) { // even if forwarded to the user, warn in case the user is not // aware of rollback messages. LOGGER.warn( "Received rollback for vbucket {} to seqno {}", RollbackMessage.vbucket(event), RollbackMessage.seqno(event) ); // depends on control dependency: [if], data = [none] } // Forward event to user. controlEventHandler.onEvent(flowController, event); } }); } }
public class class_name { private boolean expandCompositCharAtNear(char[] dest,int start, int length, int yehHamzaOption, int seenTailOption, int lamAlefOption){ boolean spaceNotFound = false; if (isNormalizedLamAlefChar(dest[start])) { spaceNotFound = true; return spaceNotFound; } for (int i = start + length; --i >=start;) { char ch = dest[i]; if (lamAlefOption == 1 && isNormalizedLamAlefChar(ch)) { if (i>start &&dest[i-1] == SPACE_CHAR) { dest[i] = LAM_CHAR; dest[--i] = convertNormalizedLamAlef[ch - '\u065C']; } else { spaceNotFound = true; return spaceNotFound; } }else if(seenTailOption == 1 && isSeenTailFamilyChar(ch) == 1){ if(i>start &&dest[i-1] == SPACE_CHAR){ dest[i-1] = tailChar; } else{ spaceNotFound = true; return spaceNotFound; } }else if(yehHamzaOption == 1 && isYehHamzaChar(ch)){ if(i>start &&dest[i-1] == SPACE_CHAR){ dest[i] = yehHamzaToYeh[ch - YEH_HAMZAFE_CHAR]; dest[i-1] = HAMZAFE_CHAR; }else{ spaceNotFound = true; return spaceNotFound; } } } return false; } }
public class class_name { private boolean expandCompositCharAtNear(char[] dest,int start, int length, int yehHamzaOption, int seenTailOption, int lamAlefOption){ boolean spaceNotFound = false; if (isNormalizedLamAlefChar(dest[start])) { spaceNotFound = true; // depends on control dependency: [if], data = [none] return spaceNotFound; // depends on control dependency: [if], data = [none] } for (int i = start + length; --i >=start;) { char ch = dest[i]; if (lamAlefOption == 1 && isNormalizedLamAlefChar(ch)) { if (i>start &&dest[i-1] == SPACE_CHAR) { dest[i] = LAM_CHAR; // depends on control dependency: [if], data = [none] dest[--i] = convertNormalizedLamAlef[ch - '\u065C']; // depends on control dependency: [if], data = [none] } else { spaceNotFound = true; // depends on control dependency: [if], data = [none] return spaceNotFound; // depends on control dependency: [if], data = [none] } }else if(seenTailOption == 1 && isSeenTailFamilyChar(ch) == 1){ if(i>start &&dest[i-1] == SPACE_CHAR){ dest[i-1] = tailChar; // depends on control dependency: [if], data = [none] } else{ spaceNotFound = true; // depends on control dependency: [if], data = [none] return spaceNotFound; // depends on control dependency: [if], data = [none] } }else if(yehHamzaOption == 1 && isYehHamzaChar(ch)){ if(i>start &&dest[i-1] == SPACE_CHAR){ dest[i] = yehHamzaToYeh[ch - YEH_HAMZAFE_CHAR]; // depends on control dependency: [if], data = [none] dest[i-1] = HAMZAFE_CHAR; // depends on control dependency: [if], data = [none] }else{ spaceNotFound = true; // depends on control dependency: [if], data = [none] return spaceNotFound; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public OnLineStatistics[] getOnlineColumnStats(boolean useWeights) { OnLineStatistics[] stats = new OnLineStatistics[numNumerVals]; for(int i = 0; i < stats.length; i++) stats[i] = new OnLineStatistics(); double totalSoW = 0.0; /** * We got to skip nans, count their weight in each column so that we can still fast count zeros */ double[] nanWeight = new double[numNumerVals]; int pos = 0; for(Iterator<DataPoint> iter = getDataPointIterator(); iter.hasNext(); ) { DataPoint dp = iter.next(); double weight = useWeights ? getWeight(pos++): 1; totalSoW += weight; Vec v = dp.getNumericalValues(); for (IndexValue iv : v) if (Double.isNaN(iv.getValue()))//count it so we can fast count zeros right later nanWeight[iv.getIndex()] += weight; else stats[iv.getIndex()].add(iv.getValue(), weight); } double expected = totalSoW; //Add zero counts back in for(int i = 0; i < stats.length; i++) stats[i].add(0.0, expected-stats[i].getSumOfWeights()-nanWeight[i]); return stats; } }
public class class_name { public OnLineStatistics[] getOnlineColumnStats(boolean useWeights) { OnLineStatistics[] stats = new OnLineStatistics[numNumerVals]; for(int i = 0; i < stats.length; i++) stats[i] = new OnLineStatistics(); double totalSoW = 0.0; /** * We got to skip nans, count their weight in each column so that we can still fast count zeros */ double[] nanWeight = new double[numNumerVals]; int pos = 0; for(Iterator<DataPoint> iter = getDataPointIterator(); iter.hasNext(); ) { DataPoint dp = iter.next(); double weight = useWeights ? getWeight(pos++): 1; totalSoW += weight; // depends on control dependency: [for], data = [none] Vec v = dp.getNumericalValues(); for (IndexValue iv : v) if (Double.isNaN(iv.getValue()))//count it so we can fast count zeros right later nanWeight[iv.getIndex()] += weight; else stats[iv.getIndex()].add(iv.getValue(), weight); } double expected = totalSoW; //Add zero counts back in for(int i = 0; i < stats.length; i++) stats[i].add(0.0, expected-stats[i].getSumOfWeights()-nanWeight[i]); return stats; } }
public class class_name { private List<DiffEntry> blockingCompareTrees(RevTree treeA, RevTree treeB) { if (cache == null) { return blockingCompareTreesUncached(treeA, treeB, TreeFilter.ALL); } final CacheableCompareTreesCall key = new CacheableCompareTreesCall(this, treeA, treeB); CompletableFuture<List<DiffEntry>> existingFuture = cache.getIfPresent(key); if (existingFuture != null) { final List<DiffEntry> existingDiffEntries = existingFuture.getNow(null); if (existingDiffEntries != null) { // Cached already. return existingDiffEntries; } } // Not cached yet. Acquire a lock so that we do not compare the same tree pairs simultaneously. final List<DiffEntry> newDiffEntries; final Lock lock = key.coarseGrainedLock(); lock.lock(); try { existingFuture = cache.getIfPresent(key); if (existingFuture != null) { final List<DiffEntry> existingDiffEntries = existingFuture.getNow(null); if (existingDiffEntries != null) { // Other thread already put the entries to the cache before we acquire the lock. return existingDiffEntries; } } newDiffEntries = blockingCompareTreesUncached(treeA, treeB, TreeFilter.ALL); cache.put(key, newDiffEntries); } finally { lock.unlock(); } logger.debug("Cache miss: {}", key); return newDiffEntries; } }
public class class_name { private List<DiffEntry> blockingCompareTrees(RevTree treeA, RevTree treeB) { if (cache == null) { return blockingCompareTreesUncached(treeA, treeB, TreeFilter.ALL); // depends on control dependency: [if], data = [none] } final CacheableCompareTreesCall key = new CacheableCompareTreesCall(this, treeA, treeB); CompletableFuture<List<DiffEntry>> existingFuture = cache.getIfPresent(key); if (existingFuture != null) { final List<DiffEntry> existingDiffEntries = existingFuture.getNow(null); if (existingDiffEntries != null) { // Cached already. return existingDiffEntries; // depends on control dependency: [if], data = [none] } } // Not cached yet. Acquire a lock so that we do not compare the same tree pairs simultaneously. final List<DiffEntry> newDiffEntries; final Lock lock = key.coarseGrainedLock(); lock.lock(); try { existingFuture = cache.getIfPresent(key); // depends on control dependency: [try], data = [none] if (existingFuture != null) { final List<DiffEntry> existingDiffEntries = existingFuture.getNow(null); if (existingDiffEntries != null) { // Other thread already put the entries to the cache before we acquire the lock. return existingDiffEntries; // depends on control dependency: [if], data = [none] } } newDiffEntries = blockingCompareTreesUncached(treeA, treeB, TreeFilter.ALL); // depends on control dependency: [try], data = [none] cache.put(key, newDiffEntries); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } logger.debug("Cache miss: {}", key); return newDiffEntries; } }
public class class_name { public boolean matches(String name) { if (name == null) { return pattern.equals(""); } if (all != null) { return all.equals(name); } if (middle != null) { return name.contains(middle); } if (start != null && !name.startsWith(start)) { return false; } return end == null || name.endsWith(end); } }
public class class_name { public boolean matches(String name) { if (name == null) { return pattern.equals(""); // depends on control dependency: [if], data = [none] } if (all != null) { return all.equals(name); // depends on control dependency: [if], data = [none] } if (middle != null) { return name.contains(middle); // depends on control dependency: [if], data = [(middle] } if (start != null && !name.startsWith(start)) { return false; // depends on control dependency: [if], data = [none] } return end == null || name.endsWith(end); } }
public class class_name { public void addRegistry(Registry... registries){ for (Registry registry: registries){ registryList.add(registryList.size()-1, registry); } } }
public class class_name { public void addRegistry(Registry... registries){ for (Registry registry: registries){ registryList.add(registryList.size()-1, registry); // depends on control dependency: [for], data = [registry] } } }
public class class_name { public static SecretKey generateKey(String algorithm, int keySize) { KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); } }
public class class_name { public static SecretKey generateKey(String algorithm, int keySize) { KeyGenerator secretKeyGenerator; try { secretKeyGenerator = KeyGenerator.getInstance(algorithm); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] secretKeyGenerator.init(keySize); return secretKeyGenerator.generateKey(); } }
public class class_name { public static final int floorDivide(int n, int d, int[] r) { if (n >= 0) { r[0] = n % d; return n / d; } int q = ((n + 1) / d) - 1; r[0] = n - (q * d); return q; } }
public class class_name { public static final int floorDivide(int n, int d, int[] r) { if (n >= 0) { r[0] = n % d; // depends on control dependency: [if], data = [none] return n / d; // depends on control dependency: [if], data = [none] } int q = ((n + 1) / d) - 1; r[0] = n - (q * d); return q; } }
public class class_name { protected void handleIoException(int attempt, IOException ioException) throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); } catch (IOException e) { LOGGER.warn("Failed to close channel after failed publish", e); } } channel = null; if (attempt == DEFAULT_RETRY_ATTEMPTS) { throw ioException; } try { Thread.sleep(DEFAULT_RETRY_INTERVAL); } catch (InterruptedException e) { LOGGER.warn("Sending message interrupted while waiting for retry attempt", e); } } }
public class class_name { protected void handleIoException(int attempt, IOException ioException) throws IOException { if (channel != null && channel.isOpen()) { try { channel.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOGGER.warn("Failed to close channel after failed publish", e); } // depends on control dependency: [catch], data = [none] } channel = null; if (attempt == DEFAULT_RETRY_ATTEMPTS) { throw ioException; } try { Thread.sleep(DEFAULT_RETRY_INTERVAL); } catch (InterruptedException e) { LOGGER.warn("Sending message interrupted while waiting for retry attempt", e); } } }
public class class_name { public static <StoredObjectType, ResultSetType> Pagination createPagination(PageCriteria pageCriteria) { String id = pageCriteria.getId(); if(id == null || id.length() == 0) { return null; } Pagination pagination = ClassPath.newInstance(paginationClassName,String.class,pageCriteria.getId()); paginationMap.put(id, pagination); return pagination; } }
public class class_name { public static <StoredObjectType, ResultSetType> Pagination createPagination(PageCriteria pageCriteria) { String id = pageCriteria.getId(); if(id == null || id.length() == 0) { return null; // depends on control dependency: [if], data = [none] } Pagination pagination = ClassPath.newInstance(paginationClassName,String.class,pageCriteria.getId()); paginationMap.put(id, pagination); return pagination; } }
public class class_name { public boolean isAssociatedTo(Class<? extends Model> targetModelClass) { if(targetModelClass == null){ throw new NullPointerException(); } for (Association association : associations) { if (association.getTargetClass().getName().equals(targetModelClass.getName())) { return true; } } return false; } }
public class class_name { public boolean isAssociatedTo(Class<? extends Model> targetModelClass) { if(targetModelClass == null){ throw new NullPointerException(); } for (Association association : associations) { if (association.getTargetClass().getName().equals(targetModelClass.getName())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public ScanSpecPathMatch dirWhitelistMatchStatus(final String relativePath) { // In blacklisted path if (pathWhiteBlackList.isBlacklisted(relativePath)) { // The directory is blacklisted. return ScanSpecPathMatch.HAS_BLACKLISTED_PATH_PREFIX; } if (pathPrefixWhiteBlackList.isBlacklisted(relativePath)) { // An prefix of this path is blacklisted. return ScanSpecPathMatch.HAS_BLACKLISTED_PATH_PREFIX; } if (pathWhiteBlackList.whitelistIsEmpty() && classPackagePathWhiteBlackList.whitelistIsEmpty()) { // If there are no whitelisted packages, the root package is whitelisted return relativePath.isEmpty() || relativePath.equals("/") ? ScanSpecPathMatch.AT_WHITELISTED_PATH : ScanSpecPathMatch.HAS_WHITELISTED_PATH_PREFIX; } // At whitelisted path if (pathWhiteBlackList.isSpecificallyWhitelistedAndNotBlacklisted(relativePath)) { // Reached a whitelisted path return ScanSpecPathMatch.AT_WHITELISTED_PATH; } if (classPackagePathWhiteBlackList.isSpecificallyWhitelistedAndNotBlacklisted(relativePath)) { // Reached a package containing a specifically-whitelisted class return ScanSpecPathMatch.AT_WHITELISTED_CLASS_PACKAGE; } // Descendant of whitelisted path if (pathPrefixWhiteBlackList.isSpecificallyWhitelisted(relativePath)) { // Path prefix matches one in the whitelist return ScanSpecPathMatch.HAS_WHITELISTED_PATH_PREFIX; } // Ancestor of whitelisted path if (relativePath.equals("/")) { // The default package is always the ancestor of whitelisted paths (need to keep recursing) return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; } if (pathWhiteBlackList.whitelistHasPrefix(relativePath)) { // relativePath is an ancestor (prefix) of a whitelisted path return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; } if (classfilePathWhiteBlackList.whitelistHasPrefix(relativePath)) { // relativePath is an ancestor (prefix) of a whitelisted class' parent directory return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; } // Not in whitelisted path return ScanSpecPathMatch.NOT_WITHIN_WHITELISTED_PATH; } }
public class class_name { public ScanSpecPathMatch dirWhitelistMatchStatus(final String relativePath) { // In blacklisted path if (pathWhiteBlackList.isBlacklisted(relativePath)) { // The directory is blacklisted. return ScanSpecPathMatch.HAS_BLACKLISTED_PATH_PREFIX; // depends on control dependency: [if], data = [none] } if (pathPrefixWhiteBlackList.isBlacklisted(relativePath)) { // An prefix of this path is blacklisted. return ScanSpecPathMatch.HAS_BLACKLISTED_PATH_PREFIX; // depends on control dependency: [if], data = [none] } if (pathWhiteBlackList.whitelistIsEmpty() && classPackagePathWhiteBlackList.whitelistIsEmpty()) { // If there are no whitelisted packages, the root package is whitelisted return relativePath.isEmpty() || relativePath.equals("/") ? ScanSpecPathMatch.AT_WHITELISTED_PATH : ScanSpecPathMatch.HAS_WHITELISTED_PATH_PREFIX; // depends on control dependency: [if], data = [none] } // At whitelisted path if (pathWhiteBlackList.isSpecificallyWhitelistedAndNotBlacklisted(relativePath)) { // Reached a whitelisted path return ScanSpecPathMatch.AT_WHITELISTED_PATH; // depends on control dependency: [if], data = [none] } if (classPackagePathWhiteBlackList.isSpecificallyWhitelistedAndNotBlacklisted(relativePath)) { // Reached a package containing a specifically-whitelisted class return ScanSpecPathMatch.AT_WHITELISTED_CLASS_PACKAGE; // depends on control dependency: [if], data = [none] } // Descendant of whitelisted path if (pathPrefixWhiteBlackList.isSpecificallyWhitelisted(relativePath)) { // Path prefix matches one in the whitelist return ScanSpecPathMatch.HAS_WHITELISTED_PATH_PREFIX; // depends on control dependency: [if], data = [none] } // Ancestor of whitelisted path if (relativePath.equals("/")) { // The default package is always the ancestor of whitelisted paths (need to keep recursing) return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; // depends on control dependency: [if], data = [none] } if (pathWhiteBlackList.whitelistHasPrefix(relativePath)) { // relativePath is an ancestor (prefix) of a whitelisted path return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; // depends on control dependency: [if], data = [none] } if (classfilePathWhiteBlackList.whitelistHasPrefix(relativePath)) { // relativePath is an ancestor (prefix) of a whitelisted class' parent directory return ScanSpecPathMatch.ANCESTOR_OF_WHITELISTED_PATH; // depends on control dependency: [if], data = [none] } // Not in whitelisted path return ScanSpecPathMatch.NOT_WITHIN_WHITELISTED_PATH; } }
public class class_name { @Pure public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) { final int count = getPointCount(); final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(count - 1); final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y); final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y); if (d1 <= d2) { if (distance != null) { distance.set(d1); } return 0; } if (distance != null) { distance.set(d2); } return count - 1; } }
public class class_name { @Pure public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) { final int count = getPointCount(); final Point2d firstPoint = getPointAt(0); final Point2d lastPoint = getPointAt(count - 1); final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y); final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y); if (d1 <= d2) { if (distance != null) { distance.set(d1); // depends on control dependency: [if], data = [none] } return 0; // depends on control dependency: [if], data = [none] } if (distance != null) { distance.set(d2); // depends on control dependency: [if], data = [none] } return count - 1; } }
public class class_name { private void setFilterableElt(Element filterableElt) { filterable = filterableElt; if (filterable != null && JQMCommon.isFilterableReady(filterable)) { JavaScriptObject origFilter = JQMCommon.getFilterCallback(filterable); JQMCommon.bindFilterCallback(this, filterable, origFilter); } } }
public class class_name { private void setFilterableElt(Element filterableElt) { filterable = filterableElt; if (filterable != null && JQMCommon.isFilterableReady(filterable)) { JavaScriptObject origFilter = JQMCommon.getFilterCallback(filterable); JQMCommon.bindFilterCallback(this, filterable, origFilter); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void generateSmap(Node.Nodes pageNodes) throws IOException { classInfos = new ArrayList<ClassInfo>(); String className = ctxt.getFullClassName(); // Instantiate a SmapStratum for the main JSP page. SmapStratum s = new SmapStratum("JSP"); classInfos.add(new ClassInfo(className, s)); // Map out Node.Nodes and putting LineInfo into SmapStratum evaluateNodes(pageNodes, s, ctxt.getOptions().getMappedFile()); String classFileName = ctxt.getClassFileName(); for (ClassInfo entry: classInfos) { // Get SmapStratum s = entry.getSmapStratum(); s.optimizeLineSection(); // Set up our SMAP generator SmapGenerator g = new SmapGenerator(); g.setOutputFileName(unqualify(ctxt.getServletJavaFileName())); g.addStratum(s, true); String name = entry.getClassName(); // class name // Compute the class name and output file name for inner classes if (!className.equals(name)) { classFileName = ctxt.getOutputDir() + name.substring(name.lastIndexOf('.')+1) + ".class"; } entry.setClassFileName(classFileName); entry.setSmap(g.getString()); if (ctxt.getOptions().isSmapDumped()) { File outSmap = new File(classFileName + ".smap"); PrintWriter so = new PrintWriter( new OutputStreamWriter( new FileOutputStream(outSmap), SMAP_ENCODING)); so.print(g.getString()); so.close(); } } } }
public class class_name { public void generateSmap(Node.Nodes pageNodes) throws IOException { classInfos = new ArrayList<ClassInfo>(); String className = ctxt.getFullClassName(); // Instantiate a SmapStratum for the main JSP page. SmapStratum s = new SmapStratum("JSP"); classInfos.add(new ClassInfo(className, s)); // Map out Node.Nodes and putting LineInfo into SmapStratum evaluateNodes(pageNodes, s, ctxt.getOptions().getMappedFile()); String classFileName = ctxt.getClassFileName(); for (ClassInfo entry: classInfos) { // Get SmapStratum s = entry.getSmapStratum(); s.optimizeLineSection(); // Set up our SMAP generator SmapGenerator g = new SmapGenerator(); g.setOutputFileName(unqualify(ctxt.getServletJavaFileName())); g.addStratum(s, true); String name = entry.getClassName(); // class name // Compute the class name and output file name for inner classes if (!className.equals(name)) { classFileName = ctxt.getOutputDir() + name.substring(name.lastIndexOf('.')+1) + ".class"; // depends on control dependency: [if], data = [none] } entry.setClassFileName(classFileName); entry.setSmap(g.getString()); if (ctxt.getOptions().isSmapDumped()) { File outSmap = new File(classFileName + ".smap"); PrintWriter so = new PrintWriter( new OutputStreamWriter( new FileOutputStream(outSmap), SMAP_ENCODING)); so.print(g.getString()); // depends on control dependency: [if], data = [none] so.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void cacheUniqueSelectRef(Object object, MappedStatement mt, String cacheKey) { Collection<QueryMethodCache> mcs = queryCacheMethods.get(mt.getId().substring(0, mt.getId().lastIndexOf(SPLIT_PONIT))).values(); outter:for (QueryMethodCache methodCache : mcs) { if(methodCache.isPk || methodCache.groupRalated)continue; try { Object[] cacheFieldValues = new Object[methodCache.fieldNames.length]; for (int i = 0; i < cacheFieldValues.length; i++) { if(methodCache.fieldNames[i] == null)break outter; cacheFieldValues[i] = ReflectUtils.getObjectValue(object, methodCache.fieldNames[i]); if(cacheFieldValues[i] == null)continue outter; } String fieldCacheKey = genarateQueryCacheKey(methodCache.keyPattern , cacheFieldValues); cacheFieldRefKey(fieldCacheKey,cacheKey, methodCache.getExpire()); if(logger.isDebugEnabled())logger.debug("_autocache_ method[{}] add ref cacheKey:{}",mt.getId(),fieldCacheKey); } catch (Exception e) { logger.warn("cacheUniqueSelectRef:"+cacheKey,e); } } } }
public class class_name { private void cacheUniqueSelectRef(Object object, MappedStatement mt, String cacheKey) { Collection<QueryMethodCache> mcs = queryCacheMethods.get(mt.getId().substring(0, mt.getId().lastIndexOf(SPLIT_PONIT))).values(); outter:for (QueryMethodCache methodCache : mcs) { if(methodCache.isPk || methodCache.groupRalated)continue; try { Object[] cacheFieldValues = new Object[methodCache.fieldNames.length]; for (int i = 0; i < cacheFieldValues.length; i++) { if(methodCache.fieldNames[i] == null)break outter; cacheFieldValues[i] = ReflectUtils.getObjectValue(object, methodCache.fieldNames[i]); // depends on control dependency: [for], data = [i] if(cacheFieldValues[i] == null)continue outter; } String fieldCacheKey = genarateQueryCacheKey(methodCache.keyPattern , cacheFieldValues); cacheFieldRefKey(fieldCacheKey,cacheKey, methodCache.getExpire()); // depends on control dependency: [try], data = [none] if(logger.isDebugEnabled())logger.debug("_autocache_ method[{}] add ref cacheKey:{}",mt.getId(),fieldCacheKey); } catch (Exception e) { logger.warn("cacheUniqueSelectRef:"+cacheKey,e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public HttpConnection setRequestBody(final InputStream input, final long inputLength) { try { return setRequestBody(new InputStreamWrappingGenerator(input, inputLength), inputLength); } catch (IOException e) { logger.log(Level.SEVERE, "Error copying input stream for request body", e); throw new RuntimeException(e); } } }
public class class_name { public HttpConnection setRequestBody(final InputStream input, final long inputLength) { try { return setRequestBody(new InputStreamWrappingGenerator(input, inputLength), inputLength); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.log(Level.SEVERE, "Error copying input stream for request body", e); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void compareTables(String name1, String name2, List<? extends GribTables.Parameter> test, Grib2Tables reference, Formatter f) { int extra = 0; int udunits = 0; int conflict = 0; f.format("Table 1 : %s%n", name1); f.format("Table 2 : %s%n", name2); for (GribTables.Parameter p1 : test) { GribTables.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber()); if (p2 == null) { if (p1.getCategory() < 192 && p1.getNumber() < 192) { extra++; f.format(" WMO missing %s%n", p1); } } else { String p1n = Util.cleanName(p1.getName()); String p2n = Util.cleanName(p2.getName()); if (!p1n.equalsIgnoreCase(p2n)) { f.format(" p1=%10s %40s %15s %15s %s%n", p1.getId(), p1.getName(), p1.getUnit(), p1.getAbbrev(), p1.getDescription()); f.format(" p2=%10s %40s %15s %15s %s%n%n", p2.getId(), p2.getName(), p2.getUnit(), p2.getAbbrev(), p2.getDescription()); conflict++; } if (!p1.getUnit().equalsIgnoreCase(p2.getUnit())) { String cu1 = Util.cleanUnit(p1.getUnit()); String cu2 = Util.cleanUnit(p2.getUnit()); // eliminate common non-udunits boolean isUnitless1 = Util.isUnitless(cu1); boolean isUnitless2 = Util.isUnitless(cu2); if (isUnitless1 != isUnitless2) { f.format(" ud=%10s %s != %s for %s (%s)%n%n", p1.getId(), cu1, cu2, p1.getId(), p1.getName()); udunits++; } else if (!isUnitless1) { try { SimpleUnit su1 = SimpleUnit.factoryWithExceptions(cu1); if (!su1.isCompatible(cu2)) { f.format(" ud=%10s %s (%s) != %s for %s (%s)%n%n", p1.getId(), cu1, su1, cu2, p1.getId(), p1.getName()); udunits++; } } catch (Exception e) { f.format(" udunits cant parse=%10s %15s %15s%n", p1.getId(), cu1, cu2); } } } } } f.format("Conflicts=%d extra=%d udunits=%d%n%n", conflict, extra, udunits); f.format("Parameters in %s not in %s%n", name1, name2); int local = 0; for (GribTables.Parameter p1 : test) { GribTables.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber()); if (p2 == null) { local++; f.format(" %s%n", p1); } } f.format(" missing=%d%n%n", local); } }
public class class_name { public static void compareTables(String name1, String name2, List<? extends GribTables.Parameter> test, Grib2Tables reference, Formatter f) { int extra = 0; int udunits = 0; int conflict = 0; f.format("Table 1 : %s%n", name1); f.format("Table 2 : %s%n", name2); for (GribTables.Parameter p1 : test) { GribTables.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber()); if (p2 == null) { if (p1.getCategory() < 192 && p1.getNumber() < 192) { extra++; // depends on control dependency: [if], data = [none] f.format(" WMO missing %s%n", p1); // depends on control dependency: [if], data = [none] } } else { String p1n = Util.cleanName(p1.getName()); String p2n = Util.cleanName(p2.getName()); if (!p1n.equalsIgnoreCase(p2n)) { f.format(" p1=%10s %40s %15s %15s %s%n", p1.getId(), p1.getName(), p1.getUnit(), p1.getAbbrev(), p1.getDescription()); // depends on control dependency: [if], data = [none] f.format(" p2=%10s %40s %15s %15s %s%n%n", p2.getId(), p2.getName(), p2.getUnit(), p2.getAbbrev(), p2.getDescription()); // depends on control dependency: [if], data = [none] conflict++; // depends on control dependency: [if], data = [none] } if (!p1.getUnit().equalsIgnoreCase(p2.getUnit())) { String cu1 = Util.cleanUnit(p1.getUnit()); String cu2 = Util.cleanUnit(p2.getUnit()); // eliminate common non-udunits boolean isUnitless1 = Util.isUnitless(cu1); boolean isUnitless2 = Util.isUnitless(cu2); if (isUnitless1 != isUnitless2) { f.format(" ud=%10s %s != %s for %s (%s)%n%n", p1.getId(), cu1, cu2, p1.getId(), p1.getName()); // depends on control dependency: [if], data = [none] udunits++; // depends on control dependency: [if], data = [none] } else if (!isUnitless1) { try { SimpleUnit su1 = SimpleUnit.factoryWithExceptions(cu1); if (!su1.isCompatible(cu2)) { f.format(" ud=%10s %s (%s) != %s for %s (%s)%n%n", p1.getId(), cu1, su1, cu2, p1.getId(), p1.getName()); // depends on control dependency: [if], data = [none] udunits++; // depends on control dependency: [if], data = [none] } } catch (Exception e) { f.format(" udunits cant parse=%10s %15s %15s%n", p1.getId(), cu1, cu2); } // depends on control dependency: [catch], data = [none] } } } } f.format("Conflicts=%d extra=%d udunits=%d%n%n", conflict, extra, udunits); f.format("Parameters in %s not in %s%n", name1, name2); int local = 0; for (GribTables.Parameter p1 : test) { GribTables.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber()); if (p2 == null) { local++; // depends on control dependency: [if], data = [none] f.format(" %s%n", p1); // depends on control dependency: [if], data = [none] } } f.format(" missing=%d%n%n", local); } }
public class class_name { @Override public boolean removeAttribute(String name) { boolean result = true; // Send confirmation to client final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_DELETE_DATA, name, null); if (ownerMessage.addEvent(event)) { if (super.removeAttribute(name)) { modified.set(true); syncEvents.add(event); deleteStats.incrementAndGet(); } else { result = false; } notifyModified(); } return result; } }
public class class_name { @Override public boolean removeAttribute(String name) { boolean result = true; // Send confirmation to client final SharedObjectEvent event = new SharedObjectEvent(Type.CLIENT_DELETE_DATA, name, null); if (ownerMessage.addEvent(event)) { if (super.removeAttribute(name)) { modified.set(true); // depends on control dependency: [if], data = [none] syncEvents.add(event); // depends on control dependency: [if], data = [none] deleteStats.incrementAndGet(); // depends on control dependency: [if], data = [none] } else { result = false; // depends on control dependency: [if], data = [none] } notifyModified(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { static ParameterizedType newParameterizedTypeWithOwner( Type ownerType, Class<?> rawType, Type... arguments) { if (ownerType == null) { return newParameterizedType(rawType, arguments); } // ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE checkNotNull(arguments); checkArgument(rawType.getEnclosingClass() != null, "Owner type for unenclosed %s", rawType); return new ParameterizedTypeImpl(ownerType, rawType, arguments); } }
public class class_name { static ParameterizedType newParameterizedTypeWithOwner( Type ownerType, Class<?> rawType, Type... arguments) { if (ownerType == null) { return newParameterizedType(rawType, arguments); // depends on control dependency: [if], data = [none] } // ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE checkNotNull(arguments); checkArgument(rawType.getEnclosingClass() != null, "Owner type for unenclosed %s", rawType); return new ParameterizedTypeImpl(ownerType, rawType, arguments); } }
public class class_name { public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { String sql; if (haveInformationSchemaParameters()) { /* * Get info from information_schema.parameters */ sql = "SELECT SPECIFIC_SCHEMA PROCEDURE_CAT, NULL PROCEDURE_SCHEM, SPECIFIC_NAME PROCEDURE_NAME," + " PARAMETER_NAME COLUMN_NAME, " + " CASE PARAMETER_MODE " + " WHEN 'IN' THEN " + procedureColumnIn + " WHEN 'OUT' THEN " + procedureColumnOut + " WHEN 'INOUT' THEN " + procedureColumnInOut + " ELSE IF(PARAMETER_MODE IS NULL," + procedureColumnReturn + "," + procedureColumnUnknown + ")" + " END COLUMN_TYPE," + dataTypeClause("DTD_IDENTIFIER") + " DATA_TYPE," + "DATA_TYPE TYPE_NAME," + " CASE DATA_TYPE" + " WHEN 'time' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 10, CAST(11 + DATETIME_PRECISION as signed integer))" : "10") + " WHEN 'date' THEN 10" + " WHEN 'datetime' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " WHEN 'timestamp' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " ELSE " + " IF(NUMERIC_PRECISION IS NULL, LEAST(CHARACTER_MAXIMUM_LENGTH," + Integer.MAX_VALUE + "), NUMERIC_PRECISION) " + " END `PRECISION`," + " CASE DATA_TYPE" + " WHEN 'time' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 10, CAST(11 + DATETIME_PRECISION as signed integer))" : "10") + " WHEN 'date' THEN 10" + " WHEN 'datetime' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " WHEN 'timestamp' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " ELSE " + " IF(NUMERIC_PRECISION IS NULL, LEAST(CHARACTER_MAXIMUM_LENGTH," + Integer.MAX_VALUE + "), NUMERIC_PRECISION) " + " END `LENGTH`," + (datePrecisionColumnExist ? " CASE DATA_TYPE" + " WHEN 'time' THEN CAST(DATETIME_PRECISION as signed integer)" + " WHEN 'datetime' THEN CAST(DATETIME_PRECISION as signed integer)" + " WHEN 'timestamp' THEN CAST(DATETIME_PRECISION as signed integer)" + " ELSE NUMERIC_SCALE " + " END `SCALE`," : " NUMERIC_SCALE `SCALE`,") + "10 RADIX," + procedureNullableUnknown + " NULLABLE,NULL REMARKS,NULL COLUMN_DEF,0 SQL_DATA_TYPE,0 SQL_DATETIME_SUB," + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH ,ORDINAL_POSITION, '' IS_NULLABLE, SPECIFIC_NAME " + " FROM INFORMATION_SCHEMA.PARAMETERS " + " WHERE " + catalogCond("SPECIFIC_SCHEMA", catalog) + " AND " + patternCond("SPECIFIC_NAME", procedureNamePattern) + " AND " + patternCond("PARAMETER_NAME", columnNamePattern) + " /* AND ROUTINE_TYPE='PROCEDURE' */ " + " ORDER BY SPECIFIC_SCHEMA, SPECIFIC_NAME, ORDINAL_POSITION"; } else { /* No information_schema.parameters * TODO : figure out what to do with older versions (get info via mysql.proc) * For now, just a dummy result set is returned. */ sql = "SELECT '' PROCEDURE_CAT, '' PROCEDURE_SCHEM , '' PROCEDURE_NAME,'' COLUMN_NAME, 0 COLUMN_TYPE," + "0 DATA_TYPE,'' TYPE_NAME, 0 `PRECISION`,0 LENGTH, 0 SCALE,10 RADIX," + "0 NULLABLE,NULL REMARKS,NULL COLUMN_DEF,0 SQL_DATA_TYPE,0 SQL_DATETIME_SUB," + "0 CHAR_OCTET_LENGTH ,0 ORDINAL_POSITION, '' IS_NULLABLE, '' SPECIFIC_NAME " + " FROM DUAL " + " WHERE 1=0 "; } try { return executeQuery(sql); } catch (SQLException sqlException) { if (sqlException.getMessage().contains("Unknown column 'DATETIME_PRECISION'")) { datePrecisionColumnExist = false; return getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern); } throw sqlException; } } }
public class class_name { public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { String sql; if (haveInformationSchemaParameters()) { /* * Get info from information_schema.parameters */ sql = "SELECT SPECIFIC_SCHEMA PROCEDURE_CAT, NULL PROCEDURE_SCHEM, SPECIFIC_NAME PROCEDURE_NAME," + " PARAMETER_NAME COLUMN_NAME, " + " CASE PARAMETER_MODE " + " WHEN 'IN' THEN " + procedureColumnIn + " WHEN 'OUT' THEN " + procedureColumnOut + " WHEN 'INOUT' THEN " + procedureColumnInOut + " ELSE IF(PARAMETER_MODE IS NULL," + procedureColumnReturn + "," + procedureColumnUnknown + ")" + " END COLUMN_TYPE," + dataTypeClause("DTD_IDENTIFIER") + " DATA_TYPE," + "DATA_TYPE TYPE_NAME," + " CASE DATA_TYPE" + " WHEN 'time' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 10, CAST(11 + DATETIME_PRECISION as signed integer))" : "10") + " WHEN 'date' THEN 10" + " WHEN 'datetime' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " WHEN 'timestamp' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " ELSE " + " IF(NUMERIC_PRECISION IS NULL, LEAST(CHARACTER_MAXIMUM_LENGTH," + Integer.MAX_VALUE + "), NUMERIC_PRECISION) " + " END `PRECISION`," + " CASE DATA_TYPE" + " WHEN 'time' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 10, CAST(11 + DATETIME_PRECISION as signed integer))" : "10") + " WHEN 'date' THEN 10" + " WHEN 'datetime' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " WHEN 'timestamp' THEN " + (datePrecisionColumnExist ? "IF(DATETIME_PRECISION = 0, 19, CAST(20 + DATETIME_PRECISION as signed integer))" : "19") + " ELSE " + " IF(NUMERIC_PRECISION IS NULL, LEAST(CHARACTER_MAXIMUM_LENGTH," + Integer.MAX_VALUE + "), NUMERIC_PRECISION) " + " END `LENGTH`," + (datePrecisionColumnExist ? " CASE DATA_TYPE" + " WHEN 'time' THEN CAST(DATETIME_PRECISION as signed integer)" + " WHEN 'datetime' THEN CAST(DATETIME_PRECISION as signed integer)" + " WHEN 'timestamp' THEN CAST(DATETIME_PRECISION as signed integer)" + " ELSE NUMERIC_SCALE " + " END `SCALE`," : " NUMERIC_SCALE `SCALE`,") + "10 RADIX," + procedureNullableUnknown + " NULLABLE,NULL REMARKS,NULL COLUMN_DEF,0 SQL_DATA_TYPE,0 SQL_DATETIME_SUB," + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH ,ORDINAL_POSITION, '' IS_NULLABLE, SPECIFIC_NAME " + " FROM INFORMATION_SCHEMA.PARAMETERS " + " WHERE " + catalogCond("SPECIFIC_SCHEMA", catalog) + " AND " + patternCond("SPECIFIC_NAME", procedureNamePattern) + " AND " + patternCond("PARAMETER_NAME", columnNamePattern) + " /* AND ROUTINE_TYPE='PROCEDURE' */ " + " ORDER BY SPECIFIC_SCHEMA, SPECIFIC_NAME, ORDINAL_POSITION"; } else { /* No information_schema.parameters * TODO : figure out what to do with older versions (get info via mysql.proc) * For now, just a dummy result set is returned. */ sql = "SELECT '' PROCEDURE_CAT, '' PROCEDURE_SCHEM , '' PROCEDURE_NAME,'' COLUMN_NAME, 0 COLUMN_TYPE," + "0 DATA_TYPE,'' TYPE_NAME, 0 `PRECISION`,0 LENGTH, 0 SCALE,10 RADIX," + "0 NULLABLE,NULL REMARKS,NULL COLUMN_DEF,0 SQL_DATA_TYPE,0 SQL_DATETIME_SUB," + "0 CHAR_OCTET_LENGTH ,0 ORDINAL_POSITION, '' IS_NULLABLE, '' SPECIFIC_NAME " + " FROM DUAL " + " WHERE 1=0 "; } try { return executeQuery(sql); } catch (SQLException sqlException) { if (sqlException.getMessage().contains("Unknown column 'DATETIME_PRECISION'")) { datePrecisionColumnExist = false; // depends on control dependency: [if], data = [none] return getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern); // depends on control dependency: [if], data = [none] } throw sqlException; } } }
public class class_name { public double getStandardDeviation() { Lock lock = this.getLock().readLock(); lock.lock(); try { return this.sigma; } finally { lock.unlock(); } } }
public class class_name { public double getStandardDeviation() { Lock lock = this.getLock().readLock(); lock.lock(); try { return this.sigma; // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { private Set<Integer> matchWithClosestAisMessageIfBufferLargeEnough( long arrivalTime, Integer earliestTimestampLineIndex) { String timestampLine = getLine(earliestTimestampLineIndex); long time = getLineTime(earliestTimestampLineIndex); log.debug("ts=" + timestampLine + ",time=" + time); Set<Integer> removeThese; if (arrivalTime - time > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) { removeThese = matchWithClosestAisMessageAndFindIndexesToRemove( earliestTimestampLineIndex, timestampLine, time); } else removeThese = findExpiredIndexesBeforeIndex(earliestTimestampLineIndex); return removeThese; } }
public class class_name { private Set<Integer> matchWithClosestAisMessageIfBufferLargeEnough( long arrivalTime, Integer earliestTimestampLineIndex) { String timestampLine = getLine(earliestTimestampLineIndex); long time = getLineTime(earliestTimestampLineIndex); log.debug("ts=" + timestampLine + ",time=" + time); Set<Integer> removeThese; if (arrivalTime - time > MAXIMUM_ARRIVAL_TIME_DIFFERENCE_MS) { removeThese = matchWithClosestAisMessageAndFindIndexesToRemove( earliestTimestampLineIndex, timestampLine, time); // depends on control dependency: [if], data = [none] } else removeThese = findExpiredIndexesBeforeIndex(earliestTimestampLineIndex); return removeThese; } }
public class class_name { public <A extends Annotation> A getAnnotationAnywhere(Class<A> annotationType) { A anno = getAnnotation(annotationType); if (anno == null) { Class<?> clazz = (Class<?>) GenericTypeReflector.erase(type); return clazz.getAnnotation(annotationType); } else { return anno; } } }
public class class_name { public <A extends Annotation> A getAnnotationAnywhere(Class<A> annotationType) { A anno = getAnnotation(annotationType); if (anno == null) { Class<?> clazz = (Class<?>) GenericTypeReflector.erase(type); return clazz.getAnnotation(annotationType); } else { return anno; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void updateStyle(BoxStyle bstyle, TextPosition text) { String font = text.getFont().getName(); String family = null; String weight = null; String fstyle = null; bstyle.setFontSize(text.getFontSizeInPt()); bstyle.setLineHeight(text.getHeight()); if (font != null) { //font style and weight for (int i = 0; i < pdFontType.length; i++) { if (font.toLowerCase().lastIndexOf(pdFontType[i]) >= 0) { weight = cssFontWeight[i]; fstyle = cssFontStyle[i]; break; } } if (weight != null) bstyle.setFontWeight(weight); else bstyle.setFontWeight(cssFontWeight[0]); if (fstyle != null) bstyle.setFontStyle(fstyle); else bstyle.setFontStyle(cssFontStyle[0]); //font family //If it's a known common font don't embed in html output to save space String knownFontFamily = findKnownFontFamily(font); if (!knownFontFamily.equals("")) family = knownFontFamily; else { family = fontTable.getUsedName(text.getFont()); if (family == null) family = font; } if (family != null) bstyle.setFontFamily(family); } updateStyleForRenderingMode(); } }
public class class_name { protected void updateStyle(BoxStyle bstyle, TextPosition text) { String font = text.getFont().getName(); String family = null; String weight = null; String fstyle = null; bstyle.setFontSize(text.getFontSizeInPt()); bstyle.setLineHeight(text.getHeight()); if (font != null) { //font style and weight for (int i = 0; i < pdFontType.length; i++) { if (font.toLowerCase().lastIndexOf(pdFontType[i]) >= 0) { weight = cssFontWeight[i]; // depends on control dependency: [if], data = [none] fstyle = cssFontStyle[i]; // depends on control dependency: [if], data = [none] break; } } if (weight != null) bstyle.setFontWeight(weight); else bstyle.setFontWeight(cssFontWeight[0]); if (fstyle != null) bstyle.setFontStyle(fstyle); else bstyle.setFontStyle(cssFontStyle[0]); //font family //If it's a known common font don't embed in html output to save space String knownFontFamily = findKnownFontFamily(font); if (!knownFontFamily.equals("")) family = knownFontFamily; else { family = fontTable.getUsedName(text.getFont()); // depends on control dependency: [if], data = [none] if (family == null) family = font; } if (family != null) bstyle.setFontFamily(family); } updateStyleForRenderingMode(); } }
public class class_name { public static Provider getProvider() { Provider provider = cProvider.get(); if (provider == null) { provider = getDefaultProvider(); if (!cProvider.compareAndSet(null, provider)) { provider = cProvider.get(); } } return provider; } }
public class class_name { public static Provider getProvider() { Provider provider = cProvider.get(); if (provider == null) { provider = getDefaultProvider(); // depends on control dependency: [if], data = [none] if (!cProvider.compareAndSet(null, provider)) { provider = cProvider.get(); // depends on control dependency: [if], data = [none] } } return provider; } }
public class class_name { public Chain getCurrentChain(){ if ( current_model_pos >= structure.nrModels()){ return null; } List<Chain> model = structure.getModel(current_model_pos); if ( current_chain_pos >= model.size() ){ return null; } return model.get(current_chain_pos); } }
public class class_name { public Chain getCurrentChain(){ if ( current_model_pos >= structure.nrModels()){ return null; // depends on control dependency: [if], data = [none] } List<Chain> model = structure.getModel(current_model_pos); if ( current_chain_pos >= model.size() ){ return null; // depends on control dependency: [if], data = [none] } return model.get(current_chain_pos); } }
public class class_name { public void setDefaultIndicatorShape(Shape shape){ if(mUserSetSelectedIndicatorResId == 0){ if(shape == Shape.Oval){ mSelectedGradientDrawable.setShape(GradientDrawable.OVAL); }else{ mSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE); } } if(mUserSetUnSelectedIndicatorResId == 0){ if(shape == Shape.Oval){ mUnSelectedGradientDrawable.setShape(GradientDrawable.OVAL); }else{ mUnSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE); } } resetDrawable(); } }
public class class_name { public void setDefaultIndicatorShape(Shape shape){ if(mUserSetSelectedIndicatorResId == 0){ if(shape == Shape.Oval){ mSelectedGradientDrawable.setShape(GradientDrawable.OVAL); // depends on control dependency: [if], data = [none] }else{ mSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE); // depends on control dependency: [if], data = [none] } } if(mUserSetUnSelectedIndicatorResId == 0){ if(shape == Shape.Oval){ mUnSelectedGradientDrawable.setShape(GradientDrawable.OVAL); // depends on control dependency: [if], data = [none] }else{ mUnSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE); // depends on control dependency: [if], data = [none] } } resetDrawable(); } }
public class class_name { @Override @SuppressWarnings("unchecked") public Result combine(EvaluationCtx context, @SuppressWarnings("rawtypes") List parameters, @SuppressWarnings("rawtypes") List policyElements) { logger.info("Combining using: " + getIdentifier()); boolean atLeastOneError = false; boolean atLeastOnePermit = false; Set<Set<?>> denyObligations = new HashSet<Set<?>>(); Status firstIndeterminateStatus = null; Set<AbstractPolicy> matchedPolicies = new HashSet<AbstractPolicy>(); Iterator<?> it = policyElements.iterator(); while (it.hasNext()) { AbstractPolicy policy = ((PolicyCombinerElement) it.next()).getPolicy(); // make sure that the policy matches the context MatchResult match = policy.match(context); if (match.getResult() == MatchResult.INDETERMINATE) { atLeastOneError = true; // keep track of the first error, regardless of cause if (firstIndeterminateStatus == null) { firstIndeterminateStatus = match.getStatus(); } } else if (match.getResult() == MatchResult.MATCH) { matchedPolicies.add(policy); } } Set<AbstractPolicy> applicablePolicies = getApplicablePolicies(context, matchedPolicies); for (AbstractPolicy policy : applicablePolicies) { Result result = policy.evaluate(context); int effect = result.getDecision(); if (effect == Result.DECISION_DENY) { denyObligations.addAll(result.getObligations()); return new Result(Result.DECISION_DENY, context.getResourceId() .encode(), denyObligations); } if (effect == Result.DECISION_PERMIT) { atLeastOnePermit = true; } else if (effect == Result.DECISION_INDETERMINATE) { atLeastOneError = true; // keep track of the first error, regardless of cause if (firstIndeterminateStatus == null) { firstIndeterminateStatus = result.getStatus(); } } } // if we got a PERMIT, return it if (atLeastOnePermit) { return new Result(Result.DECISION_PERMIT, context.getResourceId() .encode()); } // if we got an INDETERMINATE, return it if (atLeastOneError) { return new Result(Result.DECISION_INDETERMINATE, firstIndeterminateStatus, context.getResourceId().encode()); } // if we got here, then nothing applied to us return new Result(Result.DECISION_NOT_APPLICABLE, context .getResourceId().encode()); } }
public class class_name { @Override @SuppressWarnings("unchecked") public Result combine(EvaluationCtx context, @SuppressWarnings("rawtypes") List parameters, @SuppressWarnings("rawtypes") List policyElements) { logger.info("Combining using: " + getIdentifier()); boolean atLeastOneError = false; boolean atLeastOnePermit = false; Set<Set<?>> denyObligations = new HashSet<Set<?>>(); Status firstIndeterminateStatus = null; Set<AbstractPolicy> matchedPolicies = new HashSet<AbstractPolicy>(); Iterator<?> it = policyElements.iterator(); while (it.hasNext()) { AbstractPolicy policy = ((PolicyCombinerElement) it.next()).getPolicy(); // make sure that the policy matches the context MatchResult match = policy.match(context); if (match.getResult() == MatchResult.INDETERMINATE) { atLeastOneError = true; // depends on control dependency: [if], data = [none] // keep track of the first error, regardless of cause if (firstIndeterminateStatus == null) { firstIndeterminateStatus = match.getStatus(); // depends on control dependency: [if], data = [none] } } else if (match.getResult() == MatchResult.MATCH) { matchedPolicies.add(policy); // depends on control dependency: [if], data = [none] } } Set<AbstractPolicy> applicablePolicies = getApplicablePolicies(context, matchedPolicies); for (AbstractPolicy policy : applicablePolicies) { Result result = policy.evaluate(context); int effect = result.getDecision(); if (effect == Result.DECISION_DENY) { denyObligations.addAll(result.getObligations()); // depends on control dependency: [if], data = [none] return new Result(Result.DECISION_DENY, context.getResourceId() .encode(), denyObligations); // depends on control dependency: [if], data = [none] } if (effect == Result.DECISION_PERMIT) { atLeastOnePermit = true; // depends on control dependency: [if], data = [none] } else if (effect == Result.DECISION_INDETERMINATE) { atLeastOneError = true; // depends on control dependency: [if], data = [none] // keep track of the first error, regardless of cause if (firstIndeterminateStatus == null) { firstIndeterminateStatus = result.getStatus(); // depends on control dependency: [if], data = [none] } } } // if we got a PERMIT, return it if (atLeastOnePermit) { return new Result(Result.DECISION_PERMIT, context.getResourceId() .encode()); // depends on control dependency: [if], data = [none] } // if we got an INDETERMINATE, return it if (atLeastOneError) { return new Result(Result.DECISION_INDETERMINATE, firstIndeterminateStatus, context.getResourceId().encode()); // depends on control dependency: [if], data = [none] } // if we got here, then nothing applied to us return new Result(Result.DECISION_NOT_APPLICABLE, context .getResourceId().encode()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer container) { if (!GeometryUtil.has3DCoordinates(container)) return getDummyDescriptorValue(new CDKException("Molecule must have 3D coordinates")); IAtomContainer clone; IsotopeFactory factory; try { clone = (IAtomContainer) container.clone(); factory = Isotopes.getInstance(); factory.configureAtoms(clone); } catch (CloneNotSupportedException | IOException e) { logger.debug(e); return getDummyDescriptorValue(e); } DoubleArrayResult retval = new DoubleArrayResult(7); double ccf = 1.000138; double eps = 1e-5; double[][] imat = new double[3][3]; Point3d centerOfMass = GeometryUtil.get3DCentreOfMass(clone); double xdif; double ydif; double zdif; double xsq; double ysq; double zsq; for (int i = 0; i < clone.getAtomCount(); i++) { IAtom currentAtom = clone.getAtom(i); Double mass = factory.getMajorIsotope(currentAtom.getSymbol()).getExactMass(); if (mass == null) mass = factory.getNaturalMass(currentAtom); xdif = currentAtom.getPoint3d().x - centerOfMass.x; ydif = currentAtom.getPoint3d().y - centerOfMass.y; zdif = currentAtom.getPoint3d().z - centerOfMass.z; xsq = xdif * xdif; ysq = ydif * ydif; zsq = zdif * zdif; imat[0][0] += mass * (ysq + zsq); imat[1][1] += mass * (xsq + zsq); imat[2][2] += mass * (xsq + ysq); imat[1][0] += -1 * mass * ydif * xdif; imat[0][1] = imat[1][0]; imat[2][0] += -1 * mass * xdif * zdif; imat[0][2] = imat[2][0]; imat[2][1] += -1 * mass * ydif * zdif; imat[1][2] = imat[2][1]; } // diagonalize the MI tensor Matrix tmp = new Matrix(imat); EigenvalueDecomposition eigenDecomp = tmp.eig(); double[] eval = eigenDecomp.getRealEigenvalues(); retval.add(eval[2]); retval.add(eval[1]); retval.add(eval[0]); double etmp = eval[0]; eval[0] = eval[2]; eval[2] = etmp; if (Math.abs(eval[1]) > 1e-3) retval.add(eval[0] / eval[1]); else retval.add(1000); if (Math.abs(eval[2]) > 1e-3) { retval.add(eval[0] / eval[2]); retval.add(eval[1] / eval[2]); } else { retval.add(1000); retval.add(1000); } // finally get the radius of gyration double pri; IMolecularFormula formula = MolecularFormulaManipulator.getMolecularFormula(clone); if (Math.abs(eval[2]) > eps) pri = Math.pow(eval[0] * eval[1] * eval[2], 1.0 / 3.0); else pri = Math.sqrt(eval[0] * ccf / MolecularFormulaManipulator.getTotalExactMass(formula)); retval.add(Math.sqrt(Math.PI * 2 * pri * ccf / MolecularFormulaManipulator.getTotalExactMass(formula))); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, getDescriptorNames()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer container) { if (!GeometryUtil.has3DCoordinates(container)) return getDummyDescriptorValue(new CDKException("Molecule must have 3D coordinates")); IAtomContainer clone; IsotopeFactory factory; try { clone = (IAtomContainer) container.clone(); // depends on control dependency: [try], data = [none] factory = Isotopes.getInstance(); // depends on control dependency: [try], data = [none] factory.configureAtoms(clone); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException | IOException e) { logger.debug(e); return getDummyDescriptorValue(e); } // depends on control dependency: [catch], data = [none] DoubleArrayResult retval = new DoubleArrayResult(7); double ccf = 1.000138; double eps = 1e-5; double[][] imat = new double[3][3]; Point3d centerOfMass = GeometryUtil.get3DCentreOfMass(clone); double xdif; double ydif; double zdif; double xsq; double ysq; double zsq; for (int i = 0; i < clone.getAtomCount(); i++) { IAtom currentAtom = clone.getAtom(i); Double mass = factory.getMajorIsotope(currentAtom.getSymbol()).getExactMass(); if (mass == null) mass = factory.getNaturalMass(currentAtom); xdif = currentAtom.getPoint3d().x - centerOfMass.x; // depends on control dependency: [for], data = [none] ydif = currentAtom.getPoint3d().y - centerOfMass.y; // depends on control dependency: [for], data = [none] zdif = currentAtom.getPoint3d().z - centerOfMass.z; // depends on control dependency: [for], data = [none] xsq = xdif * xdif; // depends on control dependency: [for], data = [none] ysq = ydif * ydif; // depends on control dependency: [for], data = [none] zsq = zdif * zdif; // depends on control dependency: [for], data = [none] imat[0][0] += mass * (ysq + zsq); // depends on control dependency: [for], data = [none] imat[1][1] += mass * (xsq + zsq); // depends on control dependency: [for], data = [none] imat[2][2] += mass * (xsq + ysq); // depends on control dependency: [for], data = [none] imat[1][0] += -1 * mass * ydif * xdif; // depends on control dependency: [for], data = [none] imat[0][1] = imat[1][0]; // depends on control dependency: [for], data = [none] imat[2][0] += -1 * mass * xdif * zdif; // depends on control dependency: [for], data = [none] imat[0][2] = imat[2][0]; // depends on control dependency: [for], data = [none] imat[2][1] += -1 * mass * ydif * zdif; // depends on control dependency: [for], data = [none] imat[1][2] = imat[2][1]; // depends on control dependency: [for], data = [none] } // diagonalize the MI tensor Matrix tmp = new Matrix(imat); EigenvalueDecomposition eigenDecomp = tmp.eig(); double[] eval = eigenDecomp.getRealEigenvalues(); retval.add(eval[2]); retval.add(eval[1]); retval.add(eval[0]); double etmp = eval[0]; eval[0] = eval[2]; eval[2] = etmp; if (Math.abs(eval[1]) > 1e-3) retval.add(eval[0] / eval[1]); else retval.add(1000); if (Math.abs(eval[2]) > 1e-3) { retval.add(eval[0] / eval[2]); // depends on control dependency: [if], data = [none] retval.add(eval[1] / eval[2]); // depends on control dependency: [if], data = [none] } else { retval.add(1000); // depends on control dependency: [if], data = [none] retval.add(1000); // depends on control dependency: [if], data = [none] } // finally get the radius of gyration double pri; IMolecularFormula formula = MolecularFormulaManipulator.getMolecularFormula(clone); if (Math.abs(eval[2]) > eps) pri = Math.pow(eval[0] * eval[1] * eval[2], 1.0 / 3.0); else pri = Math.sqrt(eval[0] * ccf / MolecularFormulaManipulator.getTotalExactMass(formula)); retval.add(Math.sqrt(Math.PI * 2 * pri * ccf / MolecularFormulaManipulator.getTotalExactMass(formula))); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval, getDescriptorNames()); } }
public class class_name { public Packer setInsetLeft(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, val, i.bottom, i.right); setConstraints(comp, gc); return this; } }
public class class_name { public Packer setInsetLeft(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); // depends on control dependency: [if], data = [none] } gc.insets = new Insets(i.top, val, i.bottom, i.right); setConstraints(comp, gc); return this; } }
public class class_name { private void addToWatchList(final int addRow, final int lastStaticRow, final List<Integer> watchList) { if ((addRow > lastStaticRow) && !(watchList.contains(addRow))) { watchList.add(addRow); } } }
public class class_name { private void addToWatchList(final int addRow, final int lastStaticRow, final List<Integer> watchList) { if ((addRow > lastStaticRow) && !(watchList.contains(addRow))) { watchList.add(addRow); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Restricted(NoExternalUse.class) public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) { DiskSpace size = (DiskSpace) super.data(c); if(size!=null && size.size < getThresholdBytes()) { size.setTriggered(this.getClass(), true); if(getDescriptor().markOffline(c,size)) { LOGGER.warning(Messages.DiskSpaceMonitor_MarkedOffline(c.getDisplayName())); } } return size; } }
public class class_name { @Restricted(NoExternalUse.class) public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) { DiskSpace size = (DiskSpace) super.data(c); if(size!=null && size.size < getThresholdBytes()) { size.setTriggered(this.getClass(), true); // depends on control dependency: [if], data = [none] if(getDescriptor().markOffline(c,size)) { LOGGER.warning(Messages.DiskSpaceMonitor_MarkedOffline(c.getDisplayName())); // depends on control dependency: [if], data = [none] } } return size; } }
public class class_name { public ExecutionVertex getVertexByChannelID(final ChannelID id) { final ExecutionEdge edge = this.edgeMap.get(id); if (edge == null) { return null; } if (id.equals(edge.getOutputChannelID())) { return edge.getOutputGate().getVertex(); } return edge.getInputGate().getVertex(); } }
public class class_name { public ExecutionVertex getVertexByChannelID(final ChannelID id) { final ExecutionEdge edge = this.edgeMap.get(id); if (edge == null) { return null; // depends on control dependency: [if], data = [none] } if (id.equals(edge.getOutputChannelID())) { return edge.getOutputGate().getVertex(); // depends on control dependency: [if], data = [none] } return edge.getInputGate().getVertex(); } }
public class class_name { protected void configureOAuth20Client(final Collection<BaseClient> properties) { val index = new AtomicInteger(); pac4jProperties.getOauth2() .stream() .filter(oauth -> StringUtils.isNotBlank(oauth.getId()) && StringUtils.isNotBlank(oauth.getSecret())) .forEach(oauth -> { val client = new GenericOAuth20Client(); client.setKey(oauth.getId()); client.setSecret(oauth.getSecret()); client.setProfileAttrs(oauth.getProfileAttrs()); client.setProfileNodePath(oauth.getProfilePath()); client.setProfileUrl(oauth.getProfileUrl()); client.setProfileVerb(Verb.valueOf(oauth.getProfileVerb().toUpperCase())); client.setTokenUrl(oauth.getTokenUrl()); client.setAuthUrl(oauth.getAuthUrl()); client.setCustomParams(oauth.getCustomParams()); val count = index.intValue(); if (StringUtils.isBlank(oauth.getClientName())) { client.setName(client.getClass().getSimpleName() + count); } client.setCallbackUrlResolver(new PathParameterCallbackUrlResolver()); configureClient(client, oauth); index.incrementAndGet(); LOGGER.debug("Created client [{}]", client); properties.add(client); }); } }
public class class_name { protected void configureOAuth20Client(final Collection<BaseClient> properties) { val index = new AtomicInteger(); pac4jProperties.getOauth2() .stream() .filter(oauth -> StringUtils.isNotBlank(oauth.getId()) && StringUtils.isNotBlank(oauth.getSecret())) .forEach(oauth -> { val client = new GenericOAuth20Client(); client.setKey(oauth.getId()); client.setSecret(oauth.getSecret()); client.setProfileAttrs(oauth.getProfileAttrs()); client.setProfileNodePath(oauth.getProfilePath()); client.setProfileUrl(oauth.getProfileUrl()); client.setProfileVerb(Verb.valueOf(oauth.getProfileVerb().toUpperCase())); client.setTokenUrl(oauth.getTokenUrl()); client.setAuthUrl(oauth.getAuthUrl()); client.setCustomParams(oauth.getCustomParams()); val count = index.intValue(); if (StringUtils.isBlank(oauth.getClientName())) { client.setName(client.getClass().getSimpleName() + count); // depends on control dependency: [if], data = [none] } client.setCallbackUrlResolver(new PathParameterCallbackUrlResolver()); configureClient(client, oauth); index.incrementAndGet(); LOGGER.debug("Created client [{}]", client); properties.add(client); }); } }
public class class_name { @Override public boolean isEmpty() { registryLock.readLock().lock(); try { return entryMap.isEmpty(); } finally { registryLock.readLock().unlock(); } } }
public class class_name { @Override public boolean isEmpty() { registryLock.readLock().lock(); try { return entryMap.isEmpty(); // depends on control dependency: [try], data = [none] } finally { registryLock.readLock().unlock(); } } }
public class class_name { public void doEventSelected(final JRebirthEvent eventSelected, final Wave wave) { // Same object (reference) if (getEventModel() == eventSelected) { view().getScaleTransition().play(); } else { view().getScaleTransition().stop(); view().resetScale(); } } }
public class class_name { public void doEventSelected(final JRebirthEvent eventSelected, final Wave wave) { // Same object (reference) if (getEventModel() == eventSelected) { view().getScaleTransition().play(); // depends on control dependency: [if], data = [none] } else { view().getScaleTransition().stop(); // depends on control dependency: [if], data = [none] view().resetScale(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final EObject ruleAtom() throws RecognitionException { EObject current = null; Token lv_cardinality_2_1=null; Token lv_cardinality_2_2=null; Token lv_cardinality_2_3=null; EObject this_OtherElement_0 = null; EObject this_RuleOptions_3 = null; enterRule(); try { // InternalSimpleAntlr.g:651:28: ( ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) ) // InternalSimpleAntlr.g:652:1: ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) { // InternalSimpleAntlr.g:652:1: ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) int alt15=2; int LA15_0 = input.LA(1); if ( (LA15_0==RULE_ID||(LA15_0>=RULE_OPEN && LA15_0<=RULE_STRING)||LA15_0==28||LA15_0==36) ) { alt15=1; } else if ( ((LA15_0>=15 && LA15_0<=16)) ) { alt15=2; } else { if (state.backtracking>0) {state.failed=true; return current;} NoViableAltException nvae = new NoViableAltException("", 15, 0, input); throw nvae; } switch (alt15) { case 1 : // InternalSimpleAntlr.g:652:2: (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) { // InternalSimpleAntlr.g:652:2: (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) // InternalSimpleAntlr.g:653:2: this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getAtomAccess().getOtherElementParserRuleCall_0_0()); } pushFollow(FOLLOW_17); this_OtherElement_0=ruleOtherElement(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_OtherElement_0; afterParserOrEnumRuleCall(); } // InternalSimpleAntlr.g:664:1: ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? int alt14=2; int LA14_0 = input.LA(1); if ( ((LA14_0>=25 && LA14_0<=27)) ) { alt14=1; } switch (alt14) { case 1 : // InternalSimpleAntlr.g:664:2: () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) { // InternalSimpleAntlr.g:664:2: () // InternalSimpleAntlr.g:665:2: { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getAtomAccess().getElementWithCardinalityElementAction_0_1_0(), current); } } // InternalSimpleAntlr.g:673:2: ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) // InternalSimpleAntlr.g:674:1: ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) { // InternalSimpleAntlr.g:674:1: ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) // InternalSimpleAntlr.g:675:1: (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) { // InternalSimpleAntlr.g:675:1: (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) int alt13=3; switch ( input.LA(1) ) { case 25: { alt13=1; } break; case 26: { alt13=2; } break; case 27: { alt13=3; } break; default: if (state.backtracking>0) {state.failed=true; return current;} NoViableAltException nvae = new NoViableAltException("", 13, 0, input); throw nvae; } switch (alt13) { case 1 : // InternalSimpleAntlr.g:676:3: lv_cardinality_2_1= '+' { lv_cardinality_2_1=(Token)match(input,25,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_1, grammarAccess.getAtomAccess().getCardinalityPlusSignKeyword_0_1_1_0_0()); } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); } setWithLastConsumed(current, "cardinality", lv_cardinality_2_1, null); } } break; case 2 : // InternalSimpleAntlr.g:688:8: lv_cardinality_2_2= '*' { lv_cardinality_2_2=(Token)match(input,26,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_2, grammarAccess.getAtomAccess().getCardinalityAsteriskKeyword_0_1_1_0_1()); } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); } setWithLastConsumed(current, "cardinality", lv_cardinality_2_2, null); } } break; case 3 : // InternalSimpleAntlr.g:700:8: lv_cardinality_2_3= '?' { lv_cardinality_2_3=(Token)match(input,27,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_3, grammarAccess.getAtomAccess().getCardinalityQuestionMarkKeyword_0_1_1_0_2()); } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); } setWithLastConsumed(current, "cardinality", lv_cardinality_2_3, null); } } break; } } } } break; } } } break; case 2 : // InternalSimpleAntlr.g:717:2: this_RuleOptions_3= ruleRuleOptions { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getAtomAccess().getRuleOptionsParserRuleCall_1()); } pushFollow(FOLLOW_2); this_RuleOptions_3=ruleRuleOptions(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_RuleOptions_3; afterParserOrEnumRuleCall(); } } break; } } if ( state.backtracking==0 ) { leaveRule(); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleAtom() throws RecognitionException { EObject current = null; Token lv_cardinality_2_1=null; Token lv_cardinality_2_2=null; Token lv_cardinality_2_3=null; EObject this_OtherElement_0 = null; EObject this_RuleOptions_3 = null; enterRule(); try { // InternalSimpleAntlr.g:651:28: ( ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) ) // InternalSimpleAntlr.g:652:1: ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) { // InternalSimpleAntlr.g:652:1: ( (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) | this_RuleOptions_3= ruleRuleOptions ) int alt15=2; int LA15_0 = input.LA(1); if ( (LA15_0==RULE_ID||(LA15_0>=RULE_OPEN && LA15_0<=RULE_STRING)||LA15_0==28||LA15_0==36) ) { alt15=1; // depends on control dependency: [if], data = [none] } else if ( ((LA15_0>=15 && LA15_0<=16)) ) { alt15=2; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 15, 0, input); throw nvae; } switch (alt15) { case 1 : // InternalSimpleAntlr.g:652:2: (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) { // InternalSimpleAntlr.g:652:2: (this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? ) // InternalSimpleAntlr.g:653:2: this_OtherElement_0= ruleOtherElement ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getAtomAccess().getOtherElementParserRuleCall_0_0()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_17); this_OtherElement_0=ruleOtherElement(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_OtherElement_0; // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none] } // InternalSimpleAntlr.g:664:1: ( () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) )? int alt14=2; int LA14_0 = input.LA(1); if ( ((LA14_0>=25 && LA14_0<=27)) ) { alt14=1; // depends on control dependency: [if], data = [none] } switch (alt14) { case 1 : // InternalSimpleAntlr.g:664:2: () ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) { // InternalSimpleAntlr.g:664:2: () // InternalSimpleAntlr.g:665:2: { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { current = forceCreateModelElementAndSet( grammarAccess.getAtomAccess().getElementWithCardinalityElementAction_0_1_0(), current); // depends on control dependency: [if], data = [none] } } // InternalSimpleAntlr.g:673:2: ( ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) ) // InternalSimpleAntlr.g:674:1: ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) { // InternalSimpleAntlr.g:674:1: ( (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) ) // InternalSimpleAntlr.g:675:1: (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) { // InternalSimpleAntlr.g:675:1: (lv_cardinality_2_1= '+' | lv_cardinality_2_2= '*' | lv_cardinality_2_3= '?' ) int alt13=3; switch ( input.LA(1) ) { case 25: { alt13=1; } break; case 26: { alt13=2; } break; case 27: { alt13=3; } break; default: if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] NoViableAltException nvae = new NoViableAltException("", 13, 0, input); throw nvae; } switch (alt13) { case 1 : // InternalSimpleAntlr.g:676:3: lv_cardinality_2_1= '+' { lv_cardinality_2_1=(Token)match(input,25,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_1, grammarAccess.getAtomAccess().getCardinalityPlusSignKeyword_0_1_1_0_0()); // depends on control dependency: [if], data = [none] } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); // depends on control dependency: [if], data = [none] } setWithLastConsumed(current, "cardinality", lv_cardinality_2_1, null); // depends on control dependency: [if], data = [none] } } break; case 2 : // InternalSimpleAntlr.g:688:8: lv_cardinality_2_2= '*' { lv_cardinality_2_2=(Token)match(input,26,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_2, grammarAccess.getAtomAccess().getCardinalityAsteriskKeyword_0_1_1_0_1()); // depends on control dependency: [if], data = [none] } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); // depends on control dependency: [if], data = [none] } setWithLastConsumed(current, "cardinality", lv_cardinality_2_2, null); // depends on control dependency: [if], data = [none] } } break; case 3 : // InternalSimpleAntlr.g:700:8: lv_cardinality_2_3= '?' { lv_cardinality_2_3=(Token)match(input,27,FOLLOW_2); if (state.failed) return current; if ( state.backtracking==0 ) { newLeafNode(lv_cardinality_2_3, grammarAccess.getAtomAccess().getCardinalityQuestionMarkKeyword_0_1_1_0_2()); // depends on control dependency: [if], data = [none] } if ( state.backtracking==0 ) { if (current==null) { current = createModelElement(grammarAccess.getAtomRule()); // depends on control dependency: [if], data = [none] } setWithLastConsumed(current, "cardinality", lv_cardinality_2_3, null); // depends on control dependency: [if], data = [none] } } break; } } } } break; } } } break; case 2 : // InternalSimpleAntlr.g:717:2: this_RuleOptions_3= ruleRuleOptions { if ( state.backtracking==0 ) { /* */ } if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getAtomAccess().getRuleOptionsParserRuleCall_1()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_2); this_RuleOptions_3=ruleRuleOptions(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current = this_RuleOptions_3; // depends on control dependency: [if], data = [none] afterParserOrEnumRuleCall(); // 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 List<String> resolveHostFromSrvRecords(final String srvHost) { String srvHostDomain = srvHost.substring(srvHost.indexOf('.') + 1); List<String> srvHostDomainParts = asList(srvHostDomain.split("\\.")); List<String> hosts = new ArrayList<String>(); InitialDirContext dirContext = createDnsDirContext(); try { Attributes attributes = dirContext.getAttributes("_mongodb._tcp." + srvHost, new String[]{"SRV"}); Attribute attribute = attributes.get("SRV"); if (attribute == null) { throw new MongoConfigurationException("No SRV records available for host " + srvHost); } NamingEnumeration<?> srvRecordEnumeration = attribute.getAll(); while (srvRecordEnumeration.hasMore()) { String srvRecord = (String) srvRecordEnumeration.next(); String[] split = srvRecord.split(" "); String resolvedHost = split[3].endsWith(".") ? split[3].substring(0, split[3].length() - 1) : split[3]; String resolvedHostDomain = resolvedHost.substring(resolvedHost.indexOf('.') + 1); if (!sameParentDomain(srvHostDomainParts, resolvedHostDomain)) { throw new MongoConfigurationException( format("The SRV host name '%s'resolved to a host '%s 'that is not in a sub-domain of the SRV host.", srvHost, resolvedHost)); } hosts.add(resolvedHost + ":" + split[2]); } if (hosts.isEmpty()) { throw new MongoConfigurationException("Unable to find any SRV records for host " + srvHost); } } catch (NamingException e) { throw new MongoConfigurationException("Unable to look up SRV record for host " + srvHost, e); } finally { try { dirContext.close(); } catch (NamingException e) { // ignore } } return hosts; } }
public class class_name { @Override public List<String> resolveHostFromSrvRecords(final String srvHost) { String srvHostDomain = srvHost.substring(srvHost.indexOf('.') + 1); List<String> srvHostDomainParts = asList(srvHostDomain.split("\\.")); List<String> hosts = new ArrayList<String>(); InitialDirContext dirContext = createDnsDirContext(); try { Attributes attributes = dirContext.getAttributes("_mongodb._tcp." + srvHost, new String[]{"SRV"}); Attribute attribute = attributes.get("SRV"); if (attribute == null) { throw new MongoConfigurationException("No SRV records available for host " + srvHost); } NamingEnumeration<?> srvRecordEnumeration = attribute.getAll(); while (srvRecordEnumeration.hasMore()) { String srvRecord = (String) srvRecordEnumeration.next(); String[] split = srvRecord.split(" "); String resolvedHost = split[3].endsWith(".") ? split[3].substring(0, split[3].length() - 1) : split[3]; String resolvedHostDomain = resolvedHost.substring(resolvedHost.indexOf('.') + 1); if (!sameParentDomain(srvHostDomainParts, resolvedHostDomain)) { throw new MongoConfigurationException( format("The SRV host name '%s'resolved to a host '%s 'that is not in a sub-domain of the SRV host.", srvHost, resolvedHost)); } hosts.add(resolvedHost + ":" + split[2]); // depends on control dependency: [while], data = [none] } if (hosts.isEmpty()) { throw new MongoConfigurationException("Unable to find any SRV records for host " + srvHost); } } catch (NamingException e) { throw new MongoConfigurationException("Unable to look up SRV record for host " + srvHost, e); } finally { // depends on control dependency: [catch], data = [none] try { dirContext.close(); // depends on control dependency: [try], data = [none] } catch (NamingException e) { // ignore } // depends on control dependency: [catch], data = [none] } return hosts; } }
public class class_name { protected void updateFade (float time) { if (_fadeMode == FadeMode.NONE) { return; } float alpha = Math.min((_fadeElapsed += time) / _fadeInterval, 1f); _source.setGain(_gain * (_fadeMode == FadeMode.IN ? alpha : (1f - alpha))); if (alpha == 1f) { if (_fadeMode == FadeMode.OUT) { stop(); } else if (_fadeMode == FadeMode.OUT_DISPOSE) { dispose(); } _fadeMode = FadeMode.NONE; } } }
public class class_name { protected void updateFade (float time) { if (_fadeMode == FadeMode.NONE) { return; // depends on control dependency: [if], data = [none] } float alpha = Math.min((_fadeElapsed += time) / _fadeInterval, 1f); _source.setGain(_gain * (_fadeMode == FadeMode.IN ? alpha : (1f - alpha))); if (alpha == 1f) { if (_fadeMode == FadeMode.OUT) { stop(); // depends on control dependency: [if], data = [none] } else if (_fadeMode == FadeMode.OUT_DISPOSE) { dispose(); // depends on control dependency: [if], data = [none] } _fadeMode = FadeMode.NONE; // depends on control dependency: [if], data = [none] } } }
public class class_name { public java.util.List<DeploymentInfo> getDeploymentsInfo() { if (deploymentsInfo == null) { deploymentsInfo = new com.amazonaws.internal.SdkInternalList<DeploymentInfo>(); } return deploymentsInfo; } }
public class class_name { public java.util.List<DeploymentInfo> getDeploymentsInfo() { if (deploymentsInfo == null) { deploymentsInfo = new com.amazonaws.internal.SdkInternalList<DeploymentInfo>(); // depends on control dependency: [if], data = [none] } return deploymentsInfo; } }
public class class_name { public LocalTransactionCoordinator suspend() { if (tc.isEntryEnabled()) Tr.entry(tc, "suspend", this); final LocalTranCoordImpl ltc = _coord; if (ltc != null) { _coord = null; ltc.suspend(); // suspend any native context invokeEventListener(ltc, UOWEventListener.SUSPEND, null); } if (tc.isEntryEnabled()) Tr.exit(tc, "suspend", ltc); return ltc; } }
public class class_name { public LocalTransactionCoordinator suspend() { if (tc.isEntryEnabled()) Tr.entry(tc, "suspend", this); final LocalTranCoordImpl ltc = _coord; if (ltc != null) { _coord = null; // depends on control dependency: [if], data = [none] ltc.suspend(); // suspend any native context // depends on control dependency: [if], data = [none] invokeEventListener(ltc, UOWEventListener.SUSPEND, null); // depends on control dependency: [if], data = [(ltc] } if (tc.isEntryEnabled()) Tr.exit(tc, "suspend", ltc); return ltc; } }
public class class_name { public Single<ClientCredentials> issueClientCredentials(HttpRequest req) throws OAuthException { Single<ClientCredentials> creds; String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(HttpHeaderValues.APPLICATION_JSON)) { ApplicationInfo appInfo; FullHttpRequest fullHttpRequest = (FullHttpRequest) req; appInfo = InputValidator.validate(fullHttpRequest.content().toString(CharsetUtil.UTF_8), ApplicationInfo.class); if (appInfo.valid()) { String[] scopeList = appInfo.getScope().split(SCOPE_SPLITTER); creds = db.getAllScopes().flatMap(allScopes -> { for (String s : scopeList) { if (matchScope(allScopes, s) == null) { throw new OAuthException(ResponseBuilder.SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); } } // check client_id, client_secret passed if ((appInfo.getId() != null && appInfo.getId().length() > 0) && (appInfo.getSecret() != null && appInfo.getSecret().length() > 0)) { // check if passed client_id, client_secret are valid if (areClientCredentialsValid(appInfo.getId(), appInfo.getSecret())) { return db.findClientCredentials(appInfo.getId()) .switchIfEmpty(Single.just(new ClientCredentials(appInfo.getName(), appInfo.getScope(), appInfo.getDescription(), appInfo.getRedirectUri(), appInfo.getId(), appInfo.getSecret(), appInfo.getApplicationDetails()))) .flatMap(clientCredentials -> { // if a client app with this client_id already registered return Single.error(new OAuthException(ResponseBuilder.ALREADY_REGISTERED_APP, HttpResponseStatus.BAD_REQUEST)); }); } else { throw new OAuthException(ResponseBuilder.INVALID_CLIENT_CREDENTIALS, HttpResponseStatus.BAD_REQUEST); } } else { ClientCredentials clientCredentials = new ClientCredentials(appInfo.getName(), appInfo.getScope(), appInfo.getDescription(), appInfo.getRedirectUri(), appInfo.getApplicationDetails()); return Single.just(clientCredentials); } }).flatMap(credsTmp -> db .storeClientCredentials(credsTmp) .andThen(Single.just(credsTmp))); } else { return Single.error(new OAuthException(ResponseBuilder.NAME_OR_SCOPE_OR_URI_IS_NULL, HttpResponseStatus.BAD_REQUEST)); } // return Single.error(new OAuthException(e, ResponseBuilder.CANNOT_REGISTER_APP, HttpResponseStatus.BAD_REQUEST)); } else { return Single.error(new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST)); } return creds; } }
public class class_name { public Single<ClientCredentials> issueClientCredentials(HttpRequest req) throws OAuthException { Single<ClientCredentials> creds; String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(HttpHeaderValues.APPLICATION_JSON)) { ApplicationInfo appInfo; FullHttpRequest fullHttpRequest = (FullHttpRequest) req; appInfo = InputValidator.validate(fullHttpRequest.content().toString(CharsetUtil.UTF_8), ApplicationInfo.class); if (appInfo.valid()) { String[] scopeList = appInfo.getScope().split(SCOPE_SPLITTER); creds = db.getAllScopes().flatMap(allScopes -> { for (String s : scopeList) { if (matchScope(allScopes, s) == null) { throw new OAuthException(ResponseBuilder.SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); // depends on control dependency: [if], data = [none] } } // check client_id, client_secret passed if ((appInfo.getId() != null && appInfo.getId().length() > 0) && (appInfo.getSecret() != null && appInfo.getSecret().length() > 0)) { // check if passed client_id, client_secret are valid if (areClientCredentialsValid(appInfo.getId(), appInfo.getSecret())) { return db.findClientCredentials(appInfo.getId()) .switchIfEmpty(Single.just(new ClientCredentials(appInfo.getName(), appInfo.getScope(), appInfo.getDescription(), appInfo.getRedirectUri(), appInfo.getId(), appInfo.getSecret(), appInfo.getApplicationDetails()))) .flatMap(clientCredentials -> { // if a client app with this client_id already registered return Single.error(new OAuthException(ResponseBuilder.ALREADY_REGISTERED_APP, HttpResponseStatus.BAD_REQUEST)); // depends on control dependency: [if], data = [none] }); } else { throw new OAuthException(ResponseBuilder.INVALID_CLIENT_CREDENTIALS, HttpResponseStatus.BAD_REQUEST); } } else { ClientCredentials clientCredentials = new ClientCredentials(appInfo.getName(), appInfo.getScope(), appInfo.getDescription(), appInfo.getRedirectUri(), appInfo.getApplicationDetails()); return Single.just(clientCredentials); } }).flatMap(credsTmp -> db .storeClientCredentials(credsTmp) .andThen(Single.just(credsTmp))); } else { return Single.error(new OAuthException(ResponseBuilder.NAME_OR_SCOPE_OR_URI_IS_NULL, HttpResponseStatus.BAD_REQUEST)); } // return Single.error(new OAuthException(e, ResponseBuilder.CANNOT_REGISTER_APP, HttpResponseStatus.BAD_REQUEST)); } else { return Single.error(new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST)); } return creds; } }
public class class_name { public static boolean intersects(Bbox one, Bbox two) { if (two.getX() > one.getMaxX()) { return false; } if (two.getY() > one.getMaxY()) { return false; } if (two.getMaxX() < one.getX()) { return false; } if (two.getMaxY() < one.getY()) { return false; } return true; } }
public class class_name { public static boolean intersects(Bbox one, Bbox two) { if (two.getX() > one.getMaxX()) { return false; // depends on control dependency: [if], data = [none] } if (two.getY() > one.getMaxY()) { return false; // depends on control dependency: [if], data = [none] } if (two.getMaxX() < one.getX()) { return false; // depends on control dependency: [if], data = [none] } if (two.getMaxY() < one.getY()) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void clearCommand(Command command) { List controls = getControlsFor(command); for (int i=0;i<controls.size();i++) { unbindCommand((Control) controls.get(i)); } } }
public class class_name { public void clearCommand(Command command) { List controls = getControlsFor(command); for (int i=0;i<controls.size();i++) { unbindCommand((Control) controls.get(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { public int read() throws IOException { // If we got something in the char buffer, let's use it. if (0 != fCharCount) { fCharCount--; return ((int) fCharBuf[fCharCount]) & 0xFFFF; } int b0 = fInputStream.read() & 0xff; // 1st byte if (b0 == 0xff) { return -1; } int b1 = fInputStream.read() & 0xff; // 2nd byte if (b1 == 0xff) { return -1; } if (fEncoding >= 4) { // UCS-4 int b2 = fInputStream.read() & 0xff; // 3rd byte if (b2 == 0xff) { return -1; } int b3 = fInputStream.read() & 0xff; // 4th byte if (b3 == 0xff) { return -1; } int codepoint; if (UCS4BE == fEncoding) { codepoint = ((b0 << 24) + (b1 << 16) + (b2 << 8) + b3); } else { codepoint = ((b3 << 24) + (b2 << 16) + (b1 << 8) + b0); } /* * Encoding from UCS-4 to UTF-16 as described in RFC 2781 * In theory there should be additional `isValidCodePoint()` check * but I simply don't know what to do if invalid one is encountered. */ if (!isSupplementaryCodePoint(codepoint)) { return codepoint; } else { int cp1 = (codepoint - 0x10000) & 0xFFFFF; int highSurrogate = 0xD800 + (cp1 >>> 10); // ">>" should work too // Saving low surrogate for future use fCharBuf[fCharCount] = (char) (0xDC00 + (cp1 & 0x3FF)); // low surrogate code unit will be returned during next call return highSurrogate; } } else { // UCS-2 if (fEncoding == UCS2BE) { return (b0 << 8) + b1; } else { return (b1 << 8) + b0; } } } }
public class class_name { public int read() throws IOException { // If we got something in the char buffer, let's use it. if (0 != fCharCount) { fCharCount--; return ((int) fCharBuf[fCharCount]) & 0xFFFF; } int b0 = fInputStream.read() & 0xff; // 1st byte if (b0 == 0xff) { return -1; } int b1 = fInputStream.read() & 0xff; // 2nd byte if (b1 == 0xff) { return -1; } if (fEncoding >= 4) { // UCS-4 int b2 = fInputStream.read() & 0xff; // 3rd byte if (b2 == 0xff) { return -1; // depends on control dependency: [if], data = [none] } int b3 = fInputStream.read() & 0xff; // 4th byte if (b3 == 0xff) { return -1; // depends on control dependency: [if], data = [none] } int codepoint; if (UCS4BE == fEncoding) { codepoint = ((b0 << 24) + (b1 << 16) + (b2 << 8) + b3); // depends on control dependency: [if], data = [none] } else { codepoint = ((b3 << 24) + (b2 << 16) + (b1 << 8) + b0); // depends on control dependency: [if], data = [none] } /* * Encoding from UCS-4 to UTF-16 as described in RFC 2781 * In theory there should be additional `isValidCodePoint()` check * but I simply don't know what to do if invalid one is encountered. */ if (!isSupplementaryCodePoint(codepoint)) { return codepoint; // depends on control dependency: [if], data = [none] } else { int cp1 = (codepoint - 0x10000) & 0xFFFFF; int highSurrogate = 0xD800 + (cp1 >>> 10); // ">>" should work too // Saving low surrogate for future use fCharBuf[fCharCount] = (char) (0xDC00 + (cp1 & 0x3FF)); // depends on control dependency: [if], data = [none] // low surrogate code unit will be returned during next call return highSurrogate; // depends on control dependency: [if], data = [none] } } else { // UCS-2 if (fEncoding == UCS2BE) { return (b0 << 8) + b1; // depends on control dependency: [if], data = [none] } else { return (b1 << 8) + b0; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private byte[] getBytes() { byte[] bytes = new byte[15]; long mask = 0x00000000000000ff; for (int i = 14; i >= 7; i--) { bytes[i] = (byte) ((low & mask) >>> ((14 - i) << 3)); mask = mask << 8; } mask = 0x00000000000000ff; for (int i = 6; i >= 1; i--) { bytes[i] = (byte) ((high & mask) >>> ((6 - i) << 3)); mask = mask << 8; } mask = 0x0001000000000000L; bytes[0] = (byte) ((high & mask) >>> 48); return bytes; } }
public class class_name { private byte[] getBytes() { byte[] bytes = new byte[15]; long mask = 0x00000000000000ff; for (int i = 14; i >= 7; i--) { bytes[i] = (byte) ((low & mask) >>> ((14 - i) << 3)); // depends on control dependency: [for], data = [i] mask = mask << 8; // depends on control dependency: [for], data = [none] } mask = 0x00000000000000ff; for (int i = 6; i >= 1; i--) { bytes[i] = (byte) ((high & mask) >>> ((6 - i) << 3)); // depends on control dependency: [for], data = [i] mask = mask << 8; // depends on control dependency: [for], data = [none] } mask = 0x0001000000000000L; bytes[0] = (byte) ((high & mask) >>> 48); return bytes; } }
public class class_name { public boolean sendRequest(String requesttype, boolean wantreply, byte[] requestdata, boolean isActivity) throws SshException { synchronized (this) { ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_CHANNEL_REQUEST); msg.writeInt(remoteid); msg.writeString(requesttype); msg.writeBoolean(wantreply); if (requestdata != null) { msg.write(requestdata); } if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_REQUEST id=" + channelid + " rid=" + remoteid + " request=" + requesttype + " wantreply=" + wantreply); } connection.sendMessage(msg.toByteArray(), true); boolean result = false; if (wantreply) { SshMessage reply = processMessages(CHANNEL_REQUEST_MESSAGES); return reply.getMessageId() == SSH_MSG_CHANNEL_SUCCESS; } return result; } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { msg.close(); } catch (IOException e) { } } } } }
public class class_name { public boolean sendRequest(String requesttype, boolean wantreply, byte[] requestdata, boolean isActivity) throws SshException { synchronized (this) { ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_CHANNEL_REQUEST); // depends on control dependency: [try], data = [none] msg.writeInt(remoteid); // depends on control dependency: [try], data = [none] msg.writeString(requesttype); // depends on control dependency: [try], data = [none] msg.writeBoolean(wantreply); // depends on control dependency: [try], data = [none] if (requestdata != null) { msg.write(requestdata); // depends on control dependency: [if], data = [(requestdata] } if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_REQUEST id=" + channelid + " rid=" + remoteid + " request=" + requesttype + " wantreply=" + wantreply); // depends on control dependency: [if], data = [none] } connection.sendMessage(msg.toByteArray(), true); // depends on control dependency: [try], data = [none] boolean result = false; if (wantreply) { SshMessage reply = processMessages(CHANNEL_REQUEST_MESSAGES); return reply.getMessageId() == SSH_MSG_CHANNEL_SUCCESS; // depends on control dependency: [if], data = [none] } return result; // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { // depends on control dependency: [catch], data = [none] try { msg.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public void cleanup(){ synchronized (mBeanServer) { for (ObjectName beanName : beansNames) try { mBeanServer.unregisterMBean(beanName); } catch (InstanceNotFoundException ignored) { // Bean previously been unregistered } catch (MBeanRegistrationException e) { log.warn("Exception thrown while trying to clean up registered MBeans", e); } } } }
public class class_name { public void cleanup(){ synchronized (mBeanServer) { for (ObjectName beanName : beansNames) try { mBeanServer.unregisterMBean(beanName); // depends on control dependency: [try], data = [none] } catch (InstanceNotFoundException ignored) { // Bean previously been unregistered } catch (MBeanRegistrationException e) { // depends on control dependency: [catch], data = [none] log.warn("Exception thrown while trying to clean up registered MBeans", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public JobFlowInstancesConfig withEc2SubnetIds(String... ec2SubnetIds) { if (this.ec2SubnetIds == null) { setEc2SubnetIds(new com.amazonaws.internal.SdkInternalList<String>(ec2SubnetIds.length)); } for (String ele : ec2SubnetIds) { this.ec2SubnetIds.add(ele); } return this; } }
public class class_name { public JobFlowInstancesConfig withEc2SubnetIds(String... ec2SubnetIds) { if (this.ec2SubnetIds == null) { setEc2SubnetIds(new com.amazonaws.internal.SdkInternalList<String>(ec2SubnetIds.length)); // depends on control dependency: [if], data = [none] } for (String ele : ec2SubnetIds) { this.ec2SubnetIds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public void wantWrite() { if (hStdinWidow != null && !NuWinNT.INVALID_HANDLE_VALUE.getPointer().equals(hStdinWidow.getPointer())) { userWantsWrite.set(true); myProcessor.wantWrite(this); } } }
public class class_name { @Override public void wantWrite() { if (hStdinWidow != null && !NuWinNT.INVALID_HANDLE_VALUE.getPointer().equals(hStdinWidow.getPointer())) { userWantsWrite.set(true); // depends on control dependency: [if], data = [none] myProcessor.wantWrite(this); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer ac) { ac = clone(ac); // don't mod original int rotatableBondsCount = 0; int degree0; int degree1; IRingSet ringSet; try { ringSet = new SpanningTree(ac).getBasicRings(); } catch (NoSuchAtomException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult( (int) Double.NaN), getDescriptorNames(), e); } for (IBond bond : ac.bonds()) { if (ringSet.getRings(bond).getAtomContainerCount() > 0) { bond.setFlag(CDKConstants.ISINRING, true); } } for (IBond bond : ac.bonds()) { IAtom atom0 = bond.getBegin(); IAtom atom1 = bond.getEnd(); if (atom0.getSymbol().equals("H") || atom1.getSymbol().equals("H")) continue; if (bond.getOrder() == Order.SINGLE) { if ((BondManipulator.isLowerOrder(ac.getMaximumBondOrder(atom0), IBond.Order.TRIPLE)) && (BondManipulator.isLowerOrder(ac.getMaximumBondOrder(atom1), IBond.Order.TRIPLE))) { if (!bond.getFlag(CDKConstants.ISINRING)) { if (excludeAmides && (isAmide(atom0, atom1, ac) || isAmide(atom1, atom0, ac))) { continue; } // if there are explicit H's we should ignore those bonds degree0 = ac.getConnectedBondsCount(atom0) - getConnectedHCount(ac, atom0); degree1 = ac.getConnectedBondsCount(atom1) - getConnectedHCount(ac, atom1); if ((degree0 == 1) || (degree1 == 1)) { if (includeTerminals) { rotatableBondsCount += 1; } } else { rotatableBondsCount += 1; } } } } } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult( rotatableBondsCount), getDescriptorNames()); } }
public class class_name { @Override public DescriptorValue calculate(IAtomContainer ac) { ac = clone(ac); // don't mod original int rotatableBondsCount = 0; int degree0; int degree1; IRingSet ringSet; try { ringSet = new SpanningTree(ac).getBasicRings(); // depends on control dependency: [try], data = [none] } catch (NoSuchAtomException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult( (int) Double.NaN), getDescriptorNames(), e); } // depends on control dependency: [catch], data = [none] for (IBond bond : ac.bonds()) { if (ringSet.getRings(bond).getAtomContainerCount() > 0) { bond.setFlag(CDKConstants.ISINRING, true); // depends on control dependency: [if], data = [none] } } for (IBond bond : ac.bonds()) { IAtom atom0 = bond.getBegin(); IAtom atom1 = bond.getEnd(); if (atom0.getSymbol().equals("H") || atom1.getSymbol().equals("H")) continue; if (bond.getOrder() == Order.SINGLE) { if ((BondManipulator.isLowerOrder(ac.getMaximumBondOrder(atom0), IBond.Order.TRIPLE)) && (BondManipulator.isLowerOrder(ac.getMaximumBondOrder(atom1), IBond.Order.TRIPLE))) { if (!bond.getFlag(CDKConstants.ISINRING)) { if (excludeAmides && (isAmide(atom0, atom1, ac) || isAmide(atom1, atom0, ac))) { continue; } // if there are explicit H's we should ignore those bonds degree0 = ac.getConnectedBondsCount(atom0) - getConnectedHCount(ac, atom0); // depends on control dependency: [if], data = [none] degree1 = ac.getConnectedBondsCount(atom1) - getConnectedHCount(ac, atom1); // depends on control dependency: [if], data = [none] if ((degree0 == 1) || (degree1 == 1)) { if (includeTerminals) { rotatableBondsCount += 1; // depends on control dependency: [if], data = [none] } } else { rotatableBondsCount += 1; // depends on control dependency: [if], data = [none] } } } } } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult( rotatableBondsCount), getDescriptorNames()); } }
public class class_name { public void update (int timeout) throws IOException { updateThread = Thread.currentThread(); synchronized (updateLock) { // Blocks to avoid a select while the selector is used to bind the server connection. } long startTime = System.currentTimeMillis(); int select = 0; if (timeout > 0) { select = selector.select(timeout); } else { select = selector.selectNow(); } if (select == 0) { emptySelects++; if (emptySelects == 100) { emptySelects = 0; // NIO freaks and returns immediately with 0 sometimes, so try to keep from hogging the CPU. long elapsedTime = System.currentTimeMillis() - startTime; try { if (elapsedTime < 25) Thread.sleep(25 - elapsedTime); } catch (InterruptedException ex) { } } } else { emptySelects = 0; isClosed = false; Set<SelectionKey> keys = selector.selectedKeys(); synchronized (keys) { for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext();) { keepAlive(); SelectionKey selectionKey = iter.next(); iter.remove(); try { int ops = selectionKey.readyOps(); if ((ops & SelectionKey.OP_READ) == SelectionKey.OP_READ) { if (selectionKey.attachment() == tcp) { while (true) { Object object = tcp.readObject(this); if (object == null) break; if (!tcpRegistered) { if (object instanceof RegisterTCP) { id = ((RegisterTCP)object).connectionID; synchronized (tcpRegistrationLock) { tcpRegistered = true; tcpRegistrationLock.notifyAll(); if (TRACE) trace("kryonet", this + " received TCP: RegisterTCP"); if (udp == null) setConnected(true); } if (udp == null) notifyConnected(); } continue; } if (udp != null && !udpRegistered) { if (object instanceof RegisterUDP) { synchronized (udpRegistrationLock) { udpRegistered = true; udpRegistrationLock.notifyAll(); if (TRACE) trace("kryonet", this + " received UDP: RegisterUDP"); if (DEBUG) { debug("kryonet", "Port " + udp.datagramChannel.socket().getLocalPort() + "/UDP connected to: " + udp.connectedAddress); } setConnected(true); } notifyConnected(); } continue; } if (!isConnected) continue; if (DEBUG) { String objectString = object == null ? "null" : object.getClass().getSimpleName(); if (!(object instanceof FrameworkMessage)) { debug("kryonet", this + " received TCP: " + objectString); } else if (TRACE) { trace("kryonet", this + " received TCP: " + objectString); } } notifyReceived(object); } } else { if (udp.readFromAddress() == null) continue; Object object = udp.readObject(this); if (object == null) continue; if (DEBUG) { String objectString = object == null ? "null" : object.getClass().getSimpleName(); debug("kryonet", this + " received UDP: " + objectString); } notifyReceived(object); } } if ((ops & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) tcp.writeOperation(); } catch (CancelledKeyException ignored) { // Connection is closed. } } } } if (isConnected) { long time = System.currentTimeMillis(); if (tcp.isTimedOut(time)) { if (DEBUG) debug("kryonet", this + " timed out."); close(); } else keepAlive(); if (isIdle()) notifyIdle(); } } }
public class class_name { public void update (int timeout) throws IOException { updateThread = Thread.currentThread(); synchronized (updateLock) { // Blocks to avoid a select while the selector is used to bind the server connection. } long startTime = System.currentTimeMillis(); int select = 0; if (timeout > 0) { select = selector.select(timeout); } else { select = selector.selectNow(); } if (select == 0) { emptySelects++; if (emptySelects == 100) { emptySelects = 0; // NIO freaks and returns immediately with 0 sometimes, so try to keep from hogging the CPU. long elapsedTime = System.currentTimeMillis() - startTime; try { if (elapsedTime < 25) Thread.sleep(25 - elapsedTime); } catch (InterruptedException ex) { } // depends on control dependency: [catch], data = [none] } } else { emptySelects = 0; isClosed = false; Set<SelectionKey> keys = selector.selectedKeys(); synchronized (keys) { for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext();) { keepAlive(); SelectionKey selectionKey = iter.next(); iter.remove(); try { int ops = selectionKey.readyOps(); if ((ops & SelectionKey.OP_READ) == SelectionKey.OP_READ) { if (selectionKey.attachment() == tcp) { while (true) { Object object = tcp.readObject(this); if (object == null) break; if (!tcpRegistered) { if (object instanceof RegisterTCP) { id = ((RegisterTCP)object).connectionID; synchronized (tcpRegistrationLock) { tcpRegistered = true; tcpRegistrationLock.notifyAll(); if (TRACE) trace("kryonet", this + " received TCP: RegisterTCP"); if (udp == null) setConnected(true); } if (udp == null) notifyConnected(); } continue; } if (udp != null && !udpRegistered) { if (object instanceof RegisterUDP) { synchronized (udpRegistrationLock) { udpRegistered = true; udpRegistrationLock.notifyAll(); if (TRACE) trace("kryonet", this + " received UDP: RegisterUDP"); if (DEBUG) { debug("kryonet", "Port " + udp.datagramChannel.socket().getLocalPort() + "/UDP connected to: " + udp.connectedAddress); } setConnected(true); } notifyConnected(); } continue; } if (!isConnected) continue; if (DEBUG) { String objectString = object == null ? "null" : object.getClass().getSimpleName(); if (!(object instanceof FrameworkMessage)) { debug("kryonet", this + " received TCP: " + objectString); } else if (TRACE) { trace("kryonet", this + " received TCP: " + objectString); } } notifyReceived(object); } } else { if (udp.readFromAddress() == null) continue; Object object = udp.readObject(this); if (object == null) continue; if (DEBUG) { String objectString = object == null ? "null" : object.getClass().getSimpleName(); debug("kryonet", this + " received UDP: " + objectString); } notifyReceived(object); } } if ((ops & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) tcp.writeOperation(); } catch (CancelledKeyException ignored) { // Connection is closed. } } } } if (isConnected) { long time = System.currentTimeMillis(); if (tcp.isTimedOut(time)) { if (DEBUG) debug("kryonet", this + " timed out."); close(); } else keepAlive(); if (isIdle()) notifyIdle(); } } }
public class class_name { private void setProtocols(String protocolsString, boolean append) { List<Protocol> protocolsList = new ArrayList<>(); if (append) { protocolsList.addAll(client.getProtocols()); } for (String protocol : protocolsString.split(",", -1)) { try { protocolsList.add(Protocol.get(protocol)); } catch (IOException e) { throw new IllegalStateException(e); } } client.setProtocols(protocolsList); } }
public class class_name { private void setProtocols(String protocolsString, boolean append) { List<Protocol> protocolsList = new ArrayList<>(); if (append) { protocolsList.addAll(client.getProtocols()); // depends on control dependency: [if], data = [none] } for (String protocol : protocolsString.split(",", -1)) { try { protocolsList.add(Protocol.get(protocol)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } client.setProtocols(protocolsList); } }
public class class_name { @Override public final void lcompute() { if( _hi-_lo >= 2 ) { // Multi-key case: just divide-and-conquer to 1 key final int mid = (_lo+_hi)>>>1; // Mid-point assert _left == null && _rite == null; T l = clone(); T r = clone(); _left = l; l._reservedMem = 0; _rite = r; r._reservedMem = 0; _left._hi = mid; // Reset mid-point _rite._lo = mid; // Also set self mid-point setPendingCount(1); // Compute min. memory required to run the right branch in parallel. Min // memory equals to the max memory used if the right branch will be // executed single threaded (but in parallel with our left branch). // Assuming all memory is kept in the tasks and it is halved by reduce // operation, the min memory is proportional to the depth of the right // subtree. long reqMem = (log2(_hi - mid)+3)*memOverheadPerChunk(); if(!_runSingleThreaded && MemoryManager.tryReserveTaskMem(reqMem)){ _reservedMem += reqMem; // Remember the amount of reserved memory to free it later. _left.fork(); // Runs in another thread/FJ instance } else { _left.compute2(); } _rite.compute2(); // Runs in THIS F/J thread } else { if( _hi > _lo ) { // Single key? try { map(_keys[_lo]); // Get it, run it locally } catch( RuntimeException re ) { // Catch user-map-thrown exceptions throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } catch( AssertionError re ) { // Catch user-map-thrown exceptions throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } catch( OutOfMemoryError re ) { // Catch user-map-thrown exceptions throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } } tryComplete(); // And this task is complete } } }
public class class_name { @Override public final void lcompute() { if( _hi-_lo >= 2 ) { // Multi-key case: just divide-and-conquer to 1 key final int mid = (_lo+_hi)>>>1; // Mid-point assert _left == null && _rite == null; // depends on control dependency: [if], data = [none] T l = clone(); T r = clone(); _left = l; l._reservedMem = 0; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] _rite = r; r._reservedMem = 0; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] _left._hi = mid; // Reset mid-point // depends on control dependency: [if], data = [none] _rite._lo = mid; // Also set self mid-point // depends on control dependency: [if], data = [none] setPendingCount(1); // depends on control dependency: [if], data = [none] // Compute min. memory required to run the right branch in parallel. Min // memory equals to the max memory used if the right branch will be // executed single threaded (but in parallel with our left branch). // Assuming all memory is kept in the tasks and it is halved by reduce // operation, the min memory is proportional to the depth of the right // subtree. long reqMem = (log2(_hi - mid)+3)*memOverheadPerChunk(); if(!_runSingleThreaded && MemoryManager.tryReserveTaskMem(reqMem)){ _reservedMem += reqMem; // Remember the amount of reserved memory to free it later. // depends on control dependency: [if], data = [none] _left.fork(); // Runs in another thread/FJ instance // depends on control dependency: [if], data = [none] } else { _left.compute2(); // depends on control dependency: [if], data = [none] } _rite.compute2(); // Runs in THIS F/J thread // depends on control dependency: [if], data = [none] } else { if( _hi > _lo ) { // Single key? try { map(_keys[_lo]); // Get it, run it locally // depends on control dependency: [try], data = [none] } catch( RuntimeException re ) { // Catch user-map-thrown exceptions throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } catch( AssertionError re ) { // Catch user-map-thrown exceptions // depends on control dependency: [catch], data = [none] throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } catch( OutOfMemoryError re ) { // Catch user-map-thrown exceptions // depends on control dependency: [catch], data = [none] throw H2O.setDetailMessage(re,re.getMessage()+" while mapping key "+_keys[_lo]); } // depends on control dependency: [catch], data = [none] } tryComplete(); // And this task is complete // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<Field, Bind> bfields(@NonNull final Class<?> klass) { Map<Field, Bind> value = bfields.get(klass); if (value == null) { value = fields(klass, Bind.class); for (Field field : value.keySet()) { if (!field.isAccessible()) { field.setAccessible(true); } } bfields.put(klass, unmodifiableMap(value)); } return value; } }
public class class_name { private Map<Field, Bind> bfields(@NonNull final Class<?> klass) { Map<Field, Bind> value = bfields.get(klass); if (value == null) { value = fields(klass, Bind.class); // depends on control dependency: [if], data = [none] for (Field field : value.keySet()) { if (!field.isAccessible()) { field.setAccessible(true); // depends on control dependency: [if], data = [none] } } bfields.put(klass, unmodifiableMap(value)); // depends on control dependency: [if], data = [(value] } return value; } }
public class class_name { @Override public <T> T execute(SolrCallback<T> action) { Assert.notNull(action, "SolrCallback must not be null!"); try { SolrClient solrClient = this.getSolrClient(); return action.doInSolr(solrClient); } catch (Exception e) { DataAccessException resolved = getExceptionTranslator().translateExceptionIfPossible( e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e.getMessage(), e)); throw resolved == null ? new UncategorizedSolrException(e.getMessage(), e) : resolved; } } }
public class class_name { @Override public <T> T execute(SolrCallback<T> action) { Assert.notNull(action, "SolrCallback must not be null!"); try { SolrClient solrClient = this.getSolrClient(); return action.doInSolr(solrClient); // depends on control dependency: [try], data = [none] } catch (Exception e) { DataAccessException resolved = getExceptionTranslator().translateExceptionIfPossible( e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e.getMessage(), e)); throw resolved == null ? new UncategorizedSolrException(e.getMessage(), e) : resolved; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void remove(String item) { if(item == null || item.isEmpty()){ return; } if(LOGGER.isDebugEnabled()) { LOGGER.debug("移除词性:" + item); } //从根节点开始查找 //获取根节点 TrieNode<V> node = getRootNode(item.charAt(0)); if(node == null){ //不存在根节点,结束查找 if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); } return; } int length = item.length(); //存在根节点,继续查找 for(int i=1;i<length;i++){ char character = item.charAt(i); TrieNode<V> child = node.getChild(character); if(child == null){ //未找到匹配节点 if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); } return; }else{ //找到节点,继续往下找 node = child; } } if(node.isTerminal()){ //设置为非叶子节点,效果相当于移除词性 node.setTerminal(false); node.setValue(null); if(LOGGER.isDebugEnabled()) { LOGGER.debug("成功移除词性:" + item); } }else{ if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); } } } }
public class class_name { public void remove(String item) { if(item == null || item.isEmpty()){ return; // depends on control dependency: [if], data = [none] } if(LOGGER.isDebugEnabled()) { LOGGER.debug("移除词性:" + item); // depends on control dependency: [if], data = [none] } //从根节点开始查找 //获取根节点 TrieNode<V> node = getRootNode(item.charAt(0)); if(node == null){ //不存在根节点,结束查找 if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } int length = item.length(); //存在根节点,继续查找 for(int i=1;i<length;i++){ char character = item.charAt(i); TrieNode<V> child = node.getChild(character); if(child == null){ //未找到匹配节点 if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] }else{ //找到节点,继续往下找 node = child; // depends on control dependency: [if], data = [none] } } if(node.isTerminal()){ //设置为非叶子节点,效果相当于移除词性 node.setTerminal(false); // depends on control dependency: [if], data = [none] node.setValue(null); // depends on control dependency: [if], data = [none] if(LOGGER.isDebugEnabled()) { LOGGER.debug("成功移除词性:" + item); // depends on control dependency: [if], data = [none] } }else{ if(LOGGER.isDebugEnabled()) { LOGGER.debug("词性不存在:" + item); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public final Counts run(final File inputFile, final File outputFile) { Counts result = null; FileSystemDirectoryHelper dirHelper = new FileSystemDirectoryHelper(); RunnerHelper currentRunner = DependencyManager.getOrCreate(RunnerHelper.class); RunnerHelper helper = new RunnerHelper(); DependencyManager.inject(RunnerHelper.class, helper); helper.setFile(dirHelper.rel2abs(System.getProperty("user.dir"), inputFile.toString())); helper.setResultFile(dirHelper.rel2abs(System.getProperty("user.dir"), outputFile.toString())); helper.setRunner(this); helper.setHelper(dirHelper); try { result = process(inputFile, outputFile); } catch (Exception e) { System.err.printf("%s while processing %s -> %s%n", e, inputFile, outputFile); System.err.println(e.getMessage()); e.printStackTrace(); } finally { DependencyManager.inject(RunnerHelper.class, currentRunner); } return result; } }
public class class_name { @Override public final Counts run(final File inputFile, final File outputFile) { Counts result = null; FileSystemDirectoryHelper dirHelper = new FileSystemDirectoryHelper(); RunnerHelper currentRunner = DependencyManager.getOrCreate(RunnerHelper.class); RunnerHelper helper = new RunnerHelper(); DependencyManager.inject(RunnerHelper.class, helper); helper.setFile(dirHelper.rel2abs(System.getProperty("user.dir"), inputFile.toString())); helper.setResultFile(dirHelper.rel2abs(System.getProperty("user.dir"), outputFile.toString())); helper.setRunner(this); helper.setHelper(dirHelper); try { result = process(inputFile, outputFile); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.printf("%s while processing %s -> %s%n", e, inputFile, outputFile); System.err.println(e.getMessage()); e.printStackTrace(); } finally { // depends on control dependency: [catch], data = [none] DependencyManager.inject(RunnerHelper.class, currentRunner); } return result; } }