code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @SuppressWarnings("unchecked") static VisitorStatusType visitList(String name, List<Object> list, BindMapListener listener, VisitorStatusType status) { int i = 0; for (Object item : list) { if (item == null || item instanceof String) { visit(name + "." + i, (String) item, listener, status); } else if (item instanceof List) { visitList(name + "." + i, (List<Object>) item, listener, status); } else if (item instanceof Map) { visitMap(name + "." + i, (Map<String, Object>) item, listener, status); } i++; if (status == VisitorStatusType.STOP) return status; } return status; } }
public class class_name { @SuppressWarnings("unchecked") static VisitorStatusType visitList(String name, List<Object> list, BindMapListener listener, VisitorStatusType status) { int i = 0; for (Object item : list) { if (item == null || item instanceof String) { visit(name + "." + i, (String) item, listener, status); // depends on control dependency: [if], data = [none] } else if (item instanceof List) { visitList(name + "." + i, (List<Object>) item, listener, status); // depends on control dependency: [if], data = [none] } else if (item instanceof Map) { visitMap(name + "." + i, (Map<String, Object>) item, listener, status); // depends on control dependency: [if], data = [none] } i++; // depends on control dependency: [for], data = [none] if (status == VisitorStatusType.STOP) return status; } return status; } }
public class class_name { private void finalizeSourceMap() throws IOException { StringWriter writer = new StringWriter(); smGen.appendTo(writer, "" /* file name */); //$NON-NLS-1$ sourceMap = writer.toString(); // now add the sourcesContent field try { JSONObject obj = new JSONObject(sourceMap); JSONArray sources = (JSONArray)obj.get("sources"); //$NON-NLS-1$ JSONArray sourcesContent = new JSONArray(); for (int i = 0; i < sources.length(); i++) { String content = sourcesMap.get(sources.get(i)); sourcesContent.add(content != null ? content : ""); //$NON-NLS-1$ } obj.put("sourcesContent", sourcesContent); //$NON-NLS-1$ StringBuffer sb = new StringBuffer(SOURCEMAP_XSSI_PREAMBLE); sourceMap = sb.append(obj.toString()).toString(); } catch (JSONException e) { throw new IOException(e); } } }
public class class_name { private void finalizeSourceMap() throws IOException { StringWriter writer = new StringWriter(); smGen.appendTo(writer, "" /* file name */); //$NON-NLS-1$ sourceMap = writer.toString(); // now add the sourcesContent field try { JSONObject obj = new JSONObject(sourceMap); JSONArray sources = (JSONArray)obj.get("sources"); //$NON-NLS-1$ JSONArray sourcesContent = new JSONArray(); for (int i = 0; i < sources.length(); i++) { String content = sourcesMap.get(sources.get(i)); sourcesContent.add(content != null ? content : ""); //$NON-NLS-1$ // depends on control dependency: [for], data = [none] } obj.put("sourcesContent", sourcesContent); //$NON-NLS-1$ StringBuffer sb = new StringBuffer(SOURCEMAP_XSSI_PREAMBLE); sourceMap = sb.append(obj.toString()).toString(); } catch (JSONException e) { throw new IOException(e); } } }
public class class_name { protected void growAndCopy() { if (textLen == text.length) { int newSize = text.length << 1; char[] newText = new char[newSize]; if (textLen > 0) { System.arraycopy(text, 0, newText, 0, textLen); } text = newText; } } }
public class class_name { protected void growAndCopy() { if (textLen == text.length) { int newSize = text.length << 1; char[] newText = new char[newSize]; if (textLen > 0) { System.arraycopy(text, 0, newText, 0, textLen); // depends on control dependency: [if], data = [none] } text = newText; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected synchronized void indexSearcherClose(IndexSearcher searcher) { // in case there is an index searcher available close it if ((searcher != null) && (searcher.getIndexReader() != null)) { try { searcher.getIndexReader().close(); } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INDEX_SEARCHER_CLOSE_1, getName()), e); } } } }
public class class_name { protected synchronized void indexSearcherClose(IndexSearcher searcher) { // in case there is an index searcher available close it if ((searcher != null) && (searcher.getIndexReader() != null)) { try { searcher.getIndexReader().close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error(Messages.get().getBundle().key(Messages.ERR_INDEX_SEARCHER_CLOSE_1, getName()), e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public float trimLastSpace() { BaseFont ft = font.getFont(); if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') { if (value.length() > 1 && value.endsWith("\u0001")) { value = value.substring(0, value.length() - 1); return font.width('\u0001'); } } else { if (value.length() > 1 && value.endsWith(" ")) { value = value.substring(0, value.length() - 1); return font.width(' '); } } return 0; } }
public class class_name { public float trimLastSpace() { BaseFont ft = font.getFont(); if (ft.getFontType() == BaseFont.FONT_TYPE_CJK && ft.getUnicodeEquivalent(' ') != ' ') { if (value.length() > 1 && value.endsWith("\u0001")) { value = value.substring(0, value.length() - 1); // depends on control dependency: [if], data = [none] return font.width('\u0001'); // depends on control dependency: [if], data = [none] } } else { if (value.length() > 1 && value.endsWith(" ")) { value = value.substring(0, value.length() - 1); // depends on control dependency: [if], data = [none] return font.width(' '); // depends on control dependency: [if], data = [none] } } return 0; } }
public class class_name { public static int random(int min, int max) { if (min < 0 || max < 0) { throw new RuntimeException( "illegal argment, min and max must great then zero."); } if (min > max) { int t = max; max = min; min = t; } else if (min == max) { return min; } Random random = new Random(); return random.nextInt(max) % (max - min + 1) + min; } }
public class class_name { public static int random(int min, int max) { if (min < 0 || max < 0) { throw new RuntimeException( "illegal argment, min and max must great then zero."); } if (min > max) { int t = max; max = min; // depends on control dependency: [if], data = [none] min = t; // depends on control dependency: [if], data = [none] } else if (min == max) { return min; // depends on control dependency: [if], data = [none] } Random random = new Random(); return random.nextInt(max) % (max - min + 1) + min; } }
public class class_name { private boolean validatePast(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } int res = 0; if (validationObject.getClass().isAssignableFrom(java.util.Date.class)) { Date today = new Date(); Date pastDate = (Date) validationObject; res = pastDate.compareTo(today); } else if (validationObject.getClass().isAssignableFrom(java.util.Calendar.class)) { Calendar cal = Calendar.getInstance(); Calendar pastDate = (Calendar) validationObject; res = pastDate.compareTo(cal); } // else // { // ruleExceptionHandler(((Past) annotate).message()); // } if (res >= 0) { throwValidationException(((Past) annotate).message()); } return true; } }
public class class_name { private boolean validatePast(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; // depends on control dependency: [if], data = [none] } int res = 0; if (validationObject.getClass().isAssignableFrom(java.util.Date.class)) { Date today = new Date(); Date pastDate = (Date) validationObject; res = pastDate.compareTo(today); // depends on control dependency: [if], data = [none] } else if (validationObject.getClass().isAssignableFrom(java.util.Calendar.class)) { Calendar cal = Calendar.getInstance(); Calendar pastDate = (Calendar) validationObject; res = pastDate.compareTo(cal); // depends on control dependency: [if], data = [none] } // else // { // ruleExceptionHandler(((Past) annotate).message()); // } if (res >= 0) { throwValidationException(((Past) annotate).message()); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void sweepDisk() { //iterate over the files in the store dir and check expiry times long now = System.currentTimeMillis(); if (log.isDebugEnabled()) { log.debug("Sweeping " + storeDir + " for old session files"); } try { Files.walk(storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS) .filter(p -> !Files.isDirectory(p)) .filter(p -> isSessionFilename(p.getFileName().toString())) .forEach(p -> { try { sweepFile(now, p); } catch (Exception e) { log.warn(e.getMessage(), e); } }); } catch (Exception e) { log.warn(e.getMessage(), e); } } }
public class class_name { public void sweepDisk() { //iterate over the files in the store dir and check expiry times long now = System.currentTimeMillis(); if (log.isDebugEnabled()) { log.debug("Sweeping " + storeDir + " for old session files"); // depends on control dependency: [if], data = [none] } try { Files.walk(storeDir.toPath(), 1, FileVisitOption.FOLLOW_LINKS) .filter(p -> !Files.isDirectory(p)) .filter(p -> isSessionFilename(p.getFileName().toString())) .forEach(p -> { try { sweepFile(now, p); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] }); } catch (Exception e) { log.warn(e.getMessage(), e); } } }
public class class_name { Query createQuery(String jpaQuery, final String persistenceUnit) { Client client = getClient(persistenceUnit); EntityMetadata metadata = null; try { metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit()) .getEntityMetadataMap().values().iterator().next(); } catch (Exception e) { log.info("Entity metadata is null. Proceeding as Scalar Query."); } Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit) .getQueryImplementor(), this, metadata, persistenceUnit); return query; } }
public class class_name { Query createQuery(String jpaQuery, final String persistenceUnit) { Client client = getClient(persistenceUnit); EntityMetadata metadata = null; try { metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit()) .getEntityMetadataMap().values().iterator().next(); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.info("Entity metadata is null. Proceeding as Scalar Query."); } // depends on control dependency: [catch], data = [none] Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit) .getQueryImplementor(), this, metadata, persistenceUnit); return query; } }
public class class_name { public List<T> getSuggestions(QueryToken queryToken) { String prefix = queryToken.getKeywords().toLowerCase(); List<T> suggestions = new ArrayList<>(); if (mData != null) { for (T suggestion : mData) { String name = suggestion.getSuggestiblePrimaryText().toLowerCase(); if (name.startsWith(prefix)) { suggestions.add(suggestion); } } } return suggestions; } }
public class class_name { public List<T> getSuggestions(QueryToken queryToken) { String prefix = queryToken.getKeywords().toLowerCase(); List<T> suggestions = new ArrayList<>(); if (mData != null) { for (T suggestion : mData) { String name = suggestion.getSuggestiblePrimaryText().toLowerCase(); if (name.startsWith(prefix)) { suggestions.add(suggestion); // depends on control dependency: [if], data = [none] } } } return suggestions; } }
public class class_name { void flattenSets() { Assert.assrt(fType != setRef); if (fLeftChild != null) { if (fLeftChild.fType == setRef) { RBBINode setRefNode = fLeftChild; RBBINode usetNode = setRefNode.fLeftChild; RBBINode replTree = usetNode.fLeftChild; fLeftChild = replTree.cloneTree(); fLeftChild.fParent = this; } else { fLeftChild.flattenSets(); } } if (fRightChild != null) { if (fRightChild.fType == setRef) { RBBINode setRefNode = fRightChild; RBBINode usetNode = setRefNode.fLeftChild; RBBINode replTree = usetNode.fLeftChild; fRightChild = replTree.cloneTree(); fRightChild.fParent = this; // delete setRefNode; } else { fRightChild.flattenSets(); } } } }
public class class_name { void flattenSets() { Assert.assrt(fType != setRef); if (fLeftChild != null) { if (fLeftChild.fType == setRef) { RBBINode setRefNode = fLeftChild; RBBINode usetNode = setRefNode.fLeftChild; RBBINode replTree = usetNode.fLeftChild; fLeftChild = replTree.cloneTree(); // depends on control dependency: [if], data = [none] fLeftChild.fParent = this; // depends on control dependency: [if], data = [none] } else { fLeftChild.flattenSets(); // depends on control dependency: [if], data = [none] } } if (fRightChild != null) { if (fRightChild.fType == setRef) { RBBINode setRefNode = fRightChild; RBBINode usetNode = setRefNode.fLeftChild; RBBINode replTree = usetNode.fLeftChild; fRightChild = replTree.cloneTree(); // depends on control dependency: [if], data = [none] fRightChild.fParent = this; // depends on control dependency: [if], data = [none] // delete setRefNode; } else { fRightChild.flattenSets(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) { for (CmsCheckBox cb : m_checkboxes) { cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue()))); } } }
public class class_name { private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) { for (CmsCheckBox cb : m_checkboxes) { cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue()))); // depends on control dependency: [for], data = [cb] } } }
public class class_name { synchronized Weight getMinimumDuration() { if (calcMinDuration == null) { Weight min = WeightFactory.POS_INFINITY; for (int i = 0, n = intervals.size(); i < n; i++) { Object finish = intervals.get(i).getFinish(); Map<?, Weight> d = BellmanFord.calcShortestDistances(finish, directedGraph, BellmanFord.Mode.SOURCE); if (d == null) { throw new IllegalStateException("Negative cycle detected!"); } for (int j = 0; j < n; j++) { Object start = intervals.get(j).getStart(); min = Weight.min(min, d.get(start)); } } calcMinDuration = min.invertSign(); } return calcMinDuration; } }
public class class_name { synchronized Weight getMinimumDuration() { if (calcMinDuration == null) { Weight min = WeightFactory.POS_INFINITY; for (int i = 0, n = intervals.size(); i < n; i++) { Object finish = intervals.get(i).getFinish(); Map<?, Weight> d = BellmanFord.calcShortestDistances(finish, directedGraph, BellmanFord.Mode.SOURCE); if (d == null) { throw new IllegalStateException("Negative cycle detected!"); } for (int j = 0; j < n; j++) { Object start = intervals.get(j).getStart(); min = Weight.min(min, d.get(start)); // depends on control dependency: [for], data = [none] } } calcMinDuration = min.invertSign(); // depends on control dependency: [if], data = [none] } return calcMinDuration; } }
public class class_name { private Subject getSubject() { return AccessController.doPrivileged(new PrivilegedAction<Subject>() { /** * run method */ public Subject run() { try { String domain = recoverSecurityDomain; if (domain != null && subjectFactory != null) { Subject subject = SecurityActions.createSubject(subjectFactory, domain); Set<PasswordCredential> pcs = SecurityActions.getPasswordCredentials(subject); if (!pcs.isEmpty()) { for (PasswordCredential pc : pcs) { pc.setManagedConnectionFactory(mcf); } } log.debugf("Recovery Subject=%s", subject); return subject; } else { log.noCrashRecoverySecurityDomain(jndiName); } } catch (Throwable t) { log.exceptionDuringCrashRecoverySubject(jndiName, t.getMessage(), t); } return null; } }); } }
public class class_name { private Subject getSubject() { return AccessController.doPrivileged(new PrivilegedAction<Subject>() { /** * run method */ public Subject run() { try { String domain = recoverSecurityDomain; if (domain != null && subjectFactory != null) { Subject subject = SecurityActions.createSubject(subjectFactory, domain); Set<PasswordCredential> pcs = SecurityActions.getPasswordCredentials(subject); if (!pcs.isEmpty()) { for (PasswordCredential pc : pcs) { pc.setManagedConnectionFactory(mcf); // depends on control dependency: [for], data = [pc] } } log.debugf("Recovery Subject=%s", subject); // depends on control dependency: [if], data = [none] return subject; // depends on control dependency: [if], data = [none] } else { log.noCrashRecoverySecurityDomain(jndiName); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { log.exceptionDuringCrashRecoverySubject(jndiName, t.getMessage(), t); } // depends on control dependency: [catch], data = [none] return null; } }); } }
public class class_name { @Override public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection, Map<String, Object> argumentTypes, Map<String, AnnotationMetadata> argumentAnnotationMetadata, Map<String, Map<String, Object>> genericTypes) { if (constructorVisitor == null) { // first build the constructor visitBeanDefinitionConstructorInternal( annotationMetadata, requiresReflection, argumentTypes, argumentAnnotationMetadata, genericTypes); // now prepare the implementation of the build method. See BeanFactory interface visitBuildMethodDefinition(annotationMetadata, argumentTypes, argumentAnnotationMetadata); // now override the injectBean method visitInjectMethodDefinition(); } } }
public class class_name { @Override public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection, Map<String, Object> argumentTypes, Map<String, AnnotationMetadata> argumentAnnotationMetadata, Map<String, Map<String, Object>> genericTypes) { if (constructorVisitor == null) { // first build the constructor visitBeanDefinitionConstructorInternal( annotationMetadata, requiresReflection, argumentTypes, argumentAnnotationMetadata, genericTypes); // depends on control dependency: [if], data = [none] // now prepare the implementation of the build method. See BeanFactory interface visitBuildMethodDefinition(annotationMetadata, argumentTypes, argumentAnnotationMetadata); // depends on control dependency: [if], data = [none] // now override the injectBean method visitInjectMethodDefinition(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; } double sshape; if (Op.isLE(x, bottomLeft)) { sshape = 0.0; } else if (Op.isLE(x, 0.5 * (bottomLeft + topLeft))) { sshape = 2.0 * Math.pow((x - bottomLeft) / (topLeft - bottomLeft), 2); } else if (Op.isLt(x, topLeft)) { sshape = 1.0 - 2.0 * Math.pow((x - topLeft) / (topLeft - bottomLeft), 2); } else { sshape = 1.0; } double zshape; if (Op.isLE(x, topRight)) { zshape = 1.0; } else if (Op.isLE(x, 0.5 * (topRight + bottomRight))) { zshape = 1.0 - 2.0 * Math.pow((x - topRight) / (bottomRight - topRight), 2); } else if (Op.isLt(x, bottomRight)) { zshape = 2.0 * Math.pow((x - bottomRight) / (bottomRight - topRight), 2); } else { zshape = 0.0; } return height * sshape * zshape; } }
public class class_name { @Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; // depends on control dependency: [if], data = [none] } double sshape; if (Op.isLE(x, bottomLeft)) { sshape = 0.0; // depends on control dependency: [if], data = [none] } else if (Op.isLE(x, 0.5 * (bottomLeft + topLeft))) { sshape = 2.0 * Math.pow((x - bottomLeft) / (topLeft - bottomLeft), 2); // depends on control dependency: [if], data = [none] } else if (Op.isLt(x, topLeft)) { sshape = 1.0 - 2.0 * Math.pow((x - topLeft) / (topLeft - bottomLeft), 2); // depends on control dependency: [if], data = [none] } else { sshape = 1.0; // depends on control dependency: [if], data = [none] } double zshape; if (Op.isLE(x, topRight)) { zshape = 1.0; // depends on control dependency: [if], data = [none] } else if (Op.isLE(x, 0.5 * (topRight + bottomRight))) { zshape = 1.0 - 2.0 * Math.pow((x - topRight) / (bottomRight - topRight), 2); // depends on control dependency: [if], data = [none] } else if (Op.isLt(x, bottomRight)) { zshape = 2.0 * Math.pow((x - bottomRight) / (bottomRight - topRight), 2); // depends on control dependency: [if], data = [none] } else { zshape = 0.0; // depends on control dependency: [if], data = [none] } return height * sshape * zshape; } }
public class class_name { @Override public IPromise then(Callback resultCB) { // FIXME: this can be implemented more efficient while( !lock.compareAndSet(false,true) ) {} try { if (resultReceiver != null) throw new RuntimeException("Double register of promise listener"); resultReceiver = resultCB; if (hadResult) { hasFired = true; if (nextFuture == null) { nextFuture = new Promise(result, error); lock.set(false); resultCB.complete(result, error); } else { lock.set(false); resultCB.complete(result, error); nextFuture.complete(result, error); return nextFuture; } } if (resultCB instanceof IPromise) { return (IPromise) resultCB; } lock.set(false); while( !lock.compareAndSet(false,true) ) {} if (nextFuture == null) { return nextFuture = new Promise(); } else { return nextFuture; } } finally { lock.set(false); } } }
public class class_name { @Override public IPromise then(Callback resultCB) { // FIXME: this can be implemented more efficient while( !lock.compareAndSet(false,true) ) {} try { if (resultReceiver != null) throw new RuntimeException("Double register of promise listener"); resultReceiver = resultCB; // depends on control dependency: [try], data = [none] if (hadResult) { hasFired = true; // depends on control dependency: [if], data = [none] if (nextFuture == null) { nextFuture = new Promise(result, error); // depends on control dependency: [if], data = [none] lock.set(false); // depends on control dependency: [if], data = [none] resultCB.complete(result, error); // depends on control dependency: [if], data = [none] } else { lock.set(false); // depends on control dependency: [if], data = [none] resultCB.complete(result, error); // depends on control dependency: [if], data = [none] nextFuture.complete(result, error); // depends on control dependency: [if], data = [none] return nextFuture; // depends on control dependency: [if], data = [none] } } if (resultCB instanceof IPromise) { return (IPromise) resultCB; // depends on control dependency: [if], data = [none] } lock.set(false); // depends on control dependency: [try], data = [none] while( !lock.compareAndSet(false,true) ) {} if (nextFuture == null) { return nextFuture = new Promise(); // depends on control dependency: [if], data = [none] } else { return nextFuture; // depends on control dependency: [if], data = [none] } } finally { lock.set(false); } } }
public class class_name { public void printUsage(Command command) { String commandName = command.getDescriptor().getName(); StringBuilder sb = new StringBuilder(getSyntaxPrefix()).append(commandName).append(" "); // create a list for processed option groups Collection<OptionGroup> processedGroups = new ArrayList<>(); Collection<Option> optList = command.getOptions().getAllOptions(); if (optList.size() > 1 && getOptionComparator() != null) { List<Option> optList2 = new ArrayList<>(optList); optList2.sort(getOptionComparator()); optList = optList2; } for (Iterator<Option> it = optList.iterator(); it.hasNext();) { // get the next Option Option option = it.next(); // check if the option is part of an OptionGroup OptionGroup group = command.getOptions().getOptionGroup(option); if (group != null) { // if the group has not already been processed if (!processedGroups.contains(group)) { // add the group to the processed list processedGroups.add(group); // add the usage clause appendOptionGroup(sb, group); } // otherwise the option was displayed in the group // previously so ignore it. } // if the Option is not part of an OptionGroup else { appendOption(sb, option, option.isRequired()); } if (it.hasNext()) { sb.append(" "); } } for (Arguments arguments : command.getArgumentsList()) { sb.append(" "); appendArguments(sb, arguments); } printWrapped(getSyntaxPrefix().length() + commandName.length() + 1, sb.toString()); } }
public class class_name { public void printUsage(Command command) { String commandName = command.getDescriptor().getName(); StringBuilder sb = new StringBuilder(getSyntaxPrefix()).append(commandName).append(" "); // create a list for processed option groups Collection<OptionGroup> processedGroups = new ArrayList<>(); Collection<Option> optList = command.getOptions().getAllOptions(); if (optList.size() > 1 && getOptionComparator() != null) { List<Option> optList2 = new ArrayList<>(optList); optList2.sort(getOptionComparator()); // depends on control dependency: [if], data = [none] optList = optList2; // depends on control dependency: [if], data = [none] } for (Iterator<Option> it = optList.iterator(); it.hasNext();) { // get the next Option Option option = it.next(); // check if the option is part of an OptionGroup OptionGroup group = command.getOptions().getOptionGroup(option); if (group != null) { // if the group has not already been processed if (!processedGroups.contains(group)) { // add the group to the processed list processedGroups.add(group); // depends on control dependency: [if], data = [none] // add the usage clause appendOptionGroup(sb, group); // depends on control dependency: [if], data = [none] } // otherwise the option was displayed in the group // previously so ignore it. } // if the Option is not part of an OptionGroup else { appendOption(sb, option, option.isRequired()); // depends on control dependency: [if], data = [none] } if (it.hasNext()) { sb.append(" "); // depends on control dependency: [if], data = [none] } } for (Arguments arguments : command.getArgumentsList()) { sb.append(" "); // depends on control dependency: [for], data = [none] appendArguments(sb, arguments); // depends on control dependency: [for], data = [arguments] } printWrapped(getSyntaxPrefix().length() + commandName.length() + 1, sb.toString()); } }
public class class_name { public static boolean isAbsoluteURI(String systemId) { /** http://www.ietf.org/rfc/rfc2396.txt * Authors should be aware that a path segment which contains a colon * character cannot be used as the first segment of a relative URI path * (e.g., "this:that"), because it would be mistaken for a scheme name. **/ /** * %REVIEW% Can we assume here that systemId is a valid URI? * It looks like we cannot ( See discussion of this common problem in * Bugzilla Bug 22777 ). **/ //"fix" for Bugzilla Bug 22777 if(isWindowsAbsolutePath(systemId)){ return false; } final int fragmentIndex = systemId.indexOf('#'); final int queryIndex = systemId.indexOf('?'); final int slashIndex = systemId.indexOf('/'); final int colonIndex = systemId.indexOf(':'); //finding substring before '#', '?', and '/' int index = systemId.length() -1; if(fragmentIndex > 0) index = fragmentIndex; if((queryIndex > 0) && (queryIndex <index)) index = queryIndex; if((slashIndex > 0) && (slashIndex <index)) index = slashIndex; // return true if there is ':' before '#', '?', and '/' return ((colonIndex >0) && (colonIndex<index)); } }
public class class_name { public static boolean isAbsoluteURI(String systemId) { /** http://www.ietf.org/rfc/rfc2396.txt * Authors should be aware that a path segment which contains a colon * character cannot be used as the first segment of a relative URI path * (e.g., "this:that"), because it would be mistaken for a scheme name. **/ /** * %REVIEW% Can we assume here that systemId is a valid URI? * It looks like we cannot ( See discussion of this common problem in * Bugzilla Bug 22777 ). **/ //"fix" for Bugzilla Bug 22777 if(isWindowsAbsolutePath(systemId)){ return false; // depends on control dependency: [if], data = [none] } final int fragmentIndex = systemId.indexOf('#'); final int queryIndex = systemId.indexOf('?'); final int slashIndex = systemId.indexOf('/'); final int colonIndex = systemId.indexOf(':'); //finding substring before '#', '?', and '/' int index = systemId.length() -1; if(fragmentIndex > 0) index = fragmentIndex; if((queryIndex > 0) && (queryIndex <index)) index = queryIndex; if((slashIndex > 0) && (slashIndex <index)) index = slashIndex; // return true if there is ':' before '#', '?', and '/' return ((colonIndex >0) && (colonIndex<index)); } }
public class class_name { public static String flattenReservedTokens(String str) { if (StringUtils.isBlank(str)) { return str; } return str.replaceAll("\\{\\[", "{").replaceAll("\\]\\}", "}"); } }
public class class_name { public static String flattenReservedTokens(String str) { if (StringUtils.isBlank(str)) { return str; // depends on control dependency: [if], data = [none] } return str.replaceAll("\\{\\[", "{").replaceAll("\\]\\}", "}"); } }
public class class_name { public Result<MoveAlongSurfaceResult> moveAlongSurface(long startRef, float[] startPos, float[] endPos, QueryFilter filter) { // Validate input if (!m_nav.isValidPolyRef(startRef) || Objects.isNull(startPos) || !vIsFinite(startPos) || Objects.isNull(endPos) || !vIsFinite(endPos) || Objects.isNull(filter)) { return Result.invalidParam(); } m_tinyNodePool.clear(); Node startNode = m_tinyNodePool.getNode(startRef); startNode.pidx = 0; startNode.cost = 0; startNode.total = 0; startNode.id = startRef; startNode.flags = Node.DT_NODE_CLOSED; LinkedList<Node> stack = new LinkedList<>(); stack.add(startNode); float[] bestPos = new float[3]; float bestDist = Float.MAX_VALUE; Node bestNode = null; vCopy(bestPos, startPos); // Search constraints float[] searchPos = vLerp(startPos, endPos, 0.5f); float searchRadSqr = sqr(vDist(startPos, endPos) / 2.0f + 0.001f); float[] verts = new float[m_nav.getMaxVertsPerPoly() * 3]; while (!stack.isEmpty()) { // Pop front. Node curNode = stack.pop(); // Get poly and tile. // The API input has been cheked already, skip checking internal data. long curRef = curNode.id; Tupple2<MeshTile, Poly> tileAndPoly = m_nav.getTileAndPolyByRefUnsafe(curRef); MeshTile curTile = tileAndPoly.first; Poly curPoly = tileAndPoly.second; // Collect vertices. int nverts = curPoly.vertCount; for (int i = 0; i < nverts; ++i) { System.arraycopy(curTile.data.verts, curPoly.verts[i] * 3, verts, i * 3, 3); } // If target is inside the poly, stop search. if (pointInPolygon(endPos, verts, nverts)) { bestNode = curNode; vCopy(bestPos, endPos); break; } // Find wall edges and find nearest point inside the walls. for (int i = 0, j = curPoly.vertCount - 1; i < curPoly.vertCount; j = i++) { // Find links to neighbours. int MAX_NEIS = 8; int nneis = 0; long[] neis = new long[MAX_NEIS]; if ((curPoly.neis[j] & NavMesh.DT_EXT_LINK) != 0) { // Tile border. for (int k = curPoly.firstLink; k != NavMesh.DT_NULL_LINK; k = curTile.links.get(k).next) { Link link = curTile.links.get(k); if (link.edge == j) { if (link.ref != 0) { tileAndPoly = m_nav.getTileAndPolyByRefUnsafe(link.ref); MeshTile neiTile = tileAndPoly.first; Poly neiPoly = tileAndPoly.second; if (filter.passFilter(link.ref, neiTile, neiPoly)) { if (nneis < MAX_NEIS) { neis[nneis++] = link.ref; } } } } } } else if (curPoly.neis[j] != 0) { int idx = curPoly.neis[j] - 1; long ref = m_nav.getPolyRefBase(curTile) | idx; if (filter.passFilter(ref, curTile, curTile.data.polys[idx])) { // Internal edge, encode id. neis[nneis++] = ref; } } if (nneis == 0) { // Wall edge, calc distance. int vj = j * 3; int vi = i * 3; Tupple2<Float, Float> distSeg = distancePtSegSqr2D(endPos, verts, vj, vi); float distSqr = distSeg.first; float tseg = distSeg.second; if (distSqr < bestDist) { // Update nearest distance. bestPos = vLerp(verts, vj, vi, tseg); bestDist = distSqr; bestNode = curNode; } } else { for (int k = 0; k < nneis; ++k) { Node neighbourNode = m_tinyNodePool.getNode(neis[k]); // Skip if already visited. if ((neighbourNode.flags & Node.DT_NODE_CLOSED) != 0) { continue; } // Skip the link if it is too far from search constraint. // TODO: Maybe should use getPortalPoints(), but this one is way faster. int vj = j * 3; int vi = i * 3; Tupple2<Float, Float> distseg = distancePtSegSqr2D(searchPos, verts, vj, vi); float distSqr = distseg.first; if (distSqr > searchRadSqr) { continue; } // Mark as the node as visited and push to queue. neighbourNode.pidx = m_tinyNodePool.getNodeIdx(curNode); neighbourNode.flags |= Node.DT_NODE_CLOSED; stack.add(neighbourNode); } } } } List<Long> visited = new ArrayList<>(); if (bestNode != null) { // Reverse the path. Node prev = null; Node node = bestNode; do { Node next = m_tinyNodePool.getNodeAtIdx(node.pidx); node.pidx = m_tinyNodePool.getNodeIdx(prev); prev = node; node = next; } while (node != null); // Store result node = prev; do { visited.add(node.id); node = m_tinyNodePool.getNodeAtIdx(node.pidx); } while (node != null); } return Result.success(new MoveAlongSurfaceResult(bestPos, visited)); } }
public class class_name { public Result<MoveAlongSurfaceResult> moveAlongSurface(long startRef, float[] startPos, float[] endPos, QueryFilter filter) { // Validate input if (!m_nav.isValidPolyRef(startRef) || Objects.isNull(startPos) || !vIsFinite(startPos) || Objects.isNull(endPos) || !vIsFinite(endPos) || Objects.isNull(filter)) { return Result.invalidParam(); // depends on control dependency: [if], data = [none] } m_tinyNodePool.clear(); Node startNode = m_tinyNodePool.getNode(startRef); startNode.pidx = 0; startNode.cost = 0; startNode.total = 0; startNode.id = startRef; startNode.flags = Node.DT_NODE_CLOSED; LinkedList<Node> stack = new LinkedList<>(); stack.add(startNode); float[] bestPos = new float[3]; float bestDist = Float.MAX_VALUE; Node bestNode = null; vCopy(bestPos, startPos); // Search constraints float[] searchPos = vLerp(startPos, endPos, 0.5f); float searchRadSqr = sqr(vDist(startPos, endPos) / 2.0f + 0.001f); float[] verts = new float[m_nav.getMaxVertsPerPoly() * 3]; while (!stack.isEmpty()) { // Pop front. Node curNode = stack.pop(); // Get poly and tile. // The API input has been cheked already, skip checking internal data. long curRef = curNode.id; Tupple2<MeshTile, Poly> tileAndPoly = m_nav.getTileAndPolyByRefUnsafe(curRef); MeshTile curTile = tileAndPoly.first; Poly curPoly = tileAndPoly.second; // Collect vertices. int nverts = curPoly.vertCount; for (int i = 0; i < nverts; ++i) { System.arraycopy(curTile.data.verts, curPoly.verts[i] * 3, verts, i * 3, 3); // depends on control dependency: [for], data = [i] } // If target is inside the poly, stop search. if (pointInPolygon(endPos, verts, nverts)) { bestNode = curNode; // depends on control dependency: [if], data = [none] vCopy(bestPos, endPos); // depends on control dependency: [if], data = [none] break; } // Find wall edges and find nearest point inside the walls. for (int i = 0, j = curPoly.vertCount - 1; i < curPoly.vertCount; j = i++) { // Find links to neighbours. int MAX_NEIS = 8; int nneis = 0; long[] neis = new long[MAX_NEIS]; if ((curPoly.neis[j] & NavMesh.DT_EXT_LINK) != 0) { // Tile border. for (int k = curPoly.firstLink; k != NavMesh.DT_NULL_LINK; k = curTile.links.get(k).next) { Link link = curTile.links.get(k); if (link.edge == j) { if (link.ref != 0) { tileAndPoly = m_nav.getTileAndPolyByRefUnsafe(link.ref); // depends on control dependency: [if], data = [(link.ref] MeshTile neiTile = tileAndPoly.first; Poly neiPoly = tileAndPoly.second; if (filter.passFilter(link.ref, neiTile, neiPoly)) { if (nneis < MAX_NEIS) { neis[nneis++] = link.ref; // depends on control dependency: [if], data = [none] } } } } } } else if (curPoly.neis[j] != 0) { int idx = curPoly.neis[j] - 1; long ref = m_nav.getPolyRefBase(curTile) | idx; if (filter.passFilter(ref, curTile, curTile.data.polys[idx])) { // Internal edge, encode id. neis[nneis++] = ref; // depends on control dependency: [if], data = [none] } } if (nneis == 0) { // Wall edge, calc distance. int vj = j * 3; int vi = i * 3; Tupple2<Float, Float> distSeg = distancePtSegSqr2D(endPos, verts, vj, vi); float distSqr = distSeg.first; float tseg = distSeg.second; if (distSqr < bestDist) { // Update nearest distance. bestPos = vLerp(verts, vj, vi, tseg); // depends on control dependency: [if], data = [none] bestDist = distSqr; // depends on control dependency: [if], data = [none] bestNode = curNode; // depends on control dependency: [if], data = [none] } } else { for (int k = 0; k < nneis; ++k) { Node neighbourNode = m_tinyNodePool.getNode(neis[k]); // Skip if already visited. if ((neighbourNode.flags & Node.DT_NODE_CLOSED) != 0) { continue; } // Skip the link if it is too far from search constraint. // TODO: Maybe should use getPortalPoints(), but this one is way faster. int vj = j * 3; int vi = i * 3; Tupple2<Float, Float> distseg = distancePtSegSqr2D(searchPos, verts, vj, vi); float distSqr = distseg.first; if (distSqr > searchRadSqr) { continue; } // Mark as the node as visited and push to queue. neighbourNode.pidx = m_tinyNodePool.getNodeIdx(curNode); // depends on control dependency: [for], data = [none] neighbourNode.flags |= Node.DT_NODE_CLOSED; // depends on control dependency: [for], data = [none] stack.add(neighbourNode); // depends on control dependency: [for], data = [none] } } } } List<Long> visited = new ArrayList<>(); if (bestNode != null) { // Reverse the path. Node prev = null; Node node = bestNode; do { Node next = m_tinyNodePool.getNodeAtIdx(node.pidx); node.pidx = m_tinyNodePool.getNodeIdx(prev); prev = node; node = next; } while (node != null); // Store result node = prev; // depends on control dependency: [if], data = [none] do { visited.add(node.id); node = m_tinyNodePool.getNodeAtIdx(node.pidx); } while (node != null); } return Result.success(new MoveAlongSurfaceResult(bestPos, visited)); } }
public class class_name { @Override public void execute(final ModelNode original, final OperationMessageHandler messageHandler, final ProxyOperationControl control, final OperationAttachments attachments, final BlockingTimeout blockingTimeout) { // Add blocking support to adhere to the proxy controller API contracts final CountDownLatch completed = new CountDownLatch(1); final BlockingQueue<TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation>> queue = new ArrayBlockingQueue<TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation>>(1, true); final TransactionalProtocolClient.TransactionalOperationListener<TransactionalProtocolClient.Operation> operationListener = new TransactionalProtocolClient.TransactionalOperationListener<TransactionalProtocolClient.Operation>() { @Override public void operationPrepared(TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> prepared) { if(! queue.offer(prepared)) { prepared.rollback(); } } @Override public void operationFailed(TransactionalProtocolClient.Operation operation, ModelNode result) { try { queue.offer(new BlockingQueueOperationListener.FailedOperation<TransactionalProtocolClient.Operation>(operation, result)); } finally { // This might not be needed? completed.countDown(); } } @Override public void operationComplete(TransactionalProtocolClient.Operation operation, OperationResponse response) { try { control.operationCompleted(response); } finally { // Make sure the handler is called before commit/rollback returns completed.countDown(); } } }; AsyncFuture<OperationResponse> futureResult = null; try { // Translate the operation final PathAddress targetAddress = PathAddress.pathAddress(original.get(OP_ADDR)); final ModelNode translated = translateOperationForProxy(original, targetAddress); // Execute the operation ControllerLogger.MGMT_OP_LOGGER.tracef("Executing %s for %s", translated.get(OP).asString(), getProxyNodeAddress()); futureResult = client.execute(operationListener, translated, messageHandler, attachments); // Wait for the prepared response final TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> prepared; if (blockingTimeout == null) { prepared = queue.take(); } else { long timeout = blockingTimeout.getProxyBlockingTimeout(targetAddress, this); prepared = queue.poll(timeout, TimeUnit.MILLISECONDS); if (prepared == null) { blockingTimeout.proxyTimeoutDetected(targetAddress); futureResult.asyncCancel(true); ModelNode response = getTimeoutResponse(translated.get(OP).asString(), timeout); control.operationFailed(response); ControllerLogger.MGMT_OP_LOGGER.info(response.get(FAILURE_DESCRIPTION).asString()); return; } } if(prepared.isFailed()) { // If the operation failed, there is nothing more to do control.operationFailed(prepared.getPreparedResult()); return; } // Send the prepared notification and wrap the OperationTransaction to block on commit/rollback final AsyncFuture cancellable = futureResult; control.operationPrepared(new ModelController.OperationTransaction() { @Override public void commit() { prepared.commit(); awaitCompletion(); } @Override public void rollback() { prepared.rollback(); awaitCompletion(); } private void awaitCompletion() { try { // Await the completed notification if (blockingTimeout == null) { completed.await(); } else { long timeout = blockingTimeout.getProxyBlockingTimeout(targetAddress, RemoteProxyController.this); if (!completed.await(timeout, TimeUnit.MILLISECONDS)) { cancellable.asyncCancel(true); blockingTimeout.proxyTimeoutDetected(targetAddress); ControllerLogger.MGMT_OP_LOGGER.timeoutAwaitingFinalResponse(translated.get(OP).asString(), getProxyNodeAddress(), timeout); } } } catch (InterruptedException e) { cancellable.asyncCancel(true); ControllerLogger.MGMT_OP_LOGGER.interruptedAwaitingFinalResponse(translated.get(OP).asString(), getProxyNodeAddress()); Thread.currentThread().interrupt(); } catch (Exception e) { // ignore } } }, prepared.getPreparedResult()); } catch (InterruptedException e) { if (futureResult != null) { // it won't be null, as IE can only be thrown after it's assigned ControllerLogger.MGMT_OP_LOGGER.interruptedAwaitingInitialResponse(original.get(OP).asString(), getProxyNodeAddress()); // Cancel the operation futureResult.asyncCancel(true); } control.operationFailed(getCancelledResponse()); Thread.currentThread().interrupt(); } catch (IOException e) { final ModelNode result = new ModelNode(); result.get(OUTCOME).set(FAILED); result.get(FAILURE_DESCRIPTION).set(e.getLocalizedMessage()); // Notify the proxy control that the operation failed control.operationFailed(result); } } }
public class class_name { @Override public void execute(final ModelNode original, final OperationMessageHandler messageHandler, final ProxyOperationControl control, final OperationAttachments attachments, final BlockingTimeout blockingTimeout) { // Add blocking support to adhere to the proxy controller API contracts final CountDownLatch completed = new CountDownLatch(1); final BlockingQueue<TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation>> queue = new ArrayBlockingQueue<TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation>>(1, true); final TransactionalProtocolClient.TransactionalOperationListener<TransactionalProtocolClient.Operation> operationListener = new TransactionalProtocolClient.TransactionalOperationListener<TransactionalProtocolClient.Operation>() { @Override public void operationPrepared(TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> prepared) { if(! queue.offer(prepared)) { prepared.rollback(); // depends on control dependency: [if], data = [none] } } @Override public void operationFailed(TransactionalProtocolClient.Operation operation, ModelNode result) { try { queue.offer(new BlockingQueueOperationListener.FailedOperation<TransactionalProtocolClient.Operation>(operation, result)); // depends on control dependency: [try], data = [none] } finally { // This might not be needed? completed.countDown(); } } @Override public void operationComplete(TransactionalProtocolClient.Operation operation, OperationResponse response) { try { control.operationCompleted(response); // depends on control dependency: [try], data = [none] } finally { // Make sure the handler is called before commit/rollback returns completed.countDown(); } } }; AsyncFuture<OperationResponse> futureResult = null; try { // Translate the operation final PathAddress targetAddress = PathAddress.pathAddress(original.get(OP_ADDR)); final ModelNode translated = translateOperationForProxy(original, targetAddress); // Execute the operation ControllerLogger.MGMT_OP_LOGGER.tracef("Executing %s for %s", translated.get(OP).asString(), getProxyNodeAddress()); // depends on control dependency: [try], data = [none] futureResult = client.execute(operationListener, translated, messageHandler, attachments); // depends on control dependency: [try], data = [none] // Wait for the prepared response final TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> prepared; if (blockingTimeout == null) { prepared = queue.take(); // depends on control dependency: [if], data = [none] } else { long timeout = blockingTimeout.getProxyBlockingTimeout(targetAddress, this); prepared = queue.poll(timeout, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none] if (prepared == null) { blockingTimeout.proxyTimeoutDetected(targetAddress); // depends on control dependency: [if], data = [none] futureResult.asyncCancel(true); // depends on control dependency: [if], data = [none] ModelNode response = getTimeoutResponse(translated.get(OP).asString(), timeout); control.operationFailed(response); // depends on control dependency: [if], data = [none] ControllerLogger.MGMT_OP_LOGGER.info(response.get(FAILURE_DESCRIPTION).asString()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } if(prepared.isFailed()) { // If the operation failed, there is nothing more to do control.operationFailed(prepared.getPreparedResult()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Send the prepared notification and wrap the OperationTransaction to block on commit/rollback final AsyncFuture cancellable = futureResult; control.operationPrepared(new ModelController.OperationTransaction() { @Override public void commit() { prepared.commit(); awaitCompletion(); } @Override public void rollback() { prepared.rollback(); awaitCompletion(); } private void awaitCompletion() { try { // Await the completed notification if (blockingTimeout == null) { completed.await(); // depends on control dependency: [if], data = [none] } else { long timeout = blockingTimeout.getProxyBlockingTimeout(targetAddress, RemoteProxyController.this); if (!completed.await(timeout, TimeUnit.MILLISECONDS)) { cancellable.asyncCancel(true); // depends on control dependency: [if], data = [none] blockingTimeout.proxyTimeoutDetected(targetAddress); // depends on control dependency: [if], data = [none] ControllerLogger.MGMT_OP_LOGGER.timeoutAwaitingFinalResponse(translated.get(OP).asString(), getProxyNodeAddress(), timeout); // depends on control dependency: [if], data = [none] } } } catch (InterruptedException e) { cancellable.asyncCancel(true); ControllerLogger.MGMT_OP_LOGGER.interruptedAwaitingFinalResponse(translated.get(OP).asString(), getProxyNodeAddress()); Thread.currentThread().interrupt(); } catch (Exception e) { // depends on control dependency: [catch], data = [none] // ignore } // depends on control dependency: [catch], data = [none] } }, prepared.getPreparedResult()); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { if (futureResult != null) { // it won't be null, as IE can only be thrown after it's assigned ControllerLogger.MGMT_OP_LOGGER.interruptedAwaitingInitialResponse(original.get(OP).asString(), getProxyNodeAddress()); // depends on control dependency: [if], data = [none] // Cancel the operation futureResult.asyncCancel(true); // depends on control dependency: [if], data = [none] } control.operationFailed(getCancelledResponse()); Thread.currentThread().interrupt(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] final ModelNode result = new ModelNode(); result.get(OUTCOME).set(FAILED); result.get(FAILURE_DESCRIPTION).set(e.getLocalizedMessage()); // Notify the proxy control that the operation failed control.operationFailed(result); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length == 0) { return null; } return ann[0]; } }
public class class_name { static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); // depends on control dependency: [if], data = [none] } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); // depends on control dependency: [if], data = [none] } if (ann.length == 0) { return null; // depends on control dependency: [if], data = [none] } return ann[0]; } }
public class class_name { public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDescriptor = new FieldDescriptor(className, name, signature, isStatic); FieldDescriptor existing = fieldDescriptorMap.get(fieldDescriptor); if (existing == null) { fieldDescriptorMap.put(fieldDescriptor, fieldDescriptor); existing = fieldDescriptor; } return existing; } }
public class class_name { public FieldDescriptor getFieldDescriptor(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDescriptor = new FieldDescriptor(className, name, signature, isStatic); FieldDescriptor existing = fieldDescriptorMap.get(fieldDescriptor); if (existing == null) { fieldDescriptorMap.put(fieldDescriptor, fieldDescriptor); // depends on control dependency: [if], data = [none] existing = fieldDescriptor; // depends on control dependency: [if], data = [none] } return existing; } }
public class class_name { public static void main(final String[] args) { // update java.io.tmpdir final String tempPath = System.getProperty(FESS_TEMP_PATH); if (tempPath != null) { System.setProperty(JAVA_IO_TMPDIR, tempPath); } final TomcatBoot tomcatBoot = new FessBoot(getPort(), getContextPath()) // .useTldDetect(); // for JSP if (tempPath != null) { tomcatBoot.atBaseDir(new File(tempPath, "webapp").getAbsolutePath()); } final String tomcatConfigPath = getTomcatConfigPath(); if (tomcatConfigPath != null) { tomcatBoot.configure(tomcatConfigPath); // e.g. URIEncoding } tomcatBoot.logging(LOGGING_PROPERTIES, op -> { op.ignoreNoFile(); String fessLogPath = System.getProperty("fess.log.path"); if (fessLogPath == null) { fessLogPath = "../../logs"; } op.replace("fess.log.path", fessLogPath.replace("\\", "/")); }).asYouLikeIt(resource -> { final Host host = resource.getHost(); if (host instanceof StandardHost) { ((StandardHost) host).setErrorReportValveClass(SuppressErrorReportValve.class.getName()); } }).asDevelopment(isNoneEnv()).bootAwait(); } }
public class class_name { public static void main(final String[] args) { // update java.io.tmpdir final String tempPath = System.getProperty(FESS_TEMP_PATH); if (tempPath != null) { System.setProperty(JAVA_IO_TMPDIR, tempPath); // depends on control dependency: [if], data = [none] } final TomcatBoot tomcatBoot = new FessBoot(getPort(), getContextPath()) // .useTldDetect(); // for JSP if (tempPath != null) { tomcatBoot.atBaseDir(new File(tempPath, "webapp").getAbsolutePath()); // depends on control dependency: [if], data = [(tempPath] } final String tomcatConfigPath = getTomcatConfigPath(); if (tomcatConfigPath != null) { tomcatBoot.configure(tomcatConfigPath); // e.g. URIEncoding // depends on control dependency: [if], data = [(tomcatConfigPath] } tomcatBoot.logging(LOGGING_PROPERTIES, op -> { op.ignoreNoFile(); String fessLogPath = System.getProperty("fess.log.path"); if (fessLogPath == null) { fessLogPath = "../../logs"; // depends on control dependency: [if], data = [none] } op.replace("fess.log.path", fessLogPath.replace("\\", "/")); }).asYouLikeIt(resource -> { final Host host = resource.getHost(); if (host instanceof StandardHost) { ((StandardHost) host).setErrorReportValveClass(SuppressErrorReportValve.class.getName()); } }).asDevelopment(isNoneEnv()).bootAwait(); } }
public class class_name { protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) { I_CmsXmlContentValueLocation nameLocation = location.getSubValue("ConfigName"); if (nameLocation == null) { return null; } String configName = nameLocation.asString(m_cms); if (CmsStringUtil.isEmptyOrWhitespaceOnly(configName)) { return null; } configName = configName.trim(); I_CmsXmlContentValueLocation titleLocation = location.getSubValue("Title"); String title = null; if (titleLocation != null) { title = titleLocation.asString(m_cms); } I_CmsXmlContentValueLocation descriptionLocation = location.getSubValue("Description"); String description = null; if (descriptionLocation != null) { description = descriptionLocation.asString(m_cms); } return new CmsInheritanceReference(configName, title, description, m_resource, locale); } }
public class class_name { protected CmsInheritanceReference parseReference(I_CmsXmlContentLocation location, Locale locale) { I_CmsXmlContentValueLocation nameLocation = location.getSubValue("ConfigName"); if (nameLocation == null) { return null; // depends on control dependency: [if], data = [none] } String configName = nameLocation.asString(m_cms); if (CmsStringUtil.isEmptyOrWhitespaceOnly(configName)) { return null; // depends on control dependency: [if], data = [none] } configName = configName.trim(); I_CmsXmlContentValueLocation titleLocation = location.getSubValue("Title"); String title = null; if (titleLocation != null) { title = titleLocation.asString(m_cms); // depends on control dependency: [if], data = [none] } I_CmsXmlContentValueLocation descriptionLocation = location.getSubValue("Description"); String description = null; if (descriptionLocation != null) { description = descriptionLocation.asString(m_cms); // depends on control dependency: [if], data = [none] } return new CmsInheritanceReference(configName, title, description, m_resource, locale); } }
public class class_name { private synchronized boolean cancel(final int id, final boolean mayInterrupt, final boolean removeOperation) { final RunningOperation runningOperation = mRunningOperations.get(id); if (runningOperation != null) { if (removeOperation) { mRunningOperations.remove(id); } mCancelledOperations.add(id); return runningOperation.cancel(mayInterrupt); } else { return false; } } }
public class class_name { private synchronized boolean cancel(final int id, final boolean mayInterrupt, final boolean removeOperation) { final RunningOperation runningOperation = mRunningOperations.get(id); if (runningOperation != null) { if (removeOperation) { mRunningOperations.remove(id); // depends on control dependency: [if], data = [none] } mCancelledOperations.add(id); // depends on control dependency: [if], data = [none] return runningOperation.cancel(mayInterrupt); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static boolean tryUpgradeUpdateToWriteLockMillis( long address, long timeInMillis, boolean interruptible) throws InterruptedException { long lastTime = System.currentTimeMillis(); registerWait(address); try { do { if (tryUpgradeUpdateToWriteLockAndDeregisterWait0(address)) return true; checkInterrupted(interruptible); ThreadHints.onSpinWait(); long now = System.currentTimeMillis(); if (now != lastTime) { lastTime = now; timeInMillis--; } } while (timeInMillis >= 0); deregisterWait(address); return false; } catch (Throwable t) { throw tryDeregisterWaitAndRethrow(address, t); } } }
public class class_name { private static boolean tryUpgradeUpdateToWriteLockMillis( long address, long timeInMillis, boolean interruptible) throws InterruptedException { long lastTime = System.currentTimeMillis(); registerWait(address); try { do { if (tryUpgradeUpdateToWriteLockAndDeregisterWait0(address)) return true; checkInterrupted(interruptible); ThreadHints.onSpinWait(); long now = System.currentTimeMillis(); if (now != lastTime) { lastTime = now; // depends on control dependency: [if], data = [none] timeInMillis--; // depends on control dependency: [if], data = [none] } } while (timeInMillis >= 0); deregisterWait(address); return false; } catch (Throwable t) { throw tryDeregisterWaitAndRethrow(address, t); } } }
public class class_name { public SearchProvisionedProductsResult withProvisionedProducts(ProvisionedProductAttribute... provisionedProducts) { if (this.provisionedProducts == null) { setProvisionedProducts(new java.util.ArrayList<ProvisionedProductAttribute>(provisionedProducts.length)); } for (ProvisionedProductAttribute ele : provisionedProducts) { this.provisionedProducts.add(ele); } return this; } }
public class class_name { public SearchProvisionedProductsResult withProvisionedProducts(ProvisionedProductAttribute... provisionedProducts) { if (this.provisionedProducts == null) { setProvisionedProducts(new java.util.ArrayList<ProvisionedProductAttribute>(provisionedProducts.length)); // depends on control dependency: [if], data = [none] } for (ProvisionedProductAttribute ele : provisionedProducts) { this.provisionedProducts.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void snapshotChanges(int originBase, Bytez origin) { int sumLen = 0; for (int i = 0; i < curIndex; i++) { sumLen += changeLength[i]; } snapshot = new byte[sumLen]; int targetIdx = 0; for (int i = 0; i < curIndex; i++) { int changeOffset = changeOffsets[i]; int len = changeLength[i]; for ( int ii = 0; ii < len; ii++) { snapshot[targetIdx++] = origin.get(changeOffset+ii); } } rebase(originBase); } }
public class class_name { public void snapshotChanges(int originBase, Bytez origin) { int sumLen = 0; for (int i = 0; i < curIndex; i++) { sumLen += changeLength[i]; // depends on control dependency: [for], data = [i] } snapshot = new byte[sumLen]; int targetIdx = 0; for (int i = 0; i < curIndex; i++) { int changeOffset = changeOffsets[i]; int len = changeLength[i]; for ( int ii = 0; ii < len; ii++) { snapshot[targetIdx++] = origin.get(changeOffset+ii); // depends on control dependency: [for], data = [ii] } } rebase(originBase); } }
public class class_name { public boolean connect(){ try { sock = new Socket(host, port); in = new BufferedReader(new InputStreamReader( sock.getInputStream(), "UTF-8")); out = new BufferedWriter(new OutputStreamWriter( sock.getOutputStream(), "UTF-8")); return true; } catch (Exception e){ System.out.println(e.getMessage()); return false; } } }
public class class_name { public boolean connect(){ try { sock = new Socket(host, port); // depends on control dependency: [try], data = [none] in = new BufferedReader(new InputStreamReader( sock.getInputStream(), "UTF-8")); // depends on control dependency: [try], data = [none] out = new BufferedWriter(new OutputStreamWriter( sock.getOutputStream(), "UTF-8")); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception e){ System.out.println(e.getMessage()); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void convertNode(final GraphObjectMap map, final Node node) { final NodeList nodeList = node.getChildNodes(); if (nodeList != null) { final List<GraphObjectMap> children = new LinkedList<>(); final int length = nodeList.getLength(); for (int i=0; i<length; i++) { final GraphObjectMap childMap = new GraphObjectMap(); final Node childNode = nodeList.item(i); convertNode(childMap, childNode); children.add(childMap); } map.put(childrenProperty, children); } final NamedNodeMap attributeList = node.getAttributes(); if (attributeList != null) { final List<GraphObjectMap> attributes = new LinkedList<>(); final int length = attributeList.getLength(); for (int i=0; i<length; i++) { final GraphObjectMap attributeMap = new GraphObjectMap(); final Node attributeNode = attributeList.item(i); convertNode(attributeMap, attributeNode); attributes.add(attributeMap); } map.put(attributesProperty, attributes); } map.put(typeProperty, node.getClass().getSimpleName()); final String nodeName = node.getNodeName(); if (nodeName != null) { map.put(nameProperty, nodeName); } final String nodeValue = node.getNodeValue(); if (nodeValue != null) { map.put(valueProperty, nodeValue); } } }
public class class_name { private void convertNode(final GraphObjectMap map, final Node node) { final NodeList nodeList = node.getChildNodes(); if (nodeList != null) { final List<GraphObjectMap> children = new LinkedList<>(); final int length = nodeList.getLength(); for (int i=0; i<length; i++) { final GraphObjectMap childMap = new GraphObjectMap(); final Node childNode = nodeList.item(i); convertNode(childMap, childNode); // depends on control dependency: [for], data = [none] children.add(childMap); // depends on control dependency: [for], data = [none] } map.put(childrenProperty, children); // depends on control dependency: [if], data = [none] } final NamedNodeMap attributeList = node.getAttributes(); if (attributeList != null) { final List<GraphObjectMap> attributes = new LinkedList<>(); final int length = attributeList.getLength(); for (int i=0; i<length; i++) { final GraphObjectMap attributeMap = new GraphObjectMap(); final Node attributeNode = attributeList.item(i); convertNode(attributeMap, attributeNode); // depends on control dependency: [for], data = [none] attributes.add(attributeMap); // depends on control dependency: [for], data = [none] } map.put(attributesProperty, attributes); // depends on control dependency: [if], data = [none] } map.put(typeProperty, node.getClass().getSimpleName()); final String nodeName = node.getNodeName(); if (nodeName != null) { map.put(nameProperty, nodeName); // depends on control dependency: [if], data = [none] } final String nodeValue = node.getNodeValue(); if (nodeValue != null) { map.put(valueProperty, nodeValue); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setThisData(byte[] data) { try { pen.setData(data); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } } }
public class class_name { public void setThisData(byte[] data) { try { pen.setData(data); // depends on control dependency: [try], data = [none] } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void handleEvent(Event event) { LOG.fine("CustomInfoHandler called"); if (customInfo != null) { event.getCustomInfo().putAll(customInfo); } } }
public class class_name { @Override public void handleEvent(Event event) { LOG.fine("CustomInfoHandler called"); if (customInfo != null) { event.getCustomInfo().putAll(customInfo); // depends on control dependency: [if], data = [(customInfo] } } }
public class class_name { public void populateExtractionResult(List<Object> objects) { for (Object object : objects) { extractorDelegate.extractEntity(object); } } }
public class class_name { public void populateExtractionResult(List<Object> objects) { for (Object object : objects) { extractorDelegate.extractEntity(object); // depends on control dependency: [for], data = [object] } } }
public class class_name { @Override public Response getApplicationBindings( String applicationName ) { Response response; ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { ApplicationBindings bindings = new ApplicationBindings(); // Find all the external prefixes to resolve for( Component c : ComponentHelpers.findAllComponents( ma.getApplication())) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); bindings.prefixToItems.put( prefix, new ArrayList<ApplicationBindingItem> ()); } } // Find all the applications that match a given prefix for( ManagedApplication managedApp : this.manager.applicationMngr().getManagedApplications()) { // Any potential bindings with this application? // There should be AT MOST 1 matching template for a given prefix. // One template means there can be several applications. String prefix = managedApp.getApplication().getTemplate().getExternalExportsPrefix(); if( prefix == null || ! bindings.prefixToItems.containsKey( prefix )) continue; // There is a potential match. Is there an effective bound? Set<String> boundApps = ma.getApplication().getApplicationBindings().get( prefix ); boolean bound = boundApps != null && boundApps.contains( managedApp.getName()); ApplicationBindingItem item = new ApplicationBindingItem( managedApp.getName(), bound ); bindings.prefixToItems.get( prefix ).add( item ); } response = Response.ok().entity( bindings ).build(); } return response; } }
public class class_name { @Override public Response getApplicationBindings( String applicationName ) { Response response; ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { response = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); // depends on control dependency: [if], data = [none] } else { ApplicationBindings bindings = new ApplicationBindings(); // Find all the external prefixes to resolve for( Component c : ComponentHelpers.findAllComponents( ma.getApplication())) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); bindings.prefixToItems.put( prefix, new ArrayList<ApplicationBindingItem> ()); // depends on control dependency: [for], data = [none] } } // Find all the applications that match a given prefix for( ManagedApplication managedApp : this.manager.applicationMngr().getManagedApplications()) { // Any potential bindings with this application? // There should be AT MOST 1 matching template for a given prefix. // One template means there can be several applications. String prefix = managedApp.getApplication().getTemplate().getExternalExportsPrefix(); if( prefix == null || ! bindings.prefixToItems.containsKey( prefix )) continue; // There is a potential match. Is there an effective bound? Set<String> boundApps = ma.getApplication().getApplicationBindings().get( prefix ); boolean bound = boundApps != null && boundApps.contains( managedApp.getName()); ApplicationBindingItem item = new ApplicationBindingItem( managedApp.getName(), bound ); bindings.prefixToItems.get( prefix ).add( item ); // depends on control dependency: [for], data = [none] } response = Response.ok().entity( bindings ).build(); // depends on control dependency: [if], data = [none] } return response; } }
public class class_name { @Override public void setBufferSize(int size) { if (this.writing || isClosed()) { throw new IllegalStateException("Stream unable to set size"); } this.amountToBuffer = size; this.bbSize = (49152 < size) ? 32768 : 8192; // make sure we never create larger frames than the max http2 frame size Integer h2size = (Integer) this.getVc().getStateMap().get("h2_frame_size"); if (h2size != null && h2size < bbSize) { this.bbSize = h2size; } int numBuffers = (size / this.bbSize); if (0 == size || 0 != (size % this.bbSize)) { numBuffers++; } this.output = new WsByteBuffer[numBuffers]; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setBufferSize=" + size + "; " + this); } } }
public class class_name { @Override public void setBufferSize(int size) { if (this.writing || isClosed()) { throw new IllegalStateException("Stream unable to set size"); } this.amountToBuffer = size; this.bbSize = (49152 < size) ? 32768 : 8192; // make sure we never create larger frames than the max http2 frame size Integer h2size = (Integer) this.getVc().getStateMap().get("h2_frame_size"); if (h2size != null && h2size < bbSize) { this.bbSize = h2size; // depends on control dependency: [if], data = [none] } int numBuffers = (size / this.bbSize); if (0 == size || 0 != (size % this.bbSize)) { numBuffers++; // depends on control dependency: [if], data = [none] } this.output = new WsByteBuffer[numBuffers]; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setBufferSize=" + size + "; " + this); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Message clearFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) if(flag != null) tmp&=~flag.value(); this.flags=tmp; } return this; } }
public class class_name { public Message clearFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) if(flag != null) tmp&=~flag.value(); this.flags=tmp; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { protected void computePDists(Relation<O> relation, KNNQuery<O> knn, WritableDoubleDataStore pdists) { // computing PRDs FiniteProgress prdsProgress = LOG.isVerbose() ? new FiniteProgress("pdists", relation.size(), LOG) : null; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final KNNList neighbors = knn.getKNNForDBID(iditer, kreach + 1); // + // query // point // use first kref neighbors as reference set int ks = 0; double ssum = 0.; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid() && ks < kreach; neighbor.advance()) { if(DBIDUtil.equal(neighbor, iditer)) { continue; } final double d = neighbor.doubleValue(); ssum += d * d; ks++; } double pdist = ks > 0 ? FastMath.sqrt(ssum / ks) : 0.; pdists.putDouble(iditer, pdist); LOG.incrementProcessed(prdsProgress); } LOG.ensureCompleted(prdsProgress); } }
public class class_name { protected void computePDists(Relation<O> relation, KNNQuery<O> knn, WritableDoubleDataStore pdists) { // computing PRDs FiniteProgress prdsProgress = LOG.isVerbose() ? new FiniteProgress("pdists", relation.size(), LOG) : null; for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { final KNNList neighbors = knn.getKNNForDBID(iditer, kreach + 1); // + // query // point // use first kref neighbors as reference set int ks = 0; double ssum = 0.; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid() && ks < kreach; neighbor.advance()) { if(DBIDUtil.equal(neighbor, iditer)) { continue; } final double d = neighbor.doubleValue(); ssum += d * d; // depends on control dependency: [for], data = [none] ks++; // depends on control dependency: [for], data = [none] } double pdist = ks > 0 ? FastMath.sqrt(ssum / ks) : 0.; pdists.putDouble(iditer, pdist); // depends on control dependency: [for], data = [iditer] LOG.incrementProcessed(prdsProgress); // depends on control dependency: [for], data = [none] } LOG.ensureCompleted(prdsProgress); } }
public class class_name { protected final boolean validate(@NonNull Subscriber<?>[] subscribers) { int p = parallelism(); if (subscribers.length != p) { Throwable iae = new IllegalArgumentException("parallelism = " + p + ", subscribers = " + subscribers.length); for (Subscriber<?> s : subscribers) { EmptySubscription.error(iae, s); } return false; } return true; } }
public class class_name { protected final boolean validate(@NonNull Subscriber<?>[] subscribers) { int p = parallelism(); if (subscribers.length != p) { Throwable iae = new IllegalArgumentException("parallelism = " + p + ", subscribers = " + subscribers.length); for (Subscriber<?> s : subscribers) { EmptySubscription.error(iae, s); // depends on control dependency: [for], data = [s] } return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { @Override public final long getLastIdleTime(IdleStatus status) { if (status == IdleStatus.BOTH_IDLE) { return lastIdleTimeForBoth; } if (status == IdleStatus.READER_IDLE) { return lastIdleTimeForRead; } if (status == IdleStatus.WRITER_IDLE) { return lastIdleTimeForWrite; } throw new IllegalArgumentException("Unknown idle status: " + status); } }
public class class_name { @Override public final long getLastIdleTime(IdleStatus status) { if (status == IdleStatus.BOTH_IDLE) { return lastIdleTimeForBoth; // depends on control dependency: [if], data = [none] } if (status == IdleStatus.READER_IDLE) { return lastIdleTimeForRead; // depends on control dependency: [if], data = [none] } if (status == IdleStatus.WRITER_IDLE) { return lastIdleTimeForWrite; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Unknown idle status: " + status); } }
public class class_name { public void marshall(DeleteLoadBalancerTlsCertificateRequest deleteLoadBalancerTlsCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteLoadBalancerTlsCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getLoadBalancerName(), LOADBALANCERNAME_BINDING); protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getCertificateName(), CERTIFICATENAME_BINDING); protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getForce(), FORCE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteLoadBalancerTlsCertificateRequest deleteLoadBalancerTlsCertificateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteLoadBalancerTlsCertificateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getLoadBalancerName(), LOADBALANCERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getCertificateName(), CERTIFICATENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteLoadBalancerTlsCertificateRequest.getForce(), FORCE_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 { void collectVertices(final List<ManagementVertex> vertices) { final Iterator<ManagementVertex> it = this.groupMembers.iterator(); while (it.hasNext()) { vertices.add(it.next()); } } }
public class class_name { void collectVertices(final List<ManagementVertex> vertices) { final Iterator<ManagementVertex> it = this.groupMembers.iterator(); while (it.hasNext()) { vertices.add(it.next()); // depends on control dependency: [while], data = [none] } } }
public class class_name { public InputStream post(URI uri, String json) { HttpConnection connection = Http.POST(uri, "application/json"); if (json != null && !json.isEmpty()) { connection.setRequestBody(json); } return executeToInputStream(connection); } }
public class class_name { public InputStream post(URI uri, String json) { HttpConnection connection = Http.POST(uri, "application/json"); if (json != null && !json.isEmpty()) { connection.setRequestBody(json); // depends on control dependency: [if], data = [(json] } return executeToInputStream(connection); } }
public class class_name { public TagFileInfo getTagFile(String shortname) { TagFileInfo tagFiles[] = getTagFiles(); if (tagFiles == null || tagFiles.length == 0) { return null; } for (int i=0; i < tagFiles.length; i++) { if (tagFiles[i].getName().equals(shortname)) { return tagFiles[i]; } } return null; } }
public class class_name { public TagFileInfo getTagFile(String shortname) { TagFileInfo tagFiles[] = getTagFiles(); if (tagFiles == null || tagFiles.length == 0) { return null; // depends on control dependency: [if], data = [none] } for (int i=0; i < tagFiles.length; i++) { if (tagFiles[i].getName().equals(shortname)) { return tagFiles[i]; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Nonnull public static Configuration createConfiguration(Properties properties) { final Configuration configuration = new Configuration(); final Set<String> propertyNames = properties.stringPropertyNames(); for (String propertyName : propertyNames) { configuration.setString(propertyName, properties.getProperty(propertyName)); } return configuration; } }
public class class_name { @Nonnull public static Configuration createConfiguration(Properties properties) { final Configuration configuration = new Configuration(); final Set<String> propertyNames = properties.stringPropertyNames(); for (String propertyName : propertyNames) { configuration.setString(propertyName, properties.getProperty(propertyName)); // depends on control dependency: [for], data = [propertyName] } return configuration; } }
public class class_name { public static boolean hasField( Class clazz, String fieldName ) { try { clazz.getDeclaredField( fieldName ); return true; } catch( NoSuchFieldException nfe ) { if( clazz.getSuperclass() != null ) { return hasField( clazz.getSuperclass(), fieldName ); } else { return false; } } } }
public class class_name { public static boolean hasField( Class clazz, String fieldName ) { try { clazz.getDeclaredField( fieldName ); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch( NoSuchFieldException nfe ) { if( clazz.getSuperclass() != null ) { return hasField( clazz.getSuperclass(), fieldName ); // depends on control dependency: [if], data = [( clazz.getSuperclass()] } else { return false; // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void foldButtons() { VerticalLayout mainPV = (VerticalLayout)m_foldedButtonsMenu.getContent().getPopupComponent(); for (int i = m_itemsLeft.getComponentCount() - 1; i > -1; i--) { Component comp = m_itemsLeft.getComponent(i); if (!isAlwaysShow(comp)) { m_itemsLeft.removeComponent(comp); m_leftButtons.addComponent(comp, 0); m_leftButtons.setComponentAlignment(comp, Alignment.MIDDLE_CENTER); } } if (m_leftButtons.getComponentCount() == 0) { mainPV.removeComponent(m_leftButtons); } else { mainPV.addComponent(m_leftButtons, 0); } for (int i = m_itemsRight.getComponentCount() - 1; i > -1; i--) { Component comp = m_itemsRight.getComponent(i); if (!isAlwaysShow(comp)) { m_itemsRight.removeComponent(comp); m_rightButtons.addComponent(comp, 0); m_rightButtons.setComponentAlignment(comp, Alignment.MIDDLE_CENTER); } } if (m_rightButtons.getComponentCount() == 0) { mainPV.removeComponent(m_rightButtons); } else { mainPV.addComponent(m_rightButtons); } m_itemsRight.addComponent(m_foldedButtonsMenu, 0); m_buttonsFolded = true; markAsDirtyRecursive(); } }
public class class_name { private void foldButtons() { VerticalLayout mainPV = (VerticalLayout)m_foldedButtonsMenu.getContent().getPopupComponent(); for (int i = m_itemsLeft.getComponentCount() - 1; i > -1; i--) { Component comp = m_itemsLeft.getComponent(i); if (!isAlwaysShow(comp)) { m_itemsLeft.removeComponent(comp); // depends on control dependency: [if], data = [none] m_leftButtons.addComponent(comp, 0); // depends on control dependency: [if], data = [none] m_leftButtons.setComponentAlignment(comp, Alignment.MIDDLE_CENTER); // depends on control dependency: [if], data = [none] } } if (m_leftButtons.getComponentCount() == 0) { mainPV.removeComponent(m_leftButtons); // depends on control dependency: [if], data = [none] } else { mainPV.addComponent(m_leftButtons, 0); // depends on control dependency: [if], data = [0)] } for (int i = m_itemsRight.getComponentCount() - 1; i > -1; i--) { Component comp = m_itemsRight.getComponent(i); if (!isAlwaysShow(comp)) { m_itemsRight.removeComponent(comp); // depends on control dependency: [if], data = [none] m_rightButtons.addComponent(comp, 0); // depends on control dependency: [if], data = [none] m_rightButtons.setComponentAlignment(comp, Alignment.MIDDLE_CENTER); // depends on control dependency: [if], data = [none] } } if (m_rightButtons.getComponentCount() == 0) { mainPV.removeComponent(m_rightButtons); // depends on control dependency: [if], data = [none] } else { mainPV.addComponent(m_rightButtons); // depends on control dependency: [if], data = [none] } m_itemsRight.addComponent(m_foldedButtonsMenu, 0); m_buttonsFolded = true; markAsDirtyRecursive(); } }
public class class_name { private boolean cdissect(RuntimeSubexpression t, int begin, int end) { assert t != null; switch (t.op) { case '=': /* terminal node */ assert t.left == null && t.right == null; return true; /* no action, parent did the work */ case '|': /* alternation */ assert t.left != null; return caltdissect(t, begin, end); case 'b': /* back ref -- shouldn't be calling us! */ assert t.left == null && t.right == null; return cbrdissect(t, begin, end); case '.': /* concatenation */ assert t.left != null && t.right != null; return ccondissect(t, begin, end); case '(': /* capturing */ assert t.left != null && t.right == null; assert t.number > 0; boolean cdmatch = cdissect(t.left, begin, end); if (cdmatch) { subset(t, begin, end); } return cdmatch; default: throw new RuntimeException("Impossible op"); } } }
public class class_name { private boolean cdissect(RuntimeSubexpression t, int begin, int end) { assert t != null; switch (t.op) { case '=': /* terminal node */ assert t.left == null && t.right == null; return true; /* no action, parent did the work */ case '|': /* alternation */ assert t.left != null; return caltdissect(t, begin, end); case 'b': /* back ref -- shouldn't be calling us! */ assert t.left == null && t.right == null; return cbrdissect(t, begin, end); case '.': /* concatenation */ assert t.left != null && t.right != null; return ccondissect(t, begin, end); case '(': /* capturing */ assert t.left != null && t.right == null; assert t.number > 0; boolean cdmatch = cdissect(t.left, begin, end); if (cdmatch) { subset(t, begin, end); // depends on control dependency: [if], data = [none] } return cdmatch; default: throw new RuntimeException("Impossible op"); } } }
public class class_name { public Map<String, EntityDocument> getEntityDocuments(List<String> entityIds) throws MediaWikiApiErrorException, IOException { Map<String, EntityDocument> result = new HashMap<>(); List<String> newEntityIds = new ArrayList<>(); newEntityIds.addAll(entityIds); boolean moreItems = !newEntityIds.isEmpty(); while (moreItems) { List<String> subListOfEntityIds; if (newEntityIds.size() <= maxListSize) { subListOfEntityIds = newEntityIds; moreItems = false; } else { subListOfEntityIds = newEntityIds.subList(0, maxListSize); } WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = ApiConnection.implodeObjects(subListOfEntityIds); result.putAll(getEntityDocumentMap(entityIds.size(), properties)); subListOfEntityIds.clear(); } return result; } }
public class class_name { public Map<String, EntityDocument> getEntityDocuments(List<String> entityIds) throws MediaWikiApiErrorException, IOException { Map<String, EntityDocument> result = new HashMap<>(); List<String> newEntityIds = new ArrayList<>(); newEntityIds.addAll(entityIds); boolean moreItems = !newEntityIds.isEmpty(); while (moreItems) { List<String> subListOfEntityIds; if (newEntityIds.size() <= maxListSize) { subListOfEntityIds = newEntityIds; // depends on control dependency: [if], data = [none] moreItems = false; // depends on control dependency: [if], data = [none] } else { subListOfEntityIds = newEntityIds.subList(0, maxListSize); // depends on control dependency: [if], data = [none] } WbGetEntitiesActionData properties = new WbGetEntitiesActionData(); properties.ids = ApiConnection.implodeObjects(subListOfEntityIds); result.putAll(getEntityDocumentMap(entityIds.size(), properties)); subListOfEntityIds.clear(); } return result; } }
public class class_name { public static double[] line_of_twoP(double[] p1, double[] p2) { // kb[0]:if the line is vertical;kb[1]:a value if kb[0]=1,k value or else;kb[2]:insignificance if kb[0]=1,b value or else; double[] kb = new double[3]; if (p1[0] == p2[0]) { kb[0] = 1; kb[1] = p1[0]; kb[2] = 0; } else { kb[0] = 0; kb[1] = (p1[1] - p2[1]) / (p1[0] - p2[0]); kb[2] = p1[1] - kb[1] * p1[0]; } return kb; } }
public class class_name { public static double[] line_of_twoP(double[] p1, double[] p2) { // kb[0]:if the line is vertical;kb[1]:a value if kb[0]=1,k value or else;kb[2]:insignificance if kb[0]=1,b value or else; double[] kb = new double[3]; if (p1[0] == p2[0]) { kb[0] = 1; // depends on control dependency: [if], data = [none] kb[1] = p1[0]; // depends on control dependency: [if], data = [none] kb[2] = 0; // depends on control dependency: [if], data = [none] } else { kb[0] = 0; // depends on control dependency: [if], data = [none] kb[1] = (p1[1] - p2[1]) / (p1[0] - p2[0]); // depends on control dependency: [if], data = [(p1[0]] kb[2] = p1[1] - kb[1] * p1[0]; // depends on control dependency: [if], data = [none] } return kb; } }
public class class_name { public Discover firstAirDateYearLte(int year) { if (checkYear(year)) { params.add(Param.FIRST_AIR_DATE_LTE, year); } return this; } }
public class class_name { public Discover firstAirDateYearLte(int year) { if (checkYear(year)) { params.add(Param.FIRST_AIR_DATE_LTE, year); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private CompletableFuture<Void> throttle() { val delay = new AtomicReference<ThrottlerCalculator.DelayResult>(this.throttlerCalculator.getThrottlingDelay()); if (!delay.get().isMaximum()) { // We are not delaying the maximum amount. We only need to do this once. return throttleOnce(delay.get().getDurationMillis(), delay.get().isMaximum()); } else { // The initial delay calculation indicated that we need to throttle to the maximum, which means there's // significant pressure. In order to protect downstream components, we need to run in a loop and delay as much // as needed until the pressure is relieved. return Futures.loop( () -> !delay.get().isMaximum(), () -> throttleOnce(delay.get().getDurationMillis(), delay.get().isMaximum()) .thenRun(() -> delay.set(this.throttlerCalculator.getThrottlingDelay())), this.executor); } } }
public class class_name { private CompletableFuture<Void> throttle() { val delay = new AtomicReference<ThrottlerCalculator.DelayResult>(this.throttlerCalculator.getThrottlingDelay()); if (!delay.get().isMaximum()) { // We are not delaying the maximum amount. We only need to do this once. return throttleOnce(delay.get().getDurationMillis(), delay.get().isMaximum()); // depends on control dependency: [if], data = [none] } else { // The initial delay calculation indicated that we need to throttle to the maximum, which means there's // significant pressure. In order to protect downstream components, we need to run in a loop and delay as much // as needed until the pressure is relieved. return Futures.loop( () -> !delay.get().isMaximum(), () -> throttleOnce(delay.get().getDurationMillis(), delay.get().isMaximum()) .thenRun(() -> delay.set(this.throttlerCalculator.getThrottlingDelay())), this.executor); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods) { Map map = new HashMap(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; map.put(method.getName() + Type.getMethodDescriptor(method), method); } Method[] result = new Method[namesAndDescriptors.length / 2]; for (int i = 0; i < result.length; i++) { result[i] = (Method)map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]); if (result[i] == null) { // TODO: error? } } return result; } }
public class class_name { public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods) { Map map = new HashMap(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; map.put(method.getName() + Type.getMethodDescriptor(method), method); // depends on control dependency: [for], data = [none] } Method[] result = new Method[namesAndDescriptors.length / 2]; for (int i = 0; i < result.length; i++) { result[i] = (Method)map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]); // depends on control dependency: [for], data = [i] if (result[i] == null) { // TODO: error? } } return result; } }
public class class_name { @Override public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException { String marketName = DSXAdapters.currencyPairToMarketName(currencyPair); String accountType = null; try { if (args != null) { accountType = (String) args[0]; } } catch (ArrayIndexOutOfBoundsException e) { // ignore, can happen if no argument given. } DSXTickerWrapper dsxTickerWrapper = getDSXTicker(marketName, accountType); // Adapt to XChange DTOs return DSXAdapters.adaptTicker(dsxTickerWrapper.getTicker(marketName), currencyPair); } }
public class class_name { @Override public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException { String marketName = DSXAdapters.currencyPairToMarketName(currencyPair); String accountType = null; try { if (args != null) { accountType = (String) args[0]; // depends on control dependency: [if], data = [none] } } catch (ArrayIndexOutOfBoundsException e) { // ignore, can happen if no argument given. } // depends on control dependency: [catch], data = [none] DSXTickerWrapper dsxTickerWrapper = getDSXTicker(marketName, accountType); // Adapt to XChange DTOs return DSXAdapters.adaptTicker(dsxTickerWrapper.getTicker(marketName), currencyPair); } }
public class class_name { public void setUserProperties(Map userData) throws SIResourceException { if (tc.isEntryEnabled()) SibTr.entry(tc, "setUserProperties", new Object[] { userData }); _consumerDispatcher.getConsumerDispatcherState().setUserData(userData); Transaction tran = _messageProcessor.getTXManager().createAutoCommitTransaction(); if( !_consumerDispatcher.getReferenceStream().isUpdating() ) { try { _consumerDispatcher.getReferenceStream().requestUpdate(tran); } catch (MessageStoreException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.MPSubscriptionImpl.setUserProperties", "1:269:1.6", this); SibTr.exception(tc, e); if (tc.isEntryEnabled()) SibTr.exit(tc, "setUserProperties", "SIResourceException"); throw new SIResourceException(e); } } if (tc.isEntryEnabled()) SibTr.exit(tc, "setUserProperties"); } }
public class class_name { public void setUserProperties(Map userData) throws SIResourceException { if (tc.isEntryEnabled()) SibTr.entry(tc, "setUserProperties", new Object[] { userData }); _consumerDispatcher.getConsumerDispatcherState().setUserData(userData); Transaction tran = _messageProcessor.getTXManager().createAutoCommitTransaction(); if( !_consumerDispatcher.getReferenceStream().isUpdating() ) { try { _consumerDispatcher.getReferenceStream().requestUpdate(tran); // depends on control dependency: [try], data = [none] } catch (MessageStoreException e) { // MessageStoreException shouldn't occur so FFDC. FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.MPSubscriptionImpl.setUserProperties", "1:269:1.6", this); SibTr.exception(tc, e); if (tc.isEntryEnabled()) SibTr.exit(tc, "setUserProperties", "SIResourceException"); throw new SIResourceException(e); } // depends on control dependency: [catch], data = [none] } if (tc.isEntryEnabled()) SibTr.exit(tc, "setUserProperties"); } }
public class class_name { public final static boolean isJavaKeyword(String s) { if (s == null || s.length() == 0) { return false; } for (int i = 0; i < keywords.length; i++) { if (keywords[i].equals(s)) { return true; } } return false; } }
public class class_name { public final static boolean isJavaKeyword(String s) { if (s == null || s.length() == 0) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < keywords.length; i++) { if (keywords[i].equals(s)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { protected static double rawQuantile(double p, double alpha, double beta, final double logbeta) { // Initial estimate for x double x; { // Very fast approximation of y. double tmp = FastMath.sqrt(-2 * FastMath.log(p)); double y = tmp - (2.30753 + 0.27061 * tmp) / (1. + (0.99229 + 0.04481 * tmp) * tmp); if(alpha > 1 && beta > 1) { double r = (y * y - 3.) / 6.; double s = 1. / (alpha + alpha - 1.); double t = 1. / (beta + beta - 1.); double h = 2. / (s + t); double w = y * FastMath.sqrt(h + r) / h - (t - s) * (r + 5. / 6. - 2. / (3. * h)); x = alpha / (alpha + beta * FastMath.exp(w + w)); } else { double r = beta + beta; double t = 1. / (9. * beta); final double a = 1. - t + y * FastMath.sqrt(t); t = r * a * a * a; if(t <= 0.) { x = 1. - FastMath.exp((FastMath.log1p(-p) + FastMath.log(beta) + logbeta) / beta); } else { t = (4. * alpha + r - 2.) / t; if(t <= 1.) { x = FastMath.exp((FastMath.log(p * alpha) + logbeta) / alpha); } else { x = 1. - 2. / (t + 1.); } } } // Degenerate initial approximations if(x < 3e-308 || x > 1 - 2.22e-16) { x = 0.5; } } // Newon-Raphson method using the CDF { final double ialpha = 1 - alpha; final double ibeta = 1 - beta; // Desired accuracy, as from GNU R adoption of AS 109 final double acu = Math.max(1e-300, FastMath.pow(10., -13 - 2.5 / (alpha * alpha) - .5 / (p * p))); double prevstep = 0., y = 0., stepsize = 1; for(int outer = 0; outer < 1000; outer++) { // Current CDF value double ynew = cdf(x, alpha, beta); if(Double.isInfinite(ynew)) { // Degenerated. return Double.NaN; } // Error gradient ynew = (ynew - p) * FastMath.exp(logbeta + ialpha * FastMath.log(x) + ibeta * FastMath.log1p(-x)); if(ynew * y <= 0.) { prevstep = Math.max(Math.abs(stepsize), 3e-308); } // Inner loop: try different step sizes: y * 3^-i double g = 1, xnew = 0.; for(int inner = 0; inner < 1000; inner++) { stepsize = g * ynew; if(Math.abs(stepsize) < prevstep) { xnew = x - stepsize; // Candidate x if(xnew >= 0. && xnew <= 1.) { // Close enough if(prevstep <= acu || Math.abs(ynew) <= acu) { return x; } if(xnew != 0. && xnew != 1.) { break; } } } g /= 3.; } // Convergence if(Math.abs(xnew - x) < 1e-15 * x) { return x; } // Iterate with new values x = xnew; y = ynew; } } // Not converged in Newton-Raphson throw new ArithmeticException("Beta quantile computation did not converge."); } }
public class class_name { protected static double rawQuantile(double p, double alpha, double beta, final double logbeta) { // Initial estimate for x double x; { // Very fast approximation of y. double tmp = FastMath.sqrt(-2 * FastMath.log(p)); double y = tmp - (2.30753 + 0.27061 * tmp) / (1. + (0.99229 + 0.04481 * tmp) * tmp); if(alpha > 1 && beta > 1) { double r = (y * y - 3.) / 6.; double s = 1. / (alpha + alpha - 1.); double t = 1. / (beta + beta - 1.); double h = 2. / (s + t); double w = y * FastMath.sqrt(h + r) / h - (t - s) * (r + 5. / 6. - 2. / (3. * h)); x = alpha / (alpha + beta * FastMath.exp(w + w)); // depends on control dependency: [if], data = [(alpha] } else { double r = beta + beta; double t = 1. / (9. * beta); final double a = 1. - t + y * FastMath.sqrt(t); t = r * a * a * a; // depends on control dependency: [if], data = [none] if(t <= 0.) { x = 1. - FastMath.exp((FastMath.log1p(-p) + FastMath.log(beta) + logbeta) / beta); // depends on control dependency: [if], data = [none] } else { t = (4. * alpha + r - 2.) / t; // depends on control dependency: [if], data = [none] if(t <= 1.) { x = FastMath.exp((FastMath.log(p * alpha) + logbeta) / alpha); // depends on control dependency: [if], data = [none] } else { x = 1. - 2. / (t + 1.); // depends on control dependency: [if], data = [(t] } } } // Degenerate initial approximations if(x < 3e-308 || x > 1 - 2.22e-16) { x = 0.5; // depends on control dependency: [if], data = [none] } } // Newon-Raphson method using the CDF { final double ialpha = 1 - alpha; final double ibeta = 1 - beta; // Desired accuracy, as from GNU R adoption of AS 109 final double acu = Math.max(1e-300, FastMath.pow(10., -13 - 2.5 / (alpha * alpha) - .5 / (p * p))); double prevstep = 0., y = 0., stepsize = 1; for(int outer = 0; outer < 1000; outer++) { // Current CDF value double ynew = cdf(x, alpha, beta); if(Double.isInfinite(ynew)) { // Degenerated. return Double.NaN; // depends on control dependency: [if], data = [none] } // Error gradient ynew = (ynew - p) * FastMath.exp(logbeta + ialpha * FastMath.log(x) + ibeta * FastMath.log1p(-x)); // depends on control dependency: [for], data = [none] if(ynew * y <= 0.) { prevstep = Math.max(Math.abs(stepsize), 3e-308); // depends on control dependency: [if], data = [none] } // Inner loop: try different step sizes: y * 3^-i double g = 1, xnew = 0.; for(int inner = 0; inner < 1000; inner++) { stepsize = g * ynew; // depends on control dependency: [for], data = [none] if(Math.abs(stepsize) < prevstep) { xnew = x - stepsize; // Candidate x // depends on control dependency: [if], data = [none] if(xnew >= 0. && xnew <= 1.) { // Close enough if(prevstep <= acu || Math.abs(ynew) <= acu) { return x; // depends on control dependency: [if], data = [none] } if(xnew != 0. && xnew != 1.) { break; } } } g /= 3.; // depends on control dependency: [for], data = [none] } // Convergence if(Math.abs(xnew - x) < 1e-15 * x) { return x; // depends on control dependency: [if], data = [none] } // Iterate with new values x = xnew; // depends on control dependency: [for], data = [none] y = ynew; // depends on control dependency: [for], data = [none] } } // Not converged in Newton-Raphson throw new ArithmeticException("Beta quantile computation did not converge."); } }
public class class_name { public static Multimap<String, String> convertToMultiMap(final PObject objectParams) { Multimap<String, String> params = HashMultimap.create(); if (objectParams != null) { Iterator<String> customParamsIter = objectParams.keys(); while (customParamsIter.hasNext()) { String key = customParamsIter.next(); if (objectParams.isArray(key)) { final PArray array = objectParams.optArray(key); for (int i = 0; i < array.size(); i++) { params.put(key, array.getString(i)); } } else { params.put(key, objectParams.optString(key, "")); } } } return params; } }
public class class_name { public static Multimap<String, String> convertToMultiMap(final PObject objectParams) { Multimap<String, String> params = HashMultimap.create(); if (objectParams != null) { Iterator<String> customParamsIter = objectParams.keys(); while (customParamsIter.hasNext()) { String key = customParamsIter.next(); if (objectParams.isArray(key)) { final PArray array = objectParams.optArray(key); for (int i = 0; i < array.size(); i++) { params.put(key, array.getString(i)); // depends on control dependency: [for], data = [i] } } else { params.put(key, objectParams.optString(key, "")); // depends on control dependency: [if], data = [none] } } } return params; } }
public class class_name { private void writeFileByte(byte[] content, File file) throws IOException { FileOutputStream fOut = null; DataOutputStream dOut = null; try { // write the content to the file in server filesystem fOut = new FileOutputStream(file); dOut = new DataOutputStream(fOut); dOut.write(content); dOut.flush(); } catch (IOException e) { throw e; } finally { try { if (fOut != null) { fOut.close(); } } catch (IOException e) { // ignore } try { if (dOut != null) { dOut.close(); } } catch (IOException e) { // ignore } } } }
public class class_name { private void writeFileByte(byte[] content, File file) throws IOException { FileOutputStream fOut = null; DataOutputStream dOut = null; try { // write the content to the file in server filesystem fOut = new FileOutputStream(file); dOut = new DataOutputStream(fOut); dOut.write(content); dOut.flush(); } catch (IOException e) { throw e; } finally { try { if (fOut != null) { fOut.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { // ignore } // depends on control dependency: [catch], data = [none] try { if (dOut != null) { dOut.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { // ignore } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected MessageSecurityMetadataSource createMetadataSource() { LinkedHashMap<MessageMatcher<?>, String> matcherToExpression = new LinkedHashMap<MessageMatcher<?>, String>(); for (Map.Entry<MatcherBuilder, String> entry : this.matcherToExpression .entrySet()) { matcherToExpression.put(entry.getKey().build(), entry.getValue()); } return ExpressionBasedMessageSecurityMetadataSourceFactory .createExpressionMessageMetadataSource(matcherToExpression, expressionHandler); } }
public class class_name { protected MessageSecurityMetadataSource createMetadataSource() { LinkedHashMap<MessageMatcher<?>, String> matcherToExpression = new LinkedHashMap<MessageMatcher<?>, String>(); for (Map.Entry<MatcherBuilder, String> entry : this.matcherToExpression .entrySet()) { matcherToExpression.put(entry.getKey().build(), entry.getValue()); // depends on control dependency: [for], data = [entry] } return ExpressionBasedMessageSecurityMetadataSourceFactory .createExpressionMessageMetadataSource(matcherToExpression, expressionHandler); } }
public class class_name { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { currentAttributes = attributes; currentText = new StringBuilder(); if (SUPPRESS.equals(qName)) { rule = new SuppressionRule(); final String base = currentAttributes.getValue("base"); if (base != null) { rule.setBase(Boolean.parseBoolean(base)); } else { rule.setBase(false); } final String until = currentAttributes.getValue("until"); if (until != null) { try { rule.setUntil(DateUtil.parseXmlDate(until)); } catch (ParseException ex) { throw new SAXException("Unable to parse until date in suppression file: " + until, ex); } } } } }
public class class_name { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { currentAttributes = attributes; currentText = new StringBuilder(); if (SUPPRESS.equals(qName)) { rule = new SuppressionRule(); final String base = currentAttributes.getValue("base"); if (base != null) { rule.setBase(Boolean.parseBoolean(base)); // depends on control dependency: [if], data = [(base] } else { rule.setBase(false); // depends on control dependency: [if], data = [none] } final String until = currentAttributes.getValue("until"); if (until != null) { try { rule.setUntil(DateUtil.parseXmlDate(until)); // depends on control dependency: [try], data = [none] } catch (ParseException ex) { throw new SAXException("Unable to parse until date in suppression file: " + until, ex); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public static HClientFactory createFactory(CassandraHostConfigurator chc) { try { return chc.getClientFactoryClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public static HClientFactory createFactory(CassandraHostConfigurator chc) { try { return chc.getClientFactoryClass().newInstance(); // 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 marshall(StopAssessmentRunRequest stopAssessmentRunRequest, ProtocolMarshaller protocolMarshaller) { if (stopAssessmentRunRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopAssessmentRunRequest.getAssessmentRunArn(), ASSESSMENTRUNARN_BINDING); protocolMarshaller.marshall(stopAssessmentRunRequest.getStopAction(), STOPACTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StopAssessmentRunRequest stopAssessmentRunRequest, ProtocolMarshaller protocolMarshaller) { if (stopAssessmentRunRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopAssessmentRunRequest.getAssessmentRunArn(), ASSESSMENTRUNARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(stopAssessmentRunRequest.getStopAction(), STOPACTION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void checkForAllowedBody() { int code = getIntCode(); // check for explicit codes if (204 == code || 304 == code) { setBodyAllowed(false); } // all 1xx codes should not have a body else if (100 <= code && 200 > code) { setBodyAllowed(false); } // default everything else... else { setBodyAllowed(true); } } }
public class class_name { protected void checkForAllowedBody() { int code = getIntCode(); // check for explicit codes if (204 == code || 304 == code) { setBodyAllowed(false); // depends on control dependency: [if], data = [none] } // all 1xx codes should not have a body else if (100 <= code && 200 > code) { setBodyAllowed(false); // depends on control dependency: [if], data = [none] } // default everything else... else { setBodyAllowed(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String encodeAtomExpr(int atmIdx) { final IAtom atom = mol.getAtom(atmIdx); boolean complex = mode == MODE_EXACT; StringBuilder sb = new StringBuilder(); switch (atom.getAtomicNumber()) { case 0: // * sb.append('*'); break; case 5: // B case 6: // C case 7: // N case 8: // O case 15: // P case 16: // S case 9: // F case 17: // Cl case 35: // Br case 53: // I sb.append(atom.isAromatic() ? atom.getSymbol().toLowerCase(Locale.ROOT) : atom.getSymbol()); break; default: complex = true; sb.append(atom.isAromatic() ? atom.getSymbol().toLowerCase(Locale.ROOT) : atom.getSymbol()); break; } if (mode == MODE_EXACT) { int hcount = atom.getImplicitHydrogenCount(); int valence = hcount; int connections = hcount; int atmDeg = this.deg[atmIdx]; for (int i = 0; i < atmDeg; i++) { IBond bond = mol.getBond(bondAdj[atmIdx][i]); IAtom nbr = bond.getOther(atom); if (nbr.getAtomicNumber() != null && nbr.getAtomicNumber() == 1) hcount++; int bord = bond.getOrder() != null ? bond.getOrder().numeric() : 0; if (bord == 0) throw new IllegalArgumentException("Molecule had unsupported zero-order or unset bonds!"); valence += bord; connections++; } sb.append('H').append(hcount); sb.append('v').append(valence); sb.append('X').append(connections); } Integer chg = atom.getFormalCharge(); if (chg == null) chg = 0; if (chg <= -1 || chg >= +1) { if (chg >= 0) sb.append('+'); else sb.append('-'); int abs = Math.abs(chg); if (abs > 1) sb.append(abs); complex = true; } else if (mode == MODE_EXACT) { sb.append("+0"); } return complex ? '[' + sb.toString() + ']' : sb.toString(); } }
public class class_name { private String encodeAtomExpr(int atmIdx) { final IAtom atom = mol.getAtom(atmIdx); boolean complex = mode == MODE_EXACT; StringBuilder sb = new StringBuilder(); switch (atom.getAtomicNumber()) { case 0: // * sb.append('*'); break; case 5: // B case 6: // C case 7: // N case 8: // O case 15: // P case 16: // S case 9: // F case 17: // Cl case 35: // Br case 53: // I sb.append(atom.isAromatic() ? atom.getSymbol().toLowerCase(Locale.ROOT) : atom.getSymbol()); break; default: complex = true; sb.append(atom.isAromatic() ? atom.getSymbol().toLowerCase(Locale.ROOT) : atom.getSymbol()); break; } if (mode == MODE_EXACT) { int hcount = atom.getImplicitHydrogenCount(); int valence = hcount; int connections = hcount; int atmDeg = this.deg[atmIdx]; for (int i = 0; i < atmDeg; i++) { IBond bond = mol.getBond(bondAdj[atmIdx][i]); IAtom nbr = bond.getOther(atom); if (nbr.getAtomicNumber() != null && nbr.getAtomicNumber() == 1) hcount++; int bord = bond.getOrder() != null ? bond.getOrder().numeric() : 0; if (bord == 0) throw new IllegalArgumentException("Molecule had unsupported zero-order or unset bonds!"); valence += bord; // depends on control dependency: [for], data = [none] connections++; // depends on control dependency: [for], data = [none] } sb.append('H').append(hcount); sb.append('v').append(valence); sb.append('X').append(connections); } Integer chg = atom.getFormalCharge(); if (chg == null) chg = 0; if (chg <= -1 || chg >= +1) { if (chg >= 0) sb.append('+'); else sb.append('-'); int abs = Math.abs(chg); if (abs > 1) sb.append(abs); complex = true; } else if (mode == MODE_EXACT) { sb.append("+0"); } return complex ? '[' + sb.toString() + ']' : sb.toString(); } }
public class class_name { public void marshall(DiscoverPollEndpointRequest discoverPollEndpointRequest, ProtocolMarshaller protocolMarshaller) { if (discoverPollEndpointRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(discoverPollEndpointRequest.getContainerInstance(), CONTAINERINSTANCE_BINDING); protocolMarshaller.marshall(discoverPollEndpointRequest.getCluster(), CLUSTER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DiscoverPollEndpointRequest discoverPollEndpointRequest, ProtocolMarshaller protocolMarshaller) { if (discoverPollEndpointRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(discoverPollEndpointRequest.getContainerInstance(), CONTAINERINSTANCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(discoverPollEndpointRequest.getCluster(), CLUSTER_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void updateVersion() { try { MessageDigest versionDigest = MessageDigest.getInstance("MD5"); for (Row row : SystemKeyspace.serializedSchema()) { if (invalidSchemaRow(row) || ignoredSchemaRow(row)) continue; // we want to digest only live columns ColumnFamilyStore.removeDeletedColumnsOnly(row.cf, Integer.MAX_VALUE, SecondaryIndexManager.nullUpdater); row.cf.purgeTombstones(Integer.MAX_VALUE); row.cf.updateDigest(versionDigest); } version = UUID.nameUUIDFromBytes(versionDigest.digest()); SystemKeyspace.updateSchemaVersion(version); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public void updateVersion() { try { MessageDigest versionDigest = MessageDigest.getInstance("MD5"); for (Row row : SystemKeyspace.serializedSchema()) { if (invalidSchemaRow(row) || ignoredSchemaRow(row)) continue; // we want to digest only live columns ColumnFamilyStore.removeDeletedColumnsOnly(row.cf, Integer.MAX_VALUE, SecondaryIndexManager.nullUpdater); // depends on control dependency: [for], data = [row] row.cf.purgeTombstones(Integer.MAX_VALUE); // depends on control dependency: [for], data = [row] row.cf.updateDigest(versionDigest); // depends on control dependency: [for], data = [row] } version = UUID.nameUUIDFromBytes(versionDigest.digest()); // depends on control dependency: [try], data = [none] SystemKeyspace.updateSchemaVersion(version); // 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 setUserPassword(String password) { try { getSipURI().setUserPassword(password); } catch (ParseException e) { logger.error("error setting parameter ", e); throw new IllegalArgumentException("Bad arg", e ); } } }
public class class_name { public void setUserPassword(String password) { try { getSipURI().setUserPassword(password); // depends on control dependency: [try], data = [none] } catch (ParseException e) { logger.error("error setting parameter ", e); throw new IllegalArgumentException("Bad arg", e ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int size() { if (size == -1) { if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { // let's fast calculate the size long fromNum = ((Number) from).longValue(); long toNum = ((Number) to).longValue(); size = (int) (toNum - fromNum + 1); } else if (from instanceof Character && to instanceof Character) { // let's fast calculate the size char fromNum = (Character) from; char toNum = (Character) to; size = toNum - fromNum + 1; } else if (from instanceof BigDecimal || to instanceof BigDecimal || from instanceof BigInteger || to instanceof BigInteger) { // let's fast calculate the size BigDecimal fromNum = new BigDecimal(from.toString()); BigDecimal toNum = new BigDecimal(to.toString()); BigInteger sizeNum = toNum.subtract(fromNum).add(new BigDecimal(1.0)).toBigInteger(); size = sizeNum.intValue(); } else { // let's lazily calculate the size size = 0; Comparable first = from; Comparable value = from; while (compareTo(to, value) >= 0) { value = (Comparable) increment(value); size++; if (compareTo(first, value) >= 0) break; // handle back to beginning due to modulo incrementing } } } return size; } }
public class class_name { public int size() { if (size == -1) { if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { // let's fast calculate the size long fromNum = ((Number) from).longValue(); long toNum = ((Number) to).longValue(); size = (int) (toNum - fromNum + 1); // depends on control dependency: [if], data = [none] } else if (from instanceof Character && to instanceof Character) { // let's fast calculate the size char fromNum = (Character) from; char toNum = (Character) to; size = toNum - fromNum + 1; // depends on control dependency: [if], data = [none] } else if (from instanceof BigDecimal || to instanceof BigDecimal || from instanceof BigInteger || to instanceof BigInteger) { // let's fast calculate the size BigDecimal fromNum = new BigDecimal(from.toString()); BigDecimal toNum = new BigDecimal(to.toString()); BigInteger sizeNum = toNum.subtract(fromNum).add(new BigDecimal(1.0)).toBigInteger(); size = sizeNum.intValue(); // depends on control dependency: [if], data = [none] } else { // let's lazily calculate the size size = 0; // depends on control dependency: [if], data = [none] Comparable first = from; Comparable value = from; while (compareTo(to, value) >= 0) { value = (Comparable) increment(value); // depends on control dependency: [while], data = [none] size++; // depends on control dependency: [while], data = [none] if (compareTo(first, value) >= 0) break; // handle back to beginning due to modulo incrementing } } } return size; } }
public class class_name { private Optional<MethodUsage> solveMethodAsUsage(ResolvedReferenceType refType, String name, List<ResolvedType> argumentsTypes, TypeSolver typeSolver, Context invokationContext) { Optional<MethodUsage> ref = ContextHelper.solveMethodAsUsage(refType.getTypeDeclaration(), name, argumentsTypes, typeSolver, invokationContext, refType.typeParametersValues()); if (ref.isPresent()) { MethodUsage methodUsage = ref.get(); methodUsage = resolveMethodTypeParametersFromExplicitList(typeSolver, methodUsage); // At this stage I should derive from the context and the value some information on the type parameters // for example, when calling: // myStream.collect(Collectors.toList()) // I should be able to figure out that considering the type of the stream (e.g., Stream<String>) // and considering that Stream has this method: // // <R,A> R collect(Collector<? super T,A,R> collector) // // and collector has this method: // // static <T> Collector<T,?,List<T>> toList() // // In this case collect.R has to be equal to List<toList.T> // And toList.T has to be equal to ? super Stream.T // Therefore R has to be equal to List<? super Stream.T>. // In our example Stream.T equal to String, so the R (and the result of the call to collect) is // List<? super String> Map<ResolvedTypeParameterDeclaration, ResolvedType> derivedValues = new HashMap<>(); for (int i = 0; i < methodUsage.getParamTypes().size(); i++) { ResolvedParameterDeclaration parameter = methodUsage.getDeclaration().getParam(i); ResolvedType parameterType = parameter.getType(); if (parameter.isVariadic()) { parameterType = parameterType.asArrayType().getComponentType(); } inferTypes(argumentsTypes.get(i), parameterType, derivedValues); } for (Map.Entry<ResolvedTypeParameterDeclaration, ResolvedType> entry : derivedValues.entrySet()){ methodUsage = methodUsage.replaceTypeParameter(entry.getKey(), entry.getValue()); } ResolvedType returnType = refType.useThisTypeParametersOnTheGivenType(methodUsage.returnType()); if (returnType != methodUsage.returnType()) { methodUsage = methodUsage.replaceReturnType(returnType); } for (int i = 0; i < methodUsage.getParamTypes().size(); i++) { ResolvedType replaced = refType.useThisTypeParametersOnTheGivenType(methodUsage.getParamTypes().get(i)); methodUsage = methodUsage.replaceParamType(i, replaced); } return Optional.of(methodUsage); } else { return ref; } } }
public class class_name { private Optional<MethodUsage> solveMethodAsUsage(ResolvedReferenceType refType, String name, List<ResolvedType> argumentsTypes, TypeSolver typeSolver, Context invokationContext) { Optional<MethodUsage> ref = ContextHelper.solveMethodAsUsage(refType.getTypeDeclaration(), name, argumentsTypes, typeSolver, invokationContext, refType.typeParametersValues()); if (ref.isPresent()) { MethodUsage methodUsage = ref.get(); methodUsage = resolveMethodTypeParametersFromExplicitList(typeSolver, methodUsage); // depends on control dependency: [if], data = [none] // At this stage I should derive from the context and the value some information on the type parameters // for example, when calling: // myStream.collect(Collectors.toList()) // I should be able to figure out that considering the type of the stream (e.g., Stream<String>) // and considering that Stream has this method: // // <R,A> R collect(Collector<? super T,A,R> collector) // // and collector has this method: // // static <T> Collector<T,?,List<T>> toList() // // In this case collect.R has to be equal to List<toList.T> // And toList.T has to be equal to ? super Stream.T // Therefore R has to be equal to List<? super Stream.T>. // In our example Stream.T equal to String, so the R (and the result of the call to collect) is // List<? super String> Map<ResolvedTypeParameterDeclaration, ResolvedType> derivedValues = new HashMap<>(); for (int i = 0; i < methodUsage.getParamTypes().size(); i++) { ResolvedParameterDeclaration parameter = methodUsage.getDeclaration().getParam(i); ResolvedType parameterType = parameter.getType(); if (parameter.isVariadic()) { parameterType = parameterType.asArrayType().getComponentType(); // depends on control dependency: [if], data = [none] } inferTypes(argumentsTypes.get(i), parameterType, derivedValues); // depends on control dependency: [for], data = [i] } for (Map.Entry<ResolvedTypeParameterDeclaration, ResolvedType> entry : derivedValues.entrySet()){ methodUsage = methodUsage.replaceTypeParameter(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } ResolvedType returnType = refType.useThisTypeParametersOnTheGivenType(methodUsage.returnType()); if (returnType != methodUsage.returnType()) { methodUsage = methodUsage.replaceReturnType(returnType); // depends on control dependency: [if], data = [(returnType] } for (int i = 0; i < methodUsage.getParamTypes().size(); i++) { ResolvedType replaced = refType.useThisTypeParametersOnTheGivenType(methodUsage.getParamTypes().get(i)); methodUsage = methodUsage.replaceParamType(i, replaced); // depends on control dependency: [for], data = [i] } return Optional.of(methodUsage); // depends on control dependency: [if], data = [none] } else { return ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void recursiveSetSrid(Geometry geometry, int srid) { if (geometry != null) { geometry.setSrid(srid); } if (geometry.getGeometries() != null) { for (Geometry childGeometry : geometry.getGeometries()) { recursiveSetSrid(childGeometry, srid); } } } }
public class class_name { private static void recursiveSetSrid(Geometry geometry, int srid) { if (geometry != null) { geometry.setSrid(srid); // depends on control dependency: [if], data = [none] } if (geometry.getGeometries() != null) { for (Geometry childGeometry : geometry.getGeometries()) { recursiveSetSrid(childGeometry, srid); // depends on control dependency: [for], data = [childGeometry] } } } }
public class class_name { public List<ItemMini> getItemsByFieldAndTitle(int fieldId, String text, List<Integer> notItemIds, Integer limit) { WebResource resource = getResourceFactory().getApiResource( "/item/field/" + fieldId + "/find"); if (limit != null) { resource = resource.queryParam("limit", limit.toString()); } if (notItemIds != null && notItemIds.size() > 0) { resource = resource.queryParam( "not_item_id", ToStringUtil.toString(notItemIds, ",")); } resource = resource.queryParam("text", text); return resource.get(new GenericType<List<ItemMini>>() {}); } }
public class class_name { public List<ItemMini> getItemsByFieldAndTitle(int fieldId, String text, List<Integer> notItemIds, Integer limit) { WebResource resource = getResourceFactory().getApiResource( "/item/field/" + fieldId + "/find"); if (limit != null) { resource = resource.queryParam("limit", limit.toString()); // depends on control dependency: [if], data = [none] } if (notItemIds != null && notItemIds.size() > 0) { resource = resource.queryParam( "not_item_id", ToStringUtil.toString(notItemIds, ",")); // depends on control dependency: [if], data = [none] } resource = resource.queryParam("text", text); return resource.get(new GenericType<List<ItemMini>>() {}); } }
public class class_name { private static BinaryMemcacheRequest handleGetRequest(final ChannelHandlerContext ctx, final GetRequest msg) { byte opcode; ByteBuf extras; if (msg.lock()) { opcode = OP_GET_AND_LOCK; extras = ctx.alloc().buffer().writeInt(msg.expiry()); } else if (msg.touch()) { opcode = OP_GET_AND_TOUCH; extras = ctx.alloc().buffer().writeInt(msg.expiry()); } else { opcode = OP_GET; extras = Unpooled.EMPTY_BUFFER; } byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request .setOpcode(opcode) .setKeyLength(keyLength) .setExtras(extras) .setExtrasLength(extrasLength) .setTotalBodyLength(keyLength + extrasLength); return request; } }
public class class_name { private static BinaryMemcacheRequest handleGetRequest(final ChannelHandlerContext ctx, final GetRequest msg) { byte opcode; ByteBuf extras; if (msg.lock()) { opcode = OP_GET_AND_LOCK; // depends on control dependency: [if], data = [none] extras = ctx.alloc().buffer().writeInt(msg.expiry()); // depends on control dependency: [if], data = [none] } else if (msg.touch()) { opcode = OP_GET_AND_TOUCH; // depends on control dependency: [if], data = [none] extras = ctx.alloc().buffer().writeInt(msg.expiry()); // depends on control dependency: [if], data = [none] } else { opcode = OP_GET; // depends on control dependency: [if], data = [none] extras = Unpooled.EMPTY_BUFFER; // depends on control dependency: [if], data = [none] } byte[] key = msg.keyBytes(); short keyLength = (short) key.length; byte extrasLength = (byte) extras.readableBytes(); BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest(key); request .setOpcode(opcode) .setKeyLength(keyLength) .setExtras(extras) .setExtrasLength(extrasLength) .setTotalBodyLength(keyLength + extrasLength); return request; } }
public class class_name { protected void initialize() { if (m_folderList != null) { // ensure folders are sorted starting with parent folders Collections.sort(m_folderList, I_CmsResource.COMPARE_ROOT_PATH); } if (m_fileList != null) { // ensure files are sorted starting with files in parent folders Collections.sort(m_fileList, I_CmsResource.COMPARE_ROOT_PATH); } if (m_deletedFolderList != null) { // ensure deleted folders are sorted starting with child folders Collections.sort(m_deletedFolderList, I_CmsResource.COMPARE_ROOT_PATH); Collections.reverse(m_deletedFolderList); } } }
public class class_name { protected void initialize() { if (m_folderList != null) { // ensure folders are sorted starting with parent folders Collections.sort(m_folderList, I_CmsResource.COMPARE_ROOT_PATH); // depends on control dependency: [if], data = [(m_folderList] } if (m_fileList != null) { // ensure files are sorted starting with files in parent folders Collections.sort(m_fileList, I_CmsResource.COMPARE_ROOT_PATH); // depends on control dependency: [if], data = [(m_fileList] } if (m_deletedFolderList != null) { // ensure deleted folders are sorted starting with child folders Collections.sort(m_deletedFolderList, I_CmsResource.COMPARE_ROOT_PATH); // depends on control dependency: [if], data = [(m_deletedFolderList] Collections.reverse(m_deletedFolderList); // depends on control dependency: [if], data = [(m_deletedFolderList] } } }
public class class_name { private void loadDynamicJavaRegisteredServices() { Map<Package,Map<String,String>> packagedJava = new HashMap<>(); try { for (Asset javaAsset : AssetCache.getAssets(Asset.JAVA)) { // process RegisteredService-annotated classes if (javaAsset.getStringContent().indexOf("@RegisteredService") > 0 || javaAsset.getStringContent().indexOf("@Monitor") > 0 || javaAsset.getStringContent().indexOf("@Path") > 0 || javaAsset.getStringContent().indexOf("@Api") > 0 || javaAsset.getStringContent().indexOf("@ScheduledJob") > 0) { String className = JavaNaming.getValidClassName(javaAsset.getName()); Package javaAssetPackage = PackageCache.getAssetPackage(javaAsset.getId()); if (javaAssetPackage == null) { logger.severe("Omitting unpackaged Registered Service from compilation: " + javaAsset.getLabel()); } else { String qName = JavaNaming.getValidPackageName(javaAssetPackage.getName()) + "." + className; Map<String,String> javaSources = packagedJava.get(javaAssetPackage); if (javaSources == null) { javaSources = new HashMap<>(); packagedJava.put(javaAssetPackage, javaSources); } javaSources.put(qName, javaAsset.getStringContent()); } } } } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } if (!packagedJava.isEmpty()) { for (Package pkg : packagedJava.keySet()) { try { List<Class<?>> classes = CompiledJavaCache.compileClasses(getClass().getClassLoader(), pkg, packagedJava.get(pkg), true); for (Class<?> clazz : classes) { RegisteredService registeredService = clazz.getAnnotation(RegisteredService.class); if (registeredService == null) { // jax-rs services, and swagger Apis Path pathAnnotation = clazz.getAnnotation(Path.class); if (pathAnnotation != null) { String resourcePath = pathAnnotation.value() == null ? clazz.getPackage().getName() + "/" + clazz.getSimpleName() : pathAnnotation.value(); if (JsonService.class.isAssignableFrom(clazz)) { logger.info("JAX-RS JSON Service: " + resourcePath + " --> '" + clazz + "'"); DynamicJavaServiceRegistry.addRegisteredService(JsonService.class.getName(), clazz.getName(), resourcePath); } if (XmlService.class.isAssignableFrom(clazz)) { logger.info("JAX-RS XML Service: " + resourcePath + " --> '" + clazz + "'"); DynamicJavaServiceRegistry.addRegisteredService(XmlService.class.getName(), clazz.getName(), resourcePath); } } // Monitor annotation Monitor monitorAnnotation = clazz.getAnnotation(Monitor.class); if (monitorAnnotation != null) { logger.info("Monitor Service: " + monitorAnnotation.value() + " --> '" + clazz + "'"); String monitorCategory = monitorAnnotation.category().getName(); MonitorRegistry.getInstance().addDynamicService(monitorCategory, clazz.getName()); } // ScheduledJob annotation ScheduledJob scheduledJobAnnotation = clazz.getAnnotation(ScheduledJob.class); if (scheduledJobAnnotation != null) { logger.info("Scheduled Job: " + scheduledJobAnnotation.value() + " --> '" + clazz + "'"); DynamicJavaServiceRegistry.addRegisteredService(com.centurylink.mdw.model.monitor.ScheduledJob.class.getName(), clazz.getName()); } } else { for (int i = 0; i < registeredService.value().length; i++) { String serviceName = registeredService.value()[i].getName(); logger.info("@RegisteredService: " + serviceName + " Class: " + clazz); DynamicJavaServiceRegistry.addRegisteredService(serviceName, clazz.getName()); } } } } catch (Exception ex) { // let other packages continue to process logger.severeException("Failed to process Dynamic Java services in package " + pkg.getLabel() + ": " + ex.getMessage(), ex); } } } } }
public class class_name { private void loadDynamicJavaRegisteredServices() { Map<Package,Map<String,String>> packagedJava = new HashMap<>(); try { for (Asset javaAsset : AssetCache.getAssets(Asset.JAVA)) { // process RegisteredService-annotated classes if (javaAsset.getStringContent().indexOf("@RegisteredService") > 0 || javaAsset.getStringContent().indexOf("@Monitor") > 0 || javaAsset.getStringContent().indexOf("@Path") > 0 || javaAsset.getStringContent().indexOf("@Api") > 0 || javaAsset.getStringContent().indexOf("@ScheduledJob") > 0) { String className = JavaNaming.getValidClassName(javaAsset.getName()); Package javaAssetPackage = PackageCache.getAssetPackage(javaAsset.getId()); if (javaAssetPackage == null) { logger.severe("Omitting unpackaged Registered Service from compilation: " + javaAsset.getLabel()); // depends on control dependency: [if], data = [none] } else { String qName = JavaNaming.getValidPackageName(javaAssetPackage.getName()) + "." + className; Map<String,String> javaSources = packagedJava.get(javaAssetPackage); if (javaSources == null) { javaSources = new HashMap<>(); // depends on control dependency: [if], data = [none] packagedJava.put(javaAssetPackage, javaSources); // depends on control dependency: [if], data = [none] } javaSources.put(qName, javaAsset.getStringContent()); // depends on control dependency: [if], data = [none] } } } } catch (Exception ex) { logger.severeException(ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] if (!packagedJava.isEmpty()) { for (Package pkg : packagedJava.keySet()) { try { List<Class<?>> classes = CompiledJavaCache.compileClasses(getClass().getClassLoader(), pkg, packagedJava.get(pkg), true); for (Class<?> clazz : classes) { RegisteredService registeredService = clazz.getAnnotation(RegisteredService.class); if (registeredService == null) { // jax-rs services, and swagger Apis Path pathAnnotation = clazz.getAnnotation(Path.class); if (pathAnnotation != null) { String resourcePath = pathAnnotation.value() == null ? clazz.getPackage().getName() + "/" + clazz.getSimpleName() : pathAnnotation.value(); if (JsonService.class.isAssignableFrom(clazz)) { logger.info("JAX-RS JSON Service: " + resourcePath + " --> '" + clazz + "'"); // depends on control dependency: [if], data = [none] DynamicJavaServiceRegistry.addRegisteredService(JsonService.class.getName(), clazz.getName(), resourcePath); // depends on control dependency: [if], data = [none] } if (XmlService.class.isAssignableFrom(clazz)) { logger.info("JAX-RS XML Service: " + resourcePath + " --> '" + clazz + "'"); // depends on control dependency: [if], data = [none] DynamicJavaServiceRegistry.addRegisteredService(XmlService.class.getName(), clazz.getName(), resourcePath); // depends on control dependency: [if], data = [none] } } // Monitor annotation Monitor monitorAnnotation = clazz.getAnnotation(Monitor.class); if (monitorAnnotation != null) { logger.info("Monitor Service: " + monitorAnnotation.value() + " --> '" + clazz + "'"); String monitorCategory = monitorAnnotation.category().getName(); MonitorRegistry.getInstance().addDynamicService(monitorCategory, clazz.getName()); } // ScheduledJob annotation ScheduledJob scheduledJobAnnotation = clazz.getAnnotation(ScheduledJob.class); if (scheduledJobAnnotation != null) { logger.info("Scheduled Job: " + scheduledJobAnnotation.value() + " --> '" + clazz + "'"); DynamicJavaServiceRegistry.addRegisteredService(com.centurylink.mdw.model.monitor.ScheduledJob.class.getName(), clazz.getName()); } } else { for (int i = 0; i < registeredService.value().length; i++) { String serviceName = registeredService.value()[i].getName(); logger.info("@RegisteredService: " + serviceName + " Class: " + clazz); DynamicJavaServiceRegistry.addRegisteredService(serviceName, clazz.getName()); } } } } catch (Exception ex) { // let other packages continue to process logger.severeException("Failed to process Dynamic Java services in package " + pkg.getLabel() + ": " + ex.getMessage(), ex); } } } } }
public class class_name { @Override public EClass getIfcSoundPressureLevelMeasure() { if (ifcSoundPressureLevelMeasureEClass == null) { ifcSoundPressureLevelMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(867); } return ifcSoundPressureLevelMeasureEClass; } }
public class class_name { @Override public EClass getIfcSoundPressureLevelMeasure() { if (ifcSoundPressureLevelMeasureEClass == null) { ifcSoundPressureLevelMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(867); // depends on control dependency: [if], data = [none] } return ifcSoundPressureLevelMeasureEClass; } }
public class class_name { public final int decode(final InputStream stream, final ByteBuffer buffer) throws IOException { // TODO: Allow decoding < row.length at a time and get rid of this assertion... if (buffer.capacity() < row.length) { throw new AssertionError("This decoder needs a buffer.capacity() of at least one row"); } while (buffer.remaining() >= row.length && srcY >= 0) { // NOTE: Decode only full rows, don't decode if y delta if (dstX == 0 && srcY == dstY) { decodeRow(stream); } int length = Math.min(row.length - (dstX * bitsPerSample) / 8, buffer.remaining()); buffer.put(row, 0, length); dstX += (length * 8) / bitsPerSample; if (dstX == (row.length * 8) / bitsPerSample) { dstX = 0; dstY++; // NOTE: If src Y is > dst Y, we have a delta, and have to fill the // gap with zero-bytes if (srcX > dstX) { Arrays.fill(row, 0, (srcX * bitsPerSample) / 8, (byte) 0); } if (srcY > dstY) { Arrays.fill(row, (byte) 0); } } } return buffer.position(); } }
public class class_name { public final int decode(final InputStream stream, final ByteBuffer buffer) throws IOException { // TODO: Allow decoding < row.length at a time and get rid of this assertion... if (buffer.capacity() < row.length) { throw new AssertionError("This decoder needs a buffer.capacity() of at least one row"); } while (buffer.remaining() >= row.length && srcY >= 0) { // NOTE: Decode only full rows, don't decode if y delta if (dstX == 0 && srcY == dstY) { decodeRow(stream); } int length = Math.min(row.length - (dstX * bitsPerSample) / 8, buffer.remaining()); buffer.put(row, 0, length); dstX += (length * 8) / bitsPerSample; if (dstX == (row.length * 8) / bitsPerSample) { dstX = 0; dstY++; // NOTE: If src Y is > dst Y, we have a delta, and have to fill the // gap with zero-bytes if (srcX > dstX) { Arrays.fill(row, 0, (srcX * bitsPerSample) / 8, (byte) 0); // depends on control dependency: [if], data = [(srcX] } if (srcY > dstY) { Arrays.fill(row, (byte) 0); // depends on control dependency: [if], data = [none] } } } return buffer.position(); } }
public class class_name { public Set<ModuleIdentifier> getAllRevisionIds(String scriptModuleId) { Objects.requireNonNull(scriptModuleId, "scriptModuleId"); Set<ModuleIdentifier> revisionIds = new LinkedHashSet<ModuleIdentifier>(); for (ModuleIdentifier revisionId : moduleSpecs.keySet()) { if (revisionId.getName().equals(scriptModuleId)) { revisionIds.add(revisionId); } } return Collections.unmodifiableSet(revisionIds); } }
public class class_name { public Set<ModuleIdentifier> getAllRevisionIds(String scriptModuleId) { Objects.requireNonNull(scriptModuleId, "scriptModuleId"); Set<ModuleIdentifier> revisionIds = new LinkedHashSet<ModuleIdentifier>(); for (ModuleIdentifier revisionId : moduleSpecs.keySet()) { if (revisionId.getName().equals(scriptModuleId)) { revisionIds.add(revisionId); // depends on control dependency: [if], data = [none] } } return Collections.unmodifiableSet(revisionIds); } }
public class class_name { public boolean add( T[] entries ) { assert entries != null; if (entries.length == 0 || !addEntries.get()) return false; try { producerLock.lock(); long position = cursor.claim(entries.length); // blocks for (int i = 0; i != entries.length; ++i) { int index = (int)(position & mask); buffer[index] = entries[i]; } return cursor.publish(position); } finally { producerLock.unlock(); } } }
public class class_name { public boolean add( T[] entries ) { assert entries != null; if (entries.length == 0 || !addEntries.get()) return false; try { producerLock.lock(); // depends on control dependency: [try], data = [none] long position = cursor.claim(entries.length); // blocks for (int i = 0; i != entries.length; ++i) { int index = (int)(position & mask); buffer[index] = entries[i]; // depends on control dependency: [for], data = [i] } return cursor.publish(position); // depends on control dependency: [try], data = [none] } finally { producerLock.unlock(); } } }
public class class_name { private void extractImageFeatures(final ProgressMonitor progressMonitor, final int progress, T image, List<TupleDesc> descs, List<Point2D_F64> locs) { SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setNote("Detecting"); } }); detector.detect(image); SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setProgress(progress + 1); progressMonitor.setNote("Describing"); } }); describe.setImage(image); orientation.setImage(image); // See if the detector can detect the feature's scale if (detector.hasScale()) { for (int i = 0; i < detector.getNumberOfFeatures(); i++) { double yaw = 0; Point2D_F64 pt = detector.getLocation(i); double radius = detector.getRadius(i); if (describe.requiresOrientation()) { orientation.setObjectRadius(radius); yaw = orientation.compute(pt.x, pt.y); } TupleDesc d = describe.createDescription(); if ( describe.process(pt.x, pt.y, yaw, radius, d) ) { descs.add(d); locs.add(pt.copy()); } } } else { // just set the radius to one in this case orientation.setObjectRadius(1); for (int i = 0; i < detector.getNumberOfFeatures(); i++) { double yaw = 0; Point2D_F64 pt = detector.getLocation(i); if (describe.requiresOrientation()) { yaw = orientation.compute(pt.x, pt.y); } TupleDesc d = describe.createDescription(); if (describe.process(pt.x, pt.y, yaw, 1, d)) { descs.add(d); locs.add(pt.copy()); } } } SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setProgress(progress + 2); } }); } }
public class class_name { private void extractImageFeatures(final ProgressMonitor progressMonitor, final int progress, T image, List<TupleDesc> descs, List<Point2D_F64> locs) { SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setNote("Detecting"); } }); detector.detect(image); SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setProgress(progress + 1); progressMonitor.setNote("Describing"); } }); describe.setImage(image); orientation.setImage(image); // See if the detector can detect the feature's scale if (detector.hasScale()) { for (int i = 0; i < detector.getNumberOfFeatures(); i++) { double yaw = 0; Point2D_F64 pt = detector.getLocation(i); double radius = detector.getRadius(i); if (describe.requiresOrientation()) { orientation.setObjectRadius(radius); // depends on control dependency: [if], data = [none] yaw = orientation.compute(pt.x, pt.y); // depends on control dependency: [if], data = [none] } TupleDesc d = describe.createDescription(); if ( describe.process(pt.x, pt.y, yaw, radius, d) ) { descs.add(d); // depends on control dependency: [if], data = [none] locs.add(pt.copy()); // depends on control dependency: [if], data = [none] } } } else { // just set the radius to one in this case orientation.setObjectRadius(1); // depends on control dependency: [if], data = [none] for (int i = 0; i < detector.getNumberOfFeatures(); i++) { double yaw = 0; Point2D_F64 pt = detector.getLocation(i); if (describe.requiresOrientation()) { yaw = orientation.compute(pt.x, pt.y); // depends on control dependency: [if], data = [none] } TupleDesc d = describe.createDescription(); if (describe.process(pt.x, pt.y, yaw, 1, d)) { descs.add(d); // depends on control dependency: [if], data = [none] locs.add(pt.copy()); // depends on control dependency: [if], data = [none] } } } SwingUtilities.invokeLater(new Runnable() { public void run() { progressMonitor.setProgress(progress + 2); } }); } }
public class class_name { public void doWithRows(Pairs pairs) { if (isEmpty()) { return; } Row row1 = new Row(this); Row row2 = new Row(this); int max = rowCount(); for (int i = 1; i < max; i++) { row1.at(i - 1); row2.at(i); pairs.doWithPair(row1, row2); } } }
public class class_name { public void doWithRows(Pairs pairs) { if (isEmpty()) { return; // depends on control dependency: [if], data = [none] } Row row1 = new Row(this); Row row2 = new Row(this); int max = rowCount(); for (int i = 1; i < max; i++) { row1.at(i - 1); // depends on control dependency: [for], data = [i] row2.at(i); // depends on control dependency: [for], data = [i] pairs.doWithPair(row1, row2); // depends on control dependency: [for], data = [none] } } }
public class class_name { void removeTrigger(String name) { TriggerDef td = null; for (int i = 0; i < triggerList.length; i++) { td = triggerList[i]; if (td.name.name.equals(name)) { td.terminate(); triggerList = (TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList, null, i, -1); break; } } if (td == null) { return; } int index = td.vectorIndex; // look in each trigger list of each type of trigger for (int j = 0; j < triggerLists[index].length; j++) { td = triggerLists[index][j]; if (td.name.name.equals(name)) { td.terminate(); triggerLists[index] = (TriggerDef[]) ArrayUtil.toAdjustedArray( triggerLists[index], null, j, -1); break; } } } }
public class class_name { void removeTrigger(String name) { TriggerDef td = null; for (int i = 0; i < triggerList.length; i++) { td = triggerList[i]; // depends on control dependency: [for], data = [i] if (td.name.name.equals(name)) { td.terminate(); // depends on control dependency: [if], data = [none] triggerList = (TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList, null, i, -1); // depends on control dependency: [if], data = [none] break; } } if (td == null) { return; // depends on control dependency: [if], data = [none] } int index = td.vectorIndex; // look in each trigger list of each type of trigger for (int j = 0; j < triggerLists[index].length; j++) { td = triggerLists[index][j]; // depends on control dependency: [for], data = [j] if (td.name.name.equals(name)) { td.terminate(); // depends on control dependency: [if], data = [none] triggerLists[index] = (TriggerDef[]) ArrayUtil.toAdjustedArray( triggerLists[index], null, j, -1); // depends on control dependency: [if], data = [none] break; } } } }
public class class_name { @Override public String getSignature(String baseString, String apiSecret, String tokenSecret) { try { final Signature signature = Signature.getInstance(RSA_SHA1); signature.initSign(privateKey); signature.update(baseString.getBytes(UTF8)); return BASE_64_ENCODER.encodeToString(signature.sign()); } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException | UnsupportedEncodingException | RuntimeException e) { throw new OAuthSignatureException(baseString, e); } } }
public class class_name { @Override public String getSignature(String baseString, String apiSecret, String tokenSecret) { try { final Signature signature = Signature.getInstance(RSA_SHA1); signature.initSign(privateKey); // depends on control dependency: [try], data = [none] signature.update(baseString.getBytes(UTF8)); // depends on control dependency: [try], data = [none] return BASE_64_ENCODER.encodeToString(signature.sign()); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException | UnsupportedEncodingException | RuntimeException e) { throw new OAuthSignatureException(baseString, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>> getDiagnosticsItemWithServiceResponseAsync(String resourceGroupName, String name, String diagnosticsName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (diagnosticsName == null) { throw new IllegalArgumentException("Parameter diagnosticsName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getDiagnosticsItem(resourceGroupName, name, diagnosticsName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>>>() { @Override public Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>> call(Response<ResponseBody> response) { try { ServiceResponse<HostingEnvironmentDiagnosticsInner> clientResponse = getDiagnosticsItemDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>> getDiagnosticsItemWithServiceResponseAsync(String resourceGroupName, String name, String diagnosticsName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (diagnosticsName == null) { throw new IllegalArgumentException("Parameter diagnosticsName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getDiagnosticsItem(resourceGroupName, name, diagnosticsName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>>>() { @Override public Observable<ServiceResponse<HostingEnvironmentDiagnosticsInner>> call(Response<ResponseBody> response) { try { ServiceResponse<HostingEnvironmentDiagnosticsInner> clientResponse = getDiagnosticsItemDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void setLaunchConfigurations(java.util.Collection<LaunchConfiguration> launchConfigurations) { if (launchConfigurations == null) { this.launchConfigurations = null; return; } this.launchConfigurations = new com.amazonaws.internal.SdkInternalList<LaunchConfiguration>(launchConfigurations); } }
public class class_name { public void setLaunchConfigurations(java.util.Collection<LaunchConfiguration> launchConfigurations) { if (launchConfigurations == null) { this.launchConfigurations = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.launchConfigurations = new com.amazonaws.internal.SdkInternalList<LaunchConfiguration>(launchConfigurations); } }
public class class_name { @SuppressWarnings("unchecked") public <P> Populator<P> getPopulator(final Class<P> clazz, final Path path) { if (clazz == null || clazz.equals(Object.class)) { return (Populator<P>)NullPopulator.INSTANCE; } else { final ClassTranslator<P> classTranslator = (ClassTranslator<P>)this.<P, FullEntity<?>>getTranslator(new TypeKey<>(clazz), this, path); return classTranslator.getPopulator(); } } }
public class class_name { @SuppressWarnings("unchecked") public <P> Populator<P> getPopulator(final Class<P> clazz, final Path path) { if (clazz == null || clazz.equals(Object.class)) { return (Populator<P>)NullPopulator.INSTANCE; // depends on control dependency: [if], data = [none] } else { final ClassTranslator<P> classTranslator = (ClassTranslator<P>)this.<P, FullEntity<?>>getTranslator(new TypeKey<>(clazz), this, path); return classTranslator.getPopulator(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String getInputFileBasedOutputFileName(JobConf job, String name) { String infilepath = job.get("map.input.file"); if (infilepath == null) { // if the map input file does not exists, then return the given name return name; } int numOfTrailingLegsToUse = job.getInt("mapred.outputformat.numOfTrailingLegs", 0); if (numOfTrailingLegsToUse <= 0) { return name; } Path infile = new Path(infilepath); Path parent = infile.getParent(); String midName = infile.getName(); Path outPath = new Path(midName); for (int i = 1; i < numOfTrailingLegsToUse; i++) { if (parent == null) break; midName = parent.getName(); if (midName.length() == 0) break; parent = parent.getParent(); outPath = new Path(midName, outPath); } return outPath.toString(); } }
public class class_name { protected String getInputFileBasedOutputFileName(JobConf job, String name) { String infilepath = job.get("map.input.file"); if (infilepath == null) { // if the map input file does not exists, then return the given name return name; // depends on control dependency: [if], data = [none] } int numOfTrailingLegsToUse = job.getInt("mapred.outputformat.numOfTrailingLegs", 0); if (numOfTrailingLegsToUse <= 0) { return name; // depends on control dependency: [if], data = [none] } Path infile = new Path(infilepath); Path parent = infile.getParent(); String midName = infile.getName(); Path outPath = new Path(midName); for (int i = 1; i < numOfTrailingLegsToUse; i++) { if (parent == null) break; midName = parent.getName(); // depends on control dependency: [for], data = [none] if (midName.length() == 0) break; parent = parent.getParent(); // depends on control dependency: [for], data = [none] outPath = new Path(midName, outPath); // depends on control dependency: [for], data = [none] } return outPath.toString(); } }
public class class_name { @Override public XmlObject getFormObject(ProposalDevelopmentDocumentContract proposalDevelopmentDocument) { this.pdDoc = proposalDevelopmentDocument; S2sUserAttachedFormFileContract userAttachedFormFile = findUserAttachedFormFile(); if(userAttachedFormFile==null){ throw new RuntimeException("Cannot find XML Data"); } String formXml = userAttachedFormFile.getXmlFile(); XmlObject xmlObject; try { xmlObject = XmlObject.Factory.parse(formXml); }catch (XmlException e) { throw new RuntimeException("XmlObject not ready"); } S2sUserAttachedFormContract userAttachedForm = findUserAttachedForm(); List<? extends S2sUserAttachedFormAttContract> attachments = userAttachedForm.getS2sUserAttachedFormAtts(); for (S2sUserAttachedFormAttContract s2sUserAttachedFormAtt : attachments) { addAttachment(s2sUserAttachedFormAtt); } return xmlObject; } }
public class class_name { @Override public XmlObject getFormObject(ProposalDevelopmentDocumentContract proposalDevelopmentDocument) { this.pdDoc = proposalDevelopmentDocument; S2sUserAttachedFormFileContract userAttachedFormFile = findUserAttachedFormFile(); if(userAttachedFormFile==null){ throw new RuntimeException("Cannot find XML Data"); } String formXml = userAttachedFormFile.getXmlFile(); XmlObject xmlObject; try { xmlObject = XmlObject.Factory.parse(formXml); // depends on control dependency: [try], data = [none] }catch (XmlException e) { throw new RuntimeException("XmlObject not ready"); } // depends on control dependency: [catch], data = [none] S2sUserAttachedFormContract userAttachedForm = findUserAttachedForm(); List<? extends S2sUserAttachedFormAttContract> attachments = userAttachedForm.getS2sUserAttachedFormAtts(); for (S2sUserAttachedFormAttContract s2sUserAttachedFormAtt : attachments) { addAttachment(s2sUserAttachedFormAtt); // depends on control dependency: [for], data = [s2sUserAttachedFormAtt] } return xmlObject; } }
public class class_name { @Deprecated protected Runnable getTask(boolean oldThread) throws InterruptedException { // PK77809 long waitTime; Runnable r = null; boolean firstTime = true; while (true) { synchronized (this) { // System.out.println("1 " + activeThreads + " : " + poolSize_); if (firstTime) { --activeThreads; // PK77809 Let the buffer know we have a waiting thread if (oldThread) { requestBuffer.incrementWaitingThreads(); } } if (poolSize_ > maximumPoolSize_) { // Cause to die if too many threads if (!growasneeded || !firstTime) { // System.out.println("2 die"); --poolSize_; // PK77809 Let the buffer know we have a waiting thread requestBuffer.decrementWaitingThreads(); return null; } } // infinite timeout if we are below the minimum size waitTime = (shutdown_) ? 0 : (poolSize_ <= minimumPoolSize_) ? -1 : keepAliveTime_; } // PK27301 start try { r = (waitTime >= 0) ? (Runnable) (requestBuffer.poll(waitTime)) : (Runnable) (requestBuffer.take()); } catch (InterruptedException e) { ++activeThreads; // PK77809 Let the buffer know we have a waiting thread synchronized (this) { requestBuffer.decrementWaitingThreads(); }; throw e; } // PK27301 end synchronized (this) { // System.out.println("3 r=" + r); if (r == null) { r = (Runnable) requestBuffer.poll(0); } if (r != null) { ++activeThreads; break; } else if (poolSize_ > minimumPoolSize_) { // discount the current thread // System.out.println("4 die"); poolSize_--; // PK77809 Signal the buffer we have removed a thread requestBuffer.decrementWaitingThreads(); break; } // System.out.println("going again"); } firstTime = false; } return r; } }
public class class_name { @Deprecated protected Runnable getTask(boolean oldThread) throws InterruptedException { // PK77809 long waitTime; Runnable r = null; boolean firstTime = true; while (true) { synchronized (this) { // System.out.println("1 " + activeThreads + " : " + poolSize_); if (firstTime) { --activeThreads; // depends on control dependency: [if], data = [none] // PK77809 Let the buffer know we have a waiting thread if (oldThread) { requestBuffer.incrementWaitingThreads(); // depends on control dependency: [if], data = [none] } } if (poolSize_ > maximumPoolSize_) { // Cause to die if too many threads if (!growasneeded || !firstTime) { // System.out.println("2 die"); --poolSize_; // depends on control dependency: [if], data = [none] // PK77809 Let the buffer know we have a waiting thread requestBuffer.decrementWaitingThreads(); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } // infinite timeout if we are below the minimum size waitTime = (shutdown_) ? 0 : (poolSize_ <= minimumPoolSize_) ? -1 : keepAliveTime_; } // PK27301 start try { r = (waitTime >= 0) ? (Runnable) (requestBuffer.poll(waitTime)) : (Runnable) (requestBuffer.take()); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { ++activeThreads; // PK77809 Let the buffer know we have a waiting thread synchronized (this) { requestBuffer.decrementWaitingThreads(); }; throw e; } // depends on control dependency: [catch], data = [none] // PK27301 end synchronized (this) { // System.out.println("3 r=" + r); if (r == null) { r = (Runnable) requestBuffer.poll(0); // depends on control dependency: [if], data = [none] } if (r != null) { ++activeThreads; // depends on control dependency: [if], data = [none] break; } else if (poolSize_ > minimumPoolSize_) { // discount the current thread // System.out.println("4 die"); poolSize_--; // depends on control dependency: [if], data = [none] // PK77809 Signal the buffer we have removed a thread requestBuffer.decrementWaitingThreads(); // depends on control dependency: [if], data = [none] break; } // System.out.println("going again"); } firstTime = false; } return r; } }
public class class_name { protected void unregisterDriver(){ String jdbcURL = this.config.getJdbcUrl(); if ((jdbcURL != null) && this.config.isDeregisterDriverOnClose()){ logger.info("Unregistering JDBC driver for : "+jdbcURL); try { DriverManager.deregisterDriver(DriverManager.getDriver(jdbcURL)); } catch (SQLException e) { logger.info("Unregistering driver failed.", e); } } } }
public class class_name { protected void unregisterDriver(){ String jdbcURL = this.config.getJdbcUrl(); if ((jdbcURL != null) && this.config.isDeregisterDriverOnClose()){ logger.info("Unregistering JDBC driver for : "+jdbcURL); // depends on control dependency: [if], data = [none] try { DriverManager.deregisterDriver(DriverManager.getDriver(jdbcURL)); // depends on control dependency: [try], data = [none] } catch (SQLException e) { logger.info("Unregistering driver failed.", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void add(VMTransitionBuilder b) { Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState()); for (VMState src : b.getSourceStates()) { m.put(src, b); } } }
public class class_name { public void add(VMTransitionBuilder b) { Map<VMState, VMTransitionBuilder> m = vmAMB2.get(b.getDestinationState()); for (VMState src : b.getSourceStates()) { m.put(src, b); // depends on control dependency: [for], data = [src] } } }
public class class_name { @Override public EClass getIfcObjectReferenceSelect() { if (ifcObjectReferenceSelectEClass == null) { ifcObjectReferenceSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1146); } return ifcObjectReferenceSelectEClass; } }
public class class_name { @Override public EClass getIfcObjectReferenceSelect() { if (ifcObjectReferenceSelectEClass == null) { ifcObjectReferenceSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1146); // depends on control dependency: [if], data = [none] } return ifcObjectReferenceSelectEClass; } }
public class class_name { public void fireChangeEvent() { ChangeEvent event = createChangeEvent(getSource()); for (ChangeListener listener : this) { listener.stateChanged(event); } } }
public class class_name { public void fireChangeEvent() { ChangeEvent event = createChangeEvent(getSource()); for (ChangeListener listener : this) { listener.stateChanged(event); // depends on control dependency: [for], data = [listener] } } }
public class class_name { private String getClassName(final TypeMirror t) { String res = null; if (t instanceof DeclaredType) { final DeclaredType dt = (DeclaredType) t; res = ((TypeElement) dt.asElement()).getQualifiedName().toString(); } return res; } }
public class class_name { private String getClassName(final TypeMirror t) { String res = null; if (t instanceof DeclaredType) { final DeclaredType dt = (DeclaredType) t; res = ((TypeElement) dt.asElement()).getQualifiedName().toString(); // depends on control dependency: [if], data = [none] } return res; } }
public class class_name { public String json(String text) { if (text == null || text.isEmpty()) { return text; } return StringEscapeUtils.escapeJson(text); } }
public class class_name { public String json(String text) { if (text == null || text.isEmpty()) { return text; // depends on control dependency: [if], data = [none] } return StringEscapeUtils.escapeJson(text); } }
public class class_name { public Optional<BigDecimal> getMax() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMaximum() != null ? integerProperty.getMaximum() : null); } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMaximum()); } return Optional.empty(); } }
public class class_name { public Optional<BigDecimal> getMax() { if (property instanceof BaseIntegerProperty) { BaseIntegerProperty integerProperty = (BaseIntegerProperty) property; return Optional.ofNullable(integerProperty.getMaximum() != null ? integerProperty.getMaximum() : null); // depends on control dependency: [if], data = [none] } else if (property instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) property; return Optional.ofNullable(numericProperty.getMaximum()); // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { @Override public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) { // Each form consists of a prefix, suffix, // * radix, minimum digit count, and maximum digit count. These // * values are stored as a five character header. ... UnicodeSet myFilter = getFilterAsUnicodeSet(inputFilter); UnicodeSet items = new UnicodeSet(); StringBuilder buffer = new StringBuilder(); for (int i = 0; spec[i] != END;) { // first 5 items are header int end = i + spec[i] + spec[i+1] + 5; int radix = spec[i+2]; for (int j = 0; j < radix; ++j) { Utility.appendNumber(buffer, j, radix, 0); } // then add the characters for (int j = i + 5; j < end; ++j) { items.add(spec[j]); } // and go to next block i = end; } items.addAll(buffer.toString()); items.retainAll(myFilter); if (items.size() > 0) { sourceSet.addAll(items); targetSet.addAll(0,0x10FFFF); // assume we can produce any character } } }
public class class_name { @Override public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) { // Each form consists of a prefix, suffix, // * radix, minimum digit count, and maximum digit count. These // * values are stored as a five character header. ... UnicodeSet myFilter = getFilterAsUnicodeSet(inputFilter); UnicodeSet items = new UnicodeSet(); StringBuilder buffer = new StringBuilder(); for (int i = 0; spec[i] != END;) { // first 5 items are header int end = i + spec[i] + spec[i+1] + 5; int radix = spec[i+2]; for (int j = 0; j < radix; ++j) { Utility.appendNumber(buffer, j, radix, 0); // depends on control dependency: [for], data = [j] } // then add the characters for (int j = i + 5; j < end; ++j) { items.add(spec[j]); // depends on control dependency: [for], data = [j] } // and go to next block i = end; // depends on control dependency: [for], data = [i] } items.addAll(buffer.toString()); items.retainAll(myFilter); if (items.size() > 0) { sourceSet.addAll(items); // depends on control dependency: [if], data = [none] targetSet.addAll(0,0x10FFFF); // assume we can produce any character // depends on control dependency: [if], data = [none] } } }
public class class_name { public MessageFieldDesc getMessageFieldDesc(String strKey) { if (strKey.lastIndexOf('/') != -1) { String strParentKey = strKey.substring(0, strKey.lastIndexOf('/')); String strFieldKey = strKey.substring(strKey.lastIndexOf('/') + 1); MessageDataDesc messageRecordDesc = this.getMessageFieldDesc(strParentKey); if (messageRecordDesc == null) return null; return messageRecordDesc.getMessageFieldDesc(strFieldKey); } if (this.getMessageDataDesc(strKey) instanceof MessageFieldDesc) return (MessageFieldDesc)this.getMessageDataDesc(strKey); return null; } }
public class class_name { public MessageFieldDesc getMessageFieldDesc(String strKey) { if (strKey.lastIndexOf('/') != -1) { String strParentKey = strKey.substring(0, strKey.lastIndexOf('/')); String strFieldKey = strKey.substring(strKey.lastIndexOf('/') + 1); MessageDataDesc messageRecordDesc = this.getMessageFieldDesc(strParentKey); if (messageRecordDesc == null) return null; return messageRecordDesc.getMessageFieldDesc(strFieldKey); // depends on control dependency: [if], data = [none] } if (this.getMessageDataDesc(strKey) instanceof MessageFieldDesc) return (MessageFieldDesc)this.getMessageDataDesc(strKey); return null; } }
public class class_name { protected void purge() { Reference ref = queue.poll(); while (ref != null) { purge(ref); ref = queue.poll(); } } }
public class class_name { protected void purge() { Reference ref = queue.poll(); while (ref != null) { purge(ref); // depends on control dependency: [while], data = [(ref] ref = queue.poll(); // depends on control dependency: [while], data = [none] } } }