code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private Collection<String> checkAndPutToCollection(Collection<String> collection, String[] names) { if (collection == null) { collection = new HashSet<String>(); } Collections.addAll(collection, names); return collection; } }
public class class_name { private Collection<String> checkAndPutToCollection(Collection<String> collection, String[] names) { if (collection == null) { collection = new HashSet<String>(); // depends on control dependency: [if], data = [none] } Collections.addAll(collection, names); return collection; } }
public class class_name { private long getTime(Date start, Date end, long target, boolean after) { long total = 0; if (start != null && end != null) { Date startTime = DateHelper.getCanonicalTime(start); Date endTime = DateHelper.getCanonicalTime(end); Date startDay = DateHelper.getDayStartDate(start); Date finishDay = DateHelper.getDayStartDate(end); // // Handle the case where the end of the range is at midnight - // this will show up as the start and end days not matching // if (startDay.getTime() != finishDay.getTime()) { endTime = DateHelper.addDays(endTime, 1); } int diff = DateHelper.compare(startTime, endTime, target); if (diff == 0) { if (after == true) { total = (endTime.getTime() - target); } else { total = (target - startTime.getTime()); } } else { if ((after == true && diff < 0) || (after == false && diff > 0)) { total = (endTime.getTime() - startTime.getTime()); } } } return (total); } }
public class class_name { private long getTime(Date start, Date end, long target, boolean after) { long total = 0; if (start != null && end != null) { Date startTime = DateHelper.getCanonicalTime(start); Date endTime = DateHelper.getCanonicalTime(end); Date startDay = DateHelper.getDayStartDate(start); Date finishDay = DateHelper.getDayStartDate(end); // // Handle the case where the end of the range is at midnight - // this will show up as the start and end days not matching // if (startDay.getTime() != finishDay.getTime()) { endTime = DateHelper.addDays(endTime, 1); // depends on control dependency: [if], data = [none] } int diff = DateHelper.compare(startTime, endTime, target); if (diff == 0) { if (after == true) { total = (endTime.getTime() - target); // depends on control dependency: [if], data = [none] } else { total = (target - startTime.getTime()); // depends on control dependency: [if], data = [none] } } else { if ((after == true && diff < 0) || (after == false && diff > 0)) { total = (endTime.getTime() - startTime.getTime()); // depends on control dependency: [if], data = [none] } } } return (total); } }
public class class_name { public ItemRef get(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _get(onItemSnapshot, onError, false); } }, onError); } else { this._get(onItemSnapshot, onError, false); } return this; } }
public class class_name { public ItemRef get(final OnItemSnapshot onItemSnapshot, final OnError onError){ TableMetadata tm = context.getTableMeta(this.table.name); if(tm == null){ this.table.meta(new OnTableMetadata(){ @Override public void run(TableMetadata tableMetadata) { _get(onItemSnapshot, onError, false); } }, onError); // depends on control dependency: [if], data = [none] } else { this._get(onItemSnapshot, onError, false); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public void setScaleType(ScaleType scaleType) { if (Objects.equal(mScaleType, scaleType)) { return; } mScaleType = scaleType; mScaleTypeState = null; configureBounds(); invalidateSelf(); } }
public class class_name { public void setScaleType(ScaleType scaleType) { if (Objects.equal(mScaleType, scaleType)) { return; // depends on control dependency: [if], data = [none] } mScaleType = scaleType; mScaleTypeState = null; configureBounds(); invalidateSelf(); } }
public class class_name { protected Client getClient(String apiKey) throws SQLException { Client client; synchronized (mutex) { client = clientCache.get(apiKey); } if (client == null) { client = super.getClientInternal(apiKey); synchronized (mutex) { if (client != null) { clientCache.put(apiKey, client); } } } return client; } }
public class class_name { protected Client getClient(String apiKey) throws SQLException { Client client; synchronized (mutex) { client = clientCache.get(apiKey); } if (client == null) { client = super.getClientInternal(apiKey); synchronized (mutex) { if (client != null) { clientCache.put(apiKey, client); // depends on control dependency: [if], data = [none] } } } return client; } }
public class class_name { public static String readScript(LineNumberReader lineNumberReader, String commentPrefix, String separator) throws IOException { String currentStatement = lineNumberReader.readLine(); StringBuilder scriptBuilder = new StringBuilder(); while (currentStatement != null) { if (commentPrefix != null && !currentStatement.startsWith(commentPrefix)) { if (scriptBuilder.length() > 0) { scriptBuilder.append('\n'); } scriptBuilder.append(currentStatement); } currentStatement = lineNumberReader.readLine(); } appendSeparatorToScriptIfNecessary(scriptBuilder, separator); return scriptBuilder.toString(); } }
public class class_name { public static String readScript(LineNumberReader lineNumberReader, String commentPrefix, String separator) throws IOException { String currentStatement = lineNumberReader.readLine(); StringBuilder scriptBuilder = new StringBuilder(); while (currentStatement != null) { if (commentPrefix != null && !currentStatement.startsWith(commentPrefix)) { if (scriptBuilder.length() > 0) { scriptBuilder.append('\n'); // depends on control dependency: [if], data = [none] } scriptBuilder.append(currentStatement); } currentStatement = lineNumberReader.readLine(); } appendSeparatorToScriptIfNecessary(scriptBuilder, separator); return scriptBuilder.toString(); } }
public class class_name { public void marshall(InventoryResultEntity inventoryResultEntity, ProtocolMarshaller protocolMarshaller) { if (inventoryResultEntity == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inventoryResultEntity.getId(), ID_BINDING); protocolMarshaller.marshall(inventoryResultEntity.getData(), DATA_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InventoryResultEntity inventoryResultEntity, ProtocolMarshaller protocolMarshaller) { if (inventoryResultEntity == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inventoryResultEntity.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(inventoryResultEntity.getData(), DATA_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void putProcessedInputToCache(ProcessedInput processedInput) { if (MjdbcConfig.isQueryInputProcessorUseCache() == true) { ProcessedInput clonedProcessedInput = new ProcessedInput(processedInput); synchronized (this.processedInputCache) { // no need to keep parameters in the memory. removing just in case clonedProcessedInput.setSqlParameterValues(null); this.processedInputCache.put(processedInput.getOriginalSql(), clonedProcessedInput); } } } }
public class class_name { private void putProcessedInputToCache(ProcessedInput processedInput) { if (MjdbcConfig.isQueryInputProcessorUseCache() == true) { ProcessedInput clonedProcessedInput = new ProcessedInput(processedInput); synchronized (this.processedInputCache) { // depends on control dependency: [if], data = [none] // no need to keep parameters in the memory. removing just in case clonedProcessedInput.setSqlParameterValues(null); this.processedInputCache.put(processedInput.getOriginalSql(), clonedProcessedInput); } } } }
public class class_name { public void setPipelineObjects(java.util.Collection<PipelineObject> pipelineObjects) { if (pipelineObjects == null) { this.pipelineObjects = null; return; } this.pipelineObjects = new com.amazonaws.internal.SdkInternalList<PipelineObject>(pipelineObjects); } }
public class class_name { public void setPipelineObjects(java.util.Collection<PipelineObject> pipelineObjects) { if (pipelineObjects == null) { this.pipelineObjects = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.pipelineObjects = new com.amazonaws.internal.SdkInternalList<PipelineObject>(pipelineObjects); } }
public class class_name { private static String replace(String source, char oldChar, String newString) { StringBuilder StringBuilder = new StringBuilder(source.length()); for (int i = 0; i < source.length(); i++) { char c = source.charAt(i); if (c == oldChar) { StringBuilder.append(newString); } else { StringBuilder.append(c); } } return StringBuilder.toString(); } }
public class class_name { private static String replace(String source, char oldChar, String newString) { StringBuilder StringBuilder = new StringBuilder(source.length()); for (int i = 0; i < source.length(); i++) { char c = source.charAt(i); if (c == oldChar) { StringBuilder.append(newString); // depends on control dependency: [if], data = [none] } else { StringBuilder.append(c); // depends on control dependency: [if], data = [(c] } } return StringBuilder.toString(); } }
public class class_name { public static Type getType() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { return Type.WINDOWS; } else if (osName.contains("linux")) { return Type.LINUX; } else if (osName.contains("mac")) { return Type.MAC; } return Type.UNKNOWN; } }
public class class_name { public static Type getType() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { return Type.WINDOWS; // depends on control dependency: [if], data = [none] } else if (osName.contains("linux")) { return Type.LINUX; // depends on control dependency: [if], data = [none] } else if (osName.contains("mac")) { return Type.MAC; // depends on control dependency: [if], data = [none] } return Type.UNKNOWN; } }
public class class_name { public static Method getPropertySetterMethod(Class clazz, String property, Class propertyClazz) { String methodName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1); try { return clazz.getMethod(methodName, propertyClazz); } catch (NoSuchMethodException e) { throw new SofaRpcRuntimeException("No setter method for " + clazz.getName() + "#" + property, e); } } }
public class class_name { public static Method getPropertySetterMethod(Class clazz, String property, Class propertyClazz) { String methodName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1); try { return clazz.getMethod(methodName, propertyClazz); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { throw new SofaRpcRuntimeException("No setter method for " + clazz.getName() + "#" + property, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, Document document, final MetamodelImpl metaModel) { try { Field luceneField; Object id; id = PropertyAccessorHelper.getId(entity, metadata); // Indexing composite keys if (metaModel != null && metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) { id = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, id); } luceneField = new Field(IndexingConstants.ENTITY_ID_FIELD, id.toString(), Field.Store.YES, Field.Index.ANALYZED); // luceneField.set // adding class // namespace // /*Field.Store.YES, Field.Index.ANALYZED_NO_NORMS*/); document.add(luceneField); // index namespace for unique deletion luceneField = new Field(IndexingConstants.KUNDERA_ID_FIELD, getKunderaId(metadata, id), Field.Store.YES, Field.Index.ANALYZED); // adding // class // namespace // Field.Store.YES/*, Field.Index.ANALYZED_NO_NORMS*/); document.add(luceneField); // index entity class luceneField = new Field(IndexingConstants.ENTITY_CLASS_FIELD, metadata.getEntityClazz().getCanonicalName() .toLowerCase(), Field.Store.YES, Field.Index.ANALYZED); document.add(luceneField); // luceneField = new Field("timestamp", System.currentTimeMillis() + "", Field.Store.YES, Field.Index.NO); document.add(luceneField); // index index name luceneField = new Field(IndexingConstants.ENTITY_INDEXNAME_FIELD, metadata.getIndexName(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS); document.add(luceneField); luceneField = new Field(getCannonicalPropertyName(metadata.getEntityClazz().getSimpleName(), ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), id.toString(), Field.Store.YES, Field.Index.ANALYZED_NO_NORMS); document.add(luceneField); } catch (PropertyAccessException e) { throw new IllegalArgumentException("Id could not be read from object " + entity); } } }
public class class_name { protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, Document document, final MetamodelImpl metaModel) { try { Field luceneField; Object id; id = PropertyAccessorHelper.getId(entity, metadata); // depends on control dependency: [try], data = [none] // Indexing composite keys if (metaModel != null && metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) { id = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, id); // depends on control dependency: [if], data = [none] } luceneField = new Field(IndexingConstants.ENTITY_ID_FIELD, id.toString(), Field.Store.YES, Field.Index.ANALYZED); // depends on control dependency: [try], data = [none] // luceneField.set // adding class // namespace // /*Field.Store.YES, Field.Index.ANALYZED_NO_NORMS*/); document.add(luceneField); // depends on control dependency: [try], data = [none] // index namespace for unique deletion luceneField = new Field(IndexingConstants.KUNDERA_ID_FIELD, getKunderaId(metadata, id), Field.Store.YES, Field.Index.ANALYZED); // adding // depends on control dependency: [try], data = [none] // class // namespace // Field.Store.YES/*, Field.Index.ANALYZED_NO_NORMS*/); document.add(luceneField); // depends on control dependency: [try], data = [none] // index entity class luceneField = new Field(IndexingConstants.ENTITY_CLASS_FIELD, metadata.getEntityClazz().getCanonicalName() .toLowerCase(), Field.Store.YES, Field.Index.ANALYZED); // depends on control dependency: [try], data = [none] document.add(luceneField); // depends on control dependency: [try], data = [none] // luceneField = new Field("timestamp", System.currentTimeMillis() + "", Field.Store.YES, Field.Index.NO); // depends on control dependency: [try], data = [none] document.add(luceneField); // depends on control dependency: [try], data = [none] // index index name luceneField = new Field(IndexingConstants.ENTITY_INDEXNAME_FIELD, metadata.getIndexName(), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS); // depends on control dependency: [try], data = [none] document.add(luceneField); // depends on control dependency: [try], data = [none] luceneField = new Field(getCannonicalPropertyName(metadata.getEntityClazz().getSimpleName(), ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), id.toString(), Field.Store.YES, Field.Index.ANALYZED_NO_NORMS); // depends on control dependency: [try], data = [none] document.add(luceneField); // depends on control dependency: [try], data = [none] } catch (PropertyAccessException e) { throw new IllegalArgumentException("Id could not be read from object " + entity); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (requestCancelActivityTaskFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getActivityId(), ACTIVITYID_BINDING); protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getCause(), CAUSE_BINDING); protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (requestCancelActivityTaskFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getActivityId(), ACTIVITYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getCause(), CAUSE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(requestCancelActivityTaskFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override void setLocation(int x, int y) { if (x != nextX || y != nextY) { nextX = x; nextY = y; MonocleWindowManager.getInstance().repaintAll(); } } }
public class class_name { @Override void setLocation(int x, int y) { if (x != nextX || y != nextY) { nextX = x; // depends on control dependency: [if], data = [none] nextY = y; // depends on control dependency: [if], data = [none] MonocleWindowManager.getInstance().repaintAll(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void start() { if (!raftIntegration.isReady()) { raftIntegration.schedule(new Runnable() { @Override public void run() { start(); } }, RAFT_NODE_INIT_DELAY_MILLIS, MILLISECONDS); return; } if (logger.isFineEnabled()) { logger.fine("Starting raft node: " + localMember + " for " + groupId + " with " + state.memberCount() + " members: " + state.members()); } raftIntegration.execute(new PreVoteTask(this, 0)); scheduleLeaderFailureDetection(); } }
public class class_name { public void start() { if (!raftIntegration.isReady()) { raftIntegration.schedule(new Runnable() { @Override public void run() { start(); } }, RAFT_NODE_INIT_DELAY_MILLIS, MILLISECONDS); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (logger.isFineEnabled()) { logger.fine("Starting raft node: " + localMember + " for " + groupId + " with " + state.memberCount() + " members: " + state.members()); // depends on control dependency: [if], data = [none] } raftIntegration.execute(new PreVoteTask(this, 0)); scheduleLeaderFailureDetection(); } }
public class class_name { private Set<Artifact> getProjectPluginManagement() { Set<Artifact> result = new LinkedHashSet<Artifact>(); PluginManagement pluginManagement = getProject().getPluginManagement(); if (pluginManagement != null) { for (Plugin plugin : pluginManagement.getPlugins()) { result.add(toArtifact(plugin)); } } return result; } }
public class class_name { private Set<Artifact> getProjectPluginManagement() { Set<Artifact> result = new LinkedHashSet<Artifact>(); PluginManagement pluginManagement = getProject().getPluginManagement(); if (pluginManagement != null) { for (Plugin plugin : pluginManagement.getPlugins()) { result.add(toArtifact(plugin)); // depends on control dependency: [for], data = [plugin] } } return result; } }
public class class_name { @Override public int buildReport(String[] args, final OutputStream out) throws Exception { try { if (!initSettings(args)) { return EXITNOSETTINGS; } if (settings.containsKey(VERSION)) { for (VersionInfo.VersionInformation mi : VersionInfo.getVersionInfo().values()) { System.out.println(mi); } return EXITFROMPROPERTYCODE; } if (settings.containsKey(HELP)) { showHelp(settings); return EXITFROMPROPERTYCODE; } DataCollector<RD> dc = getDataCollector(); ReportGenerator<RD> rg = getReportGenerator(); if (dc == null && rg.getClass().equals(BaseReportGenerator.class)) { throw new VectorPrintException(DATACLASS_HELP); } else if (dc == null) { log.warning(String.format("no data collector found, assuming that %s overrides createReportBody", rg.getClass().getName())); } StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(rg, settings); if (dc != null) { StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(dc, settings); } return rg.generate(dc == null ? null : dc.collect(), out); } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | VectorPrintException | RuntimeException exception) { log.log(Level.SEVERE, exception.getMessage(), exception); throw exception; } finally { log.info(String.format("Settings (from %s) not used sofar: %s", getSettings().getId(), getSettings().getUnusedKeys())); log.info(String.format("Settings (from %s) not present, for which a default was used: %s", getSettings().getId(), getSettings().getKeysNotPresent())); if (out != null) { out.close(); } } } }
public class class_name { @Override public int buildReport(String[] args, final OutputStream out) throws Exception { try { if (!initSettings(args)) { return EXITNOSETTINGS; } if (settings.containsKey(VERSION)) { for (VersionInfo.VersionInformation mi : VersionInfo.getVersionInfo().values()) { System.out.println(mi); // depends on control dependency: [for], data = [mi] } return EXITFROMPROPERTYCODE; } if (settings.containsKey(HELP)) { showHelp(settings); return EXITFROMPROPERTYCODE; } DataCollector<RD> dc = getDataCollector(); ReportGenerator<RD> rg = getReportGenerator(); if (dc == null && rg.getClass().equals(BaseReportGenerator.class)) { throw new VectorPrintException(DATACLASS_HELP); } else if (dc == null) { log.warning(String.format("no data collector found, assuming that %s overrides createReportBody", rg.getClass().getName())); } StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(rg, settings); if (dc != null) { StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(dc, settings); } return rg.generate(dc == null ? null : dc.collect(), out); } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | VectorPrintException | RuntimeException exception) { log.log(Level.SEVERE, exception.getMessage(), exception); throw exception; } finally { log.info(String.format("Settings (from %s) not used sofar: %s", getSettings().getId(), getSettings().getUnusedKeys())); log.info(String.format("Settings (from %s) not present, for which a default was used: %s", getSettings().getId(), getSettings().getKeysNotPresent())); if (out != null) { out.close(); } } } }
public class class_name { @POST @Path("/importer") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importDevice( @MultipartForm ImporterForm form, @Context HttpServletRequest request) { // find the matching variation: final Variant variant = loadVariantWhenAuthorized(request); if (variant == null) { return create401Response(request); } List<Installation> devices; try { devices = mapper.readValue(form.getJsonFile(), new TypeReference<List<Installation>>() {}); } catch (IOException e) { logger.error("Error when parsing importer json file", e); return Response.status(Status.BAD_REQUEST).build(); } logger.info("Devices to import: {}", devices.size()); clientInstallationService.addInstallations(variant, devices); // return directly, the above is async and may take a bit :-) return Response.ok(EmptyJSON.STRING).build(); } }
public class class_name { @POST @Path("/importer") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response importDevice( @MultipartForm ImporterForm form, @Context HttpServletRequest request) { // find the matching variation: final Variant variant = loadVariantWhenAuthorized(request); if (variant == null) { return create401Response(request); // depends on control dependency: [if], data = [none] } List<Installation> devices; try { devices = mapper.readValue(form.getJsonFile(), new TypeReference<List<Installation>>() {}); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.error("Error when parsing importer json file", e); return Response.status(Status.BAD_REQUEST).build(); } // depends on control dependency: [catch], data = [none] logger.info("Devices to import: {}", devices.size()); clientInstallationService.addInstallations(variant, devices); // return directly, the above is async and may take a bit :-) return Response.ok(EmptyJSON.STRING).build(); } }
public class class_name { private String encodeUri( String uri ) { String newUri = ""; StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) newUri += "/"; else if ( tok.equals( " " )) newUri += "%20"; else { newUri += URLEncoder.encode( tok ); // For Java 1.4 you'll want to use this instead: // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {} } } return newUri; } }
public class class_name { private String encodeUri( String uri ) { String newUri = ""; StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) newUri += "/"; else if ( tok.equals( " " )) newUri += "%20"; else { newUri += URLEncoder.encode( tok ); // depends on control dependency: [if], data = [none] // For Java 1.4 you'll want to use this instead: // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {} } } return newUri; } }
public class class_name { public boolean link(String url, String pkglisturl, DocErrorReporter reporter, boolean linkoffline) { this.linkoffline = linkoffline; try { url = adjustEndFileSeparator(url); if (isUrl(pkglisturl)) { readPackageListFromURL(url, toURL(adjustEndFileSeparator(pkglisturl))); } else { readPackageListFromFile(url, DocFile.createFileForInput(configuration, pkglisturl)); } return true; } catch (Fault f) { reporter.printWarning(f.getMessage()); return false; } } }
public class class_name { public boolean link(String url, String pkglisturl, DocErrorReporter reporter, boolean linkoffline) { this.linkoffline = linkoffline; try { url = adjustEndFileSeparator(url); // depends on control dependency: [try], data = [none] if (isUrl(pkglisturl)) { readPackageListFromURL(url, toURL(adjustEndFileSeparator(pkglisturl))); // depends on control dependency: [if], data = [none] } else { readPackageListFromFile(url, DocFile.createFileForInput(configuration, pkglisturl)); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [try], data = [none] } catch (Fault f) { reporter.printWarning(f.getMessage()); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public double getMatchRatio(String strA, String strB) { if (strA == null && strB == null) { return MAX_RATIO; } else if (strA == null || strB == null) { return MIN_RATIO; } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); } }
public class class_name { public double getMatchRatio(String strA, String strB) { if (strA == null && strB == null) { return MAX_RATIO; // depends on control dependency: [if], data = [none] } else if (strA == null || strB == null) { return MIN_RATIO; // depends on control dependency: [if], data = [none] } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; // depends on control dependency: [if], data = [none] } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; // depends on control dependency: [if], data = [none] } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); } }
public class class_name { public void marshall(CreateKeyPairRequest createKeyPairRequest, ProtocolMarshaller protocolMarshaller) { if (createKeyPairRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createKeyPairRequest.getKeyPairName(), KEYPAIRNAME_BINDING); protocolMarshaller.marshall(createKeyPairRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateKeyPairRequest createKeyPairRequest, ProtocolMarshaller protocolMarshaller) { if (createKeyPairRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createKeyPairRequest.getKeyPairName(), KEYPAIRNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createKeyPairRequest.getTags(), TAGS_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 java.lang.String getFilenameTensorName() { java.lang.Object ref = filenameTensorName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); filenameTensorName_ = s; return s; } } }
public class class_name { public java.lang.String getFilenameTensorName() { java.lang.Object ref = filenameTensorName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); filenameTensorName_ = s; // depends on control dependency: [if], data = [none] return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void assign(HashMap<String, DBIDs> labelMap, String label, DBIDRef id) { if(labelMap.containsKey(label)) { DBIDs exist = labelMap.get(label); if(exist instanceof DBID) { ModifiableDBIDs n = DBIDUtil.newHashSet(); n.add((DBID) exist); n.add(id); labelMap.put(label, n); } else { assert (exist instanceof HashSetModifiableDBIDs); assert (exist.size() > 1); ((ModifiableDBIDs) exist).add(id); } } else { labelMap.put(label, DBIDUtil.deref(id)); } } }
public class class_name { private void assign(HashMap<String, DBIDs> labelMap, String label, DBIDRef id) { if(labelMap.containsKey(label)) { DBIDs exist = labelMap.get(label); if(exist instanceof DBID) { ModifiableDBIDs n = DBIDUtil.newHashSet(); n.add((DBID) exist); // depends on control dependency: [if], data = [none] n.add(id); // depends on control dependency: [if], data = [none] labelMap.put(label, n); // depends on control dependency: [if], data = [none] } else { assert (exist instanceof HashSetModifiableDBIDs); // depends on control dependency: [if], data = [none] assert (exist.size() > 1); // depends on control dependency: [if], data = [none] ((ModifiableDBIDs) exist).add(id); // depends on control dependency: [if], data = [none] } } else { labelMap.put(label, DBIDUtil.deref(id)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void proxyPause() { logger.info("Pausing after cluster state has changed to allow proxy bridges to be established. " + "Will start rebalancing work on servers in " + proxyPauseSec + " seconds."); try { Thread.sleep(TimeUnit.SECONDS.toMillis(proxyPauseSec)); } catch(InterruptedException e) { logger.warn("Sleep interrupted in proxy pause."); } } }
public class class_name { private void proxyPause() { logger.info("Pausing after cluster state has changed to allow proxy bridges to be established. " + "Will start rebalancing work on servers in " + proxyPauseSec + " seconds."); try { Thread.sleep(TimeUnit.SECONDS.toMillis(proxyPauseSec)); // depends on control dependency: [try], data = [none] } catch(InterruptedException e) { logger.warn("Sleep interrupted in proxy pause."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void onMenuClose(CmsSitemapHoverbar hoverbar) { m_button.setDown(false); if (!hoverbar.isHovered()) { hoverbar.hide(); } else { hoverbar.setLocked(false); } } }
public class class_name { protected void onMenuClose(CmsSitemapHoverbar hoverbar) { m_button.setDown(false); if (!hoverbar.isHovered()) { hoverbar.hide(); // depends on control dependency: [if], data = [none] } else { hoverbar.setLocked(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nullable /*package*/ <T extends View> Parcelable restoreInstanceState(@NonNull T target, @Nullable Parcelable state) { if (state != null) { Injector.View<T> injector = safeGet(target, Injector.View.DEFAULT); return injector.restore(target, state); } else { return null; } } }
public class class_name { @Nullable /*package*/ <T extends View> Parcelable restoreInstanceState(@NonNull T target, @Nullable Parcelable state) { if (state != null) { Injector.View<T> injector = safeGet(target, Injector.View.DEFAULT); return injector.restore(target, state); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void computeOctaveScales() { octaveImages[0] = tempImage0; for (int i = 1; i < numScales+3; i++) { octaveImages[i].reshape(tempImage0.width, tempImage0.height); applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]); } for (int i = 1; i < numScales+3; i++) { differenceOfGaussian[i-1].reshape(tempImage0.width, tempImage0.height); PixelMath.subtract(octaveImages[i],octaveImages[i - 1],differenceOfGaussian[i-1]); } } }
public class class_name { private void computeOctaveScales() { octaveImages[0] = tempImage0; for (int i = 1; i < numScales+3; i++) { octaveImages[i].reshape(tempImage0.width, tempImage0.height); // depends on control dependency: [for], data = [i] applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]); // depends on control dependency: [for], data = [i] } for (int i = 1; i < numScales+3; i++) { differenceOfGaussian[i-1].reshape(tempImage0.width, tempImage0.height); // depends on control dependency: [for], data = [i] PixelMath.subtract(octaveImages[i],octaveImages[i - 1],differenceOfGaussian[i-1]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Set<Map.Entry<Buffer, Buffer>> getAllParameters() { consumeUntil(null); if (this.paramMap != null) { return this.paramMap.entrySet(); } return null; } }
public class class_name { public Set<Map.Entry<Buffer, Buffer>> getAllParameters() { consumeUntil(null); if (this.paramMap != null) { return this.paramMap.entrySet(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private boolean reachEndRange() { // current row key ByteBuffer rowKey; if (keyValidator instanceof CompositeType) { ByteBuffer[] keys = new ByteBuffer[partitionBoundColumns.size()]; for (int i = 0; i < partitionBoundColumns.size(); i++) { keys[i] = partitionBoundColumns.get(i).value.duplicate(); } rowKey = CompositeType.build(keys); } else { rowKey = partitionBoundColumns.get(0).value; } String endToken = String.valueOf(split.getEndToken()); String currentToken = partitioner.getToken(rowKey).toString(); return endToken.equals(currentToken); } }
public class class_name { private boolean reachEndRange() { // current row key ByteBuffer rowKey; if (keyValidator instanceof CompositeType) { ByteBuffer[] keys = new ByteBuffer[partitionBoundColumns.size()]; for (int i = 0; i < partitionBoundColumns.size(); i++) { keys[i] = partitionBoundColumns.get(i).value.duplicate(); // depends on control dependency: [for], data = [i] } rowKey = CompositeType.build(keys); // depends on control dependency: [if], data = [none] } else { rowKey = partitionBoundColumns.get(0).value; // depends on control dependency: [if], data = [none] } String endToken = String.valueOf(split.getEndToken()); String currentToken = partitioner.getToken(rowKey).toString(); return endToken.equals(currentToken); } }
public class class_name { @Override public void run() { long now = System.currentTimeMillis(); final long stamp = lock.readLock(); try { for (MemoryPartition partition : partitions.values()) { partition.removeOldEntries(now); } } finally { lock.unlockRead(stamp); } } }
public class class_name { @Override public void run() { long now = System.currentTimeMillis(); final long stamp = lock.readLock(); try { for (MemoryPartition partition : partitions.values()) { partition.removeOldEntries(now); // depends on control dependency: [for], data = [partition] } } finally { lock.unlockRead(stamp); } } }
public class class_name { public synchronized V invalidate(K key) { Singleton<V> singleton = _cache.get(key); if (singleton != null) { return singleton.clear(); } else { return null; } } }
public class class_name { public synchronized V invalidate(K key) { Singleton<V> singleton = _cache.get(key); if (singleton != null) { return singleton.clear(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized void stopListening() { if (mListening) { mContext.unregisterReceiver(mReceiver); mContext = null; mNetworkInfo = null; mOtherNetworkInfo = null; mIsFailOver = false; mReason = null; mListening = false; } } }
public class class_name { public synchronized void stopListening() { if (mListening) { mContext.unregisterReceiver(mReceiver); // depends on control dependency: [if], data = [none] mContext = null; // depends on control dependency: [if], data = [none] mNetworkInfo = null; // depends on control dependency: [if], data = [none] mOtherNetworkInfo = null; // depends on control dependency: [if], data = [none] mIsFailOver = false; // depends on control dependency: [if], data = [none] mReason = null; // depends on control dependency: [if], data = [none] mListening = false; // depends on control dependency: [if], data = [none] } } }
public class class_name { static void linearTimeIncrementHistogramCounters(final DoublesBufferAccessor samples, final long weight, final double[] splitPoints, final double[] counters) { int i = 0; int j = 0; while (i < samples.numItems() && j < splitPoints.length) { if (samples.get(i) < splitPoints[j]) { counters[j] += weight; // this sample goes into this bucket i++; // move on to next sample and see whether it also goes into this bucket } else { j++; // no more samples for this bucket. move on the next bucket. } } // now either i == numSamples(we are out of samples), or // j == numSplitPoints(out of buckets, but there are more samples remaining) // we only need to do something in the latter case. if (j == splitPoints.length) { counters[j] += (weight * (samples.numItems() - i)); } } }
public class class_name { static void linearTimeIncrementHistogramCounters(final DoublesBufferAccessor samples, final long weight, final double[] splitPoints, final double[] counters) { int i = 0; int j = 0; while (i < samples.numItems() && j < splitPoints.length) { if (samples.get(i) < splitPoints[j]) { counters[j] += weight; // this sample goes into this bucket // depends on control dependency: [if], data = [none] i++; // move on to next sample and see whether it also goes into this bucket // depends on control dependency: [if], data = [none] } else { j++; // no more samples for this bucket. move on the next bucket. // depends on control dependency: [if], data = [none] } } // now either i == numSamples(we are out of samples), or // j == numSplitPoints(out of buckets, but there are more samples remaining) // we only need to do something in the latter case. if (j == splitPoints.length) { counters[j] += (weight * (samples.numItems() - i)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override boolean add(int n, int m) { if (!matrix.get(n, m)) return false; // fix the mapping matrix.markRow(n, -(n + 1)); matrix.set(n, m); // attempt to refine the mapping if (refine(n)) { size = size + 1; m1[n] = m; m2[m] = n; return true; } else { // mapping became invalid - unfix mapping matrix.resetRows(n, -(n + 1)); return false; } } }
public class class_name { @Override boolean add(int n, int m) { if (!matrix.get(n, m)) return false; // fix the mapping matrix.markRow(n, -(n + 1)); matrix.set(n, m); // attempt to refine the mapping if (refine(n)) { size = size + 1; // depends on control dependency: [if], data = [none] m1[n] = m; // depends on control dependency: [if], data = [none] m2[m] = n; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { // mapping became invalid - unfix mapping matrix.resetRows(n, -(n + 1)); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setAccountDetails(java.util.Collection<AccountDetails> accountDetails) { if (accountDetails == null) { this.accountDetails = null; return; } this.accountDetails = new java.util.ArrayList<AccountDetails>(accountDetails); } }
public class class_name { public void setAccountDetails(java.util.Collection<AccountDetails> accountDetails) { if (accountDetails == null) { this.accountDetails = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.accountDetails = new java.util.ArrayList<AccountDetails>(accountDetails); } }
public class class_name { public static <T, C extends Collection<T>> IntFunction<? extends C> reuse(final IntFunction<? extends C> supplier) { return new IntFunction<C>() { private C c; @Override public C apply(int size) { if (c == null) { c = supplier.apply(size); } else if (c.size() > 0) { c.clear(); } return c; } }; } }
public class class_name { public static <T, C extends Collection<T>> IntFunction<? extends C> reuse(final IntFunction<? extends C> supplier) { return new IntFunction<C>() { private C c; @Override public C apply(int size) { if (c == null) { c = supplier.apply(size); // depends on control dependency: [if], data = [none] } else if (c.size() > 0) { c.clear(); // depends on control dependency: [if], data = [none] } return c; } }; } }
public class class_name { public void clear() { for (Object component : store.values()) { try { Event.of(Passivated.class).on(component).fire(); } catch (Exception e) {} } for (Object component : store.values()) { try { Event.of(Destroyed.class).on(component).fire(); } catch (Exception e) {} } store.clear(); } }
public class class_name { public void clear() { for (Object component : store.values()) { try { Event.of(Passivated.class).on(component).fire(); // depends on control dependency: [try], data = [none] } catch (Exception e) {} // depends on control dependency: [catch], data = [none] } for (Object component : store.values()) { try { Event.of(Destroyed.class).on(component).fire(); // depends on control dependency: [try], data = [none] } catch (Exception e) {} // depends on control dependency: [catch], data = [none] } store.clear(); } }
public class class_name { private Object getField(Object object, Field f) { f.setAccessible(true); try { return f.get(object); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } }
public class class_name { private Object getField(Object object, Field f) { f.setAccessible(true); try { return f.get(object); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String[] trimArray(String[] strings) { for (int i = 0; i < strings.length; i++) { strings[i] = strings[i].trim(); } return strings; } }
public class class_name { public static String[] trimArray(String[] strings) { for (int i = 0; i < strings.length; i++) { strings[i] = strings[i].trim(); // depends on control dependency: [for], data = [i] } return strings; } }
public class class_name { static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) { try { final ByteArrayInput input = new ByteArrayInput(data, offset, length, decodeNestedMessageAsGroup); schema.mergeFrom(input, message); input.checkLastTagWas(0); } catch (ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("Truncated.", ProtobufException.truncatedMessage(ae)); } catch (IOException e) { throw new RuntimeException("Reading from a byte array threw an IOException (should " + "never happen).", e); } } }
public class class_name { static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) { try { final ByteArrayInput input = new ByteArrayInput(data, offset, length, decodeNestedMessageAsGroup); schema.mergeFrom(input, message); // depends on control dependency: [try], data = [none] input.checkLastTagWas(0); // depends on control dependency: [try], data = [none] } catch (ArrayIndexOutOfBoundsException ae) { throw new RuntimeException("Truncated.", ProtobufException.truncatedMessage(ae)); } // depends on control dependency: [catch], data = [none] catch (IOException e) { throw new RuntimeException("Reading from a byte array threw an IOException (should " + "never happen).", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean accept(File pathname) { String name = pathname.getName(); int iLastDot = name.lastIndexOf('.'); String strExtension = ""; if ((iLastDot != -1) && (iLastDot != name.length() -1 )) strExtension = name.substring(iLastDot + 1); if (m_rgstrIncludeExtensions != null) { for (int i = 0; i < m_rgstrIncludeExtensions.length; i++) { if (m_rgstrIncludeExtensions[i].equalsIgnoreCase(strExtension)) return true; // Accept } return false; // Not in included - return } if (m_rgstrExcludeExtensions != null) { for (int i = 0; i < m_rgstrExcludeExtensions.length; i++) { if (m_rgstrExcludeExtensions[i].equalsIgnoreCase(strExtension)) return false; // Don't accept } } return true; // Accept this file } }
public class class_name { public boolean accept(File pathname) { String name = pathname.getName(); int iLastDot = name.lastIndexOf('.'); String strExtension = ""; if ((iLastDot != -1) && (iLastDot != name.length() -1 )) strExtension = name.substring(iLastDot + 1); if (m_rgstrIncludeExtensions != null) { for (int i = 0; i < m_rgstrIncludeExtensions.length; i++) { if (m_rgstrIncludeExtensions[i].equalsIgnoreCase(strExtension)) return true; // Accept } return false; // Not in included - return // depends on control dependency: [if], data = [none] } if (m_rgstrExcludeExtensions != null) { for (int i = 0; i < m_rgstrExcludeExtensions.length; i++) { if (m_rgstrExcludeExtensions[i].equalsIgnoreCase(strExtension)) return false; // Don't accept } } return true; // Accept this file } }
public class class_name { public EClass getIfcColour() { if (ifcColourEClass == null) { ifcColourEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(942); } return ifcColourEClass; } }
public class class_name { public EClass getIfcColour() { if (ifcColourEClass == null) { ifcColourEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(942); // depends on control dependency: [if], data = [none] } return ifcColourEClass; } }
public class class_name { public JSONObject getLinkDataJsonObject() { JSONObject linkDataJson = new JSONObject(); try { if (!TextUtils.isEmpty(channel)) { linkDataJson.put("~" + Defines.LinkParam.Channel.getKey(), channel); } if (!TextUtils.isEmpty(alias)) { linkDataJson.put("~" + Defines.LinkParam.Alias.getKey(), alias); } if (!TextUtils.isEmpty(feature)) { linkDataJson.put("~" + Defines.LinkParam.Feature.getKey(), feature); } if (!TextUtils.isEmpty(stage)) { linkDataJson.put("~" + Defines.LinkParam.Stage.getKey(), stage); } if (!TextUtils.isEmpty(campaign)) { linkDataJson.put("~" + Defines.LinkParam.Campaign.getKey(), campaign); } if (has(Defines.LinkParam.Tags.getKey())) { linkDataJson.put(Defines.LinkParam.Tags.getKey(), getJSONArray(Defines.LinkParam.Tags.getKey())); } linkDataJson.put("~" + Defines.LinkParam.Type.getKey(), type); linkDataJson.put("~" + Defines.LinkParam.Duration.getKey(), duration); } catch (JSONException ignore) { } return linkDataJson; } }
public class class_name { public JSONObject getLinkDataJsonObject() { JSONObject linkDataJson = new JSONObject(); try { if (!TextUtils.isEmpty(channel)) { linkDataJson.put("~" + Defines.LinkParam.Channel.getKey(), channel); // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(alias)) { linkDataJson.put("~" + Defines.LinkParam.Alias.getKey(), alias); // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(feature)) { linkDataJson.put("~" + Defines.LinkParam.Feature.getKey(), feature); // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(stage)) { linkDataJson.put("~" + Defines.LinkParam.Stage.getKey(), stage); // depends on control dependency: [if], data = [none] } if (!TextUtils.isEmpty(campaign)) { linkDataJson.put("~" + Defines.LinkParam.Campaign.getKey(), campaign); // depends on control dependency: [if], data = [none] } if (has(Defines.LinkParam.Tags.getKey())) { linkDataJson.put(Defines.LinkParam.Tags.getKey(), getJSONArray(Defines.LinkParam.Tags.getKey())); // depends on control dependency: [if], data = [none] } linkDataJson.put("~" + Defines.LinkParam.Type.getKey(), type); // depends on control dependency: [try], data = [none] linkDataJson.put("~" + Defines.LinkParam.Duration.getKey(), duration); // depends on control dependency: [try], data = [none] } catch (JSONException ignore) { } // depends on control dependency: [catch], data = [none] return linkDataJson; } }
public class class_name { protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { if (schema == null) { return; } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } } }
public class class_name { protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { if (schema == null) { return; // depends on control dependency: [if], data = [none] } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } } }
public class class_name { public static Map<String, Class<? extends ParaObject>> getCoreClassesMap() { if (CORE_CLASSES.isEmpty()) { try { CORE_PARA_CLASSES.putAll(SCANNER.getComponentClasses(ParaObject.class.getPackage().getName())); CORE_CLASSES.putAll(CORE_PARA_CLASSES); if (!Config.CORE_PACKAGE_NAME.isEmpty()) { CORE_CLASSES.putAll(SCANNER.getComponentClasses(Config.CORE_PACKAGE_NAME)); } logger.debug("Found {} ParaObject classes: {}", CORE_CLASSES.size(), CORE_CLASSES); } catch (Exception ex) { logger.error(null, ex); } } return Collections.unmodifiableMap(CORE_CLASSES); } }
public class class_name { public static Map<String, Class<? extends ParaObject>> getCoreClassesMap() { if (CORE_CLASSES.isEmpty()) { try { CORE_PARA_CLASSES.putAll(SCANNER.getComponentClasses(ParaObject.class.getPackage().getName())); // depends on control dependency: [try], data = [none] CORE_CLASSES.putAll(CORE_PARA_CLASSES); // depends on control dependency: [try], data = [none] if (!Config.CORE_PACKAGE_NAME.isEmpty()) { CORE_CLASSES.putAll(SCANNER.getComponentClasses(Config.CORE_PACKAGE_NAME)); // depends on control dependency: [if], data = [none] } logger.debug("Found {} ParaObject classes: {}", CORE_CLASSES.size(), CORE_CLASSES); // depends on control dependency: [try], data = [none] } catch (Exception ex) { logger.error(null, ex); } // depends on control dependency: [catch], data = [none] } return Collections.unmodifiableMap(CORE_CLASSES); } }
public class class_name { @Override public String execute(MavenWorkingSession session) { final String declaredVersion = dependency.getVersion(); String resolvedVersion = declaredVersion; // is not able to infer anything, it was not configured if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion)) { // version is ignored here, so we have to iterate to get the dependency we are looking for if (session.getDependencyManagement().contains(dependency)) { // get the dependency from internal dependencyManagement MavenDependency resolved = null; Iterator<MavenDependency> it = session.getDependencyManagement().iterator(); while (it.hasNext()) { resolved = it.next(); if (resolved.equals(dependency)) { break; } } // we have resolved a version from dependency management resolvedVersion = resolved.getVersion(); log.log(Level.FINE, "Resolved version {0} from the POM file for the artifact {1}", new Object[] { resolved.getVersion(), dependency.toCanonicalForm() }); } } // SHRINKRES-102 test-jar has special behavior if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion) && dependency.getPackaging().equals(PackagingType.JAR) && dependency.getClassifier().equals(PackagingType.TEST_JAR.getClassifier())) { MavenCoordinate coordinate = MavenCoordinates.createCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), PackagingType.TEST_JAR, PackagingType.TEST_JAR.getClassifier()); MavenDependency newDependency = new MavenDependencyImpl(coordinate, dependency.getScope(), dependency.isOptional(), dependency.getExclusions().toArray(new MavenDependencyExclusion[0])); // version is ignored here, so we have to iterate to get the dependency we are looking for if (session.getDependencyManagement().contains(newDependency)) { // get the dependency from internal dependencyManagement MavenDependency resolved = null; Iterator<MavenDependency> it = session.getDependencyManagement().iterator(); while (it.hasNext()) { resolved = it.next(); if (resolved.equals(newDependency)) { break; } } // we have resolved a version from dependency management resolvedVersion = resolved.getVersion(); log.log(Level.FINE, "Resolved version {0} from the POM file for the artifact {1} via {2}", new Object[] { resolved.getVersion(), dependency.toCanonicalForm() , newDependency.toCanonicalForm()}); } } // Still unresolved? if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion)) { // log available version management if (log.isLoggable(Level.FINER)) { StringBuilder sb = new StringBuilder("Available version management: \n"); for (final MavenDependency depmgmt : session.getDependencyManagement()) { sb.append(depmgmt).append("\n"); } log.log(Level.FINER, sb.toString()); } throw new ResolutionException( MessageFormat .format( "Unable to get version for dependency specified by {0}, it was not provided in neither <dependencyManagement> nor <dependencies> sections.", dependency.toCanonicalForm())); } // Return return resolvedVersion; } }
public class class_name { @Override public String execute(MavenWorkingSession session) { final String declaredVersion = dependency.getVersion(); String resolvedVersion = declaredVersion; // is not able to infer anything, it was not configured if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion)) { // version is ignored here, so we have to iterate to get the dependency we are looking for if (session.getDependencyManagement().contains(dependency)) { // get the dependency from internal dependencyManagement MavenDependency resolved = null; Iterator<MavenDependency> it = session.getDependencyManagement().iterator(); while (it.hasNext()) { resolved = it.next(); // depends on control dependency: [while], data = [none] if (resolved.equals(dependency)) { break; } } // we have resolved a version from dependency management resolvedVersion = resolved.getVersion(); // depends on control dependency: [if], data = [none] log.log(Level.FINE, "Resolved version {0} from the POM file for the artifact {1}", new Object[] { resolved.getVersion(), dependency.toCanonicalForm() }); // depends on control dependency: [if], data = [none] } } // SHRINKRES-102 test-jar has special behavior if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion) && dependency.getPackaging().equals(PackagingType.JAR) && dependency.getClassifier().equals(PackagingType.TEST_JAR.getClassifier())) { MavenCoordinate coordinate = MavenCoordinates.createCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), PackagingType.TEST_JAR, PackagingType.TEST_JAR.getClassifier()); MavenDependency newDependency = new MavenDependencyImpl(coordinate, dependency.getScope(), dependency.isOptional(), dependency.getExclusions().toArray(new MavenDependencyExclusion[0])); // version is ignored here, so we have to iterate to get the dependency we are looking for if (session.getDependencyManagement().contains(newDependency)) { // get the dependency from internal dependencyManagement MavenDependency resolved = null; Iterator<MavenDependency> it = session.getDependencyManagement().iterator(); while (it.hasNext()) { resolved = it.next(); // depends on control dependency: [while], data = [none] if (resolved.equals(newDependency)) { break; } } // we have resolved a version from dependency management resolvedVersion = resolved.getVersion(); // depends on control dependency: [if], data = [none] log.log(Level.FINE, "Resolved version {0} from the POM file for the artifact {1} via {2}", new Object[] { resolved.getVersion(), dependency.toCanonicalForm() , newDependency.toCanonicalForm()}); // depends on control dependency: [if], data = [none] } } // Still unresolved? if (Validate.isNullOrEmptyOrQuestionMark(resolvedVersion)) { // log available version management if (log.isLoggable(Level.FINER)) { StringBuilder sb = new StringBuilder("Available version management: \n"); for (final MavenDependency depmgmt : session.getDependencyManagement()) { sb.append(depmgmt).append("\n"); // depends on control dependency: [for], data = [depmgmt] } log.log(Level.FINER, sb.toString()); // depends on control dependency: [if], data = [none] } throw new ResolutionException( MessageFormat .format( "Unable to get version for dependency specified by {0}, it was not provided in neither <dependencyManagement> nor <dependencies> sections.", dependency.toCanonicalForm())); } // Return return resolvedVersion; } }
public class class_name { public void addError(I_CmsXmlContentValue value, String message) { m_hasErrors = true; Locale locale = value.getLocale(); Map<String, String> localeErrors = getLocalIssueMap(m_errors, locale); localeErrors.put(value.getPath(), message); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_ERR_2, value.getPath(), message)); } } }
public class class_name { public void addError(I_CmsXmlContentValue value, String message) { m_hasErrors = true; Locale locale = value.getLocale(); Map<String, String> localeErrors = getLocalIssueMap(m_errors, locale); localeErrors.put(value.getPath(), message); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key(Messages.LOG_XMLCONTENT_VALIDATION_ERR_2, value.getPath(), message)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <O extends ImageGray<O>> O[] declareOutput( ImagePyramid<?> pyramid , Class<O> outputType ) { O[] ret = (O[])Array.newInstance(outputType,pyramid.getNumLayers()); for( int i = 0; i < ret.length; i++ ) { int w = pyramid.getWidth(i); int h = pyramid.getHeight(i); ret[i] = GeneralizedImageOps.createSingleBand(outputType,w,h); } return ret; } }
public class class_name { public static <O extends ImageGray<O>> O[] declareOutput( ImagePyramid<?> pyramid , Class<O> outputType ) { O[] ret = (O[])Array.newInstance(outputType,pyramid.getNumLayers()); for( int i = 0; i < ret.length; i++ ) { int w = pyramid.getWidth(i); int h = pyramid.getHeight(i); ret[i] = GeneralizedImageOps.createSingleBand(outputType,w,h); // depends on control dependency: [for], data = [i] } return ret; } }
public class class_name { protected ActionCommand createDataEditorCommand() { ActionCommand selectDialogCommand = new ActionCommand(getSelectDialogCommandId()) { private ApplicationDialog dataEditorDialog; @Override protected void doExecuteCommand() { if (LookupBinding.this.propertyChangeMonitor.proceedOnChange()) { if (dataEditorDialog == null) { dataEditorDialog = new TitledWidgetApplicationDialog(getDataEditor(), TitledWidgetApplicationDialog.SELECT_CANCEL_MODE) { protected boolean onFinish() { if (getDataEditor().canClose()) return LookupBinding.this.onFinish(); return false; } @Override protected boolean onSelectNone() { getDataEditor().getTableWidget().unSelectAll(); return super.onSelectNone(); } @Override protected void onCancel() { if (getDataEditor().canClose()) super.onCancel(); } }; dataEditorDialog.setParentComponent(getDataEditorButton()); getDataEditor().setSelectMode(AbstractDataEditorWidget.ON); getApplicationConfig().applicationObjectConfigurer().configure(dataEditorDialog, getSelectDialogId()); } if (getParameter(NO_INITIALIZE_DATA_EDITOR) != ON) initializeDataEditor(); if (getDialogSize() != null) { dataEditorDialog.getDialog().setMinimumSize(getDialogSize()); } dataEditorDialog.showDialog(); } } }; getApplicationConfig().commandConfigurer().configure(selectDialogCommand); return selectDialogCommand; } }
public class class_name { protected ActionCommand createDataEditorCommand() { ActionCommand selectDialogCommand = new ActionCommand(getSelectDialogCommandId()) { private ApplicationDialog dataEditorDialog; @Override protected void doExecuteCommand() { if (LookupBinding.this.propertyChangeMonitor.proceedOnChange()) { if (dataEditorDialog == null) { dataEditorDialog = new TitledWidgetApplicationDialog(getDataEditor(), TitledWidgetApplicationDialog.SELECT_CANCEL_MODE) { protected boolean onFinish() { if (getDataEditor().canClose()) return LookupBinding.this.onFinish(); return false; } @Override protected boolean onSelectNone() { getDataEditor().getTableWidget().unSelectAll(); return super.onSelectNone(); } @Override protected void onCancel() { if (getDataEditor().canClose()) super.onCancel(); } }; // depends on control dependency: [if], data = [none] dataEditorDialog.setParentComponent(getDataEditorButton()); // depends on control dependency: [if], data = [none] getDataEditor().setSelectMode(AbstractDataEditorWidget.ON); // depends on control dependency: [if], data = [none] getApplicationConfig().applicationObjectConfigurer().configure(dataEditorDialog, getSelectDialogId()); // depends on control dependency: [if], data = [(dataEditorDialog] } if (getParameter(NO_INITIALIZE_DATA_EDITOR) != ON) initializeDataEditor(); if (getDialogSize() != null) { dataEditorDialog.getDialog().setMinimumSize(getDialogSize()); // depends on control dependency: [if], data = [(getDialogSize()] } dataEditorDialog.showDialog(); // depends on control dependency: [if], data = [none] } } }; getApplicationConfig().commandConfigurer().configure(selectDialogCommand); return selectDialogCommand; } }
public class class_name { protected boolean abortPublishJob(CmsPublishJobInfoBean publishJob) { if (OpenCms.getMemoryMonitor().getCachedPublishJob(publishJob.getPublishHistoryId().toString()) != null) { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); return true; } else { return false; } } }
public class class_name { protected boolean abortPublishJob(CmsPublishJobInfoBean publishJob) { if (OpenCms.getMemoryMonitor().getCachedPublishJob(publishJob.getPublishHistoryId().toString()) != null) { // remove publish job from cache OpenCms.getMemoryMonitor().uncachePublishJob(publishJob); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String trimLastPathSection(String path) { String[] sections = path.split("/"); StringBuilder newPath = new StringBuilder("/"); for (int i = 1; i < sections.length - 1; i++) { newPath.append(sections[i]).append("/"); } return newPath.toString(); } }
public class class_name { public static String trimLastPathSection(String path) { String[] sections = path.split("/"); StringBuilder newPath = new StringBuilder("/"); for (int i = 1; i < sections.length - 1; i++) { newPath.append(sections[i]).append("/"); // depends on control dependency: [for], data = [i] } return newPath.toString(); } }
public class class_name { private void appendHourFormat(MethodSpec.Builder method, List<Node> fmt) { for (Node n : fmt) { if (n instanceof Text) { String t = ((Text)n).text(); boolean minute = t.equals(":") || t.equals("."); if (minute) { method.beginControlFlow("if (emitMins)"); } method.addStatement("b.append($S)", t); if (minute) { method.endControlFlow(); } } else { Field f = (Field)n; if (f.ch() == 'H') { if (f.width() == 1) { method.addStatement("zeroPad2(b, hours, 1)"); } else { method.addStatement("zeroPad2(b, hours, _short ? 1 : $L)", f.width()); } } else { method.beginControlFlow("if (emitMins)"); method.addStatement("zeroPad2(b, mins, $L)", f.width()); method.endControlFlow(); } } } } }
public class class_name { private void appendHourFormat(MethodSpec.Builder method, List<Node> fmt) { for (Node n : fmt) { if (n instanceof Text) { String t = ((Text)n).text(); boolean minute = t.equals(":") || t.equals("."); if (minute) { method.beginControlFlow("if (emitMins)"); } method.addStatement("b.append($S)", t); // depends on control dependency: [if], data = [none] if (minute) { method.endControlFlow(); // depends on control dependency: [if], data = [none] } } else { Field f = (Field)n; if (f.ch() == 'H') { if (f.width() == 1) { method.addStatement("zeroPad2(b, hours, 1)"); // depends on control dependency: [if], data = [1)] } else { method.addStatement("zeroPad2(b, hours, _short ? 1 : $L)", f.width()); // depends on control dependency: [if], data = [none] } } else { method.beginControlFlow("if (emitMins)"); method.addStatement("zeroPad2(b, mins, $L)", f.width()); method.endControlFlow(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public int link(final int size) { _currentFrameBottom = _frameTop; _frameTop += size; if (_frameTop >= _stackFrames.length) { XObject newsf[] = new XObject[_stackFrames.length + XPathContext.RECURSIONLIMIT + size]; System.arraycopy(_stackFrames, 0, newsf, 0, _stackFrames.length); _stackFrames = newsf; } if (_linksTop + 1 >= _links.length) { int newlinks[] = new int[_links.length + (CLEARLIMITATION * 2)]; System.arraycopy(_links, 0, newlinks, 0, _links.length); _links = newlinks; } _links[_linksTop++] = _currentFrameBottom; return _currentFrameBottom; } }
public class class_name { public int link(final int size) { _currentFrameBottom = _frameTop; _frameTop += size; if (_frameTop >= _stackFrames.length) { XObject newsf[] = new XObject[_stackFrames.length + XPathContext.RECURSIONLIMIT + size]; System.arraycopy(_stackFrames, 0, newsf, 0, _stackFrames.length); // depends on control dependency: [if], data = [none] _stackFrames = newsf; // depends on control dependency: [if], data = [none] } if (_linksTop + 1 >= _links.length) { int newlinks[] = new int[_links.length + (CLEARLIMITATION * 2)]; System.arraycopy(_links, 0, newlinks, 0, _links.length); // depends on control dependency: [if], data = [none] _links = newlinks; // depends on control dependency: [if], data = [none] } _links[_linksTop++] = _currentFrameBottom; return _currentFrameBottom; } }
public class class_name { public <T> List<T> getByScore(double min,double max){ Set<byte[]> result = null; try { if(isCluster(groupName)){ result = getBinaryJedisClusterCommands(groupName).zrangeByScore(keyBytes, min, max); }else{ result = getBinaryJedisCommands(groupName).zrangeByScore(keyBytes, min, max); } return toObjectList(new ArrayList<>(result)); } finally{ getJedisProvider(groupName).release(); } } }
public class class_name { public <T> List<T> getByScore(double min,double max){ Set<byte[]> result = null; try { if(isCluster(groupName)){ result = getBinaryJedisClusterCommands(groupName).zrangeByScore(keyBytes, min, max); // depends on control dependency: [if], data = [none] }else{ result = getBinaryJedisCommands(groupName).zrangeByScore(keyBytes, min, max); // depends on control dependency: [if], data = [none] } return toObjectList(new ArrayList<>(result)); // depends on control dependency: [try], data = [none] } finally{ getJedisProvider(groupName).release(); } } }
public class class_name { public SelectQuery orderBy(String name, Order order) { if (orderBy == null) { orderBy = new StringBuilder(ORDER_BY_LENGTH); orderBy.append(" ORDER BY "); } orderBy.append(name).append(" ").append(order.getStringCode()).append(", "); return this; } }
public class class_name { public SelectQuery orderBy(String name, Order order) { if (orderBy == null) { orderBy = new StringBuilder(ORDER_BY_LENGTH); // depends on control dependency: [if], data = [none] orderBy.append(" ORDER BY "); // depends on control dependency: [if], data = [none] } orderBy.append(name).append(" ").append(order.getStringCode()).append(", "); return this; } }
public class class_name { @Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); if (!result) { return false; } } return true; } }
public class class_name { @Override public boolean evaluate(FieldManager fieldManager, IndentPrinter printer) { Comparable fieldValue = fieldManager.getValue(fieldName); for (ConditionalTest test : conditionalTests) { boolean result = test.operator.apply(fieldValue, test.parameter); printer.print("- %s => %b", test.operator.description(fieldManager.getDescription(fieldName), fieldValue, test.parameter), result); // depends on control dependency: [for], data = [test] if (!result) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public static byte[] decodeHex(String hexStr) { if (StrUtil.isEmpty(hexStr)) { return null; } return decodeHex(hexStr.toCharArray()); } }
public class class_name { public static byte[] decodeHex(String hexStr) { if (StrUtil.isEmpty(hexStr)) { return null; // depends on control dependency: [if], data = [none] } return decodeHex(hexStr.toCharArray()); } }
public class class_name { public FieldInfoList getFieldInfo() { if (!scanResult.scanSpec.enableFieldInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableFieldInfo() before #scan()"); } // Implement field overriding final FieldInfoList fieldInfoList = new FieldInfoList(); final Set<String> fieldNameSet = new HashSet<>(); for (final ClassInfo ci : getOverrideOrder()) { for (final FieldInfo fi : ci.getDeclaredFieldInfo()) { // If field has not been overridden by field of same name if (fieldNameSet.add(fi.getName())) { // Add field to output order fieldInfoList.add(fi); } } } return fieldInfoList; } }
public class class_name { public FieldInfoList getFieldInfo() { if (!scanResult.scanSpec.enableFieldInfo) { throw new IllegalArgumentException("Please call ClassGraph#enableFieldInfo() before #scan()"); } // Implement field overriding final FieldInfoList fieldInfoList = new FieldInfoList(); final Set<String> fieldNameSet = new HashSet<>(); for (final ClassInfo ci : getOverrideOrder()) { for (final FieldInfo fi : ci.getDeclaredFieldInfo()) { // If field has not been overridden by field of same name if (fieldNameSet.add(fi.getName())) { // Add field to output order fieldInfoList.add(fi); // depends on control dependency: [if], data = [none] } } } return fieldInfoList; } }
public class class_name { public TLSCertificateKeyPair serverCert(String subjectAlternativeName) { try { return createCert(CertType.SERVER, subjectAlternativeName); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public TLSCertificateKeyPair serverCert(String subjectAlternativeName) { try { return createCert(CertType.SERVER, subjectAlternativeName); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Component prepareFolderFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) { FacetField folderFacets = solrResultList.getFacetField(CmsListManager.FIELD_PARENT_FOLDERS); I_CmsSearchControllerFacetField facetController = resultWrapper.getController().getFieldFacets().getFieldFacetController().get( CmsListManager.FIELD_PARENT_FOLDERS); if ((folderFacets != null) && (folderFacets.getValueCount() > 0)) { VerticalLayout folderLayout = new VerticalLayout(); for (final Count value : filterFolderFacets(folderFacets.getValues())) { Button folder = new Button(getFolderLabel(value.getName()) + " (" + value.getCount() + ")"); folder.addStyleName(ValoTheme.BUTTON_TINY); folder.addStyleName(ValoTheme.BUTTON_BORDERLESS); Boolean selected = facetController.getState().getIsChecked().get(value.getName()); if ((selected != null) && selected.booleanValue()) { folder.addStyleName(SELECTED_STYLE); } folder.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (isSelected(event.getComponent())) { resetFacetsAndSearch(); } else { selectFieldFacet(CmsListManager.FIELD_PARENT_FOLDERS, value.getName()); } } }); folderLayout.addComponent(folder); } Panel folderPanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_FOLDERS_0)); folderPanel.setContent(folderLayout); return folderPanel; } else { return null; } } }
public class class_name { private Component prepareFolderFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) { FacetField folderFacets = solrResultList.getFacetField(CmsListManager.FIELD_PARENT_FOLDERS); I_CmsSearchControllerFacetField facetController = resultWrapper.getController().getFieldFacets().getFieldFacetController().get( CmsListManager.FIELD_PARENT_FOLDERS); if ((folderFacets != null) && (folderFacets.getValueCount() > 0)) { VerticalLayout folderLayout = new VerticalLayout(); for (final Count value : filterFolderFacets(folderFacets.getValues())) { Button folder = new Button(getFolderLabel(value.getName()) + " (" + value.getCount() + ")"); folder.addStyleName(ValoTheme.BUTTON_TINY); folder.addStyleName(ValoTheme.BUTTON_BORDERLESS); Boolean selected = facetController.getState().getIsChecked().get(value.getName()); if ((selected != null) && selected.booleanValue()) { folder.addStyleName(SELECTED_STYLE); } folder.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (isSelected(event.getComponent())) { resetFacetsAndSearch(); // depends on control dependency: [if], data = [none] } else { selectFieldFacet(CmsListManager.FIELD_PARENT_FOLDERS, value.getName()); // depends on control dependency: [if], data = [none] } } }); folderLayout.addComponent(folder); } Panel folderPanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_FOLDERS_0)); folderPanel.setContent(folderLayout); return folderPanel; } else { return null; } } }
public class class_name { @SuppressWarnings("unused") // called through reflection by RequestServer public ModelBuildersV3 list(int version, ModelBuildersV3 m) { m.model_builders = new ModelBuilderSchema.IcedHashMapStringModelBuilderSchema(); for( String algo : ModelBuilder.algos() ) { ModelBuilder builder = ModelBuilder.make(algo, null, null); m.model_builders.put(algo.toLowerCase(), (ModelBuilderSchema)SchemaServer.schema(version, builder).fillFromImpl(builder)); } return m; } }
public class class_name { @SuppressWarnings("unused") // called through reflection by RequestServer public ModelBuildersV3 list(int version, ModelBuildersV3 m) { m.model_builders = new ModelBuilderSchema.IcedHashMapStringModelBuilderSchema(); for( String algo : ModelBuilder.algos() ) { ModelBuilder builder = ModelBuilder.make(algo, null, null); m.model_builders.put(algo.toLowerCase(), (ModelBuilderSchema)SchemaServer.schema(version, builder).fillFromImpl(builder)); // depends on control dependency: [for], data = [algo] } return m; } }
public class class_name { public <T> T updateBatchAndProcessGeneratedKeys(@NotNull ResultSetProcessor<T> generatedKeysProcessor, @NotNull List<String> columnNames, @NotNull @SQL String sql, @NotNull List<? extends List<?>> argumentLists) { SqlQuery query = SqlQuery.query(sql, "<batch-update>"); return withCurrentTransaction(query, tx -> { logQuery(query); try (PreparedStatement ps = prepareStatement(tx.getConnection(), sql, columnNames)) { bindQueryParameters(ps, query); for (List<?> arguments : argumentLists) { bindArguments(ps, arguments); ps.addBatch(); } long startTime = currentTimeMillis(); ps.executeBatch(); logQueryExecution(query, currentTimeMillis() - startTime); try (ResultSet rs = ps.getGeneratedKeys()) { return generatedKeysProcessor.process(rs); } } }); } }
public class class_name { public <T> T updateBatchAndProcessGeneratedKeys(@NotNull ResultSetProcessor<T> generatedKeysProcessor, @NotNull List<String> columnNames, @NotNull @SQL String sql, @NotNull List<? extends List<?>> argumentLists) { SqlQuery query = SqlQuery.query(sql, "<batch-update>"); return withCurrentTransaction(query, tx -> { logQuery(query); try (PreparedStatement ps = prepareStatement(tx.getConnection(), sql, columnNames)) { bindQueryParameters(ps, query); for (List<?> arguments : argumentLists) { bindArguments(ps, arguments); // depends on control dependency: [for], data = [arguments] ps.addBatch(); // depends on control dependency: [for], data = [none] } long startTime = currentTimeMillis(); ps.executeBatch(); logQueryExecution(query, currentTimeMillis() - startTime); try (ResultSet rs = ps.getGeneratedKeys()) { return generatedKeysProcessor.process(rs); } } }); } }
public class class_name { public void startReporting() { // make sure we report the lifecycle event only once if (startupEventReported == true) { logger.error("startup event has already been reported or is being reported now"); return; } startupEventReported = true; // the startup event has to be reported in its own thread, as this is // done forever. Otherwise a servlet will hang in startup mode forever // and can't be stopped by normal admin commands. Callable<Boolean> reportEventCallable = new Callable<Boolean>() { public Boolean call() { try { // Notify BPC of BP startup event in a loop. if (reportEventLoop()) { // reporting successful within the allowed number of // retries return true; } // The BPC could not be reached, so return. logger.error("Bounce Proxy lifecycle event notification failed. Exiting."); } catch (Exception e) { logger.error("Uncaught exception in reporting lifecycle event.", e); } startupEventReported = false; return false; } }; // don't wait for the callable to end so that shutting down is possible // at any time startupReportFuture = execService.submit(reportEventCallable); startupReportFutureAvailable.release(); } }
public class class_name { public void startReporting() { // make sure we report the lifecycle event only once if (startupEventReported == true) { logger.error("startup event has already been reported or is being reported now"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } startupEventReported = true; // the startup event has to be reported in its own thread, as this is // done forever. Otherwise a servlet will hang in startup mode forever // and can't be stopped by normal admin commands. Callable<Boolean> reportEventCallable = new Callable<Boolean>() { public Boolean call() { try { // Notify BPC of BP startup event in a loop. if (reportEventLoop()) { // reporting successful within the allowed number of // retries return true; // depends on control dependency: [if], data = [none] } // The BPC could not be reached, so return. logger.error("Bounce Proxy lifecycle event notification failed. Exiting."); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Uncaught exception in reporting lifecycle event.", e); } // depends on control dependency: [catch], data = [none] startupEventReported = false; return false; } }; // don't wait for the callable to end so that shutting down is possible // at any time startupReportFuture = execService.submit(reportEventCallable); startupReportFutureAvailable.release(); } }
public class class_name { @Override public void close() { // make sure that we close only once synchronized (this.stateLock) { if (this.closed) { return; } this.closed = true; } LOG.debug("Closing hash table and releasing resources."); // release the table structure releaseTable(); // clear the memory in the partitions clearPartitions(); } }
public class class_name { @Override public void close() { // make sure that we close only once synchronized (this.stateLock) { if (this.closed) { return; // depends on control dependency: [if], data = [none] } this.closed = true; } LOG.debug("Closing hash table and releasing resources."); // release the table structure releaseTable(); // clear the memory in the partitions clearPartitions(); } }
public class class_name { @Nullable final Permutation calculatePermutation( @Nonnull final TreeLogger logger, @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) throws UnableToCompleteException { Permutation permutation = null; for ( final SelectionInformation result : artifacts.find( SelectionInformation.class ) ) { final String strongName = result.getStrongName(); if ( null != permutation && !permutation.getPermutationName().equals( strongName ) ) { throw new UnableToCompleteException(); } if ( null == permutation ) { permutation = new Permutation( strongName ); final Set<String> artifactsForCompilation = getArtifactsForCompilation( context, artifacts ); permutation.getPermutationFiles().addAll( artifactsForCompilation ); } final List<BindingProperty> list = new ArrayList<>(); for ( final SelectionProperty property : context.getProperties() ) { if ( !property.isDerived() ) { final String name = property.getName(); final String value = result.getPropMap().get( name ); if ( null != value ) { list.add( new BindingProperty( name, value ) ); } } } final SelectionDescriptor selection = new SelectionDescriptor( strongName, list ); final List<SelectionDescriptor> selectors = permutation.getSelectors(); if ( !selectors.contains( selection ) ) { selectors.add( selection ); } } if ( null != permutation ) { logger.log( Type.DEBUG, "Calculated Permutation: " + permutation.getPermutationName() + " Selectors: " + permutation.getSelectors() ); } return permutation; } }
public class class_name { @Nullable final Permutation calculatePermutation( @Nonnull final TreeLogger logger, @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) throws UnableToCompleteException { Permutation permutation = null; for ( final SelectionInformation result : artifacts.find( SelectionInformation.class ) ) { final String strongName = result.getStrongName(); if ( null != permutation && !permutation.getPermutationName().equals( strongName ) ) { throw new UnableToCompleteException(); } if ( null == permutation ) { permutation = new Permutation( strongName ); // depends on control dependency: [if], data = [none] final Set<String> artifactsForCompilation = getArtifactsForCompilation( context, artifacts ); permutation.getPermutationFiles().addAll( artifactsForCompilation ); // depends on control dependency: [if], data = [none] } final List<BindingProperty> list = new ArrayList<>(); for ( final SelectionProperty property : context.getProperties() ) { if ( !property.isDerived() ) { final String name = property.getName(); final String value = result.getPropMap().get( name ); if ( null != value ) { list.add( new BindingProperty( name, value ) ); // depends on control dependency: [if], data = [value )] } } } final SelectionDescriptor selection = new SelectionDescriptor( strongName, list ); final List<SelectionDescriptor> selectors = permutation.getSelectors(); if ( !selectors.contains( selection ) ) { selectors.add( selection ); // depends on control dependency: [if], data = [none] } } if ( null != permutation ) { logger.log( Type.DEBUG, "Calculated Permutation: " + permutation.getPermutationName() + " Selectors: " + permutation.getSelectors() ); } return permutation; } }
public class class_name { public String getRemoteHost() { String host = "127.0.0.1"; HttpConnection connection = getHttpConnection(); if (connection != null) { host = connection.getRemoteHost(); if (host == null) host = connection.getRemoteAddr(); } return host; } }
public class class_name { public String getRemoteHost() { String host = "127.0.0.1"; HttpConnection connection = getHttpConnection(); if (connection != null) { host = connection.getRemoteHost(); // depends on control dependency: [if], data = [none] if (host == null) host = connection.getRemoteAddr(); } return host; } }
public class class_name { private int getViewID() { if (viewID < 0) { String sql = "SELECT view_id FROM views WHERE name=?"; String[] args = {name}; Cursor cursor = null; try { cursor = store.getStorageEngine().rawQuery(sql, args); if (cursor.moveToNext()) { viewID = cursor.getInt(0); } } catch (SQLException e) { Log.e(Log.TAG_VIEW, "Error getting view id", e); } finally { if (cursor != null) { cursor.close(); } } } return viewID; } }
public class class_name { private int getViewID() { if (viewID < 0) { String sql = "SELECT view_id FROM views WHERE name=?"; String[] args = {name}; Cursor cursor = null; try { cursor = store.getStorageEngine().rawQuery(sql, args); // depends on control dependency: [try], data = [none] if (cursor.moveToNext()) { viewID = cursor.getInt(0); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { Log.e(Log.TAG_VIEW, "Error getting view id", e); } finally { // depends on control dependency: [catch], data = [none] if (cursor != null) { cursor.close(); // depends on control dependency: [if], data = [none] } } } return viewID; } }
public class class_name { private static Long getApproximateZoomLevel(double[] lengths, List<TileMatrix> tileMatrices, double length) { Long lengthZoomLevel = null; double minLength = lengths[0]; double maxLength = lengths[lengths.length - 1]; // Length is zoomed in further than available tiles if (length < minLength) { double levelsIn = Math.log(length / minLength) / Math.log(.5); long zoomAbove = (long) Math.floor(levelsIn); long zoomBelow = (long) Math.ceil(levelsIn); double lengthAbove = minLength * Math.pow(.5, zoomAbove); double lengthBelow = minLength * Math.pow(.5, zoomBelow); lengthZoomLevel = tileMatrices.get(tileMatrices.size() - 1) .getZoomLevel(); if (lengthAbove - length <= length - lengthBelow) { lengthZoomLevel += zoomAbove; } else { lengthZoomLevel += zoomBelow; } } // Length is zoomed out further than available tiles else if (length > maxLength) { double levelsOut = Math.log(length / maxLength) / Math.log(2); long zoomAbove = (long) Math.ceil(levelsOut); long zoomBelow = (long) Math.floor(levelsOut); double lengthAbove = maxLength * Math.pow(2, zoomAbove); double lengthBelow = maxLength * Math.pow(2, zoomBelow); lengthZoomLevel = tileMatrices.get(0).getZoomLevel(); if (length - lengthBelow <= lengthAbove - length) { lengthZoomLevel -= zoomBelow; } else { lengthZoomLevel -= zoomAbove; } } // Length is between the available tiles else { int lengthIndex = Arrays.binarySearch(lengths, length); if (lengthIndex < 0) { lengthIndex = (lengthIndex + 1) * -1; } double zoomDistance = Math.log(length / lengths[lengthIndex]) / Math.log(.5); long zoomLevelAbove = getTileMatrixAtLengthIndex(tileMatrices, lengthIndex).getZoomLevel(); zoomLevelAbove += Math.round(zoomDistance); lengthZoomLevel = zoomLevelAbove; } return lengthZoomLevel; } }
public class class_name { private static Long getApproximateZoomLevel(double[] lengths, List<TileMatrix> tileMatrices, double length) { Long lengthZoomLevel = null; double minLength = lengths[0]; double maxLength = lengths[lengths.length - 1]; // Length is zoomed in further than available tiles if (length < minLength) { double levelsIn = Math.log(length / minLength) / Math.log(.5); long zoomAbove = (long) Math.floor(levelsIn); long zoomBelow = (long) Math.ceil(levelsIn); double lengthAbove = minLength * Math.pow(.5, zoomAbove); double lengthBelow = minLength * Math.pow(.5, zoomBelow); lengthZoomLevel = tileMatrices.get(tileMatrices.size() - 1) .getZoomLevel(); // depends on control dependency: [if], data = [none] if (lengthAbove - length <= length - lengthBelow) { lengthZoomLevel += zoomAbove; // depends on control dependency: [if], data = [none] } else { lengthZoomLevel += zoomBelow; // depends on control dependency: [if], data = [none] } } // Length is zoomed out further than available tiles else if (length > maxLength) { double levelsOut = Math.log(length / maxLength) / Math.log(2); long zoomAbove = (long) Math.ceil(levelsOut); long zoomBelow = (long) Math.floor(levelsOut); double lengthAbove = maxLength * Math.pow(2, zoomAbove); double lengthBelow = maxLength * Math.pow(2, zoomBelow); lengthZoomLevel = tileMatrices.get(0).getZoomLevel(); // depends on control dependency: [if], data = [none] if (length - lengthBelow <= lengthAbove - length) { lengthZoomLevel -= zoomBelow; // depends on control dependency: [if], data = [none] } else { lengthZoomLevel -= zoomAbove; // depends on control dependency: [if], data = [none] } } // Length is between the available tiles else { int lengthIndex = Arrays.binarySearch(lengths, length); if (lengthIndex < 0) { lengthIndex = (lengthIndex + 1) * -1; // depends on control dependency: [if], data = [(lengthIndex] } double zoomDistance = Math.log(length / lengths[lengthIndex]) / Math.log(.5); long zoomLevelAbove = getTileMatrixAtLengthIndex(tileMatrices, lengthIndex).getZoomLevel(); zoomLevelAbove += Math.round(zoomDistance); // depends on control dependency: [if], data = [none] lengthZoomLevel = zoomLevelAbove; // depends on control dependency: [if], data = [none] } return lengthZoomLevel; } }
public class class_name { public void processHttpChainWork(boolean enableEndpoint, boolean isPause) { if (enableEndpoint) { // enable the endpoint if it is currently disabled // it's ok if the endpoint is stopped, the config update will occur @ next start endpointState.compareAndSet(DISABLED, ENABLED); if (httpPort >= 0) { httpChain.enable(); } if (httpsPort >= 0 && sslFactoryProvider.getService() != null) { httpSecureChain.enable(); } if (!isPause) { // Use an update action so they pick up the new settings performAction(updateAction); } else { updateAction.run(); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "endpoint disabled: " + (String) endpointConfig.get("id")); } // The endpoint has been disabled-- stop it now endpointState.set(DISABLED); if (!isPause) { performAction(stopAction); } else { stopAction.run(); } } } }
public class class_name { public void processHttpChainWork(boolean enableEndpoint, boolean isPause) { if (enableEndpoint) { // enable the endpoint if it is currently disabled // it's ok if the endpoint is stopped, the config update will occur @ next start endpointState.compareAndSet(DISABLED, ENABLED); // depends on control dependency: [if], data = [none] if (httpPort >= 0) { httpChain.enable(); // depends on control dependency: [if], data = [none] } if (httpsPort >= 0 && sslFactoryProvider.getService() != null) { httpSecureChain.enable(); // depends on control dependency: [if], data = [none] } if (!isPause) { // Use an update action so they pick up the new settings performAction(updateAction); // depends on control dependency: [if], data = [none] } else { updateAction.run(); // depends on control dependency: [if], data = [none] } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "endpoint disabled: " + (String) endpointConfig.get("id")); // depends on control dependency: [if], data = [none] } // The endpoint has been disabled-- stop it now endpointState.set(DISABLED); // depends on control dependency: [if], data = [none] if (!isPause) { performAction(stopAction); // depends on control dependency: [if], data = [none] } else { stopAction.run(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { byte[] readPage(long pageIndex) throws IOException { synchronized (lockObject) { lastAccessTime = System.nanoTime(); if (pageIndex == lastWrittenPageIndex) { return lastWrittenPage.array(); } if (pageIndex >= firstCachedPage && pageIndex < firstCachedPage + pageCache.size()) { final ByteBuffer buffer = pageCache.get((int) (pageIndex - firstCachedPage)); return buffer.array(); } final ByteBuffer buffer = ByteBuffer.allocate(OWALPage.PAGE_SIZE).order(ByteOrder.nativeOrder()); initFile(); segChannel.position(pageIndex * OWALPage.PAGE_SIZE); readByteBuffer(buffer, segChannel); return buffer.array(); } } }
public class class_name { byte[] readPage(long pageIndex) throws IOException { synchronized (lockObject) { lastAccessTime = System.nanoTime(); if (pageIndex == lastWrittenPageIndex) { return lastWrittenPage.array(); // depends on control dependency: [if], data = [none] } if (pageIndex >= firstCachedPage && pageIndex < firstCachedPage + pageCache.size()) { final ByteBuffer buffer = pageCache.get((int) (pageIndex - firstCachedPage)); return buffer.array(); // depends on control dependency: [if], data = [none] } final ByteBuffer buffer = ByteBuffer.allocate(OWALPage.PAGE_SIZE).order(ByteOrder.nativeOrder()); initFile(); segChannel.position(pageIndex * OWALPage.PAGE_SIZE); readByteBuffer(buffer, segChannel); return buffer.array(); } } }
public class class_name { public static boolean isLinux(String os) { if (os == null) { return false; } String operating = os.toLowerCase(); return operating.contains("nix") || operating.contains("nux") || operating.contains("aix"); } }
public class class_name { public static boolean isLinux(String os) { if (os == null) { return false; // depends on control dependency: [if], data = [none] } String operating = os.toLowerCase(); return operating.contains("nix") || operating.contains("nux") || operating.contains("aix"); } }
public class class_name { @Override void archive() { FTPArchiveClient client = new FTPArchiveClient(); try { client.init(clientArguments); } catch (UnknownHostException e) { throw new Audit4jRuntimeException("Excepting in running archive client.", e); } } }
public class class_name { @Override void archive() { FTPArchiveClient client = new FTPArchiveClient(); try { client.init(clientArguments); // depends on control dependency: [try], data = [none] } catch (UnknownHostException e) { throw new Audit4jRuntimeException("Excepting in running archive client.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static int[] gammaLUT(double gammaValue) { int[] gammaLUT = new int[256]; for (int i = 0; i < gammaLUT.length; i++) { gammaLUT[i] = (int) (255 * (Math.pow((double) i / (double) 255, gammaValue))); } return gammaLUT; } }
public class class_name { private static int[] gammaLUT(double gammaValue) { int[] gammaLUT = new int[256]; for (int i = 0; i < gammaLUT.length; i++) { gammaLUT[i] = (int) (255 * (Math.pow((double) i / (double) 255, gammaValue))); // depends on control dependency: [for], data = [i] } return gammaLUT; } }
public class class_name { public void hideSoftKeyboard(EditText editText, boolean shouldSleepFirst, boolean shouldSleepAfter) { InputMethodManager inputMethodManager; Activity activity = activityUtils.getCurrentActivity(shouldSleepFirst); if(activity == null){ inputMethodManager = (InputMethodManager) instrumentation.getTargetContext().getSystemService(Context.INPUT_METHOD_SERVICE); } else { inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); } if(editText != null) { inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0); return; } View focusedView = activity.getCurrentFocus(); if(!(focusedView instanceof EditText)) { EditText freshestEditText = viewFetcher.getFreshestView(viewFetcher.getCurrentViews(EditText.class, true)); if(freshestEditText != null){ focusedView = freshestEditText; } } if(focusedView != null) { inputMethodManager.hideSoftInputFromWindow(focusedView.getWindowToken(), 0); } if(shouldSleepAfter){ sleeper.sleep(); } } }
public class class_name { public void hideSoftKeyboard(EditText editText, boolean shouldSleepFirst, boolean shouldSleepAfter) { InputMethodManager inputMethodManager; Activity activity = activityUtils.getCurrentActivity(shouldSleepFirst); if(activity == null){ inputMethodManager = (InputMethodManager) instrumentation.getTargetContext().getSystemService(Context.INPUT_METHOD_SERVICE); // depends on control dependency: [if], data = [none] } else { inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); // depends on control dependency: [if], data = [none] } if(editText != null) { inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(), 0); // depends on control dependency: [if], data = [(editText] return; // depends on control dependency: [if], data = [none] } View focusedView = activity.getCurrentFocus(); if(!(focusedView instanceof EditText)) { EditText freshestEditText = viewFetcher.getFreshestView(viewFetcher.getCurrentViews(EditText.class, true)); if(freshestEditText != null){ focusedView = freshestEditText; // depends on control dependency: [if], data = [none] } } if(focusedView != null) { inputMethodManager.hideSoftInputFromWindow(focusedView.getWindowToken(), 0); // depends on control dependency: [if], data = [(focusedView] } if(shouldSleepAfter){ sleeper.sleep(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void generate( String templateName, Row row ) { try { CompiledTemplate template = getTemplate( templateName ); VariableResolverFactory factory = new MapVariableResolverFactory(); Map<String, Object> vars = new HashMap<String, Object>(); initializePriorCommaConstraints( vars ); initializeHasPriorJunctionConstraint( vars ); vars.put( "row", row ); for ( Cell cell : row.getCells() ) { cell.addValue( vars ); } String drl = String.valueOf( TemplateRuntime.execute( template, vars, factory, registry ) ); rules.add( drl ); } catch ( Exception e ) { throw new RuntimeException( e ); } } }
public class class_name { public void generate( String templateName, Row row ) { try { CompiledTemplate template = getTemplate( templateName ); VariableResolverFactory factory = new MapVariableResolverFactory(); Map<String, Object> vars = new HashMap<String, Object>(); initializePriorCommaConstraints( vars ); // depends on control dependency: [try], data = [none] initializeHasPriorJunctionConstraint( vars ); // depends on control dependency: [try], data = [none] vars.put( "row", row ); // depends on control dependency: [try], data = [none] for ( Cell cell : row.getCells() ) { cell.addValue( vars ); // depends on control dependency: [for], data = [cell] } String drl = String.valueOf( TemplateRuntime.execute( template, vars, factory, registry ) ); rules.add( drl ); // depends on control dependency: [try], data = [none] } catch ( Exception e ) { throw new RuntimeException( e ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setRow(long id, TRow row) { lock.lock(); try { RowCondition rowCondition = rows.remove(id); if (rowCondition != null) { rowCondition.row = row; rowCondition.condition.signalAll(); } } finally { lock.unlock(); } } }
public class class_name { public void setRow(long id, TRow row) { lock.lock(); try { RowCondition rowCondition = rows.remove(id); if (rowCondition != null) { rowCondition.row = row; // depends on control dependency: [if], data = [none] rowCondition.condition.signalAll(); // depends on control dependency: [if], data = [none] } } finally { lock.unlock(); } } }
public class class_name { public int readLine(byte[] b, int off, int len) throws IOException { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine"); } if ( total >= limit ) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine Over the limit: -1"); } return -1; } int avail; //bytes available in buffer int readlen; //amount to be read by copyline int remain = 0; //amount remaining to be read int newlen; //amount read by copyline int totalread; //total amount read so far remain = len; avail = count - pos; if ( avail <= 0 ) { fill(); avail = count - pos; if ( avail <= 0 ) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine avail less than 0: -1"); } return -1; } } if ( avail < len ) { readlen = avail; } else { readlen = len; } newlen = copyLine(buf, pos, b, off, readlen); pos += newlen; total += newlen; remain -= newlen; totalread = newlen; if ( totalread == 0 ) { //should never happen if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine totalRead is 0: -1"); } return -1; } while ( remain > 0 && b[off+totalread-1] != '\n' ) { //loop through until the conditions of the method are satisfied fill(); avail = count - pos; if ( avail <= 0 ) { // The stream is finished, return what we have. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine returning --> "+totalread); } return totalread; } if ( avail < remain ) { readlen = avail; } else { readlen = remain; } newlen = copyLine(buf, pos, b, off+totalread, readlen); pos += newlen; total += newlen; remain -= newlen; totalread += newlen; } return totalread; } }
public class class_name { public int readLine(byte[] b, int off, int len) throws IOException { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine"); } if ( total >= limit ) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine Over the limit: -1"); // depends on control dependency: [if], data = [none] } return -1; } int avail; //bytes available in buffer int readlen; //amount to be read by copyline int remain = 0; //amount remaining to be read int newlen; //amount read by copyline int totalread; //total amount read so far remain = len; avail = count - pos; if ( avail <= 0 ) { fill(); avail = count - pos; if ( avail <= 0 ) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine avail less than 0: -1"); } return -1; } } if ( avail < len ) { readlen = avail; } else { readlen = len; } newlen = copyLine(buf, pos, b, off, readlen); pos += newlen; total += newlen; remain -= newlen; totalread = newlen; if ( totalread == 0 ) { //should never happen if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine totalRead is 0: -1"); } return -1; } while ( remain > 0 && b[off+totalread-1] != '\n' ) { //loop through until the conditions of the method are satisfied fill(); avail = count - pos; if ( avail <= 0 ) { // The stream is finished, return what we have. if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"readLine", "readLine returning --> "+totalread); } return totalread; } if ( avail < remain ) { readlen = avail; } else { readlen = remain; } newlen = copyLine(buf, pos, b, off+totalread, readlen); pos += newlen; total += newlen; remain -= newlen; totalread += newlen; } return totalread; } }
public class class_name { private static void genVisits(int noVisits, int noDocs, String path) { Random rand = new Random(Calendar.getInstance().getTimeInMillis()); try (BufferedWriter fw = new BufferedWriter(new FileWriter(path))) { for (int i = 0; i < noVisits; i++) { int year = 2000 + rand.nextInt(10); // yearFilter 3 int month = rand.nextInt(12) + 1; // month between 1 and 12 int day = rand.nextInt(27) + 1; // day between 1 and 28 // IP address StringBuilder visit = new StringBuilder(rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256) + "|"); // URL visit.append("url_" + rand.nextInt(noDocs) + "|"); // Date (format: YYYY-MM-DD) visit.append(year + "-" + month + "-" + day + "|"); // Miscellaneous data, e.g. User-Agent visit.append("0.12|Mozilla Firefox 3.1|de|de|Nothing special|124|\n"); fw.write(visit.toString()); } } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { private static void genVisits(int noVisits, int noDocs, String path) { Random rand = new Random(Calendar.getInstance().getTimeInMillis()); try (BufferedWriter fw = new BufferedWriter(new FileWriter(path))) { for (int i = 0; i < noVisits; i++) { int year = 2000 + rand.nextInt(10); // yearFilter 3 int month = rand.nextInt(12) + 1; // month between 1 and 12 int day = rand.nextInt(27) + 1; // day between 1 and 28 // IP address StringBuilder visit = new StringBuilder(rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256) + "|"); // URL visit.append("url_" + rand.nextInt(noDocs) + "|"); // depends on control dependency: [for], data = [none] // Date (format: YYYY-MM-DD) visit.append(year + "-" + month + "-" + day + "|"); // depends on control dependency: [for], data = [none] // Miscellaneous data, e.g. User-Agent visit.append("0.12|Mozilla Firefox 3.1|de|de|Nothing special|124|\n"); // depends on control dependency: [for], data = [none] fw.write(visit.toString()); // depends on control dependency: [for], data = [none] } } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { protected void invokeInterceptorsImpl(FaxClientSpiProxyEventType eventType,Method method,Object[] arguments,Object output,Throwable throwable) { //get interceptors FaxClientSpiInterceptor[] interceptors=this.getFaxClientSpiInterceptors(); //get interceptors amount int amount=interceptors.length; FaxClientSpiInterceptor interceptor=null; for(int index=0;index<amount;index++) { //get next interceptor interceptor=interceptors[index]; //invoke interceptor if(eventType==FaxClientSpiProxyEventType.PRE_EVENT_TYPE) { interceptor.preMethodInvocation(method,arguments); } else if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE) { interceptor.postMethodInvocation(method,arguments,output); } else { interceptor.onMethodInvocationError(method,arguments,throwable); } } } }
public class class_name { protected void invokeInterceptorsImpl(FaxClientSpiProxyEventType eventType,Method method,Object[] arguments,Object output,Throwable throwable) { //get interceptors FaxClientSpiInterceptor[] interceptors=this.getFaxClientSpiInterceptors(); //get interceptors amount int amount=interceptors.length; FaxClientSpiInterceptor interceptor=null; for(int index=0;index<amount;index++) { //get next interceptor interceptor=interceptors[index]; // depends on control dependency: [for], data = [index] //invoke interceptor if(eventType==FaxClientSpiProxyEventType.PRE_EVENT_TYPE) { interceptor.preMethodInvocation(method,arguments); // depends on control dependency: [if], data = [none] } else if(eventType==FaxClientSpiProxyEventType.POST_EVENT_TYPE) { interceptor.postMethodInvocation(method,arguments,output); // depends on control dependency: [if], data = [none] } else { interceptor.onMethodInvocationError(method,arguments,throwable); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) { // Ignore methods and constructors that are not annotated with {@link MustBeClosed}. return NO_MATCH; } boolean isAConstructor = methodIsConstructor().matches(tree, state); if (isAConstructor && !AUTO_CLOSEABLE_CONSTRUCTOR_MATCHER.matches(tree, state)) { return buildDescription(tree) .setMessage("MustBeClosed should only annotate constructors of AutoCloseables.") .build(); } if (!isAConstructor && !METHOD_RETURNS_AUTO_CLOSEABLE_MATCHER.matches(tree, state)) { return buildDescription(tree) .setMessage("MustBeClosed should only annotate methods that return an AutoCloseable.") .build(); } return NO_MATCH; } }
public class class_name { @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) { // Ignore methods and constructors that are not annotated with {@link MustBeClosed}. return NO_MATCH; // depends on control dependency: [if], data = [none] } boolean isAConstructor = methodIsConstructor().matches(tree, state); if (isAConstructor && !AUTO_CLOSEABLE_CONSTRUCTOR_MATCHER.matches(tree, state)) { return buildDescription(tree) .setMessage("MustBeClosed should only annotate constructors of AutoCloseables.") .build(); // depends on control dependency: [if], data = [none] } if (!isAConstructor && !METHOD_RETURNS_AUTO_CLOSEABLE_MATCHER.matches(tree, state)) { return buildDescription(tree) .setMessage("MustBeClosed should only annotate methods that return an AutoCloseable.") .build(); // depends on control dependency: [if], data = [none] } return NO_MATCH; } }
public class class_name { private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getRowCount(); maybeNotifyListeners(oldCount, count); } } }
public class class_name { private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getRowCount(); // depends on control dependency: [if], data = [none] maybeNotifyListeners(oldCount, count); // depends on control dependency: [if], data = [none] } } }
public class class_name { public StyleDao getStyleDao() { StyleDao styleDao = null; if (geoPackage.isTable(StyleTable.TABLE_NAME)) { AttributesDao attributesDao = getGeoPackage().getAttributesDao( StyleTable.TABLE_NAME); styleDao = new StyleDao(attributesDao); relatedTables.setContents(styleDao.getTable()); } return styleDao; } }
public class class_name { public StyleDao getStyleDao() { StyleDao styleDao = null; if (geoPackage.isTable(StyleTable.TABLE_NAME)) { AttributesDao attributesDao = getGeoPackage().getAttributesDao( StyleTable.TABLE_NAME); styleDao = new StyleDao(attributesDao); // depends on control dependency: [if], data = [none] relatedTables.setContents(styleDao.getTable()); // depends on control dependency: [if], data = [none] } return styleDao; } }
public class class_name { @Override public boolean requestPermissionToFinishRead() { boolean rc = true; synchronized (this) { if ((currentState & FINISH_NOT_ALLOWED_MASK) != 0) { rc = false; } else { currentState = (currentState | READ_FINISHING) & READ_FINISHING_CLEAR_OUT; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "requestPermissionToFinishRead returning " + rc); } return rc; } }
public class class_name { @Override public boolean requestPermissionToFinishRead() { boolean rc = true; synchronized (this) { if ((currentState & FINISH_NOT_ALLOWED_MASK) != 0) { rc = false; // depends on control dependency: [if], data = [none] } else { currentState = (currentState | READ_FINISHING) & READ_FINISHING_CLEAR_OUT; // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "requestPermissionToFinishRead returning " + rc); // depends on control dependency: [if], data = [none] } return rc; } }
public class class_name { public OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener) { if (!mGattClient.isConnected()) { listener.error(BeanError.NOT_CONNECTED); } Log.i(TAG, "Starting firmware update procedure"); // Save state for this firmware procedure this.oadListener = listener; this.firmwareBundle = bundle; watchdog.start(OAD_TIMEOUT_SECONDS, watchdogListener); checkFirmwareVersion(); return this.oadApproval; } }
public class class_name { public OADApproval programWithFirmware(final FirmwareBundle bundle, OADListener listener) { if (!mGattClient.isConnected()) { listener.error(BeanError.NOT_CONNECTED); // depends on control dependency: [if], data = [none] } Log.i(TAG, "Starting firmware update procedure"); // Save state for this firmware procedure this.oadListener = listener; this.firmwareBundle = bundle; watchdog.start(OAD_TIMEOUT_SECONDS, watchdogListener); checkFirmwareVersion(); return this.oadApproval; } }
public class class_name { public EGeometryType getType() { SymbolizerWrapper geometrySymbolizersWrapper = getGeometrySymbolizersWrapper(); if (geometrySymbolizersWrapper == null) { return null; } Symbolizer symbolizer = geometrySymbolizersWrapper.getSymbolizer(); if (symbolizer instanceof PointSymbolizer) { return EGeometryType.POINT; } else if (symbolizer instanceof LineSymbolizer) { return EGeometryType.LINESTRING; } else if (symbolizer instanceof PolygonSymbolizer) { return EGeometryType.POLYGON; } else if (symbolizer instanceof RasterSymbolizer) { throw new RuntimeException("Not implemented yet!"); } return null; } }
public class class_name { public EGeometryType getType() { SymbolizerWrapper geometrySymbolizersWrapper = getGeometrySymbolizersWrapper(); if (geometrySymbolizersWrapper == null) { return null; // depends on control dependency: [if], data = [none] } Symbolizer symbolizer = geometrySymbolizersWrapper.getSymbolizer(); if (symbolizer instanceof PointSymbolizer) { return EGeometryType.POINT; // depends on control dependency: [if], data = [none] } else if (symbolizer instanceof LineSymbolizer) { return EGeometryType.LINESTRING; // depends on control dependency: [if], data = [none] } else if (symbolizer instanceof PolygonSymbolizer) { return EGeometryType.POLYGON; // depends on control dependency: [if], data = [none] } else if (symbolizer instanceof RasterSymbolizer) { throw new RuntimeException("Not implemented yet!"); } return null; } }
public class class_name { @Override public String getSignature() { if (signature == null) { String decl = getDeclaration(); int ndx = decl.indexOf(')'); ndx++; String retType = decl.substring(ndx); StringBuilder methodDeclaration = new StringBuilder(50); methodDeclaration.append(retType).append(' ').append(methodName).append(decl, 0, ndx); String exceptionsAsString = getExceptionsAsString(); if (exceptionsAsString != null) { methodDeclaration.append(" throws ").append(exceptionsAsString); } signature = methodDeclaration.toString(); } return signature; } }
public class class_name { @Override public String getSignature() { if (signature == null) { String decl = getDeclaration(); int ndx = decl.indexOf(')'); ndx++; // depends on control dependency: [if], data = [none] String retType = decl.substring(ndx); StringBuilder methodDeclaration = new StringBuilder(50); methodDeclaration.append(retType).append(' ').append(methodName).append(decl, 0, ndx); // depends on control dependency: [if], data = [none] String exceptionsAsString = getExceptionsAsString(); if (exceptionsAsString != null) { methodDeclaration.append(" throws ").append(exceptionsAsString); // depends on control dependency: [if], data = [(exceptionsAsString] } signature = methodDeclaration.toString(); // depends on control dependency: [if], data = [none] } return signature; } }
public class class_name { public void destroy() { try { ctx.close(); } catch (javax.naming.NamingException e) { LOG.warn("Error when closing", e); } } }
public class class_name { public void destroy() { try { ctx.close(); // depends on control dependency: [try], data = [none] } catch (javax.naming.NamingException e) { LOG.warn("Error when closing", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void loadInitialPage(App app, String url, Reporter reporter) { String startingPage = "The initial url of <i>"; String act = "Opening new browser and loading up initial url"; String expected = startingPage + url + "</i> will successfully load"; if (app != null) { try { app.getDriver().get(url); if (!app.get().url().contains(url)) { reporter.fail(act, expected, startingPage + app.get().url() + "</i> loaded instead of <i>" + url + "</i>"); return; } reporter.pass(act, expected, startingPage + url + "</i> loaded successfully"); } catch (Exception e) { log.warn(e); reporter.fail(act, expected, startingPage + url + "</i> did not load successfully"); } app.acceptCertificate(); } } }
public class class_name { private void loadInitialPage(App app, String url, Reporter reporter) { String startingPage = "The initial url of <i>"; String act = "Opening new browser and loading up initial url"; String expected = startingPage + url + "</i> will successfully load"; if (app != null) { try { app.getDriver().get(url); // depends on control dependency: [try], data = [none] if (!app.get().url().contains(url)) { reporter.fail(act, expected, startingPage + app.get().url() + "</i> loaded instead of <i>" + url + "</i>"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } reporter.pass(act, expected, startingPage + url + "</i> loaded successfully"); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn(e); reporter.fail(act, expected, startingPage + url + "</i> did not load successfully"); } // depends on control dependency: [catch], data = [none] app.acceptCertificate(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order) { Shape.assertValidOrder(order); long vectorLength = source.shape()[sourceDimension]; INDArray ret = Nd4j.createUninitialized(new long[] {indexes.length, vectorLength}, order); for (int cnt = 0; cnt < indexes.length; cnt++) { ret.putRow(cnt, source.tensorAlongDimension((int) indexes[cnt], sourceDimension)); } return ret; } }
public class class_name { @Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes, char order) { Shape.assertValidOrder(order); long vectorLength = source.shape()[sourceDimension]; INDArray ret = Nd4j.createUninitialized(new long[] {indexes.length, vectorLength}, order); for (int cnt = 0; cnt < indexes.length; cnt++) { ret.putRow(cnt, source.tensorAlongDimension((int) indexes[cnt], sourceDimension)); // depends on control dependency: [for], data = [cnt] } return ret; } }
public class class_name { public void close() { logger.debug("Try to close accessFile and channel for file: " + osFile); if (headerBuffer != null) { headerBuffer.force(); headerBuffer = null; } try { unlock(); if (channel != null && channel.isOpen()) { channel.close(); channel = null; } if (accessFile != null) { accessFile.close(); accessFile = null; } } catch (IOException e) { e.printStackTrace(); } logger.debug("Closed accessFile and channel for file: " + osFile); } }
public class class_name { public void close() { logger.debug("Try to close accessFile and channel for file: " + osFile); if (headerBuffer != null) { headerBuffer.force(); // depends on control dependency: [if], data = [none] headerBuffer = null; // depends on control dependency: [if], data = [none] } try { unlock(); // depends on control dependency: [try], data = [none] if (channel != null && channel.isOpen()) { channel.close(); // depends on control dependency: [if], data = [none] channel = null; // depends on control dependency: [if], data = [none] } if (accessFile != null) { accessFile.close(); // depends on control dependency: [if], data = [none] accessFile = null; // depends on control dependency: [if], data = [none] } } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] logger.debug("Closed accessFile and channel for file: " + osFile); } }
public class class_name { private void close(State state) { // ensure close happens once only to avoid race conditions if (state.closed.compareAndSet(false, true)) { Util.closeQuietly(state.ps); if (isCommit() || isRollback()) Util.closeQuietly(state.con); else Util.closeQuietlyIfAutoCommit(state.con); } } }
public class class_name { private void close(State state) { // ensure close happens once only to avoid race conditions if (state.closed.compareAndSet(false, true)) { Util.closeQuietly(state.ps); // depends on control dependency: [if], data = [none] if (isCommit() || isRollback()) Util.closeQuietly(state.con); else Util.closeQuietlyIfAutoCommit(state.con); } } }
public class class_name { private void getAllReferences( PartnerConnection partnerConnection, Map<String, ObjectMetadata> metadataMap, List<List<Pair<String, String>>> references, String[] allTypes, int depth ) throws ConnectionException { if (depth < 0) { return; } List<String> next = new ArrayList<>(); for (int typeIndex = 0; typeIndex < allTypes.length; typeIndex += MAX_METADATA_TYPES) { int copyTo = Math.min(typeIndex + MAX_METADATA_TYPES, allTypes.length); String[] types = Arrays.copyOfRange(allTypes, typeIndex, copyTo); // Special case - we prepopulate the cache with the root sobject type - don't repeat // ourselves if (types.length > 1 || !metadataMap.containsKey(types[0])) { for (DescribeSObjectResult result : partnerConnection.describeSObjects(types)) { Map<String, Field> fieldMap = new LinkedHashMap<>(); Map<String, Field> relationshipMap = new LinkedHashMap<>(); for (Field field : result.getFields()) { fieldMap.put(field.getName().toLowerCase(), field); String relationshipName = field.getRelationshipName(); if (relationshipName != null) { relationshipMap.put(relationshipName.toLowerCase(), field); } } Map<String, String> childRelationships = new LinkedHashMap<>(); for (ChildRelationship child : result.getChildRelationships()) { if (child.getRelationshipName() != null) { childRelationships.put(child.getRelationshipName().toLowerCase(), child.getChildSObject().toLowerCase()); } } metadataMap.put(result.getName().toLowerCase(), new ObjectMetadata(fieldMap, relationshipMap, childRelationships)); } } if (references != null) { for (List<Pair<String, String>> path : references) { // Top field name in the path should be in the metadata now if (!path.isEmpty()) { Pair<String, String> top = path.get(0); Field field = metadataMap.get(top.getLeft()).getFieldFromRelationship(top.getRight()); Set<String> sobjectNames = metadataMap.keySet(); for (String ref : field.getReferenceTo()) { ref = ref.toLowerCase(); if (!sobjectNames.contains(ref) && !next.contains(ref)) { next.add(ref); } if (path.size() > 1) { path.set(1, Pair.of(ref, path.get(1).getRight())); } } // SDC-10422 Polymorphic references have an implicit reference to the Name object type if (field.isPolymorphicForeignKey()) { next.add(NAME); } path.remove(0); } } } } if (!next.isEmpty()) { getAllReferences(partnerConnection, metadataMap, references, next.toArray(new String[0]), depth - 1); } } }
public class class_name { private void getAllReferences( PartnerConnection partnerConnection, Map<String, ObjectMetadata> metadataMap, List<List<Pair<String, String>>> references, String[] allTypes, int depth ) throws ConnectionException { if (depth < 0) { return; } List<String> next = new ArrayList<>(); for (int typeIndex = 0; typeIndex < allTypes.length; typeIndex += MAX_METADATA_TYPES) { int copyTo = Math.min(typeIndex + MAX_METADATA_TYPES, allTypes.length); String[] types = Arrays.copyOfRange(allTypes, typeIndex, copyTo); // Special case - we prepopulate the cache with the root sobject type - don't repeat // ourselves if (types.length > 1 || !metadataMap.containsKey(types[0])) { for (DescribeSObjectResult result : partnerConnection.describeSObjects(types)) { Map<String, Field> fieldMap = new LinkedHashMap<>(); Map<String, Field> relationshipMap = new LinkedHashMap<>(); for (Field field : result.getFields()) { fieldMap.put(field.getName().toLowerCase(), field); // depends on control dependency: [for], data = [field] String relationshipName = field.getRelationshipName(); if (relationshipName != null) { relationshipMap.put(relationshipName.toLowerCase(), field); // depends on control dependency: [if], data = [(relationshipName] } } Map<String, String> childRelationships = new LinkedHashMap<>(); for (ChildRelationship child : result.getChildRelationships()) { if (child.getRelationshipName() != null) { childRelationships.put(child.getRelationshipName().toLowerCase(), child.getChildSObject().toLowerCase()); // depends on control dependency: [if], data = [none] } } metadataMap.put(result.getName().toLowerCase(), new ObjectMetadata(fieldMap, relationshipMap, childRelationships)); // depends on control dependency: [for], data = [result] } } if (references != null) { for (List<Pair<String, String>> path : references) { // Top field name in the path should be in the metadata now if (!path.isEmpty()) { Pair<String, String> top = path.get(0); Field field = metadataMap.get(top.getLeft()).getFieldFromRelationship(top.getRight()); Set<String> sobjectNames = metadataMap.keySet(); for (String ref : field.getReferenceTo()) { ref = ref.toLowerCase(); if (!sobjectNames.contains(ref) && !next.contains(ref)) { next.add(ref); } if (path.size() > 1) { path.set(1, Pair.of(ref, path.get(1).getRight())); } } // SDC-10422 Polymorphic references have an implicit reference to the Name object type if (field.isPolymorphicForeignKey()) { next.add(NAME); } path.remove(0); } } } } if (!next.isEmpty()) { getAllReferences(partnerConnection, metadataMap, references, next.toArray(new String[0]), depth - 1); } } }
public class class_name { @Override public void deleteAll() throws LockingException { Connection conn = null; Statement stmnt = null; try { String sql = "DELETE FROM " + LOCK_TABLE; if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.deleteAll(): " + sql); conn = RDBMServices.getConnection(); try { stmnt = conn.createStatement(); int rc = stmnt.executeUpdate(sql); if (log.isDebugEnabled()) { String msg = "Deleted " + rc + " locks."; log.debug("RDBMEntityLockStore.deleteAll(): " + msg); } } finally { if (stmnt != null) stmnt.close(); } } catch (SQLException sqle) { throw new LockingException("Problem deleting locks", sqle); } finally { RDBMServices.releaseConnection(conn); } } }
public class class_name { @Override public void deleteAll() throws LockingException { Connection conn = null; Statement stmnt = null; try { String sql = "DELETE FROM " + LOCK_TABLE; if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.deleteAll(): " + sql); conn = RDBMServices.getConnection(); try { stmnt = conn.createStatement(); // depends on control dependency: [try], data = [none] int rc = stmnt.executeUpdate(sql); if (log.isDebugEnabled()) { String msg = "Deleted " + rc + " locks."; log.debug("RDBMEntityLockStore.deleteAll(): " + msg); // depends on control dependency: [if], data = [none] } } finally { if (stmnt != null) stmnt.close(); } } catch (SQLException sqle) { throw new LockingException("Problem deleting locks", sqle); } finally { RDBMServices.releaseConnection(conn); } } }
public class class_name { public static String getCanonicalName(Class c) { String binaryName = c.getName(); c = c.getDeclaringClass(); if (c == null) { return binaryName; } StringBuilder buf = new StringBuilder(binaryName); do { buf.setCharAt(c.getName().length(), '.'); c = c.getDeclaringClass(); } while ( c != null); return buf.toString(); } }
public class class_name { public static String getCanonicalName(Class c) { String binaryName = c.getName(); c = c.getDeclaringClass(); if (c == null) { return binaryName; // depends on control dependency: [if], data = [none] } StringBuilder buf = new StringBuilder(binaryName); do { buf.setCharAt(c.getName().length(), '.'); c = c.getDeclaringClass(); } while ( c != null); return buf.toString(); } }
public class class_name { protected void stopLayerTranslation() { if (mLayerTypeHardware) { mLayerTypeHardware = false; mContentContainer.setLayerType(View.LAYER_TYPE_NONE, null); mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null); } } }
public class class_name { protected void stopLayerTranslation() { if (mLayerTypeHardware) { mLayerTypeHardware = false; // depends on control dependency: [if], data = [none] mContentContainer.setLayerType(View.LAYER_TYPE_NONE, null); // depends on control dependency: [if], data = [none] mMenuContainer.setLayerType(View.LAYER_TYPE_NONE, null); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean processCancelRequests() { // Try to make this as fast as possible. Don't need to sync // since if a cancel gets added after checking the size, we will // see it next time. if (cancelList.size() == 0) { return false; } boolean needSelectToOccur = false; final boolean bTrace = TraceComponent.isAnyTracingEnabled(); synchronized (cancelList) { for (CancelRequest req : this.cancelList) { if (req.state == CancelRequest.Ready_To_Cancel) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(this, tc, "cancelling key " + req.key); } req.key.cancel(); req.state = CancelRequest.Ready_To_Signal_Done; needSelectToOccur = true; } } } // end-sync return needSelectToOccur; } }
public class class_name { private boolean processCancelRequests() { // Try to make this as fast as possible. Don't need to sync // since if a cancel gets added after checking the size, we will // see it next time. if (cancelList.size() == 0) { return false; // depends on control dependency: [if], data = [none] } boolean needSelectToOccur = false; final boolean bTrace = TraceComponent.isAnyTracingEnabled(); synchronized (cancelList) { for (CancelRequest req : this.cancelList) { if (req.state == CancelRequest.Ready_To_Cancel) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(this, tc, "cancelling key " + req.key); // depends on control dependency: [if], data = [none] } req.key.cancel(); // depends on control dependency: [if], data = [none] req.state = CancelRequest.Ready_To_Signal_Done; // depends on control dependency: [if], data = [none] needSelectToOccur = true; // depends on control dependency: [if], data = [none] } } } // end-sync return needSelectToOccur; } }
public class class_name { public Result addCcTokenTrace(ClientRequest request, String traceabilityId) { Result<Jwt> result = tokenManager.getJwt(request); if(result.isFailure()) { return Failure.of(result.getError()); } request.getRequestHeaders().put(Headers.AUTHORIZATION, "Bearer " + result.getResult().getJwt()); request.getRequestHeaders().put(HttpStringConstants.TRACEABILITY_ID, traceabilityId); return result; } }
public class class_name { public Result addCcTokenTrace(ClientRequest request, String traceabilityId) { Result<Jwt> result = tokenManager.getJwt(request); if(result.isFailure()) { return Failure.of(result.getError()); } // depends on control dependency: [if], data = [none] request.getRequestHeaders().put(Headers.AUTHORIZATION, "Bearer " + result.getResult().getJwt()); request.getRequestHeaders().put(HttpStringConstants.TRACEABILITY_ID, traceabilityId); return result; } }
public class class_name { private void skipCountry() { if (!atTerminator()) { if (id[index] == UNDERSCORE || id[index] == HYPHEN) { ++index; } /* * Save the index point after the separator, since the format * requires two separators if the country is not present. */ int oldIndex = index; skipUntilTerminatorOrIDSeparator(); int charsSkipped = index - oldIndex; if (charsSkipped < 2 || charsSkipped > 3) { index = oldIndex; } } } }
public class class_name { private void skipCountry() { if (!atTerminator()) { if (id[index] == UNDERSCORE || id[index] == HYPHEN) { ++index; // depends on control dependency: [if], data = [none] } /* * Save the index point after the separator, since the format * requires two separators if the country is not present. */ int oldIndex = index; skipUntilTerminatorOrIDSeparator(); // depends on control dependency: [if], data = [none] int charsSkipped = index - oldIndex; if (charsSkipped < 2 || charsSkipped > 3) { index = oldIndex; // depends on control dependency: [if], data = [none] } } } }