code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private POJOPropertyBuilder jackson27AndHigherInstance( MapperConfig<?> config, BeanPropertyDefinition beanProperty, AnnotationIntrospector annotationIntrospector, boolean forSerialization) { try { Constructor<POJOPropertyBuilder> constructor = constructorWithParams( MapperConfig.class, AnnotationIntrospector.class, Boolean.TYPE, PropertyName.class); return constructor.newInstance( config, annotationIntrospector, forSerialization, new PropertyName(beanProperty.getName())); } catch (Exception e) { throw new InstantiationError("Unable to create an instance of POJOPropertyBuilder"); } } }
public class class_name { private POJOPropertyBuilder jackson27AndHigherInstance( MapperConfig<?> config, BeanPropertyDefinition beanProperty, AnnotationIntrospector annotationIntrospector, boolean forSerialization) { try { Constructor<POJOPropertyBuilder> constructor = constructorWithParams( MapperConfig.class, AnnotationIntrospector.class, Boolean.TYPE, PropertyName.class); return constructor.newInstance( config, annotationIntrospector, forSerialization, new PropertyName(beanProperty.getName())); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new InstantiationError("Unable to create an instance of POJOPropertyBuilder"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<ModelNode> getAllowedValues() { if (allowedValues == null) { return Collections.emptyList(); } return Arrays.asList(this.allowedValues); } }
public class class_name { public List<ModelNode> getAllowedValues() { if (allowedValues == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return Arrays.asList(this.allowedValues); } }
public class class_name { public boolean saveList(boolean fast) { try { InsertManyOptions ops = new InsertManyOptions(); if (fast) { ops.ordered(false); } MongoKit.INSTANCE.insert(collectionName, documents, ops); documents.clear(); return true; } catch (RuntimeException e) { MongoKit.INSTANCE.error("MongoQuery.class", e.getMessage()); return false; } } }
public class class_name { public boolean saveList(boolean fast) { try { InsertManyOptions ops = new InsertManyOptions(); if (fast) { ops.ordered(false); // depends on control dependency: [if], data = [none] } MongoKit.INSTANCE.insert(collectionName, documents, ops); // depends on control dependency: [try], data = [none] documents.clear(); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { MongoKit.INSTANCE.error("MongoQuery.class", e.getMessage()); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setParameters(java.util.Collection<PolicyParameter> parameters) { if (parameters == null) { this.parameters = null; return; } this.parameters = new java.util.ArrayList<PolicyParameter>(parameters); } }
public class class_name { public void setParameters(java.util.Collection<PolicyParameter> parameters) { if (parameters == null) { this.parameters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.parameters = new java.util.ArrayList<PolicyParameter>(parameters); } }
public class class_name { public static ImageListener getImageListener(final ImageView view, final int defaultImageResId, final int errorImageResId) { return new ImageListener() { @Override public void onError(JusError error) { if (errorImageResId != 0) { view.setImageResource(errorImageResId); } } @Override public void onResponse(ImageContainer response, boolean isImmediate) { if (response.getBitmap() != null) { view.setImageBitmap(response.getBitmap()); } else if (defaultImageResId != 0) { view.setImageResource(defaultImageResId); } } }; } }
public class class_name { public static ImageListener getImageListener(final ImageView view, final int defaultImageResId, final int errorImageResId) { return new ImageListener() { @Override public void onError(JusError error) { if (errorImageResId != 0) { view.setImageResource(errorImageResId); // depends on control dependency: [if], data = [(errorImageResId] } } @Override public void onResponse(ImageContainer response, boolean isImmediate) { if (response.getBitmap() != null) { view.setImageBitmap(response.getBitmap()); // depends on control dependency: [if], data = [(response.getBitmap()] } else if (defaultImageResId != 0) { view.setImageResource(defaultImageResId); // depends on control dependency: [if], data = [(defaultImageResId] } } }; } }
public class class_name { protected void parseVendors(Document doc) { // Parse vendors, we will need those. // Format: <vendor vendor-id="TGPP" code="10415" name="3GPP" /> NodeList vendorNodes = doc.getElementsByTagName("vendor"); for (int v = 0; v < vendorNodes.getLength(); v++) { Node vendorNode = vendorNodes.item(v); if (vendorNode.getNodeType() == Node.ELEMENT_NODE) { Element vendorElement = (Element) vendorNode; // Get the Code (number) and ID (string) String vendorCode = vendorElement.getAttribute("code"); String vendorId = vendorElement.getAttribute("vendor-id"); vendorMap.put(vendorId, vendorCode); } } } }
public class class_name { protected void parseVendors(Document doc) { // Parse vendors, we will need those. // Format: <vendor vendor-id="TGPP" code="10415" name="3GPP" /> NodeList vendorNodes = doc.getElementsByTagName("vendor"); for (int v = 0; v < vendorNodes.getLength(); v++) { Node vendorNode = vendorNodes.item(v); if (vendorNode.getNodeType() == Node.ELEMENT_NODE) { Element vendorElement = (Element) vendorNode; // Get the Code (number) and ID (string) String vendorCode = vendorElement.getAttribute("code"); String vendorId = vendorElement.getAttribute("vendor-id"); vendorMap.put(vendorId, vendorCode); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Set<DiscoveryEntryWithMetaInfo> filter(Version callerVersion, Set<DiscoveryEntryWithMetaInfo> discoveryEntries, Map<String, Set<Version>> discoveredVersions) { if (callerVersion == null || discoveryEntries == null) { throw new IllegalArgumentException(String.format("Neither callerVersion (%s) nor discoveryEntries (%s) can be null.", callerVersion, discoveryEntries)); } Iterator<DiscoveryEntryWithMetaInfo> iterator = discoveryEntries.iterator(); while (iterator.hasNext()) { DiscoveryEntry discoveryEntry = iterator.next(); if (discoveredVersions != null) { Set<Version> versionsByDomain = discoveredVersions.get(discoveryEntry.getDomain()); if (versionsByDomain == null) { versionsByDomain = new HashSet<>(); discoveredVersions.put(discoveryEntry.getDomain(), versionsByDomain); } versionsByDomain.add(discoveryEntry.getProviderVersion()); } if (!versionCompatibilityChecker.check(callerVersion, discoveryEntry.getProviderVersion())) { iterator.remove(); } } return discoveryEntries; } }
public class class_name { public Set<DiscoveryEntryWithMetaInfo> filter(Version callerVersion, Set<DiscoveryEntryWithMetaInfo> discoveryEntries, Map<String, Set<Version>> discoveredVersions) { if (callerVersion == null || discoveryEntries == null) { throw new IllegalArgumentException(String.format("Neither callerVersion (%s) nor discoveryEntries (%s) can be null.", callerVersion, discoveryEntries)); } Iterator<DiscoveryEntryWithMetaInfo> iterator = discoveryEntries.iterator(); while (iterator.hasNext()) { DiscoveryEntry discoveryEntry = iterator.next(); if (discoveredVersions != null) { Set<Version> versionsByDomain = discoveredVersions.get(discoveryEntry.getDomain()); if (versionsByDomain == null) { versionsByDomain = new HashSet<>(); // depends on control dependency: [if], data = [none] discoveredVersions.put(discoveryEntry.getDomain(), versionsByDomain); // depends on control dependency: [if], data = [none] } versionsByDomain.add(discoveryEntry.getProviderVersion()); // depends on control dependency: [if], data = [none] } if (!versionCompatibilityChecker.check(callerVersion, discoveryEntry.getProviderVersion())) { iterator.remove(); // depends on control dependency: [if], data = [none] } } return discoveryEntries; } }
public class class_name { public static String file(File file) throws IOException { FileInputStream fi = null; try { fi = new FileInputStream(file); return stream(fi, file.length()); } finally { if (fi != null) { try { fi.close(); } catch (Throwable t) { } } } } }
public class class_name { public static String file(File file) throws IOException { FileInputStream fi = null; try { fi = new FileInputStream(file); return stream(fi, file.length()); } finally { if (fi != null) { try { fi.close(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private void initIfNecessary() { if (logger.isLoggable(Level.FINER)) { logger.config("In initIfNecessary()."); } // Use double-checked locking with volatile. if (!isInited) { synchronized (isInitedLock) { if (!isInited) { logger.config("--- Initializing ServicesManagerImpl ---"); batchConfigImpl = new BatchConfigImpl(); // Read config readConfigFromPropertiesFiles(); readConfigFromSPI(); readConfigFromSystemProperties(); // Set config in memory initBatchConfigImpl(); initServiceImplOverrides(); initDatabaseConfig(); initPlatformSEorEE(); isInited = Boolean.TRUE; logger.config("--- Completed initialization of ServicesManagerImpl ---"); } } } logger.config("Exiting initIfNecessary()"); } }
public class class_name { private void initIfNecessary() { if (logger.isLoggable(Level.FINER)) { logger.config("In initIfNecessary()."); // depends on control dependency: [if], data = [none] } // Use double-checked locking with volatile. if (!isInited) { synchronized (isInitedLock) { // depends on control dependency: [if], data = [none] if (!isInited) { logger.config("--- Initializing ServicesManagerImpl ---"); // depends on control dependency: [if], data = [none] batchConfigImpl = new BatchConfigImpl(); // depends on control dependency: [if], data = [none] // Read config readConfigFromPropertiesFiles(); // depends on control dependency: [if], data = [none] readConfigFromSPI(); // depends on control dependency: [if], data = [none] readConfigFromSystemProperties(); // depends on control dependency: [if], data = [none] // Set config in memory initBatchConfigImpl(); // depends on control dependency: [if], data = [none] initServiceImplOverrides(); // depends on control dependency: [if], data = [none] initDatabaseConfig(); // depends on control dependency: [if], data = [none] initPlatformSEorEE(); // depends on control dependency: [if], data = [none] isInited = Boolean.TRUE; // depends on control dependency: [if], data = [none] logger.config("--- Completed initialization of ServicesManagerImpl ---"); // depends on control dependency: [if], data = [none] } } } logger.config("Exiting initIfNecessary()"); } }
public class class_name { public void stopSyncInternal(AlluxioURI syncPoint, MountTable.Resolution resolution) { try (LockResource r = new LockResource(mSyncManagerLock)) { LOG.debug("stop syncPoint {}", syncPoint.getPath()); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(resolution.getMountId()) .build(); apply(removeSyncPoint); try { stopSyncPostJournal(syncPoint); } catch (Throwable e) { // revert state; AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); apply(addSyncPoint); recoverFromStopSync(syncPoint, resolution.getMountId()); } } } }
public class class_name { public void stopSyncInternal(AlluxioURI syncPoint, MountTable.Resolution resolution) { try (LockResource r = new LockResource(mSyncManagerLock)) { LOG.debug("stop syncPoint {}", syncPoint.getPath()); RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()) .setMountId(resolution.getMountId()) .build(); apply(removeSyncPoint); try { stopSyncPostJournal(syncPoint); // depends on control dependency: [try], data = [none] } catch (Throwable e) { // revert state; AddSyncPointEntry addSyncPoint = File.AddSyncPointEntry.newBuilder() .setSyncpointPath(syncPoint.toString()).build(); apply(addSyncPoint); recoverFromStopSync(syncPoint, resolution.getMountId()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static DateFormat getInstance() { if (instance == null) { synchronized (instanceLock) { if (instance == null) { instance = new ResqueDateFormatThreadLocal(); } } } return instance.get(); } }
public class class_name { public static DateFormat getInstance() { if (instance == null) { synchronized (instanceLock) { // depends on control dependency: [if], data = [(instance] if (instance == null) { instance = new ResqueDateFormatThreadLocal(); // depends on control dependency: [if], data = [none] } } } return instance.get(); } }
public class class_name { public void modify(DataMediaSource dataMediaSource) { Assert.assertNotNull(dataMediaSource); try { DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource); if (dataMediaSourceDao.checkUnique(dataMediaSourceDo)) { dataMediaSourceDao.update(dataMediaSourceDo); } else { String exceptionCause = "exist the same name source in the database."; logger.warn("WARN ## " + exceptionCause); throw new RepeatConfigureException(exceptionCause); } } catch (RepeatConfigureException rce) { throw rce; } catch (Exception e) { logger.error("ERROR ## modify dataMediaSource has an exception!"); throw new ManagerException(e); } } }
public class class_name { public void modify(DataMediaSource dataMediaSource) { Assert.assertNotNull(dataMediaSource); try { DataMediaSourceDO dataMediaSourceDo = modelToDo(dataMediaSource); if (dataMediaSourceDao.checkUnique(dataMediaSourceDo)) { dataMediaSourceDao.update(dataMediaSourceDo); // depends on control dependency: [if], data = [none] } else { String exceptionCause = "exist the same name source in the database."; // depends on control dependency: [if], data = [none] logger.warn("WARN ## " + exceptionCause); // depends on control dependency: [if], data = [none] throw new RepeatConfigureException(exceptionCause); } } catch (RepeatConfigureException rce) { throw rce; } catch (Exception e) { // depends on control dependency: [catch], data = [none] logger.error("ERROR ## modify dataMediaSource has an exception!"); throw new ManagerException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean cutFile(File originFile, File targetFile) { Assert.notNull(originFile); Assert.notNull(targetFile); copyFile(originFile, targetFile); if (originFile.length() == targetFile.length()) { return originFile.delete(); } return false; } }
public class class_name { public static boolean cutFile(File originFile, File targetFile) { Assert.notNull(originFile); Assert.notNull(targetFile); copyFile(originFile, targetFile); if (originFile.length() == targetFile.length()) { return originFile.delete(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public String dot() { StringBuilder builder = new StringBuilder(); builder.append("digraph RegressionTree {\n node [shape=box, style=\"filled, rounded\", color=\"black\", fontname=helvetica];\n edge [fontname=helvetica];\n"); int n = 0; // number of nodes processed Queue<DotNode> queue = new LinkedList<>(); queue.add(new DotNode(-1, 0, root)); while (!queue.isEmpty()) { // Dequeue a vertex from queue and print it DotNode dnode = queue.poll(); int id = dnode.id; int parent = dnode.parent; Node node = dnode.node; // leaf node if (node.trueChild == null && node.falseChild == null) { builder.append(String.format(" %d [label=<%.4f>, fillcolor=\"#00000000\", shape=ellipse];\n", id, node.output)); } else { Attribute attr = attributes[node.splitFeature]; if (attr.getType() == Attribute.Type.NOMINAL) { builder.append(String.format(" %d [label=<%s = %s<br/>nscore = %.4f>, fillcolor=\"#00000000\"];\n", id, attr.getName(), attr.toString(node.splitValue), node.splitScore)); } else if (attr.getType() == Attribute.Type.NUMERIC) { builder.append(String.format(" %d [label=<%s &le; %.4f<br/>score = %.4f>, fillcolor=\"#00000000\"];\n", id, attr.getName(), node.splitValue, node.splitScore)); } else { throw new IllegalStateException("Unsupported attribute type: " + attr.getType()); } } // add edge if (parent >= 0) { builder.append(' ').append(parent).append(" -> ").append(id); // only draw edge label at top if (parent == 0) { if (id == 1) { builder.append(" [labeldistance=2.5, labelangle=45, headlabel=\"True\"]"); } else { builder.append(" [labeldistance=2.5, labelangle=-45, headlabel=\"False\"]"); } } builder.append(";\n"); } if (node.trueChild != null) { queue.add(new DotNode(id, ++n, node.trueChild)); } if (node.falseChild != null) { queue.add(new DotNode(id, ++n, node.falseChild)); } } builder.append("}"); return builder.toString(); } }
public class class_name { public String dot() { StringBuilder builder = new StringBuilder(); builder.append("digraph RegressionTree {\n node [shape=box, style=\"filled, rounded\", color=\"black\", fontname=helvetica];\n edge [fontname=helvetica];\n"); int n = 0; // number of nodes processed Queue<DotNode> queue = new LinkedList<>(); queue.add(new DotNode(-1, 0, root)); while (!queue.isEmpty()) { // Dequeue a vertex from queue and print it DotNode dnode = queue.poll(); int id = dnode.id; int parent = dnode.parent; Node node = dnode.node; // leaf node if (node.trueChild == null && node.falseChild == null) { builder.append(String.format(" %d [label=<%.4f>, fillcolor=\"#00000000\", shape=ellipse];\n", id, node.output)); // depends on control dependency: [if], data = [none] } else { Attribute attr = attributes[node.splitFeature]; if (attr.getType() == Attribute.Type.NOMINAL) { builder.append(String.format(" %d [label=<%s = %s<br/>nscore = %.4f>, fillcolor=\"#00000000\"];\n", id, attr.getName(), attr.toString(node.splitValue), node.splitScore)); // depends on control dependency: [if], data = [none] } else if (attr.getType() == Attribute.Type.NUMERIC) { builder.append(String.format(" %d [label=<%s &le; %.4f<br/>score = %.4f>, fillcolor=\"#00000000\"];\n", id, attr.getName(), node.splitValue, node.splitScore)); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("Unsupported attribute type: " + attr.getType()); } } // add edge if (parent >= 0) { builder.append(' ').append(parent).append(" -> ").append(id); // depends on control dependency: [if], data = [(parent] // only draw edge label at top if (parent == 0) { if (id == 1) { builder.append(" [labeldistance=2.5, labelangle=45, headlabel=\"True\"]"); // depends on control dependency: [if], data = [none] } else { builder.append(" [labeldistance=2.5, labelangle=-45, headlabel=\"False\"]"); // depends on control dependency: [if], data = [none] } } builder.append(";\n"); // depends on control dependency: [if], data = [none] } if (node.trueChild != null) { queue.add(new DotNode(id, ++n, node.trueChild)); // depends on control dependency: [if], data = [none] } if (node.falseChild != null) { queue.add(new DotNode(id, ++n, node.falseChild)); // depends on control dependency: [if], data = [none] } } builder.append("}"); return builder.toString(); } }
public class class_name { public final BELScriptParser.define_annotation_return define_annotation() throws RecognitionException { BELScriptParser.define_annotation_return retval = new BELScriptParser.define_annotation_return(); retval.start = input.LT(1); Object root_0 = null; Token vl=null; Token string_literal40=null; Token string_literal41=null; Token OBJECT_IDENT42=null; Token string_literal43=null; Token set44=null; Token string_literal46=null; BELScriptParser.quoted_value_return quoted_value45 = null; Object vl_tree=null; Object string_literal40_tree=null; Object string_literal41_tree=null; Object OBJECT_IDENT42_tree=null; Object string_literal43_tree=null; Object set44_tree=null; Object string_literal46_tree=null; paraphrases.push("in define annotation."); try { // BELScript.g:105:5: ( ( 'DEFINE' 'ANNOTATION' ) OBJECT_IDENT 'AS' ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) ) // BELScript.g:106:5: ( 'DEFINE' 'ANNOTATION' ) OBJECT_IDENT 'AS' ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) { root_0 = (Object)adaptor.nil(); // BELScript.g:106:5: ( 'DEFINE' 'ANNOTATION' ) // BELScript.g:106:6: 'DEFINE' 'ANNOTATION' { string_literal40=(Token)match(input,27,FOLLOW_27_in_define_annotation487); string_literal40_tree = (Object)adaptor.create(string_literal40); adaptor.addChild(root_0, string_literal40_tree); string_literal41=(Token)match(input,32,FOLLOW_32_in_define_annotation489); string_literal41_tree = (Object)adaptor.create(string_literal41); adaptor.addChild(root_0, string_literal41_tree); } OBJECT_IDENT42=(Token)match(input,OBJECT_IDENT,FOLLOW_OBJECT_IDENT_in_define_annotation492); OBJECT_IDENT42_tree = (Object)adaptor.create(OBJECT_IDENT42); adaptor.addChild(root_0, OBJECT_IDENT42_tree); string_literal43=(Token)match(input,30,FOLLOW_30_in_define_annotation494); string_literal43_tree = (Object)adaptor.create(string_literal43); adaptor.addChild(root_0, string_literal43_tree); // BELScript.g:106:47: ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==31||LA7_0==33) ) { alt7=1; } else if ( (LA7_0==34) ) { alt7=2; } else { NoViableAltException nvae = new NoViableAltException("", 7, 0, input); throw nvae; } switch (alt7) { case 1 : // BELScript.g:106:48: ( ( 'URL' | 'PATTERN' ) quoted_value ) { // BELScript.g:106:48: ( ( 'URL' | 'PATTERN' ) quoted_value ) // BELScript.g:106:49: ( 'URL' | 'PATTERN' ) quoted_value { set44=(Token)input.LT(1); if ( input.LA(1)==31||input.LA(1)==33 ) { input.consume(); adaptor.addChild(root_0, (Object)adaptor.create(set44)); state.errorRecovery=false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } pushFollow(FOLLOW_quoted_value_in_define_annotation506); quoted_value45=quoted_value(); state._fsp--; adaptor.addChild(root_0, quoted_value45.getTree()); } } break; case 2 : // BELScript.g:106:85: ( 'LIST' vl= VALUE_LIST ) { // BELScript.g:106:85: ( 'LIST' vl= VALUE_LIST ) // BELScript.g:106:86: 'LIST' vl= VALUE_LIST { string_literal46=(Token)match(input,34,FOLLOW_34_in_define_annotation512); string_literal46_tree = (Object)adaptor.create(string_literal46); adaptor.addChild(root_0, string_literal46_tree); vl=(Token)match(input,VALUE_LIST,FOLLOW_VALUE_LIST_in_define_annotation516); vl_tree = (Object)adaptor.create(vl); adaptor.addChild(root_0, vl_tree); } } break; } // https://github.com/OpenBEL/openbel-framework/issues/14 if (vl != null) vl.setText(vl.getText().replace("\\\\", "\\")); } retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); paraphrases.pop(); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { public final BELScriptParser.define_annotation_return define_annotation() throws RecognitionException { BELScriptParser.define_annotation_return retval = new BELScriptParser.define_annotation_return(); retval.start = input.LT(1); Object root_0 = null; Token vl=null; Token string_literal40=null; Token string_literal41=null; Token OBJECT_IDENT42=null; Token string_literal43=null; Token set44=null; Token string_literal46=null; BELScriptParser.quoted_value_return quoted_value45 = null; Object vl_tree=null; Object string_literal40_tree=null; Object string_literal41_tree=null; Object OBJECT_IDENT42_tree=null; Object string_literal43_tree=null; Object set44_tree=null; Object string_literal46_tree=null; paraphrases.push("in define annotation."); try { // BELScript.g:105:5: ( ( 'DEFINE' 'ANNOTATION' ) OBJECT_IDENT 'AS' ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) ) // BELScript.g:106:5: ( 'DEFINE' 'ANNOTATION' ) OBJECT_IDENT 'AS' ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) { root_0 = (Object)adaptor.nil(); // BELScript.g:106:5: ( 'DEFINE' 'ANNOTATION' ) // BELScript.g:106:6: 'DEFINE' 'ANNOTATION' { string_literal40=(Token)match(input,27,FOLLOW_27_in_define_annotation487); string_literal40_tree = (Object)adaptor.create(string_literal40); adaptor.addChild(root_0, string_literal40_tree); string_literal41=(Token)match(input,32,FOLLOW_32_in_define_annotation489); string_literal41_tree = (Object)adaptor.create(string_literal41); adaptor.addChild(root_0, string_literal41_tree); } OBJECT_IDENT42=(Token)match(input,OBJECT_IDENT,FOLLOW_OBJECT_IDENT_in_define_annotation492); OBJECT_IDENT42_tree = (Object)adaptor.create(OBJECT_IDENT42); adaptor.addChild(root_0, OBJECT_IDENT42_tree); string_literal43=(Token)match(input,30,FOLLOW_30_in_define_annotation494); string_literal43_tree = (Object)adaptor.create(string_literal43); adaptor.addChild(root_0, string_literal43_tree); // BELScript.g:106:47: ( ( ( 'URL' | 'PATTERN' ) quoted_value ) | ( 'LIST' vl= VALUE_LIST ) ) int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==31||LA7_0==33) ) { alt7=1; // depends on control dependency: [if], data = [none] } else if ( (LA7_0==34) ) { alt7=2; // depends on control dependency: [if], data = [none] } else { NoViableAltException nvae = new NoViableAltException("", 7, 0, input); throw nvae; } switch (alt7) { case 1 : // BELScript.g:106:48: ( ( 'URL' | 'PATTERN' ) quoted_value ) { // BELScript.g:106:48: ( ( 'URL' | 'PATTERN' ) quoted_value ) // BELScript.g:106:49: ( 'URL' | 'PATTERN' ) quoted_value { set44=(Token)input.LT(1); if ( input.LA(1)==31||input.LA(1)==33 ) { input.consume(); // depends on control dependency: [if], data = [none] adaptor.addChild(root_0, (Object)adaptor.create(set44)); // depends on control dependency: [if], data = [none] state.errorRecovery=false; // depends on control dependency: [if], data = [none] } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } pushFollow(FOLLOW_quoted_value_in_define_annotation506); quoted_value45=quoted_value(); state._fsp--; adaptor.addChild(root_0, quoted_value45.getTree()); } } break; case 2 : // BELScript.g:106:85: ( 'LIST' vl= VALUE_LIST ) { // BELScript.g:106:85: ( 'LIST' vl= VALUE_LIST ) // BELScript.g:106:86: 'LIST' vl= VALUE_LIST { string_literal46=(Token)match(input,34,FOLLOW_34_in_define_annotation512); string_literal46_tree = (Object)adaptor.create(string_literal46); adaptor.addChild(root_0, string_literal46_tree); vl=(Token)match(input,VALUE_LIST,FOLLOW_VALUE_LIST_in_define_annotation516); vl_tree = (Object)adaptor.create(vl); adaptor.addChild(root_0, vl_tree); } } break; } // https://github.com/OpenBEL/openbel-framework/issues/14 if (vl != null) vl.setText(vl.getText().replace("\\\\", "\\")); } retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); paraphrases.pop(); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; } }
public class class_name { protected Type getModelType(final EntityTypeToken modelType) { final Class<?> modelClass = modelType.getRawClass(); // check for wrappers final Model modelAnnotation = modelClass.getAnnotation(Model.class); if (modelAnnotation == null) { return modelType.getType(); } final Class<?> wrapper = modelAnnotation.wrapper(); return wrapper != null && wrapper != Model.class ? wrapper : modelType.getType(); } }
public class class_name { protected Type getModelType(final EntityTypeToken modelType) { final Class<?> modelClass = modelType.getRawClass(); // check for wrappers final Model modelAnnotation = modelClass.getAnnotation(Model.class); if (modelAnnotation == null) { return modelType.getType(); } // depends on control dependency: [if], data = [none] final Class<?> wrapper = modelAnnotation.wrapper(); return wrapper != null && wrapper != Model.class ? wrapper : modelType.getType(); } }
public class class_name { private void checkMethod(String methodName, String signature) { JavaClass javaClass = checkClass(); if (javaClass == null) { return; } for (JavaClass current = javaClass; current != null; current = getSuperclass(current)) { for (Method method : current.getMethods()) { if (methodName.equals(method.getName()) && signature.equals(method.getSignature())) { // method has been found - check if it's beta if (isBeta(method.getAnnotationEntries())) { bugReporter.reportBug(createBugInstance(BETA_METHOD_USAGE).addCalledMethod(this)); } return; } } } if (!javaClass.isAbstract()) { bugReporter.logError( "Can't locate method " + javaClass.getClassName() + "." + methodName + signature); } } }
public class class_name { private void checkMethod(String methodName, String signature) { JavaClass javaClass = checkClass(); if (javaClass == null) { return; // depends on control dependency: [if], data = [none] } for (JavaClass current = javaClass; current != null; current = getSuperclass(current)) { for (Method method : current.getMethods()) { if (methodName.equals(method.getName()) && signature.equals(method.getSignature())) { // method has been found - check if it's beta if (isBeta(method.getAnnotationEntries())) { bugReporter.reportBug(createBugInstance(BETA_METHOD_USAGE).addCalledMethod(this)); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } } } if (!javaClass.isAbstract()) { bugReporter.logError( "Can't locate method " + javaClass.getClassName() + "." + methodName + signature); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void loadProtoClassToCache(String key, Class clazz, String methodName) { Method pbMethod = null; Method[] methods = clazz.getMethods(); for (Method method : methods) { if (methodName.equals(method.getName())) { pbMethod = method; break; } } if (pbMethod == null) { throw new SofaRpcRuntimeException("Cannot found protobuf method: " + clazz.getName() + "." + methodName); } Class[] parameterTypes = pbMethod.getParameterTypes(); if (parameterTypes == null || parameterTypes.length != 1 || isProtoBufMessageObject(parameterTypes[0])) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support one protobuf parameter!"); } Class reqClass = parameterTypes[0]; requestClassCache.put(key, reqClass); Class resClass = pbMethod.getReturnType(); if (resClass == void.class || !isProtoBufMessageClass(resClass)) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support return protobuf message!"); } responseClassCache.put(key, resClass); } }
public class class_name { private void loadProtoClassToCache(String key, Class clazz, String methodName) { Method pbMethod = null; Method[] methods = clazz.getMethods(); for (Method method : methods) { if (methodName.equals(method.getName())) { pbMethod = method; // depends on control dependency: [if], data = [none] break; } } if (pbMethod == null) { throw new SofaRpcRuntimeException("Cannot found protobuf method: " + clazz.getName() + "." + methodName); } Class[] parameterTypes = pbMethod.getParameterTypes(); if (parameterTypes == null || parameterTypes.length != 1 || isProtoBufMessageObject(parameterTypes[0])) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support one protobuf parameter!"); } Class reqClass = parameterTypes[0]; requestClassCache.put(key, reqClass); Class resClass = pbMethod.getReturnType(); if (resClass == void.class || !isProtoBufMessageClass(resClass)) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support return protobuf message!"); } responseClassCache.put(key, resClass); } }
public class class_name { public Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>> listOwnershipIdentifiersWithServiceResponseAsync(final String resourceGroupName, final String domainName) { return listOwnershipIdentifiersSinglePageAsync(resourceGroupName, domainName) .concatMap(new Func1<ServiceResponse<Page<DomainOwnershipIdentifierInner>>, Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>>>() { @Override public Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>> call(ServiceResponse<Page<DomainOwnershipIdentifierInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listOwnershipIdentifiersNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>> listOwnershipIdentifiersWithServiceResponseAsync(final String resourceGroupName, final String domainName) { return listOwnershipIdentifiersSinglePageAsync(resourceGroupName, domainName) .concatMap(new Func1<ServiceResponse<Page<DomainOwnershipIdentifierInner>>, Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>>>() { @Override public Observable<ServiceResponse<Page<DomainOwnershipIdentifierInner>>> call(ServiceResponse<Page<DomainOwnershipIdentifierInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listOwnershipIdentifiersNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { private void ensureRespondJsScriptElement() { if (this.respondJsScript == null) { this.respondJsScript = Document.get().createScriptElement(); this.respondJsScript.setSrc(GWT.getModuleBaseForStaticFiles() + DefaultIE8ThemeController.RESPOND_JS_LOCATION); this.respondJsScript.setType("text/javascript"); } } }
public class class_name { private void ensureRespondJsScriptElement() { if (this.respondJsScript == null) { this.respondJsScript = Document.get().createScriptElement(); // depends on control dependency: [if], data = [none] this.respondJsScript.setSrc(GWT.getModuleBaseForStaticFiles() + DefaultIE8ThemeController.RESPOND_JS_LOCATION); // depends on control dependency: [if], data = [none] this.respondJsScript.setType("text/javascript"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public SmiOidNode findByOidPrefix(int... oid) { SmiOidNode parent = getRootNode(); for (int subId : oid) { SmiOidNode result = parent.findChild(subId); if (result == null) { return parent; } parent = result; } return null; } }
public class class_name { public SmiOidNode findByOidPrefix(int... oid) { SmiOidNode parent = getRootNode(); for (int subId : oid) { SmiOidNode result = parent.findChild(subId); if (result == null) { return parent; // depends on control dependency: [if], data = [none] } parent = result; // depends on control dependency: [for], data = [none] } return null; } }
public class class_name { public Set<String> parseAddFormatters(I_CmsXmlContentLocation node) { Set<String> addFormatters = new HashSet<String>(); for (I_CmsXmlContentValueLocation addLoc : node.getSubValues(N_ADD_FORMATTERS + "/" + N_ADD_FORMATTER)) { CmsXmlVfsFileValue value = (CmsXmlVfsFileValue)addLoc.getValue(); CmsLink link = value.getLink(m_cms); if (link != null) { addFormatters.add(link.getStructureId().toString()); } } return addFormatters; } }
public class class_name { public Set<String> parseAddFormatters(I_CmsXmlContentLocation node) { Set<String> addFormatters = new HashSet<String>(); for (I_CmsXmlContentValueLocation addLoc : node.getSubValues(N_ADD_FORMATTERS + "/" + N_ADD_FORMATTER)) { CmsXmlVfsFileValue value = (CmsXmlVfsFileValue)addLoc.getValue(); CmsLink link = value.getLink(m_cms); if (link != null) { addFormatters.add(link.getStructureId().toString()); // depends on control dependency: [if], data = [(link] } } return addFormatters; } }
public class class_name { public static int countCommonElements(int[] arra, int[] arrb) { int k = 0; for (int i = 0; i < arra.length; i++) { for (int j = 0; j < arrb.length; j++) { if (arra[i] == arrb[j]) { k++; } } } return k; } }
public class class_name { public static int countCommonElements(int[] arra, int[] arrb) { int k = 0; for (int i = 0; i < arra.length; i++) { for (int j = 0; j < arrb.length; j++) { if (arra[i] == arrb[j]) { k++; // depends on control dependency: [if], data = [none] } } } return k; } }
public class class_name { public PlainTime getStart(PlainTime context) { PlainTime compare = ( (context.getHour() == 24) ? PlainTime.midnightAtStartOfDay() : context); PlainTime last = this.codeMap.lastKey(); for (PlainTime key : this.codeMap.keySet()) { if (compare.isSimultaneous(key)) { return key; } else if (compare.isBefore(key)) { break; } else { last = key; } } return last; } }
public class class_name { public PlainTime getStart(PlainTime context) { PlainTime compare = ( (context.getHour() == 24) ? PlainTime.midnightAtStartOfDay() : context); PlainTime last = this.codeMap.lastKey(); for (PlainTime key : this.codeMap.keySet()) { if (compare.isSimultaneous(key)) { return key; // depends on control dependency: [if], data = [none] } else if (compare.isBefore(key)) { break; } else { last = key; // depends on control dependency: [if], data = [none] } } return last; } }
public class class_name { private Object findByKey(String key) { Object value = Config.get(request, key); if (value != null) { return value; } value = Config.get(request.getSession(createNewSession()), key); if (value != null) { return value; } value = Config.get(request.getServletContext(), key); if (value != null) { return value; } return request.getServletContext().getInitParameter(key); } }
public class class_name { private Object findByKey(String key) { Object value = Config.get(request, key); if (value != null) { return value; // depends on control dependency: [if], data = [none] } value = Config.get(request.getSession(createNewSession()), key); if (value != null) { return value; // depends on control dependency: [if], data = [none] } value = Config.get(request.getServletContext(), key); if (value != null) { return value; // depends on control dependency: [if], data = [none] } return request.getServletContext().getInitParameter(key); } }
public class class_name { @Override public String getFormattedMessage() { if (formattedMessage == null) { if (message == null) { message = getMessage(messagePattern, argArray, throwable); } formattedMessage = message.getFormattedMessage(); } return formattedMessage; } }
public class class_name { @Override public String getFormattedMessage() { if (formattedMessage == null) { if (message == null) { message = getMessage(messagePattern, argArray, throwable); // depends on control dependency: [if], data = [(message] } formattedMessage = message.getFormattedMessage(); // depends on control dependency: [if], data = [none] } return formattedMessage; } }
public class class_name { private static String xunescapeString(String in, char escape, boolean spaceplus) { try { if(in == null) return null; byte[] utf8 = in.getBytes(utf8Charset); byte escape8 = (byte) escape; byte[] out = new byte[utf8.length]; // Should be max we need int index8 = 0; for(int i = 0; i < utf8.length; ) { byte b = utf8[i++]; if(b == plus && spaceplus) { out[index8++] = blank; } else if(b == escape8) { // check to see if there are enough characters left if(i + 2 <= utf8.length) { b = (byte) (fromHex(utf8[i]) << 4 | fromHex(utf8[i + 1])); i += 2; } } out[index8++] = b; } return new String(out, 0, index8, utf8Charset); } catch (Exception e) { return in; } } }
public class class_name { private static String xunescapeString(String in, char escape, boolean spaceplus) { try { if(in == null) return null; byte[] utf8 = in.getBytes(utf8Charset); byte escape8 = (byte) escape; byte[] out = new byte[utf8.length]; // Should be max we need int index8 = 0; for(int i = 0; i < utf8.length; ) { byte b = utf8[i++]; if(b == plus && spaceplus) { out[index8++] = blank; // depends on control dependency: [if], data = [none] } else if(b == escape8) { // check to see if there are enough characters left if(i + 2 <= utf8.length) { b = (byte) (fromHex(utf8[i]) << 4 | fromHex(utf8[i + 1])); // depends on control dependency: [if], data = [none] i += 2; // depends on control dependency: [if], data = [none] } } out[index8++] = b; // depends on control dependency: [for], data = [none] } return new String(out, 0, index8, utf8Charset); // depends on control dependency: [try], data = [none] } catch (Exception e) { return in; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Accessor getAccessorForProperty(final Class<?> clazz, final String propertyName) { int splitPoint = propertyName.indexOf('.'); if (splitPoint > 0) { String firstPart = propertyName.substring(0, splitPoint); String secondPart = propertyName.substring(splitPoint + 1); return new NestedAccessor(clazz, firstPart, secondPart); } return new SimpleAccessor(clazz, propertyName); } }
public class class_name { public static Accessor getAccessorForProperty(final Class<?> clazz, final String propertyName) { int splitPoint = propertyName.indexOf('.'); if (splitPoint > 0) { String firstPart = propertyName.substring(0, splitPoint); String secondPart = propertyName.substring(splitPoint + 1); return new NestedAccessor(clazz, firstPart, secondPart); // depends on control dependency: [if], data = [none] } return new SimpleAccessor(clazz, propertyName); } }
public class class_name { protected void load() { if (loader == null) { setInfiniteScrollLoader(new InfiniteScrollLoader()); } offset = loadConfig.getOffset(); limit = loadConfig.getLimit(); load(offset, limit); } }
public class class_name { protected void load() { if (loader == null) { setInfiniteScrollLoader(new InfiniteScrollLoader()); // depends on control dependency: [if], data = [none] } offset = loadConfig.getOffset(); limit = loadConfig.getLimit(); load(offset, limit); } }
public class class_name { public List<org.openprovenance.prov.model.Other> getOther() { if (other == null) { other = new ArrayList<org.openprovenance.prov.model.Other>(); } return this.other; } }
public class class_name { public List<org.openprovenance.prov.model.Other> getOther() { if (other == null) { other = new ArrayList<org.openprovenance.prov.model.Other>(); // depends on control dependency: [if], data = [none] } return this.other; } }
public class class_name { private static List<FieldSchema> getFieldSchemas(HiveRegistrationUnit unit) { List<Column> columns = unit.getColumns(); List<FieldSchema> fieldSchemas = new ArrayList<>(); if (columns != null && columns.size() > 0) { fieldSchemas = getFieldSchemas(columns); } else { Deserializer deserializer = getDeserializer(unit); if (deserializer != null) { try { fieldSchemas = MetaStoreUtils.getFieldsFromDeserializer(unit.getTableName(), deserializer); } catch (SerDeException | MetaException e) { LOG.warn("Encountered exception while getting fields from deserializer.", e); } } } return fieldSchemas; } }
public class class_name { private static List<FieldSchema> getFieldSchemas(HiveRegistrationUnit unit) { List<Column> columns = unit.getColumns(); List<FieldSchema> fieldSchemas = new ArrayList<>(); if (columns != null && columns.size() > 0) { fieldSchemas = getFieldSchemas(columns); // depends on control dependency: [if], data = [(columns] } else { Deserializer deserializer = getDeserializer(unit); if (deserializer != null) { try { fieldSchemas = MetaStoreUtils.getFieldsFromDeserializer(unit.getTableName(), deserializer); // depends on control dependency: [try], data = [none] } catch (SerDeException | MetaException e) { LOG.warn("Encountered exception while getting fields from deserializer.", e); } // depends on control dependency: [catch], data = [none] } } return fieldSchemas; } }
public class class_name { public void setSharedDirectoryIds(java.util.Collection<String> sharedDirectoryIds) { if (sharedDirectoryIds == null) { this.sharedDirectoryIds = null; return; } this.sharedDirectoryIds = new com.amazonaws.internal.SdkInternalList<String>(sharedDirectoryIds); } }
public class class_name { public void setSharedDirectoryIds(java.util.Collection<String> sharedDirectoryIds) { if (sharedDirectoryIds == null) { this.sharedDirectoryIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.sharedDirectoryIds = new com.amazonaws.internal.SdkInternalList<String>(sharedDirectoryIds); } }
public class class_name { Map<String, byte[]> getRowKeyValue(List<IndexExpression> expressions, String primaryKeyName) { Map<String, byte[]> rowKeys = new HashMap<String, byte[]>(); List<IndexExpression> rowExpressions = new ArrayList<IndexExpression>(); if (expressions != null) { for (IndexExpression e : expressions) { if (primaryKeyName.equals(new String(e.getColumn_name()))) { IndexOperator operator = e.op; if (operator.equals(IndexOperator.LTE) || operator.equals(IndexOperator.LT)) { rowKeys.put(MAX_, e.getValue()); rowExpressions.add(e); } else if (operator.equals(IndexOperator.GTE) || operator.equals(IndexOperator.GT)) { rowKeys.put(MIN_, e.getValue()); rowExpressions.add(e); } else if (operator.equals(IndexOperator.EQ)) { rowKeys.put(MAX_, e.getValue()); rowKeys.put(MIN_, e.getValue()); rowExpressions.add(e); } } } expressions.removeAll(rowExpressions); } return rowKeys; } }
public class class_name { Map<String, byte[]> getRowKeyValue(List<IndexExpression> expressions, String primaryKeyName) { Map<String, byte[]> rowKeys = new HashMap<String, byte[]>(); List<IndexExpression> rowExpressions = new ArrayList<IndexExpression>(); if (expressions != null) { for (IndexExpression e : expressions) { if (primaryKeyName.equals(new String(e.getColumn_name()))) { IndexOperator operator = e.op; if (operator.equals(IndexOperator.LTE) || operator.equals(IndexOperator.LT)) { rowKeys.put(MAX_, e.getValue()); // depends on control dependency: [if], data = [none] rowExpressions.add(e); // depends on control dependency: [if], data = [none] } else if (operator.equals(IndexOperator.GTE) || operator.equals(IndexOperator.GT)) { rowKeys.put(MIN_, e.getValue()); // depends on control dependency: [if], data = [none] rowExpressions.add(e); // depends on control dependency: [if], data = [none] } else if (operator.equals(IndexOperator.EQ)) { rowKeys.put(MAX_, e.getValue()); // depends on control dependency: [if], data = [none] rowKeys.put(MIN_, e.getValue()); // depends on control dependency: [if], data = [none] rowExpressions.add(e); // depends on control dependency: [if], data = [none] } } } expressions.removeAll(rowExpressions); // depends on control dependency: [if], data = [none] } return rowKeys; } }
public class class_name { public static <T> List<T> toList(Iterator<T> iter) { List<T> buf = new ArrayList<>(); while (iter.hasNext()) { buf.add(iter.next()); } return buf; } }
public class class_name { public static <T> List<T> toList(Iterator<T> iter) { List<T> buf = new ArrayList<>(); while (iter.hasNext()) { buf.add(iter.next()); // depends on control dependency: [while], data = [none] } return buf; } }
public class class_name { private static <E extends Element> List<E> findTopLevelElementsRecurse(Class<E> elementType, Node node, List<E> matches) { for(Element elem : node.getChildElements()) { if(elementType.isInstance(elem)) { // Found match if(matches == null) matches = new ArrayList<>(); matches.add(elementType.cast(elem)); } else { // Look further down the tree matches = findTopLevelElementsRecurse(elementType, elem, matches); } } return matches; } }
public class class_name { private static <E extends Element> List<E> findTopLevelElementsRecurse(Class<E> elementType, Node node, List<E> matches) { for(Element elem : node.getChildElements()) { if(elementType.isInstance(elem)) { // Found match if(matches == null) matches = new ArrayList<>(); matches.add(elementType.cast(elem)); // depends on control dependency: [if], data = [none] } else { // Look further down the tree matches = findTopLevelElementsRecurse(elementType, elem, matches); // depends on control dependency: [if], data = [none] } } return matches; } }
public class class_name { @SuppressWarnings("unchecked") public final void integrityCheck(AbstractMTree<O, N, E, ?> mTree, E entry) { // leaf node if(isLeaf()) { for(int i = 0; i < getCapacity(); i++) { E e = getEntry(i); if(i < getNumEntries() && e == null) { throw new InconsistentDataException("i < numEntries && entry == null"); } if(i >= getNumEntries() && e != null) { throw new InconsistentDataException("i >= numEntries && entry != null"); } } } // dir node else { N tmp = mTree.getNode(getEntry(0)); boolean childIsLeaf = tmp.isLeaf(); for(int i = 0; i < getCapacity(); i++) { E e = getEntry(i); if(i < getNumEntries() && e == null) { throw new InconsistentDataException("i < numEntries && entry == null"); } if(i >= getNumEntries() && e != null) { throw new InconsistentDataException("i >= numEntries && entry != null"); } if(e != null) { N node = mTree.getNode(e); if(childIsLeaf && !node.isLeaf()) { for(int k = 0; k < getNumEntries(); k++) { mTree.getNode(getEntry(k)); } throw new InconsistentDataException("Wrong Child in " + this + " at " + i); } if(!childIsLeaf && node.isLeaf()) { throw new InconsistentDataException("Wrong Child: child id no leaf, but node is leaf!"); } // noinspection unchecked node.integrityCheckParameters(entry, (N) this, i, mTree); node.integrityCheck(mTree, e); } } if(LoggingConfiguration.DEBUG) { Logger.getLogger(this.getClass().getName()).fine("DirNode " + getPageID() + " ok!"); } } } }
public class class_name { @SuppressWarnings("unchecked") public final void integrityCheck(AbstractMTree<O, N, E, ?> mTree, E entry) { // leaf node if(isLeaf()) { for(int i = 0; i < getCapacity(); i++) { E e = getEntry(i); if(i < getNumEntries() && e == null) { throw new InconsistentDataException("i < numEntries && entry == null"); } if(i >= getNumEntries() && e != null) { throw new InconsistentDataException("i >= numEntries && entry != null"); } } } // dir node else { N tmp = mTree.getNode(getEntry(0)); boolean childIsLeaf = tmp.isLeaf(); for(int i = 0; i < getCapacity(); i++) { E e = getEntry(i); if(i < getNumEntries() && e == null) { throw new InconsistentDataException("i < numEntries && entry == null"); } if(i >= getNumEntries() && e != null) { throw new InconsistentDataException("i >= numEntries && entry != null"); } if(e != null) { N node = mTree.getNode(e); if(childIsLeaf && !node.isLeaf()) { for(int k = 0; k < getNumEntries(); k++) { mTree.getNode(getEntry(k)); // depends on control dependency: [for], data = [k] } throw new InconsistentDataException("Wrong Child in " + this + " at " + i); } if(!childIsLeaf && node.isLeaf()) { throw new InconsistentDataException("Wrong Child: child id no leaf, but node is leaf!"); } // noinspection unchecked node.integrityCheckParameters(entry, (N) this, i, mTree); // depends on control dependency: [if], data = [(e] node.integrityCheck(mTree, e); // depends on control dependency: [if], data = [none] } } if(LoggingConfiguration.DEBUG) { Logger.getLogger(this.getClass().getName()).fine("DirNode " + getPageID() + " ok!"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean handleImageUpload(CmsObject cms, CmsUser user, String uploadedFile) { boolean result = false; try { setUserImage(cms, user, uploadedFile); result = true; } catch (CmsException e) { LOG.error("Error setting user image.", e); } try { cms.lockResource(uploadedFile); cms.deleteResource(uploadedFile, CmsResource.DELETE_REMOVE_SIBLINGS); } catch (CmsException e) { LOG.error("Error deleting user image temp file.", e); } return result; } }
public class class_name { public boolean handleImageUpload(CmsObject cms, CmsUser user, String uploadedFile) { boolean result = false; try { setUserImage(cms, user, uploadedFile); // depends on control dependency: [try], data = [none] result = true; // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error("Error setting user image.", e); } // depends on control dependency: [catch], data = [none] try { cms.lockResource(uploadedFile); // depends on control dependency: [try], data = [none] cms.deleteResource(uploadedFile, CmsResource.DELETE_REMOVE_SIBLINGS); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error("Error deleting user image temp file.", e); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { public AmqpChannel closeChannel(int replyCode, String replyText, int classId, int methodId1) { if (readyState == ReadyState.CLOSED) { return this; } Object[] args = {replyCode, replyText, classId, methodId1}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "closeChannel"; String methodId = "20" + "40"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null); return this; } }
public class class_name { public AmqpChannel closeChannel(int replyCode, String replyText, int classId, int methodId1) { if (readyState == ReadyState.CLOSED) { return this; // depends on control dependency: [if], data = [none] } Object[] args = {replyCode, replyText, classId, methodId1}; WrappedByteBuffer bodyArg = null; HashMap<String, Object> headersArg = null; String methodName = "closeChannel"; String methodId = "20" + "40"; AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId); Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg}; asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null); return this; } }
public class class_name { @Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); } else { valueAsString = Objects.toString(pvalue, null); } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } if (valueAsString.length() != BIC_LENGTH_MIN && valueAsString.length() != BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; } if (!valueAsString.matches(BIC_REGEX)) { // format is wrong! return false; } final String countryCode = valueAsString.substring(4, 6); final IbanLengthDefinition validBicLength = IBAN_LENGTH_MAP.ibanLengths().get(countryCode); return validBicLength != null; } }
public class class_name { @Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); // depends on control dependency: [if], data = [none] } else { valueAsString = Objects.toString(pvalue, null); // depends on control dependency: [if], data = [none] } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; // depends on control dependency: [if], data = [none] } if (valueAsString.length() != BIC_LENGTH_MIN && valueAsString.length() != BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; // depends on control dependency: [if], data = [none] } if (!valueAsString.matches(BIC_REGEX)) { // format is wrong! return false; // depends on control dependency: [if], data = [none] } final String countryCode = valueAsString.substring(4, 6); final IbanLengthDefinition validBicLength = IBAN_LENGTH_MAP.ibanLengths().get(countryCode); return validBicLength != null; } }
public class class_name { protected short[] convertValueToArray(final Object value) { if (value instanceof Collection) { final Collection collection = (Collection) value; final short[] target = new short[collection.size()]; int i = 0; for (final Object element : collection) { target[i] = convertType(element); i++; } return target; } if (value instanceof Iterable) { final Iterable iterable = (Iterable) value; final ArrayList<Short> shortArrayList = new ArrayList<>(); for (final Object element : iterable) { final short convertedValue = convertType(element); shortArrayList.add(Short.valueOf(convertedValue)); } final short[] array = new short[shortArrayList.size()]; for (int i = 0; i < shortArrayList.size(); i++) { final Short s = shortArrayList.get(i); array[i] = s.shortValue(); } return array; } if (value instanceof CharSequence) { final String[] strings = StringUtil.splitc(value.toString(), ArrayConverter.NUMBER_DELIMITERS); return convertArrayToArray(strings); } // everything else: return convertToSingleElementArray(value); } }
public class class_name { protected short[] convertValueToArray(final Object value) { if (value instanceof Collection) { final Collection collection = (Collection) value; final short[] target = new short[collection.size()]; int i = 0; for (final Object element : collection) { target[i] = convertType(element); // depends on control dependency: [for], data = [element] i++; // depends on control dependency: [for], data = [none] } return target; // depends on control dependency: [if], data = [none] } if (value instanceof Iterable) { final Iterable iterable = (Iterable) value; final ArrayList<Short> shortArrayList = new ArrayList<>(); for (final Object element : iterable) { final short convertedValue = convertType(element); shortArrayList.add(Short.valueOf(convertedValue)); // depends on control dependency: [for], data = [none] } final short[] array = new short[shortArrayList.size()]; for (int i = 0; i < shortArrayList.size(); i++) { final Short s = shortArrayList.get(i); array[i] = s.shortValue(); // depends on control dependency: [for], data = [i] } return array; // depends on control dependency: [if], data = [none] } if (value instanceof CharSequence) { final String[] strings = StringUtil.splitc(value.toString(), ArrayConverter.NUMBER_DELIMITERS); return convertArrayToArray(strings); // depends on control dependency: [if], data = [none] } // everything else: return convertToSingleElementArray(value); } }
public class class_name { public static Map<String, Object> findFreeMarkerExtensions(Furnace furnace, GraphRewrite event) { Imported<WindupFreeMarkerMethod> freeMarkerMethods = furnace.getAddonRegistry().getServices( WindupFreeMarkerMethod.class); Map<String, Object> results = new HashMap<>(); for (WindupFreeMarkerMethod freeMarkerMethod : freeMarkerMethods) { freeMarkerMethod.setContext(event); if (results.containsKey(freeMarkerMethod.getMethodName())) { throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: " + freeMarkerMethod.getMethodName()); } results.put(freeMarkerMethod.getMethodName(), freeMarkerMethod); } Imported<WindupFreeMarkerTemplateDirective> freeMarkerDirectives = furnace.getAddonRegistry().getServices( WindupFreeMarkerTemplateDirective.class); for (WindupFreeMarkerTemplateDirective freeMarkerDirective : freeMarkerDirectives) { freeMarkerDirective.setContext(event); if (results.containsKey(freeMarkerDirective.getDirectiveName())) { throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: " + freeMarkerDirective.getDirectiveName()); } results.put(freeMarkerDirective.getDirectiveName(), freeMarkerDirective); } return results; } }
public class class_name { public static Map<String, Object> findFreeMarkerExtensions(Furnace furnace, GraphRewrite event) { Imported<WindupFreeMarkerMethod> freeMarkerMethods = furnace.getAddonRegistry().getServices( WindupFreeMarkerMethod.class); Map<String, Object> results = new HashMap<>(); for (WindupFreeMarkerMethod freeMarkerMethod : freeMarkerMethods) { freeMarkerMethod.setContext(event); // depends on control dependency: [for], data = [freeMarkerMethod] if (results.containsKey(freeMarkerMethod.getMethodName())) { throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: " + freeMarkerMethod.getMethodName()); } results.put(freeMarkerMethod.getMethodName(), freeMarkerMethod); // depends on control dependency: [for], data = [freeMarkerMethod] } Imported<WindupFreeMarkerTemplateDirective> freeMarkerDirectives = furnace.getAddonRegistry().getServices( WindupFreeMarkerTemplateDirective.class); for (WindupFreeMarkerTemplateDirective freeMarkerDirective : freeMarkerDirectives) { freeMarkerDirective.setContext(event); // depends on control dependency: [for], data = [freeMarkerDirective] if (results.containsKey(freeMarkerDirective.getDirectiveName())) { throw new WindupException(Util.WINDUP_BRAND_NAME_ACRONYM+" contains two freemarker extension providing the same name: " + freeMarkerDirective.getDirectiveName()); } results.put(freeMarkerDirective.getDirectiveName(), freeMarkerDirective); // depends on control dependency: [for], data = [freeMarkerDirective] } return results; } }
public class class_name { public void marshall(CreateConfigurationSetEventDestinationRequest createConfigurationSetEventDestinationRequest, ProtocolMarshaller protocolMarshaller) { if (createConfigurationSetEventDestinationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getEventDestination(), EVENTDESTINATION_BINDING); protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getEventDestinationName(), EVENTDESTINATIONNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateConfigurationSetEventDestinationRequest createConfigurationSetEventDestinationRequest, ProtocolMarshaller protocolMarshaller) { if (createConfigurationSetEventDestinationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getEventDestination(), EVENTDESTINATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createConfigurationSetEventDestinationRequest.getEventDestinationName(), EVENTDESTINATIONNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void log(Throwable t, String template, Object... values) { out.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(); out.flush(); } } }
public class class_name { public static void log(Throwable t, String template, Object... values) { out.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(); // depends on control dependency: [if], data = [none] out.flush(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void retrieveAggregateRoot(final Set<String> removedNodeIds, final Map<String, NodeData> map) { if (indexingConfig != null) { AggregateRule[] aggregateRules = indexingConfig.getAggregateRules(); if (aggregateRules == null) { return; } long time = 0; if (log.isDebugEnabled()) { time = System.currentTimeMillis(); } int found = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Integer>() { public Integer run() { int found = 0; try { CachingMultiIndexReader reader = indexRegister.getDefaultIndex().getIndexReader(); try { Term aggregateUUIDs = new Term(FieldNames.AGGREGATED_NODE_UUID, ""); TermDocs tDocs = reader.termDocs(); try { ItemDataConsumer ism = getContext().getItemStateManager(); for (Iterator<String> it = removedNodeIds.iterator(); it.hasNext();) { String id = it.next(); aggregateUUIDs = aggregateUUIDs.createTerm(id); tDocs.seek(aggregateUUIDs); while (tDocs.next()) { Document doc = reader.document(tDocs.doc(), FieldSelectors.UUID); String uuid = doc.get(FieldNames.UUID); ItemData itd = ism.getItemData(uuid); if (itd == null) { continue; } if (!itd.isNode()) { throw new RepositoryException("Item with id:" + uuid + " is not a node"); } map.put(uuid, (NodeData)itd); found++; } } } finally { tDocs.close(); } } finally { reader.release(); } } catch (Exception e) { log.warn("Exception while retrieving aggregate roots", e); } return found; } }); if (log.isDebugEnabled()) { time = System.currentTimeMillis() - time; log.debug("Retrieved {} aggregate roots in {} ms.", new Integer(found), new Long(time)); } } } }
public class class_name { protected void retrieveAggregateRoot(final Set<String> removedNodeIds, final Map<String, NodeData> map) { if (indexingConfig != null) { AggregateRule[] aggregateRules = indexingConfig.getAggregateRules(); if (aggregateRules == null) { return; // depends on control dependency: [if], data = [none] } long time = 0; if (log.isDebugEnabled()) { time = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] } int found = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Integer>() { public Integer run() { int found = 0; try { CachingMultiIndexReader reader = indexRegister.getDefaultIndex().getIndexReader(); try { Term aggregateUUIDs = new Term(FieldNames.AGGREGATED_NODE_UUID, ""); TermDocs tDocs = reader.termDocs(); try { ItemDataConsumer ism = getContext().getItemStateManager(); for (Iterator<String> it = removedNodeIds.iterator(); it.hasNext();) { String id = it.next(); aggregateUUIDs = aggregateUUIDs.createTerm(id); // depends on control dependency: [for], data = [none] tDocs.seek(aggregateUUIDs); // depends on control dependency: [for], data = [none] while (tDocs.next()) { Document doc = reader.document(tDocs.doc(), FieldSelectors.UUID); String uuid = doc.get(FieldNames.UUID); ItemData itd = ism.getItemData(uuid); if (itd == null) { continue; } if (!itd.isNode()) { throw new RepositoryException("Item with id:" + uuid + " is not a node"); } map.put(uuid, (NodeData)itd); // depends on control dependency: [while], data = [none] found++; // depends on control dependency: [while], data = [none] } } } finally { tDocs.close(); } } finally { reader.release(); } } catch (Exception e) { log.warn("Exception while retrieving aggregate roots", e); } // depends on control dependency: [catch], data = [none] return found; } }); if (log.isDebugEnabled()) { time = System.currentTimeMillis() - time; // depends on control dependency: [if], data = [none] log.debug("Retrieved {} aggregate roots in {} ms.", new Integer(found), new Long(time)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static TBase<?, ?> newTInstance(Class<?> tClass) { try { return (TBase<?, ?>) tClass.newInstance(); } catch (Exception e) { // not expected. throw new RuntimeException(e); } } }
public class class_name { private static TBase<?, ?> newTInstance(Class<?> tClass) { try { return (TBase<?, ?>) tClass.newInstance(); // depends on control dependency: [try], data = [none] // depends on control dependency: [try], data = [none] } catch (Exception e) { // not expected. throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void init() { _smoothed = true; _chartType = ChartType.LINE; _subDivisions = 16; _snapToTicks = false; _selectorFillColor = Color.WHITE; _selectorStrokeColor = Color.RED; _selectorSize = 10; _decimals = 2; _interactive = true; _tooltipTimeout = 2000; formatString = "%.2f"; strokePaths = new ArrayList<>(); clickHandler = e -> select(e); endOfTransformationHandler = e -> selectorTooltip.hide(); seriesListener = change -> { while (change.next()) { if (change.wasAdded()) { change.getAddedSubList().forEach(addedItem -> { final Series<X, Y> series = addedItem; final Path strokePath = (Path) ((Group) series.getNode()).getChildren().get(1); final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0); fillPath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePaths.add(strokePath); series.getData().forEach(data -> data.YValueProperty().addListener(o -> layoutPlotChildren())); }); } else if (change.wasRemoved()) { change.getRemoved().forEach(removedItem -> { final Series<X, Y> series = removedItem; final Path strokePath = (Path) ((Group) series.getNode()).getChildren().get(1); final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0); fillPath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePaths.remove(strokePath); }); } } }; // Add selector to chart selector = new Circle(); selector.setFill(_selectorFillColor); selector.setStroke(_selectorStrokeColor); selector.setOpacity(0); selectorTooltip = new Tooltip(""); Tooltip.install(selector, selectorTooltip); FadeTransition fadeIn = new FadeTransition(Duration.millis(100), selector); fadeIn.setFromValue(0); fadeIn.setToValue(1); timeBeforeFadeOut = new PauseTransition(Duration.millis(_tooltipTimeout)); FadeTransition fadeOut = new FadeTransition(Duration.millis(100), selector); fadeOut.setFromValue(1); fadeOut.setToValue(0); fadeInFadeOut = new SequentialTransition(fadeIn, timeBeforeFadeOut, fadeOut); fadeInFadeOut.setOnFinished(endOfTransformationHandler); chartPlotBackground = getChartPlotBackground(); chartPlotBackground.widthProperty().addListener(o -> resizeSelector()); chartPlotBackground.heightProperty().addListener(o -> resizeSelector()); chartPlotBackground.layoutYProperty().addListener(o -> resizeSelector()); Path horizontalGridLines = getHorizontalGridLines(); if (null != horizontalGridLines) { horizontalGridLines.setMouseTransparent(true); } Path verticalGridLines = getVerticalGridLines(); if (null != verticalGridLines) { verticalGridLines.setMouseTransparent(true); } getChartChildren().addAll(selector); } }
public class class_name { private void init() { _smoothed = true; _chartType = ChartType.LINE; _subDivisions = 16; _snapToTicks = false; _selectorFillColor = Color.WHITE; _selectorStrokeColor = Color.RED; _selectorSize = 10; _decimals = 2; _interactive = true; _tooltipTimeout = 2000; formatString = "%.2f"; strokePaths = new ArrayList<>(); clickHandler = e -> select(e); endOfTransformationHandler = e -> selectorTooltip.hide(); seriesListener = change -> { while (change.next()) { if (change.wasAdded()) { change.getAddedSubList().forEach(addedItem -> { final Series<X, Y> series = addedItem; // depends on control dependency: [if], data = [none] final Path strokePath = (Path) ((Group) series.getNode()).getChildren().get(1); final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0); fillPath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); // depends on control dependency: [if], data = [none] strokePath.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); // depends on control dependency: [if], data = [none] strokePaths.add(strokePath); // depends on control dependency: [if], data = [none] series.getData().forEach(data -> data.YValueProperty().addListener(o -> layoutPlotChildren())); // depends on control dependency: [if], data = [none] }); } else if (change.wasRemoved()) { change.getRemoved().forEach(removedItem -> { final Series<X, Y> series = removedItem; final Path strokePath = (Path) ((Group) series.getNode()).getChildren().get(1); final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0); fillPath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePath.removeEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); strokePaths.remove(strokePath); }); } } }; // Add selector to chart selector = new Circle(); selector.setFill(_selectorFillColor); selector.setStroke(_selectorStrokeColor); selector.setOpacity(0); selectorTooltip = new Tooltip(""); Tooltip.install(selector, selectorTooltip); FadeTransition fadeIn = new FadeTransition(Duration.millis(100), selector); fadeIn.setFromValue(0); fadeIn.setToValue(1); timeBeforeFadeOut = new PauseTransition(Duration.millis(_tooltipTimeout)); FadeTransition fadeOut = new FadeTransition(Duration.millis(100), selector); fadeOut.setFromValue(1); fadeOut.setToValue(0); fadeInFadeOut = new SequentialTransition(fadeIn, timeBeforeFadeOut, fadeOut); fadeInFadeOut.setOnFinished(endOfTransformationHandler); chartPlotBackground = getChartPlotBackground(); chartPlotBackground.widthProperty().addListener(o -> resizeSelector()); chartPlotBackground.heightProperty().addListener(o -> resizeSelector()); chartPlotBackground.layoutYProperty().addListener(o -> resizeSelector()); Path horizontalGridLines = getHorizontalGridLines(); if (null != horizontalGridLines) { horizontalGridLines.setMouseTransparent(true); } Path verticalGridLines = getVerticalGridLines(); if (null != verticalGridLines) { verticalGridLines.setMouseTransparent(true); } getChartChildren().addAll(selector); } }
public class class_name { public String format( boolean removeUnsetTokens ) { // template should already have been parsed with a call to if ( !_isParsed ) { // Parse the template into tokens and literals parseTemplate(); } InternalStringBuilder result = new InternalStringBuilder( _template.length() + 16 ); for ( java.util.Iterator ii = _parsedTemplate.iterator(); ii.hasNext(); ) { TemplateItem item = ( TemplateItem ) ii.next(); if ( item.isToken() ) { if ( _tokenValuesMap.containsKey( item.getValue() ) ) { appendToResult( result, ( String ) _tokenValuesMap.get( item.getValue() ) ); } else { // No value for the token. if ( !removeUnsetTokens ) { // treat the token as a literal appendToResult( result, item.getValue() ); } } } else { appendToResult( result, item.getValue() ); } } if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '?' ) { result.deleteCharAt( result.length() - 1 ); } return result.toString(); } }
public class class_name { public String format( boolean removeUnsetTokens ) { // template should already have been parsed with a call to if ( !_isParsed ) { // Parse the template into tokens and literals parseTemplate(); // depends on control dependency: [if], data = [none] } InternalStringBuilder result = new InternalStringBuilder( _template.length() + 16 ); for ( java.util.Iterator ii = _parsedTemplate.iterator(); ii.hasNext(); ) { TemplateItem item = ( TemplateItem ) ii.next(); if ( item.isToken() ) { if ( _tokenValuesMap.containsKey( item.getValue() ) ) { appendToResult( result, ( String ) _tokenValuesMap.get( item.getValue() ) ); // depends on control dependency: [if], data = [none] } else { // No value for the token. if ( !removeUnsetTokens ) { // treat the token as a literal appendToResult( result, item.getValue() ); // depends on control dependency: [if], data = [none] } } } else { appendToResult( result, item.getValue() ); // depends on control dependency: [if], data = [none] } } if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '?' ) { result.deleteCharAt( result.length() - 1 ); // depends on control dependency: [if], data = [none] } return result.toString(); } }
public class class_name { private void throttledTransfer(MockResponse policy, Socket socket, BufferedSource source, BufferedSink sink, long byteCount, boolean isRequest) throws IOException { if (byteCount == 0) return; Buffer buffer = new Buffer(); long bytesPerPeriod = policy.getThrottleBytesPerPeriod(); long periodDelayMs = policy.getThrottlePeriod(TimeUnit.MILLISECONDS); long halfByteCount = byteCount / 2; boolean disconnectHalfway = isRequest ? policy.getSocketPolicy() == DISCONNECT_DURING_REQUEST_BODY : policy.getSocketPolicy() == DISCONNECT_DURING_RESPONSE_BODY; while (!socket.isClosed()) { for (long b = 0; b < bytesPerPeriod; ) { // Ensure we do not read past the allotted bytes in this period. long toRead = Math.min(byteCount, bytesPerPeriod - b); // Ensure we do not read past halfway if the policy will kill the connection. if (disconnectHalfway) { toRead = Math.min(toRead, byteCount - halfByteCount); } long read = source.read(buffer, toRead); if (read == -1) return; sink.write(buffer, read); sink.flush(); b += read; byteCount -= read; if (disconnectHalfway && byteCount == halfByteCount) { socket.close(); return; } if (byteCount == 0) return; } if (periodDelayMs != 0) { try { Thread.sleep(periodDelayMs); } catch (InterruptedException e) { throw new AssertionError(e); } } } } }
public class class_name { private void throttledTransfer(MockResponse policy, Socket socket, BufferedSource source, BufferedSink sink, long byteCount, boolean isRequest) throws IOException { if (byteCount == 0) return; Buffer buffer = new Buffer(); long bytesPerPeriod = policy.getThrottleBytesPerPeriod(); long periodDelayMs = policy.getThrottlePeriod(TimeUnit.MILLISECONDS); long halfByteCount = byteCount / 2; boolean disconnectHalfway = isRequest ? policy.getSocketPolicy() == DISCONNECT_DURING_REQUEST_BODY : policy.getSocketPolicy() == DISCONNECT_DURING_RESPONSE_BODY; while (!socket.isClosed()) { for (long b = 0; b < bytesPerPeriod; ) { // Ensure we do not read past the allotted bytes in this period. long toRead = Math.min(byteCount, bytesPerPeriod - b); // Ensure we do not read past halfway if the policy will kill the connection. if (disconnectHalfway) { toRead = Math.min(toRead, byteCount - halfByteCount); // depends on control dependency: [if], data = [none] } long read = source.read(buffer, toRead); if (read == -1) return; sink.write(buffer, read); sink.flush(); b += read; byteCount -= read; if (disconnectHalfway && byteCount == halfByteCount) { socket.close(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (byteCount == 0) return; } if (periodDelayMs != 0) { try { Thread.sleep(periodDelayMs); } catch (InterruptedException e) { throw new AssertionError(e); } } } } }
public class class_name { public static void translateAllPositive(IAtomContainer atomCon) { double minX = Double.MAX_VALUE; double minY = Double.MAX_VALUE; Iterator<IAtom> atoms = atomCon.atoms().iterator(); while (atoms.hasNext()) { IAtom atom = (IAtom) atoms.next(); if (atom.getPoint2d() != null) { if (atom.getPoint2d().x < minX) { minX = atom.getPoint2d().x; } if (atom.getPoint2d().y < minY) { minY = atom.getPoint2d().y; } } } logger.debug("Translating: minx=" + minX + ", minY=" + minY); translate2D(atomCon, minX * -1, minY * -1); } }
public class class_name { public static void translateAllPositive(IAtomContainer atomCon) { double minX = Double.MAX_VALUE; double minY = Double.MAX_VALUE; Iterator<IAtom> atoms = atomCon.atoms().iterator(); while (atoms.hasNext()) { IAtom atom = (IAtom) atoms.next(); if (atom.getPoint2d() != null) { if (atom.getPoint2d().x < minX) { minX = atom.getPoint2d().x; // depends on control dependency: [if], data = [none] } if (atom.getPoint2d().y < minY) { minY = atom.getPoint2d().y; // depends on control dependency: [if], data = [none] } } } logger.debug("Translating: minx=" + minX + ", minY=" + minY); translate2D(atomCon, minX * -1, minY * -1); } }
public class class_name { public String formatAsString(boolean reverse) { BasicBlock source = getSource(); BasicBlock target = getTarget(); StringBuilder buf = new StringBuilder(); buf.append(reverse ? "REVERSE_EDGE(" : "EDGE("); buf.append(getLabel()); buf.append(") type "); buf.append(edgeTypeToString(type)); buf.append(" from block "); buf.append(reverse ? target.getLabel() : source.getLabel()); buf.append(" to block "); buf.append(reverse ? source.getLabel() : target.getLabel()); InstructionHandle sourceInstruction = source.getLastInstruction(); InstructionHandle targetInstruction = target.getFirstInstruction(); String exInfo = " -> "; if (targetInstruction == null && target.isExceptionThrower()) { targetInstruction = target.getExceptionThrower(); exInfo = " => "; } if (sourceInstruction != null && targetInstruction != null) { buf.append(" [bytecode "); buf.append(sourceInstruction.getPosition()); buf.append(exInfo); buf.append(targetInstruction.getPosition()); buf.append(']'); } else if (source.isExceptionThrower()) { if (type == FALL_THROUGH_EDGE) { buf.append(" [successful check]"); } else { buf.append(" [failed check for "); buf.append(source.getExceptionThrower().getPosition()); if (targetInstruction != null) { buf.append(" to "); buf.append(targetInstruction.getPosition()); } buf.append(']'); } } return buf.toString(); } }
public class class_name { public String formatAsString(boolean reverse) { BasicBlock source = getSource(); BasicBlock target = getTarget(); StringBuilder buf = new StringBuilder(); buf.append(reverse ? "REVERSE_EDGE(" : "EDGE("); buf.append(getLabel()); buf.append(") type "); buf.append(edgeTypeToString(type)); buf.append(" from block "); buf.append(reverse ? target.getLabel() : source.getLabel()); buf.append(" to block "); buf.append(reverse ? source.getLabel() : target.getLabel()); InstructionHandle sourceInstruction = source.getLastInstruction(); InstructionHandle targetInstruction = target.getFirstInstruction(); String exInfo = " -> "; if (targetInstruction == null && target.isExceptionThrower()) { targetInstruction = target.getExceptionThrower(); // depends on control dependency: [if], data = [none] exInfo = " => "; // depends on control dependency: [if], data = [none] } if (sourceInstruction != null && targetInstruction != null) { buf.append(" [bytecode "); // depends on control dependency: [if], data = [none] buf.append(sourceInstruction.getPosition()); // depends on control dependency: [if], data = [(sourceInstruction] buf.append(exInfo); // depends on control dependency: [if], data = [none] buf.append(targetInstruction.getPosition()); // depends on control dependency: [if], data = [none] buf.append(']'); // depends on control dependency: [if], data = [none] } else if (source.isExceptionThrower()) { if (type == FALL_THROUGH_EDGE) { buf.append(" [successful check]"); // depends on control dependency: [if], data = [none] } else { buf.append(" [failed check for "); // depends on control dependency: [if], data = [none] buf.append(source.getExceptionThrower().getPosition()); // depends on control dependency: [if], data = [none] if (targetInstruction != null) { buf.append(" to "); // depends on control dependency: [if], data = [none] buf.append(targetInstruction.getPosition()); // depends on control dependency: [if], data = [(targetInstruction] } buf.append(']'); // depends on control dependency: [if], data = [none] } } return buf.toString(); } }
public class class_name { public void dispatchEvent(IEvent event) { if (event instanceof IRTMPEvent && !closed.get()) { switch (event.getType()) { case STREAM_CONTROL: case STREAM_DATA: // create the event IRTMPEvent rtmpEvent; try { rtmpEvent = (IRTMPEvent) event; } catch (ClassCastException e) { log.error("Class cast exception in event dispatch", e); return; } int eventTime = rtmpEvent.getTimestamp(); // verify and / or set source type if (rtmpEvent.getSourceType() != Constants.SOURCE_TYPE_LIVE) { rtmpEvent.setSourceType(Constants.SOURCE_TYPE_LIVE); } /* if (log.isTraceEnabled()) { // If this is first packet save its timestamp; expect it is // absolute? no matter: it's never used! if (firstPacketTime == -1) { firstPacketTime = rtmpEvent.getTimestamp(); log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d", System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime)); } else { log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d timestamp=%d", System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime, eventTime)); } } */ //get the buffer only once per call IoBuffer buf = null; if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData<?>) rtmpEvent).getData()) != null) { bytesReceived += buf.limit(); } // get stream codec IStreamCodecInfo codecInfo = getCodecInfo(); StreamCodecInfo info = null; if (codecInfo instanceof StreamCodecInfo) { info = (StreamCodecInfo) codecInfo; } //log.trace("Stream codec info: {}", info); if (rtmpEvent instanceof AudioData) { //log.trace("Audio: {}", eventTime); IAudioStreamCodec audioStreamCodec = null; if (checkAudioCodec) { // dont try to read codec info from 0 length audio packets if (buf.limit() > 0) { audioStreamCodec = AudioCodecFactory.getAudioCodec(buf); if (info != null) { info.setAudioCodec(audioStreamCodec); } checkAudioCodec = false; } } else if (codecInfo != null) { audioStreamCodec = codecInfo.getAudioCodec(); } if (audioStreamCodec != null) { audioStreamCodec.addData(buf); } if (info != null) { info.setHasAudio(true); } } else if (rtmpEvent instanceof VideoData) { //log.trace("Video: {}", eventTime); IVideoStreamCodec videoStreamCodec = null; if (checkVideoCodec) { videoStreamCodec = VideoCodecFactory.getVideoCodec(buf); if (info != null) { info.setVideoCodec(videoStreamCodec); } checkVideoCodec = false; } else if (codecInfo != null) { videoStreamCodec = codecInfo.getVideoCodec(); } if (videoStreamCodec != null) { videoStreamCodec.addData(buf, eventTime); } if (info != null) { info.setHasVideo(true); } } else if (rtmpEvent instanceof Invoke) { //Invoke invokeEvent = (Invoke) rtmpEvent; //log.debug("Invoke action: {}", invokeEvent.getAction()); // event / stream listeners will not be notified of invokes return; } else if (rtmpEvent instanceof Notify) { Notify notifyEvent = (Notify) rtmpEvent; String action = notifyEvent.getAction(); //if (log.isDebugEnabled()) { //log.debug("Notify action: {}", action); //} if ("onMetaData".equals(action)) { // store the metadata try { //log.debug("Setting metadata"); setMetaData(notifyEvent.duplicate()); } catch (Exception e) { log.warn("Metadata could not be duplicated for this stream", e); } } } // update last event time if (eventTime > latestTimeStamp) { latestTimeStamp = eventTime; } // notify event listeners checkSendNotifications(event); // note this timestamp is set in event/body but not in the associated header try { // route to live if (livePipe != null) { // create new RTMP message, initialize it and push through pipe RTMPMessage msg = RTMPMessage.build(rtmpEvent, eventTime); livePipe.pushMessage(msg); } else if (log.isDebugEnabled()) { log.debug("Live pipe was null, message was not pushed"); } } catch (IOException err) { stop(); } // notify listeners about received packet if (rtmpEvent instanceof IStreamPacket) { for (IStreamListener listener : getStreamListeners()) { try { listener.packetReceived(this, (IStreamPacket) rtmpEvent); } catch (Exception e) { log.error("Error while notifying listener {}", listener, e); if (listener instanceof RecordingListener) { sendRecordFailedNotify(e.getMessage()); } } } } break; default: // ignored event //log.debug("Ignoring event: {}", event.getType()); } } else { log.debug("Event was of wrong type or stream is closed ({})", closed); } } }
public class class_name { public void dispatchEvent(IEvent event) { if (event instanceof IRTMPEvent && !closed.get()) { switch (event.getType()) { case STREAM_CONTROL: case STREAM_DATA: // create the event IRTMPEvent rtmpEvent; try { rtmpEvent = (IRTMPEvent) event; // depends on control dependency: [try], data = [none] } catch (ClassCastException e) { log.error("Class cast exception in event dispatch", e); return; } // depends on control dependency: [catch], data = [none] int eventTime = rtmpEvent.getTimestamp(); // verify and / or set source type if (rtmpEvent.getSourceType() != Constants.SOURCE_TYPE_LIVE) { rtmpEvent.setSourceType(Constants.SOURCE_TYPE_LIVE); // depends on control dependency: [if], data = [Constants.SOURCE_TYPE_LIVE)] } /* if (log.isTraceEnabled()) { // If this is first packet save its timestamp; expect it is // absolute? no matter: it's never used! if (firstPacketTime == -1) { firstPacketTime = rtmpEvent.getTimestamp(); log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d", System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime)); } else { log.trace(String.format("CBS=@%08x: rtmpEvent=%s creation=%s firstPacketTime=%d timestamp=%d", System.identityHashCode(this), rtmpEvent.getClass().getSimpleName(), creationTime, firstPacketTime, eventTime)); } } */ //get the buffer only once per call IoBuffer buf = null; if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData<?>) rtmpEvent).getData()) != null) { bytesReceived += buf.limit(); // depends on control dependency: [if], data = [none] } // get stream codec IStreamCodecInfo codecInfo = getCodecInfo(); StreamCodecInfo info = null; if (codecInfo instanceof StreamCodecInfo) { info = (StreamCodecInfo) codecInfo; // depends on control dependency: [if], data = [none] } //log.trace("Stream codec info: {}", info); if (rtmpEvent instanceof AudioData) { //log.trace("Audio: {}", eventTime); IAudioStreamCodec audioStreamCodec = null; if (checkAudioCodec) { // dont try to read codec info from 0 length audio packets if (buf.limit() > 0) { audioStreamCodec = AudioCodecFactory.getAudioCodec(buf); // depends on control dependency: [if], data = [none] if (info != null) { info.setAudioCodec(audioStreamCodec); // depends on control dependency: [if], data = [none] } checkAudioCodec = false; // depends on control dependency: [if], data = [none] } } else if (codecInfo != null) { audioStreamCodec = codecInfo.getAudioCodec(); // depends on control dependency: [if], data = [none] } if (audioStreamCodec != null) { audioStreamCodec.addData(buf); // depends on control dependency: [if], data = [none] } if (info != null) { info.setHasAudio(true); // depends on control dependency: [if], data = [none] } } else if (rtmpEvent instanceof VideoData) { //log.trace("Video: {}", eventTime); IVideoStreamCodec videoStreamCodec = null; if (checkVideoCodec) { videoStreamCodec = VideoCodecFactory.getVideoCodec(buf); // depends on control dependency: [if], data = [none] if (info != null) { info.setVideoCodec(videoStreamCodec); // depends on control dependency: [if], data = [none] } checkVideoCodec = false; // depends on control dependency: [if], data = [none] } else if (codecInfo != null) { videoStreamCodec = codecInfo.getVideoCodec(); // depends on control dependency: [if], data = [none] } if (videoStreamCodec != null) { videoStreamCodec.addData(buf, eventTime); // depends on control dependency: [if], data = [none] } if (info != null) { info.setHasVideo(true); // depends on control dependency: [if], data = [none] } } else if (rtmpEvent instanceof Invoke) { //Invoke invokeEvent = (Invoke) rtmpEvent; //log.debug("Invoke action: {}", invokeEvent.getAction()); // event / stream listeners will not be notified of invokes return; // depends on control dependency: [if], data = [none] } else if (rtmpEvent instanceof Notify) { Notify notifyEvent = (Notify) rtmpEvent; String action = notifyEvent.getAction(); //if (log.isDebugEnabled()) { //log.debug("Notify action: {}", action); //} if ("onMetaData".equals(action)) { // store the metadata try { //log.debug("Setting metadata"); setMetaData(notifyEvent.duplicate()); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn("Metadata could not be duplicated for this stream", e); } // depends on control dependency: [catch], data = [none] } } // update last event time if (eventTime > latestTimeStamp) { latestTimeStamp = eventTime; // depends on control dependency: [if], data = [none] } // notify event listeners checkSendNotifications(event); // note this timestamp is set in event/body but not in the associated header try { // route to live if (livePipe != null) { // create new RTMP message, initialize it and push through pipe RTMPMessage msg = RTMPMessage.build(rtmpEvent, eventTime); livePipe.pushMessage(msg); // depends on control dependency: [if], data = [none] } else if (log.isDebugEnabled()) { log.debug("Live pipe was null, message was not pushed"); // depends on control dependency: [if], data = [none] } } catch (IOException err) { stop(); } // depends on control dependency: [catch], data = [none] // notify listeners about received packet if (rtmpEvent instanceof IStreamPacket) { for (IStreamListener listener : getStreamListeners()) { try { listener.packetReceived(this, (IStreamPacket) rtmpEvent); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.error("Error while notifying listener {}", listener, e); if (listener instanceof RecordingListener) { sendRecordFailedNotify(e.getMessage()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } break; default: // ignored event //log.debug("Ignoring event: {}", event.getType()); } } else { log.debug("Event was of wrong type or stream is closed ({})", closed); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void addTo( JTabbedPane tabbedPane, String title, JComponent component, boolean confirmClose) { if (confirmClose) { addTo(tabbedPane, title, component, CloseCallbacks.confirming()); } else { addTo(tabbedPane, title, component, CloseCallbacks.alwaysTrue()); } } }
public class class_name { public static void addTo( JTabbedPane tabbedPane, String title, JComponent component, boolean confirmClose) { if (confirmClose) { addTo(tabbedPane, title, component, CloseCallbacks.confirming()); // depends on control dependency: [if], data = [none] } else { addTo(tabbedPane, title, component, CloseCallbacks.alwaysTrue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void alarm(Object alarmObj) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "alarm", alarmObj); // Has the async reader already sent a message back to the client? boolean sessionAvailable = true; if (!asynchReader.isComplete()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Async reader has not yet got a message"); // If not stop the session... try { try { asynchReader.stopSession(); } catch (SISessionDroppedException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a SISessionDroppedException", e); sessionAvailable = false; // If the session was unavailable this may be because the connection has been closed // while we were in a receiveWithWait(). In this case, we should try and send an error // back to the client, but not worry too much if we cannot if (asynchReader.isConversationClosed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The Conversation was closed - no need to panic"); } else { // The Conversation was not closed, throw the exception on so we can inform // the client throw e; } } catch (SISessionUnavailableException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a SISessionUnavailableException", e); sessionAvailable = false; // See the comments above... if (asynchReader.isConversationClosed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The Conversation was closed - no need to panic"); } else { throw e; } } } catch (SIException sis) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if(!asynchReader.hasMETerminated()) { FFDCFilter.processException(sis, CLASS_NAME + ".alarm", CommsConstants.CATTIMER_ALARM_01, this); } sessionAvailable = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, sis.getMessage(), sis); asynchReader.sendErrorToClient(sis, CommsConstants.CATTIMER_ALARM_01); } finally { //At this point we should deregister asyncReader as a SICoreConnectionListener as the current receive with wait is pretty much finished. //Note that there is a bit of a timing window where asyncReader.consumeMessages could be called and we end up deregistering //the listener twice but that is allowed by the API. We minimize this window by only doing a dereg if the asyncReader isn't complete. if(!asynchReader.isComplete()) { try { final MPConsumerSession mpSession = (MPConsumerSession) asynchReader.getCATMainConsumer().getConsumerSession(); mpSession.getConnection().removeConnectionListener(asynchReader); } catch(SIException e) { //No FFDC code needed if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); //No need to send an exception back to the client in this case as we are only really performing tidy up processing. //Also, if it is a really bad problem we are likely to have already send the exception back in the previous catch block. } } } } if (sessionAvailable) { // ...and check again. // If the async reader has still not sent a message at this point we // assume a timeout and inform the client if (asynchReader.isComplete()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Async reader got a message"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No message received"); asynchReader.sendNoMessageToClient(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "alarm"); } }
public class class_name { public void alarm(Object alarmObj) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "alarm", alarmObj); // Has the async reader already sent a message back to the client? boolean sessionAvailable = true; if (!asynchReader.isComplete()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Async reader has not yet got a message"); // If not stop the session... try { try { asynchReader.stopSession(); // depends on control dependency: [try], data = [none] } catch (SISessionDroppedException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a SISessionDroppedException", e); sessionAvailable = false; // If the session was unavailable this may be because the connection has been closed // while we were in a receiveWithWait(). In this case, we should try and send an error // back to the client, but not worry too much if we cannot if (asynchReader.isConversationClosed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The Conversation was closed - no need to panic"); } else { // The Conversation was not closed, throw the exception on so we can inform // the client throw e; } } // depends on control dependency: [catch], data = [none] catch (SISessionUnavailableException e) { // No FFDC Code Needed if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Caught a SISessionUnavailableException", e); sessionAvailable = false; // See the comments above... if (asynchReader.isConversationClosed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The Conversation was closed - no need to panic"); } else { throw e; } } // depends on control dependency: [catch], data = [none] } catch (SIException sis) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if(!asynchReader.hasMETerminated()) { FFDCFilter.processException(sis, CLASS_NAME + ".alarm", CommsConstants.CATTIMER_ALARM_01, this); // depends on control dependency: [if], data = [none] } sessionAvailable = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, sis.getMessage(), sis); asynchReader.sendErrorToClient(sis, CommsConstants.CATTIMER_ALARM_01); } // depends on control dependency: [catch], data = [none] finally { //At this point we should deregister asyncReader as a SICoreConnectionListener as the current receive with wait is pretty much finished. //Note that there is a bit of a timing window where asyncReader.consumeMessages could be called and we end up deregistering //the listener twice but that is allowed by the API. We minimize this window by only doing a dereg if the asyncReader isn't complete. if(!asynchReader.isComplete()) { try { final MPConsumerSession mpSession = (MPConsumerSession) asynchReader.getCATMainConsumer().getConsumerSession(); mpSession.getConnection().removeConnectionListener(asynchReader); // depends on control dependency: [try], data = [none] } catch(SIException e) { //No FFDC code needed if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); //No need to send an exception back to the client in this case as we are only really performing tidy up processing. //Also, if it is a really bad problem we are likely to have already send the exception back in the previous catch block. } // depends on control dependency: [catch], data = [none] } } } if (sessionAvailable) { // ...and check again. // If the async reader has still not sent a message at this point we // assume a timeout and inform the client if (asynchReader.isComplete()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Async reader got a message"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No message received"); asynchReader.sendNoMessageToClient(); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "alarm"); } }
public class class_name { public int rowSum(int classindex) { int s = 0; for(int i = 0; i < confusion[classindex].length; i++) { s += confusion[classindex][i]; } return s; } }
public class class_name { public int rowSum(int classindex) { int s = 0; for(int i = 0; i < confusion[classindex].length; i++) { s += confusion[classindex][i]; // depends on control dependency: [for], data = [i] } return s; } }
public class class_name { public static @SlashedClassName String trimSignature(String signature) { if ((signature != null) && signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && signature.endsWith(Values.SIG_QUALIFIED_CLASS_SUFFIX)) { return signature.substring(1, signature.length() - 1); } return signature; } }
public class class_name { public static @SlashedClassName String trimSignature(String signature) { if ((signature != null) && signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX) && signature.endsWith(Values.SIG_QUALIFIED_CLASS_SUFFIX)) { return signature.substring(1, signature.length() - 1); // depends on control dependency: [if], data = [none] } return signature; } }
public class class_name { private Send handle(SelectionKey key, Receive request) { final short requestTypeId = request.buffer().getShort(); final RequestKeys requestType = RequestKeys.valueOf(requestTypeId); if (requestLogger.isTraceEnabled()) { if (requestType == null) { throw new InvalidRequestException("No mapping found for handler id " + requestTypeId); } String logFormat = "Handling %s request from %s"; requestLogger.trace(format(logFormat, requestType, channelFor(key).socket().getRemoteSocketAddress())); } RequestHandler handlerMapping = requesthandlerFactory.mapping(requestType, request); if (handlerMapping == null) { throw new InvalidRequestException("No handler found for request"); } long start = System.nanoTime(); Send maybeSend = handlerMapping.handler(requestType, request); stats.recordRequest(requestType, System.nanoTime() - start); return maybeSend; } }
public class class_name { private Send handle(SelectionKey key, Receive request) { final short requestTypeId = request.buffer().getShort(); final RequestKeys requestType = RequestKeys.valueOf(requestTypeId); if (requestLogger.isTraceEnabled()) { if (requestType == null) { throw new InvalidRequestException("No mapping found for handler id " + requestTypeId); } String logFormat = "Handling %s request from %s"; requestLogger.trace(format(logFormat, requestType, channelFor(key).socket().getRemoteSocketAddress())); // depends on control dependency: [if], data = [none] } RequestHandler handlerMapping = requesthandlerFactory.mapping(requestType, request); if (handlerMapping == null) { throw new InvalidRequestException("No handler found for request"); } long start = System.nanoTime(); Send maybeSend = handlerMapping.handler(requestType, request); stats.recordRequest(requestType, System.nanoTime() - start); return maybeSend; } }
public class class_name { public static boolean isFindKeyOnly(EntityMetadata metadata, List<Map<String, Object>> colToOutput) { if (colToOutput != null && colToOutput.size() == 1) { String idCol = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(); return idCol.equals(colToOutput.get(0).get(Constants.DB_COL_NAME)) && !(boolean) colToOutput.get(0).get(Constants.IS_EMBEDDABLE); } else { return false; } } }
public class class_name { public static boolean isFindKeyOnly(EntityMetadata metadata, List<Map<String, Object>> colToOutput) { if (colToOutput != null && colToOutput.size() == 1) { String idCol = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(); return idCol.equals(colToOutput.get(0).get(Constants.DB_COL_NAME)) && !(boolean) colToOutput.get(0).get(Constants.IS_EMBEDDABLE); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static boolean checkPlayServices(OrtcClient ortcClient) { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(ortcClient.appContext); if (resultCode != ConnectionResult.SUCCESS) { /* if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, (Activity) ortcClient.appContext, PLAY_SERVICES_RESOLUTION_REQUEST).show(); } else { ortcClient.raiseOrtcEvent(EventEnum.OnException, ortcClient, new OrtcGcmException("The device is not supported!")); }*/ return false; } return true; } }
public class class_name { private static boolean checkPlayServices(OrtcClient ortcClient) { int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(ortcClient.appContext); if (resultCode != ConnectionResult.SUCCESS) { /* if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) { GooglePlayServicesUtil.getErrorDialog(resultCode, (Activity) ortcClient.appContext, PLAY_SERVICES_RESOLUTION_REQUEST).show(); } else { ortcClient.raiseOrtcEvent(EventEnum.OnException, ortcClient, new OrtcGcmException("The device is not supported!")); }*/ return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { @Override public int compareTo(final KafkaMessageId id) { // instance is always > null if (id == null) { return 1; } // use signum to perform the comparison, mark _partition more significant than _offset return 2 * Integer.signum(_partition - id.getPartition()) + Long.signum(_offset - id.getOffset()); } }
public class class_name { @Override public int compareTo(final KafkaMessageId id) { // instance is always > null if (id == null) { return 1; // depends on control dependency: [if], data = [none] } // use signum to perform the comparison, mark _partition more significant than _offset return 2 * Integer.signum(_partition - id.getPartition()) + Long.signum(_offset - id.getOffset()); } }
public class class_name { @Override public boolean add(final T element) { requireNonNull(element); boolean updated = false; final Iterator<T> iterator = _population.iterator(); while (iterator.hasNext()) { final T existing = iterator.next(); int cmp = _dominance.compare(element, existing); if (cmp > 0) { iterator.remove(); updated = true; } else if (cmp < 0 || element.equals(existing)) { return updated; } } _population.add(element); return true; } }
public class class_name { @Override public boolean add(final T element) { requireNonNull(element); boolean updated = false; final Iterator<T> iterator = _population.iterator(); while (iterator.hasNext()) { final T existing = iterator.next(); int cmp = _dominance.compare(element, existing); if (cmp > 0) { iterator.remove(); // depends on control dependency: [if], data = [none] updated = true; // depends on control dependency: [if], data = [none] } else if (cmp < 0 || element.equals(existing)) { return updated; // depends on control dependency: [if], data = [none] } } _population.add(element); return true; } }
public class class_name { private final K getRoundKey(final K key, final boolean upORdown, final boolean acceptEqual) { final TreeEntry<K, V> entry = getRoundEntry(key, upORdown, acceptEqual); if (entry == null) { return null; } return entry.getKey(); } }
public class class_name { private final K getRoundKey(final K key, final boolean upORdown, final boolean acceptEqual) { final TreeEntry<K, V> entry = getRoundEntry(key, upORdown, acceptEqual); if (entry == null) { return null; // depends on control dependency: [if], data = [none] } return entry.getKey(); } }
public class class_name { public void setBase(String base) { if (base != null) { this.base = LdapUtils.newLdapName(base); } else { this.base = LdapUtils.emptyLdapName(); } } }
public class class_name { public void setBase(String base) { if (base != null) { this.base = LdapUtils.newLdapName(base); // depends on control dependency: [if], data = [(base] } else { this.base = LdapUtils.emptyLdapName(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private SequenceType parseSequenceType() { if (is("empty-sequence", true)) { consume(TokenType.OPEN_BR, true); consume(TokenType.CLOSE_BR, true); return new SequenceType(); } else { final AbsFilter filter = parseItemType(); if (isWildcard()) { final char wildcard = parseOccuranceIndicator(); return new SequenceType(filter, wildcard); } return new SequenceType(filter); } } }
public class class_name { private SequenceType parseSequenceType() { if (is("empty-sequence", true)) { consume(TokenType.OPEN_BR, true); // depends on control dependency: [if], data = [none] consume(TokenType.CLOSE_BR, true); // depends on control dependency: [if], data = [none] return new SequenceType(); // depends on control dependency: [if], data = [none] } else { final AbsFilter filter = parseItemType(); if (isWildcard()) { final char wildcard = parseOccuranceIndicator(); return new SequenceType(filter, wildcard); // depends on control dependency: [if], data = [none] } return new SequenceType(filter); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static ModuleMetaData getModuleMetaData() { ComponentMetaData cmd = getComponentMetaData(); ModuleMetaData mmd = null; if (cmd != null) { mmd = cmd.getModuleMetaData(); } if (tc.isDebugEnabled()) { Tr.debug(tc, "ModuleMetaData object is " + (mmd != null ? mmd.toString() : "null!")); } return mmd; } }
public class class_name { public static ModuleMetaData getModuleMetaData() { ComponentMetaData cmd = getComponentMetaData(); ModuleMetaData mmd = null; if (cmd != null) { mmd = cmd.getModuleMetaData(); // depends on control dependency: [if], data = [none] } if (tc.isDebugEnabled()) { Tr.debug(tc, "ModuleMetaData object is " + (mmd != null ? mmd.toString() : "null!")); // depends on control dependency: [if], data = [none] } return mmd; } }
public class class_name { public void setValues(java.util.Collection<Value> values) { if (values == null) { this.values = null; return; } this.values = new java.util.ArrayList<Value>(values); } }
public class class_name { public void setValues(java.util.Collection<Value> values) { if (values == null) { this.values = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.values = new java.util.ArrayList<Value>(values); } }
public class class_name { protected MessageEndpoint createEndpoint() throws ResourceException { final String methodName = "createEndpoint"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } // Ensure that in non-WAS environments the activation spec used to create // the current connection specified a specific messaging engine. This is // required so that we always connect to the same messaging engine when // using the same activation specification to permit transaction recovery. //chetan liberty change : //getTarget() check is removed since in liberty we have 1 ME per liberty profile if ((_endpointConfiguration.getTargetSignificance().equals(SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED)) && (_endpointConfiguration.getTargetType().equals(SibTrmConstants.TARGET_TYPE_ME))) { _sibXaResource = new SibRaXaResource (getXaResource()); } else { String p0; // Connection property name String p1; // Required connection property value if (!_endpointConfiguration.getTargetSignificance().equals(SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED)) { p0 = SibTrmConstants.TARGET_SIGNIFICANCE; p1 = SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED; } else if (!_endpointConfiguration.getTargetType().equals(SibTrmConstants.TARGET_TYPE_ME)) { p0 = SibTrmConstants.TARGET_TYPE; p1 = SibTrmConstants.TARGET_TYPE_ME; } else { p0 = SibTrmConstants.TARGET_GROUP; p1 = "!null"; } SibTr.error(TRACE, "ME_NAME_REQUIRED_CWSIV0652",new Object[] {p0,p1}); throw new NotSupportedException(NLS.getFormattedMessage("ME_NAME_REQUIRED_CWSIV0652", new Object[] {p0,p1}, null)); } final MessageEndpoint endpoint = _endpointFactory .createEndpoint(_sibXaResource); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, endpoint); } return endpoint; } }
public class class_name { protected MessageEndpoint createEndpoint() throws ResourceException { final String methodName = "createEndpoint"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } // Ensure that in non-WAS environments the activation spec used to create // the current connection specified a specific messaging engine. This is // required so that we always connect to the same messaging engine when // using the same activation specification to permit transaction recovery. //chetan liberty change : //getTarget() check is removed since in liberty we have 1 ME per liberty profile if ((_endpointConfiguration.getTargetSignificance().equals(SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED)) && (_endpointConfiguration.getTargetType().equals(SibTrmConstants.TARGET_TYPE_ME))) { _sibXaResource = new SibRaXaResource (getXaResource()); } else { String p0; // Connection property name String p1; // Required connection property value if (!_endpointConfiguration.getTargetSignificance().equals(SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED)) { p0 = SibTrmConstants.TARGET_SIGNIFICANCE; // depends on control dependency: [if], data = [none] p1 = SibTrmConstants.TARGET_SIGNIFICANCE_REQUIRED; // depends on control dependency: [if], data = [none] } else if (!_endpointConfiguration.getTargetType().equals(SibTrmConstants.TARGET_TYPE_ME)) { p0 = SibTrmConstants.TARGET_TYPE; // depends on control dependency: [if], data = [none] p1 = SibTrmConstants.TARGET_TYPE_ME; // depends on control dependency: [if], data = [none] } else { p0 = SibTrmConstants.TARGET_GROUP; // depends on control dependency: [if], data = [none] p1 = "!null"; // depends on control dependency: [if], data = [none] } SibTr.error(TRACE, "ME_NAME_REQUIRED_CWSIV0652",new Object[] {p0,p1}); throw new NotSupportedException(NLS.getFormattedMessage("ME_NAME_REQUIRED_CWSIV0652", new Object[] {p0,p1}, null)); } final MessageEndpoint endpoint = _endpointFactory .createEndpoint(_sibXaResource); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, endpoint); } return endpoint; } }
public class class_name { private int indexOfFused(int start, BitSet cycle) { for (int i = start; i < cycles.size(); i++) { if (and(cycles.get(i), cycle).cardinality() > 1) { return i; } } return -1; } }
public class class_name { private int indexOfFused(int start, BitSet cycle) { for (int i = start; i < cycles.size(); i++) { if (and(cycles.get(i), cycle).cardinality() > 1) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { @SafeVarargs @Nonnull public static <I> Word<I> fromSymbols(I... symbols) { if (symbols.length == 0) { return epsilon(); } if (symbols.length == 1) { return fromLetter(symbols[0]); } return new SharedWord<>(symbols.clone()); } }
public class class_name { @SafeVarargs @Nonnull public static <I> Word<I> fromSymbols(I... symbols) { if (symbols.length == 0) { return epsilon(); // depends on control dependency: [if], data = [none] } if (symbols.length == 1) { return fromLetter(symbols[0]); // depends on control dependency: [if], data = [none] } return new SharedWord<>(symbols.clone()); } }
public class class_name { @Override void onPause() { if (impl != null) { // note our current play position if (impl.isPlaying()) { position = impl.getCurrentPosition(); } // release our media player and reset ourselves to the unloaded state impl.release(); impl = null; } } }
public class class_name { @Override void onPause() { if (impl != null) { // note our current play position if (impl.isPlaying()) { position = impl.getCurrentPosition(); // depends on control dependency: [if], data = [none] } // release our media player and reset ourselves to the unloaded state impl.release(); // depends on control dependency: [if], data = [none] impl = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String removeResponseBaggage(String key) { if (BAGGAGE_ENABLE && key != null) { return responseBaggage.remove(key); } return null; } }
public class class_name { public String removeResponseBaggage(String key) { if (BAGGAGE_ENABLE && key != null) { return responseBaggage.remove(key); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public <E> List<E> getForeignKeysFromJoinTable(String schemaName, String joinTableName, Object rowKey, String inverseJoinColumnName) { List<E> foreignKeys = new ArrayList<E>(); Table hTable = null; String tableName = HBaseUtils.getHTableName(schemaName, joinTableName); try { hTable = gethTable(tableName); List<HBaseDataWrapper> results = hbaseReader.loadData(hTable, rowKey, null, null, joinTableName, getFilter(joinTableName), null); if (results != null && !results.isEmpty()) { HBaseDataWrapper data = results.get(0); Map<String, byte[]> hbaseValues = data.getColumns(); Set<String> columnNames = hbaseValues.keySet(); for (String columnName : columnNames) { if (columnName.startsWith(HBaseUtils.getColumnDataKey(joinTableName, inverseJoinColumnName))) { byte[] columnValue = data.getColumnValue(columnName); String hbaseColumnValue = Bytes.toString(columnValue); foreignKeys.add((E) hbaseColumnValue); } } } } catch (IOException e) { return foreignKeys; } finally { try { if (hTable != null) { closeHTable(hTable); } } catch (IOException e) { logger.error("Error in closing hTable, caused by: ", e); } } return foreignKeys; } }
public class class_name { @Override public <E> List<E> getForeignKeysFromJoinTable(String schemaName, String joinTableName, Object rowKey, String inverseJoinColumnName) { List<E> foreignKeys = new ArrayList<E>(); Table hTable = null; String tableName = HBaseUtils.getHTableName(schemaName, joinTableName); try { hTable = gethTable(tableName); // depends on control dependency: [try], data = [none] List<HBaseDataWrapper> results = hbaseReader.loadData(hTable, rowKey, null, null, joinTableName, getFilter(joinTableName), null); if (results != null && !results.isEmpty()) { HBaseDataWrapper data = results.get(0); Map<String, byte[]> hbaseValues = data.getColumns(); Set<String> columnNames = hbaseValues.keySet(); for (String columnName : columnNames) { if (columnName.startsWith(HBaseUtils.getColumnDataKey(joinTableName, inverseJoinColumnName))) { byte[] columnValue = data.getColumnValue(columnName); String hbaseColumnValue = Bytes.toString(columnValue); foreignKeys.add((E) hbaseColumnValue); // depends on control dependency: [if], data = [none] } } } } catch (IOException e) { return foreignKeys; } // depends on control dependency: [catch], data = [none] finally { try { if (hTable != null) { closeHTable(hTable); // depends on control dependency: [if], data = [(hTable] } } catch (IOException e) { logger.error("Error in closing hTable, caused by: ", e); } // depends on control dependency: [catch], data = [none] } return foreignKeys; } }
public class class_name { @Override public String[] getFormats() { final String[] formats = new String[Format.values().length]; int i = 0; for (final Format format : Format.values()) { formats[i++] = format.name(); } return formats; } }
public class class_name { @Override public String[] getFormats() { final String[] formats = new String[Format.values().length]; int i = 0; for (final Format format : Format.values()) { formats[i++] = format.name(); // depends on control dependency: [for], data = [format] } return formats; } }
public class class_name { protected void addGetParam(String paramKey, String paramValue) { try { params_.put(paramKey, paramValue); } catch (JSONException ignore) { } } }
public class class_name { protected void addGetParam(String paramKey, String paramValue) { try { params_.put(paramKey, paramValue); // depends on control dependency: [try], data = [none] } catch (JSONException ignore) { } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Object updateBufferedListModel(final Object wrappedCollection) { if (bufferedListModel == null) { bufferedListModel = createBufferedListModel(); bufferedListModel.addListDataListener(listChangeHandler); setValue(bufferedListModel); } if (wrappedCollection == null) { bufferedListModel.clear(); } else { if (wrappedType.isAssignableFrom(wrappedCollection.getClass())) { Collection buffer = null; if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; buffer = Arrays.asList(wrappedArray); } else { buffer = (Collection)wrappedCollection; } bufferedListModel.clear(); bufferedListModel.addAll(prepareBackingCollection(buffer)); } else { throw new IllegalArgumentException("wrappedCollection must be assignable from " + wrappedType.getName()); } } return bufferedListModel; } }
public class class_name { private Object updateBufferedListModel(final Object wrappedCollection) { if (bufferedListModel == null) { bufferedListModel = createBufferedListModel(); // depends on control dependency: [if], data = [none] bufferedListModel.addListDataListener(listChangeHandler); // depends on control dependency: [if], data = [none] setValue(bufferedListModel); // depends on control dependency: [if], data = [(bufferedListModel] } if (wrappedCollection == null) { bufferedListModel.clear(); // depends on control dependency: [if], data = [none] } else { if (wrappedType.isAssignableFrom(wrappedCollection.getClass())) { Collection buffer = null; if (wrappedCollection instanceof Object[]) { Object[] wrappedArray = (Object[])wrappedCollection; buffer = Arrays.asList(wrappedArray); // depends on control dependency: [if], data = [none] } else { buffer = (Collection)wrappedCollection; // depends on control dependency: [if], data = [none] } bufferedListModel.clear(); // depends on control dependency: [if], data = [none] bufferedListModel.addAll(prepareBackingCollection(buffer)); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("wrappedCollection must be assignable from " + wrappedType.getName()); } } return bufferedListModel; } }
public class class_name { protected AnnotationElement parseAnnotationTypeElementDoc(AnnotationTypeElementDoc annotationTypeElementDoc) { AnnotationElement annotationElementNode = objectFactory.createAnnotationElement(); annotationElementNode.setName(annotationTypeElementDoc.name()); annotationElementNode.setQualified(annotationTypeElementDoc.qualifiedName()); annotationElementNode.setType(parseTypeInfo(annotationTypeElementDoc.returnType())); AnnotationValue value = annotationTypeElementDoc.defaultValue(); if (value != null) { annotationElementNode.setDefault(value.toString()); } return annotationElementNode; } }
public class class_name { protected AnnotationElement parseAnnotationTypeElementDoc(AnnotationTypeElementDoc annotationTypeElementDoc) { AnnotationElement annotationElementNode = objectFactory.createAnnotationElement(); annotationElementNode.setName(annotationTypeElementDoc.name()); annotationElementNode.setQualified(annotationTypeElementDoc.qualifiedName()); annotationElementNode.setType(parseTypeInfo(annotationTypeElementDoc.returnType())); AnnotationValue value = annotationTypeElementDoc.defaultValue(); if (value != null) { annotationElementNode.setDefault(value.toString()); // depends on control dependency: [if], data = [(value] } return annotationElementNode; } }
public class class_name { Object getValue( MatchSpaceKey msg, Object contextValue) throws MatchingException, BadMessageFormatMatchingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry( cclass, "getValue", "msg: " + msg + "contextValue: " + contextValue); // The value which we'll return SetValEvaluationContext xpEval = null; // May need to call MFP multiple times, if our context has multiple nodes if(contextValue != null) { // Currently this must be a list of nodes if (contextValue instanceof SetValEvaluationContext) { SetValEvaluationContext evalContext = (SetValEvaluationContext)contextValue; // Get the node list ArrayList wrappedParentList = evalContext.getWrappedNodeList(); // If the list is empty, then we have yet to get the document root if(wrappedParentList.isEmpty()) { //Set up a root (document) context for evaluation Object docRoot = Matching.getEvaluator().getDocumentRoot(msg); // Create an object to hold the wrapped node WrappedNodeResults wrapper = new WrappedNodeResults(docRoot); // Set the root into the evaluation context evalContext.addNode(wrapper); } // Iterate over the nodes Iterator iter = wrappedParentList.iterator(); while(iter.hasNext()) { WrappedNodeResults nextWrappedParentNode = (WrappedNodeResults)iter.next(); Object nextParentNode = nextWrappedParentNode.getNode(); String debugString = ""; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "getValue", "Evaluation context node: " + nextWrappedParentNode); // If no cached value we'll need to call MFP ArrayList numberList = nextWrappedParentNode.getEvalNumberResult(id.getName()); if(numberList == null) { // Call MFP to get the results for this node ArrayList childNodeList = (ArrayList) msg.getIdentifierValue(id, false, nextParentNode, true); // true means return a nodelist // Process the retrieved nodes to get a list of Numbers numberList = Matching.getEvaluator().castToNumberList(childNodeList); // Add result to cache for next time nextWrappedParentNode.addEvalNumberResult(id.getName(), numberList); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugString = "Result from MFP "; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugString = "Result from Cache "; } // Useful debug if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String asString = ", type: Numeric - <"; if(numberList == null) { asString = asString + "null"; } else { Iterator iterDebug = numberList.iterator(); boolean first = true; while(iterDebug.hasNext()) { Number num = (Number)iterDebug.next(); if(!first) asString = asString + "," + num; else { asString = asString + num; first = false; } } } asString = asString + ">"; tc.debug(this,cclass, "getValue", debugString + "for identifier " + id.getName() + asString); } // Build the return value as an XPathEvaluationContext if(xpEval == null) xpEval = new SetValEvaluationContext(); // Add the wrapped node to the evaluation context xpEval.addNode(nextWrappedParentNode); } // eof while } // eof instanceof XPathEvaluationContext } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "getValue", xpEval); return xpEval; } }
public class class_name { Object getValue( MatchSpaceKey msg, Object contextValue) throws MatchingException, BadMessageFormatMatchingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry( cclass, "getValue", "msg: " + msg + "contextValue: " + contextValue); // The value which we'll return SetValEvaluationContext xpEval = null; // May need to call MFP multiple times, if our context has multiple nodes if(contextValue != null) { // Currently this must be a list of nodes if (contextValue instanceof SetValEvaluationContext) { SetValEvaluationContext evalContext = (SetValEvaluationContext)contextValue; // Get the node list ArrayList wrappedParentList = evalContext.getWrappedNodeList(); // If the list is empty, then we have yet to get the document root if(wrappedParentList.isEmpty()) { //Set up a root (document) context for evaluation Object docRoot = Matching.getEvaluator().getDocumentRoot(msg); // Create an object to hold the wrapped node WrappedNodeResults wrapper = new WrappedNodeResults(docRoot); // Set the root into the evaluation context evalContext.addNode(wrapper); // depends on control dependency: [if], data = [none] } // Iterate over the nodes Iterator iter = wrappedParentList.iterator(); while(iter.hasNext()) { WrappedNodeResults nextWrappedParentNode = (WrappedNodeResults)iter.next(); Object nextParentNode = nextWrappedParentNode.getNode(); String debugString = ""; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(this,cclass, "getValue", "Evaluation context node: " + nextWrappedParentNode); // If no cached value we'll need to call MFP ArrayList numberList = nextWrappedParentNode.getEvalNumberResult(id.getName()); if(numberList == null) { // Call MFP to get the results for this node ArrayList childNodeList = (ArrayList) msg.getIdentifierValue(id, false, nextParentNode, true); // true means return a nodelist // Process the retrieved nodes to get a list of Numbers numberList = Matching.getEvaluator().castToNumberList(childNodeList); // depends on control dependency: [if], data = [none] // Add result to cache for next time nextWrappedParentNode.addEvalNumberResult(id.getName(), numberList); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugString = "Result from MFP "; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugString = "Result from Cache "; } // Useful debug if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String asString = ", type: Numeric - <"; if(numberList == null) { asString = asString + "null"; // depends on control dependency: [if], data = [none] } else { Iterator iterDebug = numberList.iterator(); boolean first = true; while(iterDebug.hasNext()) { Number num = (Number)iterDebug.next(); if(!first) asString = asString + "," + num; else { asString = asString + num; // depends on control dependency: [if], data = [none] first = false; // depends on control dependency: [if], data = [none] } } } asString = asString + ">"; // depends on control dependency: [if], data = [none] tc.debug(this,cclass, "getValue", debugString + "for identifier " + id.getName() + asString); // depends on control dependency: [if], data = [none] } // Build the return value as an XPathEvaluationContext if(xpEval == null) xpEval = new SetValEvaluationContext(); // Add the wrapped node to the evaluation context xpEval.addNode(nextWrappedParentNode); // depends on control dependency: [while], data = [none] } // eof while } // eof instanceof XPathEvaluationContext } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "getValue", xpEval); return xpEval; } }
public class class_name { public static void projViewFromRectangle( Vector3d eye, Vector3d p, Vector3d x, Vector3d y, double nearFarDist, boolean zeroToOne, Matrix4d projDest, Matrix4d viewDest) { double zx = y.y * x.z - y.z * x.y, zy = y.z * x.x - y.x * x.z, zz = y.x * x.y - y.y * x.x; double zd = zx * (p.x - eye.x) + zy * (p.y - eye.y) + zz * (p.z - eye.z); double zs = zd >= 0 ? 1 : -1; zx *= zs; zy *= zs; zz *= zs; zd *= zs; viewDest.setLookAt(eye.x, eye.y, eye.z, eye.x + zx, eye.y + zy, eye.z + zz, y.x, y.y, y.z); double px = viewDest.m00 * p.x + viewDest.m10 * p.y + viewDest.m20 * p.z + viewDest.m30; double py = viewDest.m01 * p.x + viewDest.m11 * p.y + viewDest.m21 * p.z + viewDest.m31; double tx = viewDest.m00 * x.x + viewDest.m10 * x.y + viewDest.m20 * x.z; double ty = viewDest.m01 * y.x + viewDest.m11 * y.y + viewDest.m21 * y.z; double len = Math.sqrt(zx * zx + zy * zy + zz * zz); double near = zd / len, far; if (Double.isInfinite(nearFarDist) && nearFarDist < 0.0) { far = near; near = Double.POSITIVE_INFINITY; } else if (Double.isInfinite(nearFarDist) && nearFarDist > 0.0) { far = Double.POSITIVE_INFINITY; } else if (nearFarDist < 0.0) { far = near; near = near + nearFarDist; } else { far = near + nearFarDist; } projDest.setFrustum(px, px + tx, py, py + ty, near, far, zeroToOne); } }
public class class_name { public static void projViewFromRectangle( Vector3d eye, Vector3d p, Vector3d x, Vector3d y, double nearFarDist, boolean zeroToOne, Matrix4d projDest, Matrix4d viewDest) { double zx = y.y * x.z - y.z * x.y, zy = y.z * x.x - y.x * x.z, zz = y.x * x.y - y.y * x.x; double zd = zx * (p.x - eye.x) + zy * (p.y - eye.y) + zz * (p.z - eye.z); double zs = zd >= 0 ? 1 : -1; zx *= zs; zy *= zs; zz *= zs; zd *= zs; viewDest.setLookAt(eye.x, eye.y, eye.z, eye.x + zx, eye.y + zy, eye.z + zz, y.x, y.y, y.z); double px = viewDest.m00 * p.x + viewDest.m10 * p.y + viewDest.m20 * p.z + viewDest.m30; double py = viewDest.m01 * p.x + viewDest.m11 * p.y + viewDest.m21 * p.z + viewDest.m31; double tx = viewDest.m00 * x.x + viewDest.m10 * x.y + viewDest.m20 * x.z; double ty = viewDest.m01 * y.x + viewDest.m11 * y.y + viewDest.m21 * y.z; double len = Math.sqrt(zx * zx + zy * zy + zz * zz); double near = zd / len, far; if (Double.isInfinite(nearFarDist) && nearFarDist < 0.0) { far = near; // depends on control dependency: [if], data = [none] near = Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none] } else if (Double.isInfinite(nearFarDist) && nearFarDist > 0.0) { far = Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none] } else if (nearFarDist < 0.0) { far = near; // depends on control dependency: [if], data = [none] near = near + nearFarDist; // depends on control dependency: [if], data = [none] } else { far = near + nearFarDist; // depends on control dependency: [if], data = [none] } projDest.setFrustum(px, px + tx, py, py + ty, near, far, zeroToOne); } }
public class class_name { public Runnable concat(Runnable... runnables) { if (runnables.length == 0) { throw new IllegalArgumentException("empty"); } Runnable r = runnables[runnables.length-1]; for (int ii=runnables.length-2;ii>=0;ii--) { r = concat(runnables[ii], r); } return r; } }
public class class_name { public Runnable concat(Runnable... runnables) { if (runnables.length == 0) { throw new IllegalArgumentException("empty"); } Runnable r = runnables[runnables.length-1]; for (int ii=runnables.length-2;ii>=0;ii--) { r = concat(runnables[ii], r); // depends on control dependency: [for], data = [ii] } return r; } }
public class class_name { static void writeInt(byte[] byteArray, int offset, int i) { for (int j = 0; j < 4; j++) { int shift = 24 - j * 8; byteArray[offset + j] = (byte) (i >>> shift); } } }
public class class_name { static void writeInt(byte[] byteArray, int offset, int i) { for (int j = 0; j < 4; j++) { int shift = 24 - j * 8; byteArray[offset + j] = (byte) (i >>> shift); // depends on control dependency: [for], data = [j] } } }
public class class_name { private void buildTrackerAddresses() { Set<InetSocketAddress> addressSet = new HashSet<InetSocketAddress>(); for (String item : trackerList) { if (StringUtils.isBlank(item)) { continue; } String[] parts = StringUtils.split(item, ":", 2); if (parts.length != 2) { throw new IllegalArgumentException( "the value of item \"tracker_server\" is invalid, the correct format is host:port"); } InetSocketAddress address = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim())); addressSet.add(address); } // 放到轮询圈 for (InetSocketAddress item : addressSet) { TrackerAddressHolder holder = new TrackerAddressHolder(item); trackerAddressCircular.add(holder); trackerAddressMap.put(item, holder); } } }
public class class_name { private void buildTrackerAddresses() { Set<InetSocketAddress> addressSet = new HashSet<InetSocketAddress>(); for (String item : trackerList) { if (StringUtils.isBlank(item)) { continue; } String[] parts = StringUtils.split(item, ":", 2); if (parts.length != 2) { throw new IllegalArgumentException( "the value of item \"tracker_server\" is invalid, the correct format is host:port"); } InetSocketAddress address = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim())); addressSet.add(address); // depends on control dependency: [for], data = [none] } // 放到轮询圈 for (InetSocketAddress item : addressSet) { TrackerAddressHolder holder = new TrackerAddressHolder(item); trackerAddressCircular.add(holder); // depends on control dependency: [for], data = [none] trackerAddressMap.put(item, holder); // depends on control dependency: [for], data = [item] } } }
public class class_name { public String get(String key) { final Map<String, String> map = copyOnThreadLocal.get(); if ((map != null) && (key != null)) { return map.get(key); } else { return null; } } }
public class class_name { public String get(String key) { final Map<String, String> map = copyOnThreadLocal.get(); if ((map != null) && (key != null)) { return map.get(key); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Properties loadProperties(String path, Class cls) { Properties properties = new Properties(); // environment variables will always override properties file try { InputStream in = cls.getResourceAsStream(path); // if we cant find the properties file if (in != null) { properties.load(in); } // Env variables will always override properties if (System.getenv("api_key") != null && System.getenv("api_url") != null) { properties.put("api_key", System.getenv("api_key")); properties.put("api_url", System.getenv("api_url")); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Problems loading properties", e); } return properties; } }
public class class_name { public static Properties loadProperties(String path, Class cls) { Properties properties = new Properties(); // environment variables will always override properties file try { InputStream in = cls.getResourceAsStream(path); // if we cant find the properties file if (in != null) { properties.load(in); // depends on control dependency: [if], data = [(in] } // Env variables will always override properties if (System.getenv("api_key") != null && System.getenv("api_url") != null) { properties.put("api_key", System.getenv("api_key")); // depends on control dependency: [if], data = [none] properties.put("api_url", System.getenv("api_url")); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Problems loading properties", e); } // depends on control dependency: [catch], data = [none] return properties; } }
public class class_name { private void parseProperties(final String propertiesAsString) { //should work also \r?\n final String[] propertyEntries = propertiesAsString.split("\\r?\\n"); for (final String entry : propertyEntries) { readPropertyEntry(entry); } } }
public class class_name { private void parseProperties(final String propertiesAsString) { //should work also \r?\n final String[] propertyEntries = propertiesAsString.split("\\r?\\n"); for (final String entry : propertyEntries) { readPropertyEntry(entry); // depends on control dependency: [for], data = [entry] } } }
public class class_name { void dump(PrintWriter stream) { stream.print("[size=" + count); for (int i = 0; i < count; i++) { if (i != 0) { stream.print(", "); stream.print(timeStamps[i] - timeStamps[i - 1]); } else { stream.print(" " + timeStamps[i]); } } stream.println("]"); } }
public class class_name { void dump(PrintWriter stream) { stream.print("[size=" + count); for (int i = 0; i < count; i++) { if (i != 0) { stream.print(", "); // depends on control dependency: [if], data = [none] stream.print(timeStamps[i] - timeStamps[i - 1]); // depends on control dependency: [if], data = [none] } else { stream.print(" " + timeStamps[i]); // depends on control dependency: [if], data = [none] } } stream.println("]"); } }
public class class_name { private static void makeASquare(double length) { // If the current length is greater than 10 --#10.2 if (length > 10) { // Run the recipe moveToTheSquareStart with the current length --#4.3 moveToTheSquareStart(length); // // Do the following 4 times --#7.1 for (int i = 0; i < 4; i++) { // Move the Tortoise the current length Tortoise.move(length); // MakeASquare with the current length divided by 1.7 (recipe below)--#11.3 makeASquare(length / 1.7); // If the current process count is less than 3 (HINT: use 'i') --#9 if (i < 3) { // Turn the tortoise 90 degrees to the right Tortoise.turn(90); // } // End Repeat --#7.2 } // MoveBackToCenter with the current length (recipe below)--#5.3 moveBackToCenter(length); // Set the current length to the current length times two --#10.1 length = length * 2; } // End of makeASquare recipe } }
public class class_name { private static void makeASquare(double length) { // If the current length is greater than 10 --#10.2 if (length > 10) { // Run the recipe moveToTheSquareStart with the current length --#4.3 moveToTheSquareStart(length); // depends on control dependency: [if], data = [(length] // // Do the following 4 times --#7.1 for (int i = 0; i < 4; i++) { // Move the Tortoise the current length Tortoise.move(length); // depends on control dependency: [for], data = [none] // MakeASquare with the current length divided by 1.7 (recipe below)--#11.3 makeASquare(length / 1.7); // depends on control dependency: [for], data = [none] // If the current process count is less than 3 (HINT: use 'i') --#9 if (i < 3) { // Turn the tortoise 90 degrees to the right Tortoise.turn(90); // depends on control dependency: [if], data = [none] // } // End Repeat --#7.2 } // MoveBackToCenter with the current length (recipe below)--#5.3 moveBackToCenter(length); // depends on control dependency: [if], data = [(length] // Set the current length to the current length times two --#10.1 length = length * 2; // depends on control dependency: [if], data = [none] } // End of makeASquare recipe } }
public class class_name { public static EWAHCompressedBitmap32 or(final Iterator<EWAHCompressedBitmap32> bitmaps) { PriorityQueue<EWAHCompressedBitmap32> pq = new PriorityQueue<EWAHCompressedBitmap32>(32, new Comparator<EWAHCompressedBitmap32>() { @Override public int compare(EWAHCompressedBitmap32 a, EWAHCompressedBitmap32 b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); while(bitmaps.hasNext()) pq.add(bitmaps.next()); if(pq.isEmpty()) return new EWAHCompressedBitmap32(); while (pq.size() > 1) { EWAHCompressedBitmap32 x1 = pq.poll(); EWAHCompressedBitmap32 x2 = pq.poll(); pq.add(x1.or(x2)); } return pq.poll(); } }
public class class_name { public static EWAHCompressedBitmap32 or(final Iterator<EWAHCompressedBitmap32> bitmaps) { PriorityQueue<EWAHCompressedBitmap32> pq = new PriorityQueue<EWAHCompressedBitmap32>(32, new Comparator<EWAHCompressedBitmap32>() { @Override public int compare(EWAHCompressedBitmap32 a, EWAHCompressedBitmap32 b) { return a.sizeInBytes() - b.sizeInBytes(); } } ); while(bitmaps.hasNext()) pq.add(bitmaps.next()); if(pq.isEmpty()) return new EWAHCompressedBitmap32(); while (pq.size() > 1) { EWAHCompressedBitmap32 x1 = pq.poll(); EWAHCompressedBitmap32 x2 = pq.poll(); pq.add(x1.or(x2)); // depends on control dependency: [while], data = [none] } return pq.poll(); } }
public class class_name { public static Long getValidMaxTotalRows(IndexTuningConfig tuningConfig) { @Nullable final Integer numShards = tuningConfig.numShards; @Nullable final Long maxTotalRows = tuningConfig.maxTotalRows; if (numShards == null || numShards == -1) { return maxTotalRows == null ? IndexTuningConfig.DEFAULT_MAX_TOTAL_ROWS : maxTotalRows; } else { return null; } } }
public class class_name { public static Long getValidMaxTotalRows(IndexTuningConfig tuningConfig) { @Nullable final Integer numShards = tuningConfig.numShards; @Nullable final Long maxTotalRows = tuningConfig.maxTotalRows; if (numShards == null || numShards == -1) { return maxTotalRows == null ? IndexTuningConfig.DEFAULT_MAX_TOTAL_ROWS : maxTotalRows; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean sharedTryLock() { ReadersEntry localEntry = entry.get(); // Initialize a new Reader-state for this thread if needed if (localEntry == null) { localEntry = addState(); } final AtomicInteger currentReadersState = localEntry.state; currentReadersState.set(SRWL_STATE_READING); if (!stampedLock.isWriteLocked()) { // Acquired lock in read-only mode return true; } else { // Go back to SRWL_STATE_NOT_READING and quit currentReadersState.set(SRWL_STATE_NOT_READING); return false; } } }
public class class_name { public boolean sharedTryLock() { ReadersEntry localEntry = entry.get(); // Initialize a new Reader-state for this thread if needed if (localEntry == null) { localEntry = addState(); // depends on control dependency: [if], data = [none] } final AtomicInteger currentReadersState = localEntry.state; currentReadersState.set(SRWL_STATE_READING); if (!stampedLock.isWriteLocked()) { // Acquired lock in read-only mode return true; // depends on control dependency: [if], data = [none] } else { // Go back to SRWL_STATE_NOT_READING and quit currentReadersState.set(SRWL_STATE_NOT_READING); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Iterator<? extends T> iterator(final long first, final long count) { List<T> result = new ArrayList<>(sort()); if (result.size() > (first + count)) { result = result.subList((int)first, (int)first + (int)count); } else { result = result.subList((int)first, result.size()); } return result.iterator(); } }
public class class_name { @Override public Iterator<? extends T> iterator(final long first, final long count) { List<T> result = new ArrayList<>(sort()); if (result.size() > (first + count)) { result = result.subList((int)first, (int)first + (int)count); // depends on control dependency: [if], data = [none] } else { result = result.subList((int)first, result.size()); // depends on control dependency: [if], data = [none] } return result.iterator(); } }
public class class_name { protected void reset() { this.active = false; synchronized (this.cachedChannelsNonTransactional) { for (ChannelProxy channel : this.cachedChannelsNonTransactional) { try { channel.getTargetChannel().close(); } catch (Throwable ex) { this.logger.trace("Could not close cached Rabbit Channel", ex); } } this.cachedChannelsNonTransactional.clear(); } synchronized (this.cachedChannelsTransactional) { for (ChannelProxy channel : this.cachedChannelsTransactional) { try { channel.getTargetChannel().close(); } catch (Throwable ex) { this.logger.trace("Could not close cached Rabbit Channel", ex); } } this.cachedChannelsTransactional.clear(); } this.active = true; } }
public class class_name { protected void reset() { this.active = false; synchronized (this.cachedChannelsNonTransactional) { for (ChannelProxy channel : this.cachedChannelsNonTransactional) { try { channel.getTargetChannel().close(); // depends on control dependency: [try], data = [none] } catch (Throwable ex) { this.logger.trace("Could not close cached Rabbit Channel", ex); } // depends on control dependency: [catch], data = [none] } this.cachedChannelsNonTransactional.clear(); } synchronized (this.cachedChannelsTransactional) { for (ChannelProxy channel : this.cachedChannelsTransactional) { try { channel.getTargetChannel().close(); // depends on control dependency: [try], data = [none] } catch (Throwable ex) { this.logger.trace("Could not close cached Rabbit Channel", ex); } // depends on control dependency: [catch], data = [none] } this.cachedChannelsTransactional.clear(); } this.active = true; } }
public class class_name { public V put(K key, V value) { int hashCode = hash((key == null) ? NULL : key); int index = hashIndex(hashCode, data.length); HashEntry<K, V> entry = data[index]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) { V oldValue = entry.getValue(); updateEntry(entry, value); return oldValue; } entry = entry.next; } addMapping(index, hashCode, key, value); return null; } }
public class class_name { public V put(K key, V value) { int hashCode = hash((key == null) ? NULL : key); int index = hashIndex(hashCode, data.length); HashEntry<K, V> entry = data[index]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(key, entry.getKey())) { V oldValue = entry.getValue(); updateEntry(entry, value); // depends on control dependency: [if], data = [none] return oldValue; // depends on control dependency: [if], data = [none] } entry = entry.next; // depends on control dependency: [while], data = [none] } addMapping(index, hashCode, key, value); return null; } }
public class class_name { public void setNextPartialSolution(OptimizerNode nextPartialSolution, OptimizerNode terminationCriterion) { // check if the root of the step function has the same parallelism as the iteration // or if the step function has any operator at all if (nextPartialSolution.getParallelism() != getParallelism() || nextPartialSolution == partialSolution || nextPartialSolution instanceof BinaryUnionNode) { // add a no-op to the root to express the re-partitioning NoOpNode noop = new NoOpNode(); noop.setParallelism(getParallelism()); DagConnection noOpConn = new DagConnection(nextPartialSolution, noop, ExecutionMode.PIPELINED); noop.setIncomingConnection(noOpConn); nextPartialSolution.addOutgoingConnection(noOpConn); nextPartialSolution = noop; } this.nextPartialSolution = nextPartialSolution; this.terminationCriterion = terminationCriterion; if (terminationCriterion == null) { this.singleRoot = nextPartialSolution; this.rootConnection = new DagConnection(nextPartialSolution, ExecutionMode.PIPELINED); } else { // we have a termination criterion SingleRootJoiner singleRootJoiner = new SingleRootJoiner(); this.rootConnection = new DagConnection(nextPartialSolution, singleRootJoiner, ExecutionMode.PIPELINED); this.terminationCriterionRootConnection = new DagConnection(terminationCriterion, singleRootJoiner, ExecutionMode.PIPELINED); singleRootJoiner.setInputs(this.rootConnection, this.terminationCriterionRootConnection); this.singleRoot = singleRootJoiner; // add connection to terminationCriterion for interesting properties visitor terminationCriterion.addOutgoingConnection(terminationCriterionRootConnection); } nextPartialSolution.addOutgoingConnection(rootConnection); } }
public class class_name { public void setNextPartialSolution(OptimizerNode nextPartialSolution, OptimizerNode terminationCriterion) { // check if the root of the step function has the same parallelism as the iteration // or if the step function has any operator at all if (nextPartialSolution.getParallelism() != getParallelism() || nextPartialSolution == partialSolution || nextPartialSolution instanceof BinaryUnionNode) { // add a no-op to the root to express the re-partitioning NoOpNode noop = new NoOpNode(); noop.setParallelism(getParallelism()); // depends on control dependency: [if], data = [none] DagConnection noOpConn = new DagConnection(nextPartialSolution, noop, ExecutionMode.PIPELINED); noop.setIncomingConnection(noOpConn); // depends on control dependency: [if], data = [none] nextPartialSolution.addOutgoingConnection(noOpConn); // depends on control dependency: [if], data = [none] nextPartialSolution = noop; // depends on control dependency: [if], data = [none] } this.nextPartialSolution = nextPartialSolution; this.terminationCriterion = terminationCriterion; if (terminationCriterion == null) { this.singleRoot = nextPartialSolution; // depends on control dependency: [if], data = [none] this.rootConnection = new DagConnection(nextPartialSolution, ExecutionMode.PIPELINED); // depends on control dependency: [if], data = [none] } else { // we have a termination criterion SingleRootJoiner singleRootJoiner = new SingleRootJoiner(); this.rootConnection = new DagConnection(nextPartialSolution, singleRootJoiner, ExecutionMode.PIPELINED); // depends on control dependency: [if], data = [none] this.terminationCriterionRootConnection = new DagConnection(terminationCriterion, singleRootJoiner, ExecutionMode.PIPELINED); // depends on control dependency: [if], data = [none] singleRootJoiner.setInputs(this.rootConnection, this.terminationCriterionRootConnection); // depends on control dependency: [if], data = [none] this.singleRoot = singleRootJoiner; // depends on control dependency: [if], data = [none] // add connection to terminationCriterion for interesting properties visitor terminationCriterion.addOutgoingConnection(terminationCriterionRootConnection); // depends on control dependency: [if], data = [(terminationCriterion] } nextPartialSolution.addOutgoingConnection(rootConnection); } }
public class class_name { public Collection<DavChild> syncReport(final BasicHttpClient cl, final String path, final String syncToken, final Collection<QName> props) throws Throwable { final StringWriter sw = new StringWriter(); final XmlEmit xml = getXml(); addNs(xml, WebdavTags.namespace); xml.startEmit(sw); /* <?xml version="1.0" encoding="utf-8" ?> <D:sync-collection xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <D:sync-token/> <D:prop> <D:getetag/> </D:prop> </D:sync-collection> */ xml.openTag(WebdavTags.syncCollection); if (syncToken == null) { xml.emptyTag(WebdavTags.syncToken); } else { xml.property(WebdavTags.syncToken, syncToken); } xml.property(WebdavTags.synclevel, "1"); xml.openTag(WebdavTags.prop); xml.emptyTag(WebdavTags.getetag); if (props != null) { for (final QName pr: props) { if (pr.equals(WebdavTags.getetag)) { continue; } addNs(xml, pr.getNamespaceURI()); xml.emptyTag(pr); } } xml.closeTag(WebdavTags.prop); xml.closeTag(WebdavTags.syncCollection); final byte[] content = sw.toString().getBytes(); final int res = sendRequest(cl, "REPORT", path, depth0, "text/xml", // contentType, content.length, // contentLen, content); if (res == HttpServletResponse.SC_NOT_FOUND) { return null; } final int SC_MULTI_STATUS = 207; // not defined for some reason if (res != SC_MULTI_STATUS) { if (debug()) { debug("Got response " + res + " for path " + path); } //throw new Exception("Got response " + res + " for path " + path); return null; } final Document doc = parseContent(cl.getResponseBodyAsStream()); final Element root = doc.getDocumentElement(); /* <!ELEMENT multistatus (response+, responsedescription?) > */ expect(root, WebdavTags.multistatus); return processResponses(getChildren(root), null); } }
public class class_name { public Collection<DavChild> syncReport(final BasicHttpClient cl, final String path, final String syncToken, final Collection<QName> props) throws Throwable { final StringWriter sw = new StringWriter(); final XmlEmit xml = getXml(); addNs(xml, WebdavTags.namespace); xml.startEmit(sw); /* <?xml version="1.0" encoding="utf-8" ?> <D:sync-collection xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <D:sync-token/> <D:prop> <D:getetag/> </D:prop> </D:sync-collection> */ xml.openTag(WebdavTags.syncCollection); if (syncToken == null) { xml.emptyTag(WebdavTags.syncToken); } else { xml.property(WebdavTags.syncToken, syncToken); } xml.property(WebdavTags.synclevel, "1"); xml.openTag(WebdavTags.prop); xml.emptyTag(WebdavTags.getetag); if (props != null) { for (final QName pr: props) { if (pr.equals(WebdavTags.getetag)) { continue; } addNs(xml, pr.getNamespaceURI()); // depends on control dependency: [for], data = [pr] xml.emptyTag(pr); // depends on control dependency: [for], data = [pr] } } xml.closeTag(WebdavTags.prop); xml.closeTag(WebdavTags.syncCollection); final byte[] content = sw.toString().getBytes(); final int res = sendRequest(cl, "REPORT", path, depth0, "text/xml", // contentType, content.length, // contentLen, content); if (res == HttpServletResponse.SC_NOT_FOUND) { return null; } final int SC_MULTI_STATUS = 207; // not defined for some reason if (res != SC_MULTI_STATUS) { if (debug()) { debug("Got response " + res + " for path " + path); // depends on control dependency: [if], data = [none] } //throw new Exception("Got response " + res + " for path " + path); return null; } final Document doc = parseContent(cl.getResponseBodyAsStream()); final Element root = doc.getDocumentElement(); /* <!ELEMENT multistatus (response+, responsedescription?) > */ expect(root, WebdavTags.multistatus); return processResponses(getChildren(root), null); } }
public class class_name { public int index(FeatureIndexType type, boolean force) { if (type == null) { throw new GeoPackageException("FeatureIndexType is required to index"); } int count = 0; switch (type) { case GEOPACKAGE: count = featureTableIndex.index(force); break; case METADATA: count = featureIndexer.index(force); break; case RTREE: boolean rTreeIndexed = rTreeIndexTableDao.has(); if (!rTreeIndexed || force) { if (rTreeIndexed) { rTreeIndexTableDao.delete(); } rTreeIndexTableDao.create(); count = rTreeIndexTableDao.count(); } break; default: throw new GeoPackageException("Unsupported FeatureIndexType: " + type); } return count; } }
public class class_name { public int index(FeatureIndexType type, boolean force) { if (type == null) { throw new GeoPackageException("FeatureIndexType is required to index"); } int count = 0; switch (type) { case GEOPACKAGE: count = featureTableIndex.index(force); break; case METADATA: count = featureIndexer.index(force); break; case RTREE: boolean rTreeIndexed = rTreeIndexTableDao.has(); if (!rTreeIndexed || force) { if (rTreeIndexed) { rTreeIndexTableDao.delete(); // depends on control dependency: [if], data = [none] } rTreeIndexTableDao.create(); // depends on control dependency: [if], data = [none] count = rTreeIndexTableDao.count(); // depends on control dependency: [if], data = [none] } break; default: throw new GeoPackageException("Unsupported FeatureIndexType: " + type); } return count; } }
public class class_name { @Override public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID); if (pendingRequest != null) { // request was still pending failPendingRequest(pendingRequest, cause); return Optional.empty(); } else { return tryFailingAllocatedSlot(allocationID, cause); } // TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase } }
public class class_name { @Override public Optional<ResourceID> failAllocation(final AllocationID allocationID, final Exception cause) { componentMainThreadExecutor.assertRunningInMainThread(); final PendingRequest pendingRequest = pendingRequests.removeKeyB(allocationID); if (pendingRequest != null) { // request was still pending failPendingRequest(pendingRequest, cause); // depends on control dependency: [if], data = [(pendingRequest] return Optional.empty(); // depends on control dependency: [if], data = [none] } else { return tryFailingAllocatedSlot(allocationID, cause); // depends on control dependency: [if], data = [none] } // TODO: add some unit tests when the previous two are ready, the allocation may failed at any phase } }
public class class_name { private Vector<TreeNode> getFilteredChildren() { if (filteredChildren == null) { @SuppressWarnings("unchecked") Enumeration<? extends TreeNode> enumeration = delegateNode.children(); Stream<TreeNode> stream = enumerationAsStream(enumeration); filteredChildren = filteredTreeModel.getFiltered(stream) .collect(Collectors.toCollection(Vector::new)); } return filteredChildren; } }
public class class_name { private Vector<TreeNode> getFilteredChildren() { if (filteredChildren == null) { @SuppressWarnings("unchecked") Enumeration<? extends TreeNode> enumeration = delegateNode.children(); Stream<TreeNode> stream = enumerationAsStream(enumeration); filteredChildren = filteredTreeModel.getFiltered(stream) .collect(Collectors.toCollection(Vector::new)); // depends on control dependency: [if], data = [none] } return filteredChildren; } }
public class class_name { public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; } else { // Try to guess chain = s.getChain(chainId, model); if(chain == null) { // no chain found chain = new ChainImpl(); chain.setId(chainId); Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); } } newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo); // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); chain.setSeqMisMatches(oldChain.getSeqMisMatches()); s.addChain(chain,model); } } // Add cloned group if(clone) { g = (Group)g.clone(); } chain.addGroup(g); return chain; } } }
public class class_name { public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; // depends on control dependency: [if], data = [none] } else { // Try to guess chain = s.getChain(chainId, model); // depends on control dependency: [if], data = [none] if(chain == null) { // no chain found chain = new ChainImpl(); // depends on control dependency: [if], data = [none] chain.setId(chainId); // depends on control dependency: [if], data = [(chain] Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); // depends on control dependency: [if], data = [none] EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); // depends on control dependency: [if], data = [none] s.addEntityInfo(newEntityInfo); // depends on control dependency: [if], data = [none] } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); // depends on control dependency: [if], data = [(oldEntityInfo] if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); // depends on control dependency: [if], data = [none] s.addEntityInfo(newEntityInfo); // depends on control dependency: [if], data = [none] } } newEntityInfo.addChain(chain); // depends on control dependency: [if], data = [(chain] chain.setEntityInfo(newEntityInfo); // depends on control dependency: [if], data = [none] // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); // depends on control dependency: [if], data = [none] chain.setSeqMisMatches(oldChain.getSeqMisMatches()); // depends on control dependency: [if], data = [none] s.addChain(chain,model); // depends on control dependency: [if], data = [(chain] } } // Add cloned group if(clone) { g = (Group)g.clone(); // depends on control dependency: [if], data = [none] } chain.addGroup(g); return chain; } } }
public class class_name { public EClass getResourceObjectInclude() { if (resourceObjectIncludeEClass == null) { resourceObjectIncludeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(529); } return resourceObjectIncludeEClass; } }
public class class_name { public EClass getResourceObjectInclude() { if (resourceObjectIncludeEClass == null) { resourceObjectIncludeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(529); // depends on control dependency: [if], data = [none] } return resourceObjectIncludeEClass; } }
public class class_name { public static <T> List<Set<T>> split(Set<T> set, int maxSize) { Assert.notNull(set, "Missing set to be split!"); Assert.isTrue(maxSize > 0, "Max size must be > 0!"); if (set.size() < maxSize) { return Collections.singletonList(set); } List<Set<T>> list = new ArrayList<>(); Iterator<T> iterator = set.iterator(); while (iterator.hasNext()) { Set<T> newSet = new HashSet<>(); for (int j = 0; j < maxSize && iterator.hasNext(); j++) { T item = iterator.next(); newSet.add(item); } list.add(newSet); } return list; } }
public class class_name { public static <T> List<Set<T>> split(Set<T> set, int maxSize) { Assert.notNull(set, "Missing set to be split!"); Assert.isTrue(maxSize > 0, "Max size must be > 0!"); if (set.size() < maxSize) { return Collections.singletonList(set); // depends on control dependency: [if], data = [none] } List<Set<T>> list = new ArrayList<>(); Iterator<T> iterator = set.iterator(); while (iterator.hasNext()) { Set<T> newSet = new HashSet<>(); for (int j = 0; j < maxSize && iterator.hasNext(); j++) { T item = iterator.next(); newSet.add(item); // depends on control dependency: [for], data = [none] } list.add(newSet); // depends on control dependency: [while], data = [none] } return list; } }
public class class_name { static Map<String, String> readFasta(final File inputFastqFile) throws IOException, NoSuchElementException, BioException{ BufferedReader reader = null; HashMap<String, String> fasta = new HashMap<String, String>(); try{ reader = reader(inputFastqFile); for (SequenceIterator sequences = SeqIOTools.readFastaDNA(reader); sequences.hasNext(); ) { Sequence sequence = sequences.nextSequence(); String sequenceId = sequence.getName(); String fastaSeq = sequence.seqString(); fasta.put(sequenceId, fastaSeq); } }finally { try { reader.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } return fasta; } }
public class class_name { static Map<String, String> readFasta(final File inputFastqFile) throws IOException, NoSuchElementException, BioException{ BufferedReader reader = null; HashMap<String, String> fasta = new HashMap<String, String>(); try{ reader = reader(inputFastqFile); for (SequenceIterator sequences = SeqIOTools.readFastaDNA(reader); sequences.hasNext(); ) { Sequence sequence = sequences.nextSequence(); String sequenceId = sequence.getName(); String fastaSeq = sequence.seqString(); fasta.put(sequenceId, fastaSeq); // depends on control dependency: [for], data = [none] } }finally { try { reader.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); System.exit(1); } // depends on control dependency: [catch], data = [none] } return fasta; } }