code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public Item getItem(int position) { if (shouldInsertItemAtPosition(position)) { return mItems.get(itemInsertedBeforeCount(position - 1)); } return null; } }
public class class_name { public Item getItem(int position) { if (shouldInsertItemAtPosition(position)) { return mItems.get(itemInsertedBeforeCount(position - 1)); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private boolean isNotPresentDisplayedEnabledSelect(String action, String expected) { // wait for element to be present if (isNotPresent(action, expected, Element.CANT_SELECT)) { return true; } // wait for element to be displayed if (isNotDisplayed(action, expected, Element.CANT_SELECT)) { return true; } // wait for element to be enabled return isNotEnabled(action, expected, Element.CANT_SELECT) || !isSelect(action, expected); } }
public class class_name { private boolean isNotPresentDisplayedEnabledSelect(String action, String expected) { // wait for element to be present if (isNotPresent(action, expected, Element.CANT_SELECT)) { return true; // depends on control dependency: [if], data = [none] } // wait for element to be displayed if (isNotDisplayed(action, expected, Element.CANT_SELECT)) { return true; // depends on control dependency: [if], data = [none] } // wait for element to be enabled return isNotEnabled(action, expected, Element.CANT_SELECT) || !isSelect(action, expected); } }
public class class_name { public final void mTEXT() throws RecognitionException { try { int _type = TEXT; int _channel = DEFAULT_TOKEN_CHANNEL; // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:116:5: ( ( 'T' | 't' ) ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) ) // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:116:7: ( 'T' | 't' ) ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) { if ( input.LA(1)=='T'||input.LA(1)=='t' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } if ( input.LA(1)=='E'||input.LA(1)=='e' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } if ( input.LA(1)=='X'||input.LA(1)=='x' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } if ( input.LA(1)=='T'||input.LA(1)=='t' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public final void mTEXT() throws RecognitionException { try { int _type = TEXT; int _channel = DEFAULT_TOKEN_CHANNEL; // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:116:5: ( ( 'T' | 't' ) ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) ) // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:116:7: ( 'T' | 't' ) ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) { if ( input.LA(1)=='T'||input.LA(1)=='t' ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } if ( input.LA(1)=='E'||input.LA(1)=='e' ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } if ( input.LA(1)=='X'||input.LA(1)=='x' ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } if ( input.LA(1)=='T'||input.LA(1)=='t' ) { input.consume(); // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); // depends on control dependency: [if], data = [none] throw mse; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { private String getEntityManagerFactoryName(String beanName) { if (beanName.length() > ENTITY_MANAGER_FACTORY_SUFFIX.length() && StringUtils .endsWithIgnoreCase(beanName, ENTITY_MANAGER_FACTORY_SUFFIX)) { return beanName.substring(0, beanName.length() - ENTITY_MANAGER_FACTORY_SUFFIX.length()); } return beanName; } }
public class class_name { private String getEntityManagerFactoryName(String beanName) { if (beanName.length() > ENTITY_MANAGER_FACTORY_SUFFIX.length() && StringUtils .endsWithIgnoreCase(beanName, ENTITY_MANAGER_FACTORY_SUFFIX)) { return beanName.substring(0, beanName.length() - ENTITY_MANAGER_FACTORY_SUFFIX.length()); // depends on control dependency: [if], data = [none] } return beanName; } }
public class class_name { public static Term create(Element element) { if (element instanceof StringProperty) { return create(((StringProperty) element).getValue()); } else if (element instanceof LongProperty) { return create(((LongProperty) element).getValue().longValue()); } else { throw EvaluationException.create(MSG_INVALID_ELEMENT_FOR_INDEX, element.getTypeAsString()); } } }
public class class_name { public static Term create(Element element) { if (element instanceof StringProperty) { return create(((StringProperty) element).getValue()); // depends on control dependency: [if], data = [none] } else if (element instanceof LongProperty) { return create(((LongProperty) element).getValue().longValue()); // depends on control dependency: [if], data = [none] } else { throw EvaluationException.create(MSG_INVALID_ELEMENT_FOR_INDEX, element.getTypeAsString()); } } }
public class class_name { public static <T> T fromJson(String jsonString, Class<T> clazz) { if (StringHelper.isEmpty(jsonString)) { return null; } try { return mapper.readValue(jsonString, clazz); } catch (Exception e) { log.warn("parse json string error:" + jsonString, e); return null; } } }
public class class_name { public static <T> T fromJson(String jsonString, Class<T> clazz) { if (StringHelper.isEmpty(jsonString)) { return null; // depends on control dependency: [if], data = [none] } try { return mapper.readValue(jsonString, clazz); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn("parse json string error:" + jsonString, e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private synchronized void awaitResponse() throws BOSHException { HttpEntity entity = null; try { HttpResponse httpResp = client.execute(post, context); entity = httpResp.getEntity(); byte[] data = EntityUtils.toByteArray(entity); String encoding = entity.getContentEncoding() != null ? entity.getContentEncoding().getValue() : null; if (ZLIBCodec.getID().equalsIgnoreCase(encoding)) { data = ZLIBCodec.decode(data); } else if (GZIPCodec.getID().equalsIgnoreCase(encoding)) { data = GZIPCodec.decode(data); } body = StaticBody.fromString(new String(data, CHARSET)); statusCode = httpResp.getStatusLine().getStatusCode(); sent = true; } catch (IOException iox) { abort(); toThrow = new BOSHException("Could not obtain response", iox); throw(toThrow); } catch (RuntimeException ex) { abort(); throw(ex); } } }
public class class_name { private synchronized void awaitResponse() throws BOSHException { HttpEntity entity = null; try { HttpResponse httpResp = client.execute(post, context); entity = httpResp.getEntity(); byte[] data = EntityUtils.toByteArray(entity); String encoding = entity.getContentEncoding() != null ? entity.getContentEncoding().getValue() : null; if (ZLIBCodec.getID().equalsIgnoreCase(encoding)) { data = ZLIBCodec.decode(data); // depends on control dependency: [if], data = [none] } else if (GZIPCodec.getID().equalsIgnoreCase(encoding)) { data = GZIPCodec.decode(data); // depends on control dependency: [if], data = [none] } body = StaticBody.fromString(new String(data, CHARSET)); statusCode = httpResp.getStatusLine().getStatusCode(); sent = true; } catch (IOException iox) { abort(); toThrow = new BOSHException("Could not obtain response", iox); throw(toThrow); } catch (RuntimeException ex) { abort(); throw(ex); } } }
public class class_name { public void marshall(DurationRange durationRange, ProtocolMarshaller protocolMarshaller) { if (durationRange == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(durationRange.getMinSeconds(), MINSECONDS_BINDING); protocolMarshaller.marshall(durationRange.getMaxSeconds(), MAXSECONDS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DurationRange durationRange, ProtocolMarshaller protocolMarshaller) { if (durationRange == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(durationRange.getMinSeconds(), MINSECONDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(durationRange.getMaxSeconds(), MAXSECONDS_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 RepeatedFieldBuilder<MType, BType, IType> addAllMessages( final Iterable<? extends MType> values) { for (final MType value : values) { if (value == null) { throw new NullPointerException(); } } if (values instanceof Collection) { @SuppressWarnings("unchecked") final Collection<MType> collection = (Collection<MType>) values; if (collection.size() == 0) { return this; } ensureMutableMessageList(); for (final MType value : values) { addMessage(value); } } else { ensureMutableMessageList(); for (final MType value : values) { addMessage(value); } } onChanged(); incrementModCounts(); return this; } }
public class class_name { public RepeatedFieldBuilder<MType, BType, IType> addAllMessages( final Iterable<? extends MType> values) { for (final MType value : values) { if (value == null) { throw new NullPointerException(); } } if (values instanceof Collection) { @SuppressWarnings("unchecked") final Collection<MType> collection = (Collection<MType>) values; if (collection.size() == 0) { return this; // depends on control dependency: [if], data = [none] } ensureMutableMessageList(); // depends on control dependency: [if], data = [none] for (final MType value : values) { addMessage(value); // depends on control dependency: [for], data = [value] } } else { ensureMutableMessageList(); // depends on control dependency: [if], data = [none] for (final MType value : values) { addMessage(value); // depends on control dependency: [for], data = [value] } } onChanged(); incrementModCounts(); return this; } }
public class class_name { static SearchRequestBuilder applyAliasMetadata(EsMajorVersion version, Map<String, IndicesAliases.Alias> aliases, SearchRequestBuilder searchRequestBuilder, String index, String... indicesOrAliases) { if (QueryUtils.isExplicitlyRequested(index, indicesOrAliases)) { return searchRequestBuilder; } Set<String> routing = new HashSet<String>(); List<QueryBuilder> aliasFilters = new ArrayList<QueryBuilder>(); for (IndicesAliases.Alias alias : aliases.values()) { if (QueryUtils.isExplicitlyRequested(alias.getName(), indicesOrAliases)) { // The alias is explicitly requested if (StringUtils.hasLength(alias.getSearchRouting())) { for (String value : alias.getSearchRouting().split(",")) { routing.add(value.trim()); } } if (alias.getFilter() != null) { try { aliasFilters.add(new RawQueryBuilder(alias.getFilter(), false)); } catch (IOException e) { throw new EsHadoopIllegalArgumentException("Failed to parse alias filter: [" + alias.getFilter() + "]"); } } } } if (aliasFilters.size() > 0) { QueryBuilder aliasQuery; if (aliasFilters.size() == 1) { aliasQuery = aliasFilters.get(0); } else { aliasQuery = new BoolQueryBuilder(); for (QueryBuilder filter : aliasFilters) { ((BoolQueryBuilder) aliasQuery).should(filter); } } if (searchRequestBuilder.query() == null) { searchRequestBuilder.query(aliasQuery); } else { BoolQueryBuilder mainQuery = new BoolQueryBuilder(); mainQuery.must(searchRequestBuilder.query()); if (version.after(EsMajorVersion.V_1_X)) { mainQuery.filter(aliasQuery); } else { mainQuery.must(new ConstantScoreQueryBuilder().filter(aliasQuery).boost(0.0f)); } searchRequestBuilder.query(mainQuery); } } if (routing.size() > 0) { searchRequestBuilder.routing(StringUtils.concatenate(routing, ",")); } return searchRequestBuilder; } }
public class class_name { static SearchRequestBuilder applyAliasMetadata(EsMajorVersion version, Map<String, IndicesAliases.Alias> aliases, SearchRequestBuilder searchRequestBuilder, String index, String... indicesOrAliases) { if (QueryUtils.isExplicitlyRequested(index, indicesOrAliases)) { return searchRequestBuilder; // depends on control dependency: [if], data = [none] } Set<String> routing = new HashSet<String>(); List<QueryBuilder> aliasFilters = new ArrayList<QueryBuilder>(); for (IndicesAliases.Alias alias : aliases.values()) { if (QueryUtils.isExplicitlyRequested(alias.getName(), indicesOrAliases)) { // The alias is explicitly requested if (StringUtils.hasLength(alias.getSearchRouting())) { for (String value : alias.getSearchRouting().split(",")) { routing.add(value.trim()); // depends on control dependency: [for], data = [value] } } if (alias.getFilter() != null) { try { aliasFilters.add(new RawQueryBuilder(alias.getFilter(), false)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new EsHadoopIllegalArgumentException("Failed to parse alias filter: [" + alias.getFilter() + "]"); } // depends on control dependency: [catch], data = [none] } } } if (aliasFilters.size() > 0) { QueryBuilder aliasQuery; if (aliasFilters.size() == 1) { aliasQuery = aliasFilters.get(0); // depends on control dependency: [if], data = [none] } else { aliasQuery = new BoolQueryBuilder(); // depends on control dependency: [if], data = [none] for (QueryBuilder filter : aliasFilters) { ((BoolQueryBuilder) aliasQuery).should(filter); // depends on control dependency: [for], data = [filter] } } if (searchRequestBuilder.query() == null) { searchRequestBuilder.query(aliasQuery); // depends on control dependency: [if], data = [none] } else { BoolQueryBuilder mainQuery = new BoolQueryBuilder(); mainQuery.must(searchRequestBuilder.query()); // depends on control dependency: [if], data = [(searchRequestBuilder.query()] if (version.after(EsMajorVersion.V_1_X)) { mainQuery.filter(aliasQuery); // depends on control dependency: [if], data = [none] } else { mainQuery.must(new ConstantScoreQueryBuilder().filter(aliasQuery).boost(0.0f)); // depends on control dependency: [if], data = [none] } searchRequestBuilder.query(mainQuery); // depends on control dependency: [if], data = [none] } } if (routing.size() > 0) { searchRequestBuilder.routing(StringUtils.concatenate(routing, ",")); // depends on control dependency: [if], data = [none] } return searchRequestBuilder; } }
public class class_name { public Map<String, String> getUriVariablesForEntity(BullhornEntityInfo entityInfo, Integer id, Set<String> fieldSet, EntityParams params) { if (params == null) { params = ParamFactory.entityParams(); } Map<String, String> uriVariables = params.getParameterMap(); this.addCommonUriVariables(fieldSet, entityInfo, uriVariables); uriVariables.put(ID, id == null ? "" : id.toString()); return uriVariables; } }
public class class_name { public Map<String, String> getUriVariablesForEntity(BullhornEntityInfo entityInfo, Integer id, Set<String> fieldSet, EntityParams params) { if (params == null) { params = ParamFactory.entityParams(); // depends on control dependency: [if], data = [none] } Map<String, String> uriVariables = params.getParameterMap(); this.addCommonUriVariables(fieldSet, entityInfo, uriVariables); uriVariables.put(ID, id == null ? "" : id.toString()); return uriVariables; } }
public class class_name { @Override protected void onString(String text, String fieldName, JsonParser jp) { log.trace(fieldName + " " + text); if ("_id".equals(fieldName)) { List<java.lang.reflect.Field> fields = ClassUtil.getAnnotatedFields(entity.getClass(), Id.class); if (fields.isEmpty() || fields.size() > 1) { throw new ApitraryOrmIdException("Illegal amount of annotated id properties of class " + entity.getClass().getName()); } else { ClassUtil.setSilent(this.entity, fields.get(0).getName(), text); } } } }
public class class_name { @Override protected void onString(String text, String fieldName, JsonParser jp) { log.trace(fieldName + " " + text); if ("_id".equals(fieldName)) { List<java.lang.reflect.Field> fields = ClassUtil.getAnnotatedFields(entity.getClass(), Id.class); if (fields.isEmpty() || fields.size() > 1) { throw new ApitraryOrmIdException("Illegal amount of annotated id properties of class " + entity.getClass().getName()); } else { ClassUtil.setSilent(this.entity, fields.get(0).getName(), text); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected String loadOnlyConfig(final Class<T> cl) { try { /* Load up the config */ ConfigurationStore cs = getStore(); List<String> configNames = cs.getConfigs(); if (configNames.isEmpty()) { error("No configuration on path " + cs.getLocation()); return "No configuration on path " + cs.getLocation(); } if (configNames.size() != 1) { error("1 and only 1 configuration allowed"); return "1 and only 1 configuration allowed"; } String configName = configNames.iterator().next(); cfg = getConfigInfo(cs, configName, cl); if (cfg == null) { error("Unable to read configuration"); return "Unable to read configuration"; } setConfigName(configName); return null; } catch (Throwable t) { error("Failed to load configuration: " + t.getLocalizedMessage()); error(t); return "failed"; } } }
public class class_name { protected String loadOnlyConfig(final Class<T> cl) { try { /* Load up the config */ ConfigurationStore cs = getStore(); List<String> configNames = cs.getConfigs(); if (configNames.isEmpty()) { error("No configuration on path " + cs.getLocation()); // depends on control dependency: [if], data = [none] return "No configuration on path " + cs.getLocation(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } if (configNames.size() != 1) { error("1 and only 1 configuration allowed"); // depends on control dependency: [if], data = [none] return "1 and only 1 configuration allowed"; // depends on control dependency: [if], data = [none] } String configName = configNames.iterator().next(); cfg = getConfigInfo(cs, configName, cl); // depends on control dependency: [try], data = [none] if (cfg == null) { error("Unable to read configuration"); // depends on control dependency: [if], data = [none] return "Unable to read configuration"; // depends on control dependency: [if], data = [none] } setConfigName(configName); // depends on control dependency: [try], data = [none] return null; // depends on control dependency: [try], data = [none] } catch (Throwable t) { error("Failed to load configuration: " + t.getLocalizedMessage()); error(t); return "failed"; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void ensureCapacityUnsafe(int addBytes) { int newCapacity = writerIndex() + addBytes; if (newCapacity > capacity()) { byte[] tmp = new byte[newCapacity * 3 / 2]; System.arraycopy(array, 0, tmp, 0, writerIndex()); array = tmp; } // int size = writableBytes(); // if (minWritableBytes <= size) { // return; // } // int addSize = minWritableBytes - size; // array = Arrays.copyOf(array, array.length + addSize); } }
public class class_name { protected void ensureCapacityUnsafe(int addBytes) { int newCapacity = writerIndex() + addBytes; if (newCapacity > capacity()) { byte[] tmp = new byte[newCapacity * 3 / 2]; System.arraycopy(array, 0, tmp, 0, writerIndex()); // depends on control dependency: [if], data = [none] array = tmp; // depends on control dependency: [if], data = [none] } // int size = writableBytes(); // if (minWritableBytes <= size) { // return; // } // int addSize = minWritableBytes - size; // array = Arrays.copyOf(array, array.length + addSize); } }
public class class_name { public static int hashLengthToCoverBoundingBox(double topLeftLat, double topLeftLon, double bottomRightLat, double bottomRightLon) { boolean isEven = true; double minLat = -90.0, maxLat = 90; double minLon = -180.0, maxLon = 180.0; for (int bits = 0; bits < MAX_HASH_LENGTH * 5; bits++) { if (isEven) { double mid = (minLon + maxLon) / 2; if (topLeftLon >= mid) { if (bottomRightLon < mid) return bits / 5; minLon = mid; } else { if (bottomRightLon >= mid) return bits / 5; maxLon = mid; } } else { double mid = (minLat + maxLat) / 2; if (topLeftLat >= mid) { if (bottomRightLat < mid) return bits / 5; minLat = mid; } else { if (bottomRightLat >= mid) return bits / 5; maxLat = mid; } } isEven = !isEven; } return MAX_HASH_LENGTH; } }
public class class_name { public static int hashLengthToCoverBoundingBox(double topLeftLat, double topLeftLon, double bottomRightLat, double bottomRightLon) { boolean isEven = true; double minLat = -90.0, maxLat = 90; double minLon = -180.0, maxLon = 180.0; for (int bits = 0; bits < MAX_HASH_LENGTH * 5; bits++) { if (isEven) { double mid = (minLon + maxLon) / 2; if (topLeftLon >= mid) { if (bottomRightLon < mid) return bits / 5; minLon = mid; // depends on control dependency: [if], data = [none] } else { if (bottomRightLon >= mid) return bits / 5; maxLon = mid; // depends on control dependency: [if], data = [none] } } else { double mid = (minLat + maxLat) / 2; if (topLeftLat >= mid) { if (bottomRightLat < mid) return bits / 5; minLat = mid; // depends on control dependency: [if], data = [none] } else { if (bottomRightLat >= mid) return bits / 5; maxLat = mid; // depends on control dependency: [if], data = [none] } } isEven = !isEven; // depends on control dependency: [for], data = [none] } return MAX_HASH_LENGTH; } }
public class class_name { public final T getComponent(final String aName) { for (final T c : this) { if (c.getName().equals(aName)) { return c; } } return null; } }
public class class_name { public final T getComponent(final String aName) { for (final T c : this) { if (c.getName().equals(aName)) { return c; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private Resolved resolve(Record record, ReadConsistency consistency, boolean scheduleCompactionIfPresent) { Table table = record.getKey().getTable(); String key = record.getKey().getKey(); // Resolve the timeline into a flattened object Expanded expanded = expand(record, false, consistency); // Log records with too many uncompacted deltas as a potential performance problem. _slowQueryLog.log(table.getName(), key, expanded); // Are there deltas in this record that we no longer need? If so, schedule an asynchronous compaction. if (scheduleCompactionIfPresent && expanded.getPendingCompaction() != null) { compactAsync(table, key, expanded.getPendingCompaction()); } return expanded.getResolved(); } }
public class class_name { private Resolved resolve(Record record, ReadConsistency consistency, boolean scheduleCompactionIfPresent) { Table table = record.getKey().getTable(); String key = record.getKey().getKey(); // Resolve the timeline into a flattened object Expanded expanded = expand(record, false, consistency); // Log records with too many uncompacted deltas as a potential performance problem. _slowQueryLog.log(table.getName(), key, expanded); // Are there deltas in this record that we no longer need? If so, schedule an asynchronous compaction. if (scheduleCompactionIfPresent && expanded.getPendingCompaction() != null) { compactAsync(table, key, expanded.getPendingCompaction()); // depends on control dependency: [if], data = [none] } return expanded.getResolved(); } }
public class class_name { public Observable<ServiceResponse<ListStreamingLocatorsResponseInner>> listStreamingLocatorsWithServiceResponseAsync(String resourceGroupName, String accountName, String assetName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (assetName == null) { throw new IllegalArgumentException("Parameter assetName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listStreamingLocators(this.client.subscriptionId(), resourceGroupName, accountName, assetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ListStreamingLocatorsResponseInner>>>() { @Override public Observable<ServiceResponse<ListStreamingLocatorsResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ListStreamingLocatorsResponseInner> clientResponse = listStreamingLocatorsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ListStreamingLocatorsResponseInner>> listStreamingLocatorsWithServiceResponseAsync(String resourceGroupName, String accountName, String assetName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (assetName == null) { throw new IllegalArgumentException("Parameter assetName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listStreamingLocators(this.client.subscriptionId(), resourceGroupName, accountName, assetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ListStreamingLocatorsResponseInner>>>() { @Override public Observable<ServiceResponse<ListStreamingLocatorsResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ListStreamingLocatorsResponseInner> clientResponse = listStreamingLocatorsDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private void processOptions(OptionSet options) { Pseudorandom.get().setSeed(options.valueOf(randomSeed)); if (opts.contains(CommonOptions.MAP_REDUCE)) { MapReduceConfiguration.setMapReduceExecutor(new LocalMapReduceExecutor( options.valueOf(mrMaxThreads), options.valueOf(mrMaxBatchesPerThread))); } if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT) || opts.contains(CommonOptions.LBFGS)) { LogFunction log = null; if (parsedOptions.has(logBrief)) { log = new NullLogFunction(); } else { log = new DefaultLogFunction(parsedOptions.valueOf(logInterval), false, options.valueOf(logParametersInterval), options.valueOf(logParametersDir)); } LogFunctions.setLogFunction(log); } } }
public class class_name { private void processOptions(OptionSet options) { Pseudorandom.get().setSeed(options.valueOf(randomSeed)); if (opts.contains(CommonOptions.MAP_REDUCE)) { MapReduceConfiguration.setMapReduceExecutor(new LocalMapReduceExecutor( options.valueOf(mrMaxThreads), options.valueOf(mrMaxBatchesPerThread))); // depends on control dependency: [if], data = [none] } if (opts.contains(CommonOptions.STOCHASTIC_GRADIENT) || opts.contains(CommonOptions.LBFGS)) { LogFunction log = null; if (parsedOptions.has(logBrief)) { log = new NullLogFunction(); // depends on control dependency: [if], data = [none] } else { log = new DefaultLogFunction(parsedOptions.valueOf(logInterval), false, options.valueOf(logParametersInterval), options.valueOf(logParametersDir)); // depends on control dependency: [if], data = [none] } LogFunctions.setLogFunction(log); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void addThrowableAndCauses(List<ThrowableDTO> exceptions, Throwable exception) { if (exception != null) { ThrowableDTO dto = new ThrowableDTO(exception); exceptions.add(dto); Throwable cause = exception.getCause(); if (cause != null && cause != exception) { addThrowableAndCauses(exceptions, cause); } } } }
public class class_name { public static void addThrowableAndCauses(List<ThrowableDTO> exceptions, Throwable exception) { if (exception != null) { ThrowableDTO dto = new ThrowableDTO(exception); exceptions.add(dto); // depends on control dependency: [if], data = [none] Throwable cause = exception.getCause(); if (cause != null && cause != exception) { addThrowableAndCauses(exceptions, cause); // depends on control dependency: [if], data = [none] } } } }
public class class_name { boolean isUpdateable() throws SQLException { checkClosed(); if (resultsetconcurrency == ResultSet.CONCUR_READ_ONLY) { throw new PSQLException( GT.tr("ResultSets with concurrency CONCUR_READ_ONLY cannot be updated."), PSQLState.INVALID_CURSOR_STATE); } if (updateable) { return true; } connection.getLogger().log(Level.FINE, "checking if rs is updateable"); parseQuery(); if (!singleTable) { connection.getLogger().log(Level.FINE, "not a single table"); return false; } connection.getLogger().log(Level.FINE, "getting primary keys"); // // Contains the primary key? // primaryKeys = new ArrayList<PrimaryKey>(); // this is not strictly jdbc spec, but it will make things much faster if used // the user has to select oid, * from table and then we will just use oid usingOID = false; int oidIndex = findColumnIndex("oid"); // 0 if not present int i = 0; int numPKcolumns = 0; // if we find the oid then just use it // oidIndex will be >0 if the oid was in the select list if (oidIndex > 0) { i++; numPKcolumns++; primaryKeys.add(new PrimaryKey(oidIndex, "oid")); usingOID = true; } else { // otherwise go and get the primary keys and create a list of keys String[] s = quotelessTableName(tableName); String quotelessTableName = s[0]; String quotelessSchemaName = s[1]; java.sql.ResultSet rs = connection.getMetaData().getPrimaryKeys("", quotelessSchemaName, quotelessTableName); while (rs.next()) { numPKcolumns++; String columnName = rs.getString(4); // get the columnName int index = findColumnIndex(columnName); if (index > 0) { i++; primaryKeys.add(new PrimaryKey(index, columnName)); // get the primary key information } } rs.close(); } connection.getLogger().log(Level.FINE, "no of keys={0}", i); if (i < 1) { throw new PSQLException(GT.tr("No primary key found for table {0}.", tableName), PSQLState.DATA_ERROR); } updateable = (i == numPKcolumns); connection.getLogger().log(Level.FINE, "checking primary key {0}", updateable); return updateable; } }
public class class_name { boolean isUpdateable() throws SQLException { checkClosed(); if (resultsetconcurrency == ResultSet.CONCUR_READ_ONLY) { throw new PSQLException( GT.tr("ResultSets with concurrency CONCUR_READ_ONLY cannot be updated."), PSQLState.INVALID_CURSOR_STATE); } if (updateable) { return true; } connection.getLogger().log(Level.FINE, "checking if rs is updateable"); parseQuery(); if (!singleTable) { connection.getLogger().log(Level.FINE, "not a single table"); return false; } connection.getLogger().log(Level.FINE, "getting primary keys"); // // Contains the primary key? // primaryKeys = new ArrayList<PrimaryKey>(); // this is not strictly jdbc spec, but it will make things much faster if used // the user has to select oid, * from table and then we will just use oid usingOID = false; int oidIndex = findColumnIndex("oid"); // 0 if not present int i = 0; int numPKcolumns = 0; // if we find the oid then just use it // oidIndex will be >0 if the oid was in the select list if (oidIndex > 0) { i++; numPKcolumns++; primaryKeys.add(new PrimaryKey(oidIndex, "oid")); usingOID = true; } else { // otherwise go and get the primary keys and create a list of keys String[] s = quotelessTableName(tableName); String quotelessTableName = s[0]; String quotelessSchemaName = s[1]; java.sql.ResultSet rs = connection.getMetaData().getPrimaryKeys("", quotelessSchemaName, quotelessTableName); while (rs.next()) { numPKcolumns++; // depends on control dependency: [while], data = [none] String columnName = rs.getString(4); // get the columnName int index = findColumnIndex(columnName); if (index > 0) { i++; // depends on control dependency: [if], data = [none] primaryKeys.add(new PrimaryKey(index, columnName)); // get the primary key information // depends on control dependency: [if], data = [(index] } } rs.close(); } connection.getLogger().log(Level.FINE, "no of keys={0}", i); if (i < 1) { throw new PSQLException(GT.tr("No primary key found for table {0}.", tableName), PSQLState.DATA_ERROR); } updateable = (i == numPKcolumns); connection.getLogger().log(Level.FINE, "checking primary key {0}", updateable); return updateable; } }
public class class_name { private void addAnnualData(final VerticalLayout content, final String name, final String label, final Map<String, List<GovernmentBodyAnnualOutcomeSummary>> collect) { final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH); for (final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry : collect.entrySet()) { series.addSeries(new XYseries().setLabel(entry.getKey())); dataSeries.newSeries(); addEntryData(dataSeries, simpleDateFormat, entry); } addChart(content, name + label, new DCharts().setDataSeries(dataSeries) .setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true); } }
public class class_name { private void addAnnualData(final VerticalLayout content, final String name, final String label, final Map<String, List<GovernmentBodyAnnualOutcomeSummary>> collect) { final DataSeries dataSeries = new DataSeries(); final Series series = new Series(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH); for (final Entry<String, List<GovernmentBodyAnnualOutcomeSummary>> entry : collect.entrySet()) { series.addSeries(new XYseries().setLabel(entry.getKey())); // depends on control dependency: [for], data = [entry] dataSeries.newSeries(); // depends on control dependency: [for], data = [none] addEntryData(dataSeries, simpleDateFormat, entry); // depends on control dependency: [for], data = [entry] } addChart(content, name + label, new DCharts().setDataSeries(dataSeries) .setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true); } }
public class class_name { @Override public int compare(String o1, String o2) { if (C_ELEMENT_SYMBOL.equals(o1)) { if (C_ELEMENT_SYMBOL.equals(o2)) { return 0; } else { return -1; } } else if (H_ELEMENT_SYMBOL.equals(o1)) { if (C_ELEMENT_SYMBOL.equals(o2)) { return 1; } else if (H_ELEMENT_SYMBOL.equals(o2)) { return 0; } else { return -1; } } else { if (C_ELEMENT_SYMBOL.equals(o2) || H_ELEMENT_SYMBOL.equals(o2)) { return 1; } else { return ((String) o1).compareTo((String) o2); } } } }
public class class_name { @Override public int compare(String o1, String o2) { if (C_ELEMENT_SYMBOL.equals(o1)) { if (C_ELEMENT_SYMBOL.equals(o2)) { return 0; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } else if (H_ELEMENT_SYMBOL.equals(o1)) { if (C_ELEMENT_SYMBOL.equals(o2)) { return 1; // depends on control dependency: [if], data = [none] } else if (H_ELEMENT_SYMBOL.equals(o2)) { return 0; // depends on control dependency: [if], data = [none] } else { return -1; // depends on control dependency: [if], data = [none] } } else { if (C_ELEMENT_SYMBOL.equals(o2) || H_ELEMENT_SYMBOL.equals(o2)) { return 1; // depends on control dependency: [if], data = [none] } else { return ((String) o1).compareTo((String) o2); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static OutputStream getOutputStream(final Socket socket) throws IOException { final OutputStream delegate = socket.getOutputStream(); return new OutputStream() { @Override public void close() throws IOException { delegate.flush(); synchronized (socket) { socket.shutdownOutput(); if (socket.isInputShutdown()) { socket.close(); } } } // Boring delegates from here on down @Override public void write(int b) throws IOException { delegate.write(b); } @Override public void write(byte[] b) throws IOException { delegate.write(b); } @Override public void write(byte[] b, int off, int len) throws IOException { delegate.write(b, off, len); } @Override public void flush() throws IOException { delegate.flush(); } }; } }
public class class_name { private static OutputStream getOutputStream(final Socket socket) throws IOException { final OutputStream delegate = socket.getOutputStream(); return new OutputStream() { @Override public void close() throws IOException { delegate.flush(); synchronized (socket) { socket.shutdownOutput(); if (socket.isInputShutdown()) { socket.close(); // depends on control dependency: [if], data = [none] } } } // Boring delegates from here on down @Override public void write(int b) throws IOException { delegate.write(b); } @Override public void write(byte[] b) throws IOException { delegate.write(b); } @Override public void write(byte[] b, int off, int len) throws IOException { delegate.write(b, off, len); } @Override public void flush() throws IOException { delegate.flush(); } }; } }
public class class_name { public static void init(InputStream keyStoreStream, String keyStorePass, String entryName, String entryProtectionParam) { if (bypassSecurity) { return; } try { KeyStore ks = KeyStore.getInstance("JCEKS"); ks.load(keyStoreStream, keyStorePass.toCharArray()); KeyStore.SecretKeyEntry entry = (KeyStore.SecretKeyEntry) ks.getEntry(entryName, new KeyStore.PasswordProtection(entryProtectionParam.toCharArray())); SecretKey key = entry.getSecretKey(); enCipher = Cipher.getInstance(key.getAlgorithm()); enCipher.init(Cipher.ENCRYPT_MODE, key); deCipher = Cipher.getInstance(key.getAlgorithm()); deCipher.init(Cipher.DECRYPT_MODE, key); keyStoreStream.close(); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public static void init(InputStream keyStoreStream, String keyStorePass, String entryName, String entryProtectionParam) { if (bypassSecurity) { return; // depends on control dependency: [if], data = [none] } try { KeyStore ks = KeyStore.getInstance("JCEKS"); ks.load(keyStoreStream, keyStorePass.toCharArray()); // depends on control dependency: [try], data = [none] KeyStore.SecretKeyEntry entry = (KeyStore.SecretKeyEntry) ks.getEntry(entryName, new KeyStore.PasswordProtection(entryProtectionParam.toCharArray())); SecretKey key = entry.getSecretKey(); enCipher = Cipher.getInstance(key.getAlgorithm()); // depends on control dependency: [try], data = [none] enCipher.init(Cipher.ENCRYPT_MODE, key); // depends on control dependency: [try], data = [none] deCipher = Cipher.getInstance(key.getAlgorithm()); // depends on control dependency: [try], data = [none] deCipher.init(Cipher.DECRYPT_MODE, key); // depends on control dependency: [try], data = [none] keyStoreStream.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int indexOfIgnoreCase( String text , String needle , int fromIndex ) { int textLen = text.length(); int needleLen = needle.length(); if (fromIndex >= textLen) return needleLen == 0 ? textLen : -1; int i = fromIndex; if (i < 0) i = 0; if (needleLen == 0) return i; char first = Character.toUpperCase(needle.charAt(0)); int max = textLen - needleLen; startSearchForFirstChar: while (true) { // Look for first character. while (i <= max) { char c = Character.toUpperCase(text.charAt(i)); if (c != first) i++; else break; } if (i > max) return -1; // Found first character, now look at the rest of the string int j = i + 1; int end = j + needleLen - 1; int k = 1; while (j < end) { char c1 = Character.toUpperCase(text.charAt(j++)); char c2 = Character.toUpperCase(needle.charAt(k++)); if (c1 != c2) { i++; // Look for str's first char again. continue startSearchForFirstChar; } } return i; } } }
public class class_name { public static int indexOfIgnoreCase( String text , String needle , int fromIndex ) { int textLen = text.length(); int needleLen = needle.length(); if (fromIndex >= textLen) return needleLen == 0 ? textLen : -1; int i = fromIndex; if (i < 0) i = 0; if (needleLen == 0) return i; char first = Character.toUpperCase(needle.charAt(0)); int max = textLen - needleLen; startSearchForFirstChar: while (true) { // Look for first character. while (i <= max) { char c = Character.toUpperCase(text.charAt(i)); if (c != first) i++; else break; } if (i > max) return -1; // Found first character, now look at the rest of the string int j = i + 1; int end = j + needleLen - 1; int k = 1; while (j < end) { char c1 = Character.toUpperCase(text.charAt(j++)); char c2 = Character.toUpperCase(needle.charAt(k++)); if (c1 != c2) { i++; // depends on control dependency: [if], data = [none] // Look for str's first char again. continue startSearchForFirstChar; } } return i; // depends on control dependency: [while], data = [none] } } }
public class class_name { public ListBackupPlanTemplatesResult withBackupPlanTemplatesList(BackupPlanTemplatesListMember... backupPlanTemplatesList) { if (this.backupPlanTemplatesList == null) { setBackupPlanTemplatesList(new java.util.ArrayList<BackupPlanTemplatesListMember>(backupPlanTemplatesList.length)); } for (BackupPlanTemplatesListMember ele : backupPlanTemplatesList) { this.backupPlanTemplatesList.add(ele); } return this; } }
public class class_name { public ListBackupPlanTemplatesResult withBackupPlanTemplatesList(BackupPlanTemplatesListMember... backupPlanTemplatesList) { if (this.backupPlanTemplatesList == null) { setBackupPlanTemplatesList(new java.util.ArrayList<BackupPlanTemplatesListMember>(backupPlanTemplatesList.length)); // depends on control dependency: [if], data = [none] } for (BackupPlanTemplatesListMember ele : backupPlanTemplatesList) { this.backupPlanTemplatesList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void marshall(ReservationResourceSpecification reservationResourceSpecification, ProtocolMarshaller protocolMarshaller) { if (reservationResourceSpecification == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(reservationResourceSpecification.getChannelClass(), CHANNELCLASS_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getCodec(), CODEC_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getMaximumBitrate(), MAXIMUMBITRATE_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getMaximumFramerate(), MAXIMUMFRAMERATE_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getResolution(), RESOLUTION_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getResourceType(), RESOURCETYPE_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getSpecialFeature(), SPECIALFEATURE_BINDING); protocolMarshaller.marshall(reservationResourceSpecification.getVideoQuality(), VIDEOQUALITY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ReservationResourceSpecification reservationResourceSpecification, ProtocolMarshaller protocolMarshaller) { if (reservationResourceSpecification == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(reservationResourceSpecification.getChannelClass(), CHANNELCLASS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getCodec(), CODEC_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getMaximumBitrate(), MAXIMUMBITRATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getMaximumFramerate(), MAXIMUMFRAMERATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getResolution(), RESOLUTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getSpecialFeature(), SPECIALFEATURE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(reservationResourceSpecification.getVideoQuality(), VIDEOQUALITY_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 void handleQueueMemberRemovedEvent(QueueMemberRemovedEvent event) { final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue()); if (queue == null) { logger.error("Ignored QueueMemberRemovedEvent for unknown queue " + event.getQueue()); return; } final AsteriskQueueMemberImpl member = queue.getMember(event.getLocation()); if (member == null) { logger.error("Ignored QueueMemberRemovedEvent for unknown agent name: " + event.getMemberName() + " location: " + event.getLocation() + " queue: " + event.getQueue()); return; } queue.removeMember(member); } }
public class class_name { public void handleQueueMemberRemovedEvent(QueueMemberRemovedEvent event) { final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue()); if (queue == null) { logger.error("Ignored QueueMemberRemovedEvent for unknown queue " + event.getQueue()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } final AsteriskQueueMemberImpl member = queue.getMember(event.getLocation()); if (member == null) { logger.error("Ignored QueueMemberRemovedEvent for unknown agent name: " + event.getMemberName() + " location: " + event.getLocation() + " queue: " + event.getQueue()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } queue.removeMember(member); } }
public class class_name { @NotNull public Candidate setDateOfBirth(@Nullable final Date dateOfBirth) { if (dateOfBirth == null) { this.dateOfBirth = null; return this; } this.dateOfBirth = new Date(dateOfBirth.getTime()); return this; } }
public class class_name { @NotNull public Candidate setDateOfBirth(@Nullable final Date dateOfBirth) { if (dateOfBirth == null) { this.dateOfBirth = null; // depends on control dependency: [if], data = [none] return this; // depends on control dependency: [if], data = [none] } this.dateOfBirth = new Date(dateOfBirth.getTime()); return this; } }
public class class_name { public static void runExample( AdManagerServices adManagerServices, AdManagerSession session, String currencyCode) throws RemoteException { ExchangeRateServiceInterface exchangeRateService = adManagerServices.get(session, ExchangeRateServiceInterface.class); // Create a statement to select exchange rates. StatementBuilder statementBuilder = new StatementBuilder() .where("currencyCode = :currencyCode") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("currencyCode", currencyCode); // Retrieve a small amount of exchange rates at a time, paging through // until all exchange rates have been retrieved. int totalResultSetSize = 0; do { ExchangeRatePage page = exchangeRateService.getExchangeRatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each exchange rate. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (ExchangeRate exchangeRate : page.getResults()) { System.out.printf( "%d) Exchange rate with ID %d, currency code '%s', " + "and exchange rate %.2f was found.%n", i++, exchangeRate.getId(), exchangeRate.getCurrencyCode(), exchangeRate.getExchangeRate() / 10000000000f ); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public static void runExample( AdManagerServices adManagerServices, AdManagerSession session, String currencyCode) throws RemoteException { ExchangeRateServiceInterface exchangeRateService = adManagerServices.get(session, ExchangeRateServiceInterface.class); // Create a statement to select exchange rates. StatementBuilder statementBuilder = new StatementBuilder() .where("currencyCode = :currencyCode") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("currencyCode", currencyCode); // Retrieve a small amount of exchange rates at a time, paging through // until all exchange rates have been retrieved. int totalResultSetSize = 0; do { ExchangeRatePage page = exchangeRateService.getExchangeRatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each exchange rate. totalResultSetSize = page.getTotalResultSetSize(); // depends on control dependency: [if], data = [none] int i = page.getStartIndex(); for (ExchangeRate exchangeRate : page.getResults()) { System.out.printf( "%d) Exchange rate with ID %d, currency code '%s', " + "and exchange rate %.2f was found.%n", i++, exchangeRate.getId(), exchangeRate.getCurrencyCode(), exchangeRate.getExchangeRate() / 10000000000f ); // depends on control dependency: [for], data = [none] } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); } }
public class class_name { public List<MediaType> getAccept() { String value = getFirst(ACCEPT); List<MediaType> result = (value != null ? MediaType.parseMediaTypes(value) : Collections.<MediaType>emptyList()); // Some containers parse 'Accept' into multiple values if (result.size() == 1) { List<String> acceptHeader = get(ACCEPT); if (acceptHeader.size() > 1) { value = StringUtils.collectionToCommaDelimitedString(acceptHeader); result = MediaType.parseMediaTypes(value); } } return result; } }
public class class_name { public List<MediaType> getAccept() { String value = getFirst(ACCEPT); List<MediaType> result = (value != null ? MediaType.parseMediaTypes(value) : Collections.<MediaType>emptyList()); // Some containers parse 'Accept' into multiple values if (result.size() == 1) { List<String> acceptHeader = get(ACCEPT); if (acceptHeader.size() > 1) { value = StringUtils.collectionToCommaDelimitedString(acceptHeader); // depends on control dependency: [if], data = [none] result = MediaType.parseMediaTypes(value); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private void refineAction(final Action action, final FilterKey key) { if (key.value != null && bindingMap != null && !bindingMap.isEmpty()) { final Map<String, Set<Element>> schemeMap = bindingMap.get(key.attribute); if (schemeMap != null && !schemeMap.isEmpty()) { for (final Set<Element> submap: schemeMap.values()) { for (final Element e: submap) { final Element subRoot = searchForKey(e, key.value); if (subRoot != null) { insertAction(subRoot, key.attribute, action); } } } } } } }
public class class_name { private void refineAction(final Action action, final FilterKey key) { if (key.value != null && bindingMap != null && !bindingMap.isEmpty()) { final Map<String, Set<Element>> schemeMap = bindingMap.get(key.attribute); if (schemeMap != null && !schemeMap.isEmpty()) { for (final Set<Element> submap: schemeMap.values()) { for (final Element e: submap) { final Element subRoot = searchForKey(e, key.value); if (subRoot != null) { insertAction(subRoot, key.attribute, action); // depends on control dependency: [if], data = [(subRoot] } } } } } } }
public class class_name { @Override public T decode(final byte[] data) { final WakeTuplePBuf tuple; try { tuple = WakeTuplePBuf.parseFrom(data); } catch (final InvalidProtocolBufferException e) { e.printStackTrace(); throw new RemoteRuntimeException(e); } final String className = tuple.getClassName(); final byte[] message = tuple.getData().toByteArray(); final Class<?> clazz; try { clazz = Class.forName(className); } catch (final ClassNotFoundException e) { e.printStackTrace(); throw new RemoteRuntimeException(e); } return clazzToDecoderMap.get(clazz).decode(message); } }
public class class_name { @Override public T decode(final byte[] data) { final WakeTuplePBuf tuple; try { tuple = WakeTuplePBuf.parseFrom(data); // depends on control dependency: [try], data = [none] } catch (final InvalidProtocolBufferException e) { e.printStackTrace(); throw new RemoteRuntimeException(e); } // depends on control dependency: [catch], data = [none] final String className = tuple.getClassName(); final byte[] message = tuple.getData().toByteArray(); final Class<?> clazz; try { clazz = Class.forName(className); // depends on control dependency: [try], data = [none] } catch (final ClassNotFoundException e) { e.printStackTrace(); throw new RemoteRuntimeException(e); } // depends on control dependency: [catch], data = [none] return clazzToDecoderMap.get(clazz).decode(message); } }
public class class_name { public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlAnnotationType.getModifiers().add(modifier); } } }
public class class_name { public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlAnnotationType.getModifiers().add(modifier); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String substituteVariables(String template, String patternString, Map<String, String> variables) { Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(template); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { if (variables.containsKey(matcher.group(1))) { String replacement = variables.get(matcher.group(1)); // quote to work properly with $ and {,} signs matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null"); } } matcher.appendTail(buffer); return buffer.toString(); } }
public class class_name { private String substituteVariables(String template, String patternString, Map<String, String> variables) { Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(template); StringBuffer buffer = new StringBuffer(); while (matcher.find()) { if (variables.containsKey(matcher.group(1))) { String replacement = variables.get(matcher.group(1)); // quote to work properly with $ and {,} signs matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null"); // depends on control dependency: [if], data = [none] } } matcher.appendTail(buffer); return buffer.toString(); } }
public class class_name { protected final boolean notifyObservers() { try { // It is not waited until the write actions are finished because the notification will be triggered after the lock release. if (registryLock.isWriteLockedByCurrentThread()) { logger.debug("Notification of registry[" + this + "] change skipped because of running write operations!"); notificationSkipped = true; return false; } if (super.notifyObservers(entryMap)) { try { pluginPool.afterRegistryChange(); } catch (CouldNotPerformException ex) { MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack(); exceptionStack.push(pluginPool, ex); throw new MultiException("PluginPool could not execute afterRegistryChange", exceptionStack); } } notificationSkipped = false; } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify all registry observer!", ex), logger, LogLevel.ERROR); return false; } return true; } }
public class class_name { protected final boolean notifyObservers() { try { // It is not waited until the write actions are finished because the notification will be triggered after the lock release. if (registryLock.isWriteLockedByCurrentThread()) { logger.debug("Notification of registry[" + this + "] change skipped because of running write operations!"); // depends on control dependency: [if], data = [none] notificationSkipped = true; // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (super.notifyObservers(entryMap)) { try { pluginPool.afterRegistryChange(); // depends on control dependency: [try], data = [none] } catch (CouldNotPerformException ex) { MultiException.ExceptionStack exceptionStack = new MultiException.ExceptionStack(); exceptionStack.push(pluginPool, ex); throw new MultiException("PluginPool could not execute afterRegistryChange", exceptionStack); } // depends on control dependency: [catch], data = [none] } notificationSkipped = false; // depends on control dependency: [try], data = [none] } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify all registry observer!", ex), logger, LogLevel.ERROR); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { public final String getNextLine() throws IOException { String str = null; if (buf_end - buf_pos <= 0) { if (fillBuffer() < 0) { return null; } } int lineend = -1; for (int i = buf_pos; i < buf_end; i++) { if (buffer[i] == '\n') { lineend = i; break; } // check for only '\r' as line end if ((i - buf_pos > 0) && buffer[i - 1] == '\r') { lineend = i - 1; break; } } if (lineend < 0) { StringBuilder input = new StringBuilder(256); int c; int lastC = 0; while (((c = read()) != -1) && (c != '\n') && (lastC != '\r')) { input.append((char) c); lastC = c; } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); } if (lineend > 0 && buffer[lineend] == '\n' && buffer[lineend - 1] == '\r') { str = new String(buffer, buf_pos, lineend - buf_pos - 1); } else { str = new String(buffer, buf_pos, lineend - buf_pos); } buf_pos = lineend + 1; return str; } }
public class class_name { public final String getNextLine() throws IOException { String str = null; if (buf_end - buf_pos <= 0) { if (fillBuffer() < 0) { return null; // depends on control dependency: [if], data = [none] } } int lineend = -1; for (int i = buf_pos; i < buf_end; i++) { if (buffer[i] == '\n') { lineend = i; break; } // check for only '\r' as line end if ((i - buf_pos > 0) && buffer[i - 1] == '\r') { lineend = i - 1; break; } } if (lineend < 0) { StringBuilder input = new StringBuilder(256); int c; int lastC = 0; while (((c = read()) != -1) && (c != '\n') && (lastC != '\r')) { input.append((char) c); lastC = c; } if ((c == -1) && (input.length() == 0)) { return null; } return input.toString(); } if (lineend > 0 && buffer[lineend] == '\n' && buffer[lineend - 1] == '\r') { str = new String(buffer, buf_pos, lineend - buf_pos - 1); } else { str = new String(buffer, buf_pos, lineend - buf_pos); } buf_pos = lineend + 1; return str; } }
public class class_name { @Override public void publish(final LogRecord record) { if (record == null) { return; } if (!isLoggable(record)) { return; } synchronized (this) { this.logs.add(record); if (!this.driverInitialized || this.logs.size() < BUFFER_LEN) { return; } } logAll(); } }
public class class_name { @Override public void publish(final LogRecord record) { if (record == null) { return; // depends on control dependency: [if], data = [none] } if (!isLoggable(record)) { return; // depends on control dependency: [if], data = [none] } synchronized (this) { this.logs.add(record); if (!this.driverInitialized || this.logs.size() < BUFFER_LEN) { return; // depends on control dependency: [if], data = [none] } } logAll(); } }
public class class_name { public void addColumn(Column<T, ?> column, Header<?> header, boolean sortable) { addColumn(column, header); column.setSortable(sortable); if (sortable) { defaultSortOrderMap.put(column, true); } } }
public class class_name { public void addColumn(Column<T, ?> column, Header<?> header, boolean sortable) { addColumn(column, header); column.setSortable(sortable); if (sortable) { defaultSortOrderMap.put(column, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void main(String[] args) throws Exception { BufferedInputStream in = null; BufferedOutputStream out = null; boolean validate = true; if (args == null || args.length == 0) { // assume stream in = new BufferedInputStream(System.in); out = new BufferedOutputStream(System.out); PrintStream ps = new PrintStream(new File("system.out")); System.setOut(ps); } else { String input=null, output=null; for (String s : args) { if (NOVALIDATE.equals(s)) { validate = false; } else if (input==null) { input = s; } else { output = s; } } in = (input==null)?new BufferedInputStream(System.in):new BufferedInputStream(new FileInputStream(input)); out = (output==null) ? new BufferedOutputStream(System.out) : new BufferedOutputStream(new FileOutputStream(output)); if (output==null) { PrintStream ps = new PrintStream(new File("system.out")); System.setOut(ps); } } System.out.println(USAGE); transform(in, out, validate); out.close(); } }
public class class_name { public static void main(String[] args) throws Exception { BufferedInputStream in = null; BufferedOutputStream out = null; boolean validate = true; if (args == null || args.length == 0) { // assume stream in = new BufferedInputStream(System.in); out = new BufferedOutputStream(System.out); PrintStream ps = new PrintStream(new File("system.out")); System.setOut(ps); } else { String input=null, output=null; for (String s : args) { if (NOVALIDATE.equals(s)) { validate = false; // depends on control dependency: [if], data = [none] } else if (input==null) { input = s; // depends on control dependency: [if], data = [none] } else { output = s; // depends on control dependency: [if], data = [none] } } in = (input==null)?new BufferedInputStream(System.in):new BufferedInputStream(new FileInputStream(input)); out = (output==null) ? new BufferedOutputStream(System.out) : new BufferedOutputStream(new FileOutputStream(output)); if (output==null) { PrintStream ps = new PrintStream(new File("system.out")); System.setOut(ps); // depends on control dependency: [if], data = [none] } } System.out.println(USAGE); transform(in, out, validate); out.close(); } }
public class class_name { public static double sum(FlatDataCollection flatDataCollection) { double sum = 0.0; Iterator<Double> it = flatDataCollection.iteratorDouble(); while(it.hasNext()) { Double value = it.next(); if(value != null) { sum+= value; } } return sum; } }
public class class_name { public static double sum(FlatDataCollection flatDataCollection) { double sum = 0.0; Iterator<Double> it = flatDataCollection.iteratorDouble(); while(it.hasNext()) { Double value = it.next(); if(value != null) { sum+= value; // depends on control dependency: [if], data = [none] } } return sum; } }
public class class_name { public boolean isUninstallable(UninstallAsset uninstallAsset, Set<IFixInfo> installedFixes, List<UninstallAsset> uninstallAssets) { if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) { return true; } IFixInfo fixToBeUninstalled = uninstallAsset.getIFixInfo(); for (IFixInfo fix : installedFixes) { if (!(fixToBeUninstalled.getId().equals(fix.getId()))) { if ((!confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) && (!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems()))) if (!isToBeUninstalled(fix.getId(), uninstallAssets)) return false; } } return true; } }
public class class_name { public boolean isUninstallable(UninstallAsset uninstallAsset, Set<IFixInfo> installedFixes, List<UninstallAsset> uninstallAssets) { if (Boolean.valueOf(System.getenv(S_DISABLE)).booleanValue()) { return true; // depends on control dependency: [if], data = [none] } IFixInfo fixToBeUninstalled = uninstallAsset.getIFixInfo(); for (IFixInfo fix : installedFixes) { if (!(fixToBeUninstalled.getId().equals(fix.getId()))) { if ((!confirmNoFileConflicts(fixToBeUninstalled.getUpdates().getFiles(), fix.getUpdates().getFiles())) && (!isSupersededBy(fix.getResolves().getProblems(), fixToBeUninstalled.getResolves().getProblems()))) if (!isToBeUninstalled(fix.getId(), uninstallAssets)) return false; } } return true; } }
public class class_name { @Override public boolean canRender(final String userName, final String fname) { if (userName == null || fname == null) { return false; } final IAuthorizationPrincipal userPrincipal = this.getUserPrincipal(userName); if (userPrincipal == null) { return false; } final String portletId; try { final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinitionByFname(fname); if (portletDefinition == null) { if (this.logger.isInfoEnabled()) { this.logger.info( "No PortletDefinition for fname='" + fname + "', returning false."); } return false; } portletId = portletDefinition.getPortletDefinitionId().getStringId(); } catch (Exception e) { this.logger.warn( "Could not find PortletDefinition for fname='" + fname + "' while checking if user '" + userName + "' can render it. Returning FALSE.", e); return false; } return userPrincipal.canRender(portletId); } }
public class class_name { @Override public boolean canRender(final String userName, final String fname) { if (userName == null || fname == null) { return false; // depends on control dependency: [if], data = [none] } final IAuthorizationPrincipal userPrincipal = this.getUserPrincipal(userName); if (userPrincipal == null) { return false; // depends on control dependency: [if], data = [none] } final String portletId; try { final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinitionByFname(fname); if (portletDefinition == null) { if (this.logger.isInfoEnabled()) { this.logger.info( "No PortletDefinition for fname='" + fname + "', returning false."); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } portletId = portletDefinition.getPortletDefinitionId().getStringId(); // depends on control dependency: [try], data = [none] } catch (Exception e) { this.logger.warn( "Could not find PortletDefinition for fname='" + fname + "' while checking if user '" + userName + "' can render it. Returning FALSE.", e); return false; } // depends on control dependency: [catch], data = [none] return userPrincipal.canRender(portletId); } }
public class class_name { private boolean isTileBlocked(Pathfindable mover, int tx, int ty) { final Tile tile = map.getTile(tx, ty); if (tile != null) { final TilePath tilePath = tile.getFeature(TilePath.class); return mover.isBlocking(tilePath.getCategory()); } return false; } }
public class class_name { private boolean isTileBlocked(Pathfindable mover, int tx, int ty) { final Tile tile = map.getTile(tx, ty); if (tile != null) { final TilePath tilePath = tile.getFeature(TilePath.class); return mover.isBlocking(tilePath.getCategory()); // depends on control dependency: [if], data = [(tile] } return false; } }
public class class_name { public void processAbort() { LOG.entering(CLASS_NAME, "abort"); if (reader != null) { reader.stop(); reader = null; } } }
public class class_name { public void processAbort() { LOG.entering(CLASS_NAME, "abort"); if (reader != null) { reader.stop(); // depends on control dependency: [if], data = [none] reader = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Response createResponse(Object object) { if (object == null) { return Response.ok().build(); } if (object instanceof Response) { return (Response) object; } if (object instanceof Response.Status) { Response.Status s = (Response.Status) object; switch (s) { case OK: return Response.ok().build(); case ACCEPTED: return Response.accepted().build(); case NO_CONTENT: return Response.noContent().build(); default: return createErrorResponse( new S3Exception("Response status is invalid", S3ErrorCode.INTERNAL_ERROR)); } } // Need to explicitly encode the string as XML because Jackson will not do it automatically. XmlMapper mapper = new XmlMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); } catch (JsonProcessingException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Failed to encode XML: " + e.getMessage()).build(); } } }
public class class_name { private static Response createResponse(Object object) { if (object == null) { return Response.ok().build(); // depends on control dependency: [if], data = [none] } if (object instanceof Response) { return (Response) object; // depends on control dependency: [if], data = [none] } if (object instanceof Response.Status) { Response.Status s = (Response.Status) object; switch (s) { case OK: return Response.ok().build(); case ACCEPTED: return Response.accepted().build(); case NO_CONTENT: return Response.noContent().build(); default: return createErrorResponse( new S3Exception("Response status is invalid", S3ErrorCode.INTERNAL_ERROR)); } } // Need to explicitly encode the string as XML because Jackson will not do it automatically. XmlMapper mapper = new XmlMapper(); try { return Response.ok(mapper.writeValueAsString(object)).build(); // depends on control dependency: [try], data = [none] } catch (JsonProcessingException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Failed to encode XML: " + e.getMessage()).build(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void drawSymbol(Object parent, String name, Coordinate position, ShapeStyle style, String shapeTypeId) { if (isAttached()) { Element useElement = helper.createOrUpdateElement(parent, name, "use", style); Dom.setElementAttributeNS(Dom.NS_XLINK, useElement, "xlink:href", "#" + shapeTypeId); if (position != null) { Dom.setElementAttribute(useElement, "x", Double.toString(position.getX())); Dom.setElementAttribute(useElement, "y", Double.toString(position.getY())); } } } }
public class class_name { public void drawSymbol(Object parent, String name, Coordinate position, ShapeStyle style, String shapeTypeId) { if (isAttached()) { Element useElement = helper.createOrUpdateElement(parent, name, "use", style); Dom.setElementAttributeNS(Dom.NS_XLINK, useElement, "xlink:href", "#" + shapeTypeId); // depends on control dependency: [if], data = [none] if (position != null) { Dom.setElementAttribute(useElement, "x", Double.toString(position.getX())); // depends on control dependency: [if], data = [(position] Dom.setElementAttribute(useElement, "y", Double.toString(position.getY())); // depends on control dependency: [if], data = [(position] } } } }
public class class_name { private int getIndexOfCurlyB(String str) { int i; int j; i = str.indexOf("{"); j = str.indexOf("\\{"); while ((i - 1 == j) && (j != -1)) { i = str.indexOf("{", i + 1); j = str.indexOf("\\{", j + 1); } return i; } }
public class class_name { private int getIndexOfCurlyB(String str) { int i; int j; i = str.indexOf("{"); j = str.indexOf("\\{"); while ((i - 1 == j) && (j != -1)) { i = str.indexOf("{", i + 1); // depends on control dependency: [while], data = [none] j = str.indexOf("\\{", j + 1); // depends on control dependency: [while], data = [none] } return i; } }
public class class_name { public double getMean() { if (getTotalCount() == 0) { return 0.0; } recordedValuesIterator.reset(); double totalValue = 0; while (recordedValuesIterator.hasNext()) { HistogramIterationValue iterationValue = recordedValuesIterator.next(); totalValue += medianEquivalentValue(iterationValue.getValueIteratedTo()) * iterationValue.getCountAtValueIteratedTo(); } return (totalValue * 1.0) / getTotalCount(); } }
public class class_name { public double getMean() { if (getTotalCount() == 0) { return 0.0; // depends on control dependency: [if], data = [none] } recordedValuesIterator.reset(); double totalValue = 0; while (recordedValuesIterator.hasNext()) { HistogramIterationValue iterationValue = recordedValuesIterator.next(); totalValue += medianEquivalentValue(iterationValue.getValueIteratedTo()) * iterationValue.getCountAtValueIteratedTo(); // depends on control dependency: [while], data = [none] } return (totalValue * 1.0) / getTotalCount(); } }
public class class_name { private void setTicks() { double range, z; if(zeroBased) { firstTick = 0.0; } else { range = Math.abs(minValue); z = (range % getMinorTickSpacing())==0 ? 0 : 1; firstTick = Math.signum(minValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z); } range = Math.abs(maxValue); z = (range % getMinorTickSpacing())==0 ? 0 : 1; lastTick = Math.signum(maxValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z); tickNumber = (int) ((lastTick-Math.signum(firstTick)*Math.abs(firstTick))/getMinorTickSpacing())+1; tickRange = lastTick-Math.signum(firstTick)*Math.abs(firstTick); // System.out.println("first tick: "+firstTick); // System.out.println(" last tick: "+lastTick); // System.out.println("tick number: "+tickNumber); // System.out.println("tick range: "+tickRange); } }
public class class_name { private void setTicks() { double range, z; if(zeroBased) { firstTick = 0.0; // depends on control dependency: [if], data = [none] } else { range = Math.abs(minValue); // depends on control dependency: [if], data = [none] z = (range % getMinorTickSpacing())==0 ? 0 : 1; // depends on control dependency: [if], data = [none] firstTick = Math.signum(minValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z); // depends on control dependency: [if], data = [none] } range = Math.abs(maxValue); z = (range % getMinorTickSpacing())==0 ? 0 : 1; lastTick = Math.signum(maxValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z); tickNumber = (int) ((lastTick-Math.signum(firstTick)*Math.abs(firstTick))/getMinorTickSpacing())+1; tickRange = lastTick-Math.signum(firstTick)*Math.abs(firstTick); // System.out.println("first tick: "+firstTick); // System.out.println(" last tick: "+lastTick); // System.out.println("tick number: "+tickNumber); // System.out.println("tick range: "+tickRange); } }
public class class_name { @Inject @AttackStoreListener public void setListeners(Collection<AttackListener> listeners) { for (AttackListener listener : listeners) { registerListener(listener); } } }
public class class_name { @Inject @AttackStoreListener public void setListeners(Collection<AttackListener> listeners) { for (AttackListener listener : listeners) { registerListener(listener); // depends on control dependency: [for], data = [listener] } } }
public class class_name { public synchronized void release(int key, T value) { LinkedEntry<T> bucket = mMap.get(key); if (bucket == null) { bucket = new LinkedEntry<T>(null, key, new LinkedList<T>(), null); mMap.put(key, bucket); } bucket.value.addLast(value); moveToFront(bucket); } }
public class class_name { public synchronized void release(int key, T value) { LinkedEntry<T> bucket = mMap.get(key); if (bucket == null) { bucket = new LinkedEntry<T>(null, key, new LinkedList<T>(), null); // depends on control dependency: [if], data = [null)] mMap.put(key, bucket); // depends on control dependency: [if], data = [none] } bucket.value.addLast(value); moveToFront(bucket); } }
public class class_name { private boolean isJavascript(String type) { if("text/javascript".equalsIgnoreCase(type)) { return true; } if("application/x-javascript".equalsIgnoreCase(type)) { return true; } return false; } }
public class class_name { private boolean isJavascript(String type) { if("text/javascript".equalsIgnoreCase(type)) { return true; // depends on control dependency: [if], data = [none] } if("application/x-javascript".equalsIgnoreCase(type)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private int emitNodes(FSA fsa, OutputStream os, IntArrayList linearized) throws IOException { int offset = 0; // Add epsilon state. offset += emitNodeData(os, 0); if (fsa.getRootNode() != 0) offset += emitArc(os, BIT_LAST_ARC, (byte) '^', offsets.get(fsa.getRootNode())); else offset += emitArc(os, BIT_LAST_ARC, (byte) '^', 0); boolean offsetsChanged = false; final int max = linearized.size(); for (IntCursor c : linearized) { final int state = c.value; final int nextState = c.index + 1 < max ? linearized.get(c.index + 1) : NO_STATE; if (os == null) { offsetsChanged |= (offsets.get(state) != offset); offsets.put(state, offset); } else { assert offsets.get(state) == offset : state + " " + offsets.get(state) + " " + offset; } offset += emitNodeData(os, withNumbers ? numbers.get(state) : 0); offset += emitNodeArcs(fsa, os, state, nextState); } return offsetsChanged ? offset : 0; } }
public class class_name { private int emitNodes(FSA fsa, OutputStream os, IntArrayList linearized) throws IOException { int offset = 0; // Add epsilon state. offset += emitNodeData(os, 0); if (fsa.getRootNode() != 0) offset += emitArc(os, BIT_LAST_ARC, (byte) '^', offsets.get(fsa.getRootNode())); else offset += emitArc(os, BIT_LAST_ARC, (byte) '^', 0); boolean offsetsChanged = false; final int max = linearized.size(); for (IntCursor c : linearized) { final int state = c.value; final int nextState = c.index + 1 < max ? linearized.get(c.index + 1) : NO_STATE; if (os == null) { offsetsChanged |= (offsets.get(state) != offset); // depends on control dependency: [if], data = [none] offsets.put(state, offset); // depends on control dependency: [if], data = [none] } else { assert offsets.get(state) == offset : state + " " + offsets.get(state) + " " + offset; // depends on control dependency: [if], data = [none] } offset += emitNodeData(os, withNumbers ? numbers.get(state) : 0); offset += emitNodeArcs(fsa, os, state, nextState); } return offsetsChanged ? offset : 0; } }
public class class_name { public static String getFirstHeader(String headerName, HttpResponse httpResponse) { Header header = httpResponse.getFirstHeader(headerName); if (header != null) { return header.getValue(); } return null; } }
public class class_name { public static String getFirstHeader(String headerName, HttpResponse httpResponse) { Header header = httpResponse.getFirstHeader(headerName); if (header != null) { return header.getValue(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private ListenableFuture<?> writeBlocksToTargets(Collection<DBBPool.BBContainer> outputBuffers, int[] serialized) { Preconditions.checkArgument(m_tableTasks.size() == serialized.length); Preconditions.checkArgument(outputBuffers.size() == serialized.length); final List<ListenableFuture<?>> writeFutures = new ArrayList<ListenableFuture<?>>(outputBuffers.size()); // The containers, the data targets, and the serialized byte counts should all line up Iterator<DBBPool.BBContainer> containerIter = outputBuffers.iterator(); int serializedIndex = 0; for (SnapshotTableTask task : m_tableTasks) { final DBBPool.BBContainer container = containerIter.next(); /* * Finalize the buffer by setting position to 0 and limit to the last used byte */ final ByteBuffer buf = container.b(); buf.limit(serialized[serializedIndex++] + task.m_target.getHeaderSize()); buf.position(0); Callable<DBBPool.BBContainer> valueForTarget = Callables.returning(container); if (task.m_filters != null) { for (SnapshotDataFilter filter : task.m_filters) { valueForTarget = filter.filter(valueForTarget); } } ListenableFuture<?> writeFuture = task.m_target.write(valueForTarget, m_tableId); if (writeFuture != null) { writeFutures.add(writeFuture); } } // Wraps all write futures in one future return Futures.allAsList(writeFutures); } }
public class class_name { private ListenableFuture<?> writeBlocksToTargets(Collection<DBBPool.BBContainer> outputBuffers, int[] serialized) { Preconditions.checkArgument(m_tableTasks.size() == serialized.length); Preconditions.checkArgument(outputBuffers.size() == serialized.length); final List<ListenableFuture<?>> writeFutures = new ArrayList<ListenableFuture<?>>(outputBuffers.size()); // The containers, the data targets, and the serialized byte counts should all line up Iterator<DBBPool.BBContainer> containerIter = outputBuffers.iterator(); int serializedIndex = 0; for (SnapshotTableTask task : m_tableTasks) { final DBBPool.BBContainer container = containerIter.next(); /* * Finalize the buffer by setting position to 0 and limit to the last used byte */ final ByteBuffer buf = container.b(); buf.limit(serialized[serializedIndex++] + task.m_target.getHeaderSize()); // depends on control dependency: [for], data = [task] buf.position(0); // depends on control dependency: [for], data = [none] Callable<DBBPool.BBContainer> valueForTarget = Callables.returning(container); if (task.m_filters != null) { for (SnapshotDataFilter filter : task.m_filters) { valueForTarget = filter.filter(valueForTarget); // depends on control dependency: [for], data = [filter] } } ListenableFuture<?> writeFuture = task.m_target.write(valueForTarget, m_tableId); if (writeFuture != null) { writeFutures.add(writeFuture); // depends on control dependency: [if], data = [(writeFuture] } } // Wraps all write futures in one future return Futures.allAsList(writeFutures); } }
public class class_name { public static void trim(List<String> value) { if (value==null) return; for (int i=0; i<value.size(); i++) { value.set(i, value.get(i).trim()); } } }
public class class_name { public static void trim(List<String> value) { if (value==null) return; for (int i=0; i<value.size(); i++) { value.set(i, value.get(i).trim()); // depends on control dependency: [for], data = [i] } } }
public class class_name { @SuppressWarnings("deprecation") public List<Action> getActions() { List<Action> result = new ArrayList<>(); result.addAll(super.getActions()); synchronized (this) { if (transientActions == null) { transientActions = TransientComputerActionFactory.createAllFor(this); } result.addAll(transientActions); } return Collections.unmodifiableList(result); } }
public class class_name { @SuppressWarnings("deprecation") public List<Action> getActions() { List<Action> result = new ArrayList<>(); result.addAll(super.getActions()); synchronized (this) { if (transientActions == null) { transientActions = TransientComputerActionFactory.createAllFor(this); // depends on control dependency: [if], data = [none] } result.addAll(transientActions); } return Collections.unmodifiableList(result); } }
public class class_name { public FDistort affine(double a11, double a12, double a21, double a22, double dx, double dy) { PixelTransformAffine_F32 transform; if( outputToInput != null && outputToInput instanceof PixelTransformAffine_F32 ) { transform = (PixelTransformAffine_F32)outputToInput; } else { transform = new PixelTransformAffine_F32(); } Affine2D_F32 m = new Affine2D_F32(); m.a11 = (float)a11; m.a12 = (float)a12; m.a21 = (float)a21; m.a22 = (float)a22; m.tx = (float)dx; m.ty = (float)dy; m.invert(transform.getModel()); return transform(transform); } }
public class class_name { public FDistort affine(double a11, double a12, double a21, double a22, double dx, double dy) { PixelTransformAffine_F32 transform; if( outputToInput != null && outputToInput instanceof PixelTransformAffine_F32 ) { transform = (PixelTransformAffine_F32)outputToInput; // depends on control dependency: [if], data = [none] } else { transform = new PixelTransformAffine_F32(); // depends on control dependency: [if], data = [none] } Affine2D_F32 m = new Affine2D_F32(); m.a11 = (float)a11; m.a12 = (float)a12; m.a21 = (float)a21; m.a22 = (float)a22; m.tx = (float)dx; m.ty = (float)dy; m.invert(transform.getModel()); return transform(transform); } }
public class class_name { public void setValidationProfiles(java.util.Collection<ModelPackageValidationProfile> validationProfiles) { if (validationProfiles == null) { this.validationProfiles = null; return; } this.validationProfiles = new java.util.ArrayList<ModelPackageValidationProfile>(validationProfiles); } }
public class class_name { public void setValidationProfiles(java.util.Collection<ModelPackageValidationProfile> validationProfiles) { if (validationProfiles == null) { this.validationProfiles = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.validationProfiles = new java.util.ArrayList<ModelPackageValidationProfile>(validationProfiles); } }
public class class_name { private String getFirstPartOfString(final String source) { final int pos = source.indexOf("."); if (pos > -1) { return source.substring(0, pos); } return source; } }
public class class_name { private String getFirstPartOfString(final String source) { final int pos = source.indexOf("."); if (pos > -1) { return source.substring(0, pos); // depends on control dependency: [if], data = [none] } return source; } }
public class class_name { public long[] toLongArray() { long[] copy = new long[size]; for (int i = 0; i < size; i++) { copy[i] = elements[i]; } return copy; } }
public class class_name { public long[] toLongArray() { long[] copy = new long[size]; for (int i = 0; i < size; i++) { copy[i] = elements[i]; // depends on control dependency: [for], data = [i] } return copy; } }
public class class_name { public void addDeleteColumn() { if (alreadyContainsColumn(SPUIDefinitions.DELETE_FILTER_BUTTON_COLUMN)) { return; } deleteColumnIfVisible(SPUIDefinitions.UPDATE_FILTER_BUTTON_COLUMN); addGeneratedColumn(SPUIDefinitions.DELETE_FILTER_BUTTON_COLUMN, (source, itemId, columnId) -> addDeleteCell(itemId)); } }
public class class_name { public void addDeleteColumn() { if (alreadyContainsColumn(SPUIDefinitions.DELETE_FILTER_BUTTON_COLUMN)) { return; // depends on control dependency: [if], data = [none] } deleteColumnIfVisible(SPUIDefinitions.UPDATE_FILTER_BUTTON_COLUMN); addGeneratedColumn(SPUIDefinitions.DELETE_FILTER_BUTTON_COLUMN, (source, itemId, columnId) -> addDeleteCell(itemId)); } }
public class class_name { public long transferFrom(ReadableByteChannel src, long pos, long count) throws IOException { prepareForWrite(pos, 0); // don't assume the full count bytes will be written if (count == 0) { return 0; } long remaining = count; int blockIndex = blockIndex(pos); byte[] block = blockForWrite(blockIndex); int off = offsetInBlock(pos); ByteBuffer buf = ByteBuffer.wrap(block, off, length(off, remaining)); long currentPos = pos; int read = 0; while (buf.hasRemaining()) { read = src.read(buf); if (read == -1) { break; } currentPos += read; remaining -= read; } // update size before trying to get next block in case the disk is out of space if (currentPos > size) { size = currentPos; } if (read != -1) { outer: while (remaining > 0) { block = blockForWrite(++blockIndex); buf = ByteBuffer.wrap(block, 0, length(remaining)); while (buf.hasRemaining()) { read = src.read(buf); if (read == -1) { break outer; } currentPos += read; remaining -= read; } if (currentPos > size) { size = currentPos; } } } if (currentPos > size) { size = currentPos; } return currentPos - pos; } }
public class class_name { public long transferFrom(ReadableByteChannel src, long pos, long count) throws IOException { prepareForWrite(pos, 0); // don't assume the full count bytes will be written if (count == 0) { return 0; } long remaining = count; int blockIndex = blockIndex(pos); byte[] block = blockForWrite(blockIndex); int off = offsetInBlock(pos); ByteBuffer buf = ByteBuffer.wrap(block, off, length(off, remaining)); long currentPos = pos; int read = 0; while (buf.hasRemaining()) { read = src.read(buf); if (read == -1) { break; } currentPos += read; remaining -= read; } // update size before trying to get next block in case the disk is out of space if (currentPos > size) { size = currentPos; } if (read != -1) { outer: while (remaining > 0) { block = blockForWrite(++blockIndex); buf = ByteBuffer.wrap(block, 0, length(remaining)); while (buf.hasRemaining()) { read = src.read(buf); // depends on control dependency: [while], data = [none] if (read == -1) { break outer; } currentPos += read; // depends on control dependency: [while], data = [none] remaining -= read; // depends on control dependency: [while], data = [none] } if (currentPos > size) { size = currentPos; // depends on control dependency: [if], data = [none] } } } if (currentPos > size) { size = currentPos; } return currentPos - pos; } }
public class class_name { protected void readCookies(final HttpResponse httpResponse) { Cookie[] newCookies = httpResponse.cookies(); for (Cookie cookie : newCookies) { cookies.add(cookie.getName(), cookie); } } }
public class class_name { protected void readCookies(final HttpResponse httpResponse) { Cookie[] newCookies = httpResponse.cookies(); for (Cookie cookie : newCookies) { cookies.add(cookie.getName(), cookie); // depends on control dependency: [for], data = [cookie] } } }
public class class_name { private FPTree getLocalFPTree(FPTree.Node node, int[] localItemSupport, int[] prefixItemset) { FPTree tree = new FPTree(localItemSupport, minSupport); while (node != null) { Node parent = node.parent; int i = prefixItemset.length; while (parent != null) { if (localItemSupport[parent.id] >= minSupport) { prefixItemset[--i] = parent.id; } parent = parent.parent; } if (i < prefixItemset.length) { tree.add(i, prefixItemset.length, prefixItemset, node.count); } node = node.next; } return tree; } }
public class class_name { private FPTree getLocalFPTree(FPTree.Node node, int[] localItemSupport, int[] prefixItemset) { FPTree tree = new FPTree(localItemSupport, minSupport); while (node != null) { Node parent = node.parent; int i = prefixItemset.length; while (parent != null) { if (localItemSupport[parent.id] >= minSupport) { prefixItemset[--i] = parent.id; // depends on control dependency: [if], data = [none] } parent = parent.parent; // depends on control dependency: [while], data = [none] } if (i < prefixItemset.length) { tree.add(i, prefixItemset.length, prefixItemset, node.count); // depends on control dependency: [if], data = [(i] } node = node.next; // depends on control dependency: [while], data = [none] } return tree; } }
public class class_name { public T setSelection(int position) { if (view instanceof AdapterView) { AdapterView<?> alv = (AdapterView<?>) view; alv.setSelection(position); } return self(); } }
public class class_name { public T setSelection(int position) { if (view instanceof AdapterView) { AdapterView<?> alv = (AdapterView<?>) view; alv.setSelection(position); // depends on control dependency: [if], data = [none] } return self(); } }
public class class_name { private void updateRegion() { actMessage.setVisible(false); String state = (String) stateSelector.getSelected(); if (STATE_ACT.equals(state)) { actMessage.setVisible(true); regionSelector.setOptions(new String[]{null, "Belconnen", "City", "Woden"}); } else if (STATE_NSW.equals(state)) { regionSelector.setOptions( new String[]{null, "Hunter", "Riverina", "Southern Tablelands"}); } else if (STATE_VIC.equals(state)) { regionSelector.setOptions( new String[]{null, "Gippsland", "Melbourne", "Mornington Peninsula"}); } else { regionSelector.setOptions(new Object[]{null}); } } }
public class class_name { private void updateRegion() { actMessage.setVisible(false); String state = (String) stateSelector.getSelected(); if (STATE_ACT.equals(state)) { actMessage.setVisible(true); // depends on control dependency: [if], data = [none] regionSelector.setOptions(new String[]{null, "Belconnen", "City", "Woden"}); // depends on control dependency: [if], data = [none] } else if (STATE_NSW.equals(state)) { regionSelector.setOptions( new String[]{null, "Hunter", "Riverina", "Southern Tablelands"}); // depends on control dependency: [if], data = [none] } else if (STATE_VIC.equals(state)) { regionSelector.setOptions( new String[]{null, "Gippsland", "Melbourne", "Mornington Peninsula"}); // depends on control dependency: [if], data = [none] } else { regionSelector.setOptions(new Object[]{null}); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected List<T> manycastSendAndReceive(DatagramSocket datagramSocket, byte[] rqstBytes, int timeout) { List<T> result = new ArrayList<T>(); udpConnector.manycastSend(datagramSocket, rqstBytes); DatagramPacket packet = null; while ((packet = udpConnector.receive(datagramSocket, timeout)) != null) { byte[] data = new byte[packet.getLength()]; System.arraycopy(packet.getData(), packet.getOffset(), data, 0, data.length); InetSocketAddress address = (InetSocketAddress)packet.getSocketAddress(); T rply = convert(data, address); if (rply != null) { rply.setResponder(address.getAddress().getHostAddress()); result.add(rply); } } return result; } }
public class class_name { protected List<T> manycastSendAndReceive(DatagramSocket datagramSocket, byte[] rqstBytes, int timeout) { List<T> result = new ArrayList<T>(); udpConnector.manycastSend(datagramSocket, rqstBytes); DatagramPacket packet = null; while ((packet = udpConnector.receive(datagramSocket, timeout)) != null) { byte[] data = new byte[packet.getLength()]; System.arraycopy(packet.getData(), packet.getOffset(), data, 0, data.length); // depends on control dependency: [while], data = [none] InetSocketAddress address = (InetSocketAddress)packet.getSocketAddress(); T rply = convert(data, address); if (rply != null) { rply.setResponder(address.getAddress().getHostAddress()); // depends on control dependency: [if], data = [none] result.add(rply); // depends on control dependency: [if], data = [(rply] } } return result; } }
public class class_name { public DiffBuilder append(final String fieldName, final Object lhs, final Object rhs) { validateFieldNameNotNull(fieldName); if (objectsTriviallyEqual) { return this; } if (lhs == rhs) { return this; } Object objectToTest; if (lhs != null) { objectToTest = lhs; } else { // rhs cannot be null, as lhs != rhs objectToTest = rhs; } if (objectToTest.getClass().isArray()) { if (objectToTest instanceof boolean[]) { return append(fieldName, (boolean[]) lhs, (boolean[]) rhs); } if (objectToTest instanceof byte[]) { return append(fieldName, (byte[]) lhs, (byte[]) rhs); } if (objectToTest instanceof char[]) { return append(fieldName, (char[]) lhs, (char[]) rhs); } if (objectToTest instanceof double[]) { return append(fieldName, (double[]) lhs, (double[]) rhs); } if (objectToTest instanceof float[]) { return append(fieldName, (float[]) lhs, (float[]) rhs); } if (objectToTest instanceof int[]) { return append(fieldName, (int[]) lhs, (int[]) rhs); } if (objectToTest instanceof long[]) { return append(fieldName, (long[]) lhs, (long[]) rhs); } if (objectToTest instanceof short[]) { return append(fieldName, (short[]) lhs, (short[]) rhs); } return append(fieldName, (Object[]) lhs, (Object[]) rhs); } // Not array type if (lhs != null && lhs.equals(rhs)) { return this; } diffs.add(new Diff<Object>(fieldName) { private static final long serialVersionUID = 1L; @Override public Object getLeft() { return lhs; } @Override public Object getRight() { return rhs; } }); return this; } }
public class class_name { public DiffBuilder append(final String fieldName, final Object lhs, final Object rhs) { validateFieldNameNotNull(fieldName); if (objectsTriviallyEqual) { return this; // depends on control dependency: [if], data = [none] } if (lhs == rhs) { return this; // depends on control dependency: [if], data = [none] } Object objectToTest; if (lhs != null) { objectToTest = lhs; // depends on control dependency: [if], data = [none] } else { // rhs cannot be null, as lhs != rhs objectToTest = rhs; // depends on control dependency: [if], data = [none] } if (objectToTest.getClass().isArray()) { if (objectToTest instanceof boolean[]) { return append(fieldName, (boolean[]) lhs, (boolean[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof byte[]) { return append(fieldName, (byte[]) lhs, (byte[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof char[]) { return append(fieldName, (char[]) lhs, (char[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof double[]) { return append(fieldName, (double[]) lhs, (double[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof float[]) { return append(fieldName, (float[]) lhs, (float[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof int[]) { return append(fieldName, (int[]) lhs, (int[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof long[]) { return append(fieldName, (long[]) lhs, (long[]) rhs); // depends on control dependency: [if], data = [none] } if (objectToTest instanceof short[]) { return append(fieldName, (short[]) lhs, (short[]) rhs); // depends on control dependency: [if], data = [none] } return append(fieldName, (Object[]) lhs, (Object[]) rhs); // depends on control dependency: [if], data = [none] } // Not array type if (lhs != null && lhs.equals(rhs)) { return this; // depends on control dependency: [if], data = [none] } diffs.add(new Diff<Object>(fieldName) { private static final long serialVersionUID = 1L; @Override public Object getLeft() { return lhs; } @Override public Object getRight() { return rhs; } }); return this; } }
public class class_name { public void printDisplayControl(PrintWriter out) { if (this.getScreenField().getConverter() != null) { String strFieldName = this.getScreenField().getConverter().getField().getFieldName(false, false); this.printInputControl(out, null, strFieldName, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? } else if (this.getScreenField().getParentScreen() instanceof GridScreen) { // These are command buttons such as "Form" or "Detail" this.printInputControl(out, null, null, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? } } }
public class class_name { public void printDisplayControl(PrintWriter out) { if (this.getScreenField().getConverter() != null) { String strFieldName = this.getScreenField().getConverter().getField().getFieldName(false, false); this.printInputControl(out, null, strFieldName, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? // depends on control dependency: [if], data = [none] } else if (this.getScreenField().getParentScreen() instanceof GridScreen) { // These are command buttons such as "Form" or "Detail" this.printInputControl(out, null, null, null, null, null, HtmlConstants.BUTTON, 0); // Button that does nothing? // depends on control dependency: [if], data = [none] } } }
public class class_name { public byte[] read_integer_byte_array() throws OtpErlangDecodeException { int tag; byte[] nb; tag = read1skip_version(); switch (tag) { case OtpExternal.smallIntTag: nb = new byte[2]; nb[0] = 0; nb[1] = (byte) read1(); break; case OtpExternal.intTag: nb = new byte[4]; if (this.readN(nb) != 4) { // Big endian throw new OtpErlangDecodeException( "Cannot read from intput stream"); } break; case OtpExternal.smallBigTag: case OtpExternal.largeBigTag: int arity; int sign; if (tag == OtpExternal.smallBigTag) { arity = read1(); sign = read1(); } else { arity = read4BE(); sign = read1(); if (arity + 1 < 0) { throw new OtpErlangDecodeException( "Value of largeBig does not fit in BigInteger, arity " + arity + " sign " + sign); } } nb = new byte[arity + 1]; // Value is read as little endian. The big end is augumented // with one zero byte to make the value 2's complement positive. if (this.readN(nb, 0, arity) != arity) { throw new OtpErlangDecodeException( "Cannot read from intput stream"); } // Reverse the array to make it big endian. for (int i = 0, j = nb.length; i < j--; i++) { // Swap [i] with [j] final byte b = nb[i]; nb[i] = nb[j]; nb[j] = b; } if (sign != 0) { // 2's complement negate the big endian value in the array int c = 1; // Carry for (int j = nb.length; j-- > 0;) { c = (~nb[j] & 0xFF) + c; nb[j] = (byte) c; c >>= 8; } } break; default: throw new OtpErlangDecodeException("Not valid integer tag: " + tag); } return nb; } }
public class class_name { public byte[] read_integer_byte_array() throws OtpErlangDecodeException { int tag; byte[] nb; tag = read1skip_version(); switch (tag) { case OtpExternal.smallIntTag: nb = new byte[2]; nb[0] = 0; nb[1] = (byte) read1(); break; case OtpExternal.intTag: nb = new byte[4]; if (this.readN(nb) != 4) { // Big endian throw new OtpErlangDecodeException( "Cannot read from intput stream"); } break; case OtpExternal.smallBigTag: case OtpExternal.largeBigTag: int arity; int sign; if (tag == OtpExternal.smallBigTag) { arity = read1(); // depends on control dependency: [if], data = [none] sign = read1(); // depends on control dependency: [if], data = [none] } else { arity = read4BE(); // depends on control dependency: [if], data = [none] sign = read1(); // depends on control dependency: [if], data = [none] if (arity + 1 < 0) { throw new OtpErlangDecodeException( "Value of largeBig does not fit in BigInteger, arity " + arity + " sign " + sign); } } nb = new byte[arity + 1]; // Value is read as little endian. The big end is augumented // with one zero byte to make the value 2's complement positive. if (this.readN(nb, 0, arity) != arity) { throw new OtpErlangDecodeException( "Cannot read from intput stream"); } // Reverse the array to make it big endian. for (int i = 0, j = nb.length; i < j--; i++) { // Swap [i] with [j] final byte b = nb[i]; nb[i] = nb[j]; // depends on control dependency: [for], data = [i] nb[j] = b; // depends on control dependency: [for], data = [none] } if (sign != 0) { // 2's complement negate the big endian value in the array int c = 1; // Carry for (int j = nb.length; j-- > 0;) { c = (~nb[j] & 0xFF) + c; // depends on control dependency: [for], data = [j] nb[j] = (byte) c; // depends on control dependency: [for], data = [j] c >>= 8; // depends on control dependency: [for], data = [none] } } break; default: throw new OtpErlangDecodeException("Not valid integer tag: " + tag); } return nb; } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); if (!isInitialised()) { setPresets(); setInitialised(true); } if (trigger instanceof Disableable) { ((Disableable) trigger).setDisabled(cbDisableTrigger.isSelected()); } if (trigger instanceof Input) { ((Input) trigger).setReadOnly(cbReadOnlyTrigger.isSelected()); } } }
public class class_name { @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); if (!isInitialised()) { setPresets(); // depends on control dependency: [if], data = [none] setInitialised(true); // depends on control dependency: [if], data = [none] } if (trigger instanceof Disableable) { ((Disableable) trigger).setDisabled(cbDisableTrigger.isSelected()); // depends on control dependency: [if], data = [none] } if (trigger instanceof Input) { ((Input) trigger).setReadOnly(cbReadOnlyTrigger.isSelected()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Integer getMinLevelIndex(String value) { Integer minLevelIndex = 0; if ("info".equalsIgnoreCase(value)) { minLevelIndex = 6; } else { Level minLevel = Level.parse(value.toUpperCase()); for (int i = 0; i < TrLevelConstants.levels.length; i++) { if (minLevel.equals(TrLevelConstants.levels[i])) { minLevelIndex = i; break; } } } return minLevelIndex; } }
public class class_name { private static Integer getMinLevelIndex(String value) { Integer minLevelIndex = 0; if ("info".equalsIgnoreCase(value)) { minLevelIndex = 6; // depends on control dependency: [if], data = [none] } else { Level minLevel = Level.parse(value.toUpperCase()); for (int i = 0; i < TrLevelConstants.levels.length; i++) { if (minLevel.equals(TrLevelConstants.levels[i])) { minLevelIndex = i; // depends on control dependency: [if], data = [none] break; } } } return minLevelIndex; } }
public class class_name { @FFDCIgnore({ NamingException.class }) @Sensitive Object resolveObject(Object o, WSName subname) throws NamingException { ServiceReference<?> ref = null; try { if (o instanceof ContextNode) return new WSContext(userContext, (ContextNode) o, env); if (tc.isDebugEnabled()) Tr.debug(tc, "Resolving object", o); if (o instanceof ServiceReference) { ref = (ServiceReference<?>) o; if (tc.isDebugEnabled()) Tr.debug(tc, "External service registry entry."); } else if (o instanceof AutoBindNode) { if (tc.isDebugEnabled()) Tr.debug(tc, "AutoBindNode entry."); AutoBindNode abNode = (AutoBindNode) o; ref = (ServiceReference<?>) abNode.getLastEntry(); // null means the node was removed in another thread. if (ref == null) { // Use the same semantics as ContextNode.lookup. throw new NameNotFoundException(subname.toString()); } } else if (o instanceof ServiceRegistration) { ref = ((ServiceRegistration<?>) o).getReference(); if (tc.isDebugEnabled()) Tr.debug(tc, "Programmatic JNDI entry."); } boolean getObjectInstance; if (ref == null) { getObjectInstance = true; } else { o = getReference(userContext, ref); if (o == null) { throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString())); } Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN); if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieved service from registry", o, JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin, Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS))); getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) || contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName()); } if (getObjectInstance) { // give JNDI a chance to resolve any references try { Object oldO = o; o = NamingManager.getObjectInstance(o, subname, this, env); if (o != oldO) if (tc.isDebugEnabled()) Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information. } catch (NamingException e) { throw e; } catch (Exception e) { // FFDC and proceed } } return o; } catch (NamingException e) { throw e; } catch (Exception e) { NamingException ne = new NamingException(); ne.setRootCause(e); throw ne; } } }
public class class_name { @FFDCIgnore({ NamingException.class }) @Sensitive Object resolveObject(Object o, WSName subname) throws NamingException { ServiceReference<?> ref = null; try { if (o instanceof ContextNode) return new WSContext(userContext, (ContextNode) o, env); if (tc.isDebugEnabled()) Tr.debug(tc, "Resolving object", o); if (o instanceof ServiceReference) { ref = (ServiceReference<?>) o; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "External service registry entry."); } else if (o instanceof AutoBindNode) { if (tc.isDebugEnabled()) Tr.debug(tc, "AutoBindNode entry."); AutoBindNode abNode = (AutoBindNode) o; ref = (ServiceReference<?>) abNode.getLastEntry(); // depends on control dependency: [if], data = [none] // null means the node was removed in another thread. if (ref == null) { // Use the same semantics as ContextNode.lookup. throw new NameNotFoundException(subname.toString()); } } else if (o instanceof ServiceRegistration) { ref = ((ServiceRegistration<?>) o).getReference(); // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "Programmatic JNDI entry."); } boolean getObjectInstance; if (ref == null) { getObjectInstance = true; // depends on control dependency: [if], data = [none] } else { o = getReference(userContext, ref); // depends on control dependency: [if], data = [none] if (o == null) { throw new NamingException(Tr.formatMessage(tc, "jndi.servicereference.failed", subname.toString())); } Object origin = ref.getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN); if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieved service from registry", o, JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN + "=" + origin, Constants.OBJECTCLASS + "=" + Arrays.toString((String[]) ref.getProperty(Constants.OBJECTCLASS))); getObjectInstance = JNDIServiceBinder.OSGI_JNDI_SERVICE_ORIGIN_VALUE.equals(origin) || contains((String[]) ref.getProperty(Constants.OBJECTCLASS), Reference.class.getName()); // depends on control dependency: [if], data = [none] } if (getObjectInstance) { // give JNDI a chance to resolve any references try { Object oldO = o; o = NamingManager.getObjectInstance(o, subname, this, env); // depends on control dependency: [try], data = [none] if (o != oldO) if (tc.isDebugEnabled()) Tr.debug(tc, "Resolved object through NamingManager"); // remove logging object o since it might contain the sensitive information. } catch (NamingException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] // FFDC and proceed } // depends on control dependency: [catch], data = [none] } return o; } catch (NamingException e) { throw e; } catch (Exception e) { NamingException ne = new NamingException(); ne.setRootCause(e); throw ne; } } }
public class class_name { public static void registerListener(ListenerInfo information) { if (isServiceLoaderDisabled()) { // Donot even attempt register any listeners if the user doesnt want them to be managed. return; } logger.entering(information); listenerMap.put(information.getListenerClassName(), information); } }
public class class_name { public static void registerListener(ListenerInfo information) { if (isServiceLoaderDisabled()) { // Donot even attempt register any listeners if the user doesnt want them to be managed. return; // depends on control dependency: [if], data = [none] } logger.entering(information); listenerMap.put(information.getListenerClassName(), information); } }
public class class_name { @SuppressWarnings("unchecked") private JComboBox<HandleParametersOption> getComboHandleParameters() { if (handleParameters == null) { handleParameters = new JComboBox<>(new HandleParametersOption[] { HandleParametersOption.USE_ALL, HandleParametersOption.IGNORE_VALUE, HandleParametersOption.IGNORE_COMPLETELY }); handleParameters.setRenderer(new HandleParametersOptionRenderer()); } return handleParameters; } }
public class class_name { @SuppressWarnings("unchecked") private JComboBox<HandleParametersOption> getComboHandleParameters() { if (handleParameters == null) { handleParameters = new JComboBox<>(new HandleParametersOption[] { HandleParametersOption.USE_ALL, HandleParametersOption.IGNORE_VALUE, HandleParametersOption.IGNORE_COMPLETELY }); // depends on control dependency: [if], data = [none] handleParameters.setRenderer(new HandleParametersOptionRenderer()); // depends on control dependency: [if], data = [none] } return handleParameters; } }
public class class_name { private void orthes() { // FIXME: does this fail on NaN/inf values? // This is derived from the Algol procedures orthes and ortran, // by Martin and Wilkinson, Handbook for Auto. Comp., // Vol.ii-Linear Algebra, and the corresponding // Fortran subroutines in EISPACK. final int low = 0, high = n - 1; for(int m = low + 1; m <= high - 1; m++) { // Scale column. double scale = 0.0; for(int i = m; i <= high; i++) { scale += abs(H[i][m - 1]); } if(scale > 0.0 || scale < 0.0) { // Compute Householder transformation. double h = 0.0; for(int i = high; i >= m; i--) { double oi = ort[i] = H[i][m - 1] / scale; h += oi * oi; } double g = FastMath.sqrt(h), om = ort[m]; g = (om > 0) ? -g : g; h -= om * g; ort[m] = om - g; // Apply Householder similarity transformation // H = (I-u*u'/h)*H*(I-u*u')/h) for(int j = m; j < n; j++) { double f = 0.0; for(int i = high; i >= m; i--) { f += ort[i] * H[i][j]; } f /= h; for(int i = m; i <= high; i++) { H[i][j] -= f * ort[i]; } } for(int i = 0; i <= high; i++) { final double[] Hi = H[i]; double f = 0.0; for(int j = high; j >= m; j--) { f += ort[j] * Hi[j]; } f /= h; for(int j = m; j <= high; j++) { Hi[j] -= f * ort[j]; } } ort[m] *= scale; H[m][m - 1] = scale * g; } } // Accumulate transformations (Algol's ortran). for(int i = 0; i < n; i++) { Arrays.fill(V[i], 0.); V[i][i] = 1.; } for(int m = high - 1; m >= low + 1; m--) { final double[] H_m = H[m]; if(H_m[m - 1] != 0.0) { for(int i = m + 1; i <= high; i++) { ort[i] = H[i][m - 1]; } final double ort_m = ort[m]; for(int j = m; j <= high; j++) { double g = 0.0; for(int i = m; i <= high; i++) { g += ort[i] * V[i][j]; } // Double division avoids possible underflow g = (g / ort_m) / H_m[m - 1]; for(int i = m; i <= high; i++) { V[i][j] += g * ort[i]; } } } } } }
public class class_name { private void orthes() { // FIXME: does this fail on NaN/inf values? // This is derived from the Algol procedures orthes and ortran, // by Martin and Wilkinson, Handbook for Auto. Comp., // Vol.ii-Linear Algebra, and the corresponding // Fortran subroutines in EISPACK. final int low = 0, high = n - 1; for(int m = low + 1; m <= high - 1; m++) { // Scale column. double scale = 0.0; for(int i = m; i <= high; i++) { scale += abs(H[i][m - 1]); // depends on control dependency: [for], data = [i] } if(scale > 0.0 || scale < 0.0) { // Compute Householder transformation. double h = 0.0; for(int i = high; i >= m; i--) { double oi = ort[i] = H[i][m - 1] / scale; h += oi * oi; // depends on control dependency: [for], data = [none] } double g = FastMath.sqrt(h), om = ort[m]; g = (om > 0) ? -g : g; // depends on control dependency: [if], data = [none] h -= om * g; // depends on control dependency: [if], data = [none] ort[m] = om - g; // depends on control dependency: [if], data = [none] // Apply Householder similarity transformation // H = (I-u*u'/h)*H*(I-u*u')/h) for(int j = m; j < n; j++) { double f = 0.0; for(int i = high; i >= m; i--) { f += ort[i] * H[i][j]; // depends on control dependency: [for], data = [i] } f /= h; // depends on control dependency: [for], data = [none] for(int i = m; i <= high; i++) { H[i][j] -= f * ort[i]; // depends on control dependency: [for], data = [i] } } for(int i = 0; i <= high; i++) { final double[] Hi = H[i]; double f = 0.0; for(int j = high; j >= m; j--) { f += ort[j] * Hi[j]; // depends on control dependency: [for], data = [j] } f /= h; // depends on control dependency: [for], data = [none] for(int j = m; j <= high; j++) { Hi[j] -= f * ort[j]; // depends on control dependency: [for], data = [j] } } ort[m] *= scale; // depends on control dependency: [if], data = [none] H[m][m - 1] = scale * g; // depends on control dependency: [if], data = [none] } } // Accumulate transformations (Algol's ortran). for(int i = 0; i < n; i++) { Arrays.fill(V[i], 0.); // depends on control dependency: [for], data = [i] V[i][i] = 1.; // depends on control dependency: [for], data = [i] } for(int m = high - 1; m >= low + 1; m--) { final double[] H_m = H[m]; if(H_m[m - 1] != 0.0) { for(int i = m + 1; i <= high; i++) { ort[i] = H[i][m - 1]; // depends on control dependency: [for], data = [i] } final double ort_m = ort[m]; for(int j = m; j <= high; j++) { double g = 0.0; for(int i = m; i <= high; i++) { g += ort[i] * V[i][j]; // depends on control dependency: [for], data = [i] } // Double division avoids possible underflow g = (g / ort_m) / H_m[m - 1]; // depends on control dependency: [for], data = [none] for(int i = m; i <= high; i++) { V[i][j] += g * ort[i]; // depends on control dependency: [for], data = [i] } } } } } }
public class class_name { private static final TreeScanner<Void, Void> createFindIdentifiersScanner( ImmutableSet.Builder<Symbol> builder, @Nullable Tree stoppingPoint) { return new TreeScanner<Void, Void>() { @Override public Void scan(Tree tree, Void unused) { return Objects.equals(stoppingPoint, tree) ? null : super.scan(tree, unused); } @Override public Void scan(Iterable<? extends Tree> iterable, Void unused) { if (stoppingPoint != null && iterable != null) { ImmutableList.Builder<Tree> builder = ImmutableList.builder(); for (Tree t : iterable) { if (stoppingPoint.equals(t)) { break; } builder.add(t); } iterable = builder.build(); } return super.scan(iterable, unused); } @Override public Void visitIdentifier(IdentifierTree identifierTree, Void unused) { Symbol symbol = ASTHelpers.getSymbol(identifierTree); if (symbol != null) { builder.add(symbol); } return null; } }; } }
public class class_name { private static final TreeScanner<Void, Void> createFindIdentifiersScanner( ImmutableSet.Builder<Symbol> builder, @Nullable Tree stoppingPoint) { return new TreeScanner<Void, Void>() { @Override public Void scan(Tree tree, Void unused) { return Objects.equals(stoppingPoint, tree) ? null : super.scan(tree, unused); } @Override public Void scan(Iterable<? extends Tree> iterable, Void unused) { if (stoppingPoint != null && iterable != null) { ImmutableList.Builder<Tree> builder = ImmutableList.builder(); for (Tree t : iterable) { if (stoppingPoint.equals(t)) { break; } builder.add(t); // depends on control dependency: [for], data = [t] } iterable = builder.build(); // depends on control dependency: [if], data = [none] } return super.scan(iterable, unused); } @Override public Void visitIdentifier(IdentifierTree identifierTree, Void unused) { Symbol symbol = ASTHelpers.getSymbol(identifierTree); if (symbol != null) { builder.add(symbol); // depends on control dependency: [if], data = [(symbol] } return null; } }; } }
public class class_name { public Object marshalRootElement() { if (justRoutes) { RoutesDefinition routes = new RoutesDefinition(); routes.setRoutes(contextElement.getRoutes()); return routes; } else { return contextElement; } } }
public class class_name { public Object marshalRootElement() { if (justRoutes) { RoutesDefinition routes = new RoutesDefinition(); routes.setRoutes(contextElement.getRoutes()); // depends on control dependency: [if], data = [none] return routes; // depends on control dependency: [if], data = [none] } else { return contextElement; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void processMesh( GVRAssetLoader.AssetRequest assetRequest, GVRSceneObject sceneObject, int meshId) { EnumSet<GVRImportSettings> settings = assetRequest.getImportSettings(); AiMesh aiMesh = mScene.getMeshes().get(meshId); GVRMesh mesh = mMeshes[meshId]; GVRMaterial gvrMaterial = mMaterials[aiMesh.getMaterialIndex()]; if (mesh == null) { mesh = createMesh(mContext, aiMesh, settings); mMeshes[meshId] = mesh; if (aiMesh.hasBones() && (mSkeleton != null)) { GVRSkin skin = processBones(mesh, aiMesh.getBones()); if (skin != null) { sceneObject.attachComponent(skin); } } } else { Log.v("BONE", "instancing mesh %s", sceneObject.getName()); } if (gvrMaterial == null) { AiMaterial material = mScene.getMaterials().get(aiMesh.getMaterialIndex()); gvrMaterial = processMaterial(assetRequest, material, aiMesh); mMaterials[aiMesh.getMaterialIndex()] = gvrMaterial; } GVRRenderData renderData = new GVRRenderData(mContext, gvrMaterial); renderData.setMesh(mesh); if (settings.contains(GVRImportSettings.NO_LIGHTING)) { renderData.disableLight(); } sceneObject.attachRenderData(renderData); setMeshMorphComponent(mesh, sceneObject, aiMesh); } }
public class class_name { private void processMesh( GVRAssetLoader.AssetRequest assetRequest, GVRSceneObject sceneObject, int meshId) { EnumSet<GVRImportSettings> settings = assetRequest.getImportSettings(); AiMesh aiMesh = mScene.getMeshes().get(meshId); GVRMesh mesh = mMeshes[meshId]; GVRMaterial gvrMaterial = mMaterials[aiMesh.getMaterialIndex()]; if (mesh == null) { mesh = createMesh(mContext, aiMesh, settings); // depends on control dependency: [if], data = [none] mMeshes[meshId] = mesh; // depends on control dependency: [if], data = [none] if (aiMesh.hasBones() && (mSkeleton != null)) { GVRSkin skin = processBones(mesh, aiMesh.getBones()); if (skin != null) { sceneObject.attachComponent(skin); // depends on control dependency: [if], data = [(skin] } } } else { Log.v("BONE", "instancing mesh %s", sceneObject.getName()); // depends on control dependency: [if], data = [none] } if (gvrMaterial == null) { AiMaterial material = mScene.getMaterials().get(aiMesh.getMaterialIndex()); gvrMaterial = processMaterial(assetRequest, material, aiMesh); // depends on control dependency: [if], data = [none] mMaterials[aiMesh.getMaterialIndex()] = gvrMaterial; // depends on control dependency: [if], data = [none] } GVRRenderData renderData = new GVRRenderData(mContext, gvrMaterial); renderData.setMesh(mesh); if (settings.contains(GVRImportSettings.NO_LIGHTING)) { renderData.disableLight(); // depends on control dependency: [if], data = [none] } sceneObject.attachRenderData(renderData); setMeshMorphComponent(mesh, sceneObject, aiMesh); } }
public class class_name { @Override public Map<String, String> getTelemetryProperties() { final Map<String, String> map = super.getTelemetryProperties(); try { map.put(DEPLOYMENT_TYPE_KEY, getDeploymentType().toString()); } catch (MojoExecutionException e) { map.put(DEPLOYMENT_TYPE_KEY, "Unknown deployment type."); } return map; } }
public class class_name { @Override public Map<String, String> getTelemetryProperties() { final Map<String, String> map = super.getTelemetryProperties(); try { map.put(DEPLOYMENT_TYPE_KEY, getDeploymentType().toString()); // depends on control dependency: [try], data = [none] } catch (MojoExecutionException e) { map.put(DEPLOYMENT_TYPE_KEY, "Unknown deployment type."); } // depends on control dependency: [catch], data = [none] return map; } }
public class class_name { @Override public void addResponse(Response response) { logger.warn("Security response " + response.getAction() + " triggered for user: " + response.getUser().getUsername()); try { responseRepository.save(response); } catch (JsonProcessingException e) { throw new RuntimeException(e); } super.notifyListeners(response); } }
public class class_name { @Override public void addResponse(Response response) { logger.warn("Security response " + response.getAction() + " triggered for user: " + response.getUser().getUsername()); try { responseRepository.save(response); // depends on control dependency: [try], data = [none] } catch (JsonProcessingException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] super.notifyListeners(response); } }
public class class_name { public boolean hasSpanWithId(String id) { TraceState ts = traceState.get(); if (id != null && ts != null) { boolean spanFound = ts.getSpanForId(id) != null; if (log.isLoggable(Level.FINEST)) { log.finest("Has span with id = " + id + "? " + spanFound); } return spanFound; } return false; } }
public class class_name { public boolean hasSpanWithId(String id) { TraceState ts = traceState.get(); if (id != null && ts != null) { boolean spanFound = ts.getSpanForId(id) != null; if (log.isLoggable(Level.FINEST)) { log.finest("Has span with id = " + id + "? " + spanFound); // depends on control dependency: [if], data = [none] } return spanFound; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public synchronized ManageableCacheValue getNextCacheValue() { //changes to the map are reflected on the keySet. And its iterator is weakly consistent. so will never //throw concurrent modification exception. if (iterator.hasNext()) { return hashMap.get(iterator.next().getKey()); } else { resetIterator(); return null; } } }
public class class_name { public synchronized ManageableCacheValue getNextCacheValue() { //changes to the map are reflected on the keySet. And its iterator is weakly consistent. so will never //throw concurrent modification exception. if (iterator.hasNext()) { return hashMap.get(iterator.next().getKey()); // depends on control dependency: [if], data = [none] } else { resetIterator(); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private String printAbstractConcept(AbstractConcept ac) { if(ac instanceof au.csiro.snorocket.core.model.Concept) { au.csiro.snorocket.core.model.Concept c = (au.csiro.snorocket.core.model.Concept) ac; Object o = factory.lookupConceptId(c.hashCode()); if(o instanceof String) { return (String) o; } else { return printAbstractConcept((AbstractConcept) o); } } else if(ac instanceof au.csiro.snorocket.core.model.Conjunction) { au.csiro.snorocket.core.model.Conjunction c = (au.csiro.snorocket.core.model.Conjunction) ac; AbstractConcept[] acs = c.getConcepts(); StringBuilder sb = new StringBuilder(); if(acs != null && acs.length > 0) { sb.append(printAbstractConcept(acs[0])); for(int i = 1; i < acs.length; i++) { sb.append(" + "); sb.append(printAbstractConcept(acs[i])); } } return sb.toString(); } else if(ac instanceof au.csiro.snorocket.core.model.Existential) { au.csiro.snorocket.core.model.Existential e = (au.csiro.snorocket.core.model.Existential) ac; return "E"+factory.lookupRoleId(e.getRole()).toString()+"."+printAbstractConcept(e.getConcept()); } else if(ac instanceof au.csiro.snorocket.core.model.Datatype) { au.csiro.snorocket.core.model.Datatype d = (au.csiro.snorocket.core.model.Datatype) ac; return "F"+factory.lookupFeatureId(d.getFeature())+".("+d.getOperator()+", "+d.getLiteral()+")"; } else { throw new RuntimeException("Unexpected concept: " + ac); } } }
public class class_name { private String printAbstractConcept(AbstractConcept ac) { if(ac instanceof au.csiro.snorocket.core.model.Concept) { au.csiro.snorocket.core.model.Concept c = (au.csiro.snorocket.core.model.Concept) ac; Object o = factory.lookupConceptId(c.hashCode()); if(o instanceof String) { return (String) o; // depends on control dependency: [if], data = [none] } else { return printAbstractConcept((AbstractConcept) o); // depends on control dependency: [if], data = [none] } } else if(ac instanceof au.csiro.snorocket.core.model.Conjunction) { au.csiro.snorocket.core.model.Conjunction c = (au.csiro.snorocket.core.model.Conjunction) ac; AbstractConcept[] acs = c.getConcepts(); StringBuilder sb = new StringBuilder(); if(acs != null && acs.length > 0) { sb.append(printAbstractConcept(acs[0])); // depends on control dependency: [if], data = [(acs] for(int i = 1; i < acs.length; i++) { sb.append(" + "); // depends on control dependency: [for], data = [none] sb.append(printAbstractConcept(acs[i])); // depends on control dependency: [for], data = [i] } } return sb.toString(); // depends on control dependency: [if], data = [none] } else if(ac instanceof au.csiro.snorocket.core.model.Existential) { au.csiro.snorocket.core.model.Existential e = (au.csiro.snorocket.core.model.Existential) ac; return "E"+factory.lookupRoleId(e.getRole()).toString()+"."+printAbstractConcept(e.getConcept()); // depends on control dependency: [if], data = [none] } else if(ac instanceof au.csiro.snorocket.core.model.Datatype) { au.csiro.snorocket.core.model.Datatype d = (au.csiro.snorocket.core.model.Datatype) ac; return "F"+factory.lookupFeatureId(d.getFeature())+".("+d.getOperator()+", "+d.getLiteral()+")"; // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("Unexpected concept: " + ac); } } }
public class class_name { private DataSet doFixedLengthFile(final Reader dataSource) throws IOException { final DefaultDataSet ds = new DefaultDataSet(getPzMetaData(), this); try (BufferedReader br = new BufferedReader(dataSource)) { // gather the conversion properties ds.setPZConvertProps(ParserUtils.loadConvertProperties()); final Map<String, Integer> recordLengths = ParserUtils.calculateRecordLengths(getPzMetaData()); // Read in the flat file String line = null; int lineCount = 0; // map of record lengths corresponding to the ID's in the columnMD // array loop through each line in the file while ((line = br.readLine()) != null) { lineCount++; // empty line skip past it if (line.trim().length() == 0) { continue; } final String mdkey = FixedWidthParserUtils.getCMDKey(getPzMetaData(), line); final int recordLength = recordLengths.get(mdkey); if (line.length() > recordLength) { // Incorrect record length on line log the error. Line will not // be included in the // dataset if (isIgnoreExtraColumns()) { // user has choosen to ignore the fact that we have too many bytes in the fixed // width file. Truncate the line to the correct length line = line.substring(0, recordLength); addError(ds, "TRUNCATED LINE TO CORRECT LENGTH", lineCount, 1); } else { addError(ds, "LINE TOO LONG. LINE IS " + line.length() + " LONG. SHOULD BE " + recordLength, lineCount, 2, isStoreRawDataToDataError() ? line : null); continue; } } else if (line.length() < recordLength) { if (isHandlingShortLines()) { // We can pad this line out line += ParserUtils.padding(recordLength - line.length(), ' '); // log a warning addError(ds, "PADDED LINE TO CORRECT RECORD LENGTH", lineCount, 1); } else { addError(ds, "LINE TOO SHORT. LINE IS " + line.length() + " LONG. SHOULD BE " + recordLength, lineCount, 2, isStoreRawDataToDataError() ? line : null); continue; } } final Row row = new Row(); row.setMdkey(mdkey.equals(FPConstants.DETAIL_ID) ? null : mdkey); // try final List<ColumnMetaData> cmds = ParserUtils.getColumnMetaData(mdkey, getPzMetaData()); row.addColumn(FixedWidthParserUtils.splitFixedText(cmds, line, isPreserveLeadingWhitespace(), isPreserveTrailingWhitespace())); row.setRowNumber(lineCount); if (isFlagEmptyRows()) { // user has elected to have the parser flag rows that are empty row.setEmpty(ParserUtils.isListElementsEmpty(row.getCols())); } if (isStoreRawDataToDataSet()) { // user told the parser to keep a copy of the raw data in the row // WARNING potential for high memory usage here row.setRawData(line); } // add the row to the array ds.addRow(row); } } finally { closeReaders(); } return ds; } }
public class class_name { private DataSet doFixedLengthFile(final Reader dataSource) throws IOException { final DefaultDataSet ds = new DefaultDataSet(getPzMetaData(), this); try (BufferedReader br = new BufferedReader(dataSource)) { // gather the conversion properties ds.setPZConvertProps(ParserUtils.loadConvertProperties()); final Map<String, Integer> recordLengths = ParserUtils.calculateRecordLengths(getPzMetaData()); // Read in the flat file String line = null; int lineCount = 0; // map of record lengths corresponding to the ID's in the columnMD // array loop through each line in the file while ((line = br.readLine()) != null) { lineCount++; // depends on control dependency: [while], data = [none] // empty line skip past it if (line.trim().length() == 0) { continue; } final String mdkey = FixedWidthParserUtils.getCMDKey(getPzMetaData(), line); final int recordLength = recordLengths.get(mdkey); if (line.length() > recordLength) { // Incorrect record length on line log the error. Line will not // be included in the // dataset if (isIgnoreExtraColumns()) { // user has choosen to ignore the fact that we have too many bytes in the fixed // width file. Truncate the line to the correct length line = line.substring(0, recordLength); // depends on control dependency: [if], data = [none] addError(ds, "TRUNCATED LINE TO CORRECT LENGTH", lineCount, 1); // depends on control dependency: [if], data = [none] } else { addError(ds, "LINE TOO LONG. LINE IS " + line.length() + " LONG. SHOULD BE " + recordLength, lineCount, 2, isStoreRawDataToDataError() ? line : null); // depends on control dependency: [if], data = [none] continue; } } else if (line.length() < recordLength) { if (isHandlingShortLines()) { // We can pad this line out line += ParserUtils.padding(recordLength - line.length(), ' '); // depends on control dependency: [if], data = [none] // log a warning addError(ds, "PADDED LINE TO CORRECT RECORD LENGTH", lineCount, 1); // depends on control dependency: [if], data = [none] } else { addError(ds, "LINE TOO SHORT. LINE IS " + line.length() + " LONG. SHOULD BE " + recordLength, lineCount, 2, isStoreRawDataToDataError() ? line : null); // depends on control dependency: [if], data = [none] continue; } } final Row row = new Row(); row.setMdkey(mdkey.equals(FPConstants.DETAIL_ID) ? null : mdkey); // try // depends on control dependency: [while], data = [none] final List<ColumnMetaData> cmds = ParserUtils.getColumnMetaData(mdkey, getPzMetaData()); row.addColumn(FixedWidthParserUtils.splitFixedText(cmds, line, isPreserveLeadingWhitespace(), isPreserveTrailingWhitespace())); // depends on control dependency: [while], data = [none] row.setRowNumber(lineCount); // depends on control dependency: [while], data = [none] if (isFlagEmptyRows()) { // user has elected to have the parser flag rows that are empty row.setEmpty(ParserUtils.isListElementsEmpty(row.getCols())); // depends on control dependency: [if], data = [none] } if (isStoreRawDataToDataSet()) { // user told the parser to keep a copy of the raw data in the row // WARNING potential for high memory usage here row.setRawData(line); // depends on control dependency: [if], data = [none] } // add the row to the array ds.addRow(row); // depends on control dependency: [while], data = [none] } } finally { closeReaders(); } return ds; } }
public class class_name { public List<String> encode(Iterable<? extends Cookie> cookies) { if (cookies == null) { throw new NullPointerException("cookies"); } if (cookies.iterator().hasNext()) { return Collections.emptyList(); } List<String> encoded = new ArrayList<String>(); for (Cookie c : cookies) { if (c == null) { break; } encoded.add(encode(c)); } return encoded; } }
public class class_name { public List<String> encode(Iterable<? extends Cookie> cookies) { if (cookies == null) { throw new NullPointerException("cookies"); } if (cookies.iterator().hasNext()) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<String> encoded = new ArrayList<String>(); for (Cookie c : cookies) { if (c == null) { break; } encoded.add(encode(c)); // depends on control dependency: [for], data = [c] } return encoded; } }
public class class_name { public boolean expectsResponseBody() { boolean result = true; if (TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) { result = false; } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Flux.class)) { final ParameterizedType asyncReturnType = (ParameterizedType) returnType; final Type syncReturnType = asyncReturnType.getActualTypeArguments()[0]; if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Void.class)) { result = false; } else if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Response.class)) { result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) TypeUtil.getSuperType(syncReturnType, Response.class)); } } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Response.class)) { result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) returnType); } return result; } }
public class class_name { public boolean expectsResponseBody() { boolean result = true; if (TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) { result = false; // depends on control dependency: [if], data = [none] } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Flux.class)) { final ParameterizedType asyncReturnType = (ParameterizedType) returnType; final Type syncReturnType = asyncReturnType.getActualTypeArguments()[0]; if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Void.class)) { result = false; // depends on control dependency: [if], data = [none] } else if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Response.class)) { result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) TypeUtil.getSuperType(syncReturnType, Response.class)); // depends on control dependency: [if], data = [none] } } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Response.class)) { result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) returnType); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void marshall(DeleteInventoryRequest deleteInventoryRequest, ProtocolMarshaller protocolMarshaller) { if (deleteInventoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteInventoryRequest.getTypeName(), TYPENAME_BINDING); protocolMarshaller.marshall(deleteInventoryRequest.getSchemaDeleteOption(), SCHEMADELETEOPTION_BINDING); protocolMarshaller.marshall(deleteInventoryRequest.getDryRun(), DRYRUN_BINDING); protocolMarshaller.marshall(deleteInventoryRequest.getClientToken(), CLIENTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteInventoryRequest deleteInventoryRequest, ProtocolMarshaller protocolMarshaller) { if (deleteInventoryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteInventoryRequest.getTypeName(), TYPENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteInventoryRequest.getSchemaDeleteOption(), SCHEMADELETEOPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteInventoryRequest.getDryRun(), DRYRUN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteInventoryRequest.getClientToken(), CLIENTTOKEN_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 { protected List<SqlVisitor> filterRollbackVisitors(final List<SqlVisitor> visitors) { final List<SqlVisitor> rollbackVisitors = new ArrayList<>(); if (visitors != null) { for (SqlVisitor visitor : visitors) { if (visitor.isApplyToRollback()) { rollbackVisitors.add(visitor); } } } return rollbackVisitors; } }
public class class_name { protected List<SqlVisitor> filterRollbackVisitors(final List<SqlVisitor> visitors) { final List<SqlVisitor> rollbackVisitors = new ArrayList<>(); if (visitors != null) { for (SqlVisitor visitor : visitors) { if (visitor.isApplyToRollback()) { rollbackVisitors.add(visitor); // depends on control dependency: [if], data = [none] } } } return rollbackVisitors; } }
public class class_name { public Object get(String propName) { if (propName.equals("uniqueId")) { return getUniqueId(); } if (propName.equals("uniqueName")) { return getUniqueName(); } if (propName.equals("externalId")) { return getExternalId(); } if (propName.equals("externalName")) { return getExternalName(); } if (propName.equals("repositoryId")) { return getRepositoryId(); } return null; } }
public class class_name { public Object get(String propName) { if (propName.equals("uniqueId")) { return getUniqueId(); // depends on control dependency: [if], data = [none] } if (propName.equals("uniqueName")) { return getUniqueName(); // depends on control dependency: [if], data = [none] } if (propName.equals("externalId")) { return getExternalId(); // depends on control dependency: [if], data = [none] } if (propName.equals("externalName")) { return getExternalName(); // depends on control dependency: [if], data = [none] } if (propName.equals("repositoryId")) { return getRepositoryId(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public boolean recordBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags() && !currentInfo.hasBaseType()) { currentInfo.setBaseType(jsType); populated = true; return true; } else { return false; } } }
public class class_name { public boolean recordBaseType(JSTypeExpression jsType) { if (jsType != null && !hasAnySingletonTypeTags() && !currentInfo.hasBaseType()) { currentInfo.setBaseType(jsType); // depends on control dependency: [if], data = [(jsType] populated = true; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private TimeColumn fillWith(int count, Iterator<LocalTime> iterator, Consumer<LocalTime> acceptor) { for (int r = 0; r < count; r++) { if (!iterator.hasNext()) { break; } acceptor.accept(iterator.next()); } return this; } }
public class class_name { private TimeColumn fillWith(int count, Iterator<LocalTime> iterator, Consumer<LocalTime> acceptor) { for (int r = 0; r < count; r++) { if (!iterator.hasNext()) { break; } acceptor.accept(iterator.next()); // depends on control dependency: [for], data = [none] } return this; } }
public class class_name { @Override public ClassLoader getClassLoader() { // To follow the same behavior of Class.forName(...) I had to play // dirty (Supported by Sun, IBM & BEA JVMs) try { // Get a reference to this class' class-loader ClassLoader cl = this.getClass().getClassLoader(); // Create a method instance representing the protected // getCallerClassLoader method of class ClassLoader Method mthd = ClassLoader.class.getDeclaredMethod("getCallerClassLoader", new Class[0]); // Make the method accessible. AccessibleObject.setAccessible(new AccessibleObject[] {mthd}, true); // Try to get the caller's class-loader return (ClassLoader) mthd.invoke(cl, new Object[0]); } catch (Exception all) { // Use this class' class-loader return this.getClass().getClassLoader(); } } }
public class class_name { @Override public ClassLoader getClassLoader() { // To follow the same behavior of Class.forName(...) I had to play // dirty (Supported by Sun, IBM & BEA JVMs) try { // Get a reference to this class' class-loader ClassLoader cl = this.getClass().getClassLoader(); // Create a method instance representing the protected // getCallerClassLoader method of class ClassLoader Method mthd = ClassLoader.class.getDeclaredMethod("getCallerClassLoader", new Class[0]); // Make the method accessible. AccessibleObject.setAccessible(new AccessibleObject[] {mthd}, true); // depends on control dependency: [try], data = [none] // Try to get the caller's class-loader return (ClassLoader) mthd.invoke(cl, new Object[0]); // depends on control dependency: [try], data = [none] } catch (Exception all) { // Use this class' class-loader return this.getClass().getClassLoader(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean useCompression() { // If stream compression was offered by the server and we want to use // compression then send compression request to the server if (authenticated) { throw new IllegalStateException( "Compression should be negotiated before authentication."); } if ((compressionHandler = maybeGetCompressionHandler()) != null) { requestStreamCompression(compressionHandler.getCompressionMethod()); // Wait until compression is being used or a timeout happened synchronized (this) { try { this.wait(SmackConfiguration.getPacketReplyTimeout() * 5); } catch (InterruptedException e) { // Ignore. } } return isUsingCompression(); } return false; } }
public class class_name { private boolean useCompression() { // If stream compression was offered by the server and we want to use // compression then send compression request to the server if (authenticated) { throw new IllegalStateException( "Compression should be negotiated before authentication."); } if ((compressionHandler = maybeGetCompressionHandler()) != null) { requestStreamCompression(compressionHandler.getCompressionMethod()); // depends on control dependency: [if], data = [none] // Wait until compression is being used or a timeout happened synchronized (this) { // depends on control dependency: [if], data = [none] try { this.wait(SmackConfiguration.getPacketReplyTimeout() * 5); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // Ignore. } // depends on control dependency: [catch], data = [none] } return isUsingCompression(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static Unset unset(String... fields) { Unset x = new Unset(); for (String f : fields) { x.more(f); } return x; } }
public class class_name { public static Unset unset(String... fields) { Unset x = new Unset(); for (String f : fields) { x.more(f); // depends on control dependency: [for], data = [f] } return x; } }
public class class_name { public static String left(final String str, final int len) { if (str == null) { return null; } if (len < 0) { return EMPTY; } if (str.length() <= len) { return str; } return str.substring(0, len); } }
public class class_name { public static String left(final String str, final int len) { if (str == null) { return null; // depends on control dependency: [if], data = [none] } if (len < 0) { return EMPTY; // depends on control dependency: [if], data = [none] } if (str.length() <= len) { return str; // depends on control dependency: [if], data = [none] } return str.substring(0, len); } }
public class class_name { public static int positionOf(char value, char[] array) { for (int i = 0; i < array.length; i++) { if (value == array[i]) { return i; } } throw new OkapiException("Unable to find character '" + value + "' in character array."); } }
public class class_name { public static int positionOf(char value, char[] array) { for (int i = 0; i < array.length; i++) { if (value == array[i]) { return i; // depends on control dependency: [if], data = [none] } } throw new OkapiException("Unable to find character '" + value + "' in character array."); } }