code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { void addAndGet(long amount) { for (int i = 0; i < ServoPollers.NUM_POLLERS; ++i) { getCurrent(i).addAndGet(amount); } } }
public class class_name { void addAndGet(long amount) { for (int i = 0; i < ServoPollers.NUM_POLLERS; ++i) { getCurrent(i).addAndGet(amount); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName, final String ipConfigurationName) { return listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetVMPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName, final String ipConfigurationName) { return listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listVirtualMachineScaleSetVMPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public final void mAND() throws RecognitionException { try { int _type = AND; int _channel = DEFAULT_TOKEN_CHANNEL; // druidG.g:631:6: ( ( 'AND' | 'and' ) ) // druidG.g:631:8: ( 'AND' | 'and' ) { // druidG.g:631:8: ( 'AND' | 'and' ) int alt20=2; int LA20_0 = input.LA(1); if ( (LA20_0=='A') ) { alt20=1; } else if ( (LA20_0=='a') ) { alt20=2; } else { NoViableAltException nvae = new NoViableAltException("", 20, 0, input); throw nvae; } switch (alt20) { case 1 : // druidG.g:631:9: 'AND' { match("AND"); } break; case 2 : // druidG.g:631:15: 'and' { match("and"); } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public final void mAND() throws RecognitionException { try { int _type = AND; int _channel = DEFAULT_TOKEN_CHANNEL; // druidG.g:631:6: ( ( 'AND' | 'and' ) ) // druidG.g:631:8: ( 'AND' | 'and' ) { // druidG.g:631:8: ( 'AND' | 'and' ) int alt20=2; int LA20_0 = input.LA(1); if ( (LA20_0=='A') ) { alt20=1; // depends on control dependency: [if], data = [none] } else if ( (LA20_0=='a') ) { alt20=2; // depends on control dependency: [if], data = [none] } else { NoViableAltException nvae = new NoViableAltException("", 20, 0, input); throw nvae; } switch (alt20) { case 1 : // druidG.g:631:9: 'AND' { match("AND"); } break; case 2 : // druidG.g:631:15: 'and' { match("and"); } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public static void disposeLoopsAndConnections() { HttpResources resources = httpResources.getAndSet(null); if (resources != null) { resources._dispose(); } } }
public class class_name { public static void disposeLoopsAndConnections() { HttpResources resources = httpResources.getAndSet(null); if (resources != null) { resources._dispose(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void rcvXAOpen(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXAOpen", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); short connectionObjectId = request.getShort(); int clientTransactionId = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "Connection Object ID", connectionObjectId); SibTr.debug(tc, "Transaction ID", clientTransactionId); } try { conversation.send(poolManager.allocate(), JFapChannelConstants.SEG_XAOPEN_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXAOpen", CommsConstants.STATICCATXATRANSACTION_XAOPEN_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXAOpen"); } }
public class class_name { public static void rcvXAOpen(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXAOpen", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); short connectionObjectId = request.getShort(); int clientTransactionId = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "Connection Object ID", connectionObjectId); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "Transaction ID", clientTransactionId); // depends on control dependency: [if], data = [none] } try { conversation.send(poolManager.allocate(), JFapChannelConstants.SEG_XAOPEN_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXAOpen", CommsConstants.STATICCATXATRANSACTION_XAOPEN_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXAOpen"); } }
public class class_name { public void setResourceShareArns(java.util.Collection<String> resourceShareArns) { if (resourceShareArns == null) { this.resourceShareArns = null; return; } this.resourceShareArns = new java.util.ArrayList<String>(resourceShareArns); } }
public class class_name { public void setResourceShareArns(java.util.Collection<String> resourceShareArns) { if (resourceShareArns == null) { this.resourceShareArns = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.resourceShareArns = new java.util.ArrayList<String>(resourceShareArns); } }
public class class_name { @Override public EClass getRenderEnginePluginConfiguration() { if (renderEnginePluginConfigurationEClass == null) { renderEnginePluginConfigurationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(14); } return renderEnginePluginConfigurationEClass; } }
public class class_name { @Override public EClass getRenderEnginePluginConfiguration() { if (renderEnginePluginConfigurationEClass == null) { renderEnginePluginConfigurationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(14); // depends on control dependency: [if], data = [none] } return renderEnginePluginConfigurationEClass; } }
public class class_name { public void open() throws DBException { if (m_JDBCConnection == null) { String strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM); if ((strJdbcDriver == null) || (strJdbcDriver.length() == 0)) { // If a JDBC driver isn't specified, set up for the default driver String strDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM); if (strDataSource == null) strDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM); if (strDataSource == null) strDataSource = SQLParams.DEFAULT_DATASOURCE; boolean bDataSourceConnection = false; if (strDataSource != null) bDataSourceConnection = this.setupDataSourceConnection(strDataSource); String strDatabaseProductName = null; try { if (m_JDBCConnection != null) { strDatabaseProductName = m_JDBCConnection.getMetaData().getDatabaseProductName(); strDatabaseProductName = this.fixDatabaseProductName(strDatabaseProductName); } } catch (SQLException e) { e.printStackTrace(); } if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0)) strDatabaseProductName = this.getProperty(SQLParams.DATABASE_PRODUCT_PARAM); if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0)) strDatabaseProductName = DEFAULT_DATABASE_PRODUCT; this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName); this.setupDatabaseProperties(); // If I haven't read the db properties, read them now! if (!bDataSourceConnection) { // Datasource connection could be supplied in the db properties String strDBDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM); if (strDBDataSource == null) strDBDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM); if (strDBDataSource != null) if (!strDBDataSource.equalsIgnoreCase(strDataSource)) bDataSourceConnection = this.setupDataSourceConnection(strDBDataSource); } if (!bDataSourceConnection) bDataSourceConnection = this.setupDirectDataSourceConnection(); if (!bDataSourceConnection) { strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM); // Default driver if (strJdbcDriver == null) strJdbcDriver = this.getProperty(BASE_DATABASE_JDBC_DRIVER); // Special case - base database } } if (strJdbcDriver != null) this.setupJDBCConnection(strJdbcDriver); this.initConnection(); this.loadDatabaseProperties(); } super.open(); // Do any inherited } }
public class class_name { public void open() throws DBException { if (m_JDBCConnection == null) { String strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM); if ((strJdbcDriver == null) || (strJdbcDriver.length() == 0)) { // If a JDBC driver isn't specified, set up for the default driver String strDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM); if (strDataSource == null) strDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM); if (strDataSource == null) strDataSource = SQLParams.DEFAULT_DATASOURCE; boolean bDataSourceConnection = false; if (strDataSource != null) bDataSourceConnection = this.setupDataSourceConnection(strDataSource); String strDatabaseProductName = null; try { if (m_JDBCConnection != null) { strDatabaseProductName = m_JDBCConnection.getMetaData().getDatabaseProductName(); // depends on control dependency: [if], data = [none] strDatabaseProductName = this.fixDatabaseProductName(strDatabaseProductName); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0)) strDatabaseProductName = this.getProperty(SQLParams.DATABASE_PRODUCT_PARAM); if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0)) strDatabaseProductName = DEFAULT_DATABASE_PRODUCT; this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName); this.setupDatabaseProperties(); // If I haven't read the db properties, read them now! if (!bDataSourceConnection) { // Datasource connection could be supplied in the db properties String strDBDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM); if (strDBDataSource == null) strDBDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM); if (strDBDataSource != null) if (!strDBDataSource.equalsIgnoreCase(strDataSource)) bDataSourceConnection = this.setupDataSourceConnection(strDBDataSource); } if (!bDataSourceConnection) bDataSourceConnection = this.setupDirectDataSourceConnection(); if (!bDataSourceConnection) { strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM); // Default driver // depends on control dependency: [if], data = [none] if (strJdbcDriver == null) strJdbcDriver = this.getProperty(BASE_DATABASE_JDBC_DRIVER); // Special case - base database } } if (strJdbcDriver != null) this.setupJDBCConnection(strJdbcDriver); this.initConnection(); this.loadDatabaseProperties(); } super.open(); // Do any inherited } }
public class class_name { public synchronized Node<ElkClass> getEquivalentClassesQuietly( ElkClassExpression classExpression) throws ElkException { try { return getEquivalentClasses(classExpression); } catch (final ElkInconsistentOntologyException e) { // All classes are equivalent to each other, so also to owl:Nothing. return getTaxonomyQuietly().getBottomNode(); } } }
public class class_name { public synchronized Node<ElkClass> getEquivalentClassesQuietly( ElkClassExpression classExpression) throws ElkException { try { return getEquivalentClasses(classExpression); // depends on control dependency: [try], data = [none] } catch (final ElkInconsistentOntologyException e) { // All classes are equivalent to each other, so also to owl:Nothing. return getTaxonomyQuietly().getBottomNode(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String format(Object... array) { if (array == null) { return StringUtils.EMPTY; } if (array.length == 1 && array[0].getClass().isArray()) { return format(Convert.convert(array[0], Iterable.class)); } return format(Arrays.asList(array).iterator()); } }
public class class_name { public String format(Object... array) { if (array == null) { return StringUtils.EMPTY; // depends on control dependency: [if], data = [none] } if (array.length == 1 && array[0].getClass().isArray()) { return format(Convert.convert(array[0], Iterable.class)); // depends on control dependency: [if], data = [none] } return format(Arrays.asList(array).iterator()); } }
public class class_name { public static void shutdown() { try { EXECUTOR_SERVICE.shutdown(); if (RuntimeCache.REDIS == getRuntimeCache()) { RedisCache.shutdown(); } Connections.shutdownConnectionPool(); if (RuntimeDatabase.H2 == getRuntimeDatabase()) { final String newTCPServer = getLocalProperty("newTCPServer"); if ("true".equals(newTCPServer)) { h2.stop(); h2.shutdown(); LOGGER.log(Level.INFO, "Closed H2 TCP server"); } } } catch (final Exception e) { LOGGER.log(Level.ERROR, "Shutdowns Latke failed", e); } BeanManager.close(); // Manually unregister JDBC driver, which prevents Tomcat from complaining about memory leaks final Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { final Driver driver = drivers.nextElement(); try { DriverManager.deregisterDriver(driver); LOGGER.log(Level.TRACE, "Unregistered JDBC driver [" + driver + "]"); } catch (final SQLException e) { LOGGER.log(Level.ERROR, "Unregister JDBC driver [" + driver + "] failed", e); } } } }
public class class_name { public static void shutdown() { try { EXECUTOR_SERVICE.shutdown(); // depends on control dependency: [try], data = [none] if (RuntimeCache.REDIS == getRuntimeCache()) { RedisCache.shutdown(); // depends on control dependency: [if], data = [none] } Connections.shutdownConnectionPool(); // depends on control dependency: [try], data = [none] if (RuntimeDatabase.H2 == getRuntimeDatabase()) { final String newTCPServer = getLocalProperty("newTCPServer"); if ("true".equals(newTCPServer)) { h2.stop(); // depends on control dependency: [if], data = [none] h2.shutdown(); // depends on control dependency: [if], data = [none] LOGGER.log(Level.INFO, "Closed H2 TCP server"); // depends on control dependency: [if], data = [none] } } } catch (final Exception e) { LOGGER.log(Level.ERROR, "Shutdowns Latke failed", e); } // depends on control dependency: [catch], data = [none] BeanManager.close(); // Manually unregister JDBC driver, which prevents Tomcat from complaining about memory leaks final Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { final Driver driver = drivers.nextElement(); try { DriverManager.deregisterDriver(driver); // depends on control dependency: [try], data = [none] LOGGER.log(Level.TRACE, "Unregistered JDBC driver [" + driver + "]"); // depends on control dependency: [try], data = [none] } catch (final SQLException e) { LOGGER.log(Level.ERROR, "Unregister JDBC driver [" + driver + "] failed", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @Nullable @MainThread static ActivityScopedCache getActivityScope(@NonNull Activity activity) { if (activity == null) { throw new NullPointerException("Activity is null"); } String activityId = activityIdMap.get(activity); if (activityId == null) { return null; } return activityScopedCacheMap.get(activityId); } }
public class class_name { @Nullable @MainThread static ActivityScopedCache getActivityScope(@NonNull Activity activity) { if (activity == null) { throw new NullPointerException("Activity is null"); } String activityId = activityIdMap.get(activity); if (activityId == null) { return null; // depends on control dependency: [if], data = [none] } return activityScopedCacheMap.get(activityId); } }
public class class_name { public static int decodeDesc(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { int headerSize; int bytesLength; byte[] bytes; try { int header = src[srcOffset]; if (header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW) { valueRef[0] = null; return 1; } header &= 0xff; if (header > 1 && header < 0xfe) { if (header < 0x80) { bytesLength = 0x80 - header; } else { bytesLength = header - 0x7f; } headerSize = 1; } else { bytesLength = Math.abs(DataDecoder.decodeInt(src, srcOffset + 1)); headerSize = 5; } bytes = new byte[bytesLength]; srcOffset += headerSize; for (int i=0; i<bytesLength; i++) { bytes[i] = (byte) ~src[srcOffset + i]; } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } valueRef[0] = new BigInteger(bytes); return headerSize + bytesLength; } }
public class class_name { public static int decodeDesc(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { int headerSize; int bytesLength; byte[] bytes; try { int header = src[srcOffset]; if (header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW) { valueRef[0] = null; // depends on control dependency: [if], data = [none] return 1; // depends on control dependency: [if], data = [none] } header &= 0xff; if (header > 1 && header < 0xfe) { if (header < 0x80) { bytesLength = 0x80 - header; // depends on control dependency: [if], data = [none] } else { bytesLength = header - 0x7f; // depends on control dependency: [if], data = [none] } headerSize = 1; // depends on control dependency: [if], data = [none] } else { bytesLength = Math.abs(DataDecoder.decodeInt(src, srcOffset + 1)); // depends on control dependency: [if], data = [none] headerSize = 5; // depends on control dependency: [if], data = [none] } bytes = new byte[bytesLength]; srcOffset += headerSize; for (int i=0; i<bytesLength; i++) { bytes[i] = (byte) ~src[srcOffset + i]; // depends on control dependency: [for], data = [i] } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } valueRef[0] = new BigInteger(bytes); return headerSize + bytesLength; } }
public class class_name { public java.util.List<String> getPipelineIds() { if (pipelineIds == null) { pipelineIds = new com.amazonaws.internal.SdkInternalList<String>(); } return pipelineIds; } }
public class class_name { public java.util.List<String> getPipelineIds() { if (pipelineIds == null) { pipelineIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return pipelineIds; } }
public class class_name { public void printData(PrintWriter pw) { long lmin = min.get(); if (lmin == Long.MAX_VALUE) { lmin = -1; } long lmax = max.get(); long ltotal = total.get(); long ltimes = times.get(); float favg = ltimes == 0 ? 0f : (float)ltotal / ltimes; pw.print(lmin); pw.print(','); pw.print(lmax); pw.print(','); pw.print(ltotal); pw.print(','); pw.print(favg); pw.print(','); pw.print(ltimes); } }
public class class_name { public void printData(PrintWriter pw) { long lmin = min.get(); if (lmin == Long.MAX_VALUE) { lmin = -1; // depends on control dependency: [if], data = [none] } long lmax = max.get(); long ltotal = total.get(); long ltimes = times.get(); float favg = ltimes == 0 ? 0f : (float)ltotal / ltimes; pw.print(lmin); pw.print(','); pw.print(lmax); pw.print(','); pw.print(ltotal); pw.print(','); pw.print(favg); pw.print(','); pw.print(ltimes); } }
public class class_name { public void flush() throws IOException { SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { synchronized (MultiIndex.this) { // commit volatile index executeAndLog(new Start(Action.INTERNAL_TRANSACTION)); commitVolatileIndex(); // commit persistent indexes for (int i = indexes.size() - 1; i >= 0; i--) { PersistentIndex index = indexes.get(i); // only commit indexes we own // index merger also places PersistentIndex instances in // indexes, // but does not make them public by registering the name in // indexNames if (indexNames.contains(index.getName())) { index.commit(); // check if index still contains documents if (index.getNumDocuments() == 0) { executeAndLog(new DeleteIndex(getTransactionId(), index.getName())); } } } executeAndLog(new Commit(getTransactionId())); indexNames.write(); // reset redo log redoLog.clear(); lastFlushTime = System.currentTimeMillis(); lastFileSystemFlushTime = System.currentTimeMillis(); } // delete obsolete indexes attemptDelete(); return null; } }); } }
public class class_name { public void flush() throws IOException { SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { synchronized (MultiIndex.this) { // commit volatile index executeAndLog(new Start(Action.INTERNAL_TRANSACTION)); commitVolatileIndex(); // commit persistent indexes for (int i = indexes.size() - 1; i >= 0; i--) { PersistentIndex index = indexes.get(i); // only commit indexes we own // index merger also places PersistentIndex instances in // indexes, // but does not make them public by registering the name in // indexNames if (indexNames.contains(index.getName())) { index.commit(); // depends on control dependency: [if], data = [none] // check if index still contains documents if (index.getNumDocuments() == 0) { executeAndLog(new DeleteIndex(getTransactionId(), index.getName())); // depends on control dependency: [if], data = [none] } } } executeAndLog(new Commit(getTransactionId())); indexNames.write(); // reset redo log redoLog.clear(); lastFlushTime = System.currentTimeMillis(); lastFileSystemFlushTime = System.currentTimeMillis(); } // delete obsolete indexes attemptDelete(); return null; } }); } }
public class class_name { public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; } } } this.errors.add(error); } }
public class class_name { public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; // depends on control dependency: [if], data = [none] } } } this.errors.add(error); } }
public class class_name { public static String wrapLinesByWords(String text, int maxLen) { StringBuffer buffer = new StringBuffer(); int lineLength = 0; for (String token : text.split(" ")) { if (lineLength + token.length() + 1 > maxLen) { buffer.append("\n"); lineLength = 0; } else if (lineLength > 0) { buffer.append(" "); lineLength++; } buffer.append(token); lineLength += token.length(); } text = buffer.toString(); return text; } }
public class class_name { public static String wrapLinesByWords(String text, int maxLen) { StringBuffer buffer = new StringBuffer(); int lineLength = 0; for (String token : text.split(" ")) { if (lineLength + token.length() + 1 > maxLen) { buffer.append("\n"); // depends on control dependency: [if], data = [none] lineLength = 0; // depends on control dependency: [if], data = [none] } else if (lineLength > 0) { buffer.append(" "); // depends on control dependency: [if], data = [none] lineLength++; // depends on control dependency: [if], data = [none] } buffer.append(token); // depends on control dependency: [for], data = [token] lineLength += token.length(); // depends on control dependency: [for], data = [token] } text = buffer.toString(); return text; } }
public class class_name { synchronized void addTrackerTaskFailure(String trackerName, TaskTracker taskTracker, String lastFailureReason) { if (flakyTaskTrackers < (clusterSize * CLUSTER_BLACKLIST_PERCENT)) { String trackerHostName = convertTrackerNameToHostName(trackerName); List<String> trackerFailures = trackerToFailuresMap.get(trackerHostName); if (trackerFailures == null) { trackerFailures = new LinkedList<String>(); trackerToFailuresMap.put(trackerHostName, trackerFailures); } trackerFailures.add(lastFailureReason); // Check if this tasktracker has turned 'flaky' if (trackerFailures.size() == maxTaskFailuresPerTracker) { ++flakyTaskTrackers; // Cancel reservations if appropriate if (taskTracker != null) { if (trackersReservedForMaps.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.MAP, this); } if (trackersReservedForReduces.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.REDUCE, this); } } LOG.info("TaskTracker at '" + trackerHostName + "' turned 'flaky'"); } } } }
public class class_name { synchronized void addTrackerTaskFailure(String trackerName, TaskTracker taskTracker, String lastFailureReason) { if (flakyTaskTrackers < (clusterSize * CLUSTER_BLACKLIST_PERCENT)) { String trackerHostName = convertTrackerNameToHostName(trackerName); List<String> trackerFailures = trackerToFailuresMap.get(trackerHostName); if (trackerFailures == null) { trackerFailures = new LinkedList<String>(); // depends on control dependency: [if], data = [none] trackerToFailuresMap.put(trackerHostName, trackerFailures); // depends on control dependency: [if], data = [none] } trackerFailures.add(lastFailureReason); // depends on control dependency: [if], data = [none] // Check if this tasktracker has turned 'flaky' if (trackerFailures.size() == maxTaskFailuresPerTracker) { ++flakyTaskTrackers; // depends on control dependency: [if], data = [none] // Cancel reservations if appropriate if (taskTracker != null) { if (trackersReservedForMaps.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.MAP, this); // depends on control dependency: [if], data = [none] } if (trackersReservedForReduces.containsKey(taskTracker)) { taskTracker.unreserveSlots(TaskType.REDUCE, this); // depends on control dependency: [if], data = [none] } } LOG.info("TaskTracker at '" + trackerHostName + "' turned 'flaky'"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void menuEditCopyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEditCopyActionPerformed final TabTitle title = this.getFocusedTab(); if (title != null && title.getProvider().doesSupportCutCopyPaste()) { title.getProvider().doCopy(); } updateMenuItemsForProvider(title == null ? null : title.getProvider()); } }
public class class_name { private void menuEditCopyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEditCopyActionPerformed final TabTitle title = this.getFocusedTab(); if (title != null && title.getProvider().doesSupportCutCopyPaste()) { title.getProvider().doCopy(); // depends on control dependency: [if], data = [none] } updateMenuItemsForProvider(title == null ? null : title.getProvider()); } }
public class class_name { private int _checkInlineLink (final MarkdownHCStack aOut, final String sIn, final int nStart, final EMarkToken eToken) { boolean bIsAbbrev = false; int nPos = nStart + (eToken == EMarkToken.LINK ? 1 : 2); final StringBuilder aTmp = new StringBuilder (); aTmp.setLength (0); nPos = MarkdownHelper.readMdLinkId (aTmp, sIn, nPos); if (nPos < nStart) return -1; final String sName = aTmp.toString (); String sLink = null; String sComment = null; final int nOldPos = nPos++; nPos = MarkdownHelper.skipSpaces (sIn, nPos); if (nPos < nStart) { final LinkRef aLR = m_aLinkRefs.get (sName.toLowerCase (Locale.US)); if (aLR == null) return -1; bIsAbbrev = aLR.isAbbrev (); sLink = aLR.getLink (); sComment = aLR.getTitle (); nPos = nOldPos; } else if (sIn.charAt (nPos) == '(') { nPos++; nPos = MarkdownHelper.skipSpaces (sIn, nPos); if (nPos < nStart) return -1; aTmp.setLength (0); final boolean bUseLt = sIn.charAt (nPos) == '<'; nPos = bUseLt ? MarkdownHelper.readUntil (aTmp, sIn, nPos + 1, '>') : MarkdownHelper.readMdLink (aTmp, sIn, nPos); if (nPos < nStart) return -1; if (bUseLt) nPos++; sLink = aTmp.toString (); if (sIn.charAt (nPos) == ' ') { nPos = MarkdownHelper.skipSpaces (sIn, nPos); if (nPos > nStart && sIn.charAt (nPos) == '"') { nPos++; aTmp.setLength (0); nPos = MarkdownHelper.readUntil (aTmp, sIn, nPos, '"'); if (nPos < nStart) return -1; sComment = aTmp.toString (); nPos++; nPos = MarkdownHelper.skipSpaces (sIn, nPos); if (nPos == -1) return -1; } } if (sIn.charAt (nPos) != ')') return -1; } else if (sIn.charAt (nPos) == '[') { nPos++; aTmp.setLength (0); nPos = MarkdownHelper.readRawUntil (aTmp, sIn, nPos, ']'); if (nPos < nStart) return -1; final String sID = aTmp.length () > 0 ? aTmp.toString () : sName; final LinkRef aLR = m_aLinkRefs.get (sID.toLowerCase (Locale.US)); if (aLR != null) { sLink = aLR.getLink (); sComment = aLR.getTitle (); } } else { final LinkRef aLR = m_aLinkRefs.get (sName.toLowerCase (Locale.US)); if (aLR == null) return -1; bIsAbbrev = aLR.isAbbrev (); sLink = aLR.getLink (); sComment = aLR.getTitle (); nPos = nOldPos; } if (sLink == null) return -1; if (eToken == EMarkToken.LINK) { if (bIsAbbrev && sComment != null) { if (!m_bUseExtensions) return -1; aOut.push (new HCAbbr ().setTitle (sComment)); _recursiveEmitLine (aOut, sName, 0, EMarkToken.NONE); aOut.pop (); } else { final HCA aLink = m_aConfig.getDecorator ().openLink (aOut); aLink.setHref (new SimpleURL (sLink)); if (sComment != null) aLink.setTitle (sComment); _recursiveEmitLine (aOut, sName, 0, EMarkToken.NONE); m_aConfig.getDecorator ().closeLink (aOut); } } else { final HCImg aImg = m_aConfig.getDecorator ().appendImage (aOut); aImg.setSrc (new SimpleURL (sLink)); aImg.setAlt (sName); if (sComment != null) aImg.setTitle (sComment); } return nPos; } }
public class class_name { private int _checkInlineLink (final MarkdownHCStack aOut, final String sIn, final int nStart, final EMarkToken eToken) { boolean bIsAbbrev = false; int nPos = nStart + (eToken == EMarkToken.LINK ? 1 : 2); final StringBuilder aTmp = new StringBuilder (); aTmp.setLength (0); nPos = MarkdownHelper.readMdLinkId (aTmp, sIn, nPos); if (nPos < nStart) return -1; final String sName = aTmp.toString (); String sLink = null; String sComment = null; final int nOldPos = nPos++; nPos = MarkdownHelper.skipSpaces (sIn, nPos); if (nPos < nStart) { final LinkRef aLR = m_aLinkRefs.get (sName.toLowerCase (Locale.US)); if (aLR == null) return -1; bIsAbbrev = aLR.isAbbrev (); // depends on control dependency: [if], data = [none] sLink = aLR.getLink (); // depends on control dependency: [if], data = [none] sComment = aLR.getTitle (); // depends on control dependency: [if], data = [none] nPos = nOldPos; // depends on control dependency: [if], data = [none] } else if (sIn.charAt (nPos) == '(') { nPos++; // depends on control dependency: [if], data = [none] nPos = MarkdownHelper.skipSpaces (sIn, nPos); // depends on control dependency: [if], data = [none] if (nPos < nStart) return -1; aTmp.setLength (0); // depends on control dependency: [if], data = [none] final boolean bUseLt = sIn.charAt (nPos) == '<'; nPos = bUseLt ? MarkdownHelper.readUntil (aTmp, sIn, nPos + 1, '>') : MarkdownHelper.readMdLink (aTmp, sIn, nPos); // depends on control dependency: [if], data = [none] if (nPos < nStart) return -1; if (bUseLt) nPos++; sLink = aTmp.toString (); // depends on control dependency: [if], data = [none] if (sIn.charAt (nPos) == ' ') { nPos = MarkdownHelper.skipSpaces (sIn, nPos); // depends on control dependency: [if], data = [none] if (nPos > nStart && sIn.charAt (nPos) == '"') { nPos++; // depends on control dependency: [if], data = [none] aTmp.setLength (0); // depends on control dependency: [if], data = [none] nPos = MarkdownHelper.readUntil (aTmp, sIn, nPos, '"'); // depends on control dependency: [if], data = ['"')] if (nPos < nStart) return -1; sComment = aTmp.toString (); // depends on control dependency: [if], data = [none] nPos++; // depends on control dependency: [if], data = [none] nPos = MarkdownHelper.skipSpaces (sIn, nPos); // depends on control dependency: [if], data = [none] if (nPos == -1) return -1; } } if (sIn.charAt (nPos) != ')') return -1; } else if (sIn.charAt (nPos) == '[') { nPos++; // depends on control dependency: [if], data = [none] aTmp.setLength (0); // depends on control dependency: [if], data = [none] nPos = MarkdownHelper.readRawUntil (aTmp, sIn, nPos, ']'); // depends on control dependency: [if], data = [none] if (nPos < nStart) return -1; final String sID = aTmp.length () > 0 ? aTmp.toString () : sName; final LinkRef aLR = m_aLinkRefs.get (sID.toLowerCase (Locale.US)); if (aLR != null) { sLink = aLR.getLink (); // depends on control dependency: [if], data = [none] sComment = aLR.getTitle (); // depends on control dependency: [if], data = [none] } } else { final LinkRef aLR = m_aLinkRefs.get (sName.toLowerCase (Locale.US)); if (aLR == null) return -1; bIsAbbrev = aLR.isAbbrev (); // depends on control dependency: [if], data = [none] sLink = aLR.getLink (); // depends on control dependency: [if], data = [none] sComment = aLR.getTitle (); // depends on control dependency: [if], data = [none] nPos = nOldPos; // depends on control dependency: [if], data = [none] } if (sLink == null) return -1; if (eToken == EMarkToken.LINK) { if (bIsAbbrev && sComment != null) { if (!m_bUseExtensions) return -1; aOut.push (new HCAbbr ().setTitle (sComment)); // depends on control dependency: [if], data = [none] _recursiveEmitLine (aOut, sName, 0, EMarkToken.NONE); // depends on control dependency: [if], data = [none] aOut.pop (); // depends on control dependency: [if], data = [none] } else { final HCA aLink = m_aConfig.getDecorator ().openLink (aOut); aLink.setHref (new SimpleURL (sLink)); // depends on control dependency: [if], data = [none] if (sComment != null) aLink.setTitle (sComment); _recursiveEmitLine (aOut, sName, 0, EMarkToken.NONE); // depends on control dependency: [if], data = [none] m_aConfig.getDecorator ().closeLink (aOut); // depends on control dependency: [if], data = [none] } } else { final HCImg aImg = m_aConfig.getDecorator ().appendImage (aOut); aImg.setSrc (new SimpleURL (sLink)); // depends on control dependency: [if], data = [none] aImg.setAlt (sName); // depends on control dependency: [if], data = [none] if (sComment != null) aImg.setTitle (sComment); } return nPos; } }
public class class_name { public void close() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "close"); // begin F177053 ChannelFramework framework = ChannelFrameworkFactory.getChannelFramework(); // F196678.10 try { framework.stopChain(chainInbound, CHAIN_STOP_TIME); } catch (ChainException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_01, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } catch (ChannelException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_02, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } // end F177053 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "close"); } }
public class class_name { public void close() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "close"); // begin F177053 ChannelFramework framework = ChannelFrameworkFactory.getChannelFramework(); // F196678.10 try { framework.stopChain(chainInbound, CHAIN_STOP_TIME); // depends on control dependency: [try], data = [none] } catch (ChainException e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_01, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } catch (ChannelException e) { // depends on control dependency: [catch], data = [none] FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.ListenerPortImpl.close", JFapChannelConstants.LISTENERPORTIMPL_CLOSE_02, new Object[] { framework, chainInbound }); // D232185 if (tc.isEventEnabled()) SibTr.exception(this, tc, e); } // depends on control dependency: [catch], data = [none] // end F177053 if (tc.isEntryEnabled()) SibTr.exit(this, tc, "close"); } }
public class class_name { public static BufferedImage colorizeGradient(ImageGray derivX, ImageGray derivY, double maxAbsValue, BufferedImage output){ if( derivX instanceof GrayS16) { return colorizeGradient((GrayS16)derivX,(GrayS16)derivY,(int)maxAbsValue, output); } else if( derivX instanceof GrayF32) { return colorizeGradient((GrayF32)derivX,(GrayF32)derivY,(float)maxAbsValue, output); } else { throw new IllegalArgumentException("Image type not supported"); } } }
public class class_name { public static BufferedImage colorizeGradient(ImageGray derivX, ImageGray derivY, double maxAbsValue, BufferedImage output){ if( derivX instanceof GrayS16) { return colorizeGradient((GrayS16)derivX,(GrayS16)derivY,(int)maxAbsValue, output); // depends on control dependency: [if], data = [none] } else if( derivX instanceof GrayF32) { return colorizeGradient((GrayF32)derivX,(GrayF32)derivY,(float)maxAbsValue, output); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Image type not supported"); } } }
public class class_name { private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) { Configuration configuration = m_writer.configuration; Utils utils = configuration.utils; if (isTypeLink) { return configuration.getText("doclet.Href_Type_Param_Title", classDoc.name()); } else if (classDoc.isInterface()){ return configuration.getText("doclet.Href_Interface_Title", utils.getPackageName(classDoc.containingPackage())); } else if (classDoc.isAnnotationType()) { return configuration.getText("doclet.Href_Annotation_Title", utils.getPackageName(classDoc.containingPackage())); } else if (classDoc.isEnum()) { return configuration.getText("doclet.Href_Enum_Title", utils.getPackageName(classDoc.containingPackage())); } else { return configuration.getText("doclet.Href_Class_Title", utils.getPackageName(classDoc.containingPackage())); } } }
public class class_name { private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) { Configuration configuration = m_writer.configuration; Utils utils = configuration.utils; if (isTypeLink) { return configuration.getText("doclet.Href_Type_Param_Title", classDoc.name()); // depends on control dependency: [if], data = [none] } else if (classDoc.isInterface()){ return configuration.getText("doclet.Href_Interface_Title", utils.getPackageName(classDoc.containingPackage())); // depends on control dependency: [if], data = [none] } else if (classDoc.isAnnotationType()) { return configuration.getText("doclet.Href_Annotation_Title", utils.getPackageName(classDoc.containingPackage())); // depends on control dependency: [if], data = [none] } else if (classDoc.isEnum()) { return configuration.getText("doclet.Href_Enum_Title", utils.getPackageName(classDoc.containingPackage())); // depends on control dependency: [if], data = [none] } else { return configuration.getText("doclet.Href_Class_Title", utils.getPackageName(classDoc.containingPackage())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public AdminUpdateUserAttributesRequest withUserAttributes(AttributeType... userAttributes) { if (this.userAttributes == null) { setUserAttributes(new java.util.ArrayList<AttributeType>(userAttributes.length)); } for (AttributeType ele : userAttributes) { this.userAttributes.add(ele); } return this; } }
public class class_name { public AdminUpdateUserAttributesRequest withUserAttributes(AttributeType... userAttributes) { if (this.userAttributes == null) { setUserAttributes(new java.util.ArrayList<AttributeType>(userAttributes.length)); // depends on control dependency: [if], data = [none] } for (AttributeType ele : userAttributes) { this.userAttributes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Deprecated public void pushError(final String errorMessage, final int errorCode) { CleverTapAPI cleverTapAPI = weakReference.get(); if(cleverTapAPI == null){ Logger.d("CleverTap Instance is null."); } else { cleverTapAPI.pushError(errorMessage, errorCode); } } }
public class class_name { @Deprecated public void pushError(final String errorMessage, final int errorCode) { CleverTapAPI cleverTapAPI = weakReference.get(); if(cleverTapAPI == null){ Logger.d("CleverTap Instance is null."); // depends on control dependency: [if], data = [none] } else { cleverTapAPI.pushError(errorMessage, errorCode); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte[] generateTarGz(File sourceDirectory, String pathPrefix, File chaincodeMetaInf) throws IOException { logger.trace(format("generateTarGz: sourceDirectory: %s, pathPrefix: %s, chaincodeMetaInf: %s", sourceDirectory == null ? "null" : sourceDirectory.getAbsolutePath(), pathPrefix, chaincodeMetaInf == null ? "null" : chaincodeMetaInf.getAbsolutePath())); ByteArrayOutputStream bos = new ByteArrayOutputStream(500000); String sourcePath = sourceDirectory.getAbsolutePath(); TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new GzipCompressorOutputStream(bos)); archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); try { Collection<File> childrenFiles = org.apache.commons.io.FileUtils.listFiles(sourceDirectory, null, true); ArchiveEntry archiveEntry; FileInputStream fileInputStream; for (File childFile : childrenFiles) { String childPath = childFile.getAbsolutePath(); String relativePath = childPath.substring((sourcePath.length() + 1), childPath.length()); if (pathPrefix != null) { relativePath = Utils.combinePaths(pathPrefix, relativePath); } relativePath = FilenameUtils.separatorsToUnix(relativePath); if (TRACE_ENABED) { logger.trace(format("generateTarGz: Adding '%s' entry from source '%s' to archive.", relativePath, childFile.getAbsolutePath())); } archiveEntry = new TarArchiveEntry(childFile, relativePath); fileInputStream = new FileInputStream(childFile); archiveOutputStream.putArchiveEntry(archiveEntry); try { IOUtils.copy(fileInputStream, archiveOutputStream); } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } if (null != chaincodeMetaInf) { childrenFiles = org.apache.commons.io.FileUtils.listFiles(chaincodeMetaInf, null, true); final URI metabase = chaincodeMetaInf.toURI(); for (File childFile : childrenFiles) { final String relativePath = Paths.get("META-INF", metabase.relativize(childFile.toURI()).getPath()).toString(); if (TRACE_ENABED) { logger.trace(format("generateTarGz: Adding '%s' entry from source '%s' to archive.", relativePath, childFile.getAbsolutePath())); } archiveEntry = new TarArchiveEntry(childFile, relativePath); fileInputStream = new FileInputStream(childFile); archiveOutputStream.putArchiveEntry(archiveEntry); try { IOUtils.copy(fileInputStream, archiveOutputStream); } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } } } finally { IOUtils.closeQuietly(archiveOutputStream); } return bos.toByteArray(); } }
public class class_name { public static byte[] generateTarGz(File sourceDirectory, String pathPrefix, File chaincodeMetaInf) throws IOException { logger.trace(format("generateTarGz: sourceDirectory: %s, pathPrefix: %s, chaincodeMetaInf: %s", sourceDirectory == null ? "null" : sourceDirectory.getAbsolutePath(), pathPrefix, chaincodeMetaInf == null ? "null" : chaincodeMetaInf.getAbsolutePath())); ByteArrayOutputStream bos = new ByteArrayOutputStream(500000); String sourcePath = sourceDirectory.getAbsolutePath(); TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new GzipCompressorOutputStream(bos)); archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); try { Collection<File> childrenFiles = org.apache.commons.io.FileUtils.listFiles(sourceDirectory, null, true); ArchiveEntry archiveEntry; FileInputStream fileInputStream; for (File childFile : childrenFiles) { String childPath = childFile.getAbsolutePath(); String relativePath = childPath.substring((sourcePath.length() + 1), childPath.length()); if (pathPrefix != null) { relativePath = Utils.combinePaths(pathPrefix, relativePath); // depends on control dependency: [if], data = [(pathPrefix] } relativePath = FilenameUtils.separatorsToUnix(relativePath); // depends on control dependency: [for], data = [none] if (TRACE_ENABED) { logger.trace(format("generateTarGz: Adding '%s' entry from source '%s' to archive.", relativePath, childFile.getAbsolutePath())); // depends on control dependency: [if], data = [none] } archiveEntry = new TarArchiveEntry(childFile, relativePath); // depends on control dependency: [for], data = [childFile] fileInputStream = new FileInputStream(childFile); // depends on control dependency: [for], data = [childFile] archiveOutputStream.putArchiveEntry(archiveEntry); // depends on control dependency: [for], data = [none] try { IOUtils.copy(fileInputStream, archiveOutputStream); // depends on control dependency: [try], data = [none] } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } if (null != chaincodeMetaInf) { childrenFiles = org.apache.commons.io.FileUtils.listFiles(chaincodeMetaInf, null, true); // depends on control dependency: [if], data = [none] final URI metabase = chaincodeMetaInf.toURI(); for (File childFile : childrenFiles) { final String relativePath = Paths.get("META-INF", metabase.relativize(childFile.toURI()).getPath()).toString(); if (TRACE_ENABED) { logger.trace(format("generateTarGz: Adding '%s' entry from source '%s' to archive.", relativePath, childFile.getAbsolutePath())); // depends on control dependency: [if], data = [none] } archiveEntry = new TarArchiveEntry(childFile, relativePath); // depends on control dependency: [for], data = [childFile] fileInputStream = new FileInputStream(childFile); // depends on control dependency: [for], data = [childFile] archiveOutputStream.putArchiveEntry(archiveEntry); // depends on control dependency: [for], data = [none] try { IOUtils.copy(fileInputStream, archiveOutputStream); // depends on control dependency: [try], data = [none] } finally { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } } } } finally { IOUtils.closeQuietly(archiveOutputStream); } return bos.toByteArray(); } }
public class class_name { private boolean replaceFilePathsWithBytes(ModelNode request) throws CommandFormatException, IOException { boolean didReplacement = false; ModelNode opDesc = new ModelNode(); opDesc.get("address").set(request.get("address")); opDesc.get("operation").set("read-operation-description"); final String opName = request.get("operation").asString(); opDesc.get("name").set(opName); ModelNode response = execute(opDesc, false).getResponseNode(); if (response.hasDefined("result", "request-properties")) { final ModelNode requestProps = response.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES && request.hasDefined(prop.getName())) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); if (!localFile.exists()) continue; try { request.get(prop.getName()).set(Util.readBytes(localFile)); didReplacement = true; } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } } return didReplacement; } }
public class class_name { private boolean replaceFilePathsWithBytes(ModelNode request) throws CommandFormatException, IOException { boolean didReplacement = false; ModelNode opDesc = new ModelNode(); opDesc.get("address").set(request.get("address")); opDesc.get("operation").set("read-operation-description"); final String opName = request.get("operation").asString(); opDesc.get("name").set(opName); ModelNode response = execute(opDesc, false).getResponseNode(); if (response.hasDefined("result", "request-properties")) { final ModelNode requestProps = response.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES && request.hasDefined(prop.getName())) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); if (!localFile.exists()) continue; try { request.get(prop.getName()).set(Util.readBytes(localFile)); // depends on control dependency: [try], data = [none] didReplacement = true; // depends on control dependency: [try], data = [none] } catch (OperationFormatException e) { throw new CommandFormatException(e); } // depends on control dependency: [catch], data = [none] } } } return didReplacement; } }
public class class_name { public List<Item> intercept(List<Model> models) { List<Item> items = new ArrayList<>(models.size()); Item item; for (Model model : models) { item = intercept(model); if (item == null) continue; items.add(item); } return items; } }
public class class_name { public List<Item> intercept(List<Model> models) { List<Item> items = new ArrayList<>(models.size()); Item item; for (Model model : models) { item = intercept(model); // depends on control dependency: [for], data = [model] if (item == null) continue; items.add(item); // depends on control dependency: [for], data = [none] } return items; } }
public class class_name { public synchronized boolean reread(ReadMode readMode, boolean isStartup) { readNow = System.currentTimeMillis(); logCatalogInit.info("=========================================================================================\n"+ "ConfigCatalogInitialization readMode={} isStartup={}", readMode, isStartup); catPathMap = new HashSet<>(); fcNameMap = new HashMap<>(); if (ccc != null) ccc.invalidateAll(); // remove anything in cache if (fcCache != null) fcCache.invalidateAll(); // remove anything in cache if (!isStartup && readMode == ReadMode.always) trackerNumber++; // must write a new database if TDS is already running and rereading all if (!isDebugMode || this.datasetTracker == null) this.datasetTracker = new DatasetTrackerChronicle(trackerDir, maxDatasets, trackerNumber); boolean databaseAlreadyExists = datasetTracker.exists(); // detect if tracker database exists if (!databaseAlreadyExists) { readMode = ReadMode.always; logCatalogInit.info("ConfigCatalogInitializion datasetTracker database does not exist, set readMode to=" + readMode); } if (this.callback == null) this.callback = new StatCallback(readMode); // going to reread global services allowedServices.clearGlobalServices(); switch (readMode) { case always: // if the database already exists, we need to close it // before we reinit if (databaseAlreadyExists) { logCatalogInit.info("ConfigCatalogInitializion datasetTracker database already exists - closing it before reinitialization."); try { this.datasetTracker.close(); } catch (IOException e) { logCatalogInit.error("There was an error closing the datasetTracker database.", e); } this.datasetTracker.reinit(); } this.catalogTracker = new CatalogTracker(trackerDir, true, numberCatalogs, nextCatId); this.dataRootTracker = new DataRootTracker(trackerDir, true, callback); this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); // starting over readRootCatalogs(readMode); break; case check: this.catalogTracker = new CatalogTracker(trackerDir, false, numberCatalogs, nextCatId); // use existing catalog list this.dataRootTracker = new DataRootTracker(trackerDir, false, callback); // use existing data roots this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); readRootCatalogs(readMode); // read just roots to get global services checkExistingCatalogs(readMode); break; case triggerOnly: this.catalogTracker = new CatalogTracker(trackerDir, false, numberCatalogs, nextCatId); // use existing catalog list this.dataRootTracker = new DataRootTracker(trackerDir, false, callback); // use existing data roots this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); readRootCatalogs(readMode); // read just roots to get global services break; } numberCatalogs = catalogTracker.size(); nextCatId = catalogTracker.getNextCatId(); if (prefs != null) { prefs.putLong("trackerNumber", trackerNumber); prefs.putLong("nextCatId", nextCatId); prefs.putInt("numberCatalogs", numberCatalogs); } callback.finish(); logCatalogInit.info("\nConfigCatalogInitializion stats\n" + callback); try { datasetTracker.save(); catalogTracker.save(); dataRootTracker.save(); } catch (IOException e) { // e.printStackTrace(); logCatalogInit.error("datasetTracker.save() failed", e); } // heres where we may be doing a switcheroo in a running TDS if (dataRootManager != null) dataRootManager.setDataRootPathMatcher(dataRootPathMatcher); if (datasetManager != null) datasetManager.setDatasetTracker(datasetTracker); // cleanup old version of the database if (!isStartup && readMode == ReadMode.always) { DatasetTrackerChronicle.cleanupBefore(trackerDir, trackerNumber); } long took = System.currentTimeMillis() - readNow; logCatalogInit.info("ConfigCatalogInitializion finished took={} msecs", took); // cleanup catPathMap = null; fcNameMap = null; catalogTracker = null; return true; // ok } }
public class class_name { public synchronized boolean reread(ReadMode readMode, boolean isStartup) { readNow = System.currentTimeMillis(); logCatalogInit.info("=========================================================================================\n"+ "ConfigCatalogInitialization readMode={} isStartup={}", readMode, isStartup); catPathMap = new HashSet<>(); fcNameMap = new HashMap<>(); if (ccc != null) ccc.invalidateAll(); // remove anything in cache if (fcCache != null) fcCache.invalidateAll(); // remove anything in cache if (!isStartup && readMode == ReadMode.always) trackerNumber++; // must write a new database if TDS is already running and rereading all if (!isDebugMode || this.datasetTracker == null) this.datasetTracker = new DatasetTrackerChronicle(trackerDir, maxDatasets, trackerNumber); boolean databaseAlreadyExists = datasetTracker.exists(); // detect if tracker database exists if (!databaseAlreadyExists) { readMode = ReadMode.always; // depends on control dependency: [if], data = [none] logCatalogInit.info("ConfigCatalogInitializion datasetTracker database does not exist, set readMode to=" + readMode); // depends on control dependency: [if], data = [none] } if (this.callback == null) this.callback = new StatCallback(readMode); // going to reread global services allowedServices.clearGlobalServices(); switch (readMode) { case always: // if the database already exists, we need to close it // before we reinit if (databaseAlreadyExists) { logCatalogInit.info("ConfigCatalogInitializion datasetTracker database already exists - closing it before reinitialization."); // depends on control dependency: [if], data = [none] try { this.datasetTracker.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logCatalogInit.error("There was an error closing the datasetTracker database.", e); } // depends on control dependency: [catch], data = [none] this.datasetTracker.reinit(); // depends on control dependency: [if], data = [none] } this.catalogTracker = new CatalogTracker(trackerDir, true, numberCatalogs, nextCatId); this.dataRootTracker = new DataRootTracker(trackerDir, true, callback); this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); // starting over readRootCatalogs(readMode); break; case check: this.catalogTracker = new CatalogTracker(trackerDir, false, numberCatalogs, nextCatId); // use existing catalog list this.dataRootTracker = new DataRootTracker(trackerDir, false, callback); // use existing data roots this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); readRootCatalogs(readMode); // read just roots to get global services checkExistingCatalogs(readMode); break; case triggerOnly: this.catalogTracker = new CatalogTracker(trackerDir, false, numberCatalogs, nextCatId); // use existing catalog list this.dataRootTracker = new DataRootTracker(trackerDir, false, callback); // use existing data roots this.dataRootPathMatcher = new DataRootPathMatcher(ccc, dataRootTracker); readRootCatalogs(readMode); // read just roots to get global services break; } numberCatalogs = catalogTracker.size(); nextCatId = catalogTracker.getNextCatId(); if (prefs != null) { prefs.putLong("trackerNumber", trackerNumber); // depends on control dependency: [if], data = [none] prefs.putLong("nextCatId", nextCatId); // depends on control dependency: [if], data = [none] prefs.putInt("numberCatalogs", numberCatalogs); // depends on control dependency: [if], data = [none] } callback.finish(); logCatalogInit.info("\nConfigCatalogInitializion stats\n" + callback); try { datasetTracker.save(); // depends on control dependency: [try], data = [none] catalogTracker.save(); // depends on control dependency: [try], data = [none] dataRootTracker.save(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // e.printStackTrace(); logCatalogInit.error("datasetTracker.save() failed", e); } // depends on control dependency: [catch], data = [none] // heres where we may be doing a switcheroo in a running TDS if (dataRootManager != null) dataRootManager.setDataRootPathMatcher(dataRootPathMatcher); if (datasetManager != null) datasetManager.setDatasetTracker(datasetTracker); // cleanup old version of the database if (!isStartup && readMode == ReadMode.always) { DatasetTrackerChronicle.cleanupBefore(trackerDir, trackerNumber); // depends on control dependency: [if], data = [none] } long took = System.currentTimeMillis() - readNow; logCatalogInit.info("ConfigCatalogInitializion finished took={} msecs", took); // cleanup catPathMap = null; fcNameMap = null; catalogTracker = null; return true; // ok } }
public class class_name { public void activate() { if (appender instanceof OptionHandler) { ((OptionHandler) appender).activateOptions(); if (LoggingLogger.ROOT_LOGGER.isDebugEnabled()) { LoggingLogger.ROOT_LOGGER.debugf("Invoking OptionHandler.activateOptions() on appender %s (%s)", appender.getName(), appender.getClass().getCanonicalName()); } } } }
public class class_name { public void activate() { if (appender instanceof OptionHandler) { ((OptionHandler) appender).activateOptions(); // depends on control dependency: [if], data = [none] if (LoggingLogger.ROOT_LOGGER.isDebugEnabled()) { LoggingLogger.ROOT_LOGGER.debugf("Invoking OptionHandler.activateOptions() on appender %s (%s)", appender.getName(), appender.getClass().getCanonicalName()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Jedis getResource(int DBIndex) { try { if (this.jedisPool == null) throw new NullPointerException(this.name + ", Jedis Pool 未初始化"); Jedis jedis = this.jedisPool.getResource(); jedis.select(DBIndex); return jedis; } catch (JedisConnectionException e) { LOG.error(this.name + ", Jedis Pool 连接出现异常", e); throw e; } catch (JedisException e) { LOG.error(this.name + ", Jedis Pool 出现异常", e); throw e; } catch (Exception e) { LOG.error(this.name + ", Jedis Pool 获取连接, 暂时无法识别异常", e); throw e; } } }
public class class_name { public Jedis getResource(int DBIndex) { try { if (this.jedisPool == null) throw new NullPointerException(this.name + ", Jedis Pool 未初始化"); Jedis jedis = this.jedisPool.getResource(); jedis.select(DBIndex); // depends on control dependency: [try], data = [none] return jedis; // depends on control dependency: [try], data = [none] } catch (JedisConnectionException e) { LOG.error(this.name + ", Jedis Pool 连接出现异常", e); throw e; } catch (JedisException e) { // depends on control dependency: [catch], data = [none] LOG.error(this.name + ", Jedis Pool 出现异常", e); throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] LOG.error(this.name + ", Jedis Pool 获取连接, 暂时无法识别异常", e); throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void submitSegmentIndexBuffer() { if(_sibEnabled && !_sib.isDirty()) { _sib.setSegmentId(_segment.getSegmentId()); _sib.setSegmentLastForcedTime(_segment.getLastForcedTime()); _segmentManager.submit(_sib); } else { _segmentManager.remove(_sib); } } }
public class class_name { protected void submitSegmentIndexBuffer() { if(_sibEnabled && !_sib.isDirty()) { _sib.setSegmentId(_segment.getSegmentId()); // depends on control dependency: [if], data = [none] _sib.setSegmentLastForcedTime(_segment.getLastForcedTime()); // depends on control dependency: [if], data = [none] _segmentManager.submit(_sib); // depends on control dependency: [if], data = [none] } else { _segmentManager.remove(_sib); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Element getElementWithCanonicalName(String canonicalName) { if (canonicalName == null || canonicalName.trim().length() == 0) { throw new IllegalArgumentException("A canonical name must be specified."); } // canonical names start with a leading slash, so add this if it's missing if (!canonicalName.startsWith("/")) { canonicalName = "/" + canonicalName; } for (Element element : getElements()) { if (element.getCanonicalName().equals(canonicalName)) { return element; } } return null; } }
public class class_name { public Element getElementWithCanonicalName(String canonicalName) { if (canonicalName == null || canonicalName.trim().length() == 0) { throw new IllegalArgumentException("A canonical name must be specified."); } // canonical names start with a leading slash, so add this if it's missing if (!canonicalName.startsWith("/")) { canonicalName = "/" + canonicalName; // depends on control dependency: [if], data = [none] } for (Element element : getElements()) { if (element.getCanonicalName().equals(canonicalName)) { return element; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @SuppressWarnings("fallthrough") public static ZoneOffset of(String offsetId) { Objects.requireNonNull(offsetId, "offsetId"); // "Z" is always in the cache ZoneOffset offset = ID_CACHE.get(offsetId); if (offset != null) { return offset; } // parse - +h, +hh, +hhmm, +hh:mm, +hhmmss, +hh:mm:ss final int hours, minutes, seconds; switch (offsetId.length()) { case 2: offsetId = offsetId.charAt(0) + "0" + offsetId.charAt(1); // fallthru case 3: hours = parseNumber(offsetId, 1, false); minutes = 0; seconds = 0; break; case 5: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 3, false); seconds = 0; break; case 6: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 4, true); seconds = 0; break; case 7: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 3, false); seconds = parseNumber(offsetId, 5, false); break; case 9: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 4, true); seconds = parseNumber(offsetId, 7, true); break; default: throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId); } char first = offsetId.charAt(0); if (first != '+' && first != '-') { throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId); } if (first == '-') { return ofHoursMinutesSeconds(-hours, -minutes, -seconds); } else { return ofHoursMinutesSeconds(hours, minutes, seconds); } } }
public class class_name { @SuppressWarnings("fallthrough") public static ZoneOffset of(String offsetId) { Objects.requireNonNull(offsetId, "offsetId"); // "Z" is always in the cache ZoneOffset offset = ID_CACHE.get(offsetId); if (offset != null) { return offset; // depends on control dependency: [if], data = [none] } // parse - +h, +hh, +hhmm, +hh:mm, +hhmmss, +hh:mm:ss final int hours, minutes, seconds; switch (offsetId.length()) { case 2: offsetId = offsetId.charAt(0) + "0" + offsetId.charAt(1); // fallthru case 3: hours = parseNumber(offsetId, 1, false); minutes = 0; seconds = 0; break; case 5: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 3, false); seconds = 0; break; case 6: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 4, true); seconds = 0; break; case 7: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 3, false); seconds = parseNumber(offsetId, 5, false); break; case 9: hours = parseNumber(offsetId, 1, false); minutes = parseNumber(offsetId, 4, true); seconds = parseNumber(offsetId, 7, true); break; default: throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId); } char first = offsetId.charAt(0); if (first != '+' && first != '-') { throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId); } if (first == '-') { return ofHoursMinutesSeconds(-hours, -minutes, -seconds); } else { return ofHoursMinutesSeconds(hours, minutes, seconds); } } }
public class class_name { public void copyContent(final CharSequence buf, final ParserCursor cursor, final BitSet delimiters, final StringBuilder dst) { Args.notNull(buf, "Char sequence"); Args.notNull(cursor, "Parser cursor"); Args.notNull(dst, "String builder"); int pos = cursor.getPos(); final int indexFrom = cursor.getPos(); final int indexTo = cursor.getUpperBound(); for (int i = indexFrom; i < indexTo; i++) { final char current = buf.charAt(i); if ((delimiters != null && delimiters.get(current)) || isWhitespace(current)) { break; } pos++; dst.append(current); } cursor.updatePos(pos); } }
public class class_name { public void copyContent(final CharSequence buf, final ParserCursor cursor, final BitSet delimiters, final StringBuilder dst) { Args.notNull(buf, "Char sequence"); Args.notNull(cursor, "Parser cursor"); Args.notNull(dst, "String builder"); int pos = cursor.getPos(); final int indexFrom = cursor.getPos(); final int indexTo = cursor.getUpperBound(); for (int i = indexFrom; i < indexTo; i++) { final char current = buf.charAt(i); if ((delimiters != null && delimiters.get(current)) || isWhitespace(current)) { break; } pos++; // depends on control dependency: [for], data = [none] dst.append(current); // depends on control dependency: [for], data = [none] } cursor.updatePos(pos); } }
public class class_name { public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } return this; } }
public class class_name { public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); // depends on control dependency: [try], data = [none] } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { public final Status evaluate(final Metric metric) { if (okThresholdList.isEmpty() && warningThresholdList.isEmpty() && criticalThresholdList.isEmpty()) { return Status.OK; } // Perform evaluation escalation for (Range range : okThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.OK; } } for (Range range : criticalThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.CRITICAL; } } for (Range range : warningThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.WARNING; } } if (!okThresholdList.isEmpty()) { return Status.CRITICAL; } return Status.OK; } }
public class class_name { public final Status evaluate(final Metric metric) { if (okThresholdList.isEmpty() && warningThresholdList.isEmpty() && criticalThresholdList.isEmpty()) { return Status.OK; // depends on control dependency: [if], data = [none] } // Perform evaluation escalation for (Range range : okThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.OK; // depends on control dependency: [if], data = [none] } } for (Range range : criticalThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.CRITICAL; // depends on control dependency: [if], data = [none] } } for (Range range : warningThresholdList) { if (range.isValueInside(metric, prefix)) { return Status.WARNING; // depends on control dependency: [if], data = [none] } } if (!okThresholdList.isEmpty()) { return Status.CRITICAL; // depends on control dependency: [if], data = [none] } return Status.OK; } }
public class class_name { public Observable<ServiceResponse<EventSubscriptionInner>> beginUpdateWithServiceResponseAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (eventSubscriptionName == null) { throw new IllegalArgumentException("Parameter eventSubscriptionName is required and cannot be null."); } if (eventSubscriptionUpdateParameters == null) { throw new IllegalArgumentException("Parameter eventSubscriptionUpdateParameters is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(eventSubscriptionUpdateParameters); return service.beginUpdate(scope, eventSubscriptionName, eventSubscriptionUpdateParameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventSubscriptionInner>>>() { @Override public Observable<ServiceResponse<EventSubscriptionInner>> call(Response<ResponseBody> response) { try { ServiceResponse<EventSubscriptionInner> clientResponse = beginUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<EventSubscriptionInner>> beginUpdateWithServiceResponseAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (eventSubscriptionName == null) { throw new IllegalArgumentException("Parameter eventSubscriptionName is required and cannot be null."); } if (eventSubscriptionUpdateParameters == null) { throw new IllegalArgumentException("Parameter eventSubscriptionUpdateParameters is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(eventSubscriptionUpdateParameters); return service.beginUpdate(scope, eventSubscriptionName, eventSubscriptionUpdateParameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventSubscriptionInner>>>() { @Override public Observable<ServiceResponse<EventSubscriptionInner>> call(Response<ResponseBody> response) { try { ServiceResponse<EventSubscriptionInner> clientResponse = beginUpdateDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static MemberSummaryBuilder getInstance( AnnotationTypeWriter annotationTypeWriter, Context context) { MemberSummaryBuilder builder = new MemberSummaryBuilder(context, annotationTypeWriter.getAnnotationTypeElement()); WriterFactory wf = context.configuration.getWriterFactory(); for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) { MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers() ? null : wf.getMemberSummaryWriter(annotationTypeWriter, kind); builder.memberSummaryWriters.put(kind, msw); } return builder; } }
public class class_name { public static MemberSummaryBuilder getInstance( AnnotationTypeWriter annotationTypeWriter, Context context) { MemberSummaryBuilder builder = new MemberSummaryBuilder(context, annotationTypeWriter.getAnnotationTypeElement()); WriterFactory wf = context.configuration.getWriterFactory(); for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) { MemberSummaryWriter msw = builder.getVisibleMemberMap(kind).noVisibleMembers() ? null : wf.getMemberSummaryWriter(annotationTypeWriter, kind); builder.memberSummaryWriters.put(kind, msw); // depends on control dependency: [for], data = [kind] } return builder; } }
public class class_name { public void marshall(LifecyclePolicy lifecyclePolicy, ProtocolMarshaller protocolMarshaller) { if (lifecyclePolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lifecyclePolicy.getTransitionToIA(), TRANSITIONTOIA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(LifecyclePolicy lifecyclePolicy, ProtocolMarshaller protocolMarshaller) { if (lifecyclePolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lifecyclePolicy.getTransitionToIA(), TRANSITIONTOIA_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 Calendar adjustDayInMonthIfNeeded(Calendar calendar) { int day = calendar.get(Calendar.DAY_OF_MONTH); int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > daysInMonth) { calendar.set(Calendar.DAY_OF_MONTH, daysInMonth); } return mDateRangeLimiter.setToNearestDate(calendar); } }
public class class_name { private Calendar adjustDayInMonthIfNeeded(Calendar calendar) { int day = calendar.get(Calendar.DAY_OF_MONTH); int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > daysInMonth) { calendar.set(Calendar.DAY_OF_MONTH, daysInMonth); // depends on control dependency: [if], data = [daysInMonth)] } return mDateRangeLimiter.setToNearestDate(calendar); } }
public class class_name { public Mutations<S> combineWith(final Mutations<S> other) { IntArrayList result = new IntArrayList(mutations.length + other.mutations.length); //mut2 pointer int p2 = 0, position0 = 0, delta = 0; for (int p1 = 0; p1 < mutations.length; ++p1) { position0 = getPosition(mutations[p1]); while (p2 < other.mutations.length && // There are mutations in m2 (getPosition(other.mutations[p2]) < position0 + delta || // Before current point (getPosition(other.mutations[p2]) == position0 + delta && // On the current point and it is insertion getRawTypeCode(other.mutations[p2]) == RAW_MUTATION_TYPE_INSERTION))) appendInCombine(result, Mutation.move(other.mutations[p2++], -delta)); switch (getRawTypeCode(mutations[p1])) { case RAW_MUTATION_TYPE_INSERTION: if (p2 < other.mutations.length && getPosition(other.mutations[p2]) == delta + position0) { if (getTo(mutations[p1]) != getFrom(other.mutations[p2])) throw new IllegalArgumentException(); if (isSubstitution(other.mutations[p2])) appendInCombine(result, (mutations[p1] & (~LETTER_MASK)) | (other.mutations[p2] & LETTER_MASK)); ++p2; } else appendInCombine(result, mutations[p1]); ++delta; break; case RAW_MUTATION_TYPE_SUBSTITUTION: if (p2 < other.mutations.length && getPosition(other.mutations[p2]) == delta + position0) { if (getTo(mutations[p1]) != getFrom(other.mutations[p2])) throw new IllegalArgumentException(); if (isSubstitution(other.mutations[p2])) { if (getFrom(mutations[p1]) != getTo(other.mutations[p2])) appendInCombine(result, (mutations[p1] & (~LETTER_MASK)) | (other.mutations[p2] & LETTER_MASK)); } else if (isDeletion(other.mutations[p2])) appendInCombine(result, createDeletion(position0, getFrom(mutations[p1]))); else throw new RuntimeException("Insertion after Del. or Subs."); ++p2; } else appendInCombine(result, mutations[p1]); break; case RAW_MUTATION_TYPE_DELETION: --delta; appendInCombine(result, mutations[p1]); break; } } while (p2 < other.mutations.length) appendInCombine(result, Mutation.move(other.mutations[p2++], -delta)); return new Mutations<S>(alphabet, result.toArray(), true); } }
public class class_name { public Mutations<S> combineWith(final Mutations<S> other) { IntArrayList result = new IntArrayList(mutations.length + other.mutations.length); //mut2 pointer int p2 = 0, position0 = 0, delta = 0; for (int p1 = 0; p1 < mutations.length; ++p1) { position0 = getPosition(mutations[p1]); // depends on control dependency: [for], data = [p1] while (p2 < other.mutations.length && // There are mutations in m2 (getPosition(other.mutations[p2]) < position0 + delta || // Before current point (getPosition(other.mutations[p2]) == position0 + delta && // On the current point and it is insertion getRawTypeCode(other.mutations[p2]) == RAW_MUTATION_TYPE_INSERTION))) appendInCombine(result, Mutation.move(other.mutations[p2++], -delta)); switch (getRawTypeCode(mutations[p1])) { case RAW_MUTATION_TYPE_INSERTION: if (p2 < other.mutations.length && getPosition(other.mutations[p2]) == delta + position0) { if (getTo(mutations[p1]) != getFrom(other.mutations[p2])) throw new IllegalArgumentException(); if (isSubstitution(other.mutations[p2])) appendInCombine(result, (mutations[p1] & (~LETTER_MASK)) | (other.mutations[p2] & LETTER_MASK)); ++p2; // depends on control dependency: [if], data = [none] } else appendInCombine(result, mutations[p1]); ++delta; // depends on control dependency: [for], data = [none] break; case RAW_MUTATION_TYPE_SUBSTITUTION: if (p2 < other.mutations.length && getPosition(other.mutations[p2]) == delta + position0) { if (getTo(mutations[p1]) != getFrom(other.mutations[p2])) throw new IllegalArgumentException(); if (isSubstitution(other.mutations[p2])) { if (getFrom(mutations[p1]) != getTo(other.mutations[p2])) appendInCombine(result, (mutations[p1] & (~LETTER_MASK)) | (other.mutations[p2] & LETTER_MASK)); } else if (isDeletion(other.mutations[p2])) appendInCombine(result, createDeletion(position0, getFrom(mutations[p1]))); else throw new RuntimeException("Insertion after Del. or Subs."); ++p2; // depends on control dependency: [if], data = [none] } else appendInCombine(result, mutations[p1]); break; case RAW_MUTATION_TYPE_DELETION: --delta; // depends on control dependency: [for], data = [none] appendInCombine(result, mutations[p1]); // depends on control dependency: [for], data = [p1] break; } } while (p2 < other.mutations.length) appendInCombine(result, Mutation.move(other.mutations[p2++], -delta)); return new Mutations<S>(alphabet, result.toArray(), true); } }
public class class_name { boolean animationFrame(long currentTime) { boolean done = false; if (mPlayingState == STOPPED) { mPlayingState = RUNNING; if (mSeekTime < 0) { mStartTime = currentTime; } else { mStartTime = currentTime - mSeekTime; // Now that we're playing, reset the seek time mSeekTime = -1; } } switch (mPlayingState) { case RUNNING: case SEEKED: float fraction = mDuration > 0 ? (float)(currentTime - mStartTime) / mDuration : 1f; if (fraction >= 1f) { if (mCurrentIteration < mRepeatCount || mRepeatCount == INFINITE) { // Time to repeat if (mListeners != null) { int numListeners = mListeners.size(); for (int i = 0; i < numListeners; ++i) { mListeners.get(i).onAnimationRepeat(this); } } if (mRepeatMode == REVERSE) { mPlayingBackwards = mPlayingBackwards ? false : true; } mCurrentIteration += (int)fraction; fraction = fraction % 1f; mStartTime += mDuration; } else { done = true; fraction = Math.min(fraction, 1.0f); } } if (mPlayingBackwards) { fraction = 1f - fraction; } animateValue(fraction); break; } return done; } }
public class class_name { boolean animationFrame(long currentTime) { boolean done = false; if (mPlayingState == STOPPED) { mPlayingState = RUNNING; // depends on control dependency: [if], data = [none] if (mSeekTime < 0) { mStartTime = currentTime; // depends on control dependency: [if], data = [none] } else { mStartTime = currentTime - mSeekTime; // depends on control dependency: [if], data = [none] // Now that we're playing, reset the seek time mSeekTime = -1; // depends on control dependency: [if], data = [none] } } switch (mPlayingState) { case RUNNING: case SEEKED: float fraction = mDuration > 0 ? (float)(currentTime - mStartTime) / mDuration : 1f; if (fraction >= 1f) { if (mCurrentIteration < mRepeatCount || mRepeatCount == INFINITE) { // Time to repeat if (mListeners != null) { int numListeners = mListeners.size(); for (int i = 0; i < numListeners; ++i) { mListeners.get(i).onAnimationRepeat(this); // depends on control dependency: [for], data = [i] } } if (mRepeatMode == REVERSE) { mPlayingBackwards = mPlayingBackwards ? false : true; // depends on control dependency: [if], data = [none] } mCurrentIteration += (int)fraction; // depends on control dependency: [if], data = [none] fraction = fraction % 1f; // depends on control dependency: [if], data = [none] mStartTime += mDuration; // depends on control dependency: [if], data = [none] } else { done = true; // depends on control dependency: [if], data = [none] fraction = Math.min(fraction, 1.0f); // depends on control dependency: [if], data = [none] } } if (mPlayingBackwards) { fraction = 1f - fraction; // depends on control dependency: [if], data = [none] } animateValue(fraction); break; } return done; } }
public class class_name { public void setAddNetworkLoadBalancerArns(java.util.Collection<String> addNetworkLoadBalancerArns) { if (addNetworkLoadBalancerArns == null) { this.addNetworkLoadBalancerArns = null; return; } this.addNetworkLoadBalancerArns = new com.amazonaws.internal.SdkInternalList<String>(addNetworkLoadBalancerArns); } }
public class class_name { public void setAddNetworkLoadBalancerArns(java.util.Collection<String> addNetworkLoadBalancerArns) { if (addNetworkLoadBalancerArns == null) { this.addNetworkLoadBalancerArns = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.addNetworkLoadBalancerArns = new com.amazonaws.internal.SdkInternalList<String>(addNetworkLoadBalancerArns); } }
public class class_name { @VisibleForTesting protected int stringToInt(final String exp) { final Integer value = fieldConstraints.getStringMappingValue(exp); if (value != null) { return value; } else { try { return Integer.parseInt(exp); } catch (final NumberFormatException e) { final String invalidChars = new StringValidations(fieldConstraints).removeValidChars(exp); throw new IllegalArgumentException(String.format("Invalid chars in expression! Expression: %s Invalid chars: %s", exp, invalidChars)); } } } }
public class class_name { @VisibleForTesting protected int stringToInt(final String exp) { final Integer value = fieldConstraints.getStringMappingValue(exp); if (value != null) { return value; // depends on control dependency: [if], data = [none] } else { try { return Integer.parseInt(exp); // depends on control dependency: [try], data = [none] } catch (final NumberFormatException e) { final String invalidChars = new StringValidations(fieldConstraints).removeValidChars(exp); throw new IllegalArgumentException(String.format("Invalid chars in expression! Expression: %s Invalid chars: %s", exp, invalidChars)); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public boolean addCassandraHost(CassandraHost cassandraHost) { String keysapce = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, getPersistenceUnit()) .getProperties().getProperty(PersistenceProperties.KUNDERA_KEYSPACE); PoolConfiguration prop = new PoolProperties(); prop.setHost(cassandraHost.getHost()); prop.setPort(cassandraHost.getPort()); prop.setKeySpace(keysapce); CassandraUtilities.setPoolConfigPolicy(cassandraHost, prop); try { if (logger.isInfoEnabled()) { logger.info("Initializing connection for keyspace {},host {},port {}", keysapce, cassandraHost.getHost(), cassandraHost.getPort()); } ConnectionPool pool = new ConnectionPool(prop); hostPools.put(cassandraHost, pool); return true; } catch (TException e) { logger.warn("Node " + cassandraHost.getHost() + " are still down"); return false; } } }
public class class_name { public boolean addCassandraHost(CassandraHost cassandraHost) { String keysapce = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, getPersistenceUnit()) .getProperties().getProperty(PersistenceProperties.KUNDERA_KEYSPACE); PoolConfiguration prop = new PoolProperties(); prop.setHost(cassandraHost.getHost()); prop.setPort(cassandraHost.getPort()); prop.setKeySpace(keysapce); CassandraUtilities.setPoolConfigPolicy(cassandraHost, prop); try { if (logger.isInfoEnabled()) { logger.info("Initializing connection for keyspace {},host {},port {}", keysapce, cassandraHost.getHost(), cassandraHost.getPort()); // depends on control dependency: [if], data = [none] } ConnectionPool pool = new ConnectionPool(prop); hostPools.put(cassandraHost, pool); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (TException e) { logger.warn("Node " + cassandraHost.getHost() + " are still down"); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static JsonObject from(Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } else if (mapData.isEmpty()) { return JsonObject.empty(); } JsonObject result = new JsonObject(mapData.size()); for (Map.Entry<String, ?> entry : mapData.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value == JsonValue.NULL) { value = null; } if (key == null) { throw new NullPointerException("The key is not allowed to be null"); } else if (value instanceof Map) { try { JsonObject sub = JsonObject.from((Map<String, ?>) value); result.put(key, sub); } catch (ClassCastException e) { throw e; } catch (Exception e) { ClassCastException c = new ClassCastException("Couldn't convert sub-Map " + key + " to JsonObject"); c.initCause(e); throw c; } } else if (value instanceof List) { try { JsonArray sub = JsonArray.from((List<?>) value); result.put(key, sub); } catch (Exception e) { //no risk of a direct ClassCastException here ClassCastException c = new ClassCastException("Couldn't convert sub-List " + key + " to JsonArray"); c.initCause(e); throw c; } } else if (!checkType(value)) { throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass()); } else { result.put(key, value); } } return result; } }
public class class_name { public static JsonObject from(Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } else if (mapData.isEmpty()) { return JsonObject.empty(); // depends on control dependency: [if], data = [none] } JsonObject result = new JsonObject(mapData.size()); for (Map.Entry<String, ?> entry : mapData.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value == JsonValue.NULL) { value = null; // depends on control dependency: [if], data = [none] } if (key == null) { throw new NullPointerException("The key is not allowed to be null"); } else if (value instanceof Map) { try { JsonObject sub = JsonObject.from((Map<String, ?>) value); result.put(key, sub); // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] ClassCastException c = new ClassCastException("Couldn't convert sub-Map " + key + " to JsonObject"); c.initCause(e); throw c; } } else if (value instanceof List) { try { JsonArray sub = JsonArray.from((List<?>) value); result.put(key, sub); } catch (Exception e) { //no risk of a direct ClassCastException here ClassCastException c = new ClassCastException("Couldn't convert sub-List " + key + " to JsonArray"); c.initCause(e); throw c; } // depends on control dependency: [catch], data = [none] } else if (!checkType(value)) { throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass()); } else { result.put(key, value); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public float getAscender() { float ascender = 0; for (int k = 0; k < line.size(); ++k) { PdfChunk ck = (PdfChunk)line.get(k); if (ck.isImage()) ascender = Math.max(ascender, ck.getImage().getScaledHeight() + ck.getImageOffsetY()); else { PdfFont font = ck.font(); ascender = Math.max(ascender, font.getFont().getFontDescriptor(BaseFont.ASCENT, font.size())); } } return ascender; } }
public class class_name { public float getAscender() { float ascender = 0; for (int k = 0; k < line.size(); ++k) { PdfChunk ck = (PdfChunk)line.get(k); if (ck.isImage()) ascender = Math.max(ascender, ck.getImage().getScaledHeight() + ck.getImageOffsetY()); else { PdfFont font = ck.font(); ascender = Math.max(ascender, font.getFont().getFontDescriptor(BaseFont.ASCENT, font.size())); // depends on control dependency: [if], data = [none] } } return ascender; } }
public class class_name { public static final boolean prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive) { int max = prefix.length; if (name.length < max) { return false; } if (isCaseSensitive) { for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (prefix[i] != name[i]) { return false; } } return true; } for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (Character.toLowerCase(prefix[i]) != Character.toLowerCase(name[i])) { return false; } } return true; } }
public class class_name { public static final boolean prefixEquals(char[] prefix, char[] name, boolean isCaseSensitive) { int max = prefix.length; if (name.length < max) { return false; // depends on control dependency: [if], data = [none] } if (isCaseSensitive) { for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (prefix[i] != name[i]) { return false; // depends on control dependency: [if], data = [none] } } return true; // depends on control dependency: [if], data = [none] } for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (Character.toLowerCase(prefix[i]) != Character.toLowerCase(name[i])) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, Context context) { try { ClientCodeWrapper ccw = ClientCodeWrapper.instance(context); if (options != null) { for (String option : options) Objects.requireNonNull(option); } if (classes != null) { for (String cls : classes) { int sep = cls.indexOf('/'); // implicit null check if (sep > 0) { String mod = cls.substring(0, sep); if (!SourceVersion.isName(mod)) throw new IllegalArgumentException("Not a valid module name: " + mod); cls = cls.substring(sep + 1); } if (!SourceVersion.isName(cls)) throw new IllegalArgumentException("Not a valid class name: " + cls); } } if (compilationUnits != null) { compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check for (JavaFileObject cu : compilationUnits) { if (cu.getKind() != JavaFileObject.Kind.SOURCE) { String kindMsg = "Compilation unit is not of SOURCE kind: " + "\"" + cu.getName() + "\""; throw new IllegalArgumentException(kindMsg); } } } if (diagnosticListener != null) context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener)); if (out == null) context.put(Log.errKey, new PrintWriter(System.err, true)); else context.put(Log.errKey, new PrintWriter(out, true)); if (fileManager == null) { fileManager = getStandardFileManager(diagnosticListener, null, null); if (fileManager instanceof BaseFileManager) { ((BaseFileManager) fileManager).autoClose = true; } } fileManager = ccw.wrap(fileManager); context.put(JavaFileManager.class, fileManager); Arguments args = Arguments.instance(context); args.init("javac", options, classes, compilationUnits); // init multi-release jar handling if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) { Target target = Target.instance(context); List<String> list = List.of(target.multiReleaseValue()); fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator()); } return new JavacTaskImpl(context); } catch (PropagatedException ex) { throw ex.getCause(); } catch (ClientCodeException ex) { throw new RuntimeException(ex.getCause()); } } }
public class class_name { public JavacTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits, Context context) { try { ClientCodeWrapper ccw = ClientCodeWrapper.instance(context); if (options != null) { for (String option : options) Objects.requireNonNull(option); } if (classes != null) { for (String cls : classes) { int sep = cls.indexOf('/'); // implicit null check if (sep > 0) { String mod = cls.substring(0, sep); if (!SourceVersion.isName(mod)) throw new IllegalArgumentException("Not a valid module name: " + mod); cls = cls.substring(sep + 1); // depends on control dependency: [if], data = [(sep] } if (!SourceVersion.isName(cls)) throw new IllegalArgumentException("Not a valid class name: " + cls); } } if (compilationUnits != null) { compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check // depends on control dependency: [if], data = [(compilationUnits] for (JavaFileObject cu : compilationUnits) { if (cu.getKind() != JavaFileObject.Kind.SOURCE) { String kindMsg = "Compilation unit is not of SOURCE kind: " + "\"" + cu.getName() + "\""; // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(kindMsg); } } } if (diagnosticListener != null) context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener)); if (out == null) context.put(Log.errKey, new PrintWriter(System.err, true)); else context.put(Log.errKey, new PrintWriter(out, true)); if (fileManager == null) { fileManager = getStandardFileManager(diagnosticListener, null, null); // depends on control dependency: [if], data = [null)] if (fileManager instanceof BaseFileManager) { ((BaseFileManager) fileManager).autoClose = true; // depends on control dependency: [if], data = [none] } } fileManager = ccw.wrap(fileManager); // depends on control dependency: [try], data = [none] context.put(JavaFileManager.class, fileManager); // depends on control dependency: [try], data = [none] Arguments args = Arguments.instance(context); args.init("javac", options, classes, compilationUnits); // depends on control dependency: [try], data = [none] // init multi-release jar handling if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) { Target target = Target.instance(context); List<String> list = List.of(target.multiReleaseValue()); fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator()); // depends on control dependency: [if], data = [none] } return new JavacTaskImpl(context); // depends on control dependency: [try], data = [none] } catch (PropagatedException ex) { throw ex.getCause(); } catch (ClientCodeException ex) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(ex.getCause()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void sortheap(Quicksortable q, int size) { for (int i = size-1; i >= 1; i--) { q.swap(0, i); heapifyDown(q, 0, i); } } }
public class class_name { private static void sortheap(Quicksortable q, int size) { for (int i = size-1; i >= 1; i--) { q.swap(0, i); // depends on control dependency: [for], data = [i] heapifyDown(q, 0, i); // depends on control dependency: [for], data = [i] } } }
public class class_name { public OutlierResult run(Relation<?> relation) { WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { String label = relation.get(iditer).toString(); final double score = (pattern.matcher(label).matches()) ? 1 : 0; scores.putDouble(iditer, score); } DoubleRelation scoreres = new MaterializedDoubleRelation("By label outlier scores", "label-outlier", scores, relation.getDBIDs()); OutlierScoreMeta meta = new ProbabilisticOutlierScore(); return new OutlierResult(meta, scoreres); } }
public class class_name { public OutlierResult run(Relation<?> relation) { WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT); for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { String label = relation.get(iditer).toString(); final double score = (pattern.matcher(label).matches()) ? 1 : 0; scores.putDouble(iditer, score); // depends on control dependency: [for], data = [iditer] } DoubleRelation scoreres = new MaterializedDoubleRelation("By label outlier scores", "label-outlier", scores, relation.getDBIDs()); OutlierScoreMeta meta = new ProbabilisticOutlierScore(); return new OutlierResult(meta, scoreres); } }
public class class_name { public static HashFunction[] createHashFunctions(final int seed, final int num) { final HashFunction[] hashFunctions = new HashFunction[num]; for (int i = 0; i < num; i++) { hashFunctions[i] = Hashing.murmur3_128(seed + i); } return hashFunctions; } }
public class class_name { public static HashFunction[] createHashFunctions(final int seed, final int num) { final HashFunction[] hashFunctions = new HashFunction[num]; for (int i = 0; i < num; i++) { hashFunctions[i] = Hashing.murmur3_128(seed + i); // depends on control dependency: [for], data = [i] } return hashFunctions; } }
public class class_name { public static <C> AsmClassAccess<C> get(Class<C> clazz) { @SuppressWarnings("unchecked") AsmClassAccess<C> access = (AsmClassAccess<C>) CLASS_ACCESSES.get(clazz); if (access != null) { return access; } Class<?> enclosingType = clazz.getEnclosingClass(); final boolean isNonStaticMemberClass = determineNonStaticMemberClass(clazz, enclosingType); String clazzName = clazz.getName(); Field[] fields = ClassUtils.collectInstanceFields(clazz, false, false, true); Method[] methods = ClassUtils.collectMethods(clazz); String accessClassName = constructAccessClassName(clazzName); Class<?> accessClass = null; AccessClassLoader loader = AccessClassLoader.get(clazz); synchronized (loader) { try { accessClass = loader.loadClass(accessClassName); } catch (ClassNotFoundException ignored) { String accessClassNm = accessClassName.replace('.', '/'); String clazzNm = clazzName.replace('.', '/'); String enclosingClassNm = determineEnclosingClassNm(clazz, enclosingType, isNonStaticMemberClass); String signatureString = "L" + ASM_CLASS_ACCESS_NM + "<L" + clazzNm + ";>;L" + CLASS_ACCESS_NM + "<L" + clazzNm + ";>;"; ClassWriter cw = new ClassWriter(0); // TraceClassVisitor tcv = new TraceClassVisitor(cv, new PrintWriter(System.err)); // CheckClassAdapter cw = new CheckClassAdapter(tcv); cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, accessClassNm, signatureString, ASM_CLASS_ACCESS_NM, null); enhanceForConstructor(cw, accessClassNm, clazzNm); if (isNonStaticMemberClass) { enhanceForNewInstanceInner(cw, clazzNm, enclosingClassNm); } else { enhanceForNewInstance(cw, clazzNm); } enhanceForGetValueObject(cw, accessClassNm, clazzNm, fields); enhanceForPutValueObject(cw, accessClassNm, clazzNm, fields); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BOOLEAN_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BOOLEAN_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BYTE_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BYTE_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.SHORT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.SHORT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.INT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.INT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.LONG_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.LONG_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.DOUBLE_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.DOUBLE_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.FLOAT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.FLOAT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.CHAR_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.CHAR_TYPE); enhanceForInvokeMethod(cw, accessClassNm, clazzNm, methods); cw.visitEnd(); loader.registerClass(accessClassName, cw.toByteArray()); try { accessClass = loader.findClass(accessClassName); } catch (ClassNotFoundException e) { throw new IllegalStateException("AccessClass unexpectedly could not be found", e); } } } try { @SuppressWarnings("unchecked") Constructor<AsmClassAccess<C>> c = (Constructor<AsmClassAccess<C>>) accessClass.getConstructor(new Class[] { Class.class }); access = c.newInstance(clazz); access.isNonStaticMemberClass = isNonStaticMemberClass; CLASS_ACCESSES.putIfAbsent(clazz, access); return access; } catch (Exception ex) { throw new RuntimeException("Error constructing constructor access class: " + accessClassName + "{ " + ex.getMessage() + " }", ex); } } }
public class class_name { public static <C> AsmClassAccess<C> get(Class<C> clazz) { @SuppressWarnings("unchecked") AsmClassAccess<C> access = (AsmClassAccess<C>) CLASS_ACCESSES.get(clazz); if (access != null) { return access; // depends on control dependency: [if], data = [none] } Class<?> enclosingType = clazz.getEnclosingClass(); final boolean isNonStaticMemberClass = determineNonStaticMemberClass(clazz, enclosingType); String clazzName = clazz.getName(); Field[] fields = ClassUtils.collectInstanceFields(clazz, false, false, true); Method[] methods = ClassUtils.collectMethods(clazz); String accessClassName = constructAccessClassName(clazzName); Class<?> accessClass = null; AccessClassLoader loader = AccessClassLoader.get(clazz); synchronized (loader) { try { accessClass = loader.loadClass(accessClassName); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException ignored) { String accessClassNm = accessClassName.replace('.', '/'); String clazzNm = clazzName.replace('.', '/'); String enclosingClassNm = determineEnclosingClassNm(clazz, enclosingType, isNonStaticMemberClass); String signatureString = "L" + ASM_CLASS_ACCESS_NM + "<L" + clazzNm + ";>;L" + CLASS_ACCESS_NM + "<L" + clazzNm + ";>;"; ClassWriter cw = new ClassWriter(0); // TraceClassVisitor tcv = new TraceClassVisitor(cv, new PrintWriter(System.err)); // CheckClassAdapter cw = new CheckClassAdapter(tcv); cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, accessClassNm, signatureString, ASM_CLASS_ACCESS_NM, null); enhanceForConstructor(cw, accessClassNm, clazzNm); if (isNonStaticMemberClass) { enhanceForNewInstanceInner(cw, clazzNm, enclosingClassNm); // depends on control dependency: [if], data = [none] } else { enhanceForNewInstance(cw, clazzNm); // depends on control dependency: [if], data = [none] } enhanceForGetValueObject(cw, accessClassNm, clazzNm, fields); enhanceForPutValueObject(cw, accessClassNm, clazzNm, fields); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BOOLEAN_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BOOLEAN_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BYTE_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.BYTE_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.SHORT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.SHORT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.INT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.INT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.LONG_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.LONG_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.DOUBLE_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.DOUBLE_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.FLOAT_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.FLOAT_TYPE); enhanceForGetValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.CHAR_TYPE); enhanceForPutValuePrimitive(cw, accessClassNm, clazzNm, fields, Type.CHAR_TYPE); enhanceForInvokeMethod(cw, accessClassNm, clazzNm, methods); cw.visitEnd(); loader.registerClass(accessClassName, cw.toByteArray()); try { accessClass = loader.findClass(accessClassName); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw new IllegalStateException("AccessClass unexpectedly could not be found", e); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } try { @SuppressWarnings("unchecked") Constructor<AsmClassAccess<C>> c = (Constructor<AsmClassAccess<C>>) accessClass.getConstructor(new Class[] { Class.class }); access = c.newInstance(clazz); // depends on control dependency: [try], data = [none] access.isNonStaticMemberClass = isNonStaticMemberClass; // depends on control dependency: [try], data = [none] CLASS_ACCESSES.putIfAbsent(clazz, access); // depends on control dependency: [try], data = [none] return access; // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new RuntimeException("Error constructing constructor access class: " + accessClassName + "{ " + ex.getMessage() + " }", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) { Assert.notNull(propertyName, "The property name must not be null."); Assert.notNull(listener, "The listener must not be null."); if (bean instanceof PropertyChangePublisher) { ((PropertyChangePublisher)bean).removePropertyChangeListener(propertyName, listener); } else { Class beanClass = bean.getClass(); Method namedPCLRemover = getNamedPCLRemover(beanClass); if (namedPCLRemover == null) throw new FatalBeanException("Could not find the bean method" + "/npublic void removePropertyChangeListener(String, PropertyChangeListener);/nin bean '" + bean + "'"); try { namedPCLRemover.invoke(bean, new Object[] {propertyName, listener}); } catch (InvocationTargetException e) { throw new FatalBeanException("Due to an InvocationTargetException we failed to remove " + "a named PropertyChangeListener from bean '" + bean + "'", e); } catch (IllegalAccessException e) { throw new FatalBeanException("Due to an IllegalAccessException we failed to remove " + "a named PropertyChangeListener from bean '" + bean + "'", e); } } } }
public class class_name { public static void removePropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) { Assert.notNull(propertyName, "The property name must not be null."); Assert.notNull(listener, "The listener must not be null."); if (bean instanceof PropertyChangePublisher) { ((PropertyChangePublisher)bean).removePropertyChangeListener(propertyName, listener); // depends on control dependency: [if], data = [none] } else { Class beanClass = bean.getClass(); Method namedPCLRemover = getNamedPCLRemover(beanClass); if (namedPCLRemover == null) throw new FatalBeanException("Could not find the bean method" + "/npublic void removePropertyChangeListener(String, PropertyChangeListener);/nin bean '" + bean + "'"); try { namedPCLRemover.invoke(bean, new Object[] {propertyName, listener}); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { throw new FatalBeanException("Due to an InvocationTargetException we failed to remove " + "a named PropertyChangeListener from bean '" + bean + "'", e); } // depends on control dependency: [catch], data = [none] catch (IllegalAccessException e) { throw new FatalBeanException("Due to an IllegalAccessException we failed to remove " + "a named PropertyChangeListener from bean '" + bean + "'", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void marshall(GetDifferencesRequest getDifferencesRequest, ProtocolMarshaller protocolMarshaller) { if (getDifferencesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getDifferencesRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getBeforeCommitSpecifier(), BEFORECOMMITSPECIFIER_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getAfterCommitSpecifier(), AFTERCOMMITSPECIFIER_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getBeforePath(), BEFOREPATH_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getAfterPath(), AFTERPATH_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(getDifferencesRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetDifferencesRequest getDifferencesRequest, ProtocolMarshaller protocolMarshaller) { if (getDifferencesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getDifferencesRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getBeforeCommitSpecifier(), BEFORECOMMITSPECIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getAfterCommitSpecifier(), AFTERCOMMITSPECIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getBeforePath(), BEFOREPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getAfterPath(), AFTERPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getDifferencesRequest.getNextToken(), NEXTTOKEN_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 ExceptionAnnotation exception(Throwable t) { if (t instanceof InvocationTargetException) { if (GreenPepper.isDebugEnabled()) { LOGGER.info("Caught exception in fixture execution", t); } return new ExceptionAnnotation( ((InvocationTargetException) t).getTargetException() ); } else { if (GreenPepper.isDebugEnabled()) { LOGGER.info("Caught exception in fixture execution", t); } return new ExceptionAnnotation( t ); } } }
public class class_name { public static ExceptionAnnotation exception(Throwable t) { if (t instanceof InvocationTargetException) { if (GreenPepper.isDebugEnabled()) { LOGGER.info("Caught exception in fixture execution", t); // depends on control dependency: [if], data = [none] } return new ExceptionAnnotation( ((InvocationTargetException) t).getTargetException() ); // depends on control dependency: [if], data = [none] } else { if (GreenPepper.isDebugEnabled()) { LOGGER.info("Caught exception in fixture execution", t); // depends on control dependency: [if], data = [none] } return new ExceptionAnnotation( t ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final Pair<Integer, Integer> pairNums() throws RecognitionException { Pair<Integer, Integer> pair = null; Token i=null; Token j=null; try { // druidG.g:356:2: ( ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) ) // druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) { // druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) // druidG.g:356:5: LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE { match(input,LSQUARE,FOLLOW_LSQUARE_in_pairNums2489); // druidG.g:356:13: ( WS )? int alt169=2; int LA169_0 = input.LA(1); if ( (LA169_0==WS) ) { alt169=1; } switch (alt169) { case 1 : // druidG.g:356:13: WS { match(input,WS,FOLLOW_WS_in_pairNums2491); } break; } i=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2496); // druidG.g:356:25: ( WS )? int alt170=2; int LA170_0 = input.LA(1); if ( (LA170_0==WS) ) { alt170=1; } switch (alt170) { case 1 : // druidG.g:356:25: WS { match(input,WS,FOLLOW_WS_in_pairNums2499); } break; } match(input,91,FOLLOW_91_in_pairNums2502); // druidG.g:356:33: ( WS )? int alt171=2; int LA171_0 = input.LA(1); if ( (LA171_0==WS) ) { alt171=1; } switch (alt171) { case 1 : // druidG.g:356:33: WS { match(input,WS,FOLLOW_WS_in_pairNums2504); } break; } j=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2509); // druidG.g:356:44: ( WS )? int alt172=2; int LA172_0 = input.LA(1); if ( (LA172_0==WS) ) { alt172=1; } switch (alt172) { case 1 : // druidG.g:356:44: WS { match(input,WS,FOLLOW_WS_in_pairNums2511); } break; } match(input,RSQUARE,FOLLOW_RSQUARE_in_pairNums2514); } pair = new Pair<>(Integer.parseInt((i!=null?i.getText():null)), Integer.parseInt((j!=null?j.getText():null))); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } return pair; } }
public class class_name { public final Pair<Integer, Integer> pairNums() throws RecognitionException { Pair<Integer, Integer> pair = null; Token i=null; Token j=null; try { // druidG.g:356:2: ( ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) ) // druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) { // druidG.g:356:4: ( LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE ) // druidG.g:356:5: LSQUARE ( WS )? i= LONG ( WS )? ',' ( WS )? j= LONG ( WS )? RSQUARE { match(input,LSQUARE,FOLLOW_LSQUARE_in_pairNums2489); // druidG.g:356:13: ( WS )? int alt169=2; int LA169_0 = input.LA(1); if ( (LA169_0==WS) ) { alt169=1; // depends on control dependency: [if], data = [none] } switch (alt169) { case 1 : // druidG.g:356:13: WS { match(input,WS,FOLLOW_WS_in_pairNums2491); } break; } i=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2496); // druidG.g:356:25: ( WS )? int alt170=2; int LA170_0 = input.LA(1); if ( (LA170_0==WS) ) { alt170=1; // depends on control dependency: [if], data = [none] } switch (alt170) { case 1 : // druidG.g:356:25: WS { match(input,WS,FOLLOW_WS_in_pairNums2499); } break; } match(input,91,FOLLOW_91_in_pairNums2502); // druidG.g:356:33: ( WS )? int alt171=2; int LA171_0 = input.LA(1); if ( (LA171_0==WS) ) { alt171=1; // depends on control dependency: [if], data = [none] } switch (alt171) { case 1 : // druidG.g:356:33: WS { match(input,WS,FOLLOW_WS_in_pairNums2504); } break; } j=(Token)match(input,LONG,FOLLOW_LONG_in_pairNums2509); // druidG.g:356:44: ( WS )? int alt172=2; int LA172_0 = input.LA(1); if ( (LA172_0==WS) ) { alt172=1; // depends on control dependency: [if], data = [none] } switch (alt172) { case 1 : // druidG.g:356:44: WS { match(input,WS,FOLLOW_WS_in_pairNums2511); } break; } match(input,RSQUARE,FOLLOW_RSQUARE_in_pairNums2514); } pair = new Pair<>(Integer.parseInt((i!=null?i.getText():null)), Integer.parseInt((j!=null?j.getText():null))); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } return pair; } }
public class class_name { public BigMoney plusMinor(long amountToAdd) { if (amountToAdd == 0) { return this; } BigDecimal newAmount = amount.add(BigDecimal.valueOf(amountToAdd, currency.getDecimalPlaces())); return BigMoney.of(currency, newAmount); } }
public class class_name { public BigMoney plusMinor(long amountToAdd) { if (amountToAdd == 0) { return this; // depends on control dependency: [if], data = [none] } BigDecimal newAmount = amount.add(BigDecimal.valueOf(amountToAdd, currency.getDecimalPlaces())); return BigMoney.of(currency, newAmount); } }
public class class_name { static protected String buildURL(String baseurl, String suffix, DapDataset template, String ce) { StringBuilder methodurl = new StringBuilder(); methodurl.append(baseurl); if(suffix != null) { methodurl.append('.'); methodurl.append(suffix); } if(ce != null && ce.length() > 0) { methodurl.append(QUERYSTART); methodurl.append(CONSTRAINTTAG); methodurl.append('='); methodurl.append(ce); } return methodurl.toString(); } }
public class class_name { static protected String buildURL(String baseurl, String suffix, DapDataset template, String ce) { StringBuilder methodurl = new StringBuilder(); methodurl.append(baseurl); if(suffix != null) { methodurl.append('.'); // depends on control dependency: [if], data = [none] methodurl.append(suffix); // depends on control dependency: [if], data = [(suffix] } if(ce != null && ce.length() > 0) { methodurl.append(QUERYSTART); // depends on control dependency: [if], data = [none] methodurl.append(CONSTRAINTTAG); // depends on control dependency: [if], data = [none] methodurl.append('='); // depends on control dependency: [if], data = [none] methodurl.append(ce); // depends on control dependency: [if], data = [(ce] } return methodurl.toString(); } }
public class class_name { public java.lang.String getUnit() { java.lang.Object ref = unit_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); unit_ = s; return s; } } }
public class class_name { public java.lang.String getUnit() { java.lang.Object ref = unit_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); unit_ = s; // depends on control dependency: [if], data = [none] return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { public int getClassDepth() { int depth = 0; ClassFile outer = mOuterClass; while (outer != null) { depth++; outer = outer.mOuterClass; } return depth; } }
public class class_name { public int getClassDepth() { int depth = 0; ClassFile outer = mOuterClass; while (outer != null) { depth++; // depends on control dependency: [while], data = [none] outer = outer.mOuterClass; // depends on control dependency: [while], data = [none] } return depth; } }
public class class_name { public EClass getBuffer() { if (bufferEClass == null) { bufferEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(GeometryPackage.eNS_URI).getEClassifiers().get(3); } return bufferEClass; } }
public class class_name { public EClass getBuffer() { if (bufferEClass == null) { bufferEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(GeometryPackage.eNS_URI).getEClassifiers().get(3); // depends on control dependency: [if], data = [none] } return bufferEClass; } }
public class class_name { private void declareExportsInModuleScope( Module googModule, Node moduleBody, TypedScope moduleScope) { if (!googModule.namespace().containsKey(Export.NAMESPACE)) { // The goog.module never assigns `exports = ...`, so declare `exports` as an object literal. moduleScope.declare( "exports", googModule.metadata().rootNode(), typeRegistry.createAnonymousObjectType(null), compiler.getInput(moduleBody.getInputId()), /* inferred= */ false); } } }
public class class_name { private void declareExportsInModuleScope( Module googModule, Node moduleBody, TypedScope moduleScope) { if (!googModule.namespace().containsKey(Export.NAMESPACE)) { // The goog.module never assigns `exports = ...`, so declare `exports` as an object literal. moduleScope.declare( "exports", googModule.metadata().rootNode(), typeRegistry.createAnonymousObjectType(null), compiler.getInput(moduleBody.getInputId()), /* inferred= */ false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void logMeasures(HLAMeasure[] measures, final Logger log) { log.info("\nAvailable measures are:"); log.info("======================"); for (HLAMeasure currMeasure : measures) { log.info(" - " + currMeasure.getSonarName()); } LogHelper.moo(log); } }
public class class_name { public static void logMeasures(HLAMeasure[] measures, final Logger log) { log.info("\nAvailable measures are:"); log.info("======================"); for (HLAMeasure currMeasure : measures) { log.info(" - " + currMeasure.getSonarName()); // depends on control dependency: [for], data = [currMeasure] } LogHelper.moo(log); } }
public class class_name { public Calendar retrieveCalendar(String name, T jedis) throws JobPersistenceException{ final String calendarHashKey = redisSchema.calendarHashKey(name); Calendar calendar; try{ final Map<String, String> calendarMap = jedis.hgetAll(calendarHashKey); if(calendarMap == null || calendarMap.isEmpty()){ return null; } final Class<?> calendarClass = Class.forName(calendarMap.get(CALENDAR_CLASS)); calendar = (Calendar) mapper.readValue(calendarMap.get(CALENDAR_JSON), calendarClass); } catch (ClassNotFoundException e) { logger.error("Class not found for calendar " + name); throw new JobPersistenceException(e.getMessage(), e); } catch (IOException e) { logger.error("Unable to deserialize calendar json for calendar " + name); throw new JobPersistenceException(e.getMessage(), e); } return calendar; } }
public class class_name { public Calendar retrieveCalendar(String name, T jedis) throws JobPersistenceException{ final String calendarHashKey = redisSchema.calendarHashKey(name); Calendar calendar; try{ final Map<String, String> calendarMap = jedis.hgetAll(calendarHashKey); if(calendarMap == null || calendarMap.isEmpty()){ return null; // depends on control dependency: [if], data = [none] } final Class<?> calendarClass = Class.forName(calendarMap.get(CALENDAR_CLASS)); calendar = (Calendar) mapper.readValue(calendarMap.get(CALENDAR_JSON), calendarClass); } catch (ClassNotFoundException e) { logger.error("Class not found for calendar " + name); throw new JobPersistenceException(e.getMessage(), e); } catch (IOException e) { logger.error("Unable to deserialize calendar json for calendar " + name); throw new JobPersistenceException(e.getMessage(), e); } return calendar; } }
public class class_name { private void forwardSendMessage(int edge, int iter) { // Update the residual double oldResidual = residuals[edge]; residuals[edge] = smartResidual(msgs[edge], newMsgs[edge], edge); if (oldResidual > prm.convergenceThreshold && residuals[edge] <= prm.convergenceThreshold) { // This message has (newly) converged. numConverged ++; } if (oldResidual <= prm.convergenceThreshold && residuals[edge] > prm.convergenceThreshold) { // This message was marked as converged, but is no longer converged. numConverged--; } // Check for oscillation. Did the argmax change? if (log.isTraceEnabled() && iter > 0) { if (msgs[edge].getArgmaxConfigId() != newMsgs[edge].getArgmaxConfigId()) { oscillationCount.incrementAndGet(); } sendCount.incrementAndGet(); log.trace("Residual: {} {}", fg.edgeToString(edge), residuals[edge]); } // Update the cached belief. int child = bg.childE(edge); if (!bg.isT1T2(edge) && bg.numNbsT1(child) >= prm.minVarNbsForCache) { varBeliefs[child].elemDivBP(msgs[edge]); varBeliefs[child].elemMultiply(newMsgs[edge]); assert !varBeliefs[child].containsBadValues() : "varBeliefs[child] = " + varBeliefs[child]; } else if (bg.isT1T2(edge) && bg.numNbsT2(child) >= prm.minFacNbsForCache){ Factor f = bg.t2E(edge); if (! (f instanceof GlobalFactor)) { facBeliefs[child].divBP(msgs[edge]); facBeliefs[child].prod(newMsgs[edge]); assert !facBeliefs[child].containsBadValues() : "facBeliefs[child] = " + facBeliefs[child]; } } // Send message: Just swap the pointers to the current message and the new message, so // that we don't have to create a new factor object. VarTensor oldMessage = msgs[edge]; msgs[edge] = newMsgs[edge]; newMsgs[edge] = oldMessage; assert !msgs[edge].containsBadValues() : "msgs[edge] = " + msgs[edge]; if (log.isTraceEnabled()) { log.trace("Message sent: {} {}", fg.edgeToString(edge), msgs[edge]); } } }
public class class_name { private void forwardSendMessage(int edge, int iter) { // Update the residual double oldResidual = residuals[edge]; residuals[edge] = smartResidual(msgs[edge], newMsgs[edge], edge); if (oldResidual > prm.convergenceThreshold && residuals[edge] <= prm.convergenceThreshold) { // This message has (newly) converged. numConverged ++; // depends on control dependency: [if], data = [none] } if (oldResidual <= prm.convergenceThreshold && residuals[edge] > prm.convergenceThreshold) { // This message was marked as converged, but is no longer converged. numConverged--; // depends on control dependency: [if], data = [none] } // Check for oscillation. Did the argmax change? if (log.isTraceEnabled() && iter > 0) { if (msgs[edge].getArgmaxConfigId() != newMsgs[edge].getArgmaxConfigId()) { oscillationCount.incrementAndGet(); // depends on control dependency: [if], data = [none] } sendCount.incrementAndGet(); // depends on control dependency: [if], data = [none] log.trace("Residual: {} {}", fg.edgeToString(edge), residuals[edge]); // depends on control dependency: [if], data = [none] } // Update the cached belief. int child = bg.childE(edge); if (!bg.isT1T2(edge) && bg.numNbsT1(child) >= prm.minVarNbsForCache) { varBeliefs[child].elemDivBP(msgs[edge]); // depends on control dependency: [if], data = [none] varBeliefs[child].elemMultiply(newMsgs[edge]); // depends on control dependency: [if], data = [none] assert !varBeliefs[child].containsBadValues() : "varBeliefs[child] = " + varBeliefs[child]; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } else if (bg.isT1T2(edge) && bg.numNbsT2(child) >= prm.minFacNbsForCache){ Factor f = bg.t2E(edge); if (! (f instanceof GlobalFactor)) { facBeliefs[child].divBP(msgs[edge]); // depends on control dependency: [if], data = [none] facBeliefs[child].prod(newMsgs[edge]); // depends on control dependency: [if], data = [none] assert !facBeliefs[child].containsBadValues() : "facBeliefs[child] = " + facBeliefs[child]; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } } // Send message: Just swap the pointers to the current message and the new message, so // that we don't have to create a new factor object. VarTensor oldMessage = msgs[edge]; msgs[edge] = newMsgs[edge]; newMsgs[edge] = oldMessage; assert !msgs[edge].containsBadValues() : "msgs[edge] = " + msgs[edge]; if (log.isTraceEnabled()) { log.trace("Message sent: {} {}", fg.edgeToString(edge), msgs[edge]); // depends on control dependency: [if], data = [none] } } }
public class class_name { private FolderAndFile handle(final Path root, final Path relativePath, final Path path, final boolean create) throws FrameworkException { // identify mounted folder object final PropertyKey<String> mountTargetKey = StructrApp.key(Folder.class, "mountTarget"); final Folder folder = StructrApp.getInstance().nodeQuery(Folder.class).and(mountTargetKey, root.toString()).getFirst(); if (folder != null) { final String mountFolderPath = folder.getProperty(StructrApp.key(Folder.class, "path")); if (mountFolderPath != null) { final Path relativePathParent = relativePath.getParent(); if (relativePathParent == null) { return new FolderAndFile(folder, getOrCreate(folder, path, relativePath, create)); } else { final String pathRelativeToRoot = folder.getPath() + "/" + relativePathParent.toString(); final Folder parentFolder = FileHelper.createFolderPath(SecurityContext.getSuperUserInstance(), pathRelativeToRoot); final AbstractFile file = getOrCreate(parentFolder, path, relativePath, create); return new FolderAndFile(folder, file); } } else { logger.warn("Cannot handle watch event, folder {} has no path", folder.getUuid()); } } return null; } }
public class class_name { private FolderAndFile handle(final Path root, final Path relativePath, final Path path, final boolean create) throws FrameworkException { // identify mounted folder object final PropertyKey<String> mountTargetKey = StructrApp.key(Folder.class, "mountTarget"); final Folder folder = StructrApp.getInstance().nodeQuery(Folder.class).and(mountTargetKey, root.toString()).getFirst(); if (folder != null) { final String mountFolderPath = folder.getProperty(StructrApp.key(Folder.class, "path")); if (mountFolderPath != null) { final Path relativePathParent = relativePath.getParent(); if (relativePathParent == null) { return new FolderAndFile(folder, getOrCreate(folder, path, relativePath, create)); // depends on control dependency: [if], data = [none] } else { final String pathRelativeToRoot = folder.getPath() + "/" + relativePathParent.toString(); final Folder parentFolder = FileHelper.createFolderPath(SecurityContext.getSuperUserInstance(), pathRelativeToRoot); final AbstractFile file = getOrCreate(parentFolder, path, relativePath, create); return new FolderAndFile(folder, file); // depends on control dependency: [if], data = [none] } } else { logger.warn("Cannot handle watch event, folder {} has no path", folder.getUuid()); } } return null; } }
public class class_name { public OSFamilyEnum getOsfamily() { if (isReference()) { final TargetDef refPlatform = (TargetDef) getCheckedRef(TargetDef.class, "TargetDef"); return refPlatform.getOsfamily(); } return this.osFamily; } }
public class class_name { public OSFamilyEnum getOsfamily() { if (isReference()) { final TargetDef refPlatform = (TargetDef) getCheckedRef(TargetDef.class, "TargetDef"); return refPlatform.getOsfamily(); // depends on control dependency: [if], data = [none] } return this.osFamily; } }
public class class_name { private void setEntitiesInResult(EntityMetadata m, List results, JsonArray array) { for (JsonElement element : array) { String id = element.getAsJsonObject().get("value").getAsJsonObject() .get(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()).getAsString(); Object entityFromJson = CouchDBObjectMapper.getEntityFromJson(m.getEntityClazz(), m, element .getAsJsonObject().get("value").getAsJsonObject(), m.getRelationNames(), kunderaMetadata); if (entityFromJson != null && (m.getTableName().concat(id)).equals(element.getAsJsonObject().get("id").getAsString())) { results.add(entityFromJson); } } } }
public class class_name { private void setEntitiesInResult(EntityMetadata m, List results, JsonArray array) { for (JsonElement element : array) { String id = element.getAsJsonObject().get("value").getAsJsonObject() .get(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()).getAsString(); Object entityFromJson = CouchDBObjectMapper.getEntityFromJson(m.getEntityClazz(), m, element .getAsJsonObject().get("value").getAsJsonObject(), m.getRelationNames(), kunderaMetadata); if (entityFromJson != null && (m.getTableName().concat(id)).equals(element.getAsJsonObject().get("id").getAsString())) { results.add(entityFromJson); // depends on control dependency: [if], data = [(entityFromJson] } } } }
public class class_name { public final Item getReferredItem() throws SevereMessageStoreException { if (null == _item) { if (null == _referredMembership) { // may be because it has not been set as a result // of restore from DB ReferenceMembership m = (ReferenceMembership)_getMembership(); if (null == m) { throw new NotInMessageStore(); } if (null != m) { long refID = m.getReferencedID(); if (NO_ID != refID) { MessageStore messageStore = getOwningMessageStore(); if (null != messageStore) { _referredMembership = (ItemMembership) messageStore.getMembership(refID); } } } } if (null != _referredMembership) { _item = (Item) _referredMembership.getItem(); } } return _item; } }
public class class_name { public final Item getReferredItem() throws SevereMessageStoreException { if (null == _item) { if (null == _referredMembership) { // may be because it has not been set as a result // of restore from DB ReferenceMembership m = (ReferenceMembership)_getMembership(); if (null == m) { throw new NotInMessageStore(); } if (null != m) { long refID = m.getReferencedID(); if (NO_ID != refID) { MessageStore messageStore = getOwningMessageStore(); if (null != messageStore) { _referredMembership = (ItemMembership) messageStore.getMembership(refID); // depends on control dependency: [if], data = [none] } } } } if (null != _referredMembership) { _item = (Item) _referredMembership.getItem(); // depends on control dependency: [if], data = [none] } } return _item; } }
public class class_name { public void update(Object[] newValues, boolean updateOutOnly) { AssertUtils.assertNotNull(newValues); if (newValues.length != this.values.size()) { throw new IllegalArgumentException(ERROR_INCORRECT_LENGTH); } this.assertIncorrectOrder(); String parameterName = null; for (int i = 0; i < newValues.length; i++) { parameterName = this.getNameByPosition(i); if (updateOutOnly == false || isOutParameter(parameterName) == true) { parameterName = this.getNameByPosition(i); this.updateValue(parameterName, newValues[i]); } } } }
public class class_name { public void update(Object[] newValues, boolean updateOutOnly) { AssertUtils.assertNotNull(newValues); if (newValues.length != this.values.size()) { throw new IllegalArgumentException(ERROR_INCORRECT_LENGTH); } this.assertIncorrectOrder(); String parameterName = null; for (int i = 0; i < newValues.length; i++) { parameterName = this.getNameByPosition(i); // depends on control dependency: [for], data = [i] if (updateOutOnly == false || isOutParameter(parameterName) == true) { parameterName = this.getNameByPosition(i); // depends on control dependency: [if], data = [none] this.updateValue(parameterName, newValues[i]); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Object getClassBundleService(String interfaceClassName, String serviceClassName, String versionRange, Dictionary<String, String> filter, int secsToWait) { ServiceReference serviceReference = null; if (interfaceClassName != null) serviceReference = getClassServiceReference(bundleContext, interfaceClassName, versionRange, filter); if (serviceReference == null) if (serviceClassName != null) { serviceReference = getClassServiceReference(bundleContext, serviceClassName, versionRange, filter); if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.SERVICE_CLASS, serviceClassName, true)); if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.ACTIVATOR, serviceClassName, true)); // If you pass an activator class name, the service class may be different } if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.PACKAGE, ClassFinderActivator.getPackageName((interfaceClassName == null) ? serviceClassName : interfaceClassName, false), true)); if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.SERVICE_PID, ClassFinderActivator.getPackageName((interfaceClassName == null) ? serviceClassName : interfaceClassName, false), true)); serviceReference = checkService(serviceReference, interfaceClassName); if ((serviceReference != null) && ((serviceReference.getBundle().getState() & Bundle.ACTIVE) != 0)) return bundleContext.getService(serviceReference); if (secsToWait != 0) return ClassFinderActivator.waitForServiceStartup(bundleContext, interfaceClassName, serviceClassName, versionRange, filter, secsToWait); return null; } }
public class class_name { public Object getClassBundleService(String interfaceClassName, String serviceClassName, String versionRange, Dictionary<String, String> filter, int secsToWait) { ServiceReference serviceReference = null; if (interfaceClassName != null) serviceReference = getClassServiceReference(bundleContext, interfaceClassName, versionRange, filter); if (serviceReference == null) if (serviceClassName != null) { serviceReference = getClassServiceReference(bundleContext, serviceClassName, versionRange, filter); // depends on control dependency: [if], data = [none] if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.SERVICE_CLASS, serviceClassName, true)); if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.ACTIVATOR, serviceClassName, true)); // If you pass an activator class name, the service class may be different } if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.PACKAGE, ClassFinderActivator.getPackageName((interfaceClassName == null) ? serviceClassName : interfaceClassName, false), true)); if (serviceReference == null) serviceReference = getClassServiceReference(bundleContext, ServiceTracker.class.getName(), versionRange, ClassServiceUtility.addToFilter(filter, BundleConstants.SERVICE_PID, ClassFinderActivator.getPackageName((interfaceClassName == null) ? serviceClassName : interfaceClassName, false), true)); serviceReference = checkService(serviceReference, interfaceClassName); if ((serviceReference != null) && ((serviceReference.getBundle().getState() & Bundle.ACTIVE) != 0)) return bundleContext.getService(serviceReference); if (secsToWait != 0) return ClassFinderActivator.waitForServiceStartup(bundleContext, interfaceClassName, serviceClassName, versionRange, filter, secsToWait); return null; } }
public class class_name { @Override public Response toResponse(PersistenceException exception) { logger.error("Executing SQL error", exception); ErrorMessage errorMessage = ErrorMessage.fromStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); errorMessage.setThrowable(exception); errorMessage.setCode(Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString()); boolean isDev = mode.isDev(); List<ErrorMessage.Error> errors = Lists.newArrayList(); errors.add(new Result.Error( errorMessage.getCode(), exception.getMessage(), null, isDev ? ErrorMessage.parseSource(resourceInfo) : null )); if (isDev) { errors.addAll(ErrorMessage.parseErrors(exception, errorMessage.getStatus())); } errorMessage.setErrors(errors); return Response.status(errorMessage.getStatus()) .entity(errorMessage) .type(ExceptionMapperUtils.getResponseType()) .build(); } }
public class class_name { @Override public Response toResponse(PersistenceException exception) { logger.error("Executing SQL error", exception); ErrorMessage errorMessage = ErrorMessage.fromStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); errorMessage.setThrowable(exception); errorMessage.setCode(Hashing.murmur3_32().hashUnencodedChars(exception.getClass().getName()).toString()); boolean isDev = mode.isDev(); List<ErrorMessage.Error> errors = Lists.newArrayList(); errors.add(new Result.Error( errorMessage.getCode(), exception.getMessage(), null, isDev ? ErrorMessage.parseSource(resourceInfo) : null )); if (isDev) { errors.addAll(ErrorMessage.parseErrors(exception, errorMessage.getStatus())); // depends on control dependency: [if], data = [none] } errorMessage.setErrors(errors); return Response.status(errorMessage.getStatus()) .entity(errorMessage) .type(ExceptionMapperUtils.getResponseType()) .build(); } }
public class class_name { public static void render() { // If Anvil.render() is called on a non-UI thread, use UI Handler if (Looper.myLooper() != Looper.getMainLooper()) { synchronized (Anvil.class) { if (anvilUIHandler == null) { anvilUIHandler = new Handler(Looper.getMainLooper()); } } anvilUIHandler.removeCallbacksAndMessages(null); anvilUIHandler.post(anvilRenderRunnable); return; } Set<Mount> set = new HashSet<>(); set.addAll(mounts.values()); for (Mount m : set) { render(m); } } }
public class class_name { public static void render() { // If Anvil.render() is called on a non-UI thread, use UI Handler if (Looper.myLooper() != Looper.getMainLooper()) { synchronized (Anvil.class) { // depends on control dependency: [if], data = [none] if (anvilUIHandler == null) { anvilUIHandler = new Handler(Looper.getMainLooper()); // depends on control dependency: [if], data = [none] } } anvilUIHandler.removeCallbacksAndMessages(null); // depends on control dependency: [if], data = [none] anvilUIHandler.post(anvilRenderRunnable); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } Set<Mount> set = new HashSet<>(); set.addAll(mounts.values()); for (Mount m : set) { render(m); // depends on control dependency: [for], data = [m] } } }
public class class_name { public static Collection<Channel> filterbyProperties( Collection<Channel> channels, Collection<String> propNames) { Collection<Channel> result = new ArrayList<Channel>(); Collection<Channel> input = new ArrayList<Channel>(channels); for (Channel channel : input) { if (channel.getPropertyNames().containsAll(propNames)) { result.add(channel); } } return result; } }
public class class_name { public static Collection<Channel> filterbyProperties( Collection<Channel> channels, Collection<String> propNames) { Collection<Channel> result = new ArrayList<Channel>(); Collection<Channel> input = new ArrayList<Channel>(channels); for (Channel channel : input) { if (channel.getPropertyNames().containsAll(propNames)) { result.add(channel); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @Override protected void compareData(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler) throws DataSetException { logger.debug("compareData(expectedTable={}, actualTable={}, " + "comparisonCols={}, failureHandler={}) - start", new Object[]{expectedTable, actualTable, comparisonCols, failureHandler}); if (expectedTable == null) { throw new NullPointerException( "The parameter 'expectedTable' must not be null"); } if (actualTable == null) { throw new NullPointerException( "The parameter 'actualTable' must not be null"); } if (comparisonCols == null) { throw new NullPointerException( "The parameter 'comparisonCols' must not be null"); } if (failureHandler == null) { throw new NullPointerException( "The parameter 'failureHandler' must not be null"); } // iterate over all rows for (int i = 0; i < expectedTable.getRowCount(); i++) { // iterate over all columns of the current row for (int j = 0; j < comparisonCols.length; j++) { ComparisonColumn compareColumn = comparisonCols[j]; String columnName = compareColumn.getColumnName(); DataType dataType = compareColumn.getDataType(); Object expectedValue = expectedTable.getValue(i, columnName); Object actualValue = actualTable.getValue(i, columnName); // Compare the values if (skipCompare(columnName, expectedValue, actualValue)) { if (logger.isTraceEnabled()) { logger.trace("ignoring comparison " + expectedValue + "=" + actualValue + " on column " + columnName); } continue; } if(expectedValue != null && expectedValue.toString().startsWith("regex:")){ if(!regexMatches(expectedValue.toString(),actualValue.toString())){ Difference diff = new Difference( expectedTable, actualTable, i, columnName, expectedValue, actualValue); // Handle the difference (throw error immediately or something else) failureHandler.handle(diff); } } else if (dataType.compare(expectedValue, actualValue) != 0) { Difference diff = new Difference( expectedTable, actualTable, i, columnName, expectedValue, actualValue); // Handle the difference (throw error immediately or something else) failureHandler.handle(diff); } } } } }
public class class_name { @Override protected void compareData(ITable expectedTable, ITable actualTable, ComparisonColumn[] comparisonCols, FailureHandler failureHandler) throws DataSetException { logger.debug("compareData(expectedTable={}, actualTable={}, " + "comparisonCols={}, failureHandler={}) - start", new Object[]{expectedTable, actualTable, comparisonCols, failureHandler}); if (expectedTable == null) { throw new NullPointerException( "The parameter 'expectedTable' must not be null"); } if (actualTable == null) { throw new NullPointerException( "The parameter 'actualTable' must not be null"); } if (comparisonCols == null) { throw new NullPointerException( "The parameter 'comparisonCols' must not be null"); } if (failureHandler == null) { throw new NullPointerException( "The parameter 'failureHandler' must not be null"); } // iterate over all rows for (int i = 0; i < expectedTable.getRowCount(); i++) { // iterate over all columns of the current row for (int j = 0; j < comparisonCols.length; j++) { ComparisonColumn compareColumn = comparisonCols[j]; String columnName = compareColumn.getColumnName(); DataType dataType = compareColumn.getDataType(); Object expectedValue = expectedTable.getValue(i, columnName); Object actualValue = actualTable.getValue(i, columnName); // Compare the values if (skipCompare(columnName, expectedValue, actualValue)) { if (logger.isTraceEnabled()) { logger.trace("ignoring comparison " + expectedValue + "=" + actualValue + " on column " + columnName); // depends on control dependency: [if], data = [none] } continue; } if(expectedValue != null && expectedValue.toString().startsWith("regex:")){ if(!regexMatches(expectedValue.toString(),actualValue.toString())){ Difference diff = new Difference( expectedTable, actualTable, i, columnName, expectedValue, actualValue); // Handle the difference (throw error immediately or something else) failureHandler.handle(diff); // depends on control dependency: [if], data = [none] } } else if (dataType.compare(expectedValue, actualValue) != 0) { Difference diff = new Difference( expectedTable, actualTable, i, columnName, expectedValue, actualValue); // Handle the difference (throw error immediately or something else) failureHandler.handle(diff); } } } } }
public class class_name { private List returnSpecificFieldList(EntityMetadata m, List<Map<String, Object>> columnsToOutput, List<HBaseDataWrapper> results, List outputResults) { for (HBaseDataWrapper data : results) { List result = new ArrayList(); Map<String, byte[]> columns = data.getColumns(); for (Map<String, Object> map : columnsToOutput) { Object obj; String colDataKey = HBaseUtils.getColumnDataKey((String) map.get(Constants.COL_FAMILY), (String) map.get(Constants.DB_COL_NAME)); if ((boolean) map.get(Constants.IS_EMBEDDABLE)) { Class embedClazz = (Class) map.get(Constants.FIELD_CLAZZ); String prefix = (String) map.get(Constants.DB_COL_NAME) + HBaseUtils.DOT; obj = populateEmbeddableObject(data, KunderaCoreUtils.createNewInstance(embedClazz), m, embedClazz, prefix); } else if (isIdCol(m, (String) map.get(Constants.DB_COL_NAME))) { obj = HBaseUtils.fromBytes(data.getRowKey(), (Class) map.get(Constants.FIELD_CLAZZ)); } else { obj = HBaseUtils.fromBytes(columns.get(colDataKey), (Class) map.get(Constants.FIELD_CLAZZ)); } result.add(obj); } if (columnsToOutput.size() == 1) outputResults.addAll(result); else outputResults.add(result); } return outputResults; } }
public class class_name { private List returnSpecificFieldList(EntityMetadata m, List<Map<String, Object>> columnsToOutput, List<HBaseDataWrapper> results, List outputResults) { for (HBaseDataWrapper data : results) { List result = new ArrayList(); Map<String, byte[]> columns = data.getColumns(); for (Map<String, Object> map : columnsToOutput) { Object obj; String colDataKey = HBaseUtils.getColumnDataKey((String) map.get(Constants.COL_FAMILY), (String) map.get(Constants.DB_COL_NAME)); if ((boolean) map.get(Constants.IS_EMBEDDABLE)) { Class embedClazz = (Class) map.get(Constants.FIELD_CLAZZ); // depends on control dependency: [if], data = [none] String prefix = (String) map.get(Constants.DB_COL_NAME) + HBaseUtils.DOT; obj = populateEmbeddableObject(data, KunderaCoreUtils.createNewInstance(embedClazz), m, embedClazz, prefix); // depends on control dependency: [if], data = [none] } else if (isIdCol(m, (String) map.get(Constants.DB_COL_NAME))) { obj = HBaseUtils.fromBytes(data.getRowKey(), (Class) map.get(Constants.FIELD_CLAZZ)); // depends on control dependency: [if], data = [none] } else { obj = HBaseUtils.fromBytes(columns.get(colDataKey), (Class) map.get(Constants.FIELD_CLAZZ)); // depends on control dependency: [if], data = [none] } result.add(obj); // depends on control dependency: [for], data = [none] } if (columnsToOutput.size() == 1) outputResults.addAll(result); else outputResults.add(result); } return outputResults; } }
public class class_name { public void jacobianPoint( double camX, double camY, double camZ, @Nonnull double pointX[], @Nonnull double pointY[]) { funcPoint.setParameters(intrinsic); X[0] = camX;X[1] = camY;X[2] = camZ; jacobian.reshape(2,3); numericalPoint.process(X,jacobian); for (int i = 0; i < 3; i++) { pointX[i] = jacobian.data[i]; pointY[i] = jacobian.data[i+3]; } } }
public class class_name { public void jacobianPoint( double camX, double camY, double camZ, @Nonnull double pointX[], @Nonnull double pointY[]) { funcPoint.setParameters(intrinsic); X[0] = camX;X[1] = camY;X[2] = camZ; jacobian.reshape(2,3); numericalPoint.process(X,jacobian); for (int i = 0; i < 3; i++) { pointX[i] = jacobian.data[i]; // depends on control dependency: [for], data = [i] pointY[i] = jacobian.data[i+3]; // depends on control dependency: [for], data = [i] } } }
public class class_name { @Override public Query doQuery(SingleColumnMapper<?> mapper, Analyzer analyzer) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (Object value : values) { MatchCondition condition = new MatchCondition(null, field, value, docValues); builder.add(condition.doQuery(mapper, analyzer), BooleanClause.Occur.SHOULD); } return builder.build(); } }
public class class_name { @Override public Query doQuery(SingleColumnMapper<?> mapper, Analyzer analyzer) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (Object value : values) { MatchCondition condition = new MatchCondition(null, field, value, docValues); builder.add(condition.doQuery(mapper, analyzer), BooleanClause.Occur.SHOULD); // depends on control dependency: [for], data = [none] } return builder.build(); } }
public class class_name { public IntervalHistogram snapshot(boolean reset) { if (reset) { return new IntervalHistogram(bins, getAndResetHits()); } return new IntervalHistogram(bins, getHits()); } }
public class class_name { public IntervalHistogram snapshot(boolean reset) { if (reset) { return new IntervalHistogram(bins, getAndResetHits()); // depends on control dependency: [if], data = [none] } return new IntervalHistogram(bins, getHits()); } }
public class class_name { public static String toZeroPaddedString(long value, int precision, int maxSize) { StringBuffer sb = new StringBuffer(); if (value < 0) { value = -value; } String s = Long.toString(value); if (s.length() > precision) { s = s.substring(precision); } for (int i = s.length(); i < precision; i++) { sb.append('0'); } sb.append(s); if (maxSize < precision) { sb.setLength(maxSize); } return sb.toString(); } }
public class class_name { public static String toZeroPaddedString(long value, int precision, int maxSize) { StringBuffer sb = new StringBuffer(); if (value < 0) { value = -value; // depends on control dependency: [if], data = [none] } String s = Long.toString(value); if (s.length() > precision) { s = s.substring(precision); // depends on control dependency: [if], data = [precision)] } for (int i = s.length(); i < precision; i++) { sb.append('0'); // depends on control dependency: [for], data = [none] } sb.append(s); if (maxSize < precision) { sb.setLength(maxSize); // depends on control dependency: [if], data = [(maxSize] } return sb.toString(); } }
public class class_name { public static List<String> splitOnWordBoundaries(final String value, final boolean includeDelims) { if (value == null) { return Collections.emptyList(); } return Arrays.asList(WORD_BOUNDARY_PATTERN.split(value)); } }
public class class_name { public static List<String> splitOnWordBoundaries(final String value, final boolean includeDelims) { if (value == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return Arrays.asList(WORD_BOUNDARY_PATTERN.split(value)); } }
public class class_name { public void shutdown() { stopListenting(); // Shut down all event loops to terminate all threads. if (bossGroup != null) { bossGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS); } if (workerGroup != null) { workerGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS); } if (bossGroup != null) { bossGroup.terminationFuture().syncUninterruptibly(); } if (workerGroup != null) { workerGroup.terminationFuture().syncUninterruptibly(); } backend.close(); log.info("completed shutdown of {}", this); } }
public class class_name { public void shutdown() { stopListenting(); // Shut down all event loops to terminate all threads. if (bossGroup != null) { bossGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS); // depends on control dependency: [if], data = [none] } if (workerGroup != null) { workerGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS); // depends on control dependency: [if], data = [none] } if (bossGroup != null) { bossGroup.terminationFuture().syncUninterruptibly(); // depends on control dependency: [if], data = [none] } if (workerGroup != null) { workerGroup.terminationFuture().syncUninterruptibly(); // depends on control dependency: [if], data = [none] } backend.close(); log.info("completed shutdown of {}", this); } }
public class class_name { @Override public void serverStarted() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "serverStarted"); synchronized (_mpStartStopLock) { if (!_started || _isWASOpenForEBusiness) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "serverStarted", "Returning as ME not started " + _started + " or already announced " + _isWASOpenForEBusiness); return; } _isWASOpenForEBusiness = true; } _destinationManager.announceWASOpenForEBusiness(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "serverStarted"); } }
public class class_name { @Override public void serverStarted() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "serverStarted"); synchronized (_mpStartStopLock) { if (!_started || _isWASOpenForEBusiness) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "serverStarted", "Returning as ME not started " + _started + " or already announced " + _isWASOpenForEBusiness); return; // depends on control dependency: [if], data = [none] } _isWASOpenForEBusiness = true; } _destinationManager.announceWASOpenForEBusiness(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "serverStarted"); } }
public class class_name { protected void addTargetListeners (Component comp) { comp.addMouseListener(_targetListener); comp.addMouseMotionListener(_targetListener); if (comp instanceof Container) { // hm, always true for JComp.. Container cont = (Container) comp; cont.addContainerListener(_childListener); for (int ii=0, nn=cont.getComponentCount(); ii < nn; ii++) { addTargetListeners(cont.getComponent(ii)); } } } }
public class class_name { protected void addTargetListeners (Component comp) { comp.addMouseListener(_targetListener); comp.addMouseMotionListener(_targetListener); if (comp instanceof Container) { // hm, always true for JComp.. Container cont = (Container) comp; cont.addContainerListener(_childListener); // depends on control dependency: [if], data = [none] for (int ii=0, nn=cont.getComponentCount(); ii < nn; ii++) { addTargetListeners(cont.getComponent(ii)); // depends on control dependency: [for], data = [ii] } } } }
public class class_name { public void setCacheNames(Collection<String> names) { if (names != null) { for (String name : names) { getCache(name); } dynamic = false; } else { dynamic = true; } } }
public class class_name { public void setCacheNames(Collection<String> names) { if (names != null) { for (String name : names) { getCache(name); // depends on control dependency: [for], data = [name] } dynamic = false; // depends on control dependency: [if], data = [none] } else { dynamic = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void close(Closeable a) { try { if (a != null) { a.close(); } } catch (Exception e) { throw wrap(e); } } }
public class class_name { public static void close(Closeable a) { try { if (a != null) { a.close(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw wrap(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean hasBounceProxyBeenRegistered() { // startup reporting hasn't started if (!startupEventReported) { return false; } // startup reporting still ongoing - don't block this call! if (!startupReportFuture.isDone()) { return false; } // get result try { return startupReportFuture.get(); } catch (InterruptedException e) { return false; } catch (ExecutionException e) { return false; } catch (CancellationException e) { // reporting was cancelled before startup could be reported return false; } } }
public class class_name { public boolean hasBounceProxyBeenRegistered() { // startup reporting hasn't started if (!startupEventReported) { return false; // depends on control dependency: [if], data = [none] } // startup reporting still ongoing - don't block this call! if (!startupReportFuture.isDone()) { return false; // depends on control dependency: [if], data = [none] } // get result try { return startupReportFuture.get(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { return false; } catch (ExecutionException e) { // depends on control dependency: [catch], data = [none] return false; } catch (CancellationException e) { // depends on control dependency: [catch], data = [none] // reporting was cancelled before startup could be reported return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String toJwt() { Map<String, Object> headers = new HashMap<>(); headers.put("typ", "JWT"); headers.putAll(this.getHeaders()); JwtBuilder builder = Jwts.builder() .signWith(this.algorithm, this.secretKey) .setHeaderParams(headers) .setIssuer(this.issuer) .setExpiration(expiration); if (this.getClaims() != null) { for (Map.Entry<String, Object> entry : this.getClaims().entrySet()) { builder.claim(entry.getKey(), entry.getValue()); } } if (this.getId() != null) { builder.setId(this.getId()); } if (this.getSubject() != null) { builder.setSubject(this.getSubject()); } if (this.getNbf() != null) { builder.setNotBefore(this.getNbf()); } return builder.compact(); } }
public class class_name { public String toJwt() { Map<String, Object> headers = new HashMap<>(); headers.put("typ", "JWT"); headers.putAll(this.getHeaders()); JwtBuilder builder = Jwts.builder() .signWith(this.algorithm, this.secretKey) .setHeaderParams(headers) .setIssuer(this.issuer) .setExpiration(expiration); if (this.getClaims() != null) { for (Map.Entry<String, Object> entry : this.getClaims().entrySet()) { builder.claim(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } } if (this.getId() != null) { builder.setId(this.getId()); // depends on control dependency: [if], data = [(this.getId()] } if (this.getSubject() != null) { builder.setSubject(this.getSubject()); // depends on control dependency: [if], data = [(this.getSubject()] } if (this.getNbf() != null) { builder.setNotBefore(this.getNbf()); // depends on control dependency: [if], data = [(this.getNbf()] } return builder.compact(); } }
public class class_name { private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { // Always write legacy exception data: // Powerproject appears not to recognise new format data at all, // and legacy data is ignored in preference to new data post MSP 2003 writeExceptions9(dayList, exceptions); if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue()) { writeExceptions12(calendar, exceptions); } } }
public class class_name { private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { // Always write legacy exception data: // Powerproject appears not to recognise new format data at all, // and legacy data is ignored in preference to new data post MSP 2003 writeExceptions9(dayList, exceptions); if (m_saveVersion.getValue() > SaveVersion.Project2003.getValue()) { writeExceptions12(calendar, exceptions); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getClipPathRef() { if (this.clip == null) { return ""; } if (this.clipRef == null) { this.clipRef = registerClip(getClip()); } StringBuilder b = new StringBuilder(); b.append("clip-path=\"url(#").append(this.clipRef).append(")\""); return b.toString(); } }
public class class_name { private String getClipPathRef() { if (this.clip == null) { return ""; // depends on control dependency: [if], data = [none] } if (this.clipRef == null) { this.clipRef = registerClip(getClip()); // depends on control dependency: [if], data = [none] } StringBuilder b = new StringBuilder(); b.append("clip-path=\"url(#").append(this.clipRef).append(")\""); return b.toString(); } }
public class class_name { public void marshall(Note note, ProtocolMarshaller protocolMarshaller) { if (note == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(note.getText(), TEXT_BINDING); protocolMarshaller.marshall(note.getUpdatedBy(), UPDATEDBY_BINDING); protocolMarshaller.marshall(note.getUpdatedAt(), UPDATEDAT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Note note, ProtocolMarshaller protocolMarshaller) { if (note == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(note.getText(), TEXT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(note.getUpdatedBy(), UPDATEDBY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(note.getUpdatedAt(), UPDATEDAT_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 { @SuppressWarnings("unchecked") public static void main(String[] args) { List<File> filenames = new Vector<File>(); List<File> pathnames = new Vector<File>(); List<String> largs = Arrays.asList(args); VDMJ controller = null; Dialect dialect = Dialect.VDM_SL; String remoteName = null; Class<RemoteControl> remoteClass = null; String defaultName = null; Properties.init(); // Read properties file, if any Settings.usingCmdLine = true; if(largs.contains("-version")) { println(getOvertureVersion()); System.exit(0); } for (Iterator<String> i = largs.iterator(); i.hasNext();) { String arg = i.next(); if (arg.equals("-vdmsl")) { controller = new VDMSL(); dialect = Dialect.VDM_SL; } else if (arg.equals("-vdmpp")) { controller = new VDMPP(); dialect = Dialect.VDM_PP; } else if (arg.equals("-vdmrt")) { controller = new VDMRT(); dialect = Dialect.VDM_RT; } else if (arg.equals("-w")) { warnings = false; } else if (arg.equals("-i")) { interpret = true; } else if (arg.equals("-p")) { pog = true; } else if (arg.equals("-q")) { quiet = true; } else if (arg.equals("-e")) { Settings.usingCmdLine = false; interpret = true; pog = false; if (i.hasNext()) { script = i.next(); } else { usage("-e option requires an expression"); } } else if (arg.equals("-o")) { if (i.hasNext()) { if (outfile != null) { usage("Only one -o option allowed"); } outfile = i.next(); } else { usage("-o option requires a filename"); } } else if (arg.equals("-c")) { if (i.hasNext()) { filecharset = validateCharset(i.next()); } else { usage("-c option requires a charset name"); } } else if (arg.equals("-t")) { if (i.hasNext()) { Console.setCharset(validateCharset(i.next())); } else { usage("-t option requires a charset name"); } } else if (arg.equals("-r")) { if (i.hasNext()) { Settings.release = Release.lookup(i.next()); if (Settings.release == null) { usage("-r option must be " + Release.list()); } } else { usage("-r option requires a VDM release"); } } else if (arg.equals("-pre")) { Settings.prechecks = false; } else if (arg.equals("-post")) { Settings.postchecks = false; } else if (arg.equals("-inv")) { Settings.invchecks = false; } else if (arg.equals("-dtc")) { // NB. Turn off both when no DTC Settings.invchecks = false; Settings.dynamictypechecks = false; } else if (arg.equals("-measures")) { Settings.measureChecks = false; } else if (arg.equals("-log")) { if (i.hasNext()) { logfile = i.next(); } else { usage("-log option requires a filename"); } } else if (arg.equals("-remote")) { if (i.hasNext()) { interpret = true; remoteName = i.next(); } else { usage("-remote option requires a Java classname"); } } else if (arg.equals("-default")) { if (i.hasNext()) { defaultName = i.next(); } else { usage("-default option requires a name"); } } else if (arg.equals("-path")) { if (i.hasNext()) { File path = new File(i.next()); if (path.isDirectory()) { pathnames.add(path); } else { usage(path + " is not a directory"); } } else { usage("-path option requires a directory"); } }else if (arg.equals("-baseDir")) { if (i.hasNext()) { try { Settings.baseDir = new File(i.next()); } catch (IllegalArgumentException e) { usage(e.getMessage() + ": " + arg); } } else { usage("-baseDir option requires a folder name"); } } else if (arg.startsWith("-")) { usage("Unknown option " + arg); } else { // It's a file or a directory File file = new File(arg); if (file.isDirectory()) { for (File subFile : file.listFiles(dialect.getFilter())) { if (subFile.isFile()) { filenames.add(subFile); } } } else { if (file.exists()) { filenames.add(file); } else { boolean OK = false; for (File path : pathnames) { File pfile = new File(path, arg); if (pfile.exists()) { filenames.add(pfile); OK = true; break; } } if (!OK) { usage("Cannot find file " + file); } } } } } if (controller == null) { usage("You must specify either -vdmsl, -vdmpp or -vdmrt"); } if (logfile != null && !(controller instanceof VDMRT)) { usage("The -log option can only be used with -vdmrt"); } if (remoteName != null) { try { Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(remoteName); remoteClass = (Class<RemoteControl>) cls; } catch (ClassNotFoundException e) { usage("Cannot locate " + remoteName + " on the CLASSPATH"); } } ExitStatus status = null; if (filenames.isEmpty() && (!interpret || remoteClass != null)) { usage("You didn't specify any files"); status = ExitStatus.EXIT_ERRORS; } else { do { if (filenames.isEmpty()) { status = controller.interpret(filenames, null); } else { status = controller.parse(filenames); if (status == ExitStatus.EXIT_OK) { status = controller.typeCheck(); if (status == ExitStatus.EXIT_OK && interpret) { if (remoteClass == null) { status = controller.interpret(filenames, defaultName); } else { try { final RemoteControl remote = remoteClass.newInstance(); Interpreter i = controller.getInterpreter(); if (defaultName != null) { i.setDefaultName(defaultName); } i.init(null); try { // remote.run(new RemoteInterpreter(i, null)); final RemoteInterpreter remoteInterpreter = new RemoteInterpreter(i, null); Thread remoteThread = new Thread(new Runnable() { public void run() { try { remote.run(remoteInterpreter); } catch (Exception e) { println(e.getMessage()); // status = ExitStatus.EXIT_ERRORS; } } }); remoteThread.setName("RemoteControl runner"); remoteThread.setDaemon(true); remoteThread.start(); remoteInterpreter.processRemoteCalls(); status = ExitStatus.EXIT_OK; } catch (Exception e) { println(e.getMessage()); status = ExitStatus.EXIT_ERRORS; } } catch (InstantiationException e) { usage("Cannot instantiate " + remoteName); } catch (Exception e) { usage(e.getMessage()); } } } } } } while (status == ExitStatus.RELOAD); } if (interpret) { infoln("Bye"); } System.exit(status == ExitStatus.EXIT_OK ? 0 : 1); } }
public class class_name { @SuppressWarnings("unchecked") public static void main(String[] args) { List<File> filenames = new Vector<File>(); List<File> pathnames = new Vector<File>(); List<String> largs = Arrays.asList(args); VDMJ controller = null; Dialect dialect = Dialect.VDM_SL; String remoteName = null; Class<RemoteControl> remoteClass = null; String defaultName = null; Properties.init(); // Read properties file, if any Settings.usingCmdLine = true; if(largs.contains("-version")) { println(getOvertureVersion()); // depends on control dependency: [if], data = [none] System.exit(0); // depends on control dependency: [if], data = [none] } for (Iterator<String> i = largs.iterator(); i.hasNext();) { String arg = i.next(); if (arg.equals("-vdmsl")) { controller = new VDMSL(); // depends on control dependency: [if], data = [none] dialect = Dialect.VDM_SL; // depends on control dependency: [if], data = [none] } else if (arg.equals("-vdmpp")) { controller = new VDMPP(); // depends on control dependency: [if], data = [none] dialect = Dialect.VDM_PP; // depends on control dependency: [if], data = [none] } else if (arg.equals("-vdmrt")) { controller = new VDMRT(); // depends on control dependency: [if], data = [none] dialect = Dialect.VDM_RT; // depends on control dependency: [if], data = [none] } else if (arg.equals("-w")) { warnings = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-i")) { interpret = true; // depends on control dependency: [if], data = [none] } else if (arg.equals("-p")) { pog = true; // depends on control dependency: [if], data = [none] } else if (arg.equals("-q")) { quiet = true; // depends on control dependency: [if], data = [none] } else if (arg.equals("-e")) { Settings.usingCmdLine = false; // depends on control dependency: [if], data = [none] interpret = true; // depends on control dependency: [if], data = [none] pog = false; // depends on control dependency: [if], data = [none] if (i.hasNext()) { script = i.next(); // depends on control dependency: [if], data = [none] } else { usage("-e option requires an expression"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-o")) { if (i.hasNext()) { if (outfile != null) { usage("Only one -o option allowed"); // depends on control dependency: [if], data = [none] } outfile = i.next(); // depends on control dependency: [if], data = [none] } else { usage("-o option requires a filename"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-c")) { if (i.hasNext()) { filecharset = validateCharset(i.next()); // depends on control dependency: [if], data = [none] } else { usage("-c option requires a charset name"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-t")) { if (i.hasNext()) { Console.setCharset(validateCharset(i.next())); // depends on control dependency: [if], data = [none] } else { usage("-t option requires a charset name"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-r")) { if (i.hasNext()) { Settings.release = Release.lookup(i.next()); // depends on control dependency: [if], data = [none] if (Settings.release == null) { usage("-r option must be " + Release.list()); // depends on control dependency: [if], data = [none] } } else { usage("-r option requires a VDM release"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-pre")) { Settings.prechecks = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-post")) { Settings.postchecks = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-inv")) { Settings.invchecks = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-dtc")) { // NB. Turn off both when no DTC Settings.invchecks = false; // depends on control dependency: [if], data = [none] Settings.dynamictypechecks = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-measures")) { Settings.measureChecks = false; // depends on control dependency: [if], data = [none] } else if (arg.equals("-log")) { if (i.hasNext()) { logfile = i.next(); // depends on control dependency: [if], data = [none] } else { usage("-log option requires a filename"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-remote")) { if (i.hasNext()) { interpret = true; // depends on control dependency: [if], data = [none] remoteName = i.next(); // depends on control dependency: [if], data = [none] } else { usage("-remote option requires a Java classname"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-default")) { if (i.hasNext()) { defaultName = i.next(); // depends on control dependency: [if], data = [none] } else { usage("-default option requires a name"); // depends on control dependency: [if], data = [none] } } else if (arg.equals("-path")) { if (i.hasNext()) { File path = new File(i.next()); if (path.isDirectory()) { pathnames.add(path); // depends on control dependency: [if], data = [none] } else { usage(path + " is not a directory"); // depends on control dependency: [if], data = [none] } } else { usage("-path option requires a directory"); // depends on control dependency: [if], data = [none] } }else if (arg.equals("-baseDir")) { if (i.hasNext()) { try { Settings.baseDir = new File(i.next()); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { usage(e.getMessage() + ": " + arg); } // depends on control dependency: [catch], data = [none] } else { usage("-baseDir option requires a folder name"); // depends on control dependency: [if], data = [none] } } else if (arg.startsWith("-")) { usage("Unknown option " + arg); // depends on control dependency: [if], data = [none] } else { // It's a file or a directory File file = new File(arg); if (file.isDirectory()) { for (File subFile : file.listFiles(dialect.getFilter())) { if (subFile.isFile()) { filenames.add(subFile); // depends on control dependency: [if], data = [none] } } } else { if (file.exists()) { filenames.add(file); // depends on control dependency: [if], data = [none] } else { boolean OK = false; for (File path : pathnames) { File pfile = new File(path, arg); if (pfile.exists()) { filenames.add(pfile); // depends on control dependency: [if], data = [none] OK = true; // depends on control dependency: [if], data = [none] break; } } if (!OK) { usage("Cannot find file " + file); // depends on control dependency: [if], data = [none] } } } } } if (controller == null) { usage("You must specify either -vdmsl, -vdmpp or -vdmrt"); // depends on control dependency: [if], data = [none] } if (logfile != null && !(controller instanceof VDMRT)) { usage("The -log option can only be used with -vdmrt"); // depends on control dependency: [if], data = [none] } if (remoteName != null) { try { Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(remoteName); remoteClass = (Class<RemoteControl>) cls; // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { usage("Cannot locate " + remoteName + " on the CLASSPATH"); } // depends on control dependency: [catch], data = [none] } ExitStatus status = null; if (filenames.isEmpty() && (!interpret || remoteClass != null)) { usage("You didn't specify any files"); // depends on control dependency: [if], data = [none] status = ExitStatus.EXIT_ERRORS; // depends on control dependency: [if], data = [none] } else { do { if (filenames.isEmpty()) { status = controller.interpret(filenames, null); // depends on control dependency: [if], data = [none] } else { status = controller.parse(filenames); // depends on control dependency: [if], data = [none] if (status == ExitStatus.EXIT_OK) { status = controller.typeCheck(); // depends on control dependency: [if], data = [none] if (status == ExitStatus.EXIT_OK && interpret) { if (remoteClass == null) { status = controller.interpret(filenames, defaultName); // depends on control dependency: [if], data = [none] } else { try { final RemoteControl remote = remoteClass.newInstance(); Interpreter i = controller.getInterpreter(); if (defaultName != null) { i.setDefaultName(defaultName); // depends on control dependency: [if], data = [(defaultName] } i.init(null); // depends on control dependency: [try], data = [none] try { // remote.run(new RemoteInterpreter(i, null)); final RemoteInterpreter remoteInterpreter = new RemoteInterpreter(i, null); Thread remoteThread = new Thread(new Runnable() { public void run() { try { remote.run(remoteInterpreter); // depends on control dependency: [try], data = [none] } catch (Exception e) { println(e.getMessage()); // status = ExitStatus.EXIT_ERRORS; } // depends on control dependency: [catch], data = [none] } }); remoteThread.setName("RemoteControl runner"); // depends on control dependency: [try], data = [none] remoteThread.setDaemon(true); // depends on control dependency: [try], data = [none] remoteThread.start(); // depends on control dependency: [try], data = [none] remoteInterpreter.processRemoteCalls(); // depends on control dependency: [try], data = [none] status = ExitStatus.EXIT_OK; // depends on control dependency: [try], data = [none] } catch (Exception e) { println(e.getMessage()); status = ExitStatus.EXIT_ERRORS; } // depends on control dependency: [catch], data = [none] } catch (InstantiationException e) { usage("Cannot instantiate " + remoteName); } catch (Exception e) // depends on control dependency: [catch], data = [none] { usage(e.getMessage()); } // depends on control dependency: [catch], data = [none] } } } } } while (status == ExitStatus.RELOAD); } if (interpret) { infoln("Bye"); // depends on control dependency: [if], data = [none] } System.exit(status == ExitStatus.EXIT_OK ? 0 : 1); } }
public class class_name { private void createFolder(String foldername, int position, Hashtable properties) { String vfsFolderName = (String)m_fileIndex.get(foldername.replace('\\', '/')); m_report.print(Messages.get().container(Messages.RPT_CREATE_FOLDER_0), I_CmsReport.FORMAT_NOTE); m_report.print( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_ARGUMENT_1, vfsFolderName)); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); if (vfsFolderName != null) { String path = vfsFolderName.substring( 0, vfsFolderName.substring(0, vfsFolderName.length() - 1).lastIndexOf("/")); String folder = vfsFolderName.substring(path.length(), vfsFolderName.length()); try { // try to find a meta.properties file in the folder String propertyFileName = foldername + File.separator + META_PROPERTIES; boolean metaPropertiesFound = false; CmsParameterConfiguration propertyFile = new CmsParameterConfiguration(); try { propertyFile.load(new FileInputStream(new File(propertyFileName))); metaPropertiesFound = true; } catch (Exception e1) { // do nothing if the property file could not be loaded since it is not required // that such s file does exist } // now copy all values from the property file to the already found properties of the // new folder in OpenCms // only do this if we have found a meta.properties file if (metaPropertiesFound) { properties.putAll(propertyFile); // check if we have to set the navpos property. if (properties.get(CmsPropertyDefinition.PROPERTY_NAVPOS) == null) { // set the position in the folder as navpos // we have to add one to the position, since it is counted from 0 properties.put(CmsPropertyDefinition.PROPERTY_NAVPOS, (position + 1) + ""); } // check if we have to set the navpos property. if (properties.get(CmsPropertyDefinition.PROPERTY_NAVTEXT) == null) { // set the foldername in the folder as navtext String navtext = folder.substring(1, 2).toUpperCase() + folder.substring(2, folder.length() - 1); properties.put(CmsPropertyDefinition.PROPERTY_NAVTEXT, navtext); } } else { // if there was no meta.properties file, no properties should be added to the // folder properties = new Hashtable(); } // try to read the folder, it its there we must not create it again try { m_cmsObject.readFolder(path + folder); m_cmsObject.lockResource(path + folder); } catch (CmsException e1) { // the folder was not there, so create it m_cmsObject.createResource( path + folder, OpenCms.getResourceManager().getResourceType( CmsResourceTypeFolder.getStaticTypeName()).getTypeId()); } // create all properties and put them in an ArrayList Enumeration enu = properties.keys(); List propertyList = new ArrayList(); while (enu.hasMoreElements()) { // get property and value String propertyKey = (String)enu.nextElement(); String propertyVal = (String)properties.get(propertyKey); CmsProperty property = new CmsProperty(propertyKey, propertyVal, propertyVal); // create implicitly if Property doesn't exist already property.setAutoCreatePropertyDefinition(true); // add new property to the list propertyList.add(property); } // try to write the property Objects try { m_cmsObject.writePropertyObjects(path + folder, propertyList); } catch (CmsException e1) { e1.printStackTrace(); } m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } catch (CmsException e) { m_report.println(e); LOG.error(e.getLocalizedMessage(), e); } } } }
public class class_name { private void createFolder(String foldername, int position, Hashtable properties) { String vfsFolderName = (String)m_fileIndex.get(foldername.replace('\\', '/')); m_report.print(Messages.get().container(Messages.RPT_CREATE_FOLDER_0), I_CmsReport.FORMAT_NOTE); m_report.print( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_ARGUMENT_1, vfsFolderName)); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); if (vfsFolderName != null) { String path = vfsFolderName.substring( 0, vfsFolderName.substring(0, vfsFolderName.length() - 1).lastIndexOf("/")); String folder = vfsFolderName.substring(path.length(), vfsFolderName.length()); try { // try to find a meta.properties file in the folder String propertyFileName = foldername + File.separator + META_PROPERTIES; boolean metaPropertiesFound = false; CmsParameterConfiguration propertyFile = new CmsParameterConfiguration(); try { propertyFile.load(new FileInputStream(new File(propertyFileName))); // depends on control dependency: [try], data = [none] metaPropertiesFound = true; // depends on control dependency: [try], data = [none] } catch (Exception e1) { // do nothing if the property file could not be loaded since it is not required // that such s file does exist } // depends on control dependency: [catch], data = [none] // now copy all values from the property file to the already found properties of the // new folder in OpenCms // only do this if we have found a meta.properties file if (metaPropertiesFound) { properties.putAll(propertyFile); // depends on control dependency: [if], data = [none] // check if we have to set the navpos property. if (properties.get(CmsPropertyDefinition.PROPERTY_NAVPOS) == null) { // set the position in the folder as navpos // we have to add one to the position, since it is counted from 0 properties.put(CmsPropertyDefinition.PROPERTY_NAVPOS, (position + 1) + ""); // depends on control dependency: [if], data = [none] } // check if we have to set the navpos property. if (properties.get(CmsPropertyDefinition.PROPERTY_NAVTEXT) == null) { // set the foldername in the folder as navtext String navtext = folder.substring(1, 2).toUpperCase() + folder.substring(2, folder.length() - 1); properties.put(CmsPropertyDefinition.PROPERTY_NAVTEXT, navtext); // depends on control dependency: [if], data = [none] } } else { // if there was no meta.properties file, no properties should be added to the // folder properties = new Hashtable(); // depends on control dependency: [if], data = [none] } // try to read the folder, it its there we must not create it again try { m_cmsObject.readFolder(path + folder); // depends on control dependency: [try], data = [none] m_cmsObject.lockResource(path + folder); // depends on control dependency: [try], data = [none] } catch (CmsException e1) { // the folder was not there, so create it m_cmsObject.createResource( path + folder, OpenCms.getResourceManager().getResourceType( CmsResourceTypeFolder.getStaticTypeName()).getTypeId()); } // depends on control dependency: [catch], data = [none] // create all properties and put them in an ArrayList Enumeration enu = properties.keys(); List propertyList = new ArrayList(); while (enu.hasMoreElements()) { // get property and value String propertyKey = (String)enu.nextElement(); String propertyVal = (String)properties.get(propertyKey); CmsProperty property = new CmsProperty(propertyKey, propertyVal, propertyVal); // create implicitly if Property doesn't exist already property.setAutoCreatePropertyDefinition(true); // depends on control dependency: [while], data = [none] // add new property to the list propertyList.add(property); // depends on control dependency: [while], data = [none] } // try to write the property Objects try { m_cmsObject.writePropertyObjects(path + folder, propertyList); // depends on control dependency: [try], data = [none] } catch (CmsException e1) { e1.printStackTrace(); } // depends on control dependency: [catch], data = [none] m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); // depends on control dependency: [try], data = [none] } catch (CmsException e) { m_report.println(e); LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public int get(int key, int defaultValue) { int index = getKeyIndex(key); if (index >= 0) { return values[index]; } else { return defaultValue; } } }
public class class_name { public int get(int key, int defaultValue) { int index = getKeyIndex(key); if (index >= 0) { return values[index]; // depends on control dependency: [if], data = [none] } else { return defaultValue; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setBlockAppearance(StoredBlock block, boolean bestChain, int relativityOffset) { long blockTime = block.getHeader().getTimeSeconds() * 1000; if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) { updatedAt = new Date(blockTime); } addBlockAppearance(block.getHeader().getHash(), relativityOffset); if (bestChain) { TransactionConfidence transactionConfidence = getConfidence(); // This sets type to BUILDING and depth to one. transactionConfidence.setAppearedAtChainHeight(block.getHeight()); } } }
public class class_name { public void setBlockAppearance(StoredBlock block, boolean bestChain, int relativityOffset) { long blockTime = block.getHeader().getTimeSeconds() * 1000; if (bestChain && (updatedAt == null || updatedAt.getTime() == 0 || updatedAt.getTime() > blockTime)) { updatedAt = new Date(blockTime); // depends on control dependency: [if], data = [none] } addBlockAppearance(block.getHeader().getHash(), relativityOffset); if (bestChain) { TransactionConfidence transactionConfidence = getConfidence(); // This sets type to BUILDING and depth to one. transactionConfidence.setAppearedAtChainHeight(block.getHeight()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String replaceInternalFromUri(String input, final List<Triple<Token, Token, String>> replace, UriBaseListener rewriterListener) { Pair<ParserRuleContext, CommonTokenStream> parser = prepareUri(input); pathSegmentIndex = -1; walker.walk(rewriterListener, parser.value0); TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1); for (Triple<Token, Token, String> item : replace) { rewriter.replace(item.value0, item.value1, item.value2); } return rewriter.getText(); } }
public class class_name { private String replaceInternalFromUri(String input, final List<Triple<Token, Token, String>> replace, UriBaseListener rewriterListener) { Pair<ParserRuleContext, CommonTokenStream> parser = prepareUri(input); pathSegmentIndex = -1; walker.walk(rewriterListener, parser.value0); TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1); for (Triple<Token, Token, String> item : replace) { rewriter.replace(item.value0, item.value1, item.value2); // depends on control dependency: [for], data = [item] } return rewriter.getText(); } }
public class class_name { public void release() { if (releaseCallbacks == null) { return; } for (ReleaseCallback callback : releaseCallbacks) { try { callback.release(); } catch (Exception e) { LOGGER.warn( "Exception occured during release callback invocation:", e); } } } }
public class class_name { public void release() { if (releaseCallbacks == null) { return; // depends on control dependency: [if], data = [none] } for (ReleaseCallback callback : releaseCallbacks) { try { callback.release(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.warn( "Exception occured during release callback invocation:", e); } // depends on control dependency: [catch], data = [none] } } }