code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
protected void walkDescendantsIteratively(final LinkedList<Node> nodes, final CssSelector cssSelector, final List<Node> result) {
while (!nodes.isEmpty()) {
Node node = nodes.removeFirst();
selectAndAdd(node, cssSelector, result);
// append children in walking order to be processed right after this node
int childCount = node.getChildNodesCount();
for (int i = childCount - 1; i >= 0; i--) {
nodes.addFirst(node.getChild(i));
}
}
} }
|
public class class_name {
protected void walkDescendantsIteratively(final LinkedList<Node> nodes, final CssSelector cssSelector, final List<Node> result) {
while (!nodes.isEmpty()) {
Node node = nodes.removeFirst();
selectAndAdd(node, cssSelector, result); // depends on control dependency: [while], data = [none]
// append children in walking order to be processed right after this node
int childCount = node.getChildNodesCount();
for (int i = childCount - 1; i >= 0; i--) {
nodes.addFirst(node.getChild(i)); // depends on control dependency: [for], data = [i]
}
}
} }
|
public class class_name {
private List<CmsRadioButton> parseConfiguration(String config) {
// generate an empty list off radio button.
List<CmsRadioButton> result = new LinkedList<CmsRadioButton>();
CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
for (Map.Entry<String, String> entry : parser.getOptions().entrySet()) {
// create a new radio button with the given name and label.
CmsRadioButton radiobutton = new CmsRadioButton(entry.getKey(), entry.getValue());
// add click handler.
radiobutton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
fireChangeEvent();
}
});
// add this radio button to the group
radiobutton.setGroup(m_group);
// check if this value is default set.
if (entry.getKey().equals(parser.getDefaultValue())) {
radiobutton.setChecked(true);
m_defaultRadioButton = radiobutton;
}
// add this radio button to the list.
result.add(radiobutton);
}
return result;
} }
|
public class class_name {
private List<CmsRadioButton> parseConfiguration(String config) {
// generate an empty list off radio button.
List<CmsRadioButton> result = new LinkedList<CmsRadioButton>();
CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
for (Map.Entry<String, String> entry : parser.getOptions().entrySet()) {
// create a new radio button with the given name and label.
CmsRadioButton radiobutton = new CmsRadioButton(entry.getKey(), entry.getValue());
// add click handler.
radiobutton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
fireChangeEvent();
}
});
// depends on control dependency: [for], data = [none]
// add this radio button to the group
radiobutton.setGroup(m_group);
// depends on control dependency: [for], data = [none]
// check if this value is default set.
if (entry.getKey().equals(parser.getDefaultValue())) {
radiobutton.setChecked(true);
// depends on control dependency: [if], data = [none]
m_defaultRadioButton = radiobutton;
// depends on control dependency: [if], data = [none]
}
// add this radio button to the list.
result.add(radiobutton);
// depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
@Nonnull
/*package*/ static InputStream getBundledJpiManifestStream(@Nonnull URL url) throws IOException {
URLConnection uc = url.openConnection();
InputStream in = null;
// Magic, which allows to avoid using stream generated for JarURLConnection.
// It prevents getting into JENKINS-37332 due to the file descriptor leak
if (uc instanceof JarURLConnection) {
final JarURLConnection jarURLConnection = (JarURLConnection) uc;
final String entryName = jarURLConnection.getEntryName();
try(final JarFile jarFile = jarURLConnection.getJarFile()) {
final JarEntry entry = (entryName != null && jarFile != null) ? jarFile.getJarEntry(entryName) : null;
if (entry != null && jarFile != null) {
try(InputStream i = jarFile.getInputStream(entry)) {
byte[] manifestBytes = IOUtils.toByteArray(i);
in = new ByteArrayInputStream(manifestBytes);
}
} else {
LOGGER.log(Level.WARNING, "Failed to locate the JAR file for {0}"
+ "The default URLConnection stream access will be used, file descriptor may be leaked.",
url);
}
}
}
// If input stream is undefined, use the default implementation
if (in == null) {
in = url.openStream();
}
return in;
} }
|
public class class_name {
@Nonnull
/*package*/ static InputStream getBundledJpiManifestStream(@Nonnull URL url) throws IOException {
URLConnection uc = url.openConnection();
InputStream in = null;
// Magic, which allows to avoid using stream generated for JarURLConnection.
// It prevents getting into JENKINS-37332 due to the file descriptor leak
if (uc instanceof JarURLConnection) {
final JarURLConnection jarURLConnection = (JarURLConnection) uc;
final String entryName = jarURLConnection.getEntryName();
try(final JarFile jarFile = jarURLConnection.getJarFile()) {
final JarEntry entry = (entryName != null && jarFile != null) ? jarFile.getJarEntry(entryName) : null;
if (entry != null && jarFile != null) {
try(InputStream i = jarFile.getInputStream(entry)) {
byte[] manifestBytes = IOUtils.toByteArray(i);
in = new ByteArrayInputStream(manifestBytes); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.log(Level.WARNING, "Failed to locate the JAR file for {0}"
+ "The default URLConnection stream access will be used, file descriptor may be leaked.",
url);
}
}
}
// If input stream is undefined, use the default implementation
if (in == null) {
in = url.openStream();
}
return in;
} }
|
public class class_name {
private <T> Task<T> unwind(Try<T> result) {
if (result.isFailed()) {
return Task.failure(result.getError());
} else {
return Task.value(result.get());
}
} }
|
public class class_name {
private <T> Task<T> unwind(Try<T> result) {
if (result.isFailed()) {
return Task.failure(result.getError()); // depends on control dependency: [if], data = [none]
} else {
return Task.value(result.get()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public DefaultDmnEngineConfiguration build() {
List<DmnDecisionEvaluationListener> decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners();
dmnEngineConfiguration.setCustomPostDecisionEvaluationListeners(decisionEvaluationListeners);
// override the decision table handler
DmnTransformer dmnTransformer = dmnEngineConfiguration.getTransformer();
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Definitions.class, new DecisionRequirementsDefinitionTransformHandler());
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Decision.class, new DecisionDefinitionHandler());
// do not override the script engine resolver if set
if (dmnEngineConfiguration.getScriptEngineResolver() == null) {
ensureNotNull("scriptEngineResolver", scriptEngineResolver);
dmnEngineConfiguration.setScriptEngineResolver(scriptEngineResolver);
}
// do not override the el provider if set
if (dmnEngineConfiguration.getElProvider() == null) {
ensureNotNull("expressionManager", expressionManager);
ProcessEngineElProvider elProvider = new ProcessEngineElProvider(expressionManager);
dmnEngineConfiguration.setElProvider(elProvider);
}
return dmnEngineConfiguration;
} }
|
public class class_name {
public DefaultDmnEngineConfiguration build() {
List<DmnDecisionEvaluationListener> decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners();
dmnEngineConfiguration.setCustomPostDecisionEvaluationListeners(decisionEvaluationListeners);
// override the decision table handler
DmnTransformer dmnTransformer = dmnEngineConfiguration.getTransformer();
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Definitions.class, new DecisionRequirementsDefinitionTransformHandler());
dmnTransformer.getElementTransformHandlerRegistry().addHandler(Decision.class, new DecisionDefinitionHandler());
// do not override the script engine resolver if set
if (dmnEngineConfiguration.getScriptEngineResolver() == null) {
ensureNotNull("scriptEngineResolver", scriptEngineResolver); // depends on control dependency: [if], data = [none]
dmnEngineConfiguration.setScriptEngineResolver(scriptEngineResolver); // depends on control dependency: [if], data = [none]
}
// do not override the el provider if set
if (dmnEngineConfiguration.getElProvider() == null) {
ensureNotNull("expressionManager", expressionManager); // depends on control dependency: [if], data = [none]
ProcessEngineElProvider elProvider = new ProcessEngineElProvider(expressionManager);
dmnEngineConfiguration.setElProvider(elProvider); // depends on control dependency: [if], data = [none]
}
return dmnEngineConfiguration;
} }
|
public class class_name {
<ViewModelType extends ViewModel> void callInitialize(View<? extends ViewModelType> view) {
try {
final Method initializeMethod = view.getClass().getMethod(NAMING_CONVENTION_INITIALIZE_IDENTIFIER);
AccessController.doPrivileged((PrivilegedAction) () -> {
try {
return initializeMethod.invoke(view);
} catch (InvocationTargetException e) {
LOG.warn("The '{}' method of the view {} has thrown an exception!",
NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else {
throw new RuntimeException(cause);
}
} catch (IllegalAccessException e) {
LOG.warn("Can't invoke the '{}' method of the view {} because it is not accessible",
NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
}
return null;
});
} catch (NoSuchMethodException e) {
// This exception means that there is no initialize method declared.
// While it's possible that the user has no such method by design,
// normally and in most cases you need an initialize method in your
// view (either with Initialize interface
// or implicit).
// So it's likely that the user has misspelled the method name or
// uses a wrong naming convention.
// For this reason we give the user the log message.
LOG.debug("There is no '{}' method declared at the view {}", NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
}
} }
|
public class class_name {
<ViewModelType extends ViewModel> void callInitialize(View<? extends ViewModelType> view) {
try {
final Method initializeMethod = view.getClass().getMethod(NAMING_CONVENTION_INITIALIZE_IDENTIFIER);
AccessController.doPrivileged((PrivilegedAction) () -> {
try {
return initializeMethod.invoke(view);
} catch (InvocationTargetException e) {
LOG.warn("The '{}' method of the view {} has thrown an exception!",
NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else {
throw new RuntimeException(cause);
}
} catch (IllegalAccessException e) {
LOG.warn("Can't invoke the '{}' method of the view {} because it is not accessible",
NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
}
return null;
}); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
// This exception means that there is no initialize method declared.
// While it's possible that the user has no such method by design,
// normally and in most cases you need an initialize method in your
// view (either with Initialize interface
// or implicit).
// So it's likely that the user has misspelled the method name or
// uses a wrong naming convention.
// For this reason we give the user the log message.
LOG.debug("There is no '{}' method declared at the view {}", NAMING_CONVENTION_INITIALIZE_IDENTIFIER, view);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Nonnull
public Word<I> longestCommonSuffix(Word<?> other) {
int len = length(), otherLen = other.length();
int minLen = (len < otherLen) ? len : otherLen;
int idx1 = len, idx2 = otherLen;
int i = 0;
while (i < minLen) {
I sym1 = getSymbol(--idx1);
Object sym2 = other.getSymbol(--idx2);
if (!Objects.equals(sym1, sym2)) {
break;
}
i++;
}
return suffix(i);
} }
|
public class class_name {
@Nonnull
public Word<I> longestCommonSuffix(Word<?> other) {
int len = length(), otherLen = other.length();
int minLen = (len < otherLen) ? len : otherLen;
int idx1 = len, idx2 = otherLen;
int i = 0;
while (i < minLen) {
I sym1 = getSymbol(--idx1);
Object sym2 = other.getSymbol(--idx2);
if (!Objects.equals(sym1, sym2)) {
break;
}
i++; // depends on control dependency: [while], data = [none]
}
return suffix(i);
} }
|
public class class_name {
private DataBlockScanner getNextNamespaceSliceScanner(int currentNamespaceId) {
Integer nextNsId = null;
while ((nextNsId == null) && datanode.shouldRun
&& !blockScannerThread.isInterrupted()) {
waitForOneNameSpaceUp();
synchronized (this) {
if (getNamespaceSetSize() > 0) {
// Find nextNsId by finding the last modified current log file, if any
long lastScanTime = -1;
Iterator<Integer> nsidIterator = namespaceScannerMap.keySet()
.iterator();
while (nsidIterator.hasNext()) {
int nsid = nsidIterator.next();
for (FSDataset.FSVolume vol : dataset.volumes.getVolumes()) {
try {
File currFile = DataBlockScanner.getCurrentFile(vol, nsid);
if (currFile.exists()) {
long lastModified = currFile.lastModified();
if (lastScanTime < lastModified) {
lastScanTime = lastModified;
nextNsId = nsid;
}
}
} catch (IOException e) {
LOG.warn("Received exception: ", e);
}
}
}
// nextNsId can still be -1 if no current log is found,
// find nextNsId sequentially.
if (nextNsId == null) {
try {
if (currentNamespaceId == -1) {
nextNsId = namespaceScannerMap.firstKey();
} else {
nextNsId = namespaceScannerMap.higherKey(currentNamespaceId);
if (nextNsId == null) {
nextNsId = namespaceScannerMap.firstKey();
}
}
} catch (NoSuchElementException e) {
// if firstKey throws an exception
continue;
}
}
if (nextNsId != null) {
return getNSScanner(nextNsId);
}
}
}
LOG.warn("No namespace is up, going to wait");
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
LOG.warn("Received exception: " + ex);
blockScannerThread.interrupt();
return null;
}
}
return null;
} }
|
public class class_name {
private DataBlockScanner getNextNamespaceSliceScanner(int currentNamespaceId) {
Integer nextNsId = null;
while ((nextNsId == null) && datanode.shouldRun
&& !blockScannerThread.isInterrupted()) {
waitForOneNameSpaceUp(); // depends on control dependency: [while], data = [none]
synchronized (this) { // depends on control dependency: [while], data = [none]
if (getNamespaceSetSize() > 0) {
// Find nextNsId by finding the last modified current log file, if any
long lastScanTime = -1;
Iterator<Integer> nsidIterator = namespaceScannerMap.keySet()
.iterator();
while (nsidIterator.hasNext()) {
int nsid = nsidIterator.next();
for (FSDataset.FSVolume vol : dataset.volumes.getVolumes()) {
try {
File currFile = DataBlockScanner.getCurrentFile(vol, nsid);
if (currFile.exists()) {
long lastModified = currFile.lastModified();
if (lastScanTime < lastModified) {
lastScanTime = lastModified; // depends on control dependency: [if], data = [none]
nextNsId = nsid; // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
LOG.warn("Received exception: ", e);
} // depends on control dependency: [catch], data = [none]
}
}
// nextNsId can still be -1 if no current log is found,
// find nextNsId sequentially.
if (nextNsId == null) {
try {
if (currentNamespaceId == -1) {
nextNsId = namespaceScannerMap.firstKey(); // depends on control dependency: [if], data = [none]
} else {
nextNsId = namespaceScannerMap.higherKey(currentNamespaceId); // depends on control dependency: [if], data = [(currentNamespaceId]
if (nextNsId == null) {
nextNsId = namespaceScannerMap.firstKey(); // depends on control dependency: [if], data = [none]
}
}
} catch (NoSuchElementException e) {
// if firstKey throws an exception
continue;
} // depends on control dependency: [catch], data = [none]
}
if (nextNsId != null) {
return getNSScanner(nextNsId); // depends on control dependency: [if], data = [(nextNsId]
}
}
}
LOG.warn("No namespace is up, going to wait"); // depends on control dependency: [while], data = [none]
try {
Thread.sleep(5000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {
LOG.warn("Received exception: " + ex);
blockScannerThread.interrupt();
return null;
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
@Override
public SchemaManager getSchemaManager(Map<String, Object> puProperties)
{
setExternalProperties(puProperties);
if (schemaManager == null)
{
initializePropertyReader();
schemaManager = new CouchDBSchemaManager(this.getClass().getName(), puProperties, this.kunderaMetadata);
}
return schemaManager;
} }
|
public class class_name {
@Override
public SchemaManager getSchemaManager(Map<String, Object> puProperties)
{
setExternalProperties(puProperties);
if (schemaManager == null)
{
initializePropertyReader(); // depends on control dependency: [if], data = [none]
schemaManager = new CouchDBSchemaManager(this.getClass().getName(), puProperties, this.kunderaMetadata); // depends on control dependency: [if], data = [none]
}
return schemaManager;
} }
|
public class class_name {
private void deleteFromTableVToK(int entry, int valueHash) {
checkArgument(entry != ABSENT);
int valueBucket = bucket(valueHash);
if (hashTableVToK[valueBucket] == entry) {
hashTableVToK[valueBucket] = nextInBucketVToK[entry];
nextInBucketVToK[entry] = ABSENT;
return;
}
int prevInBucket = hashTableVToK[valueBucket];
for (int entryInBucket = nextInBucketVToK[prevInBucket];
entryInBucket != ABSENT;
entryInBucket = nextInBucketVToK[entryInBucket]) {
if (entryInBucket == entry) {
nextInBucketVToK[prevInBucket] = nextInBucketVToK[entry];
nextInBucketVToK[entry] = ABSENT;
return;
}
prevInBucket = entryInBucket;
}
throw new AssertionError("Expected to find entry with value " + values[entry]);
} }
|
public class class_name {
private void deleteFromTableVToK(int entry, int valueHash) {
checkArgument(entry != ABSENT);
int valueBucket = bucket(valueHash);
if (hashTableVToK[valueBucket] == entry) {
hashTableVToK[valueBucket] = nextInBucketVToK[entry]; // depends on control dependency: [if], data = [none]
nextInBucketVToK[entry] = ABSENT; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int prevInBucket = hashTableVToK[valueBucket];
for (int entryInBucket = nextInBucketVToK[prevInBucket];
entryInBucket != ABSENT;
entryInBucket = nextInBucketVToK[entryInBucket]) {
if (entryInBucket == entry) {
nextInBucketVToK[prevInBucket] = nextInBucketVToK[entry]; // depends on control dependency: [if], data = [none]
nextInBucketVToK[entry] = ABSENT; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
prevInBucket = entryInBucket; // depends on control dependency: [for], data = [entryInBucket]
}
throw new AssertionError("Expected to find entry with value " + values[entry]);
} }
|
public class class_name {
private boolean shouldBundlerRun(String requestedBundler, String currentRunningBundlerID, JavaFXGradlePluginExtension ext, final Logger logger, Map<String, ? super Object> params) {
if( requestedBundler != null && !"ALL".equalsIgnoreCase(requestedBundler) && !requestedBundler.equalsIgnoreCase(currentRunningBundlerID) ){
// this is not the specified bundler
return false;
}
if( ext.isSkipJNLP() && "jnlp".equalsIgnoreCase(currentRunningBundlerID) ){
logger.info("Skipped JNLP-bundling as requested.");
return false;
}
boolean runBundler = true;
// Workaround for native installer bundle not creating working executable native launcher
// (this is a comeback of issue 124)
// https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/205
// do run application bundler and put the cfg-file to application resources
if( System.getProperty("os.name").toLowerCase().startsWith("linux") ){
if( workarounds.isWorkaroundForBug205Needed() ){
// check if special conditions for this are met (not jnlp, but not linux.app too, because another workaround already works)
if( !"jnlp".equalsIgnoreCase(requestedBundler) && !"linux.app".equalsIgnoreCase(requestedBundler) && "linux.app".equalsIgnoreCase(currentRunningBundlerID) ){
if( !ext.isSkipNativeLauncherWorkaround205() ){
logger.info("Detected linux application bundler ('linux.app') needs to run before installer bundlers are executed.");
runBundler = true;
params.put(CFG_WORKAROUND_MARKER, "true");
} else {
logger.info("Skipped workaround for native linux installer bundlers.");
}
}
}
}
return runBundler;
} }
|
public class class_name {
private boolean shouldBundlerRun(String requestedBundler, String currentRunningBundlerID, JavaFXGradlePluginExtension ext, final Logger logger, Map<String, ? super Object> params) {
if( requestedBundler != null && !"ALL".equalsIgnoreCase(requestedBundler) && !requestedBundler.equalsIgnoreCase(currentRunningBundlerID) ){
// this is not the specified bundler
return false; // depends on control dependency: [if], data = [none]
}
if( ext.isSkipJNLP() && "jnlp".equalsIgnoreCase(currentRunningBundlerID) ){
logger.info("Skipped JNLP-bundling as requested."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
boolean runBundler = true;
// Workaround for native installer bundle not creating working executable native launcher
// (this is a comeback of issue 124)
// https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/205
// do run application bundler and put the cfg-file to application resources
if( System.getProperty("os.name").toLowerCase().startsWith("linux") ){
if( workarounds.isWorkaroundForBug205Needed() ){
// check if special conditions for this are met (not jnlp, but not linux.app too, because another workaround already works)
if( !"jnlp".equalsIgnoreCase(requestedBundler) && !"linux.app".equalsIgnoreCase(requestedBundler) && "linux.app".equalsIgnoreCase(currentRunningBundlerID) ){
if( !ext.isSkipNativeLauncherWorkaround205() ){
logger.info("Detected linux application bundler ('linux.app') needs to run before installer bundlers are executed.");
runBundler = true;
params.put(CFG_WORKAROUND_MARKER, "true");
} else {
logger.info("Skipped workaround for native linux installer bundlers.");
}
}
}
}
return runBundler;
} }
|
public class class_name {
public void runQueryWithArrayParameters() throws InterruptedException {
// [START bigquery_query_params_arrays]
// BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
String gender = "M";
String[] states = {"WA", "WI", "WV", "WY"};
String query =
"SELECT name, sum(number) as count\n"
+ "FROM `bigquery-public-data.usa_names.usa_1910_2013`\n"
+ "WHERE gender = @gender\n"
+ "AND state IN UNNEST(@states)\n"
+ "GROUP BY name\n"
+ "ORDER BY count DESC\n"
+ "LIMIT 10;";
// Note: Standard SQL is required to use query parameters.
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(query)
.addNamedParameter("gender", QueryParameterValue.string(gender))
.addNamedParameter("states", QueryParameterValue.array(states, String.class))
.build();
// Print the results.
for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
for (FieldValue val : row) {
System.out.printf("%s,", val.toString());
}
System.out.printf("\n");
}
// [END bigquery_query_params_arrays]
} }
|
public class class_name {
public void runQueryWithArrayParameters() throws InterruptedException {
// [START bigquery_query_params_arrays]
// BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
String gender = "M";
String[] states = {"WA", "WI", "WV", "WY"};
String query =
"SELECT name, sum(number) as count\n"
+ "FROM `bigquery-public-data.usa_names.usa_1910_2013`\n"
+ "WHERE gender = @gender\n"
+ "AND state IN UNNEST(@states)\n"
+ "GROUP BY name\n"
+ "ORDER BY count DESC\n"
+ "LIMIT 10;";
// Note: Standard SQL is required to use query parameters.
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(query)
.addNamedParameter("gender", QueryParameterValue.string(gender))
.addNamedParameter("states", QueryParameterValue.array(states, String.class))
.build();
// Print the results.
for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
for (FieldValue val : row) {
System.out.printf("%s,", val.toString()); // depends on control dependency: [for], data = [val]
}
System.out.printf("\n");
}
// [END bigquery_query_params_arrays]
} }
|
public class class_name {
private static Set<Parameter<?>> getParametersFromPublicFields(Class<?> type) {
Set<Parameter<?>> params = new HashSet<>();
try {
Field[] fields = type.getFields();
for (Field field : fields) {
if (field.getType().isAssignableFrom(Parameter.class)) {
params.add((Parameter<?>)field.get(null));
}
}
}
catch (IllegalArgumentException | IllegalAccessException ex) {
throw new RuntimeException("Unable to access fields of " + type.getName(), ex);
}
return ImmutableSet.copyOf(params);
} }
|
public class class_name {
private static Set<Parameter<?>> getParametersFromPublicFields(Class<?> type) {
Set<Parameter<?>> params = new HashSet<>();
try {
Field[] fields = type.getFields();
for (Field field : fields) {
if (field.getType().isAssignableFrom(Parameter.class)) {
params.add((Parameter<?>)field.get(null)); // depends on control dependency: [if], data = [none]
}
}
}
catch (IllegalArgumentException | IllegalAccessException ex) {
throw new RuntimeException("Unable to access fields of " + type.getName(), ex);
}
return ImmutableSet.copyOf(params);
} }
|
public class class_name {
public static Map<String, String> resource(String type, Map<String, String> meta) {
HashMap<String, String> authResource = new HashMap<String, String>();
if (null != meta) {
authResource.putAll(meta);
}
authResource.put(TYPE_FIELD, type);
return authResource;
} }
|
public class class_name {
public static Map<String, String> resource(String type, Map<String, String> meta) {
HashMap<String, String> authResource = new HashMap<String, String>();
if (null != meta) {
authResource.putAll(meta); // depends on control dependency: [if], data = [meta)]
}
authResource.put(TYPE_FIELD, type);
return authResource;
} }
|
public class class_name {
public void uninstall(DeployableUnitID deployableUnitID)
throws NullPointerException, UnrecognizedDeployableUnitException,
DependencyException, InvalidStateException, ManagementException {
logger.info("Uninstalling " +deployableUnitID);
final SleeContainer sleeContainer = getSleeContainer();
final SleeTransactionManager sleeTransactionManager = sleeContainer
.getTransactionManager();
final ServiceManagement serviceManagement = sleeContainer
.getServiceManagement();
final ResourceManagement resourceManagement = sleeContainer
.getResourceManagement();
final DeployableUnitManagement deployableUnitManagement = sleeContainer
.getDeployableUnitManagement();
final ComponentRepository componentRepositoryImpl = sleeContainer
.getComponentRepository();
// we sync on the container's monitor object
synchronized (sleeContainer.getManagementMonitor()) {
if (this.isInstalled(deployableUnitID)) {
Thread currentThread = Thread.currentThread();
ClassLoader currentClassLoader = currentThread
.getContextClassLoader();
DeployableUnit deployableUnit = null;
boolean rollback = true;
try {
// start transaction
sleeTransactionManager.begin();
// get du
deployableUnit = deployableUnitManagement
.getDeployableUnit(deployableUnitID);
// Check if its safe to remove the deployable unit.
for (SleeComponent sleeComponent : deployableUnit
.getDeployableUnitComponents()) {
for (SleeComponent referringComponent : sleeContainer
.getComponentRepository()
.getReferringComponents(sleeComponent)) {
if (!referringComponent.getDeployableUnit()
.getDeployableUnitID().equals(
deployableUnitID)) {
throw new DependencyException("Component "
+ referringComponent
+ " refers DU component "
+ sleeComponent);
}
}
}
for (ServiceComponent component : deployableUnit
.getServiceComponents().values()) {
serviceManagement.uninstallService(component);
componentRepositoryImpl.removeComponent(component
.getServiceID());
logger.info("Uninstalled " + component);
}
for (SbbComponent component : deployableUnit
.getSbbComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader());
removeSecurityPermissions(component, false);
sleeContainer.getSbbManagement()
.uninstallSbb(component);
componentRepositoryImpl.removeComponent(component
.getSbbID());
logger.info("Uninstalled " + component);
}
for (ResourceAdaptorComponent component : deployableUnit
.getResourceAdaptorComponents().values()) {
removeSecurityPermissions(component, false);
resourceManagement.uninstallResourceAdaptor(component);
componentRepositoryImpl.removeComponent(component
.getResourceAdaptorID());
logger.info("Uninstalled " + component);
}
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader());
removeSecurityPermissions(component, false);
sleeContainer.getSleeProfileTableManager()
.uninstallProfileSpecification(component);
componentRepositoryImpl.removeComponent(component
.getProfileSpecificationID());
logger.info("Uninstalled " + component);
}
for (ResourceAdaptorTypeComponent component : deployableUnit
.getResourceAdaptorTypeComponents().values()) {
resourceManagement
.uninstallResourceAdaptorType(component);
componentRepositoryImpl.removeComponent(component
.getResourceAdaptorTypeID());
logger.info("Uninstalled " + component);
}
for (EventTypeID componentID : deployableUnit
.getEventTypeComponents().keySet()) {
componentRepositoryImpl.removeComponent(componentID);
logger.info("Uninstalled " + componentID);
}
for (LibraryID componentID : deployableUnit
.getLibraryComponents().keySet()) {
removeSecurityPermissions(componentRepositoryImpl.getComponentByID(componentID), false);
componentRepositoryImpl.removeComponent(componentID);
logger.info("Uninstalled " + componentID);
}
removeSecurityPermissions(null,true);
// remove du
deployableUnitManagement
.removeDeployableUnit(deployableUnitID);
rollback = false;
logger.info("Uninstalled " +deployableUnitID);
} catch (InvalidStateException ex) {
logger.error(ex.getMessage(), ex);
throw ex;
} catch (DependencyException ex) {
logger.error(ex.getMessage(), ex);
throw ex;
} catch (Throwable ex) {
if (logger.isDebugEnabled())
logger.debug(ex.getMessage(),ex);
throw new ManagementException(
"Exception removing deployable Unit ", ex);
} finally {
currentThread.setContextClassLoader(currentClassLoader);
try {
if (rollback) {
if (deployableUnit != null) {
// put all components in the repo again
for (LibraryComponent component : deployableUnit
.getLibraryComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false);
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (EventTypeComponent component : deployableUnit
.getEventTypeComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (ResourceAdaptorTypeComponent component : deployableUnit
.getResourceAdaptorTypeComponents()
.values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents()
.values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false);
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (ResourceAdaptorComponent component : deployableUnit
.getResourceAdaptorComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false);
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (SbbComponent component : deployableUnit
.getSbbComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false);
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
for (ServiceComponent component : deployableUnit
.getServiceComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback");
}
}
updateSecurityPermissions(null, true);
deployableUnitManagement
.addDeployableUnit(deployableUnit);
}
sleeTransactionManager.rollback();
} else {
sleeTransactionManager.commit();
// FIXME: For JBoss 7.2.0.Final:
// we have a problem with org.hibernate.service.UnknownServiceException:
// Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry]
// see https://hibernate.atlassian.net/browse/HHH-8586
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader());
removeSecurityPermissions(component, false);
sleeContainer.getSleeProfileTableManager()
.closeEntityManagerFactory(component);
logger.info("Finalized " + component);
}
// Clean up all the class files.
deployableUnit.undeploy();
}
} catch (Throwable ex) {
throw new ManagementException(
"Exception while completing transaction", ex);
}
}
} else {
throw new UnrecognizedDeployableUnitException(
"deployable unit " + deployableUnitID);
}
}
} }
|
public class class_name {
public void uninstall(DeployableUnitID deployableUnitID)
throws NullPointerException, UnrecognizedDeployableUnitException,
DependencyException, InvalidStateException, ManagementException {
logger.info("Uninstalling " +deployableUnitID);
final SleeContainer sleeContainer = getSleeContainer();
final SleeTransactionManager sleeTransactionManager = sleeContainer
.getTransactionManager();
final ServiceManagement serviceManagement = sleeContainer
.getServiceManagement();
final ResourceManagement resourceManagement = sleeContainer
.getResourceManagement();
final DeployableUnitManagement deployableUnitManagement = sleeContainer
.getDeployableUnitManagement();
final ComponentRepository componentRepositoryImpl = sleeContainer
.getComponentRepository();
// we sync on the container's monitor object
synchronized (sleeContainer.getManagementMonitor()) {
if (this.isInstalled(deployableUnitID)) {
Thread currentThread = Thread.currentThread();
ClassLoader currentClassLoader = currentThread
.getContextClassLoader();
DeployableUnit deployableUnit = null;
boolean rollback = true;
try {
// start transaction
sleeTransactionManager.begin(); // depends on control dependency: [try], data = [none]
// get du
deployableUnit = deployableUnitManagement
.getDeployableUnit(deployableUnitID); // depends on control dependency: [try], data = [none]
// Check if its safe to remove the deployable unit.
for (SleeComponent sleeComponent : deployableUnit
.getDeployableUnitComponents()) {
for (SleeComponent referringComponent : sleeContainer
.getComponentRepository()
.getReferringComponents(sleeComponent)) {
if (!referringComponent.getDeployableUnit()
.getDeployableUnitID().equals(
deployableUnitID)) {
throw new DependencyException("Component "
+ referringComponent
+ " refers DU component "
+ sleeComponent);
}
}
}
for (ServiceComponent component : deployableUnit
.getServiceComponents().values()) {
serviceManagement.uninstallService(component); // depends on control dependency: [for], data = [component]
componentRepositoryImpl.removeComponent(component
.getServiceID()); // depends on control dependency: [for], data = [component]
logger.info("Uninstalled " + component); // depends on control dependency: [for], data = [component]
}
for (SbbComponent component : deployableUnit
.getSbbComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader()); // depends on control dependency: [for], data = [none]
removeSecurityPermissions(component, false); // depends on control dependency: [for], data = [component]
sleeContainer.getSbbManagement()
.uninstallSbb(component); // depends on control dependency: [for], data = [none]
componentRepositoryImpl.removeComponent(component
.getSbbID()); // depends on control dependency: [for], data = [component]
logger.info("Uninstalled " + component); // depends on control dependency: [for], data = [component]
}
for (ResourceAdaptorComponent component : deployableUnit
.getResourceAdaptorComponents().values()) {
removeSecurityPermissions(component, false); // depends on control dependency: [for], data = [component]
resourceManagement.uninstallResourceAdaptor(component); // depends on control dependency: [for], data = [component]
componentRepositoryImpl.removeComponent(component
.getResourceAdaptorID()); // depends on control dependency: [for], data = [component]
logger.info("Uninstalled " + component); // depends on control dependency: [for], data = [component]
}
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader()); // depends on control dependency: [for], data = [none]
removeSecurityPermissions(component, false); // depends on control dependency: [for], data = [component]
sleeContainer.getSleeProfileTableManager()
.uninstallProfileSpecification(component); // depends on control dependency: [for], data = [none]
componentRepositoryImpl.removeComponent(component
.getProfileSpecificationID()); // depends on control dependency: [for], data = [component]
logger.info("Uninstalled " + component); // depends on control dependency: [for], data = [component]
}
for (ResourceAdaptorTypeComponent component : deployableUnit
.getResourceAdaptorTypeComponents().values()) {
resourceManagement
.uninstallResourceAdaptorType(component); // depends on control dependency: [for], data = [none]
componentRepositoryImpl.removeComponent(component
.getResourceAdaptorTypeID()); // depends on control dependency: [for], data = [component]
logger.info("Uninstalled " + component); // depends on control dependency: [for], data = [component]
}
for (EventTypeID componentID : deployableUnit
.getEventTypeComponents().keySet()) {
componentRepositoryImpl.removeComponent(componentID); // depends on control dependency: [for], data = [componentID]
logger.info("Uninstalled " + componentID); // depends on control dependency: [for], data = [componentID]
}
for (LibraryID componentID : deployableUnit
.getLibraryComponents().keySet()) {
removeSecurityPermissions(componentRepositoryImpl.getComponentByID(componentID), false); // depends on control dependency: [for], data = [componentID]
componentRepositoryImpl.removeComponent(componentID); // depends on control dependency: [for], data = [componentID]
logger.info("Uninstalled " + componentID); // depends on control dependency: [for], data = [componentID]
}
removeSecurityPermissions(null,true); // depends on control dependency: [try], data = [none]
// remove du
deployableUnitManagement
.removeDeployableUnit(deployableUnitID); // depends on control dependency: [try], data = [none]
rollback = false; // depends on control dependency: [try], data = [none]
logger.info("Uninstalled " +deployableUnitID); // depends on control dependency: [try], data = [none]
} catch (InvalidStateException ex) {
logger.error(ex.getMessage(), ex);
throw ex;
} catch (DependencyException ex) { // depends on control dependency: [catch], data = [none]
logger.error(ex.getMessage(), ex);
throw ex;
} catch (Throwable ex) { // depends on control dependency: [catch], data = [none]
if (logger.isDebugEnabled())
logger.debug(ex.getMessage(),ex);
throw new ManagementException(
"Exception removing deployable Unit ", ex);
} finally { // depends on control dependency: [catch], data = [none]
currentThread.setContextClassLoader(currentClassLoader);
try {
if (rollback) {
if (deployableUnit != null) {
// put all components in the repo again
for (LibraryComponent component : deployableUnit
.getLibraryComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false); // depends on control dependency: [if], data = [none]
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (EventTypeComponent component : deployableUnit
.getEventTypeComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (ResourceAdaptorTypeComponent component : deployableUnit
.getResourceAdaptorTypeComponents()
.values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents()
.values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false); // depends on control dependency: [if], data = [none]
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (ResourceAdaptorComponent component : deployableUnit
.getResourceAdaptorComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false); // depends on control dependency: [if], data = [none]
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (SbbComponent component : deployableUnit
.getSbbComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
updateSecurityPermissions(component, false); // depends on control dependency: [if], data = [none]
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
for (ServiceComponent component : deployableUnit
.getServiceComponents().values()) {
if (componentRepositoryImpl.putComponent(component)) {
logger.info("Reinstalled " + component
+ " due to tx rollback"); // depends on control dependency: [if], data = [none]
}
}
updateSecurityPermissions(null, true); // depends on control dependency: [if], data = [none]
deployableUnitManagement
.addDeployableUnit(deployableUnit); // depends on control dependency: [if], data = [none]
}
sleeTransactionManager.rollback(); // depends on control dependency: [if], data = [none]
} else {
sleeTransactionManager.commit(); // depends on control dependency: [if], data = [none]
// FIXME: For JBoss 7.2.0.Final:
// we have a problem with org.hibernate.service.UnknownServiceException:
// Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry]
// see https://hibernate.atlassian.net/browse/HHH-8586
for (ProfileSpecificationComponent component : deployableUnit
.getProfileSpecificationComponents().values()) {
currentThread.setContextClassLoader(component
.getClassLoader()); // depends on control dependency: [for], data = [none]
removeSecurityPermissions(component, false); // depends on control dependency: [for], data = [component]
sleeContainer.getSleeProfileTableManager()
.closeEntityManagerFactory(component); // depends on control dependency: [for], data = [none]
logger.info("Finalized " + component); // depends on control dependency: [for], data = [component]
}
// Clean up all the class files.
deployableUnit.undeploy(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable ex) {
throw new ManagementException(
"Exception while completing transaction", ex);
} // depends on control dependency: [catch], data = [none]
}
} else {
throw new UnrecognizedDeployableUnitException(
"deployable unit " + deployableUnitID);
}
}
} }
|
public class class_name {
public static int[] factor (int n, int fromfactors[]){
int factors[] = new int[64]; // Cant be more than 64 factors.
int nf = 0;
int ntest = n;
int factor;
if (n <= 0) // Error case
throw new Error("Number ("+n+") must be positive integer");
/* deal with the preferred factors first */
for(int i = 0; i < fromfactors.length && ntest != 1; i++){
factor = fromfactors[i];
while ((ntest % factor) == 0) {
ntest /= factor;
factors[nf++] = factor; }}
/* deal with any other even prime factors (there is only one) */
factor = 2;
while ((ntest % factor) == 0 && (ntest != 1)) {
ntest /= factor;
factors[nf++] = factor; }
/* deal with any other odd prime factors */
factor = 3;
while (ntest != 1) {
while ((ntest % factor) != 0) {
factor += 2; }
ntest /= factor;
factors[nf++] = factor; }
/* check that the factorization is correct */
int product = 1;
for (int i = 0; i < nf; i++) {
product *= factors[i]; }
if (product != n)
throw new Error("factorization failed for "+n);
/* Now, make an array of the right length containing the factors... */
int f[] = new int[nf];
System.arraycopy(factors,0,f,0,nf);
return f; } }
|
public class class_name {
public static int[] factor (int n, int fromfactors[]){
int factors[] = new int[64]; // Cant be more than 64 factors.
int nf = 0;
int ntest = n;
int factor;
if (n <= 0) // Error case
throw new Error("Number ("+n+") must be positive integer");
/* deal with the preferred factors first */
for(int i = 0; i < fromfactors.length && ntest != 1; i++){
factor = fromfactors[i]; // depends on control dependency: [for], data = [i]
while ((ntest % factor) == 0) {
ntest /= factor; // depends on control dependency: [while], data = [none]
factors[nf++] = factor; }} // depends on control dependency: [while], data = [none]
/* deal with any other even prime factors (there is only one) */
factor = 2;
while ((ntest % factor) == 0 && (ntest != 1)) {
ntest /= factor; // depends on control dependency: [while], data = [none]
factors[nf++] = factor; } // depends on control dependency: [while], data = [none]
/* deal with any other odd prime factors */
factor = 3;
while (ntest != 1) {
while ((ntest % factor) != 0) {
factor += 2; } // depends on control dependency: [while], data = [none]
ntest /= factor; // depends on control dependency: [while], data = [none]
factors[nf++] = factor; } // depends on control dependency: [while], data = [none]
/* check that the factorization is correct */
int product = 1;
for (int i = 0; i < nf; i++) {
product *= factors[i]; } // depends on control dependency: [for], data = [i]
if (product != n)
throw new Error("factorization failed for "+n);
/* Now, make an array of the right length containing the factors... */
int f[] = new int[nf];
System.arraycopy(factors,0,f,0,nf);
return f; } }
|
public class class_name {
@SafeVarargs
public final <T> List<T> list(final Class<T> targetClass, final String sql, Object... parameters) {
final DataSet rs = query(targetClass, sql, 0, Integer.MAX_VALUE, parameters);
if (N.isNullOrEmpty(rs)) {
return new ArrayList<>();
} else {
return rs.toList(targetClass);
}
} }
|
public class class_name {
@SafeVarargs
public final <T> List<T> list(final Class<T> targetClass, final String sql, Object... parameters) {
final DataSet rs = query(targetClass, sql, 0, Integer.MAX_VALUE, parameters);
if (N.isNullOrEmpty(rs)) {
return new ArrayList<>();
// depends on control dependency: [if], data = [none]
} else {
return rs.toList(targetClass);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
StoryState copy() {
StoryState copy = new StoryState(story);
copy.getOutputStream().addAll(outputStream);
outputStreamDirty();
copy.currentChoices.addAll(currentChoices);
if (hasError()) {
copy.currentErrors = new ArrayList<String>();
copy.currentErrors.addAll(currentErrors);
}
if (hasWarning()) {
copy.currentWarnings = new ArrayList<String>();
copy.currentWarnings.addAll(currentWarnings);
}
copy.callStack = new CallStack(callStack);
copy.variablesState = new VariablesState(copy.callStack, story.getListDefinitions());
copy.variablesState.copyFrom(variablesState);
copy.evaluationStack.addAll(evaluationStack);
if (!divertedPointer.isNull())
copy.divertedPointer.assign(divertedPointer);
copy.setPreviousPointer(getPreviousPointer());
copy.visitCounts = new HashMap<String, Integer>(visitCounts);
copy.turnIndices = new HashMap<String, Integer>(turnIndices);
copy.currentTurnIndex = currentTurnIndex;
copy.storySeed = storySeed;
copy.previousRandom = previousRandom;
copy.setDidSafeExit(didSafeExit);
return copy;
} }
|
public class class_name {
StoryState copy() {
StoryState copy = new StoryState(story);
copy.getOutputStream().addAll(outputStream);
outputStreamDirty();
copy.currentChoices.addAll(currentChoices);
if (hasError()) {
copy.currentErrors = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
copy.currentErrors.addAll(currentErrors); // depends on control dependency: [if], data = [none]
}
if (hasWarning()) {
copy.currentWarnings = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
copy.currentWarnings.addAll(currentWarnings); // depends on control dependency: [if], data = [none]
}
copy.callStack = new CallStack(callStack);
copy.variablesState = new VariablesState(copy.callStack, story.getListDefinitions());
copy.variablesState.copyFrom(variablesState);
copy.evaluationStack.addAll(evaluationStack);
if (!divertedPointer.isNull())
copy.divertedPointer.assign(divertedPointer);
copy.setPreviousPointer(getPreviousPointer());
copy.visitCounts = new HashMap<String, Integer>(visitCounts);
copy.turnIndices = new HashMap<String, Integer>(turnIndices);
copy.currentTurnIndex = currentTurnIndex;
copy.storySeed = storySeed;
copy.previousRandom = previousRandom;
copy.setDidSafeExit(didSafeExit);
return copy;
} }
|
public class class_name {
public void setMode(int mode, boolean animation){
if(mMode != mode){
mMode = mode;
if(mOnTimeChangedListener != null)
mOnTimeChangedListener.onModeChanged(mMode);
if(animation)
startAnimation();
else
invalidate();
}
} }
|
public class class_name {
public void setMode(int mode, boolean animation){
if(mMode != mode){
mMode = mode; // depends on control dependency: [if], data = [none]
if(mOnTimeChangedListener != null)
mOnTimeChangedListener.onModeChanged(mMode);
if(animation)
startAnimation();
else
invalidate();
}
} }
|
public class class_name {
public static <E> void subtractInPlace(Counter<E> target, Counter<E> arg) {
for (E key : arg.keySet()) {
target.decrementCount(key, arg.getCount(key));
}
} }
|
public class class_name {
public static <E> void subtractInPlace(Counter<E> target, Counter<E> arg) {
for (E key : arg.keySet()) {
target.decrementCount(key, arg.getCount(key));
// depends on control dependency: [for], data = [key]
}
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public static void setSREInstalls(ISREInstall[] sres, IProgressMonitor monitor) throws CoreException {
final SubMonitor mon = SubMonitor.convert(monitor,
io.sarl.eclipse.runtime.Messages.SARLRuntime_0,
sres.length * 2 + ALL_SRE_INSTALLS.size());
initializeSREs();
final String oldDefaultId;
String newDefaultId;
final List<ISREInstall> newElements = new ArrayList<>();
final Map<String, ISREInstall> allKeys;
LOCK.lock();
try {
oldDefaultId = getDefaultSREId();
newDefaultId = oldDefaultId;
allKeys = new TreeMap<>(ALL_SRE_INSTALLS);
for (final ISREInstall sre : sres) {
if (allKeys.remove(sre.getId()) == null) {
newElements.add(sre);
ALL_SRE_INSTALLS.put(sre.getId(), sre);
}
mon.worked(1);
}
for (final ISREInstall sre : allKeys.values()) {
ALL_SRE_INSTALLS.remove(sre.getId());
platformSREInstalls.remove(sre.getId());
mon.worked(1);
}
if (oldDefaultId != null && !ALL_SRE_INSTALLS.containsKey(oldDefaultId)) {
newDefaultId = null;
}
} finally {
LOCK.unlock();
}
boolean changed = false;
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_1);
if (oldDefaultId != null && newDefaultId == null) {
changed = true;
setDefaultSREInstall(null, monitor);
}
mon.worked(1);
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_2);
for (final ISREInstall sre : allKeys.values()) {
changed = true;
fireSRERemoved(sre);
}
for (final ISREInstall sre : newElements) {
changed = true;
fireSREAdded(sre);
}
mon.worked(1);
if (changed) {
saveSREConfiguration(mon.newChild(sres.length - 2));
}
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public static void setSREInstalls(ISREInstall[] sres, IProgressMonitor monitor) throws CoreException {
final SubMonitor mon = SubMonitor.convert(monitor,
io.sarl.eclipse.runtime.Messages.SARLRuntime_0,
sres.length * 2 + ALL_SRE_INSTALLS.size());
initializeSREs();
final String oldDefaultId;
String newDefaultId;
final List<ISREInstall> newElements = new ArrayList<>();
final Map<String, ISREInstall> allKeys;
LOCK.lock();
try {
oldDefaultId = getDefaultSREId();
newDefaultId = oldDefaultId;
allKeys = new TreeMap<>(ALL_SRE_INSTALLS);
for (final ISREInstall sre : sres) {
if (allKeys.remove(sre.getId()) == null) {
newElements.add(sre); // depends on control dependency: [if], data = [none]
ALL_SRE_INSTALLS.put(sre.getId(), sre); // depends on control dependency: [if], data = [none]
}
mon.worked(1); // depends on control dependency: [for], data = [none]
}
for (final ISREInstall sre : allKeys.values()) {
ALL_SRE_INSTALLS.remove(sre.getId()); // depends on control dependency: [for], data = [sre]
platformSREInstalls.remove(sre.getId()); // depends on control dependency: [for], data = [sre]
mon.worked(1); // depends on control dependency: [for], data = [none]
}
if (oldDefaultId != null && !ALL_SRE_INSTALLS.containsKey(oldDefaultId)) {
newDefaultId = null; // depends on control dependency: [if], data = [none]
}
} finally {
LOCK.unlock();
}
boolean changed = false;
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_1);
if (oldDefaultId != null && newDefaultId == null) {
changed = true;
setDefaultSREInstall(null, monitor);
}
mon.worked(1);
mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_2);
for (final ISREInstall sre : allKeys.values()) {
changed = true;
fireSRERemoved(sre);
}
for (final ISREInstall sre : newElements) {
changed = true;
fireSREAdded(sre);
}
mon.worked(1);
if (changed) {
saveSREConfiguration(mon.newChild(sres.length - 2));
}
} }
|
public class class_name {
protected void endRequest() {
int oldState, newState;
do {
oldState = state;
newState = oldState - 1;
} while (!stateUpdater.compareAndSet(this, oldState, newState));
if (newState == CLOSED) {
handleCompleted();
}
} }
|
public class class_name {
protected void endRequest() {
int oldState, newState;
do {
oldState = state;
newState = oldState - 1;
} while (!stateUpdater.compareAndSet(this, oldState, newState));
if (newState == CLOSED) {
handleCompleted(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void onModuleLoad() {
final Button sendButton = new Button( messages.sendButton() );
final TextBox nameField = new TextBox();
nameField.setText( messages.nameField() );
final Label errorLabel = new Label();
// We can add style names to widgets
sendButton.addStyleName("sendButton");
// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element
RootPanel.get("nameFieldContainer").add(nameField);
RootPanel.get("sendButtonContainer").add(sendButton);
RootPanel.get("errorLabelContainer").add(errorLabel);
// Focus the cursor on the name field when the app loads
nameField.setFocus(true);
nameField.selectAll();
// Create the popup dialog box
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Remote Procedure Call");
dialogBox.setAnimationEnabled(true);
final Button closeButton = new Button("Close");
// We can set the id of a widget by accessing its Element
closeButton.getElement().setId("closeButton");
final Label textToServerLabel = new Label();
final HTML serverResponseLabel = new HTML();
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.addStyleName("dialogVPanel");
dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
dialogVPanel.add(textToServerLabel);
dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
dialogVPanel.add(serverResponseLabel);
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
dialogVPanel.add(closeButton);
dialogBox.setWidget(dialogVPanel);
// Add a handler to close the DialogBox
closeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
dialogBox.hide();
sendButton.setEnabled(true);
sendButton.setFocus(true);
}
});
// Create a handler for the sendButton and nameField
class MyHandler implements ClickHandler, KeyUpHandler {
/**
* Fired when the user clicks on the sendButton.
*/
public void onClick(ClickEvent event) {
sendNameToServer();
}
/**
* Fired when the user types in the nameField.
*/
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
sendNameToServer();
}
}
/**
* Send the name from the nameField to the server and wait for a response.
*/
private void sendNameToServer() {
// First, we validate the input.
errorLabel.setText("");
String textToServer = nameField.getText();
if (!FieldVerifier.isValidName(textToServer)) {
errorLabel.setText("Please enter at least four characters");
return;
}
// Then, we send the input to the server.
sendButton.setEnabled(false);
textToServerLabel.setText(textToServer);
serverResponseLabel.setText("");
greetingService.greetServer(textToServer, new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// Show the RPC error message to the user
dialogBox.setText("Remote Procedure Call - Failure");
serverResponseLabel.addStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(SERVER_ERROR);
dialogBox.center();
closeButton.setFocus(true);
}
public void onSuccess(String result) {
dialogBox.setText("Remote Procedure Call");
serverResponseLabel.removeStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(result);
dialogBox.center();
closeButton.setFocus(true);
}
});
}
}
// Add a handler to send the name to the server
MyHandler handler = new MyHandler();
sendButton.addClickHandler(handler);
nameField.addKeyUpHandler(handler);
} }
|
public class class_name {
public void onModuleLoad() {
final Button sendButton = new Button( messages.sendButton() );
final TextBox nameField = new TextBox();
nameField.setText( messages.nameField() );
final Label errorLabel = new Label();
// We can add style names to widgets
sendButton.addStyleName("sendButton");
// Add the nameField and sendButton to the RootPanel
// Use RootPanel.get() to get the entire body element
RootPanel.get("nameFieldContainer").add(nameField);
RootPanel.get("sendButtonContainer").add(sendButton);
RootPanel.get("errorLabelContainer").add(errorLabel);
// Focus the cursor on the name field when the app loads
nameField.setFocus(true);
nameField.selectAll();
// Create the popup dialog box
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Remote Procedure Call");
dialogBox.setAnimationEnabled(true);
final Button closeButton = new Button("Close");
// We can set the id of a widget by accessing its Element
closeButton.getElement().setId("closeButton");
final Label textToServerLabel = new Label();
final HTML serverResponseLabel = new HTML();
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.addStyleName("dialogVPanel");
dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
dialogVPanel.add(textToServerLabel);
dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
dialogVPanel.add(serverResponseLabel);
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
dialogVPanel.add(closeButton);
dialogBox.setWidget(dialogVPanel);
// Add a handler to close the DialogBox
closeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
dialogBox.hide();
sendButton.setEnabled(true);
sendButton.setFocus(true);
}
});
// Create a handler for the sendButton and nameField
class MyHandler implements ClickHandler, KeyUpHandler {
/**
* Fired when the user clicks on the sendButton.
*/
public void onClick(ClickEvent event) {
sendNameToServer();
}
/**
* Fired when the user types in the nameField.
*/
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
sendNameToServer(); // depends on control dependency: [if], data = [none]
}
}
/**
* Send the name from the nameField to the server and wait for a response.
*/
private void sendNameToServer() {
// First, we validate the input.
errorLabel.setText("");
String textToServer = nameField.getText();
if (!FieldVerifier.isValidName(textToServer)) {
errorLabel.setText("Please enter at least four characters"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Then, we send the input to the server.
sendButton.setEnabled(false);
textToServerLabel.setText(textToServer);
serverResponseLabel.setText("");
greetingService.greetServer(textToServer, new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// Show the RPC error message to the user
dialogBox.setText("Remote Procedure Call - Failure");
serverResponseLabel.addStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(SERVER_ERROR);
dialogBox.center();
closeButton.setFocus(true);
}
public void onSuccess(String result) {
dialogBox.setText("Remote Procedure Call");
serverResponseLabel.removeStyleName("serverResponseLabelError");
serverResponseLabel.setHTML(result);
dialogBox.center();
closeButton.setFocus(true);
}
});
}
}
// Add a handler to send the name to the server
MyHandler handler = new MyHandler();
sendButton.addClickHandler(handler);
nameField.addKeyUpHandler(handler);
} }
|
public class class_name {
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
// Set window transition elements
if(BuildUtils.isLollipop()) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
TransitionSet transitions = new TransitionSet()
.addTransition(new ChangeBounds())
.addTransition(new Fade());
getWindow().setEnterTransition(new Explode());
getWindow().setExitTransition(new Explode());
getWindow().setSharedElementEnterTransition(transitions);
getWindow().setSharedElementExitTransition(transitions);
}
super.onCreate(savedInstanceState);
overridePendingTransition(0, 0);
setContentView(R.layout.activity_license_detail);
// Inflate components
mAppbar = ButterKnife.findById(this, R.id.appbar);
mName = ButterKnife.findById(this, R.id.name);
mAuthor = ButterKnife.findById(this, R.id.author);
mLicense = ButterKnife.findById(this, R.id.license);
// Apply components
setSupportActionBar(mAppbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mAppbar.setNavigationOnClickListener(this);
// Parse extras
parseExtras(savedInstanceState);
} }
|
public class class_name {
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
// Set window transition elements
if(BuildUtils.isLollipop()) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); // depends on control dependency: [if], data = [none]
TransitionSet transitions = new TransitionSet()
.addTransition(new ChangeBounds())
.addTransition(new Fade());
getWindow().setEnterTransition(new Explode()); // depends on control dependency: [if], data = [none]
getWindow().setExitTransition(new Explode()); // depends on control dependency: [if], data = [none]
getWindow().setSharedElementEnterTransition(transitions); // depends on control dependency: [if], data = [none]
getWindow().setSharedElementExitTransition(transitions); // depends on control dependency: [if], data = [none]
}
super.onCreate(savedInstanceState);
overridePendingTransition(0, 0);
setContentView(R.layout.activity_license_detail);
// Inflate components
mAppbar = ButterKnife.findById(this, R.id.appbar);
mName = ButterKnife.findById(this, R.id.name);
mAuthor = ButterKnife.findById(this, R.id.author);
mLicense = ButterKnife.findById(this, R.id.license);
// Apply components
setSupportActionBar(mAppbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mAppbar.setNavigationOnClickListener(this);
// Parse extras
parseExtras(savedInstanceState);
} }
|
public class class_name {
public void marshall(ListGrantsRequest listGrantsRequest, ProtocolMarshaller protocolMarshaller) {
if (listGrantsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listGrantsRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listGrantsRequest.getMarker(), MARKER_BINDING);
protocolMarshaller.marshall(listGrantsRequest.getKeyId(), KEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListGrantsRequest listGrantsRequest, ProtocolMarshaller protocolMarshaller) {
if (listGrantsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listGrantsRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listGrantsRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listGrantsRequest.getKeyId(), KEYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static void flipAround(SceneStructureMetric structure, SceneObservations observations) {
// The first view will be identity
for (int i = 1; i < structure.views.length; i++) {
Se3_F64 w2v = structure.views[i].worldToView;
w2v.set(w2v.invert(null));
}
triangulatePoints(structure,observations);
} }
|
public class class_name {
private static void flipAround(SceneStructureMetric structure, SceneObservations observations) {
// The first view will be identity
for (int i = 1; i < structure.views.length; i++) {
Se3_F64 w2v = structure.views[i].worldToView;
w2v.set(w2v.invert(null)); // depends on control dependency: [for], data = [none]
}
triangulatePoints(structure,observations);
} }
|
public class class_name {
public void stop() {
if (future != null) {
future.cancel(true);
}
if (executor != null) {
executor.shutdownNow();
}
} }
|
public class class_name {
public void stop() {
if (future != null) {
future.cancel(true);
// depends on control dependency: [if], data = [none]
}
if (executor != null) {
executor.shutdownNow();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void wrap(ChannelHandlerContext ctx, boolean inUnwrap) throws SSLException {
ByteBuf out = null;
ChannelPromise promise = null;
ByteBufAllocator alloc = ctx.alloc();
boolean needUnwrap = false;
ByteBuf buf = null;
try {
final int wrapDataSize = this.wrapDataSize;
// Only continue to loop if the handler was not removed in the meantime.
// See https://github.com/netty/netty/issues/5860
outer: while (!ctx.isRemoved()) {
promise = ctx.newPromise();
buf = wrapDataSize > 0 ?
pendingUnencryptedWrites.remove(alloc, wrapDataSize, promise) :
pendingUnencryptedWrites.removeFirst(promise);
if (buf == null) {
break;
}
if (out == null) {
out = allocateOutNetBuf(ctx, buf.readableBytes(), buf.nioBufferCount());
}
SSLEngineResult result = wrap(alloc, engine, buf, out);
if (result.getStatus() == Status.CLOSED) {
buf.release();
buf = null;
promise.tryFailure(SSLENGINE_CLOSED);
promise = null;
// SSLEngine has been closed already.
// Any further write attempts should be denied.
pendingUnencryptedWrites.releaseAndFailAll(ctx, SSLENGINE_CLOSED);
return;
} else {
if (buf.isReadable()) {
pendingUnencryptedWrites.addFirst(buf, promise);
// When we add the buffer/promise pair back we need to be sure we don't complete the promise
// later in finishWrap. We only complete the promise if the buffer is completely consumed.
promise = null;
} else {
buf.release();
}
buf = null;
switch (result.getHandshakeStatus()) {
case NEED_TASK:
if (!runDelegatedTasks(inUnwrap)) {
// We scheduled a task on the delegatingTaskExecutor, so stop processing as we will
// resume once the task completes.
break outer;
}
break;
case FINISHED:
setHandshakeSuccess();
// deliberate fall-through
case NOT_HANDSHAKING:
setHandshakeSuccessIfStillHandshaking();
// deliberate fall-through
case NEED_WRAP:
finishWrap(ctx, out, promise, inUnwrap, false);
promise = null;
out = null;
break;
case NEED_UNWRAP:
needUnwrap = true;
return;
default:
throw new IllegalStateException(
"Unknown handshake status: " + result.getHandshakeStatus());
}
}
}
} finally {
// Ownership of buffer was not transferred, release it.
if (buf != null) {
buf.release();
}
finishWrap(ctx, out, promise, inUnwrap, needUnwrap);
}
} }
|
public class class_name {
private void wrap(ChannelHandlerContext ctx, boolean inUnwrap) throws SSLException {
ByteBuf out = null;
ChannelPromise promise = null;
ByteBufAllocator alloc = ctx.alloc();
boolean needUnwrap = false;
ByteBuf buf = null;
try {
final int wrapDataSize = this.wrapDataSize;
// Only continue to loop if the handler was not removed in the meantime.
// See https://github.com/netty/netty/issues/5860
outer: while (!ctx.isRemoved()) {
promise = ctx.newPromise(); // depends on control dependency: [while], data = [none]
buf = wrapDataSize > 0 ?
pendingUnencryptedWrites.remove(alloc, wrapDataSize, promise) :
pendingUnencryptedWrites.removeFirst(promise); // depends on control dependency: [while], data = [none]
if (buf == null) {
break;
}
if (out == null) {
out = allocateOutNetBuf(ctx, buf.readableBytes(), buf.nioBufferCount()); // depends on control dependency: [if], data = [none]
}
SSLEngineResult result = wrap(alloc, engine, buf, out);
if (result.getStatus() == Status.CLOSED) {
buf.release(); // depends on control dependency: [if], data = [none]
buf = null; // depends on control dependency: [if], data = [none]
promise.tryFailure(SSLENGINE_CLOSED); // depends on control dependency: [if], data = [none]
promise = null; // depends on control dependency: [if], data = [none]
// SSLEngine has been closed already.
// Any further write attempts should be denied.
pendingUnencryptedWrites.releaseAndFailAll(ctx, SSLENGINE_CLOSED); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
if (buf.isReadable()) {
pendingUnencryptedWrites.addFirst(buf, promise); // depends on control dependency: [if], data = [none]
// When we add the buffer/promise pair back we need to be sure we don't complete the promise
// later in finishWrap. We only complete the promise if the buffer is completely consumed.
promise = null; // depends on control dependency: [if], data = [none]
} else {
buf.release(); // depends on control dependency: [if], data = [none]
}
buf = null; // depends on control dependency: [if], data = [none]
switch (result.getHandshakeStatus()) {
case NEED_TASK:
if (!runDelegatedTasks(inUnwrap)) {
// We scheduled a task on the delegatingTaskExecutor, so stop processing as we will
// resume once the task completes.
break outer;
}
break;
case FINISHED:
setHandshakeSuccess();
// deliberate fall-through
case NOT_HANDSHAKING:
setHandshakeSuccessIfStillHandshaking();
// deliberate fall-through
case NEED_WRAP:
finishWrap(ctx, out, promise, inUnwrap, false);
promise = null; // depends on control dependency: [if], data = [none]
out = null; // depends on control dependency: [if], data = [none]
break;
case NEED_UNWRAP:
needUnwrap = true;
return; // depends on control dependency: [if], data = [none]
default:
throw new IllegalStateException(
"Unknown handshake status: " + result.getHandshakeStatus());
}
}
}
} finally {
// Ownership of buffer was not transferred, release it.
if (buf != null) {
buf.release();
}
finishWrap(ctx, out, promise, inUnwrap, needUnwrap);
}
} }
|
public class class_name {
public void setContentLength(int contentLength, boolean resetMatchCount) {
if (contentLength <= 0) {
throw new IllegalArgumentException("contentLength: "
+ contentLength);
}
ctx.setContentLength(contentLength);
if (resetMatchCount) {
ctx.setMatchCount(0);
}
} }
|
public class class_name {
public void setContentLength(int contentLength, boolean resetMatchCount) {
if (contentLength <= 0) {
throw new IllegalArgumentException("contentLength: "
+ contentLength);
}
ctx.setContentLength(contentLength);
if (resetMatchCount) {
ctx.setMatchCount(0); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void update(InputStream stream, long length, long position) throws IOException, RepositoryException
{
validateAndAdjustLenght(length, position, Integer.MAX_VALUE);
long newSize = Math.max(length + position, value.length);
byte[] newBytes = new byte[(int)newSize];
if (position > 0)
{
// begin from the existed bytes
System.arraycopy(value, 0, newBytes, 0, (int)(position < value.length ? position : value.length));
}
// write new data
long read;
boolean doRead = true;
byte[] buff = new byte[2048];
while (doRead && (read = stream.read(buff)) >= 0)
{
if (position + read > newBytes.length)
{
// given length reached
read = newBytes.length - position;
doRead = false;
}
System.arraycopy(buff, 0, newBytes, (int)position, (int)read);
position += read;
}
if (position < value.length)
{
// write the rest of existed data
System.arraycopy(value, (int)position, newBytes, (int)position, (int)(value.length - position));
}
value = newBytes;
} }
|
public class class_name {
public void update(InputStream stream, long length, long position) throws IOException, RepositoryException
{
validateAndAdjustLenght(length, position, Integer.MAX_VALUE);
long newSize = Math.max(length + position, value.length);
byte[] newBytes = new byte[(int)newSize];
if (position > 0)
{
// begin from the existed bytes
System.arraycopy(value, 0, newBytes, 0, (int)(position < value.length ? position : value.length));
}
// write new data
long read;
boolean doRead = true;
byte[] buff = new byte[2048];
while (doRead && (read = stream.read(buff)) >= 0)
{
if (position + read > newBytes.length)
{
// given length reached
read = newBytes.length - position; // depends on control dependency: [if], data = [none]
doRead = false; // depends on control dependency: [if], data = [none]
}
System.arraycopy(buff, 0, newBytes, (int)position, (int)read);
position += read;
}
if (position < value.length)
{
// write the rest of existed data
System.arraycopy(value, (int)position, newBytes, (int)position, (int)(value.length - position));
}
value = newBytes;
} }
|
public class class_name {
private void CheckTiles(IFD ifd, IfdTags metadata, int n) {
long offset;
int id;
// Check Tile Offsets
id = TiffTags.getTagId("TileOffsets");
offset = metadata.get(id).getFirstNumericValue();
int no = metadata.get(id).getCardinality();
if (offset <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
offset);
// Check Tile Byte Counts
id = TiffTags.getTagId("TileBYTECounts");
offset = metadata.get(id).getFirstNumericValue();
int nc = metadata.get(id).getCardinality();
if (offset <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
offset);
if (no != nc) {
validation.addErrorLoc("Inconsistent tile lengths", "IFD" + n);
}
// Check Tile Width
long tileWidth = 0;
id = TiffTags.getTagId("TileWidth");
if (!metadata.containsTagId(id))
validation.addErrorLoc("Missing required field for tiles " + TiffTags.getTag(id).getName(),
"IFD" + n);
else {
tileWidth = metadata.get(id).getFirstNumericValue();
if (tileWidth <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
tileWidth);
}
// Check Tile Length
id = TiffTags.getTagId("TileLength");
long tileLength = 0;
if (!metadata.containsTagId(id))
validation.addErrorLoc("Missing required field for tiles " + TiffTags.getTag(id).getName(),
"IFD" + n);
else {
tileLength = metadata.get(id).getFirstNumericValue();
if (tileLength <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
tileLength);
}
long tilesPerImage =
((metadata.get(TiffTags.getTagId("ImageWidth")).getFirstNumericValue() + tileWidth - 1) / tileWidth)
* ((metadata.get(TiffTags.getTagId("ImageLength")).getFirstNumericValue() + tileLength - 1) / tileLength);
// Check Plannar Configuration
id = TiffTags.getTagId("PlanarConfiguration");
int idspp = TiffTags.getTagId("SamplesPerPixel");
if (metadata.containsTagId(id) && metadata.containsTagId(idspp)) {
long planar = metadata.get(id).getFirstNumericValue();
long spp = metadata.get(idspp).getFirstNumericValue();
if (planar == 2) {
long spp_tpi = spp * tilesPerImage;
if (ifd.getImageTiles().getTiles().size() < spp_tpi) {
validation.addErrorLoc("Insufficient tiles", "IFD" + n);
}
}
}
} }
|
public class class_name {
private void CheckTiles(IFD ifd, IfdTags metadata, int n) {
long offset;
int id;
// Check Tile Offsets
id = TiffTags.getTagId("TileOffsets");
offset = metadata.get(id).getFirstNumericValue();
int no = metadata.get(id).getCardinality();
if (offset <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
offset);
// Check Tile Byte Counts
id = TiffTags.getTagId("TileBYTECounts");
offset = metadata.get(id).getFirstNumericValue();
int nc = metadata.get(id).getCardinality();
if (offset <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
offset);
if (no != nc) {
validation.addErrorLoc("Inconsistent tile lengths", "IFD" + n); // depends on control dependency: [if], data = [none]
}
// Check Tile Width
long tileWidth = 0;
id = TiffTags.getTagId("TileWidth");
if (!metadata.containsTagId(id))
validation.addErrorLoc("Missing required field for tiles " + TiffTags.getTag(id).getName(),
"IFD" + n);
else {
tileWidth = metadata.get(id).getFirstNumericValue(); // depends on control dependency: [if], data = [none]
if (tileWidth <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
tileWidth);
}
// Check Tile Length
id = TiffTags.getTagId("TileLength");
long tileLength = 0;
if (!metadata.containsTagId(id))
validation.addErrorLoc("Missing required field for tiles " + TiffTags.getTag(id).getName(),
"IFD" + n);
else {
tileLength = metadata.get(id).getFirstNumericValue(); // depends on control dependency: [if], data = [none]
if (tileLength <= 0)
validation.addError("Invalid value for field " + TiffTags.getTag(id).getName(), "IFD" + n,
tileLength);
}
long tilesPerImage =
((metadata.get(TiffTags.getTagId("ImageWidth")).getFirstNumericValue() + tileWidth - 1) / tileWidth)
* ((metadata.get(TiffTags.getTagId("ImageLength")).getFirstNumericValue() + tileLength - 1) / tileLength);
// Check Plannar Configuration
id = TiffTags.getTagId("PlanarConfiguration");
int idspp = TiffTags.getTagId("SamplesPerPixel");
if (metadata.containsTagId(id) && metadata.containsTagId(idspp)) {
long planar = metadata.get(id).getFirstNumericValue();
long spp = metadata.get(idspp).getFirstNumericValue();
if (planar == 2) {
long spp_tpi = spp * tilesPerImage;
if (ifd.getImageTiles().getTiles().size() < spp_tpi) {
validation.addErrorLoc("Insufficient tiles", "IFD" + n); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private static void parseStencil(JSONObject modelJSON,
Shape current) throws JSONException {
// get stencil type
if (modelJSON.has("stencil")) {
JSONObject stencil = modelJSON.getJSONObject("stencil");
// TODO other attributes of stencil
String stencilString = "";
if (stencil.has("id")) {
stencilString = stencil.getString("id");
}
current.setStencil(new StencilType(stencilString));
}
} }
|
public class class_name {
private static void parseStencil(JSONObject modelJSON,
Shape current) throws JSONException {
// get stencil type
if (modelJSON.has("stencil")) {
JSONObject stencil = modelJSON.getJSONObject("stencil");
// TODO other attributes of stencil
String stencilString = "";
if (stencil.has("id")) {
stencilString = stencil.getString("id"); // depends on control dependency: [if], data = [none]
}
current.setStencil(new StencilType(stencilString));
}
} }
|
public class class_name {
public TaskGetHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} }
|
public class class_name {
public TaskGetHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} }
|
public class class_name {
public void marshall(ListProvisioningArtifactsRequest listProvisioningArtifactsRequest, ProtocolMarshaller protocolMarshaller) {
if (listProvisioningArtifactsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listProvisioningArtifactsRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING);
protocolMarshaller.marshall(listProvisioningArtifactsRequest.getProductId(), PRODUCTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListProvisioningArtifactsRequest listProvisioningArtifactsRequest, ProtocolMarshaller protocolMarshaller) {
if (listProvisioningArtifactsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listProvisioningArtifactsRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listProvisioningArtifactsRequest.getProductId(), PRODUCTID_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 final RequestType getRequestType(Object context, Object request)
{
//Stuff is laid out strangely in this class in order to optimize
//performance. We want to do as few instanceof's as possible so
//things are laid out according to the expected frequency of the
//various requests occurring.
if(_PORTLET_10_SUPPORTED || _PORTLET_20_SUPPORTED)
{
if (_PORTLET_CONFIG_CLASS.isInstance(context) ||
_PORTLET_CONTEXT_CLASS.isInstance(context))
{
//We are inside of a portlet container
if(_PORTLET_RENDER_REQUEST_CLASS.isInstance(request))
{
return RequestType.RENDER;
}
if(_PORTLET_RESOURCE_REQUEST_CLASS != null)
{
if(_PORTLET_ACTION_REQUEST_CLASS.isInstance(request))
{
return RequestType.ACTION;
}
//We are in a JSR-286 container
if(_PORTLET_RESOURCE_REQUEST_CLASS.isInstance(request))
{
return RequestType.RESOURCE;
}
return RequestType.EVENT;
}
return RequestType.ACTION;
}
}
return RequestType.SERVLET;
} }
|
public class class_name {
public static final RequestType getRequestType(Object context, Object request)
{
//Stuff is laid out strangely in this class in order to optimize
//performance. We want to do as few instanceof's as possible so
//things are laid out according to the expected frequency of the
//various requests occurring.
if(_PORTLET_10_SUPPORTED || _PORTLET_20_SUPPORTED)
{
if (_PORTLET_CONFIG_CLASS.isInstance(context) ||
_PORTLET_CONTEXT_CLASS.isInstance(context))
{
//We are inside of a portlet container
if(_PORTLET_RENDER_REQUEST_CLASS.isInstance(request))
{
return RequestType.RENDER; // depends on control dependency: [if], data = [none]
}
if(_PORTLET_RESOURCE_REQUEST_CLASS != null)
{
if(_PORTLET_ACTION_REQUEST_CLASS.isInstance(request))
{
return RequestType.ACTION; // depends on control dependency: [if], data = [none]
}
//We are in a JSR-286 container
if(_PORTLET_RESOURCE_REQUEST_CLASS.isInstance(request))
{
return RequestType.RESOURCE; // depends on control dependency: [if], data = [none]
}
return RequestType.EVENT; // depends on control dependency: [if], data = [none]
}
return RequestType.ACTION; // depends on control dependency: [if], data = [none]
}
}
return RequestType.SERVLET;
} }
|
public class class_name {
public static BaseResult img_sec_check(String access_token,InputStream media){
HttpPost httpPost = new HttpPost(BASE_URI + "/wxa/img_sec_check");
byte[] data = null;
try {
data = StreamUtils.copyToByteArray(media);
} catch (IOException e) {
logger.error("", e);
}
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp.jpg")
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} }
|
public class class_name {
public static BaseResult img_sec_check(String access_token,InputStream media){
HttpPost httpPost = new HttpPost(BASE_URI + "/wxa/img_sec_check");
byte[] data = null;
try {
data = StreamUtils.copyToByteArray(media);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("", e);
}
// depends on control dependency: [catch], data = [none]
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp.jpg")
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} }
|
public class class_name {
public Object[] getValueArray(Object[] arguments, Service service) {
Object[] paramArray = new Object[this.parameters.size()];
int argumentIndex = 0;
for (int i = 0; i < this.parameters.size(); i++) {
// inject params if needed
IParameter p = this.parameters.get(i);
try {
if (p instanceof InjectedParameter) {
paramArray[i] = p.getArgumentValue(null, service);
} else {
paramArray[i] = p.getArgumentValue(arguments[argumentIndex], service);
argumentIndex++;
}
} catch (ClassCastException e) {
SystemUtils.trace("twine", "getArgumentValue failed on parameter " + (i + 1) + ": " + e.getMessage());
}
}
return paramArray;
} }
|
public class class_name {
public Object[] getValueArray(Object[] arguments, Service service) {
Object[] paramArray = new Object[this.parameters.size()];
int argumentIndex = 0;
for (int i = 0; i < this.parameters.size(); i++) {
// inject params if needed
IParameter p = this.parameters.get(i);
try {
if (p instanceof InjectedParameter) {
paramArray[i] = p.getArgumentValue(null, service); // depends on control dependency: [if], data = [none]
} else {
paramArray[i] = p.getArgumentValue(arguments[argumentIndex], service); // depends on control dependency: [if], data = [none]
argumentIndex++; // depends on control dependency: [if], data = [none]
}
} catch (ClassCastException e) {
SystemUtils.trace("twine", "getArgumentValue failed on parameter " + (i + 1) + ": " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
return paramArray;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <VALUEBASE, VALUE extends VALUEBASE, KEY extends Key<CoreMap, VALUEBASE>>
VALUE set(Class<KEY> key, VALUE value) {
// search array for existing value to replace
for (int i = 0; i < size; i++) {
if (keys[i] == key) {
VALUE rv = (VALUE)values[i];
values[i] = value;
return rv;
}
}
// not found in arrays, add to end ...
// increment capacity of arrays if necessary
if (size >= keys.length) {
int capacity = keys.length + (keys.length < 16 ? 4: 8);
Class<?>[] newKeys = new Class<?>[capacity];
Object[] newVals = new Object[capacity];
System.arraycopy(keys, 0, newKeys, 0, size);
System.arraycopy(values, 0, newVals, 0, size);
keys = newKeys;
values = newVals;
}
// store value
keys[size] = key;
values[size] = value;
size++;
return null;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <VALUEBASE, VALUE extends VALUEBASE, KEY extends Key<CoreMap, VALUEBASE>>
VALUE set(Class<KEY> key, VALUE value) {
// search array for existing value to replace
for (int i = 0; i < size; i++) {
if (keys[i] == key) {
VALUE rv = (VALUE)values[i];
values[i] = value;
// depends on control dependency: [if], data = [none]
return rv;
// depends on control dependency: [if], data = [none]
}
}
// not found in arrays, add to end ...
// increment capacity of arrays if necessary
if (size >= keys.length) {
int capacity = keys.length + (keys.length < 16 ? 4: 8);
Class<?>[] newKeys = new Class<?>[capacity];
Object[] newVals = new Object[capacity];
System.arraycopy(keys, 0, newKeys, 0, size);
System.arraycopy(values, 0, newVals, 0, size);
keys = newKeys;
values = newVals;
}
// store value
keys[size] = key;
values[size] = value;
size++;
return null;
// depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public LaSchedulingNow start() {
final ClassLoader originalLoader = startHotdeploy();
final Cron4jScheduler cron4jScheduler;
final Cron4jNow cron4jNow;
try {
final LaJobScheduler appScheduler = findAppScheduler();
inject(appScheduler);
final LaJobRunner jobRunner = appScheduler.createRunner();
inject(jobRunner);
cron4jScheduler = createCron4jScheduler(jobRunner);
cron4jNow = createCron4jNow(cron4jScheduler, jobRunner);
final Cron4jCron cron4jCron = createCron4jCron(cron4jScheduler, jobRunner, cron4jNow);
appScheduler.schedule(cron4jCron);
showBoot(appScheduler, jobRunner, cron4jScheduler, cron4jNow);
} finally {
stopHotdeploy(originalLoader);
}
// thread start is out of hot-deploy scope
// because launcher thread should not inherit hot-deploy class loader
startCron(cron4jScheduler);
return cron4jNow;
} }
|
public class class_name {
public LaSchedulingNow start() {
final ClassLoader originalLoader = startHotdeploy();
final Cron4jScheduler cron4jScheduler;
final Cron4jNow cron4jNow;
try {
final LaJobScheduler appScheduler = findAppScheduler();
inject(appScheduler); // depends on control dependency: [try], data = [none]
final LaJobRunner jobRunner = appScheduler.createRunner();
inject(jobRunner); // depends on control dependency: [try], data = [none]
cron4jScheduler = createCron4jScheduler(jobRunner); // depends on control dependency: [try], data = [none]
cron4jNow = createCron4jNow(cron4jScheduler, jobRunner); // depends on control dependency: [try], data = [none]
final Cron4jCron cron4jCron = createCron4jCron(cron4jScheduler, jobRunner, cron4jNow);
appScheduler.schedule(cron4jCron); // depends on control dependency: [try], data = [none]
showBoot(appScheduler, jobRunner, cron4jScheduler, cron4jNow); // depends on control dependency: [try], data = [none]
} finally {
stopHotdeploy(originalLoader);
}
// thread start is out of hot-deploy scope
// because launcher thread should not inherit hot-deploy class loader
startCron(cron4jScheduler);
return cron4jNow;
} }
|
public class class_name {
@Override
public List<String> predict(org.nd4j.linalg.dataset.api.DataSet dataSet) {
Preconditions.checkState(dataSet.getLabelNamesList() != null, "This method can only be used when the DataSet contains a label name list");
int[] intRet = predict(dataSet.getFeatures());
List<String> ret = new ArrayList<>();
for (int i = 0; i < intRet.length; i++) {
ret.add(i, dataSet.getLabelName(intRet[i]));
}
return ret;
} }
|
public class class_name {
@Override
public List<String> predict(org.nd4j.linalg.dataset.api.DataSet dataSet) {
Preconditions.checkState(dataSet.getLabelNamesList() != null, "This method can only be used when the DataSet contains a label name list");
int[] intRet = predict(dataSet.getFeatures());
List<String> ret = new ArrayList<>();
for (int i = 0; i < intRet.length; i++) {
ret.add(i, dataSet.getLabelName(intRet[i])); // depends on control dependency: [for], data = [i]
}
return ret;
} }
|
public class class_name {
public MockSecurityGroup authorizeSecurityGroupIngress(final String groupId, final String ipProtocol,
final Integer fromPort, final Integer toPort, final String cidrIp) {
if (groupId == null) {
return null;
}
MockSecurityGroup ret = allMockSecurityGroup.get(groupId);
if (ret != null) {
MockIpPermissionType mockIpPermissionType = new MockIpPermissionType();
mockIpPermissionType.setIpProtocol(ipProtocol);
mockIpPermissionType.setFromPort(fromPort);
mockIpPermissionType.setToPort(toPort);
List<String> ipRanges = new ArrayList<String>();
ipRanges.add(cidrIp);
mockIpPermissionType.setIpRanges(ipRanges);
List<MockIpPermissionType> mockIpPermissionTypes = ret.getIpPermissions();
mockIpPermissionTypes.add(mockIpPermissionType);
ret.setIpPermissions(mockIpPermissionTypes);
allMockSecurityGroup.put(ret.getGroupId(), ret);
}
return ret;
} }
|
public class class_name {
public MockSecurityGroup authorizeSecurityGroupIngress(final String groupId, final String ipProtocol,
final Integer fromPort, final Integer toPort, final String cidrIp) {
if (groupId == null) {
return null; // depends on control dependency: [if], data = [none]
}
MockSecurityGroup ret = allMockSecurityGroup.get(groupId);
if (ret != null) {
MockIpPermissionType mockIpPermissionType = new MockIpPermissionType();
mockIpPermissionType.setIpProtocol(ipProtocol); // depends on control dependency: [if], data = [none]
mockIpPermissionType.setFromPort(fromPort); // depends on control dependency: [if], data = [none]
mockIpPermissionType.setToPort(toPort); // depends on control dependency: [if], data = [none]
List<String> ipRanges = new ArrayList<String>();
ipRanges.add(cidrIp); // depends on control dependency: [if], data = [none]
mockIpPermissionType.setIpRanges(ipRanges); // depends on control dependency: [if], data = [none]
List<MockIpPermissionType> mockIpPermissionTypes = ret.getIpPermissions();
mockIpPermissionTypes.add(mockIpPermissionType); // depends on control dependency: [if], data = [none]
ret.setIpPermissions(mockIpPermissionTypes); // depends on control dependency: [if], data = [none]
allMockSecurityGroup.put(ret.getGroupId(), ret); // depends on control dependency: [if], data = [(ret]
}
return ret;
} }
|
public class class_name {
private com.buschmais.xo.spi.reflection.AnnotatedElement<?> getRelationDefinitionElement(PropertyMethod propertyMethod) {
if (propertyMethod.getByMetaAnnotationOfProperty(RelationDefinition.class) != null) {
return propertyMethod;
}
Annotation[] declaredAnnotations = propertyMethod.getAnnotationsOfProperty();
for (int i = 0; i < declaredAnnotations.length; i++) {
com.buschmais.xo.spi.reflection.AnnotatedElement<?> annotationTypeElement = new AnnotatedType(declaredAnnotations[i].annotationType());
if (annotationTypeElement.getByMetaAnnotation(RelationDefinition.class) != null) {
return annotationTypeElement;
}
}
return propertyMethod;
} }
|
public class class_name {
private com.buschmais.xo.spi.reflection.AnnotatedElement<?> getRelationDefinitionElement(PropertyMethod propertyMethod) {
if (propertyMethod.getByMetaAnnotationOfProperty(RelationDefinition.class) != null) {
return propertyMethod; // depends on control dependency: [if], data = [none]
}
Annotation[] declaredAnnotations = propertyMethod.getAnnotationsOfProperty();
for (int i = 0; i < declaredAnnotations.length; i++) {
com.buschmais.xo.spi.reflection.AnnotatedElement<?> annotationTypeElement = new AnnotatedType(declaredAnnotations[i].annotationType());
if (annotationTypeElement.getByMetaAnnotation(RelationDefinition.class) != null) {
return annotationTypeElement; // depends on control dependency: [if], data = [none]
}
}
return propertyMethod;
} }
|
public class class_name {
private GeoPackage getOrOpen(String name, boolean writable, boolean cache) {
GeoPackage geoPackage = get(name);
if (geoPackage == null) {
geoPackage = manager.open(name, writable);
if (cache) {
add(geoPackage);
}
}
return geoPackage;
} }
|
public class class_name {
private GeoPackage getOrOpen(String name, boolean writable, boolean cache) {
GeoPackage geoPackage = get(name);
if (geoPackage == null) {
geoPackage = manager.open(name, writable); // depends on control dependency: [if], data = [none]
if (cache) {
add(geoPackage); // depends on control dependency: [if], data = [none]
}
}
return geoPackage;
} }
|
public class class_name {
public synchronized SIDestinationAddress getSIDestinationAddress(short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIDestinationAddress", Short.valueOf(fapLevel)); //469395
checkReleased();
boolean isFromMediation = false;
/**************************************************************/
/* Uuid */
/**************************************************************/
short uuidLength = getShort(); // BIT16 Uuid Length
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid length:", ""+uuidLength);
SIBUuid8 uuid = null;
// Note: In all other cases, a length of -1 would normally indicate a null value.
// However, in this case we use a length 0 to inidicate a null value, mainly
// because the uuid can not be 0 in length, and using 0 makes the code neater.
if (uuidLength != 0)
{
if (uuidLength == 1)
{
byte addressFlags = get();
if (addressFlags == CommsConstants.DESTADDR_ISFROMMEDIATION)
{
isFromMediation = true;
}
}
else
{
byte[] uuidBytes = get(uuidLength); // BYTE[] Uuid
uuid = new SIBUuid8(uuidBytes);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid:", uuid);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid was null");
}
/**************************************************************/
/* Destination */
/**************************************************************/
String destinationName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination name:", destinationName);
/**************************************************************/
/* Bus name */
/**************************************************************/
String busName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Bus name:", busName);
/**************************************************************/
/* Local only */
/**************************************************************/
//Only read from buffer if fap 9 or greater
//Default value if not flown is false for backwards compatibility.
boolean localOnly = false;
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
final byte localOnlyByte = get();
localOnly = (localOnlyByte == CommsConstants.TRUE_BYTE);
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "localOnly: ", localOnly);
// If we get a null UUID, a null name and a null bus name, return null
JsDestinationAddress destAddress = null;
if (uuid == null && destinationName == null && busName == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Both UUID, destination name and bus name were null");
}
else
{
//lohith liberty change
/* if (isFromMediation)
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsMediationdestinationAddress(destinationName);
}
else*/
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsDestinationAddress(destinationName,
localOnly,
uuid,
busName);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIDestinationAddress",destAddress); //469395
return destAddress;
} }
|
public class class_name {
public synchronized SIDestinationAddress getSIDestinationAddress(short fapLevel)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSIDestinationAddress", Short.valueOf(fapLevel)); //469395
checkReleased();
boolean isFromMediation = false;
/**************************************************************/
/* Uuid */
/**************************************************************/
short uuidLength = getShort(); // BIT16 Uuid Length
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid length:", ""+uuidLength);
SIBUuid8 uuid = null;
// Note: In all other cases, a length of -1 would normally indicate a null value.
// However, in this case we use a length 0 to inidicate a null value, mainly
// because the uuid can not be 0 in length, and using 0 makes the code neater.
if (uuidLength != 0)
{
if (uuidLength == 1)
{
byte addressFlags = get();
if (addressFlags == CommsConstants.DESTADDR_ISFROMMEDIATION)
{
isFromMediation = true; // depends on control dependency: [if], data = [none]
}
}
else
{
byte[] uuidBytes = get(uuidLength); // BYTE[] Uuid
uuid = new SIBUuid8(uuidBytes); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid:", uuid);
}
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Uuid was null");
}
/**************************************************************/
/* Destination */
/**************************************************************/
String destinationName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Destination name:", destinationName);
/**************************************************************/
/* Bus name */
/**************************************************************/
String busName = getString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Bus name:", busName);
/**************************************************************/
/* Local only */
/**************************************************************/
//Only read from buffer if fap 9 or greater
//Default value if not flown is false for backwards compatibility.
boolean localOnly = false;
if(fapLevel >= JFapChannelConstants.FAP_VERSION_9)
{
final byte localOnlyByte = get();
localOnly = (localOnlyByte == CommsConstants.TRUE_BYTE); // depends on control dependency: [if], data = [none]
}
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "localOnly: ", localOnly);
// If we get a null UUID, a null name and a null bus name, return null
JsDestinationAddress destAddress = null;
if (uuid == null && destinationName == null && busName == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Both UUID, destination name and bus name were null");
}
else
{
//lohith liberty change
/* if (isFromMediation)
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsMediationdestinationAddress(destinationName);
}
else*/
{
destAddress =
((JsDestinationAddressFactory) JsDestinationAddressFactory.getInstance()).
createJsDestinationAddress(destinationName,
localOnly,
uuid,
busName);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSIDestinationAddress",destAddress); //469395
return destAddress;
} }
|
public class class_name {
public @NotNull ByteAssert isGreaterThanOrEqualTo(byte other) {
if (actual >= other) {
return this;
}
failIfCustomMessageIsSet();
throw failure(unexpectedLessThan(actual, other));
} }
|
public class class_name {
public @NotNull ByteAssert isGreaterThanOrEqualTo(byte other) {
if (actual >= other) {
return this; // depends on control dependency: [if], data = [none]
}
failIfCustomMessageIsSet();
throw failure(unexpectedLessThan(actual, other));
} }
|
public class class_name {
public void eraseEventFire(String identifier)
{
ItemState item = getItemState(identifier);
if (item != null)
{
item.eraseEventFire();
Map<String, ItemState> children = lastChildPropertyStates.get(identifier);
if (children != null)
{
// Call the method ItemState.eraseEventFire() on each properties
for (ItemState child : children.values())
{
child.eraseEventFire();
}
}
children = lastChildNodeStates.get(identifier);
if (children != null)
{
// Recursively call the method eraseEventFire(String identifier) for each sub node
for (ItemState child : children.values())
{
eraseEventFire(child.getData().getIdentifier());
}
}
}
} }
|
public class class_name {
public void eraseEventFire(String identifier)
{
ItemState item = getItemState(identifier);
if (item != null)
{
item.eraseEventFire(); // depends on control dependency: [if], data = [none]
Map<String, ItemState> children = lastChildPropertyStates.get(identifier);
if (children != null)
{
// Call the method ItemState.eraseEventFire() on each properties
for (ItemState child : children.values())
{
child.eraseEventFire(); // depends on control dependency: [for], data = [child]
}
}
children = lastChildNodeStates.get(identifier); // depends on control dependency: [if], data = [none]
if (children != null)
{
// Recursively call the method eraseEventFire(String identifier) for each sub node
for (ItemState child : children.values())
{
eraseEventFire(child.getData().getIdentifier()); // depends on control dependency: [for], data = [child]
}
}
}
} }
|
public class class_name {
protected void logException(E ex, HttpServletRequest req) {
if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) {
Marker marker = MarkerFactory.getMarker(ex.getClass().getName());
String uri = req.getRequestURI();
if (req.getQueryString() != null) {
uri += '?' + req.getQueryString();
}
String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus());
if (getStatus().value() >= 500) {
LOG.error(marker, msg, ex);
} else if (LOG.isDebugEnabled()) {
LOG.debug(marker, msg, ex);
} else {
LOG.info(marker, msg);
}
}
} }
|
public class class_name {
protected void logException(E ex, HttpServletRequest req) {
if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) {
Marker marker = MarkerFactory.getMarker(ex.getClass().getName());
String uri = req.getRequestURI();
if (req.getQueryString() != null) {
uri += '?' + req.getQueryString(); // depends on control dependency: [if], data = [none]
}
String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus());
if (getStatus().value() >= 500) {
LOG.error(marker, msg, ex); // depends on control dependency: [if], data = [none]
} else if (LOG.isDebugEnabled()) {
LOG.debug(marker, msg, ex); // depends on control dependency: [if], data = [none]
} else {
LOG.info(marker, msg); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static void translateAndCache(PmiModuleConfig cfg, Locale l) {
PmiModuleConfig aCfg = getConfig(l, cfg.getUID());
if (aCfg == null) {
aCfg = cfg.copy(); // create a copy before translating
// filter sub-module entry
if (aCfg != null) {
PmiDataInfo[] data = aCfg.listData(null);
for (int k = data.length - 1; k >= 0; k--) {
if (data[k].getType() == PmiConstants.TYPE_SUBMODULE)
aCfg.removeData(data[k]);
}
}
aCfg = translate(aCfg, l); //getNLS (l, cfg.getResourceBundle()));
getConfigMap(l).put(aCfg.getUID(), aCfg);
}
} }
|
public class class_name {
public static void translateAndCache(PmiModuleConfig cfg, Locale l) {
PmiModuleConfig aCfg = getConfig(l, cfg.getUID());
if (aCfg == null) {
aCfg = cfg.copy(); // create a copy before translating // depends on control dependency: [if], data = [none]
// filter sub-module entry
if (aCfg != null) {
PmiDataInfo[] data = aCfg.listData(null);
for (int k = data.length - 1; k >= 0; k--) {
if (data[k].getType() == PmiConstants.TYPE_SUBMODULE)
aCfg.removeData(data[k]);
}
}
aCfg = translate(aCfg, l); //getNLS (l, cfg.getResourceBundle())); // depends on control dependency: [if], data = [(aCfg]
getConfigMap(l).put(aCfg.getUID(), aCfg); // depends on control dependency: [if], data = [(aCfg]
}
} }
|
public class class_name {
public ListSecretVersionIdsResult withVersions(SecretVersionsListEntry... versions) {
if (this.versions == null) {
setVersions(new java.util.ArrayList<SecretVersionsListEntry>(versions.length));
}
for (SecretVersionsListEntry ele : versions) {
this.versions.add(ele);
}
return this;
} }
|
public class class_name {
public ListSecretVersionIdsResult withVersions(SecretVersionsListEntry... versions) {
if (this.versions == null) {
setVersions(new java.util.ArrayList<SecretVersionsListEntry>(versions.length)); // depends on control dependency: [if], data = [none]
}
for (SecretVersionsListEntry ele : versions) {
this.versions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public Object newInstance( String name, Object[] params, String[] types ) throws ClassLoaderException {
Class<?> clazz;
try {
clazz = loadClass(name);
} catch (ClassNotFoundException e) {
throw new ClassLoaderException(e);
}
List<Class> paramTypes = new ArrayList<Class>();
if ( types != null ) {
for( String type: types ) {
try {
paramTypes.add( loadClass(type) );
} catch (ClassNotFoundException e) {
throw new ClassLoaderException(e);
}
}
} else if ( params != null ) {
for ( Object param: params ) {
paramTypes.add( param.getClass() );
}
}
if ( params != null ) {
Constructor<?> constructor;
try {
constructor = clazz.getConstructor( paramTypes.toArray( new Class[paramTypes.size()] ) );
} catch (SecurityException e) {
throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(), e);
} catch (NoSuchMethodException e) {
throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(), e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
}
try {
return constructor.newInstance(params);
} catch (IllegalArgumentException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InstantiationException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (IllegalAccessException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InvocationTargetException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
}
} else {
Constructor<?> constructor;
try {
constructor = clazz.getConstructor();
} catch (SecurityException e) {
throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(),e);
} catch (NoSuchMethodException e) {
throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
}
try {
return constructor.newInstance();
} catch (IllegalArgumentException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InstantiationException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (IllegalAccessException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InvocationTargetException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
}
}
} }
|
public class class_name {
public Object newInstance( String name, Object[] params, String[] types ) throws ClassLoaderException {
Class<?> clazz;
try {
clazz = loadClass(name);
} catch (ClassNotFoundException e) {
throw new ClassLoaderException(e);
}
List<Class> paramTypes = new ArrayList<Class>();
if ( types != null ) {
for( String type: types ) {
try {
paramTypes.add( loadClass(type) ); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new ClassLoaderException(e);
} // depends on control dependency: [catch], data = [none]
}
} else if ( params != null ) {
for ( Object param: params ) {
paramTypes.add( param.getClass() );
}
}
if ( params != null ) {
Constructor<?> constructor;
try {
constructor = clazz.getConstructor( paramTypes.toArray( new Class[paramTypes.size()] ) );
} catch (SecurityException e) {
throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(), e);
} catch (NoSuchMethodException e) {
throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(), e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
}
try {
return constructor.newInstance(params);
} catch (IllegalArgumentException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InstantiationException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (IllegalAccessException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InvocationTargetException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
}
} else {
Constructor<?> constructor;
try {
constructor = clazz.getConstructor();
} catch (SecurityException e) {
throw new ClassLoaderException("Private constructor for " + clazz.getSimpleName(),e);
} catch (NoSuchMethodException e) {
throw new ClassLoaderException("No such constructor for " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to access constructor for " + clazz.getSimpleName(), e);
}
try {
return constructor.newInstance();
} catch (IllegalArgumentException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InstantiationException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (IllegalAccessException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (InvocationTargetException e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
} catch (Exception e) {
throw new ClassLoaderException("Attempted to created new instance of " + clazz.getSimpleName(),e);
}
}
} }
|
public class class_name {
public void setProductName(java.util.Collection<StringFilter> productName) {
if (productName == null) {
this.productName = null;
return;
}
this.productName = new java.util.ArrayList<StringFilter>(productName);
} }
|
public class class_name {
public void setProductName(java.util.Collection<StringFilter> productName) {
if (productName == null) {
this.productName = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.productName = new java.util.ArrayList<StringFilter>(productName);
} }
|
public class class_name {
public Collection<Map.Entry<Address, List<Integer>>> getPartitions(PartitionTableView partitionTableView) {
Map<Address, List<Integer>> partitionsMap = new HashMap<Address, List<Integer>>();
int partitionCount = partitionTableView.getLength();
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
PartitionReplica owner = partitionTableView.getReplica(partitionId, 0);
if (owner == null) {
partitionsMap.clear();
return partitionsMap.entrySet();
}
Address clientOwnerAddress = clientAddressOf(owner.address());
if (clientOwnerAddress == null) {
partitionsMap.clear();
return partitionsMap.entrySet();
}
List<Integer> indexes = partitionsMap.get(clientOwnerAddress);
if (indexes == null) {
indexes = new LinkedList<Integer>();
partitionsMap.put(clientOwnerAddress, indexes);
}
indexes.add(partitionId);
}
return partitionsMap.entrySet();
} }
|
public class class_name {
public Collection<Map.Entry<Address, List<Integer>>> getPartitions(PartitionTableView partitionTableView) {
Map<Address, List<Integer>> partitionsMap = new HashMap<Address, List<Integer>>();
int partitionCount = partitionTableView.getLength();
for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
PartitionReplica owner = partitionTableView.getReplica(partitionId, 0);
if (owner == null) {
partitionsMap.clear(); // depends on control dependency: [if], data = [none]
return partitionsMap.entrySet(); // depends on control dependency: [if], data = [none]
}
Address clientOwnerAddress = clientAddressOf(owner.address());
if (clientOwnerAddress == null) {
partitionsMap.clear(); // depends on control dependency: [if], data = [none]
return partitionsMap.entrySet(); // depends on control dependency: [if], data = [none]
}
List<Integer> indexes = partitionsMap.get(clientOwnerAddress);
if (indexes == null) {
indexes = new LinkedList<Integer>(); // depends on control dependency: [if], data = [none]
partitionsMap.put(clientOwnerAddress, indexes); // depends on control dependency: [if], data = [none]
}
indexes.add(partitionId); // depends on control dependency: [for], data = [partitionId]
}
return partitionsMap.entrySet();
} }
|
public class class_name {
public HashMap<StreamShardMetadata, SequenceNumber> snapshotState() {
// this method assumes that the checkpoint lock is held
assert Thread.holdsLock(checkpointLock);
HashMap<StreamShardMetadata, SequenceNumber> stateSnapshot = new HashMap<>();
for (KinesisStreamShardState shardWithState : subscribedShardsState) {
stateSnapshot.put(shardWithState.getStreamShardMetadata(), shardWithState.getLastProcessedSequenceNum());
}
return stateSnapshot;
} }
|
public class class_name {
public HashMap<StreamShardMetadata, SequenceNumber> snapshotState() {
// this method assumes that the checkpoint lock is held
assert Thread.holdsLock(checkpointLock);
HashMap<StreamShardMetadata, SequenceNumber> stateSnapshot = new HashMap<>();
for (KinesisStreamShardState shardWithState : subscribedShardsState) {
stateSnapshot.put(shardWithState.getStreamShardMetadata(), shardWithState.getLastProcessedSequenceNum()); // depends on control dependency: [for], data = [shardWithState]
}
return stateSnapshot;
} }
|
public class class_name {
public T path(String path) {
if (path.length() == 0) {
this.path += encodePath(path);
} else {
this.path += "/" + encodePath(path);
}
return returnThis();
} }
|
public class class_name {
public T path(String path) {
if (path.length() == 0) {
this.path += encodePath(path); // depends on control dependency: [if], data = [none]
} else {
this.path += "/" + encodePath(path); // depends on control dependency: [if], data = [none]
}
return returnThis();
} }
|
public class class_name {
public boolean removeVertex(Vertex<T> v)
{
if (!verticies.containsValue(v))
return false;
verticies.remove(v.getName());
if( v == rootVertex )
rootVertex = null;
// Remove the edges associated with v
for(int n = 0; n < v.getOutgoingEdgeCount(); n ++)
{
Edge<T> e = v.getOutgoingEdge(n);
v.remove(e);
Vertex<T> to = e.getTo();
to.remove(e);
edges.remove(e);
}
for(int n = 0; n < v.getIncomingEdgeCount(); n ++)
{
Edge<T> e = v.getIncomingEdge(n);
v.remove(e);
Vertex<T> predecessor = e.getFrom();
predecessor.remove(e);
}
return true;
} }
|
public class class_name {
public boolean removeVertex(Vertex<T> v)
{
if (!verticies.containsValue(v))
return false;
verticies.remove(v.getName());
if( v == rootVertex )
rootVertex = null;
// Remove the edges associated with v
for(int n = 0; n < v.getOutgoingEdgeCount(); n ++)
{
Edge<T> e = v.getOutgoingEdge(n);
v.remove(e); // depends on control dependency: [for], data = [none]
Vertex<T> to = e.getTo();
to.remove(e); // depends on control dependency: [for], data = [none]
edges.remove(e); // depends on control dependency: [for], data = [none]
}
for(int n = 0; n < v.getIncomingEdgeCount(); n ++)
{
Edge<T> e = v.getIncomingEdge(n);
v.remove(e); // depends on control dependency: [for], data = [none]
Vertex<T> predecessor = e.getFrom();
predecessor.remove(e); // depends on control dependency: [for], data = [none]
}
return true;
} }
|
public class class_name {
public void compare(Node control, Node test, DifferenceListener listener,
ElementQualifier elementQualifier) {
controlTracker.reset();
testTracker.reset();
try {
compare(getNullOrNotNull(control), getNullOrNotNull(test),
control, test, listener, NODE_TYPE);
if (control!=null) {
compareNode(control, test, listener, elementQualifier);
}
} catch (DifferenceFoundException e) {
// thrown by the protected compare() method to terminate the
// comparison and unwind the call stack back to here
}
} }
|
public class class_name {
public void compare(Node control, Node test, DifferenceListener listener,
ElementQualifier elementQualifier) {
controlTracker.reset();
testTracker.reset();
try {
compare(getNullOrNotNull(control), getNullOrNotNull(test),
control, test, listener, NODE_TYPE); // depends on control dependency: [try], data = [none]
if (control!=null) {
compareNode(control, test, listener, elementQualifier); // depends on control dependency: [if], data = [(control]
}
} catch (DifferenceFoundException e) {
// thrown by the protected compare() method to terminate the
// comparison and unwind the call stack back to here
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int length(){
if(root.child==null){
return 0;
}
if(length>-1){
return length;
}
length=root.getChildCount();
return length;
} }
|
public class class_name {
public int length(){
if(root.child==null){
return 0; // depends on control dependency: [if], data = [none]
}
if(length>-1){
return length; // depends on control dependency: [if], data = [none]
}
length=root.getChildCount();
return length;
} }
|
public class class_name {
static PlainTimestamp from(
UnixTime ut,
ZonalOffset offset
) {
long localSeconds = ut.getPosixTime() + offset.getIntegralAmount();
int localNanos = ut.getNanosecond() + offset.getFractionalAmount();
if (localNanos < 0) {
localNanos += MRD;
localSeconds--;
} else if (localNanos >= MRD) {
localNanos -= MRD;
localSeconds++;
}
PlainDate date =
PlainDate.of(
MathUtils.floorDivide(localSeconds, 86400),
EpochDays.UNIX);
int secondsOfDay = MathUtils.floorModulo(localSeconds, 86400);
int second = secondsOfDay % 60;
int minutesOfDay = secondsOfDay / 60;
int minute = minutesOfDay % 60;
int hour = minutesOfDay / 60;
PlainTime time =
PlainTime.of(
hour,
minute,
second,
localNanos
);
return PlainTimestamp.of(date, time);
} }
|
public class class_name {
static PlainTimestamp from(
UnixTime ut,
ZonalOffset offset
) {
long localSeconds = ut.getPosixTime() + offset.getIntegralAmount();
int localNanos = ut.getNanosecond() + offset.getFractionalAmount();
if (localNanos < 0) {
localNanos += MRD; // depends on control dependency: [if], data = [none]
localSeconds--; // depends on control dependency: [if], data = [none]
} else if (localNanos >= MRD) {
localNanos -= MRD; // depends on control dependency: [if], data = [none]
localSeconds++; // depends on control dependency: [if], data = [none]
}
PlainDate date =
PlainDate.of(
MathUtils.floorDivide(localSeconds, 86400),
EpochDays.UNIX);
int secondsOfDay = MathUtils.floorModulo(localSeconds, 86400);
int second = secondsOfDay % 60;
int minutesOfDay = secondsOfDay / 60;
int minute = minutesOfDay % 60;
int hour = minutesOfDay / 60;
PlainTime time =
PlainTime.of(
hour,
minute,
second,
localNanos
);
return PlainTimestamp.of(date, time);
} }
|
public class class_name {
private String getArtifactIdFromName(PhpPackage phpPackage) {
String artifactId = null;
if (StringUtils.isNotBlank(phpPackage.getName())) {
String packageName = phpPackage.getName();
String[] gavCoordinates = packageName.split(FORWARD_SLASH);
artifactId = gavCoordinates[1];
}
return artifactId;
} }
|
public class class_name {
private String getArtifactIdFromName(PhpPackage phpPackage) {
String artifactId = null;
if (StringUtils.isNotBlank(phpPackage.getName())) {
String packageName = phpPackage.getName();
String[] gavCoordinates = packageName.split(FORWARD_SLASH);
artifactId = gavCoordinates[1]; // depends on control dependency: [if], data = [none]
}
return artifactId;
} }
|
public class class_name {
public void marshall(DomainNameConfiguration domainNameConfiguration, ProtocolMarshaller protocolMarshaller) {
if (domainNameConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(domainNameConfiguration.getApiGatewayDomainName(), APIGATEWAYDOMAINNAME_BINDING);
protocolMarshaller.marshall(domainNameConfiguration.getCertificateArn(), CERTIFICATEARN_BINDING);
protocolMarshaller.marshall(domainNameConfiguration.getCertificateName(), CERTIFICATENAME_BINDING);
protocolMarshaller.marshall(domainNameConfiguration.getCertificateUploadDate(), CERTIFICATEUPLOADDATE_BINDING);
protocolMarshaller.marshall(domainNameConfiguration.getEndpointType(), ENDPOINTTYPE_BINDING);
protocolMarshaller.marshall(domainNameConfiguration.getHostedZoneId(), HOSTEDZONEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DomainNameConfiguration domainNameConfiguration, ProtocolMarshaller protocolMarshaller) {
if (domainNameConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(domainNameConfiguration.getApiGatewayDomainName(), APIGATEWAYDOMAINNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(domainNameConfiguration.getCertificateArn(), CERTIFICATEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(domainNameConfiguration.getCertificateName(), CERTIFICATENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(domainNameConfiguration.getCertificateUploadDate(), CERTIFICATEUPLOADDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(domainNameConfiguration.getEndpointType(), ENDPOINTTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(domainNameConfiguration.getHostedZoneId(), HOSTEDZONEID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void put(String table, String key, Map<String, Object> doc,
IPutCallback<Map<String, Object>> callback) {
SessionManager sessionManager = getSessionManager();
String tableName = calcTableName(table);
long timestamp = System.currentTimeMillis();
List<Statement> stmList = new ArrayList<>();
{
String cqlDelete = MessageFormat.format(CQL_DELETE_USING_TIMESTAMP, tableName,
String.valueOf(timestamp));
Statement stmDelete = sessionManager
.bindValues(sessionManager.prepareStatement(cqlDelete), key)
.setConsistencyLevel(getConsistencyLevelDelete());
stmList.add(stmDelete);
}
{
ConsistencyLevel consistencyLevel = getConsistencyLevelPut();
Map<String, byte[]> data = documentToBytesMap(doc);
PreparedStatement stmPut = sessionManager.prepareStatement(MessageFormat
.format(CQL_INSERT_USING_TIMESTAMP, tableName, String.valueOf(timestamp + 1)));
data.forEach((f, v) -> {
stmList.add(sessionManager.bindValues(stmPut, key, f, v)
.setConsistencyLevel(consistencyLevel));
});
}
BatchStatement batch = CqlUtils.buildBatch(BatchStatement.Type.LOGGED,
stmList.toArray(new Statement[0]));
if (isAsyncPut()) {
try {
sessionManager.executeAsync(new RetryFutureCallbackResultSet(sessionManager, 1000,
ConsistencyLevel.LOCAL_SERIAL, batch) {
@Override
public void onSuccess(ResultSet result) {
if (callback != null) {
callback.onSuccess(table, key, doc);
}
}
@Override
protected void onError(Throwable t) {
if (callback != null) {
callback.onError(table, key, doc, t);
} else {
LOGGER.error(t.getMessage());
}
}
}, 1000, batch, ConsistencyLevel.LOCAL_SERIAL);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} else {
try {
sessionManager.execute(batch, ConsistencyLevel.LOCAL_SERIAL);
if (callback != null) {
callback.onSuccess(table, key, doc);
}
} catch (Throwable t) {
if (callback != null) {
callback.onError(table, key, doc, t);
}
}
}
} }
|
public class class_name {
@Override
public void put(String table, String key, Map<String, Object> doc,
IPutCallback<Map<String, Object>> callback) {
SessionManager sessionManager = getSessionManager();
String tableName = calcTableName(table);
long timestamp = System.currentTimeMillis();
List<Statement> stmList = new ArrayList<>();
{
String cqlDelete = MessageFormat.format(CQL_DELETE_USING_TIMESTAMP, tableName,
String.valueOf(timestamp));
Statement stmDelete = sessionManager
.bindValues(sessionManager.prepareStatement(cqlDelete), key)
.setConsistencyLevel(getConsistencyLevelDelete());
stmList.add(stmDelete);
}
{
ConsistencyLevel consistencyLevel = getConsistencyLevelPut();
Map<String, byte[]> data = documentToBytesMap(doc);
PreparedStatement stmPut = sessionManager.prepareStatement(MessageFormat
.format(CQL_INSERT_USING_TIMESTAMP, tableName, String.valueOf(timestamp + 1)));
data.forEach((f, v) -> {
stmList.add(sessionManager.bindValues(stmPut, key, f, v)
.setConsistencyLevel(consistencyLevel));
});
}
BatchStatement batch = CqlUtils.buildBatch(BatchStatement.Type.LOGGED,
stmList.toArray(new Statement[0]));
if (isAsyncPut()) {
try {
sessionManager.executeAsync(new RetryFutureCallbackResultSet(sessionManager, 1000,
ConsistencyLevel.LOCAL_SERIAL, batch) {
@Override
public void onSuccess(ResultSet result) {
if (callback != null) {
callback.onSuccess(table, key, doc); // depends on control dependency: [if], data = [none]
}
}
@Override
protected void onError(Throwable t) {
if (callback != null) {
callback.onError(table, key, doc, t); // depends on control dependency: [if], data = [none]
} else {
LOGGER.error(t.getMessage()); // depends on control dependency: [if], data = [none]
}
}
}, 1000, batch, ConsistencyLevel.LOCAL_SERIAL);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} else {
try {
sessionManager.execute(batch, ConsistencyLevel.LOCAL_SERIAL);
if (callback != null) {
callback.onSuccess(table, key, doc);
}
} catch (Throwable t) {
if (callback != null) {
callback.onError(table, key, doc, t);
}
}
}
} }
|
public class class_name {
public static boolean valueChanged(Set<?> before, Set<?> after) {
if ((before == null && after == null) || after == null) {
return false;
}
if (before == null) {
if (after.isEmpty()) {
return false;
} else {
return true;
}
} else {
if (before.size() != after.size()) {
return true;
}
for (Object bean : after) {
if (!before.contains(bean)) {
return true;
}
}
}
return false;
} }
|
public class class_name {
public static boolean valueChanged(Set<?> before, Set<?> after) {
if ((before == null && after == null) || after == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (before == null) {
if (after.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} else {
if (before.size() != after.size()) {
return true; // depends on control dependency: [if], data = [none]
}
for (Object bean : after) {
if (!before.contains(bean)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
@Override
public String getQuorumName(String cacheName) {
CacheConfig cacheConfig = getCacheConfig(cacheName);
if (cacheConfig == null) {
return null;
}
return cacheConfig.getQuorumName();
} }
|
public class class_name {
@Override
public String getQuorumName(String cacheName) {
CacheConfig cacheConfig = getCacheConfig(cacheName);
if (cacheConfig == null) {
return null; // depends on control dependency: [if], data = [none]
}
return cacheConfig.getQuorumName();
} }
|
public class class_name {
public static void applyToOrSetGone(ImageHolder imageHolder, ImageView imageView, String tag) {
boolean imageSet = applyTo(imageHolder, imageView, tag);
if (imageView != null) {
if (imageSet) {
imageView.setVisibility(View.VISIBLE);
} else {
imageView.setVisibility(View.GONE);
}
}
} }
|
public class class_name {
public static void applyToOrSetGone(ImageHolder imageHolder, ImageView imageView, String tag) {
boolean imageSet = applyTo(imageHolder, imageView, tag);
if (imageView != null) {
if (imageSet) {
imageView.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
} else {
imageView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void exit(boolean withAnimation) {
if (getRequestedId() == null) {
throw new IllegalStateException("You should call enter(...) before calling exit(...)");
}
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Exit requested from " + getRequestedId()
+ ", with animation = " + withAnimation);
}
exitRequested = true;
exitWithAnimation = withAnimation;
exitIfRequested();
} }
|
public class class_name {
public void exit(boolean withAnimation) {
if (getRequestedId() == null) {
throw new IllegalStateException("You should call enter(...) before calling exit(...)");
}
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Exit requested from " + getRequestedId()
+ ", with animation = " + withAnimation); // depends on control dependency: [if], data = [none]
}
exitRequested = true;
exitWithAnimation = withAnimation;
exitIfRequested();
} }
|
public class class_name {
public Object get(ManagedObjectReference mor, String propName)
{
Map<ManagedObjectReference, Map<String, Object>> items = cache.getCachedItems();
Map<String, Object> moMap = items.get(mor);
if(moMap!=null)
{
return moMap.get(propName);
}
return null;
} }
|
public class class_name {
public Object get(ManagedObjectReference mor, String propName)
{
Map<ManagedObjectReference, Map<String, Object>> items = cache.getCachedItems();
Map<String, Object> moMap = items.get(mor);
if(moMap!=null)
{
return moMap.get(propName);
// depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void setPipelines(java.util.Collection<PipelineSummary> pipelines) {
if (pipelines == null) {
this.pipelines = null;
return;
}
this.pipelines = new java.util.ArrayList<PipelineSummary>(pipelines);
} }
|
public class class_name {
public void setPipelines(java.util.Collection<PipelineSummary> pipelines) {
if (pipelines == null) {
this.pipelines = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.pipelines = new java.util.ArrayList<PipelineSummary>(pipelines);
} }
|
public class class_name {
public static boolean stereosAreOpposite(IAtomContainer container, IAtom atom) {
List<IAtom> atoms = container.getConnectedAtomsList(atom);
TreeMap<Double, Integer> hm = new TreeMap<Double, Integer>();
for (int i = 1; i < atoms.size(); i++) {
hm.put(giveAngle(atom, atoms.get(0), atoms.get(i)), i);
}
Object[] ohere = hm.values().toArray();
IBond.Stereo stereoOne = container.getBond(atom, atoms.get(0)).getStereo();
IBond.Stereo stereoOpposite = container.getBond(atom, atoms.get((Integer) ohere[1])).getStereo();
return stereoOpposite == stereoOne;
} }
|
public class class_name {
public static boolean stereosAreOpposite(IAtomContainer container, IAtom atom) {
List<IAtom> atoms = container.getConnectedAtomsList(atom);
TreeMap<Double, Integer> hm = new TreeMap<Double, Integer>();
for (int i = 1; i < atoms.size(); i++) {
hm.put(giveAngle(atom, atoms.get(0), atoms.get(i)), i); // depends on control dependency: [for], data = [i]
}
Object[] ohere = hm.values().toArray();
IBond.Stereo stereoOne = container.getBond(atom, atoms.get(0)).getStereo();
IBond.Stereo stereoOpposite = container.getBond(atom, atoms.get((Integer) ohere[1])).getStereo();
return stereoOpposite == stereoOne;
} }
|
public class class_name {
private List<String> getFieldsToNull(List<NullReplacerConditionalConfig> nullReplacerConditionalConfigs, Set<String> fieldsThatDoNotExist, Set<String> fieldPaths, Record record) throws OnRecordErrorException {
//Gather in this all fields to null
List<String> fieldsToNull = new ArrayList<>();
for (NullReplacerConditionalConfig nullReplacerConditionalConfig : nullReplacerConditionalConfigs) {
List<String> fieldNamesToNull = nullReplacerConditionalConfig.fieldsToNull;
//Gather fieldsPathsToNull for this nullReplacerConditionalConfig
List<String> fieldPathsToNull = new ArrayList<>();
//Gather existing paths for each nullReplacerConditionalConfig
//And if field does not exist gather them in fieldsThatDoNotExist
for (String fieldNameToNull : fieldNamesToNull) {
try {
final List<String> matchingPaths = FieldPathExpressionUtil.evaluateMatchingFieldPaths(
fieldNameToNull,
fieldPathEval,
fieldPathVars,
record,
fieldPaths
);
if (matchingPaths.isEmpty()) {
// FieldPathExpressionUtil.evaluateMatchingFieldPaths does NOT return the supplied param in its result
// regardless, like FieldRegexUtil#getMatchingFieldPaths did, so we add manually here
fieldsThatDoNotExist.add(fieldNameToNull);
} else {
for (String matchingField : matchingPaths) {
if (record.has(matchingField)) {
fieldPathsToNull.add(matchingField);
} else {
fieldsThatDoNotExist.add(matchingField);
}
}
}
} catch (ELEvalException e) {
LOG.error("Error evaluating condition: " + nullReplacerConditionalConfig.condition, e);
throw new OnRecordErrorException(record, Errors.VALUE_REPLACER_07, fieldNameToNull, e.toString(), e);
}
}
//Now evaluate the condition in nullReplacerConditionalConfig
//If it empty or condition evaluates to true, add all the gathered fields in fieldsPathsToNull
// for this nullReplacerConditionalConfig to fieldsToNull
try {
boolean evaluatedCondition = true;
//If it is empty we assume it is true.
if (!StringUtils.isEmpty(nullReplacerConditionalConfig.condition)) {
evaluatedCondition = nullConditionELEval.eval(nullConditionELVars, nullReplacerConditionalConfig.condition, Boolean.class);
}
if (evaluatedCondition) {
fieldsToNull.addAll(fieldPathsToNull);
}
} catch (ELEvalException e) {
LOG.error("Error evaluating condition: " + nullReplacerConditionalConfig.condition, e);
throw new OnRecordErrorException(record, Errors.VALUE_REPLACER_06, nullReplacerConditionalConfig.condition, e.toString());
}
}
return fieldsToNull;
} }
|
public class class_name {
private List<String> getFieldsToNull(List<NullReplacerConditionalConfig> nullReplacerConditionalConfigs, Set<String> fieldsThatDoNotExist, Set<String> fieldPaths, Record record) throws OnRecordErrorException {
//Gather in this all fields to null
List<String> fieldsToNull = new ArrayList<>();
for (NullReplacerConditionalConfig nullReplacerConditionalConfig : nullReplacerConditionalConfigs) {
List<String> fieldNamesToNull = nullReplacerConditionalConfig.fieldsToNull;
//Gather fieldsPathsToNull for this nullReplacerConditionalConfig
List<String> fieldPathsToNull = new ArrayList<>();
//Gather existing paths for each nullReplacerConditionalConfig
//And if field does not exist gather them in fieldsThatDoNotExist
for (String fieldNameToNull : fieldNamesToNull) {
try {
final List<String> matchingPaths = FieldPathExpressionUtil.evaluateMatchingFieldPaths(
fieldNameToNull,
fieldPathEval,
fieldPathVars,
record,
fieldPaths
);
if (matchingPaths.isEmpty()) {
// FieldPathExpressionUtil.evaluateMatchingFieldPaths does NOT return the supplied param in its result
// regardless, like FieldRegexUtil#getMatchingFieldPaths did, so we add manually here
fieldsThatDoNotExist.add(fieldNameToNull); // depends on control dependency: [if], data = [none]
} else {
for (String matchingField : matchingPaths) {
if (record.has(matchingField)) {
fieldPathsToNull.add(matchingField); // depends on control dependency: [if], data = [none]
} else {
fieldsThatDoNotExist.add(matchingField); // depends on control dependency: [if], data = [none]
}
}
}
} catch (ELEvalException e) {
LOG.error("Error evaluating condition: " + nullReplacerConditionalConfig.condition, e);
throw new OnRecordErrorException(record, Errors.VALUE_REPLACER_07, fieldNameToNull, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
}
//Now evaluate the condition in nullReplacerConditionalConfig
//If it empty or condition evaluates to true, add all the gathered fields in fieldsPathsToNull
// for this nullReplacerConditionalConfig to fieldsToNull
try {
boolean evaluatedCondition = true;
//If it is empty we assume it is true.
if (!StringUtils.isEmpty(nullReplacerConditionalConfig.condition)) {
evaluatedCondition = nullConditionELEval.eval(nullConditionELVars, nullReplacerConditionalConfig.condition, Boolean.class); // depends on control dependency: [if], data = [none]
}
if (evaluatedCondition) {
fieldsToNull.addAll(fieldPathsToNull); // depends on control dependency: [if], data = [none]
}
} catch (ELEvalException e) {
LOG.error("Error evaluating condition: " + nullReplacerConditionalConfig.condition, e);
throw new OnRecordErrorException(record, Errors.VALUE_REPLACER_06, nullReplacerConditionalConfig.condition, e.toString());
} // depends on control dependency: [catch], data = [none]
}
return fieldsToNull;
} }
|
public class class_name {
private void selectTabInternal(int newPosition, boolean firstTab, boolean callListener, boolean forcedSelection) {
int oldPosition = mSelectedPosition;
if (mSelectedPosition != newPosition) {
if (mBackgroundStyle == BACKGROUND_STYLE_STATIC) {
if (mSelectedPosition != -1)
mBottomNavigationTabs.get(mSelectedPosition).unSelect(true, mAnimationDuration);
mBottomNavigationTabs.get(newPosition).select(true, mAnimationDuration);
} else if (mBackgroundStyle == BACKGROUND_STYLE_RIPPLE) {
if (mSelectedPosition != -1)
mBottomNavigationTabs.get(mSelectedPosition).unSelect(false, mAnimationDuration);
mBottomNavigationTabs.get(newPosition).select(false, mAnimationDuration);
final BottomNavigationTab clickedView = mBottomNavigationTabs.get(newPosition);
if (firstTab) {
// Running a ripple on the opening app won't be good so on firstTab this won't run.
mContainer.setBackgroundColor(clickedView.getActiveColor());
mBackgroundOverlay.setVisibility(View.GONE);
} else {
mBackgroundOverlay.post(new Runnable() {
@Override
public void run() {
// try {
BottomNavigationHelper.setBackgroundWithRipple(clickedView, mContainer, mBackgroundOverlay, clickedView.getActiveColor(), mRippleAnimationDuration);
// } catch (Exception e) {
// mContainer.setBackgroundColor(clickedView.getActiveColor());
// mBackgroundOverlay.setVisibility(View.GONE);
// }
}
});
}
}
mSelectedPosition = newPosition;
}
if (callListener) {
sendListenerCall(oldPosition, newPosition, forcedSelection);
}
} }
|
public class class_name {
private void selectTabInternal(int newPosition, boolean firstTab, boolean callListener, boolean forcedSelection) {
int oldPosition = mSelectedPosition;
if (mSelectedPosition != newPosition) {
if (mBackgroundStyle == BACKGROUND_STYLE_STATIC) {
if (mSelectedPosition != -1)
mBottomNavigationTabs.get(mSelectedPosition).unSelect(true, mAnimationDuration);
mBottomNavigationTabs.get(newPosition).select(true, mAnimationDuration); // depends on control dependency: [if], data = [none]
} else if (mBackgroundStyle == BACKGROUND_STYLE_RIPPLE) {
if (mSelectedPosition != -1)
mBottomNavigationTabs.get(mSelectedPosition).unSelect(false, mAnimationDuration);
mBottomNavigationTabs.get(newPosition).select(false, mAnimationDuration); // depends on control dependency: [if], data = [none]
final BottomNavigationTab clickedView = mBottomNavigationTabs.get(newPosition);
if (firstTab) {
// Running a ripple on the opening app won't be good so on firstTab this won't run.
mContainer.setBackgroundColor(clickedView.getActiveColor()); // depends on control dependency: [if], data = [none]
mBackgroundOverlay.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
} else {
mBackgroundOverlay.post(new Runnable() {
@Override
public void run() {
// try {
BottomNavigationHelper.setBackgroundWithRipple(clickedView, mContainer, mBackgroundOverlay, clickedView.getActiveColor(), mRippleAnimationDuration);
// } catch (Exception e) {
// mContainer.setBackgroundColor(clickedView.getActiveColor());
// mBackgroundOverlay.setVisibility(View.GONE);
// }
}
}); // depends on control dependency: [if], data = [none]
}
}
mSelectedPosition = newPosition; // depends on control dependency: [if], data = [none]
}
if (callListener) {
sendListenerCall(oldPosition, newPosition, forcedSelection); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private Month readOptionalMonth(JSONObject json, String key) {
try {
String str = json.getString(key);
return Month.valueOf(str);
} catch (JSONException | IllegalArgumentException e) {
LOG.debug("Reading optional JSON month failed. Default to provided default value.", e);
}
return null;
} }
|
public class class_name {
private Month readOptionalMonth(JSONObject json, String key) {
try {
String str = json.getString(key);
return Month.valueOf(str); // depends on control dependency: [try], data = [none]
} catch (JSONException | IllegalArgumentException e) {
LOG.debug("Reading optional JSON month failed. Default to provided default value.", e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public GzipHdfsBolt addRecordFormat(RecordFormat format, int position) {
MultipleRecordFormat formats;
if (this.format == null) {
formats = new MultipleRecordFormat(format);
this.format = formats;
} else {
if (this.format instanceof MultipleRecordFormat) {
formats = (MultipleRecordFormat) this.format;
} else {
formats = new MultipleRecordFormat(this.format);
this.format = formats;
}
formats.addFormat(new GzippedRecordFormat(format), position);
}
return this;
} }
|
public class class_name {
public GzipHdfsBolt addRecordFormat(RecordFormat format, int position) {
MultipleRecordFormat formats;
if (this.format == null) {
formats = new MultipleRecordFormat(format); // depends on control dependency: [if], data = [none]
this.format = formats; // depends on control dependency: [if], data = [none]
} else {
if (this.format instanceof MultipleRecordFormat) {
formats = (MultipleRecordFormat) this.format; // depends on control dependency: [if], data = [none]
} else {
formats = new MultipleRecordFormat(this.format); // depends on control dependency: [if], data = [none]
this.format = formats; // depends on control dependency: [if], data = [none]
}
formats.addFormat(new GzippedRecordFormat(format), position); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static void bufferedToInterleaved(DataBufferByte buffer, WritableRaster src, InterleavedF32 dst) {
byte[] srcData = buffer.getData();
int srcStride = stride(src);
int srcOffset = getOffset(src);
int length = dst.width*dst.numBands;
//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
for (int y = 0; y < dst.height; y++) {
int indexSrc = srcOffset + y*srcStride;
int indexDst = dst.startIndex + dst.stride * y;
int indexDstEnd = indexDst + length;
while( indexDst < indexDstEnd) {
dst.data[indexDst++] = srcData[indexSrc++] & 0xFF;
}
}
//CONCURRENT_ABOVE });
} }
|
public class class_name {
public static void bufferedToInterleaved(DataBufferByte buffer, WritableRaster src, InterleavedF32 dst) {
byte[] srcData = buffer.getData();
int srcStride = stride(src);
int srcOffset = getOffset(src);
int length = dst.width*dst.numBands;
//CONCURRENT_BELOW BoofConcurrency.loopFor(0, dst.height, y -> {
for (int y = 0; y < dst.height; y++) {
int indexSrc = srcOffset + y*srcStride;
int indexDst = dst.startIndex + dst.stride * y;
int indexDstEnd = indexDst + length;
while( indexDst < indexDstEnd) {
dst.data[indexDst++] = srcData[indexSrc++] & 0xFF; // depends on control dependency: [while], data = [none]
}
}
//CONCURRENT_ABOVE });
} }
|
public class class_name {
public Parameter<?> getParameter(String name) {
Collection<Parameter<?>> extnParameters = getParameters();
for (Parameter<?> extnParameter : extnParameters) {
if (extnParameter.name().equals(name)) {
return extnParameter;
}
}
return null;
} }
|
public class class_name {
public Parameter<?> getParameter(String name) {
Collection<Parameter<?>> extnParameters = getParameters();
for (Parameter<?> extnParameter : extnParameters) {
if (extnParameter.name().equals(name)) {
return extnParameter; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private void computeDerivatives(double sigma) {
this.Lx2 = new float[width][height];
this.Ly2 = new float[width][height];
this.Lxy = new float[width][height];
float[][][] grad = new float[width][height][];
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
grad[x][y] = sobel(x, y);
int radius = (int) (2 * sigma);
int window = 1 + 2 * radius;
float[][] gaussian = new float[window][window];
for (int j = -radius; j <= radius; j++)
for (int i = -radius; i <= radius; i++)
gaussian[i + radius][j + radius] = (float) gaussian(i, j, sigma);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
for (int dy = -radius; dy <= radius; dy++) {
for (int dx = -radius; dx <= radius; dx++) {
int xk = x + dx;
int yk = y + dy;
if (xk < 0 || xk >= width)
continue;
if (yk < 0 || yk >= height)
continue;
double gw = gaussian[dx + radius][dy + radius];
this.Lx2[x][y] += gw * grad[xk][yk][0]
* grad[xk][yk][0];
this.Ly2[x][y] += gw * grad[xk][yk][1]
* grad[xk][yk][1];
this.Lxy[x][y] += gw * grad[xk][yk][0]
* grad[xk][yk][1];
}
}
}
}
} }
|
public class class_name {
private void computeDerivatives(double sigma) {
this.Lx2 = new float[width][height];
this.Ly2 = new float[width][height];
this.Lxy = new float[width][height];
float[][][] grad = new float[width][height][];
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
grad[x][y] = sobel(x, y);
int radius = (int) (2 * sigma);
int window = 1 + 2 * radius;
float[][] gaussian = new float[window][window];
for (int j = -radius; j <= radius; j++)
for (int i = -radius; i <= radius; i++)
gaussian[i + radius][j + radius] = (float) gaussian(i, j, sigma);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
for (int dy = -radius; dy <= radius; dy++) {
for (int dx = -radius; dx <= radius; dx++) {
int xk = x + dx;
int yk = y + dy;
if (xk < 0 || xk >= width)
continue;
if (yk < 0 || yk >= height)
continue;
double gw = gaussian[dx + radius][dy + radius];
this.Lx2[x][y] += gw * grad[xk][yk][0]
* grad[xk][yk][0];
// depends on control dependency: [for], data = [none]
this.Ly2[x][y] += gw * grad[xk][yk][1]
* grad[xk][yk][1];
// depends on control dependency: [for], data = [none]
this.Lxy[x][y] += gw * grad[xk][yk][0]
* grad[xk][yk][1];
// depends on control dependency: [for], data = [none]
}
}
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
static Iterator<MarkerRange.Builder> add(
Range constraint, List<FieldPartitioner> fps,
Iterator<MarkerRange.Builder> inner) {
Iterator<MarkerRange.Builder> current = inner;
List<Pair<String, Range>> compatible = Lists.newArrayList();
for (FieldPartitioner fp : fps) {
Predicate<?> projected = fp.project(constraint);
if (projected instanceof In) {
current = addProjected(projected, fp.getName(), current);
} else if (projected instanceof Range) {
compatible.add(Pair.of(fp.getName(), (Range) projected));
}
// otherwise, all fields are included, so don't add anything
}
if (compatible.size() < 1) {
return current;
} else if (compatible.size() == 1) {
Pair<String, Range> pair = compatible.get(0);
return addProjected((Predicate<?>) pair.second(), pair.first(), current);
} else {
return new RangeGroupIterator(constraint, compatible, current);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
static Iterator<MarkerRange.Builder> add(
Range constraint, List<FieldPartitioner> fps,
Iterator<MarkerRange.Builder> inner) {
Iterator<MarkerRange.Builder> current = inner;
List<Pair<String, Range>> compatible = Lists.newArrayList();
for (FieldPartitioner fp : fps) {
Predicate<?> projected = fp.project(constraint);
if (projected instanceof In) {
current = addProjected(projected, fp.getName(), current); // depends on control dependency: [if], data = [none]
} else if (projected instanceof Range) {
compatible.add(Pair.of(fp.getName(), (Range) projected)); // depends on control dependency: [if], data = [none]
}
// otherwise, all fields are included, so don't add anything
}
if (compatible.size() < 1) {
return current; // depends on control dependency: [if], data = [none]
} else if (compatible.size() == 1) {
Pair<String, Range> pair = compatible.get(0);
return addProjected((Predicate<?>) pair.second(), pair.first(), current); // depends on control dependency: [if], data = [none]
} else {
return new RangeGroupIterator(constraint, compatible, current); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setProfileFromBackup(JSONObject profileBackup, int profileId, String clientUUID) throws Exception {
// Reset the profile before applying changes
ClientService clientService = ClientService.getInstance();
clientService.reset(profileId, clientUUID);
clientService.updateActive(profileId, clientUUID, true);
JSONArray errors = new JSONArray();
// Change to correct server group
JSONObject activeServerGroup = profileBackup.getJSONObject(Constants.BACKUP_ACTIVE_SERVER_GROUP);
int activeServerId = getServerIdFromName(activeServerGroup.getString(Constants.NAME), profileId);
if (activeServerId == -1) {
errors.put(formErrorJson("Server Error", "Cannot change to '" + activeServerGroup.getString(Constants.NAME) + "' - Check Server Group Exists"));
} else {
Client clientToUpdate = ClientService.getInstance().findClient(clientUUID, profileId);
ServerRedirectService.getInstance().activateServerGroup(activeServerId, clientToUpdate.getId());
}
JSONArray enabledPaths = profileBackup.getJSONArray(Constants.ENABLED_PATHS);
PathOverrideService pathOverrideService = PathOverrideService.getInstance();
OverrideService overrideService = OverrideService.getInstance();
for (int i = 0; i < enabledPaths.length(); i++) {
JSONObject path = enabledPaths.getJSONObject(i);
int pathId = pathOverrideService.getPathId(path.getString(Constants.PATH_NAME), profileId);
// Set path to have request/response enabled as necessary
try {
if (path.getBoolean(Constants.REQUEST_ENABLED)) {
pathOverrideService.setRequestEnabled(pathId, true, clientUUID);
}
if (path.getBoolean(Constants.RESPONSE_ENABLED)) {
pathOverrideService.setResponseEnabled(pathId, true, clientUUID);
}
} catch (Exception e) {
errors.put(formErrorJson("Path Error", "Cannot update path: '" + path.getString(Constants.PATH_NAME) + "' - Check Path Exists"));
continue;
}
JSONArray enabledOverrides = path.getJSONArray(Constants.ENABLED_ENDPOINTS);
/**
* 2 for loops to ensure overrides are added with correct priority
* 1st loop is priority currently adding override to
* 2nd loop is to find the override with matching priority in profile json
*/
for (int j = 0; j < enabledOverrides.length(); j++) {
for (int k = 0; k < enabledOverrides.length(); k++) {
JSONObject override = enabledOverrides.getJSONObject(k);
if (override.getInt(Constants.PRIORITY) != j) {
continue;
}
int overrideId;
// Name of method that can be used by error message as necessary later
String overrideNameForError = "";
// Get the Id of the override
try {
// If method information is null, then the override is a default override
if (override.get(Constants.METHOD_INFORMATION) != JSONObject.NULL) {
JSONObject methodInformation = override.getJSONObject(Constants.METHOD_INFORMATION);
overrideNameForError = methodInformation.getString(Constants.METHOD_NAME);
overrideId = overrideService.getOverrideIdForMethod(methodInformation.getString(Constants.CLASS_NAME),
methodInformation.getString(Constants.METHOD_NAME));
} else {
overrideNameForError = "Default Override";
overrideId = override.getInt(Constants.OVERRIDE_ID);
}
// Enable override and set repeat number and arguments
overrideService.enableOverride(overrideId, pathId, clientUUID);
int overrideOrdinal = overrideService.getCurrentMethodOrdinal(overrideId, pathId, clientUUID, null);
overrideService.updateRepeatNumber(overrideId, pathId, overrideOrdinal, override.getInt(Constants.REPEAT_NUMBER), clientUUID);
overrideService.updateArguments(overrideId, pathId, overrideOrdinal, override.getString(Constants.ARGUMENTS), clientUUID);
// If it has responseCode then update the override with the responseCode. Otherwise, use 200 as response code
try {
overrideService.updateResponseCode(overrideId, pathId, overrideOrdinal, override.getString(Constants.RESPONSE_CODE), clientUUID);
} catch (JSONException e) {
overrideService.updateResponseCode(overrideId, pathId, overrideOrdinal, "200", clientUUID);
}
} catch (Exception e) {
errors.put(formErrorJson("Override Error", "Cannot add/update override: '" + overrideNameForError + "' - Check Override Exists"));
continue;
}
}
}
}
// Throw exception if any errors occured
if (errors.length() > 0) {
throw new Exception(errors.toString());
}
} }
|
public class class_name {
public void setProfileFromBackup(JSONObject profileBackup, int profileId, String clientUUID) throws Exception {
// Reset the profile before applying changes
ClientService clientService = ClientService.getInstance();
clientService.reset(profileId, clientUUID);
clientService.updateActive(profileId, clientUUID, true);
JSONArray errors = new JSONArray();
// Change to correct server group
JSONObject activeServerGroup = profileBackup.getJSONObject(Constants.BACKUP_ACTIVE_SERVER_GROUP);
int activeServerId = getServerIdFromName(activeServerGroup.getString(Constants.NAME), profileId);
if (activeServerId == -1) {
errors.put(formErrorJson("Server Error", "Cannot change to '" + activeServerGroup.getString(Constants.NAME) + "' - Check Server Group Exists"));
} else {
Client clientToUpdate = ClientService.getInstance().findClient(clientUUID, profileId);
ServerRedirectService.getInstance().activateServerGroup(activeServerId, clientToUpdate.getId());
}
JSONArray enabledPaths = profileBackup.getJSONArray(Constants.ENABLED_PATHS);
PathOverrideService pathOverrideService = PathOverrideService.getInstance();
OverrideService overrideService = OverrideService.getInstance();
for (int i = 0; i < enabledPaths.length(); i++) {
JSONObject path = enabledPaths.getJSONObject(i);
int pathId = pathOverrideService.getPathId(path.getString(Constants.PATH_NAME), profileId);
// Set path to have request/response enabled as necessary
try {
if (path.getBoolean(Constants.REQUEST_ENABLED)) {
pathOverrideService.setRequestEnabled(pathId, true, clientUUID); // depends on control dependency: [if], data = [none]
}
if (path.getBoolean(Constants.RESPONSE_ENABLED)) {
pathOverrideService.setResponseEnabled(pathId, true, clientUUID); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
errors.put(formErrorJson("Path Error", "Cannot update path: '" + path.getString(Constants.PATH_NAME) + "' - Check Path Exists"));
continue;
}
JSONArray enabledOverrides = path.getJSONArray(Constants.ENABLED_ENDPOINTS);
/**
* 2 for loops to ensure overrides are added with correct priority
* 1st loop is priority currently adding override to
* 2nd loop is to find the override with matching priority in profile json
*/
for (int j = 0; j < enabledOverrides.length(); j++) {
for (int k = 0; k < enabledOverrides.length(); k++) {
JSONObject override = enabledOverrides.getJSONObject(k);
if (override.getInt(Constants.PRIORITY) != j) {
continue;
}
int overrideId;
// Name of method that can be used by error message as necessary later
String overrideNameForError = "";
// Get the Id of the override
try {
// If method information is null, then the override is a default override
if (override.get(Constants.METHOD_INFORMATION) != JSONObject.NULL) {
JSONObject methodInformation = override.getJSONObject(Constants.METHOD_INFORMATION);
overrideNameForError = methodInformation.getString(Constants.METHOD_NAME);
overrideId = overrideService.getOverrideIdForMethod(methodInformation.getString(Constants.CLASS_NAME),
methodInformation.getString(Constants.METHOD_NAME));
} else {
overrideNameForError = "Default Override";
overrideId = override.getInt(Constants.OVERRIDE_ID);
}
// Enable override and set repeat number and arguments
overrideService.enableOverride(overrideId, pathId, clientUUID);
int overrideOrdinal = overrideService.getCurrentMethodOrdinal(overrideId, pathId, clientUUID, null);
overrideService.updateRepeatNumber(overrideId, pathId, overrideOrdinal, override.getInt(Constants.REPEAT_NUMBER), clientUUID);
overrideService.updateArguments(overrideId, pathId, overrideOrdinal, override.getString(Constants.ARGUMENTS), clientUUID);
// If it has responseCode then update the override with the responseCode. Otherwise, use 200 as response code
try {
overrideService.updateResponseCode(overrideId, pathId, overrideOrdinal, override.getString(Constants.RESPONSE_CODE), clientUUID);
} catch (JSONException e) {
overrideService.updateResponseCode(overrideId, pathId, overrideOrdinal, "200", clientUUID);
}
} catch (Exception e) {
errors.put(formErrorJson("Override Error", "Cannot add/update override: '" + overrideNameForError + "' - Check Override Exists"));
continue;
}
}
}
}
// Throw exception if any errors occured
if (errors.length() > 0) {
throw new Exception(errors.toString());
}
} }
|
public class class_name {
@Override
public String getCacheKeyForTable(final Object table) {
String tableName;
TableWithNullOption nullOptionTable = null;
if (table instanceof TableWithNullOption) {
nullOptionTable = (TableWithNullOption) table;
tableName = nullOptionTable.getTableName();
} else {
tableName = (String) table;
}
// For the examples, we only cache the "icao" and "australian_state" sets.
if ("icao".equals(tableName) || "australian_state".equals(tableName) || "nodata".equals(
tableName)) {
StringBuffer key = new StringBuffer(tableName);
if (nullOptionTable != null) {
key.append("C");
key.append(Base64Util.encodeString(nullOptionTable.getNullCode()));
key.append("D");
key.append(Base64Util.encodeString(nullOptionTable.getNullDescription()));
}
key.append("##VERSION##");
CACHE_MAP.put(key.toString(), table);
return key.toString();
}
return null;
} }
|
public class class_name {
@Override
public String getCacheKeyForTable(final Object table) {
String tableName;
TableWithNullOption nullOptionTable = null;
if (table instanceof TableWithNullOption) {
nullOptionTable = (TableWithNullOption) table; // depends on control dependency: [if], data = [none]
tableName = nullOptionTable.getTableName(); // depends on control dependency: [if], data = [none]
} else {
tableName = (String) table; // depends on control dependency: [if], data = [none]
}
// For the examples, we only cache the "icao" and "australian_state" sets.
if ("icao".equals(tableName) || "australian_state".equals(tableName) || "nodata".equals(
tableName)) {
StringBuffer key = new StringBuffer(tableName);
if (nullOptionTable != null) {
key.append("C"); // depends on control dependency: [if], data = [none]
key.append(Base64Util.encodeString(nullOptionTable.getNullCode())); // depends on control dependency: [if], data = [(nullOptionTable]
key.append("D"); // depends on control dependency: [if], data = [none]
key.append(Base64Util.encodeString(nullOptionTable.getNullDescription())); // depends on control dependency: [if], data = [(nullOptionTable]
}
key.append("##VERSION##"); // depends on control dependency: [if], data = [none]
CACHE_MAP.put(key.toString(), table); // depends on control dependency: [if], data = [none]
return key.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public AroundTimeoutType<SessionBeanType<T>> getOrCreateAroundTimeout()
{
List<Node> nodeList = childNode.get("around-timeout");
if (nodeList != null && nodeList.size() > 0)
{
return new AroundTimeoutTypeImpl<SessionBeanType<T>>(this, "around-timeout", childNode, nodeList.get(0));
}
return createAroundTimeout();
} }
|
public class class_name {
public AroundTimeoutType<SessionBeanType<T>> getOrCreateAroundTimeout()
{
List<Node> nodeList = childNode.get("around-timeout");
if (nodeList != null && nodeList.size() > 0)
{
return new AroundTimeoutTypeImpl<SessionBeanType<T>>(this, "around-timeout", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createAroundTimeout();
} }
|
public class class_name {
protected Cookie getCookieFromRequest(String name, HttpServletRequest request) {
final Cookie[] cookies = request.getCookies();
if (cookies == null) { // getCookies() returns null if there aren't any
return null;
}
for (final Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return cookie;
}
}
return null;
} }
|
public class class_name {
protected Cookie getCookieFromRequest(String name, HttpServletRequest request) {
final Cookie[] cookies = request.getCookies();
if (cookies == null) { // getCookies() returns null if there aren't any
return null; // depends on control dependency: [if], data = [none]
}
for (final Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return cookie; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private boolean acceptTargetUrl(String urlS) {
// Whitelist has precedence. Only patterns on the white list are allowed
if (whiteList != null) {
return checkPattern(whiteList, urlS, true);
}
// Then blacklist: Everything on this list is forbidden
if (blackList != null) {
return checkPattern(blackList, urlS, false);
}
// If no list is configured, then everything is allowed
return true;
} }
|
public class class_name {
private boolean acceptTargetUrl(String urlS) {
// Whitelist has precedence. Only patterns on the white list are allowed
if (whiteList != null) {
return checkPattern(whiteList, urlS, true); // depends on control dependency: [if], data = [(whiteList]
}
// Then blacklist: Everything on this list is forbidden
if (blackList != null) {
return checkPattern(blackList, urlS, false); // depends on control dependency: [if], data = [(blackList]
}
// If no list is configured, then everything is allowed
return true;
} }
|
public class class_name {
public final void setAdviseCategory(
final AdviseCategoryOfGs pAdviseCategory) {
this.adviseCategory = pAdviseCategory;
if (this.itsId == null) {
this.itsId = new GoodsAdviseCategoriesId();
}
this.itsId.setAdviseCategory(this.adviseCategory);
} }
|
public class class_name {
public final void setAdviseCategory(
final AdviseCategoryOfGs pAdviseCategory) {
this.adviseCategory = pAdviseCategory;
if (this.itsId == null) {
this.itsId = new GoodsAdviseCategoriesId(); // depends on control dependency: [if], data = [none]
}
this.itsId.setAdviseCategory(this.adviseCategory);
} }
|
public class class_name {
public void setOutputArtifacts(java.util.Collection<Artifact> outputArtifacts) {
if (outputArtifacts == null) {
this.outputArtifacts = null;
return;
}
this.outputArtifacts = new java.util.ArrayList<Artifact>(outputArtifacts);
} }
|
public class class_name {
public void setOutputArtifacts(java.util.Collection<Artifact> outputArtifacts) {
if (outputArtifacts == null) {
this.outputArtifacts = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.outputArtifacts = new java.util.ArrayList<Artifact>(outputArtifacts);
} }
|
public class class_name {
public ListPrincipalsResult withPrincipals(Principal... principals) {
if (this.principals == null) {
setPrincipals(new java.util.ArrayList<Principal>(principals.length));
}
for (Principal ele : principals) {
this.principals.add(ele);
}
return this;
} }
|
public class class_name {
public ListPrincipalsResult withPrincipals(Principal... principals) {
if (this.principals == null) {
setPrincipals(new java.util.ArrayList<Principal>(principals.length)); // depends on control dependency: [if], data = [none]
}
for (Principal ele : principals) {
this.principals.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public AVFile getAVFile() {
if (actualFile != null) {
return actualFile;
} else if (null != file && file.containsKey(FILE_URL)) {
Map<String, Object> avfileMeta = null;
if (file.containsKey(FILE_META)) {
avfileMeta = (Map) file.get(FILE_META);
}
AVFile avfile = new AVFile(null, (String) file.get(FILE_URL), avfileMeta);
if (file.containsKey(OBJECT_ID)) {
avfile.setObjectId((String) file.get(OBJECT_ID));
}
return avfile;
}
return null;
} }
|
public class class_name {
public AVFile getAVFile() {
if (actualFile != null) {
return actualFile; // depends on control dependency: [if], data = [none]
} else if (null != file && file.containsKey(FILE_URL)) {
Map<String, Object> avfileMeta = null;
if (file.containsKey(FILE_META)) {
avfileMeta = (Map) file.get(FILE_META); // depends on control dependency: [if], data = [none]
}
AVFile avfile = new AVFile(null, (String) file.get(FILE_URL), avfileMeta);
if (file.containsKey(OBJECT_ID)) {
avfile.setObjectId((String) file.get(OBJECT_ID)); // depends on control dependency: [if], data = [none]
}
return avfile; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void setOriginEndpoints(java.util.Collection<OriginEndpoint> originEndpoints) {
if (originEndpoints == null) {
this.originEndpoints = null;
return;
}
this.originEndpoints = new java.util.ArrayList<OriginEndpoint>(originEndpoints);
} }
|
public class class_name {
public void setOriginEndpoints(java.util.Collection<OriginEndpoint> originEndpoints) {
if (originEndpoints == null) {
this.originEndpoints = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.originEndpoints = new java.util.ArrayList<OriginEndpoint>(originEndpoints);
} }
|
public class class_name {
public V put(final int key, final V value) {
int index = (key & 0x7FFFFFFF) % elementData.length;
IntEntry<V> entry = elementData[index];
while (entry != null && key != entry.key) {
entry = entry.nextInSlot;
}
if (entry == null) {
if (++elementCount > threshold) {
rehash();
index = (key & 0x7FFFFFFF) % elementData.length;
}
entry = createHashedEntry(key, index);
}
V result = entry.value;
entry.value = value;
return result;
} }
|
public class class_name {
public V put(final int key, final V value) {
int index = (key & 0x7FFFFFFF) % elementData.length;
IntEntry<V> entry = elementData[index];
while (entry != null && key != entry.key) {
entry = entry.nextInSlot; // depends on control dependency: [while], data = [none]
}
if (entry == null) {
if (++elementCount > threshold) {
rehash(); // depends on control dependency: [if], data = [none]
index = (key & 0x7FFFFFFF) % elementData.length; // depends on control dependency: [if], data = [none]
}
entry = createHashedEntry(key, index); // depends on control dependency: [if], data = [none]
}
V result = entry.value;
entry.value = value;
return result;
} }
|
public class class_name {
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
pixelSize = (width / cols) < (height / rows) ? (width / cols) : (height / rows);
pixelWidth = (width / cols);
pixelHeight = (height / rows);
spacer = useSpacer ? pixelSize * getSpacerSizeFactor() : 0;
pixelSizeMinusDoubleSpacer = pixelSize - spacer * 2;
pixelWidthMinusDoubleSpacer = pixelWidth - spacer * 2;
pixelHeightMinusDoubleSpacer = pixelHeight - spacer * 2;
if (width > 0 && height > 0) {
if (squarePixels) {
pixelWidth = pixelSize;
pixelHeight = pixelSize;
pixelWidthMinusDoubleSpacer = pixelSizeMinusDoubleSpacer;
pixelHeightMinusDoubleSpacer = pixelSizeMinusDoubleSpacer;
}
canvas.setWidth(cols * pixelWidth);
canvas.setHeight(rows * pixelHeight);
canvas.relocate((getWidth() - (cols *pixelWidth)) * 0.5, (getHeight() - (rows * pixelHeight)) * 0.5);
drawMatrix();
}
} }
|
public class class_name {
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
pixelSize = (width / cols) < (height / rows) ? (width / cols) : (height / rows);
pixelWidth = (width / cols);
pixelHeight = (height / rows);
spacer = useSpacer ? pixelSize * getSpacerSizeFactor() : 0;
pixelSizeMinusDoubleSpacer = pixelSize - spacer * 2;
pixelWidthMinusDoubleSpacer = pixelWidth - spacer * 2;
pixelHeightMinusDoubleSpacer = pixelHeight - spacer * 2;
if (width > 0 && height > 0) {
if (squarePixels) {
pixelWidth = pixelSize; // depends on control dependency: [if], data = [none]
pixelHeight = pixelSize; // depends on control dependency: [if], data = [none]
pixelWidthMinusDoubleSpacer = pixelSizeMinusDoubleSpacer; // depends on control dependency: [if], data = [none]
pixelHeightMinusDoubleSpacer = pixelSizeMinusDoubleSpacer; // depends on control dependency: [if], data = [none]
}
canvas.setWidth(cols * pixelWidth); // depends on control dependency: [if], data = [none]
canvas.setHeight(rows * pixelHeight); // depends on control dependency: [if], data = [none]
canvas.relocate((getWidth() - (cols *pixelWidth)) * 0.5, (getHeight() - (rows * pixelHeight)) * 0.5); // depends on control dependency: [if], data = [none]
drawMatrix(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected synchronized void copy(Writable other) {
if (other != null) {
try {
DataOutputBuffer out = new DataOutputBuffer();
other.write(out);
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.getLength());
readFields(in);
} catch (IOException e) {
throw new IllegalArgumentException("map cannot be copied: " +
e.getMessage());
}
} else {
throw new IllegalArgumentException("source map cannot be null");
}
} }
|
public class class_name {
protected synchronized void copy(Writable other) {
if (other != null) {
try {
DataOutputBuffer out = new DataOutputBuffer();
other.write(out); // depends on control dependency: [try], data = [none]
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.getLength()); // depends on control dependency: [try], data = [none]
readFields(in); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException("map cannot be copied: " +
e.getMessage());
} // depends on control dependency: [catch], data = [none]
} else {
throw new IllegalArgumentException("source map cannot be null");
}
} }
|
public class class_name {
static public char normalize(char input, int format) {
if (NORMALIZE_LOWER == format) {
return toLower(input);
}
if (NORMALIZE_UPPER == format) {
return toUpper(input);
}
return input;
} }
|
public class class_name {
static public char normalize(char input, int format) {
if (NORMALIZE_LOWER == format) {
return toLower(input); // depends on control dependency: [if], data = [none]
}
if (NORMALIZE_UPPER == format) {
return toUpper(input); // depends on control dependency: [if], data = [none]
}
return input;
} }
|
public class class_name {
private boolean smo(double epsgr) {
SupportVector i = svmax;
int ii = gmaxindex;
double old_alpha_i = i.alpha[ii];
if (i.kcache == null) {
gram(i);
}
SupportVector j = svmin;
int jj = gminindex;
double old_alpha_j = j.alpha[jj];
// Second order working set selection.
double best = 0.0;
double gi = ii == 0 ? -i.g[0] : i.g[1];
for (SupportVector v : sv) {
double curv = i.k + v.k - 2 * kernel.k(i.x, v.x);
if (curv <= 0.0) curv = TAU;
double gj = -v.g[0];
if (v.alpha[0] > 0.0 && gj < gi) {
double gain = -Math.sqr(gi - gj) / curv;
if (gain < best) {
best = gain;
j = v;
jj = 0;
old_alpha_j = j.alpha[0];
}
}
gj = v.g[1];
if (v.alpha[1] < v.C && gj < gi) {
double gain = -Math.sqr(gi - gj) / curv;
if (gain < best) {
best = gain;
j = v;
jj = 1;
old_alpha_j = j.alpha[1];
}
}
}
if (j.kcache == null) {
gram(j);
}
// Determine curvature
double curv = i.k + j.k - 2 * kernel.k(i.x, j.x);
if (curv <= 0.0) curv = TAU;
if (ii != jj) {
double delta = (-i.g[ii] - j.g[jj]) / curv;
double diff = i.alpha[ii] - j.alpha[jj];
i.alpha[ii] += delta;
j.alpha[jj] += delta;
if (diff > 0.0) {
// Region III
if (j.alpha[jj] < 0.0) {
j.alpha[jj] = 0.0;
i.alpha[ii] = diff;
}
} else {
// Region IV
if (i.alpha[ii] < 0.0) {
i.alpha[ii] = 0.0;
j.alpha[jj] = -diff;
}
}
if (diff > i.C - j.C) {
// Region I
if (i.alpha[ii] > i.C) {
i.alpha[ii] = i.C;
j.alpha[jj] = i.C - diff;
}
} else {
// Region II
if (j.alpha[jj] > j.C) {
j.alpha[jj] = j.C;
i.alpha[ii] = j.C + diff;
}
}
} else {
double delta = (i.g[ii] - j.g[jj]) / curv;
double sum = i.alpha[ii] + j.alpha[jj];
i.alpha[ii] -= delta;
j.alpha[jj] += delta;
if (sum > i.C) {
if (i.alpha[ii] > i.C) {
i.alpha[ii] = i.C;
j.alpha[jj] = sum - i.C;
}
} else {
if (j.alpha[jj] < 0) {
j.alpha[jj] = 0;
i.alpha[ii] = sum;
}
}
if (sum > j.C) {
if (j.alpha[jj] > j.C) {
j.alpha[jj] = j.C;
i.alpha[ii] = sum - j.C;
}
} else {
if (i.alpha[ii] < 0) {
i.alpha[ii] = 0.0;
j.alpha[jj] = sum;
}
}
}
double delta_alpha_i = i.alpha[ii] - old_alpha_i;
double delta_alpha_j = j.alpha[jj] - old_alpha_j;
int si = 2 * ii - 1;
int sj = 2 * jj - 1;
for (int k = 0; k < sv.size(); k++) {
SupportVector v = sv.get(k);
v.g[0] -= si * i.kcache.get(k) * delta_alpha_i + sj * j.kcache.get(k) * delta_alpha_j;
v.g[1] += si * i.kcache.get(k) * delta_alpha_i + sj * j.kcache.get(k) * delta_alpha_j;
}
// optimality test
minmax();
b = -(gmax + gmin) / 2;
if (gmax - gmin < epsgr) {
return false;
}
return true;
} }
|
public class class_name {
private boolean smo(double epsgr) {
SupportVector i = svmax;
int ii = gmaxindex;
double old_alpha_i = i.alpha[ii];
if (i.kcache == null) {
gram(i); // depends on control dependency: [if], data = [none]
}
SupportVector j = svmin;
int jj = gminindex;
double old_alpha_j = j.alpha[jj];
// Second order working set selection.
double best = 0.0;
double gi = ii == 0 ? -i.g[0] : i.g[1];
for (SupportVector v : sv) {
double curv = i.k + v.k - 2 * kernel.k(i.x, v.x);
if (curv <= 0.0) curv = TAU;
double gj = -v.g[0];
if (v.alpha[0] > 0.0 && gj < gi) {
double gain = -Math.sqr(gi - gj) / curv;
if (gain < best) {
best = gain; // depends on control dependency: [if], data = [none]
j = v; // depends on control dependency: [if], data = [none]
jj = 0; // depends on control dependency: [if], data = [none]
old_alpha_j = j.alpha[0]; // depends on control dependency: [if], data = [none]
}
}
gj = v.g[1]; // depends on control dependency: [for], data = [v]
if (v.alpha[1] < v.C && gj < gi) {
double gain = -Math.sqr(gi - gj) / curv;
if (gain < best) {
best = gain; // depends on control dependency: [if], data = [none]
j = v; // depends on control dependency: [if], data = [none]
jj = 1; // depends on control dependency: [if], data = [none]
old_alpha_j = j.alpha[1]; // depends on control dependency: [if], data = [none]
}
}
}
if (j.kcache == null) {
gram(j); // depends on control dependency: [if], data = [none]
}
// Determine curvature
double curv = i.k + j.k - 2 * kernel.k(i.x, j.x);
if (curv <= 0.0) curv = TAU;
if (ii != jj) {
double delta = (-i.g[ii] - j.g[jj]) / curv;
double diff = i.alpha[ii] - j.alpha[jj];
i.alpha[ii] += delta; // depends on control dependency: [if], data = [none]
j.alpha[jj] += delta; // depends on control dependency: [if], data = [none]
if (diff > 0.0) {
// Region III
if (j.alpha[jj] < 0.0) {
j.alpha[jj] = 0.0; // depends on control dependency: [if], data = [none]
i.alpha[ii] = diff; // depends on control dependency: [if], data = [none]
}
} else {
// Region IV
if (i.alpha[ii] < 0.0) {
i.alpha[ii] = 0.0; // depends on control dependency: [if], data = [none]
j.alpha[jj] = -diff; // depends on control dependency: [if], data = [none]
}
}
if (diff > i.C - j.C) {
// Region I
if (i.alpha[ii] > i.C) {
i.alpha[ii] = i.C; // depends on control dependency: [if], data = [none]
j.alpha[jj] = i.C - diff; // depends on control dependency: [if], data = [none]
}
} else {
// Region II
if (j.alpha[jj] > j.C) {
j.alpha[jj] = j.C; // depends on control dependency: [if], data = [none]
i.alpha[ii] = j.C + diff; // depends on control dependency: [if], data = [none]
}
}
} else {
double delta = (i.g[ii] - j.g[jj]) / curv;
double sum = i.alpha[ii] + j.alpha[jj];
i.alpha[ii] -= delta; // depends on control dependency: [if], data = [none]
j.alpha[jj] += delta; // depends on control dependency: [if], data = [none]
if (sum > i.C) {
if (i.alpha[ii] > i.C) {
i.alpha[ii] = i.C; // depends on control dependency: [if], data = [none]
j.alpha[jj] = sum - i.C; // depends on control dependency: [if], data = [none]
}
} else {
if (j.alpha[jj] < 0) {
j.alpha[jj] = 0; // depends on control dependency: [if], data = [none]
i.alpha[ii] = sum; // depends on control dependency: [if], data = [none]
}
}
if (sum > j.C) {
if (j.alpha[jj] > j.C) {
j.alpha[jj] = j.C; // depends on control dependency: [if], data = [none]
i.alpha[ii] = sum - j.C; // depends on control dependency: [if], data = [none]
}
} else {
if (i.alpha[ii] < 0) {
i.alpha[ii] = 0.0; // depends on control dependency: [if], data = [none]
j.alpha[jj] = sum; // depends on control dependency: [if], data = [none]
}
}
}
double delta_alpha_i = i.alpha[ii] - old_alpha_i;
double delta_alpha_j = j.alpha[jj] - old_alpha_j;
int si = 2 * ii - 1;
int sj = 2 * jj - 1;
for (int k = 0; k < sv.size(); k++) {
SupportVector v = sv.get(k);
v.g[0] -= si * i.kcache.get(k) * delta_alpha_i + sj * j.kcache.get(k) * delta_alpha_j; // depends on control dependency: [for], data = [k]
v.g[1] += si * i.kcache.get(k) * delta_alpha_i + sj * j.kcache.get(k) * delta_alpha_j; // depends on control dependency: [for], data = [k]
}
// optimality test
minmax();
b = -(gmax + gmin) / 2;
if (gmax - gmin < epsgr) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public FlowStepRule moveFlowStepEntryRuleDown(FlowStepRule flowStepRuleParam)
{
if(flowStepRuleParam != null && this.serviceTicket != null)
{
flowStepRuleParam.setServiceTicket(this.serviceTicket);
}
return new FlowStepRule(this.postJson(
flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleMoveEntryDown()));
} }
|
public class class_name {
public FlowStepRule moveFlowStepEntryRuleDown(FlowStepRule flowStepRuleParam)
{
if(flowStepRuleParam != null && this.serviceTicket != null)
{
flowStepRuleParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
return new FlowStepRule(this.postJson(
flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleMoveEntryDown()));
} }
|
public class class_name {
public static QueryFilter or(QueryFilter... queryFilters) {
QueryFilter result = null;
for (QueryFilter q : queryFilters) {
result = result == null ? q : result.or(q);
}
return result;
} }
|
public class class_name {
public static QueryFilter or(QueryFilter... queryFilters) {
QueryFilter result = null;
for (QueryFilter q : queryFilters) {
result = result == null ? q : result.or(q); // depends on control dependency: [for], data = [q]
}
return result;
} }
|
public class class_name {
@Deprecated
public Object getProperty(String name) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null.");
return null;
} else {
return cleverTapAPI.getProperty(name);
}
} }
|
public class class_name {
@Deprecated
public Object getProperty(String name) {
CleverTapAPI cleverTapAPI = weakReference.get();
if (cleverTapAPI == null) {
Logger.d("CleverTap Instance is null."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
} else {
return cleverTapAPI.getProperty(name); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ArrayDBIDs updateKNNsAfterInsertion(DBIDs ids) {
ArrayModifiableDBIDs rkNN_ids = DBIDUtil.newArray();
DBIDs oldids = DBIDUtil.difference(relation.getDBIDs(), ids);
for(DBIDIter iter = oldids.iter(); iter.valid(); iter.advance()) {
KNNList kNNs = storage.get(iter);
double knnDist = kNNs.getKNNDistance();
// look for new kNNs
KNNHeap heap = null;
for(DBIDIter iter2 = ids.iter(); iter2.valid(); iter2.advance()) {
final double dist = distanceQuery.distance(iter, iter2);
if(dist <= knnDist) {
heap = heap != null ? heap : DBIDUtil.newHeap(kNNs);
heap.insert(dist, iter2);
}
}
if(heap != null) {
storage.put(iter, kNNs = heap.toKNNList());
rkNN_ids.add(iter);
}
}
return rkNN_ids;
} }
|
public class class_name {
private ArrayDBIDs updateKNNsAfterInsertion(DBIDs ids) {
ArrayModifiableDBIDs rkNN_ids = DBIDUtil.newArray();
DBIDs oldids = DBIDUtil.difference(relation.getDBIDs(), ids);
for(DBIDIter iter = oldids.iter(); iter.valid(); iter.advance()) {
KNNList kNNs = storage.get(iter);
double knnDist = kNNs.getKNNDistance();
// look for new kNNs
KNNHeap heap = null;
for(DBIDIter iter2 = ids.iter(); iter2.valid(); iter2.advance()) {
final double dist = distanceQuery.distance(iter, iter2);
if(dist <= knnDist) {
heap = heap != null ? heap : DBIDUtil.newHeap(kNNs); // depends on control dependency: [if], data = [none]
heap.insert(dist, iter2); // depends on control dependency: [if], data = [(dist]
}
}
if(heap != null) {
storage.put(iter, kNNs = heap.toKNNList()); // depends on control dependency: [if], data = [none]
rkNN_ids.add(iter); // depends on control dependency: [if], data = [none]
}
}
return rkNN_ids;
} }
|
public class class_name {
public int parseParameters(String[] args) {
// check for action
if (args.length < 1) {
CliFrontendParser.printHelp(customCommandLines);
System.out.println("Please specify an action.");
return 1;
}
// get action
String action = args[0];
// remove action from parameters
final String[] params = Arrays.copyOfRange(args, 1, args.length);
try {
// do action
switch (action) {
case ACTION_RUN:
run(params);
return 0;
case ACTION_LIST:
list(params);
return 0;
case ACTION_INFO:
info(params);
return 0;
case ACTION_CANCEL:
cancel(params);
return 0;
case ACTION_STOP:
stop(params);
return 0;
case ACTION_SAVEPOINT:
savepoint(params);
return 0;
case "-h":
case "--help":
CliFrontendParser.printHelp(customCommandLines);
return 0;
case "-v":
case "--version":
String version = EnvironmentInformation.getVersion();
String commitID = EnvironmentInformation.getRevisionInformation().commitId;
System.out.print("Version: " + version);
System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
return 0;
default:
System.out.printf("\"%s\" is not a valid action.\n", action);
System.out.println();
System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
System.out.println();
System.out.println("Specify the version option (-v or --version) to print Flink version.");
System.out.println();
System.out.println("Specify the help option (-h or --help) to get help on the command.");
return 1;
}
} catch (CliArgsException ce) {
return handleArgException(ce);
} catch (ProgramParametrizationException ppe) {
return handleParametrizationException(ppe);
} catch (ProgramMissingJobException pmje) {
return handleMissingJobException();
} catch (Exception e) {
return handleError(e);
}
} }
|
public class class_name {
public int parseParameters(String[] args) {
// check for action
if (args.length < 1) {
CliFrontendParser.printHelp(customCommandLines); // depends on control dependency: [if], data = [none]
System.out.println("Please specify an action."); // depends on control dependency: [if], data = [none]
return 1; // depends on control dependency: [if], data = [none]
}
// get action
String action = args[0];
// remove action from parameters
final String[] params = Arrays.copyOfRange(args, 1, args.length);
try {
// do action
switch (action) {
case ACTION_RUN:
run(params);
return 0;
case ACTION_LIST:
list(params);
return 0;
case ACTION_INFO:
info(params);
return 0;
case ACTION_CANCEL:
cancel(params);
return 0;
case ACTION_STOP:
stop(params);
return 0;
case ACTION_SAVEPOINT:
savepoint(params);
return 0;
case "-h":
case "--help":
CliFrontendParser.printHelp(customCommandLines);
return 0;
case "-v":
case "--version":
String version = EnvironmentInformation.getVersion();
String commitID = EnvironmentInformation.getRevisionInformation().commitId;
System.out.print("Version: " + version);
System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
return 0;
default:
System.out.printf("\"%s\" is not a valid action.\n", action);
System.out.println();
System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
System.out.println();
System.out.println("Specify the version option (-v or --version) to print Flink version.");
System.out.println();
System.out.println("Specify the help option (-h or --help) to get help on the command.");
return 1;
}
} catch (CliArgsException ce) {
return handleArgException(ce);
} catch (ProgramParametrizationException ppe) { // depends on control dependency: [catch], data = [none]
return handleParametrizationException(ppe);
} catch (ProgramMissingJobException pmje) { // depends on control dependency: [catch], data = [none]
return handleMissingJobException();
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
return handleError(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private int paethPredictor(byte[] line, byte[] previousLine, int x, int xp) {
int a = 0xFF & ((xp < 0) ? 0 : line[xp]);
int b = 0xFF & previousLine[x];
int c = 0xFF & ((xp < 0) ? 0 : previousLine[xp]);
int p = a + b - c;
int pa = (p >= a) ? (p - a) : -(p - a);
int pb = (p >= b) ? (p - b) : -(p - b);
int pc = (p >= c) ? (p - c) : -(p - c);
if (pa <= pb && pa <= pc) {
return a;
}
return (pb <= pc) ? b : c;
} }
|
public class class_name {
private int paethPredictor(byte[] line, byte[] previousLine, int x, int xp) {
int a = 0xFF & ((xp < 0) ? 0 : line[xp]);
int b = 0xFF & previousLine[x];
int c = 0xFF & ((xp < 0) ? 0 : previousLine[xp]);
int p = a + b - c;
int pa = (p >= a) ? (p - a) : -(p - a);
int pb = (p >= b) ? (p - b) : -(p - b);
int pc = (p >= c) ? (p - c) : -(p - c);
if (pa <= pb && pa <= pc) {
return a; // depends on control dependency: [if], data = [none]
}
return (pb <= pc) ? b : c;
} }
|
public class class_name {
private Node tryAppend(Node s, boolean haveData) {
for (Node t = tail, p = t;;) { // move p to last node and append
Node n, u; // temps for reads of next & tail
if (p == null && (p = head) == null) {
if (casHead(null, s))
return s; // initialize
}
else if (p.cannotPrecede(haveData))
return null; // lost race vs opposite mode
else if ((n = p.next) != null) // not last; keep traversing
p = p != t && t != (u = tail) ? (t = u) : // stale tail
(UNLINKED != n) ? n : null; // restart if off list
else if (!p.casNext(null, s))
p = p.next; // re-read on CAS failure
else {
if (p != t) { // update if slack now >= 2
while ((tail != t || !casTail(t, s)) &&
(t = tail) != null &&
(s = t.next) != null && // advance and retry
(s = s.next) != null && s != UNLINKED);
}
return p;
}
}
} }
|
public class class_name {
private Node tryAppend(Node s, boolean haveData) {
for (Node t = tail, p = t;;) { // move p to last node and append
Node n, u; // temps for reads of next & tail
if (p == null && (p = head) == null) {
if (casHead(null, s))
return s; // initialize
}
else if (p.cannotPrecede(haveData))
return null; // lost race vs opposite mode
else if ((n = p.next) != null) // not last; keep traversing
p = p != t && t != (u = tail) ? (t = u) : // stale tail
(UNLINKED != n) ? n : null; // restart if off list
else if (!p.casNext(null, s))
p = p.next; // re-read on CAS failure
else {
if (p != t) { // update if slack now >= 2
while ((tail != t || !casTail(t, s)) &&
(t = tail) != null &&
(s = t.next) != null && // advance and retry
(s = s.next) != null && s != UNLINKED);
}
return p; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static long[] toBitset(Itemset i, long[] bits) {
for(int it = i.iter(); i.iterValid(it); it = i.iterAdvance(it)) {
BitsUtil.setI(bits, i.iterDim(it));
}
return bits;
} }
|
public class class_name {
public static long[] toBitset(Itemset i, long[] bits) {
for(int it = i.iter(); i.iterValid(it); it = i.iterAdvance(it)) {
BitsUtil.setI(bits, i.iterDim(it)); // depends on control dependency: [for], data = [it]
}
return bits;
} }
|
public class class_name {
public final void setPropositionDefinitions(PropositionDefinition[] propDefs) {
if (propDefs == null) {
propDefs = EMPTY_PROP_DEF_ARRAY;
}
this.propDefs = propDefs.clone();
} }
|
public class class_name {
public final void setPropositionDefinitions(PropositionDefinition[] propDefs) {
if (propDefs == null) {
propDefs = EMPTY_PROP_DEF_ARRAY; // depends on control dependency: [if], data = [none]
}
this.propDefs = propDefs.clone();
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.