code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public AbstractChart<T, S> addSerie(Serie serie) { Collection<Serie> series = getSeries(); if (series == null) { series = new ArrayList<Serie>(); } series.add(serie); return this; } }
public class class_name { public AbstractChart<T, S> addSerie(Serie serie) { Collection<Serie> series = getSeries(); if (series == null) { series = new ArrayList<Serie>(); // depends on control dependency: [if], data = [none] } series.add(serie); return this; } }
public class class_name { protected MessageChannel resolveChannelName(String channelName) { if (channelResolver == null) { channelResolver = new BeanFactoryChannelResolver(beanFactory); } return channelResolver.resolveDestination(channelName); } }
public class class_name { protected MessageChannel resolveChannelName(String channelName) { if (channelResolver == null) { channelResolver = new BeanFactoryChannelResolver(beanFactory); // depends on control dependency: [if], data = [none] } return channelResolver.resolveDestination(channelName); } }
public class class_name { @Override protected DatanodeDescriptor chooseTarget(int numOfReplicas, DatanodeDescriptor writer, HashMap<Node, Node> excludedNodes, long blocksize, int maxNodesPerRack, List<DatanodeDescriptor> results, boolean newBlock) { if (numOfReplicas == 0 || clusterMap.getNumOfLeaves() == 0) { return writer; } int numOfResults = results.size(); if (writer == null && !newBlock) { writer = results.get(0); } try { if (numOfResults == 0) { writer = chooseLocalNode(writer, excludedNodes, blocksize, maxNodesPerRack, results); if (--numOfReplicas == 0) { return writer; } } if (numOfResults <= 1) { // If we have a replication factor of 2, place both replicas on the // same rack. if (numOfReplicas == 1) { chooseLocalRack(results.get(0), excludedNodes, blocksize, maxNodesPerRack, results); } else { chooseFirstInRemoteRack(results.get(0), excludedNodes, blocksize, maxNodesPerRack, results); } if (--numOfReplicas == 0) { return writer; } } chooseRemainingReplicas(numOfReplicas, excludedNodes, blocksize, maxNodesPerRack, results); } catch (NotEnoughReplicasException e) { LOG.warn("Not able to place enough replicas, still in need of " + numOfReplicas); } return writer; } }
public class class_name { @Override protected DatanodeDescriptor chooseTarget(int numOfReplicas, DatanodeDescriptor writer, HashMap<Node, Node> excludedNodes, long blocksize, int maxNodesPerRack, List<DatanodeDescriptor> results, boolean newBlock) { if (numOfReplicas == 0 || clusterMap.getNumOfLeaves() == 0) { return writer; // depends on control dependency: [if], data = [none] } int numOfResults = results.size(); if (writer == null && !newBlock) { writer = results.get(0); // depends on control dependency: [if], data = [none] } try { if (numOfResults == 0) { writer = chooseLocalNode(writer, excludedNodes, blocksize, maxNodesPerRack, results); // depends on control dependency: [if], data = [none] if (--numOfReplicas == 0) { return writer; // depends on control dependency: [if], data = [none] } } if (numOfResults <= 1) { // If we have a replication factor of 2, place both replicas on the // same rack. if (numOfReplicas == 1) { chooseLocalRack(results.get(0), excludedNodes, blocksize, maxNodesPerRack, results); // depends on control dependency: [if], data = [none] } else { chooseFirstInRemoteRack(results.get(0), excludedNodes, blocksize, maxNodesPerRack, results); // depends on control dependency: [if], data = [none] } if (--numOfReplicas == 0) { return writer; // depends on control dependency: [if], data = [none] } } chooseRemainingReplicas(numOfReplicas, excludedNodes, blocksize, maxNodesPerRack, results); // depends on control dependency: [try], data = [none] } catch (NotEnoughReplicasException e) { LOG.warn("Not able to place enough replicas, still in need of " + numOfReplicas); } // depends on control dependency: [catch], data = [none] return writer; } }
public class class_name { private boolean existsResource(String path, boolean rootPath) { CmsObject cms = getCmsObject(); if (rootPath) { String origSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); if (cms.existsResource(path, CmsResourceFilter.ALL)) { return true; } } finally { cms.getRequestContext().setSiteRoot(origSiteRoot); } } else { if (cms.existsResource(path, CmsResourceFilter.ALL)) { return true; } } return false; } }
public class class_name { private boolean existsResource(String path, boolean rootPath) { CmsObject cms = getCmsObject(); if (rootPath) { String origSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none] if (cms.existsResource(path, CmsResourceFilter.ALL)) { return true; // depends on control dependency: [if], data = [none] } } finally { cms.getRequestContext().setSiteRoot(origSiteRoot); } } else { if (cms.existsResource(path, CmsResourceFilter.ALL)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromPredictionsWithServiceResponseAsync(UUID projectId, ImageIdCreateBatch batch) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (batch == null) { throw new IllegalArgumentException("Parameter batch is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(batch); return service.createImagesFromPredictions(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ImageCreateSummary>>>() { @Override public Observable<ServiceResponse<ImageCreateSummary>> call(Response<ResponseBody> response) { try { ServiceResponse<ImageCreateSummary> clientResponse = createImagesFromPredictionsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<ImageCreateSummary>> createImagesFromPredictionsWithServiceResponseAsync(UUID projectId, ImageIdCreateBatch batch) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (batch == null) { throw new IllegalArgumentException("Parameter batch is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(batch); return service.createImagesFromPredictions(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ImageCreateSummary>>>() { @Override public Observable<ServiceResponse<ImageCreateSummary>> call(Response<ResponseBody> response) { try { ServiceResponse<ImageCreateSummary> clientResponse = createImagesFromPredictionsDelegate(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 boolean exclude(String identifier) { String excludeMatch = null; for (String rule = identifier; rule != null; rule = enclosing(rule)) { if (excludes.contains(rule)) { excludeMatch = rule; } } if (excludeMatch != null) { usedExcludes.add(excludeMatch); return true; } return false; } }
public class class_name { private boolean exclude(String identifier) { String excludeMatch = null; for (String rule = identifier; rule != null; rule = enclosing(rule)) { if (excludes.contains(rule)) { excludeMatch = rule; // depends on control dependency: [if], data = [none] } } if (excludeMatch != null) { usedExcludes.add(excludeMatch); // depends on control dependency: [if], data = [(excludeMatch] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public List<MonolingualTextValue> getAddedAliases(String language) { AliasesWithUpdate update = newAliases.get(language); if (update == null) { return Collections.<MonolingualTextValue>emptyList(); } return update.added; } }
public class class_name { public List<MonolingualTextValue> getAddedAliases(String language) { AliasesWithUpdate update = newAliases.get(language); if (update == null) { return Collections.<MonolingualTextValue>emptyList(); // depends on control dependency: [if], data = [none] } return update.added; } }
public class class_name { public void put(Id id, Object value, Mode mode) { if (Mode.WRITE.equals(mode)) { writeCache.put(id, value); } readCache.put(new CacheKey(id), value); } }
public class class_name { public void put(Id id, Object value, Mode mode) { if (Mode.WRITE.equals(mode)) { writeCache.put(id, value); // depends on control dependency: [if], data = [none] } readCache.put(new CacheKey(id), value); } }
public class class_name { protected void loadCustomConfigFiles() { String customConfigFile = FindSecBugsGlobalConfig.getInstance().getCustomConfigFile(getClass().getSimpleName()); if (customConfigFile != null && !customConfigFile.isEmpty()) { for (String configFile : customConfigFile.split(File.pathSeparator)) { String[] injectionDefinition = configFile.split(Pattern.quote("|")); if (injectionDefinition.length != 2 || injectionDefinition[0].trim().isEmpty() || injectionDefinition[1].trim().isEmpty()) { AnalysisContext.logError("Wrong injection config file definition: " + configFile + ". Syntax: fileName|bugType, example: sql-custom.txt|SQL_INJECTION_HIBERNATE"); continue; } loadCustomSinks(injectionDefinition[0], injectionDefinition[1]); } } } }
public class class_name { protected void loadCustomConfigFiles() { String customConfigFile = FindSecBugsGlobalConfig.getInstance().getCustomConfigFile(getClass().getSimpleName()); if (customConfigFile != null && !customConfigFile.isEmpty()) { for (String configFile : customConfigFile.split(File.pathSeparator)) { String[] injectionDefinition = configFile.split(Pattern.quote("|")); if (injectionDefinition.length != 2 || injectionDefinition[0].trim().isEmpty() || injectionDefinition[1].trim().isEmpty()) { AnalysisContext.logError("Wrong injection config file definition: " + configFile + ". Syntax: fileName|bugType, example: sql-custom.txt|SQL_INJECTION_HIBERNATE"); // depends on control dependency: [if], data = [none] continue; } loadCustomSinks(injectionDefinition[0], injectionDefinition[1]); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public void add(ValidationResultsModel validationResultsModel) { if (children.add(validationResultsModel)) { validationResultsModel.addValidationListener(this); validationResultsModel.addPropertyChangeListener(HAS_ERRORS_PROPERTY, this); validationResultsModel.addPropertyChangeListener(HAS_WARNINGS_PROPERTY, this); validationResultsModel.addPropertyChangeListener(HAS_INFO_PROPERTY, this); if ((validationResultsModel.getMessageCount() > 0)) fireChangedEvents(); } } }
public class class_name { public void add(ValidationResultsModel validationResultsModel) { if (children.add(validationResultsModel)) { validationResultsModel.addValidationListener(this); // depends on control dependency: [if], data = [none] validationResultsModel.addPropertyChangeListener(HAS_ERRORS_PROPERTY, this); // depends on control dependency: [if], data = [none] validationResultsModel.addPropertyChangeListener(HAS_WARNINGS_PROPERTY, this); // depends on control dependency: [if], data = [none] validationResultsModel.addPropertyChangeListener(HAS_INFO_PROPERTY, this); // depends on control dependency: [if], data = [none] if ((validationResultsModel.getMessageCount() > 0)) fireChangedEvents(); } } }
public class class_name { public JsonResultSet getSimilarImages(String imageId, double threshold) { JsonResultSet similar = new JsonResultSet(); PostMethod queryMethod = null; String response = null; try { Part[] parts = { new StringPart("id", imageId), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/query_id/" + collectionName); queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); response = writer.toString(); queryMethod.releaseConnection(); similar = parseResponse(response); } else { _logger.error("Http returned code: " + code); } } catch (Exception e) { _logger.error("Exception for ID: " + imageId, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; } }
public class class_name { public JsonResultSet getSimilarImages(String imageId, double threshold) { JsonResultSet similar = new JsonResultSet(); PostMethod queryMethod = null; String response = null; try { Part[] parts = { new StringPart("id", imageId), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/query_id/" + collectionName); // depends on control dependency: [try], data = [none] queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); // depends on control dependency: [try], data = [none] int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); // depends on control dependency: [if], data = [none] response = writer.toString(); // depends on control dependency: [if], data = [none] queryMethod.releaseConnection(); // depends on control dependency: [if], data = [none] similar = parseResponse(response); // depends on control dependency: [if], data = [none] } else { _logger.error("Http returned code: " + code); // depends on control dependency: [if], data = [none] } } catch (Exception e) { _logger.error("Exception for ID: " + imageId, e); response = null; } finally { // depends on control dependency: [catch], data = [none] if (queryMethod != null) { queryMethod.releaseConnection(); // depends on control dependency: [if], data = [none] } } return similar; } }
public class class_name { @Override public DurationFormatterFactory setFallbackLimit(long fallbackLimit) { if (fallbackLimit < 0) { fallbackLimit = 0; } if (fallbackLimit != this.fallbackLimit) { this.fallbackLimit = fallbackLimit; reset(); } return this; } }
public class class_name { @Override public DurationFormatterFactory setFallbackLimit(long fallbackLimit) { if (fallbackLimit < 0) { fallbackLimit = 0; // depends on control dependency: [if], data = [none] } if (fallbackLimit != this.fallbackLimit) { this.fallbackLimit = fallbackLimit; // depends on control dependency: [if], data = [none] reset(); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private void _writeStringCustom(final int len) throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; final int[] escCodes = _outputEscapes; final int maxNonEscaped = (_maximumNonEscapedChar < 1) ? 0xFFFF : _maximumNonEscapedChar; final int escLimit = Math.min(escCodes.length, maxNonEscaped+1); int escCode = 0; final CharacterEscapes customEscapes = _characterEscapes; output_loop: while (_outputTail < end) { char c; // Fast loop for chars not needing escaping escape_loop: while (true) { c = _outputBuffer[_outputTail]; if (c < escLimit) { escCode = escCodes[c]; if (escCode != 0) { break escape_loop; } } else if (c > maxNonEscaped) { escCode = CharacterEscapes.ESCAPE_STANDARD; break escape_loop; } else { if ((_currentEscape = customEscapes.getEscapeSequence(c)) != null) { escCode = CharacterEscapes.ESCAPE_CUSTOM; break escape_loop; } } if (++_outputTail >= end) { break output_loop; } } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); } } }
public class class_name { private void _writeStringCustom(final int len) throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; final int[] escCodes = _outputEscapes; final int maxNonEscaped = (_maximumNonEscapedChar < 1) ? 0xFFFF : _maximumNonEscapedChar; final int escLimit = Math.min(escCodes.length, maxNonEscaped+1); int escCode = 0; final CharacterEscapes customEscapes = _characterEscapes; output_loop: while (_outputTail < end) { char c; // Fast loop for chars not needing escaping escape_loop: while (true) { c = _outputBuffer[_outputTail]; if (c < escLimit) { escCode = escCodes[c]; // depends on control dependency: [if], data = [none] if (escCode != 0) { break escape_loop; } } else if (c > maxNonEscaped) { escCode = CharacterEscapes.ESCAPE_STANDARD; // depends on control dependency: [if], data = [none] break escape_loop; } else { if ((_currentEscape = customEscapes.getEscapeSequence(c)) != null) { escCode = CharacterEscapes.ESCAPE_CUSTOM; // depends on control dependency: [if], data = [none] break escape_loop; } } if (++_outputTail >= end) { break output_loop; } } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); } } }
public class class_name { public void distributeShare() { if (needRedistributed) { ScheduleComparator sc = configManager.getPoolGroupComparator(getName()); Schedulable.distributeShare(getShare(), snapshotPools, sc); } needRedistributed = false; } }
public class class_name { public void distributeShare() { if (needRedistributed) { ScheduleComparator sc = configManager.getPoolGroupComparator(getName()); Schedulable.distributeShare(getShare(), snapshotPools, sc); // depends on control dependency: [if], data = [none] } needRedistributed = false; } }
public class class_name { public TransferManager getTransferManager(String region) { synchronized (transferManagersByRegion) { TransferManager tm = transferManagersByRegion.get(region); if (tm == null) { tm = new TransferManager(getClient(region)); transferManagersByRegion.put(region, tm); } return tm; } } }
public class class_name { public TransferManager getTransferManager(String region) { synchronized (transferManagersByRegion) { TransferManager tm = transferManagersByRegion.get(region); if (tm == null) { tm = new TransferManager(getClient(region)); // depends on control dependency: [if], data = [none] transferManagersByRegion.put(region, tm); // depends on control dependency: [if], data = [none] } return tm; } } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata getAudioTranscriptionDetails() { if (detailsCase_ == 10) { return (com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata) details_; } return com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata .getDefaultInstance(); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata getAudioTranscriptionDetails() { if (detailsCase_ == 10) { return (com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata) details_; // depends on control dependency: [if], data = [none] } return com.google.cloud.datalabeling.v1beta1.LabelAudioTranscriptionOperationMetadata .getDefaultInstance(); } }
public class class_name { private static void stampTypeOnJsonObject(final Object o, final Type t) { Class clazz = t instanceof Class ? (Class)t : getRawType(t); if (o instanceof JsonObject && clazz != null) { JsonObject jObj = (JsonObject) o; if ((jObj.type == null || jObj.type.isEmpty()) && jObj.target == null) { jObj.type = clazz.getName(); } } } }
public class class_name { private static void stampTypeOnJsonObject(final Object o, final Type t) { Class clazz = t instanceof Class ? (Class)t : getRawType(t); if (o instanceof JsonObject && clazz != null) { JsonObject jObj = (JsonObject) o; if ((jObj.type == null || jObj.type.isEmpty()) && jObj.target == null) { jObj.type = clazz.getName(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public ListVoiceConnectorTerminationCredentialsResult withUsernames(String... usernames) { if (this.usernames == null) { setUsernames(new java.util.ArrayList<String>(usernames.length)); } for (String ele : usernames) { this.usernames.add(ele); } return this; } }
public class class_name { public ListVoiceConnectorTerminationCredentialsResult withUsernames(String... usernames) { if (this.usernames == null) { setUsernames(new java.util.ArrayList<String>(usernames.length)); // depends on control dependency: [if], data = [none] } for (String ele : usernames) { this.usernames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public List<CmsSolrFieldConfiguration> getFieldConfigurationsSolr() { List<CmsSolrFieldConfiguration> result = new ArrayList<CmsSolrFieldConfiguration>(); for (I_CmsSearchFieldConfiguration conf : m_fieldConfigurations.values()) { if (conf instanceof CmsSolrFieldConfiguration) { result.add((CmsSolrFieldConfiguration)conf); } } Collections.sort(result); return Collections.unmodifiableList(result); } }
public class class_name { public List<CmsSolrFieldConfiguration> getFieldConfigurationsSolr() { List<CmsSolrFieldConfiguration> result = new ArrayList<CmsSolrFieldConfiguration>(); for (I_CmsSearchFieldConfiguration conf : m_fieldConfigurations.values()) { if (conf instanceof CmsSolrFieldConfiguration) { result.add((CmsSolrFieldConfiguration)conf); // depends on control dependency: [if], data = [none] } } Collections.sort(result); return Collections.unmodifiableList(result); } }
public class class_name { public void automaticColor() { final Map<TileRef, ColorRgba> colors = new HashMap<>(); for (final Integer sheet : map.getSheets()) { computeSheet(colors, sheet); } pixels = colors; } }
public class class_name { public void automaticColor() { final Map<TileRef, ColorRgba> colors = new HashMap<>(); for (final Integer sheet : map.getSheets()) { computeSheet(colors, sheet); // depends on control dependency: [for], data = [sheet] } pixels = colors; } }
public class class_name { public void process( I left , I right , GrayF32 imageDisparity ) { // check inputs and initialize data structures InputSanityCheck.checkSameShape(left,right,imageDisparity); this.imageLeft = left; this.imageRight = right; w = left.width; h = left.height; // Compute disparity for each pixel for( int y = radiusY*2; y < h-radiusY*2; y++ ) { for( int x = radiusX*2+minDisparity; x < w-radiusX*2; x++ ) { // take in account image border when computing max disparity int max = x-Math.max(radiusX*2-1,x-score.length); // compute match score across all candidates processPixel(x, y, max); // select the best disparity imageDisparity.set(x,y,(float)selectBest(max)); } } } }
public class class_name { public void process( I left , I right , GrayF32 imageDisparity ) { // check inputs and initialize data structures InputSanityCheck.checkSameShape(left,right,imageDisparity); this.imageLeft = left; this.imageRight = right; w = left.width; h = left.height; // Compute disparity for each pixel for( int y = radiusY*2; y < h-radiusY*2; y++ ) { for( int x = radiusX*2+minDisparity; x < w-radiusX*2; x++ ) { // take in account image border when computing max disparity int max = x-Math.max(radiusX*2-1,x-score.length); // compute match score across all candidates processPixel(x, y, max); // depends on control dependency: [for], data = [x] // select the best disparity imageDisparity.set(x,y,(float)selectBest(max)); // depends on control dependency: [for], data = [x] } } } }
public class class_name { @Override public boolean createProperty(String name, String value) { if (name == null || name.length() == 0) throw new IllegalArgumentException("name: " + name); if (value == null || value.length() == 0) throw new IllegalArgumentException("value: " + value); boolean created = false; TransactionController tranController = new TransactionController(); try { tranController.preInvoke(); created = taskStore.createProperty(name, value); if (!created) tranController.expectRollback(); } catch (Throwable x) { tranController.setFailure(x); } finally { PersistentStoreException x = tranController.postInvoke(PersistentStoreException.class); // TODO proposed spec class if (x != null) throw x; } return created; } }
public class class_name { @Override public boolean createProperty(String name, String value) { if (name == null || name.length() == 0) throw new IllegalArgumentException("name: " + name); if (value == null || value.length() == 0) throw new IllegalArgumentException("value: " + value); boolean created = false; TransactionController tranController = new TransactionController(); try { tranController.preInvoke(); // depends on control dependency: [try], data = [none] created = taskStore.createProperty(name, value); // depends on control dependency: [try], data = [none] if (!created) tranController.expectRollback(); } catch (Throwable x) { tranController.setFailure(x); } finally { // depends on control dependency: [catch], data = [none] PersistentStoreException x = tranController.postInvoke(PersistentStoreException.class); // TODO proposed spec class if (x != null) throw x; } return created; } }
public class class_name { @Deprecated public static String unquoteIdentifier(String string) { if (string != null && string.startsWith("`") && string.endsWith("`") && string.length() >= 2) { return string.substring(1, string.length() - 1).replace("``", "`"); } return string; } }
public class class_name { @Deprecated public static String unquoteIdentifier(String string) { if (string != null && string.startsWith("`") && string.endsWith("`") && string.length() >= 2) { return string.substring(1, string.length() - 1).replace("``", "`"); // depends on control dependency: [if], data = [none] } return string; } }
public class class_name { public List<JspConfigType<WebAppType<T>>> getAllJspConfig() { List<JspConfigType<WebAppType<T>>> list = new ArrayList<JspConfigType<WebAppType<T>>>(); List<Node> nodeList = childNode.get("jsp-config"); for(Node node: nodeList) { JspConfigType<WebAppType<T>> type = new JspConfigTypeImpl<WebAppType<T>>(this, "jsp-config", childNode, node); list.add(type); } return list; } }
public class class_name { public List<JspConfigType<WebAppType<T>>> getAllJspConfig() { List<JspConfigType<WebAppType<T>>> list = new ArrayList<JspConfigType<WebAppType<T>>>(); List<Node> nodeList = childNode.get("jsp-config"); for(Node node: nodeList) { JspConfigType<WebAppType<T>> type = new JspConfigTypeImpl<WebAppType<T>>(this, "jsp-config", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer) { T recyclable = null; lock.lock(); try { List<Recyclable> list = mapList.get(cls); if (list != null && !list.isEmpty()) { recyclable = (T) list.remove(list.size()-1); log.debug("get recycled %s", recyclable); } } finally { lock.unlock(); } if (recyclable == null) { try { recyclable = cls.newInstance(); log.debug("create new recycled %s", recyclable); } catch (InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } } if (initializer != null) { initializer.accept(recyclable); } return (T) recyclable; } }
public class class_name { public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer) { T recyclable = null; lock.lock(); try { List<Recyclable> list = mapList.get(cls); if (list != null && !list.isEmpty()) { recyclable = (T) list.remove(list.size()-1); // depends on control dependency: [if], data = [(list] log.debug("get recycled %s", recyclable); // depends on control dependency: [if], data = [none] } } finally { lock.unlock(); } if (recyclable == null) { try { recyclable = cls.newInstance(); // depends on control dependency: [try], data = [none] log.debug("create new recycled %s", recyclable); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException ex) { throw new IllegalArgumentException(ex); } // depends on control dependency: [catch], data = [none] } if (initializer != null) { initializer.accept(recyclable); // depends on control dependency: [if], data = [none] } return (T) recyclable; } }
public class class_name { private void addConditionalFieldsToAttemptEvent(AWSRequestMetrics metrics, HandlerAfterAttemptContext context, ApiCallAttemptMonitoringEvent event) { TimingInfo timingInfo = metrics == null ? null : metrics.getTimingInfo(); Response<?> response = context.getResponse(); Integer statusCode = null; String xAmznRequestId = null; String xAmzRequestId = null; String xAmzId2 = null; Long requestLatency = null; Map<String, String> responseHeaders = null; if (response != null && response.getHttpResponse() != null) { responseHeaders = response.getHttpResponse().getHeaders(); statusCode = response.getHttpResponse().getStatusCode(); requestLatency = calculateRequestLatency(timingInfo); } else if (context.getException() instanceof AmazonServiceException) { responseHeaders = ((AmazonServiceException) context.getException()).getHttpHeaders(); statusCode = extractHttpStatusCode((AmazonServiceException) context.getException()); requestLatency = calculateRequestLatency(timingInfo); } if (responseHeaders != null) { xAmznRequestId = responseHeaders.get(X_AMZN_REQUEST_ID_HEADER_KEY); xAmzRequestId = responseHeaders.get(X_AMZ_REQUEST_ID_HEADER_KEY); xAmzId2 = responseHeaders.get(X_AMZ_REQUEST_ID_2_HEADER_KEY); } event.withXAmznRequestId(xAmznRequestId) .withXAmzRequestId(xAmzRequestId) .withXAmzId2(xAmzId2) .withHttpStatusCode(statusCode) .withRequestLatency(requestLatency); addException(context.getException(), event); } }
public class class_name { private void addConditionalFieldsToAttemptEvent(AWSRequestMetrics metrics, HandlerAfterAttemptContext context, ApiCallAttemptMonitoringEvent event) { TimingInfo timingInfo = metrics == null ? null : metrics.getTimingInfo(); Response<?> response = context.getResponse(); Integer statusCode = null; String xAmznRequestId = null; String xAmzRequestId = null; String xAmzId2 = null; Long requestLatency = null; Map<String, String> responseHeaders = null; if (response != null && response.getHttpResponse() != null) { responseHeaders = response.getHttpResponse().getHeaders(); // depends on control dependency: [if], data = [none] statusCode = response.getHttpResponse().getStatusCode(); // depends on control dependency: [if], data = [none] requestLatency = calculateRequestLatency(timingInfo); // depends on control dependency: [if], data = [none] } else if (context.getException() instanceof AmazonServiceException) { responseHeaders = ((AmazonServiceException) context.getException()).getHttpHeaders(); // depends on control dependency: [if], data = [none] statusCode = extractHttpStatusCode((AmazonServiceException) context.getException()); // depends on control dependency: [if], data = [none] requestLatency = calculateRequestLatency(timingInfo); // depends on control dependency: [if], data = [none] } if (responseHeaders != null) { xAmznRequestId = responseHeaders.get(X_AMZN_REQUEST_ID_HEADER_KEY); // depends on control dependency: [if], data = [none] xAmzRequestId = responseHeaders.get(X_AMZ_REQUEST_ID_HEADER_KEY); // depends on control dependency: [if], data = [none] xAmzId2 = responseHeaders.get(X_AMZ_REQUEST_ID_2_HEADER_KEY); // depends on control dependency: [if], data = [none] } event.withXAmznRequestId(xAmznRequestId) .withXAmzRequestId(xAmzRequestId) .withXAmzId2(xAmzId2) .withHttpStatusCode(statusCode) .withRequestLatency(requestLatency); addException(context.getException(), event); } }
public class class_name { private void deleteApplicationCFs(ApplicationDefinition appDef) { Tenant tenant = Tenant.getTenant(appDef); for (TableDefinition tableDef : appDef.getTableDefinitions().values()) { DBService.instance(tenant).deleteStoreIfPresent(objectsStoreName(tableDef)); DBService.instance(tenant).deleteStoreIfPresent(termsStoreName(tableDef)); } } }
public class class_name { private void deleteApplicationCFs(ApplicationDefinition appDef) { Tenant tenant = Tenant.getTenant(appDef); for (TableDefinition tableDef : appDef.getTableDefinitions().values()) { DBService.instance(tenant).deleteStoreIfPresent(objectsStoreName(tableDef)); // depends on control dependency: [for], data = [tableDef] DBService.instance(tenant).deleteStoreIfPresent(termsStoreName(tableDef)); // depends on control dependency: [for], data = [tableDef] } } }
public class class_name { public void marshall(AttachDiskRequest attachDiskRequest, ProtocolMarshaller protocolMarshaller) { if (attachDiskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attachDiskRequest.getDiskName(), DISKNAME_BINDING); protocolMarshaller.marshall(attachDiskRequest.getInstanceName(), INSTANCENAME_BINDING); protocolMarshaller.marshall(attachDiskRequest.getDiskPath(), DISKPATH_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AttachDiskRequest attachDiskRequest, ProtocolMarshaller protocolMarshaller) { if (attachDiskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attachDiskRequest.getDiskName(), DISKNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(attachDiskRequest.getInstanceName(), INSTANCENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(attachDiskRequest.getDiskPath(), DISKPATH_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static boolean looksUnsafeForFastParser(String s) { boolean lastWasDot = true; // start of path is also a "dot" int len = s.length(); if (s.isEmpty()) return true; if (s.charAt(0) == '.') return true; if (s.charAt(len - 1) == '.') return true; for (int i = 0; i < len; ++i) { char c = s.charAt(i); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') { lastWasDot = false; continue; } else if (c == '.') { if (lastWasDot) return true; // ".." means we need to throw an error lastWasDot = true; } else if (c == '-') { if (lastWasDot) return true; continue; } else { return true; } } if (lastWasDot) return true; return false; } }
public class class_name { private static boolean looksUnsafeForFastParser(String s) { boolean lastWasDot = true; // start of path is also a "dot" int len = s.length(); if (s.isEmpty()) return true; if (s.charAt(0) == '.') return true; if (s.charAt(len - 1) == '.') return true; for (int i = 0; i < len; ++i) { char c = s.charAt(i); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') { lastWasDot = false; // depends on control dependency: [if], data = [none] continue; } else if (c == '.') { if (lastWasDot) return true; // ".." means we need to throw an error lastWasDot = true; // depends on control dependency: [if], data = [none] } else if (c == '-') { if (lastWasDot) return true; continue; } else { return true; // depends on control dependency: [if], data = [none] } } if (lastWasDot) return true; return false; } }
public class class_name { private void updateSubdirectories(ISO9660Directory dir) { List<ISO9660Directory> subdirectories = dir.getDirectories(); Iterator<ISO9660Directory> iter = subdirectories.iterator(); while (iter.hasNext()) { ISO9660Directory subdir = (ISO9660Directory) iter.next(); subdir.setLevel(dir.getLevel() + 1); subdir.setRoot(dir.getRoot()); updateSubdirectories(subdir); } } }
public class class_name { private void updateSubdirectories(ISO9660Directory dir) { List<ISO9660Directory> subdirectories = dir.getDirectories(); Iterator<ISO9660Directory> iter = subdirectories.iterator(); while (iter.hasNext()) { ISO9660Directory subdir = (ISO9660Directory) iter.next(); subdir.setLevel(dir.getLevel() + 1); // depends on control dependency: [while], data = [none] subdir.setRoot(dir.getRoot()); // depends on control dependency: [while], data = [none] updateSubdirectories(subdir); // depends on control dependency: [while], data = [none] } } }
public class class_name { public Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> getContainerTargets() { Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> result = new HashMap<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer>(); for (Entry<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> entry : m_targetContainers.entrySet()) { if (entry.getValue().isEditable() && (!isDetailPage() || (entry.getValue().isDetailOnly() || entry.getValue().isDetailView()))) { result.put(entry.getKey(), entry.getValue()); } } return result; } }
public class class_name { public Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> getContainerTargets() { Map<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> result = new HashMap<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer>(); for (Entry<String, org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer> entry : m_targetContainers.entrySet()) { if (entry.getValue().isEditable() && (!isDetailPage() || (entry.getValue().isDetailOnly() || entry.getValue().isDetailView()))) { result.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private static boolean checkVerticesForIntersection_( MultiVertexGeometryImpl geom, RasterizedGeometry2D rgeom) { // Do a quick raster test for each point. If any point is inside, then // there is an intersection. int pointCount = geom.getPointCount(); Point2D pt = new Point2D(); for (int ipoint = 0; ipoint < pointCount; ipoint++) { geom.getXY(ipoint, pt); RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry(pt.x, pt.y); if (hit == RasterizedGeometry2D.HitType.Inside) { return true; } } return false; } }
public class class_name { private static boolean checkVerticesForIntersection_( MultiVertexGeometryImpl geom, RasterizedGeometry2D rgeom) { // Do a quick raster test for each point. If any point is inside, then // there is an intersection. int pointCount = geom.getPointCount(); Point2D pt = new Point2D(); for (int ipoint = 0; ipoint < pointCount; ipoint++) { geom.getXY(ipoint, pt); // depends on control dependency: [for], data = [ipoint] RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry(pt.x, pt.y); if (hit == RasterizedGeometry2D.HitType.Inside) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private State checkV3Parameterization(Class<?> cls, State state) throws NoClassDefFoundError { // check for a V3 Parameterizer class for(Class<?> inner : cls.getDeclaredClasses()) { if(AbstractParameterizer.class.isAssignableFrom(inner)) { try { Class<? extends AbstractParameterizer> pcls = inner.asSubclass(AbstractParameterizer.class); pcls.newInstance(); if(checkParameterizer(cls, pcls)) { if(state == State.INSTANTIABLE) { LOG.warning("More than one parameterization method in class " + cls.getName()); } state = State.INSTANTIABLE; } } catch(Exception|Error e) { LOG.verbose("Could not run Parameterizer: " + inner.getName() + ": " + e.getMessage()); // continue. Probably non-public } } } return state; } }
public class class_name { private State checkV3Parameterization(Class<?> cls, State state) throws NoClassDefFoundError { // check for a V3 Parameterizer class for(Class<?> inner : cls.getDeclaredClasses()) { if(AbstractParameterizer.class.isAssignableFrom(inner)) { try { Class<? extends AbstractParameterizer> pcls = inner.asSubclass(AbstractParameterizer.class); pcls.newInstance(); if(checkParameterizer(cls, pcls)) { if(state == State.INSTANTIABLE) { LOG.warning("More than one parameterization method in class " + cls.getName()); // depends on control dependency: [if], data = [none] } state = State.INSTANTIABLE; // depends on control dependency: [if], data = [none] } } catch(Exception|Error e) { LOG.verbose("Could not run Parameterizer: " + inner.getName() + ": " + e.getMessage()); // continue. Probably non-public } // depends on control dependency: [catch], data = [none] } } return state; } }
public class class_name { private void nullPrintln(PrintStream out, String line) { if (out != null) { out.println(line); } } }
public class class_name { private void nullPrintln(PrintStream out, String line) { if (out != null) { out.println(line); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getHBCICode() { StringBuffer ret = null; // Macht aus z.Bsp. "KUmsZeit5" -> "KUmsZeitPar5.SegHead.code" StringBuilder searchString = new StringBuilder(name); for (int i = searchString.length() - 1; i >= 0; i--) { if (!(searchString.charAt(i) >= '0' && searchString.charAt(i) <= '9')) { searchString.insert(i + 1, "Par"); searchString.append(".SegHead.code"); break; } } StringBuilder tempkey = new StringBuilder(); // durchsuchen aller param-segmente nach einem job mit dem jobnamen des // aktuellen jobs for (String key : passport.getBPD().keySet()) { if (key.indexOf("Params") == 0) { tempkey.setLength(0); tempkey.append(key); tempkey.delete(0, tempkey.indexOf(".") + 1); if (tempkey.toString().equals(searchString.toString())) { ret = new StringBuffer(passport.getBPD().get(key)); ret.replace(1, 2, "K"); ret.deleteCharAt(ret.length() - 1); break; } } } if (ret != null) { return ret.toString(); } return null; } }
public class class_name { public String getHBCICode() { StringBuffer ret = null; // Macht aus z.Bsp. "KUmsZeit5" -> "KUmsZeitPar5.SegHead.code" StringBuilder searchString = new StringBuilder(name); for (int i = searchString.length() - 1; i >= 0; i--) { if (!(searchString.charAt(i) >= '0' && searchString.charAt(i) <= '9')) { searchString.insert(i + 1, "Par"); // depends on control dependency: [if], data = [none] searchString.append(".SegHead.code"); // depends on control dependency: [if], data = [none] break; } } StringBuilder tempkey = new StringBuilder(); // durchsuchen aller param-segmente nach einem job mit dem jobnamen des // aktuellen jobs for (String key : passport.getBPD().keySet()) { if (key.indexOf("Params") == 0) { tempkey.setLength(0); // depends on control dependency: [if], data = [0)] tempkey.append(key); // depends on control dependency: [if], data = [none] tempkey.delete(0, tempkey.indexOf(".") + 1); // depends on control dependency: [if], data = [none] if (tempkey.toString().equals(searchString.toString())) { ret = new StringBuffer(passport.getBPD().get(key)); // depends on control dependency: [if], data = [none] ret.replace(1, 2, "K"); // depends on control dependency: [if], data = [none] ret.deleteCharAt(ret.length() - 1); // depends on control dependency: [if], data = [none] break; } } } if (ret != null) { return ret.toString(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static Access authorizeAllResourceActions( final AuthenticationResult authenticationResult, final Iterable<ResourceAction> resourceActions, final AuthorizerMapper authorizerMapper ) { final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName()); if (authorizer == null) { throw new ISE("No authorizer found with name: [%s].", authenticationResult.getAuthorizerName()); } // this method returns on first failure, so only successful Access results are kept in the cache final Set<ResourceAction> resultCache = new HashSet<>(); for (ResourceAction resourceAction : resourceActions) { if (resultCache.contains(resourceAction)) { continue; } final Access access = authorizer.authorize( authenticationResult, resourceAction.getResource(), resourceAction.getAction() ); if (!access.isAllowed()) { return access; } else { resultCache.add(resourceAction); } } return Access.OK; } }
public class class_name { public static Access authorizeAllResourceActions( final AuthenticationResult authenticationResult, final Iterable<ResourceAction> resourceActions, final AuthorizerMapper authorizerMapper ) { final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName()); if (authorizer == null) { throw new ISE("No authorizer found with name: [%s].", authenticationResult.getAuthorizerName()); } // this method returns on first failure, so only successful Access results are kept in the cache final Set<ResourceAction> resultCache = new HashSet<>(); for (ResourceAction resourceAction : resourceActions) { if (resultCache.contains(resourceAction)) { continue; } final Access access = authorizer.authorize( authenticationResult, resourceAction.getResource(), resourceAction.getAction() ); if (!access.isAllowed()) { return access; // depends on control dependency: [if], data = [none] } else { resultCache.add(resourceAction); // depends on control dependency: [if], data = [none] } } return Access.OK; } }
public class class_name { protected final void setNonceForWffScript(final String value) { if (autoremoveWffScript) { throw new InvalidUsageException( "Cannot remove while autoremoveWffScript is set as true. Please do setAutoremoveWffScript(false)"); } if (value != null) { if (nonceForWffScriptTag == null) { nonceForWffScriptTag = new Nonce(value); if (wffScriptTagId != null) { final AbstractHtml[] ownerTags = wffScriptTagId .getOwnerTags(); if (ownerTags.length > 0) { final AbstractHtml wffScript = ownerTags[0]; wffScript.addAttributes(nonceForWffScriptTag); } } } else { nonceForWffScriptTag.setValue(value); } } else { if (wffScriptTagId != null && nonceForWffScriptTag != null) { final AbstractHtml[] ownerTags = wffScriptTagId.getOwnerTags(); if (ownerTags.length > 0) { final AbstractHtml wffScript = ownerTags[0]; wffScript.removeAttributes(nonceForWffScriptTag); } } nonceForWffScriptTag = null; } } }
public class class_name { protected final void setNonceForWffScript(final String value) { if (autoremoveWffScript) { throw new InvalidUsageException( "Cannot remove while autoremoveWffScript is set as true. Please do setAutoremoveWffScript(false)"); } if (value != null) { if (nonceForWffScriptTag == null) { nonceForWffScriptTag = new Nonce(value); // depends on control dependency: [if], data = [none] if (wffScriptTagId != null) { final AbstractHtml[] ownerTags = wffScriptTagId .getOwnerTags(); if (ownerTags.length > 0) { final AbstractHtml wffScript = ownerTags[0]; wffScript.addAttributes(nonceForWffScriptTag); // depends on control dependency: [if], data = [none] } } } else { nonceForWffScriptTag.setValue(value); // depends on control dependency: [if], data = [none] } } else { if (wffScriptTagId != null && nonceForWffScriptTag != null) { final AbstractHtml[] ownerTags = wffScriptTagId.getOwnerTags(); if (ownerTags.length > 0) { final AbstractHtml wffScript = ownerTags[0]; wffScript.removeAttributes(nonceForWffScriptTag); // depends on control dependency: [if], data = [none] } } nonceForWffScriptTag = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public String getUserFacingMessage() { final StringBuilder bldr = new StringBuilder(); if (signatureStatus != null && signatureStatus.size() > 1) { bldr.append("SEMANTIC WARNINGS"); } else { bldr.append("SEMANTIC WARNING"); } final String name = getName(); if (name != null) { bldr.append(" in "); bldr.append(name); } bldr.append("\n\treason: "); final String msg = getMessage(); if (msg != null) { bldr.append(msg); } else { bldr.append("Unknown"); } bldr.append("\n"); if (signatureStatus != null) { // Signature status is non-null, suppliedSignature is as well bldr.append("\tsignature: "); bldr.append(suppliedSignature); bldr.append("\n"); bldr.append("\tfunction signatures: "); bldr.append(signatureStatus.size()); bldr.append("\n"); final Set<Entry<Signature, SemanticStatus>> entrySet = signatureStatus.entrySet(); for (final Entry<Signature, SemanticStatus> entry : entrySet) { Signature sig = entry.getKey(); SemanticStatus status = entry.getValue(); bldr.append("\t\t"); bldr.append(status); bldr.append(" for signature "); bldr.append(sig); bldr.append("\n"); } } return bldr.toString(); } }
public class class_name { @Override public String getUserFacingMessage() { final StringBuilder bldr = new StringBuilder(); if (signatureStatus != null && signatureStatus.size() > 1) { bldr.append("SEMANTIC WARNINGS"); // depends on control dependency: [if], data = [none] } else { bldr.append("SEMANTIC WARNING"); // depends on control dependency: [if], data = [none] } final String name = getName(); if (name != null) { bldr.append(" in "); // depends on control dependency: [if], data = [none] bldr.append(name); // depends on control dependency: [if], data = [(name] } bldr.append("\n\treason: "); final String msg = getMessage(); if (msg != null) { bldr.append(msg); // depends on control dependency: [if], data = [(msg] } else { bldr.append("Unknown"); // depends on control dependency: [if], data = [none] } bldr.append("\n"); if (signatureStatus != null) { // Signature status is non-null, suppliedSignature is as well bldr.append("\tsignature: "); // depends on control dependency: [if], data = [none] bldr.append(suppliedSignature); // depends on control dependency: [if], data = [none] bldr.append("\n"); // depends on control dependency: [if], data = [none] bldr.append("\tfunction signatures: "); // depends on control dependency: [if], data = [none] bldr.append(signatureStatus.size()); // depends on control dependency: [if], data = [(signatureStatus] bldr.append("\n"); // depends on control dependency: [if], data = [none] final Set<Entry<Signature, SemanticStatus>> entrySet = signatureStatus.entrySet(); for (final Entry<Signature, SemanticStatus> entry : entrySet) { Signature sig = entry.getKey(); SemanticStatus status = entry.getValue(); bldr.append("\t\t"); // depends on control dependency: [for], data = [none] bldr.append(status); // depends on control dependency: [for], data = [none] bldr.append(" for signature "); // depends on control dependency: [for], data = [none] bldr.append(sig); // depends on control dependency: [for], data = [none] bldr.append("\n"); // depends on control dependency: [for], data = [none] } } return bldr.toString(); } }
public class class_name { public void reset() { for(ByteBuffer bb : bbs) { bb.position(0); } if(bbs.isEmpty()) { curr = null; idx = 0; } else { curr=bbs.get(0); idx=1; } } }
public class class_name { public void reset() { for(ByteBuffer bb : bbs) { bb.position(0); // depends on control dependency: [for], data = [bb] } if(bbs.isEmpty()) { curr = null; // depends on control dependency: [if], data = [none] idx = 0; // depends on control dependency: [if], data = [none] } else { curr=bbs.get(0); // depends on control dependency: [if], data = [none] idx=1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean readFullyOrNothing(InputStream in, byte[] buffer) throws IOException { int bytesRead = 0; do { int count = in.read(buffer, bytesRead, buffer.length - bytesRead); if (count < 0) { if (bytesRead == 0) { return false; } throw new EOFException(); } bytesRead += count; } while (bytesRead < buffer.length); return true; } }
public class class_name { public static boolean readFullyOrNothing(InputStream in, byte[] buffer) throws IOException { int bytesRead = 0; do { int count = in.read(buffer, bytesRead, buffer.length - bytesRead); if (count < 0) { if (bytesRead == 0) { return false; // depends on control dependency: [if], data = [none] } throw new EOFException(); } bytesRead += count; } while (bytesRead < buffer.length); return true; } }
public class class_name { @Override public void close() { try { if (future != null) { if (!(future.isDone() || future.isCancelled())) { boolean cancelled = future.cancel(true); if (!cancelled) { // On shutdown these threads are getting closed down from elsewhere if (future.isDone() || future.isCancelled()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "PollingDynamicConfig lost race in future cancel: {0}", this); } // Something 'odd' happened } else { if (tc.isWarningEnabled()) { Tr.warning(tc, "future.update.not.cancelled.CWMCG0016E", this); } } } } future = null; } } finally { if (this.localExecutor) { this.executor.shutdown(); } } } }
public class class_name { @Override public void close() { try { if (future != null) { if (!(future.isDone() || future.isCancelled())) { boolean cancelled = future.cancel(true); if (!cancelled) { // On shutdown these threads are getting closed down from elsewhere if (future.isDone() || future.isCancelled()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "PollingDynamicConfig lost race in future cancel: {0}", this); // depends on control dependency: [if], data = [none] } // Something 'odd' happened } else { if (tc.isWarningEnabled()) { Tr.warning(tc, "future.update.not.cancelled.CWMCG0016E", this); // depends on control dependency: [if], data = [none] } } } } future = null; // depends on control dependency: [if], data = [none] } } finally { if (this.localExecutor) { this.executor.shutdown(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void setStylesSplit(TextView split) { if(split!=null){ split.setText(mSplit); split.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); split.setGravity(Gravity.CENTER_VERTICAL); if (mColorSplit != PinViewSettings.DEFAULT_COLOR_SPLIT) { split.setTextColor(mColorSplit); } split.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mSizeSplit)); } } }
public class class_name { private void setStylesSplit(TextView split) { if(split!=null){ split.setText(mSplit); // depends on control dependency: [if], data = [none] split.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); // depends on control dependency: [if], data = [none] split.setGravity(Gravity.CENTER_VERTICAL); // depends on control dependency: [if], data = [none] if (mColorSplit != PinViewSettings.DEFAULT_COLOR_SPLIT) { split.setTextColor(mColorSplit); // depends on control dependency: [if], data = [(mColorSplit] } split.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mSizeSplit)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nullable public Container getContainerWithId(@Nonnull String id) { if (id == null || id.trim().length() == 0) { throw new IllegalArgumentException("A container ID must be provided."); } for (Container container : getContainers()) { if (container.getId().equals(id)) { return container; } } return null; } }
public class class_name { @Nullable public Container getContainerWithId(@Nonnull String id) { if (id == null || id.trim().length() == 0) { throw new IllegalArgumentException("A container ID must be provided."); } for (Container container : getContainers()) { if (container.getId().equals(id)) { return container; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) { if (ArrayUtils.isNotEmpty(searchStrings)) { for (final CharSequence next : searchStrings) { if (equals(string, next)) { return true; } } } return false; } }
public class class_name { public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings) { if (ArrayUtils.isNotEmpty(searchStrings)) { for (final CharSequence next : searchStrings) { if (equals(string, next)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public static String changeCharset(CharSequence cs, Charset newCharset) { if (cs != null) { byte[] bs = cs.toString().getBytes(); return new String(bs, newCharset); } return null; } }
public class class_name { public static String changeCharset(CharSequence cs, Charset newCharset) { if (cs != null) { byte[] bs = cs.toString().getBytes(); return new String(bs, newCharset); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) private <K,V> Region<K,V> createRegion(String regionName) { if(regionName.startsWith("/")) regionName = regionName.substring(1); //remove prefix CacheListenerBridge<K, V> listener = (CacheListenerBridge)this.listenerMap.get(regionName); if(listener != null) { ClientRegionFactory<K, V> listenerRegionFactory = null; if(this.cachingProxy) listenerRegionFactory = this.clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY); else listenerRegionFactory = this.clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY); listenerRegionFactory.addCacheListener((CacheListener)listener); Region<K,V> region = listenerRegionFactory.create(regionName); region.registerInterestRegex(".*"); return region; } if(this.cachingProxy) return (Region<K,V>)this.cachingRegionfactory.create(regionName); else return (Region<K,V>)this.proxyRegionfactory.create(regionName); } }
public class class_name { @SuppressWarnings({ "unchecked", "rawtypes" }) private <K,V> Region<K,V> createRegion(String regionName) { if(regionName.startsWith("/")) regionName = regionName.substring(1); //remove prefix CacheListenerBridge<K, V> listener = (CacheListenerBridge)this.listenerMap.get(regionName); if(listener != null) { ClientRegionFactory<K, V> listenerRegionFactory = null; if(this.cachingProxy) listenerRegionFactory = this.clientCache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY); else listenerRegionFactory = this.clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY); listenerRegionFactory.addCacheListener((CacheListener)listener); // depends on control dependency: [if], data = [none] Region<K,V> region = listenerRegionFactory.create(regionName); region.registerInterestRegex(".*"); // depends on control dependency: [if], data = [none] return region; // depends on control dependency: [if], data = [none] } if(this.cachingProxy) return (Region<K,V>)this.cachingRegionfactory.create(regionName); else return (Region<K,V>)this.proxyRegionfactory.create(regionName); } }
public class class_name { private void readResourceAssignment(Task task, Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment) { Resource resource = m_projectFile.getResourceByUniqueID(assignment.getResourceID()); if (resource != null) { ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource); mpxjAssignment.setUniqueID(assignment.getID()); mpxjAssignment.setWork(Duration.getInstance(assignment.getManHour().doubleValue() * m_workHoursPerDay, TimeUnit.HOURS)); mpxjAssignment.setUnits(assignment.getUse()); } } }
public class class_name { private void readResourceAssignment(Task task, Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment) { Resource resource = m_projectFile.getResourceByUniqueID(assignment.getResourceID()); if (resource != null) { ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource); mpxjAssignment.setUniqueID(assignment.getID()); // depends on control dependency: [if], data = [none] mpxjAssignment.setWork(Duration.getInstance(assignment.getManHour().doubleValue() * m_workHoursPerDay, TimeUnit.HOURS)); // depends on control dependency: [if], data = [none] mpxjAssignment.setUnits(assignment.getUse()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean isHeaderExternal(String host, int port,String transport, boolean isIpv6) { if(!isIpv6) { if (host.equalsIgnoreCase(balancerRunner.balancerContext.externalHost)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(host.equalsIgnoreCase(balancerRunner.balancerContext.internalHost)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(balancerRunner.balancerContext.externalIpLoadBalancerAddresses!=null&& balancerRunner.balancerContext.externalIpLoadBalancerAddresses.contains(host)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(balancerRunner.balancerContext.internalIpLoadBalancerAddresses!=null&& balancerRunner.balancerContext.internalIpLoadBalancerAddresses.contains(host)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(host.equalsIgnoreCase(balancerRunner.balancerContext.publicIP)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } return true; } else { String cleanHost=host; if(cleanHost.startsWith("[")) cleanHost=cleanHost.substring(1); if(cleanHost.endsWith("]")) cleanHost=cleanHost.substring(0,cleanHost.length()-1); InetAddress address=null; try { address=InetAddress.getByName(cleanHost); } catch(UnknownHostException ex) { } if(address==null) return false; if (address.equals(balancerRunner.balancerContext.externalIpv6HostAddress)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(address.equals(balancerRunner.balancerContext.internalIpv6HostAddress)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(balancerRunner.balancerContext.externalIpv6LoadBalancerAddressHosts.contains(address)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(balancerRunner.balancerContext.internalIpv6LoadBalancerAddressHosts.contains(address)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(address.equals(balancerRunner.balancerContext.publicIPv6Host)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } return true; } } }
public class class_name { private boolean isHeaderExternal(String host, int port,String transport, boolean isIpv6) { if(!isIpv6) { if (host.equalsIgnoreCase(balancerRunner.balancerContext.externalHost)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(host.equalsIgnoreCase(balancerRunner.balancerContext.internalHost)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(balancerRunner.balancerContext.externalIpLoadBalancerAddresses!=null&& balancerRunner.balancerContext.externalIpLoadBalancerAddresses.contains(host)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(balancerRunner.balancerContext.internalIpLoadBalancerAddresses!=null&& balancerRunner.balancerContext.internalIpLoadBalancerAddresses.contains(host)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } if(host.equalsIgnoreCase(balancerRunner.balancerContext.publicIP)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalPortByTransport(transport,false)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,false)==port) return false; } return true; // depends on control dependency: [if], data = [none] } else { String cleanHost=host; if(cleanHost.startsWith("[")) cleanHost=cleanHost.substring(1); if(cleanHost.endsWith("]")) cleanHost=cleanHost.substring(0,cleanHost.length()-1); InetAddress address=null; try { address=InetAddress.getByName(cleanHost); // depends on control dependency: [try], data = [none] } catch(UnknownHostException ex) { } // depends on control dependency: [catch], data = [none] if(address==null) return false; if (address.equals(balancerRunner.balancerContext.externalIpv6HostAddress)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(address.equals(balancerRunner.balancerContext.internalIpv6HostAddress)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(balancerRunner.balancerContext.externalIpv6LoadBalancerAddressHosts.contains(address)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(balancerRunner.balancerContext.internalIpv6LoadBalancerAddressHosts.contains(address)) { if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } if(address.equals(balancerRunner.balancerContext.publicIPv6Host)) { if(balancerRunner.balancerContext.getExternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getExternalLoadBalancerPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalPortByTransport(transport,true)==port) return false; if(balancerRunner.balancerContext.getInternalLoadBalancerPortByTransport(transport,true)==port) return false; } return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setCheckedImmediately(boolean checked){ if(mChecked != checked) { mChecked = checked; if(mOnCheckedChangeListener != null) mOnCheckedChangeListener.onCheckedChanged(this, mChecked); } mThumbPosition = mChecked ? 1f : 0f; invalidate(); } }
public class class_name { public void setCheckedImmediately(boolean checked){ if(mChecked != checked) { mChecked = checked; // depends on control dependency: [if], data = [none] if(mOnCheckedChangeListener != null) mOnCheckedChangeListener.onCheckedChanged(this, mChecked); } mThumbPosition = mChecked ? 1f : 0f; invalidate(); } }
public class class_name { @Override public Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) { ReactiveAdapter adapter = getAdapterRegistry().getAdapter(parameter.getParameterType()); Mono<SecurityContext> reactiveSecurityContext = ReactiveSecurityContextHolder.getContext(); if (reactiveSecurityContext == null) { return null; } return reactiveSecurityContext.flatMap( a -> { Object p = resolveSecurityContext(parameter, a); Mono<Object> o = Mono.justOrEmpty(p); return adapter == null ? o : Mono.just(adapter.fromPublisher(o)); }); } }
public class class_name { @Override public Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) { ReactiveAdapter adapter = getAdapterRegistry().getAdapter(parameter.getParameterType()); Mono<SecurityContext> reactiveSecurityContext = ReactiveSecurityContextHolder.getContext(); if (reactiveSecurityContext == null) { return null; // depends on control dependency: [if], data = [none] } return reactiveSecurityContext.flatMap( a -> { Object p = resolveSecurityContext(parameter, a); Mono<Object> o = Mono.justOrEmpty(p); return adapter == null ? o : Mono.just(adapter.fromPublisher(o)); }); } }
public class class_name { public static void refreshedFiles(String[] filePaths) { for (String filePath : filePaths) { IFile file = CommonServices.getFileSystem().getIFile(new File(filePath)); if (file != null) { TypeSystem.refreshed(file); } } } }
public class class_name { public static void refreshedFiles(String[] filePaths) { for (String filePath : filePaths) { IFile file = CommonServices.getFileSystem().getIFile(new File(filePath)); if (file != null) { TypeSystem.refreshed(file); // depends on control dependency: [if], data = [(file] } } } }
public class class_name { public static Sql[] getAlterTableSqls(Database database, SQLiteDatabase.AlterTableVisitor alterTableVisitor, String catalogName, String schemaName, String tableName) { Sql[] generatedSqls; try { List<SqlStatement> statements = SQLiteDatabase.getAlterTableStatements(alterTableVisitor, database, catalogName, schemaName, tableName); // convert from SqlStatement to Sql SqlStatement[] sqlStatements = new SqlStatement[statements.size()]; sqlStatements = statements.toArray(sqlStatements); generatedSqls = SqlGeneratorFactory.getInstance().generateSql(sqlStatements, database); } catch (DatabaseException e) { throw new UnexpectedLiquibaseException(e); } return generatedSqls; } }
public class class_name { public static Sql[] getAlterTableSqls(Database database, SQLiteDatabase.AlterTableVisitor alterTableVisitor, String catalogName, String schemaName, String tableName) { Sql[] generatedSqls; try { List<SqlStatement> statements = SQLiteDatabase.getAlterTableStatements(alterTableVisitor, database, catalogName, schemaName, tableName); // convert from SqlStatement to Sql SqlStatement[] sqlStatements = new SqlStatement[statements.size()]; sqlStatements = statements.toArray(sqlStatements); // depends on control dependency: [try], data = [none] generatedSqls = SqlGeneratorFactory.getInstance().generateSql(sqlStatements, database); // depends on control dependency: [try], data = [none] } catch (DatabaseException e) { throw new UnexpectedLiquibaseException(e); } // depends on control dependency: [catch], data = [none] return generatedSqls; } }
public class class_name { public static boolean sameWeek(Date dateOne, Date dateTwo) { if ((dateOne == null) || (dateTwo == null)) { return false; } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int week = cal.get(Calendar.WEEK_OF_YEAR); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int week2 = cal.get(Calendar.WEEK_OF_YEAR); return ( (year == year2) && (week == week2) ); } }
public class class_name { public static boolean sameWeek(Date dateOne, Date dateTwo) { if ((dateOne == null) || (dateTwo == null)) { return false; // depends on control dependency: [if], data = [none] } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int week = cal.get(Calendar.WEEK_OF_YEAR); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int week2 = cal.get(Calendar.WEEK_OF_YEAR); return ( (year == year2) && (week == week2) ); } }
public class class_name { public void addNcsEquivalent(StructureInterface interfaceNew, StructureInterface interfaceRef) { this.add(interfaceNew); if (clustersNcs == null) { clustersNcs = new ArrayList<>(); } if (interfaceRef == null) { StructureInterfaceCluster newCluster = new StructureInterfaceCluster(); newCluster.addMember(interfaceNew); clustersNcs.add(newCluster); return; } Optional<StructureInterfaceCluster> clusterRef = clustersNcs.stream(). filter(r->r.getMembers().stream(). anyMatch(c -> c.equals(interfaceRef))). findFirst(); if (clusterRef.isPresent()) { clusterRef.get().addMember(interfaceNew); return; } logger.warn("The specified reference interface, if not null, should have been added to this set previously. " + "Creating new cluster and adding both interfaces. This is likely a bug."); this.add(interfaceRef); StructureInterfaceCluster newCluster = new StructureInterfaceCluster(); newCluster.addMember(interfaceRef); newCluster.addMember(interfaceNew); clustersNcs.add(newCluster); } }
public class class_name { public void addNcsEquivalent(StructureInterface interfaceNew, StructureInterface interfaceRef) { this.add(interfaceNew); if (clustersNcs == null) { clustersNcs = new ArrayList<>(); // depends on control dependency: [if], data = [none] } if (interfaceRef == null) { StructureInterfaceCluster newCluster = new StructureInterfaceCluster(); newCluster.addMember(interfaceNew); // depends on control dependency: [if], data = [none] clustersNcs.add(newCluster); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } Optional<StructureInterfaceCluster> clusterRef = clustersNcs.stream(). filter(r->r.getMembers().stream(). anyMatch(c -> c.equals(interfaceRef))). findFirst(); if (clusterRef.isPresent()) { clusterRef.get().addMember(interfaceNew); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } logger.warn("The specified reference interface, if not null, should have been added to this set previously. " + "Creating new cluster and adding both interfaces. This is likely a bug."); this.add(interfaceRef); StructureInterfaceCluster newCluster = new StructureInterfaceCluster(); newCluster.addMember(interfaceRef); newCluster.addMember(interfaceNew); clustersNcs.add(newCluster); } }
public class class_name { @Override public Connection getConnection(String dsName, boolean startTransaction) { try { Connection conn = DbcHelper.getConnection(id + "-" + dsName, startTransaction); if (conn != null) { return (Connection) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { Connection.class }, new MyConnectionInvocationHandler(conn)); } return null; } catch (SQLException e) { throw new DaoException(e); } } }
public class class_name { @Override public Connection getConnection(String dsName, boolean startTransaction) { try { Connection conn = DbcHelper.getConnection(id + "-" + dsName, startTransaction); if (conn != null) { return (Connection) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { Connection.class }, new MyConnectionInvocationHandler(conn)); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new DaoException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void inlineCssNodes(final Document doc, final String basePath) { if (doc == null) return; final String fixedBasePath = basePath == null ? "" : basePath; final List<Node> nodes = XMLUtilities.getChildNodes(doc.getDocumentElement(), "link"); for (final Node node : nodes) { final NamedNodeMap attributes = node.getAttributes(); final Node relAttribute = attributes.getNamedItem("rel"); final Node hrefAttribute = attributes.getNamedItem("href"); final Node mediaAttribute = attributes.getNamedItem("media"); if (relAttribute != null && relAttribute.getTextContent().equals("stylesheet") && hrefAttribute != null) { final String href = hrefAttribute.getTextContent(); final File hrefFile = new File(fixedBasePath + "/" + href); if (hrefFile.exists()) { // find the base path for any import statements that // might be in the css file String cssBasePath = ""; int end = href.lastIndexOf("/"); if (end == -1) end = href.lastIndexOf("\\"); if (end != -1) cssBasePath = href.substring(0, end); final String fileString = inlineCssImports(FileUtilities.readFileContents(hrefFile), basePath + "/" + cssBasePath); final Node parent = node.getParentNode(); if (parent != null) { final Element newNode = doc.createElement("style"); newNode.setAttribute("type", "text/css"); if (mediaAttribute != null) newNode.setAttribute("media", mediaAttribute.getTextContent()); newNode.setTextContent(fileString); parent.replaceChild(newNode, node); } } } } } }
public class class_name { private static void inlineCssNodes(final Document doc, final String basePath) { if (doc == null) return; final String fixedBasePath = basePath == null ? "" : basePath; final List<Node> nodes = XMLUtilities.getChildNodes(doc.getDocumentElement(), "link"); for (final Node node : nodes) { final NamedNodeMap attributes = node.getAttributes(); final Node relAttribute = attributes.getNamedItem("rel"); final Node hrefAttribute = attributes.getNamedItem("href"); final Node mediaAttribute = attributes.getNamedItem("media"); if (relAttribute != null && relAttribute.getTextContent().equals("stylesheet") && hrefAttribute != null) { final String href = hrefAttribute.getTextContent(); final File hrefFile = new File(fixedBasePath + "/" + href); if (hrefFile.exists()) { // find the base path for any import statements that // might be in the css file String cssBasePath = ""; int end = href.lastIndexOf("/"); if (end == -1) end = href.lastIndexOf("\\"); if (end != -1) cssBasePath = href.substring(0, end); final String fileString = inlineCssImports(FileUtilities.readFileContents(hrefFile), basePath + "/" + cssBasePath); final Node parent = node.getParentNode(); if (parent != null) { final Element newNode = doc.createElement("style"); newNode.setAttribute("type", "text/css"); // depends on control dependency: [if], data = [none] if (mediaAttribute != null) newNode.setAttribute("media", mediaAttribute.getTextContent()); newNode.setTextContent(fileString); // depends on control dependency: [if], data = [none] parent.replaceChild(newNode, node); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public Map<Integer, Integer> updateBuckets(Map<Integer, Integer> oldBuckets, List<Integer> members) { if (isEmpty(members)) { throw new IllegalArgumentException("newMembers must be not null"); } /* Create a new map */ if (isEmpty(oldBuckets)) { Map<Integer, Integer> newBuckets = new HashMap<>(); for (int i = 0; i < members.size(); i++) { newBuckets.put(i, members.get(i)); } return newBuckets; } Map<Integer, Integer> newBuckets = new HashMap<>(); int newBucket = 0; while (newBucket < members.size()) { int bucket = 0; boolean placed = false; while (bucket < oldBuckets.size() && !placed) { Integer oldMember = oldBuckets.get(bucket); if (!newBuckets.containsValue(oldMember) && members.contains(oldMember) && (bucket == newBucket || bucket >= members.size())) { newBuckets.put(newBucket, oldMember); placed = true; } else { bucket++; } } if (bucket == oldBuckets.size() && !placed) { newBuckets.put(newBucket, members.get(newBucket)); } newBucket++; } return newBuckets; } }
public class class_name { public Map<Integer, Integer> updateBuckets(Map<Integer, Integer> oldBuckets, List<Integer> members) { if (isEmpty(members)) { throw new IllegalArgumentException("newMembers must be not null"); } /* Create a new map */ if (isEmpty(oldBuckets)) { Map<Integer, Integer> newBuckets = new HashMap<>(); for (int i = 0; i < members.size(); i++) { newBuckets.put(i, members.get(i)); // depends on control dependency: [for], data = [i] } return newBuckets; // depends on control dependency: [if], data = [none] } Map<Integer, Integer> newBuckets = new HashMap<>(); int newBucket = 0; while (newBucket < members.size()) { int bucket = 0; boolean placed = false; while (bucket < oldBuckets.size() && !placed) { Integer oldMember = oldBuckets.get(bucket); if (!newBuckets.containsValue(oldMember) && members.contains(oldMember) && (bucket == newBucket || bucket >= members.size())) { newBuckets.put(newBucket, oldMember); // depends on control dependency: [if], data = [none] placed = true; // depends on control dependency: [if], data = [none] } else { bucket++; // depends on control dependency: [if], data = [none] } } if (bucket == oldBuckets.size() && !placed) { newBuckets.put(newBucket, members.get(newBucket)); // depends on control dependency: [if], data = [none] } newBucket++; // depends on control dependency: [while], data = [none] } return newBuckets; } }
public class class_name { public static BBox parseTwoPoints(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); double minLat = Double.parseDouble(splittedObject[0]); double minLon = Double.parseDouble(splittedObject[1]); double maxLat = Double.parseDouble(splittedObject[2]); double maxLon = Double.parseDouble(splittedObject[3]); if (minLat > maxLat) { double tmp = minLat; minLat = maxLat; maxLat = tmp; } if (minLon > maxLon) { double tmp = minLon; minLon = maxLon; maxLon = tmp; } return new BBox(minLon, maxLon, minLat, maxLat); } }
public class class_name { public static BBox parseTwoPoints(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); double minLat = Double.parseDouble(splittedObject[0]); double minLon = Double.parseDouble(splittedObject[1]); double maxLat = Double.parseDouble(splittedObject[2]); double maxLon = Double.parseDouble(splittedObject[3]); if (minLat > maxLat) { double tmp = minLat; minLat = maxLat; // depends on control dependency: [if], data = [none] maxLat = tmp; // depends on control dependency: [if], data = [none] } if (minLon > maxLon) { double tmp = minLon; minLon = maxLon; // depends on control dependency: [if], data = [none] maxLon = tmp; // depends on control dependency: [if], data = [none] } return new BBox(minLon, maxLon, minLat, maxLat); } }
public class class_name { private void doMultiMapKeys(final Message<JsonObject> message) { final String name = message.body().getString("name"); if (name == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified.")); return; } context.execute(new Action<Set<Object>>() { @Override public Set<Object> perform() { return data.getMultiMap(formatKey(name)).keySet(); } }, new Handler<AsyncResult<Set<Object>>>() { @Override public void handle(AsyncResult<Set<Object>> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); } else { message.reply(new JsonObject().putString("status", "ok").putArray("result", new JsonArray(result.result().toArray(new Object[result.result().size()])))); } } }); } }
public class class_name { private void doMultiMapKeys(final Message<JsonObject> message) { final String name = message.body().getString("name"); if (name == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } context.execute(new Action<Set<Object>>() { @Override public Set<Object> perform() { return data.getMultiMap(formatKey(name)).keySet(); } }, new Handler<AsyncResult<Set<Object>>>() { @Override public void handle(AsyncResult<Set<Object>> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none] } else { message.reply(new JsonObject().putString("status", "ok").putArray("result", new JsonArray(result.result().toArray(new Object[result.result().size()])))); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public void restoreUncommitted(SIMPMessage m) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "restoreUncommitted", new Object[] { m }); TickRange tr = null; JsMessage jsMsg = m.getMessage(); long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "restoreUncommitted at: " + stamp + " on Stream " + stream); } synchronized (this) { // write into stream tr = TickRange.newUncommittedTick(stamp); tr.startstamp = starts; tr.endstamp = ends; // Save message in the stream while it is Uncommitted // It will be replaced by its index in the ItemStream once it becomes a Value tr.value = m; oststream.writeCombinedRange(tr); } // end synchronized if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreUncommitted"); } }
public class class_name { public void restoreUncommitted(SIMPMessage m) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "restoreUncommitted", new Object[] { m }); TickRange tr = null; JsMessage jsMsg = m.getMessage(); long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "restoreUncommitted at: " + stamp + " on Stream " + stream); // depends on control dependency: [if], data = [none] } synchronized (this) { // write into stream tr = TickRange.newUncommittedTick(stamp); tr.startstamp = starts; tr.endstamp = ends; // Save message in the stream while it is Uncommitted // It will be replaced by its index in the ItemStream once it becomes a Value tr.value = m; oststream.writeCombinedRange(tr); } // end synchronized if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreUncommitted"); } }
public class class_name { @Override public Result<K, V> apply(final Result<K, V> previousOperation) { if(previousOperation == null) { return this; } else { return previousOperation; } } }
public class class_name { @Override public Result<K, V> apply(final Result<K, V> previousOperation) { if(previousOperation == null) { return this; // depends on control dependency: [if], data = [none] } else { return previousOperation; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void shutdown(String instanceName) { HazelcastClientProxy proxy = CLIENTS.remove(instanceName); if (proxy == null) { return; } HazelcastClientInstanceImpl client = proxy.client; if (client == null) { return; } proxy.client = null; try { client.shutdown(); } catch (Throwable ignored) { EmptyStatement.ignore(ignored); } finally { OutOfMemoryErrorDispatcher.deregisterClient(client); } } }
public class class_name { public static void shutdown(String instanceName) { HazelcastClientProxy proxy = CLIENTS.remove(instanceName); if (proxy == null) { return; // depends on control dependency: [if], data = [none] } HazelcastClientInstanceImpl client = proxy.client; if (client == null) { return; // depends on control dependency: [if], data = [none] } proxy.client = null; try { client.shutdown(); // depends on control dependency: [try], data = [none] } catch (Throwable ignored) { EmptyStatement.ignore(ignored); } finally { // depends on control dependency: [catch], data = [none] OutOfMemoryErrorDispatcher.deregisterClient(client); } } }
public class class_name { private void addSubscriptionsToBus(BusGroup group, String busId) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addSubscriptionsToBus", new Object[]{group, busId}); // Get the complete list of Subscriptions from the MatchSpace // and assign to the BusGroup. final ArrayList cdList = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .getAllCDMatchTargets(); // Iterate through the list of available "subscriptions". final Iterator cdIterator = cdList.listIterator(); while (cdIterator.hasNext()) { // Get the Consumer Dispatcher for this element. final ConsumerDispatcher cd = (ConsumerDispatcher) cdIterator.next(); // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. group.addLocalSubscription(cd.getConsumerDispatcherState(), null, null, false); } // Add proxy subscriptions that have been registered by // Neighbouring ME's. final ArrayList phList = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .getAllPubSubOutputHandlerMatchTargets(); final ArrayList outputSeenList = new ArrayList(); final Iterator phIterator = phList.listIterator(); while (phIterator.hasNext()) { // Get the PubSub OutputHandler for this element. final PubSubOutputHandler oh = (PubSubOutputHandler) phIterator.next(); if (!outputSeenList.contains(oh) && oh.neighbourOnDifferentBus(busId)) { // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. final String topics[] = oh.getTopics(); final SIBUuid12 topicSpaceUuid = oh.getTopicSpaceUuid(); if (topics != null && topics.length > 0) { for (int i=0; i<topics.length; i++) { group.addRemoteSubscription(topicSpaceUuid, topics[i], null, false); } } // Add the neighbour to the list of seen Neighbours. outputSeenList.add(oh); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addSubscriptionsToBus"); } }
public class class_name { private void addSubscriptionsToBus(BusGroup group, String busId) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addSubscriptionsToBus", new Object[]{group, busId}); // Get the complete list of Subscriptions from the MatchSpace // and assign to the BusGroup. final ArrayList cdList = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .getAllCDMatchTargets(); // Iterate through the list of available "subscriptions". final Iterator cdIterator = cdList.listIterator(); while (cdIterator.hasNext()) { // Get the Consumer Dispatcher for this element. final ConsumerDispatcher cd = (ConsumerDispatcher) cdIterator.next(); // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. group.addLocalSubscription(cd.getConsumerDispatcherState(), null, null, false); // depends on control dependency: [while], data = [none] } // Add proxy subscriptions that have been registered by // Neighbouring ME's. final ArrayList phList = _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .getAllPubSubOutputHandlerMatchTargets(); final ArrayList outputSeenList = new ArrayList(); final Iterator phIterator = phList.listIterator(); while (phIterator.hasNext()) { // Get the PubSub OutputHandler for this element. final PubSubOutputHandler oh = (PubSubOutputHandler) phIterator.next(); if (!outputSeenList.contains(oh) && oh.neighbourOnDifferentBus(busId)) { // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. final String topics[] = oh.getTopics(); final SIBUuid12 topicSpaceUuid = oh.getTopicSpaceUuid(); if (topics != null && topics.length > 0) { for (int i=0; i<topics.length; i++) { group.addRemoteSubscription(topicSpaceUuid, topics[i], null, false); // depends on control dependency: [for], data = [i] } } // Add the neighbour to the list of seen Neighbours. outputSeenList.add(oh); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addSubscriptionsToBus"); } }
public class class_name { public void setWindowExecutions(java.util.Collection<MaintenanceWindowExecution> windowExecutions) { if (windowExecutions == null) { this.windowExecutions = null; return; } this.windowExecutions = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecution>(windowExecutions); } }
public class class_name { public void setWindowExecutions(java.util.Collection<MaintenanceWindowExecution> windowExecutions) { if (windowExecutions == null) { this.windowExecutions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.windowExecutions = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecution>(windowExecutions); } }
public class class_name { public static void waitUntilNoActivityUpTo(Jenkins jenkins, int timeout) throws Exception { long startTime = System.currentTimeMillis(); int streak = 0; while (true) { Thread.sleep(10); if (isSomethingHappening(jenkins)) { streak = 0; } else { streak++; } if (streak > 5) { // the system is quiet for a while return; } if (System.currentTimeMillis() - startTime > timeout) { List<Queue.Executable> building = new ArrayList<Queue.Executable>(); for (Computer c : jenkins.getComputers()) { for (Executor e : c.getExecutors()) { if (e.isBusy()) building.add(e.getCurrentExecutable()); } for (Executor e : c.getOneOffExecutors()) { if (e.isBusy()) building.add(e.getCurrentExecutable()); } } dumpThreads(); throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s", timeout, Arrays.asList(jenkins.getQueue().getItems()), building)); } } } }
public class class_name { public static void waitUntilNoActivityUpTo(Jenkins jenkins, int timeout) throws Exception { long startTime = System.currentTimeMillis(); int streak = 0; while (true) { Thread.sleep(10); if (isSomethingHappening(jenkins)) { streak = 0; // depends on control dependency: [if], data = [none] } else { streak++; // depends on control dependency: [if], data = [none] } if (streak > 5) { // the system is quiet for a while return; // depends on control dependency: [if], data = [none] } if (System.currentTimeMillis() - startTime > timeout) { List<Queue.Executable> building = new ArrayList<Queue.Executable>(); for (Computer c : jenkins.getComputers()) { for (Executor e : c.getExecutors()) { if (e.isBusy()) building.add(e.getCurrentExecutable()); } for (Executor e : c.getOneOffExecutors()) { if (e.isBusy()) building.add(e.getCurrentExecutable()); } } dumpThreads(); // depends on control dependency: [if], data = [none] throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s", timeout, Arrays.asList(jenkins.getQueue().getItems()), building)); } } } }
public class class_name { public PdfDictionary getAsDict(PdfName key) { PdfDictionary dict = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isDictionary()) { dict = (PdfDictionary) orig; } return dict; } }
public class class_name { public PdfDictionary getAsDict(PdfName key) { PdfDictionary dict = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isDictionary()) { dict = (PdfDictionary) orig; // depends on control dependency: [if], data = [none] } return dict; } }
public class class_name { public EClass getIfcLogical() { if (ifcLogicalEClass == null) { ifcLogicalEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(699); } return ifcLogicalEClass; } }
public class class_name { public EClass getIfcLogical() { if (ifcLogicalEClass == null) { ifcLogicalEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(699); // depends on control dependency: [if], data = [none] } return ifcLogicalEClass; } }
public class class_name { private static String getDuration(long millis) { long tsec = millis / 1000; long h = tsec / 60 / 60; long m = (tsec - h * 60 * 60) / 60; long s = tsec - h * 60 * 60 - m * 60; StringBuffer out = new StringBuffer(); if (h > 0) { out.append(h + " hour"); if (h > 1) { out.append('s'); } } if (m > 0) { if (h > 0) { out.append(", "); } out.append(m + " minute"); if (m > 1) { out.append('s'); } } if (s > 0 || h == 0 && m == 0) { if (h > 0 || m > 0) { out.append(", "); } out.append(s + " second"); if (s != 1) { out.append('s'); } } return out.toString(); } }
public class class_name { private static String getDuration(long millis) { long tsec = millis / 1000; long h = tsec / 60 / 60; long m = (tsec - h * 60 * 60) / 60; long s = tsec - h * 60 * 60 - m * 60; StringBuffer out = new StringBuffer(); if (h > 0) { out.append(h + " hour"); // depends on control dependency: [if], data = [(h] if (h > 1) { out.append('s'); // depends on control dependency: [if], data = [none] } } if (m > 0) { if (h > 0) { out.append(", "); // depends on control dependency: [if], data = [none] } out.append(m + " minute"); // depends on control dependency: [if], data = [(m] if (m > 1) { out.append('s'); // depends on control dependency: [if], data = [none] } } if (s > 0 || h == 0 && m == 0) { if (h > 0 || m > 0) { out.append(", "); // depends on control dependency: [if], data = [none] } out.append(s + " second"); // depends on control dependency: [if], data = [none] if (s != 1) { out.append('s'); // depends on control dependency: [if], data = [none] } } return out.toString(); } }
public class class_name { @Override public Collection<BioPAXElement> generate(Match match, int... ind) { Collection<BioPAXElement> result = new HashSet<BioPAXElement>(); PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); for (Interaction inter : pe.getParticipantOf()) { if (inter instanceof Conversion) { Conversion cnv = (Conversion) inter; ConversionDirectionType dir = getDirection(cnv); // do not get blacklisted small molecules if (blacklist != null && blacklist.isUbique(pe, cnv, dir, type)) continue; if (dir == ConversionDirectionType.REVERSIBLE) { result.add(cnv); } else if (dir == ConversionDirectionType.RIGHT_TO_LEFT && (type == RelType.INPUT ? cnv.getRight().contains(pe) : cnv.getLeft().contains(pe))) { result.add(cnv); } // Note that null direction is treated as if LEFT_TO_RIGHT. This is not a best // practice, but it is a good approximation. else if ((dir == ConversionDirectionType.LEFT_TO_RIGHT || dir == null) && (type == RelType.INPUT ? cnv.getLeft().contains(pe) : cnv.getRight().contains(pe))) { result.add(cnv); } } } return result; } }
public class class_name { @Override public Collection<BioPAXElement> generate(Match match, int... ind) { Collection<BioPAXElement> result = new HashSet<BioPAXElement>(); PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]); for (Interaction inter : pe.getParticipantOf()) { if (inter instanceof Conversion) { Conversion cnv = (Conversion) inter; ConversionDirectionType dir = getDirection(cnv); // do not get blacklisted small molecules if (blacklist != null && blacklist.isUbique(pe, cnv, dir, type)) continue; if (dir == ConversionDirectionType.REVERSIBLE) { result.add(cnv); // depends on control dependency: [if], data = [none] } else if (dir == ConversionDirectionType.RIGHT_TO_LEFT && (type == RelType.INPUT ? cnv.getRight().contains(pe) : cnv.getLeft().contains(pe))) { result.add(cnv); // depends on control dependency: [if], data = [none] } // Note that null direction is treated as if LEFT_TO_RIGHT. This is not a best // practice, but it is a good approximation. else if ((dir == ConversionDirectionType.LEFT_TO_RIGHT || dir == null) && (type == RelType.INPUT ? cnv.getLeft().contains(pe) : cnv.getRight().contains(pe))) { result.add(cnv); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet) { TypedArray typedArray = getContext().obtainStyledAttributes(attributeSet, R.styleable.Chip); try { obtainText(typedArray); obtainTextColor(typedArray); obtainColor(typedArray); obtainIcon(typedArray); obtainClosable(typedArray); obtainCloseIcon(typedArray); } finally { typedArray.recycle(); } } }
public class class_name { private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet) { TypedArray typedArray = getContext().obtainStyledAttributes(attributeSet, R.styleable.Chip); try { obtainText(typedArray); // depends on control dependency: [try], data = [none] obtainTextColor(typedArray); // depends on control dependency: [try], data = [none] obtainColor(typedArray); // depends on control dependency: [try], data = [none] obtainIcon(typedArray); // depends on control dependency: [try], data = [none] obtainClosable(typedArray); // depends on control dependency: [try], data = [none] obtainCloseIcon(typedArray); // depends on control dependency: [try], data = [none] } finally { typedArray.recycle(); } } }
public class class_name { public final String getCallSignature() { final StringBuffer sb = new StringBuffer(); sb.append(getName()); sb.append("("); for (int i = 0; i < getArguments().size(); i++) { if (i > 0) { sb.append(", "); } final SgArgument arg = getArguments().get(i); sb.append(arg.getName()); } sb.append(")"); return sb.toString(); } }
public class class_name { public final String getCallSignature() { final StringBuffer sb = new StringBuffer(); sb.append(getName()); sb.append("("); for (int i = 0; i < getArguments().size(); i++) { if (i > 0) { sb.append(", "); // depends on control dependency: [if], data = [none] } final SgArgument arg = getArguments().get(i); sb.append(arg.getName()); // depends on control dependency: [for], data = [none] } sb.append(")"); return sb.toString(); } }
public class class_name { private static <T> T statementToObject(final PreparedStatement stmt, final T target, final Object... args) throws SQLException { populateStatementParameters(stmt, args); try (final ResultSet resultSet = stmt.executeQuery()) { if (resultSet.next()) { return resultSetToObject(resultSet, target); } return null; } catch (Exception e) { throw new RuntimeException(e); } finally { stmt.close(); } } }
public class class_name { private static <T> T statementToObject(final PreparedStatement stmt, final T target, final Object... args) throws SQLException { populateStatementParameters(stmt, args); try (final ResultSet resultSet = stmt.executeQuery()) { if (resultSet.next()) { return resultSetToObject(resultSet, target); // depends on control dependency: [if], data = [none] } return null; } catch (Exception e) { throw new RuntimeException(e); } finally { stmt.close(); } } }
public class class_name { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); } }
public class class_name { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } overflowCount.increment(); } }
public class class_name { public void setOptNoAbbrev(boolean optNoAbbrev) { if (optVerbose) { if (optAbbrev && optNoAbbrev) { throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120") + " --no-abbrev cannot be used with --abbrev."); } this.optNoAbbrev = optNoAbbrev; } } }
public class class_name { public void setOptNoAbbrev(boolean optNoAbbrev) { if (optVerbose) { if (optAbbrev && optNoAbbrev) { throw new IllegalArgumentException(ExceptionMessageMap.getMessage("000120") + " --no-abbrev cannot be used with --abbrev."); } this.optNoAbbrev = optNoAbbrev; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void trainOnInstanceImpl(Instance instance) { /** * AMRules Algorithm * //For each rule in the rule set //If rule covers the instance //if the instance is not an anomaly //Update Change Detection Tests //Compute prediction error //Call PHTest //If change is detected then //Remove rule //Else //Update sufficient statistics of rule //If number of examples in rule > Nmin //Expand rule //If ordered set then //break //If none of the rule covers the instance //Update sufficient statistics of default rule //If number of examples in default rule is multiple of Nmin //Expand default rule and add it to the set of rules //Reset the default rule */ numInstances+=instance.weight(); debug("Train",3); debug("Nº instance "+numInstances + " - " + instance.toString(),3); boolean rulesCoveringInstance = false; Iterator<Rule> ruleIterator= this.ruleSet.iterator(); while (ruleIterator.hasNext()) { Rule rule = ruleIterator.next(); if (rule.isCovering(instance) == true) { rulesCoveringInstance = true; if (isAnomaly(instance, rule) == false) { //Update Change Detection Tests double error = rule.computeError(instance); //Use adaptive mode error boolean changeDetected = rule.getLearningNode().updateChangeDetection(error); if (changeDetected == true) { debug("I) Drift Detected. Exa. : " + this.numInstances + " (" + rule.getInstancesSeen() +") Remove Rule: " +rule.getRuleNumberID(),1); ruleIterator.remove(); this.numChangesDetected+=instance.weight(); //Just for statistics } else { rule.updateStatistics(instance); if (rule.getInstancesSeen() % this.gracePeriodOption.getValue() == 0.0) { if (rule.tryToExpand(this.splitConfidenceOption.getValue(), this.tieThresholdOption.getValue()) ) { rule.split(); debug("Rule Expanded:",2); debug(rule.printRule(),2); } } } } else { debug("Anomaly Detected: " + this.numInstances + " Rule: " +rule.getRuleNumberID() ,1); this.numAnomaliesDetected+=instance.weight();//Just for statistics } if (!this.unorderedRulesOption.isSet()) break; } } if (rulesCoveringInstance == false){ defaultRule.updateStatistics(instance); if (defaultRule.getInstancesSeen() % this.gracePeriodOption.getValue() == 0.0) { debug("Nr. examples "+defaultRule.getInstancesSeen(), 4); if (defaultRule.tryToExpand(this.splitConfidenceOption.getValue(), this.tieThresholdOption.getValue()) == true) { Rule newDefaultRule=newRule(defaultRule.getRuleNumberID(),defaultRule.getLearningNode(),defaultRule.getLearningNode().getStatisticsOtherBranchSplit()); //other branch defaultRule.split(); defaultRule.setRuleNumberID(++ruleNumberID); this.ruleSet.add(this.defaultRule); debug("Default rule expanded! New Rule:",2); debug(defaultRule.printRule(),2); debug("New default rule:", 3); debug(newDefaultRule.printRule(),3); defaultRule=newDefaultRule; } } } } }
public class class_name { @Override public void trainOnInstanceImpl(Instance instance) { /** * AMRules Algorithm * //For each rule in the rule set //If rule covers the instance //if the instance is not an anomaly //Update Change Detection Tests //Compute prediction error //Call PHTest //If change is detected then //Remove rule //Else //Update sufficient statistics of rule //If number of examples in rule > Nmin //Expand rule //If ordered set then //break //If none of the rule covers the instance //Update sufficient statistics of default rule //If number of examples in default rule is multiple of Nmin //Expand default rule and add it to the set of rules //Reset the default rule */ numInstances+=instance.weight(); debug("Train",3); debug("Nº instance "+numInstances + " - " + instance.toString(),3); boolean rulesCoveringInstance = false; Iterator<Rule> ruleIterator= this.ruleSet.iterator(); while (ruleIterator.hasNext()) { Rule rule = ruleIterator.next(); if (rule.isCovering(instance) == true) { rulesCoveringInstance = true; // depends on control dependency: [if], data = [none] if (isAnomaly(instance, rule) == false) { //Update Change Detection Tests double error = rule.computeError(instance); //Use adaptive mode error boolean changeDetected = rule.getLearningNode().updateChangeDetection(error); if (changeDetected == true) { debug("I) Drift Detected. Exa. : " + this.numInstances + " (" + rule.getInstancesSeen() +") Remove Rule: " +rule.getRuleNumberID(),1); // depends on control dependency: [if], data = [none] ruleIterator.remove(); // depends on control dependency: [if], data = [none] this.numChangesDetected+=instance.weight(); //Just for statistics // depends on control dependency: [if], data = [none] } else { rule.updateStatistics(instance); // depends on control dependency: [if], data = [none] if (rule.getInstancesSeen() % this.gracePeriodOption.getValue() == 0.0) { if (rule.tryToExpand(this.splitConfidenceOption.getValue(), this.tieThresholdOption.getValue()) ) { rule.split(); // depends on control dependency: [if], data = [none] debug("Rule Expanded:",2); // depends on control dependency: [if], data = [none] debug(rule.printRule(),2); // depends on control dependency: [if], data = [none] } } } } else { debug("Anomaly Detected: " + this.numInstances + " Rule: " +rule.getRuleNumberID() ,1); // depends on control dependency: [if], data = [none] this.numAnomaliesDetected+=instance.weight();//Just for statistics // depends on control dependency: [if], data = [none] } if (!this.unorderedRulesOption.isSet()) break; } } if (rulesCoveringInstance == false){ defaultRule.updateStatistics(instance); // depends on control dependency: [if], data = [none] if (defaultRule.getInstancesSeen() % this.gracePeriodOption.getValue() == 0.0) { debug("Nr. examples "+defaultRule.getInstancesSeen(), 4); // depends on control dependency: [if], data = [none] if (defaultRule.tryToExpand(this.splitConfidenceOption.getValue(), this.tieThresholdOption.getValue()) == true) { Rule newDefaultRule=newRule(defaultRule.getRuleNumberID(),defaultRule.getLearningNode(),defaultRule.getLearningNode().getStatisticsOtherBranchSplit()); //other branch defaultRule.split(); // depends on control dependency: [if], data = [none] defaultRule.setRuleNumberID(++ruleNumberID); // depends on control dependency: [if], data = [none] this.ruleSet.add(this.defaultRule); // depends on control dependency: [if], data = [none] debug("Default rule expanded! New Rule:",2); // depends on control dependency: [if], data = [none] debug(defaultRule.printRule(),2); // depends on control dependency: [if], data = [none] debug("New default rule:", 3); // depends on control dependency: [if], data = [none] debug(newDefaultRule.printRule(),3); // depends on control dependency: [if], data = [none] defaultRule=newDefaultRule; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private INDArray getMask() { // If no input is provided, no mask is used and null is returned if (inputIdx < 0) { return null; } final INDArray[] inputMaskArrays = graph.getInputMaskArrays(); return (inputMaskArrays != null ? inputMaskArrays[inputIdx] : null); } }
public class class_name { private INDArray getMask() { // If no input is provided, no mask is used and null is returned if (inputIdx < 0) { return null; // depends on control dependency: [if], data = [none] } final INDArray[] inputMaskArrays = graph.getInputMaskArrays(); return (inputMaskArrays != null ? inputMaskArrays[inputIdx] : null); } }
public class class_name { @Override public EClass getIfcEngineType() { if (ifcEngineTypeEClass == null) { ifcEngineTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(234); } return ifcEngineTypeEClass; } }
public class class_name { @Override public EClass getIfcEngineType() { if (ifcEngineTypeEClass == null) { ifcEngineTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(234); // depends on control dependency: [if], data = [none] } return ifcEngineTypeEClass; } }
public class class_name { public void trim(int ntrees) { if (ntrees > trees.length) { throw new IllegalArgumentException("The new model size is larger than the current size."); } if (ntrees <= 0) { throw new IllegalArgumentException("Invalid new model size: " + ntrees); } if (ntrees < trees.length) { trees = Arrays.copyOf(trees, ntrees); alpha = Arrays.copyOf(alpha, ntrees); error = Arrays.copyOf(error, ntrees); } } }
public class class_name { public void trim(int ntrees) { if (ntrees > trees.length) { throw new IllegalArgumentException("The new model size is larger than the current size."); } if (ntrees <= 0) { throw new IllegalArgumentException("Invalid new model size: " + ntrees); } if (ntrees < trees.length) { trees = Arrays.copyOf(trees, ntrees); // depends on control dependency: [if], data = [none] alpha = Arrays.copyOf(alpha, ntrees); // depends on control dependency: [if], data = [none] error = Arrays.copyOf(error, ntrees); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setTargetIps(java.util.Collection<TargetAddress> targetIps) { if (targetIps == null) { this.targetIps = null; return; } this.targetIps = new java.util.ArrayList<TargetAddress>(targetIps); } }
public class class_name { public void setTargetIps(java.util.Collection<TargetAddress> targetIps) { if (targetIps == null) { this.targetIps = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.targetIps = new java.util.ArrayList<TargetAddress>(targetIps); } }
public class class_name { public static int indexOfControlOrNonAscii(String input) { for (int i = 0, length = input.length(); i < length; i++) { char c = input.charAt(i); if (c <= '\u001f' || c >= '\u007f') { return i; } } return -1; } }
public class class_name { public static int indexOfControlOrNonAscii(String input) { for (int i = 0, length = input.length(); i < length; i++) { char c = input.charAt(i); if (c <= '\u001f' || c >= '\u007f') { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { protected boolean collectOptions(final Options options, final String[] args) { try { if (args != null && args.length > 0) { CommandLineParser parser = new PosixParser(); CommandLine line = parser.parse(options, args); return processLine(line, options); } return true; } catch (ParseException e) { log.error("Invalid option", e); return false; } catch (IllegalArgumentException e) { log.error("Invalid option value", e); return false; } } }
public class class_name { protected boolean collectOptions(final Options options, final String[] args) { try { if (args != null && args.length > 0) { CommandLineParser parser = new PosixParser(); CommandLine line = parser.parse(options, args); return processLine(line, options); // depends on control dependency: [if], data = [none] } return true; } catch (ParseException e) { log.error("Invalid option", e); return false; } catch (IllegalArgumentException e) { log.error("Invalid option value", e); return false; } } }
public class class_name { public java.util.List<String> getRequestedEc2SubnetIds() { if (requestedEc2SubnetIds == null) { requestedEc2SubnetIds = new com.amazonaws.internal.SdkInternalList<String>(); } return requestedEc2SubnetIds; } }
public class class_name { public java.util.List<String> getRequestedEc2SubnetIds() { if (requestedEc2SubnetIds == null) { requestedEc2SubnetIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return requestedEc2SubnetIds; } }
public class class_name { private void replicateToPeers(Action action, String appName, String id, InstanceInfo info /* optional */, InstanceStatus newStatus /* optional */, boolean isReplication) { Stopwatch tracer = action.getTimer().start(); try { if (isReplication) { numberOfReplicationsLastMin.increment(); } // If it is a replication already, do not replicate again as this will create a poison replication if (peerEurekaNodes == Collections.EMPTY_LIST || isReplication) { return; } for (final PeerEurekaNode node : peerEurekaNodes.getPeerEurekaNodes()) { // If the url represents this host, do not replicate to yourself. if (peerEurekaNodes.isThisMyUrl(node.getServiceUrl())) { continue; } replicateInstanceActionsToPeers(action, appName, id, info, newStatus, node); } } finally { tracer.stop(); } } }
public class class_name { private void replicateToPeers(Action action, String appName, String id, InstanceInfo info /* optional */, InstanceStatus newStatus /* optional */, boolean isReplication) { Stopwatch tracer = action.getTimer().start(); try { if (isReplication) { numberOfReplicationsLastMin.increment(); // depends on control dependency: [if], data = [none] } // If it is a replication already, do not replicate again as this will create a poison replication if (peerEurekaNodes == Collections.EMPTY_LIST || isReplication) { return; // depends on control dependency: [if], data = [none] } for (final PeerEurekaNode node : peerEurekaNodes.getPeerEurekaNodes()) { // If the url represents this host, do not replicate to yourself. if (peerEurekaNodes.isThisMyUrl(node.getServiceUrl())) { continue; } replicateInstanceActionsToPeers(action, appName, id, info, newStatus, node); // depends on control dependency: [for], data = [node] } } finally { tracer.stop(); } } }
public class class_name { public Session renew(final String sessionId, final String datacenter) { final URI uri = createURI("/renew/" + sessionId); final HttpRequestBuilder httpRequestBuilder = RequestUtils .getHttpRequestBuilder(datacenter, null, null, ""); HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(), ""); if (httpResponse == null || httpResponse.code() != 200) { die("Unable to renew the session", uri, httpResponse); } return fromJsonArray(httpResponse.body(), Session.class).get(0); } }
public class class_name { public Session renew(final String sessionId, final String datacenter) { final URI uri = createURI("/renew/" + sessionId); final HttpRequestBuilder httpRequestBuilder = RequestUtils .getHttpRequestBuilder(datacenter, null, null, ""); HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(), ""); if (httpResponse == null || httpResponse.code() != 200) { die("Unable to renew the session", uri, httpResponse); // depends on control dependency: [if], data = [none] } return fromJsonArray(httpResponse.body(), Session.class).get(0); } }
public class class_name { private String getDefaultSortOrderXml() throws IOException { CheckedSupplier<InputStream, IOException> createStreamFunc = () -> { if (customSortOrderFile != null) { UrlWrapper urlWrapper = new UrlWrapper(customSortOrderFile); if (urlWrapper.isUrl()) { return urlWrapper.openStream(); } else { return openCustomSortOrderFile(); } } else if (predefinedSortOrder != null) { return getPredefinedSortOrder(predefinedSortOrder); } return getPredefinedSortOrder(DEFAULT_SORT_ORDER_FILENAME); }; try (InputStream inputStream = createStreamFunc.get()) { return IOUtils.toString(inputStream, encoding); } } }
public class class_name { private String getDefaultSortOrderXml() throws IOException { CheckedSupplier<InputStream, IOException> createStreamFunc = () -> { if (customSortOrderFile != null) { UrlWrapper urlWrapper = new UrlWrapper(customSortOrderFile); if (urlWrapper.isUrl()) { return urlWrapper.openStream(); // depends on control dependency: [if], data = [none] } else { return openCustomSortOrderFile(); // depends on control dependency: [if], data = [none] } } else if (predefinedSortOrder != null) { return getPredefinedSortOrder(predefinedSortOrder); // depends on control dependency: [if], data = [(predefinedSortOrder] } return getPredefinedSortOrder(DEFAULT_SORT_ORDER_FILENAME); }; try (InputStream inputStream = createStreamFunc.get()) { return IOUtils.toString(inputStream, encoding); } } }
public class class_name { public static double calculateAverageBondLength(IReactionSet reactionSet) { double averageBondModelLength = 0.0; for (IReaction reaction : reactionSet.reactions()) { averageBondModelLength += calculateAverageBondLength(reaction); } return averageBondModelLength / reactionSet.getReactionCount(); } }
public class class_name { public static double calculateAverageBondLength(IReactionSet reactionSet) { double averageBondModelLength = 0.0; for (IReaction reaction : reactionSet.reactions()) { averageBondModelLength += calculateAverageBondLength(reaction); // depends on control dependency: [for], data = [reaction] } return averageBondModelLength / reactionSet.getReactionCount(); } }
public class class_name { public static void storeStatusUpdateTemplateNode( final AbstractGraphDatabase graphDatabase, final String templateId, final Node templateNode, final Node previousTemplateNode) { // remove node of the latest previous template version if (previousTemplateNode != null) { INDEX_STATUS_UPDATE_TEMPLATES.remove(previousTemplateNode, IDENTIFIER, templateId); } // add the new template node INDEX_STATUS_UPDATE_TEMPLATES.add(templateNode, IDENTIFIER, templateId); } }
public class class_name { public static void storeStatusUpdateTemplateNode( final AbstractGraphDatabase graphDatabase, final String templateId, final Node templateNode, final Node previousTemplateNode) { // remove node of the latest previous template version if (previousTemplateNode != null) { INDEX_STATUS_UPDATE_TEMPLATES.remove(previousTemplateNode, IDENTIFIER, templateId); // depends on control dependency: [if], data = [none] } // add the new template node INDEX_STATUS_UPDATE_TEMPLATES.add(templateNode, IDENTIFIER, templateId); } }
public class class_name { public boolean loadTxt(String path) { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(path); model_header = lineIterator.next(); if (model_header == null) return false; root = lineIterator.next(); use_distance = "1".equals(lineIterator.next()); use_valency = "1".equals(lineIterator.next()); use_cluster = "1".equals(lineIterator.next()); W1 = read_matrix(lineIterator); W2 = read_matrix(lineIterator); E = read_matrix(lineIterator); b1 = read_vector(lineIterator); saved = read_matrix(lineIterator); forms_alphabet = read_alphabet(lineIterator); postags_alphabet = read_alphabet(lineIterator); deprels_alphabet = read_alphabet(lineIterator); precomputation_id_encoder = read_map(lineIterator); if (use_cluster) { cluster4_types_alphabet = read_alphabet(lineIterator); cluster6_types_alphabet = read_alphabet(lineIterator); cluster_types_alphabet = read_alphabet(lineIterator); form_to_cluster4 = read_map(lineIterator); form_to_cluster6 = read_map(lineIterator); form_to_cluster = read_map(lineIterator); } assert !lineIterator.hasNext() : "文件有残留,可能是读取逻辑不对"; classifier = new NeuralNetworkClassifier(W1, W2, E, b1, saved, precomputation_id_encoder); classifier.canonical(); return true; } }
public class class_name { public boolean loadTxt(String path) { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(path); model_header = lineIterator.next(); if (model_header == null) return false; root = lineIterator.next(); use_distance = "1".equals(lineIterator.next()); use_valency = "1".equals(lineIterator.next()); use_cluster = "1".equals(lineIterator.next()); W1 = read_matrix(lineIterator); W2 = read_matrix(lineIterator); E = read_matrix(lineIterator); b1 = read_vector(lineIterator); saved = read_matrix(lineIterator); forms_alphabet = read_alphabet(lineIterator); postags_alphabet = read_alphabet(lineIterator); deprels_alphabet = read_alphabet(lineIterator); precomputation_id_encoder = read_map(lineIterator); if (use_cluster) { cluster4_types_alphabet = read_alphabet(lineIterator); // depends on control dependency: [if], data = [none] cluster6_types_alphabet = read_alphabet(lineIterator); // depends on control dependency: [if], data = [none] cluster_types_alphabet = read_alphabet(lineIterator); // depends on control dependency: [if], data = [none] form_to_cluster4 = read_map(lineIterator); // depends on control dependency: [if], data = [none] form_to_cluster6 = read_map(lineIterator); // depends on control dependency: [if], data = [none] form_to_cluster = read_map(lineIterator); // depends on control dependency: [if], data = [none] } assert !lineIterator.hasNext() : "文件有残留,可能是读取逻辑不对"; classifier = new NeuralNetworkClassifier(W1, W2, E, b1, saved, precomputation_id_encoder); classifier.canonical(); return true; } }
public class class_name { private CmsResource findXmlPage(CmsObject cms, String resourcename) { // get the full folder path of the resource to start from String path = cms.getRequestContext().removeSiteRoot(resourcename); // the path without the trailing slash // for example: .../xmlpage.xml/ -> .../xmlpagepage.xml String reducedPath = CmsFileUtil.removeTrailingSeparator(path); do { // check if a resource without the trailing shalsh exists boolean existResource = cms.existsResource(reducedPath); // check if the current folder exists if (cms.existsResource(path) || existResource) { // prove if a resource without the trailing slash does exist if (existResource) { // a resource without the trailing slash does exist, so take the path without the trailing slash path = reducedPath; } try { CmsResource res = cms.readResource(path); I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(res.getTypeId()); if (resType instanceof CmsResourceTypeXmlPage) { return res; } else { break; } } catch (CmsException ex) { break; } } else { // folder does not exist, go up one folder path = CmsResource.getParentFolder(path); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } } if (CmsStringUtil.isEmpty(path)) { // site root or root folder reached and no folder found break; } } while (true); return null; } }
public class class_name { private CmsResource findXmlPage(CmsObject cms, String resourcename) { // get the full folder path of the resource to start from String path = cms.getRequestContext().removeSiteRoot(resourcename); // the path without the trailing slash // for example: .../xmlpage.xml/ -> .../xmlpagepage.xml String reducedPath = CmsFileUtil.removeTrailingSeparator(path); do { // check if a resource without the trailing shalsh exists boolean existResource = cms.existsResource(reducedPath); // check if the current folder exists if (cms.existsResource(path) || existResource) { // prove if a resource without the trailing slash does exist if (existResource) { // a resource without the trailing slash does exist, so take the path without the trailing slash path = reducedPath; // depends on control dependency: [if], data = [none] } try { CmsResource res = cms.readResource(path); I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(res.getTypeId()); if (resType instanceof CmsResourceTypeXmlPage) { return res; // depends on control dependency: [if], data = [none] } else { break; } } catch (CmsException ex) { break; } // depends on control dependency: [catch], data = [none] } else { // folder does not exist, go up one folder path = CmsResource.getParentFolder(path); // depends on control dependency: [if], data = [none] if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none] } } if (CmsStringUtil.isEmpty(path)) { // site root or root folder reached and no folder found break; } } while (true); return null; } }
public class class_name { protected void update(CollectionUpdateType force) throws IOException { // this may be called from a background thread, or from checkState() request thread State localState; synchronized (lock) { if (first) { state = checkState(); state.lastInvChange = System.currentTimeMillis(); return; } // do the update in a local object localState = state.copy(); } updateCollection(localState, force); // makeDatasetTop(localState); localState.lastInvChange = System.currentTimeMillis(); // switch to live synchronized (lock) { state = localState; } } }
public class class_name { protected void update(CollectionUpdateType force) throws IOException { // this may be called from a background thread, or from checkState() request thread State localState; synchronized (lock) { if (first) { state = checkState(); // depends on control dependency: [if], data = [none] state.lastInvChange = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // do the update in a local object localState = state.copy(); } updateCollection(localState, force); // makeDatasetTop(localState); localState.lastInvChange = System.currentTimeMillis(); // switch to live synchronized (lock) { state = localState; } } }
public class class_name { protected void onRPCComplete(int asyncHandle, String data) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCComplete(asyncHandle, data); } } }
public class class_name { protected void onRPCComplete(int asyncHandle, String data) { IAsyncRPCEvent callback = getCallback(asyncHandle); if (callback != null) { callback.onRPCComplete(asyncHandle, data); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public <T> CASValue<T> gets(String key, Transcoder<T> tc) { try { return asyncGets(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for value", e); } } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } } }
public class class_name { @Override public <T> CASValue<T> gets(String key, Transcoder<T> tc) { try { return asyncGets(key, tc).get(operationTimeout, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { // depends on control dependency: [catch], data = [none] if(e.getCause() instanceof CancellationException) { throw (CancellationException) e.getCause(); } else { throw new RuntimeException("Exception waiting for value", e); } } catch (TimeoutException e) { // depends on control dependency: [catch], data = [none] throw new OperationTimeoutException("Timeout waiting for value", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void checkInParameters() { // TODO Auto-generated method stub checkNull(inFlow); if (pMode < 0 || pMode > 1) { String message = msg.message("distancetooutlet.modeOutRange"); pm.errorMessage(message); throw new IllegalArgumentException(message); } } }
public class class_name { private void checkInParameters() { // TODO Auto-generated method stub checkNull(inFlow); if (pMode < 0 || pMode > 1) { String message = msg.message("distancetooutlet.modeOutRange"); pm.errorMessage(message); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(message); } } }
public class class_name { void handleAdd() { BoofSwingUtil.checkGuiThread(); java.util.List<File> paths = browser.getSelectedFiles(); for (int i = 0; i < paths.size(); i++) { File f = paths.get(i); // if it's a directory add all the files in the directory if( f.isDirectory() ) { java.util.List<String> files = UtilIO.listAll(f.getPath()); Collections.sort(files); for (int j = 0; j < files.size(); j++) { File p = new File(files.get(j)); // Note: Can't use mimetype to determine if it's an image or not since it isn't 100% reliable if( p.isFile() ) { selected.addPath(p); } } } else { selected.addPath(f); } } } }
public class class_name { void handleAdd() { BoofSwingUtil.checkGuiThread(); java.util.List<File> paths = browser.getSelectedFiles(); for (int i = 0; i < paths.size(); i++) { File f = paths.get(i); // if it's a directory add all the files in the directory if( f.isDirectory() ) { java.util.List<String> files = UtilIO.listAll(f.getPath()); Collections.sort(files); // depends on control dependency: [if], data = [none] for (int j = 0; j < files.size(); j++) { File p = new File(files.get(j)); // Note: Can't use mimetype to determine if it's an image or not since it isn't 100% reliable if( p.isFile() ) { selected.addPath(p); // depends on control dependency: [if], data = [none] } } } else { selected.addPath(f); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(KinesisFirehoseDestination kinesisFirehoseDestination, ProtocolMarshaller protocolMarshaller) { if (kinesisFirehoseDestination == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(kinesisFirehoseDestination.getIamRoleArn(), IAMROLEARN_BINDING); protocolMarshaller.marshall(kinesisFirehoseDestination.getDeliveryStreamArn(), DELIVERYSTREAMARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(KinesisFirehoseDestination kinesisFirehoseDestination, ProtocolMarshaller protocolMarshaller) { if (kinesisFirehoseDestination == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(kinesisFirehoseDestination.getIamRoleArn(), IAMROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(kinesisFirehoseDestination.getDeliveryStreamArn(), DELIVERYSTREAMARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void main(String[] args) { BasicConfigurator.configure(new ConsoleAppender( new PatternLayout("%-5p: %m%n"))); CmdLineParser parser = new CmdLineParser(); CmdLineParser.Option help = parser.addBooleanOption('h', "help"); CmdLineParser.Option filename = parser.addStringOption('t', "torrent"); CmdLineParser.Option create = parser.addBooleanOption('c', "create"); CmdLineParser.Option pieceLength = parser.addIntegerOption('l', "length"); CmdLineParser.Option announce = parser.addStringOption('a', "announce"); try { parser.parse(args); } catch (CmdLineParser.OptionException oe) { System.err.println(oe.getMessage()); usage(System.err); System.exit(1); } // Display help and exit if requested if (Boolean.TRUE.equals(parser.getOptionValue(help))) { usage(System.out); System.exit(0); } String filenameValue = (String) parser.getOptionValue(filename); if (filenameValue == null) { usage(System.err, "Torrent file must be provided!"); System.exit(1); } Integer pieceLengthVal = (Integer) parser.getOptionValue(pieceLength); if (pieceLengthVal == null) { pieceLengthVal = TorrentCreator.DEFAULT_PIECE_LENGTH; } else { pieceLengthVal = pieceLengthVal * 1024; } logger.info("Using piece length of {} bytes.", pieceLengthVal); Boolean createFlag = (Boolean) parser.getOptionValue(create); //For repeated announce urls @SuppressWarnings("unchecked") Vector<String> announceURLs = (Vector<String>) parser.getOptionValues(announce); String[] otherArgs = parser.getRemainingArgs(); if (Boolean.TRUE.equals(createFlag) && (otherArgs.length != 1 || announceURLs.isEmpty())) { usage(System.err, "Announce URL and a file or directory must be " + "provided to create a torrent file!"); System.exit(1); } OutputStream fos = null; try { if (Boolean.TRUE.equals(createFlag)) { fos = new FileOutputStream(filenameValue); //Process the announce URLs into URIs List<URI> announceURIs = new ArrayList<URI>(); for (String url : announceURLs) { announceURIs.add(new URI(url)); } //Create the announce-list as a list of lists of URIs //Assume all the URI's are first tier trackers List<List<URI>> announceList = new ArrayList<List<URI>>(); announceList.add(announceURIs); File source = new File(otherArgs[0]); if (!source.exists() || !source.canRead()) { throw new IllegalArgumentException( "Cannot access source file or directory " + source.getName()); } String creator = String.format("%s (ttorrent)", System.getProperty("user.name")); TorrentMetadata torrent; if (source.isDirectory()) { List<File> files = new ArrayList<File>(FileUtils.listFiles(source, TrueFileFilter.TRUE, TrueFileFilter.TRUE)); Collections.sort(files); torrent = TorrentCreator.create(source, files, announceList.get(0).get(0), announceList, creator, pieceLengthVal); } else { torrent = TorrentCreator.create(source, null, announceList.get(0).get(0), announceList, creator, pieceLengthVal); } fos.write(new TorrentSerializer().serialize(torrent)); } else { new TorrentParser().parseFromFile(new File(filenameValue)); } } catch (Exception e) { logger.error("{}", e.getMessage(), e); System.exit(2); } finally { if (fos != System.out) { IOUtils.closeQuietly(fos); } } } }
public class class_name { public static void main(String[] args) { BasicConfigurator.configure(new ConsoleAppender( new PatternLayout("%-5p: %m%n"))); CmdLineParser parser = new CmdLineParser(); CmdLineParser.Option help = parser.addBooleanOption('h', "help"); CmdLineParser.Option filename = parser.addStringOption('t', "torrent"); CmdLineParser.Option create = parser.addBooleanOption('c', "create"); CmdLineParser.Option pieceLength = parser.addIntegerOption('l', "length"); CmdLineParser.Option announce = parser.addStringOption('a', "announce"); try { parser.parse(args); // depends on control dependency: [try], data = [none] } catch (CmdLineParser.OptionException oe) { System.err.println(oe.getMessage()); usage(System.err); System.exit(1); } // depends on control dependency: [catch], data = [none] // Display help and exit if requested if (Boolean.TRUE.equals(parser.getOptionValue(help))) { usage(System.out); // depends on control dependency: [if], data = [none] System.exit(0); // depends on control dependency: [if], data = [none] } String filenameValue = (String) parser.getOptionValue(filename); if (filenameValue == null) { usage(System.err, "Torrent file must be provided!"); // depends on control dependency: [if], data = [none] System.exit(1); // depends on control dependency: [if], data = [none] } Integer pieceLengthVal = (Integer) parser.getOptionValue(pieceLength); if (pieceLengthVal == null) { pieceLengthVal = TorrentCreator.DEFAULT_PIECE_LENGTH; // depends on control dependency: [if], data = [none] } else { pieceLengthVal = pieceLengthVal * 1024; // depends on control dependency: [if], data = [none] } logger.info("Using piece length of {} bytes.", pieceLengthVal); Boolean createFlag = (Boolean) parser.getOptionValue(create); //For repeated announce urls @SuppressWarnings("unchecked") Vector<String> announceURLs = (Vector<String>) parser.getOptionValues(announce); String[] otherArgs = parser.getRemainingArgs(); if (Boolean.TRUE.equals(createFlag) && (otherArgs.length != 1 || announceURLs.isEmpty())) { usage(System.err, "Announce URL and a file or directory must be " + "provided to create a torrent file!"); // depends on control dependency: [if], data = [none] System.exit(1); // depends on control dependency: [if], data = [none] } OutputStream fos = null; try { if (Boolean.TRUE.equals(createFlag)) { fos = new FileOutputStream(filenameValue); // depends on control dependency: [if], data = [none] //Process the announce URLs into URIs List<URI> announceURIs = new ArrayList<URI>(); for (String url : announceURLs) { announceURIs.add(new URI(url)); // depends on control dependency: [for], data = [url] } //Create the announce-list as a list of lists of URIs //Assume all the URI's are first tier trackers List<List<URI>> announceList = new ArrayList<List<URI>>(); announceList.add(announceURIs); // depends on control dependency: [if], data = [none] File source = new File(otherArgs[0]); if (!source.exists() || !source.canRead()) { throw new IllegalArgumentException( "Cannot access source file or directory " + source.getName()); } String creator = String.format("%s (ttorrent)", System.getProperty("user.name")); TorrentMetadata torrent; if (source.isDirectory()) { List<File> files = new ArrayList<File>(FileUtils.listFiles(source, TrueFileFilter.TRUE, TrueFileFilter.TRUE)); Collections.sort(files); torrent = TorrentCreator.create(source, files, announceList.get(0).get(0), announceList, creator, pieceLengthVal); } else { torrent = TorrentCreator.create(source, null, announceList.get(0).get(0), announceList, creator, pieceLengthVal); } fos.write(new TorrentSerializer().serialize(torrent)); } else { new TorrentParser().parseFromFile(new File(filenameValue)); } } catch (Exception e) { logger.error("{}", e.getMessage(), e); System.exit(2); // depends on control dependency: [if], data = [none] } finally { if (fos != System.out) { IOUtils.closeQuietly(fos); // depends on control dependency: [if], data = [(fos] } } } }
public class class_name { public static Charset getCharset(CharSequence contentTypeValue, Charset defaultCharset) { if (contentTypeValue != null) { CharSequence charsetCharSequence = getCharsetAsSequence(contentTypeValue); if (charsetCharSequence != null) { try { return Charset.forName(charsetCharSequence.toString()); } catch (UnsupportedCharsetException ignored) { return defaultCharset; } } else { return defaultCharset; } } else { return defaultCharset; } } }
public class class_name { public static Charset getCharset(CharSequence contentTypeValue, Charset defaultCharset) { if (contentTypeValue != null) { CharSequence charsetCharSequence = getCharsetAsSequence(contentTypeValue); if (charsetCharSequence != null) { try { return Charset.forName(charsetCharSequence.toString()); // depends on control dependency: [try], data = [none] } catch (UnsupportedCharsetException ignored) { return defaultCharset; } // depends on control dependency: [catch], data = [none] } else { return defaultCharset; // depends on control dependency: [if], data = [none] } } else { return defaultCharset; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void saveToContext(Context context, boolean updateSiteStructure) { ParameterParser urlParamParser = context.getUrlParamParser(); ParameterParser formParamParser = context.getPostParamParser(); List<String> structParams = new ArrayList<String>(); List<StructuralNodeModifier> ddns = new ArrayList<StructuralNodeModifier>(); for (StructuralNodeModifier snm : this.ddnTableModel.getElements()) { if (snm.getType().equals(StructuralNodeModifier.Type.StructuralParameter)) { structParams.add(snm.getName()); } else { ddns.add(snm); } } if (urlParamParser instanceof StandardParameterParser) { StandardParameterParser urlStdParamParser = (StandardParameterParser) urlParamParser; urlStdParamParser.setKeyValuePairSeparators(this.getUrlKvPairSeparators().getText()); urlStdParamParser.setKeyValueSeparators(this.getUrlKeyValueSeparators().getText()); urlStdParamParser.setStructuralParameters(structParams); context.setUrlParamParser(urlStdParamParser); urlStdParamParser.setContext(context); } if (formParamParser instanceof StandardParameterParser) { StandardParameterParser formStdParamParser = (StandardParameterParser) formParamParser; formStdParamParser.setKeyValuePairSeparators(this.getPostKvPairSeparators().getText()); formStdParamParser.setKeyValueSeparators(this.getPostKeyValueSeparators().getText()); context.setPostParamParser(formStdParamParser); formStdParamParser.setContext(context); } context.setDataDrivenNodes(ddns); if (updateSiteStructure) { context.restructureSiteTree(); } } }
public class class_name { private void saveToContext(Context context, boolean updateSiteStructure) { ParameterParser urlParamParser = context.getUrlParamParser(); ParameterParser formParamParser = context.getPostParamParser(); List<String> structParams = new ArrayList<String>(); List<StructuralNodeModifier> ddns = new ArrayList<StructuralNodeModifier>(); for (StructuralNodeModifier snm : this.ddnTableModel.getElements()) { if (snm.getType().equals(StructuralNodeModifier.Type.StructuralParameter)) { structParams.add(snm.getName()); // depends on control dependency: [if], data = [none] } else { ddns.add(snm); // depends on control dependency: [if], data = [none] } } if (urlParamParser instanceof StandardParameterParser) { StandardParameterParser urlStdParamParser = (StandardParameterParser) urlParamParser; urlStdParamParser.setKeyValuePairSeparators(this.getUrlKvPairSeparators().getText()); // depends on control dependency: [if], data = [none] urlStdParamParser.setKeyValueSeparators(this.getUrlKeyValueSeparators().getText()); // depends on control dependency: [if], data = [none] urlStdParamParser.setStructuralParameters(structParams); // depends on control dependency: [if], data = [none] context.setUrlParamParser(urlStdParamParser); // depends on control dependency: [if], data = [none] urlStdParamParser.setContext(context); // depends on control dependency: [if], data = [none] } if (formParamParser instanceof StandardParameterParser) { StandardParameterParser formStdParamParser = (StandardParameterParser) formParamParser; formStdParamParser.setKeyValuePairSeparators(this.getPostKvPairSeparators().getText()); // depends on control dependency: [if], data = [none] formStdParamParser.setKeyValueSeparators(this.getPostKeyValueSeparators().getText()); // depends on control dependency: [if], data = [none] context.setPostParamParser(formStdParamParser); // depends on control dependency: [if], data = [none] formStdParamParser.setContext(context); // depends on control dependency: [if], data = [none] } context.setDataDrivenNodes(ddns); if (updateSiteStructure) { context.restructureSiteTree(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; } }
public class class_name { public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; // depends on control dependency: [if], data = [none] } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; } }
public class class_name { protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException { List<PropertyData> refProps = null; if (cache.isEnabled()) { refProps = cache.getReferencedProperties(identifier); if (refProps != null) { return refProps; } } final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES); try { request.start(); if (cache.isEnabled()) { // Try first to get the value from the cache since a // request could have been launched just before refProps = cache.getReferencedProperties(identifier); if (refProps != null) { return refProps; } } return executeAction(new PrivilegedExceptionAction<List<PropertyData>>() { public List<PropertyData> run() throws RepositoryException { List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false); if (cache.isEnabled()) { cache.addReferencedProperties(identifier, refProps); } return refProps; } }); } finally { request.done(); } } }
public class class_name { protected List<PropertyData> getReferencedPropertiesData(final String identifier) throws RepositoryException { List<PropertyData> refProps = null; if (cache.isEnabled()) { refProps = cache.getReferencedProperties(identifier); if (refProps != null) { return refProps; } } final DataRequest request = new DataRequest(identifier, DataRequest.GET_REFERENCES); try { request.start(); if (cache.isEnabled()) { // Try first to get the value from the cache since a // request could have been launched just before refProps = cache.getReferencedProperties(identifier); if (refProps != null) { return refProps; // depends on control dependency: [if], data = [none] } } return executeAction(new PrivilegedExceptionAction<List<PropertyData>>() { public List<PropertyData> run() throws RepositoryException { List<PropertyData> refProps = CacheableWorkspaceDataManager.super.getReferencesData(identifier, false); if (cache.isEnabled()) { cache.addReferencedProperties(identifier, refProps); // depends on control dependency: [if], data = [none] } return refProps; } }); } finally { request.done(); } } }