code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private Method findToStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException(ex); } if (Modifier.isStatic(m.getModifiers())) { throw new IllegalArgumentException("Method must not be static: " + methodName); } return m; } }
public class class_name { private Method findToStringMethod(Class<?> cls, String methodName) { Method m; try { m = cls.getMethod(methodName); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException ex) { throw new IllegalArgumentException(ex); } // depends on control dependency: [catch], data = [none] if (Modifier.isStatic(m.getModifiers())) { throw new IllegalArgumentException("Method must not be static: " + methodName); } return m; } }
public class class_name { public static String setter(TypeName beanClass, String beanName, ModelProperty property) { if (property.getParent()!=null && ((ModelClass<?>) property.getParent()).isImmutablePojo()) { return ImmutableUtility.IMMUTABLE_PREFIX + property.getName(); } else { String prefix=""; if (beanName!=null) { prefix=beanName+"."; } if (property.isPublicField()) { return prefix+property.getName(); } else if (property.isFieldWithSetter()) { return prefix+"set" + converterField2Method.convert(property.getName()); } else { throw new PropertyVisibilityException(String.format("property '%s' of class '%s' can not be modify", property.getName(), property.getParent().getElement().asType())); } } } }
public class class_name { public static String setter(TypeName beanClass, String beanName, ModelProperty property) { if (property.getParent()!=null && ((ModelClass<?>) property.getParent()).isImmutablePojo()) { return ImmutableUtility.IMMUTABLE_PREFIX + property.getName(); // depends on control dependency: [if], data = [none] } else { String prefix=""; if (beanName!=null) { prefix=beanName+"."; // depends on control dependency: [if], data = [none] } if (property.isPublicField()) { return prefix+property.getName(); // depends on control dependency: [if], data = [none] } else if (property.isFieldWithSetter()) { return prefix+"set" + converterField2Method.convert(property.getName()); // depends on control dependency: [if], data = [none] } else { throw new PropertyVisibilityException(String.format("property '%s' of class '%s' can not be modify", property.getName(), property.getParent().getElement().asType())); } } } }
public class class_name { public ByteBuffer readToByteBuffer(ByteBuffer dest, int elements, ByteStorageSupport<?> storage) throws IOException { int bytesAllocated = storage.getBytesAllocated(); int size = elements * storage.getBytesAllocated(); //direct buffer copy if ( MatDataTypes.sizeOf(type) == bytesAllocated && buf.order().equals(dest.order()) ) { int bufMaxSize = 1024; int bufSize = Math.min(buf.remaining(), bufMaxSize); int bufPos = buf.position(); byte[] tmp = new byte[ bufSize ]; while ( dest.remaining() > 0 ) { int length = Math.min(dest.remaining(), tmp.length); buf.get( tmp, 0, length ); dest.put( tmp, 0, length ); } buf.position( bufPos + size ); } else { //because Matlab writes data not respectively to the declared //matrix type, the reading is not straight forward (as above) Class<?> clazz = storage.getStorageClazz(); while ( dest.remaining() > 0 ) { if ( clazz.equals( Double.class) ) { dest.putDouble( readDouble() ); } else if ( clazz.equals( Byte.class) ) { dest.put( readByte() ); } else if ( clazz.equals( Integer.class) ) { dest.putInt( readInt() ); } else if ( clazz.equals( Long.class) ) { dest.putLong( readLong() ); } else if ( clazz.equals( Float.class) ) { dest.putFloat( readFloat() ); } else if ( clazz.equals( Short.class) ) { dest.putShort( readShort() ); } else { throw new RuntimeException("Not supported buffer reader for " + clazz ); } } } dest.rewind(); return dest; } }
public class class_name { public ByteBuffer readToByteBuffer(ByteBuffer dest, int elements, ByteStorageSupport<?> storage) throws IOException { int bytesAllocated = storage.getBytesAllocated(); int size = elements * storage.getBytesAllocated(); //direct buffer copy if ( MatDataTypes.sizeOf(type) == bytesAllocated && buf.order().equals(dest.order()) ) { int bufMaxSize = 1024; int bufSize = Math.min(buf.remaining(), bufMaxSize); int bufPos = buf.position(); byte[] tmp = new byte[ bufSize ]; while ( dest.remaining() > 0 ) { int length = Math.min(dest.remaining(), tmp.length); buf.get( tmp, 0, length ); // depends on control dependency: [while], data = [none] dest.put( tmp, 0, length ); // depends on control dependency: [while], data = [none] } buf.position( bufPos + size ); } else { //because Matlab writes data not respectively to the declared //matrix type, the reading is not straight forward (as above) Class<?> clazz = storage.getStorageClazz(); while ( dest.remaining() > 0 ) { if ( clazz.equals( Double.class) ) { dest.putDouble( readDouble() ); // depends on control dependency: [if], data = [none] } else if ( clazz.equals( Byte.class) ) { dest.put( readByte() ); // depends on control dependency: [if], data = [none] } else if ( clazz.equals( Integer.class) ) { dest.putInt( readInt() ); // depends on control dependency: [if], data = [none] } else if ( clazz.equals( Long.class) ) { dest.putLong( readLong() ); // depends on control dependency: [if], data = [none] } else if ( clazz.equals( Float.class) ) { dest.putFloat( readFloat() ); // depends on control dependency: [if], data = [none] } else if ( clazz.equals( Short.class) ) { dest.putShort( readShort() ); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("Not supported buffer reader for " + clazz ); } } } dest.rewind(); return dest; } }
public class class_name { public ServiceCall<FeedbackReturn> addFeedback(AddFeedbackOptions addFeedbackOptions) { Validator.notNull(addFeedbackOptions, "addFeedbackOptions cannot be null"); String[] pathSegments = { "v1/feedback" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("compare-comply", "v1", "addFeedback"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); contentJson.add("feedback_data", GsonSingleton.getGson().toJsonTree(addFeedbackOptions.feedbackData())); if (addFeedbackOptions.userId() != null) { contentJson.addProperty("user_id", addFeedbackOptions.userId()); } if (addFeedbackOptions.comment() != null) { contentJson.addProperty("comment", addFeedbackOptions.comment()); } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(FeedbackReturn.class)); } }
public class class_name { public ServiceCall<FeedbackReturn> addFeedback(AddFeedbackOptions addFeedbackOptions) { Validator.notNull(addFeedbackOptions, "addFeedbackOptions cannot be null"); String[] pathSegments = { "v1/feedback" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("compare-comply", "v1", "addFeedback"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); contentJson.add("feedback_data", GsonSingleton.getGson().toJsonTree(addFeedbackOptions.feedbackData())); if (addFeedbackOptions.userId() != null) { contentJson.addProperty("user_id", addFeedbackOptions.userId()); // depends on control dependency: [if], data = [none] } if (addFeedbackOptions.comment() != null) { contentJson.addProperty("comment", addFeedbackOptions.comment()); // depends on control dependency: [if], data = [none] } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(FeedbackReturn.class)); } }
public class class_name { protected synchronized void completeSnapshot(Snapshot snapshot) { checkNotNull(snapshot, "snapshot cannot be null"); Map.Entry<Long, Snapshot> lastEntry = snapshots.lastEntry(); if (lastEntry == null) { snapshots.put(snapshot.index(), snapshot); } else if (lastEntry.getValue().index() < snapshot.index()) { snapshots.put(snapshot.index(), snapshot); Snapshot lastSnapshot = lastEntry.getValue(); lastSnapshot.close(); lastSnapshot.delete(); } else if (storage.isRetainStaleSnapshots()) { snapshots.put(snapshot.index(), snapshot); } else { snapshot.close(); snapshot.delete(); } } }
public class class_name { protected synchronized void completeSnapshot(Snapshot snapshot) { checkNotNull(snapshot, "snapshot cannot be null"); Map.Entry<Long, Snapshot> lastEntry = snapshots.lastEntry(); if (lastEntry == null) { snapshots.put(snapshot.index(), snapshot); // depends on control dependency: [if], data = [none] } else if (lastEntry.getValue().index() < snapshot.index()) { snapshots.put(snapshot.index(), snapshot); // depends on control dependency: [if], data = [none] Snapshot lastSnapshot = lastEntry.getValue(); lastSnapshot.close(); // depends on control dependency: [if], data = [none] lastSnapshot.delete(); // depends on control dependency: [if], data = [none] } else if (storage.isRetainStaleSnapshots()) { snapshots.put(snapshot.index(), snapshot); // depends on control dependency: [if], data = [none] } else { snapshot.close(); // depends on control dependency: [if], data = [none] snapshot.delete(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private List<PortletFilter> getFilters(PortletRequest request) { for (PortletSecurityFilterChain chain : filterChains) { if (chain.matches(request)) { return chain.getFilters(); } } return null; } }
public class class_name { private List<PortletFilter> getFilters(PortletRequest request) { for (PortletSecurityFilterChain chain : filterChains) { if (chain.matches(request)) { return chain.getFilters(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static Trades adaptTrades( MercadoBitcoinTransaction[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (MercadoBitcoinTransaction tx : transactions) { final long tradeId = tx.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } trades.add( new Trade( toOrderType(tx.getType()), tx.getAmount(), currencyPair, tx.getPrice(), DateUtils.fromMillisUtc(tx.getDate() * 1000L), String.valueOf(tradeId))); } return new Trades(trades, lastTradeId, Trades.TradeSortType.SortByID); } }
public class class_name { public static Trades adaptTrades( MercadoBitcoinTransaction[] transactions, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); long lastTradeId = 0; for (MercadoBitcoinTransaction tx : transactions) { final long tradeId = tx.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; // depends on control dependency: [if], data = [none] } trades.add( new Trade( toOrderType(tx.getType()), tx.getAmount(), currencyPair, tx.getPrice(), DateUtils.fromMillisUtc(tx.getDate() * 1000L), String.valueOf(tradeId))); // depends on control dependency: [for], data = [none] } return new Trades(trades, lastTradeId, Trades.TradeSortType.SortByID); } }
public class class_name { @Override public <T> T doWithRest(RestOperationsCallback<T> callback) { Assert.notNull(callback, "callback must not be null"); try { return callback.doWithRestOperations(restTemplate); } catch (HttpStatusCodeException e) { throw new CredHubException(e); } } }
public class class_name { @Override public <T> T doWithRest(RestOperationsCallback<T> callback) { Assert.notNull(callback, "callback must not be null"); try { return callback.doWithRestOperations(restTemplate); // depends on control dependency: [try], data = [none] } catch (HttpStatusCodeException e) { throw new CredHubException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Boolean getBoolean(Config config, String path) { try { return config.getBoolean(path) ? Boolean.TRUE : Boolean.FALSE; } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } } }
public class class_name { public static Boolean getBoolean(Config config, String path) { try { return config.getBoolean(path) ? Boolean.TRUE : Boolean.FALSE; // depends on control dependency: [try], data = [none] } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); // depends on control dependency: [if], data = [none] } return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean processKeyUp(int keyCode) { if (keyCode == KeyEvent.KEYCODE_TAB) { if(mInKbMode) { if (isTypedTimeFullyLegal()) { finishKbMode(true); } return true; } } else if (keyCode == KeyEvent.KEYCODE_ENTER) { if (mInKbMode) { if (!isTypedTimeFullyLegal()) { return true; } finishKbMode(false); } if (mCallback != null) { mCallback.onTimeSet(this, mTimePicker.getHours(), mTimePicker.getMinutes(), mTimePicker.getSeconds()); } dismiss(); return true; } else if (keyCode == KeyEvent.KEYCODE_DEL) { if (mInKbMode) { if (!mTypedTimes.isEmpty()) { int deleted = deleteLastTypedKey(); String deletedKeyStr; if (deleted == getAmOrPmKeyCode(AM)) { deletedKeyStr = mAmText; } else if (deleted == getAmOrPmKeyCode(PM)) { deletedKeyStr = mPmText; } else { deletedKeyStr = String.format(mLocale, "%d", getValFromKeyCode(deleted)); } Utils.tryAccessibilityAnnounce(mTimePicker, String.format(mDeletedKeyFormat, deletedKeyStr)); updateDisplay(true); } } } else if (keyCode == KeyEvent.KEYCODE_0 || keyCode == KeyEvent.KEYCODE_1 || keyCode == KeyEvent.KEYCODE_2 || keyCode == KeyEvent.KEYCODE_3 || keyCode == KeyEvent.KEYCODE_4 || keyCode == KeyEvent.KEYCODE_5 || keyCode == KeyEvent.KEYCODE_6 || keyCode == KeyEvent.KEYCODE_7 || keyCode == KeyEvent.KEYCODE_8 || keyCode == KeyEvent.KEYCODE_9 || (!mIs24HourMode && (keyCode == getAmOrPmKeyCode(AM) || keyCode == getAmOrPmKeyCode(PM)))) { if (!mInKbMode) { if (mTimePicker == null) { // Something's wrong, because time picker should definitely not be null. Log.e(TAG, "Unable to initiate keyboard mode, TimePicker was null."); return true; } mTypedTimes.clear(); tryStartingKbMode(keyCode); return true; } // We're already in keyboard mode. if (addKeyIfLegal(keyCode)) { updateDisplay(false); } return true; } return false; } }
public class class_name { private boolean processKeyUp(int keyCode) { if (keyCode == KeyEvent.KEYCODE_TAB) { if(mInKbMode) { if (isTypedTimeFullyLegal()) { finishKbMode(true); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } else if (keyCode == KeyEvent.KEYCODE_ENTER) { if (mInKbMode) { if (!isTypedTimeFullyLegal()) { return true; // depends on control dependency: [if], data = [none] } finishKbMode(false); // depends on control dependency: [if], data = [none] } if (mCallback != null) { mCallback.onTimeSet(this, mTimePicker.getHours(), mTimePicker.getMinutes(), mTimePicker.getSeconds()); // depends on control dependency: [if], data = [none] } dismiss(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else if (keyCode == KeyEvent.KEYCODE_DEL) { if (mInKbMode) { if (!mTypedTimes.isEmpty()) { int deleted = deleteLastTypedKey(); String deletedKeyStr; if (deleted == getAmOrPmKeyCode(AM)) { deletedKeyStr = mAmText; // depends on control dependency: [if], data = [none] } else if (deleted == getAmOrPmKeyCode(PM)) { deletedKeyStr = mPmText; // depends on control dependency: [if], data = [none] } else { deletedKeyStr = String.format(mLocale, "%d", getValFromKeyCode(deleted)); // depends on control dependency: [if], data = [(deleted] } Utils.tryAccessibilityAnnounce(mTimePicker, String.format(mDeletedKeyFormat, deletedKeyStr)); // depends on control dependency: [if], data = [none] updateDisplay(true); // depends on control dependency: [if], data = [none] } } } else if (keyCode == KeyEvent.KEYCODE_0 || keyCode == KeyEvent.KEYCODE_1 || keyCode == KeyEvent.KEYCODE_2 || keyCode == KeyEvent.KEYCODE_3 || keyCode == KeyEvent.KEYCODE_4 || keyCode == KeyEvent.KEYCODE_5 || keyCode == KeyEvent.KEYCODE_6 || keyCode == KeyEvent.KEYCODE_7 || keyCode == KeyEvent.KEYCODE_8 || keyCode == KeyEvent.KEYCODE_9 || (!mIs24HourMode && (keyCode == getAmOrPmKeyCode(AM) || keyCode == getAmOrPmKeyCode(PM)))) { if (!mInKbMode) { if (mTimePicker == null) { // Something's wrong, because time picker should definitely not be null. Log.e(TAG, "Unable to initiate keyboard mode, TimePicker was null."); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } mTypedTimes.clear(); // depends on control dependency: [if], data = [none] tryStartingKbMode(keyCode); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // We're already in keyboard mode. if (addKeyIfLegal(keyCode)) { updateDisplay(false); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @SuppressWarnings("unchecked") Map<String, Object> flatten(Map<String, Object> source) { Map<String, Object> result = new LinkedHashMap<>(); for (String key : source.keySet()) { Object value = source.get(key); if (value instanceof Map) { Map<String, Object> subMap = flatten((Map<String, Object>) value); for (String subkey : subMap.keySet()) { result.put(key + "." + subkey, subMap.get(subkey)); } } else if (value instanceof Collection) { StringBuilder joiner = new StringBuilder(); String separator = ""; for (Object element : ((Collection) value)) { Map<String, Object> subMap = flatten(Collections.singletonMap(key, element)); joiner .append(separator) .append(subMap.entrySet().iterator().next().getValue().toString()); separator = ","; } result.put(key, joiner.toString()); } else { result.put(key, value); } } return result; } }
public class class_name { @SuppressWarnings("unchecked") Map<String, Object> flatten(Map<String, Object> source) { Map<String, Object> result = new LinkedHashMap<>(); for (String key : source.keySet()) { Object value = source.get(key); if (value instanceof Map) { Map<String, Object> subMap = flatten((Map<String, Object>) value); for (String subkey : subMap.keySet()) { result.put(key + "." + subkey, subMap.get(subkey)); // depends on control dependency: [for], data = [subkey] } } else if (value instanceof Collection) { StringBuilder joiner = new StringBuilder(); String separator = ""; for (Object element : ((Collection) value)) { Map<String, Object> subMap = flatten(Collections.singletonMap(key, element)); joiner .append(separator) .append(subMap.entrySet().iterator().next().getValue().toString()); // depends on control dependency: [for], data = [none] separator = ","; // depends on control dependency: [for], data = [none] } result.put(key, joiner.toString()); // depends on control dependency: [if], data = [none] } else { result.put(key, value); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @Override public Object getInstance() { final String sourceMethod = "getInstance"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AggregatorExtension.class.getName(), sourceMethod); log.exiting(AggregatorExtension.class.getName(), sourceMethod, instance); } return instance; } }
public class class_name { @Override public Object getInstance() { final String sourceMethod = "getInstance"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AggregatorExtension.class.getName(), sourceMethod); // depends on control dependency: [if], data = [none] log.exiting(AggregatorExtension.class.getName(), sourceMethod, instance); // depends on control dependency: [if], data = [none] } return instance; } }
public class class_name { public void addCase(JMFType theCase) { if (theCase == null) throw new NullPointerException("Variant case cannot be null"); JSType newCase = (JSType)theCase; if (cases == null) cases = new JSType[1]; else { JSType[] oldCases = cases; cases = new JSType[oldCases.length + 1]; System.arraycopy(oldCases, 0, cases, 0, oldCases.length); } newCase.parent = this; newCase.siblingPosition = cases.length - 1; cases[newCase.siblingPosition] = newCase; } }
public class class_name { public void addCase(JMFType theCase) { if (theCase == null) throw new NullPointerException("Variant case cannot be null"); JSType newCase = (JSType)theCase; if (cases == null) cases = new JSType[1]; else { JSType[] oldCases = cases; cases = new JSType[oldCases.length + 1]; // depends on control dependency: [if], data = [none] System.arraycopy(oldCases, 0, cases, 0, oldCases.length); // depends on control dependency: [if], data = [none] } newCase.parent = this; newCase.siblingPosition = cases.length - 1; cases[newCase.siblingPosition] = newCase; } }
public class class_name { public static String generateMD5(final byte[] input) { try { final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.reset(); byte[] digest = messageDigest.digest(input); return new String(Hex.encodeHex(digest)); } catch (Exception e) { LOG.debug("An error occurred generating the MD5 Hash of the input string", e); return null; } } }
public class class_name { public static String generateMD5(final byte[] input) { try { final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); messageDigest.reset(); // depends on control dependency: [try], data = [none] byte[] digest = messageDigest.digest(input); return new String(Hex.encodeHex(digest)); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.debug("An error occurred generating the MD5 Hash of the input string", e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void waitForNextRecord(long startingTime, long timestamp) { if(mFirstTimestamp == 0) { mFirstTimestamp = timestamp; Log.d(TAG, "Storing " + timestamp + " as the first " + "timestamp of the trace file"); } long targetTime = startingTime + (timestamp - mFirstTimestamp); long sleepDuration = Math.max(targetTime - System.currentTimeMillis(), 0); try { Thread.sleep(sleepDuration); } catch(InterruptedException e) {} } }
public class class_name { private void waitForNextRecord(long startingTime, long timestamp) { if(mFirstTimestamp == 0) { mFirstTimestamp = timestamp; // depends on control dependency: [if], data = [none] Log.d(TAG, "Storing " + timestamp + " as the first " + "timestamp of the trace file"); // depends on control dependency: [if], data = [none] } long targetTime = startingTime + (timestamp - mFirstTimestamp); long sleepDuration = Math.max(targetTime - System.currentTimeMillis(), 0); try { Thread.sleep(sleepDuration); // depends on control dependency: [try], data = [none] } catch(InterruptedException e) {} // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void close(VirtualConnection inVC, Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "close, vc=" + getVCHash()); } // Set closed flag so that ready can't be called again in an error condition. // This is a protective measure. closed = true; // Clean up the read and write interfaces as well as the SSL engine. // cleanup has logic to avoid writing if stop(0) has been called cleanup(); //If the channel has already processed the close signal, it is too late to try and clean up the individual connection links here. //This race condition should not happen if channels above us are well behaved, so not using synchronize logic here, so as not to //impact mainline performance. if (this.sslChannel.getstop0Called() != true) { if (getDeviceLink() != null) { getDeviceLink().close(inVC, e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "close"); } } }
public class class_name { @Override public void close(VirtualConnection inVC, Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "close, vc=" + getVCHash()); // depends on control dependency: [if], data = [none] } // Set closed flag so that ready can't be called again in an error condition. // This is a protective measure. closed = true; // Clean up the read and write interfaces as well as the SSL engine. // cleanup has logic to avoid writing if stop(0) has been called cleanup(); //If the channel has already processed the close signal, it is too late to try and clean up the individual connection links here. //This race condition should not happen if channels above us are well behaved, so not using synchronize logic here, so as not to //impact mainline performance. if (this.sslChannel.getstop0Called() != true) { if (getDeviceLink() != null) { getDeviceLink().close(inVC, e); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "close"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static List<CmsAttributeComparison> compareProperties( CmsObject cms, CmsResource resource1, String version1, CmsResource resource2, String version2) throws CmsException { List<CmsProperty> properties1; if (resource1 instanceof I_CmsHistoryResource) { properties1 = cms.readHistoryPropertyObjects((I_CmsHistoryResource)resource1); } else { if (Integer.parseInt(version1) < 0) { // switch to the online project CmsProject prj = cms.getRequestContext().getCurrentProject(); try { cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); properties1 = cms.readPropertyObjects(resource1, false); } finally { cms.getRequestContext().setCurrentProject(prj); } } else { properties1 = cms.readPropertyObjects(resource1, false); } } List<CmsProperty> properties2; if (resource2 instanceof I_CmsHistoryResource) { properties2 = cms.readHistoryPropertyObjects((I_CmsHistoryResource)resource2); } else { if (Integer.parseInt(version2) < 0) { // switch to the online project CmsProject prj = cms.getRequestContext().getCurrentProject(); try { cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); properties2 = cms.readPropertyObjects(resource2, false); } finally { cms.getRequestContext().setCurrentProject(prj); } } else { properties2 = cms.readPropertyObjects(resource2, false); } } List<CmsAttributeComparison> comparedProperties = new ArrayList<CmsAttributeComparison>(); List<CmsProperty> removedProperties = new ArrayList<CmsProperty>(properties1); removedProperties.removeAll(properties2); List<CmsProperty> addedProperties = new ArrayList<CmsProperty>(properties2); addedProperties.removeAll(properties1); List<CmsProperty> retainedProperties = new ArrayList<CmsProperty>(properties2); retainedProperties.retainAll(properties1); CmsProperty prop; Iterator<CmsProperty> i = addedProperties.iterator(); while (i.hasNext()) { prop = i.next(); comparedProperties.add( new CmsAttributeComparison(prop.getName(), "", prop.getValue(), CmsResourceComparison.TYPE_ADDED)); } i = removedProperties.iterator(); while (i.hasNext()) { prop = i.next(); comparedProperties.add( new CmsAttributeComparison(prop.getName(), prop.getValue(), "", CmsResourceComparison.TYPE_REMOVED)); } i = retainedProperties.iterator(); while (i.hasNext()) { prop = i.next(); String value1 = properties1.get(properties1.indexOf(prop)).getValue(); String value2 = properties2.get(properties2.indexOf(prop)).getValue(); if (value1.equals(value2)) { comparedProperties.add( new CmsAttributeComparison(prop.getName(), value1, value2, CmsResourceComparison.TYPE_UNCHANGED)); } else { comparedProperties.add( new CmsAttributeComparison(prop.getName(), value1, value2, CmsResourceComparison.TYPE_CHANGED)); } } return comparedProperties; } }
public class class_name { public static List<CmsAttributeComparison> compareProperties( CmsObject cms, CmsResource resource1, String version1, CmsResource resource2, String version2) throws CmsException { List<CmsProperty> properties1; if (resource1 instanceof I_CmsHistoryResource) { properties1 = cms.readHistoryPropertyObjects((I_CmsHistoryResource)resource1); } else { if (Integer.parseInt(version1) < 0) { // switch to the online project CmsProject prj = cms.getRequestContext().getCurrentProject(); try { cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); // depends on control dependency: [try], data = [none] properties1 = cms.readPropertyObjects(resource1, false); // depends on control dependency: [try], data = [none] } finally { cms.getRequestContext().setCurrentProject(prj); } } else { properties1 = cms.readPropertyObjects(resource1, false); // depends on control dependency: [if], data = [none] } } List<CmsProperty> properties2; if (resource2 instanceof I_CmsHistoryResource) { properties2 = cms.readHistoryPropertyObjects((I_CmsHistoryResource)resource2); } else { if (Integer.parseInt(version2) < 0) { // switch to the online project CmsProject prj = cms.getRequestContext().getCurrentProject(); try { cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); // depends on control dependency: [try], data = [none] properties2 = cms.readPropertyObjects(resource2, false); // depends on control dependency: [try], data = [none] } finally { cms.getRequestContext().setCurrentProject(prj); } } else { properties2 = cms.readPropertyObjects(resource2, false); // depends on control dependency: [if], data = [none] } } List<CmsAttributeComparison> comparedProperties = new ArrayList<CmsAttributeComparison>(); List<CmsProperty> removedProperties = new ArrayList<CmsProperty>(properties1); removedProperties.removeAll(properties2); List<CmsProperty> addedProperties = new ArrayList<CmsProperty>(properties2); addedProperties.removeAll(properties1); List<CmsProperty> retainedProperties = new ArrayList<CmsProperty>(properties2); retainedProperties.retainAll(properties1); CmsProperty prop; Iterator<CmsProperty> i = addedProperties.iterator(); while (i.hasNext()) { prop = i.next(); comparedProperties.add( new CmsAttributeComparison(prop.getName(), "", prop.getValue(), CmsResourceComparison.TYPE_ADDED)); } i = removedProperties.iterator(); while (i.hasNext()) { prop = i.next(); comparedProperties.add( new CmsAttributeComparison(prop.getName(), prop.getValue(), "", CmsResourceComparison.TYPE_REMOVED)); } i = retainedProperties.iterator(); while (i.hasNext()) { prop = i.next(); String value1 = properties1.get(properties1.indexOf(prop)).getValue(); String value2 = properties2.get(properties2.indexOf(prop)).getValue(); if (value1.equals(value2)) { comparedProperties.add( new CmsAttributeComparison(prop.getName(), value1, value2, CmsResourceComparison.TYPE_UNCHANGED)); } else { comparedProperties.add( new CmsAttributeComparison(prop.getName(), value1, value2, CmsResourceComparison.TYPE_CHANGED)); } } return comparedProperties; } }
public class class_name { public void removeNotificationHandler(String serviceName, NotificationHandler handler){ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); } if(list.size() == 0){ notificationHandlers.remove(serviceName); } } } } }
public class class_name { public void removeNotificationHandler(String serviceName, NotificationHandler handler){ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); // depends on control dependency: [if], data = [none] } if(list.size() == 0){ notificationHandlers.remove(serviceName); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private String setParamsters(String value, final Object[] params) { for (int i = 0; i < params.length; i++) { value = value.replaceAll("\\{" + i + "\\}", params[i].toString()); } return value; } }
public class class_name { private String setParamsters(String value, final Object[] params) { for (int i = 0; i < params.length; i++) { value = value.replaceAll("\\{" + i + "\\}", params[i].toString()); // depends on control dependency: [for], data = [i] } return value; } }
public class class_name { private int readMethod(final ClassVisitor classVisitor, final Context context, int u) { // reads the method declaration char[] c = context.buffer; context.access = readUnsignedShort(u); context.name = readUTF8(u + 2, c); context.desc = readUTF8(u + 4, c); u += 6; // reads the method attributes int code = 0; int exception = 0; String[] exceptions = null; String signature = null; int methodParameters = 0; int anns = 0; int ianns = 0; int tanns = 0; int itanns = 0; int dann = 0; int mpanns = 0; int impanns = 0; int firstAttribute = u; Attribute attributes = null; for (int i = readUnsignedShort(u); i > 0; --i) { String attrName = readUTF8(u + 2, c); // tests are sorted in decreasing frequency order // (based on frequencies observed on typical classes) if ("Code".equals(attrName)) { if ((context.flags & SKIP_CODE) == 0) { code = u + 8; } } else if ("Exceptions".equals(attrName)) { exceptions = new String[readUnsignedShort(u + 8)]; exception = u + 10; for (int j = 0; j < exceptions.length; ++j) { exceptions[j] = readClass(exception, c); exception += 2; } } else if (SIGNATURES && "Signature".equals(attrName)) { signature = readUTF8(u + 8, c); } else if ("Deprecated".equals(attrName)) { context.access |= Opcodes.ACC_DEPRECATED; } else if (ANNOTATIONS && "RuntimeVisibleAnnotations".equals(attrName)) { anns = u + 8; } else if (ANNOTATIONS && "RuntimeVisibleTypeAnnotations".equals(attrName)) { tanns = u + 8; } else if (ANNOTATIONS && "AnnotationDefault".equals(attrName)) { dann = u + 8; } else if ("Synthetic".equals(attrName)) { context.access |= Opcodes.ACC_SYNTHETIC | ClassWriter.ACC_SYNTHETIC_ATTRIBUTE; } else if (ANNOTATIONS && "RuntimeInvisibleAnnotations".equals(attrName)) { ianns = u + 8; } else if (ANNOTATIONS && "RuntimeInvisibleTypeAnnotations".equals(attrName)) { itanns = u + 8; } else if (ANNOTATIONS && "RuntimeVisibleParameterAnnotations".equals(attrName)) { mpanns = u + 8; } else if (ANNOTATIONS && "RuntimeInvisibleParameterAnnotations".equals(attrName)) { impanns = u + 8; } else if ("MethodParameters".equals(attrName)) { methodParameters = u + 8; } else { Attribute attr = readAttribute(context.attrs, attrName, u + 8, readInt(u + 4), c, -1, null); if (attr != null) { attr.next = attributes; attributes = attr; } } u += 6 + readInt(u + 4); } u += 2; // visits the method declaration MethodVisitor mv = classVisitor.visitMethod(context.access, context.name, context.desc, signature, exceptions); if (mv == null) { return u; } /* * if the returned MethodVisitor is in fact a MethodWriter, it means * there is no method adapter between the reader and the writer. If, in * addition, the writer's constant pool was copied from this reader * (mw.cw.cr == this), and the signature and exceptions of the method * have not been changed, then it is possible to skip all visit events * and just copy the original code of the method to the writer (the * access, name and descriptor can have been changed, this is not * important since they are not copied as is from the reader). */ if (WRITER && mv instanceof MethodWriter) { MethodWriter mw = (MethodWriter) mv; if (mw.cw.cr == this && signature == mw.signature) { boolean sameExceptions = false; if (exceptions == null) { sameExceptions = mw.exceptionCount == 0; } else if (exceptions.length == mw.exceptionCount) { sameExceptions = true; for (int j = exceptions.length - 1; j >= 0; --j) { exception -= 2; if (mw.exceptions[j] != readUnsignedShort(exception)) { sameExceptions = false; break; } } } if (sameExceptions) { /* * we do not copy directly the code into MethodWriter to * save a byte array copy operation. The real copy will be * done in ClassWriter.toByteArray(). */ mw.classReaderOffset = firstAttribute; mw.classReaderLength = u - firstAttribute; return u; } } } // visit the method parameters if (methodParameters != 0) { for (int i = b[methodParameters] & 0xFF, v = methodParameters + 1; i > 0; --i, v = v + 4) { mv.visitParameter(readUTF8(v, c), readUnsignedShort(v + 2)); } } // visits the method annotations if (ANNOTATIONS && dann != 0) { AnnotationVisitor dv = mv.visitAnnotationDefault(); readAnnotationValue(dann, c, null, dv); if (dv != null) { dv.visitEnd(); } } if (ANNOTATIONS && anns != 0) { for (int i = readUnsignedShort(anns), v = anns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), true)); } } if (ANNOTATIONS && ianns != 0) { for (int i = readUnsignedShort(ianns), v = ianns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), false)); } } if (ANNOTATIONS && tanns != 0) { for (int i = readUnsignedShort(tanns), v = tanns + 2; i > 0; --i) { v = readAnnotationTarget(context, v); v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), true)); } } if (ANNOTATIONS && itanns != 0) { for (int i = readUnsignedShort(itanns), v = itanns + 2; i > 0; --i) { v = readAnnotationTarget(context, v); v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), false)); } } if (ANNOTATIONS && mpanns != 0) { readParameterAnnotations(mv, context, mpanns, true); } if (ANNOTATIONS && impanns != 0) { readParameterAnnotations(mv, context, impanns, false); } // visits the method attributes while (attributes != null) { Attribute attr = attributes.next; attributes.next = null; mv.visitAttribute(attributes); attributes = attr; } // visits the method code if (code != 0) { mv.visitCode(); readCode(mv, context, code); } // visits the end of the method mv.visitEnd(); return u; } }
public class class_name { private int readMethod(final ClassVisitor classVisitor, final Context context, int u) { // reads the method declaration char[] c = context.buffer; context.access = readUnsignedShort(u); context.name = readUTF8(u + 2, c); context.desc = readUTF8(u + 4, c); u += 6; // reads the method attributes int code = 0; int exception = 0; String[] exceptions = null; String signature = null; int methodParameters = 0; int anns = 0; int ianns = 0; int tanns = 0; int itanns = 0; int dann = 0; int mpanns = 0; int impanns = 0; int firstAttribute = u; Attribute attributes = null; for (int i = readUnsignedShort(u); i > 0; --i) { String attrName = readUTF8(u + 2, c); // tests are sorted in decreasing frequency order // (based on frequencies observed on typical classes) if ("Code".equals(attrName)) { if ((context.flags & SKIP_CODE) == 0) { code = u + 8; // depends on control dependency: [if], data = [none] } } else if ("Exceptions".equals(attrName)) { exceptions = new String[readUnsignedShort(u + 8)]; // depends on control dependency: [if], data = [none] exception = u + 10; // depends on control dependency: [if], data = [none] for (int j = 0; j < exceptions.length; ++j) { exceptions[j] = readClass(exception, c); // depends on control dependency: [for], data = [j] exception += 2; // depends on control dependency: [for], data = [none] } } else if (SIGNATURES && "Signature".equals(attrName)) { signature = readUTF8(u + 8, c); // depends on control dependency: [if], data = [none] } else if ("Deprecated".equals(attrName)) { context.access |= Opcodes.ACC_DEPRECATED; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeVisibleAnnotations".equals(attrName)) { anns = u + 8; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeVisibleTypeAnnotations".equals(attrName)) { tanns = u + 8; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "AnnotationDefault".equals(attrName)) { dann = u + 8; // depends on control dependency: [if], data = [none] } else if ("Synthetic".equals(attrName)) { context.access |= Opcodes.ACC_SYNTHETIC | ClassWriter.ACC_SYNTHETIC_ATTRIBUTE; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeInvisibleAnnotations".equals(attrName)) { ianns = u + 8; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeInvisibleTypeAnnotations".equals(attrName)) { itanns = u + 8; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeVisibleParameterAnnotations".equals(attrName)) { mpanns = u + 8; // depends on control dependency: [if], data = [none] } else if (ANNOTATIONS && "RuntimeInvisibleParameterAnnotations".equals(attrName)) { impanns = u + 8; // depends on control dependency: [if], data = [none] } else if ("MethodParameters".equals(attrName)) { methodParameters = u + 8; // depends on control dependency: [if], data = [none] } else { Attribute attr = readAttribute(context.attrs, attrName, u + 8, readInt(u + 4), c, -1, null); if (attr != null) { attr.next = attributes; // depends on control dependency: [if], data = [none] attributes = attr; // depends on control dependency: [if], data = [none] } } u += 6 + readInt(u + 4); // depends on control dependency: [for], data = [none] } u += 2; // visits the method declaration MethodVisitor mv = classVisitor.visitMethod(context.access, context.name, context.desc, signature, exceptions); if (mv == null) { return u; // depends on control dependency: [if], data = [none] } /* * if the returned MethodVisitor is in fact a MethodWriter, it means * there is no method adapter between the reader and the writer. If, in * addition, the writer's constant pool was copied from this reader * (mw.cw.cr == this), and the signature and exceptions of the method * have not been changed, then it is possible to skip all visit events * and just copy the original code of the method to the writer (the * access, name and descriptor can have been changed, this is not * important since they are not copied as is from the reader). */ if (WRITER && mv instanceof MethodWriter) { MethodWriter mw = (MethodWriter) mv; if (mw.cw.cr == this && signature == mw.signature) { boolean sameExceptions = false; if (exceptions == null) { sameExceptions = mw.exceptionCount == 0; // depends on control dependency: [if], data = [none] } else if (exceptions.length == mw.exceptionCount) { sameExceptions = true; // depends on control dependency: [if], data = [none] for (int j = exceptions.length - 1; j >= 0; --j) { exception -= 2; // depends on control dependency: [for], data = [none] if (mw.exceptions[j] != readUnsignedShort(exception)) { sameExceptions = false; // depends on control dependency: [if], data = [none] break; } } } if (sameExceptions) { /* * we do not copy directly the code into MethodWriter to * save a byte array copy operation. The real copy will be * done in ClassWriter.toByteArray(). */ mw.classReaderOffset = firstAttribute; // depends on control dependency: [if], data = [none] mw.classReaderLength = u - firstAttribute; // depends on control dependency: [if], data = [none] return u; // depends on control dependency: [if], data = [none] } } } // visit the method parameters if (methodParameters != 0) { for (int i = b[methodParameters] & 0xFF, v = methodParameters + 1; i > 0; --i, v = v + 4) { mv.visitParameter(readUTF8(v, c), readUnsignedShort(v + 2)); // depends on control dependency: [for], data = [none] } } // visits the method annotations if (ANNOTATIONS && dann != 0) { AnnotationVisitor dv = mv.visitAnnotationDefault(); readAnnotationValue(dann, c, null, dv); // depends on control dependency: [if], data = [none] if (dv != null) { dv.visitEnd(); // depends on control dependency: [if], data = [none] } } if (ANNOTATIONS && anns != 0) { for (int i = readUnsignedShort(anns), v = anns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), true)); // depends on control dependency: [for], data = [none] } } if (ANNOTATIONS && ianns != 0) { for (int i = readUnsignedShort(ianns), v = ianns + 2; i > 0; --i) { v = readAnnotationValues(v + 2, c, true, mv.visitAnnotation(readUTF8(v, c), false)); // depends on control dependency: [for], data = [none] } } if (ANNOTATIONS && tanns != 0) { for (int i = readUnsignedShort(tanns), v = tanns + 2; i > 0; --i) { v = readAnnotationTarget(context, v); // depends on control dependency: [for], data = [none] v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), true)); // depends on control dependency: [for], data = [none] } } if (ANNOTATIONS && itanns != 0) { for (int i = readUnsignedShort(itanns), v = itanns + 2; i > 0; --i) { v = readAnnotationTarget(context, v); // depends on control dependency: [for], data = [none] v = readAnnotationValues(v + 2, c, true, mv.visitTypeAnnotation(context.typeRef, context.typePath, readUTF8(v, c), false)); // depends on control dependency: [for], data = [none] } } if (ANNOTATIONS && mpanns != 0) { readParameterAnnotations(mv, context, mpanns, true); // depends on control dependency: [if], data = [none] } if (ANNOTATIONS && impanns != 0) { readParameterAnnotations(mv, context, impanns, false); // depends on control dependency: [if], data = [none] } // visits the method attributes while (attributes != null) { Attribute attr = attributes.next; attributes.next = null; // depends on control dependency: [while], data = [none] mv.visitAttribute(attributes); // depends on control dependency: [while], data = [(attributes] attributes = attr; // depends on control dependency: [while], data = [none] } // visits the method code if (code != 0) { mv.visitCode(); // depends on control dependency: [if], data = [none] readCode(mv, context, code); // depends on control dependency: [if], data = [none] } // visits the end of the method mv.visitEnd(); return u; } }
public class class_name { @Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } }
public class class_name { @Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); // depends on control dependency: [if], data = [none] iterator.remove(); // depends on control dependency: [if], data = [none] } } for (Step step : context.getSteps()) { process(step); // depends on control dependency: [for], data = [step] } } }
public class class_name { public static boolean hasLiteralIPAddress(URI resource) { String host = resource.getHost(); if ( host == null || host.isEmpty() ) { return false; } // basic check for a '.'-separated numeric string for now return host.matches("([0-9A-Fa-f]|\\.){4,16}"); } }
public class class_name { public static boolean hasLiteralIPAddress(URI resource) { String host = resource.getHost(); if ( host == null || host.isEmpty() ) { return false; // depends on control dependency: [if], data = [none] } // basic check for a '.'-separated numeric string for now return host.matches("([0-9A-Fa-f]|\\.){4,16}"); } }
public class class_name { private static Element createValueElement(Document document, String name, ConfigurableEmitter.Value value) { Element element = document.createElement(name); // void: now writes the value type if (value instanceof SimpleValue) { element.setAttribute("type", "simple"); element.setAttribute("value", "" + value.getValue(0)); } else if (value instanceof RandomValue) { element.setAttribute("type", "random"); element .setAttribute("value", "" + ((RandomValue) value).getValue()); } else if (value instanceof LinearInterpolator) { element.setAttribute("type", "linear"); element.setAttribute("min", "" + ((LinearInterpolator) value).getMin()); element.setAttribute("max", "" + ((LinearInterpolator) value).getMax()); element.setAttribute("active", "" + ((LinearInterpolator) value).isActive()); ArrayList curve = ((LinearInterpolator) value).getCurve(); for (int i = 0; i < curve.size(); i++) { Vector2f point = (Vector2f) curve.get(i); Element pointElement = document.createElement("point"); pointElement.setAttribute("x", "" + point.x); pointElement.setAttribute("y", "" + point.y); element.appendChild(pointElement); } } else { Log.warn("unkown value type ignored: " + value.getClass()); } return element; } }
public class class_name { private static Element createValueElement(Document document, String name, ConfigurableEmitter.Value value) { Element element = document.createElement(name); // void: now writes the value type if (value instanceof SimpleValue) { element.setAttribute("type", "simple"); // depends on control dependency: [if], data = [none] element.setAttribute("value", "" + value.getValue(0)); // depends on control dependency: [if], data = [none] } else if (value instanceof RandomValue) { element.setAttribute("type", "random"); // depends on control dependency: [if], data = [none] element .setAttribute("value", "" + ((RandomValue) value).getValue()); // depends on control dependency: [if], data = [none] } else if (value instanceof LinearInterpolator) { element.setAttribute("type", "linear"); // depends on control dependency: [if], data = [none] element.setAttribute("min", "" + ((LinearInterpolator) value).getMin()); // depends on control dependency: [if], data = [none] element.setAttribute("max", "" + ((LinearInterpolator) value).getMax()); // depends on control dependency: [if], data = [none] element.setAttribute("active", "" + ((LinearInterpolator) value).isActive()); // depends on control dependency: [if], data = [none] ArrayList curve = ((LinearInterpolator) value).getCurve(); for (int i = 0; i < curve.size(); i++) { Vector2f point = (Vector2f) curve.get(i); Element pointElement = document.createElement("point"); pointElement.setAttribute("x", "" + point.x); // depends on control dependency: [for], data = [none] pointElement.setAttribute("y", "" + point.y); // depends on control dependency: [for], data = [none] element.appendChild(pointElement); // depends on control dependency: [for], data = [none] } } else { Log.warn("unkown value type ignored: " + value.getClass()); // depends on control dependency: [if], data = [none] } return element; } }
public class class_name { protected String getShortString(Node node, String xpath, ComparisonType type) { StringBuilder sb = new StringBuilder(); if (type == ComparisonType.HAS_DOCTYPE_DECLARATION) { Document doc = (Document) node; appendDocumentType(sb, doc.getDoctype()); appendDocumentElementIndication(sb, doc); } else if (node instanceof Document) { Document doc = (Document) node; appendDocumentXmlDeclaration(sb, doc); appendDocumentElementIndication(sb, doc); } else if (node instanceof DocumentType) { final DocumentType docType = (DocumentType) node; appendDocumentType(sb, docType); appendDocumentElementIndication(sb, docType.getOwnerDocument()); } else if (node instanceof Attr) { appendAttribute(sb, (Attr) node); } else if (node instanceof Element) { appendElement(sb, (Element) node); } else if (node instanceof Text) { appendText(sb, (Text) node); } else if (node instanceof Comment) { appendComment(sb, (Comment) node); } else if (node instanceof ProcessingInstruction) { appendProcessingInstruction(sb, (ProcessingInstruction) node); } else if (node == null) { sb.append("<NULL>"); } else { sb.append("<!--NodeType ").append(node.getNodeType()) .append(' ').append(node.getNodeName()) .append('/').append(node.getNodeValue()) .append("-->"); } appendXPath(sb, xpath); return sb.toString(); } }
public class class_name { protected String getShortString(Node node, String xpath, ComparisonType type) { StringBuilder sb = new StringBuilder(); if (type == ComparisonType.HAS_DOCTYPE_DECLARATION) { Document doc = (Document) node; appendDocumentType(sb, doc.getDoctype()); // depends on control dependency: [if], data = [none] appendDocumentElementIndication(sb, doc); // depends on control dependency: [if], data = [none] } else if (node instanceof Document) { Document doc = (Document) node; appendDocumentXmlDeclaration(sb, doc); // depends on control dependency: [if], data = [none] appendDocumentElementIndication(sb, doc); // depends on control dependency: [if], data = [none] } else if (node instanceof DocumentType) { final DocumentType docType = (DocumentType) node; appendDocumentType(sb, docType); // depends on control dependency: [if], data = [none] appendDocumentElementIndication(sb, docType.getOwnerDocument()); // depends on control dependency: [if], data = [none] } else if (node instanceof Attr) { appendAttribute(sb, (Attr) node); // depends on control dependency: [if], data = [none] } else if (node instanceof Element) { appendElement(sb, (Element) node); // depends on control dependency: [if], data = [none] } else if (node instanceof Text) { appendText(sb, (Text) node); // depends on control dependency: [if], data = [none] } else if (node instanceof Comment) { appendComment(sb, (Comment) node); // depends on control dependency: [if], data = [none] } else if (node instanceof ProcessingInstruction) { appendProcessingInstruction(sb, (ProcessingInstruction) node); // depends on control dependency: [if], data = [none] } else if (node == null) { sb.append("<NULL>"); // depends on control dependency: [if], data = [none] } else { sb.append("<!--NodeType ").append(node.getNodeType()) .append(' ').append(node.getNodeName()) .append('/').append(node.getNodeValue()) .append("-->"); // depends on control dependency: [if], data = [none] } appendXPath(sb, xpath); return sb.toString(); } }
public class class_name { public JQMListDivider findDivider(String text) { for (int k = 0; k < list.getWidgetCount(); k++) { Widget w = list.getWidget(k); if (isDivider(w) && w.getElement().getInnerText().equals(text)) { return (JQMListDivider) w; } } return null; } }
public class class_name { public JQMListDivider findDivider(String text) { for (int k = 0; k < list.getWidgetCount(); k++) { Widget w = list.getWidget(k); if (isDivider(w) && w.getElement().getInnerText().equals(text)) { return (JQMListDivider) w; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void makeFirst(NonDelayedClassInfo classInfo) { String methodName = "makeFirst"; boolean doLog = tc.isDebugEnabled(); String useHashText = (doLog ? getHashText() : null); String useClassHashText = (doLog ? classInfo.getHashText() : null); if (doLog) { logLinks(methodName, classInfo); } if (classInfo == firstClassInfo) { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Already first [ {1} ]", new Object[] { useHashText, useClassHashText })); } return; } else if (classInfo == lastClassInfo) { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from last [ {1} ]", new Object[] { useHashText, useClassHashText })); Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]", new Object[] { useHashText, firstClassInfo.getHashText() })); } lastClassInfo = classInfo.getPriorClassInfo(); lastClassInfo.setNextClassInfo(null); if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] New last [ {1} ]", new Object[] { useHashText, lastClassInfo.getHashText() })); } firstClassInfo.setPriorClassInfo(classInfo); classInfo.setPriorClassInfo(null); classInfo.setNextClassInfo(firstClassInfo); firstClassInfo = classInfo; } else { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from middle [ {1} ]", new Object[] { useHashText, useClassHashText })); Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]", new Object[] { useHashText, firstClassInfo.getHashText() })); } NonDelayedClassInfo currentPrior = classInfo.getPriorClassInfo(); NonDelayedClassInfo currentNext = classInfo.getNextClassInfo(); currentPrior.setNextClassInfo(currentNext); currentNext.setPriorClassInfo(currentPrior); firstClassInfo.setPriorClassInfo(classInfo); classInfo.setNextClassInfo(firstClassInfo); classInfo.setPriorClassInfo(null); firstClassInfo = classInfo; } } }
public class class_name { public void makeFirst(NonDelayedClassInfo classInfo) { String methodName = "makeFirst"; boolean doLog = tc.isDebugEnabled(); String useHashText = (doLog ? getHashText() : null); String useClassHashText = (doLog ? classInfo.getHashText() : null); if (doLog) { logLinks(methodName, classInfo); // depends on control dependency: [if], data = [none] } if (classInfo == firstClassInfo) { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Already first [ {1} ]", new Object[] { useHashText, useClassHashText })); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } else if (classInfo == lastClassInfo) { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from last [ {1} ]", new Object[] { useHashText, useClassHashText })); // depends on control dependency: [if], data = [none] Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]", new Object[] { useHashText, firstClassInfo.getHashText() })); // depends on control dependency: [if], data = [none] } lastClassInfo = classInfo.getPriorClassInfo(); // depends on control dependency: [if], data = [none] lastClassInfo.setNextClassInfo(null); // depends on control dependency: [if], data = [none] if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] New last [ {1} ]", new Object[] { useHashText, lastClassInfo.getHashText() })); // depends on control dependency: [if], data = [none] } firstClassInfo.setPriorClassInfo(classInfo); // depends on control dependency: [if], data = [(classInfo] classInfo.setPriorClassInfo(null); // depends on control dependency: [if], data = [none] classInfo.setNextClassInfo(firstClassInfo); // depends on control dependency: [if], data = [none] firstClassInfo = classInfo; // depends on control dependency: [if], data = [none] } else { if (doLog) { Tr.debug(tc, MessageFormat.format("[ {0} ] Moving from middle [ {1} ]", new Object[] { useHashText, useClassHashText })); // depends on control dependency: [if], data = [none] Tr.debug(tc, MessageFormat.format("[ {0} ] Old first [ {1} ]", new Object[] { useHashText, firstClassInfo.getHashText() })); // depends on control dependency: [if], data = [none] } NonDelayedClassInfo currentPrior = classInfo.getPriorClassInfo(); NonDelayedClassInfo currentNext = classInfo.getNextClassInfo(); currentPrior.setNextClassInfo(currentNext); // depends on control dependency: [if], data = [none] currentNext.setPriorClassInfo(currentPrior); // depends on control dependency: [if], data = [none] firstClassInfo.setPriorClassInfo(classInfo); // depends on control dependency: [if], data = [(classInfo] classInfo.setNextClassInfo(firstClassInfo); // depends on control dependency: [if], data = [none] classInfo.setPriorClassInfo(null); // depends on control dependency: [if], data = [none] firstClassInfo = classInfo; // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized void connect() { if (state != State.NONE) { eventHandler.onError(new WebSocketException("connect() already called")); close(); return; } getIntializer().setName(getInnerThread(), THREAD_BASE_NAME + "Reader-" + clientId); state = State.CONNECTING; getInnerThread().start(); } }
public class class_name { public synchronized void connect() { if (state != State.NONE) { eventHandler.onError(new WebSocketException("connect() already called")); // depends on control dependency: [if], data = [none] close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } getIntializer().setName(getInnerThread(), THREAD_BASE_NAME + "Reader-" + clientId); state = State.CONNECTING; getInnerThread().start(); } }
public class class_name { public EClass getIfcSolidModel() { if (ifcSolidModelEClass == null) { ifcSolidModelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(519); } return ifcSolidModelEClass; } }
public class class_name { public EClass getIfcSolidModel() { if (ifcSolidModelEClass == null) { ifcSolidModelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(519); // depends on control dependency: [if], data = [none] } return ifcSolidModelEClass; } }
public class class_name { @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/{alertId}/triggers/{triggerId}") @Description("Updates a trigger having the given ID if it is associated with the given alert ID.") public TriggerDto updateTriggerById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("triggerId") BigInteger triggerId, TriggerDto triggerdDto) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (triggerdDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, getRemoteUser(req).getUserName()); Alert oldAlert = alertService.findAlertByPrimaryKey(alertId); if (oldAlert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldAlert.getOwner(), owner); for (Trigger trigger : oldAlert.getTriggers()) { if (triggerId.equals(trigger.getId())) { copyProperties(trigger, triggerdDto); oldAlert.setModifiedBy(getRemoteUser(req)); Alert alert = alertService.updateAlert(oldAlert); int index = alert.getTriggers().indexOf(trigger); return TriggerDto.transformToDto(alert.getTriggers().get(index)); } } throw new WebApplicationException("The trigger does not exist.", Response.Status.NOT_FOUND); } }
public class class_name { @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/{alertId}/triggers/{triggerId}") @Description("Updates a trigger having the given ID if it is associated with the given alert ID.") public TriggerDto updateTriggerById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId, @PathParam("triggerId") BigInteger triggerId, TriggerDto triggerdDto) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (triggerdDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, getRemoteUser(req).getUserName()); Alert oldAlert = alertService.findAlertByPrimaryKey(alertId); if (oldAlert == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldAlert.getOwner(), owner); for (Trigger trigger : oldAlert.getTriggers()) { if (triggerId.equals(trigger.getId())) { copyProperties(trigger, triggerdDto); // depends on control dependency: [if], data = [none] oldAlert.setModifiedBy(getRemoteUser(req)); // depends on control dependency: [if], data = [none] Alert alert = alertService.updateAlert(oldAlert); int index = alert.getTriggers().indexOf(trigger); return TriggerDto.transformToDto(alert.getTriggers().get(index)); // depends on control dependency: [if], data = [none] } } throw new WebApplicationException("The trigger does not exist.", Response.Status.NOT_FOUND); } }
public class class_name { public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) { if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) { for (int i = 0; i <= a.numCols; i++) { if( a.col_idx[i] != b.col_idx[i] ) return false; } for (int i = 0; i < a.nz_length; i++) { if( a.nz_rows[i] != b.nz_rows[i] ) return false; } return true; } return false; } }
public class class_name { public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) { if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) { for (int i = 0; i <= a.numCols; i++) { if( a.col_idx[i] != b.col_idx[i] ) return false; } for (int i = 0; i < a.nz_length; i++) { if( a.nz_rows[i] != b.nz_rows[i] ) return false; } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void setAccountIds(java.util.Collection<String> accountIds) { if (accountIds == null) { this.accountIds = null; return; } this.accountIds = new com.amazonaws.internal.SdkInternalList<String>(accountIds); } }
public class class_name { public void setAccountIds(java.util.Collection<String> accountIds) { if (accountIds == null) { this.accountIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.accountIds = new com.amazonaws.internal.SdkInternalList<String>(accountIds); } }
public class class_name { public boolean hasProperties(Set<PropertyKey> keys) { for (PropertyKey key : keys) { if (null == getProperty(key.m_key)) { return false; } } return true; } }
public class class_name { public boolean hasProperties(Set<PropertyKey> keys) { for (PropertyKey key : keys) { if (null == getProperty(key.m_key)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private boolean incrementViews() { if (System.currentTimeMillis() - settings.getLong(KEY_LAST_COUNT_UPDATE, 0L) < minimumInterval) { if (debug) LogD("Count not incremented due to minimum interval not reached"); return false; } editor.putInt(KEY_COUNT, settings.getInt(KEY_COUNT, 0) + 1); editor.putLong(KEY_LAST_COUNT_UPDATE, System.currentTimeMillis()); commitEditor(); return true; } }
public class class_name { private boolean incrementViews() { if (System.currentTimeMillis() - settings.getLong(KEY_LAST_COUNT_UPDATE, 0L) < minimumInterval) { if (debug) LogD("Count not incremented due to minimum interval not reached"); return false; // depends on control dependency: [if], data = [none] } editor.putInt(KEY_COUNT, settings.getInt(KEY_COUNT, 0) + 1); editor.putLong(KEY_LAST_COUNT_UPDATE, System.currentTimeMillis()); commitEditor(); return true; } }
public class class_name { private void rotateRight(final Node<K,V> node, final int index) { Node<K,V> leftChild = node.getLeft(index); node.setLeft(leftChild.getRight(index), index); if (leftChild.getRight(index) != null) { leftChild.getRight(index).setParent(node, index); } leftChild.setParent(node.getParent(index), index); if (node.getParent(index) == null) { // node was the root ... now its left child is the root rootNode[index] = leftChild; } else if (node.getParent(index).getRight(index) == node) { node.getParent(index).setRight(leftChild, index); } else { node.getParent(index).setLeft(leftChild, index); } leftChild.setRight(node, index); node.setParent(leftChild, index); } }
public class class_name { private void rotateRight(final Node<K,V> node, final int index) { Node<K,V> leftChild = node.getLeft(index); node.setLeft(leftChild.getRight(index), index); if (leftChild.getRight(index) != null) { leftChild.getRight(index).setParent(node, index); // depends on control dependency: [if], data = [none] } leftChild.setParent(node.getParent(index), index); if (node.getParent(index) == null) { // node was the root ... now its left child is the root rootNode[index] = leftChild; // depends on control dependency: [if], data = [none] } else if (node.getParent(index).getRight(index) == node) { node.getParent(index).setRight(leftChild, index); // depends on control dependency: [if], data = [none] } else { node.getParent(index).setLeft(leftChild, index); // depends on control dependency: [if], data = [none] } leftChild.setRight(node, index); node.setParent(leftChild, index); } }
public class class_name { public static void solveL_diagReal(double L[], double[] b, int n) { // for( int i = 0; i < n; i++ ) { // double sum = b[i]; // for( int k=0; k<i; k++ ) { // sum -= L[i*n+k]* b[k]; // } // b[i] = sum / L[i*n+i]; // } int stride = n*2; for( int i = 0; i < n; i++ ) { double realSum = b[i*2]; double imagSum = b[i*2+1]; int indexL = i*stride; int indexB = 0; for( int k=0; k<i; k++ ) { double realL = L[indexL++]; double imagL = L[indexL++]; double realB = b[indexB++]; double imagB = b[indexB++]; realSum -= realL*realB - imagL*imagB; imagSum -= realL*imagB + imagL*realB; } double realL = L[indexL]; b[i*2 ] = realSum/realL; b[i*2 + 1] = imagSum/realL; } } }
public class class_name { public static void solveL_diagReal(double L[], double[] b, int n) { // for( int i = 0; i < n; i++ ) { // double sum = b[i]; // for( int k=0; k<i; k++ ) { // sum -= L[i*n+k]* b[k]; // } // b[i] = sum / L[i*n+i]; // } int stride = n*2; for( int i = 0; i < n; i++ ) { double realSum = b[i*2]; double imagSum = b[i*2+1]; int indexL = i*stride; int indexB = 0; for( int k=0; k<i; k++ ) { double realL = L[indexL++]; double imagL = L[indexL++]; double realB = b[indexB++]; double imagB = b[indexB++]; realSum -= realL*realB - imagL*imagB; // depends on control dependency: [for], data = [none] imagSum -= realL*imagB + imagL*realB; // depends on control dependency: [for], data = [none] } double realL = L[indexL]; b[i*2 ] = realSum/realL; // depends on control dependency: [for], data = [i] b[i*2 + 1] = imagSum/realL; // depends on control dependency: [for], data = [i] } } }
public class class_name { public final Set<Variable> vars() { if (vars == null) { ImmutableSet.Builder<Variable> builder = ImmutableSet.<Variable>builder().add(start()); Variable end = end(); if (end != null) builder.add(end); builder.addAll(otherVars()); vars = builder.build(); } return vars; } }
public class class_name { public final Set<Variable> vars() { if (vars == null) { ImmutableSet.Builder<Variable> builder = ImmutableSet.<Variable>builder().add(start()); Variable end = end(); if (end != null) builder.add(end); builder.addAll(otherVars()); // depends on control dependency: [if], data = [none] vars = builder.build(); // depends on control dependency: [if], data = [none] } return vars; } }
public class class_name { @Override public ZonedDateTime with(TemporalAdjuster adjuster) { // optimizations if (adjuster instanceof LocalDate) { return resolveLocal(LocalDateTime.of((LocalDate) adjuster, dateTime.toLocalTime())); } else if (adjuster instanceof LocalTime) { return resolveLocal(LocalDateTime.of(dateTime.toLocalDate(), (LocalTime) adjuster)); } else if (adjuster instanceof LocalDateTime) { return resolveLocal((LocalDateTime) adjuster); } else if (adjuster instanceof OffsetDateTime) { OffsetDateTime odt = (OffsetDateTime) adjuster; return ofLocal(odt.toLocalDateTime(), zone, odt.getOffset()); } else if (adjuster instanceof Instant) { Instant instant = (Instant) adjuster; return create(instant.getEpochSecond(), instant.getNano(), zone); } else if (adjuster instanceof ZoneOffset) { return resolveOffset((ZoneOffset) adjuster); } return (ZonedDateTime) adjuster.adjustInto(this); } }
public class class_name { @Override public ZonedDateTime with(TemporalAdjuster adjuster) { // optimizations if (adjuster instanceof LocalDate) { return resolveLocal(LocalDateTime.of((LocalDate) adjuster, dateTime.toLocalTime())); // depends on control dependency: [if], data = [none] } else if (adjuster instanceof LocalTime) { return resolveLocal(LocalDateTime.of(dateTime.toLocalDate(), (LocalTime) adjuster)); // depends on control dependency: [if], data = [none] } else if (adjuster instanceof LocalDateTime) { return resolveLocal((LocalDateTime) adjuster); // depends on control dependency: [if], data = [none] } else if (adjuster instanceof OffsetDateTime) { OffsetDateTime odt = (OffsetDateTime) adjuster; return ofLocal(odt.toLocalDateTime(), zone, odt.getOffset()); // depends on control dependency: [if], data = [none] } else if (adjuster instanceof Instant) { Instant instant = (Instant) adjuster; return create(instant.getEpochSecond(), instant.getNano(), zone); // depends on control dependency: [if], data = [none] } else if (adjuster instanceof ZoneOffset) { return resolveOffset((ZoneOffset) adjuster); // depends on control dependency: [if], data = [none] } return (ZonedDateTime) adjuster.adjustInto(this); } }
public class class_name { public int submitAndMonitorJob() throws IOException { if (jar_ != null && isLocalHadoop()) { // getAbs became required when shell and subvm have different working dirs... File wd = new File(".").getAbsoluteFile(); StreamUtil.unJar(new File(jar_), wd); } // if jobConf_ changes must recreate a JobClient jc_ = new JobClient(jobConf_); boolean error = true; running_ = null; String lastReport = null; try { running_ = jc_.submitJob(jobConf_); jobId_ = running_.getID(); LOG.info("getLocalDirs(): " + Arrays.asList(jobConf_.getLocalDirs())); LOG.info("Running job: " + jobId_); jobInfo(); while (!running_.isComplete()) { try { Thread.sleep(1000); } catch (InterruptedException e) { } running_ = jc_.getJob(jobId_); String report = null; report = " map " + Math.round(running_.mapProgress() * 100) + "% reduce " + Math.round(running_.reduceProgress() * 100) + "%"; if (!report.equals(lastReport)) { LOG.info(report); lastReport = report; } } if (!running_.isSuccessful()) { jobInfo(); LOG.error("Job not Successful!"); return 1; } LOG.info("Job complete: " + jobId_); LOG.info("Output: " + output_); error = false; } catch(FileNotFoundException fe) { LOG.error("Error launching job , bad input path : " + fe.getMessage()); return 2; } catch(InvalidJobConfException je) { LOG.error("Error launching job , Invalid job conf : " + je.getMessage()); return 3; } catch(FileAlreadyExistsException fae) { LOG.error("Error launching job , Output path already exists : " + fae.getMessage()); return 4; } catch(IOException ioe) { LOG.error("Error Launching job : " + ioe.getMessage()); return 5; } finally { if (error && (running_ != null)) { LOG.info("killJob..."); running_.killJob(); } jc_.close(); } return 0; } }
public class class_name { public int submitAndMonitorJob() throws IOException { if (jar_ != null && isLocalHadoop()) { // getAbs became required when shell and subvm have different working dirs... File wd = new File(".").getAbsoluteFile(); StreamUtil.unJar(new File(jar_), wd); } // if jobConf_ changes must recreate a JobClient jc_ = new JobClient(jobConf_); boolean error = true; running_ = null; String lastReport = null; try { running_ = jc_.submitJob(jobConf_); jobId_ = running_.getID(); LOG.info("getLocalDirs(): " + Arrays.asList(jobConf_.getLocalDirs())); LOG.info("Running job: " + jobId_); jobInfo(); while (!running_.isComplete()) { try { Thread.sleep(1000); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { } // depends on control dependency: [catch], data = [none] running_ = jc_.getJob(jobId_); // depends on control dependency: [while], data = [none] String report = null; report = " map " + Math.round(running_.mapProgress() * 100) + "% reduce " + Math.round(running_.reduceProgress() * 100) + "%"; // depends on control dependency: [while], data = [none] if (!report.equals(lastReport)) { LOG.info(report); // depends on control dependency: [if], data = [none] lastReport = report; // depends on control dependency: [if], data = [none] } } if (!running_.isSuccessful()) { jobInfo(); // depends on control dependency: [if], data = [none] LOG.error("Job not Successful!"); // depends on control dependency: [if], data = [none] return 1; // depends on control dependency: [if], data = [none] } LOG.info("Job complete: " + jobId_); LOG.info("Output: " + output_); error = false; } catch(FileNotFoundException fe) { LOG.error("Error launching job , bad input path : " + fe.getMessage()); return 2; } catch(InvalidJobConfException je) { LOG.error("Error launching job , Invalid job conf : " + je.getMessage()); return 3; } catch(FileAlreadyExistsException fae) { LOG.error("Error launching job , Output path already exists : " + fae.getMessage()); return 4; } catch(IOException ioe) { LOG.error("Error Launching job : " + ioe.getMessage()); return 5; } finally { if (error && (running_ != null)) { LOG.info("killJob..."); // depends on control dependency: [if], data = [none] running_.killJob(); // depends on control dependency: [if], data = [none] } jc_.close(); } return 0; } }
public class class_name { public void clickOnActionBarHomeButton() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "clickOnActionBarHomeButton()"); } instrumentation.runOnMainSync(new Runnable() { @Override public void run() { clicker.clickOnActionBarHomeButton(); } }); } }
public class class_name { public void clickOnActionBarHomeButton() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "clickOnActionBarHomeButton()"); // depends on control dependency: [if], data = [none] } instrumentation.runOnMainSync(new Runnable() { @Override public void run() { clicker.clickOnActionBarHomeButton(); } }); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata getTextEntityExtractionDetails() { if (detailsCase_ == 13) { return (com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata) details_; } return com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata .getDefaultInstance(); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata getTextEntityExtractionDetails() { if (detailsCase_ == 13) { return (com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata) details_; // depends on control dependency: [if], data = [none] } return com.google.cloud.datalabeling.v1beta1.LabelTextEntityExtractionOperationMetadata .getDefaultInstance(); } }
public class class_name { public static String camelToLisp(final String pString) { if (pString == null) { throw new IllegalArgumentException("string == null"); } if (pString.length() == 0) { return pString; } StringBuilder buf = null; int lastPos = 0; boolean inCharSequence = false; boolean inNumberSequence = false; // NOTE: Start at index 1, as first letter should never be hyphen for (int i = 1; i < pString.length(); i++) { char current = pString.charAt(i); if (Character.isUpperCase(current)) { // Init buffer if necessary if (buf == null) { buf = new StringBuilder(pString.length() + 3);// Allow for some growth } if (inNumberSequence) { // Sequence end inNumberSequence = false; buf.append(pString.substring(lastPos, i)); if (current != '-') { buf.append('-'); } lastPos = i; continue; } // Treat multiple uppercase chars as single word char previous = pString.charAt(i - 1); if (i == lastPos || Character.isUpperCase(previous)) { inCharSequence = true; continue; } // Append word buf.append(pString.substring(lastPos, i).toLowerCase()); if (previous != '-') { buf.append('-'); } buf.append(Character.toLowerCase(current)); lastPos = i + 1; } else if (Character.isDigit(current)) { // Init buffer if necessary if (buf == null) { buf = new StringBuilder(pString.length() + 3);// Allow for some growth } if (inCharSequence) { // Sequence end inCharSequence = false; buf.append(pString.substring(lastPos, i).toLowerCase()); if (current != '-') { buf.append('-'); } lastPos = i; continue; } // Treat multiple digits as single word char previous = pString.charAt(i - 1); if (i == lastPos || Character.isDigit(previous)) { inNumberSequence = true; continue; } // Append word buf.append(pString.substring(lastPos, i).toLowerCase()); if (previous != '-') { buf.append('-'); } buf.append(Character.toLowerCase(current)); lastPos = i + 1; } else if (inNumberSequence) { // Sequence end inNumberSequence = false; buf.append(pString.substring(lastPos, i)); if (current != '-') { buf.append('-'); } lastPos = i; } else if (inCharSequence) { // Sequence end inCharSequence = false; // NOTE: Special treatment! Last upper case, is first char in // next word, not last char in this word buf.append(pString.substring(lastPos, i - 1).toLowerCase()); if (current != '-') { buf.append('-'); } lastPos = i - 1; } } if (buf != null) { // Append the rest buf.append(pString.substring(lastPos).toLowerCase()); return buf.toString(); } else { return Character.isUpperCase(pString.charAt(0)) ? pString.toLowerCase() : pString; } } }
public class class_name { public static String camelToLisp(final String pString) { if (pString == null) { throw new IllegalArgumentException("string == null"); } if (pString.length() == 0) { return pString; // depends on control dependency: [if], data = [none] } StringBuilder buf = null; int lastPos = 0; boolean inCharSequence = false; boolean inNumberSequence = false; // NOTE: Start at index 1, as first letter should never be hyphen for (int i = 1; i < pString.length(); i++) { char current = pString.charAt(i); if (Character.isUpperCase(current)) { // Init buffer if necessary if (buf == null) { buf = new StringBuilder(pString.length() + 3);// Allow for some growth // depends on control dependency: [if], data = [none] } if (inNumberSequence) { // Sequence end inNumberSequence = false; // depends on control dependency: [if], data = [none] buf.append(pString.substring(lastPos, i)); // depends on control dependency: [if], data = [none] if (current != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } lastPos = i; // depends on control dependency: [if], data = [none] continue; } // Treat multiple uppercase chars as single word char previous = pString.charAt(i - 1); if (i == lastPos || Character.isUpperCase(previous)) { inCharSequence = true; // depends on control dependency: [if], data = [none] continue; } // Append word buf.append(pString.substring(lastPos, i).toLowerCase()); // depends on control dependency: [if], data = [none] if (previous != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } buf.append(Character.toLowerCase(current)); // depends on control dependency: [if], data = [none] lastPos = i + 1; // depends on control dependency: [if], data = [none] } else if (Character.isDigit(current)) { // Init buffer if necessary if (buf == null) { buf = new StringBuilder(pString.length() + 3);// Allow for some growth // depends on control dependency: [if], data = [none] } if (inCharSequence) { // Sequence end inCharSequence = false; // depends on control dependency: [if], data = [none] buf.append(pString.substring(lastPos, i).toLowerCase()); // depends on control dependency: [if], data = [none] if (current != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } lastPos = i; // depends on control dependency: [if], data = [none] continue; } // Treat multiple digits as single word char previous = pString.charAt(i - 1); if (i == lastPos || Character.isDigit(previous)) { inNumberSequence = true; // depends on control dependency: [if], data = [none] continue; } // Append word buf.append(pString.substring(lastPos, i).toLowerCase()); // depends on control dependency: [if], data = [none] if (previous != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } buf.append(Character.toLowerCase(current)); // depends on control dependency: [if], data = [none] lastPos = i + 1; // depends on control dependency: [if], data = [none] } else if (inNumberSequence) { // Sequence end inNumberSequence = false; // depends on control dependency: [if], data = [none] buf.append(pString.substring(lastPos, i)); // depends on control dependency: [if], data = [none] if (current != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } lastPos = i; // depends on control dependency: [if], data = [none] } else if (inCharSequence) { // Sequence end inCharSequence = false; // depends on control dependency: [if], data = [none] // NOTE: Special treatment! Last upper case, is first char in // next word, not last char in this word buf.append(pString.substring(lastPos, i - 1).toLowerCase()); // depends on control dependency: [if], data = [none] if (current != '-') { buf.append('-'); // depends on control dependency: [if], data = ['-')] } lastPos = i - 1; // depends on control dependency: [if], data = [none] } } if (buf != null) { // Append the rest buf.append(pString.substring(lastPos).toLowerCase()); // depends on control dependency: [if], data = [none] return buf.toString(); // depends on control dependency: [if], data = [none] } else { return Character.isUpperCase(pString.charAt(0)) ? pString.toLowerCase() : pString; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static XMLStreamWriter getXMLStreamWriter(XMLOutputFactory factory, Result result) throws XMLStreamException { XMLStreamWriter xmlStreamWriter; if (result instanceof SAXResult) { // SAXResult is not supported by the standard XMLOutputFactory xmlStreamWriter = new XMLEventStreamWriter(new SAXEventWriter(((SAXResult) result).getHandler()), XML_EVENT_FACTORY); } else if (result instanceof StAXResult) { // XMLEventWriter is not supported as result of XMLOutputFactory#createXMLStreamWriter StAXResult staxResult = (StAXResult) result; if (staxResult.getXMLStreamWriter() != null) { xmlStreamWriter = staxResult.getXMLStreamWriter(); } else { xmlStreamWriter = new XMLEventStreamWriter(staxResult.getXMLEventWriter(), XML_EVENT_FACTORY); } } else { xmlStreamWriter = factory.createXMLStreamWriter(result); } return xmlStreamWriter; } }
public class class_name { public static XMLStreamWriter getXMLStreamWriter(XMLOutputFactory factory, Result result) throws XMLStreamException { XMLStreamWriter xmlStreamWriter; if (result instanceof SAXResult) { // SAXResult is not supported by the standard XMLOutputFactory xmlStreamWriter = new XMLEventStreamWriter(new SAXEventWriter(((SAXResult) result).getHandler()), XML_EVENT_FACTORY); } else if (result instanceof StAXResult) { // XMLEventWriter is not supported as result of XMLOutputFactory#createXMLStreamWriter StAXResult staxResult = (StAXResult) result; if (staxResult.getXMLStreamWriter() != null) { xmlStreamWriter = staxResult.getXMLStreamWriter(); // depends on control dependency: [if], data = [none] } else { xmlStreamWriter = new XMLEventStreamWriter(staxResult.getXMLEventWriter(), XML_EVENT_FACTORY); // depends on control dependency: [if], data = [none] } } else { xmlStreamWriter = factory.createXMLStreamWriter(result); } return xmlStreamWriter; } }
public class class_name { public static String upstreamToString(Channel upstream) { if (upstream == null) { linkedRemaining.set(null); return ""; } if (linkedRemaining.get() == null) { linkedRemaining.set(1); } if (linkedRemaining.get() <= 0) { linkedRemaining.set(null); return "↔…"; } linkedRemaining.set(linkedRemaining.get() - 1); // Build continuation. StringBuilder builder = new StringBuilder(); builder.append('↔') .append(Channel.toString(upstream)); linkedRemaining.set(null); return builder.toString(); } }
public class class_name { public static String upstreamToString(Channel upstream) { if (upstream == null) { linkedRemaining.set(null); // depends on control dependency: [if], data = [null)] return ""; // depends on control dependency: [if], data = [none] } if (linkedRemaining.get() == null) { linkedRemaining.set(1); // depends on control dependency: [if], data = [none] } if (linkedRemaining.get() <= 0) { linkedRemaining.set(null); // depends on control dependency: [if], data = [none] return "↔…"; // depends on control dependency: [if], data = [none] } linkedRemaining.set(linkedRemaining.get() - 1); // Build continuation. StringBuilder builder = new StringBuilder(); builder.append('↔') .append(Channel.toString(upstream)); linkedRemaining.set(null); return builder.toString(); } }
public class class_name { public void marshall(CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes, ProtocolMarshaller protocolMarshaller) { if (completeWorkflowExecutionDecisionAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(completeWorkflowExecutionDecisionAttributes.getResult(), RESULT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes, ProtocolMarshaller protocolMarshaller) { if (completeWorkflowExecutionDecisionAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(completeWorkflowExecutionDecisionAttributes.getResult(), RESULT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void validateNoAggs(AggFinder aggFinder, SqlNode node, String clause) { final SqlCall agg = aggFinder.findAgg(node); if (agg == null) { return; } final SqlOperator op = agg.getOperator(); if (op == SqlStdOperatorTable.OVER) { throw newValidationError(agg, RESOURCE.windowedAggregateIllegalInClause(clause)); } else if (op.isGroup() || op.isGroupAuxiliary()) { throw newValidationError(agg, RESOURCE.groupFunctionMustAppearInGroupByClause(op.getName())); } else { throw newValidationError(agg, RESOURCE.aggregateIllegalInClause(clause)); } } }
public class class_name { private void validateNoAggs(AggFinder aggFinder, SqlNode node, String clause) { final SqlCall agg = aggFinder.findAgg(node); if (agg == null) { return; // depends on control dependency: [if], data = [none] } final SqlOperator op = agg.getOperator(); if (op == SqlStdOperatorTable.OVER) { throw newValidationError(agg, RESOURCE.windowedAggregateIllegalInClause(clause)); } else if (op.isGroup() || op.isGroupAuxiliary()) { throw newValidationError(agg, RESOURCE.groupFunctionMustAppearInGroupByClause(op.getName())); } else { throw newValidationError(agg, RESOURCE.aggregateIllegalInClause(clause)); } } }
public class class_name { public Property getProperty(String key) { for (Property property : m_properties) { if (property.getKey().equals(key)) { return property; } } return null; } }
public class class_name { public Property getProperty(String key) { for (Property property : m_properties) { if (property.getKey().equals(key)) { return property; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private List<JSONObject> findAllMembers(@Nullable String loadBalancerId) throws CloudException, InternalException { NovaMethod method = new NovaMethod(getProvider()); JSONObject result = method.getNetworks(getMembersResource(), null, false, "?tenant_id="+getContext().getAccountNumber()); List<JSONObject> members = new ArrayList<JSONObject>(); if( result != null && result.has("members") ) { try { JSONArray list = result.getJSONArray("members"); for( int i = 0; i < list.length(); i++ ) { JSONObject member = list.getJSONObject(i); if( (loadBalancerId != null && loadBalancerId.equals(member.optString("pool_id")) ) || loadBalancerId == null) { members.add(member); } } } catch( JSONException e ) { logger.error("Unable to understand listMembers response: " + e.getMessage()); throw new CloudException(e); } } return members; } }
public class class_name { private List<JSONObject> findAllMembers(@Nullable String loadBalancerId) throws CloudException, InternalException { NovaMethod method = new NovaMethod(getProvider()); JSONObject result = method.getNetworks(getMembersResource(), null, false, "?tenant_id="+getContext().getAccountNumber()); List<JSONObject> members = new ArrayList<JSONObject>(); if( result != null && result.has("members") ) { try { JSONArray list = result.getJSONArray("members"); for( int i = 0; i < list.length(); i++ ) { JSONObject member = list.getJSONObject(i); if( (loadBalancerId != null && loadBalancerId.equals(member.optString("pool_id")) ) || loadBalancerId == null) { members.add(member); // depends on control dependency: [if], data = [none] } } } catch( JSONException e ) { logger.error("Unable to understand listMembers response: " + e.getMessage()); throw new CloudException(e); } // depends on control dependency: [catch], data = [none] } return members; } }
public class class_name { public synchronized Lease record(@Nonnull FilePath p) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "recorded " + p, new Throwable("from " + this)); } Entry old = inUse.put(p.getRemote(), new Entry(p, false)); if (old!=null) throw new AssertionError("Tried to record a workspace already owned: "+old); return lease(p); } }
public class class_name { public synchronized Lease record(@Nonnull FilePath p) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "recorded " + p, new Throwable("from " + this)); // depends on control dependency: [if], data = [none] } Entry old = inUse.put(p.getRemote(), new Entry(p, false)); if (old!=null) throw new AssertionError("Tried to record a workspace already owned: "+old); return lease(p); } }
public class class_name { public void register(T instance) { if(!isContained(instance)) { registry.add(instance); if(current == null) { current = instance; } } } }
public class class_name { public void register(T instance) { if(!isContained(instance)) { registry.add(instance); // depends on control dependency: [if], data = [none] if(current == null) { current = instance; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @GwtIncompatible("Unnecessary") private String getMapPath(String outputFile) { String basePath = ""; if (outputFile.isEmpty()) { // If we have a js_module_binary rule, output the maps // at modulename_props_map.out, etc. if (!config.moduleOutputPathPrefix.isEmpty()) { basePath = config.moduleOutputPathPrefix; } else { basePath = "jscompiler"; } } else { // Get the path of the output file. File file = new File(outputFile); String outputFileName = file.getName(); // Strip the .js from the name. if (outputFileName.endsWith(".js")) { outputFileName = outputFileName.substring(0, outputFileName.length() - 3); } String fileParent = file.getParent(); if (fileParent == null) { basePath = outputFileName; } else { basePath = file.getParent() + File.separatorChar + outputFileName; } } return basePath; } }
public class class_name { @GwtIncompatible("Unnecessary") private String getMapPath(String outputFile) { String basePath = ""; if (outputFile.isEmpty()) { // If we have a js_module_binary rule, output the maps // at modulename_props_map.out, etc. if (!config.moduleOutputPathPrefix.isEmpty()) { basePath = config.moduleOutputPathPrefix; // depends on control dependency: [if], data = [none] } else { basePath = "jscompiler"; // depends on control dependency: [if], data = [none] } } else { // Get the path of the output file. File file = new File(outputFile); String outputFileName = file.getName(); // Strip the .js from the name. if (outputFileName.endsWith(".js")) { outputFileName = outputFileName.substring(0, outputFileName.length() - 3); // depends on control dependency: [if], data = [none] } String fileParent = file.getParent(); if (fileParent == null) { basePath = outputFileName; // depends on control dependency: [if], data = [none] } else { basePath = file.getParent() + File.separatorChar + outputFileName; // depends on control dependency: [if], data = [none] } } return basePath; } }
public class class_name { protected MethodSpec.Builder generateMethodBuilder(SQLiteModelMethod method) { MethodSpec.Builder methodBuilder; if (method.hasLiveData()) { methodBuilder = MethodSpec.methodBuilder(method.getName() + LIVE_DATA_PREFIX).addModifiers(Modifier.PROTECTED); } else { methodBuilder = MethodSpec.methodBuilder(method.getName()).addAnnotation(Override.class).addModifiers(Modifier.PUBLIC); } return methodBuilder; } }
public class class_name { protected MethodSpec.Builder generateMethodBuilder(SQLiteModelMethod method) { MethodSpec.Builder methodBuilder; if (method.hasLiveData()) { methodBuilder = MethodSpec.methodBuilder(method.getName() + LIVE_DATA_PREFIX).addModifiers(Modifier.PROTECTED); // depends on control dependency: [if], data = [none] } else { methodBuilder = MethodSpec.methodBuilder(method.getName()).addAnnotation(Override.class).addModifiers(Modifier.PUBLIC); // depends on control dependency: [if], data = [none] } return methodBuilder; } }
public class class_name { public int put(Object value) { value = makePoolValue(value); Assert.check(!(value instanceof Type.TypeVar)); Assert.check(!(value instanceof Types.UniqueType && ((UniqueType) value).type instanceof Type.TypeVar)); Integer index = indices.get(value); if (index == null) { index = pp; indices.put(value, index); pool = ArrayUtils.ensureCapacity(pool, pp); pool[pp++] = value; if (value instanceof Long || value instanceof Double) { pool = ArrayUtils.ensureCapacity(pool, pp); pool[pp++] = null; } } return index.intValue(); } }
public class class_name { public int put(Object value) { value = makePoolValue(value); Assert.check(!(value instanceof Type.TypeVar)); Assert.check(!(value instanceof Types.UniqueType && ((UniqueType) value).type instanceof Type.TypeVar)); Integer index = indices.get(value); if (index == null) { index = pp; // depends on control dependency: [if], data = [none] indices.put(value, index); // depends on control dependency: [if], data = [none] pool = ArrayUtils.ensureCapacity(pool, pp); // depends on control dependency: [if], data = [none] pool[pp++] = value; // depends on control dependency: [if], data = [none] if (value instanceof Long || value instanceof Double) { pool = ArrayUtils.ensureCapacity(pool, pp); // depends on control dependency: [if], data = [none] pool[pp++] = null; // depends on control dependency: [if], data = [none] } } return index.intValue(); } }
public class class_name { private char[] getConstantChars() { Set<Character> chars = new TreeSet<Character>(); chars.add('\n'); chars.add('\r'); for (PatternConstant constant : constantSet) { char c = constant.getValue().charAt(0); if (constant.isIgnoreCase()) { chars.add(Character.toLowerCase(c)); chars.add(Character.toUpperCase(c)); } else { chars.add(c); } } char[] cs = new char[chars.size()]; int j = 0; for (Character c : chars) { cs[j] = c; j++; } Arrays.sort(cs); return cs; } }
public class class_name { private char[] getConstantChars() { Set<Character> chars = new TreeSet<Character>(); chars.add('\n'); chars.add('\r'); for (PatternConstant constant : constantSet) { char c = constant.getValue().charAt(0); if (constant.isIgnoreCase()) { chars.add(Character.toLowerCase(c)); // depends on control dependency: [if], data = [none] chars.add(Character.toUpperCase(c)); // depends on control dependency: [if], data = [none] } else { chars.add(c); // depends on control dependency: [if], data = [none] } } char[] cs = new char[chars.size()]; int j = 0; for (Character c : chars) { cs[j] = c; // depends on control dependency: [for], data = [c] j++; // depends on control dependency: [for], data = [none] } Arrays.sort(cs); return cs; } }
public class class_name { public static List<Action> getActions(MonitoringRule rule) { List<Action> result; if (rule.getActions() != null && rule.getActions().getActions() != null) { result = rule.getActions().getActions(); } else { result = Collections.<Action> emptyList(); } return result; } }
public class class_name { public static List<Action> getActions(MonitoringRule rule) { List<Action> result; if (rule.getActions() != null && rule.getActions().getActions() != null) { result = rule.getActions().getActions(); // depends on control dependency: [if], data = [none] } else { result = Collections.<Action> emptyList(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void marshall(MeetingSetting meetingSetting, ProtocolMarshaller protocolMarshaller) { if (meetingSetting == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(meetingSetting.getRequirePin(), REQUIREPIN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MeetingSetting meetingSetting, ProtocolMarshaller protocolMarshaller) { if (meetingSetting == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(meetingSetting.getRequirePin(), REQUIREPIN_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 Key[] getColumnNames(Query qry) { Query qp = Caster.toQuery(qry, null); if (qp != null) return qp.getColumnNames(); String[] strNames = qry.getColumns(); Key[] names = new Key[strNames.length]; for (int i = 0; i < names.length; i++) { names[i] = KeyImpl.getInstance(strNames[i]); } return names; } }
public class class_name { public static Key[] getColumnNames(Query qry) { Query qp = Caster.toQuery(qry, null); if (qp != null) return qp.getColumnNames(); String[] strNames = qry.getColumns(); Key[] names = new Key[strNames.length]; for (int i = 0; i < names.length; i++) { names[i] = KeyImpl.getInstance(strNames[i]); // depends on control dependency: [for], data = [i] } return names; } }
public class class_name { static long[] parseUSmilesNumbers(String aux, IAtomContainer container) { int index; long[] numbers = new long[container.getAtomCount()]; int[] first = null; int label = 1; if ((index = aux.indexOf("/R:")) >= 0) { // reconnected metal numbers int endIndex = aux.indexOf('/', index + 8); if (endIndex<0) endIndex = aux.length(); String[] baseNumbers = aux.substring(index + 8, endIndex).split(";"); first = new int[baseNumbers.length]; Arrays.fill(first, -1); for (int i = 0; i < baseNumbers.length; i++) { String[] numbering = baseNumbers[i].split(","); first[i] = Integer.parseInt(numbering[0]) - 1; for (String number : numbering) { numbers[Integer.parseInt(number) - 1] = label++; } } } else if ((index = aux.indexOf("/N:")) >= 0) { // standard numbers // read the standard numbers first (need to reference back for some structures) String[] baseNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";"); first = new int[baseNumbers.length]; Arrays.fill(first, -1); if ((index = aux.indexOf("/F:")) >= 0) { String[] fixedHNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";"); for (int i = 0; i < fixedHNumbers.length; i++) { String component = fixedHNumbers[i]; // m, 2m, 3m ... need to lookup number in the base numbering if (component.charAt(component.length() - 1) == 'm') { int n = component.length() > 1 ? Integer .parseInt(component.substring(0, component.length() - 1)) : 1; for (int j = 0; j < n; j++) { String[] numbering = baseNumbers[i + j].split(","); first[i + j] = Integer.parseInt(numbering[0]) - 1; for (String number : numbering) numbers[Integer.parseInt(number) - 1] = label++; } } else { String[] numbering = component.split(","); for (String number : numbering) numbers[Integer.parseInt(number)-1] = label++; } } } else { for (int i = 0; i < baseNumbers.length; i++) { String[] numbering = baseNumbers[i].split(","); first[i] = Integer.parseInt(numbering[0]) - 1; for (String number : numbering) numbers[Integer.parseInt(number) - 1] = label++; } } } else { throw new IllegalArgumentException("AuxInfo did not contain extractable base numbers (/N: or /R:)."); } // Rule E: swap any oxygen anion for a double bonded oxygen (InChI sees // them as equivalent) for (int v : first) { if (v >= 0) { IAtom atom = container.getAtom(v); if (atom.getFormalCharge() == null) continue; if (atom.getAtomicNumber() == 8 && atom.getFormalCharge() == -1) { List<IAtom> neighbors = container.getConnectedAtomsList(atom); if (neighbors.size() == 1) { IAtom correctedStart = findPiBondedOxygen(container, neighbors.get(0)); if (correctedStart != null) exch(numbers, v, container.indexOf(correctedStart)); } } } } // assign unlabelled atoms for (int i = 0; i < numbers.length; i++) if (numbers[i] == 0) numbers[i] = label++; return numbers; } }
public class class_name { static long[] parseUSmilesNumbers(String aux, IAtomContainer container) { int index; long[] numbers = new long[container.getAtomCount()]; int[] first = null; int label = 1; if ((index = aux.indexOf("/R:")) >= 0) { // reconnected metal numbers int endIndex = aux.indexOf('/', index + 8); if (endIndex<0) endIndex = aux.length(); String[] baseNumbers = aux.substring(index + 8, endIndex).split(";"); first = new int[baseNumbers.length]; // depends on control dependency: [if], data = [none] Arrays.fill(first, -1); // depends on control dependency: [if], data = [none] for (int i = 0; i < baseNumbers.length; i++) { String[] numbering = baseNumbers[i].split(","); first[i] = Integer.parseInt(numbering[0]) - 1; // depends on control dependency: [for], data = [i] for (String number : numbering) { numbers[Integer.parseInt(number) - 1] = label++; // depends on control dependency: [for], data = [number] } } } else if ((index = aux.indexOf("/N:")) >= 0) { // standard numbers // read the standard numbers first (need to reference back for some structures) String[] baseNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";"); first = new int[baseNumbers.length]; // depends on control dependency: [if], data = [none] Arrays.fill(first, -1); // depends on control dependency: [if], data = [none] if ((index = aux.indexOf("/F:")) >= 0) { String[] fixedHNumbers = aux.substring(index + 3, aux.indexOf('/', index + 3)).split(";"); for (int i = 0; i < fixedHNumbers.length; i++) { String component = fixedHNumbers[i]; // m, 2m, 3m ... need to lookup number in the base numbering if (component.charAt(component.length() - 1) == 'm') { int n = component.length() > 1 ? Integer .parseInt(component.substring(0, component.length() - 1)) : 1; for (int j = 0; j < n; j++) { String[] numbering = baseNumbers[i + j].split(","); first[i + j] = Integer.parseInt(numbering[0]) - 1; // depends on control dependency: [for], data = [j] for (String number : numbering) numbers[Integer.parseInt(number) - 1] = label++; } } else { String[] numbering = component.split(","); for (String number : numbering) numbers[Integer.parseInt(number)-1] = label++; } } } else { for (int i = 0; i < baseNumbers.length; i++) { String[] numbering = baseNumbers[i].split(","); first[i] = Integer.parseInt(numbering[0]) - 1; // depends on control dependency: [for], data = [i] for (String number : numbering) numbers[Integer.parseInt(number) - 1] = label++; } } } else { throw new IllegalArgumentException("AuxInfo did not contain extractable base numbers (/N: or /R:)."); } // Rule E: swap any oxygen anion for a double bonded oxygen (InChI sees // them as equivalent) for (int v : first) { if (v >= 0) { IAtom atom = container.getAtom(v); if (atom.getFormalCharge() == null) continue; if (atom.getAtomicNumber() == 8 && atom.getFormalCharge() == -1) { List<IAtom> neighbors = container.getConnectedAtomsList(atom); if (neighbors.size() == 1) { IAtom correctedStart = findPiBondedOxygen(container, neighbors.get(0)); if (correctedStart != null) exch(numbers, v, container.indexOf(correctedStart)); } } } } // assign unlabelled atoms for (int i = 0; i < numbers.length; i++) if (numbers[i] == 0) numbers[i] = label++; return numbers; } }
public class class_name { private BeanDesc init() { for (Field field : ReflectUtil.getFields(this.beanClass)) { if(false == ModifierUtil.isStatic(field)) { //只针对非static属性 this.propMap.put(field.getName(), createProp(field)); } } return this; } }
public class class_name { private BeanDesc init() { for (Field field : ReflectUtil.getFields(this.beanClass)) { if(false == ModifierUtil.isStatic(field)) { //只针对非static属性 this.propMap.put(field.getName(), createProp(field)); // depends on control dependency: [if], data = [none] } } return this; } }
public class class_name { public static Date parse(String value) { try { return STANDARD_DATE_FORMAT.get().parse(value); } catch (ParseException ignore) { } for (String formatString : BROWSER_COMPATIBLE_DATE_FORMATS) { try { return new SimpleDateFormat(formatString, Locale.US).parse(value); } catch (ParseException ignore) { } } return null; } }
public class class_name { public static Date parse(String value) { try { return STANDARD_DATE_FORMAT.get().parse(value); // depends on control dependency: [try], data = [none] } catch (ParseException ignore) { } // depends on control dependency: [catch], data = [none] for (String formatString : BROWSER_COMPATIBLE_DATE_FORMATS) { try { return new SimpleDateFormat(formatString, Locale.US).parse(value); // depends on control dependency: [try], data = [none] } catch (ParseException ignore) { } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { protected void generateErrorAndRequiredClass(UIInput input, ResponseWriter rw, String clientId, String additionalClass1, String additionalClass2, String additionalClass3) throws IOException { String styleClass = getErrorAndRequiredClass(input, clientId); if (null != additionalClass1) { additionalClass1 = additionalClass1.trim(); if (additionalClass1.trim().length() > 0) { styleClass += " " + additionalClass1; } } if (null != additionalClass2) { additionalClass2 = additionalClass2.trim(); if (additionalClass2.trim().length() > 0) { styleClass += " " + additionalClass2; } } if (null != additionalClass3) { additionalClass3 = additionalClass3.trim(); if (additionalClass3.trim().length() > 0) { styleClass += " " + additionalClass3; } } rw.writeAttribute("class", styleClass, "class"); } }
public class class_name { protected void generateErrorAndRequiredClass(UIInput input, ResponseWriter rw, String clientId, String additionalClass1, String additionalClass2, String additionalClass3) throws IOException { String styleClass = getErrorAndRequiredClass(input, clientId); if (null != additionalClass1) { additionalClass1 = additionalClass1.trim(); if (additionalClass1.trim().length() > 0) { styleClass += " " + additionalClass1; // depends on control dependency: [if], data = [none] } } if (null != additionalClass2) { additionalClass2 = additionalClass2.trim(); if (additionalClass2.trim().length() > 0) { styleClass += " " + additionalClass2; // depends on control dependency: [if], data = [none] } } if (null != additionalClass3) { additionalClass3 = additionalClass3.trim(); if (additionalClass3.trim().length() > 0) { styleClass += " " + additionalClass3; // depends on control dependency: [if], data = [none] } } rw.writeAttribute("class", styleClass, "class"); } }
public class class_name { @SafeVarargs public final void load(@NonNull final KeyType key, @NonNull final ViewType view, final boolean async, @NonNull final ParamType... params) { Condition.INSTANCE.ensureNotNull(key, "The key may not be null"); Condition.INSTANCE.ensureNotNull(view, "The view may not be null"); Condition.INSTANCE.ensureNotNull(params, "The array may not be null"); setCanceled(false); views.put(view, key); DataType data = getCachedData(key); if (!isCanceled()) { if (data != null) { onPostExecute(view, data, 0, params); notifyOnFinished(key, data, view, params); logger.logInfo(getClass(), "Loaded data with key " + key + " from cache"); } else { onPreExecute(view, params); Task<DataType, KeyType, ViewType, ParamType> task = new Task<>(view, key, params); if (async) { loadDataAsynchronously(task); } else { data = loadData(task); onPostExecute(view, data, 0, params); notifyOnFinished(key, data, view, params); } } } } }
public class class_name { @SafeVarargs public final void load(@NonNull final KeyType key, @NonNull final ViewType view, final boolean async, @NonNull final ParamType... params) { Condition.INSTANCE.ensureNotNull(key, "The key may not be null"); Condition.INSTANCE.ensureNotNull(view, "The view may not be null"); Condition.INSTANCE.ensureNotNull(params, "The array may not be null"); setCanceled(false); views.put(view, key); DataType data = getCachedData(key); if (!isCanceled()) { if (data != null) { onPostExecute(view, data, 0, params); // depends on control dependency: [if], data = [none] notifyOnFinished(key, data, view, params); // depends on control dependency: [if], data = [none] logger.logInfo(getClass(), "Loaded data with key " + key + " from cache"); // depends on control dependency: [if], data = [none] } else { onPreExecute(view, params); // depends on control dependency: [if], data = [none] Task<DataType, KeyType, ViewType, ParamType> task = new Task<>(view, key, params); if (async) { loadDataAsynchronously(task); // depends on control dependency: [if], data = [none] } else { data = loadData(task); // depends on control dependency: [if], data = [none] onPostExecute(view, data, 0, params); // depends on control dependency: [if], data = [none] notifyOnFinished(key, data, view, params); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public synchronized void clearCache(boolean force) { List<CacheElement.CacheFile> deleteList = new ArrayList<>(2 * cache.size()); if (force) { cache.clear(); // deletes everything from the cache deleteList.addAll(files.values()); // add everything to the delete list files.clear(); // counter.set(0); } else { // add unlocked files to the delete list, remove from files hash Iterator<CacheElement.CacheFile> iter = files.values().iterator(); while (iter.hasNext()) { CacheElement.CacheFile file = iter.next(); if (file.isLocked.compareAndSet(false, true)) { file.remove(); // remove from the containing CacheElement deleteList.add(file); iter.remove(); } } // remove empty cache elements for (CacheElement elem : cache.values()) { if (elem.list.size() == 0) cache.remove(elem.hashKey); } } // close all files in deleteList for (CacheElement.CacheFile file : deleteList) { if (force && file.isLocked.get()) cacheLog.warn("FileCacheARC " + name + " force close locked file= " + file); //counter.decrementAndGet(); if (file.ncfile == null) continue; try { file.ncfile.setFileCache(null); file.ncfile.close(); file.ncfile = null; // help the gc } catch (IOException e) { log.error("FileCacheARC " + name + " close failed on " + file); } } if (cacheLog.isDebugEnabled()) cacheLog.debug("*FileCacheARC " + name + " clearCache force= " + force + " deleted= " + deleteList.size() + " left=" + files.size()); //System.out.println("\n*NetcdfFileCache.clearCache force= " + force + " deleted= " + deleteList.size() + " left=" + counter.get()); } }
public class class_name { public synchronized void clearCache(boolean force) { List<CacheElement.CacheFile> deleteList = new ArrayList<>(2 * cache.size()); if (force) { cache.clear(); // deletes everything from the cache // depends on control dependency: [if], data = [none] deleteList.addAll(files.values()); // add everything to the delete list // depends on control dependency: [if], data = [none] files.clear(); // depends on control dependency: [if], data = [none] // counter.set(0); } else { // add unlocked files to the delete list, remove from files hash Iterator<CacheElement.CacheFile> iter = files.values().iterator(); while (iter.hasNext()) { CacheElement.CacheFile file = iter.next(); if (file.isLocked.compareAndSet(false, true)) { file.remove(); // remove from the containing CacheElement // depends on control dependency: [if], data = [none] deleteList.add(file); // depends on control dependency: [if], data = [none] iter.remove(); // depends on control dependency: [if], data = [none] } } // remove empty cache elements for (CacheElement elem : cache.values()) { if (elem.list.size() == 0) cache.remove(elem.hashKey); } } // close all files in deleteList for (CacheElement.CacheFile file : deleteList) { if (force && file.isLocked.get()) cacheLog.warn("FileCacheARC " + name + " force close locked file= " + file); //counter.decrementAndGet(); if (file.ncfile == null) continue; try { file.ncfile.setFileCache(null); // depends on control dependency: [try], data = [none] file.ncfile.close(); // depends on control dependency: [try], data = [none] file.ncfile = null; // help the gc // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error("FileCacheARC " + name + " close failed on " + file); } // depends on control dependency: [catch], data = [none] } if (cacheLog.isDebugEnabled()) cacheLog.debug("*FileCacheARC " + name + " clearCache force= " + force + " deleted= " + deleteList.size() + " left=" + files.size()); //System.out.println("\n*NetcdfFileCache.clearCache force= " + force + " deleted= " + deleteList.size() + " left=" + counter.get()); } }
public class class_name { private void setArgStartFormat(int argStart, Format formatter) { if (cachedFormatters == null) { cachedFormatters = new HashMap<Integer, Format>(); } cachedFormatters.put(argStart, formatter); } }
public class class_name { private void setArgStartFormat(int argStart, Format formatter) { if (cachedFormatters == null) { cachedFormatters = new HashMap<Integer, Format>(); // depends on control dependency: [if], data = [none] } cachedFormatters.put(argStart, formatter); } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) public static IncludedContent includeForUrl(String includeUrl, HttpServletRequest request, HttpServletResponse response, Map model) { RequestDispatcher dispatcher = request.getRequestDispatcher(includeUrl); HttpServletResponse wrapped = WrappedResponseHolder.getWrappedResponse(); response = wrapped != null ? wrapped : response; WebUtils.exposeIncludeRequestAttributes(request); Map toRestore = WebUtils.exposeRequestAttributesAndReturnOldValues(request, model); final GrailsWebRequest webRequest = GrailsWebRequest.lookup(request); final boolean hasPreviousWebRequest = webRequest != null; final Object previousControllerClass = hasPreviousWebRequest ? webRequest.getAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, WebRequest.SCOPE_REQUEST) : null; final Object previousMatchedRequest = hasPreviousWebRequest ? webRequest.getAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST, WebRequest.SCOPE_REQUEST) : null; try { if (hasPreviousWebRequest) { webRequest.removeAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, WebRequest.SCOPE_REQUEST); webRequest.removeAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST, WebRequest.SCOPE_REQUEST); webRequest.removeAttribute("grailsWebRequestFilter" + OncePerRequestFilter.ALREADY_FILTERED_SUFFIX, WebRequest.SCOPE_REQUEST); } final IncludeResponseWrapper responseWrapper = new IncludeResponseWrapper(response); try { WrappedResponseHolder.setWrappedResponse(responseWrapper); WebUtils.clearGrailsWebRequest(); dispatcher.include(request, responseWrapper); if (responseWrapper.getRedirectURL()!=null) { return new IncludedContent(responseWrapper.getRedirectURL()); } return new IncludedContent(responseWrapper.getContentType(), responseWrapper.getContent()); } finally { if (hasPreviousWebRequest) { WebUtils.storeGrailsWebRequest(webRequest); if (webRequest.isActive()) { webRequest.setAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, previousControllerClass,WebRequest.SCOPE_REQUEST); webRequest.setAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST,previousMatchedRequest, WebRequest.SCOPE_REQUEST); } } WrappedResponseHolder.setWrappedResponse(wrapped); } } catch (Exception e) { throw new ControllerExecutionException("Unable to execute include: " + e.getMessage(), e); } finally { WebUtils.cleanupIncludeRequestAttributes(request, toRestore); } } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) public static IncludedContent includeForUrl(String includeUrl, HttpServletRequest request, HttpServletResponse response, Map model) { RequestDispatcher dispatcher = request.getRequestDispatcher(includeUrl); HttpServletResponse wrapped = WrappedResponseHolder.getWrappedResponse(); response = wrapped != null ? wrapped : response; WebUtils.exposeIncludeRequestAttributes(request); Map toRestore = WebUtils.exposeRequestAttributesAndReturnOldValues(request, model); final GrailsWebRequest webRequest = GrailsWebRequest.lookup(request); final boolean hasPreviousWebRequest = webRequest != null; final Object previousControllerClass = hasPreviousWebRequest ? webRequest.getAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, WebRequest.SCOPE_REQUEST) : null; final Object previousMatchedRequest = hasPreviousWebRequest ? webRequest.getAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST, WebRequest.SCOPE_REQUEST) : null; try { if (hasPreviousWebRequest) { webRequest.removeAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, WebRequest.SCOPE_REQUEST); // depends on control dependency: [if], data = [none] webRequest.removeAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST, WebRequest.SCOPE_REQUEST); // depends on control dependency: [if], data = [none] webRequest.removeAttribute("grailsWebRequestFilter" + OncePerRequestFilter.ALREADY_FILTERED_SUFFIX, WebRequest.SCOPE_REQUEST); // depends on control dependency: [if], data = [none] } final IncludeResponseWrapper responseWrapper = new IncludeResponseWrapper(response); try { WrappedResponseHolder.setWrappedResponse(responseWrapper); // depends on control dependency: [try], data = [none] WebUtils.clearGrailsWebRequest(); // depends on control dependency: [try], data = [none] dispatcher.include(request, responseWrapper); // depends on control dependency: [try], data = [none] if (responseWrapper.getRedirectURL()!=null) { return new IncludedContent(responseWrapper.getRedirectURL()); // depends on control dependency: [if], data = [(responseWrapper.getRedirectURL()] } return new IncludedContent(responseWrapper.getContentType(), responseWrapper.getContent()); // depends on control dependency: [try], data = [none] } finally { if (hasPreviousWebRequest) { WebUtils.storeGrailsWebRequest(webRequest); // depends on control dependency: [if], data = [none] if (webRequest.isActive()) { webRequest.setAttribute(GrailsApplicationAttributes.GRAILS_CONTROLLER_CLASS_AVAILABLE, previousControllerClass,WebRequest.SCOPE_REQUEST); // depends on control dependency: [if], data = [none] webRequest.setAttribute(UrlMappingsHandlerMapping.MATCHED_REQUEST,previousMatchedRequest, WebRequest.SCOPE_REQUEST); // depends on control dependency: [if], data = [none] } } WrappedResponseHolder.setWrappedResponse(wrapped); } } catch (Exception e) { throw new ControllerExecutionException("Unable to execute include: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] finally { WebUtils.cleanupIncludeRequestAttributes(request, toRestore); } } }
public class class_name { @Override public int release(String path, FuseFileInfo fi) { LOG.trace("release({})", path); OpenFileEntry oe; final long fd = fi.fh.get(); synchronized (mOpenFiles) { oe = mOpenFiles.getFirstByField(ID_INDEX, fd); mOpenFiles.remove(oe); } if (oe == null) { LOG.error("Cannot find fd for {} in table", path); return -ErrorCodes.EBADFD(); } try { oe.close(); } catch (IOException e) { LOG.error("Failed closing {} [in]", path, e); } return 0; } }
public class class_name { @Override public int release(String path, FuseFileInfo fi) { LOG.trace("release({})", path); OpenFileEntry oe; final long fd = fi.fh.get(); synchronized (mOpenFiles) { oe = mOpenFiles.getFirstByField(ID_INDEX, fd); mOpenFiles.remove(oe); } if (oe == null) { LOG.error("Cannot find fd for {} in table", path); // depends on control dependency: [if], data = [none] return -ErrorCodes.EBADFD(); // depends on control dependency: [if], data = [none] } try { oe.close(); } catch (IOException e) { LOG.error("Failed closing {} [in]", path, e); } return 0; } }
public class class_name { private String escape(String str) { if (str == null || str.length() == 0) { return str; } int len = str.length(); StringBuilder ret = new StringBuilder(len * 2); for (int i = 0; i < len; i++) { char cur = str.charAt(i); switch (cur) { case '<': ret.append("&lt;"); break; case '>': ret.append("&gt;"); break; case '"': ret.append("&quot;"); break; case '\'': // ret.append("&apos;"); // IE 不支持 &apos; 考虑 &#39; ret.append("&#39;"); break; case '&': ret.append("&amp;"); break; default: ret.append(cur); break; } } return ret.toString(); } }
public class class_name { private String escape(String str) { if (str == null || str.length() == 0) { return str; // depends on control dependency: [if], data = [none] } int len = str.length(); StringBuilder ret = new StringBuilder(len * 2); for (int i = 0; i < len; i++) { char cur = str.charAt(i); switch (cur) { case '<': ret.append("&lt;"); break; case '>': ret.append("&gt;"); break; case '"': ret.append("&quot;"); break; case '\'': // ret.append("&apos;"); // IE 不支持 &apos; 考虑 &#39; ret.append("&#39;"); break; case '&': ret.append("&amp;"); break; default: ret.append(cur); break; } } return ret.toString(); } }
public class class_name { public synchronized void setDestMsgInterval() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestMsgInterval"); // See if we're issuing message depth thresholds for everything long newInterval = mp.getCustomProperties().getLogAllMessageDepthIntervals(); if (newInterval < 0) newInterval = 0; // Check for a specific custom setting for this destination/foreign bus String destName = destinationHandler.getName(); if (destinationHandler.isLink()) destName = ((LinkHandler) destinationHandler).getBusName(); Hashtable<String, Long> depthIntervals = mp.getCustomProperties().getLogMessageDepthIntervalsTable(); if (depthIntervals.containsKey(destName)) newInterval = (depthIntervals.get(destName)).longValue(); if (newInterval != _destMsgInterval) { _destMsgInterval = newInterval; if (_destMsgInterval > 0) { // Get our current message depth so that we can work out the next up and down interval long currentDepth = getTotalMsgCount(); _nextUpDepthInterval = ((currentDepth / _destMsgInterval) + 1) * _destMsgInterval; _nextDownDepthInterval = ((currentDepth - 1) / _destMsgInterval) * _destMsgInterval; } else { _nextUpDepthInterval = Long.MAX_VALUE; _nextDownDepthInterval = Long.MIN_VALUE; } // Set the MsgStore watermarks so that we find out when we cross either of these thresholds updateWatermarks(getTotalMsgCount()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setDestMsgInterval"); } }
public class class_name { public synchronized void setDestMsgInterval() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestMsgInterval"); // See if we're issuing message depth thresholds for everything long newInterval = mp.getCustomProperties().getLogAllMessageDepthIntervals(); if (newInterval < 0) newInterval = 0; // Check for a specific custom setting for this destination/foreign bus String destName = destinationHandler.getName(); if (destinationHandler.isLink()) destName = ((LinkHandler) destinationHandler).getBusName(); Hashtable<String, Long> depthIntervals = mp.getCustomProperties().getLogMessageDepthIntervalsTable(); if (depthIntervals.containsKey(destName)) newInterval = (depthIntervals.get(destName)).longValue(); if (newInterval != _destMsgInterval) { _destMsgInterval = newInterval; // depends on control dependency: [if], data = [none] if (_destMsgInterval > 0) { // Get our current message depth so that we can work out the next up and down interval long currentDepth = getTotalMsgCount(); _nextUpDepthInterval = ((currentDepth / _destMsgInterval) + 1) * _destMsgInterval; // depends on control dependency: [if], data = [none] _nextDownDepthInterval = ((currentDepth - 1) / _destMsgInterval) * _destMsgInterval; // depends on control dependency: [if], data = [none] } else { _nextUpDepthInterval = Long.MAX_VALUE; // depends on control dependency: [if], data = [none] _nextDownDepthInterval = Long.MIN_VALUE; // depends on control dependency: [if], data = [none] } // Set the MsgStore watermarks so that we find out when we cross either of these thresholds updateWatermarks(getTotalMsgCount()); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setDestMsgInterval"); } }
public class class_name { void handleLastScannedRow(ByteString key) { try { currentState = currentState.handleLastScannedRow(key); } catch (RuntimeException e) { currentState = null; throw e; } } }
public class class_name { void handleLastScannedRow(ByteString key) { try { currentState = currentState.handleLastScannedRow(key); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { currentState = null; throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void txnPollBackupReserve(long itemId, String transactionId) { QueueItem item = getBackupMap().remove(itemId); if (item != null) { txMap.put(itemId, new TxQueueItem(item).setPollOperation(true).setTransactionId(transactionId)); return; } if (txMap.remove(itemId) == null) { logger.warning("Poll backup reserve failed, itemId: " + itemId + " is not found"); } } }
public class class_name { public void txnPollBackupReserve(long itemId, String transactionId) { QueueItem item = getBackupMap().remove(itemId); if (item != null) { txMap.put(itemId, new TxQueueItem(item).setPollOperation(true).setTransactionId(transactionId)); // depends on control dependency: [if], data = [(item] return; // depends on control dependency: [if], data = [none] } if (txMap.remove(itemId) == null) { logger.warning("Poll backup reserve failed, itemId: " + itemId + " is not found"); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Long hLen(byte[] key) { try { if (isPipelined()) { pipeline(new JedisResult(pipeline.hlen(key))); return null; } return client.hlen(key); } catch (Exception ex) { throw convertException(ex); } } }
public class class_name { @Override public Long hLen(byte[] key) { try { if (isPipelined()) { pipeline(new JedisResult(pipeline.hlen(key))); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return client.hlen(key); // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw convertException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean dumpDatabaseSchemaToFile( DatabaseContext ctx, File file ) { log.info( "Dumping database schema to file " + file.getAbsolutePath() ); DatabaseDescriptionInspector inspector = new DatabaseDescriptionInspector(); DatabaseDescription dbDesc = inspector.getDatabaseDescription( ctx.db, ctx.dbh ); Gson gson = new Gson(); String json = gson.toJson( dbDesc ); try { PrintWriter writer; writer = new PrintWriter( file ); writer.print( json ); writer.close(); return true; } catch( FileNotFoundException e ) { e.printStackTrace(); return false; } } }
public class class_name { public static boolean dumpDatabaseSchemaToFile( DatabaseContext ctx, File file ) { log.info( "Dumping database schema to file " + file.getAbsolutePath() ); DatabaseDescriptionInspector inspector = new DatabaseDescriptionInspector(); DatabaseDescription dbDesc = inspector.getDatabaseDescription( ctx.db, ctx.dbh ); Gson gson = new Gson(); String json = gson.toJson( dbDesc ); try { PrintWriter writer; writer = new PrintWriter( file ); // depends on control dependency: [try], data = [none] writer.print( json ); // depends on control dependency: [try], data = [none] writer.close(); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch( FileNotFoundException e ) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int charAt(String source, int offset16) { char single = source.charAt(offset16); if (single < LEAD_SURROGATE_MIN_VALUE) { return single; } return _charAt(source, offset16, single); } }
public class class_name { public static int charAt(String source, int offset16) { char single = source.charAt(offset16); if (single < LEAD_SURROGATE_MIN_VALUE) { return single; // depends on control dependency: [if], data = [none] } return _charAt(source, offset16, single); } }
public class class_name { public static Collection<AnnotationValue> resolveTypeQualifierDefaults(Collection<AnnotationValue> values, ElementType elementType) { LinkedList<AnnotationValue> result = new LinkedList<>(); for (AnnotationValue value : values) { resolveTypeQualifierDefaults(value, elementType, result); } return result; } }
public class class_name { public static Collection<AnnotationValue> resolveTypeQualifierDefaults(Collection<AnnotationValue> values, ElementType elementType) { LinkedList<AnnotationValue> result = new LinkedList<>(); for (AnnotationValue value : values) { resolveTypeQualifierDefaults(value, elementType, result); // depends on control dependency: [for], data = [value] } return result; } }
public class class_name { static void setBackgroundWithRipple(View clickedView, final View backgroundView, final View bgOverlay, final int newColor, int animationDuration) { int centerX = (int) (clickedView.getX() + (clickedView.getMeasuredWidth() / 2)); int centerY = clickedView.getMeasuredHeight() / 2; int finalRadius = backgroundView.getWidth(); backgroundView.clearAnimation(); bgOverlay.clearAnimation(); Animator circularReveal; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { circularReveal = ViewAnimationUtils .createCircularReveal(bgOverlay, centerX, centerY, 0, finalRadius); } else { bgOverlay.setAlpha(0); circularReveal = ObjectAnimator.ofFloat(bgOverlay, "alpha", 0, 1); } circularReveal.setDuration(animationDuration); circularReveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { onCancel(); } @Override public void onAnimationCancel(Animator animation) { onCancel(); } private void onCancel() { backgroundView.setBackgroundColor(newColor); bgOverlay.setVisibility(View.GONE); } }); bgOverlay.setBackgroundColor(newColor); bgOverlay.setVisibility(View.VISIBLE); circularReveal.start(); } }
public class class_name { static void setBackgroundWithRipple(View clickedView, final View backgroundView, final View bgOverlay, final int newColor, int animationDuration) { int centerX = (int) (clickedView.getX() + (clickedView.getMeasuredWidth() / 2)); int centerY = clickedView.getMeasuredHeight() / 2; int finalRadius = backgroundView.getWidth(); backgroundView.clearAnimation(); bgOverlay.clearAnimation(); Animator circularReveal; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { circularReveal = ViewAnimationUtils .createCircularReveal(bgOverlay, centerX, centerY, 0, finalRadius); // depends on control dependency: [if], data = [none] } else { bgOverlay.setAlpha(0); // depends on control dependency: [if], data = [none] circularReveal = ObjectAnimator.ofFloat(bgOverlay, "alpha", 0, 1); // depends on control dependency: [if], data = [none] } circularReveal.setDuration(animationDuration); circularReveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { onCancel(); } @Override public void onAnimationCancel(Animator animation) { onCancel(); } private void onCancel() { backgroundView.setBackgroundColor(newColor); bgOverlay.setVisibility(View.GONE); } }); bgOverlay.setBackgroundColor(newColor); bgOverlay.setVisibility(View.VISIBLE); circularReveal.start(); } }
public class class_name { public static String parseTemplate(String template, Object paramObj) { String output; try { output = (String) TemplateRuntime.eval(template, paramObj); } catch (Exception e) { throw new ParseExpressionException("解析Mvel模板异常,解析出错的模板为:" + template, e); } return output; } }
public class class_name { public static String parseTemplate(String template, Object paramObj) { String output; try { output = (String) TemplateRuntime.eval(template, paramObj); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new ParseExpressionException("解析Mvel模板异常,解析出错的模板为:" + template, e); } // depends on control dependency: [catch], data = [none] return output; } }
public class class_name { public BuiltinIntentMetadata withSupportedLocales(String... supportedLocales) { if (this.supportedLocales == null) { setSupportedLocales(new java.util.ArrayList<String>(supportedLocales.length)); } for (String ele : supportedLocales) { this.supportedLocales.add(ele); } return this; } }
public class class_name { public BuiltinIntentMetadata withSupportedLocales(String... supportedLocales) { if (this.supportedLocales == null) { setSupportedLocales(new java.util.ArrayList<String>(supportedLocales.length)); // depends on control dependency: [if], data = [none] } for (String ele : supportedLocales) { this.supportedLocales.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; } }
public class class_name { private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); // depends on control dependency: [if], data = [none] featureIds.put(featureId, featureShape); // depends on control dependency: [if], data = [none] } return featureShape; } }
public class class_name { public static String[] setGenericConf(String[] argv, Configuration conf) { String[] serviceId = new String[1]; serviceId[0] = ""; String[] filteredArgv = getServiceName(argv, serviceId); if (!serviceId[0].equals("")) { if (!NameNode.validateServiceName(conf, serviceId[0])) { throw new IllegalArgumentException("Service Id doesn't match the config"); } setGenericConf(conf, serviceId[0], NameNode.NAMESERVICE_SPECIFIC_KEYS); NameNode.setupDefaultURI(conf); } return filteredArgv; } }
public class class_name { public static String[] setGenericConf(String[] argv, Configuration conf) { String[] serviceId = new String[1]; serviceId[0] = ""; String[] filteredArgv = getServiceName(argv, serviceId); if (!serviceId[0].equals("")) { if (!NameNode.validateServiceName(conf, serviceId[0])) { throw new IllegalArgumentException("Service Id doesn't match the config"); } setGenericConf(conf, serviceId[0], NameNode.NAMESERVICE_SPECIFIC_KEYS); // depends on control dependency: [if], data = [none] NameNode.setupDefaultURI(conf); // depends on control dependency: [if], data = [none] } return filteredArgv; } }
public class class_name { private static Double priority(final String text) { final String[] parts = MediaType.split(text); final Double priority; if (parts.length > 1) { final String num = MediaType.NON_DIGITS.matcher(parts[1]).replaceAll(""); if (num.isEmpty()) { priority = 0.0d; } else { priority = Double.parseDouble(num); } } else { priority = 1.0d; } return priority; } }
public class class_name { private static Double priority(final String text) { final String[] parts = MediaType.split(text); final Double priority; if (parts.length > 1) { final String num = MediaType.NON_DIGITS.matcher(parts[1]).replaceAll(""); if (num.isEmpty()) { priority = 0.0d; // depends on control dependency: [if], data = [none] } else { priority = Double.parseDouble(num); // depends on control dependency: [if], data = [none] } } else { priority = 1.0d; // depends on control dependency: [if], data = [none] } return priority; } }
public class class_name { private boolean isNullOrMatchingType(final Object injectedValue, final Field field) { if (injectedValue == null) { // null is always type-compatible return true; } final Class<?> fieldType = field.getType(); final Class<?> valueType = injectedValue.getClass(); if (fieldType.isPrimitive()) { return fieldType == primitiveTypeFor(valueType); } return fieldType.isAssignableFrom(valueType); } }
public class class_name { private boolean isNullOrMatchingType(final Object injectedValue, final Field field) { if (injectedValue == null) { // null is always type-compatible return true; // depends on control dependency: [if], data = [none] } final Class<?> fieldType = field.getType(); final Class<?> valueType = injectedValue.getClass(); if (fieldType.isPrimitive()) { return fieldType == primitiveTypeFor(valueType); // depends on control dependency: [if], data = [none] } return fieldType.isAssignableFrom(valueType); } }
public class class_name { public static aaauser[] get(nitro_service service, String username[]) throws Exception{ if (username !=null && username.length>0) { aaauser response[] = new aaauser[username.length]; aaauser obj[] = new aaauser[username.length]; for (int i=0;i<username.length;i++) { obj[i] = new aaauser(); obj[i].set_username(username[i]); response[i] = (aaauser) obj[i].get_resource(service); } return response; } return null; } }
public class class_name { public static aaauser[] get(nitro_service service, String username[]) throws Exception{ if (username !=null && username.length>0) { aaauser response[] = new aaauser[username.length]; aaauser obj[] = new aaauser[username.length]; for (int i=0;i<username.length;i++) { obj[i] = new aaauser(); // depends on control dependency: [for], data = [i] obj[i].set_username(username[i]); // depends on control dependency: [for], data = [i] response[i] = (aaauser) obj[i].get_resource(service); // depends on control dependency: [for], data = [i] } return response; } return null; } }
public class class_name { protected void notifyListenersResourceFound(HttpMessage message, int depth, String uri) { for (SpiderParserListener l : listeners) { l.resourceURIFound(message, depth, uri); } } }
public class class_name { protected void notifyListenersResourceFound(HttpMessage message, int depth, String uri) { for (SpiderParserListener l : listeners) { l.resourceURIFound(message, depth, uri); // depends on control dependency: [for], data = [l] } } }
public class class_name { public void marshall(PasswordPolicyType passwordPolicyType, ProtocolMarshaller protocolMarshaller) { if (passwordPolicyType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(passwordPolicyType.getMinimumLength(), MINIMUMLENGTH_BINDING); protocolMarshaller.marshall(passwordPolicyType.getRequireUppercase(), REQUIREUPPERCASE_BINDING); protocolMarshaller.marshall(passwordPolicyType.getRequireLowercase(), REQUIRELOWERCASE_BINDING); protocolMarshaller.marshall(passwordPolicyType.getRequireNumbers(), REQUIRENUMBERS_BINDING); protocolMarshaller.marshall(passwordPolicyType.getRequireSymbols(), REQUIRESYMBOLS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PasswordPolicyType passwordPolicyType, ProtocolMarshaller protocolMarshaller) { if (passwordPolicyType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(passwordPolicyType.getMinimumLength(), MINIMUMLENGTH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(passwordPolicyType.getRequireUppercase(), REQUIREUPPERCASE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(passwordPolicyType.getRequireLowercase(), REQUIRELOWERCASE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(passwordPolicyType.getRequireNumbers(), REQUIRENUMBERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(passwordPolicyType.getRequireSymbols(), REQUIRESYMBOLS_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 { @Override public void onEvent(final javax.jcr.observation.EventIterator events) { Session lookupSession = null; try { lookupSession = getJcrSession(repository.login()); @SuppressWarnings("unchecked") final Iterator<Event> filteredEvents = filter(events, eventFilter::test); eventMapper.apply(iteratorToStream(filteredEvents)) .map(filterAndDerefResourceTypes(lookupSession)) .flatMap(handleMoveEvents(lookupSession)) .forEach(this::post); } finally { if (lookupSession != null) { lookupSession.logout(); } } } }
public class class_name { @Override public void onEvent(final javax.jcr.observation.EventIterator events) { Session lookupSession = null; try { lookupSession = getJcrSession(repository.login()); // depends on control dependency: [try], data = [none] @SuppressWarnings("unchecked") final Iterator<Event> filteredEvents = filter(events, eventFilter::test); eventMapper.apply(iteratorToStream(filteredEvents)) .map(filterAndDerefResourceTypes(lookupSession)) .flatMap(handleMoveEvents(lookupSession)) .forEach(this::post); // depends on control dependency: [try], data = [none] } finally { if (lookupSession != null) { lookupSession.logout(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static long roundUpPow2(long a) { if (a <= 0) { return 1; } else if (a > 0x4000000000000000L) { throw new IllegalArgumentException("Rounding " + a + " to the next highest power of two would exceed the int range"); } else { a--; a |= a >> 1; a |= a >> 2; a |= a >> 4; a |= a >> 8; a |= a >> 16; a |= a >> 32; a++; return a; } } }
public class class_name { public static long roundUpPow2(long a) { if (a <= 0) { return 1; // depends on control dependency: [if], data = [none] } else if (a > 0x4000000000000000L) { throw new IllegalArgumentException("Rounding " + a + " to the next highest power of two would exceed the int range"); } else { a--; // depends on control dependency: [if], data = [none] a |= a >> 1; // depends on control dependency: [if], data = [none] a |= a >> 2; // depends on control dependency: [if], data = [none] a |= a >> 4; // depends on control dependency: [if], data = [none] a |= a >> 8; // depends on control dependency: [if], data = [none] a |= a >> 16; // depends on control dependency: [if], data = [none] a |= a >> 32; // depends on control dependency: [if], data = [none] a++; // depends on control dependency: [if], data = [none] return a; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void showLoading() { final FragmentIf fragmentIf = getFragmentIf(); fragmentIf.executeOnUIThread(new Runnable() { @Override public void run() { if (loading != null) { loading.show(fragmentIf); } } }); } }
public class class_name { @Override public void showLoading() { final FragmentIf fragmentIf = getFragmentIf(); fragmentIf.executeOnUIThread(new Runnable() { @Override public void run() { if (loading != null) { loading.show(fragmentIf); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public SynthesizeSpeechRequest withSpeechMarkTypes(String... speechMarkTypes) { if (this.speechMarkTypes == null) { setSpeechMarkTypes(new java.util.ArrayList<String>(speechMarkTypes.length)); } for (String ele : speechMarkTypes) { this.speechMarkTypes.add(ele); } return this; } }
public class class_name { public SynthesizeSpeechRequest withSpeechMarkTypes(String... speechMarkTypes) { if (this.speechMarkTypes == null) { setSpeechMarkTypes(new java.util.ArrayList<String>(speechMarkTypes.length)); // depends on control dependency: [if], data = [none] } for (String ele : speechMarkTypes) { this.speechMarkTypes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static StringBuilder formatTo(StringBuilder buf, double[][] d, String pre, String pos, String csep, NumberFormat nf) { if(d == null) { return buf.append("null"); } if(d.length == 0) { return buf; } for(int i = 0; i < d.length; i++) { formatTo(buf.append(pre), d[i], csep, nf).append(pos); } return buf; } }
public class class_name { public static StringBuilder formatTo(StringBuilder buf, double[][] d, String pre, String pos, String csep, NumberFormat nf) { if(d == null) { return buf.append("null"); // depends on control dependency: [if], data = [none] } if(d.length == 0) { return buf; // depends on control dependency: [if], data = [none] } for(int i = 0; i < d.length; i++) { formatTo(buf.append(pre), d[i], csep, nf).append(pos); // depends on control dependency: [for], data = [i] } return buf; } }
public class class_name { @SuppressWarnings("static-method") protected String transformURLAnchor(File file, String anchor, ReferenceContext references) { String anc = anchor; if (references != null) { anc = references.validateAnchor(anc); } return anc; } }
public class class_name { @SuppressWarnings("static-method") protected String transformURLAnchor(File file, String anchor, ReferenceContext references) { String anc = anchor; if (references != null) { anc = references.validateAnchor(anc); // depends on control dependency: [if], data = [none] } return anc; } }
public class class_name { @Override public EClass getIfcRevolvedAreaSolid() { if (ifcRevolvedAreaSolidEClass == null) { ifcRevolvedAreaSolidEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(575); } return ifcRevolvedAreaSolidEClass; } }
public class class_name { @Override public EClass getIfcRevolvedAreaSolid() { if (ifcRevolvedAreaSolidEClass == null) { ifcRevolvedAreaSolidEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(575); // depends on control dependency: [if], data = [none] } return ifcRevolvedAreaSolidEClass; } }
public class class_name { private int findCoordElementContiguous(double target, boolean bounded) { int n = axis.getNcoords(); //double resolution = (values[n-1] - values[0]) / (n - 1); //int startGuess = (int) Math.round((target - values[0]) / resolution); int low = 0; int high = n - 1; if (axis.isAscending()) { // Check that the point is within range if (target < axis.getCoordEdge1(0)) return bounded ? 0 : -1; else if (target > axis.getCoordEdgeLast()) return bounded ? n - 1 : n; // do a binary search to find the nearest index int mid; while (high > low + 1) { mid = (low + high) / 2; // binary search if (contains(target, mid, true)) return mid; else if (axis.getCoordEdge2(mid) < target) low = mid; else high = mid; } return contains(target, low, true) ? low : high; } else { // descending // Check that the point is within range if (target > axis.getCoordEdge1(0)) return bounded ? 0 : -1; else if (target < axis.getCoordEdgeLast()) return bounded ? n - 1 : n; // do a binary search to find the nearest index int mid; while (high > low + 1) { mid = (low + high) / 2; // binary search if (contains(target, mid, false)) return mid; else if (axis.getCoordEdge2(mid) < target) high = mid; else low = mid; } return contains(target, low, false) ? low : high; } } }
public class class_name { private int findCoordElementContiguous(double target, boolean bounded) { int n = axis.getNcoords(); //double resolution = (values[n-1] - values[0]) / (n - 1); //int startGuess = (int) Math.round((target - values[0]) / resolution); int low = 0; int high = n - 1; if (axis.isAscending()) { // Check that the point is within range if (target < axis.getCoordEdge1(0)) return bounded ? 0 : -1; else if (target > axis.getCoordEdgeLast()) return bounded ? n - 1 : n; // do a binary search to find the nearest index int mid; while (high > low + 1) { mid = (low + high) / 2; // binary search // depends on control dependency: [while], data = [none] if (contains(target, mid, true)) return mid; else if (axis.getCoordEdge2(mid) < target) low = mid; else high = mid; } return contains(target, low, true) ? low : high; // depends on control dependency: [if], data = [none] } else { // descending // Check that the point is within range if (target > axis.getCoordEdge1(0)) return bounded ? 0 : -1; else if (target < axis.getCoordEdgeLast()) return bounded ? n - 1 : n; // do a binary search to find the nearest index int mid; while (high > low + 1) { mid = (low + high) / 2; // binary search // depends on control dependency: [while], data = [none] if (contains(target, mid, false)) return mid; else if (axis.getCoordEdge2(mid) < target) high = mid; else low = mid; } return contains(target, low, false) ? low : high; // depends on control dependency: [if], data = [none] } } }
public class class_name { private int saveStartTime(long time) { int indexUsed = diagIndex; alarmTime[diagIndex++] = time; if (diagIndex >= MAX_DIAG_LOG) { diagIndex = 0; } return indexUsed; } }
public class class_name { private int saveStartTime(long time) { int indexUsed = diagIndex; alarmTime[diagIndex++] = time; if (diagIndex >= MAX_DIAG_LOG) { diagIndex = 0; // depends on control dependency: [if], data = [none] } return indexUsed; } }
public class class_name { private List<AbstractBaseDTNode<I, D>> updateDTTargets(List<TTTTransition<I, D>> transitions, boolean hard) { final List<AbstractBaseDTNode<I, D>> nodes = new ArrayList<>(transitions.size()); final List<Word<I>> prefixes = new ArrayList<>(transitions.size()); for (final TTTTransition<I, D> t : transitions) { if (!t.isTree()) { AbstractBaseDTNode<I, D> dt = t.getNonTreeTarget(); nodes.add(dt); prefixes.add(t.getAccessSequence()); } } final Iterator<AbstractBaseDTNode<I, D>> leavesIter = dtree.sift(nodes, prefixes, hard).iterator(); final List<AbstractBaseDTNode<I, D>> result = new ArrayList<>(transitions.size()); for (final TTTTransition<I, D> t : transitions) { if (t.isTree()) { result.add(t.getTreeTarget().dtLeaf); } else { AbstractBaseDTNode<I, D> leaf = leavesIter.next(); t.setNonTreeTarget(leaf); result.add(leaf); } } assert !leavesIter.hasNext(); return result; } }
public class class_name { private List<AbstractBaseDTNode<I, D>> updateDTTargets(List<TTTTransition<I, D>> transitions, boolean hard) { final List<AbstractBaseDTNode<I, D>> nodes = new ArrayList<>(transitions.size()); final List<Word<I>> prefixes = new ArrayList<>(transitions.size()); for (final TTTTransition<I, D> t : transitions) { if (!t.isTree()) { AbstractBaseDTNode<I, D> dt = t.getNonTreeTarget(); nodes.add(dt); // depends on control dependency: [if], data = [none] prefixes.add(t.getAccessSequence()); // depends on control dependency: [if], data = [none] } } final Iterator<AbstractBaseDTNode<I, D>> leavesIter = dtree.sift(nodes, prefixes, hard).iterator(); final List<AbstractBaseDTNode<I, D>> result = new ArrayList<>(transitions.size()); for (final TTTTransition<I, D> t : transitions) { if (t.isTree()) { result.add(t.getTreeTarget().dtLeaf); // depends on control dependency: [if], data = [none] } else { AbstractBaseDTNode<I, D> leaf = leavesIter.next(); t.setNonTreeTarget(leaf); // depends on control dependency: [if], data = [none] result.add(leaf); // depends on control dependency: [if], data = [none] } } assert !leavesIter.hasNext(); return result; } }
public class class_name { @SuppressWarnings("checkstyle:InnerAssignment") public static void quickSort(final int[][] x, final long from, final long to, final IntComparator comp) { final long len = to - from; // Selection sort on smallest arrays if (len < SMALL) { selectionSort(x, from, to, comp); return; } // Choose a partition element, v long m = from + len / 2; // Small arrays, middle element if (len > SMALL) { long l = from; long n = to - 1; if (len > MEDIUM) { // Big arrays, pseudomedian of 9 long s = len / 8; l = med3(x, l, l + s, l + 2 * s, comp); m = med3(x, m - s, m, m + s, comp); n = med3(x, n - 2 * s, n - s, n, comp); } m = med3(x, l, m, n, comp); // Mid-size, med of 3 } final int v = get(x, m); // Establish Invariant: v* (<v)* (>v)* v* long a = from; long b = a; long c = to - 1; long d = c; while (true) { int comparison; while (b <= c && (comparison = comp.compare(get(x, b), v)) <= 0) { if (comparison == 0) { swap(x, a++, b); } b++; } while (c >= b && (comparison = comp.compare(get(x, c), v)) >= 0) { if (comparison == 0) { swap(x, c, d--); } c--; } if (b > c) { break; } swap(x, b++, c--); } // Swap partition elements back to middle long s; long n = to; s = Math.min(a - from, b - a); vecSwap(x, from, b - s, s); s = Math.min(d - c, n - d - 1); vecSwap(x, b, n - s, s); // Recursively sort non-partition-elements if ((s = b - a) > 1) { quickSort(x, from, from + s, comp); } if ((s = d - c) > 1) { quickSort(x, n - s, n, comp); } } }
public class class_name { @SuppressWarnings("checkstyle:InnerAssignment") public static void quickSort(final int[][] x, final long from, final long to, final IntComparator comp) { final long len = to - from; // Selection sort on smallest arrays if (len < SMALL) { selectionSort(x, from, to, comp); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Choose a partition element, v long m = from + len / 2; // Small arrays, middle element if (len > SMALL) { long l = from; long n = to - 1; if (len > MEDIUM) { // Big arrays, pseudomedian of 9 long s = len / 8; l = med3(x, l, l + s, l + 2 * s, comp); // depends on control dependency: [if], data = [none] m = med3(x, m - s, m, m + s, comp); // depends on control dependency: [if], data = [none] n = med3(x, n - 2 * s, n - s, n, comp); // depends on control dependency: [if], data = [none] } m = med3(x, l, m, n, comp); // Mid-size, med of 3 // depends on control dependency: [if], data = [none] } final int v = get(x, m); // Establish Invariant: v* (<v)* (>v)* v* long a = from; long b = a; long c = to - 1; long d = c; while (true) { int comparison; while (b <= c && (comparison = comp.compare(get(x, b), v)) <= 0) { if (comparison == 0) { swap(x, a++, b); // depends on control dependency: [if], data = [none] } b++; // depends on control dependency: [while], data = [none] } while (c >= b && (comparison = comp.compare(get(x, c), v)) >= 0) { if (comparison == 0) { swap(x, c, d--); // depends on control dependency: [if], data = [none] } c--; // depends on control dependency: [while], data = [none] } if (b > c) { break; } swap(x, b++, c--); // depends on control dependency: [while], data = [none] } // Swap partition elements back to middle long s; long n = to; s = Math.min(a - from, b - a); vecSwap(x, from, b - s, s); s = Math.min(d - c, n - d - 1); vecSwap(x, b, n - s, s); // Recursively sort non-partition-elements if ((s = b - a) > 1) { quickSort(x, from, from + s, comp); // depends on control dependency: [if], data = [none] } if ((s = d - c) > 1) { quickSort(x, n - s, n, comp); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean notifyOnRestoreDefaultValuesRequested() { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValuesRequested(this); } return result; } }
public class class_name { private boolean notifyOnRestoreDefaultValuesRequested() { boolean result = true; for (RestoreDefaultsListener listener : restoreDefaultsListeners) { result &= listener.onRestoreDefaultValuesRequested(this); // depends on control dependency: [for], data = [listener] } return result; } }
public class class_name { public static String makePropertyName(String name) { char[] buf = new char[name.length() + 3]; int pos = 0; buf[pos++] = 's'; buf[pos++] = 'e'; buf[pos++] = 't'; for (int ix = 0; ix < name.length(); ix++) { char ch = name.charAt(ix); if (ix == 0) ch = Character.toUpperCase(ch); else if (ch == '-') { ix++; if (ix == name.length()) break; ch = Character.toUpperCase(name.charAt(ix)); } buf[pos++] = ch; } return new String(buf, 0, pos); } }
public class class_name { public static String makePropertyName(String name) { char[] buf = new char[name.length() + 3]; int pos = 0; buf[pos++] = 's'; buf[pos++] = 'e'; buf[pos++] = 't'; for (int ix = 0; ix < name.length(); ix++) { char ch = name.charAt(ix); if (ix == 0) ch = Character.toUpperCase(ch); else if (ch == '-') { ix++; // depends on control dependency: [if], data = [none] if (ix == name.length()) break; ch = Character.toUpperCase(name.charAt(ix)); // depends on control dependency: [if], data = [none] } buf[pos++] = ch; // depends on control dependency: [for], data = [none] } return new String(buf, 0, pos); } }
public class class_name { public static String[] splitOptions(String input) { //Note that we use a regex matching all "|" characters not prefixed by "\" //Since we define a regex for matching, the input delimiter "|" needs to be escaped, as well as "\", //which is even double-escaped - one escaping is due to the String, one due to the regex. // emulate missing lookbehinds in JS regexes by first reversing the input, // then using a split with lookaheads, and finally reversing the parts resulting // from the split String reverse = reverse(input); String[] parts = reverse.split("\\|(?!\\\\)"); String[] finalParts = new String[parts.length]; int lastIndex = parts.length - 1; for (int i = 0; i < parts.length; i++) { finalParts[lastIndex - i] = reverse(parts[i]); } return finalParts; } }
public class class_name { public static String[] splitOptions(String input) { //Note that we use a regex matching all "|" characters not prefixed by "\" //Since we define a regex for matching, the input delimiter "|" needs to be escaped, as well as "\", //which is even double-escaped - one escaping is due to the String, one due to the regex. // emulate missing lookbehinds in JS regexes by first reversing the input, // then using a split with lookaheads, and finally reversing the parts resulting // from the split String reverse = reverse(input); String[] parts = reverse.split("\\|(?!\\\\)"); String[] finalParts = new String[parts.length]; int lastIndex = parts.length - 1; for (int i = 0; i < parts.length; i++) { finalParts[lastIndex - i] = reverse(parts[i]); // depends on control dependency: [for], data = [i] } return finalParts; } }
public class class_name { @Override public Set<String> getExtensionClasses() { Set<String> serviceClazzes = new HashSet<>(); if (getType() == ArchiveType.WEB_MODULE) { Resource webInfClassesMetaInfServicesEntry = getResource(CDIUtils.WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION); serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(webInfClassesMetaInfServicesEntry)); } Resource metaInfServicesEntry = getResource(CDIUtils.META_INF_SERVICES_CDI_EXTENSION); serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(metaInfServicesEntry)); return serviceClazzes; } }
public class class_name { @Override public Set<String> getExtensionClasses() { Set<String> serviceClazzes = new HashSet<>(); if (getType() == ArchiveType.WEB_MODULE) { Resource webInfClassesMetaInfServicesEntry = getResource(CDIUtils.WEB_INF_CLASSES_META_INF_SERVICES_CDI_EXTENSION); serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(webInfClassesMetaInfServicesEntry)); // depends on control dependency: [if], data = [none] } Resource metaInfServicesEntry = getResource(CDIUtils.META_INF_SERVICES_CDI_EXTENSION); serviceClazzes.addAll(CDIUtils.parseServiceSPIExtensionFile(metaInfServicesEntry)); return serviceClazzes; } }
public class class_name { public double falseNegativeRate(EvaluationAveraging averaging) { int nClasses = confusion().getClasses().size(); if (averaging == EvaluationAveraging.Macro) { double macroFNR = 0.0; for (int i = 0; i < nClasses; i++) { macroFNR += falseNegativeRate(i); } macroFNR /= nClasses; return macroFNR; } else if (averaging == EvaluationAveraging.Micro) { long fnCount = 0; long tnCount = 0; for (int i = 0; i < nClasses; i++) { fnCount += falseNegatives.getCount(i); tnCount += trueNegatives.getCount(i); } return EvaluationUtils.falseNegativeRate(fnCount, tnCount, DEFAULT_EDGE_VALUE); } else { throw new UnsupportedOperationException("Unknown averaging approach: " + averaging); } } }
public class class_name { public double falseNegativeRate(EvaluationAveraging averaging) { int nClasses = confusion().getClasses().size(); if (averaging == EvaluationAveraging.Macro) { double macroFNR = 0.0; for (int i = 0; i < nClasses; i++) { macroFNR += falseNegativeRate(i); // depends on control dependency: [for], data = [i] } macroFNR /= nClasses; // depends on control dependency: [if], data = [none] return macroFNR; // depends on control dependency: [if], data = [none] } else if (averaging == EvaluationAveraging.Micro) { long fnCount = 0; long tnCount = 0; for (int i = 0; i < nClasses; i++) { fnCount += falseNegatives.getCount(i); // depends on control dependency: [for], data = [i] tnCount += trueNegatives.getCount(i); // depends on control dependency: [for], data = [i] } return EvaluationUtils.falseNegativeRate(fnCount, tnCount, DEFAULT_EDGE_VALUE); // depends on control dependency: [if], data = [none] } else { throw new UnsupportedOperationException("Unknown averaging approach: " + averaging); } } }
public class class_name { public void marshall(DescribeInventoryDeletionsRequest describeInventoryDeletionsRequest, ProtocolMarshaller protocolMarshaller) { if (describeInventoryDeletionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeInventoryDeletionsRequest.getDeletionId(), DELETIONID_BINDING); protocolMarshaller.marshall(describeInventoryDeletionsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(describeInventoryDeletionsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeInventoryDeletionsRequest describeInventoryDeletionsRequest, ProtocolMarshaller protocolMarshaller) { if (describeInventoryDeletionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeInventoryDeletionsRequest.getDeletionId(), DELETIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeInventoryDeletionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeInventoryDeletionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }