code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public java.util.List<Tag> getTagList() { if (tagList == null) { tagList = new com.amazonaws.internal.SdkInternalList<Tag>(); } return tagList; } }
public class class_name { public java.util.List<Tag> getTagList() { if (tagList == null) { tagList = new com.amazonaws.internal.SdkInternalList<Tag>(); // depends on control dependency: [if], data = [none] } return tagList; } }
public class class_name { public String getName() { if (paramName == null) { paramName = queryString.substring(paramBegin, paramNameEnd); } return paramName; } }
public class class_name { public String getName() { if (paramName == null) { paramName = queryString.substring(paramBegin, paramNameEnd); // depends on control dependency: [if], data = [none] } return paramName; } }
public class class_name { public void call(final T request, final Functor<String, RemoteService.Response> process, final Functor<Void, RemoteService.Response> confirm) { try { String message = process.invoke(RemoteService.call(location, endpoint, true, request)); if (message != null) { // clean failure throw new RuntimeException(message); } } catch (RuntimeException x) { if (confirm == null) { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { try { process.invoke(null); } catch (Exception x) {} } else { process.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // positive! } else { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { return null; } else { confirm.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // negative! throw x; } } } }
public class class_name { public void call(final T request, final Functor<String, RemoteService.Response> process, final Functor<Void, RemoteService.Response> confirm) { try { String message = process.invoke(RemoteService.call(location, endpoint, true, request)); if (message != null) { // clean failure throw new RuntimeException(message); } } catch (RuntimeException x) { if (confirm == null) { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { try { process.invoke(null); } catch (Exception x) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } else { process.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // depends on control dependency: [if], data = [none] // positive! } else { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { return null; } else { confirm.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // depends on control dependency: [if], data = [none] // negative! throw x; } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static CSLDate toDateSingle(String year, String month) { int m = toMonth(month); //parse year int y = -1; Boolean circa = null; if (year != null && year.length() >= 4) { if (StringUtils.isNumeric(year)) { y = Integer.parseInt(year); } else { String fourDigit = year.substring(year.length() - 4); if (StringUtils.isNumeric(fourDigit)) { y = Integer.parseInt(fourDigit); if (year.length() > 4) { circa = Boolean.TRUE; } } } } //create result CSLDateBuilder builder = new CSLDateBuilder(); if (y < 0) { return null; } if (m < 0) { return builder.dateParts(y).circa(circa).build(); } return builder.dateParts(y, m).circa(circa).build(); } }
public class class_name { public static CSLDate toDateSingle(String year, String month) { int m = toMonth(month); //parse year int y = -1; Boolean circa = null; if (year != null && year.length() >= 4) { if (StringUtils.isNumeric(year)) { y = Integer.parseInt(year); // depends on control dependency: [if], data = [none] } else { String fourDigit = year.substring(year.length() - 4); if (StringUtils.isNumeric(fourDigit)) { y = Integer.parseInt(fourDigit); // depends on control dependency: [if], data = [none] if (year.length() > 4) { circa = Boolean.TRUE; // depends on control dependency: [if], data = [none] } } } } //create result CSLDateBuilder builder = new CSLDateBuilder(); if (y < 0) { return null; // depends on control dependency: [if], data = [none] } if (m < 0) { return builder.dateParts(y).circa(circa).build(); // depends on control dependency: [if], data = [none] } return builder.dateParts(y, m).circa(circa).build(); } }
public class class_name { public final EObject entryRuleJvmWildcardTypeReference() throws RecognitionException { EObject current = null; EObject iv_ruleJvmWildcardTypeReference = null; try { // InternalXbaseWithAnnotations.g:6322:65: (iv_ruleJvmWildcardTypeReference= ruleJvmWildcardTypeReference EOF ) // InternalXbaseWithAnnotations.g:6323:2: iv_ruleJvmWildcardTypeReference= ruleJvmWildcardTypeReference EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getJvmWildcardTypeReferenceRule()); } pushFollow(FOLLOW_1); iv_ruleJvmWildcardTypeReference=ruleJvmWildcardTypeReference(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleJvmWildcardTypeReference; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject entryRuleJvmWildcardTypeReference() throws RecognitionException { EObject current = null; EObject iv_ruleJvmWildcardTypeReference = null; try { // InternalXbaseWithAnnotations.g:6322:65: (iv_ruleJvmWildcardTypeReference= ruleJvmWildcardTypeReference EOF ) // InternalXbaseWithAnnotations.g:6323:2: iv_ruleJvmWildcardTypeReference= ruleJvmWildcardTypeReference EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getJvmWildcardTypeReferenceRule()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_1); iv_ruleJvmWildcardTypeReference=ruleJvmWildcardTypeReference(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleJvmWildcardTypeReference; // depends on control dependency: [if], data = [none] } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { @Override public boolean isValid() { if (!_isValid && com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { //only log this if it is invalid String s = _isValid + appNameAndIdString; LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "isValid", s); } return _isValid; } }
public class class_name { @Override public boolean isValid() { if (!_isValid && com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { //only log this if it is invalid String s = _isValid + appNameAndIdString; LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "isValid", s); // depends on control dependency: [if], data = [none] } return _isValid; } }
public class class_name { public AbstractIntegerAssert<?> asInt() { isNotNull(); int value = 0; try { value = Integer.parseInt(actual); } catch (NumberFormatException e) { throwAssertionError(shouldBeConvertible(actual, "int")); } return AssertionsAdapter.assertThat(value); } }
public class class_name { public AbstractIntegerAssert<?> asInt() { isNotNull(); int value = 0; try { value = Integer.parseInt(actual); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throwAssertionError(shouldBeConvertible(actual, "int")); } // depends on control dependency: [catch], data = [none] return AssertionsAdapter.assertThat(value); } }
public class class_name { public String getEncryptedValue() { try { synchronized (this) { if (iv == null) { //if we were created from plain text or other reason without iv iv = KEY.newIv(); } } Cipher cipher = KEY.encrypt(iv); byte[] encrypted = cipher.doFinal(this.value.getBytes(UTF_8)); byte[] payload = new byte[1 + 8 + iv.length + encrypted.length]; int pos = 0; // For PAYLOAD_V1 we use this byte shifting model, V2 probably will need DataOutput payload[pos++] = PAYLOAD_V1; payload[pos++] = (byte)(iv.length >> 24); payload[pos++] = (byte)(iv.length >> 16); payload[pos++] = (byte)(iv.length >> 8); payload[pos++] = (byte)(iv.length); payload[pos++] = (byte)(encrypted.length >> 24); payload[pos++] = (byte)(encrypted.length >> 16); payload[pos++] = (byte)(encrypted.length >> 8); payload[pos++] = (byte)(encrypted.length); System.arraycopy(iv, 0, payload, pos, iv.length); pos+=iv.length; System.arraycopy(encrypted, 0, payload, pos, encrypted.length); return "{"+new String(Base64.getEncoder().encode(payload))+"}"; } catch (GeneralSecurityException e) { throw new Error(e); // impossible } } }
public class class_name { public String getEncryptedValue() { try { synchronized (this) { // depends on control dependency: [try], data = [none] if (iv == null) { //if we were created from plain text or other reason without iv iv = KEY.newIv(); // depends on control dependency: [if], data = [none] } } Cipher cipher = KEY.encrypt(iv); byte[] encrypted = cipher.doFinal(this.value.getBytes(UTF_8)); byte[] payload = new byte[1 + 8 + iv.length + encrypted.length]; int pos = 0; // For PAYLOAD_V1 we use this byte shifting model, V2 probably will need DataOutput payload[pos++] = PAYLOAD_V1; // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(iv.length >> 24); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(iv.length >> 16); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(iv.length >> 8); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(iv.length); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(encrypted.length >> 24); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(encrypted.length >> 16); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(encrypted.length >> 8); // depends on control dependency: [try], data = [none] payload[pos++] = (byte)(encrypted.length); // depends on control dependency: [try], data = [none] System.arraycopy(iv, 0, payload, pos, iv.length); // depends on control dependency: [try], data = [none] pos+=iv.length; // depends on control dependency: [try], data = [none] System.arraycopy(encrypted, 0, payload, pos, encrypted.length); // depends on control dependency: [try], data = [none] return "{"+new String(Base64.getEncoder().encode(payload))+"}"; // depends on control dependency: [try], data = [none] } catch (GeneralSecurityException e) { throw new Error(e); // impossible } // depends on control dependency: [catch], data = [none] } }
public class class_name { public MemoryPoolMXBean getMemoryPoolMXBean(String[] names) { for (String name : names) { MemoryPoolMXBean bean = getMemoryPoolMXBean(name); if (bean != null) { return bean; } } return null; } }
public class class_name { public MemoryPoolMXBean getMemoryPoolMXBean(String[] names) { for (String name : names) { MemoryPoolMXBean bean = getMemoryPoolMXBean(name); if (bean != null) { return bean; } // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void execute( Example example ) { try { List<Fixture> fixtures = getFixtureList(); Example headers = example.at( 0, 0 ); if (columns == null) { columns = getHeaderColumns(headers); } if (example.hasSibling()) { RowFixtureSplitter splitter = new RowFixtureSplitter(); splitter.split(example.at(1), fixtures, columns); for (RowFixture rowFixture : splitter.getMatch()) { Example row = rowFixture.getRow(); executeRow(row.firstChild(), headers, rowFixture.getAdapter()); if (shouldStop(stats)) { row.addChild().annotate(Annotations.stopped()); break; } } if (mustProcessMissing() && canContinue(stats)) { for (Example row : splitter.getMissing()) { missingRow(row); if (shouldStop(stats)) { row.addChild().annotate(Annotations.stopped()); break; } } } if (mustProcessSurplus() && canContinue(stats)) { for (Fixture adapter : splitter.getSurplus()) { addSurplusRow(example, headers, adapter); if (shouldStop(stats)) { example.lastSibling().addChild().annotate(Annotations.stopped()); break; } } } } } catch (Exception e) { stats.exception(); example.firstChild().annotate( exception( e ) ); if (shouldStop( stats )) { example.addChild().annotate(Annotations.stopped()); } } } }
public class class_name { public void execute( Example example ) { try { List<Fixture> fixtures = getFixtureList(); Example headers = example.at( 0, 0 ); if (columns == null) { columns = getHeaderColumns(headers); // depends on control dependency: [if], data = [none] } if (example.hasSibling()) { RowFixtureSplitter splitter = new RowFixtureSplitter(); splitter.split(example.at(1), fixtures, columns); // depends on control dependency: [if], data = [none] for (RowFixture rowFixture : splitter.getMatch()) { Example row = rowFixture.getRow(); executeRow(row.firstChild(), headers, rowFixture.getAdapter()); // depends on control dependency: [for], data = [rowFixture] if (shouldStop(stats)) { row.addChild().annotate(Annotations.stopped()); // depends on control dependency: [if], data = [none] break; } } if (mustProcessMissing() && canContinue(stats)) { for (Example row : splitter.getMissing()) { missingRow(row); // depends on control dependency: [for], data = [row] if (shouldStop(stats)) { row.addChild().annotate(Annotations.stopped()); // depends on control dependency: [if], data = [none] break; } } } if (mustProcessSurplus() && canContinue(stats)) { for (Fixture adapter : splitter.getSurplus()) { addSurplusRow(example, headers, adapter); // depends on control dependency: [for], data = [adapter] if (shouldStop(stats)) { example.lastSibling().addChild().annotate(Annotations.stopped()); // depends on control dependency: [if], data = [none] break; } } } } } catch (Exception e) { stats.exception(); example.firstChild().annotate( exception( e ) ); if (shouldStop( stats )) { example.addChild().annotate(Annotations.stopped()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean preparePanel() { // Already prepared (isPrepared will be reset to false later) if (mMenuIsPrepared) { return true; } // Init the panel state's menu--return false if init failed if (mMenu == null || mMenuRefreshContent) { if (mMenu == null) { if (!initializePanelMenu() || (mMenu == null)) { return false; } } if (wActionBar != null) { wActionBar.setMenu(mMenu, this); } // Call callback, and return if it doesn't want to display menu. // Creating the panel menu will involve a lot of manipulation; // don't dispatch change events to presenters until we're done. mMenu.stopDispatchingItemsChanged(); if (!callbackCreateOptionsMenu(mMenu)) { // Ditch the menu created above mMenu = null; if (wActionBar != null) { // Don't show it in the action bar either wActionBar.setMenu(null, this); } return false; } mMenuRefreshContent = false; } // Callback and return if the callback does not want to show the menu // Preparing the panel menu can involve a lot of manipulation; // don't dispatch change events to presenters until we're done. mMenu.stopDispatchingItemsChanged(); // Restore action view state before we prepare. This gives apps // an opportunity to override frozen/restored state in onPrepare. if (mMenuFrozenActionViewState != null) { mMenu.restoreActionViewStates(mMenuFrozenActionViewState); mMenuFrozenActionViewState = null; } if (!callbackPrepareOptionsMenu(mMenu)) { if (wActionBar != null) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. wActionBar.setMenu(null, this); } mMenu.startDispatchingItemsChanged(); return false; } // Set the proper keymap KeyCharacterMap kmap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); mMenu.setQwertyMode(kmap.getKeyboardType() != KeyCharacterMap.NUMERIC); mMenu.startDispatchingItemsChanged(); // Set other state mMenuIsPrepared = true; return true; } }
public class class_name { private boolean preparePanel() { // Already prepared (isPrepared will be reset to false later) if (mMenuIsPrepared) { return true; // depends on control dependency: [if], data = [none] } // Init the panel state's menu--return false if init failed if (mMenu == null || mMenuRefreshContent) { if (mMenu == null) { if (!initializePanelMenu() || (mMenu == null)) { return false; // depends on control dependency: [if], data = [none] } } if (wActionBar != null) { wActionBar.setMenu(mMenu, this); // depends on control dependency: [if], data = [none] } // Call callback, and return if it doesn't want to display menu. // Creating the panel menu will involve a lot of manipulation; // don't dispatch change events to presenters until we're done. mMenu.stopDispatchingItemsChanged(); // depends on control dependency: [if], data = [none] if (!callbackCreateOptionsMenu(mMenu)) { // Ditch the menu created above mMenu = null; // depends on control dependency: [if], data = [none] if (wActionBar != null) { // Don't show it in the action bar either wActionBar.setMenu(null, this); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } mMenuRefreshContent = false; // depends on control dependency: [if], data = [none] } // Callback and return if the callback does not want to show the menu // Preparing the panel menu can involve a lot of manipulation; // don't dispatch change events to presenters until we're done. mMenu.stopDispatchingItemsChanged(); // Restore action view state before we prepare. This gives apps // an opportunity to override frozen/restored state in onPrepare. if (mMenuFrozenActionViewState != null) { mMenu.restoreActionViewStates(mMenuFrozenActionViewState); // depends on control dependency: [if], data = [(mMenuFrozenActionViewState] mMenuFrozenActionViewState = null; // depends on control dependency: [if], data = [none] } if (!callbackPrepareOptionsMenu(mMenu)) { if (wActionBar != null) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. wActionBar.setMenu(null, this); // depends on control dependency: [if], data = [none] } mMenu.startDispatchingItemsChanged(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // Set the proper keymap KeyCharacterMap kmap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); mMenu.setQwertyMode(kmap.getKeyboardType() != KeyCharacterMap.NUMERIC); mMenu.startDispatchingItemsChanged(); // Set other state mMenuIsPrepared = true; return true; } }
public class class_name { private Map<String, Integer> getShardNumbers(String tableName, Set<String> targObjIDs) { TableDefinition tableDef = m_tableDef.getAppDef().getTableDef(tableName); FieldDefinition shardField = tableDef.getShardingField(); Map<String, String> shardFieldMap = SpiderService.instance().getObjectScalar(tableDef, targObjIDs, shardField.getName()); Map<String, Integer> shardNoMap = new HashMap<>(); for (String objID : shardFieldMap.keySet()) { Date shardingFieldDate = Utils.dateFromString(shardFieldMap.get(objID)); int shardNo = tableDef.computeShardNumber(shardingFieldDate); shardNoMap.put(objID, shardNo); } return shardNoMap; } }
public class class_name { private Map<String, Integer> getShardNumbers(String tableName, Set<String> targObjIDs) { TableDefinition tableDef = m_tableDef.getAppDef().getTableDef(tableName); FieldDefinition shardField = tableDef.getShardingField(); Map<String, String> shardFieldMap = SpiderService.instance().getObjectScalar(tableDef, targObjIDs, shardField.getName()); Map<String, Integer> shardNoMap = new HashMap<>(); for (String objID : shardFieldMap.keySet()) { Date shardingFieldDate = Utils.dateFromString(shardFieldMap.get(objID)); int shardNo = tableDef.computeShardNumber(shardingFieldDate); shardNoMap.put(objID, shardNo); // depends on control dependency: [for], data = [objID] } return shardNoMap; } }
public class class_name { protected int calculateBufferSize(long maxChunkSize) { final int KB = 1000; // Ensure maxChunkSize falls on 1-KB boundaries. if (maxChunkSize % KB != 0) { String m = "MaxChunkSize must be multiple of " + KB + ": " + maxChunkSize; log.error(m); throw new DuraCloudRuntimeException(m); } // Find maximum block factor less than or equal to 8-KB. long size = maxChunkSize; for (int i = 1; i <= maxChunkSize; i++) { // MaxChunkSize must be divisible by buffer size if ((maxChunkSize % i == 0) && ((maxChunkSize / i) <= (8 * KB))) { size = maxChunkSize / i; break; } } log.debug("Buf size: " + size + " for maxChunkSize: " + maxChunkSize); return (int) size; } }
public class class_name { protected int calculateBufferSize(long maxChunkSize) { final int KB = 1000; // Ensure maxChunkSize falls on 1-KB boundaries. if (maxChunkSize % KB != 0) { String m = "MaxChunkSize must be multiple of " + KB + ": " + maxChunkSize; // depends on control dependency: [if], data = [none] log.error(m); // depends on control dependency: [if], data = [none] throw new DuraCloudRuntimeException(m); } // Find maximum block factor less than or equal to 8-KB. long size = maxChunkSize; for (int i = 1; i <= maxChunkSize; i++) { // MaxChunkSize must be divisible by buffer size if ((maxChunkSize % i == 0) && ((maxChunkSize / i) <= (8 * KB))) { size = maxChunkSize / i; // depends on control dependency: [if], data = [none] break; } } log.debug("Buf size: " + size + " for maxChunkSize: " + maxChunkSize); return (int) size; } }
public class class_name { public static long toMillis(String tstr) { if (Strings.isBlank(tstr)) { return 0; } tstr = tstr.toLowerCase(); // FIXME 稍后改成正则判断 String tl = tstr.substring(0, tstr.length() - 1); String tu = tstr.substring(tstr.length() - 1); if (TIME_S_EN.equals(tu)) { return T_1S * Long.valueOf(tl); } if (TIME_M_EN.equals(tu)) { return T_1M * Long.valueOf(tl); } if (TIME_H_EN.equals(tu)) { return T_1H * Long.valueOf(tl); } if (TIME_D_EN.equals(tu)) { return T_1D * Long.valueOf(tl); } return Long.valueOf(tstr); } }
public class class_name { public static long toMillis(String tstr) { if (Strings.isBlank(tstr)) { return 0; // depends on control dependency: [if], data = [none] } tstr = tstr.toLowerCase(); // FIXME 稍后改成正则判断 String tl = tstr.substring(0, tstr.length() - 1); String tu = tstr.substring(tstr.length() - 1); if (TIME_S_EN.equals(tu)) { return T_1S * Long.valueOf(tl); // depends on control dependency: [if], data = [none] } if (TIME_M_EN.equals(tu)) { return T_1M * Long.valueOf(tl); // depends on control dependency: [if], data = [none] } if (TIME_H_EN.equals(tu)) { return T_1H * Long.valueOf(tl); // depends on control dependency: [if], data = [none] } if (TIME_D_EN.equals(tu)) { return T_1D * Long.valueOf(tl); // depends on control dependency: [if], data = [none] } return Long.valueOf(tstr); } }
public class class_name { public void marshall(LexiconAttributes lexiconAttributes, ProtocolMarshaller protocolMarshaller) { if (lexiconAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lexiconAttributes.getAlphabet(), ALPHABET_BINDING); protocolMarshaller.marshall(lexiconAttributes.getLanguageCode(), LANGUAGECODE_BINDING); protocolMarshaller.marshall(lexiconAttributes.getLastModified(), LASTMODIFIED_BINDING); protocolMarshaller.marshall(lexiconAttributes.getLexiconArn(), LEXICONARN_BINDING); protocolMarshaller.marshall(lexiconAttributes.getLexemesCount(), LEXEMESCOUNT_BINDING); protocolMarshaller.marshall(lexiconAttributes.getSize(), SIZE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(LexiconAttributes lexiconAttributes, ProtocolMarshaller protocolMarshaller) { if (lexiconAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(lexiconAttributes.getAlphabet(), ALPHABET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(lexiconAttributes.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(lexiconAttributes.getLastModified(), LASTMODIFIED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(lexiconAttributes.getLexiconArn(), LEXICONARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(lexiconAttributes.getLexemesCount(), LEXEMESCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(lexiconAttributes.getSize(), SIZE_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 void main(String[] args) { try { final ProcComm pc = new ProcComm(args, null); // use a log writer for the console (System.out), setting the user // specified log level, if any pc.w = new ConsoleWriter(pc.options.containsKey("verbose")); if (pc.options.containsKey("read") == pc.options.containsKey("write")) throw new IllegalArgumentException("do either read or write"); try { pc.run(null); pc.readWrite(); } finally { pc.quit(); } } catch (final Throwable t) { if (t.getMessage() != null) System.out.println(t.getMessage()); } } }
public class class_name { public static void main(String[] args) { try { final ProcComm pc = new ProcComm(args, null); // use a log writer for the console (System.out), setting the user // specified log level, if any pc.w = new ConsoleWriter(pc.options.containsKey("verbose")); // depends on control dependency: [try], data = [none] if (pc.options.containsKey("read") == pc.options.containsKey("write")) throw new IllegalArgumentException("do either read or write"); try { pc.run(null); // depends on control dependency: [try], data = [none] pc.readWrite(); // depends on control dependency: [try], data = [none] } finally { pc.quit(); } } catch (final Throwable t) { if (t.getMessage() != null) System.out.println(t.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public NettyChannelBuilder sslContext(SslContext sslContext) { if (sslContext != null) { checkArgument(sslContext.isClient(), "Server SSL context can not be used for client channel"); GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); } this.sslContext = sslContext; return this; } }
public class class_name { public NettyChannelBuilder sslContext(SslContext sslContext) { if (sslContext != null) { checkArgument(sslContext.isClient(), "Server SSL context can not be used for client channel"); // depends on control dependency: [if], data = [(sslContext] GrpcSslContexts.ensureAlpnAndH2Enabled(sslContext.applicationProtocolNegotiator()); // depends on control dependency: [if], data = [(sslContext] } this.sslContext = sslContext; return this; } }
public class class_name { public static Duration from(TemporalAmount amount) { Jdk8Methods.requireNonNull(amount, "amount"); Duration duration = ZERO; for (TemporalUnit unit : amount.getUnits()) { duration = duration.plus(amount.get(unit), unit); } return duration; } }
public class class_name { public static Duration from(TemporalAmount amount) { Jdk8Methods.requireNonNull(amount, "amount"); Duration duration = ZERO; for (TemporalUnit unit : amount.getUnits()) { duration = duration.plus(amount.get(unit), unit); // depends on control dependency: [for], data = [unit] } return duration; } }
public class class_name { public void run( String source, String destination ) { List<String> names = listDocumentsAt( source ); if (names.isEmpty()) { monitor.testRunning(source); monitor.testDone( 0, 0, 0, 0 ); return; } for (String name : names) { runner.run( name, flatten( name ) ); } } }
public class class_name { public void run( String source, String destination ) { List<String> names = listDocumentsAt( source ); if (names.isEmpty()) { monitor.testRunning(source); // depends on control dependency: [if], data = [none] monitor.testDone( 0, 0, 0, 0 ); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } for (String name : names) { runner.run( name, flatten( name ) ); // depends on control dependency: [for], data = [name] } } }
public class class_name { @Override public void afterExecute(final Runnable runnable, final Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable != null) { // Wrap the throwable in an ExecutionException (execute() does not do this) interruptionChecker.setExecutionException(new ExecutionException("Uncaught exception", throwable)); // execute() was called and an uncaught exception or error was thrown interruptionChecker.interrupt(); } else if (/* throwable == null && */ runnable instanceof Future<?>) { // submit() was called, so throwable is not set try { // This call will not block, since execution has finished ((Future<?>) runnable).get(); } catch (CancellationException | InterruptedException e) { // If this thread was cancelled or interrupted, interrupt other threads interruptionChecker.interrupt(); } catch (final ExecutionException e) { // Record the exception that was thrown by the thread interruptionChecker.setExecutionException(e); // Interrupt other threads interruptionChecker.interrupt(); } } } }
public class class_name { @Override public void afterExecute(final Runnable runnable, final Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable != null) { // Wrap the throwable in an ExecutionException (execute() does not do this) interruptionChecker.setExecutionException(new ExecutionException("Uncaught exception", throwable)); // depends on control dependency: [if], data = [none] // execute() was called and an uncaught exception or error was thrown interruptionChecker.interrupt(); // depends on control dependency: [if], data = [none] } else if (/* throwable == null && */ runnable instanceof Future<?>) { // submit() was called, so throwable is not set try { // This call will not block, since execution has finished ((Future<?>) runnable).get(); // depends on control dependency: [try], data = [none] } catch (CancellationException | InterruptedException e) { // If this thread was cancelled or interrupted, interrupt other threads interruptionChecker.interrupt(); } catch (final ExecutionException e) { // depends on control dependency: [catch], data = [none] // Record the exception that was thrown by the thread interruptionChecker.setExecutionException(e); // Interrupt other threads interruptionChecker.interrupt(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private Long getAccountIdArg(Object[] arguments) { if (arguments.length <= ACCT_ID_INDEX) { log.error("Illegal number of args: " + arguments.length); } return (Long) arguments[ACCT_ID_INDEX]; } }
public class class_name { private Long getAccountIdArg(Object[] arguments) { if (arguments.length <= ACCT_ID_INDEX) { log.error("Illegal number of args: " + arguments.length); // depends on control dependency: [if], data = [none] } return (Long) arguments[ACCT_ID_INDEX]; } }
public class class_name { private static LineString[] splitLineStringWithPoint(LineString line, Point pointToSplit, double tolerance) { Coordinate[] coords = line.getCoordinates(); Coordinate firstCoord = coords[0]; Coordinate lastCoord = coords[coords.length - 1]; Coordinate coordToSplit = pointToSplit.getCoordinate(); if ((coordToSplit.distance(firstCoord) <= PRECISION) || (coordToSplit.distance(lastCoord) <= PRECISION)) { return new LineString[]{line}; } else { ArrayList<Coordinate> firstLine = new ArrayList<Coordinate>(); firstLine.add(coords[0]); ArrayList<Coordinate> secondLine = new ArrayList<Coordinate>(); GeometryLocation geometryLocation = EditUtilities.getVertexToSnap(line, pointToSplit, tolerance); if (geometryLocation != null) { int segmentIndex = geometryLocation.getSegmentIndex(); Coordinate coord = geometryLocation.getCoordinate(); int index = -1; for (int i = 1; i < coords.length; i++) { index = i - 1; if (index < segmentIndex) { firstLine.add(coords[i]); } else if (index == segmentIndex) { coord.z = CoordinateUtils.interpolate(coords[i - 1], coords[i], coord); firstLine.add(coord); secondLine.add(coord); if (!coord.equals2D(coords[i])) { secondLine.add(coords[i]); } } else { secondLine.add(coords[i]); } } LineString lineString1 = FACTORY.createLineString(firstLine.toArray(new Coordinate[0])); LineString lineString2 = FACTORY.createLineString(secondLine.toArray(new Coordinate[0])); return new LineString[]{lineString1, lineString2}; } } return null; } }
public class class_name { private static LineString[] splitLineStringWithPoint(LineString line, Point pointToSplit, double tolerance) { Coordinate[] coords = line.getCoordinates(); Coordinate firstCoord = coords[0]; Coordinate lastCoord = coords[coords.length - 1]; Coordinate coordToSplit = pointToSplit.getCoordinate(); if ((coordToSplit.distance(firstCoord) <= PRECISION) || (coordToSplit.distance(lastCoord) <= PRECISION)) { return new LineString[]{line}; // depends on control dependency: [if], data = [none] } else { ArrayList<Coordinate> firstLine = new ArrayList<Coordinate>(); firstLine.add(coords[0]); // depends on control dependency: [if], data = [none] ArrayList<Coordinate> secondLine = new ArrayList<Coordinate>(); GeometryLocation geometryLocation = EditUtilities.getVertexToSnap(line, pointToSplit, tolerance); if (geometryLocation != null) { int segmentIndex = geometryLocation.getSegmentIndex(); Coordinate coord = geometryLocation.getCoordinate(); int index = -1; for (int i = 1; i < coords.length; i++) { index = i - 1; // depends on control dependency: [for], data = [i] if (index < segmentIndex) { firstLine.add(coords[i]); // depends on control dependency: [if], data = [none] } else if (index == segmentIndex) { coord.z = CoordinateUtils.interpolate(coords[i - 1], coords[i], coord); // depends on control dependency: [if], data = [none] firstLine.add(coord); // depends on control dependency: [if], data = [none] secondLine.add(coord); // depends on control dependency: [if], data = [none] if (!coord.equals2D(coords[i])) { secondLine.add(coords[i]); // depends on control dependency: [if], data = [none] } } else { secondLine.add(coords[i]); // depends on control dependency: [if], data = [none] } } LineString lineString1 = FACTORY.createLineString(firstLine.toArray(new Coordinate[0])); LineString lineString2 = FACTORY.createLineString(secondLine.toArray(new Coordinate[0])); return new LineString[]{lineString1, lineString2}; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { void processEvent(DelayQueue<Delayed> delayQueue) { // wait for key to be signaled WatchKey key; try { key = watcher.poll(250, TimeUnit.MILLISECONDS); } catch (InterruptedException | ClosedWatchServiceException x) { return; } if(key == null) { return; } Path dir = keys.get(key); if (dir == null) { return; } for (WatchEvent<?> event : key.pollEvents()) { WatchEvent.Kind<?> kind = event.kind(); if (kind == OVERFLOW) { continue; } // Context for directory entry event is the file name of entry @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path name = ev.context(); Path child = dir.resolve(name); // if (ignore.contains(child)) { return; } if (!ignorePattern.stream().anyMatch( m -> child.getFileSystem().getPathMatcher(m).matches(child.getFileName()))) { delayQueue.add(new WatchDirDelay()); } // if directory is created, and watching recursively, then // register it and its sub-directories if (kind == ENTRY_CREATE) { try { if (Files.isDirectory(child, NOFOLLOW_LINKS)) { registerAll(child); } } catch (IOException x) { } } } // reset key and remove from set if directory no longer accessible boolean valid = key.reset(); if (!valid) { keys.remove(key); // all directories are inaccessible if (keys.isEmpty()) { return; } } } }
public class class_name { void processEvent(DelayQueue<Delayed> delayQueue) { // wait for key to be signaled WatchKey key; try { key = watcher.poll(250, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException | ClosedWatchServiceException x) { return; } // depends on control dependency: [catch], data = [none] if(key == null) { return; // depends on control dependency: [if], data = [none] } Path dir = keys.get(key); if (dir == null) { return; // depends on control dependency: [if], data = [none] } for (WatchEvent<?> event : key.pollEvents()) { WatchEvent.Kind<?> kind = event.kind(); if (kind == OVERFLOW) { continue; } // Context for directory entry event is the file name of entry @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path name = ev.context(); Path child = dir.resolve(name); // if (ignore.contains(child)) { return; // depends on control dependency: [if], data = [none] } if (!ignorePattern.stream().anyMatch( m -> child.getFileSystem().getPathMatcher(m).matches(child.getFileName()))) { delayQueue.add(new WatchDirDelay()); // depends on control dependency: [if], data = [none] } // if directory is created, and watching recursively, then // register it and its sub-directories if (kind == ENTRY_CREATE) { try { if (Files.isDirectory(child, NOFOLLOW_LINKS)) { registerAll(child); // depends on control dependency: [if], data = [none] } } catch (IOException x) { } // depends on control dependency: [catch], data = [none] } } // reset key and remove from set if directory no longer accessible boolean valid = key.reset(); if (!valid) { keys.remove(key); // depends on control dependency: [if], data = [none] // all directories are inaccessible if (keys.isEmpty()) { return; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void applicationStopped(ApplicationInfo appInfo) { MetricRegistry registry = sharedMetricRegistry.getOrCreate(MetricRegistry.Type.APPLICATION.getName()); if (MetricRegistryImpl.class.isInstance(registry)) { MetricRegistryImpl impl = (MetricRegistryImpl) registry; impl.unRegisterApplicationMetrics(appInfo.getDeploymentName()); } } }
public class class_name { @Override public void applicationStopped(ApplicationInfo appInfo) { MetricRegistry registry = sharedMetricRegistry.getOrCreate(MetricRegistry.Type.APPLICATION.getName()); if (MetricRegistryImpl.class.isInstance(registry)) { MetricRegistryImpl impl = (MetricRegistryImpl) registry; impl.unRegisterApplicationMetrics(appInfo.getDeploymentName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Neighbour addNeighbour( SIBUuid8 meUUID, String busId, Transaction transaction) throws SIDiscriminatorSyntaxException, SISelectorSyntaxException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addNeighbour", new Object[] { meUUID, busId}); Neighbour neighbour = null; // Does this Neighbour exist already. synchronized(_neighbours) { if (_neighbours.containsKey(meUUID)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "addNeighbour","Neighbour already exists"); return (Neighbour) _neighbours.get(meUUID); } } // Check that there isn't a matching Neighbour in the // Recovered Neighbours list synchronized(_recoveredNeighbours) { neighbour = (Neighbour)_recoveredNeighbours.get(meUUID); } if (neighbour!=null) { synchronized(_recoveredNeighbours) { _recoveredNeighbours.remove(meUUID); } // Iterate over the list of pubsub output handlers a // and add them back into the match space. HashSet handlers = neighbour.getPubSubOutputHandlers(); if (handlers != null) { Iterator iter = handlers.iterator(); while (iter.hasNext()) { PubSubOutputHandler h = (PubSubOutputHandler)iter.next(); String[] topics = h.getTopics(); if (topics != null) { for (int i = 0; i<topics.length; i++) { MESubscription meSub = neighbour.getSubscription(h.getTopicSpaceUuid(), topics[i]); ControllableProxySubscription sub = _proxyHandler. getMessageProcessor(). getMessageProcessorMatching(). addPubSubOutputHandlerMatchTarget(h, h.getTopicSpaceUuid(), h.getTopics()[i], meSub.isForeignSecuredProxy(), meSub.getMESubUserId()); meSub.setMatchspaceSub(sub); } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Neighbour recovered " + neighbour); } else { try { neighbour = new Neighbour( _proxyHandler, meUUID, busId, this); if (transaction == null) transaction = _proxyHandler.getMessageProcessor().getTXManager().createAutoCommitTransaction(); _proxyHandler.addItemStream(neighbour, transaction); } catch (MessageStoreException e) { // If the MessageStoreException is caught, then this is bad, log a FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbours.addNeighbour", "1:755:1.113", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNeighbour", "SIResourceException"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbours", "1:764:1.113", e, meUUID}); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbours", "1:773:1.113", e, meUUID}, null), e); } } // Add the Neighbour to the list of Neighbours synchronized(_neighbours) { _neighbours.put(meUUID, neighbour); } // Get the BusGroup that this Neighbour belongs to. BusGroup group = findBus(busId); // If no group is found then create one if (group == null) group = createBus(busId); // Add the neighbour to the group group.addNeighbour(neighbour); //Assign the BusGroup to the Neighbour neighbour.setBus(group); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNeighbour", neighbour); return neighbour; } }
public class class_name { protected Neighbour addNeighbour( SIBUuid8 meUUID, String busId, Transaction transaction) throws SIDiscriminatorSyntaxException, SISelectorSyntaxException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addNeighbour", new Object[] { meUUID, busId}); Neighbour neighbour = null; // Does this Neighbour exist already. synchronized(_neighbours) { if (_neighbours.containsKey(meUUID)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit( tc, "addNeighbour","Neighbour already exists"); return (Neighbour) _neighbours.get(meUUID); // depends on control dependency: [if], data = [none] } } // Check that there isn't a matching Neighbour in the // Recovered Neighbours list synchronized(_recoveredNeighbours) { neighbour = (Neighbour)_recoveredNeighbours.get(meUUID); } if (neighbour!=null) { synchronized(_recoveredNeighbours) { _recoveredNeighbours.remove(meUUID); } // Iterate over the list of pubsub output handlers a // and add them back into the match space. HashSet handlers = neighbour.getPubSubOutputHandlers(); if (handlers != null) { Iterator iter = handlers.iterator(); while (iter.hasNext()) { PubSubOutputHandler h = (PubSubOutputHandler)iter.next(); String[] topics = h.getTopics(); if (topics != null) { for (int i = 0; i<topics.length; i++) { MESubscription meSub = neighbour.getSubscription(h.getTopicSpaceUuid(), topics[i]); ControllableProxySubscription sub = _proxyHandler. getMessageProcessor(). getMessageProcessorMatching(). addPubSubOutputHandlerMatchTarget(h, h.getTopicSpaceUuid(), h.getTopics()[i], meSub.isForeignSecuredProxy(), meSub.getMESubUserId()); meSub.setMatchspaceSub(sub); } } } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Neighbour recovered " + neighbour); } else { try { neighbour = new Neighbour( _proxyHandler, meUUID, busId, this); if (transaction == null) transaction = _proxyHandler.getMessageProcessor().getTXManager().createAutoCommitTransaction(); _proxyHandler.addItemStream(neighbour, transaction); } catch (MessageStoreException e) { // If the MessageStoreException is caught, then this is bad, log a FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.proxyhandler.Neighbours.addNeighbour", "1:755:1.113", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNeighbour", "SIResourceException"); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbours", "1:764:1.113", e, meUUID}); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { "com.ibm.ws.sib.processor.proxyhandler.Neighbours", "1:773:1.113", e, meUUID}, null), e); } } // Add the Neighbour to the list of Neighbours synchronized(_neighbours) { _neighbours.put(meUUID, neighbour); } // Get the BusGroup that this Neighbour belongs to. BusGroup group = findBus(busId); // If no group is found then create one if (group == null) group = createBus(busId); // Add the neighbour to the group group.addNeighbour(neighbour); //Assign the BusGroup to the Neighbour neighbour.setBus(group); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addNeighbour", neighbour); return neighbour; } }
public class class_name { @Override public void reset(final long mNodeKey) { super.reset(mNodeKey); if (mDupSet != null) { mDupSet.clear(); } if (mOp1 != null) { mOp1.reset(mNodeKey); } if (mOp2 != null) { mOp2.reset(mNodeKey); } } }
public class class_name { @Override public void reset(final long mNodeKey) { super.reset(mNodeKey); if (mDupSet != null) { mDupSet.clear(); // depends on control dependency: [if], data = [none] } if (mOp1 != null) { mOp1.reset(mNodeKey); // depends on control dependency: [if], data = [none] } if (mOp2 != null) { mOp2.reset(mNodeKey); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean checkTetrahedral(int u, int[] mapping) { int v = mapping[u]; if (targetTypes[v] != null && targetTypes[v] != Type.Tetrahedral) return false; ITetrahedralChirality queryElement = (ITetrahedralChirality) queryElements[u]; ITetrahedralChirality targetElement = (ITetrahedralChirality) targetElements[v]; IAtom queryAtom = query.getAtom(u); IAtom targetAtom = target.getAtom(v); int[] us = neighbors(queryElement, queryMap); us = map(u, v, us, mapping); int p = permutationParity(us); // check if unspecified was allowed if (targetTypes[v] == null) { if (queryAtom instanceof SMARTSAtom) return ((SMARTSAtom) queryAtom).chiralityMatches(targetAtom, 0, p); else return ((QueryAtom)queryAtom).getExpression().matches(targetAtom, 0); } // target was non-tetrahedral if (targetTypes[v] != Type.Tetrahedral) return false; int[] vs = neighbors(targetElement, targetMap); int q = permutationParity(vs) * parity(targetElement.getStereo()); if (queryAtom instanceof SMARTSAtom) return ((SMARTSAtom) queryAtom).chiralityMatches(targetAtom, q, p); else { q *= p; if (q < 0) return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, IStereoElement.LEFT); else if (q > 0) return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, IStereoElement.RIGHT); else return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, 0); } } }
public class class_name { private boolean checkTetrahedral(int u, int[] mapping) { int v = mapping[u]; if (targetTypes[v] != null && targetTypes[v] != Type.Tetrahedral) return false; ITetrahedralChirality queryElement = (ITetrahedralChirality) queryElements[u]; ITetrahedralChirality targetElement = (ITetrahedralChirality) targetElements[v]; IAtom queryAtom = query.getAtom(u); IAtom targetAtom = target.getAtom(v); int[] us = neighbors(queryElement, queryMap); us = map(u, v, us, mapping); int p = permutationParity(us); // check if unspecified was allowed if (targetTypes[v] == null) { if (queryAtom instanceof SMARTSAtom) return ((SMARTSAtom) queryAtom).chiralityMatches(targetAtom, 0, p); else return ((QueryAtom)queryAtom).getExpression().matches(targetAtom, 0); } // target was non-tetrahedral if (targetTypes[v] != Type.Tetrahedral) return false; int[] vs = neighbors(targetElement, targetMap); int q = permutationParity(vs) * parity(targetElement.getStereo()); if (queryAtom instanceof SMARTSAtom) return ((SMARTSAtom) queryAtom).chiralityMatches(targetAtom, q, p); else { q *= p; // depends on control dependency: [if], data = [none] if (q < 0) return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, IStereoElement.LEFT); else if (q > 0) return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, IStereoElement.RIGHT); else return ((QueryAtom) queryAtom).getExpression().matches(targetAtom, 0); } } }
public class class_name { public boolean matchRemoteEvent(final TenantAwareEvent tenantAwareEvent) { if (!(tenantAwareEvent instanceof RemoteIdEvent) || entityClass == null || entityIds == null) { return false; } final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent; try { final Class<?> remoteEntityClass = Class.forName(remoteIdEvent.getEntityClass()); return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId()); } catch (final ClassNotFoundException e) { LOG.error("Entity Class of remoteIdEvent cannot be found", e); return false; } } }
public class class_name { public boolean matchRemoteEvent(final TenantAwareEvent tenantAwareEvent) { if (!(tenantAwareEvent instanceof RemoteIdEvent) || entityClass == null || entityIds == null) { return false; // depends on control dependency: [if], data = [none] } final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent; try { final Class<?> remoteEntityClass = Class.forName(remoteIdEvent.getEntityClass()); return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId()); // depends on control dependency: [try], data = [none] } catch (final ClassNotFoundException e) { LOG.error("Entity Class of remoteIdEvent cannot be found", e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setCondition( ICondition condition) { super.setCondition( condition); // Reset ancestry for all descendants. if( members_ != null) { for( IVarDef member : members_) { member.setParent( this); } } } }
public class class_name { public void setCondition( ICondition condition) { super.setCondition( condition); // Reset ancestry for all descendants. if( members_ != null) { for( IVarDef member : members_) { member.setParent( this); // depends on control dependency: [for], data = [member] } } } }
public class class_name { @Override protected void configure() { bindListener( getTypeMatcher(), new AbstractMethodTypeListener( getAnnotationType() ) { @Override protected <I> void hear( final Method method, TypeEncounter<I> encounter ) { encounter.register( new InjectionListener<I>() { public void afterInjection( I injectee ) { try { method.invoke( injectee ); } catch ( IllegalArgumentException e ) { // should not happen, anyway... throw new ProvisionException( format( "Method @%s %s requires arguments", getAnnotationType().getName(), method ), e ); } catch ( IllegalAccessException e ) { throw new ProvisionException( format( "Impossible to access to @%s %s on %s", getAnnotationType().getName(), method, injectee ), e ); } catch ( InvocationTargetException e ) { throw new ProvisionException( format( "An error occurred while invoking @%s %s on %s", getAnnotationType().getName(), method, injectee ), e.getTargetException() ); } } } ); } } ); } }
public class class_name { @Override protected void configure() { bindListener( getTypeMatcher(), new AbstractMethodTypeListener( getAnnotationType() ) { @Override protected <I> void hear( final Method method, TypeEncounter<I> encounter ) { encounter.register( new InjectionListener<I>() { public void afterInjection( I injectee ) { try { method.invoke( injectee ); // depends on control dependency: [try], data = [none] } catch ( IllegalArgumentException e ) { // should not happen, anyway... throw new ProvisionException( format( "Method @%s %s requires arguments", getAnnotationType().getName(), method ), e ); } // depends on control dependency: [catch], data = [none] catch ( IllegalAccessException e ) { throw new ProvisionException( format( "Impossible to access to @%s %s on %s", getAnnotationType().getName(), method, injectee ), e ); } // depends on control dependency: [catch], data = [none] catch ( InvocationTargetException e ) { throw new ProvisionException( format( "An error occurred while invoking @%s %s on %s", getAnnotationType().getName(), method, injectee ), e.getTargetException() ); } // depends on control dependency: [catch], data = [none] } } ); } } ); } }
public class class_name { void returnDBConnection(DBConn dbConn) { if (dbConn == null) { return; } if (!getState().isRunning()) { dbConn.close(); // from straggler thread; close and discard } else if (dbConn.isFailed()) { // Purge all connections in case a Cassandra node is now dead. dbConn.close(); m_logger.info("Purging database connection pool"); purgeAllConnections(); } else { returnGoodConnection(dbConn); } } }
public class class_name { void returnDBConnection(DBConn dbConn) { if (dbConn == null) { return; // depends on control dependency: [if], data = [none] } if (!getState().isRunning()) { dbConn.close(); // from straggler thread; close and discard // depends on control dependency: [if], data = [none] } else if (dbConn.isFailed()) { // Purge all connections in case a Cassandra node is now dead. dbConn.close(); // depends on control dependency: [if], data = [none] m_logger.info("Purging database connection pool"); // depends on control dependency: [if], data = [none] purgeAllConnections(); // depends on control dependency: [if], data = [none] } else { returnGoodConnection(dbConn); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected double[] readAttributeDouble2(Attribute att) { if (att == null) return null; double[] val = new double[2]; if (att.isString()) { StringTokenizer stoke = new StringTokenizer(att.getStringValue()); val[0] = Double.parseDouble(stoke.nextToken()); val[1] = stoke.hasMoreTokens() ? Double.parseDouble(stoke.nextToken()) : val[0]; } else { val[0] = att.getNumericValue().doubleValue(); val[1] = (att.getLength() > 1) ? att.getNumericValue(1).doubleValue() : val[0]; } return val; } }
public class class_name { protected double[] readAttributeDouble2(Attribute att) { if (att == null) return null; double[] val = new double[2]; if (att.isString()) { StringTokenizer stoke = new StringTokenizer(att.getStringValue()); val[0] = Double.parseDouble(stoke.nextToken()); // depends on control dependency: [if], data = [none] val[1] = stoke.hasMoreTokens() ? Double.parseDouble(stoke.nextToken()) : val[0]; // depends on control dependency: [if], data = [none] } else { val[0] = att.getNumericValue().doubleValue(); // depends on control dependency: [if], data = [none] val[1] = (att.getLength() > 1) ? att.getNumericValue(1).doubleValue() : val[0]; // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { @Override public AbstractDraweeController build() { validate(); // if only a low-res request is specified, treat it as a final request. if (mImageRequest == null && mMultiImageRequests == null && mLowResImageRequest != null) { mImageRequest = mLowResImageRequest; mLowResImageRequest = null; } return buildController(); } }
public class class_name { @Override public AbstractDraweeController build() { validate(); // if only a low-res request is specified, treat it as a final request. if (mImageRequest == null && mMultiImageRequests == null && mLowResImageRequest != null) { mImageRequest = mLowResImageRequest; // depends on control dependency: [if], data = [none] mLowResImageRequest = null; // depends on control dependency: [if], data = [none] } return buildController(); } }
public class class_name { public static <A extends Annotation> List<A> getMethodParameterAnnotations(Method method, int index, Class<A> annotationClass) { Annotation[][] parametersAnnotations = method.getParameterAnnotations(); Annotation[] parameterAnnotations = parametersAnnotations[index]; List<A> foundAnnotations = new ArrayList<A>(); for (Annotation annotation : parameterAnnotations) { if (annotationClass.isInstance(annotation)) { foundAnnotations.add((A) annotation); } } return foundAnnotations; } }
public class class_name { public static <A extends Annotation> List<A> getMethodParameterAnnotations(Method method, int index, Class<A> annotationClass) { Annotation[][] parametersAnnotations = method.getParameterAnnotations(); Annotation[] parameterAnnotations = parametersAnnotations[index]; List<A> foundAnnotations = new ArrayList<A>(); for (Annotation annotation : parameterAnnotations) { if (annotationClass.isInstance(annotation)) { foundAnnotations.add((A) annotation); // depends on control dependency: [if], data = [none] } } return foundAnnotations; } }
public class class_name { public List<CmsDetailPageInfo> getAllDetailPages(boolean update) { CmsADEConfigData parentData = parent(); List<CmsDetailPageInfo> parentDetailPages; if (parentData != null) { parentDetailPages = parentData.getAllDetailPages(false); } else { parentDetailPages = Collections.emptyList(); } List<CmsDetailPageInfo> result = mergeDetailPages(parentDetailPages, m_data.getOwnDetailPages()); if (update) { result = updateUris(result); } return result; } }
public class class_name { public List<CmsDetailPageInfo> getAllDetailPages(boolean update) { CmsADEConfigData parentData = parent(); List<CmsDetailPageInfo> parentDetailPages; if (parentData != null) { parentDetailPages = parentData.getAllDetailPages(false); // depends on control dependency: [if], data = [none] } else { parentDetailPages = Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<CmsDetailPageInfo> result = mergeDetailPages(parentDetailPages, m_data.getOwnDetailPages()); if (update) { result = updateUris(result); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public <T> T getProperty(final String key) { if (key == null) return null; final OrientBaseGraph graph = getGraph(); if (key.equals("_class")) return (T) ODocumentInternal.getImmutableSchemaClass(getRecord()).getName(); else if (key.equals("_version")) return (T) new Integer(getRecord().getVersion()); else if (key.equals("_rid")) return (T) rawElement.getIdentity().toString(); final ODocument record = getRecord(); if (record == null) // NO RECORD return null; final Object fieldValue = record.field(key); if (graph != null && fieldValue instanceof OIdentifiable && !(((OIdentifiable) fieldValue).getRecord() instanceof OBlob)) { ODocument fieldRecord = ((OIdentifiable) fieldValue).getRecord(); if (fieldRecord != null) { final OClass schemaClass = fieldRecord.getSchemaClass(); if (schemaClass != null && (schemaClass.isVertexType() || schemaClass.isEdgeType())) { // CONVERT IT TO VERTEX/EDGE return (T) graph.getElement(fieldValue); } } return (T) fieldValue; } else if (!(fieldValue instanceof Map) && OMultiValue.isMultiValue(fieldValue) && OMultiValue .getFirstValue(fieldValue) instanceof OIdentifiable) { final OIdentifiable firstValue = (OIdentifiable) OMultiValue.getFirstValue(fieldValue); if (firstValue instanceof ODocument) { final ODocument document = (ODocument) firstValue; /// clusterId -2 Is considered a projection so does not have a class but is a not embedded record if (document.getIdentity().getClusterId() != -2 && (document.isEmbedded() || ODocumentInternal.getImmutableSchemaClass(document) == null)) return (T) fieldValue; } if (graph != null) // CONVERT IT TO ITERABLE<VERTEX/EDGE> return (T) new OrientElementIterable<OrientElement>(graph, OMultiValue.getMultiValueIterable(fieldValue)); } return (T) fieldValue; } }
public class class_name { @Override public <T> T getProperty(final String key) { if (key == null) return null; final OrientBaseGraph graph = getGraph(); if (key.equals("_class")) return (T) ODocumentInternal.getImmutableSchemaClass(getRecord()).getName(); else if (key.equals("_version")) return (T) new Integer(getRecord().getVersion()); else if (key.equals("_rid")) return (T) rawElement.getIdentity().toString(); final ODocument record = getRecord(); if (record == null) // NO RECORD return null; final Object fieldValue = record.field(key); if (graph != null && fieldValue instanceof OIdentifiable && !(((OIdentifiable) fieldValue).getRecord() instanceof OBlob)) { ODocument fieldRecord = ((OIdentifiable) fieldValue).getRecord(); if (fieldRecord != null) { final OClass schemaClass = fieldRecord.getSchemaClass(); if (schemaClass != null && (schemaClass.isVertexType() || schemaClass.isEdgeType())) { // CONVERT IT TO VERTEX/EDGE return (T) graph.getElement(fieldValue); // depends on control dependency: [if], data = [none] } } return (T) fieldValue; // depends on control dependency: [if], data = [none] } else if (!(fieldValue instanceof Map) && OMultiValue.isMultiValue(fieldValue) && OMultiValue .getFirstValue(fieldValue) instanceof OIdentifiable) { final OIdentifiable firstValue = (OIdentifiable) OMultiValue.getFirstValue(fieldValue); if (firstValue instanceof ODocument) { final ODocument document = (ODocument) firstValue; /// clusterId -2 Is considered a projection so does not have a class but is a not embedded record if (document.getIdentity().getClusterId() != -2 && (document.isEmbedded() || ODocumentInternal.getImmutableSchemaClass(document) == null)) return (T) fieldValue; } if (graph != null) // CONVERT IT TO ITERABLE<VERTEX/EDGE> return (T) new OrientElementIterable<OrientElement>(graph, OMultiValue.getMultiValueIterable(fieldValue)); } return (T) fieldValue; } }
public class class_name { public void abortScheduling(String requestId, boolean force) { if (trace) { log.tracef("Request[%s] abort scheduling", requestId); } ScheduledRequest scheduledRequest = scheduledRequests.get(requestId); if (scheduledRequest != null && (scheduledRequest.request.isDone() || force)) { scheduledRequest.scheduledFuture.cancel(false); scheduledRequests.remove(requestId); } } }
public class class_name { public void abortScheduling(String requestId, boolean force) { if (trace) { log.tracef("Request[%s] abort scheduling", requestId); // depends on control dependency: [if], data = [none] } ScheduledRequest scheduledRequest = scheduledRequests.get(requestId); if (scheduledRequest != null && (scheduledRequest.request.isDone() || force)) { scheduledRequest.scheduledFuture.cancel(false); // depends on control dependency: [if], data = [none] scheduledRequests.remove(requestId); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isXlsx(InputStream in) { if (false == in.markSupported()) { in = new BufferedInputStream(in); } try { return FileMagic.valueOf(in) == FileMagic.OOXML; } catch (IOException e) { throw new IORuntimeException(e); } } }
public class class_name { public static boolean isXlsx(InputStream in) { if (false == in.markSupported()) { in = new BufferedInputStream(in); // depends on control dependency: [if], data = [none] } try { return FileMagic.valueOf(in) == FileMagic.OOXML; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IORuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String[] getDependencyCells(final Dependency dependency, final License license) { final List<String> cells = new ArrayList<>(); if(decorator.getShowSources()){ cells.add(dependency.getSourceName()); } if(decorator.getShowSourcesVersion()){ cells.add(dependency.getSourceVersion()); } if(decorator.getShowTargets()){ cells.add(dependency.getTarget().getGavc()); } if(decorator.getShowTargetsDownloadUrl()){ cells.add(dependency.getTarget().getDownloadUrl()); } if(decorator.getShowTargetsSize()){ cells.add(dependency.getTarget().getSize()); } if(decorator.getShowScopes()){ cells.add(dependency.getScope().name()); } if(decorator.getShowLicenses()){ cells.add(license.getName()); } if(decorator.getShowLicensesLongName()){ cells.add(license.getLongName()); } if(decorator.getShowLicensesUrl()){ cells.add(license.getUrl()); } if(decorator.getShowLicensesComment()){ cells.add(license.getComments()); } return cells.toArray(new String[cells.size()]); } }
public class class_name { private String[] getDependencyCells(final Dependency dependency, final License license) { final List<String> cells = new ArrayList<>(); if(decorator.getShowSources()){ cells.add(dependency.getSourceName()); // depends on control dependency: [if], data = [none] } if(decorator.getShowSourcesVersion()){ cells.add(dependency.getSourceVersion()); // depends on control dependency: [if], data = [none] } if(decorator.getShowTargets()){ cells.add(dependency.getTarget().getGavc()); // depends on control dependency: [if], data = [none] } if(decorator.getShowTargetsDownloadUrl()){ cells.add(dependency.getTarget().getDownloadUrl()); // depends on control dependency: [if], data = [none] } if(decorator.getShowTargetsSize()){ cells.add(dependency.getTarget().getSize()); // depends on control dependency: [if], data = [none] } if(decorator.getShowScopes()){ cells.add(dependency.getScope().name()); // depends on control dependency: [if], data = [none] } if(decorator.getShowLicenses()){ cells.add(license.getName()); // depends on control dependency: [if], data = [none] } if(decorator.getShowLicensesLongName()){ cells.add(license.getLongName()); // depends on control dependency: [if], data = [none] } if(decorator.getShowLicensesUrl()){ cells.add(license.getUrl()); // depends on control dependency: [if], data = [none] } if(decorator.getShowLicensesComment()){ cells.add(license.getComments()); // depends on control dependency: [if], data = [none] } return cells.toArray(new String[cells.size()]); } }
public class class_name { public ByteBuffer encode(Packet packet, GroupContext groupContext, ChannelContext channelContext) { SimplePacket helloPacket = (SimplePacket) packet; byte[] body = helloPacket.getBody(); int bodyLen = 0; if(body != null){ bodyLen = body.length; } //Bytebuffer总长度 = 消息头+消息体的长度 int allLen = SimplePacket.HEADER_LENGTH+bodyLen; //创建新的Bytebuffer ByteBuffer buf = ByteBuffer.allocate(allLen); //设置字节序 buf.order(groupContext.getByteOrder()); //写入消息头 buf.putInt(bodyLen); //写入消息体 if(body != null){ buf.put(body); } return buf; } }
public class class_name { public ByteBuffer encode(Packet packet, GroupContext groupContext, ChannelContext channelContext) { SimplePacket helloPacket = (SimplePacket) packet; byte[] body = helloPacket.getBody(); int bodyLen = 0; if(body != null){ bodyLen = body.length; // depends on control dependency: [if], data = [none] } //Bytebuffer总长度 = 消息头+消息体的长度 int allLen = SimplePacket.HEADER_LENGTH+bodyLen; //创建新的Bytebuffer ByteBuffer buf = ByteBuffer.allocate(allLen); //设置字节序 buf.order(groupContext.getByteOrder()); //写入消息头 buf.putInt(bodyLen); //写入消息体 if(body != null){ buf.put(body); // depends on control dependency: [if], data = [(body] } return buf; } }
public class class_name { public static int getIntArg(CommandLine cl, Option option, int defaultValue) { int arg = defaultValue; if (cl.hasOption(option.getLongOpt())) { String argOption = cl.getOptionValue(option.getLongOpt()); arg = Integer.parseInt(argOption); } return arg; } }
public class class_name { public static int getIntArg(CommandLine cl, Option option, int defaultValue) { int arg = defaultValue; if (cl.hasOption(option.getLongOpt())) { String argOption = cl.getOptionValue(option.getLongOpt()); arg = Integer.parseInt(argOption); // depends on control dependency: [if], data = [none] } return arg; } }
public class class_name { public Query getPKQuery(Identity oid) { Object[] values = oid.getPrimaryKeyValues(); ClassDescriptor cld = pb.getClassDescriptor(oid.getObjectsTopLevelClass()); FieldDescriptor[] fields = cld.getPkFields(); Criteria criteria = new Criteria(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fld = fields[i]; criteria.addEqualTo(fld.getAttributeName(), values[i]); } return QueryFactory.newQuery(cld.getClassOfObject(), criteria); } }
public class class_name { public Query getPKQuery(Identity oid) { Object[] values = oid.getPrimaryKeyValues(); ClassDescriptor cld = pb.getClassDescriptor(oid.getObjectsTopLevelClass()); FieldDescriptor[] fields = cld.getPkFields(); Criteria criteria = new Criteria(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fld = fields[i]; criteria.addEqualTo(fld.getAttributeName(), values[i]); // depends on control dependency: [for], data = [i] } return QueryFactory.newQuery(cld.getClassOfObject(), criteria); } }
public class class_name { public EClass getESU() { if (esuEClass == null) { esuEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(328); } return esuEClass; } }
public class class_name { public EClass getESU() { if (esuEClass == null) { esuEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(328); // depends on control dependency: [if], data = [none] } return esuEClass; } }
public class class_name { private void computeAppCount() { m_appCount = m_appConfigurations.size(); for (CmsAppCategoryNode child : m_children) { child.computeAppCount(); m_appCount += child.m_appCount; } } }
public class class_name { private void computeAppCount() { m_appCount = m_appConfigurations.size(); for (CmsAppCategoryNode child : m_children) { child.computeAppCount(); // depends on control dependency: [for], data = [child] m_appCount += child.m_appCount; // depends on control dependency: [for], data = [child] } } }
public class class_name { public static Optional<Boolean> toBoolean(Object arg) { if ( arg instanceof Boolean ) { return Optional.of( (Boolean) arg ); } else if(arg instanceof String) { if("true".equalsIgnoreCase( (String)arg )) { return Optional.of( Boolean.TRUE ); } else if("false".equalsIgnoreCase( (String)arg )) { return Optional.of( Boolean.FALSE ); } } return Optional.empty(); } }
public class class_name { public static Optional<Boolean> toBoolean(Object arg) { if ( arg instanceof Boolean ) { return Optional.of( (Boolean) arg ); // depends on control dependency: [if], data = [none] } else if(arg instanceof String) { if("true".equalsIgnoreCase( (String)arg )) { return Optional.of( Boolean.TRUE ); // depends on control dependency: [if], data = [none] } else if("false".equalsIgnoreCase( (String)arg )) { return Optional.of( Boolean.FALSE ); // depends on control dependency: [if], data = [none] } } return Optional.empty(); } }
public class class_name { public Deferred<ArrayList<Boolean>> processTimeseriesMeta(final TSMeta meta, final boolean is_testing) { if (tree == null || tree.getTreeId() < 1) { throw new IllegalArgumentException( "The tree has not been set or is invalid"); } if (meta == null || meta.getTSUID() == null || meta.getTSUID().isEmpty()) { throw new IllegalArgumentException("Missing TSUID"); } // reset the state in case the caller is reusing this object resetState(); this.meta = meta; // setup a list of deferreds to return to the caller so they can wait for // storage calls to complete final ArrayList<Deferred<Boolean>> storage_calls = new ArrayList<Deferred<Boolean>>(); /** * Runs the local TSMeta object through the tree's rule set after the root * branch has been set. This can be called after loading or creating the * root or if the root is set, it's called directly from this method. The * response is the deferred group for the caller to wait on. */ final class ProcessCB implements Callback<Deferred<ArrayList<Boolean>>, Branch> { /** * Process the TSMeta using the provided branch as the root. * @param branch The root branch to use * @return A group of deferreds to wait on for storage call completion */ @Override public Deferred<ArrayList<Boolean>> call(final Branch branch) throws Exception { // start processing with the depth set to 1 since we'll start adding // branches to the root processRuleset(branch, 1); if (not_matched != null && !not_matched.isEmpty() && tree.getStrictMatch()) { // if the tree has strict matching enabled and one or more levels // failed to match, then we don't want to store the resulting branches, // only the TSUID that failed to match testMessage( "TSUID failed to match one or more rule levels, will not add: " + meta); if (!is_testing && tree.getNotMatched() != null && !tree.getNotMatched().isEmpty()) { tree.addNotMatched(meta.getTSUID(), not_matched); storage_calls.add(tree.flushNotMatched(tsdb)); } } else if (current_branch == null) { // something was wrong with the rule set that resulted in an empty // branch. Since this is likely a user error, log it instead of // throwing an exception LOG.warn("Processed TSUID [" + meta + "] resulted in a null branch on tree: " + tree.getTreeId()); } else if (!is_testing) { // iterate through the generated tree store the tree and leaves, // adding the parent path as we go Branch cb = current_branch; Map<Integer, String> path = branch.getPath(); cb.prependParentPath(path); while (cb != null) { if (cb.getLeaves() != null || !processed_branches.containsKey(cb.getBranchId())) { LOG.debug("Flushing branch to storage: " + cb); /** * Since we need to return a deferred group and we can't just * group the branch storage deferreds with the not-matched and * collisions, we need to implement a callback that will wait for * the results of the branch stores and group that with the rest. * This CB will return false if ANY of the branches failed to * be written. */ final class BranchCB implements Callback<Deferred<Boolean>, ArrayList<Boolean>> { @Override public Deferred<Boolean> call(final ArrayList<Boolean> deferreds) throws Exception { for (Boolean success : deferreds) { if (!success) { return Deferred.fromResult(false); } } return Deferred.fromResult(true); } } final Deferred<Boolean> deferred = cb.storeBranch(tsdb, tree, true) .addCallbackDeferring(new BranchCB()); storage_calls.add(deferred); processed_branches.put(cb.getBranchId(), true); } // move to the next branch in the tree if (cb.getBranches() == null) { cb = null; } else { path = cb.getPath(); // we should only have one child if we're building a tree, so we // only need to grab the first one cb = cb.getBranches().first(); cb.prependParentPath(path); } } // if we have collisions, flush em if (tree.getCollisions() != null && !tree.getCollisions().isEmpty()) { storage_calls.add(tree.flushCollisions(tsdb)); } } else { // we are testing, so compile the branch paths so that the caller can // fetch the root branch object and return it from an RPC call Branch cb = current_branch; branch.addChild(cb); Map<Integer, String> path = branch.getPath(); cb.prependParentPath(path); while (cb != null) { if (cb.getBranches() == null) { cb = null; } else { path = cb.getPath(); // we should only have one child if we're building cb = cb.getBranches().first(); cb.prependParentPath(path); } } } LOG.debug("Completed processing meta [" + meta + "] through tree: " + tree.getTreeId()); return Deferred.group(storage_calls); } } /** * Called after loading or initializing the root and continues the chain * by passing the root onto the ProcessCB */ final class LoadRootCB implements Callback<Deferred<ArrayList<Boolean>>, Branch> { @Override public Deferred<ArrayList<Boolean>> call(final Branch root) throws Exception { TreeBuilder.this.root = root; return new ProcessCB().call(root); } } LOG.debug("Processing meta [" + meta + "] through tree: " + tree.getTreeId()); if (root == null) { // if this is a new object or the root has been reset, we need to fetch // it from storage or initialize it LOG.debug("Fetching root branch for tree: " + tree.getTreeId()); return loadOrInitializeRoot(tsdb, tree.getTreeId(), is_testing) .addCallbackDeferring(new LoadRootCB()); } else { // the root has been set, so just reuse it try { return new ProcessCB().call(root); } catch (Exception e) { throw new RuntimeException("Failed to initiate processing", e); } } } }
public class class_name { public Deferred<ArrayList<Boolean>> processTimeseriesMeta(final TSMeta meta, final boolean is_testing) { if (tree == null || tree.getTreeId() < 1) { throw new IllegalArgumentException( "The tree has not been set or is invalid"); } if (meta == null || meta.getTSUID() == null || meta.getTSUID().isEmpty()) { throw new IllegalArgumentException("Missing TSUID"); } // reset the state in case the caller is reusing this object resetState(); this.meta = meta; // setup a list of deferreds to return to the caller so they can wait for // storage calls to complete final ArrayList<Deferred<Boolean>> storage_calls = new ArrayList<Deferred<Boolean>>(); /** * Runs the local TSMeta object through the tree's rule set after the root * branch has been set. This can be called after loading or creating the * root or if the root is set, it's called directly from this method. The * response is the deferred group for the caller to wait on. */ final class ProcessCB implements Callback<Deferred<ArrayList<Boolean>>, Branch> { /** * Process the TSMeta using the provided branch as the root. * @param branch The root branch to use * @return A group of deferreds to wait on for storage call completion */ @Override public Deferred<ArrayList<Boolean>> call(final Branch branch) throws Exception { // start processing with the depth set to 1 since we'll start adding // branches to the root processRuleset(branch, 1); if (not_matched != null && !not_matched.isEmpty() && tree.getStrictMatch()) { // if the tree has strict matching enabled and one or more levels // failed to match, then we don't want to store the resulting branches, // only the TSUID that failed to match testMessage( "TSUID failed to match one or more rule levels, will not add: " + meta); if (!is_testing && tree.getNotMatched() != null && !tree.getNotMatched().isEmpty()) { tree.addNotMatched(meta.getTSUID(), not_matched); storage_calls.add(tree.flushNotMatched(tsdb)); } } else if (current_branch == null) { // something was wrong with the rule set that resulted in an empty // branch. Since this is likely a user error, log it instead of // throwing an exception LOG.warn("Processed TSUID [" + meta + "] resulted in a null branch on tree: " + tree.getTreeId()); } else if (!is_testing) { // iterate through the generated tree store the tree and leaves, // adding the parent path as we go Branch cb = current_branch; Map<Integer, String> path = branch.getPath(); cb.prependParentPath(path); while (cb != null) { if (cb.getLeaves() != null || !processed_branches.containsKey(cb.getBranchId())) { LOG.debug("Flushing branch to storage: " + cb); /** * Since we need to return a deferred group and we can't just * group the branch storage deferreds with the not-matched and * collisions, we need to implement a callback that will wait for * the results of the branch stores and group that with the rest. * This CB will return false if ANY of the branches failed to * be written. */ final class BranchCB implements Callback<Deferred<Boolean>, ArrayList<Boolean>> { @Override public Deferred<Boolean> call(final ArrayList<Boolean> deferreds) throws Exception { for (Boolean success : deferreds) { if (!success) { return Deferred.fromResult(false); // depends on control dependency: [if], data = [none] } } return Deferred.fromResult(true); } } final Deferred<Boolean> deferred = cb.storeBranch(tsdb, tree, true) .addCallbackDeferring(new BranchCB()); storage_calls.add(deferred); processed_branches.put(cb.getBranchId(), true); } // move to the next branch in the tree if (cb.getBranches() == null) { cb = null; } else { path = cb.getPath(); // we should only have one child if we're building a tree, so we // only need to grab the first one cb = cb.getBranches().first(); cb.prependParentPath(path); } } // if we have collisions, flush em if (tree.getCollisions() != null && !tree.getCollisions().isEmpty()) { storage_calls.add(tree.flushCollisions(tsdb)); } } else { // we are testing, so compile the branch paths so that the caller can // fetch the root branch object and return it from an RPC call Branch cb = current_branch; branch.addChild(cb); Map<Integer, String> path = branch.getPath(); cb.prependParentPath(path); while (cb != null) { if (cb.getBranches() == null) { cb = null; } else { path = cb.getPath(); // we should only have one child if we're building cb = cb.getBranches().first(); cb.prependParentPath(path); } } } LOG.debug("Completed processing meta [" + meta + "] through tree: " + tree.getTreeId()); return Deferred.group(storage_calls); } } /** * Called after loading or initializing the root and continues the chain * by passing the root onto the ProcessCB */ final class LoadRootCB implements Callback<Deferred<ArrayList<Boolean>>, Branch> { @Override public Deferred<ArrayList<Boolean>> call(final Branch root) throws Exception { TreeBuilder.this.root = root; return new ProcessCB().call(root); } } LOG.debug("Processing meta [" + meta + "] through tree: " + tree.getTreeId()); if (root == null) { // if this is a new object or the root has been reset, we need to fetch // it from storage or initialize it LOG.debug("Fetching root branch for tree: " + tree.getTreeId()); return loadOrInitializeRoot(tsdb, tree.getTreeId(), is_testing) .addCallbackDeferring(new LoadRootCB()); } else { // the root has been set, so just reuse it try { return new ProcessCB().call(root); } catch (Exception e) { throw new RuntimeException("Failed to initiate processing", e); } } } }
public class class_name { protected Object evaluate(InputStream inStrm, String scriptName) { InputStreamReader streamReader = new InputStreamReader(inStrm, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(streamReader); StringBuilder sb = new StringBuilder(); String line; try { while ((line = br.readLine()) != null) { sb.append(line).append("\n"); } } catch (IOException e) { throw new RuntimeException("error while reading javascript from stream", e); } String script = sb.toString(); return evaluate(script, scriptName); } }
public class class_name { protected Object evaluate(InputStream inStrm, String scriptName) { InputStreamReader streamReader = new InputStreamReader(inStrm, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(streamReader); StringBuilder sb = new StringBuilder(); String line; try { while ((line = br.readLine()) != null) { sb.append(line).append("\n"); // depends on control dependency: [while], data = [none] } } catch (IOException e) { throw new RuntimeException("error while reading javascript from stream", e); } // depends on control dependency: [catch], data = [none] String script = sb.toString(); return evaluate(script, scriptName); } }
public class class_name { public static IndexedContainer getRoleContainerForUser(CmsObject cms, CmsUser user, String captionPropertyName) { IndexedContainer result = new IndexedContainer(); result.addContainerProperty(captionPropertyName, String.class, ""); try { List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, user.getOuFqn(), false); CmsRole.applySystemRoleOrder(roles); for (CmsRole role : roles) { Item item = result.addItem(role); item.getItemProperty(captionPropertyName).setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale())); } } catch (CmsException e) { LOG.error("Unabel to read roles for user", e); } return result; } }
public class class_name { public static IndexedContainer getRoleContainerForUser(CmsObject cms, CmsUser user, String captionPropertyName) { IndexedContainer result = new IndexedContainer(); result.addContainerProperty(captionPropertyName, String.class, ""); try { List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, user.getOuFqn(), false); CmsRole.applySystemRoleOrder(roles); // depends on control dependency: [try], data = [none] for (CmsRole role : roles) { Item item = result.addItem(role); item.getItemProperty(captionPropertyName).setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale())); // depends on control dependency: [for], data = [role] } } catch (CmsException e) { LOG.error("Unabel to read roles for user", e); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { private void writeFileStatus(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileStatus", new java.lang.Object[] { this, new Boolean(maintainPosition) }); if (_logFileHeader.status() == LogFileHeader.STATUS_INVALID) { if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "InternalLogException"); throw new InternalLogException(null); } try { int currentFilePointer = 0; if (maintainPosition) { // If the caller wishes the file pointer's current // position to be maintained cache it's position // here so that it can be reset once the header // has been written. currentFilePointer = _fileBuffer.position(); } // Move the buffer's pointer to the header status // field and perform a forced write of the new status _fileBuffer.position(STATUS_FIELD_FILE_OFFSET); _fileBuffer.putInt(_logFileHeader.status()); force(); if (maintainPosition) { // Reinstate the fileBuffer's pointer to its original position. _fileBuffer.position(currentFilePointer); } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus", "797", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "WriteOperationFailedException"); throw new WriteOperationFailedException(exc); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus"); } }
public class class_name { private void writeFileStatus(boolean maintainPosition) throws InternalLogException { if (tc.isEntryEnabled()) Tr.entry(tc, "writeFileStatus", new java.lang.Object[] { this, new Boolean(maintainPosition) }); if (_logFileHeader.status() == LogFileHeader.STATUS_INVALID) { if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "InternalLogException"); throw new InternalLogException(null); } try { int currentFilePointer = 0; if (maintainPosition) { // If the caller wishes the file pointer's current // position to be maintained cache it's position // here so that it can be reset once the header // has been written. currentFilePointer = _fileBuffer.position(); // depends on control dependency: [if], data = [none] } // Move the buffer's pointer to the header status // field and perform a forced write of the new status _fileBuffer.position(STATUS_FIELD_FILE_OFFSET); // depends on control dependency: [try], data = [none] _fileBuffer.putInt(_logFileHeader.status()); // depends on control dependency: [try], data = [none] force(); // depends on control dependency: [try], data = [none] if (maintainPosition) { // Reinstate the fileBuffer's pointer to its original position. _fileBuffer.position(currentFilePointer); // depends on control dependency: [if], data = [none] } } catch (Throwable exc) { FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogFileHandle.writeFileStatus", "797", this); if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus", "WriteOperationFailedException"); throw new WriteOperationFailedException(exc); } // depends on control dependency: [catch], data = [none] if (tc.isEntryEnabled()) Tr.exit(tc, "writeFileStatus"); } }
public class class_name { private static int getCycleNumber(long epochDay) { Long[] days = ADJUSTED_CYCLES; int cycleNumber; try { for (int i = 0; i < days.length; i++) { if (epochDay < days[i].longValue()) { return i - 1; } } cycleNumber = (int) epochDay / 10631; } catch (ArrayIndexOutOfBoundsException e) { cycleNumber = (int) epochDay / 10631; } return cycleNumber; } }
public class class_name { private static int getCycleNumber(long epochDay) { Long[] days = ADJUSTED_CYCLES; int cycleNumber; try { for (int i = 0; i < days.length; i++) { if (epochDay < days[i].longValue()) { return i - 1; // depends on control dependency: [if], data = [none] } } cycleNumber = (int) epochDay / 10631; // depends on control dependency: [try], data = [none] } catch (ArrayIndexOutOfBoundsException e) { cycleNumber = (int) epochDay / 10631; } // depends on control dependency: [catch], data = [none] return cycleNumber; } }
public class class_name { public static Layout parseText(String xml) { try { return parseDocument(XMLUtil.parseXMLFromString(xml)); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } } }
public class class_name { public static Layout parseText(String xml) { try { return parseDocument(XMLUtil.parseXMLFromString(xml)); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw MiscUtil.toUnchecked(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Document serviceToDocument() { final AtomService service = this; final Document doc = new Document(); final Element root = new Element("service", ATOM_PROTOCOL); doc.setRootElement(root); final List<Workspace> spaces = service.getWorkspaces(); for (final Workspace space : spaces) { root.addContent(space.workspaceToElement()); } return doc; } }
public class class_name { public Document serviceToDocument() { final AtomService service = this; final Document doc = new Document(); final Element root = new Element("service", ATOM_PROTOCOL); doc.setRootElement(root); final List<Workspace> spaces = service.getWorkspaces(); for (final Workspace space : spaces) { root.addContent(space.workspaceToElement()); // depends on control dependency: [for], data = [space] } return doc; } }
public class class_name { public static List<FieldInfo> fetchFieldInfos(Class cls, boolean ignoreNoAnnotation) { // if set ProtobufClass annotation Annotation annotation = cls.getAnnotation(ProtobufClass.class); Annotation zipZap = cls.getAnnotation(EnableZigZap.class); boolean isZipZap = false; if (zipZap != null) { isZipZap = true; } boolean typeDefined = false; List<Field> fields = null; if (annotation == null) { fields = FieldUtils.findMatchedFields(cls, Protobuf.class); if (fields.isEmpty() && ignoreNoAnnotation) { throw new IllegalArgumentException("Invalid class [" + cls.getName() + "] no field use annotation @" + Protobuf.class.getName() + " at class " + cls.getName()); } } else { typeDefined = true; fields = FieldUtils.findMatchedFields(cls, null); } List<FieldInfo> fieldInfos = ProtobufProxyUtils.processDefaultValue(fields, typeDefined, isZipZap); return fieldInfos; } }
public class class_name { public static List<FieldInfo> fetchFieldInfos(Class cls, boolean ignoreNoAnnotation) { // if set ProtobufClass annotation Annotation annotation = cls.getAnnotation(ProtobufClass.class); Annotation zipZap = cls.getAnnotation(EnableZigZap.class); boolean isZipZap = false; if (zipZap != null) { isZipZap = true; // depends on control dependency: [if], data = [none] } boolean typeDefined = false; List<Field> fields = null; if (annotation == null) { fields = FieldUtils.findMatchedFields(cls, Protobuf.class); // depends on control dependency: [if], data = [none] if (fields.isEmpty() && ignoreNoAnnotation) { throw new IllegalArgumentException("Invalid class [" + cls.getName() + "] no field use annotation @" + Protobuf.class.getName() + " at class " + cls.getName()); } } else { typeDefined = true; // depends on control dependency: [if], data = [none] fields = FieldUtils.findMatchedFields(cls, null); // depends on control dependency: [if], data = [null)] } List<FieldInfo> fieldInfos = ProtobufProxyUtils.processDefaultValue(fields, typeDefined, isZipZap); return fieldInfos; } }
public class class_name { private boolean mkdir(boolean parent) { synchronized (_rootNode) { String fullPath = getFullPath(); int head = 0; Node node = this._rootNode; while (node != null && head < fullPath.length()) { int tail = fullPath.indexOf('/', head); String name; if (tail == head) { head = tail + 1; continue; } if (tail == -1) { name = fullPath.substring(head); if (node.lookup(name) != null) return false; node.createDir(name); return true; } name = fullPath.substring(head, tail); Node next = node.lookup(name); if (next == null && parent) next = node.createDir(name); if (next == null || next.type != next.DIR) return false; node = next; head = tail + 1; } return false; } } }
public class class_name { private boolean mkdir(boolean parent) { synchronized (_rootNode) { String fullPath = getFullPath(); int head = 0; Node node = this._rootNode; while (node != null && head < fullPath.length()) { int tail = fullPath.indexOf('/', head); String name; if (tail == head) { head = tail + 1; // depends on control dependency: [if], data = [none] continue; } if (tail == -1) { name = fullPath.substring(head); // depends on control dependency: [if], data = [none] if (node.lookup(name) != null) return false; node.createDir(name); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } name = fullPath.substring(head, tail); // depends on control dependency: [while], data = [none] Node next = node.lookup(name); if (next == null && parent) next = node.createDir(name); if (next == null || next.type != next.DIR) return false; node = next; // depends on control dependency: [while], data = [none] head = tail + 1; // depends on control dependency: [while], data = [none] } return false; } } }
public class class_name { private boolean isTypedTimeLegalSoFar() { Node node = mLegalTimesTree; for (int keyCode : mTypedTimes) { node = node.canReach(keyCode); if (node == null) { return false; } } return true; } }
public class class_name { private boolean isTypedTimeLegalSoFar() { Node node = mLegalTimesTree; for (int keyCode : mTypedTimes) { node = node.canReach(keyCode); // depends on control dependency: [for], data = [keyCode] if (node == null) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public BeanInvoker getWriteInvoker(String name) { BeanInvoker invoker; if (writeInvokers.containsKey(name)) { invoker = writeInvokers.get(name); } else { invoker = getInvoker(HandleType.SET, name); writeInvokers.put(name, invoker); } return invoker; } }
public class class_name { public BeanInvoker getWriteInvoker(String name) { BeanInvoker invoker; if (writeInvokers.containsKey(name)) { invoker = writeInvokers.get(name); // depends on control dependency: [if], data = [none] } else { invoker = getInvoker(HandleType.SET, name); // depends on control dependency: [if], data = [none] writeInvokers.put(name, invoker); // depends on control dependency: [if], data = [none] } return invoker; } }
public class class_name { public BatchGetBuildsResult withBuilds(Build... builds) { if (this.builds == null) { setBuilds(new java.util.ArrayList<Build>(builds.length)); } for (Build ele : builds) { this.builds.add(ele); } return this; } }
public class class_name { public BatchGetBuildsResult withBuilds(Build... builds) { if (this.builds == null) { setBuilds(new java.util.ArrayList<Build>(builds.length)); // depends on control dependency: [if], data = [none] } for (Build ele : builds) { this.builds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public EEnum getIfcGeometricProjectionEnum() { if (ifcGeometricProjectionEnumEEnum == null) { ifcGeometricProjectionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(998); } return ifcGeometricProjectionEnumEEnum; } }
public class class_name { @Override public EEnum getIfcGeometricProjectionEnum() { if (ifcGeometricProjectionEnumEEnum == null) { ifcGeometricProjectionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(998); // depends on control dependency: [if], data = [none] } return ifcGeometricProjectionEnumEEnum; } }
public class class_name { private boolean checkParseRockpalastYears(Document document) { if(CrawlerTool.loadLongMax()) { // ermitteln, ob es sich um die erste Rockpalastübersichtsseite handelt // dazu muss das erste Element in der Jahresauswahl aktiv sein Elements yearElements = document.select(QUERY_URL_ROCKPALAST_YEARS); if(yearElements != null) { Element firstYearElement = yearElements.first(); if(firstYearElement != null) { return firstYearElement.classNames().contains("active"); } } } return false; } }
public class class_name { private boolean checkParseRockpalastYears(Document document) { if(CrawlerTool.loadLongMax()) { // ermitteln, ob es sich um die erste Rockpalastübersichtsseite handelt // dazu muss das erste Element in der Jahresauswahl aktiv sein Elements yearElements = document.select(QUERY_URL_ROCKPALAST_YEARS); if(yearElements != null) { Element firstYearElement = yearElements.first(); if(firstYearElement != null) { return firstYearElement.classNames().contains("active"); // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { @Override public CommerceAccount remove(Serializable primaryKey) throws NoSuchAccountException { Session session = null; try { session = openSession(); CommerceAccount commerceAccount = (CommerceAccount)session.get(CommerceAccountImpl.class, primaryKey); if (commerceAccount == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceAccount); } catch (NoSuchAccountException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Override public CommerceAccount remove(Serializable primaryKey) throws NoSuchAccountException { Session session = null; try { session = openSession(); CommerceAccount commerceAccount = (CommerceAccount)session.get(CommerceAccountImpl.class, primaryKey); if (commerceAccount == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none] } throw new NoSuchAccountException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(commerceAccount); } catch (NoSuchAccountException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } }
public class class_name { @Nullable public static <T> T readNullable( @NonNull Parcel source, @NonNull TypeAdapter<T> adapter) { T value = null; if (source.readInt() == 1) { value = adapter.readFromParcel(source); } return value; } }
public class class_name { @Nullable public static <T> T readNullable( @NonNull Parcel source, @NonNull TypeAdapter<T> adapter) { T value = null; if (source.readInt() == 1) { value = adapter.readFromParcel(source); // depends on control dependency: [if], data = [none] } return value; } }
public class class_name { public List<Field> getAllGlobalFieldValues() { Field field = new Field(); //Set for Payara server... field.setFieldValue(new MultiChoice()); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); } return new GlobalFieldListing(this.postJson( field, Version1.getAllValues())).getListing(); } }
public class class_name { public List<Field> getAllGlobalFieldValues() { Field field = new Field(); //Set for Payara server... field.setFieldValue(new MultiChoice()); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket] } return new GlobalFieldListing(this.postJson( field, Version1.getAllValues())).getListing(); } }
public class class_name { public void setIssues(java.util.Collection<String> issues) { if (issues == null) { this.issues = null; return; } this.issues = new java.util.ArrayList<String>(issues); } }
public class class_name { public void setIssues(java.util.Collection<String> issues) { if (issues == null) { this.issues = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.issues = new java.util.ArrayList<String>(issues); } }
public class class_name { public void drop(Object message) { if (system().getTraceInterface() != null) { system().getTraceInterface().onDrop(sender(), message, this); } reply(new DeadLetter(message)); } }
public class class_name { public void drop(Object message) { if (system().getTraceInterface() != null) { system().getTraceInterface().onDrop(sender(), message, this); // depends on control dependency: [if], data = [none] } reply(new DeadLetter(message)); } }
public class class_name { public boolean canOpen() { if (getIdleCount() > 0) { return true; } State state = _state; if (state == State.ACTIVE) return true; else if (! state.isEnabled()) return false; else { long now = CurrentTime.currentTime(); if (isFailed(now)) { return false; } return true; } } }
public class class_name { public boolean canOpen() { if (getIdleCount() > 0) { return true; // depends on control dependency: [if], data = [none] } State state = _state; if (state == State.ACTIVE) return true; else if (! state.isEnabled()) return false; else { long now = CurrentTime.currentTime(); if (isFailed(now)) { return false; // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void postValue(T value) { boolean postTask; synchronized (mDataLock) { postTask = mPendingData == NOT_SET; mPendingData = value; } if (!postTask) { return; } ArchTaskExecutor.getInstance().postToMainThread(mPostValueRunnable); } }
public class class_name { protected void postValue(T value) { boolean postTask; synchronized (mDataLock) { postTask = mPendingData == NOT_SET; mPendingData = value; } if (!postTask) { return; // depends on control dependency: [if], data = [none] } ArchTaskExecutor.getInstance().postToMainThread(mPostValueRunnable); } }
public class class_name { public String data() { StringBuilder sb = StringUtil.borrowBuilder(); for (Node childNode : childNodes) { if (childNode instanceof DataNode) { DataNode data = (DataNode) childNode; sb.append(data.getWholeData()); } else if (childNode instanceof Comment) { Comment comment = (Comment) childNode; sb.append(comment.getData()); } else if (childNode instanceof Element) { Element element = (Element) childNode; String elementData = element.data(); sb.append(elementData); } else if (childNode instanceof CDataNode) { // this shouldn't really happen because the html parser won't see the cdata as anything special when parsing script. // but incase another type gets through. CDataNode cDataNode = (CDataNode) childNode; sb.append(cDataNode.getWholeText()); } } return StringUtil.releaseBuilder(sb); } }
public class class_name { public String data() { StringBuilder sb = StringUtil.borrowBuilder(); for (Node childNode : childNodes) { if (childNode instanceof DataNode) { DataNode data = (DataNode) childNode; sb.append(data.getWholeData()); // depends on control dependency: [if], data = [none] } else if (childNode instanceof Comment) { Comment comment = (Comment) childNode; sb.append(comment.getData()); // depends on control dependency: [if], data = [none] } else if (childNode instanceof Element) { Element element = (Element) childNode; String elementData = element.data(); sb.append(elementData); // depends on control dependency: [if], data = [none] } else if (childNode instanceof CDataNode) { // this shouldn't really happen because the html parser won't see the cdata as anything special when parsing script. // but incase another type gets through. CDataNode cDataNode = (CDataNode) childNode; sb.append(cDataNode.getWholeText()); // depends on control dependency: [if], data = [none] } } return StringUtil.releaseBuilder(sb); } }
public class class_name { public static PathImpl lookup(String url) { PathImpl pwd = getPwd(); if (! url.startsWith("/")) { return pwd.lookup(url, null); } else { return PWD.lookup(url, null); } } }
public class class_name { public static PathImpl lookup(String url) { PathImpl pwd = getPwd(); if (! url.startsWith("/")) { return pwd.lookup(url, null); // depends on control dependency: [if], data = [none] } else { return PWD.lookup(url, null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int getType(int codePoint) { int type = getTypeImpl(codePoint); // The type values returned by ICU are not RI-compatible. The RI skips the value 17. if (type <= Character.FORMAT) { return type; } return (type + 1); } }
public class class_name { public static int getType(int codePoint) { int type = getTypeImpl(codePoint); // The type values returned by ICU are not RI-compatible. The RI skips the value 17. if (type <= Character.FORMAT) { return type; // depends on control dependency: [if], data = [none] } return (type + 1); } }
public class class_name { public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { if (m_inEntityRef) return; flushPending(); if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING)) { startNonEscaping(); } else if (target.equals(Result.PI_ENABLE_OUTPUT_ESCAPING)) { endNonEscaping(); } else { try { if (m_elemContext.m_startTagOpen) { closeStartTag(); m_elemContext.m_startTagOpen = false; } else if (m_needToCallStartDocument) startDocumentInternal(); if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; writer.write("<?"); writer.write(target); if (data.length() > 0 && !Character.isSpaceChar(data.charAt(0))) writer.write(' '); int indexOfQLT = data.indexOf("?>"); if (indexOfQLT >= 0) { // See XSLT spec on error recovery of "?>" in PIs. if (indexOfQLT > 0) { writer.write(data.substring(0, indexOfQLT)); } writer.write("? >"); // add space between. if ((indexOfQLT + 2) < data.length()) { writer.write(data.substring(indexOfQLT + 2)); } } else { writer.write(data); } writer.write('?'); writer.write('>'); /* * Don't write out any indentation whitespace now, * because there may be non-whitespace text after this. * * Simply mark that at this point if we do decide * to indent that we should * add a newline on the end of the current line before * the indentation at the start of the next line. */ m_startNewLine = true; } catch(IOException e) { throw new SAXException(e); } } if (m_tracer != null) super.fireEscapingEvent(target, data); } }
public class class_name { public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { if (m_inEntityRef) return; flushPending(); if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING)) { startNonEscaping(); } else if (target.equals(Result.PI_ENABLE_OUTPUT_ESCAPING)) { endNonEscaping(); } else { try { if (m_elemContext.m_startTagOpen) { closeStartTag(); // depends on control dependency: [if], data = [none] m_elemContext.m_startTagOpen = false; // depends on control dependency: [if], data = [none] } else if (m_needToCallStartDocument) startDocumentInternal(); if (shouldIndent()) indent(); final java.io.Writer writer = m_writer; writer.write("<?"); // depends on control dependency: [try], data = [none] writer.write(target); // depends on control dependency: [try], data = [none] if (data.length() > 0 && !Character.isSpaceChar(data.charAt(0))) writer.write(' '); int indexOfQLT = data.indexOf("?>"); if (indexOfQLT >= 0) { // See XSLT spec on error recovery of "?>" in PIs. if (indexOfQLT > 0) { writer.write(data.substring(0, indexOfQLT)); // depends on control dependency: [if], data = [none] } writer.write("? >"); // add space between. // depends on control dependency: [if], data = [none] if ((indexOfQLT + 2) < data.length()) { writer.write(data.substring(indexOfQLT + 2)); // depends on control dependency: [if], data = [none] } } else { writer.write(data); // depends on control dependency: [if], data = [none] } writer.write('?'); // depends on control dependency: [try], data = [none] writer.write('>'); // depends on control dependency: [try], data = [none] /* * Don't write out any indentation whitespace now, * because there may be non-whitespace text after this. * * Simply mark that at this point if we do decide * to indent that we should * add a newline on the end of the current line before * the indentation at the start of the next line. */ m_startNewLine = true; // depends on control dependency: [try], data = [none] } catch(IOException e) { throw new SAXException(e); } // depends on control dependency: [catch], data = [none] } if (m_tracer != null) super.fireEscapingEvent(target, data); } }
public class class_name { protected void addSource ( DragSource source, JComponent comp, boolean autoremove) { _draggers.put(comp, source); comp.addMouseListener(_sourceListener); comp.addMouseMotionListener(_sourceListener); if (autoremove) { comp.addAncestorListener(_remover); } } }
public class class_name { protected void addSource ( DragSource source, JComponent comp, boolean autoremove) { _draggers.put(comp, source); comp.addMouseListener(_sourceListener); comp.addMouseMotionListener(_sourceListener); if (autoremove) { comp.addAncestorListener(_remover); // depends on control dependency: [if], data = [none] } } }
public class class_name { public java.util.List<SupportedProductConfig> getNewSupportedProducts() { if (newSupportedProducts == null) { newSupportedProducts = new com.amazonaws.internal.SdkInternalList<SupportedProductConfig>(); } return newSupportedProducts; } }
public class class_name { public java.util.List<SupportedProductConfig> getNewSupportedProducts() { if (newSupportedProducts == null) { newSupportedProducts = new com.amazonaws.internal.SdkInternalList<SupportedProductConfig>(); // depends on control dependency: [if], data = [none] } return newSupportedProducts; } }
public class class_name { public static long FVN64hash(byte[] bytes) { long hash = FNV_BASIS; for (int i = 0; i < bytes.length; i++) { hash ^= 0xFF & bytes[i]; hash *= FNV_PRIME_64; } return hash; } }
public class class_name { public static long FVN64hash(byte[] bytes) { long hash = FNV_BASIS; for (int i = 0; i < bytes.length; i++) { hash ^= 0xFF & bytes[i]; // depends on control dependency: [for], data = [i] hash *= FNV_PRIME_64; // depends on control dependency: [for], data = [none] } return hash; } }
public class class_name { private static<K,V> HashTrieMap<K,V> mergeLeafMaps(int hash0, AHashMap<K,V> elem0, int hash1, AHashMap<K,V> elem1, int level, int size, AEquality equality) { final int index0 = (hash0 >>> level) & 0x1f; final int index1 = (hash1 >>> level) & 0x1f; if(index0 != index1) { final int bitmap = (1 << index0) | (1 << index1); final AHashMap<K,V>[] elems = createArray(2); if(index0 < index1) { elems[0] = elem0; elems[1] = elem1; } else { elems[0] = elem1; elems[1] = elem0; } return new HashTrieMap<>(bitmap, elems, size, equality); } else { final AHashMap<K,V>[] elems = createArray(1); final int bitmap = (1 << index0); // try again, based on the elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size, equality); return new HashTrieMap<>(bitmap, elems, size, equality); } } }
public class class_name { private static<K,V> HashTrieMap<K,V> mergeLeafMaps(int hash0, AHashMap<K,V> elem0, int hash1, AHashMap<K,V> elem1, int level, int size, AEquality equality) { final int index0 = (hash0 >>> level) & 0x1f; final int index1 = (hash1 >>> level) & 0x1f; if(index0 != index1) { final int bitmap = (1 << index0) | (1 << index1); final AHashMap<K,V>[] elems = createArray(2); if(index0 < index1) { elems[0] = elem0; // depends on control dependency: [if], data = [none] elems[1] = elem1; // depends on control dependency: [if], data = [none] } else { elems[0] = elem1; // depends on control dependency: [if], data = [none] elems[1] = elem0; // depends on control dependency: [if], data = [none] } return new HashTrieMap<>(bitmap, elems, size, equality); // depends on control dependency: [if], data = [none] } else { final AHashMap<K,V>[] elems = createArray(1); final int bitmap = (1 << index0); // try again, based on the elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size, equality); // depends on control dependency: [if], data = [none] return new HashTrieMap<>(bitmap, elems, size, equality); // depends on control dependency: [if], data = [none] } } }
public class class_name { private CompletableFuture<PrimaryTerm> term() { CompletableFuture<PrimaryTerm> future = new CompletableFuture<>(); threadContext.execute(() -> { if (term != null) { future.complete(term); } else { primaryElection.getTerm().whenCompleteAsync((term, error) -> { if (term != null) { this.term = term; future.complete(term); } else { future.completeExceptionally(new PrimitiveException.Unavailable()); } }); } }); return future; } }
public class class_name { private CompletableFuture<PrimaryTerm> term() { CompletableFuture<PrimaryTerm> future = new CompletableFuture<>(); threadContext.execute(() -> { if (term != null) { future.complete(term); // depends on control dependency: [if], data = [(term] } else { primaryElection.getTerm().whenCompleteAsync((term, error) -> { if (term != null) { this.term = term; // depends on control dependency: [if], data = [none] future.complete(term); // depends on control dependency: [if], data = [(term] } else { future.completeExceptionally(new PrimitiveException.Unavailable()); // depends on control dependency: [if], data = [none] } }); } }); return future; } }
public class class_name { public Location withAvailablePortSpeeds(String... availablePortSpeeds) { if (this.availablePortSpeeds == null) { setAvailablePortSpeeds(new com.amazonaws.internal.SdkInternalList<String>(availablePortSpeeds.length)); } for (String ele : availablePortSpeeds) { this.availablePortSpeeds.add(ele); } return this; } }
public class class_name { public Location withAvailablePortSpeeds(String... availablePortSpeeds) { if (this.availablePortSpeeds == null) { setAvailablePortSpeeds(new com.amazonaws.internal.SdkInternalList<String>(availablePortSpeeds.length)); // depends on control dependency: [if], data = [none] } for (String ele : availablePortSpeeds) { this.availablePortSpeeds.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static List<AtomSite> convertGroupToAtomSites(Group g, int model, String chainName, String chainId) { // The alt locs can have duplicates, since at parsing time we make sure that all alt loc groups have // all atoms (see StructureTools#cleanUpAltLocs) // Thus we have to remove duplicates here by using the atom id // See issue https://github.com/biojava/biojava/issues/778 and TestAltLocs.testMmcifWritingAllAltlocs/testMmcifWritingPartialAltlocs Map<Integer, AtomSite> uniqueAtomSites = new LinkedHashMap<>(); int groupsize = g.size(); for ( int atompos = 0 ; atompos < groupsize; atompos++) { Atom a = g.getAtom(atompos); if ( a == null) continue ; uniqueAtomSites.put(a.getPDBserial(), convertAtomToAtomSite(a, model, chainName, chainId)); } if ( g.hasAltLoc()){ for (Group alt : g.getAltLocs() ) { for (AtomSite atomSite : convertGroupToAtomSites(alt, model, chainName, chainId)) { uniqueAtomSites.put(Integer.parseInt(atomSite.getId()), atomSite); } } } return new ArrayList<>(uniqueAtomSites.values()); } }
public class class_name { public static List<AtomSite> convertGroupToAtomSites(Group g, int model, String chainName, String chainId) { // The alt locs can have duplicates, since at parsing time we make sure that all alt loc groups have // all atoms (see StructureTools#cleanUpAltLocs) // Thus we have to remove duplicates here by using the atom id // See issue https://github.com/biojava/biojava/issues/778 and TestAltLocs.testMmcifWritingAllAltlocs/testMmcifWritingPartialAltlocs Map<Integer, AtomSite> uniqueAtomSites = new LinkedHashMap<>(); int groupsize = g.size(); for ( int atompos = 0 ; atompos < groupsize; atompos++) { Atom a = g.getAtom(atompos); if ( a == null) continue ; uniqueAtomSites.put(a.getPDBserial(), convertAtomToAtomSite(a, model, chainName, chainId)); // depends on control dependency: [for], data = [none] } if ( g.hasAltLoc()){ for (Group alt : g.getAltLocs() ) { for (AtomSite atomSite : convertGroupToAtomSites(alt, model, chainName, chainId)) { uniqueAtomSites.put(Integer.parseInt(atomSite.getId()), atomSite); // depends on control dependency: [for], data = [atomSite] } } } return new ArrayList<>(uniqueAtomSites.values()); } }
public class class_name { public static boolean inside(Point point, MultiPolygon multiPolygon) { List<List<List<Point>>> polys = multiPolygon.coordinates(); boolean insidePoly = false; for (int i = 0; i < polys.size() && !insidePoly; i++) { // check if it is in the outer ring first if (inRing(point, polys.get(i).get(0))) { boolean inHole = false; int temp = 1; // check for the point in any of the holes while (temp < polys.get(i).size() && !inHole) { if (inRing(point, polys.get(i).get(temp))) { inHole = true; } temp++; } if (!inHole) { insidePoly = true; } } } return insidePoly; } }
public class class_name { public static boolean inside(Point point, MultiPolygon multiPolygon) { List<List<List<Point>>> polys = multiPolygon.coordinates(); boolean insidePoly = false; for (int i = 0; i < polys.size() && !insidePoly; i++) { // check if it is in the outer ring first if (inRing(point, polys.get(i).get(0))) { boolean inHole = false; int temp = 1; // check for the point in any of the holes while (temp < polys.get(i).size() && !inHole) { if (inRing(point, polys.get(i).get(temp))) { inHole = true; // depends on control dependency: [if], data = [none] } temp++; // depends on control dependency: [while], data = [none] } if (!inHole) { insidePoly = true; // depends on control dependency: [if], data = [none] } } } return insidePoly; } }
public class class_name { public Observable<ServiceResponse<SourceControlInner>> getSourceControlWithServiceResponseAsync(String sourceControlType) { if (sourceControlType == null) { throw new IllegalArgumentException("Parameter sourceControlType is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } return service.getSourceControl(sourceControlType, this.apiVersion(), this.acceptLanguage(), this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SourceControlInner>>>() { @Override public Observable<ServiceResponse<SourceControlInner>> call(Response<ResponseBody> response) { try { ServiceResponse<SourceControlInner> clientResponse = getSourceControlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<SourceControlInner>> getSourceControlWithServiceResponseAsync(String sourceControlType) { if (sourceControlType == null) { throw new IllegalArgumentException("Parameter sourceControlType is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } return service.getSourceControl(sourceControlType, this.apiVersion(), this.acceptLanguage(), this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SourceControlInner>>>() { @Override public Observable<ServiceResponse<SourceControlInner>> call(Response<ResponseBody> response) { try { ServiceResponse<SourceControlInner> clientResponse = getSourceControlDelegate(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 double getUpperBound(final int numStdDev) { if (!isEstimationMode()) { return getRetainedEntries(); } return BinomialBoundsN.getUpperBound(getRetainedEntries(), getTheta(), numStdDev, isEmpty_); } }
public class class_name { public double getUpperBound(final int numStdDev) { if (!isEstimationMode()) { return getRetainedEntries(); } // depends on control dependency: [if], data = [none] return BinomialBoundsN.getUpperBound(getRetainedEntries(), getTheta(), numStdDev, isEmpty_); } }
public class class_name { @Override public List<Sequence<AminoAcidCompound>> createSequences( Sequence<NucleotideCompound> originalSequence) { List<List<AminoAcidCompound>> workingList = new ArrayList<List<AminoAcidCompound>>(); Iterable<SequenceView<NucleotideCompound>> iter = new WindowedSequence<NucleotideCompound>( originalSequence, 3); boolean first = true; // If not waiting for a start codon, start translating immediately boolean doTranslate = !waitForStartCodon; for (SequenceView<NucleotideCompound> element : iter) { AminoAcidCompound aminoAcid = null; int i = 1; Table.CaseInsensitiveTriplet triplet = new Table.CaseInsensitiveTriplet( element.getCompoundAt(i++), element.getCompoundAt(i++), element.getCompoundAt(i++)); Codon target = null; target = quickLookup.get(triplet); // Check for a start if (!doTranslate && target.isStart()) { doTranslate = true; } if (doTranslate) { if (target != null) aminoAcid = target.getAminoAcid(); if (aminoAcid == null && translateNCodons()) { aminoAcid = unknownAminoAcidCompound; } else { if (first && initMetOnly && target.isStart()) { aminoAcid = methionineAminoAcidCompound; } } addCompoundsToList(Arrays.asList(aminoAcid), workingList); } if (doTranslate && stopAtStopCodons && target.isStop()) { // Check if we need to stop, but dont stop until started! break; } first = false; } postProcessCompoundLists(workingList); return workingListToSequences(workingList); } }
public class class_name { @Override public List<Sequence<AminoAcidCompound>> createSequences( Sequence<NucleotideCompound> originalSequence) { List<List<AminoAcidCompound>> workingList = new ArrayList<List<AminoAcidCompound>>(); Iterable<SequenceView<NucleotideCompound>> iter = new WindowedSequence<NucleotideCompound>( originalSequence, 3); boolean first = true; // If not waiting for a start codon, start translating immediately boolean doTranslate = !waitForStartCodon; for (SequenceView<NucleotideCompound> element : iter) { AminoAcidCompound aminoAcid = null; int i = 1; Table.CaseInsensitiveTriplet triplet = new Table.CaseInsensitiveTriplet( element.getCompoundAt(i++), element.getCompoundAt(i++), element.getCompoundAt(i++)); Codon target = null; target = quickLookup.get(triplet); // depends on control dependency: [for], data = [none] // Check for a start if (!doTranslate && target.isStart()) { doTranslate = true; // depends on control dependency: [if], data = [none] } if (doTranslate) { if (target != null) aminoAcid = target.getAminoAcid(); if (aminoAcid == null && translateNCodons()) { aminoAcid = unknownAminoAcidCompound; // depends on control dependency: [if], data = [none] } else { if (first && initMetOnly && target.isStart()) { aminoAcid = methionineAminoAcidCompound; // depends on control dependency: [if], data = [none] } } addCompoundsToList(Arrays.asList(aminoAcid), workingList); // depends on control dependency: [if], data = [none] } if (doTranslate && stopAtStopCodons && target.isStop()) { // Check if we need to stop, but dont stop until started! break; } first = false; // depends on control dependency: [for], data = [none] } postProcessCompoundLists(workingList); return workingListToSequences(workingList); } }
public class class_name { private void disableSpellingSuggestions(boolean disable) { // toggling suggestions often resets the cursor location, but we don't want that to happen int start = mMentionsEditText.getSelectionStart(); int end = mMentionsEditText.getSelectionEnd(); // -1 means there is no selection or cursor. if (start == -1 || end == -1) { return; } if (disable) { // store the previous input type mOriginalInputType = mMentionsEditText.getInputType(); } mMentionsEditText.setRawInputType(disable ? InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS : mOriginalInputType); mMentionsEditText.setSelection(start, end); } }
public class class_name { private void disableSpellingSuggestions(boolean disable) { // toggling suggestions often resets the cursor location, but we don't want that to happen int start = mMentionsEditText.getSelectionStart(); int end = mMentionsEditText.getSelectionEnd(); // -1 means there is no selection or cursor. if (start == -1 || end == -1) { return; // depends on control dependency: [if], data = [none] } if (disable) { // store the previous input type mOriginalInputType = mMentionsEditText.getInputType(); // depends on control dependency: [if], data = [none] } mMentionsEditText.setRawInputType(disable ? InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS : mOriginalInputType); mMentionsEditText.setSelection(start, end); } }
public class class_name { public static int getIndex( String key ) { if ( key == null ) { return -1; } key = key.toUpperCase(); if ( key.startsWith("CJK_WORD") ) { return ILexicon.CJK_WORD; } else if ( key.startsWith("CJK_CHAR") ) { return ILexicon.CJK_CHAR; } else if ( key.startsWith("CJK_UNIT") ) { return ILexicon.CJK_UNIT; } else if ( key.startsWith("CN_LNAME_ADORN") ) { return ILexicon.CN_LNAME_ADORN; } else if ( key.startsWith("CN_LNAME") ) { return ILexicon.CN_LNAME; } else if ( key.startsWith("CN_SNAME") ) { return ILexicon.CN_SNAME; } else if ( key.startsWith("CN_DNAME_1") ) { return ILexicon.CN_DNAME_1; } else if ( key.startsWith("CN_DNAME_2") ) { return ILexicon.CN_DNAME_2; } else if ( key.startsWith("STOP_WORD") ) { return ILexicon.STOP_WORD; } else if ( key.startsWith("DOMAIN_SUFFIX") ) { return ILexicon.DOMAIN_SUFFIX; } else if ( key.startsWith("NUMBER_UNIT") ) { return ILexicon.NUMBER_UNIT; } else if ( key.startsWith("CJK_SYN") ) { return ILexicon.CJK_SYN; } return ILexicon.CJK_WORD; } }
public class class_name { public static int getIndex( String key ) { if ( key == null ) { return -1; // depends on control dependency: [if], data = [none] } key = key.toUpperCase(); if ( key.startsWith("CJK_WORD") ) { return ILexicon.CJK_WORD; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CJK_CHAR") ) { return ILexicon.CJK_CHAR; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CJK_UNIT") ) { return ILexicon.CJK_UNIT; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CN_LNAME_ADORN") ) { return ILexicon.CN_LNAME_ADORN; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CN_LNAME") ) { return ILexicon.CN_LNAME; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CN_SNAME") ) { return ILexicon.CN_SNAME; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CN_DNAME_1") ) { return ILexicon.CN_DNAME_1; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CN_DNAME_2") ) { return ILexicon.CN_DNAME_2; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("STOP_WORD") ) { return ILexicon.STOP_WORD; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("DOMAIN_SUFFIX") ) { return ILexicon.DOMAIN_SUFFIX; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("NUMBER_UNIT") ) { return ILexicon.NUMBER_UNIT; // depends on control dependency: [if], data = [none] } else if ( key.startsWith("CJK_SYN") ) { return ILexicon.CJK_SYN; // depends on control dependency: [if], data = [none] } return ILexicon.CJK_WORD; } }
public class class_name { public void initializeParametersToIdentity(SufficientStatistics parameters) { CvsmSufficientStatistics cvsmStats = (CvsmSufficientStatistics) parameters; Preconditions.checkArgument(cvsmStats.size() == families.size()); for (int i = 0; i < cvsmStats.size(); i++) { SufficientStatistics curStats = cvsmStats.getSufficientStatistics(i); LrtFamily lrtFamily = families.get(i); if (lrtFamily.getDimensionNumbers().length >= 2) { if (curStats instanceof TensorSufficientStatistics) { TensorSufficientStatistics tensorStats = (TensorSufficientStatistics) curStats; Tensor tensor = tensorStats.get(); Tensor diag = SparseTensor.diagonal(tensor.getDimensionNumbers(), tensor.getDimensionSizes(), 1.0); tensorStats.increment(diag, 1.0); } else { List<SufficientStatistics> stats = curStats.coerceToList().getStatistics(); if (stats.size() == 0) { // ConstantLrtFamily. continue; } TensorSufficientStatistics diagStats = (TensorSufficientStatistics) stats.get(stats.size() - 1); Tensor tensor = diagStats.get(); DenseTensor increment = DenseTensor.constant(tensor.getDimensionNumbers(), tensor.getDimensionSizes(), 1.0); diagStats.increment(increment, 1.0); } } } } }
public class class_name { public void initializeParametersToIdentity(SufficientStatistics parameters) { CvsmSufficientStatistics cvsmStats = (CvsmSufficientStatistics) parameters; Preconditions.checkArgument(cvsmStats.size() == families.size()); for (int i = 0; i < cvsmStats.size(); i++) { SufficientStatistics curStats = cvsmStats.getSufficientStatistics(i); LrtFamily lrtFamily = families.get(i); if (lrtFamily.getDimensionNumbers().length >= 2) { if (curStats instanceof TensorSufficientStatistics) { TensorSufficientStatistics tensorStats = (TensorSufficientStatistics) curStats; Tensor tensor = tensorStats.get(); Tensor diag = SparseTensor.diagonal(tensor.getDimensionNumbers(), tensor.getDimensionSizes(), 1.0); tensorStats.increment(diag, 1.0); // depends on control dependency: [if], data = [none] } else { List<SufficientStatistics> stats = curStats.coerceToList().getStatistics(); if (stats.size() == 0) { // ConstantLrtFamily. continue; } TensorSufficientStatistics diagStats = (TensorSufficientStatistics) stats.get(stats.size() - 1); Tensor tensor = diagStats.get(); DenseTensor increment = DenseTensor.constant(tensor.getDimensionNumbers(), tensor.getDimensionSizes(), 1.0); diagStats.increment(increment, 1.0); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static Object getField(Field field, Object target) { try { return field.get(target); } catch (IllegalAccessException ex) { handleReflectionException(ex); throw new IllegalStateException( "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); } } }
public class class_name { public static Object getField(Field field, Object target) { try { return field.get(target); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException ex) { handleReflectionException(ex); throw new IllegalStateException( "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Object wrap(final Object value) { if (value instanceof Map) { return new MapResultWrapper(db, (Map)value); } if (value instanceof Collection) { return wrap((Collection)value); } return wrapper.apply(value); } }
public class class_name { private Object wrap(final Object value) { if (value instanceof Map) { return new MapResultWrapper(db, (Map)value); // depends on control dependency: [if], data = [none] } if (value instanceof Collection) { return wrap((Collection)value); // depends on control dependency: [if], data = [none] } return wrapper.apply(value); } }
public class class_name { private void buildImplementedMethodList(boolean sort) { List<Type> intfacs = utils.getAllInterfaces(classdoc, configuration, sort); for (Type interfaceType : intfacs) { MethodDoc found = utils.findMethod(interfaceType.asClassDoc(), method); if (found != null) { removeOverriddenMethod(found); if (!overridingMethodFound(found)) { methlist.add(found); interfaces.put(found, interfaceType); } } } } }
public class class_name { private void buildImplementedMethodList(boolean sort) { List<Type> intfacs = utils.getAllInterfaces(classdoc, configuration, sort); for (Type interfaceType : intfacs) { MethodDoc found = utils.findMethod(interfaceType.asClassDoc(), method); if (found != null) { removeOverriddenMethod(found); // depends on control dependency: [if], data = [(found] if (!overridingMethodFound(found)) { methlist.add(found); // depends on control dependency: [if], data = [none] interfaces.put(found, interfaceType); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void marshall(DeleteAccountRequest deleteAccountRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAccountRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAccountRequest.getAccountId(), ACCOUNTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteAccountRequest deleteAccountRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAccountRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAccountRequest.getAccountId(), ACCOUNTID_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 WstxInputSource resolveEntity (WstxInputSource parent, URL pathCtxt, String entityName, String publicId, String systemId, XMLResolver customResolver, ReaderConfig cfg, int xmlVersion) throws IOException, XMLStreamException { if (pathCtxt == null) { pathCtxt = parent.getSource(); if (pathCtxt == null) { pathCtxt = URLUtil.urlFromCurrentDir(); } } // Do we have a custom resolver that may be able to resolve it? if (customResolver != null) { Object source = customResolver.resolveEntity(publicId, systemId, pathCtxt.toExternalForm(), entityName); if (source != null) { return sourceFrom(parent, cfg, entityName, xmlVersion, source); } } // Have to have a system id, then... if (systemId == null) { throw new XMLStreamException("Can not resolve " +((entityName == null) ? "[External DTD subset]" : ("entity '"+entityName+"'"))+" without a system id (public id '" +publicId+"')"); } URL url = URLUtil.urlFromSystemId(systemId, pathCtxt); return sourceFromURL(parent, cfg, entityName, xmlVersion, url, publicId); } }
public class class_name { public static WstxInputSource resolveEntity (WstxInputSource parent, URL pathCtxt, String entityName, String publicId, String systemId, XMLResolver customResolver, ReaderConfig cfg, int xmlVersion) throws IOException, XMLStreamException { if (pathCtxt == null) { pathCtxt = parent.getSource(); if (pathCtxt == null) { pathCtxt = URLUtil.urlFromCurrentDir(); } } // Do we have a custom resolver that may be able to resolve it? if (customResolver != null) { Object source = customResolver.resolveEntity(publicId, systemId, pathCtxt.toExternalForm(), entityName); if (source != null) { return sourceFrom(parent, cfg, entityName, xmlVersion, source); // depends on control dependency: [if], data = [none] } } // Have to have a system id, then... if (systemId == null) { throw new XMLStreamException("Can not resolve " +((entityName == null) ? "[External DTD subset]" : ("entity '"+entityName+"'"))+" without a system id (public id '" +publicId+"')"); } URL url = URLUtil.urlFromSystemId(systemId, pathCtxt); return sourceFromURL(parent, cfg, entityName, xmlVersion, url, publicId); } }
public class class_name { public Reference<TimerListener> addTimerListener(final TimerListener listener) { startThreadIfNeeded(); // add the listener Runnable r = new Runnable() { @Override public void run() { try { listener.tick(); } catch (Exception e) { logger.error("Failed while ticking TimerListener", e); } } }; ScheduledFuture<?> f = executor.get().getThreadPool().scheduleAtFixedRate(r, listener.getIntervalTimeInMilliseconds(), listener.getIntervalTimeInMilliseconds(), TimeUnit.MILLISECONDS); return new TimerReference(listener, f); } }
public class class_name { public Reference<TimerListener> addTimerListener(final TimerListener listener) { startThreadIfNeeded(); // add the listener Runnable r = new Runnable() { @Override public void run() { try { listener.tick(); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Failed while ticking TimerListener", e); } // depends on control dependency: [catch], data = [none] } }; ScheduledFuture<?> f = executor.get().getThreadPool().scheduleAtFixedRate(r, listener.getIntervalTimeInMilliseconds(), listener.getIntervalTimeInMilliseconds(), TimeUnit.MILLISECONDS); return new TimerReference(listener, f); } }
public class class_name { protected boolean isValidEventNameForScope(String eventName, Element listenerElement) { if (eventName != null && eventName.trim().length() > 0) { if ("start".equals(eventName) || "end".equals(eventName)) { return true; } else { addError("Attribute 'event' must be one of {start|end}", listenerElement); } } else { addError("Attribute 'event' is mandatory on listener", listenerElement); } return false; } }
public class class_name { protected boolean isValidEventNameForScope(String eventName, Element listenerElement) { if (eventName != null && eventName.trim().length() > 0) { if ("start".equals(eventName) || "end".equals(eventName)) { return true; // depends on control dependency: [if], data = [none] } else { addError("Attribute 'event' must be one of {start|end}", listenerElement); // depends on control dependency: [if], data = [none] } } else { addError("Attribute 'event' is mandatory on listener", listenerElement); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public Multimap<Long, AccumuloColumnConstraint> getCardinalities(String schema, String table, Authorizations auths, Multimap<AccumuloColumnConstraint, Range> idxConstraintRangePairs, long earlyReturnThreshold, Duration pollingDuration) { // Submit tasks to the executor to fetch column cardinality, adding it to the Guava cache if necessary CompletionService<Pair<Long, AccumuloColumnConstraint>> executor = new ExecutorCompletionService<>(executorService); idxConstraintRangePairs.asMap().forEach((key, value) -> executor.submit(() -> { long cardinality = getColumnCardinality(schema, table, auths, key.getFamily(), key.getQualifier(), value); LOG.debug("Cardinality for column %s is %s", key.getName(), cardinality); return Pair.of(cardinality, key); })); // Create a multi map sorted by cardinality ListMultimap<Long, AccumuloColumnConstraint> cardinalityToConstraints = MultimapBuilder.treeKeys().arrayListValues().build(); try { boolean earlyReturn = false; int numTasks = idxConstraintRangePairs.asMap().entrySet().size(); do { // Sleep for the polling duration to allow concurrent tasks to run for this time Thread.sleep(pollingDuration.toMillis()); // Poll each task, retrieving the result if it is done for (int i = 0; i < numTasks; ++i) { Future<Pair<Long, AccumuloColumnConstraint>> futureCardinality = executor.poll(); if (futureCardinality != null && futureCardinality.isDone()) { Pair<Long, AccumuloColumnConstraint> columnCardinality = futureCardinality.get(); cardinalityToConstraints.put(columnCardinality.getLeft(), columnCardinality.getRight()); } } // If the smallest cardinality is present and below the threshold, set the earlyReturn flag Optional<Entry<Long, AccumuloColumnConstraint>> smallestCardinality = cardinalityToConstraints.entries().stream().findFirst(); if (smallestCardinality.isPresent()) { if (smallestCardinality.get().getKey() <= earlyReturnThreshold) { LOG.info("Cardinality %s, is below threshold. Returning early while other tasks finish", smallestCardinality); earlyReturn = true; } } } while (!earlyReturn && cardinalityToConstraints.entries().size() < numTasks); } catch (ExecutionException | InterruptedException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Exception when getting cardinality", e); } // Create a copy of the cardinalities return ImmutableMultimap.copyOf(cardinalityToConstraints); } }
public class class_name { public Multimap<Long, AccumuloColumnConstraint> getCardinalities(String schema, String table, Authorizations auths, Multimap<AccumuloColumnConstraint, Range> idxConstraintRangePairs, long earlyReturnThreshold, Duration pollingDuration) { // Submit tasks to the executor to fetch column cardinality, adding it to the Guava cache if necessary CompletionService<Pair<Long, AccumuloColumnConstraint>> executor = new ExecutorCompletionService<>(executorService); idxConstraintRangePairs.asMap().forEach((key, value) -> executor.submit(() -> { long cardinality = getColumnCardinality(schema, table, auths, key.getFamily(), key.getQualifier(), value); LOG.debug("Cardinality for column %s is %s", key.getName(), cardinality); return Pair.of(cardinality, key); })); // Create a multi map sorted by cardinality ListMultimap<Long, AccumuloColumnConstraint> cardinalityToConstraints = MultimapBuilder.treeKeys().arrayListValues().build(); try { boolean earlyReturn = false; int numTasks = idxConstraintRangePairs.asMap().entrySet().size(); do { // Sleep for the polling duration to allow concurrent tasks to run for this time Thread.sleep(pollingDuration.toMillis()); // Poll each task, retrieving the result if it is done for (int i = 0; i < numTasks; ++i) { Future<Pair<Long, AccumuloColumnConstraint>> futureCardinality = executor.poll(); if (futureCardinality != null && futureCardinality.isDone()) { Pair<Long, AccumuloColumnConstraint> columnCardinality = futureCardinality.get(); cardinalityToConstraints.put(columnCardinality.getLeft(), columnCardinality.getRight()); // depends on control dependency: [if], data = [none] } } // If the smallest cardinality is present and below the threshold, set the earlyReturn flag Optional<Entry<Long, AccumuloColumnConstraint>> smallestCardinality = cardinalityToConstraints.entries().stream().findFirst(); if (smallestCardinality.isPresent()) { if (smallestCardinality.get().getKey() <= earlyReturnThreshold) { LOG.info("Cardinality %s, is below threshold. Returning early while other tasks finish", smallestCardinality); // depends on control dependency: [if], data = [none] earlyReturn = true; // depends on control dependency: [if], data = [none] } } } while (!earlyReturn && cardinalityToConstraints.entries().size() < numTasks); } catch (ExecutionException | InterruptedException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); // depends on control dependency: [if], data = [none] } throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Exception when getting cardinality", e); } // depends on control dependency: [catch], data = [none] // Create a copy of the cardinalities return ImmutableMultimap.copyOf(cardinalityToConstraints); } }
public class class_name { private <T extends ValueMap> T coerceToValueMap(Object object, Class<T> clazz) { if (object == null) return null; if (clazz.isAssignableFrom(object.getClass())) { //noinspection unchecked return (T) object; } if (object instanceof Map) return createValueMap((Map) object, clazz); return null; } }
public class class_name { private <T extends ValueMap> T coerceToValueMap(Object object, Class<T> clazz) { if (object == null) return null; if (clazz.isAssignableFrom(object.getClass())) { //noinspection unchecked return (T) object; // depends on control dependency: [if], data = [none] } if (object instanceof Map) return createValueMap((Map) object, clazz); return null; } }
public class class_name { private static void exposeRequestAttributeIfNotPresent(ServletRequest request, String name, Object value) { if (request.getAttribute(name) == null) { request.setAttribute(name, value); } } }
public class class_name { private static void exposeRequestAttributeIfNotPresent(ServletRequest request, String name, Object value) { if (request.getAttribute(name) == null) { request.setAttribute(name, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void appendToSentence(StringBuilder buf, String[] names) { for (int i=0; i<names.length; i++) { if (i > 0) { if (i + 1 >= names.length) { buf.append(" or "); } else { buf.append(", "); } } buf.append('"'); buf.append(names[i]); buf.append('"'); } } }
public class class_name { private static void appendToSentence(StringBuilder buf, String[] names) { for (int i=0; i<names.length; i++) { if (i > 0) { if (i + 1 >= names.length) { buf.append(" or "); // depends on control dependency: [if], data = [none] } else { buf.append(", "); // depends on control dependency: [if], data = [none] } } buf.append('"'); // depends on control dependency: [for], data = [none] buf.append(names[i]); // depends on control dependency: [for], data = [i] buf.append('"'); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static void modifiersToString(final int modifiers, final ModifierType modifierType, final boolean isDefault, final StringBuilder buf) { if ((modifiers & Modifier.PUBLIC) != 0) { appendModifierKeyword(buf, "public"); } else if ((modifiers & Modifier.PRIVATE) != 0) { appendModifierKeyword(buf, "private"); } else if ((modifiers & Modifier.PROTECTED) != 0) { appendModifierKeyword(buf, "protected"); } if (modifierType != ModifierType.FIELD && (modifiers & Modifier.ABSTRACT) != 0) { appendModifierKeyword(buf, "abstract"); } if ((modifiers & Modifier.STATIC) != 0) { appendModifierKeyword(buf, "static"); } if (modifierType == ModifierType.FIELD) { if ((modifiers & Modifier.VOLATILE) != 0) { // "bridge" and "volatile" overlap in bit 0x40 appendModifierKeyword(buf, "volatile"); } if ((modifiers & Modifier.TRANSIENT) != 0) { appendModifierKeyword(buf, "transient"); } } if ((modifiers & Modifier.FINAL) != 0) { appendModifierKeyword(buf, "final"); } if (modifierType == ModifierType.METHOD) { if ((modifiers & Modifier.SYNCHRONIZED) != 0) { appendModifierKeyword(buf, "synchronized"); } if (isDefault) { appendModifierKeyword(buf, "default"); } } if ((modifiers & 0x1000) != 0) { appendModifierKeyword(buf, "synthetic"); } if (modifierType != ModifierType.FIELD && (modifiers & 0x40) != 0) { // "bridge" and "volatile" overlap in bit 0x40 appendModifierKeyword(buf, "bridge"); } if (modifierType == ModifierType.METHOD && (modifiers & Modifier.NATIVE) != 0) { appendModifierKeyword(buf, "native"); } if (modifierType != ModifierType.FIELD && (modifiers & Modifier.STRICT) != 0) { appendModifierKeyword(buf, "strictfp"); } // Ignored: // ACC_SUPER (0x0020): Treat superclass methods specially when invoked by the invokespecial instruction } }
public class class_name { public static void modifiersToString(final int modifiers, final ModifierType modifierType, final boolean isDefault, final StringBuilder buf) { if ((modifiers & Modifier.PUBLIC) != 0) { appendModifierKeyword(buf, "public"); // depends on control dependency: [if], data = [none] } else if ((modifiers & Modifier.PRIVATE) != 0) { appendModifierKeyword(buf, "private"); // depends on control dependency: [if], data = [none] } else if ((modifiers & Modifier.PROTECTED) != 0) { appendModifierKeyword(buf, "protected"); // depends on control dependency: [if], data = [none] } if (modifierType != ModifierType.FIELD && (modifiers & Modifier.ABSTRACT) != 0) { appendModifierKeyword(buf, "abstract"); // depends on control dependency: [if], data = [none] } if ((modifiers & Modifier.STATIC) != 0) { appendModifierKeyword(buf, "static"); // depends on control dependency: [if], data = [none] } if (modifierType == ModifierType.FIELD) { if ((modifiers & Modifier.VOLATILE) != 0) { // "bridge" and "volatile" overlap in bit 0x40 appendModifierKeyword(buf, "volatile"); // depends on control dependency: [if], data = [none] } if ((modifiers & Modifier.TRANSIENT) != 0) { appendModifierKeyword(buf, "transient"); // depends on control dependency: [if], data = [none] } } if ((modifiers & Modifier.FINAL) != 0) { appendModifierKeyword(buf, "final"); // depends on control dependency: [if], data = [none] } if (modifierType == ModifierType.METHOD) { if ((modifiers & Modifier.SYNCHRONIZED) != 0) { appendModifierKeyword(buf, "synchronized"); // depends on control dependency: [if], data = [none] } if (isDefault) { appendModifierKeyword(buf, "default"); // depends on control dependency: [if], data = [none] } } if ((modifiers & 0x1000) != 0) { appendModifierKeyword(buf, "synthetic"); // depends on control dependency: [if], data = [none] } if (modifierType != ModifierType.FIELD && (modifiers & 0x40) != 0) { // "bridge" and "volatile" overlap in bit 0x40 appendModifierKeyword(buf, "bridge"); // depends on control dependency: [if], data = [none] } if (modifierType == ModifierType.METHOD && (modifiers & Modifier.NATIVE) != 0) { appendModifierKeyword(buf, "native"); // depends on control dependency: [if], data = [none] } if (modifierType != ModifierType.FIELD && (modifiers & Modifier.STRICT) != 0) { appendModifierKeyword(buf, "strictfp"); // depends on control dependency: [if], data = [none] } // Ignored: // ACC_SUPER (0x0020): Treat superclass methods specially when invoked by the invokespecial instruction } }
public class class_name { @Override public void generate(final Module module, final Element element) { // this is not necessary, it is done to avoid the namespace definition // in every item. Element root = element; while (root.getParent() != null && root.getParent() instanceof Element) { root = (Element) element.getParent(); } root.addNamespaceDeclaration(GeoRSSModule.W3CGEO_NS); Element pointElement = element; if (!isShort) { pointElement = new Element("Point", GeoRSSModule.W3CGEO_NS); element.addContent(pointElement); } final GeoRSSModule geoRSSModule = (GeoRSSModule) module; final AbstractGeometry geometry = geoRSSModule.getGeometry(); if (geometry instanceof Point) { final Position pos = ((Point) geometry).getPosition(); final Element latElement = new Element("lat", GeoRSSModule.W3CGEO_NS); latElement.addContent(String.valueOf(pos.getLatitude())); pointElement.addContent(latElement); final Element lngElement = new Element("long", GeoRSSModule.W3CGEO_NS); lngElement.addContent(String.valueOf(pos.getLongitude())); pointElement.addContent(lngElement); } else { System.err.println("W3C Geo format can't handle geometries of type: " + geometry.getClass().getName()); } } }
public class class_name { @Override public void generate(final Module module, final Element element) { // this is not necessary, it is done to avoid the namespace definition // in every item. Element root = element; while (root.getParent() != null && root.getParent() instanceof Element) { root = (Element) element.getParent(); // depends on control dependency: [while], data = [none] } root.addNamespaceDeclaration(GeoRSSModule.W3CGEO_NS); Element pointElement = element; if (!isShort) { pointElement = new Element("Point", GeoRSSModule.W3CGEO_NS); // depends on control dependency: [if], data = [none] element.addContent(pointElement); // depends on control dependency: [if], data = [none] } final GeoRSSModule geoRSSModule = (GeoRSSModule) module; final AbstractGeometry geometry = geoRSSModule.getGeometry(); if (geometry instanceof Point) { final Position pos = ((Point) geometry).getPosition(); final Element latElement = new Element("lat", GeoRSSModule.W3CGEO_NS); latElement.addContent(String.valueOf(pos.getLatitude())); // depends on control dependency: [if], data = [none] pointElement.addContent(latElement); // depends on control dependency: [if], data = [none] final Element lngElement = new Element("long", GeoRSSModule.W3CGEO_NS); lngElement.addContent(String.valueOf(pos.getLongitude())); // depends on control dependency: [if], data = [none] pointElement.addContent(lngElement); // depends on control dependency: [if], data = [none] } else { System.err.println("W3C Geo format can't handle geometries of type: " + geometry.getClass().getName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double distance( LineSegment2D_I32 line, Point2D_I32 p ) { int a = line.b.x - line.a.x; int b = line.b.y - line.a.y; double t = a * ( p.x - line.a.x ) + b * ( p.y - line.a.y ); t /= ( a * a + b * b ); // if the point of intersection is past the end points return the distance // from the closest end point if( t < 0 ) { return UtilPoint2D_I32.distance(line.a.x, line.a.y, p.x, p.y); } else if( t > 1.0 ) return UtilPoint2D_I32.distance( line.b.x, line.b.y, p.x, p.y ); // return the distance of the closest point on the line return UtilPoint2D_F64.distance(line.a.x + t * a, line.a.y + t * b, p.x, p.y); } }
public class class_name { public static double distance( LineSegment2D_I32 line, Point2D_I32 p ) { int a = line.b.x - line.a.x; int b = line.b.y - line.a.y; double t = a * ( p.x - line.a.x ) + b * ( p.y - line.a.y ); t /= ( a * a + b * b ); // if the point of intersection is past the end points return the distance // from the closest end point if( t < 0 ) { return UtilPoint2D_I32.distance(line.a.x, line.a.y, p.x, p.y); // depends on control dependency: [if], data = [none] } else if( t > 1.0 ) return UtilPoint2D_I32.distance( line.b.x, line.b.y, p.x, p.y ); // return the distance of the closest point on the line return UtilPoint2D_F64.distance(line.a.x + t * a, line.a.y + t * b, p.x, p.y); } }
public class class_name { public Completable connect() { if (!conductor.disconnected()) { // short-circuit connect attempt if the conductor is already connecting/connected. LOGGER.debug("Ignoring duplicate connect attempt, already connecting/connected."); return Completable.complete(); } if (env.dataEventHandler() == null) { throw new IllegalArgumentException("A DataEventHandler needs to be provided!"); } if (env.controlEventHandler() == null) { throw new IllegalArgumentException("A ControlEventHandler needs to be provided!"); } LOGGER.info("Connecting to seed nodes and bootstrapping bucket {}.", meta(env.bucket())); return conductor.connect().onErrorResumeNext(new Func1<Throwable, Completable>() { @Override public Completable call(Throwable throwable) { return conductor.stop() .andThen(Completable.error(new BootstrapException("Could not connect to Cluster/Bucket", throwable))); } }); } }
public class class_name { public Completable connect() { if (!conductor.disconnected()) { // short-circuit connect attempt if the conductor is already connecting/connected. LOGGER.debug("Ignoring duplicate connect attempt, already connecting/connected."); // depends on control dependency: [if], data = [none] return Completable.complete(); // depends on control dependency: [if], data = [none] } if (env.dataEventHandler() == null) { throw new IllegalArgumentException("A DataEventHandler needs to be provided!"); } if (env.controlEventHandler() == null) { throw new IllegalArgumentException("A ControlEventHandler needs to be provided!"); } LOGGER.info("Connecting to seed nodes and bootstrapping bucket {}.", meta(env.bucket())); return conductor.connect().onErrorResumeNext(new Func1<Throwable, Completable>() { @Override public Completable call(Throwable throwable) { return conductor.stop() .andThen(Completable.error(new BootstrapException("Could not connect to Cluster/Bucket", throwable))); } }); } }
public class class_name { private static byte[] macAddress() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); byte[] mac = null; while (interfaces.hasMoreElements() && (mac == null || mac.length != 6)) { NetworkInterface netInterface = interfaces.nextElement(); if (netInterface.isLoopback() || netInterface.isVirtual()) continue; mac = netInterface.getHardwareAddress(); } // if the machine is not connected to a network it has no active MAC address if (mac == null) mac = new byte[] {0, 0, 0, 0, 0, 0}; return mac; } catch (Exception e) { throw new RuntimeException("Could not get MAC address"); } } }
public class class_name { private static byte[] macAddress() { try { Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); byte[] mac = null; while (interfaces.hasMoreElements() && (mac == null || mac.length != 6)) { NetworkInterface netInterface = interfaces.nextElement(); if (netInterface.isLoopback() || netInterface.isVirtual()) continue; mac = netInterface.getHardwareAddress(); // depends on control dependency: [while], data = [none] } // if the machine is not connected to a network it has no active MAC address if (mac == null) mac = new byte[] {0, 0, 0, 0, 0, 0}; return mac; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Could not get MAC address"); } // depends on control dependency: [catch], data = [none] } }