code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public String fromByteArray(byte[] bytes, int offset, int length) { java.util.Objects.requireNonNull(bytes, "bytes"); Objects.validArgument(offset >= 0, "offset must be equal or greater than zero"); Objects.validArgument(length > 0, "length must be greater than zero"); Objects.validArgument(offset + length <= bytes.length , "(offset + length) must be less than %s", bytes.length); if (byteSeparator != null && byteSeparator.length() > 0) { return fromByteArrayInternal(bytes, offset, length, byteSeparator); } else { return fromByteArrayInternal(bytes, offset, length); } } }
public class class_name { public String fromByteArray(byte[] bytes, int offset, int length) { java.util.Objects.requireNonNull(bytes, "bytes"); Objects.validArgument(offset >= 0, "offset must be equal or greater than zero"); Objects.validArgument(length > 0, "length must be greater than zero"); Objects.validArgument(offset + length <= bytes.length , "(offset + length) must be less than %s", bytes.length); if (byteSeparator != null && byteSeparator.length() > 0) { return fromByteArrayInternal(bytes, offset, length, byteSeparator); // depends on control dependency: [if], data = [none] } else { return fromByteArrayInternal(bytes, offset, length); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void disconnectBegin() { if (this.startPoint != null) { this.startPoint.remove(this); } this.startPoint = new SGraphPoint(getGraph()); this.startPoint.add(this); } }
public class class_name { public void disconnectBegin() { if (this.startPoint != null) { this.startPoint.remove(this); // depends on control dependency: [if], data = [none] } this.startPoint = new SGraphPoint(getGraph()); this.startPoint.add(this); } }
public class class_name { @Override protected void perturbation(List<DoubleSolution> swarm) { nonUniformMutation.setCurrentIteration(currentIteration); for (int i = 0; i < swarm.size(); i++) { if (i % 3 == 0) { nonUniformMutation.execute(swarm.get(i)); } else if (i % 3 == 1) { uniformMutation.execute(swarm.get(i)); } } } }
public class class_name { @Override protected void perturbation(List<DoubleSolution> swarm) { nonUniformMutation.setCurrentIteration(currentIteration); for (int i = 0; i < swarm.size(); i++) { if (i % 3 == 0) { nonUniformMutation.execute(swarm.get(i)); // depends on control dependency: [if], data = [none] } else if (i % 3 == 1) { uniformMutation.execute(swarm.get(i)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void clear() { if (mSize != 0) { freeArrays(mHashes, mArray, mSize); mHashes = ContainerHelpers.EMPTY_INTS; mArray = ContainerHelpers.EMPTY_OBJECTS; mSize = 0; } } }
public class class_name { @Override public void clear() { if (mSize != 0) { freeArrays(mHashes, mArray, mSize); // depends on control dependency: [if], data = [none] mHashes = ContainerHelpers.EMPTY_INTS; // depends on control dependency: [if], data = [none] mArray = ContainerHelpers.EMPTY_OBJECTS; // depends on control dependency: [if], data = [none] mSize = 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void localUpdateLongRunningFree(Address logicalAddress, Long freeCount) { if (trace) log.tracef("LOCAL_UPDATE_LONGRUNNING_FREE(%s, %d)", logicalAddress, freeCount); DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(logicalAddress); if (dwm != null) { Collection<NotificationListener> copy = new ArrayList<NotificationListener>(dwm.getNotificationListeners()); for (NotificationListener nl : copy) { nl.updateLongRunningFree(logicalAddress, freeCount); } } else { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); wmeq.addEvent(new WorkManagerEvent(WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING, logicalAddress, freeCount)); } } }
public class class_name { public void localUpdateLongRunningFree(Address logicalAddress, Long freeCount) { if (trace) log.tracef("LOCAL_UPDATE_LONGRUNNING_FREE(%s, %d)", logicalAddress, freeCount); DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(logicalAddress); if (dwm != null) { Collection<NotificationListener> copy = new ArrayList<NotificationListener>(dwm.getNotificationListeners()); for (NotificationListener nl : copy) { nl.updateLongRunningFree(logicalAddress, freeCount); // depends on control dependency: [for], data = [nl] } } else { WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance(); wmeq.addEvent(new WorkManagerEvent(WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING, logicalAddress, freeCount)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isUnacceptable(E element) { Ranking ranking = this.map.get(element); if (ranking == null) { return false; } return ranking.isUnacceptable(); } }
public class class_name { public boolean isUnacceptable(E element) { Ranking ranking = this.map.get(element); if (ranking == null) { return false; // depends on control dependency: [if], data = [none] } return ranking.isUnacceptable(); } }
public class class_name { public void setAttributeDefinitions(java.util.Collection<AttributeDefinition> attributeDefinitions) { if (attributeDefinitions == null) { this.attributeDefinitions = null; return; } this.attributeDefinitions = new java.util.ArrayList<AttributeDefinition>(attributeDefinitions); } }
public class class_name { public void setAttributeDefinitions(java.util.Collection<AttributeDefinition> attributeDefinitions) { if (attributeDefinitions == null) { this.attributeDefinitions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.attributeDefinitions = new java.util.ArrayList<AttributeDefinition>(attributeDefinitions); } }
public class class_name { public static Map<String, DataSource> getDataSourceMap(final Map<String, DataSourceConfiguration> dataSourceConfigurationMap) { Map<String, DataSource> result = new LinkedHashMap<>(dataSourceConfigurationMap.size(), 1); for (Entry<String, DataSourceConfiguration> entry : dataSourceConfigurationMap.entrySet()) { result.put(entry.getKey(), entry.getValue().createDataSource()); } return result; } }
public class class_name { public static Map<String, DataSource> getDataSourceMap(final Map<String, DataSourceConfiguration> dataSourceConfigurationMap) { Map<String, DataSource> result = new LinkedHashMap<>(dataSourceConfigurationMap.size(), 1); for (Entry<String, DataSourceConfiguration> entry : dataSourceConfigurationMap.entrySet()) { result.put(entry.getKey(), entry.getValue().createDataSource()); // depends on control dependency: [for], data = [entry] } return result; } }
public class class_name { public EClass getIfcStructuralPointReaction() { if (ifcStructuralPointReactionEClass == null) { ifcStructuralPointReactionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(560); } return ifcStructuralPointReactionEClass; } }
public class class_name { public EClass getIfcStructuralPointReaction() { if (ifcStructuralPointReactionEClass == null) { ifcStructuralPointReactionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(560); // depends on control dependency: [if], data = [none] } return ifcStructuralPointReactionEClass; } }
public class class_name { public Image setSizeFromGif(File gif) { if (gif.canRead()) { FileInputStream in = null; try{ byte [] buf = new byte[10]; in = new FileInputStream(gif); if (in.read(buf,0,10)==10) { if(log.isDebugEnabled())log.debug("Image "+gif.getName()+ " is " + ((0x00ff&buf[7])*256+(0x00ff&buf[6])) + " x " + (((0x00ff&buf[9])*256+(0x00ff&buf[8])))); width((0x00ff&buf[7])*256+(0x00ff&buf[6])); height(((0x00ff&buf[9])*256+(0x00ff&buf[8]))); } } catch (IOException e){ LogSupport.ignore(log,e); } finally { IO.close(in); } } return this; } }
public class class_name { public Image setSizeFromGif(File gif) { if (gif.canRead()) { FileInputStream in = null; try{ byte [] buf = new byte[10]; in = new FileInputStream(gif); // depends on control dependency: [try], data = [none] if (in.read(buf,0,10)==10) { if(log.isDebugEnabled())log.debug("Image "+gif.getName()+ " is " + ((0x00ff&buf[7])*256+(0x00ff&buf[6])) + " x " + (((0x00ff&buf[9])*256+(0x00ff&buf[8])))); width((0x00ff&buf[7])*256+(0x00ff&buf[6])); // depends on control dependency: [if], data = [none] height(((0x00ff&buf[9])*256+(0x00ff&buf[8]))); // depends on control dependency: [if], data = [none] } } catch (IOException e){ LogSupport.ignore(log,e); } // depends on control dependency: [catch], data = [none] finally { IO.close(in); } } return this; } }
public class class_name { public static void main(String[] args) { if (args.length != 0) { LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioJobMasterMonitor.class.getCanonicalName()); LOG.warn("ignoring arguments"); } AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); HealthCheckClient client; // Only the primary master serves RPCs, so if we're configured for HA, fall back to simply // checking for the running process. if (ConfigurationUtils.isHaMode(conf)) { client = new MasterHealthCheckClient.Builder(conf) .withAlluxioMasterType(MasterHealthCheckClient.MasterType.JOB_MASTER) .build(); } else { client = new JobMasterRpcHealthCheckClient(NetworkAddressUtils .getConnectAddress(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, conf), AlluxioMasterMonitor.TWO_MIN_EXP_BACKOFF, conf); } if (!client.isServing()) { System.exit(1); } System.exit(0); } }
public class class_name { public static void main(String[] args) { if (args.length != 0) { LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioJobMasterMonitor.class.getCanonicalName()); // depends on control dependency: [if], data = [none] LOG.warn("ignoring arguments"); // depends on control dependency: [if], data = [none] } AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); HealthCheckClient client; // Only the primary master serves RPCs, so if we're configured for HA, fall back to simply // checking for the running process. if (ConfigurationUtils.isHaMode(conf)) { client = new MasterHealthCheckClient.Builder(conf) .withAlluxioMasterType(MasterHealthCheckClient.MasterType.JOB_MASTER) .build(); // depends on control dependency: [if], data = [none] } else { client = new JobMasterRpcHealthCheckClient(NetworkAddressUtils .getConnectAddress(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, conf), AlluxioMasterMonitor.TWO_MIN_EXP_BACKOFF, conf); // depends on control dependency: [if], data = [none] } if (!client.isServing()) { System.exit(1); // depends on control dependency: [if], data = [none] } System.exit(0); } }
public class class_name { public void processIOException(IOExceptionEvent event) { if(event instanceof IOExceptionEventExt && ((IOExceptionEventExt)event).getReason() == gov.nist.javax.sip.IOExceptionEventExt.Reason.KeepAliveTimeout) { IOExceptionEventExt keepAliveTimeout = ((IOExceptionEventExt)event); SipConnector connector = findSipConnector( keepAliveTimeout.getLocalHost(), keepAliveTimeout.getLocalPort(), keepAliveTimeout.getTransport()); if(connector != null) { for (SipContext sipContext : applicationDeployed.values()) { final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); sipContext.enterSipContext(); try { for (SipConnectorListener connectorListener : sipContext.getListeners().getSipConnectorListeners()) { try { connectorListener.onKeepAliveTimeout(connector, keepAliveTimeout.getPeerHost(), keepAliveTimeout.getPeerPort()); } catch (Throwable t) { logger.error("SipErrorListener threw exception", t); } } } finally { sipContext.exitSipContext(oldClassLoader); } } // return; } } if(dnsServerLocator != null && event.getSource() instanceof ClientTransaction) { ClientTransaction ioExceptionTx = (ClientTransaction) event.getSource(); if(ioExceptionTx.getApplicationData() != null) { SipServletMessageImpl sipServletMessageImpl = ((TransactionApplicationData)ioExceptionTx.getApplicationData()).getSipServletMessage(); if(sipServletMessageImpl != null && sipServletMessageImpl instanceof SipServletRequestImpl) { if(logger.isDebugEnabled()) { logger.debug("An IOException occured on " + event.getHost() + ":" + event.getPort() + "/" + event.getTransport() + " for source " + event.getSource() + ", trying to visit next hop as per RFC3263"); } if(((SipServletRequestImpl)sipServletMessageImpl).visitNextHop()) { return; } } } } logger.error("An IOException occured on " + event.getHost() + ":" + event.getPort() + "/" + event.getTransport() + " for source " + event.getSource()); } }
public class class_name { public void processIOException(IOExceptionEvent event) { if(event instanceof IOExceptionEventExt && ((IOExceptionEventExt)event).getReason() == gov.nist.javax.sip.IOExceptionEventExt.Reason.KeepAliveTimeout) { IOExceptionEventExt keepAliveTimeout = ((IOExceptionEventExt)event); SipConnector connector = findSipConnector( keepAliveTimeout.getLocalHost(), keepAliveTimeout.getLocalPort(), keepAliveTimeout.getTransport()); if(connector != null) { for (SipContext sipContext : applicationDeployed.values()) { final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); sipContext.enterSipContext(); // depends on control dependency: [for], data = [sipContext] try { for (SipConnectorListener connectorListener : sipContext.getListeners().getSipConnectorListeners()) { try { connectorListener.onKeepAliveTimeout(connector, keepAliveTimeout.getPeerHost(), keepAliveTimeout.getPeerPort()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { logger.error("SipErrorListener threw exception", t); } // depends on control dependency: [catch], data = [none] } } finally { sipContext.exitSipContext(oldClassLoader); } } // return; } } if(dnsServerLocator != null && event.getSource() instanceof ClientTransaction) { ClientTransaction ioExceptionTx = (ClientTransaction) event.getSource(); if(ioExceptionTx.getApplicationData() != null) { SipServletMessageImpl sipServletMessageImpl = ((TransactionApplicationData)ioExceptionTx.getApplicationData()).getSipServletMessage(); if(sipServletMessageImpl != null && sipServletMessageImpl instanceof SipServletRequestImpl) { if(logger.isDebugEnabled()) { logger.debug("An IOException occured on " + event.getHost() + ":" + event.getPort() + "/" + event.getTransport() + " for source " + event.getSource() + ", trying to visit next hop as per RFC3263"); // depends on control dependency: [if], data = [none] } if(((SipServletRequestImpl)sipServletMessageImpl).visitNextHop()) { return; // depends on control dependency: [if], data = [none] } } } } logger.error("An IOException occured on " + event.getHost() + ":" + event.getPort() + "/" + event.getTransport() + " for source " + event.getSource()); } }
public class class_name { public void marshall(ListPullRequestsRequest listPullRequestsRequest, ProtocolMarshaller protocolMarshaller) { if (listPullRequestsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPullRequestsRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(listPullRequestsRequest.getAuthorArn(), AUTHORARN_BINDING); protocolMarshaller.marshall(listPullRequestsRequest.getPullRequestStatus(), PULLREQUESTSTATUS_BINDING); protocolMarshaller.marshall(listPullRequestsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listPullRequestsRequest.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(ListPullRequestsRequest listPullRequestsRequest, ProtocolMarshaller protocolMarshaller) { if (listPullRequestsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPullRequestsRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPullRequestsRequest.getAuthorArn(), AUTHORARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPullRequestsRequest.getPullRequestStatus(), PULLREQUESTSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPullRequestsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPullRequestsRequest.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 { public static Buffer getQueue(int size) { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_PUBLISH_HISTORY_SIZE_SET_1, new Integer(size))); } return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new CircularFifoBuffer(size) { /** The serialization version id constant. */ private static final long serialVersionUID = -6257542123241183114L; /** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove(); try { OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob); } catch (CmsException exc) { if (LOG.isErrorEnabled()) { LOG.error(exc.getLocalizedMessage(), exc); } } return publishJob; } }, CmsPublishJobInfoBean.class)); } }
public class class_name { public static Buffer getQueue(int size) { if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_PUBLISH_HISTORY_SIZE_SET_1, new Integer(size))); // depends on control dependency: [if], data = [none] } return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new CircularFifoBuffer(size) { /** The serialization version id constant. */ private static final long serialVersionUID = -6257542123241183114L; /** * Called when the queue is full to remove the oldest element.<p> * * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove() */ @Override public Object remove() { CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove(); try { OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob); // depends on control dependency: [try], data = [none] } catch (CmsException exc) { if (LOG.isErrorEnabled()) { LOG.error(exc.getLocalizedMessage(), exc); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return publishJob; } }, CmsPublishJobInfoBean.class)); } }
public class class_name { private void calcAutoWidth(int i) { int w = 10; w = Math.max(w, fMetrics.stringWidth(sColHead[i])); for (int j = 0; j < iRowCount; j++) { String[] s = (String[]) (vData.elementAt(j)); w = Math.max(w, fMetrics.stringWidth(s[i])); } iColWidth[i] = w + 6; } }
public class class_name { private void calcAutoWidth(int i) { int w = 10; w = Math.max(w, fMetrics.stringWidth(sColHead[i])); for (int j = 0; j < iRowCount; j++) { String[] s = (String[]) (vData.elementAt(j)); w = Math.max(w, fMetrics.stringWidth(s[i])); // depends on control dependency: [for], data = [none] } iColWidth[i] = w + 6; } }
public class class_name { private OpenConnection openURL(URL url) { if(url==null) return null; // jetty reports directories as URLs, which isn't what this is intended for, // so check and reject. File f = toFile(url); if(f!=null && f.isDirectory()) return null; try { // in normal protocol handlers like http/file, openConnection doesn't actually open a connection // (that's deferred until URLConnection.connect()), so this method doesn't result in an error, // even if URL points to something that doesn't exist. // // but we've heard a report from http://github.com/adreghiciu that some URLS backed by custom // protocol handlers can throw an exception as early as here. So treat this IOException // as "the resource pointed by URL is missing". URLConnection con = url.openConnection(); OpenConnection c = new OpenConnection(con); // Some URLs backed by custom broken protocol handler can return null from getInputStream(), // so let's be defensive here. An example of that is an OSGi container --- unfortunately // we don't have more details than that. if(c.stream==null) return null; return c; } catch (IOException e) { // Tomcat only reports a missing resource error here, from URLConnection.getInputStream() return null; } } }
public class class_name { private OpenConnection openURL(URL url) { if(url==null) return null; // jetty reports directories as URLs, which isn't what this is intended for, // so check and reject. File f = toFile(url); if(f!=null && f.isDirectory()) return null; try { // in normal protocol handlers like http/file, openConnection doesn't actually open a connection // (that's deferred until URLConnection.connect()), so this method doesn't result in an error, // even if URL points to something that doesn't exist. // // but we've heard a report from http://github.com/adreghiciu that some URLS backed by custom // protocol handlers can throw an exception as early as here. So treat this IOException // as "the resource pointed by URL is missing". URLConnection con = url.openConnection(); OpenConnection c = new OpenConnection(con); // Some URLs backed by custom broken protocol handler can return null from getInputStream(), // so let's be defensive here. An example of that is an OSGi container --- unfortunately // we don't have more details than that. if(c.stream==null) return null; return c; // depends on control dependency: [try], data = [none] } catch (IOException e) { // Tomcat only reports a missing resource error here, from URLConnection.getInputStream() return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Date parse(String dateString) throws ParseException { Date result = null; ParseException lastException = null; for (DateFormat format : inputFormats) { try { result = ((DateFormat) format.clone()).parse(dateString); // DateFormat is not thread safe. lastException = null; break; } catch (ParseException e) { // Keep the first exception that occurred. if (lastException == null) { lastException = e; } // And just try the next input format. } } if (lastException != null) { throw lastException; } return result; } }
public class class_name { public Date parse(String dateString) throws ParseException { Date result = null; ParseException lastException = null; for (DateFormat format : inputFormats) { try { result = ((DateFormat) format.clone()).parse(dateString); // DateFormat is not thread safe. // depends on control dependency: [try], data = [none] lastException = null; // depends on control dependency: [try], data = [none] break; } catch (ParseException e) { // Keep the first exception that occurred. if (lastException == null) { lastException = e; // depends on control dependency: [if], data = [none] } // And just try the next input format. } // depends on control dependency: [catch], data = [none] } if (lastException != null) { throw lastException; } return result; } }
public class class_name { public Iterator<URL> getResources(String name) { ArrayList<URL> collectedResources = new ArrayList<URL>(); try { synchronized (bundles) { Collection<Bundle> values = bundles.values(); for (Bundle bundle : values) { final Enumeration<URL> enumeration = bundle.getResources(name); if (enumeration == null) { continue; } while (enumeration.hasMoreElements()) { collectedResources.add(enumeration.nextElement()); } } } } catch (IOException e) { LOGGER.warn("IO exception during reading resources from bundle; returning current state."); collectedResources.iterator(); } return collectedResources.iterator(); } }
public class class_name { public Iterator<URL> getResources(String name) { ArrayList<URL> collectedResources = new ArrayList<URL>(); try { synchronized (bundles) { // depends on control dependency: [try], data = [none] Collection<Bundle> values = bundles.values(); for (Bundle bundle : values) { final Enumeration<URL> enumeration = bundle.getResources(name); if (enumeration == null) { continue; } while (enumeration.hasMoreElements()) { collectedResources.add(enumeration.nextElement()); // depends on control dependency: [while], data = [none] } } } } catch (IOException e) { LOGGER.warn("IO exception during reading resources from bundle; returning current state."); collectedResources.iterator(); } // depends on control dependency: [catch], data = [none] return collectedResources.iterator(); } }
public class class_name { public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) { for (DatabaseProtocolFrontendEngine each : NewInstanceServiceLoader.newServiceInstances(DatabaseProtocolFrontendEngine.class)) { if (DatabaseType.valueFrom(each.getDatabaseType()) == databaseType) { return each; } } throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType)); } }
public class class_name { public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) { for (DatabaseProtocolFrontendEngine each : NewInstanceServiceLoader.newServiceInstances(DatabaseProtocolFrontendEngine.class)) { if (DatabaseType.valueFrom(each.getDatabaseType()) == databaseType) { return each; // depends on control dependency: [if], data = [none] } } throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType)); } }
public class class_name { public static Constructor getConstructor(final String name) throws ClassNotFoundException, NoSuchMethodException { Constructor constructor = constructorsCache.get(name); if (constructor == null) { synchronized (constructorsCache) { constructor = constructorsCache.get(name); if (constructor == null) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl == null) { constructor = Class.forName(name).getDeclaredConstructor(); } else { constructor = Class.forName(name, true, tccl).getDeclaredConstructor(); } constructorsCache.put(name, constructor); } } } return constructor; } }
public class class_name { public static Constructor getConstructor(final String name) throws ClassNotFoundException, NoSuchMethodException { Constructor constructor = constructorsCache.get(name); if (constructor == null) { synchronized (constructorsCache) { constructor = constructorsCache.get(name); if (constructor == null) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl == null) { constructor = Class.forName(name).getDeclaredConstructor(); // depends on control dependency: [if], data = [none] } else { constructor = Class.forName(name, true, tccl).getDeclaredConstructor(); // depends on control dependency: [if], data = [none] } constructorsCache.put(name, constructor); // depends on control dependency: [if], data = [none] } } } return constructor; } }
public class class_name { public void marshall(EnableEnhancedMonitoringRequest enableEnhancedMonitoringRequest, ProtocolMarshaller protocolMarshaller) { if (enableEnhancedMonitoringRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(enableEnhancedMonitoringRequest.getStreamName(), STREAMNAME_BINDING); protocolMarshaller.marshall(enableEnhancedMonitoringRequest.getShardLevelMetrics(), SHARDLEVELMETRICS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EnableEnhancedMonitoringRequest enableEnhancedMonitoringRequest, ProtocolMarshaller protocolMarshaller) { if (enableEnhancedMonitoringRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(enableEnhancedMonitoringRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(enableEnhancedMonitoringRequest.getShardLevelMetrics(), SHARDLEVELMETRICS_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 void printMessage(final String message, final PrintStream stream, final int priority) { if (useColor && priority == Project.MSG_ERR) { stream.print(ANSI_RED); stream.print(message); stream.println(ANSI_RESET); } else { stream.println(message); } } }
public class class_name { private void printMessage(final String message, final PrintStream stream, final int priority) { if (useColor && priority == Project.MSG_ERR) { stream.print(ANSI_RED); // depends on control dependency: [if], data = [none] stream.print(message); // depends on control dependency: [if], data = [none] stream.println(ANSI_RESET); // depends on control dependency: [if], data = [none] } else { stream.println(message); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int getItemCount() { if (mAdapter != null) { /* No of currently fetched ads, as long as it isn't more than no of max ads that can fit dataset. */ int noOfAds = AdapterCalculator.getAdsCountToPublish(adFetcher.getFetchedAdsCount(), mAdapter.getItemCount()); return mAdapter.getItemCount() > 0 ? mAdapter.getItemCount() + noOfAds : 0; } else { return 0; } } }
public class class_name { @Override public int getItemCount() { if (mAdapter != null) { /* No of currently fetched ads, as long as it isn't more than no of max ads that can fit dataset. */ int noOfAds = AdapterCalculator.getAdsCountToPublish(adFetcher.getFetchedAdsCount(), mAdapter.getItemCount()); return mAdapter.getItemCount() > 0 ? mAdapter.getItemCount() + noOfAds : 0; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected final void checkMaxSize(final Dimension screenSize, final Dimension frameSize) { if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } } }
public class class_name { protected final void checkMaxSize(final Dimension screenSize, final Dimension frameSize) { if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; // depends on control dependency: [if], data = [none] } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) { if (result == null) { Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint }); return false; } String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null; String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null; if (responseStatus == null) { Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint }); return false; } if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) { Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg }); return false; } return true; } }
public class class_name { protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) { if (result == null) { Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint }); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null; String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null; if (responseStatus == null) { Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint }); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) { Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg }); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { int[] getTrimmedLocals() { int last = locals.length - 1; // Exclude all of the trailing TOPs not bound to a DOUBLE/LONG while (last >= 0 && locals[last] == TypeInfo.TOP && !TypeInfo.isTwoWords(locals[last - 1])) { last--; } last++; // Exclude trailing TOPs following a DOUBLE/LONG int size = last; for (int i = 0; i < last; i++) { if (TypeInfo.isTwoWords(locals[i])) { size--; } } int[] copy = new int[size]; for (int i = 0, j = 0; i < size; i++, j++) { copy[i] = locals[j]; if (TypeInfo.isTwoWords(locals[j])) { j++; } } return copy; } }
public class class_name { int[] getTrimmedLocals() { int last = locals.length - 1; // Exclude all of the trailing TOPs not bound to a DOUBLE/LONG while (last >= 0 && locals[last] == TypeInfo.TOP && !TypeInfo.isTwoWords(locals[last - 1])) { last--; // depends on control dependency: [while], data = [none] } last++; // Exclude trailing TOPs following a DOUBLE/LONG int size = last; for (int i = 0; i < last; i++) { if (TypeInfo.isTwoWords(locals[i])) { size--; // depends on control dependency: [if], data = [none] } } int[] copy = new int[size]; for (int i = 0, j = 0; i < size; i++, j++) { copy[i] = locals[j]; // depends on control dependency: [for], data = [i] if (TypeInfo.isTwoWords(locals[j])) { j++; // depends on control dependency: [if], data = [none] } } return copy; } }
public class class_name { private BasicInjectionTarget<T> prepareInjectionTarget(BasicInjectionTarget<T> injectionTarget) { try { postProcess(initialize(validate(injectionTarget))); return injectionTarget; } catch (Throwable e) { throw new IllegalArgumentException(e); } } }
public class class_name { private BasicInjectionTarget<T> prepareInjectionTarget(BasicInjectionTarget<T> injectionTarget) { try { postProcess(initialize(validate(injectionTarget))); // depends on control dependency: [try], data = [none] return injectionTarget; // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override protected boolean reject(LogItem log) { if (whitelistTags != null) { for (String enabledTag : whitelistTags) { if (log.tag.equals(enabledTag)) { return false; } } } return true; } }
public class class_name { @Override protected boolean reject(LogItem log) { if (whitelistTags != null) { for (String enabledTag : whitelistTags) { if (log.tag.equals(enabledTag)) { return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { private boolean newSharedImage(String name, String sharedName) { boolean success = true; ImageDescriptor id = getSharedByName(sharedName); if (id == null) { id = ImageDescriptor.getMissingImageDescriptor(); // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false; } descMap.put(name, id); imageMap.put(name, id.createImage(true)); return success; } }
public class class_name { private boolean newSharedImage(String name, String sharedName) { boolean success = true; ImageDescriptor id = getSharedByName(sharedName); if (id == null) { id = ImageDescriptor.getMissingImageDescriptor(); // depends on control dependency: [if], data = [none] // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false; // depends on control dependency: [if], data = [none] } descMap.put(name, id); imageMap.put(name, id.createImage(true)); return success; } }
public class class_name { @Override public ImageSource apply(ImageSource input) { final int[][] pixelMatrix = new int[3][3]; int w = input.getWidth(); int h = input.getHeight(); int[][] output = new int[h][w]; for (int j = 1; j < h - 1; j++) { for (int i = 1; i < w - 1; i++) { pixelMatrix[0][0] = input.getR(i - 1, j - 1); pixelMatrix[0][1] = input.getRGB(i - 1, j); pixelMatrix[0][2] = input.getRGB(i - 1, j + 1); pixelMatrix[1][0] = input.getRGB(i, j - 1); pixelMatrix[1][2] = input.getRGB(i, j + 1); pixelMatrix[2][0] = input.getRGB(i + 1, j - 1); pixelMatrix[2][1] = input.getRGB(i + 1, j); pixelMatrix[2][2] = input.getRGB(i + 1, j + 1); int edge = (int) convolution(pixelMatrix); int rgb = (edge << 16 | edge << 8 | edge); output[j][i] = rgb; } } MatrixSource source = new MatrixSource(output); return source; } }
public class class_name { @Override public ImageSource apply(ImageSource input) { final int[][] pixelMatrix = new int[3][3]; int w = input.getWidth(); int h = input.getHeight(); int[][] output = new int[h][w]; for (int j = 1; j < h - 1; j++) { for (int i = 1; i < w - 1; i++) { pixelMatrix[0][0] = input.getR(i - 1, j - 1); // depends on control dependency: [for], data = [i] pixelMatrix[0][1] = input.getRGB(i - 1, j); // depends on control dependency: [for], data = [i] pixelMatrix[0][2] = input.getRGB(i - 1, j + 1); // depends on control dependency: [for], data = [i] pixelMatrix[1][0] = input.getRGB(i, j - 1); // depends on control dependency: [for], data = [i] pixelMatrix[1][2] = input.getRGB(i, j + 1); // depends on control dependency: [for], data = [i] pixelMatrix[2][0] = input.getRGB(i + 1, j - 1); // depends on control dependency: [for], data = [i] pixelMatrix[2][1] = input.getRGB(i + 1, j); // depends on control dependency: [for], data = [i] pixelMatrix[2][2] = input.getRGB(i + 1, j + 1); // depends on control dependency: [for], data = [i] int edge = (int) convolution(pixelMatrix); int rgb = (edge << 16 | edge << 8 | edge); output[j][i] = rgb; // depends on control dependency: [for], data = [i] } } MatrixSource source = new MatrixSource(output); return source; } }
public class class_name { private void startFolderMonitor() { if (serverConfiguration.getAppFolderToMonitor() != null) { try { folderMonitor = new FolderMonitor(this, serverConfiguration); folderMonitor.start(); } catch (IOException e) { log.warning("Could not monitor the given folder: " + serverConfiguration.getAppFolderToMonitor()); } } } }
public class class_name { private void startFolderMonitor() { if (serverConfiguration.getAppFolderToMonitor() != null) { try { folderMonitor = new FolderMonitor(this, serverConfiguration); // depends on control dependency: [try], data = [none] folderMonitor.start(); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.warning("Could not monitor the given folder: " + serverConfiguration.getAppFolderToMonitor()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private double evaluateClusters(ArrayList<PROCLUSCluster> clusters, long[][] dimensions, Relation<V> database) { double result = 0; for(int i = 0; i < dimensions.length; i++) { PROCLUSCluster c_i = clusters.get(i); double[] centroid_i = c_i.centroid; long[] dims_i = dimensions[i]; double w_i = 0; for(int d = BitsUtil.nextSetBit(dims_i, 0); d >= 0; d = BitsUtil.nextSetBit(dims_i, d + 1)) { w_i += avgDistance(centroid_i, c_i.objectIDs, database, d); } w_i /= dimensions.length; result += c_i.objectIDs.size() * w_i; } return result / database.size(); } }
public class class_name { private double evaluateClusters(ArrayList<PROCLUSCluster> clusters, long[][] dimensions, Relation<V> database) { double result = 0; for(int i = 0; i < dimensions.length; i++) { PROCLUSCluster c_i = clusters.get(i); double[] centroid_i = c_i.centroid; long[] dims_i = dimensions[i]; double w_i = 0; for(int d = BitsUtil.nextSetBit(dims_i, 0); d >= 0; d = BitsUtil.nextSetBit(dims_i, d + 1)) { w_i += avgDistance(centroid_i, c_i.objectIDs, database, d); // depends on control dependency: [for], data = [d] } w_i /= dimensions.length; // depends on control dependency: [for], data = [none] result += c_i.objectIDs.size() * w_i; // depends on control dependency: [for], data = [none] } return result / database.size(); } }
public class class_name { private int getStep(double[] x, double[] dir, double[] newX, double f0, double g0, double[] newPt, double[] bestPt, double[] endPt, double stpMin, double stpMax) throws MaxEvaluationsExceeded { int info = 0; // Should check for input errors. boolean bound = false; double theta, gamma, p, q, r, s, stpc, stpq, stpf; double signG = newPt[g] * bestPt[g] / Math.abs(bestPt[g]); // // First case. A higher function value. // The minimum is bracketed. If the cubic step is closer // to stx than the quadratic step, the cubic step is taken, // else the average of the cubic and quadratic steps is taken. // if (newPt[f] > bestPt[f]) { info = 1; bound = true; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, newPt[g]), bestPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] < bestPt[a]) { gamma = -gamma; } p = (gamma - bestPt[g]) + theta; q = ((gamma - bestPt[g]) + gamma) + newPt[g]; r = p / q; stpc = bestPt[a] + r * (newPt[a] - bestPt[a]); stpq = bestPt[a] + ((bestPt[g] / ((bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g])) / 2) * (newPt[a] - bestPt[a]); if (Math.abs(stpc - bestPt[a]) < Math.abs(stpq - bestPt[a])) { stpf = stpc; } else { stpf = stpq; // stpf = stpc + (stpq - stpc)/2; } bracketed = true; if (newPt[a] < 0.1) { stpf = 0.01 * stpf; } } else if (signG < 0.0) { // // Second case. A lower function value and derivatives of // opposite sign. The minimum is bracketed. If the cubic // step is closer to stx than the quadratic (secant) step, // the cubic step is taken, else the quadratic step is taken. // info = 2; bound = false; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] > bestPt[a]) { gamma = -gamma; } p = (gamma - newPt[g]) + theta; q = ((gamma - newPt[g]) + gamma) + bestPt[g]; r = p / q; stpc = newPt[a] + r * (bestPt[a] - newPt[a]); stpq = newPt[a] + (newPt[g] / (newPt[g] - bestPt[g])) * (bestPt[a] - newPt[a]); if (Math.abs(stpc - newPt[a]) > Math.abs(stpq - newPt[a])) { stpf = stpc; } else { stpf = stpq; } bracketed = true; } else if (Math.abs(newPt[g]) < Math.abs(bestPt[g])) { // // Third case. A lower function value, derivatives of the // same sign, and the magnitude of the derivative decreases. // The cubic step is only used if the cubic tends to infinity // in the direction of the step or if the minimum of the cubic // is beyond stp. Otherwise the cubic step is defined to be // either stpmin or stpmax. The quadratic (secant) step is also // computed and if the minimum is bracketed then the the step // closest to stx is taken, else the step farthest away is taken. // info = 3; bound = true; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt(Math.max(0.0, (theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s))); if (newPt[a] < bestPt[a]) { gamma = -gamma; } p = (gamma - bestPt[g]) + theta; q = ((gamma - bestPt[g]) + gamma) + newPt[g]; r = p / q; if (r < 0.0 && gamma != 0.0) { stpc = newPt[a] + r * (bestPt[a] - newPt[a]); } else if (newPt[a] > bestPt[a]) { stpc = stpMax; } else { stpc = stpMin; } stpq = newPt[a] + (newPt[g] / (newPt[g] - bestPt[g])) * (bestPt[a] - newPt[a]); if (bracketed) { if (Math.abs(newPt[a] - stpc) < Math.abs(newPt[a] - stpq)) { stpf = stpc; } else { stpf = stpq; } } else { if (Math.abs(newPt[a] - stpc) > Math.abs(newPt[a] - stpq)) { stpf = stpc; } else { stpf = stpq; } } } else { // // Fourth case. A lower function value, derivatives of the // same sign, and the magnitude of the derivative does // not decrease. If the minimum is not bracketed, the step // is either stpmin or stpmax, else the cubic step is taken. // info = 4; bound = false; if (bracketed) { theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] > bestPt[a]) { gamma = -gamma; } p = (gamma - newPt[g]) + theta; q = ((gamma - newPt[g]) + gamma) + bestPt[g]; r = p / q; stpc = newPt[a] + r * (bestPt[a] - newPt[a]); stpf = stpc; } else if (newPt[a] > bestPt[a]) { stpf = stpMax; } else { stpf = stpMin; } } // // Update the interval of uncertainty. This update does not // depend on the new step or the case analysis above. // if (newPt[f] > bestPt[f]) { copy(newPt, endPt); } else { if (signG < 0.0) { copy(bestPt, endPt); } copy(newPt, bestPt); } say(String.valueOf(info)); // // Compute the new step and safeguard it. // stpf = Math.min(stpMax, stpf); stpf = Math.max(stpMin, stpf); newPt[a] = stpf; if (bracketed && bound) { if (endPt[a] > bestPt[a]) { newPt[a] = Math.min(bestPt[a] + p66 * (endPt[a] - bestPt[a]), newPt[a]); } else { newPt[a] = Math.max(bestPt[a] + p66 * (endPt[a] - bestPt[a]), newPt[a]); } } return info; } }
public class class_name { private int getStep(double[] x, double[] dir, double[] newX, double f0, double g0, double[] newPt, double[] bestPt, double[] endPt, double stpMin, double stpMax) throws MaxEvaluationsExceeded { int info = 0; // Should check for input errors. boolean bound = false; double theta, gamma, p, q, r, s, stpc, stpq, stpf; double signG = newPt[g] * bestPt[g] / Math.abs(bestPt[g]); // // First case. A higher function value. // The minimum is bracketed. If the cubic step is closer // to stx than the quadratic step, the cubic step is taken, // else the average of the cubic and quadratic steps is taken. // if (newPt[f] > bestPt[f]) { info = 1; bound = true; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, newPt[g]), bestPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] < bestPt[a]) { gamma = -gamma; // depends on control dependency: [if], data = [none] } p = (gamma - bestPt[g]) + theta; q = ((gamma - bestPt[g]) + gamma) + newPt[g]; r = p / q; stpc = bestPt[a] + r * (newPt[a] - bestPt[a]); stpq = bestPt[a] + ((bestPt[g] / ((bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g])) / 2) * (newPt[a] - bestPt[a]); if (Math.abs(stpc - bestPt[a]) < Math.abs(stpq - bestPt[a])) { stpf = stpc; // depends on control dependency: [if], data = [none] } else { stpf = stpq; // depends on control dependency: [if], data = [none] // stpf = stpc + (stpq - stpc)/2; } bracketed = true; if (newPt[a] < 0.1) { stpf = 0.01 * stpf; // depends on control dependency: [if], data = [none] } } else if (signG < 0.0) { // // Second case. A lower function value and derivatives of // opposite sign. The minimum is bracketed. If the cubic // step is closer to stx than the quadratic (secant) step, // the cubic step is taken, else the quadratic step is taken. // info = 2; bound = false; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] > bestPt[a]) { gamma = -gamma; } p = (gamma - newPt[g]) + theta; q = ((gamma - newPt[g]) + gamma) + bestPt[g]; r = p / q; stpc = newPt[a] + r * (bestPt[a] - newPt[a]); stpq = newPt[a] + (newPt[g] / (newPt[g] - bestPt[g])) * (bestPt[a] - newPt[a]); if (Math.abs(stpc - newPt[a]) > Math.abs(stpq - newPt[a])) { stpf = stpc; } else { stpf = stpq; } bracketed = true; } else if (Math.abs(newPt[g]) < Math.abs(bestPt[g])) { // // Third case. A lower function value, derivatives of the // same sign, and the magnitude of the derivative decreases. // The cubic step is only used if the cubic tends to infinity // in the direction of the step or if the minimum of the cubic // is beyond stp. Otherwise the cubic step is defined to be // either stpmin or stpmax. The quadratic (secant) step is also // computed and if the minimum is bracketed then the the step // closest to stx is taken, else the step farthest away is taken. // info = 3; bound = true; theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt(Math.max(0.0, (theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s))); if (newPt[a] < bestPt[a]) { gamma = -gamma; } p = (gamma - bestPt[g]) + theta; q = ((gamma - bestPt[g]) + gamma) + newPt[g]; r = p / q; if (r < 0.0 && gamma != 0.0) { stpc = newPt[a] + r * (bestPt[a] - newPt[a]); } else if (newPt[a] > bestPt[a]) { stpc = stpMax; } else { stpc = stpMin; } stpq = newPt[a] + (newPt[g] / (newPt[g] - bestPt[g])) * (bestPt[a] - newPt[a]); if (bracketed) { if (Math.abs(newPt[a] - stpc) < Math.abs(newPt[a] - stpq)) { stpf = stpc; } else { stpf = stpq; } } else { if (Math.abs(newPt[a] - stpc) > Math.abs(newPt[a] - stpq)) { stpf = stpc; } else { stpf = stpq; } } } else { // // Fourth case. A lower function value, derivatives of the // same sign, and the magnitude of the derivative does // not decrease. If the minimum is not bracketed, the step // is either stpmin or stpmax, else the cubic step is taken. // info = 4; bound = false; if (bracketed) { theta = 3 * (bestPt[f] - newPt[f]) / (newPt[a] - bestPt[a]) + bestPt[g] + newPt[g]; s = Math.max(Math.max(theta, bestPt[g]), newPt[g]); gamma = s * Math.sqrt((theta / s) * (theta / s) - (bestPt[g] / s) * (newPt[g] / s)); if (newPt[a] > bestPt[a]) { gamma = -gamma; } p = (gamma - newPt[g]) + theta; q = ((gamma - newPt[g]) + gamma) + bestPt[g]; r = p / q; stpc = newPt[a] + r * (bestPt[a] - newPt[a]); stpf = stpc; } else if (newPt[a] > bestPt[a]) { stpf = stpMax; } else { stpf = stpMin; } } // // Update the interval of uncertainty. This update does not // depend on the new step or the case analysis above. // if (newPt[f] > bestPt[f]) { copy(newPt, endPt); } else { if (signG < 0.0) { copy(bestPt, endPt); } copy(newPt, bestPt); } say(String.valueOf(info)); // // Compute the new step and safeguard it. // stpf = Math.min(stpMax, stpf); stpf = Math.max(stpMin, stpf); newPt[a] = stpf; if (bracketed && bound) { if (endPt[a] > bestPt[a]) { newPt[a] = Math.min(bestPt[a] + p66 * (endPt[a] - bestPt[a]), newPt[a]); } else { newPt[a] = Math.max(bestPt[a] + p66 * (endPt[a] - bestPt[a]), newPt[a]); } } return info; } }
public class class_name { protected void end() { if (trace) log.tracef("Ending work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().endWork(work, xid); } } if (trace) log.tracef("Ended work: %s", this); } }
public class class_name { protected void end() { if (trace) log.tracef("Ending work: %s", this); ExecutionContext ctx = getWorkContext(TransactionContext.class); if (ctx == null) { ctx = getExecutionContext(); // depends on control dependency: [if], data = [none] } if (ctx != null) { Xid xid = ctx.getXid(); if (xid != null) { workManager.getXATerminator().endWork(work, xid); // depends on control dependency: [if], data = [none] } } if (trace) log.tracef("Ended work: %s", this); } }
public class class_name { public static String unCamel(String str, char seperator, boolean lowercase) { char[] ca = str.toCharArray(); if (3 > ca.length) { return lowercase ? str.toLowerCase() : str; } // about five seperator StringBuilder build = new StringBuilder(ca.length + 5); build.append(lowercase ? toLowerCase(ca[0]) : ca[0]); boolean lower1 = isLowerCase(ca[0]); int i = 1; while (i < ca.length - 1) { char cur = ca[i]; char next = ca[i + 1]; boolean upper2 = isUpperCase(cur); boolean lower3 = isLowerCase(next); if (lower1 && upper2 && lower3) { build.append(seperator); build.append(lowercase ? toLowerCase(cur) : cur); build.append(next); i += 2; } else { if (lowercase && upper2) { build.append(toLowerCase(cur)); } else { build.append(cur); } lower1 = !upper2; i++; } } if (i == ca.length - 1) { build.append(lowercase ? toLowerCase(ca[i]) : ca[i]); } return build.toString(); } }
public class class_name { public static String unCamel(String str, char seperator, boolean lowercase) { char[] ca = str.toCharArray(); if (3 > ca.length) { return lowercase ? str.toLowerCase() : str; } // depends on control dependency: [if], data = [none] // about five seperator StringBuilder build = new StringBuilder(ca.length + 5); build.append(lowercase ? toLowerCase(ca[0]) : ca[0]); boolean lower1 = isLowerCase(ca[0]); int i = 1; while (i < ca.length - 1) { char cur = ca[i]; char next = ca[i + 1]; boolean upper2 = isUpperCase(cur); boolean lower3 = isLowerCase(next); if (lower1 && upper2 && lower3) { build.append(seperator); // depends on control dependency: [if], data = [none] build.append(lowercase ? toLowerCase(cur) : cur); // depends on control dependency: [if], data = [none] build.append(next); // depends on control dependency: [if], data = [none] i += 2; // depends on control dependency: [if], data = [none] } else { if (lowercase && upper2) { build.append(toLowerCase(cur)); // depends on control dependency: [if], data = [none] } else { build.append(cur); // depends on control dependency: [if], data = [none] } lower1 = !upper2; // depends on control dependency: [if], data = [none] i++; // depends on control dependency: [if], data = [none] } } if (i == ca.length - 1) { build.append(lowercase ? toLowerCase(ca[i]) : ca[i]); // depends on control dependency: [if], data = [none] } return build.toString(); } }
public class class_name { public static int[] parseSpecStr(String in) { if (in == null) { return new int[0]; } in = in.replaceAll(" ", ""); in = in.trim(); if (in.length() == 0) { return new int[0]; } String[] tokens = in.split(","); int[] toReturn = new int[tokens.length]; for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); try { toReturn[i] = Integer.parseInt(tokens[i]); } catch (NumberFormatException e) { if (tokens[i].equals("*") && i == 0) { toReturn[i] = PmiConstants.ALL_DATA; } // invalid configuration specification, set to undefined (no op) else { toReturn[i] = PmiConstants.LEVEL_UNDEFINED; } } } return toReturn; } }
public class class_name { public static int[] parseSpecStr(String in) { if (in == null) { return new int[0]; // depends on control dependency: [if], data = [none] } in = in.replaceAll(" ", ""); in = in.trim(); if (in.length() == 0) { return new int[0]; // depends on control dependency: [if], data = [none] } String[] tokens = in.split(","); int[] toReturn = new int[tokens.length]; for (int i = 0; i < tokens.length; i++) { tokens[i] = tokens[i].trim(); // depends on control dependency: [for], data = [i] try { toReturn[i] = Integer.parseInt(tokens[i]); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { if (tokens[i].equals("*") && i == 0) { toReturn[i] = PmiConstants.ALL_DATA; // depends on control dependency: [if], data = [none] } // invalid configuration specification, set to undefined (no op) else { toReturn[i] = PmiConstants.LEVEL_UNDEFINED; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } return toReturn; } }
public class class_name { private double penalizedPathDistance(Path path, Set<EdgeIteratorState> penalizedVirtualEdges) { double totalPenalty = 0; // Unfavored edges in the middle of the path should not be penalized because we are // only concerned about the direction at the start/end. final List<EdgeIteratorState> edges = path.calcEdges(); if (!edges.isEmpty()) { if (penalizedVirtualEdges.contains(edges.get(0))) { totalPenalty += uTurnDistancePenalty; } } if (edges.size() > 1) { if (penalizedVirtualEdges.contains(edges.get(edges.size() - 1))) { totalPenalty += uTurnDistancePenalty; } } return path.getDistance() + totalPenalty; } }
public class class_name { private double penalizedPathDistance(Path path, Set<EdgeIteratorState> penalizedVirtualEdges) { double totalPenalty = 0; // Unfavored edges in the middle of the path should not be penalized because we are // only concerned about the direction at the start/end. final List<EdgeIteratorState> edges = path.calcEdges(); if (!edges.isEmpty()) { if (penalizedVirtualEdges.contains(edges.get(0))) { totalPenalty += uTurnDistancePenalty; // depends on control dependency: [if], data = [none] } } if (edges.size() > 1) { if (penalizedVirtualEdges.contains(edges.get(edges.size() - 1))) { totalPenalty += uTurnDistancePenalty; // depends on control dependency: [if], data = [none] } } return path.getDistance() + totalPenalty; } }
public class class_name { static void set(WarpContext warpContext) { Validate.notNull(warpContext, "WarpContext for setting to store can't be null"); try { while (!reference.compareAndSet(null, warpContext)) { Thread.sleep(100); } } catch (InterruptedException e) { throw new IllegalStateException(e); } } }
public class class_name { static void set(WarpContext warpContext) { Validate.notNull(warpContext, "WarpContext for setting to store can't be null"); try { while (!reference.compareAndSet(null, warpContext)) { Thread.sleep(100); // depends on control dependency: [while], data = [none] } } catch (InterruptedException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static int convertTimestamp(String timestamp) throws ParseException { // Get the deadline from timestamp int deadline; SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss"); Date parsedDate; // Relative timestamp if (timestamp.startsWith("+")) { parsedDate = dateFormat.parse(timestamp.replace("+", "")); Calendar c = Calendar.getInstance(); c.setTime(parsedDate); deadline = c.get(Calendar.SECOND) + c.get(Calendar.MINUTE) * 60 + c.get(Calendar.HOUR_OF_DAY) * 3600; } // Absolute timestamp else { Calendar c = Calendar.getInstance(); c.setTime(new Date()); Date now = dateFormat.parse(c.get(Calendar.HOUR_OF_DAY)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND)); parsedDate = dateFormat.parse(timestamp); deadline = (int) ((parsedDate.getTime() - now.getTime()) / 1000); if (deadline < 0) { // Timestamp is for tomorrow deadline = (int) ((parsedDate.getTime() + (24 * 3600 * 1000) - now.getTime()) / 1000); } } return deadline; } }
public class class_name { private static int convertTimestamp(String timestamp) throws ParseException { // Get the deadline from timestamp int deadline; SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss"); Date parsedDate; // Relative timestamp if (timestamp.startsWith("+")) { parsedDate = dateFormat.parse(timestamp.replace("+", "")); Calendar c = Calendar.getInstance(); c.setTime(parsedDate); deadline = c.get(Calendar.SECOND) + c.get(Calendar.MINUTE) * 60 + c.get(Calendar.HOUR_OF_DAY) * 3600; } // Absolute timestamp else { Calendar c = Calendar.getInstance(); c.setTime(new Date()); Date now = dateFormat.parse(c.get(Calendar.HOUR_OF_DAY)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND)); parsedDate = dateFormat.parse(timestamp); deadline = (int) ((parsedDate.getTime() - now.getTime()) / 1000); if (deadline < 0) { // Timestamp is for tomorrow deadline = (int) ((parsedDate.getTime() + (24 * 3600 * 1000) - now.getTime()) / 1000); // depends on control dependency: [if], data = [0)] } } return deadline; } }
public class class_name { public void cacheConcept(Concept concept) { conceptCache.put(concept.id(), concept); if (concept.isSchemaConcept()) { SchemaConcept schemaConcept = concept.asSchemaConcept(); schemaConceptCache.put(schemaConcept.label(), schemaConcept); labelCache.put(schemaConcept.label(), schemaConcept.labelId()); } } }
public class class_name { public void cacheConcept(Concept concept) { conceptCache.put(concept.id(), concept); if (concept.isSchemaConcept()) { SchemaConcept schemaConcept = concept.asSchemaConcept(); schemaConceptCache.put(schemaConcept.label(), schemaConcept); // depends on control dependency: [if], data = [none] labelCache.put(schemaConcept.label(), schemaConcept.labelId()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getAnnotationValue(Annotation annotation) { Class<? extends Annotation> type = annotation.annotationType(); try { Method method = type.getDeclaredMethod(VALUE); return String.valueOf(method.invoke(annotation, NO_ARGS)); } catch (NoSuchMethodException e) { return null; } catch (InvocationTargetException e) { return null; } catch (IllegalAccessException e) { return null; } } }
public class class_name { private String getAnnotationValue(Annotation annotation) { Class<? extends Annotation> type = annotation.annotationType(); try { Method method = type.getDeclaredMethod(VALUE); return String.valueOf(method.invoke(annotation, NO_ARGS)); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { return null; } catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none] return null; } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean notifyPostEventListenerProviders(IServletContext isc,AsyncContextImpl ac) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegisterEventListenerProvider notifyPostEventListenerProvider(IServletContext,AsyncContext). _PostEventListenerProviders:"+_PostEventListenerProviders); } boolean result = false; Iterator<PostEventListenerProvider> pelps = _PostEventListenerProviders.getServices(); ArrayList<PostEventListenerProvider> reversePelps = new ArrayList<PostEventListenerProvider>(); // reverse the order so highest ranked goes last while (pelps.hasNext()) { reversePelps.add(0,pelps.next()); } if (!reversePelps.isEmpty()) { for (PostEventListenerProvider pelp : reversePelps) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegisterEventListenerProvider notifyPostEventListenerProvider(IServletContext,AsyncContext) notify listener."); } pelp.registerListener(isc,ac); } result=true; } return result; } }
public class class_name { public static boolean notifyPostEventListenerProviders(IServletContext isc,AsyncContextImpl ac) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegisterEventListenerProvider notifyPostEventListenerProvider(IServletContext,AsyncContext). _PostEventListenerProviders:"+_PostEventListenerProviders); // depends on control dependency: [if], data = [none] } boolean result = false; Iterator<PostEventListenerProvider> pelps = _PostEventListenerProviders.getServices(); ArrayList<PostEventListenerProvider> reversePelps = new ArrayList<PostEventListenerProvider>(); // reverse the order so highest ranked goes last while (pelps.hasNext()) { reversePelps.add(0,pelps.next()); // depends on control dependency: [while], data = [none] } if (!reversePelps.isEmpty()) { for (PostEventListenerProvider pelp : reversePelps) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "RegisterEventListenerProvider notifyPostEventListenerProvider(IServletContext,AsyncContext) notify listener."); // depends on control dependency: [if], data = [none] } pelp.registerListener(isc,ac); // depends on control dependency: [for], data = [pelp] } result=true; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewaySinglePageAsync(final String resourceGroupName, final String gatewayName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (gatewayName == null) { throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); } final String apiVersion = "2018-04-01"; return service.listByVpnGateway(this.client.subscriptionId(), resourceGroupName, gatewayName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<VpnConnectionInner>> result = listByVpnGatewayDelegate(response); return Observable.just(new ServiceResponse<Page<VpnConnectionInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewaySinglePageAsync(final String resourceGroupName, final String gatewayName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (gatewayName == null) { throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null."); } final String apiVersion = "2018-04-01"; return service.listByVpnGateway(this.client.subscriptionId(), resourceGroupName, gatewayName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<VpnConnectionInner>> result = listByVpnGatewayDelegate(response); return Observable.just(new ServiceResponse<Page<VpnConnectionInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public Observable<ServiceResponse<List<AzureResourceSkuInner>>> listSkusByResourceWithServiceResponseAsync(String resourceGroupName, String clusterName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listSkusByResource(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<AzureResourceSkuInner>>>>() { @Override public Observable<ServiceResponse<List<AzureResourceSkuInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AzureResourceSkuInner>> result = listSkusByResourceDelegate(response); List<AzureResourceSkuInner> items = null; if (result.body() != null) { items = result.body().items(); } ServiceResponse<List<AzureResourceSkuInner>> clientResponse = new ServiceResponse<List<AzureResourceSkuInner>>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<List<AzureResourceSkuInner>>> listSkusByResourceWithServiceResponseAsync(String resourceGroupName, String clusterName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listSkusByResource(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<AzureResourceSkuInner>>>>() { @Override public Observable<ServiceResponse<List<AzureResourceSkuInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AzureResourceSkuInner>> result = listSkusByResourceDelegate(response); List<AzureResourceSkuInner> items = null; if (result.body() != null) { items = result.body().items(); // depends on control dependency: [if], data = [none] } ServiceResponse<List<AzureResourceSkuInner>> clientResponse = new ServiceResponse<List<AzureResourceSkuInner>>(items, result.response()); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public List<JavaResource> getProjectEventTypes(Project project) { final List<JavaResource> eventTypes = new ArrayList<>(); if (project != null) { project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor() { @Override public void visit(VisitContext context, JavaResource resource) { eventTypes.add(resource); } }); } return eventTypes; } }
public class class_name { public List<JavaResource> getProjectEventTypes(Project project) { final List<JavaResource> eventTypes = new ArrayList<>(); if (project != null) { project.getFacet(JavaSourceFacet.class).visitJavaSources(new JavaResourceVisitor() { @Override public void visit(VisitContext context, JavaResource resource) { eventTypes.add(resource); } }); // depends on control dependency: [if], data = [none] } return eventTypes; } }
public class class_name { private ComponentStatus getComponentStatusFromChargePointStatus(ChargePointStatus status) { String value = status.value(); if ("Unavailable".equalsIgnoreCase(value)) { value = "Inoperative"; } return ComponentStatus.fromValue(value); } }
public class class_name { private ComponentStatus getComponentStatusFromChargePointStatus(ChargePointStatus status) { String value = status.value(); if ("Unavailable".equalsIgnoreCase(value)) { value = "Inoperative"; // depends on control dependency: [if], data = [none] } return ComponentStatus.fromValue(value); } }
public class class_name { @CommandArgument public void save( @OptionArgument("filename") String filename) { try { PrintStream out = new PrintStream(new FileOutputStream(filename)); for (User user : users.values()) { out.println(user); } } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { @CommandArgument public void save( @OptionArgument("filename") String filename) { try { PrintStream out = new PrintStream(new FileOutputStream(filename)); for (User user : users.values()) { out.println(user); // depends on control dependency: [for], data = [user] } } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected Object[] getChildren() { if (children != null) { return children; } ArrayList<DebugVariable> fields = mVariable.getFieldList(); if (fields != null) { children = new VariableNode[fields.size()]; for (int i = 0; i < fields.size(); i++) { DebugVariable variable = fields.get(i); children[i] = new VariableNode(variable); } return children; } return null; } }
public class class_name { protected Object[] getChildren() { if (children != null) { return children; // depends on control dependency: [if], data = [none] } ArrayList<DebugVariable> fields = mVariable.getFieldList(); if (fields != null) { children = new VariableNode[fields.size()]; // depends on control dependency: [if], data = [none] for (int i = 0; i < fields.size(); i++) { DebugVariable variable = fields.get(i); children[i] = new VariableNode(variable); // depends on control dependency: [for], data = [i] } return children; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Pure public static boolean hasExtension(File filename, String extension) { if (filename == null) { return false; } assert extension != null; String extent = extension; if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$ extent = EXTENSION_SEPARATOR + extent; } final String ext = extension(filename); if (ext == null) { return false; } if (isCaseSensitiveFilenameSystem()) { return ext.equals(extent); } return ext.equalsIgnoreCase(extent); } }
public class class_name { @Pure public static boolean hasExtension(File filename, String extension) { if (filename == null) { return false; // depends on control dependency: [if], data = [none] } assert extension != null; String extent = extension; if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$ extent = EXTENSION_SEPARATOR + extent; // depends on control dependency: [if], data = [none] } final String ext = extension(filename); if (ext == null) { return false; // depends on control dependency: [if], data = [none] } if (isCaseSensitiveFilenameSystem()) { return ext.equals(extent); // depends on control dependency: [if], data = [none] } return ext.equalsIgnoreCase(extent); } }
public class class_name { @Override public EEnum getIfcOccupantTypeEnum() { if (ifcOccupantTypeEnumEEnum == null) { ifcOccupantTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1023); } return ifcOccupantTypeEnumEEnum; } }
public class class_name { @Override public EEnum getIfcOccupantTypeEnum() { if (ifcOccupantTypeEnumEEnum == null) { ifcOccupantTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1023); // depends on control dependency: [if], data = [none] } return ifcOccupantTypeEnumEEnum; } }
public class class_name { public ProtoNetwork buildProtoNetwork() { ProtoNetwork pn = new ProtoNetwork(); // handle document header DocumentTable dt = pn.getDocumentTable(); dt.addDocumentHeader(new DocumentHeader(doc.getHeader())); // handle namespaces NamespaceGroup nsg = doc.getNamespaceGroup(); if (nsg != null) { NamespaceTable nt = pn.getNamespaceTable(); if (nsg.getDefaultResourceLocation() != null) { org.openbel.framework.common.model.Namespace dns = new Namespace("", nsg.getDefaultResourceLocation()); nt.addNamespace(new TableNamespace(dns), 0); } // associate namespaces to document id 0 final List<Namespace> nsl = nsg.getNamespaces(); if (hasItems(nsl)) { for (org.openbel.framework.common.model.Namespace ns : nsl) { nt.addNamespace(new TableNamespace(ns), 0); } } } // handle annotation definitions if (hasItems(doc.getDefinitions())) { for (AnnotationDefinition ad : doc.getDefinitions()) { AnnotationDefinitionTable adt = pn.getAnnotationDefinitionTable(); adt.addAnnotationDefinition(new TableAnnotationDefinition(ad), 0); } } // handle statement groups for (StatementGroup statementGroup : doc.getStatementGroups()) { buildProtoNetwork(pn, statementGroup, new HashMap<String, Annotation>()); } // create proto nodes final TermTable tt = pn.getTermTable(); final ProtoNodeTable pnt = pn.getProtoNodeTable(); final List<String> labels = tt.getTermValues(); for (int i = 0, n = labels.size(); i < n; i++) { pnt.addNode(i, labels.get(i)); } // create proto edges, process only simple edges now final Map<Integer, Integer> termNodeMap = pnt.getTermNodeIndex(); final StatementTable st = pn.getStatementTable(); final ProtoEdgeTable pet = pn.getProtoEdgeTable(); final List<TableStatement> stmts = st.getStatements(); for (int i = 0, n = stmts.size(); i < n; i++) { final TableStatement ts = stmts.get(i); final int subjectTerm = ts.getSubjectTermId(); if (ts.getObjectTermId() != null) { final int objectTerm = ts.getObjectTermId(); // find proto node index for subject / object terms final int source = termNodeMap.get(subjectTerm); final int target = termNodeMap.get(objectTerm); // create proto edge and add to table pet.addEdges(i, new ProtoEdgeTable.TableProtoEdge(source, ts .getRelationshipName(), target)); } } return pn; } }
public class class_name { public ProtoNetwork buildProtoNetwork() { ProtoNetwork pn = new ProtoNetwork(); // handle document header DocumentTable dt = pn.getDocumentTable(); dt.addDocumentHeader(new DocumentHeader(doc.getHeader())); // handle namespaces NamespaceGroup nsg = doc.getNamespaceGroup(); if (nsg != null) { NamespaceTable nt = pn.getNamespaceTable(); if (nsg.getDefaultResourceLocation() != null) { org.openbel.framework.common.model.Namespace dns = new Namespace("", nsg.getDefaultResourceLocation()); nt.addNamespace(new TableNamespace(dns), 0); // depends on control dependency: [if], data = [none] } // associate namespaces to document id 0 final List<Namespace> nsl = nsg.getNamespaces(); if (hasItems(nsl)) { for (org.openbel.framework.common.model.Namespace ns : nsl) { nt.addNamespace(new TableNamespace(ns), 0); // depends on control dependency: [for], data = [ns] } } } // handle annotation definitions if (hasItems(doc.getDefinitions())) { for (AnnotationDefinition ad : doc.getDefinitions()) { AnnotationDefinitionTable adt = pn.getAnnotationDefinitionTable(); adt.addAnnotationDefinition(new TableAnnotationDefinition(ad), 0); // depends on control dependency: [for], data = [ad] } } // handle statement groups for (StatementGroup statementGroup : doc.getStatementGroups()) { buildProtoNetwork(pn, statementGroup, new HashMap<String, Annotation>()); // depends on control dependency: [for], data = [statementGroup] } // create proto nodes final TermTable tt = pn.getTermTable(); final ProtoNodeTable pnt = pn.getProtoNodeTable(); final List<String> labels = tt.getTermValues(); for (int i = 0, n = labels.size(); i < n; i++) { pnt.addNode(i, labels.get(i)); // depends on control dependency: [for], data = [i] } // create proto edges, process only simple edges now final Map<Integer, Integer> termNodeMap = pnt.getTermNodeIndex(); final StatementTable st = pn.getStatementTable(); final ProtoEdgeTable pet = pn.getProtoEdgeTable(); final List<TableStatement> stmts = st.getStatements(); for (int i = 0, n = stmts.size(); i < n; i++) { final TableStatement ts = stmts.get(i); final int subjectTerm = ts.getSubjectTermId(); if (ts.getObjectTermId() != null) { final int objectTerm = ts.getObjectTermId(); // find proto node index for subject / object terms final int source = termNodeMap.get(subjectTerm); final int target = termNodeMap.get(objectTerm); // create proto edge and add to table pet.addEdges(i, new ProtoEdgeTable.TableProtoEdge(source, ts .getRelationshipName(), target)); // depends on control dependency: [if], data = [none] } } return pn; } }
public class class_name { protected void recalculateData() { Node currentChild = this.getChild(); if (currentChild != null) { ClusKernel currentData = this.getData(); currentData.clear(); Entry[] entries = currentChild.getEntries(); for (int i = 0; i < entries.length; i++) { currentData.add(entries[i].getData()); } } else { this.clear(); } } }
public class class_name { protected void recalculateData() { Node currentChild = this.getChild(); if (currentChild != null) { ClusKernel currentData = this.getData(); currentData.clear(); // depends on control dependency: [if], data = [none] Entry[] entries = currentChild.getEntries(); for (int i = 0; i < entries.length; i++) { currentData.add(entries[i].getData()); // depends on control dependency: [for], data = [i] } } else { this.clear(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @EventHandler public void playerJoinEvent(PlayerJoinEvent event) { if (Common.getInstance().getMainConfig().getBoolean("System.CheckNewVersion") && Common.getInstance().getServerCaller().getPlayerCaller().isOp(event.getP().getName()) && Common.getInstance().getVersionChecker().getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) { Common.getInstance().getServerCaller().getPlayerCaller().sendMessage(event.getP().getName(), "{{DARK_CYAN}}Craftconomy is out of date! New version is " + Common.getInstance().getVersionChecker().getLatestName()); } } }
public class class_name { @EventHandler public void playerJoinEvent(PlayerJoinEvent event) { if (Common.getInstance().getMainConfig().getBoolean("System.CheckNewVersion") && Common.getInstance().getServerCaller().getPlayerCaller().isOp(event.getP().getName()) && Common.getInstance().getVersionChecker().getResult() == Updater.UpdateResult.UPDATE_AVAILABLE) { Common.getInstance().getServerCaller().getPlayerCaller().sendMessage(event.getP().getName(), "{{DARK_CYAN}}Craftconomy is out of date! New version is " + Common.getInstance().getVersionChecker().getLatestName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { static boolean isModern(Class<? extends LoadStatistics> clazz) { // cannot use Util.isOverridden as these are protected methods. boolean hasGetNodes = false; boolean hasMatches = false; while (clazz != LoadStatistics.class && clazz != null && !(hasGetNodes && hasMatches)) { if (!hasGetNodes) { try { final Method getNodes = clazz.getDeclaredMethod("getNodes"); hasGetNodes = !Modifier.isAbstract(getNodes.getModifiers()); } catch (NoSuchMethodException e) { // ignore } } if (!hasMatches) { try { final Method getNodes = clazz.getDeclaredMethod("matches", Queue.Item.class, SubTask.class); hasMatches = !Modifier.isAbstract(getNodes.getModifiers()); } catch (NoSuchMethodException e) { // ignore } } if (!(hasGetNodes && hasMatches) && LoadStatistics.class.isAssignableFrom(clazz.getSuperclass())) { clazz = (Class<? extends LoadStatistics>) clazz.getSuperclass(); } } return hasGetNodes && hasMatches; } }
public class class_name { static boolean isModern(Class<? extends LoadStatistics> clazz) { // cannot use Util.isOverridden as these are protected methods. boolean hasGetNodes = false; boolean hasMatches = false; while (clazz != LoadStatistics.class && clazz != null && !(hasGetNodes && hasMatches)) { if (!hasGetNodes) { try { final Method getNodes = clazz.getDeclaredMethod("getNodes"); hasGetNodes = !Modifier.isAbstract(getNodes.getModifiers()); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { // ignore } // depends on control dependency: [catch], data = [none] } if (!hasMatches) { try { final Method getNodes = clazz.getDeclaredMethod("matches", Queue.Item.class, SubTask.class); hasMatches = !Modifier.isAbstract(getNodes.getModifiers()); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { // ignore } // depends on control dependency: [catch], data = [none] } if (!(hasGetNodes && hasMatches) && LoadStatistics.class.isAssignableFrom(clazz.getSuperclass())) { clazz = (Class<? extends LoadStatistics>) clazz.getSuperclass(); // depends on control dependency: [if], data = [none] } } return hasGetNodes && hasMatches; } }
public class class_name { private synchronized void submitToExecutor(final Runnable command) { if ( state.get() == State.STARTED ) { executorService.submit(command); } } }
public class class_name { private synchronized void submitToExecutor(final Runnable command) { if ( state.get() == State.STARTED ) { executorService.submit(command); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addBody(final GVRRigidBody gvrBody) { mPhysicsContext.runOnPhysicsThread(new Runnable() { @Override public void run() { if (contains(gvrBody)) { return; } if (gvrBody.getCollisionGroup() < 0 || gvrBody.getCollisionGroup() > 15 || mCollisionMatrix == null) { NativePhysics3DWorld.addRigidBody(getNative(), gvrBody.getNative()); } else { NativePhysics3DWorld.addRigidBodyWithMask(getNative(), gvrBody.getNative(), mCollisionMatrix.getCollisionFilterGroup(gvrBody.getCollisionGroup()), mCollisionMatrix.getCollisionFilterMask(gvrBody.getCollisionGroup())); } mPhysicsObject.put(gvrBody.getNative(), gvrBody); getGVRContext().getEventManager().sendEvent(GVRWorld.this, IPhysicsEvents.class, "onAddRigidBody", GVRWorld.this, gvrBody); } }); } }
public class class_name { public void addBody(final GVRRigidBody gvrBody) { mPhysicsContext.runOnPhysicsThread(new Runnable() { @Override public void run() { if (contains(gvrBody)) { return; // depends on control dependency: [if], data = [none] } if (gvrBody.getCollisionGroup() < 0 || gvrBody.getCollisionGroup() > 15 || mCollisionMatrix == null) { NativePhysics3DWorld.addRigidBody(getNative(), gvrBody.getNative()); // depends on control dependency: [if], data = [none] } else { NativePhysics3DWorld.addRigidBodyWithMask(getNative(), gvrBody.getNative(), mCollisionMatrix.getCollisionFilterGroup(gvrBody.getCollisionGroup()), mCollisionMatrix.getCollisionFilterMask(gvrBody.getCollisionGroup())); // depends on control dependency: [if], data = [none] } mPhysicsObject.put(gvrBody.getNative(), gvrBody); getGVRContext().getEventManager().sendEvent(GVRWorld.this, IPhysicsEvents.class, "onAddRigidBody", GVRWorld.this, gvrBody); } }); } }
public class class_name { public AT_Row setPaddingLeftRight(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeftRight(padding); } } return this; } }
public class class_name { public AT_Row setPaddingLeftRight(int padding){ if(this.hasCells()){ for(AT_Cell cell : this.getCells()){ cell.getContext().setPaddingLeftRight(padding); // depends on control dependency: [for], data = [cell] } } return this; } }
public class class_name { public DescribeClustersRequest withClusterNames(String... clusterNames) { if (this.clusterNames == null) { setClusterNames(new java.util.ArrayList<String>(clusterNames.length)); } for (String ele : clusterNames) { this.clusterNames.add(ele); } return this; } }
public class class_name { public DescribeClustersRequest withClusterNames(String... clusterNames) { if (this.clusterNames == null) { setClusterNames(new java.util.ArrayList<String>(clusterNames.length)); // depends on control dependency: [if], data = [none] } for (String ele : clusterNames) { this.clusterNames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Map<Integer, List<HeronTuples.HeronTupleSet>> getCache() { Map<Integer, List<HeronTuples.HeronTupleSet>> res = new HashMap<>(); for (Map.Entry<Integer, TupleList> entry : cache.entrySet()) { res.put(entry.getKey(), entry.getValue().getTuplesList()); } return res; } }
public class class_name { public Map<Integer, List<HeronTuples.HeronTupleSet>> getCache() { Map<Integer, List<HeronTuples.HeronTupleSet>> res = new HashMap<>(); for (Map.Entry<Integer, TupleList> entry : cache.entrySet()) { res.put(entry.getKey(), entry.getValue().getTuplesList()); // depends on control dependency: [for], data = [entry] } return res; } }
public class class_name { public int[] getIC() { int[] ic = new int[nzmax]; int i = 0; for ( IndexMN index : indexSet ) { ic[i++] = index.n; } return ic; } }
public class class_name { public int[] getIC() { int[] ic = new int[nzmax]; int i = 0; for ( IndexMN index : indexSet ) { ic[i++] = index.n; // depends on control dependency: [for], data = [index] } return ic; } }
public class class_name { private String extractIdUnescaped(String id) { if (!id.isEmpty() && !Character.isDigit(id.charAt(0))) { return org.unbescape.css.CssEscape.unescapeCss(id); } return null; } }
public class class_name { private String extractIdUnescaped(String id) { if (!id.isEmpty() && !Character.isDigit(id.charAt(0))) { return org.unbescape.css.CssEscape.unescapeCss(id); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void setupCurrentSqlExp(StringBuilder sb, RomanticTransaction tx) { final TransactionCurrentSqlBuilder currentSqlBuilder = tx.getCurrentSqlBuilder(); if (currentSqlBuilder != null) { final String currentSql = currentSqlBuilder.buildSql(); sb.append("\n/- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"); sb.append(" (SQL now: "); sb.append(tx.getCurrentTableName()).append("@").append(tx.getCurrentCommand()); final Long currentSqlBeginMillis = tx.getCurrentSqlBeginMillis(); if (currentSqlBeginMillis != null) { sb.append(" [").append(tx.buildElapsedTimeExp(currentSqlBeginMillis)).append("]"); } sb.append(")\n"); sb.append(currentSql); sb.append("\n- - - - - - - - - -/"); } } }
public class class_name { protected void setupCurrentSqlExp(StringBuilder sb, RomanticTransaction tx) { final TransactionCurrentSqlBuilder currentSqlBuilder = tx.getCurrentSqlBuilder(); if (currentSqlBuilder != null) { final String currentSql = currentSqlBuilder.buildSql(); sb.append("\n/- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"); sb.append(" (SQL now: "); sb.append(tx.getCurrentTableName()).append("@").append(tx.getCurrentCommand()); final Long currentSqlBeginMillis = tx.getCurrentSqlBeginMillis(); if (currentSqlBeginMillis != null) { sb.append(" [").append(tx.buildElapsedTimeExp(currentSqlBeginMillis)).append("]"); } sb.append(")\n"); // depends on control dependency: [if], data = [none] sb.append(currentSql); // depends on control dependency: [if], data = [none] sb.append("\n- - - - - - - - - -/"); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Reference(title = "Fast and accurate computation of binomial probabilities", // authors = "C. Loader", booktitle = "", // url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", // bibkey = "web/Loader00") private static double devianceTerm(double x, double np) { if(Math.abs(x - np) < 0.1 * (x + np)) { final double v = (x - np) / (x + np); double s = (x - np) * v; double ej = 2.0d * x * v; for(int j = 1;; j++) { ej *= v * v; final double s1 = s + ej / (2 * j + 1); if(s1 == s) { return s1; } s = s1; } } return x * FastMath.log(x / np) + np - x; } }
public class class_name { @Reference(title = "Fast and accurate computation of binomial probabilities", // authors = "C. Loader", booktitle = "", // url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", // bibkey = "web/Loader00") private static double devianceTerm(double x, double np) { if(Math.abs(x - np) < 0.1 * (x + np)) { final double v = (x - np) / (x + np); double s = (x - np) * v; double ej = 2.0d * x * v; for(int j = 1;; j++) { ej *= v * v; // depends on control dependency: [for], data = [none] final double s1 = s + ej / (2 * j + 1); if(s1 == s) { return s1; // depends on control dependency: [if], data = [none] } s = s1; // depends on control dependency: [for], data = [none] } } return x * FastMath.log(x / np) + np - x; } }
public class class_name { void add(TouchPipeline pipeline) { for (int i = 0; i < pipeline.filters.size(); i++) { addFilter(pipeline.filters.get(i)); } } }
public class class_name { void add(TouchPipeline pipeline) { for (int i = 0; i < pipeline.filters.size(); i++) { addFilter(pipeline.filters.get(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { public static void fitCannyEdges( GrayF32 input ) { BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,null); List<EdgeContour> contours = canny.getContours(); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( EdgeContour e : contours ) { g2.setColor(new Color(rand.nextInt())); for(EdgeSegment s : e.segments ) { // fit line segments to the point sequence. Note that loop is false List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty); VisualizeShapes.drawPolygon(vertexes, false, g2); } } gui.addImage(displayImage, "Canny Trace"); } }
public class class_name { public static void fitCannyEdges( GrayF32 input ) { BufferedImage displayImage = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB); // Finds edges inside the image CannyEdge<GrayF32,GrayF32> canny = FactoryEdgeDetectors.canny(2, true, true, GrayF32.class, GrayF32.class); canny.process(input,0.1f,0.3f,null); List<EdgeContour> contours = canny.getContours(); Graphics2D g2 = displayImage.createGraphics(); g2.setStroke(new BasicStroke(2)); // used to select colors for each line Random rand = new Random(234); for( EdgeContour e : contours ) { g2.setColor(new Color(rand.nextInt())); // depends on control dependency: [for], data = [e] for(EdgeSegment s : e.segments ) { // fit line segments to the point sequence. Note that loop is false List<PointIndex_I32> vertexes = ShapeFittingOps.fitPolygon(s.points,false, minSide,cornerPenalty); VisualizeShapes.drawPolygon(vertexes, false, g2); // depends on control dependency: [for], data = [s] } } gui.addImage(displayImage, "Canny Trace"); } }
public class class_name { @Override public void destroy() { final String sourceMethod = "destroy"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod); } shutdown(); super.destroy(); if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } } }
public class class_name { @Override public void destroy() { final String sourceMethod = "destroy"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod); // depends on control dependency: [if], data = [none] } shutdown(); super.destroy(); if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected IOException copyRange(Reader reader, PrintWriter writer, long start, long end) { try { reader.skip(start); } catch (IOException e) { return e; } IOException exception = null; long bytesToRead = (end - start) + 1; char[] buffer = new char[m_input]; int len = buffer.length; while ((bytesToRead > 0) && (len >= buffer.length)) { try { len = reader.read(buffer); if (bytesToRead >= len) { writer.write(buffer, 0, len); bytesToRead -= len; } else { writer.write(buffer, 0, (int)bytesToRead); bytesToRead = 0; } } catch (IOException e) { exception = e; len = -1; } if (len < buffer.length) { break; } } return exception; } }
public class class_name { protected IOException copyRange(Reader reader, PrintWriter writer, long start, long end) { try { reader.skip(start); // depends on control dependency: [try], data = [none] } catch (IOException e) { return e; } // depends on control dependency: [catch], data = [none] IOException exception = null; long bytesToRead = (end - start) + 1; char[] buffer = new char[m_input]; int len = buffer.length; while ((bytesToRead > 0) && (len >= buffer.length)) { try { len = reader.read(buffer); // depends on control dependency: [try], data = [none] if (bytesToRead >= len) { writer.write(buffer, 0, len); // depends on control dependency: [if], data = [none] bytesToRead -= len; // depends on control dependency: [if], data = [none] } else { writer.write(buffer, 0, (int)bytesToRead); // depends on control dependency: [if], data = [none] bytesToRead = 0; // depends on control dependency: [if], data = [none] } } catch (IOException e) { exception = e; len = -1; } // depends on control dependency: [catch], data = [none] if (len < buffer.length) { break; } } return exception; } }
public class class_name { @SuppressWarnings("unchecked") public static Map deepMerge(Map dst, Map src) { if (dst != null && src != null) { for (Object key : src.keySet()) { if (src.get(key) instanceof Map && dst.get(key) instanceof Map) { Map originalChild = (Map)dst.get(key); Map newChild = (Map)src.get(key); dst.put(key, deepMerge(originalChild, newChild)); } else { dst.put(key, src.get(key)); } } } return dst; } }
public class class_name { @SuppressWarnings("unchecked") public static Map deepMerge(Map dst, Map src) { if (dst != null && src != null) { for (Object key : src.keySet()) { if (src.get(key) instanceof Map && dst.get(key) instanceof Map) { Map originalChild = (Map)dst.get(key); Map newChild = (Map)src.get(key); dst.put(key, deepMerge(originalChild, newChild)); // depends on control dependency: [if], data = [none] } else { dst.put(key, src.get(key)); // depends on control dependency: [if], data = [none] } } } return dst; } }
public class class_name { private void traverseFunction(Node function, Scope parentScope) { checkState(function.getChildCount() == 3, function); checkState(function.isFunction(), function); final Node paramlist = NodeUtil.getFunctionParameters(function); final Node body = function.getLastChild(); checkState(body.getNext() == null && body.isBlock(), body); // Checking the parameters Scope fparamScope = scopeCreator.createScope(function, parentScope); // Checking the function body Scope fbodyScope = scopeCreator.createScope(body, fparamScope); Node nameNode = function.getFirstChild(); if (!nameNode.getString().isEmpty()) { // var x = function funcName() {}; // make sure funcName gets into the varInfoMap so it will be considered for removal. VarInfo varInfo = traverseNameNode(nameNode, fparamScope); if (NodeUtil.isExpressionResultUsed(function)) { // var f = function g() {}; // The f is an alias for g, so g escapes from the scope where it is defined. varInfo.hasNonLocalOrNonLiteralValue = true; } } traverseChildren(paramlist, fparamScope); traverseChildren(body, fbodyScope); allFunctionParamScopes.add(fparamScope); } }
public class class_name { private void traverseFunction(Node function, Scope parentScope) { checkState(function.getChildCount() == 3, function); checkState(function.isFunction(), function); final Node paramlist = NodeUtil.getFunctionParameters(function); final Node body = function.getLastChild(); checkState(body.getNext() == null && body.isBlock(), body); // Checking the parameters Scope fparamScope = scopeCreator.createScope(function, parentScope); // Checking the function body Scope fbodyScope = scopeCreator.createScope(body, fparamScope); Node nameNode = function.getFirstChild(); if (!nameNode.getString().isEmpty()) { // var x = function funcName() {}; // make sure funcName gets into the varInfoMap so it will be considered for removal. VarInfo varInfo = traverseNameNode(nameNode, fparamScope); if (NodeUtil.isExpressionResultUsed(function)) { // var f = function g() {}; // The f is an alias for g, so g escapes from the scope where it is defined. varInfo.hasNonLocalOrNonLiteralValue = true; // depends on control dependency: [if], data = [none] } } traverseChildren(paramlist, fparamScope); traverseChildren(body, fbodyScope); allFunctionParamScopes.add(fparamScope); } }
public class class_name { private void init(){ // Create the Empty Layout LinearLayout container = new LinearLayout(getContext()); mIcon = new ImageView(getContext()); mMessage = new TextView(getContext()); mAction = new TextView(getContext()); mProgress = new ProgressBar(getContext()); // Setup the layout LayoutParams containerParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT); container.setGravity(Gravity.CENTER); container.setOrientation(LinearLayout.VERTICAL); containerParams.addRule(RelativeLayout.CENTER_IN_PARENT); // Setup the Icon if(mEmptyIcon > 0) { mIcon.setImageResource(mEmptyIcon); }else{ mIcon.setVisibility(View.GONE); } mIcon.setPadding(0, 0, 0, mEmptyIconPadding); if (mEmptyIconColor != -1) { mIcon.setColorFilter(mEmptyIconColor, PorterDuff.Mode.SRC_IN); } int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height); container.addView(mIcon, iconParams); // Setup the message LinearLayout.LayoutParams msgParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); mMessage.setGravity(Gravity.CENTER); mMessage.setTextSize(TypedValue.COMPLEX_UNIT_PX, mEmptyMessageTextSize); mMessage.setTextColor(mEmptyMessageColor); mMessage.setText(mEmptyMessage); // Add to the layout container.addView(mMessage, msgParams); // Setup the Action Label LinearLayout.LayoutParams actionParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); actionParams.topMargin = getResources().getDimensionPixelSize(R.dimen.activity_padding); int padding = (int) SizeUtils.dpToPx(getContext(), 8); mAction.setText(mEmptyActionText); mAction.setTextColor(mEmptyActionColor); mAction.setTextSize(TypedValue.COMPLEX_UNIT_PX, mEmptyActionTextSize); mAction.setAllCaps(true); mAction.setPadding(padding, padding, padding, padding); mAction.setVisibility(TextUtils.isEmpty(mEmptyActionText) ? View.GONE : View.VISIBLE); UIUtils.setBackground(mAction, UIUtils.getSelectableItemBackground(getContext())); mAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mActionClickListener != null) mActionClickListener.onClick(v); } }); if(!isInEditMode()){ FontLoader.apply(mMessage, mEmptyMessageTypeface); FontLoader.apply(mAction, Face.ROBOTO_MEDIUM); } container.addView(mAction, actionParams); LinearLayout.LayoutParams progressParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); mProgress.setVisibility(View.GONE); container.addView(mProgress, progressParams); // Add to view addView(container, containerParams); // Switch the states if(mState == STATE_LOADING){ setLoading(); } } }
public class class_name { private void init(){ // Create the Empty Layout LinearLayout container = new LinearLayout(getContext()); mIcon = new ImageView(getContext()); mMessage = new TextView(getContext()); mAction = new TextView(getContext()); mProgress = new ProgressBar(getContext()); // Setup the layout LayoutParams containerParams = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT); container.setGravity(Gravity.CENTER); container.setOrientation(LinearLayout.VERTICAL); containerParams.addRule(RelativeLayout.CENTER_IN_PARENT); // Setup the Icon if(mEmptyIcon > 0) { mIcon.setImageResource(mEmptyIcon); // depends on control dependency: [if], data = [(mEmptyIcon] }else{ mIcon.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] } mIcon.setPadding(0, 0, 0, mEmptyIconPadding); if (mEmptyIconColor != -1) { mIcon.setColorFilter(mEmptyIconColor, PorterDuff.Mode.SRC_IN); // depends on control dependency: [if], data = [(mEmptyIconColor] } int width = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; int height = mEmptyIconSize == -1 ? WRAP_CONTENT : mEmptyIconSize; LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(width, height); container.addView(mIcon, iconParams); // Setup the message LinearLayout.LayoutParams msgParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); mMessage.setGravity(Gravity.CENTER); mMessage.setTextSize(TypedValue.COMPLEX_UNIT_PX, mEmptyMessageTextSize); mMessage.setTextColor(mEmptyMessageColor); mMessage.setText(mEmptyMessage); // Add to the layout container.addView(mMessage, msgParams); // Setup the Action Label LinearLayout.LayoutParams actionParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); actionParams.topMargin = getResources().getDimensionPixelSize(R.dimen.activity_padding); int padding = (int) SizeUtils.dpToPx(getContext(), 8); mAction.setText(mEmptyActionText); mAction.setTextColor(mEmptyActionColor); mAction.setTextSize(TypedValue.COMPLEX_UNIT_PX, mEmptyActionTextSize); mAction.setAllCaps(true); mAction.setPadding(padding, padding, padding, padding); mAction.setVisibility(TextUtils.isEmpty(mEmptyActionText) ? View.GONE : View.VISIBLE); UIUtils.setBackground(mAction, UIUtils.getSelectableItemBackground(getContext())); mAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mActionClickListener != null) mActionClickListener.onClick(v); } }); if(!isInEditMode()){ FontLoader.apply(mMessage, mEmptyMessageTypeface); // depends on control dependency: [if], data = [none] FontLoader.apply(mAction, Face.ROBOTO_MEDIUM); // depends on control dependency: [if], data = [none] } container.addView(mAction, actionParams); LinearLayout.LayoutParams progressParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); mProgress.setVisibility(View.GONE); container.addView(mProgress, progressParams); // Add to view addView(container, containerParams); // Switch the states if(mState == STATE_LOADING){ setLoading(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void end(Point p) { lastPt.x = endPt.x = p.x; lastPt.y = endPt.y = p.y; Graphics2D g = (Graphics2D) component.getGraphics(); if(g != null) { try { g.setXORMode(component.getBackground()); drawLast(g); } finally { g.dispose(); } } } }
public class class_name { public void end(Point p) { lastPt.x = endPt.x = p.x; lastPt.y = endPt.y = p.y; Graphics2D g = (Graphics2D) component.getGraphics(); if(g != null) { try { g.setXORMode(component.getBackground()); // depends on control dependency: [try], data = [none] drawLast(g); // depends on control dependency: [try], data = [none] } finally { g.dispose(); } } } }
public class class_name { @Override public <T> void cache(final Object key, final Object object, Class<T> clas) { this.logger.debug("@cache v2 "); if (object == null && !isAllowNullable()) { return; } else { this.logger.debug("logging key :", key, " with object : ", object, " with Class : ", clas); getCachableMap(clas).put(key, object); } } }
public class class_name { @Override public <T> void cache(final Object key, final Object object, Class<T> clas) { this.logger.debug("@cache v2 "); if (object == null && !isAllowNullable()) { return; // depends on control dependency: [if], data = [none] } else { this.logger.debug("logging key :", key, " with object : ", object, " with Class : ", clas); // depends on control dependency: [if], data = [none] getCachableMap(clas).put(key, object); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final boolean contains(char a) { for (int i = off; i < (off + len); ++i) { if (fb[i] == a) { return true; } } return false; } }
public class class_name { public final boolean contains(char a) { for (int i = off; i < (off + len); ++i) { if (fb[i] == a) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void writeSilenceForced(long tick) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeSilenceForced", Long.valueOf(tick) ); // Details of the new silence long startTick = -1; long endTick = -1; long completedPrefix = -1; // used to send message if it moves inside inDoubt window List sendList = null; synchronized (this) { oststream.setCursor(tick); // Get the TickRange containing this tick TickRange tr = oststream.getNext(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeSilenceForced from: " + tr.startstamp + " to " + tr.endstamp + " on Stream " + stream); } TickRange silenceRange = oststream.writeCompletedRangeForced(tr); // While we have the stream locked cache the details of the new completed // range if(silenceRange != null) { startTick = silenceRange.startstamp; endTick = silenceRange.endstamp; completedPrefix = getCompletedPrefix(); } // Check whether removing this message means we have // a message to send TickRange str = null; if ( (str = msgRemoved(tick, oststream, null)) != null) { sendList = new LinkedList(); sendList.add(str); if(str.valuestamp > lastMsgSent) lastMsgSent = str.valuestamp; } } // Do the send outside of the synchronise // If we created a new completed (silenced) range then we actually send this to the // target ME. If we don't do this it's possible for the target to never realise that // this message has been explicitly deleted (via the MBeans), and therefore, if there's // a problem with the message it will never know to give up trying to process it, which // could leave the stream blocked until an ME re-start. if(startTick != -1) { downControl.sendSilenceMessage(startTick, endTick, completedPrefix, false, priority, reliability, stream); } if (sendList != null) { sendMsgs( sendList, false ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeSilenceForced"); } }
public class class_name { public void writeSilenceForced(long tick) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeSilenceForced", Long.valueOf(tick) ); // Details of the new silence long startTick = -1; long endTick = -1; long completedPrefix = -1; // used to send message if it moves inside inDoubt window List sendList = null; synchronized (this) { oststream.setCursor(tick); // Get the TickRange containing this tick TickRange tr = oststream.getNext(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeSilenceForced from: " + tr.startstamp + " to " + tr.endstamp + " on Stream " + stream); // depends on control dependency: [if], data = [none] } TickRange silenceRange = oststream.writeCompletedRangeForced(tr); // While we have the stream locked cache the details of the new completed // range if(silenceRange != null) { startTick = silenceRange.startstamp; // depends on control dependency: [if], data = [none] endTick = silenceRange.endstamp; // depends on control dependency: [if], data = [none] completedPrefix = getCompletedPrefix(); // depends on control dependency: [if], data = [none] } // Check whether removing this message means we have // a message to send TickRange str = null; if ( (str = msgRemoved(tick, oststream, null)) != null) { sendList = new LinkedList(); // depends on control dependency: [if], data = [none] sendList.add(str); // depends on control dependency: [if], data = [none] if(str.valuestamp > lastMsgSent) lastMsgSent = str.valuestamp; } } // Do the send outside of the synchronise // If we created a new completed (silenced) range then we actually send this to the // target ME. If we don't do this it's possible for the target to never realise that // this message has been explicitly deleted (via the MBeans), and therefore, if there's // a problem with the message it will never know to give up trying to process it, which // could leave the stream blocked until an ME re-start. if(startTick != -1) { downControl.sendSilenceMessage(startTick, endTick, completedPrefix, false, priority, reliability, stream); } if (sendList != null) { sendMsgs( sendList, false ); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeSilenceForced"); } }
public class class_name { private void log(final String message) { if (this.optionalParams.isPresent()) { logger.log(logLevel, message, params); } else { logger.log(logLevel, message); } } }
public class class_name { private void log(final String message) { if (this.optionalParams.isPresent()) { logger.log(logLevel, message, params); // depends on control dependency: [if], data = [none] } else { logger.log(logLevel, message); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final BaseDescr andExpression() throws RecognitionException { BaseDescr result = null; BaseDescr left =null; BaseDescr right =null; try { // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:273:3: (left= equalityExpression ( AMPER right= equalityExpression )* ) // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:273:5: left= equalityExpression ( AMPER right= equalityExpression )* { pushFollow(FOLLOW_equalityExpression_in_andExpression1348); left=equalityExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { result = left; } } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:274:3: ( AMPER right= equalityExpression )* loop30: while (true) { int alt30=2; int LA30_0 = input.LA(1); if ( (LA30_0==AMPER) ) { alt30=1; } switch (alt30) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:274:5: AMPER right= equalityExpression { match(input,AMPER,FOLLOW_AMPER_in_andExpression1356); if (state.failed) return result; pushFollow(FOLLOW_equalityExpression_in_andExpression1360); right=equalityExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newIncAnd(); descr.addOrMerge( result ); descr.addOrMerge( right ); result = descr; } } } break; default : break loop30; } } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } return result; } }
public class class_name { public final BaseDescr andExpression() throws RecognitionException { BaseDescr result = null; BaseDescr left =null; BaseDescr right =null; try { // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:273:3: (left= equalityExpression ( AMPER right= equalityExpression )* ) // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:273:5: left= equalityExpression ( AMPER right= equalityExpression )* { pushFollow(FOLLOW_equalityExpression_in_andExpression1348); left=equalityExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { result = left; } } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:274:3: ( AMPER right= equalityExpression )* loop30: while (true) { int alt30=2; int LA30_0 = input.LA(1); if ( (LA30_0==AMPER) ) { alt30=1; // depends on control dependency: [if], data = [none] } switch (alt30) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:274:5: AMPER right= equalityExpression { match(input,AMPER,FOLLOW_AMPER_in_andExpression1356); if (state.failed) return result; pushFollow(FOLLOW_equalityExpression_in_andExpression1360); right=equalityExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newIncAnd(); descr.addOrMerge( result ); // depends on control dependency: [if], data = [none] descr.addOrMerge( right ); // depends on control dependency: [if], data = [none] result = descr; // depends on control dependency: [if], data = [none] } } } break; default : break loop30; } } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } return result; } }
public class class_name { private String extractErrorMessageFromResponse(HttpResponse response) { String contentType = response.getEntity().getContentType().getValue(); if(contentType.contains("application/json")) { Gson gson = GsonResponseParser.getDefaultGsonParser(false); String responseBody = null; try { responseBody = EntityUtils.toString(response.getEntity()); LOG.error("Body of error response from Canvas: " + responseBody); CanvasErrorResponse errorResponse = gson.fromJson(responseBody, CanvasErrorResponse.class); List<ErrorMessage> errors = errorResponse.getErrors(); if(errors != null) { //I have only ever seen a single error message but it is an array so presumably there could be more. return errors.stream().map(e -> e.getMessage()).collect(Collectors.joining(", ")); } else{ return responseBody; } } catch (Exception e) { //Returned JSON was not in expected format. Fall back to returning the whole response body, if any if(StringUtils.isNotBlank(responseBody)) { return responseBody; } } } return null; } }
public class class_name { private String extractErrorMessageFromResponse(HttpResponse response) { String contentType = response.getEntity().getContentType().getValue(); if(contentType.contains("application/json")) { Gson gson = GsonResponseParser.getDefaultGsonParser(false); String responseBody = null; try { responseBody = EntityUtils.toString(response.getEntity()); // depends on control dependency: [try], data = [none] LOG.error("Body of error response from Canvas: " + responseBody); // depends on control dependency: [try], data = [none] CanvasErrorResponse errorResponse = gson.fromJson(responseBody, CanvasErrorResponse.class); List<ErrorMessage> errors = errorResponse.getErrors(); if(errors != null) { //I have only ever seen a single error message but it is an array so presumably there could be more. return errors.stream().map(e -> e.getMessage()).collect(Collectors.joining(", ")); // depends on control dependency: [if], data = [none] } else{ return responseBody; // depends on control dependency: [if], data = [none] } } catch (Exception e) { //Returned JSON was not in expected format. Fall back to returning the whole response body, if any if(StringUtils.isNotBlank(responseBody)) { return responseBody; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static float[] stddev (int[] values, int start, int length) { // first we need the mean float mean = 0f; for (int ii = start, end = start + length; ii < end; ii++) { mean += values[ii]; } mean /= length; // next we compute the variance float variance = 0f; for (int ii = start, end = start + length; ii < end; ii++) { float value = values[ii] - mean; variance += value * value; } variance /= (length - 1); // the standard deviation is the square root of the variance return new float[] { mean, variance, (float)Math.sqrt(variance) }; } }
public class class_name { public static float[] stddev (int[] values, int start, int length) { // first we need the mean float mean = 0f; for (int ii = start, end = start + length; ii < end; ii++) { mean += values[ii]; // depends on control dependency: [for], data = [ii] } mean /= length; // next we compute the variance float variance = 0f; for (int ii = start, end = start + length; ii < end; ii++) { float value = values[ii] - mean; variance += value * value; // depends on control dependency: [for], data = [none] } variance /= (length - 1); // the standard deviation is the square root of the variance return new float[] { mean, variance, (float)Math.sqrt(variance) }; } }
public class class_name { public static String trimTextDown(String text, int sizeMinusAppend, String append) { Assert.notNull(append, "Missing append!"); if (text == null || text.length() <= sizeMinusAppend) { return text; } sizeMinusAppend = sizeMinusAppend - append.length(); int pos = text.lastIndexOf(" ", sizeMinusAppend); if (pos < 0) { return text.substring(0, sizeMinusAppend) + append; } return text.substring(0, pos) + append; } }
public class class_name { public static String trimTextDown(String text, int sizeMinusAppend, String append) { Assert.notNull(append, "Missing append!"); if (text == null || text.length() <= sizeMinusAppend) { return text; // depends on control dependency: [if], data = [none] } sizeMinusAppend = sizeMinusAppend - append.length(); int pos = text.lastIndexOf(" ", sizeMinusAppend); if (pos < 0) { return text.substring(0, sizeMinusAppend) + append; // depends on control dependency: [if], data = [none] } return text.substring(0, pos) + append; } }
public class class_name { @Override public void printGroundtruth(final Long user, final PrintStream out, final OUTPUT_FORMAT format) { for (Long i : getTest().getUserItems(user)) { Double d = getTest().getUserItemPreference(user, i); if (d >= getThreshold()) { final Map<Long, Double> tmp = new HashMap<Long, Double>(); tmp.put(i, d); printGroundtruth(user + "_" + i, tmp, out, format); } } } }
public class class_name { @Override public void printGroundtruth(final Long user, final PrintStream out, final OUTPUT_FORMAT format) { for (Long i : getTest().getUserItems(user)) { Double d = getTest().getUserItemPreference(user, i); if (d >= getThreshold()) { final Map<Long, Double> tmp = new HashMap<Long, Double>(); tmp.put(i, d); // depends on control dependency: [if], data = [none] printGroundtruth(user + "_" + i, tmp, out, format); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String translateSize(String size, boolean strict) { if (strict) { boolean found=false; for (String s: validValues) { if (s.equals(size)) { found=true; break; } } if (!found) { throw new FacesException("The size of b:panel must be one of the values xs, sm, md, lg, tiny-screen, small-screen, medium-screen, or large-screen"); } } if(size.equalsIgnoreCase("xs") || size.equalsIgnoreCase("tiny-screen")) return "xs"; if(size.equalsIgnoreCase("sm") || size.equalsIgnoreCase("small-screen")) return "sm"; if(size.equalsIgnoreCase("md") || size.equalsIgnoreCase("medium-screen")) return "md"; if(size.equalsIgnoreCase("lg") || size.equalsIgnoreCase("large-screen")) return "lg"; return size; } }
public class class_name { public static String translateSize(String size, boolean strict) { if (strict) { boolean found=false; for (String s: validValues) { if (s.equals(size)) { found=true; // depends on control dependency: [if], data = [none] break; } } if (!found) { throw new FacesException("The size of b:panel must be one of the values xs, sm, md, lg, tiny-screen, small-screen, medium-screen, or large-screen"); } } if(size.equalsIgnoreCase("xs") || size.equalsIgnoreCase("tiny-screen")) return "xs"; if(size.equalsIgnoreCase("sm") || size.equalsIgnoreCase("small-screen")) return "sm"; if(size.equalsIgnoreCase("md") || size.equalsIgnoreCase("medium-screen")) return "md"; if(size.equalsIgnoreCase("lg") || size.equalsIgnoreCase("large-screen")) return "lg"; return size; } }
public class class_name { public static Tuple<String, String> split(String strColumn, String pattern, int index, String valueName) { String name = "split_" + random(); String script = ""; if (valueName == null) { script = "def " + name + " = doc['" + strColumn + "'].value.split('" + pattern + "')[" + index + "]"; } else { script = "; def " + name + " = " + valueName + ".split('" + pattern + "')[" + index + "]"; } return new Tuple<>(name, script); } }
public class class_name { public static Tuple<String, String> split(String strColumn, String pattern, int index, String valueName) { String name = "split_" + random(); String script = ""; if (valueName == null) { script = "def " + name + " = doc['" + strColumn + "'].value.split('" + pattern + "')[" + index + "]"; // depends on control dependency: [if], data = [none] } else { script = "; def " + name + " = " + valueName + ".split('" + pattern + "')[" + index + "]"; // depends on control dependency: [if], data = [none] } return new Tuple<>(name, script); } }
public class class_name { protected int getDefaultMonthInYear(int extendedYear) { int era = internalGet(ERA, CURRENT_ERA); //computeFields(status); // No need to compute fields here - expect the caller already did so. // Find out if we are at the edge of an era if(extendedYear == ERAS[era*3]) { return ERAS[(era*3)+1] // month.. -1; // return 0-based month } else { return super.getDefaultMonthInYear(extendedYear); } } }
public class class_name { protected int getDefaultMonthInYear(int extendedYear) { int era = internalGet(ERA, CURRENT_ERA); //computeFields(status); // No need to compute fields here - expect the caller already did so. // Find out if we are at the edge of an era if(extendedYear == ERAS[era*3]) { return ERAS[(era*3)+1] // month.. -1; // return 0-based month // depends on control dependency: [if], data = [none] } else { return super.getDefaultMonthInYear(extendedYear); // depends on control dependency: [if], data = [(extendedYear] } } }
public class class_name { public EJSHome getHomeByInterface(String application, String module, String beanInterface) throws EJBNotFoundException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getHomeByInterface : " + application + ", " + module + ", " + beanInterface); J2EEName j2eeName = null; AppLinkData linkData = getAppLinkData(application); // F743-26072 if (linkData != null) { // If a module was specified, then look for a bean that implements // the interface in the module table first, as there is a better // chance of finding a single match, and this is consistent with // ejb-link behavior. d446993 if (module != null) { synchronized (linkData) { Map<String, Set<J2EEName>> moduleTable = linkData.ivBeansByModuleByType.get(module); if (moduleTable != null) { Set<J2EEName> beans = moduleTable.get(beanInterface); if (beans != null && !beans.isEmpty()) { if (beans.size() != 1) { AmbiguousEJBReferenceException ex = new AmbiguousEJBReferenceException ("The reference to bean interface " + beanInterface + " is ambiguous. Module " + application + "/" + module + " contains multiple beans with the same interface."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } j2eeName = beans.iterator().next(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Mapped beanInterface " + beanInterface + " to j2eeName " + j2eeName + " in current module."); } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "EJB with interface " + beanInterface + " not found in module " + module); } } } // If a bean was found, attempt to get the home outside of the linkData // sync block to avoid a deadlock if the bean hasn't completed starting. if (j2eeName != null) { EJSHome retHome = (EJSHome) getHome(j2eeName); if (retHome != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + retHome.getJ2EEName()); return retHome; } j2eeName = null; } } synchronized (linkData) { Set<J2EEName> beans = linkData.ivBeansByType.get(beanInterface); if (beans != null && !beans.isEmpty()) { if (beans.size() != 1) { AmbiguousEJBReferenceException ex = new AmbiguousEJBReferenceException ("The reference to bean interface " + beanInterface + " is ambiguous. Application " + application + " contains multiple beans with the same interface."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } j2eeName = beans.iterator().next(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Mapped beanInterface " + beanInterface + " to j2eeName " + j2eeName + " in another module in the app."); } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "EJB with interface " + beanInterface + " not found"); } } // If a bean was found, attempt to get the home outside of the linkData // sync block to avoid a deadlock if the bean hasn't completed starting. if (j2eeName != null) { EJSHome retHome = (EJSHome) getHome(j2eeName); if (retHome != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + retHome.getJ2EEName()); return retHome; } } } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Applicaton " + application + " not found"); } EJBNotFoundException ex = new EJBNotFoundException("EJB with interface " + beanInterface + " not present in application " + application + "."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } }
public class class_name { public EJSHome getHomeByInterface(String application, String module, String beanInterface) throws EJBNotFoundException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "getHomeByInterface : " + application + ", " + module + ", " + beanInterface); J2EEName j2eeName = null; AppLinkData linkData = getAppLinkData(application); // F743-26072 if (linkData != null) { // If a module was specified, then look for a bean that implements // the interface in the module table first, as there is a better // chance of finding a single match, and this is consistent with // ejb-link behavior. d446993 if (module != null) { synchronized (linkData) { Map<String, Set<J2EEName>> moduleTable = linkData.ivBeansByModuleByType.get(module); if (moduleTable != null) { Set<J2EEName> beans = moduleTable.get(beanInterface); if (beans != null && !beans.isEmpty()) { if (beans.size() != 1) { AmbiguousEJBReferenceException ex = new AmbiguousEJBReferenceException ("The reference to bean interface " + beanInterface + " is ambiguous. Module " + application + "/" + module + " contains multiple beans with the same interface."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } j2eeName = beans.iterator().next(); // depends on control dependency: [if], data = [none] if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Mapped beanInterface " + beanInterface + " to j2eeName " + j2eeName + " in current module."); } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "EJB with interface " + beanInterface + " not found in module " + module); } } } // If a bean was found, attempt to get the home outside of the linkData // sync block to avoid a deadlock if the bean hasn't completed starting. if (j2eeName != null) { EJSHome retHome = (EJSHome) getHome(j2eeName); if (retHome != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + retHome.getJ2EEName()); return retHome; // depends on control dependency: [if], data = [none] } j2eeName = null; // depends on control dependency: [if], data = [none] } } synchronized (linkData) { Set<J2EEName> beans = linkData.ivBeansByType.get(beanInterface); if (beans != null && !beans.isEmpty()) { if (beans.size() != 1) { AmbiguousEJBReferenceException ex = new AmbiguousEJBReferenceException ("The reference to bean interface " + beanInterface + " is ambiguous. Application " + application + " contains multiple beans with the same interface."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } j2eeName = beans.iterator().next(); // depends on control dependency: [if], data = [none] if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Mapped beanInterface " + beanInterface + " to j2eeName " + j2eeName + " in another module in the app."); } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "EJB with interface " + beanInterface + " not found"); } } // If a bean was found, attempt to get the home outside of the linkData // sync block to avoid a deadlock if the bean hasn't completed starting. if (j2eeName != null) { EJSHome retHome = (EJSHome) getHome(j2eeName); if (retHome != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + retHome.getJ2EEName()); return retHome; } } } else { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "Applicaton " + application + " not found"); } EJBNotFoundException ex = new EJBNotFoundException("EJB with interface " + beanInterface + " not present in application " + application + "."); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "getHomeByInterface : " + ex); throw ex; } }
public class class_name { public void setPrivateIpAddresses(java.util.Collection<PrivateIpAddressDetails> privateIpAddresses) { if (privateIpAddresses == null) { this.privateIpAddresses = null; return; } this.privateIpAddresses = new java.util.ArrayList<PrivateIpAddressDetails>(privateIpAddresses); } }
public class class_name { public void setPrivateIpAddresses(java.util.Collection<PrivateIpAddressDetails> privateIpAddresses) { if (privateIpAddresses == null) { this.privateIpAddresses = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.privateIpAddresses = new java.util.ArrayList<PrivateIpAddressDetails>(privateIpAddresses); } }
public class class_name { public void setBundleList(java.util.Collection<BundleDetails> bundleList) { if (bundleList == null) { this.bundleList = null; return; } this.bundleList = new java.util.ArrayList<BundleDetails>(bundleList); } }
public class class_name { public void setBundleList(java.util.Collection<BundleDetails> bundleList) { if (bundleList == null) { this.bundleList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.bundleList = new java.util.ArrayList<BundleDetails>(bundleList); } }
public class class_name { static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) { if (isAssignmentOp(n)) { return true; } switch (n.getToken()) { case DELPROP: case DEC: case INC: case YIELD: case THROW: case AWAIT: case FOR_IN: // assigns to a loop LHS case FOR_OF: // assigns to a loop LHS, runs an iterator case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations. return true; case CALL: case TAGGED_TEMPLATELIT: return NodeUtil.functionCallHasSideEffects(n, compiler); case NEW: return NodeUtil.constructorCallHasSideEffects(n); case NAME: // A variable definition. // TODO(b/129564961): Consider EXPORT declarations. return n.hasChildren(); case REST: case SPREAD: return NodeUtil.iteratesImpureIterable(n); default: break; } return false; } }
public class class_name { static boolean nodeTypeMayHaveSideEffects(Node n, AbstractCompiler compiler) { if (isAssignmentOp(n)) { return true; // depends on control dependency: [if], data = [none] } switch (n.getToken()) { case DELPROP: case DEC: case INC: case YIELD: case THROW: case AWAIT: case FOR_IN: // assigns to a loop LHS case FOR_OF: // assigns to a loop LHS, runs an iterator case FOR_AWAIT_OF: // assigns to a loop LHS, runs an iterator, async operations. return true; case CALL: case TAGGED_TEMPLATELIT: return NodeUtil.functionCallHasSideEffects(n, compiler); case NEW: return NodeUtil.constructorCallHasSideEffects(n); case NAME: // A variable definition. // TODO(b/129564961): Consider EXPORT declarations. return n.hasChildren(); case REST: case SPREAD: return NodeUtil.iteratesImpureIterable(n); default: break; } return false; } }
public class class_name { public static void setMetaClass(Class self, MetaClass metaClass) { final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry(); if (metaClass == null) metaClassRegistry.removeMetaClass(self); else { if (metaClass instanceof HandleMetaClass) { metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee()); } else { metaClassRegistry.setMetaClass(self, metaClass); } if (self==NullObject.class) { NullObject.getNullObject().setMetaClass(metaClass); } } } }
public class class_name { public static void setMetaClass(Class self, MetaClass metaClass) { final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry(); if (metaClass == null) metaClassRegistry.removeMetaClass(self); else { if (metaClass instanceof HandleMetaClass) { metaClassRegistry.setMetaClass(self, ((HandleMetaClass)metaClass).getAdaptee()); // depends on control dependency: [if], data = [none] } else { metaClassRegistry.setMetaClass(self, metaClass); // depends on control dependency: [if], data = [none] } if (self==NullObject.class) { NullObject.getNullObject().setMetaClass(metaClass); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public AwsSecurityFindingFilters withResourceAwsEc2InstanceImageId(StringFilter... resourceAwsEc2InstanceImageId) { if (this.resourceAwsEc2InstanceImageId == null) { setResourceAwsEc2InstanceImageId(new java.util.ArrayList<StringFilter>(resourceAwsEc2InstanceImageId.length)); } for (StringFilter ele : resourceAwsEc2InstanceImageId) { this.resourceAwsEc2InstanceImageId.add(ele); } return this; } }
public class class_name { public AwsSecurityFindingFilters withResourceAwsEc2InstanceImageId(StringFilter... resourceAwsEc2InstanceImageId) { if (this.resourceAwsEc2InstanceImageId == null) { setResourceAwsEc2InstanceImageId(new java.util.ArrayList<StringFilter>(resourceAwsEc2InstanceImageId.length)); // depends on control dependency: [if], data = [none] } for (StringFilter ele : resourceAwsEc2InstanceImageId) { this.resourceAwsEc2InstanceImageId.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public boolean accept(File f) { if (f != null) { if (f.isDirectory()) { return false; } String extension = getExtension(f); if (extension != null && filters.get(getExtension(f)) != null) { return true; } } return false; } }
public class class_name { public boolean accept(File f) { if (f != null) { if (f.isDirectory()) { return false; // depends on control dependency: [if], data = [none] } String extension = getExtension(f); if (extension != null && filters.get(getExtension(f)) != null) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @SuppressWarnings({"SuspiciousSystemArraycopy"}) @Override public void setTo(T orig) { if (orig.width != width || orig.height != height || orig.numBands != numBands ) reshape(orig.width,orig.height,orig.numBands); if (!orig.isSubimage() && !isSubimage()) { System.arraycopy(orig._getData(), orig.startIndex, _getData(), startIndex, stride * height); } else { int indexSrc = orig.startIndex; int indexDst = startIndex; for (int y = 0; y < height; y++) { System.arraycopy(orig._getData(), indexSrc, _getData(), indexDst, width * numBands); indexSrc += orig.stride; indexDst += stride; } } } }
public class class_name { @SuppressWarnings({"SuspiciousSystemArraycopy"}) @Override public void setTo(T orig) { if (orig.width != width || orig.height != height || orig.numBands != numBands ) reshape(orig.width,orig.height,orig.numBands); if (!orig.isSubimage() && !isSubimage()) { System.arraycopy(orig._getData(), orig.startIndex, _getData(), startIndex, stride * height); // depends on control dependency: [if], data = [none] } else { int indexSrc = orig.startIndex; int indexDst = startIndex; for (int y = 0; y < height; y++) { System.arraycopy(orig._getData(), indexSrc, _getData(), indexDst, width * numBands); // depends on control dependency: [for], data = [none] indexSrc += orig.stride; // depends on control dependency: [for], data = [none] indexDst += stride; // depends on control dependency: [for], data = [none] } } } }
public class class_name { @SuppressWarnings("ThrowFromFinallyBlock") private void updateByXml(final P project, Source source) throws IOException { project.checkPermission(Item.CONFIGURE); final String projectName = project.getName(); XmlFile configXmlFile = project.getConfigFile(); final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile()); try { try { XMLUtils.safeTransform(source, new StreamResult(out)); out.close(); } catch (SAXException | TransformerException e) { throw new IOException("Failed to persist config.xml", e); } // try to reflect the changes by reloading Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(project); if (o != project) { // ensure that we've got the same job type. extending this code to support updating // to different job type requires destroying & creating a new job type throw new IOException("Expecting " + project.getClass() + " but got " + o.getClass() + " instead"); } Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() { @SuppressWarnings("unchecked") @Override public Void call() throws IOException { project.onLoad(project.getParent(), projectName); return null; } }); Jenkins.getActiveInstance().rebuildDependencyGraphAsync(); // if everything went well, commit this new version out.commit(); } finally { out.abort(); } } }
public class class_name { @SuppressWarnings("ThrowFromFinallyBlock") private void updateByXml(final P project, Source source) throws IOException { project.checkPermission(Item.CONFIGURE); final String projectName = project.getName(); XmlFile configXmlFile = project.getConfigFile(); final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile()); try { try { XMLUtils.safeTransform(source, new StreamResult(out)); // depends on control dependency: [try], data = [none] out.close(); // depends on control dependency: [try], data = [none] } catch (SAXException | TransformerException e) { throw new IOException("Failed to persist config.xml", e); } // depends on control dependency: [catch], data = [none] // try to reflect the changes by reloading Object o = new XmlFile(Items.XSTREAM, out.getTemporaryFile()).unmarshal(project); if (o != project) { // ensure that we've got the same job type. extending this code to support updating // to different job type requires destroying & creating a new job type throw new IOException("Expecting " + project.getClass() + " but got " + o.getClass() + " instead"); } Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() { @SuppressWarnings("unchecked") @Override public Void call() throws IOException { project.onLoad(project.getParent(), projectName); return null; } }); Jenkins.getActiveInstance().rebuildDependencyGraphAsync(); // if everything went well, commit this new version out.commit(); } finally { out.abort(); } } }
public class class_name { private void recurChildrenToWffBinaryMessageOutputStream( final Set<AbstractHtml> children, final boolean rebuild) throws IOException { if (children != null && children.size() > 0) { for (final AbstractHtml child : children) { child.setRebuild(rebuild); // wffBinaryMessageOutputStreamer // outputStream.write(child.getOpeningTag().getBytes(charset)); NameValue nameValue = new NameValue(); final int tagNameIndex = TagRegistry.getTagNames() .indexOf(child.getTagName()); // if the tag index is -1 i.e. it's not indexed then the tag // name prepended with 0 value byte should be set. // If the first byte == 0 and length is greater than 1 then it's // a tag name, if the first byte is greater than 0 then it is // index bytes byte[] closingTagNameConvertedBytes = null; if (tagNameIndex == -1) { final byte[] tagNameBytes = child.getTagName() .getBytes(charset); byte[] nameBytes = new byte[tagNameBytes.length + 1]; nameBytes[0] = 0; System.arraycopy(tagNameBytes, 0, nameBytes, 1, tagNameBytes.length); nameValue.setName(nameBytes); closingTagNameConvertedBytes = nameBytes; // explicitly dereferenced right after use // because it's a recursive method. nameBytes = null; } else { // final byte[] indexBytes = WffBinaryMessageUtil // .getOptimizedBytesFromInt(tagNameIndex); // directly passed it as argument to // avoid consuming stack space nameValue.setName(WffBinaryMessageUtil .getOptimizedBytesFromInt(tagNameIndex)); closingTagNameConvertedBytes = WffBinaryMessageUtil .getOptimizedBytesFromInt((tagNameIndex * (-1))); } nameValue.setValues( child.getAttributeHtmlBytesCompressedByIndex(rebuild, charset)); wffBinaryMessageOutputStreamer.write(nameValue); // explicitly dereferenced right after use // because it's a recursive method. nameValue = null; // final Set<AbstractHtml> childrenOfChildren = child.children; // declaring a separate local variable childrenOfChildren will // consume stack space so directly passed it as argument recurChildrenToWffBinaryMessageOutputStream(child.children, rebuild); NameValue closingTagNameValue = new NameValue(); closingTagNameValue.setName(closingTagNameConvertedBytes); closingTagNameValue.setValues(new byte[0][0]); wffBinaryMessageOutputStreamer.write(closingTagNameValue); // explicitly dereferenced right after use // because it's a recursive method. closingTagNameValue = null; closingTagNameConvertedBytes = null; // outputStream.write(child.closingTag.getBytes(charset)); } } } }
public class class_name { private void recurChildrenToWffBinaryMessageOutputStream( final Set<AbstractHtml> children, final boolean rebuild) throws IOException { if (children != null && children.size() > 0) { for (final AbstractHtml child : children) { child.setRebuild(rebuild); // depends on control dependency: [for], data = [child] // wffBinaryMessageOutputStreamer // outputStream.write(child.getOpeningTag().getBytes(charset)); NameValue nameValue = new NameValue(); final int tagNameIndex = TagRegistry.getTagNames() .indexOf(child.getTagName()); // if the tag index is -1 i.e. it's not indexed then the tag // name prepended with 0 value byte should be set. // If the first byte == 0 and length is greater than 1 then it's // a tag name, if the first byte is greater than 0 then it is // index bytes byte[] closingTagNameConvertedBytes = null; if (tagNameIndex == -1) { final byte[] tagNameBytes = child.getTagName() .getBytes(charset); byte[] nameBytes = new byte[tagNameBytes.length + 1]; nameBytes[0] = 0; // depends on control dependency: [if], data = [none] System.arraycopy(tagNameBytes, 0, nameBytes, 1, tagNameBytes.length); // depends on control dependency: [if], data = [none] nameValue.setName(nameBytes); // depends on control dependency: [if], data = [none] closingTagNameConvertedBytes = nameBytes; // depends on control dependency: [if], data = [none] // explicitly dereferenced right after use // because it's a recursive method. nameBytes = null; // depends on control dependency: [if], data = [none] } else { // final byte[] indexBytes = WffBinaryMessageUtil // .getOptimizedBytesFromInt(tagNameIndex); // directly passed it as argument to // avoid consuming stack space nameValue.setName(WffBinaryMessageUtil .getOptimizedBytesFromInt(tagNameIndex)); // depends on control dependency: [if], data = [none] closingTagNameConvertedBytes = WffBinaryMessageUtil .getOptimizedBytesFromInt((tagNameIndex * (-1))); // depends on control dependency: [if], data = [none] } nameValue.setValues( child.getAttributeHtmlBytesCompressedByIndex(rebuild, charset)); // depends on control dependency: [for], data = [none] wffBinaryMessageOutputStreamer.write(nameValue); // depends on control dependency: [for], data = [none] // explicitly dereferenced right after use // because it's a recursive method. nameValue = null; // depends on control dependency: [for], data = [none] // final Set<AbstractHtml> childrenOfChildren = child.children; // declaring a separate local variable childrenOfChildren will // consume stack space so directly passed it as argument recurChildrenToWffBinaryMessageOutputStream(child.children, rebuild); // depends on control dependency: [for], data = [none] NameValue closingTagNameValue = new NameValue(); closingTagNameValue.setName(closingTagNameConvertedBytes); // depends on control dependency: [for], data = [none] closingTagNameValue.setValues(new byte[0][0]); // depends on control dependency: [for], data = [none] wffBinaryMessageOutputStreamer.write(closingTagNameValue); // depends on control dependency: [for], data = [none] // explicitly dereferenced right after use // because it's a recursive method. closingTagNameValue = null; // depends on control dependency: [for], data = [none] closingTagNameConvertedBytes = null; // depends on control dependency: [for], data = [none] // outputStream.write(child.closingTag.getBytes(charset)); } } } }
public class class_name { @Override public void run() { try { VoltTable partitionKeys = null; partitionKeys = m_client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0]; while (partitionKeys.advanceRow()) { m_client.callProcedure(new NullCallback(), "DeleteOldAdRequests", partitionKeys.getLong("PARTITION_KEY"), m_expiredAgeInSeconds); } m_client.callProcedure(new NullCallback(), "DeleteExpiredBids"); } catch (IOException | ProcCallException ex) { ex.printStackTrace(); } } }
public class class_name { @Override public void run() { try { VoltTable partitionKeys = null; partitionKeys = m_client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0]; // depends on control dependency: [try], data = [none] while (partitionKeys.advanceRow()) { m_client.callProcedure(new NullCallback(), "DeleteOldAdRequests", partitionKeys.getLong("PARTITION_KEY"), m_expiredAgeInSeconds); // depends on control dependency: [while], data = [none] } m_client.callProcedure(new NullCallback(), "DeleteExpiredBids"); // depends on control dependency: [try], data = [none] } catch (IOException | ProcCallException ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setSenderId(String senderId) { try { JSONObject sender; if (!isNull((KEY_SENDER))) { sender = getJSONObject(KEY_SENDER); } else { sender = new JSONObject(); put(KEY_SENDER, sender); } sender.put(KEY_SENDER_ID, senderId); } catch (JSONException e) { ApptentiveLog.e(e, "Exception setting ApptentiveMessage's %s field.", KEY_SENDER_ID); logException(e); } } }
public class class_name { public void setSenderId(String senderId) { try { JSONObject sender; if (!isNull((KEY_SENDER))) { sender = getJSONObject(KEY_SENDER); // depends on control dependency: [if], data = [none] } else { sender = new JSONObject(); // depends on control dependency: [if], data = [none] put(KEY_SENDER, sender); // depends on control dependency: [if], data = [none] } sender.put(KEY_SENDER_ID, senderId); // depends on control dependency: [try], data = [none] } catch (JSONException e) { ApptentiveLog.e(e, "Exception setting ApptentiveMessage's %s field.", KEY_SENDER_ID); logException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setBinaryListValues(java.util.Collection<java.nio.ByteBuffer> binaryListValues) { if (binaryListValues == null) { this.binaryListValues = null; return; } this.binaryListValues = new com.amazonaws.internal.SdkInternalList<java.nio.ByteBuffer>(binaryListValues); } }
public class class_name { public void setBinaryListValues(java.util.Collection<java.nio.ByteBuffer> binaryListValues) { if (binaryListValues == null) { this.binaryListValues = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.binaryListValues = new com.amazonaws.internal.SdkInternalList<java.nio.ByteBuffer>(binaryListValues); } }
public class class_name { public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); } }
public class class_name { public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); // depends on control dependency: [try], data = [none] } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); } }
public class class_name { @Override public String resolve( String mid, Features features, Set<String> dependentFeatures, StringBuffer sb, boolean resolveAliases, boolean evaluateHasPluginConditionals) { final String sourceMethod = "resolve"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(ConfigImpl.class.getName(), sourceMethod, new Object[]{mid, features, dependentFeatures, sb, resolveAliases, evaluateHasPluginConditionals}); } mid = _resolve(mid, features, dependentFeatures, resolveAliases, evaluateHasPluginConditionals, 0, sb); // check for package name and replace with the package's main module id IPackage pkg = packages.get(mid); if (pkg != null) { mid = pkg.getMain(); } if (isTraceLogging) { log.exiting(ConfigImpl.class.getName(), sourceMethod, mid); } return mid; } }
public class class_name { @Override public String resolve( String mid, Features features, Set<String> dependentFeatures, StringBuffer sb, boolean resolveAliases, boolean evaluateHasPluginConditionals) { final String sourceMethod = "resolve"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(ConfigImpl.class.getName(), sourceMethod, new Object[]{mid, features, dependentFeatures, sb, resolveAliases, evaluateHasPluginConditionals}); // depends on control dependency: [if], data = [none] } mid = _resolve(mid, features, dependentFeatures, resolveAliases, evaluateHasPluginConditionals, 0, sb); // check for package name and replace with the package's main module id IPackage pkg = packages.get(mid); if (pkg != null) { mid = pkg.getMain(); // depends on control dependency: [if], data = [none] } if (isTraceLogging) { log.exiting(ConfigImpl.class.getName(), sourceMethod, mid); // depends on control dependency: [if], data = [none] } return mid; } }
public class class_name { private int edgeAngleCompare_(/* const */Edge edge1, /* const */Edge edge2) { if (edge1.equals(edge2)) return 0; Point2D v1 = edge1.m_segment._getTangent(edge1.getReversed() ? 1.0 : 0.0); if (edge1.getReversed()) v1.negate(); Point2D v2 = edge2.m_segment._getTangent(edge2.getReversed() ? 1.0 : 0.0); if (edge2.getReversed()) v2.negate(); int q1 = v1._getQuarter(); int q2 = v2._getQuarter(); if (q2 == q1) { double cross = v1.crossProduct(v2); double crossError = 4 * NumberUtils.doubleEps() * (Math.abs(v2.x * v1.y) + Math.abs(v2.y * v1.x)); if (Math.abs(cross) <= crossError) { cross--; // To avoid warning of "this line has no effect" from // cross = cross. cross++; } assert (Math.abs(cross) > crossError); return cross < 0 ? 1 : (cross > 0 ? -1 : 0); } else { return q1 < q2 ? -1 : 1; } } }
public class class_name { private int edgeAngleCompare_(/* const */Edge edge1, /* const */Edge edge2) { if (edge1.equals(edge2)) return 0; Point2D v1 = edge1.m_segment._getTangent(edge1.getReversed() ? 1.0 : 0.0); if (edge1.getReversed()) v1.negate(); Point2D v2 = edge2.m_segment._getTangent(edge2.getReversed() ? 1.0 : 0.0); if (edge2.getReversed()) v2.negate(); int q1 = v1._getQuarter(); int q2 = v2._getQuarter(); if (q2 == q1) { double cross = v1.crossProduct(v2); double crossError = 4 * NumberUtils.doubleEps() * (Math.abs(v2.x * v1.y) + Math.abs(v2.y * v1.x)); if (Math.abs(cross) <= crossError) { cross--; // To avoid warning of "this line has no effect" from // depends on control dependency: [if], data = [none] // cross = cross. cross++; // depends on control dependency: [if], data = [none] } assert (Math.abs(cross) > crossError); // depends on control dependency: [if], data = [none] return cross < 0 ? 1 : (cross > 0 ? -1 : 0); // depends on control dependency: [if], data = [none] } else { return q1 < q2 ? -1 : 1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void shallowCopy(ITuple tupleDest) { for(Field field: this.getSchema().getFields()) { tupleDest.set(field.getName(), this.get(field.getName())); } } }
public class class_name { public void shallowCopy(ITuple tupleDest) { for(Field field: this.getSchema().getFields()) { tupleDest.set(field.getName(), this.get(field.getName())); // depends on control dependency: [for], data = [field] } } }