code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private void filterSuperInterfaceMethods(JavaClass inf, Set<QMethod> infMethods, JavaClass cls) {
try {
if (infMethods.isEmpty()) {
return;
}
JavaClass[] superInfs = inf.getInterfaces();
for (JavaClass superInf : superInfs) {
if (cls.implementationOf(superInf)) {
Set<QMethod> superInfMethods = buildMethodSet(superInf);
infMethods.removeAll(superInfMethods);
if (infMethods.isEmpty()) {
return;
}
}
filterSuperInterfaceMethods(superInf, infMethods, cls);
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
infMethods.clear();
}
} }
|
public class class_name {
private void filterSuperInterfaceMethods(JavaClass inf, Set<QMethod> infMethods, JavaClass cls) {
try {
if (infMethods.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
JavaClass[] superInfs = inf.getInterfaces();
for (JavaClass superInf : superInfs) {
if (cls.implementationOf(superInf)) {
Set<QMethod> superInfMethods = buildMethodSet(superInf);
infMethods.removeAll(superInfMethods); // depends on control dependency: [if], data = [none]
if (infMethods.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
}
filterSuperInterfaceMethods(superInf, infMethods, cls); // depends on control dependency: [for], data = [superInf]
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
infMethods.clear();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static UserExecutorConfiguration of(ExecutorType type, int num, @Nullable Class<? extends ThreadFactory> threadFactoryClass) {
UserExecutorConfiguration configuration = of(type, num);
if (threadFactoryClass != null) {
configuration.threadFactoryClass = threadFactoryClass;
}
return configuration;
} }
|
public class class_name {
public static UserExecutorConfiguration of(ExecutorType type, int num, @Nullable Class<? extends ThreadFactory> threadFactoryClass) {
UserExecutorConfiguration configuration = of(type, num);
if (threadFactoryClass != null) {
configuration.threadFactoryClass = threadFactoryClass; // depends on control dependency: [if], data = [none]
}
return configuration;
} }
|
public class class_name {
static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) {
List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>();
for (InetSocketAddress node : hosts) {
try {
node.getAddress().getHostAddress();
resolvableHosts.add(node);
} catch (NullPointerException ex) {
LOGGER.error("Unable to resolve address " + node.toString());
}
}
return resolvableHosts;
} }
|
public class class_name {
static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) {
List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>();
for (InetSocketAddress node : hosts) {
try {
node.getAddress().getHostAddress(); // depends on control dependency: [try], data = [none]
resolvableHosts.add(node); // depends on control dependency: [try], data = [none]
} catch (NullPointerException ex) {
LOGGER.error("Unable to resolve address " + node.toString());
} // depends on control dependency: [catch], data = [none]
}
return resolvableHosts;
} }
|
public class class_name {
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
if(highlighted_cluster!=null){
highlighted_cluster.highlight(false);
highlighted_cluster=null;
}
} }
|
public class class_name {
private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
if(highlighted_cluster!=null){
highlighted_cluster.highlight(false); // depends on control dependency: [if], data = [none]
highlighted_cluster=null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean toBoolean(Object val) {
if (val == null) {
return false;
}
else if (val instanceof Boolean) {
return ((Boolean) val).booleanValue();
}
else if (val instanceof Number) {
double number = toDouble(val);
return !Double.isNaN(number) && number != 0.d;
}
else if (val instanceof String) {
String strval = val.toString();
return strval.length() > 0 && !"false".equals(strval);
}
else if (val instanceof Collection<?>) {
Collection<?> collval = (Collection<?>) val;
return collval.isEmpty();
}
return false;
} }
|
public class class_name {
public boolean toBoolean(Object val) {
if (val == null) {
return false; // depends on control dependency: [if], data = [none]
}
else if (val instanceof Boolean) {
return ((Boolean) val).booleanValue(); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Number) {
double number = toDouble(val);
return !Double.isNaN(number) && number != 0.d; // depends on control dependency: [if], data = [none]
}
else if (val instanceof String) {
String strval = val.toString();
return strval.length() > 0 && !"false".equals(strval); // depends on control dependency: [if], data = [none]
}
else if (val instanceof Collection<?>) {
Collection<?> collval = (Collection<?>) val;
return collval.isEmpty(); // depends on control dependency: [if], data = [)]
}
return false;
} }
|
public class class_name {
@Override
public List<String> tokenize(String text) {
List<String> l = new ArrayList<>();
boolean hasException = false;
for (int idx = 0; idx < EXCEPTIONS.length; idx++) {
if(text.contains(EXCEPTIONS[idx])) {
hasException = true;
text = text.replace(EXCEPTIONS[idx], EXCEPTION_REPLACEMENT[idx]);
}
}
StringTokenizer st = new StringTokenizer(text, getTokenizingCharacters(), true);
while (st.hasMoreElements()) {
String token = st.nextToken();
for (int idx = 0; hasException && idx < EXCEPTIONS.length; idx++) {
if (token.equals(EXCEPTION_REPLACEMENT[idx])) {
token = EXCEPTIONS[idx];
}
}
if (token.length() > 1 && token.endsWith("-")) {
l.add(token.substring(0, token.length() - 1));
l.add("-");
} else {
l.add(token);
}
}
return joinEMailsAndUrls(l);
} }
|
public class class_name {
@Override
public List<String> tokenize(String text) {
List<String> l = new ArrayList<>();
boolean hasException = false;
for (int idx = 0; idx < EXCEPTIONS.length; idx++) {
if(text.contains(EXCEPTIONS[idx])) {
hasException = true; // depends on control dependency: [if], data = [none]
text = text.replace(EXCEPTIONS[idx], EXCEPTION_REPLACEMENT[idx]); // depends on control dependency: [if], data = [none]
}
}
StringTokenizer st = new StringTokenizer(text, getTokenizingCharacters(), true);
while (st.hasMoreElements()) {
String token = st.nextToken();
for (int idx = 0; hasException && idx < EXCEPTIONS.length; idx++) {
if (token.equals(EXCEPTION_REPLACEMENT[idx])) {
token = EXCEPTIONS[idx]; // depends on control dependency: [if], data = [none]
}
}
if (token.length() > 1 && token.endsWith("-")) {
l.add(token.substring(0, token.length() - 1)); // depends on control dependency: [if], data = [none]
l.add("-"); // depends on control dependency: [if], data = [none]
} else {
l.add(token); // depends on control dependency: [if], data = [none]
}
}
return joinEMailsAndUrls(l);
} }
|
public class class_name {
public static Map<String, String> signProperties(
Map<String, String> postProp, String url, String method,
String oauth_consumer_key, String oauth_consumer_secret,
String tool_consumer_instance_guid,
String tool_consumer_instance_description,
String tool_consumer_instance_url, String tool_consumer_instance_name,
String tool_consumer_instance_contact_email) {
postProp = BasicLTIUtil.cleanupProperties(postProp);
if (postProp.get(LTI_VERSION) == null) {
postProp.put(LTI_VERSION, "LTI-1p0");
}
if (postProp.get(LTI_MESSAGE_TYPE) == null) {
postProp.put(LTI_MESSAGE_TYPE, "basic-lti-launch-request");
}
// Allow caller to internationalize this for us...
if (postProp.get(BASICLTI_SUBMIT) == null) {
postProp.put(BASICLTI_SUBMIT, "Launch Endpoint with BasicLTI Data");
}
if (tool_consumer_instance_guid != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_GUID, tool_consumer_instance_guid);
}
if (tool_consumer_instance_description != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_DESCRIPTION,
tool_consumer_instance_description);
}
if (tool_consumer_instance_url != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_URL, tool_consumer_instance_url);
}
if (tool_consumer_instance_name != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_NAME, tool_consumer_instance_name);
}
if (tool_consumer_instance_contact_email != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_CONTACT_EMAIL,
tool_consumer_instance_contact_email);
}
if (postProp.get("oauth_callback") == null) {
postProp.put("oauth_callback", "about:blank");
}
if (oauth_consumer_key == null || oauth_consumer_secret == null) {
dPrint("No signature generated in signProperties");
return postProp;
}
OAuthMessage oam = new OAuthMessage(method, url, postProp.entrySet());
OAuthConsumer cons = new OAuthConsumer("about:blank", oauth_consumer_key,
oauth_consumer_secret, null);
OAuthAccessor acc = new OAuthAccessor(cons);
try {
oam.addRequiredParameters(acc);
// System.out.println("Base Message String\n"+OAuthSignatureMethod.getBaseString(oam)+"\n");
List<Map.Entry<String, String>> params = oam.getParameters();
Map<String, String> nextProp = new HashMap<String, String>();
// Convert to Map<String, String>
for (final Map.Entry<String, String> entry : params) {
nextProp.put(entry.getKey(), entry.getValue());
}
return nextProp;
} catch (net.oauth.OAuthException e) {
M_log.warning("BasicLTIUtil.signProperties OAuth Exception "
+ e.getMessage());
throw new Error(e);
} catch (java.io.IOException e) {
M_log.warning("BasicLTIUtil.signProperties IO Exception "
+ e.getMessage());
throw new Error(e);
} catch (java.net.URISyntaxException e) {
M_log.warning("BasicLTIUtil.signProperties URI Syntax Exception "
+ e.getMessage());
throw new Error(e);
}
} }
|
public class class_name {
public static Map<String, String> signProperties(
Map<String, String> postProp, String url, String method,
String oauth_consumer_key, String oauth_consumer_secret,
String tool_consumer_instance_guid,
String tool_consumer_instance_description,
String tool_consumer_instance_url, String tool_consumer_instance_name,
String tool_consumer_instance_contact_email) {
postProp = BasicLTIUtil.cleanupProperties(postProp);
if (postProp.get(LTI_VERSION) == null) {
postProp.put(LTI_VERSION, "LTI-1p0"); // depends on control dependency: [if], data = [none]
}
if (postProp.get(LTI_MESSAGE_TYPE) == null) {
postProp.put(LTI_MESSAGE_TYPE, "basic-lti-launch-request"); // depends on control dependency: [if], data = [none]
}
// Allow caller to internationalize this for us...
if (postProp.get(BASICLTI_SUBMIT) == null) {
postProp.put(BASICLTI_SUBMIT, "Launch Endpoint with BasicLTI Data"); // depends on control dependency: [if], data = [none]
}
if (tool_consumer_instance_guid != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_GUID, tool_consumer_instance_guid); // depends on control dependency: [if], data = [none]
}
if (tool_consumer_instance_description != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_DESCRIPTION,
tool_consumer_instance_description); // depends on control dependency: [if], data = [none]
}
if (tool_consumer_instance_url != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_URL, tool_consumer_instance_url); // depends on control dependency: [if], data = [none]
}
if (tool_consumer_instance_name != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_NAME, tool_consumer_instance_name); // depends on control dependency: [if], data = [none]
}
if (tool_consumer_instance_contact_email != null) {
postProp.put(TOOL_CONSUMER_INSTANCE_CONTACT_EMAIL,
tool_consumer_instance_contact_email); // depends on control dependency: [if], data = [none]
}
if (postProp.get("oauth_callback") == null) {
postProp.put("oauth_callback", "about:blank"); // depends on control dependency: [if], data = [none]
}
if (oauth_consumer_key == null || oauth_consumer_secret == null) {
dPrint("No signature generated in signProperties"); // depends on control dependency: [if], data = [none]
return postProp; // depends on control dependency: [if], data = [none]
}
OAuthMessage oam = new OAuthMessage(method, url, postProp.entrySet());
OAuthConsumer cons = new OAuthConsumer("about:blank", oauth_consumer_key,
oauth_consumer_secret, null);
OAuthAccessor acc = new OAuthAccessor(cons);
try {
oam.addRequiredParameters(acc); // depends on control dependency: [try], data = [none]
// System.out.println("Base Message String\n"+OAuthSignatureMethod.getBaseString(oam)+"\n");
List<Map.Entry<String, String>> params = oam.getParameters();
Map<String, String> nextProp = new HashMap<String, String>();
// Convert to Map<String, String>
for (final Map.Entry<String, String> entry : params) {
nextProp.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return nextProp; // depends on control dependency: [try], data = [none]
} catch (net.oauth.OAuthException e) {
M_log.warning("BasicLTIUtil.signProperties OAuth Exception "
+ e.getMessage());
throw new Error(e);
} catch (java.io.IOException e) { // depends on control dependency: [catch], data = [none]
M_log.warning("BasicLTIUtil.signProperties IO Exception "
+ e.getMessage());
throw new Error(e);
} catch (java.net.URISyntaxException e) { // depends on control dependency: [catch], data = [none]
M_log.warning("BasicLTIUtil.signProperties URI Syntax Exception "
+ e.getMessage());
throw new Error(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static TypeConverter<?> putConverter(final String attributeName,
final String type) {
TypeConverter<?> conv = DataConverter.converterClasses.get(type);
if (conv == null) {
log.warn("Could not find a converter for data type {}.", type);
throw new IllegalArgumentException(
"Could not find a converter for data type \"" + type + "\".");
}
return DataConverter.attributeConverters.put(attributeName, conv);
} }
|
public class class_name {
public static TypeConverter<?> putConverter(final String attributeName,
final String type) {
TypeConverter<?> conv = DataConverter.converterClasses.get(type);
if (conv == null) {
log.warn("Could not find a converter for data type {}.", type); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(
"Could not find a converter for data type \"" + type + "\".");
}
return DataConverter.attributeConverters.put(attributeName, conv);
} }
|
public class class_name {
public void setExceptionGen(@Nullable TypeMerger m, CodeExceptionGen exceptionGen) {
if (this.exceptionGen != null) {
AnalysisContext.logError("Multiple exception handlers");
}
this.exceptionGen = exceptionGen;
} }
|
public class class_name {
public void setExceptionGen(@Nullable TypeMerger m, CodeExceptionGen exceptionGen) {
if (this.exceptionGen != null) {
AnalysisContext.logError("Multiple exception handlers"); // depends on control dependency: [if], data = [none]
}
this.exceptionGen = exceptionGen;
} }
|
public class class_name {
@Override
public Optional<ResolvedType> solveGenericType(String name, TypeSolver typeSolver) {
if(wrappedNode.getScope().isPresent()){
ResolvedType typeOfScope = JavaParserFacade.get(typeSolver).getType(wrappedNode.getScope().get());
Optional<ResolvedType> res = typeOfScope.asReferenceType().getGenericParameterByName(name);
return res;
} else{
return Optional.empty();
}
} }
|
public class class_name {
@Override
public Optional<ResolvedType> solveGenericType(String name, TypeSolver typeSolver) {
if(wrappedNode.getScope().isPresent()){
ResolvedType typeOfScope = JavaParserFacade.get(typeSolver).getType(wrappedNode.getScope().get());
Optional<ResolvedType> res = typeOfScope.asReferenceType().getGenericParameterByName(name);
return res; // depends on control dependency: [if], data = [none]
} else{
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(CertificateValidity certificateValidity, ProtocolMarshaller protocolMarshaller) {
if (certificateValidity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(certificateValidity.getNotBefore(), NOTBEFORE_BINDING);
protocolMarshaller.marshall(certificateValidity.getNotAfter(), NOTAFTER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CertificateValidity certificateValidity, ProtocolMarshaller protocolMarshaller) {
if (certificateValidity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(certificateValidity.getNotBefore(), NOTBEFORE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(certificateValidity.getNotAfter(), NOTAFTER_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 <T> Observable<T> toHotObservable(final List<ComposableFuture<T>> futures, final boolean failOnError) {
final ReplaySubject<T> subject = ReplaySubject.create(futures.size());
final AtomicInteger counter = new AtomicInteger(futures.size());
final AtomicBoolean errorTrigger = new AtomicBoolean(false);
for (final ComposableFuture<T> future : futures) {
future.consume(provideObserverResult(subject, counter, errorTrigger, failOnError));
}
return subject;
} }
|
public class class_name {
public static <T> Observable<T> toHotObservable(final List<ComposableFuture<T>> futures, final boolean failOnError) {
final ReplaySubject<T> subject = ReplaySubject.create(futures.size());
final AtomicInteger counter = new AtomicInteger(futures.size());
final AtomicBoolean errorTrigger = new AtomicBoolean(false);
for (final ComposableFuture<T> future : futures) {
future.consume(provideObserverResult(subject, counter, errorTrigger, failOnError)); // depends on control dependency: [for], data = [future]
}
return subject;
} }
|
public class class_name {
@UiThread
public void removeMarker(@NonNull MarkerView markerView) {
if (mapView.isDestroyed() || !markers.contains(markerView)) {
return;
}
mapView.removeView(markerView.getView());
markers.remove(markerView);
} }
|
public class class_name {
@UiThread
public void removeMarker(@NonNull MarkerView markerView) {
if (mapView.isDestroyed() || !markers.contains(markerView)) {
return; // depends on control dependency: [if], data = [none]
}
mapView.removeView(markerView.getView());
markers.remove(markerView);
} }
|
public class class_name {
@Override
protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException {
if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) {
throw new TemplateException("Operand is property path but scope is not an object.");
}
String value = null;
Format format = (Format) arguments[0];
if (format != null) {
value = this.content.getString(scope, propertyPath, format);
} else {
Object object = this.content.getObject(scope, propertyPath);
if (object != null) {
if (!ConverterRegistry.hasType(object.getClass())) {
throw new TemplateException("Invalid element |%s|. Operand for VALUE operator without formatter should be convertible to string.", element);
}
value = ConverterRegistry.getConverter().asString(object);
}
}
if (value == null) {
return null;
}
return new AttrImpl("value", value);
} }
|
public class class_name {
@Override
protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws TemplateException {
if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) {
throw new TemplateException("Operand is property path but scope is not an object.");
}
String value = null;
Format format = (Format) arguments[0];
if (format != null) {
value = this.content.getString(scope, propertyPath, format);
// depends on control dependency: [if], data = [none]
} else {
Object object = this.content.getObject(scope, propertyPath);
if (object != null) {
if (!ConverterRegistry.hasType(object.getClass())) {
throw new TemplateException("Invalid element |%s|. Operand for VALUE operator without formatter should be convertible to string.", element);
}
value = ConverterRegistry.getConverter().asString(object);
// depends on control dependency: [if], data = [(object]
}
}
if (value == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return new AttrImpl("value", value);
} }
|
public class class_name {
Map<FSVolume, List<Map<Block, DatanodeBlockInfo>>> getBlockCrcPerVolume(
List<FSVolume> volumes) {
Map<FSVolume, List<Map<Block, DatanodeBlockInfo>>> retMap =
new HashMap<FSVolume, List<Map<Block, DatanodeBlockInfo>>>();
for (FSVolume volume : volumes) {
List<Map<Block, DatanodeBlockInfo>> newSubMap = new ArrayList<Map<Block, DatanodeBlockInfo>>(
numBucket);
for (int i = 0; i < numBucket; i++) {
newSubMap.add(new HashMap<Block, DatanodeBlockInfo>());
}
retMap.put(volume, newSubMap);
}
for (BlockBucket bb : blockBuckets) {
bb.getBlockCrcPerVolume(retMap);
}
return retMap;
} }
|
public class class_name {
Map<FSVolume, List<Map<Block, DatanodeBlockInfo>>> getBlockCrcPerVolume(
List<FSVolume> volumes) {
Map<FSVolume, List<Map<Block, DatanodeBlockInfo>>> retMap =
new HashMap<FSVolume, List<Map<Block, DatanodeBlockInfo>>>();
for (FSVolume volume : volumes) {
List<Map<Block, DatanodeBlockInfo>> newSubMap = new ArrayList<Map<Block, DatanodeBlockInfo>>(
numBucket);
for (int i = 0; i < numBucket; i++) {
newSubMap.add(new HashMap<Block, DatanodeBlockInfo>()); // depends on control dependency: [for], data = [none]
}
retMap.put(volume, newSubMap); // depends on control dependency: [for], data = [volume]
}
for (BlockBucket bb : blockBuckets) {
bb.getBlockCrcPerVolume(retMap); // depends on control dependency: [for], data = [bb]
}
return retMap;
} }
|
public class class_name {
String prefix(String s, String pre, String post) {
if (s == null) {
return "";
}
String pp = s.replaceAll("\\R", post + pre);
if (pp.endsWith(post + pre)) {
// prevent an extra prefix char and blank line when the string
// already terminates with newline
pp = pp.substring(0, pp.length() - (post + pre).length());
}
return pre + pp + post;
} }
|
public class class_name {
String prefix(String s, String pre, String post) {
if (s == null) {
return ""; // depends on control dependency: [if], data = [none]
}
String pp = s.replaceAll("\\R", post + pre);
if (pp.endsWith(post + pre)) {
// prevent an extra prefix char and blank line when the string
// already terminates with newline
pp = pp.substring(0, pp.length() - (post + pre).length()); // depends on control dependency: [if], data = [none]
}
return pre + pp + post;
} }
|
public class class_name {
public boolean isFailure(R result, Throwable failure) {
for (BiPredicate<R, Throwable> predicate : failureConditions) {
try {
if (predicate.test(result, failure))
return true;
} catch (Exception ignored) {
// Ignore confused user-supplied predicates.
// They should not be allowed to halt execution of the operation.
}
}
// Fail by default if a failure is not checked by a condition
return failure != null && !failuresChecked;
} }
|
public class class_name {
public boolean isFailure(R result, Throwable failure) {
for (BiPredicate<R, Throwable> predicate : failureConditions) {
try {
if (predicate.test(result, failure))
return true;
} catch (Exception ignored) {
// Ignore confused user-supplied predicates.
// They should not be allowed to halt execution of the operation.
} // depends on control dependency: [catch], data = [none]
}
// Fail by default if a failure is not checked by a condition
return failure != null && !failuresChecked;
} }
|
public class class_name {
private boolean isBreakBoundary(int index) {
BreakIterator breakiterator = search_.breakIter();
if (breakiterator == null) {
breakiterator = search_.internalBreakIter_;
}
return (breakiterator != null && breakiterator.isBoundary(index));
} }
|
public class class_name {
private boolean isBreakBoundary(int index) {
BreakIterator breakiterator = search_.breakIter();
if (breakiterator == null) {
breakiterator = search_.internalBreakIter_; // depends on control dependency: [if], data = [none]
}
return (breakiterator != null && breakiterator.isBoundary(index));
} }
|
public class class_name {
public ElementWithOptions addOptionToGroup(Option option, String groupId) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
if (group.hasValue(option.getValue())) {
throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element");
}
}
OptionGroup group = optionGroups.get(groupId);
if (group == null) {
group = new OptionGroup(groupId, null);
this.addOptionGroup(group);
}
group.addOption(option);
return this;
} }
|
public class class_name {
public ElementWithOptions addOptionToGroup(Option option, String groupId) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
if (group.hasValue(option.getValue())) {
throw new IllegalArgumentException("The value '" + option.getValue() + "' is already present in this element");
}
}
OptionGroup group = optionGroups.get(groupId);
if (group == null) {
group = new OptionGroup(groupId, null);
// depends on control dependency: [if], data = [(group]
this.addOptionGroup(group);
// depends on control dependency: [if], data = [(group]
}
group.addOption(option);
return this;
} }
|
public class class_name {
public static int getXpathIndexInt(String path) {
int pos1 = path.lastIndexOf('/');
int pos2 = path.lastIndexOf('[');
if ((pos2 < 0) || (pos1 > pos2)) {
return 1;
}
String idxStr = path.substring(pos2 + 1, path.lastIndexOf(']'));
try {
return Integer.parseInt(idxStr);
} catch (NumberFormatException e) {
// NOOP
}
return 1;
} }
|
public class class_name {
public static int getXpathIndexInt(String path) {
int pos1 = path.lastIndexOf('/');
int pos2 = path.lastIndexOf('[');
if ((pos2 < 0) || (pos1 > pos2)) {
return 1; // depends on control dependency: [if], data = [none]
}
String idxStr = path.substring(pos2 + 1, path.lastIndexOf(']'));
try {
return Integer.parseInt(idxStr); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// NOOP
} // depends on control dependency: [catch], data = [none]
return 1;
} }
|
public class class_name {
@Override
public EClass getIfcSolidOrShell() {
if (ifcSolidOrShellEClass == null) {
ifcSolidOrShellEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1160);
}
return ifcSolidOrShellEClass;
} }
|
public class class_name {
@Override
public EClass getIfcSolidOrShell() {
if (ifcSolidOrShellEClass == null) {
ifcSolidOrShellEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1160);
// depends on control dependency: [if], data = [none]
}
return ifcSolidOrShellEClass;
} }
|
public class class_name {
void initializeNonPersistent(
MessageProcessor messageProcessor,
HashMap<String, Object> durableSubscriptionsTable,
TransactionCommon transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"initializeNonPersistent",
new Object[] {
messageProcessor,
durableSubscriptionsTable,
transaction });
//Check if we are running in an ND environment. If not we can skip
//some performance intensive WLM work
_singleServer = messageProcessor.isSingleServer();
if (isPubSub())
{
_pubSubRealization.
initialise(true,
durableSubscriptionsTable);
}
else
{
_ptoPRealization.initialise();
_remoteQueuePoints = new Index();
createControlAdapter();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeNonPersistent");
} }
|
public class class_name {
void initializeNonPersistent(
MessageProcessor messageProcessor,
HashMap<String, Object> durableSubscriptionsTable,
TransactionCommon transaction)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"initializeNonPersistent",
new Object[] {
messageProcessor,
durableSubscriptionsTable,
transaction });
//Check if we are running in an ND environment. If not we can skip
//some performance intensive WLM work
_singleServer = messageProcessor.isSingleServer();
if (isPubSub())
{
_pubSubRealization.
initialise(true,
durableSubscriptionsTable); // depends on control dependency: [if], data = [none]
}
else
{
_ptoPRealization.initialise(); // depends on control dependency: [if], data = [none]
_remoteQueuePoints = new Index(); // depends on control dependency: [if], data = [none]
createControlAdapter(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeNonPersistent");
} }
|
public class class_name {
public static String selectServerId(Configuration configuration) throws AtlasException {
// ids are already trimmed by this method
String[] ids = configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS);
String matchingServerId = null;
int appPort = Integer.parseInt(System.getProperty(AtlasConstants.SYSTEM_PROPERTY_APP_PORT));
for (String id : ids) {
String hostPort = configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +id);
if (!StringUtils.isEmpty(hostPort)) {
InetSocketAddress socketAddress;
try {
socketAddress = NetUtils.createSocketAddr(hostPort);
} catch (Exception e) {
LOG.warn("Exception while trying to get socket address for {}", hostPort, e);
continue;
}
if (!socketAddress.isUnresolved()
&& NetUtils.isLocalAddress(socketAddress.getAddress())
&& appPort == socketAddress.getPort()) {
LOG.info("Found matched server id {} with host port: {}", id, hostPort);
matchingServerId = id;
break;
}
} else {
LOG.info("Could not find matching address entry for id: {}", id);
}
}
if (matchingServerId == null) {
String msg = String.format("Could not find server id for this instance. " +
"Unable to find IDs matching any local host and port binding among %s",
StringUtils.join(ids, ","));
throw new AtlasException(msg);
}
return matchingServerId;
} }
|
public class class_name {
public static String selectServerId(Configuration configuration) throws AtlasException {
// ids are already trimmed by this method
String[] ids = configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS);
String matchingServerId = null;
int appPort = Integer.parseInt(System.getProperty(AtlasConstants.SYSTEM_PROPERTY_APP_PORT));
for (String id : ids) {
String hostPort = configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +id);
if (!StringUtils.isEmpty(hostPort)) {
InetSocketAddress socketAddress;
try {
socketAddress = NetUtils.createSocketAddr(hostPort); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Exception while trying to get socket address for {}", hostPort, e);
continue;
} // depends on control dependency: [catch], data = [none]
if (!socketAddress.isUnresolved()
&& NetUtils.isLocalAddress(socketAddress.getAddress())
&& appPort == socketAddress.getPort()) {
LOG.info("Found matched server id {} with host port: {}", id, hostPort); // depends on control dependency: [if], data = [none]
matchingServerId = id; // depends on control dependency: [if], data = [none]
break;
}
} else {
LOG.info("Could not find matching address entry for id: {}", id); // depends on control dependency: [if], data = [none]
}
}
if (matchingServerId == null) {
String msg = String.format("Could not find server id for this instance. " +
"Unable to find IDs matching any local host and port binding among %s",
StringUtils.join(ids, ","));
throw new AtlasException(msg);
}
return matchingServerId;
} }
|
public class class_name {
public GroupedMap clear(String group) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
valueMap.clear();
}
} finally {
writeLock.unlock();
}
return this;
} }
|
public class class_name {
public GroupedMap clear(String group) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
valueMap.clear();
// depends on control dependency: [if], data = [none]
}
} finally {
writeLock.unlock();
}
return this;
} }
|
public class class_name {
protected String getHadoopClientHome() {
String h = env_.getProperty("HADOOP_HOME"); // standard Hadoop
if (h == null) {
//fail("Missing required environment variable: HADOOP_HOME");
h = "UNDEF";
}
return h;
} }
|
public class class_name {
protected String getHadoopClientHome() {
String h = env_.getProperty("HADOOP_HOME"); // standard Hadoop
if (h == null) {
//fail("Missing required environment variable: HADOOP_HOME");
h = "UNDEF"; // depends on control dependency: [if], data = [none]
}
return h;
} }
|
public class class_name {
private static long calculateDivisor(long power10, int numZeros) {
// We craft our divisor such that when we divide by it, we get a
// number with the same number of digits as zeros found in the
// plural variant templates. If our magnitude is 10000 and we have
// two 0's in our plural variants, then we want a divisor of 1000.
// Note that if we have 43560 which is of same magnitude as 10000.
// When we divide by 1000 we a quotient which rounds to 44 (2 digits)
long divisor = power10;
for (int i = 1; i < numZeros; i++) {
divisor /= 10;
}
return divisor;
} }
|
public class class_name {
private static long calculateDivisor(long power10, int numZeros) {
// We craft our divisor such that when we divide by it, we get a
// number with the same number of digits as zeros found in the
// plural variant templates. If our magnitude is 10000 and we have
// two 0's in our plural variants, then we want a divisor of 1000.
// Note that if we have 43560 which is of same magnitude as 10000.
// When we divide by 1000 we a quotient which rounds to 44 (2 digits)
long divisor = power10;
for (int i = 1; i < numZeros; i++) {
divisor /= 10; // depends on control dependency: [for], data = [none]
}
return divisor;
} }
|
public class class_name {
public void setLevel (Level level) {
this.defaultLevel = level;
logger.setLevel (level);
for (Handler handler : logger.getHandlers ()) {
handler.setLevel (level);
}
} }
|
public class class_name {
public void setLevel (Level level) {
this.defaultLevel = level;
logger.setLevel (level);
for (Handler handler : logger.getHandlers ()) {
handler.setLevel (level); // depends on control dependency: [for], data = [handler]
}
} }
|
public class class_name {
@Override
public List<SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
if (checkConformance(t, args)) {
@SuppressWarnings("unchecked")
List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
if (s == null) {
return Collections.emptyList();
}
return s.stream().map(Ready::new).collect(Collectors.toList());
}
return Collections.emptyList();
} }
|
public class class_name {
@Override
public List<SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
if (checkConformance(t, args)) {
@SuppressWarnings("unchecked")
List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
if (s == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return s.stream().map(Ready::new).collect(Collectors.toList()); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} }
|
public class class_name {
public static RandomVariableInterface blackScholesGeneralizedOptionValue(
RandomVariableInterface forward,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike,
RandomVariableInterface payoffUnit)
{
if(optionMaturity < 0) {
return forward.mult(0.0);
}
else
{
RandomVariableInterface dPlus = forward.div(optionStrike).log().add(volatility.squared().mult(0.5 * optionMaturity)).div(volatility).div(Math.sqrt(optionMaturity));
RandomVariableInterface dMinus = dPlus.sub(volatility.mult(Math.sqrt(optionMaturity)));
UnivariateFunction cumulativeNormal = new UnivariateFunction() {
public double value(double x) { return NormalDistribution.cumulativeDistribution(x); }
};
RandomVariableInterface valueAnalytic = dPlus.apply(cumulativeNormal).mult(forward).sub(dMinus.apply(cumulativeNormal).mult(optionStrike)).mult(payoffUnit);
return valueAnalytic;
}
} }
|
public class class_name {
public static RandomVariableInterface blackScholesGeneralizedOptionValue(
RandomVariableInterface forward,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike,
RandomVariableInterface payoffUnit)
{
if(optionMaturity < 0) {
return forward.mult(0.0); // depends on control dependency: [if], data = [0)]
}
else
{
RandomVariableInterface dPlus = forward.div(optionStrike).log().add(volatility.squared().mult(0.5 * optionMaturity)).div(volatility).div(Math.sqrt(optionMaturity));
RandomVariableInterface dMinus = dPlus.sub(volatility.mult(Math.sqrt(optionMaturity)));
UnivariateFunction cumulativeNormal = new UnivariateFunction() {
public double value(double x) { return NormalDistribution.cumulativeDistribution(x); }
};
RandomVariableInterface valueAnalytic = dPlus.apply(cumulativeNormal).mult(forward).sub(dMinus.apply(cumulativeNormal).mult(optionStrike)).mult(payoffUnit);
return valueAnalytic; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
void onGroupTabClicked(String id) {
TargetDivNavWidget navGroupWidget = (TargetDivNavWidget) super.getSubgroupNavWidget(id);
if (navGroupWidget != null) {
super.onItemClicked(navGroupWidget.getNavGroup());
view.showChildrenTabs(navGroupWidget);
navGroupWidget.gotoDefaultItem();
}
} }
|
public class class_name {
void onGroupTabClicked(String id) {
TargetDivNavWidget navGroupWidget = (TargetDivNavWidget) super.getSubgroupNavWidget(id);
if (navGroupWidget != null) {
super.onItemClicked(navGroupWidget.getNavGroup()); // depends on control dependency: [if], data = [(navGroupWidget]
view.showChildrenTabs(navGroupWidget); // depends on control dependency: [if], data = [(navGroupWidget]
navGroupWidget.gotoDefaultItem(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static ResourceField getInstance(int value)
{
ResourceField result = null;
if (value >= 0 && value < FIELD_ARRAY.length)
{
result = FIELD_ARRAY[value];
}
else
{
if ((value & 0x8000) != 0)
{
int baseValue = ResourceField.ENTERPRISE_CUSTOM_FIELD1.getValue();
int id = baseValue + (value & 0xFFF);
result = ResourceField.getInstance(id);
}
}
return (result);
} }
|
public class class_name {
public static ResourceField getInstance(int value)
{
ResourceField result = null;
if (value >= 0 && value < FIELD_ARRAY.length)
{
result = FIELD_ARRAY[value]; // depends on control dependency: [if], data = [none]
}
else
{
if ((value & 0x8000) != 0)
{
int baseValue = ResourceField.ENTERPRISE_CUSTOM_FIELD1.getValue();
int id = baseValue + (value & 0xFFF);
result = ResourceField.getInstance(id); // depends on control dependency: [if], data = [none]
}
}
return (result);
} }
|
public class class_name {
final long getDerivedJmsExpiration() {
long ts = getTimestamp().longValue();
long ttl = getTimeToLive().longValue();
if ((ts <= 0) || (ttl <= 0)) {
return 0;
}
else {
return (ts + ttl);
}
} }
|
public class class_name {
final long getDerivedJmsExpiration() {
long ts = getTimestamp().longValue();
long ttl = getTimeToLive().longValue();
if ((ts <= 0) || (ttl <= 0)) {
return 0; // depends on control dependency: [if], data = [none]
}
else {
return (ts + ttl); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Optional<? extends Number> toNumber(Object arg) {
if ( arg instanceof Number ) {
return Optional.of( ( (Number) arg ));
}
else if(arg instanceof String) {
try {
return Optional.of( (Number) Integer.parseInt( (String) arg ) );
}
catch(Exception ignored) {}
try {
return Optional.of( (Number) Long.parseLong( (String) arg ) );
}
catch(Exception ignored) {}
try {
return Optional.of( (Number) Double.parseDouble( (String) arg ) );
}
catch(Exception ignored) {}
return Optional.empty();
}
else {
return Optional.empty();
}
} }
|
public class class_name {
public static Optional<? extends Number> toNumber(Object arg) {
if ( arg instanceof Number ) {
return Optional.of( ( (Number) arg )); // depends on control dependency: [if], data = [none]
}
else if(arg instanceof String) {
try {
return Optional.of( (Number) Integer.parseInt( (String) arg ) ); // depends on control dependency: [try], data = [none]
}
catch(Exception ignored) {} // depends on control dependency: [catch], data = [none]
try {
return Optional.of( (Number) Long.parseLong( (String) arg ) ); // depends on control dependency: [try], data = [none]
}
catch(Exception ignored) {} // depends on control dependency: [catch], data = [none]
try {
return Optional.of( (Number) Double.parseDouble( (String) arg ) ); // depends on control dependency: [try], data = [none]
}
catch(Exception ignored) {} // depends on control dependency: [catch], data = [none]
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
else {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ManagementGroupVertex getOutputGroupVertex(final int stage, final int index) {
if (stage >= this.stages.size()) {
return null;
}
return this.stages.get(stage).getOutputGroupVertex(index);
} }
|
public class class_name {
public ManagementGroupVertex getOutputGroupVertex(final int stage, final int index) {
if (stage >= this.stages.size()) {
return null; // depends on control dependency: [if], data = [none]
}
return this.stages.get(stage).getOutputGroupVertex(index);
} }
|
public class class_name {
static Map<String, Set<LineageEventBuilder>> load(State state) {
String name = state.getProp(getKey(NAME_KEY));
Descriptor source = Descriptor.fromJson(state.getProp(getKey(LineageEventBuilder.SOURCE)));
String branchedPrefix = getKey(BRANCH, "");
Map<String, Set<LineageEventBuilder>> events = Maps.newHashMap();
if (source == null) {
return events;
}
for (Map.Entry<Object, Object> entry : state.getProperties().entrySet()) {
String key = entry.getKey().toString();
if (!key.startsWith(branchedPrefix)) {
continue;
}
String[] parts = key.substring(branchedPrefix.length()).split("\\.");
assert parts.length == 2;
String branchId = parts[0];
Set<LineageEventBuilder> branchEvents = events.computeIfAbsent(branchId, k -> new HashSet<>());
switch (parts[1]) {
case LineageEventBuilder.DESTINATION:
List<Descriptor> descriptors = Descriptor.fromJsonList(entry.getValue().toString());
for (Descriptor descriptor : descriptors) {
LineageEventBuilder event = new LineageEventBuilder(name);
event.setSource(source);
event.setDestination(descriptor);
branchEvents.add(event);
}
break;
default:
throw new RuntimeException("Unsupported lineage key: " + key);
}
}
return events;
} }
|
public class class_name {
static Map<String, Set<LineageEventBuilder>> load(State state) {
String name = state.getProp(getKey(NAME_KEY));
Descriptor source = Descriptor.fromJson(state.getProp(getKey(LineageEventBuilder.SOURCE)));
String branchedPrefix = getKey(BRANCH, "");
Map<String, Set<LineageEventBuilder>> events = Maps.newHashMap();
if (source == null) {
return events; // depends on control dependency: [if], data = [none]
}
for (Map.Entry<Object, Object> entry : state.getProperties().entrySet()) {
String key = entry.getKey().toString();
if (!key.startsWith(branchedPrefix)) {
continue;
}
String[] parts = key.substring(branchedPrefix.length()).split("\\.");
assert parts.length == 2;
String branchId = parts[0];
Set<LineageEventBuilder> branchEvents = events.computeIfAbsent(branchId, k -> new HashSet<>());
switch (parts[1]) {
case LineageEventBuilder.DESTINATION:
List<Descriptor> descriptors = Descriptor.fromJsonList(entry.getValue().toString());
for (Descriptor descriptor : descriptors) {
LineageEventBuilder event = new LineageEventBuilder(name);
event.setSource(source); // depends on control dependency: [for], data = [none]
event.setDestination(descriptor); // depends on control dependency: [for], data = [descriptor]
branchEvents.add(event); // depends on control dependency: [for], data = [none]
}
break;
default:
throw new RuntimeException("Unsupported lineage key: " + key);
}
}
return events;
} }
|
public class class_name {
static char[][] convert(FigletFont figletFont, String message){
char[][] result = new char[figletFont.height][];
for (int c = 0; c < message.length(); c++){
result = Smushing.addChar(figletFont, result, figletFont.getChar(message.charAt(c)));
}
return result;
} }
|
public class class_name {
static char[][] convert(FigletFont figletFont, String message){
char[][] result = new char[figletFont.height][];
for (int c = 0; c < message.length(); c++){
result = Smushing.addChar(figletFont, result, figletFont.getChar(message.charAt(c))); // depends on control dependency: [for], data = [c]
}
return result;
} }
|
public class class_name {
public void transmit( Command c, Map h, String b ) {
try {
Transmitter.transmit( c, h, b, _output );
} catch (Exception e) {
receive( Command.ERROR, null, e.getMessage() );
}
} }
|
public class class_name {
public void transmit( Command c, Map h, String b ) {
try {
Transmitter.transmit( c, h, b, _output ); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
receive( Command.ERROR, null, e.getMessage() );
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public SQLQuery getQueryInstance(String nativeQuery, EntityMetadata m)
{
s = getStatelessSession();
SQLQuery q = s.createSQLQuery(nativeQuery).addEntity(m.getEntityClazz());
List<String> relations = m.getRelationNames();
if (relations != null)
{
for (String r : relations)
{
Relation rel = m.getRelation(m.getFieldName(r));
String name = MetadataUtils.getMappedName(m, m.getRelation(r), kunderaMetadata);
if (!((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equalsIgnoreCase(
name != null ? name : r)
&& rel != null
&& !rel.getProperty().isAnnotationPresent(ManyToMany.class)
&& !rel.getProperty().isAnnotationPresent(OneToMany.class)
&& (rel.getProperty().isAnnotationPresent(OneToOne.class)
&& StringUtils.isBlank(rel.getMappedBy()) || rel.getProperty().isAnnotationPresent(
ManyToOne.class)))
{
q.addScalar(name != null ? name : r);
}
}
}
return q;
} }
|
public class class_name {
public SQLQuery getQueryInstance(String nativeQuery, EntityMetadata m)
{
s = getStatelessSession();
SQLQuery q = s.createSQLQuery(nativeQuery).addEntity(m.getEntityClazz());
List<String> relations = m.getRelationNames();
if (relations != null)
{
for (String r : relations)
{
Relation rel = m.getRelation(m.getFieldName(r));
String name = MetadataUtils.getMappedName(m, m.getRelation(r), kunderaMetadata);
if (!((AbstractAttribute) m.getIdAttribute()).getJPAColumnName().equalsIgnoreCase(
name != null ? name : r)
&& rel != null
&& !rel.getProperty().isAnnotationPresent(ManyToMany.class)
&& !rel.getProperty().isAnnotationPresent(OneToMany.class)
&& (rel.getProperty().isAnnotationPresent(OneToOne.class)
&& StringUtils.isBlank(rel.getMappedBy()) || rel.getProperty().isAnnotationPresent(
ManyToOne.class)))
{
q.addScalar(name != null ? name : r); // depends on control dependency: [if], data = [none]
}
}
}
return q;
} }
|
public class class_name {
static public String removeLeadingNewLines(String string) {
if (string == null) return string;
int pos = 0;
int len = string.length();
boolean done = false;
while (!done) {
char c = string.charAt(pos);
if (c == '\n' || c == '\r') {
pos++;
} else {
done = true;
}
if (pos == len) {
done = true;
}
}
String result = string.substring(pos);
logger.debug("removed " + pos + " new line characters");
return result;
} }
|
public class class_name {
static public String removeLeadingNewLines(String string) {
if (string == null) return string;
int pos = 0;
int len = string.length();
boolean done = false;
while (!done) {
char c = string.charAt(pos);
if (c == '\n' || c == '\r') {
pos++; // depends on control dependency: [if], data = [none]
} else {
done = true; // depends on control dependency: [if], data = [none]
}
if (pos == len) {
done = true; // depends on control dependency: [if], data = [none]
}
}
String result = string.substring(pos);
logger.debug("removed " + pos + " new line characters");
return result;
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String text) {
boolean invalid = text.contains(File.separator) || text.contains(File.pathSeparator);
if (!invalid && Utilities.isWindows()) {
invalid = text.contains(":");
}
final String result = invalid
? ValidationBundle.getMessage(IllegalCharactersInFileNameValidator.class, "ERR_INVALID_FILE_NAME", compName, text)
: null; // NOI18N
if (result != null) {
problems.add(result);
}
return !invalid;
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String text) {
boolean invalid = text.contains(File.separator) || text.contains(File.pathSeparator);
if (!invalid && Utilities.isWindows()) {
invalid = text.contains(":"); // depends on control dependency: [if], data = [none]
}
final String result = invalid
? ValidationBundle.getMessage(IllegalCharactersInFileNameValidator.class, "ERR_INVALID_FILE_NAME", compName, text)
: null; // NOI18N
if (result != null) {
problems.add(result); // depends on control dependency: [if], data = [(result]
}
return !invalid;
} }
|
public class class_name {
public static base_responses add(nitro_service client, dnsaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction addresources[] = new dnsaction[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsaction();
addresources[i].actionname = resources[i].actionname;
addresources[i].actiontype = resources[i].actiontype;
addresources[i].ipaddress = resources[i].ipaddress;
addresources[i].ttl = resources[i].ttl;
addresources[i].viewname = resources[i].viewname;
addresources[i].preferredloclist = resources[i].preferredloclist;
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
public static base_responses add(nitro_service client, dnsaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction addresources[] = new dnsaction[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsaction(); // depends on control dependency: [for], data = [i]
addresources[i].actionname = resources[i].actionname; // depends on control dependency: [for], data = [i]
addresources[i].actiontype = resources[i].actiontype; // depends on control dependency: [for], data = [i]
addresources[i].ipaddress = resources[i].ipaddress; // depends on control dependency: [for], data = [i]
addresources[i].ttl = resources[i].ttl; // depends on control dependency: [for], data = [i]
addresources[i].viewname = resources[i].viewname; // depends on control dependency: [for], data = [i]
addresources[i].preferredloclist = resources[i].preferredloclist; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
public ListClustersRequest withClusterStates(ClusterState... clusterStates) {
com.amazonaws.internal.SdkInternalList<String> clusterStatesCopy = new com.amazonaws.internal.SdkInternalList<String>(clusterStates.length);
for (ClusterState value : clusterStates) {
clusterStatesCopy.add(value.toString());
}
if (getClusterStates() == null) {
setClusterStates(clusterStatesCopy);
} else {
getClusterStates().addAll(clusterStatesCopy);
}
return this;
} }
|
public class class_name {
public ListClustersRequest withClusterStates(ClusterState... clusterStates) {
com.amazonaws.internal.SdkInternalList<String> clusterStatesCopy = new com.amazonaws.internal.SdkInternalList<String>(clusterStates.length);
for (ClusterState value : clusterStates) {
clusterStatesCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getClusterStates() == null) {
setClusterStates(clusterStatesCopy); // depends on control dependency: [if], data = [none]
} else {
getClusterStates().addAll(clusterStatesCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
private void onSetGcGrace(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String gcGraceSeconds = cfProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS);
if (gcGraceSeconds != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS);
}
else
{
cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds));
}
}
catch (NumberFormatException nfe)
{
log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
}
}
} }
|
public class class_name {
private void onSetGcGrace(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String gcGraceSeconds = cfProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS);
if (gcGraceSeconds != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS); // depends on control dependency: [if], data = [(builder]
}
else
{
cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds)); // depends on control dependency: [if], data = [none]
}
}
catch (NumberFormatException nfe)
{
log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) {
List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses);
List<CtClass> newClassesFiltered = applyFilter(options, newClasses);
ClassesComparator classesComparator = new ClassesComparator(this, options);
classesComparator.compare(oldClassesFiltered, newClassesFiltered);
List<JApiClass> classList = classesComparator.getClasses();
if (LOGGER.isLoggable(Level.FINE)) {
for (JApiClass jApiClass : classList) {
LOGGER.fine(jApiClass.toString());
}
}
checkBinaryCompatibility(classList);
checkJavaObjectSerializationCompatibility(classList);
OutputFilter.sortClassesAndMethods(classList);
return classList;
} }
|
public class class_name {
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) {
List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses);
List<CtClass> newClassesFiltered = applyFilter(options, newClasses);
ClassesComparator classesComparator = new ClassesComparator(this, options);
classesComparator.compare(oldClassesFiltered, newClassesFiltered);
List<JApiClass> classList = classesComparator.getClasses();
if (LOGGER.isLoggable(Level.FINE)) {
for (JApiClass jApiClass : classList) {
LOGGER.fine(jApiClass.toString()); // depends on control dependency: [for], data = [jApiClass]
}
}
checkBinaryCompatibility(classList);
checkJavaObjectSerializationCompatibility(classList);
OutputFilter.sortClassesAndMethods(classList);
return classList;
} }
|
public class class_name {
@Override
@Path("/{gitPath}")
public JSONObject post(String path, JSONObject content, Map<String,String> headers)
throws ServiceException, JSONException {
String subpath = getSub(path);
if (subpath == null)
throw new ServiceException(HTTP_400_BAD_REQUEST, "Missing path segment: {path}");
Query query = getQuery(path, headers);
String action = query.getFilter("gitAction");
if (action == null)
throw new ServiceException(HTTP_400_BAD_REQUEST, "Missing parameter: gitAction");
try {
vcGit = getVersionControl();
String requestPath = URLDecoder.decode(subpath, "UTF-8");
assetPath = vcGit.getRelativePath(new File(getRequiredProperty(PropertyNames.MDW_ASSET_LOCATION)));
branch = getRequiredProperty(PropertyNames.MDW_GIT_BRANCH);
gitRoot = new File(getRequiredProperty(PropertyNames.MDW_GIT_LOCAL_PATH));
logger.info("Git VCS branch: " + branch);
int lastSlash = requestPath.lastIndexOf('/');
String pkgName = null;
String assetName = null;
if (lastSlash > 0) {
pkgName = requestPath.substring(0, lastSlash);
assetName = requestPath.substring(lastSlash + 1);
}
if ("pull".equals(action)) {
if (requestPath.equals("*")) {
// importing all assets
if (content.has("gitHard"))
hard = content.getBoolean("gitHard");
GitVcs importer = this;
thread = new Thread() {
@Override
public void run() {
this.setName("GitVcsAssetImporter-thread");
importer.importAssets();
}
};
thread.start();
}
else {
if (pkgName != null) {
String pullPath = assetPath + "/" + pkgName.replace('.', '/');
if (assetName != null) {
pullPath = pullPath + "/" + assetName;
// TODO: implement asset pull
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Asset pull not implemented: " + pullPath);
}
else {
// probably won't implement this
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Package pull not implemented: " + pullPath);
}
}
else {
throw new ServiceException(ServiceException.BAD_REQUEST, "Bad path: " + path);
}
}
}
else if ("push".equals(action)) {
if (pkgName != null) {
String pkgPath = assetPath + "/" + pkgName.replace('.', '/');
if (assetName != null) {
if (!content.has("comment"))
throw new ServiceException(ServiceException.BAD_REQUEST, "Missing comment");
String comment = content.getString("comment");
if (content.has("user")) {
vcGit.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
content.getString("user"), content.getString("password")));
}
vcGit.pull(branch);
List<String> commitPaths = new ArrayList<>();
commitPaths.add(pkgPath + "/" + assetName);
if (query.getBooleanFilter("includeMeta")) {
String metaPath = pkgPath + "/.mdw";
commitPaths.add(metaPath + "/versions");
commitPaths.add(metaPath + "/package.yaml");
}
vcGit.add(commitPaths);
vcGit.commit(commitPaths, comment);
vcGit.push();
// Update ASSET_REF with new commit (will trigger automatic import in other instances)
try (DbAccess dbAccess = new DbAccess()) {
Checkpoint cp = new Checkpoint(ApplicationContext.getAssetRoot(), vcGit, vcGit.getCommit(), dbAccess.getConnection());
cp.updateRefs();
}
}
else {
// probably won't implement this
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Package push not implemented: " + pkgPath);
}
}
else {
throw new ServiceException(ServiceException.BAD_REQUEST, "Bad path: " + path);
}
}
return null;
}
catch (ServiceException ex) {
throw ex;
}
catch (Exception ex) {
throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex);
}
} }
|
public class class_name {
@Override
@Path("/{gitPath}")
public JSONObject post(String path, JSONObject content, Map<String,String> headers)
throws ServiceException, JSONException {
String subpath = getSub(path);
if (subpath == null)
throw new ServiceException(HTTP_400_BAD_REQUEST, "Missing path segment: {path}");
Query query = getQuery(path, headers);
String action = query.getFilter("gitAction");
if (action == null)
throw new ServiceException(HTTP_400_BAD_REQUEST, "Missing parameter: gitAction");
try {
vcGit = getVersionControl();
String requestPath = URLDecoder.decode(subpath, "UTF-8");
assetPath = vcGit.getRelativePath(new File(getRequiredProperty(PropertyNames.MDW_ASSET_LOCATION)));
branch = getRequiredProperty(PropertyNames.MDW_GIT_BRANCH);
gitRoot = new File(getRequiredProperty(PropertyNames.MDW_GIT_LOCAL_PATH));
logger.info("Git VCS branch: " + branch);
int lastSlash = requestPath.lastIndexOf('/');
String pkgName = null;
String assetName = null;
if (lastSlash > 0) {
pkgName = requestPath.substring(0, lastSlash); // depends on control dependency: [if], data = [none]
assetName = requestPath.substring(lastSlash + 1); // depends on control dependency: [if], data = [(lastSlash]
}
if ("pull".equals(action)) {
if (requestPath.equals("*")) {
// importing all assets
if (content.has("gitHard"))
hard = content.getBoolean("gitHard");
GitVcs importer = this;
thread = new Thread() {
@Override
public void run() {
this.setName("GitVcsAssetImporter-thread");
importer.importAssets();
}
}; // depends on control dependency: [if], data = [none]
thread.start(); // depends on control dependency: [if], data = [none]
}
else {
if (pkgName != null) {
String pullPath = assetPath + "/" + pkgName.replace('.', '/');
if (assetName != null) {
pullPath = pullPath + "/" + assetName; // depends on control dependency: [if], data = [none]
// TODO: implement asset pull
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Asset pull not implemented: " + pullPath);
}
else {
// probably won't implement this
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Package pull not implemented: " + pullPath);
}
}
else {
throw new ServiceException(ServiceException.BAD_REQUEST, "Bad path: " + path);
}
}
}
else if ("push".equals(action)) {
if (pkgName != null) {
String pkgPath = assetPath + "/" + pkgName.replace('.', '/');
if (assetName != null) {
if (!content.has("comment"))
throw new ServiceException(ServiceException.BAD_REQUEST, "Missing comment");
String comment = content.getString("comment");
if (content.has("user")) {
vcGit.setCredentialsProvider(new UsernamePasswordCredentialsProvider(
content.getString("user"), content.getString("password"))); // depends on control dependency: [if], data = [none]
}
vcGit.pull(branch); // depends on control dependency: [if], data = [none]
List<String> commitPaths = new ArrayList<>();
commitPaths.add(pkgPath + "/" + assetName); // depends on control dependency: [if], data = [none]
if (query.getBooleanFilter("includeMeta")) {
String metaPath = pkgPath + "/.mdw";
commitPaths.add(metaPath + "/versions"); // depends on control dependency: [if], data = [none]
commitPaths.add(metaPath + "/package.yaml"); // depends on control dependency: [if], data = [none]
}
vcGit.add(commitPaths); // depends on control dependency: [if], data = [none]
vcGit.commit(commitPaths, comment); // depends on control dependency: [if], data = [none]
vcGit.push(); // depends on control dependency: [if], data = [none]
// Update ASSET_REF with new commit (will trigger automatic import in other instances)
try (DbAccess dbAccess = new DbAccess()) {
Checkpoint cp = new Checkpoint(ApplicationContext.getAssetRoot(), vcGit, vcGit.getCommit(), dbAccess.getConnection());
cp.updateRefs(); // depends on control dependency: [if], data = [none]
}
}
else {
// probably won't implement this
throw new ServiceException(ServiceException.NOT_IMPLEMENTED, "Package push not implemented: " + pkgPath);
}
}
else {
throw new ServiceException(ServiceException.BAD_REQUEST, "Bad path: " + path);
}
}
return null;
}
catch (ServiceException ex) {
throw ex;
}
catch (Exception ex) {
throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex);
}
} }
|
public class class_name {
private static Map<String, Object> getActivity(Replication replicator) {
// For schema, see http://wiki.apache.org/couchdb/HttpGetActiveTasks
Map<String, Object> activity = new HashMap<String, Object>();
String source = replicator.getRemoteUrl().toExternalForm();
String target = replicator.getLocalDatabase().getName();
if (!replicator.isPull()) {
String tmp = source;
source = target;
target = tmp;
}
int processed = replicator.getCompletedChangesCount();
int total = replicator.getChangesCount();
String status = String.format(Locale.ENGLISH, "Processed %d / %d changes", processed, total);
if (!replicator.getStatus().equals(ReplicationStatus.REPLICATION_ACTIVE)) {
//These values match the values for IOS.
if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_IDLE)) {
status = "Idle"; // nonstandard
} else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_STOPPED)) {
status = "Stopped";
} else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_OFFLINE)) {
status = "Offline"; // nonstandard
}
}
int progress = (total > 0) ? (int) 100 * processed / total : 0;
activity.put("type", "Replication");
activity.put("task", replicator.getSessionID());
activity.put("source", source);
activity.put("target", target);
activity.put("status", status);
activity.put("progress", progress);
activity.put("continuous", replicator.isContinuous());
//NOTE: Need to support "x_active_requests"
if (replicator.getLastError() != null) {
String msg = String.format(Locale.ENGLISH, "Replicator error: %s. Repl: %s. Source: %s, Target: %s",
replicator.getLastError(), replicator, source, target);
Log.w(TAG, msg);
Throwable error = replicator.getLastError();
int statusCode = 400;
if (error instanceof RemoteRequestResponseException) {
statusCode = ((RemoteRequestResponseException) error).getCode();
}
Object[] errorObjects = new Object[]{statusCode, replicator.getLastError().toString()};
activity.put("error", errorObjects);
} else {
// NOTE: Following two parameters: CBL iOS does not support. We might remove them in the future.
activity.put("change_count", total);
activity.put("completed_change_count", processed);
}
return activity;
} }
|
public class class_name {
private static Map<String, Object> getActivity(Replication replicator) {
// For schema, see http://wiki.apache.org/couchdb/HttpGetActiveTasks
Map<String, Object> activity = new HashMap<String, Object>();
String source = replicator.getRemoteUrl().toExternalForm();
String target = replicator.getLocalDatabase().getName();
if (!replicator.isPull()) {
String tmp = source;
source = target; // depends on control dependency: [if], data = [none]
target = tmp; // depends on control dependency: [if], data = [none]
}
int processed = replicator.getCompletedChangesCount();
int total = replicator.getChangesCount();
String status = String.format(Locale.ENGLISH, "Processed %d / %d changes", processed, total);
if (!replicator.getStatus().equals(ReplicationStatus.REPLICATION_ACTIVE)) {
//These values match the values for IOS.
if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_IDLE)) {
status = "Idle"; // nonstandard // depends on control dependency: [if], data = [none]
} else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_STOPPED)) {
status = "Stopped"; // depends on control dependency: [if], data = [none]
} else if (replicator.getStatus().equals(ReplicationStatus.REPLICATION_OFFLINE)) {
status = "Offline"; // nonstandard // depends on control dependency: [if], data = [none]
}
}
int progress = (total > 0) ? (int) 100 * processed / total : 0;
activity.put("type", "Replication");
activity.put("task", replicator.getSessionID());
activity.put("source", source);
activity.put("target", target);
activity.put("status", status);
activity.put("progress", progress);
activity.put("continuous", replicator.isContinuous());
//NOTE: Need to support "x_active_requests"
if (replicator.getLastError() != null) {
String msg = String.format(Locale.ENGLISH, "Replicator error: %s. Repl: %s. Source: %s, Target: %s",
replicator.getLastError(), replicator, source, target);
Log.w(TAG, msg); // depends on control dependency: [if], data = [none]
Throwable error = replicator.getLastError();
int statusCode = 400;
if (error instanceof RemoteRequestResponseException) {
statusCode = ((RemoteRequestResponseException) error).getCode(); // depends on control dependency: [if], data = [none]
}
Object[] errorObjects = new Object[]{statusCode, replicator.getLastError().toString()};
activity.put("error", errorObjects); // depends on control dependency: [if], data = [none]
} else {
// NOTE: Following two parameters: CBL iOS does not support. We might remove them in the future.
activity.put("change_count", total); // depends on control dependency: [if], data = [none]
activity.put("completed_change_count", processed); // depends on control dependency: [if], data = [none]
}
return activity;
} }
|
public class class_name {
public T insertWithOverflow(T element) {
if (size < maxSize) {
add(element);
return null;
} else if (size > 0 && !lessThan(element, heap[1])) {
T ret = heap[1];
heap[1] = element;
updateTop();
return ret;
} else {
return element;
}
} }
|
public class class_name {
public T insertWithOverflow(T element) {
if (size < maxSize) {
add(element); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
} else if (size > 0 && !lessThan(element, heap[1])) {
T ret = heap[1];
heap[1] = element; // depends on control dependency: [if], data = [none]
updateTop(); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
} else {
return element; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void getSingleUrl(List<URL> urls, SourceCode cfml, Tag tag, URL url) {
char quote = 0;
boolean inside = false;
StringBuilder value = new StringBuilder();
while (!cfml.isAfterLast()) {
if (inside) {
if (quote != 0 && cfml.forwardIfCurrent(quote)) {
inside = false;
add(urls, url, value.toString());
}
else if (quote == 0 && (cfml.isCurrent(' ') || cfml.isCurrent("/>") || cfml.isCurrent('>') || cfml.isCurrent('\t') || cfml.isCurrent('\n'))) {
inside = false;
try {
urls.add(new URL(url, value.toString()));
}
catch (MalformedURLException e) {}
cfml.next();
}
else {
value.append(cfml.getCurrent());
cfml.next();
}
}
else if (cfml.forwardIfCurrent('>')) {
break;
}
else {
for (int i = 0; i < tag.attributes.length; i++) {
if (cfml.forwardIfCurrent(tag.attributes[i])) {
cfml.removeSpace();
// =
if (cfml.isCurrent('=')) {
inside = true;
cfml.next();
cfml.removeSpace();
quote = cfml.getCurrent();
value = new StringBuilder();
if (quote != '"' && quote != '\'') quote = 0;
else {
cfml.next();
}
}
}
}
if (!inside) {
cfml.next();
}
}
}
} }
|
public class class_name {
private void getSingleUrl(List<URL> urls, SourceCode cfml, Tag tag, URL url) {
char quote = 0;
boolean inside = false;
StringBuilder value = new StringBuilder();
while (!cfml.isAfterLast()) {
if (inside) {
if (quote != 0 && cfml.forwardIfCurrent(quote)) {
inside = false; // depends on control dependency: [if], data = [none]
add(urls, url, value.toString()); // depends on control dependency: [if], data = [none]
}
else if (quote == 0 && (cfml.isCurrent(' ') || cfml.isCurrent("/>") || cfml.isCurrent('>') || cfml.isCurrent('\t') || cfml.isCurrent('\n'))) {
inside = false; // depends on control dependency: [if], data = [none]
try {
urls.add(new URL(url, value.toString())); // depends on control dependency: [try], data = [none]
}
catch (MalformedURLException e) {} // depends on control dependency: [catch], data = [none]
cfml.next(); // depends on control dependency: [if], data = [none]
}
else {
value.append(cfml.getCurrent()); // depends on control dependency: [if], data = [none]
cfml.next(); // depends on control dependency: [if], data = [none]
}
}
else if (cfml.forwardIfCurrent('>')) {
break;
}
else {
for (int i = 0; i < tag.attributes.length; i++) {
if (cfml.forwardIfCurrent(tag.attributes[i])) {
cfml.removeSpace(); // depends on control dependency: [if], data = [none]
// =
if (cfml.isCurrent('=')) {
inside = true; // depends on control dependency: [if], data = [none]
cfml.next(); // depends on control dependency: [if], data = [none]
cfml.removeSpace(); // depends on control dependency: [if], data = [none]
quote = cfml.getCurrent(); // depends on control dependency: [if], data = [none]
value = new StringBuilder(); // depends on control dependency: [if], data = [none]
if (quote != '"' && quote != '\'') quote = 0;
else {
cfml.next(); // depends on control dependency: [if], data = [none]
}
}
}
}
if (!inside) {
cfml.next(); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(Method subMethod, Object subscriber) {
Preconditions.checkNotNull(subscriber);
Preconditions.checkNotNull(subMethod);
Subscribe annotation = subMethod.getAnnotation(Subscribe.class);
if (null == annotation) {
throw new IllegalArgumentException(String.format("Subscriber method %s does not contain a subscriber annotation.", subMethod.toGenericString()));
}
SubscriberConfigProvider.SubscriberConfig config = null;
if (SubscriberConfigProvider.class.isAssignableFrom(subscriber.getClass())) {
config = ((SubscriberConfigProvider) subscriber).getConfigForName(annotation.name());
}
if (null == config) {
config = new AnnotationBasedSubscriberConfig(annotation);
}
return config;
} }
|
public class class_name {
public static SubscriberConfigProvider.SubscriberConfig getSubscriberConfig(Method subMethod, Object subscriber) {
Preconditions.checkNotNull(subscriber);
Preconditions.checkNotNull(subMethod);
Subscribe annotation = subMethod.getAnnotation(Subscribe.class);
if (null == annotation) {
throw new IllegalArgumentException(String.format("Subscriber method %s does not contain a subscriber annotation.", subMethod.toGenericString()));
}
SubscriberConfigProvider.SubscriberConfig config = null;
if (SubscriberConfigProvider.class.isAssignableFrom(subscriber.getClass())) {
config = ((SubscriberConfigProvider) subscriber).getConfigForName(annotation.name()); // depends on control dependency: [if], data = [none]
}
if (null == config) {
config = new AnnotationBasedSubscriberConfig(annotation); // depends on control dependency: [if], data = [none]
}
return config;
} }
|
public class class_name {
public static URL locateClass(String binaryName, ClassLoader classLoader) {
try {
Class<?> type = loadClass(binaryName, false, classLoader);
return type.getClassLoader().getResource(getResourceName(type));
}
catch (TypeNotFoundException ignore) {
return null;
}
} }
|
public class class_name {
public static URL locateClass(String binaryName, ClassLoader classLoader) {
try {
Class<?> type = loadClass(binaryName, false, classLoader);
return type.getClassLoader().getResource(getResourceName(type)); // depends on control dependency: [try], data = [none]
}
catch (TypeNotFoundException ignore) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void registerWorkManager(WorkManager wm)
{
if (wm != null)
{
if (wm.getName() == null || wm.getName().trim().equals(""))
throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm);
if (trace)
log.tracef("Registering WorkManager: %s", wm);
if (!workmanagers.keySet().contains(wm.getName()))
{
workmanagers.put(wm.getName(), wm);
// Replay events for distributed work managers
if (wm instanceof DistributedWorkManager)
{
WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance();
List<WorkManagerEvent> events = wmeq.getEvents(wm.getName());
if (!events.isEmpty())
{
if (trace)
log.tracef("%s: Events=%s", wm.getName(), events);
for (WorkManagerEvent event : events)
{
if (event.getType() == WorkManagerEvent.TYPE_JOIN)
{
DistributedWorkManager dwm = resolveDistributedWorkManager(event.getAddress());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.join(event.getAddress());
}
}
}
else if (event.getType() == WorkManagerEvent.TYPE_LEAVE)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.leave(event.getAddress());
}
}
removeWorkManager(event.getAddress().getWorkManagerId());
}
else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_SHORT_RUNNING)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.updateShortRunningFree(event.getAddress(), event.getValue());
}
}
}
else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.updateLongRunningFree(event.getAddress(), event.getValue());
}
}
}
}
}
}
}
}
} }
|
public class class_name {
public void registerWorkManager(WorkManager wm)
{
if (wm != null)
{
if (wm.getName() == null || wm.getName().trim().equals(""))
throw new IllegalArgumentException("The name of WorkManager is invalid: " + wm);
if (trace)
log.tracef("Registering WorkManager: %s", wm);
if (!workmanagers.keySet().contains(wm.getName()))
{
workmanagers.put(wm.getName(), wm); // depends on control dependency: [if], data = [none]
// Replay events for distributed work managers
if (wm instanceof DistributedWorkManager)
{
WorkManagerEventQueue wmeq = WorkManagerEventQueue.getInstance();
List<WorkManagerEvent> events = wmeq.getEvents(wm.getName());
if (!events.isEmpty())
{
if (trace)
log.tracef("%s: Events=%s", wm.getName(), events);
for (WorkManagerEvent event : events)
{
if (event.getType() == WorkManagerEvent.TYPE_JOIN)
{
DistributedWorkManager dwm = resolveDistributedWorkManager(event.getAddress());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.join(event.getAddress()); // depends on control dependency: [for], data = [nl]
}
}
}
else if (event.getType() == WorkManagerEvent.TYPE_LEAVE)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.leave(event.getAddress()); // depends on control dependency: [for], data = [nl]
}
}
removeWorkManager(event.getAddress().getWorkManagerId()); // depends on control dependency: [if], data = [none]
}
else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_SHORT_RUNNING)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.updateShortRunningFree(event.getAddress(), event.getValue()); // depends on control dependency: [for], data = [nl]
}
}
}
else if (event.getType() == WorkManagerEvent.TYPE_UPDATE_LONG_RUNNING)
{
DistributedWorkManager dwm =
(DistributedWorkManager)activeWorkmanagers.get(event.getAddress().getWorkManagerId());
if (dwm != null)
{
Collection<NotificationListener> copy =
new ArrayList<NotificationListener>(dwm.getNotificationListeners());
for (NotificationListener nl : copy)
{
nl.updateLongRunningFree(event.getAddress(), event.getValue()); // depends on control dependency: [for], data = [nl]
}
}
}
}
}
}
}
}
} }
|
public class class_name {
public CocoTask<T> progress(final Dialog progress) {
if (progress != null) {
this.progress = new WeakReference<Object>(progress);
}
return this;
} }
|
public class class_name {
public CocoTask<T> progress(final Dialog progress) {
if (progress != null) {
this.progress = new WeakReference<Object>(progress); // depends on control dependency: [if], data = [(progress]
}
return this;
} }
|
public class class_name {
private void findMatches(Match match, int n) throws IOException {
if (n > 0) {
int largestMatchingEndPosition = match.endPosition();
Set<Integer> list = ignoreItem.getFullEndPositionList(spans.docID(),
match.endPosition());
// try to find matches with existing queue
if (!queueSpans.isEmpty()) {
Match span;
for (int i = 0; i < queueSpans.size(); i++) {
span = queueSpans.get(i);
if (match.endPosition() == span.startPosition()
|| (list != null && list.contains(span.startPosition()))) {
findMatches(new Match(match.startPosition(), span.endPosition()),
(n - 1));
largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
span.endPosition());
}
}
}
// extend queue if necessary and possible
while (!lastSpan && (largestMatchingEndPosition >= lastStartPosition)) {
if (spans.nextStartPosition() == NO_MORE_POSITIONS) {
lastSpan = true;
} else {
Match span = new Match(spans.startPosition(), spans.endPosition());
queueSpans.add(span);
lastStartPosition = spans.startPosition();
// check if this provides new match
if (match.endPosition() == span.startPosition()
|| (list != null && list.contains(span.startPosition()))) {
findMatches(new Match(match.startPosition(), span.endPosition()),
(n - 1));
largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
span.endPosition());
}
}
}
} else {
// only unique spans
if (!queueMatches.contains(match)) {
queueMatches.add(match);
}
}
} }
|
public class class_name {
private void findMatches(Match match, int n) throws IOException {
if (n > 0) {
int largestMatchingEndPosition = match.endPosition();
Set<Integer> list = ignoreItem.getFullEndPositionList(spans.docID(),
match.endPosition());
// try to find matches with existing queue
if (!queueSpans.isEmpty()) {
Match span;
for (int i = 0; i < queueSpans.size(); i++) {
span = queueSpans.get(i); // depends on control dependency: [for], data = [i]
if (match.endPosition() == span.startPosition()
|| (list != null && list.contains(span.startPosition()))) {
findMatches(new Match(match.startPosition(), span.endPosition()),
(n - 1)); // depends on control dependency: [if], data = [none]
largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
span.endPosition()); // depends on control dependency: [if], data = [none]
}
}
}
// extend queue if necessary and possible
while (!lastSpan && (largestMatchingEndPosition >= lastStartPosition)) {
if (spans.nextStartPosition() == NO_MORE_POSITIONS) {
lastSpan = true; // depends on control dependency: [if], data = [none]
} else {
Match span = new Match(spans.startPosition(), spans.endPosition());
queueSpans.add(span); // depends on control dependency: [if], data = [none]
lastStartPosition = spans.startPosition(); // depends on control dependency: [if], data = [none]
// check if this provides new match
if (match.endPosition() == span.startPosition()
|| (list != null && list.contains(span.startPosition()))) {
findMatches(new Match(match.startPosition(), span.endPosition()),
(n - 1)); // depends on control dependency: [if], data = [none]
largestMatchingEndPosition = Math.max(largestMatchingEndPosition,
span.endPosition()); // depends on control dependency: [if], data = [none]
}
}
}
} else {
// only unique spans
if (!queueMatches.contains(match)) {
queueMatches.add(match); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static String toIndexedQuery(final PartTree tree) {
final StringBuilder result = new StringBuilder();
final Iterator<OrPart> orIt = tree.iterator();
while(orIt.hasNext()) {
final OrPart orPart = orIt.next();
final Iterator<Part> partIt = orPart.iterator();
while(partIt.hasNext()) {
final Part part = partIt.next();
result.append(" " + part.getProperty().getSegment() + " ");
result.append(convertOperator(part.getType()));
if(partIt.hasNext()) {
result.append(" AND ");
}
}
if(orIt.hasNext()) {
result.append(" OR ");
}
}
return StringUtil.removeExtraSpaces(result.toString());
} }
|
public class class_name {
public static String toIndexedQuery(final PartTree tree) {
final StringBuilder result = new StringBuilder();
final Iterator<OrPart> orIt = tree.iterator();
while(orIt.hasNext()) {
final OrPart orPart = orIt.next();
final Iterator<Part> partIt = orPart.iterator();
while(partIt.hasNext()) {
final Part part = partIt.next();
result.append(" " + part.getProperty().getSegment() + " "); // depends on control dependency: [while], data = [none]
result.append(convertOperator(part.getType())); // depends on control dependency: [while], data = [none]
if(partIt.hasNext()) {
result.append(" AND "); // depends on control dependency: [if], data = [none]
}
}
if(orIt.hasNext()) {
result.append(" OR "); // depends on control dependency: [if], data = [none]
}
}
return StringUtil.removeExtraSpaces(result.toString());
} }
|
public class class_name {
private boolean selectNode(SNode n)
{
String annoKey = null;
if (mappings.containsKey(MAPPING_NODE_KEY))
{
annoKey = mappings.getProperty(MAPPING_NODE_KEY);
}
/**
* Default behaviour, when mapping is not set correctly or is not set at
* all.
*/
if (annoKey == null)
{
if (n instanceof SToken)
{
return true;
}
else
{
return false;
}
}
// if mapping is set, we check, if the node carries the mapped annotation key
Set<SAnnotation> annos = n.getAnnotations();
for (SAnnotation a : annos)
{
if (annoKey.equals(a.getName()))
{
return true;
}
}
return false;
} }
|
public class class_name {
private boolean selectNode(SNode n)
{
String annoKey = null;
if (mappings.containsKey(MAPPING_NODE_KEY))
{
annoKey = mappings.getProperty(MAPPING_NODE_KEY); // depends on control dependency: [if], data = [none]
}
/**
* Default behaviour, when mapping is not set correctly or is not set at
* all.
*/
if (annoKey == null)
{
if (n instanceof SToken)
{
return true; // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
}
// if mapping is set, we check, if the node carries the mapped annotation key
Set<SAnnotation> annos = n.getAnnotations();
for (SAnnotation a : annos)
{
if (annoKey.equals(a.getName()))
{
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public void executeDemo(String text) {
try {
ActionUtils.getActionsByUserAndEntity(this, UserUtils.getCurrentUser(this).getId(), entity.getKey(), 0, PAGE_SIZE, new ActionListListener() {
@Override
public void onList(ListResult<SocializeAction> result) {
handleSocializeResult(result);
}
@Override
public void onError(SocializeException error) {
handleError(GetActionsByUserEntityActivity.this, error);
}
});
}
catch (SocializeException e) {
e.printStackTrace();
}
} }
|
public class class_name {
@Override
public void executeDemo(String text) {
try {
ActionUtils.getActionsByUserAndEntity(this, UserUtils.getCurrentUser(this).getId(), entity.getKey(), 0, PAGE_SIZE, new ActionListListener() {
@Override
public void onList(ListResult<SocializeAction> result) {
handleSocializeResult(result);
}
@Override
public void onError(SocializeException error) {
handleError(GetActionsByUserEntityActivity.this, error);
}
}); // depends on control dependency: [try], data = [none]
}
catch (SocializeException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void start() {
setState(STATE_RUNNING);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Start: " + this);
}
} }
|
public class class_name {
public void start() {
setState(STATE_RUNNING);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Start: " + this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Map<String, SortedSet<ModuleElement>> groupModules(Set<ModuleElement> modules) {
Map<String, SortedSet<ModuleElement>> groupModuleMap = new HashMap<>();
String defaultGroupName =
(elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
configuration.getResources().getText("doclet.Modules") :
configuration.getResources().getText("doclet.Other_Modules");
// if the user has not used the default group name, add it
if (!groupList.contains(defaultGroupName)) {
groupList.add(defaultGroupName);
}
for (ModuleElement mdl : modules) {
String moduleName = mdl.isUnnamed() ? null : mdl.getQualifiedName().toString();
String groupName = mdl.isUnnamed() ? null : elementNameGroupMap.get(moduleName);
// if this module is not explicitly assigned to a group,
// try matching it to group specified by regular expression
if (groupName == null) {
groupName = regExpGroupName(moduleName);
}
// if it is in neither group map, put it in the default
// group
if (groupName == null) {
groupName = defaultGroupName;
}
getModuleList(groupModuleMap, groupName).add(mdl);
}
return groupModuleMap;
} }
|
public class class_name {
public Map<String, SortedSet<ModuleElement>> groupModules(Set<ModuleElement> modules) {
Map<String, SortedSet<ModuleElement>> groupModuleMap = new HashMap<>();
String defaultGroupName =
(elementNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
configuration.getResources().getText("doclet.Modules") :
configuration.getResources().getText("doclet.Other_Modules");
// if the user has not used the default group name, add it
if (!groupList.contains(defaultGroupName)) {
groupList.add(defaultGroupName); // depends on control dependency: [if], data = [none]
}
for (ModuleElement mdl : modules) {
String moduleName = mdl.isUnnamed() ? null : mdl.getQualifiedName().toString();
String groupName = mdl.isUnnamed() ? null : elementNameGroupMap.get(moduleName);
// if this module is not explicitly assigned to a group,
// try matching it to group specified by regular expression
if (groupName == null) {
groupName = regExpGroupName(moduleName); // depends on control dependency: [if], data = [none]
}
// if it is in neither group map, put it in the default
// group
if (groupName == null) {
groupName = defaultGroupName; // depends on control dependency: [if], data = [none]
}
getModuleList(groupModuleMap, groupName).add(mdl); // depends on control dependency: [for], data = [mdl]
}
return groupModuleMap;
} }
|
public class class_name {
@Override
protected boolean beforeHandleRequest(final Request request) {
// Clear file upload ID (if set)
setFileUploadRequestId(null);
// Check if is targeted request (thumbnail request or file content request)
String targetParam = request.getParameter(Environment.TARGET_ID);
boolean targetted = (targetParam != null && targetParam.equals(getTargetId()));
if (targetted) {
doHandleTargetedRequest(request);
return false;
}
// Check if AJAX trigger
if (isCurrentAjaxTrigger()) {
// Upload file request (check for multi part and file id)
if (request.getParameter(FILE_UPLOAD_MULTI_PART_ID_KEY) != null && request.getFileItems(getId()) != null) {
doHandleUploadRequest(request);
return false;
}
// File in list selected by the user
if (request.getParameter(FILE_UPLOAD_ID_KEY) != null) {
doHandleFileAjaxActionRequest(request);
return false;
}
}
return true;
} }
|
public class class_name {
@Override
protected boolean beforeHandleRequest(final Request request) {
// Clear file upload ID (if set)
setFileUploadRequestId(null);
// Check if is targeted request (thumbnail request or file content request)
String targetParam = request.getParameter(Environment.TARGET_ID);
boolean targetted = (targetParam != null && targetParam.equals(getTargetId()));
if (targetted) {
doHandleTargetedRequest(request); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// Check if AJAX trigger
if (isCurrentAjaxTrigger()) {
// Upload file request (check for multi part and file id)
if (request.getParameter(FILE_UPLOAD_MULTI_PART_ID_KEY) != null && request.getFileItems(getId()) != null) {
doHandleUploadRequest(request); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// File in list selected by the user
if (request.getParameter(FILE_UPLOAD_ID_KEY) != null) {
doHandleFileAjaxActionRequest(request); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
@Override
public Hashtable<String, Object> getDataAsHashtable() {
Preconditions.checkArgument(resource != null, "File resource cannot be null");
logger.entering();
// Over-writing the resource because there is a possibility that a user
// can give a type
resource.setCls(Hashtable[].class);
Hashtable<String, Object> dataAsHashTable = null;
JsonReader reader = null;
try {
reader = new JsonReader(getReader(resource));
Object[][] dataObject = mapJsonData(reader, resource.getCls());
dataAsHashTable = new Hashtable<>();
for (Object[] currentData : dataObject) {
// Its pretty safe to cast to array and its also known that a 1D
// array is packed
Hashtable<?, ?> value = (Hashtable<?, ?>) currentData[0];
/*
* As per the json specification a Json Object is a unordered collection of name value pairs. To give
* out the json data as hash table , a key needs to be figured out. To keep things clear and easy the
* .json file must have all the objects with a key "id" whose value can be used as the key in the
* hashtable.Users can directly access the data from the hash table using the value.
*
* Note: The id is harcoded purposefully here because to enforce the contract between data providers to
* have common methods.
*/
dataAsHashTable.put((String) value.get("id"), currentData);
}
} catch (NullPointerException n) { // NOSONAR
throw new DataProviderException(
"Error while parsing Json Data as a Hash table. Root cause: Unable to find a key named id. Please refer Javadoc",
n);
} catch (Exception e) {
throw new DataProviderException("Error while parsing Json Data as a Hash table", e);
} finally {
IOUtils.closeQuietly(reader);
}
logger.exiting(dataAsHashTable);
return dataAsHashTable;
} }
|
public class class_name {
@Override
public Hashtable<String, Object> getDataAsHashtable() {
Preconditions.checkArgument(resource != null, "File resource cannot be null");
logger.entering();
// Over-writing the resource because there is a possibility that a user
// can give a type
resource.setCls(Hashtable[].class);
Hashtable<String, Object> dataAsHashTable = null;
JsonReader reader = null;
try {
reader = new JsonReader(getReader(resource)); // depends on control dependency: [try], data = [none]
Object[][] dataObject = mapJsonData(reader, resource.getCls());
dataAsHashTable = new Hashtable<>(); // depends on control dependency: [try], data = [none]
for (Object[] currentData : dataObject) {
// Its pretty safe to cast to array and its also known that a 1D
// array is packed
Hashtable<?, ?> value = (Hashtable<?, ?>) currentData[0]; // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [currentData]
/*
* As per the json specification a Json Object is a unordered collection of name value pairs. To give
* out the json data as hash table , a key needs to be figured out. To keep things clear and easy the
* .json file must have all the objects with a key "id" whose value can be used as the key in the
* hashtable.Users can directly access the data from the hash table using the value.
*
* Note: The id is harcoded purposefully here because to enforce the contract between data providers to
* have common methods.
*/
dataAsHashTable.put((String) value.get("id"), currentData); // depends on control dependency: [for], data = [currentData]
}
} catch (NullPointerException n) { // NOSONAR
throw new DataProviderException(
"Error while parsing Json Data as a Hash table. Root cause: Unable to find a key named id. Please refer Javadoc",
n);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new DataProviderException("Error while parsing Json Data as a Hash table", e);
} finally { // depends on control dependency: [catch], data = [none]
IOUtils.closeQuietly(reader);
}
logger.exiting(dataAsHashTable);
return dataAsHashTable;
} }
|
public class class_name {
private double validateY(double y) {
SliderArea sliderArea = zoomSlider.getSliderArea();
y -= zoomSlider.getVerticalMargin() + sliderArea.getVerticalMargin() + 5;
double startY = 0;
double endY = sliderArea.getHeight() - zoomSlider.getSliderUnit().getBounds().getHeight();
if (y > endY) {
y = endY;
} else if (y < startY) {
y = startY;
}
return y;
} }
|
public class class_name {
private double validateY(double y) {
SliderArea sliderArea = zoomSlider.getSliderArea();
y -= zoomSlider.getVerticalMargin() + sliderArea.getVerticalMargin() + 5;
double startY = 0;
double endY = sliderArea.getHeight() - zoomSlider.getSliderUnit().getBounds().getHeight();
if (y > endY) {
y = endY; // depends on control dependency: [if], data = [none]
} else if (y < startY) {
y = startY; // depends on control dependency: [if], data = [none]
}
return y;
} }
|
public class class_name {
public static Object createNewEntity(Class<?> entityClass) {
try {
return entityClass.newInstance();
} catch (Exception e) {
throw new DialectException(e);
}
} }
|
public class class_name {
public static Object createNewEntity(Class<?> entityClass) {
try {
return entityClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new DialectException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void visit(BioPAXElement domain, Object range, Model targetModel, PropertyEditor editor)
{
BioPAXElement targetDomain = targetModel.getByID(domain.getUri());
if (range instanceof BioPAXElement)
{
BioPAXElement bpe = (BioPAXElement) range;
BioPAXElement existing = targetModel.getByID(bpe.getUri());
//set the property value if the value is already present in the target
if (existing != null) {
editor.setValueToBean(existing, targetDomain);
}
}
else
{
editor.setValueToBean(range, targetDomain);
}
} }
|
public class class_name {
public void visit(BioPAXElement domain, Object range, Model targetModel, PropertyEditor editor)
{
BioPAXElement targetDomain = targetModel.getByID(domain.getUri());
if (range instanceof BioPAXElement)
{
BioPAXElement bpe = (BioPAXElement) range;
BioPAXElement existing = targetModel.getByID(bpe.getUri());
//set the property value if the value is already present in the target
if (existing != null) {
editor.setValueToBean(existing, targetDomain); // depends on control dependency: [if], data = [(existing]
}
}
else
{
editor.setValueToBean(range, targetDomain); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void checkConstantProperty(
@Nullable PropertyReference propRef, IdentifierBehaviour identifierBehaviour) {
if (propRef == null || identifierBehaviour.equals(IdentifierBehaviour.ES5_CLASS_NAMESPACE)) {
return;
}
if (!propRef.isMutation()) {
return;
}
ObjectType objectType = castToObject(dereference(propRef.getReceiverType()));
String propertyName = propRef.getName();
boolean isConstant = isPropertyDeclaredConstant(objectType, propertyName);
// Check whether constant properties are reassigned
if (isConstant) {
if (propRef.isDeletion()) {
compiler.report(
JSError.make(propRef.getSourceNode(), CONST_PROPERTY_DELETED, propertyName));
return;
}
// Can't check for constant properties on generic function types.
// TODO(johnlenz): I'm not 100% certain this is necessary, or if
// the type is being inspected incorrectly.
if (objectType == null
|| (objectType.isFunctionType()
&& !objectType.toMaybeFunctionType().isConstructor())) {
return;
}
ObjectType oType = objectType;
while (oType != null) {
if (initializedConstantProperties.containsEntry(oType, propertyName)
|| initializedConstantProperties.containsEntry(
getCanonicalInstance(oType), propertyName)) {
compiler.report(
JSError.make(propRef.getSourceNode(), CONST_PROPERTY_REASSIGNED_VALUE, propertyName));
break;
}
oType = oType.getImplicitPrototype();
}
initializedConstantProperties.put(objectType, propertyName);
// Add the prototype when we're looking at an instance object
if (objectType.isInstanceType()) {
ObjectType prototype = objectType.getImplicitPrototype();
if (prototype != null && prototype.hasProperty(propertyName)) {
initializedConstantProperties.put(prototype, propertyName);
}
}
}
} }
|
public class class_name {
private void checkConstantProperty(
@Nullable PropertyReference propRef, IdentifierBehaviour identifierBehaviour) {
if (propRef == null || identifierBehaviour.equals(IdentifierBehaviour.ES5_CLASS_NAMESPACE)) {
return; // depends on control dependency: [if], data = [none]
}
if (!propRef.isMutation()) {
return; // depends on control dependency: [if], data = [none]
}
ObjectType objectType = castToObject(dereference(propRef.getReceiverType()));
String propertyName = propRef.getName();
boolean isConstant = isPropertyDeclaredConstant(objectType, propertyName);
// Check whether constant properties are reassigned
if (isConstant) {
if (propRef.isDeletion()) {
compiler.report(
JSError.make(propRef.getSourceNode(), CONST_PROPERTY_DELETED, propertyName)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Can't check for constant properties on generic function types.
// TODO(johnlenz): I'm not 100% certain this is necessary, or if
// the type is being inspected incorrectly.
if (objectType == null
|| (objectType.isFunctionType()
&& !objectType.toMaybeFunctionType().isConstructor())) {
return; // depends on control dependency: [if], data = [none]
}
ObjectType oType = objectType;
while (oType != null) {
if (initializedConstantProperties.containsEntry(oType, propertyName)
|| initializedConstantProperties.containsEntry(
getCanonicalInstance(oType), propertyName)) {
compiler.report(
JSError.make(propRef.getSourceNode(), CONST_PROPERTY_REASSIGNED_VALUE, propertyName)); // depends on control dependency: [if], data = [none]
break;
}
oType = oType.getImplicitPrototype(); // depends on control dependency: [while], data = [none]
}
initializedConstantProperties.put(objectType, propertyName); // depends on control dependency: [if], data = [none]
// Add the prototype when we're looking at an instance object
if (objectType.isInstanceType()) {
ObjectType prototype = objectType.getImplicitPrototype();
if (prototype != null && prototype.hasProperty(propertyName)) {
initializedConstantProperties.put(prototype, propertyName); // depends on control dependency: [if], data = [(prototype]
}
}
}
} }
|
public class class_name {
private void eliminateCallTargetArgAt(Node ref, int argIndex) {
Node callArgNode = ReferenceMap.getArgumentForCallOrNewOrDotCall(ref, argIndex);
if (callArgNode != null) {
NodeUtil.deleteNode(callArgNode, compiler);
}
} }
|
public class class_name {
private void eliminateCallTargetArgAt(Node ref, int argIndex) {
Node callArgNode = ReferenceMap.getArgumentForCallOrNewOrDotCall(ref, argIndex);
if (callArgNode != null) {
NodeUtil.deleteNode(callArgNode, compiler); // depends on control dependency: [if], data = [(callArgNode]
}
} }
|
public class class_name {
public void remove(EventListener<T> eventListener) {
if (eventListener.subscriber()) {
logger.info("remove subscription to channel {} from {} ", name, eventListener);
listeners.remove(eventListener);
stats.recordLevel(eventBusName + "::" + name, listeners.size());
} else {
if (consumer == eventListener) {
logger.info("remove consumer to channel {} from {} ", name, eventListener);
consumer = new NoOpEventConsumer<>();
}
}
} }
|
public class class_name {
public void remove(EventListener<T> eventListener) {
if (eventListener.subscriber()) {
logger.info("remove subscription to channel {} from {} ", name, eventListener); // depends on control dependency: [if], data = [none]
listeners.remove(eventListener); // depends on control dependency: [if], data = [none]
stats.recordLevel(eventBusName + "::" + name, listeners.size()); // depends on control dependency: [if], data = [none]
} else {
if (consumer == eventListener) {
logger.info("remove consumer to channel {} from {} ", name, eventListener); // depends on control dependency: [if], data = [eventListener)]
consumer = new NoOpEventConsumer<>(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public Properties getConfiguration(Environment environment) {
Properties properties = new Properties();
for (ConfigurationSource source : sources) {
Properties sourceProperties = source.getConfiguration(environment);
properties.putAll(sourceProperties);
}
return properties;
} }
|
public class class_name {
@Override
public Properties getConfiguration(Environment environment) {
Properties properties = new Properties();
for (ConfigurationSource source : sources) {
Properties sourceProperties = source.getConfiguration(environment);
properties.putAll(sourceProperties); // depends on control dependency: [for], data = [source]
}
return properties;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> IntervalCollection<T> on(TimeLine<T> timeLine) {
if (timeLine.equals(PlainDate.axis())) {
return (IntervalCollection<T>) onDateAxis();
} else if (timeLine.equals(PlainTime.axis())) {
return (IntervalCollection<T>) onClockAxis();
} else if (timeLine.equals(PlainTimestamp.axis())) {
return (IntervalCollection<T>) onTimestampAxis();
} else if (timeLine.equals(Moment.axis())) {
return (IntervalCollection<T>) onMomentAxis();
}
return new GenericWindows<>(timeLine, Collections.emptyList());
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> IntervalCollection<T> on(TimeLine<T> timeLine) {
if (timeLine.equals(PlainDate.axis())) {
return (IntervalCollection<T>) onDateAxis(); // depends on control dependency: [if], data = [none]
} else if (timeLine.equals(PlainTime.axis())) {
return (IntervalCollection<T>) onClockAxis(); // depends on control dependency: [if], data = [none]
} else if (timeLine.equals(PlainTimestamp.axis())) {
return (IntervalCollection<T>) onTimestampAxis(); // depends on control dependency: [if], data = [none]
} else if (timeLine.equals(Moment.axis())) {
return (IntervalCollection<T>) onMomentAxis(); // depends on control dependency: [if], data = [none]
}
return new GenericWindows<>(timeLine, Collections.emptyList());
} }
|
public class class_name {
public long insert(T obj) {
ContentValues cv = th.getEditableValues(obj);
if (th.getId(obj) == 0) {
// the default, remove from ContentValues to allow autoincrement
cv.remove(th.getIdCol().toString());
}
long id = getWritableDb().insertOrThrow(th.getTableName(), null, cv);
th.setId(obj, id);
return id;
} }
|
public class class_name {
public long insert(T obj) {
ContentValues cv = th.getEditableValues(obj);
if (th.getId(obj) == 0) {
// the default, remove from ContentValues to allow autoincrement
cv.remove(th.getIdCol().toString()); // depends on control dependency: [if], data = [none]
}
long id = getWritableDb().insertOrThrow(th.getTableName(), null, cv);
th.setId(obj, id);
return id;
} }
|
public class class_name {
@SafeVarargs
private final void notifyOnFinished(@NonNull final KeyType key, @Nullable final DataType data,
@NonNull final ViewType view,
@NonNull final ParamType... params) {
for (Listener<DataType, KeyType, ViewType, ParamType> listener : listeners) {
listener.onFinished(this, key, data, view, params);
}
} }
|
public class class_name {
@SafeVarargs
private final void notifyOnFinished(@NonNull final KeyType key, @Nullable final DataType data,
@NonNull final ViewType view,
@NonNull final ParamType... params) {
for (Listener<DataType, KeyType, ViewType, ParamType> listener : listeners) {
listener.onFinished(this, key, data, view, params); // depends on control dependency: [for], data = [listener]
}
} }
|
public class class_name {
public static void shellSort(int[] arrays) {
int h = 1;
while (h <= arrays.length / ValueConsts.THREE_INT) {
h = h * 3 + 1;
}
while (h > 0) {
for (int i = h; i < arrays.length; i += h) {
if (arrays[i] < arrays[i - h]) {
int tmp = arrays[i];
int j = i - h;
while (j >= 0 && arrays[j] > tmp) {
arrays[j + h] = arrays[j];
j -= h;
}
arrays[j + h] = tmp;
}
}
h = (h - 1) / 3;
}
} }
|
public class class_name {
public static void shellSort(int[] arrays) {
int h = 1;
while (h <= arrays.length / ValueConsts.THREE_INT) {
h = h * 3 + 1; // depends on control dependency: [while], data = [none]
}
while (h > 0) {
for (int i = h; i < arrays.length; i += h) {
if (arrays[i] < arrays[i - h]) {
int tmp = arrays[i];
int j = i - h;
while (j >= 0 && arrays[j] > tmp) {
arrays[j + h] = arrays[j]; // depends on control dependency: [while], data = [none]
j -= h; // depends on control dependency: [while], data = [none]
}
arrays[j + h] = tmp; // depends on control dependency: [if], data = [none]
}
}
h = (h - 1) / 3; // depends on control dependency: [while], data = [(h]
}
} }
|
public class class_name {
private void handleCreate(final NetworkContext context) {
log.debug(String.format("%s - Network configuration created in cluster: %s", NetworkManager.this, cluster.address()));
log.debug(String.format("%s - Scheduling network deployment task", NetworkManager.this));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
currentContext = context;
// Any time the network is being reconfigured, unready the network.
// This will cause components to pause during the reconfiguration.
unready(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause());
task.complete();
} else {
deployNetwork(context, new Handler<AsyncResult<NetworkContext>>() {
@Override
public void handle(AsyncResult<NetworkContext> result) {
task.complete();
if (result.failed()) {
log.error(result.cause());
} else {
log.info(String.format("%s - Successfully deployed network", NetworkManager.this));
}
}
});
}
}
});
}
});
} }
|
public class class_name {
private void handleCreate(final NetworkContext context) {
log.debug(String.format("%s - Network configuration created in cluster: %s", NetworkManager.this, cluster.address()));
log.debug(String.format("%s - Scheduling network deployment task", NetworkManager.this));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
currentContext = context;
// Any time the network is being reconfigured, unready the network.
// This will cause components to pause during the reconfiguration.
unready(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause()); // depends on control dependency: [if], data = [none]
task.complete(); // depends on control dependency: [if], data = [none]
} else {
deployNetwork(context, new Handler<AsyncResult<NetworkContext>>() {
@Override
public void handle(AsyncResult<NetworkContext> result) {
task.complete();
if (result.failed()) {
log.error(result.cause()); // depends on control dependency: [if], data = [none]
} else {
log.info(String.format("%s - Successfully deployed network", NetworkManager.this)); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
});
}
});
} }
|
public class class_name {
public static String expandShorthandHexSingle(String color) {
validateHexSingle(color);
if (color.length() == 1) {
color += color;
}
return color;
} }
|
public class class_name {
public static String expandShorthandHexSingle(String color) {
validateHexSingle(color);
if (color.length() == 1) {
color += color; // depends on control dependency: [if], data = [none]
}
return color;
} }
|
public class class_name {
private void adjustToCurrentFormat() {
// in case of a locked or fixed image ratio height and width need to be reset
int height = m_croppingParam.getOrgHeight();
int width = m_croppingParam.getOrgWidth();
if (m_croppingParam.isScaled()) {
if (m_croppingParam.getTargetHeight() == -1) {
height = (int)Math.floor(
((1.00 * m_croppingParam.getOrgHeight()) / m_croppingParam.getOrgWidth())
* m_croppingParam.getTargetWidth());
} else {
height = m_croppingParam.getTargetHeight();
}
if (m_croppingParam.getTargetWidth() == -1) {
width = (int)Math.floor(
((1.00 * m_croppingParam.getOrgWidth()) / m_croppingParam.getOrgHeight())
* m_croppingParam.getTargetHeight());
} else {
width = m_croppingParam.getTargetWidth();
}
} else {
m_croppingParam.setTargetHeight(height);
m_croppingParam.setTargetWidth(width);
}
m_formatForm.setHeightInput(height);
m_formatForm.setWidthInput(width);
// enabling/disabling ratio lock button
if (m_currentFormat.isFixedRatio()) {
m_formatForm.setRatioButton(false, false, Messages.get().key(Messages.GUI_PRIVIEW_BUTTON_RATIO_FIXED_0));
m_ratioLocked = true;
} else {
if (!m_currentFormat.isHeightEditable() && !m_currentFormat.isWidthEditable()) {
// neither height nor width are editable, disable ratio lock button
m_formatForm.setRatioButton(
false,
false,
Messages.get().key(Messages.GUI_PRIVIEW_BUTTON_NOT_EDITABLE_0));
} else {
m_formatForm.setRatioButton(false, true, null);
}
m_ratioLocked = true;
}
// enabling/disabling height and width input
m_formatForm.setHeightInputEnabled(m_currentFormat.isHeightEditable() || hasUserFormatRestriction());
m_formatForm.setWidthInputEnabled(m_currentFormat.isWidthEditable() || hasUserFormatRestriction());
} }
|
public class class_name {
private void adjustToCurrentFormat() {
// in case of a locked or fixed image ratio height and width need to be reset
int height = m_croppingParam.getOrgHeight();
int width = m_croppingParam.getOrgWidth();
if (m_croppingParam.isScaled()) {
if (m_croppingParam.getTargetHeight() == -1) {
height = (int)Math.floor(
((1.00 * m_croppingParam.getOrgHeight()) / m_croppingParam.getOrgWidth())
* m_croppingParam.getTargetWidth()); // depends on control dependency: [if], data = [none]
} else {
height = m_croppingParam.getTargetHeight(); // depends on control dependency: [if], data = [none]
}
if (m_croppingParam.getTargetWidth() == -1) {
width = (int)Math.floor(
((1.00 * m_croppingParam.getOrgWidth()) / m_croppingParam.getOrgHeight())
* m_croppingParam.getTargetHeight()); // depends on control dependency: [if], data = [none]
} else {
width = m_croppingParam.getTargetWidth(); // depends on control dependency: [if], data = [none]
}
} else {
m_croppingParam.setTargetHeight(height); // depends on control dependency: [if], data = [none]
m_croppingParam.setTargetWidth(width); // depends on control dependency: [if], data = [none]
}
m_formatForm.setHeightInput(height);
m_formatForm.setWidthInput(width);
// enabling/disabling ratio lock button
if (m_currentFormat.isFixedRatio()) {
m_formatForm.setRatioButton(false, false, Messages.get().key(Messages.GUI_PRIVIEW_BUTTON_RATIO_FIXED_0)); // depends on control dependency: [if], data = [none]
m_ratioLocked = true; // depends on control dependency: [if], data = [none]
} else {
if (!m_currentFormat.isHeightEditable() && !m_currentFormat.isWidthEditable()) {
// neither height nor width are editable, disable ratio lock button
m_formatForm.setRatioButton(
false,
false,
Messages.get().key(Messages.GUI_PRIVIEW_BUTTON_NOT_EDITABLE_0)); // depends on control dependency: [if], data = [none]
} else {
m_formatForm.setRatioButton(false, true, null); // depends on control dependency: [if], data = [none]
}
m_ratioLocked = true; // depends on control dependency: [if], data = [none]
}
// enabling/disabling height and width input
m_formatForm.setHeightInputEnabled(m_currentFormat.isHeightEditable() || hasUserFormatRestriction());
m_formatForm.setWidthInputEnabled(m_currentFormat.isWidthEditable() || hasUserFormatRestriction());
} }
|
public class class_name {
@Override
public List<FastFindResult> fastFindForList(String query, FastFindParams params) {
FastFindListWrapper wrapper = this.handleFastFindForEntities(query, params);
if (wrapper == null) {
return Collections.emptyList();
}
return wrapper.getData();
} }
|
public class class_name {
@Override
public List<FastFindResult> fastFindForList(String query, FastFindParams params) {
FastFindListWrapper wrapper = this.handleFastFindForEntities(query, params);
if (wrapper == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return wrapper.getData();
} }
|
public class class_name {
public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) {
int m = A.numRows;
int n = A.numCols;
int index = 0;
if( gamma == 1.0 ) {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , xdat*y.get(j) );
}
}
} else {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , gamma*xdat*y.get(j));
}
}
}
} }
|
public class class_name {
public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) {
int m = A.numRows;
int n = A.numCols;
int index = 0;
if( gamma == 1.0 ) {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , xdat*y.get(j) ); // depends on control dependency: [for], data = [j]
}
}
} else {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , gamma*xdat*y.get(j)); // depends on control dependency: [for], data = [j]
}
}
}
} }
|
public class class_name {
public EClass getIfcFeatureElement() {
if (ifcFeatureElementEClass == null) {
ifcFeatureElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(231);
}
return ifcFeatureElementEClass;
} }
|
public class class_name {
public EClass getIfcFeatureElement() {
if (ifcFeatureElementEClass == null) {
ifcFeatureElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(231);
// depends on control dependency: [if], data = [none]
}
return ifcFeatureElementEClass;
} }
|
public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
ifBlocks = new ArrayList<>();
loadedRegs = new HashMap<>();
loopLocations = new BitSet();
stack = new OpcodeStack();
super.visitClassContext(classContext);
} finally {
ifBlocks = null;
loadedRegs = null;
loopLocations = null;
stack = null;
}
} }
|
public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
ifBlocks = new ArrayList<>(); // depends on control dependency: [try], data = [none]
loadedRegs = new HashMap<>(); // depends on control dependency: [try], data = [none]
loopLocations = new BitSet(); // depends on control dependency: [try], data = [none]
stack = new OpcodeStack(); // depends on control dependency: [try], data = [none]
super.visitClassContext(classContext); // depends on control dependency: [try], data = [none]
} finally {
ifBlocks = null;
loadedRegs = null;
loopLocations = null;
stack = null;
}
} }
|
public class class_name {
public void marshall(ProvisioningArtifactDetail provisioningArtifactDetail, ProtocolMarshaller protocolMarshaller) {
if (provisioningArtifactDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisioningArtifactDetail.getId(), ID_BINDING);
protocolMarshaller.marshall(provisioningArtifactDetail.getName(), NAME_BINDING);
protocolMarshaller.marshall(provisioningArtifactDetail.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(provisioningArtifactDetail.getType(), TYPE_BINDING);
protocolMarshaller.marshall(provisioningArtifactDetail.getCreatedTime(), CREATEDTIME_BINDING);
protocolMarshaller.marshall(provisioningArtifactDetail.getActive(), ACTIVE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ProvisioningArtifactDetail provisioningArtifactDetail, ProtocolMarshaller protocolMarshaller) {
if (provisioningArtifactDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisioningArtifactDetail.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisioningArtifactDetail.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisioningArtifactDetail.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisioningArtifactDetail.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisioningArtifactDetail.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisioningArtifactDetail.getActive(), ACTIVE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void configureCustomProxyProperties(
Map<SFSessionProperty, Object> connectionPropertiesMap)
{
if (connectionPropertiesMap.containsKey(SFSessionProperty.USE_PROXY))
{
useProxy = (boolean) connectionPropertiesMap.get(
SFSessionProperty.USE_PROXY);
}
if (useProxy)
{
proxyHost =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_HOST);
proxyPort =
Integer.parseInt(
connectionPropertiesMap.get(SFSessionProperty.PROXY_PORT).toString());
proxyUser =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_USER);
proxyPassword =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_PASSWORD);
nonProxyHosts =
(String) connectionPropertiesMap.get(SFSessionProperty.NON_PROXY_HOSTS);
}
} }
|
public class class_name {
public static void configureCustomProxyProperties(
Map<SFSessionProperty, Object> connectionPropertiesMap)
{
if (connectionPropertiesMap.containsKey(SFSessionProperty.USE_PROXY))
{
useProxy = (boolean) connectionPropertiesMap.get(
SFSessionProperty.USE_PROXY); // depends on control dependency: [if], data = [none]
}
if (useProxy)
{
proxyHost =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_HOST); // depends on control dependency: [if], data = [none]
proxyPort =
Integer.parseInt(
connectionPropertiesMap.get(SFSessionProperty.PROXY_PORT).toString()); // depends on control dependency: [if], data = [none]
proxyUser =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_USER); // depends on control dependency: [if], data = [none]
proxyPassword =
(String) connectionPropertiesMap.get(SFSessionProperty.PROXY_PASSWORD); // depends on control dependency: [if], data = [none]
nonProxyHosts =
(String) connectionPropertiesMap.get(SFSessionProperty.NON_PROXY_HOSTS); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Set<Annotation> getPropertyAnnotations()
{
if (accessor instanceof PropertyAwareAccessor)
{
return unmodifiableSet(((PropertyAwareAccessor) accessor).getReadMethodAnnotations());
}
return unmodifiableSet(Collections.<Annotation>emptySet());
} }
|
public class class_name {
public Set<Annotation> getPropertyAnnotations()
{
if (accessor instanceof PropertyAwareAccessor)
{
return unmodifiableSet(((PropertyAwareAccessor) accessor).getReadMethodAnnotations()); // depends on control dependency: [if], data = [none]
}
return unmodifiableSet(Collections.<Annotation>emptySet());
} }
|
public class class_name {
public static Pattern compilePattern(final String expr) {
Pattern pattern;
final int lastChar = expr.length() - 1;
if (expr.charAt(0) == '/' && expr.charAt(lastChar) == '/') {
pattern = Pattern.compile(expr.substring(1, lastChar));
} else {
pattern = Pattern.compile(Pattern.quote(expr));
}
return pattern;
} }
|
public class class_name {
public static Pattern compilePattern(final String expr) {
Pattern pattern;
final int lastChar = expr.length() - 1;
if (expr.charAt(0) == '/' && expr.charAt(lastChar) == '/') {
pattern = Pattern.compile(expr.substring(1, lastChar)); // depends on control dependency: [if], data = [none]
} else {
pattern = Pattern.compile(Pattern.quote(expr)); // depends on control dependency: [if], data = [none]
}
return pattern;
} }
|
public class class_name {
public void marshall(RedshiftDestinationConfiguration redshiftDestinationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (redshiftDestinationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(redshiftDestinationConfiguration.getRoleARN(), ROLEARN_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getClusterJDBCURL(), CLUSTERJDBCURL_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getCopyCommand(), COPYCOMMAND_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getUsername(), USERNAME_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getPassword(), PASSWORD_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getRetryOptions(), RETRYOPTIONS_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3Configuration(), S3CONFIGURATION_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getProcessingConfiguration(), PROCESSINGCONFIGURATION_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3BackupMode(), S3BACKUPMODE_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3BackupConfiguration(), S3BACKUPCONFIGURATION_BINDING);
protocolMarshaller.marshall(redshiftDestinationConfiguration.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RedshiftDestinationConfiguration redshiftDestinationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (redshiftDestinationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(redshiftDestinationConfiguration.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getClusterJDBCURL(), CLUSTERJDBCURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getCopyCommand(), COPYCOMMAND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getRetryOptions(), RETRYOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3Configuration(), S3CONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getProcessingConfiguration(), PROCESSINGCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3BackupMode(), S3BACKUPMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getS3BackupConfiguration(), S3BACKUPCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftDestinationConfiguration.getCloudWatchLoggingOptions(), CLOUDWATCHLOGGINGOPTIONS_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 {
@VisibleForTesting
static void unsafeResetExporter() {
synchronized (monitor) {
if (instance != null) {
instance.intervalMetricReader.stop();
}
instance = null;
}
} }
|
public class class_name {
@VisibleForTesting
static void unsafeResetExporter() {
synchronized (monitor) {
if (instance != null) {
instance.intervalMetricReader.stop(); // depends on control dependency: [if], data = [none]
}
instance = null;
}
} }
|
public class class_name {
public ExceptionThrownRule getExceptionThrownRule(Throwable ex) {
ExceptionThrownRule exceptionThrownRule = null;
int deepest = Integer.MAX_VALUE;
for (Map.Entry<String, ExceptionThrownRule> entry : exceptionThrownRuleMap.entrySet()) {
int depth = getMatchedDepth(entry.getKey(), ex);
if (depth >= 0 && depth < deepest) {
deepest = depth;
exceptionThrownRule = entry.getValue();
}
}
return (exceptionThrownRule != null ? exceptionThrownRule : defaultExceptionThrownRule);
} }
|
public class class_name {
public ExceptionThrownRule getExceptionThrownRule(Throwable ex) {
ExceptionThrownRule exceptionThrownRule = null;
int deepest = Integer.MAX_VALUE;
for (Map.Entry<String, ExceptionThrownRule> entry : exceptionThrownRuleMap.entrySet()) {
int depth = getMatchedDepth(entry.getKey(), ex);
if (depth >= 0 && depth < deepest) {
deepest = depth; // depends on control dependency: [if], data = [none]
exceptionThrownRule = entry.getValue(); // depends on control dependency: [if], data = [none]
}
}
return (exceptionThrownRule != null ? exceptionThrownRule : defaultExceptionThrownRule);
} }
|
public class class_name {
@Override
public String processReturningText(String s, HttpAction hm) {
super.processReturningText(s, hm);
if (delToken) {
tokenAction.processReturningText(s, hm);
delToken = false;
} else {
parseXml(s);
setHasMoreMessages(false);
}
return "";
} }
|
public class class_name {
@Override
public String processReturningText(String s, HttpAction hm) {
super.processReturningText(s, hm);
if (delToken) {
tokenAction.processReturningText(s, hm); // depends on control dependency: [if], data = [none]
delToken = false; // depends on control dependency: [if], data = [none]
} else {
parseXml(s); // depends on control dependency: [if], data = [none]
setHasMoreMessages(false); // depends on control dependency: [if], data = [none]
}
return "";
} }
|
public class class_name {
public ResourceAssignment addResourceAssignment(Resource resource)
{
ResourceAssignment assignment = getExistingResourceAssignment(resource);
if (assignment == null)
{
assignment = new ResourceAssignment(getParentFile(), this);
m_assignments.add(assignment);
getParentFile().getResourceAssignments().add(assignment);
assignment.setTaskUniqueID(getUniqueID());
assignment.setWork(getDuration());
assignment.setUnits(ResourceAssignment.DEFAULT_UNITS);
if (resource != null)
{
assignment.setResourceUniqueID(resource.getUniqueID());
resource.addResourceAssignment(assignment);
}
}
return (assignment);
} }
|
public class class_name {
public ResourceAssignment addResourceAssignment(Resource resource)
{
ResourceAssignment assignment = getExistingResourceAssignment(resource);
if (assignment == null)
{
assignment = new ResourceAssignment(getParentFile(), this); // depends on control dependency: [if], data = [none]
m_assignments.add(assignment); // depends on control dependency: [if], data = [(assignment]
getParentFile().getResourceAssignments().add(assignment); // depends on control dependency: [if], data = [(assignment]
assignment.setTaskUniqueID(getUniqueID()); // depends on control dependency: [if], data = [none]
assignment.setWork(getDuration()); // depends on control dependency: [if], data = [none]
assignment.setUnits(ResourceAssignment.DEFAULT_UNITS); // depends on control dependency: [if], data = [none]
if (resource != null)
{
assignment.setResourceUniqueID(resource.getUniqueID()); // depends on control dependency: [if], data = [(resource]
resource.addResourceAssignment(assignment); // depends on control dependency: [if], data = [none]
}
}
return (assignment);
} }
|
public class class_name {
private static void displayAvailableFilters(ProjectFile project)
{
System.out.println("Unknown filter name supplied.");
System.out.println("Available task filters:");
for (Filter filter : project.getFilters().getTaskFilters())
{
System.out.println(" " + filter.getName());
}
System.out.println("Available resource filters:");
for (Filter filter : project.getFilters().getResourceFilters())
{
System.out.println(" " + filter.getName());
}
} }
|
public class class_name {
private static void displayAvailableFilters(ProjectFile project)
{
System.out.println("Unknown filter name supplied.");
System.out.println("Available task filters:");
for (Filter filter : project.getFilters().getTaskFilters())
{
System.out.println(" " + filter.getName()); // depends on control dependency: [for], data = [filter]
}
System.out.println("Available resource filters:");
for (Filter filter : project.getFilters().getResourceFilters())
{
System.out.println(" " + filter.getName());
}
} }
|
public class class_name {
public void marshall(Job job, ProtocolMarshaller protocolMarshaller) {
if (job == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(job.getAccelerationSettings(), ACCELERATIONSETTINGS_BINDING);
protocolMarshaller.marshall(job.getArn(), ARN_BINDING);
protocolMarshaller.marshall(job.getBillingTagsSource(), BILLINGTAGSSOURCE_BINDING);
protocolMarshaller.marshall(job.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(job.getCurrentPhase(), CURRENTPHASE_BINDING);
protocolMarshaller.marshall(job.getErrorCode(), ERRORCODE_BINDING);
protocolMarshaller.marshall(job.getErrorMessage(), ERRORMESSAGE_BINDING);
protocolMarshaller.marshall(job.getId(), ID_BINDING);
protocolMarshaller.marshall(job.getJobPercentComplete(), JOBPERCENTCOMPLETE_BINDING);
protocolMarshaller.marshall(job.getJobTemplate(), JOBTEMPLATE_BINDING);
protocolMarshaller.marshall(job.getOutputGroupDetails(), OUTPUTGROUPDETAILS_BINDING);
protocolMarshaller.marshall(job.getQueue(), QUEUE_BINDING);
protocolMarshaller.marshall(job.getRetryCount(), RETRYCOUNT_BINDING);
protocolMarshaller.marshall(job.getRole(), ROLE_BINDING);
protocolMarshaller.marshall(job.getSettings(), SETTINGS_BINDING);
protocolMarshaller.marshall(job.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(job.getStatusUpdateInterval(), STATUSUPDATEINTERVAL_BINDING);
protocolMarshaller.marshall(job.getTiming(), TIMING_BINDING);
protocolMarshaller.marshall(job.getUserMetadata(), USERMETADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Job job, ProtocolMarshaller protocolMarshaller) {
if (job == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(job.getAccelerationSettings(), ACCELERATIONSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getBillingTagsSource(), BILLINGTAGSSOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getCurrentPhase(), CURRENTPHASE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getJobPercentComplete(), JOBPERCENTCOMPLETE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getJobTemplate(), JOBTEMPLATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getOutputGroupDetails(), OUTPUTGROUPDETAILS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getQueue(), QUEUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getRetryCount(), RETRYCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getRole(), ROLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getSettings(), SETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getStatusUpdateInterval(), STATUSUPDATEINTERVAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getTiming(), TIMING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(job.getUserMetadata(), USERMETADATA_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 String raiseAlarm(NotificationSourceWrapper notificationSource, String alarmType, String instanceID, AlarmLevel level, String message, Throwable cause) {
synchronized (notificationSource) {
if (isAlarmAlive(notificationSource, alarmType, instanceID)) {
// Alarm a = this.placeHolderToAlarm.get(new
// AlarmPlaceHolder(notificationSource, alarmType, instanceID));
Alarm a = null;
// unconveniant....
try {
AlarmPlaceHolder localAPH = new AlarmPlaceHolder(notificationSource, alarmType, instanceID);
for (Map.Entry<String, AlarmPlaceHolder> e : this.alarmIdToAlarm.entrySet()) {
if (e.getValue().equals(localAPH)) {
a = e.getValue().getAlarm();
break;
}
}
} catch (Exception e) {
// ignore
}
if (a != null) {
return a.getAlarmID();
} else {
return this.raiseAlarm(notificationSource, alarmType, instanceID, level, message, cause);
}
} else {
Alarm a = new Alarm(UUID.randomUUID().toString(), notificationSource.getNotificationSource(), alarmType, instanceID, level, message, cause, System.currentTimeMillis());
AlarmPlaceHolder aph = new AlarmPlaceHolder(notificationSource, alarmType, instanceID, a);
this.alarmIdToAlarm.put(a.getAlarmID(), aph);
// this.placeHolderToAlarm.put(aph, a);
this.placeHolderToNotificationSource.put(aph, aph.getNotificationSource().getNotificationSource());
generateNotification(aph, false);
return a.getAlarmID();
}
}
} }
|
public class class_name {
public String raiseAlarm(NotificationSourceWrapper notificationSource, String alarmType, String instanceID, AlarmLevel level, String message, Throwable cause) {
synchronized (notificationSource) {
if (isAlarmAlive(notificationSource, alarmType, instanceID)) {
// Alarm a = this.placeHolderToAlarm.get(new
// AlarmPlaceHolder(notificationSource, alarmType, instanceID));
Alarm a = null;
// unconveniant....
try {
AlarmPlaceHolder localAPH = new AlarmPlaceHolder(notificationSource, alarmType, instanceID);
for (Map.Entry<String, AlarmPlaceHolder> e : this.alarmIdToAlarm.entrySet()) {
if (e.getValue().equals(localAPH)) {
a = e.getValue().getAlarm();
// depends on control dependency: [if], data = [none]
break;
}
}
} catch (Exception e) {
// ignore
}
// depends on control dependency: [catch], data = [none]
if (a != null) {
return a.getAlarmID();
// depends on control dependency: [if], data = [none]
} else {
return this.raiseAlarm(notificationSource, alarmType, instanceID, level, message, cause);
// depends on control dependency: [if], data = [none]
}
} else {
Alarm a = new Alarm(UUID.randomUUID().toString(), notificationSource.getNotificationSource(), alarmType, instanceID, level, message, cause, System.currentTimeMillis());
AlarmPlaceHolder aph = new AlarmPlaceHolder(notificationSource, alarmType, instanceID, a);
this.alarmIdToAlarm.put(a.getAlarmID(), aph);
// depends on control dependency: [if], data = [none]
// this.placeHolderToAlarm.put(aph, a);
this.placeHolderToNotificationSource.put(aph, aph.getNotificationSource().getNotificationSource());
// depends on control dependency: [if], data = [none]
generateNotification(aph, false);
// depends on control dependency: [if], data = [none]
return a.getAlarmID();
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Builder setDefaultTTL(@Nullable final Duration ttl) {
if (ttl == null) {
return this;
}
return setDefaultTTL((int) ttl.getSeconds());
} }
|
public class class_name {
public Builder setDefaultTTL(@Nullable final Duration ttl) {
if (ttl == null) {
return this; // depends on control dependency: [if], data = [none]
}
return setDefaultTTL((int) ttl.getSeconds());
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private Zipper<K, V> unzipBoth(Tree<K, V> left, Tree<K, V> right, List<Tree<K, V>> leftZipper, List<Tree<K, V>> rightZipper, int smallerDepth) {
if (isBlackTree(left) && isBlackTree(right)) {
return unzipBoth(left.getRight(), right.getLeft(), cons(left, leftZipper), cons(right, rightZipper), smallerDepth + 1);
} else if (isRedTree(left) && isRedTree(right)) {
return unzipBoth(left.getRight(), right.getLeft(), cons(left, leftZipper), cons(right, rightZipper), smallerDepth);
} else if (isRedTree(right)) {
return unzipBoth(left, right.getLeft(), leftZipper, cons(right, rightZipper), smallerDepth);
} else if (isRedTree(left)) {
return unzipBoth(left.getRight(), right, cons(left, leftZipper), rightZipper, smallerDepth);
} else if ((left == null) && (right == null)) {
return new Zipper<K, V>((List<Tree<K, V>>) Collections.EMPTY_LIST, true, false, smallerDepth);
} else if ((left == null) && isBlackTree(right)) {
return new Zipper<K, V>(unzip(cons(right, rightZipper), true), false, true, smallerDepth);
} else if (isBlackTree(left) && (right == null)) {
return new Zipper<K, V>(unzip(cons(left, leftZipper), false), false, false, smallerDepth);
} else {
throw new RuntimeException("unmatched trees in unzip: " + left + ", " + right);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private Zipper<K, V> unzipBoth(Tree<K, V> left, Tree<K, V> right, List<Tree<K, V>> leftZipper, List<Tree<K, V>> rightZipper, int smallerDepth) {
if (isBlackTree(left) && isBlackTree(right)) {
return unzipBoth(left.getRight(), right.getLeft(), cons(left, leftZipper), cons(right, rightZipper), smallerDepth + 1); // depends on control dependency: [if], data = [none]
} else if (isRedTree(left) && isRedTree(right)) {
return unzipBoth(left.getRight(), right.getLeft(), cons(left, leftZipper), cons(right, rightZipper), smallerDepth); // depends on control dependency: [if], data = [none]
} else if (isRedTree(right)) {
return unzipBoth(left, right.getLeft(), leftZipper, cons(right, rightZipper), smallerDepth); // depends on control dependency: [if], data = [none]
} else if (isRedTree(left)) {
return unzipBoth(left.getRight(), right, cons(left, leftZipper), rightZipper, smallerDepth); // depends on control dependency: [if], data = [none]
} else if ((left == null) && (right == null)) {
return new Zipper<K, V>((List<Tree<K, V>>) Collections.EMPTY_LIST, true, false, smallerDepth); // depends on control dependency: [if], data = [none]
} else if ((left == null) && isBlackTree(right)) {
return new Zipper<K, V>(unzip(cons(right, rightZipper), true), false, true, smallerDepth); // depends on control dependency: [if], data = [none]
} else if (isBlackTree(left) && (right == null)) {
return new Zipper<K, V>(unzip(cons(left, leftZipper), false), false, false, smallerDepth); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("unmatched trees in unzip: " + left + ", " + right);
}
} }
|
public class class_name {
private Collection<DuplicateCode> convert(final List<Duplication> duplications, final String moduleName) {
List<DuplicateCode> annotations = new ArrayList<DuplicateCode>();
for (Duplication duplication : duplications) {
List<DuplicateCode> codeBlocks = new ArrayList<DuplicateCode>();
boolean isDerived = false;
for (SourceFile file : duplication.getFiles()) {
// TODO: check why PMD reports a length + 1
DuplicateCode annotation = new DuplicateCode(getPriority(duplication.getLines()), file.getLine(), duplication.getLines(), file.getPath(), isDerived);
annotation.setSourceCode(duplication.getCodeFragment());
annotation.setModuleName(moduleName);
codeBlocks.add(annotation);
isDerived = true;
}
for (DuplicateCode block : codeBlocks) {
block.linkTo(codeBlocks);
block.setPackageName(PackageDetectors.detectPackageName(block.getFileName()));
}
annotations.addAll(codeBlocks);
}
return annotations;
} }
|
public class class_name {
private Collection<DuplicateCode> convert(final List<Duplication> duplications, final String moduleName) {
List<DuplicateCode> annotations = new ArrayList<DuplicateCode>();
for (Duplication duplication : duplications) {
List<DuplicateCode> codeBlocks = new ArrayList<DuplicateCode>();
boolean isDerived = false;
for (SourceFile file : duplication.getFiles()) {
// TODO: check why PMD reports a length + 1
DuplicateCode annotation = new DuplicateCode(getPriority(duplication.getLines()), file.getLine(), duplication.getLines(), file.getPath(), isDerived);
annotation.setSourceCode(duplication.getCodeFragment()); // depends on control dependency: [for], data = [none]
annotation.setModuleName(moduleName); // depends on control dependency: [for], data = [none]
codeBlocks.add(annotation); // depends on control dependency: [for], data = [none]
isDerived = true;
// depends on control dependency: [for], data = [none]
}
for (DuplicateCode block : codeBlocks) {
block.linkTo(codeBlocks); // depends on control dependency: [for], data = [block]
block.setPackageName(PackageDetectors.detectPackageName(block.getFileName())); // depends on control dependency: [for], data = [block]
}
annotations.addAll(codeBlocks); // depends on control dependency: [for], data = [none]
}
return annotations;
} }
|
public class class_name {
public synchronized void forceAdminObjects(List<AdminObject> newContent)
{
if (newContent != null)
{
this.adminobjects = new ArrayList<AdminObject>(newContent);
}
else
{
this.adminobjects = new ArrayList<AdminObject>(0);
}
} }
|
public class class_name {
public synchronized void forceAdminObjects(List<AdminObject> newContent)
{
if (newContent != null)
{
this.adminobjects = new ArrayList<AdminObject>(newContent); // depends on control dependency: [if], data = [(newContent]
}
else
{
this.adminobjects = new ArrayList<AdminObject>(0); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized void addElement(T element) {
List<T> origList = ref.get().list;
boolean isPresent = origList.contains(element);
if (isPresent) {
return;
}
List<T> newList = new ArrayList<T>(origList);
newList.add(element);
swapWithList(newList);
} }
|
public class class_name {
public synchronized void addElement(T element) {
List<T> origList = ref.get().list;
boolean isPresent = origList.contains(element);
if (isPresent) {
return; // depends on control dependency: [if], data = [none]
}
List<T> newList = new ArrayList<T>(origList);
newList.add(element);
swapWithList(newList);
} }
|
public class class_name {
@Override
public CPRuleAssetCategoryRel fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey);
if (serializable == nullModel) {
return null;
}
CPRuleAssetCategoryRel cpRuleAssetCategoryRel = (CPRuleAssetCategoryRel)serializable;
if (cpRuleAssetCategoryRel == null) {
Session session = null;
try {
session = openSession();
cpRuleAssetCategoryRel = (CPRuleAssetCategoryRel)session.get(CPRuleAssetCategoryRelImpl.class,
primaryKey);
if (cpRuleAssetCategoryRel != null) {
cacheResult(cpRuleAssetCategoryRel);
}
else {
entityCache.putResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey, nullModel);
}
}
catch (Exception e) {
entityCache.removeResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey);
throw processException(e);
}
finally {
closeSession(session);
}
}
return cpRuleAssetCategoryRel;
} }
|
public class class_name {
@Override
public CPRuleAssetCategoryRel fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey);
if (serializable == nullModel) {
return null; // depends on control dependency: [if], data = [none]
}
CPRuleAssetCategoryRel cpRuleAssetCategoryRel = (CPRuleAssetCategoryRel)serializable;
if (cpRuleAssetCategoryRel == null) {
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
cpRuleAssetCategoryRel = (CPRuleAssetCategoryRel)session.get(CPRuleAssetCategoryRelImpl.class,
primaryKey); // depends on control dependency: [try], data = [none]
if (cpRuleAssetCategoryRel != null) {
cacheResult(cpRuleAssetCategoryRel); // depends on control dependency: [if], data = [(cpRuleAssetCategoryRel]
}
else {
entityCache.putResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey, nullModel); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
entityCache.removeResult(CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class, primaryKey);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return cpRuleAssetCategoryRel;
} }
|
public class class_name {
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(gidNumber);
sb.append(dm).append(name);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
sb.insert(0, "{").append("}");
return sb.toString();
} }
|
public class class_name {
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(gidNumber);
sb.append(dm).append(name);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length()); // depends on control dependency: [if], data = [dm.length())]
}
sb.insert(0, "{").append("}");
return sb.toString();
} }
|
public class class_name {
public JwwfServer bindWebapp(final Class<? extends User> user, String url) {
if (!url.endsWith("/"))
url = url + "/";
context.addServlet(new ServletHolder(new WebClientServelt(clientCreator)), url + "");
context.addServlet(new ServletHolder(new SkinServlet()), url + "__jwwf/skins/*");
ServletHolder fontServletHolder = new ServletHolder(new ResourceServlet());
fontServletHolder.setInitParameter("basePackage", "net/magik6k/jwwf/assets/fonts");
context.addServlet(fontServletHolder, url + "__jwwf/fonts/*");
context.addServlet(new ServletHolder(new APISocketServlet(new UserFactory() {
@Override
public User createUser() {
try {
User u = user.getDeclaredConstructor().newInstance();
u.setServer(jwwfServer);
return u;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
})), url + "__jwwf/socket");
for (JwwfPlugin plugin : plugins) {
if (plugin instanceof IPluginWebapp)
((IPluginWebapp) plugin).onWebappBound(this, url);
}
return this;
} }
|
public class class_name {
public JwwfServer bindWebapp(final Class<? extends User> user, String url) {
if (!url.endsWith("/"))
url = url + "/";
context.addServlet(new ServletHolder(new WebClientServelt(clientCreator)), url + "");
context.addServlet(new ServletHolder(new SkinServlet()), url + "__jwwf/skins/*");
ServletHolder fontServletHolder = new ServletHolder(new ResourceServlet());
fontServletHolder.setInitParameter("basePackage", "net/magik6k/jwwf/assets/fonts");
context.addServlet(fontServletHolder, url + "__jwwf/fonts/*");
context.addServlet(new ServletHolder(new APISocketServlet(new UserFactory() {
@Override
public User createUser() {
try {
User u = user.getDeclaredConstructor().newInstance();
u.setServer(jwwfServer); // depends on control dependency: [try], data = [none]
return u; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
}
})), url + "__jwwf/socket");
for (JwwfPlugin plugin : plugins) {
if (plugin instanceof IPluginWebapp)
((IPluginWebapp) plugin).onWebappBound(this, url);
}
return this;
} }
|
public class class_name {
public static List<ChildNumber> parsePath(@Nonnull String path) {
String[] parsedNodes = path.replace("M", "").split("/");
List<ChildNumber> nodes = new ArrayList<>();
for (String n : parsedNodes) {
n = n.replaceAll(" ", "");
if (n.length() == 0) continue;
boolean isHard = n.endsWith("H");
if (isHard) n = n.substring(0, n.length() - 1);
int nodeNumber = Integer.parseInt(n);
nodes.add(new ChildNumber(nodeNumber, isHard));
}
return nodes;
} }
|
public class class_name {
public static List<ChildNumber> parsePath(@Nonnull String path) {
String[] parsedNodes = path.replace("M", "").split("/");
List<ChildNumber> nodes = new ArrayList<>();
for (String n : parsedNodes) {
n = n.replaceAll(" ", ""); // depends on control dependency: [for], data = [n]
if (n.length() == 0) continue;
boolean isHard = n.endsWith("H");
if (isHard) n = n.substring(0, n.length() - 1);
int nodeNumber = Integer.parseInt(n);
nodes.add(new ChildNumber(nodeNumber, isHard)); // depends on control dependency: [for], data = [n]
}
return nodes;
} }
|
public class class_name {
@SuppressWarnings("unlikely-arg-type")
protected final void setPrimitiveValidity(BusPrimitiveInvalidity invalidityReason) {
if ((invalidityReason == null && this.invalidityReason != null)
|| (invalidityReason != null
&& !invalidityReason.equals(BusPrimitiveInvalidityType.VALIDITY_NOT_CHECKED)
&& !invalidityReason.equals(this.invalidityReason))) {
final BusPrimitiveInvalidity old = this.invalidityReason;
this.invalidityReason = invalidityReason;
fireValidityChanged(old, this.invalidityReason);
}
} }
|
public class class_name {
@SuppressWarnings("unlikely-arg-type")
protected final void setPrimitiveValidity(BusPrimitiveInvalidity invalidityReason) {
if ((invalidityReason == null && this.invalidityReason != null)
|| (invalidityReason != null
&& !invalidityReason.equals(BusPrimitiveInvalidityType.VALIDITY_NOT_CHECKED)
&& !invalidityReason.equals(this.invalidityReason))) {
final BusPrimitiveInvalidity old = this.invalidityReason;
this.invalidityReason = invalidityReason; // depends on control dependency: [if], data = [none]
fireValidityChanged(old, this.invalidityReason); // depends on control dependency: [if], data = [none]
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.