code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void stopStep(final String uuid) {
final Optional<StepResult> found = storage.getStep(uuid);
if (!found.isPresent()) {
LOGGER.error("Could not stop step: step with uuid {} not found", uuid);
return;
}
final StepResult step = found.get();
notifier.beforeStepStop(step);
step.setStage(Stage.FINISHED);
step.setStop(System.currentTimeMillis());
storage.remove(uuid);
threadContext.stop();
notifier.afterStepStop(step);
} } | public class class_name {
public void stopStep(final String uuid) {
final Optional<StepResult> found = storage.getStep(uuid);
if (!found.isPresent()) {
LOGGER.error("Could not stop step: step with uuid {} not found", uuid); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final StepResult step = found.get();
notifier.beforeStepStop(step);
step.setStage(Stage.FINISHED);
step.setStop(System.currentTimeMillis());
storage.remove(uuid);
threadContext.stop();
notifier.afterStepStop(step);
} } |
public class class_name {
public void marshall(UpdateInputRequest updateInputRequest, ProtocolMarshaller protocolMarshaller) {
if (updateInputRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateInputRequest.getDestinations(), DESTINATIONS_BINDING);
protocolMarshaller.marshall(updateInputRequest.getInputId(), INPUTID_BINDING);
protocolMarshaller.marshall(updateInputRequest.getInputSecurityGroups(), INPUTSECURITYGROUPS_BINDING);
protocolMarshaller.marshall(updateInputRequest.getMediaConnectFlows(), MEDIACONNECTFLOWS_BINDING);
protocolMarshaller.marshall(updateInputRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateInputRequest.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(updateInputRequest.getSources(), SOURCES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateInputRequest updateInputRequest, ProtocolMarshaller protocolMarshaller) {
if (updateInputRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateInputRequest.getDestinations(), DESTINATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getInputId(), INPUTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getInputSecurityGroups(), INPUTSECURITYGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getMediaConnectFlows(), MEDIACONNECTFLOWS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateInputRequest.getSources(), SOURCES_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 boolean remove() {
try {
if(!isBinary)return getJedisCommands(groupName).del(key) == 1;
if(isCluster(groupName)){
return getBinaryJedisClusterCommands(groupName).del(keyBytes) == 1;
}
return getBinaryJedisCommands(groupName).del(keyBytes) == 1;
} finally {
getJedisProvider(groupName).release();
}
} } | public class class_name {
public boolean remove() {
try {
if(!isBinary)return getJedisCommands(groupName).del(key) == 1;
if(isCluster(groupName)){
return getBinaryJedisClusterCommands(groupName).del(keyBytes) == 1; // depends on control dependency: [if], data = [none]
}
return getBinaryJedisCommands(groupName).del(keyBytes) == 1; // depends on control dependency: [try], data = [none]
} finally {
getJedisProvider(groupName).release();
}
} } |
public class class_name {
protected NumberedSplit<InputSplit> allocateSplit(final String evaluatorId,
final BlockingQueue<NumberedSplit<InputSplit>> value) {
if (value == null) {
LOG.log(Level.FINE, "Queue of splits can't be empty. Returning null");
return null;
}
while (true) {
final NumberedSplit<InputSplit> split = value.poll();
if (split == null) {
return null;
}
if (value == unallocatedSplits || unallocatedSplits.remove(split)) {
LOG.log(Level.FINE, "Found split-" + split.getIndex() + " in the queue");
final NumberedSplit<InputSplit> old = evaluatorToSplits.putIfAbsent(evaluatorId, split);
if (old != null) {
throw new RuntimeException("Trying to assign different splits to the same evaluator is not supported");
} else {
LOG.log(Level.FINE, "Returning " + split.getIndex());
return split;
}
}
}
} } | public class class_name {
protected NumberedSplit<InputSplit> allocateSplit(final String evaluatorId,
final BlockingQueue<NumberedSplit<InputSplit>> value) {
if (value == null) {
LOG.log(Level.FINE, "Queue of splits can't be empty. Returning null"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
while (true) {
final NumberedSplit<InputSplit> split = value.poll();
if (split == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (value == unallocatedSplits || unallocatedSplits.remove(split)) {
LOG.log(Level.FINE, "Found split-" + split.getIndex() + " in the queue"); // depends on control dependency: [if], data = [none]
final NumberedSplit<InputSplit> old = evaluatorToSplits.putIfAbsent(evaluatorId, split);
if (old != null) {
throw new RuntimeException("Trying to assign different splits to the same evaluator is not supported");
} else {
LOG.log(Level.FINE, "Returning " + split.getIndex()); // depends on control dependency: [if], data = [none]
return split; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private static List<Integer> parseArray(String value, ValueParser parser){
final List<Integer> values = new ArrayList<>();
final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
for (String part : parts) {
CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
}
return values;
} } | public class class_name {
private static List<Integer> parseArray(String value, ValueParser parser){
final List<Integer> values = new ArrayList<>();
final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
for (String part : parts) {
CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
// depends on control dependency: [for], data = [part]
}
return values;
} } |
public class class_name {
public DateTimeFormatter getFormatter() {
DateTimeFormatter[] f = iFormatter;
if (f == null) {
if (size() == 0) {
return null;
}
f = new DateTimeFormatter[2];
try {
List<DateTimeFieldType> list = new ArrayList<DateTimeFieldType>(Arrays.asList(iTypes));
f[0] = ISODateTimeFormat.forFields(list, true, false);
if (list.size() == 0) {
f[1] = f[0];
}
} catch (IllegalArgumentException ex) {
// ignore
}
iFormatter = f;
}
return f[0];
} } | public class class_name {
public DateTimeFormatter getFormatter() {
DateTimeFormatter[] f = iFormatter;
if (f == null) {
if (size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
f = new DateTimeFormatter[2]; // depends on control dependency: [if], data = [none]
try {
List<DateTimeFieldType> list = new ArrayList<DateTimeFieldType>(Arrays.asList(iTypes));
f[0] = ISODateTimeFormat.forFields(list, true, false); // depends on control dependency: [try], data = [none]
if (list.size() == 0) {
f[1] = f[0]; // depends on control dependency: [if], data = [none]
}
} catch (IllegalArgumentException ex) {
// ignore
} // depends on control dependency: [catch], data = [none]
iFormatter = f; // depends on control dependency: [if], data = [none]
}
return f[0];
} } |
public class class_name {
@Override
public EClass getIfcPointOnCurve() {
if (ifcPointOnCurveEClass == null) {
ifcPointOnCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(432);
}
return ifcPointOnCurveEClass;
} } | public class class_name {
@Override
public EClass getIfcPointOnCurve() {
if (ifcPointOnCurveEClass == null) {
ifcPointOnCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(432);
// depends on control dependency: [if], data = [none]
}
return ifcPointOnCurveEClass;
} } |
public class class_name {
public void setUserAttributes(java.util.Collection<Attribute> userAttributes) {
if (userAttributes == null) {
this.userAttributes = null;
return;
}
this.userAttributes = new java.util.ArrayList<Attribute>(userAttributes);
} } | public class class_name {
public void setUserAttributes(java.util.Collection<Attribute> userAttributes) {
if (userAttributes == null) {
this.userAttributes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.userAttributes = new java.util.ArrayList<Attribute>(userAttributes);
} } |
public class class_name {
public Iterator<T> getInputSplits() {
final InputSplitProvider provider = getEnvironment().getInputSplitProvider();
return new Iterator<T>() {
private T nextSplit;
@Override
public boolean hasNext() {
if (this.nextSplit == null) {
final InputSplit split = provider.getNextInputSplit();
if (split != null) {
@SuppressWarnings("unchecked")
final T tSplit = (T) split;
this.nextSplit = tSplit;
return true;
} else {
return false;
}
} else {
return true;
}
}
@Override
public T next() {
if (this.nextSplit == null && !hasNext()) {
throw new NoSuchElementException();
}
final T tmp = this.nextSplit;
this.nextSplit = null;
return tmp;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} } | public class class_name {
public Iterator<T> getInputSplits() {
final InputSplitProvider provider = getEnvironment().getInputSplitProvider();
return new Iterator<T>() {
private T nextSplit;
@Override
public boolean hasNext() {
if (this.nextSplit == null) {
final InputSplit split = provider.getNextInputSplit();
if (split != null) {
@SuppressWarnings("unchecked")
final T tSplit = (T) split;
this.nextSplit = tSplit; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} else {
return true; // depends on control dependency: [if], data = [none]
}
}
@Override
public T next() {
if (this.nextSplit == null && !hasNext()) {
throw new NoSuchElementException();
}
final T tmp = this.nextSplit;
this.nextSplit = null;
return tmp;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} } |
public class class_name {
public void setParts(java.util.Collection<PartListElement> parts) {
if (parts == null) {
this.parts = null;
return;
}
this.parts = new java.util.ArrayList<PartListElement>(parts);
} } | public class class_name {
public void setParts(java.util.Collection<PartListElement> parts) {
if (parts == null) {
this.parts = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.parts = new java.util.ArrayList<PartListElement>(parts);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public boolean updateDoc(Map<String, Object> jsonFields, String collName,
String docId) {
if (mCollections.containsKey(collName)) {
Map<String, Map<String,Object>> collection = mCollections.get(collName);
Map<String, Object> doc = collection.get(docId);
if (doc != null) {
// take care of field updates
Map<String, Object> fields = (Map<String, Object>) jsonFields
.get(DdpMessageField.FIELDS);
if (fields != null) {
for (Map.Entry<String, Object> field : fields
.entrySet()) {
String fieldname = field.getKey();
doc.put(fieldname, field.getValue());
}
}
// take care of clearing fields
List<String> clearfields = ((List<String>) jsonFields.get(DdpMessageField.CLEARED));
if (clearfields != null) {
for (String fieldname : clearfields) {
if (doc.containsKey(fieldname)) {
doc.remove(fieldname);
}
}
}
return true;
}
} else {
log.warn("Received invalid changed msg for collection "
+ collName);
}
return false;
} } | public class class_name {
@SuppressWarnings("unchecked")
public boolean updateDoc(Map<String, Object> jsonFields, String collName,
String docId) {
if (mCollections.containsKey(collName)) {
Map<String, Map<String,Object>> collection = mCollections.get(collName);
Map<String, Object> doc = collection.get(docId);
if (doc != null) {
// take care of field updates
Map<String, Object> fields = (Map<String, Object>) jsonFields
.get(DdpMessageField.FIELDS);
if (fields != null) {
for (Map.Entry<String, Object> field : fields
.entrySet()) {
String fieldname = field.getKey();
doc.put(fieldname, field.getValue()); // depends on control dependency: [for], data = [field]
}
}
// take care of clearing fields
List<String> clearfields = ((List<String>) jsonFields.get(DdpMessageField.CLEARED));
if (clearfields != null) {
for (String fieldname : clearfields) {
if (doc.containsKey(fieldname)) {
doc.remove(fieldname); // depends on control dependency: [if], data = [none]
}
}
}
return true; // depends on control dependency: [if], data = [none]
}
} else {
log.warn("Received invalid changed msg for collection "
+ collName); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static String getDefaultSSLSocketFactory() {
if (defaultSSLSocketFactory == null) {
defaultSSLSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.SocketFactory.provider");
}
});
}
return defaultSSLSocketFactory;
} } | public class class_name {
public static String getDefaultSSLSocketFactory() {
if (defaultSSLSocketFactory == null) {
defaultSSLSocketFactory = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.SocketFactory.provider");
}
}); // depends on control dependency: [if], data = [none]
}
return defaultSSLSocketFactory;
} } |
public class class_name {
private void extend() {
while (!this.extension.empty()) {
final int lit = this.extension.back();
int other;
boolean satisfied = false;
while ((other = this.extension.back()) != 0) {
this.extension.pop();
if (val(other) == VALUE_TRUE) { satisfied = true; }
}
this.extension.pop();
if (!satisfied) { this.vals.set(Math.abs(lit), sign(lit)); }
}
} } | public class class_name {
private void extend() {
while (!this.extension.empty()) {
final int lit = this.extension.back();
int other;
boolean satisfied = false;
while ((other = this.extension.back()) != 0) {
this.extension.pop(); // depends on control dependency: [while], data = [none]
if (val(other) == VALUE_TRUE) { satisfied = true; } // depends on control dependency: [if], data = [none]
}
this.extension.pop(); // depends on control dependency: [while], data = [none]
if (!satisfied) { this.vals.set(Math.abs(lit), sign(lit)); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Paint getLinePaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = linePaint;
}
return paint;
} } | public class class_name {
protected Paint getLinePaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = linePaint; // depends on control dependency: [if], data = [none]
}
return paint;
} } |
public class class_name {
private static Collection<String> toHttpBalancerURIs(Collection<String> uris,
AcceptOptionsContext acceptOptionsCtx,
TransportFactory transportFactory) throws Exception {
List<String> httpURIs = new ArrayList<>(uris.size());
for (String uri : uris) {
Protocol protocol = transportFactory.getProtocol(getScheme(uri));
boolean secure = protocol.isSecure();
for ( int i = 0; i < HTTP_TRANSPORTS.size(); i+=2) {
String httpScheme = secure ? HTTP_TRANSPORTS.get(i) : HTTP_TRANSPORTS.get(i+1); // "httpxe+ssl" : "httpxe";
String httpAuthority = getAuthority(uri);
String httpPath = getPath(uri);
String httpQuery = getQuery(uri);
if (WsProtocol.WS.equals(protocol) || WsProtocol.WSS.equals(protocol)) {
httpURIs.add(buildURIAsString(httpScheme, httpAuthority,
URLUtils.replaceMultipleSlashesWithSingleSlash(httpPath + WsebAcceptor.EMULATED_SUFFIX), httpQuery, null));
// ensure that the accept-options is updated with bindings if they exist for ws and/or wss
// so that the Gateway binds to the correct host:port as per the service configuration.
String internalURI = acceptOptionsCtx.getInternalURI(uri);
if ((internalURI != null) && !internalURI.equals(uri)) {
String authority = getAuthority(internalURI);
acceptOptionsCtx.addBind(httpScheme, authority);
}
}
else if (SseProtocol.SSE.equals(protocol) || SseProtocol.SSE_SSL.equals(protocol) ||
HttpProtocol.HTTP.equals(protocol) || HttpProtocol.HTTPS.equals(protocol)) {
httpURIs.add(buildURIAsString(httpScheme, httpAuthority, httpPath, httpQuery, null));
}
else {
// we do not balance anything other than http, ws and sse
throw new IllegalArgumentException("Invalid protocol in the balancer: " + uri);
}
}
}
return httpURIs;
} } | public class class_name {
private static Collection<String> toHttpBalancerURIs(Collection<String> uris,
AcceptOptionsContext acceptOptionsCtx,
TransportFactory transportFactory) throws Exception {
List<String> httpURIs = new ArrayList<>(uris.size());
for (String uri : uris) {
Protocol protocol = transportFactory.getProtocol(getScheme(uri));
boolean secure = protocol.isSecure();
for ( int i = 0; i < HTTP_TRANSPORTS.size(); i+=2) {
String httpScheme = secure ? HTTP_TRANSPORTS.get(i) : HTTP_TRANSPORTS.get(i+1); // "httpxe+ssl" : "httpxe";
String httpAuthority = getAuthority(uri);
String httpPath = getPath(uri);
String httpQuery = getQuery(uri);
if (WsProtocol.WS.equals(protocol) || WsProtocol.WSS.equals(protocol)) {
httpURIs.add(buildURIAsString(httpScheme, httpAuthority,
URLUtils.replaceMultipleSlashesWithSingleSlash(httpPath + WsebAcceptor.EMULATED_SUFFIX), httpQuery, null)); // depends on control dependency: [if], data = [none]
// ensure that the accept-options is updated with bindings if they exist for ws and/or wss
// so that the Gateway binds to the correct host:port as per the service configuration.
String internalURI = acceptOptionsCtx.getInternalURI(uri);
if ((internalURI != null) && !internalURI.equals(uri)) {
String authority = getAuthority(internalURI);
acceptOptionsCtx.addBind(httpScheme, authority); // depends on control dependency: [if], data = [none]
}
}
else if (SseProtocol.SSE.equals(protocol) || SseProtocol.SSE_SSL.equals(protocol) ||
HttpProtocol.HTTP.equals(protocol) || HttpProtocol.HTTPS.equals(protocol)) {
httpURIs.add(buildURIAsString(httpScheme, httpAuthority, httpPath, httpQuery, null)); // depends on control dependency: [if], data = [none]
}
else {
// we do not balance anything other than http, ws and sse
throw new IllegalArgumentException("Invalid protocol in the balancer: " + uri);
}
}
}
return httpURIs;
} } |
public class class_name {
public static PlainTime from(WallTime time) {
if (time instanceof PlainTime) {
return (PlainTime) time;
} else if (time instanceof PlainTimestamp) {
return ((PlainTimestamp) time).getWallTime();
} else {
return PlainTime.of(
time.getHour(),
time.getMinute(),
time.getSecond(),
time.getNanosecond());
}
} } | public class class_name {
public static PlainTime from(WallTime time) {
if (time instanceof PlainTime) {
return (PlainTime) time; // depends on control dependency: [if], data = [none]
} else if (time instanceof PlainTimestamp) {
return ((PlainTimestamp) time).getWallTime(); // depends on control dependency: [if], data = [none]
} else {
return PlainTime.of(
time.getHour(),
time.getMinute(),
time.getSecond(),
time.getNanosecond()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final EObject entryRuleNotExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleNotExpression = null;
try {
// InternalSimpleAntlr.g:1078:2: (iv_ruleNotExpression= ruleNotExpression EOF )
// InternalSimpleAntlr.g:1079:2: iv_ruleNotExpression= ruleNotExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getNotExpressionRule());
}
pushFollow(FOLLOW_1);
iv_ruleNotExpression=ruleNotExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleNotExpression;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject entryRuleNotExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleNotExpression = null;
try {
// InternalSimpleAntlr.g:1078:2: (iv_ruleNotExpression= ruleNotExpression EOF )
// InternalSimpleAntlr.g:1079:2: iv_ruleNotExpression= ruleNotExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getNotExpressionRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleNotExpression=ruleNotExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleNotExpression; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private void checkIfLombokClass(ImportTree tree) {
String importStr = fullQualifiedName(tree.qualifiedIdentifier());
if (importStr.contains("lombok")) {
lombokClass = true;
}
} } | public class class_name {
private void checkIfLombokClass(ImportTree tree) {
String importStr = fullQualifiedName(tree.qualifiedIdentifier());
if (importStr.contains("lombok")) {
lombokClass = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int findOrInsertWeakNode(int index, int weight16, int level) {
assert(0 <= index && index < nodes.size());
assert(Collator.SECONDARY <= level && level <= Collator.TERTIARY);
if(weight16 == Collation.COMMON_WEIGHT16) {
return findCommonNode(index, level);
}
// If this will be the first below-common weight for the parent node,
// then we will also need to insert a common weight after it.
long node = nodes.elementAti(index);
assert(strengthFromNode(node) < level); // parent node is stronger
if(weight16 != 0 && weight16 < Collation.COMMON_WEIGHT16) {
int hasThisLevelBefore = level == Collator.SECONDARY ? HAS_BEFORE2 : HAS_BEFORE3;
if((node & hasThisLevelBefore) == 0) {
// The parent node has an implied level-common weight.
long commonNode =
nodeFromWeight16(Collation.COMMON_WEIGHT16) | nodeFromStrength(level);
if(level == Collator.SECONDARY) {
// Move the HAS_BEFORE3 flag from the parent node
// to the new secondary common node.
commonNode |= node & HAS_BEFORE3;
node &= ~(long)HAS_BEFORE3;
}
nodes.setElementAt(node | hasThisLevelBefore, index);
// Insert below-common-weight node.
int nextIndex = nextIndexFromNode(node);
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
index = insertNodeBetween(index, nextIndex, node);
// Insert common-weight node.
insertNodeBetween(index, nextIndex, commonNode);
// Return index of below-common-weight node.
return index;
}
}
// Find the root CE's weight for this level.
// Postpone insertion if not found:
// Insert the new root node before the next stronger node,
// or before the next root node with the same strength and a larger weight.
int nextIndex;
while((nextIndex = nextIndexFromNode(node)) != 0) {
node = nodes.elementAti(nextIndex);
int nextStrength = strengthFromNode(node);
if(nextStrength <= level) {
// Insert before a stronger node.
if(nextStrength < level) { break; }
// nextStrength == level
if(!isTailoredNode(node)) {
int nextWeight16 = weight16FromNode(node);
if(nextWeight16 == weight16) {
// Found the node for the root CE up to this level.
return nextIndex;
}
// Insert before a node with a larger same-strength weight.
if(nextWeight16 > weight16) { break; }
}
}
// Skip the next node.
index = nextIndex;
}
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
return insertNodeBetween(index, nextIndex, node);
} } | public class class_name {
private int findOrInsertWeakNode(int index, int weight16, int level) {
assert(0 <= index && index < nodes.size());
assert(Collator.SECONDARY <= level && level <= Collator.TERTIARY);
if(weight16 == Collation.COMMON_WEIGHT16) {
return findCommonNode(index, level); // depends on control dependency: [if], data = [none]
}
// If this will be the first below-common weight for the parent node,
// then we will also need to insert a common weight after it.
long node = nodes.elementAti(index);
assert(strengthFromNode(node) < level); // parent node is stronger
if(weight16 != 0 && weight16 < Collation.COMMON_WEIGHT16) {
int hasThisLevelBefore = level == Collator.SECONDARY ? HAS_BEFORE2 : HAS_BEFORE3;
if((node & hasThisLevelBefore) == 0) {
// The parent node has an implied level-common weight.
long commonNode =
nodeFromWeight16(Collation.COMMON_WEIGHT16) | nodeFromStrength(level);
if(level == Collator.SECONDARY) {
// Move the HAS_BEFORE3 flag from the parent node
// to the new secondary common node.
commonNode |= node & HAS_BEFORE3; // depends on control dependency: [if], data = [none]
node &= ~(long)HAS_BEFORE3; // depends on control dependency: [if], data = [none]
}
nodes.setElementAt(node | hasThisLevelBefore, index); // depends on control dependency: [if], data = [none]
// Insert below-common-weight node.
int nextIndex = nextIndexFromNode(node);
node = nodeFromWeight16(weight16) | nodeFromStrength(level); // depends on control dependency: [if], data = [none]
index = insertNodeBetween(index, nextIndex, node); // depends on control dependency: [if], data = [none]
// Insert common-weight node.
insertNodeBetween(index, nextIndex, commonNode); // depends on control dependency: [if], data = [none]
// Return index of below-common-weight node.
return index; // depends on control dependency: [if], data = [none]
}
}
// Find the root CE's weight for this level.
// Postpone insertion if not found:
// Insert the new root node before the next stronger node,
// or before the next root node with the same strength and a larger weight.
int nextIndex;
while((nextIndex = nextIndexFromNode(node)) != 0) {
node = nodes.elementAti(nextIndex); // depends on control dependency: [while], data = [none]
int nextStrength = strengthFromNode(node);
if(nextStrength <= level) {
// Insert before a stronger node.
if(nextStrength < level) { break; }
// nextStrength == level
if(!isTailoredNode(node)) {
int nextWeight16 = weight16FromNode(node);
if(nextWeight16 == weight16) {
// Found the node for the root CE up to this level.
return nextIndex; // depends on control dependency: [if], data = [none]
}
// Insert before a node with a larger same-strength weight.
if(nextWeight16 > weight16) { break; }
}
}
// Skip the next node.
index = nextIndex; // depends on control dependency: [while], data = [none]
}
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
return insertNodeBetween(index, nextIndex, node);
} } |
public class class_name {
public static int addMonths(int date, int m) {
int y0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.YEAR, date);
int m0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.MONTH, date);
int d0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.DAY, date);
int y = m / 12;
y0 += y;
m0 += m - y * 12;
int last = lastDay(y0, m0);
if (d0 > last) {
d0 = 1;
if (++m0 > 12) {
m0 = 1;
++y0;
}
}
return DateTimeUtils.ymdToUnixDate(y0, m0, d0);
} } | public class class_name {
public static int addMonths(int date, int m) {
int y0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.YEAR, date);
int m0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.MONTH, date);
int d0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.DAY, date);
int y = m / 12;
y0 += y;
m0 += m - y * 12;
int last = lastDay(y0, m0);
if (d0 > last) {
d0 = 1; // depends on control dependency: [if], data = [none]
if (++m0 > 12) {
m0 = 1; // depends on control dependency: [if], data = [none]
++y0; // depends on control dependency: [if], data = [none]
}
}
return DateTimeUtils.ymdToUnixDate(y0, m0, d0);
} } |
public class class_name {
private static final Date stripDatesAfterCurrentDate(final Date toDate) {
final DateTime currentTime = new DateTime();
if (currentTime.isBefore(toDate.getTime())) {
return currentTime.plusDays(1).toDate();
} else {
return toDate;
}
} } | public class class_name {
private static final Date stripDatesAfterCurrentDate(final Date toDate) {
final DateTime currentTime = new DateTime();
if (currentTime.isBefore(toDate.getTime())) {
return currentTime.plusDays(1).toDate(); // depends on control dependency: [if], data = [none]
} else {
return toDate; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final void error(Object message, Throwable t) {
if (isLevelEnabled(LOG_LEVEL_ERROR)) {
log(LOG_LEVEL_ERROR, message, t);
}
} } | public class class_name {
public final void error(Object message, Throwable t) {
if (isLevelEnabled(LOG_LEVEL_ERROR)) {
log(LOG_LEVEL_ERROR, message, t); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void parseConfiguration(List<String> functionsToInspect) {
for (String function : functionsToInspect) {
Config config = parseConfiguration(function);
functions.put(config.name, config);
String method = getMethodFromDeclarationName(config.name);
if (method != null) {
methods.put(method, config.name);
}
}
} } | public class class_name {
private void parseConfiguration(List<String> functionsToInspect) {
for (String function : functionsToInspect) {
Config config = parseConfiguration(function);
functions.put(config.name, config); // depends on control dependency: [for], data = [function]
String method = getMethodFromDeclarationName(config.name);
if (method != null) {
methods.put(method, config.name); // depends on control dependency: [if], data = [(method]
}
}
} } |
public class class_name {
public boolean shouldClearAll(List<CmsPublishedResource> publishedResources) {
for (CmsPublishedResource pubRes : publishedResources) {
for (String clearPath : m_clearAll) {
if (CmsStringUtil.isPrefixPath(clearPath, pubRes.getRootPath())) {
return true;
}
}
}
return false;
} } | public class class_name {
public boolean shouldClearAll(List<CmsPublishedResource> publishedResources) {
for (CmsPublishedResource pubRes : publishedResources) {
for (String clearPath : m_clearAll) {
if (CmsStringUtil.isPrefixPath(clearPath, pubRes.getRootPath())) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
@Override
public void evaluate(DoubleSolution solution) {
int numberOfVariables = getNumberOfVariables() ;
double[] x = new double[numberOfVariables] ;
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i) ;
}
double sum = 0.0;
double mult = 1.0;
double d = 4000.0;
for (int var = 0; var < numberOfVariables; var++) {
sum += x[var] * x[var];
mult *= Math.cos(x[var] / Math.sqrt(var + 1));
}
solution.setObjective(0, 1.0 / d * sum - mult + 1.0);
} } | public class class_name {
@Override
public void evaluate(DoubleSolution solution) {
int numberOfVariables = getNumberOfVariables() ;
double[] x = new double[numberOfVariables] ;
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i) ; // depends on control dependency: [for], data = [i]
}
double sum = 0.0;
double mult = 1.0;
double d = 4000.0;
for (int var = 0; var < numberOfVariables; var++) {
sum += x[var] * x[var]; // depends on control dependency: [for], data = [var]
mult *= Math.cos(x[var] / Math.sqrt(var + 1)); // depends on control dependency: [for], data = [var]
}
solution.setObjective(0, 1.0 / d * sum - mult + 1.0);
} } |
public class class_name {
public void setMinuteTickMarkColor(final Color COLOR) {
if (null == minuteTickMarkColor) {
_minuteTickMarkColor = COLOR;
fireUpdateEvent(REDRAW_EVENT);
} else {
minuteTickMarkColor.set(COLOR);
}
} } | public class class_name {
public void setMinuteTickMarkColor(final Color COLOR) {
if (null == minuteTickMarkColor) {
_minuteTickMarkColor = COLOR; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
minuteTickMarkColor.set(COLOR); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void clearJavaKeyStoresFromKeyStoreMap(Collection<File> modifiedFiles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "clearJavaKeyStoresFromKeyStoreMap ", new Object[] { modifiedFiles });
String filePath = null;
String comparePath = null;
for (File modifiedKeystoreFile : modifiedFiles) {
try {
filePath = modifiedKeystoreFile.getCanonicalPath();
comparePath = filePath.replace('\\', '/');
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception comparing file path.");
continue;
}
findKeyStoreInMapAndClear(comparePath);
}
} } | public class class_name {
public void clearJavaKeyStoresFromKeyStoreMap(Collection<File> modifiedFiles) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "clearJavaKeyStoresFromKeyStoreMap ", new Object[] { modifiedFiles });
String filePath = null;
String comparePath = null;
for (File modifiedKeystoreFile : modifiedFiles) {
try {
filePath = modifiedKeystoreFile.getCanonicalPath(); // depends on control dependency: [try], data = [none]
comparePath = filePath.replace('\\', '/'); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception comparing file path.");
continue;
} // depends on control dependency: [catch], data = [none]
findKeyStoreInMapAndClear(comparePath); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private String getRow(String rowKey) {
try {
return cache.get(rowKey);
} catch (Exception e) {
if (e.getCause() instanceof RowNotFoundException) {
return null;
}
throw new RuntimeException(e);
}
} } | public class class_name {
private String getRow(String rowKey) {
try {
return cache.get(rowKey); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (e.getCause() instanceof RowNotFoundException) {
return null; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private @Nonnull List<SortableValue> enumsThatExist(BugAspects a) {
List<Sortables> orderBeforeDivider = st.getOrderBeforeDivider();
if (orderBeforeDivider.size() == 0) {
List<SortableValue> result = Collections.emptyList();
assert false;
return result;
}
Sortables key;
if (a.size() == 0) {
key = orderBeforeDivider.get(0);
} else {
Sortables lastKey = a.last().key;
int index = orderBeforeDivider.indexOf(lastKey);
if (index + 1 < orderBeforeDivider.size()) {
key = orderBeforeDivider.get(index + 1);
} else {
key = lastKey;
}
}
String[] all = key.getAll(bugSet.query(a));
ArrayList<SortableValue> result = new ArrayList<>(all.length);
for (String i : all) {
result.add(new SortableValue(key, i));
}
return result;
} } | public class class_name {
private @Nonnull List<SortableValue> enumsThatExist(BugAspects a) {
List<Sortables> orderBeforeDivider = st.getOrderBeforeDivider();
if (orderBeforeDivider.size() == 0) {
List<SortableValue> result = Collections.emptyList();
assert false;
return result; // depends on control dependency: [if], data = [none]
}
Sortables key;
if (a.size() == 0) {
key = orderBeforeDivider.get(0); // depends on control dependency: [if], data = [0)]
} else {
Sortables lastKey = a.last().key;
int index = orderBeforeDivider.indexOf(lastKey);
if (index + 1 < orderBeforeDivider.size()) {
key = orderBeforeDivider.get(index + 1); // depends on control dependency: [if], data = [(index + 1]
} else {
key = lastKey; // depends on control dependency: [if], data = [none]
}
}
String[] all = key.getAll(bugSet.query(a));
ArrayList<SortableValue> result = new ArrayList<>(all.length);
for (String i : all) {
result.add(new SortableValue(key, i)); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public static InstagramErrorResponse parse(Gson gson, String json) {
JsonElement jsonElement = gson.fromJson(json, JsonElement.class);
JsonElement metaMember = null;
if (jsonElement != null) {
metaMember = jsonElement.getAsJsonObject().get("meta");
}
final Meta meta;
if (metaMember != null) {
meta = gson.fromJson(metaMember, Meta.class);
} else {
meta = gson.fromJson(jsonElement, Meta.class);
}
// Validate meta
if (meta.getCode() != 0 && meta.getErrorType() != null) {
return new InstagramErrorResponse(meta);
} else {
return new InstagramErrorResponse(null);
}
} } | public class class_name {
public static InstagramErrorResponse parse(Gson gson, String json) {
JsonElement jsonElement = gson.fromJson(json, JsonElement.class);
JsonElement metaMember = null;
if (jsonElement != null) {
metaMember = jsonElement.getAsJsonObject().get("meta"); // depends on control dependency: [if], data = [none]
}
final Meta meta;
if (metaMember != null) {
meta = gson.fromJson(metaMember, Meta.class); // depends on control dependency: [if], data = [(metaMember]
} else {
meta = gson.fromJson(jsonElement, Meta.class); // depends on control dependency: [if], data = [none]
}
// Validate meta
if (meta.getCode() != 0 && meta.getErrorType() != null) {
return new InstagramErrorResponse(meta); // depends on control dependency: [if], data = [none]
} else {
return new InstagramErrorResponse(null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@DefaultVisibilityForTesting
static TraceComponent loadTraceComponent(@Nullable ClassLoader classLoader) {
try {
// Call Class.forName with literal string name of the class to help shading tools.
return Provider.createInstance(
Class.forName(
"io.opencensus.impl.trace.TraceComponentImpl", /*initialize=*/ true, classLoader),
TraceComponent.class);
} catch (ClassNotFoundException e) {
logger.log(
Level.FINE,
"Couldn't load full implementation for TraceComponent, now trying to load lite "
+ "implementation.",
e);
}
try {
// Call Class.forName with literal string name of the class to help shading tools.
return Provider.createInstance(
Class.forName(
"io.opencensus.impllite.trace.TraceComponentImplLite",
/*initialize=*/ true,
classLoader),
TraceComponent.class);
} catch (ClassNotFoundException e) {
logger.log(
Level.FINE,
"Couldn't load lite implementation for TraceComponent, now using "
+ "default implementation for TraceComponent.",
e);
}
return TraceComponent.newNoopTraceComponent();
} } | public class class_name {
@DefaultVisibilityForTesting
static TraceComponent loadTraceComponent(@Nullable ClassLoader classLoader) {
try {
// Call Class.forName with literal string name of the class to help shading tools.
return Provider.createInstance(
Class.forName(
"io.opencensus.impl.trace.TraceComponentImpl", /*initialize=*/ true, classLoader),
TraceComponent.class); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
logger.log(
Level.FINE,
"Couldn't load full implementation for TraceComponent, now trying to load lite "
+ "implementation.",
e);
}
try {
// Call Class.forName with literal string name of the class to help shading tools.
return Provider.createInstance(
Class.forName(
"io.opencensus.impllite.trace.TraceComponentImplLite",
/*initialize=*/ true,
classLoader),
TraceComponent.class);
} catch (ClassNotFoundException e) {
logger.log(
Level.FINE,
"Couldn't load lite implementation for TraceComponent, now using "
+ "default implementation for TraceComponent.",
e);
} // depends on control dependency: [catch], data = [none]
return TraceComponent.newNoopTraceComponent();
} } |
public class class_name {
private View getViewOnRecyclerItemIndex(ViewGroup recyclerView, int recyclerViewIndex, int itemIndex){
final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout();
View view = recyclerView.getChildAt(itemIndex);
while(view == null){
final boolean timedOut = SystemClock.uptimeMillis() > endTime;
if (timedOut){
Assert.fail("View is null and can therefore not be clicked!");
}
sleeper.sleep();
recyclerView = (ViewGroup) viewFetcher.getIdenticalView(recyclerView);
if(recyclerView == null){
recyclerView = (ViewGroup) viewFetcher.getRecyclerView(false, recyclerViewIndex);
}
if(recyclerView != null){
view = recyclerView.getChildAt(itemIndex);
}
}
return view;
} } | public class class_name {
private View getViewOnRecyclerItemIndex(ViewGroup recyclerView, int recyclerViewIndex, int itemIndex){
final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout();
View view = recyclerView.getChildAt(itemIndex);
while(view == null){
final boolean timedOut = SystemClock.uptimeMillis() > endTime;
if (timedOut){
Assert.fail("View is null and can therefore not be clicked!"); // depends on control dependency: [if], data = [none]
}
sleeper.sleep(); // depends on control dependency: [while], data = [none]
recyclerView = (ViewGroup) viewFetcher.getIdenticalView(recyclerView); // depends on control dependency: [while], data = [none]
if(recyclerView == null){
recyclerView = (ViewGroup) viewFetcher.getRecyclerView(false, recyclerViewIndex); // depends on control dependency: [if], data = [none]
}
if(recyclerView != null){
view = recyclerView.getChildAt(itemIndex); // depends on control dependency: [if], data = [none]
}
}
return view;
} } |
public class class_name {
static final Memory loadCompactMemory(final long[] compactCache, final short seedHash,
final int curCount, final long thetaLong, final WritableMemory dstMem,
final byte flags, final int preLongs) {
assert (dstMem != null) && (compactCache != null);
final int outLongs = preLongs + curCount;
final int outBytes = outLongs << 3;
final int dstBytes = (int) dstMem.getCapacity();
if (outBytes > dstBytes) {
throw new SketchesArgumentException("Insufficient Memory: " + dstBytes
+ ", Need: " + outBytes);
}
final byte famID = (byte) Family.COMPACT.getID();
insertPreLongs(dstMem, preLongs); //RF not used = 0
insertSerVer(dstMem, SER_VER);
insertFamilyID(dstMem, famID);
//ignore lgNomLongs, lgArrLongs bytes for compact sketches
insertFlags(dstMem, flags);
insertSeedHash(dstMem, seedHash);
if ((preLongs == 1) && (curCount == 1)) { //singleItem
dstMem.putLong(8, compactCache[0]);
return dstMem;
}
if (preLongs > 1) {
insertCurCount(dstMem, curCount);
insertP(dstMem, (float) 1.0);
}
if (preLongs > 2) {
insertThetaLong(dstMem, thetaLong);
}
if (curCount > 0) {
dstMem.putLongArray(preLongs << 3, compactCache, 0, curCount);
}
return dstMem;
} } | public class class_name {
static final Memory loadCompactMemory(final long[] compactCache, final short seedHash,
final int curCount, final long thetaLong, final WritableMemory dstMem,
final byte flags, final int preLongs) {
assert (dstMem != null) && (compactCache != null);
final int outLongs = preLongs + curCount;
final int outBytes = outLongs << 3;
final int dstBytes = (int) dstMem.getCapacity();
if (outBytes > dstBytes) {
throw new SketchesArgumentException("Insufficient Memory: " + dstBytes
+ ", Need: " + outBytes);
}
final byte famID = (byte) Family.COMPACT.getID();
insertPreLongs(dstMem, preLongs); //RF not used = 0
insertSerVer(dstMem, SER_VER);
insertFamilyID(dstMem, famID);
//ignore lgNomLongs, lgArrLongs bytes for compact sketches
insertFlags(dstMem, flags);
insertSeedHash(dstMem, seedHash);
if ((preLongs == 1) && (curCount == 1)) { //singleItem
dstMem.putLong(8, compactCache[0]); // depends on control dependency: [if], data = [none]
return dstMem; // depends on control dependency: [if], data = [none]
}
if (preLongs > 1) {
insertCurCount(dstMem, curCount); // depends on control dependency: [if], data = [none]
insertP(dstMem, (float) 1.0); // depends on control dependency: [if], data = [none]
}
if (preLongs > 2) {
insertThetaLong(dstMem, thetaLong); // depends on control dependency: [if], data = [none]
}
if (curCount > 0) {
dstMem.putLongArray(preLongs << 3, compactCache, 0, curCount); // depends on control dependency: [if], data = [none]
}
return dstMem;
} } |
public class class_name {
protected long discountEstimatedProcessedTupleCount(AbstractPlanNode childNode) {
// Discount estimated processed tuple count for the outer child based on the number of
// filter expressions this child has with a rapidly diminishing effect
// that ranges from a discount of 0.09 (ORETATION_EQAUL)
// or 0.045 (all other expression types) for one post filter to a max discount approaching
// 0.888... (=8/9) for many EQUALITY filters.
// The discount value is less than the partial index discount (0.1) to make sure
// the index wins
AbstractExpression predicate = null;
if (childNode instanceof AbstractScanPlanNode) {
predicate = ((AbstractScanPlanNode) childNode).getPredicate();
} else if (childNode instanceof NestLoopPlanNode) {
predicate = ((NestLoopPlanNode) childNode).getWherePredicate();
} else if (childNode instanceof NestLoopIndexPlanNode) {
AbstractPlanNode inlineIndexScan = ((NestLoopIndexPlanNode) childNode).getInlinePlanNode(PlanNodeType.INDEXSCAN);
assert(inlineIndexScan != null);
predicate = ((AbstractScanPlanNode) inlineIndexScan).getPredicate();
} else {
return childNode.getEstimatedProcessedTupleCount();
}
if (predicate == null) {
return childNode.getEstimatedProcessedTupleCount();
}
List<AbstractExpression> predicateExprs = ExpressionUtil.uncombinePredicate(predicate);
// Counters to count the number of equality and all other expressions
int eqCount = 0;
int otherCount = 0;
final double MAX_EQ_POST_FILTER_DISCOUNT = 0.09;
final double MAX_OTHER_POST_FILTER_DISCOUNT = 0.045;
double discountCountFactor = 1.0;
// Discount tuple count.
for (AbstractExpression predicateExpr: predicateExprs) {
if (ExpressionType.COMPARE_EQUAL == predicateExpr.getExpressionType()) {
discountCountFactor -= Math.pow(MAX_EQ_POST_FILTER_DISCOUNT, ++eqCount);
} else {
discountCountFactor -= Math.pow(MAX_OTHER_POST_FILTER_DISCOUNT, ++otherCount);
}
}
return (long) (childNode.getEstimatedProcessedTupleCount() * discountCountFactor);
} } | public class class_name {
protected long discountEstimatedProcessedTupleCount(AbstractPlanNode childNode) {
// Discount estimated processed tuple count for the outer child based on the number of
// filter expressions this child has with a rapidly diminishing effect
// that ranges from a discount of 0.09 (ORETATION_EQAUL)
// or 0.045 (all other expression types) for one post filter to a max discount approaching
// 0.888... (=8/9) for many EQUALITY filters.
// The discount value is less than the partial index discount (0.1) to make sure
// the index wins
AbstractExpression predicate = null;
if (childNode instanceof AbstractScanPlanNode) {
predicate = ((AbstractScanPlanNode) childNode).getPredicate(); // depends on control dependency: [if], data = [none]
} else if (childNode instanceof NestLoopPlanNode) {
predicate = ((NestLoopPlanNode) childNode).getWherePredicate(); // depends on control dependency: [if], data = [none]
} else if (childNode instanceof NestLoopIndexPlanNode) {
AbstractPlanNode inlineIndexScan = ((NestLoopIndexPlanNode) childNode).getInlinePlanNode(PlanNodeType.INDEXSCAN);
assert(inlineIndexScan != null); // depends on control dependency: [if], data = [none]
predicate = ((AbstractScanPlanNode) inlineIndexScan).getPredicate(); // depends on control dependency: [if], data = [none]
} else {
return childNode.getEstimatedProcessedTupleCount(); // depends on control dependency: [if], data = [none]
}
if (predicate == null) {
return childNode.getEstimatedProcessedTupleCount(); // depends on control dependency: [if], data = [none]
}
List<AbstractExpression> predicateExprs = ExpressionUtil.uncombinePredicate(predicate);
// Counters to count the number of equality and all other expressions
int eqCount = 0;
int otherCount = 0;
final double MAX_EQ_POST_FILTER_DISCOUNT = 0.09;
final double MAX_OTHER_POST_FILTER_DISCOUNT = 0.045;
double discountCountFactor = 1.0;
// Discount tuple count.
for (AbstractExpression predicateExpr: predicateExprs) {
if (ExpressionType.COMPARE_EQUAL == predicateExpr.getExpressionType()) {
discountCountFactor -= Math.pow(MAX_EQ_POST_FILTER_DISCOUNT, ++eqCount); // depends on control dependency: [if], data = [none]
} else {
discountCountFactor -= Math.pow(MAX_OTHER_POST_FILTER_DISCOUNT, ++otherCount); // depends on control dependency: [if], data = [none]
}
}
return (long) (childNode.getEstimatedProcessedTupleCount() * discountCountFactor);
} } |
public class class_name {
public static Map<String, Object> getReadOnlyCacheMap() { // for framework
if (!exists()) {
return DfCollectionUtil.emptyMap();
}
return Collections.unmodifiableMap(threadLocal.get());
} } | public class class_name {
public static Map<String, Object> getReadOnlyCacheMap() { // for framework
if (!exists()) {
return DfCollectionUtil.emptyMap(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableMap(threadLocal.get());
} } |
public class class_name {
public void releaseAllResources()
{
synchronized (poolSynch)
{
Collection pools = poolMap.values();
poolMap = new HashMap(poolMap.size());
ObjectPool op = null;
for (Iterator iterator = pools.iterator(); iterator.hasNext();)
{
try
{
op = ((ObjectPool) iterator.next());
op.close();
}
catch (Exception e)
{
log.error("Exception occured while closing pool " + op, e);
}
}
}
super.releaseAllResources();
} } | public class class_name {
public void releaseAllResources()
{
synchronized (poolSynch)
{
Collection pools = poolMap.values();
poolMap = new HashMap(poolMap.size());
ObjectPool op = null;
for (Iterator iterator = pools.iterator(); iterator.hasNext();)
{
try
{
op = ((ObjectPool) iterator.next());
// depends on control dependency: [try], data = [none]
op.close();
// depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error("Exception occured while closing pool " + op, e);
}
// depends on control dependency: [catch], data = [none]
}
}
super.releaseAllResources();
} } |
public class class_name {
private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) {
byte[] data = profile.getData(tagSignature);
// The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..?
if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) {
intToBigEndian(ICC_Profile.icSigXYZData, data, 0);
profile.setData(tagSignature, data);
return true;
}
return false;
} } | public class class_name {
private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) {
byte[] data = profile.getData(tagSignature);
// The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..?
if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) {
intToBigEndian(ICC_Profile.icSigXYZData, data, 0); // depends on control dependency: [if], data = [none]
profile.setData(tagSignature, data); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public Iterable<ActionImport> build(FactoryLookup lookup) {
List<ActionImport> actionImports = new ArrayList<>();
for (ActionImportImpl.Builder actionImportBuilder : actionImportBuilders) {
actionImportBuilder.setEntitySet(
lookup.getEntitySet(actionImportBuilder.getEntitySetName()));
actionImportBuilder.setAction(
lookup.getAction(actionImportBuilder.getActionName()));
actionImports.add(actionImportBuilder.build());
}
return Collections.unmodifiableList(actionImports);
} } | public class class_name {
public Iterable<ActionImport> build(FactoryLookup lookup) {
List<ActionImport> actionImports = new ArrayList<>();
for (ActionImportImpl.Builder actionImportBuilder : actionImportBuilders) {
actionImportBuilder.setEntitySet(
lookup.getEntitySet(actionImportBuilder.getEntitySetName())); // depends on control dependency: [for], data = [actionImportBuilder]
actionImportBuilder.setAction(
lookup.getAction(actionImportBuilder.getActionName())); // depends on control dependency: [for], data = [actionImportBuilder]
actionImports.add(actionImportBuilder.build()); // depends on control dependency: [for], data = [actionImportBuilder]
}
return Collections.unmodifiableList(actionImports);
} } |
public class class_name {
public SQLBuilder set(final Object entity, final Set<String> excludedPropNames) {
if (entity instanceof String) {
return set(N.asArray((String) entity));
} else if (entity instanceof Map) {
if (N.isNullOrEmpty(excludedPropNames)) {
return set((Map<String, Object>) entity);
} else {
final Map<String, Object> props = new LinkedHashMap<>((Map<String, Object>) entity);
Maps.removeKeys(props, excludedPropNames);
return set(props);
}
} else {
final Class<?> entityClass = entity.getClass();
this.entityClass = entityClass;
final Collection<String> propNames = getUpdatePropNamesByClass(entityClass, excludedPropNames);
final Set<String> dirtyPropNames = N.isDirtyMarker(entityClass) ? ((DirtyMarker) entity).dirtyPropNames() : null;
final Map<String, Object> props = N.newHashMap(N.initHashCapacity(N.isNullOrEmpty(dirtyPropNames) ? propNames.size() : dirtyPropNames.size()));
for (String propName : propNames) {
if (N.isNullOrEmpty(dirtyPropNames) || dirtyPropNames.contains(propName)) {
props.put(propName, ClassUtil.getPropValue(entity, propName));
}
}
return set(props);
}
} } | public class class_name {
public SQLBuilder set(final Object entity, final Set<String> excludedPropNames) {
if (entity instanceof String) {
return set(N.asArray((String) entity));
// depends on control dependency: [if], data = [none]
} else if (entity instanceof Map) {
if (N.isNullOrEmpty(excludedPropNames)) {
return set((Map<String, Object>) entity);
// depends on control dependency: [if], data = [none]
} else {
final Map<String, Object> props = new LinkedHashMap<>((Map<String, Object>) entity);
Maps.removeKeys(props, excludedPropNames);
// depends on control dependency: [if], data = [none]
return set(props);
// depends on control dependency: [if], data = [none]
}
} else {
final Class<?> entityClass = entity.getClass();
this.entityClass = entityClass;
// depends on control dependency: [if], data = [none]
final Collection<String> propNames = getUpdatePropNamesByClass(entityClass, excludedPropNames);
final Set<String> dirtyPropNames = N.isDirtyMarker(entityClass) ? ((DirtyMarker) entity).dirtyPropNames() : null;
final Map<String, Object> props = N.newHashMap(N.initHashCapacity(N.isNullOrEmpty(dirtyPropNames) ? propNames.size() : dirtyPropNames.size()));
for (String propName : propNames) {
if (N.isNullOrEmpty(dirtyPropNames) || dirtyPropNames.contains(propName)) {
props.put(propName, ClassUtil.getPropValue(entity, propName));
// depends on control dependency: [if], data = [none]
}
}
return set(props);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public byte[] decrypt(byte[] msg) {
if (msg == null) return null;
try {
Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM_IMPLEMENTATION);
SecretKeySpec key = new SecretKeySpec(getMd5(), ENCRYPTION_ALGORITHM);
IvParameterSpec iv = new IvParameterSpec(getIv());
cipher.init(Cipher.DECRYPT_MODE, key, iv);
return cipher.doFinal(msg);
} catch (Exception e) {
return null;
}
} } | public class class_name {
public byte[] decrypt(byte[] msg) {
if (msg == null) return null;
try {
Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM_IMPLEMENTATION);
SecretKeySpec key = new SecretKeySpec(getMd5(), ENCRYPTION_ALGORITHM);
IvParameterSpec iv = new IvParameterSpec(getIv());
cipher.init(Cipher.DECRYPT_MODE, key, iv); // depends on control dependency: [try], data = [none]
return cipher.doFinal(msg); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Record []
run() {
if (done)
reset();
if (name.isAbsolute())
resolve(name, null);
else if (searchPath == null)
resolve(name, Name.root);
else {
if (name.labels() > defaultNdots)
resolve(name, Name.root);
if (done)
return answers;
for (int i = 0; i < searchPath.length; i++) {
resolve(name, searchPath[i]);
if (done)
return answers;
else if (foundAlias)
break;
}
}
if (!done) {
if (badresponse) {
result = TRY_AGAIN;
error = badresponse_error;
done = true;
} else if (timedout) {
result = TRY_AGAIN;
error = "timed out";
done = true;
} else if (networkerror) {
result = TRY_AGAIN;
error = "network error";
done = true;
} else if (nxdomain) {
result = HOST_NOT_FOUND;
done = true;
} else if (referral) {
result = UNRECOVERABLE;
error = "referral";
done = true;
} else if (nametoolong) {
result = UNRECOVERABLE;
error = "name too long";
done = true;
}
}
return answers;
} } | public class class_name {
public Record []
run() {
if (done)
reset();
if (name.isAbsolute())
resolve(name, null);
else if (searchPath == null)
resolve(name, Name.root);
else {
if (name.labels() > defaultNdots)
resolve(name, Name.root);
if (done)
return answers;
for (int i = 0; i < searchPath.length; i++) {
resolve(name, searchPath[i]); // depends on control dependency: [for], data = [i]
if (done)
return answers;
else if (foundAlias)
break;
}
}
if (!done) {
if (badresponse) {
result = TRY_AGAIN; // depends on control dependency: [if], data = [none]
error = badresponse_error; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
} else if (timedout) {
result = TRY_AGAIN; // depends on control dependency: [if], data = [none]
error = "timed out"; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
} else if (networkerror) {
result = TRY_AGAIN; // depends on control dependency: [if], data = [none]
error = "network error"; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
} else if (nxdomain) {
result = HOST_NOT_FOUND; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
} else if (referral) {
result = UNRECOVERABLE; // depends on control dependency: [if], data = [none]
error = "referral"; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
} else if (nametoolong) {
result = UNRECOVERABLE; // depends on control dependency: [if], data = [none]
error = "name too long"; // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
}
}
return answers;
} } |
public class class_name {
private void traverseTransientDescendants(ItemData parent, int action, List<ItemState> ret)
throws RepositoryException
{
if (parent.isNode())
{
if (action != MERGE_PROPS)
{
Collection<ItemState> childNodes = changesLog.getLastChildrenStates(parent, true);
for (ItemState childNode : childNodes)
{
ret.add(childNode);
}
}
if (action != MERGE_NODES)
{
Collection<ItemState> childProps = changesLog.getLastChildrenStates(parent, false);
for (ItemState childProp : childProps)
{
ret.add(childProp);
}
}
}
} } | public class class_name {
private void traverseTransientDescendants(ItemData parent, int action, List<ItemState> ret)
throws RepositoryException
{
if (parent.isNode())
{
if (action != MERGE_PROPS)
{
Collection<ItemState> childNodes = changesLog.getLastChildrenStates(parent, true);
for (ItemState childNode : childNodes)
{
ret.add(childNode); // depends on control dependency: [for], data = [childNode]
}
}
if (action != MERGE_NODES)
{
Collection<ItemState> childProps = changesLog.getLastChildrenStates(parent, false);
for (ItemState childProp : childProps)
{
ret.add(childProp); // depends on control dependency: [for], data = [childProp]
}
}
}
} } |
public class class_name {
public static Float toFloat(Object value) {
if (value == null) {
return null;
} else if (value instanceof Float) {
return (Float) value;
} else if (value instanceof Number) {
return ((Number) value).floatValue();
} else {
return Float.valueOf(value.toString().trim());
}
} } | public class class_name {
public static Float toFloat(Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (value instanceof Float) {
return (Float) value; // depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
return ((Number) value).floatValue(); // depends on control dependency: [if], data = [none]
} else {
return Float.valueOf(value.toString().trim()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private CmsGallerySearchParameters prepareSearchParams(CmsGallerySearchBean searchData) {
// create a new search parameter object
CmsGallerySearchParameters params = new CmsGallerySearchParameters();
CmsObject cms = getCmsObject();
// set the selected types to the parameters
if (searchData.getServerSearchTypes() != null) {
params.setResourceTypes(searchData.getServerSearchTypes());
}
// set the selected galleries to the parameters
if (searchData.getGalleries() != null) {
List<String> paramGalleries = new ArrayList<String>();
for (String gallerySitePath : searchData.getGalleries()) {
paramGalleries.add(cms.getRequestContext().addSiteRoot(gallerySitePath));
}
params.setGalleries(paramGalleries);
}
// set the sort order for the galleries to the parameters
CmsGallerySearchParameters.CmsGallerySortParam sortOrder;
String temp = searchData.getSortOrder();
try {
sortOrder = CmsGallerySearchParameters.CmsGallerySortParam.valueOf(temp);
} catch (Exception e) {
sortOrder = CmsGallerySearchParameters.CmsGallerySortParam.DEFAULT;
}
params.setSortOrder(sortOrder);
if (searchData.getScope() == null) {
params.setScope(OpenCms.getWorkplaceManager().getGalleryDefaultScope());
} else {
params.setScope(searchData.getScope());
}
params.setReferencePath(searchData.getReferencePath());
// set the selected folders to the parameters
params.setFolders(new ArrayList<String>(searchData.getFolders()));
// set the categories to the parameters
if (searchData.getCategories() != null) {
params.setCategories(searchData.getCategories());
}
// set the search query to the parameters
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchData.getQuery())) {
params.setSearchWords(searchData.getQuery());
}
// set the result page to the parameters
int page = searchData.getPage();
params.setResultPage(page);
// set the locale to the parameters
String locale = searchData.getLocale();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(locale)) {
locale = getCmsObject().getRequestContext().getLocale().toString();
}
params.setSearchLocale(locale);
// set the matches per page to the parameters
params.setMatchesPerPage(searchData.getMatchesPerPage());
// get the date range input
long dateCreatedStart = searchData.getDateCreatedStart();
long dateCreatedEnd = searchData.getDateCreatedEnd();
long dateModifiedStart = searchData.getDateModifiedStart();
long dateModifiedEnd = searchData.getDateModifiedEnd();
// set the date created range to the parameters
if ((dateCreatedStart != -1L) && (dateCreatedEnd != -1L)) {
params.setDateCreatedTimeRange(dateCreatedStart, dateCreatedEnd);
} else if (dateCreatedStart != -1L) {
params.setDateCreatedTimeRange(dateCreatedStart, Long.MAX_VALUE);
} else if (dateCreatedEnd != -1L) {
params.setDateCreatedTimeRange(Long.MIN_VALUE, dateCreatedEnd);
}
// set the date modified range to the parameters
if ((dateModifiedStart != -1L) && (dateModifiedEnd != -1L)) {
params.setDateLastModifiedTimeRange(dateModifiedStart, dateModifiedEnd);
} else if (dateModifiedStart != -1L) {
params.setDateLastModifiedTimeRange(dateModifiedStart, Long.MAX_VALUE);
} else if (dateModifiedEnd != -1L) {
params.setDateLastModifiedTimeRange(Long.MIN_VALUE, dateModifiedEnd);
}
params.setIgnoreSearchExclude(searchData.isIgnoreSearchExclude());
if (GalleryMode.ade.equals(searchData.getGalleryMode())) {
if (searchData.getTypes().isEmpty() || !Collections.disjoint(FUNCTION_TYPES, searchData.getTypes())) {
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.getRequestContext().addSiteRoot(searchData.getReferencePath()));
// in case a restricted set of functions is configured, remove all other functions
params.setAllowedFunctions(config.getDynamicFunctions());
}
}
return params;
} } | public class class_name {
private CmsGallerySearchParameters prepareSearchParams(CmsGallerySearchBean searchData) {
// create a new search parameter object
CmsGallerySearchParameters params = new CmsGallerySearchParameters();
CmsObject cms = getCmsObject();
// set the selected types to the parameters
if (searchData.getServerSearchTypes() != null) {
params.setResourceTypes(searchData.getServerSearchTypes()); // depends on control dependency: [if], data = [(searchData.getServerSearchTypes()]
}
// set the selected galleries to the parameters
if (searchData.getGalleries() != null) {
List<String> paramGalleries = new ArrayList<String>();
for (String gallerySitePath : searchData.getGalleries()) {
paramGalleries.add(cms.getRequestContext().addSiteRoot(gallerySitePath)); // depends on control dependency: [for], data = [gallerySitePath]
}
params.setGalleries(paramGalleries); // depends on control dependency: [if], data = [none]
}
// set the sort order for the galleries to the parameters
CmsGallerySearchParameters.CmsGallerySortParam sortOrder;
String temp = searchData.getSortOrder();
try {
sortOrder = CmsGallerySearchParameters.CmsGallerySortParam.valueOf(temp); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
sortOrder = CmsGallerySearchParameters.CmsGallerySortParam.DEFAULT;
} // depends on control dependency: [catch], data = [none]
params.setSortOrder(sortOrder);
if (searchData.getScope() == null) {
params.setScope(OpenCms.getWorkplaceManager().getGalleryDefaultScope()); // depends on control dependency: [if], data = [none]
} else {
params.setScope(searchData.getScope()); // depends on control dependency: [if], data = [(searchData.getScope()]
}
params.setReferencePath(searchData.getReferencePath());
// set the selected folders to the parameters
params.setFolders(new ArrayList<String>(searchData.getFolders()));
// set the categories to the parameters
if (searchData.getCategories() != null) {
params.setCategories(searchData.getCategories()); // depends on control dependency: [if], data = [(searchData.getCategories()]
}
// set the search query to the parameters
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchData.getQuery())) {
params.setSearchWords(searchData.getQuery()); // depends on control dependency: [if], data = [none]
}
// set the result page to the parameters
int page = searchData.getPage();
params.setResultPage(page);
// set the locale to the parameters
String locale = searchData.getLocale();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(locale)) {
locale = getCmsObject().getRequestContext().getLocale().toString(); // depends on control dependency: [if], data = [none]
}
params.setSearchLocale(locale);
// set the matches per page to the parameters
params.setMatchesPerPage(searchData.getMatchesPerPage());
// get the date range input
long dateCreatedStart = searchData.getDateCreatedStart();
long dateCreatedEnd = searchData.getDateCreatedEnd();
long dateModifiedStart = searchData.getDateModifiedStart();
long dateModifiedEnd = searchData.getDateModifiedEnd();
// set the date created range to the parameters
if ((dateCreatedStart != -1L) && (dateCreatedEnd != -1L)) {
params.setDateCreatedTimeRange(dateCreatedStart, dateCreatedEnd); // depends on control dependency: [if], data = [none]
} else if (dateCreatedStart != -1L) {
params.setDateCreatedTimeRange(dateCreatedStart, Long.MAX_VALUE); // depends on control dependency: [if], data = [(dateCreatedStart]
} else if (dateCreatedEnd != -1L) {
params.setDateCreatedTimeRange(Long.MIN_VALUE, dateCreatedEnd); // depends on control dependency: [if], data = [none]
}
// set the date modified range to the parameters
if ((dateModifiedStart != -1L) && (dateModifiedEnd != -1L)) {
params.setDateLastModifiedTimeRange(dateModifiedStart, dateModifiedEnd); // depends on control dependency: [if], data = [none]
} else if (dateModifiedStart != -1L) {
params.setDateLastModifiedTimeRange(dateModifiedStart, Long.MAX_VALUE); // depends on control dependency: [if], data = [(dateModifiedStart]
} else if (dateModifiedEnd != -1L) {
params.setDateLastModifiedTimeRange(Long.MIN_VALUE, dateModifiedEnd); // depends on control dependency: [if], data = [none]
}
params.setIgnoreSearchExclude(searchData.isIgnoreSearchExclude());
if (GalleryMode.ade.equals(searchData.getGalleryMode())) {
if (searchData.getTypes().isEmpty() || !Collections.disjoint(FUNCTION_TYPES, searchData.getTypes())) {
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.getRequestContext().addSiteRoot(searchData.getReferencePath()));
// in case a restricted set of functions is configured, remove all other functions
params.setAllowedFunctions(config.getDynamicFunctions()); // depends on control dependency: [if], data = [none]
}
}
return params;
} } |
public class class_name {
public FlowResponse submitFaxJob(T inputData,Object contextData,boolean invokeVendorPolicy)
{
boolean continueFlow=true;
VendorPolicy vendorPolicy=null;
if(invokeVendorPolicy)
{
//get vendor policy
vendorPolicy=this.FAX_BRIDGE.getVendorPolicy();
//invoke policy
continueFlow=vendorPolicy.invokePolicyForRequest(contextData);
}
FaxJob faxJob=null;
if(continueFlow)
{
//submit fax
faxJob=this.FAX_BRIDGE.submitFaxJob(inputData);
if(invokeVendorPolicy)
{
//invoke policy
continueFlow=vendorPolicy.invokePolicyForResponse(contextData,faxJob);
}
}
//create response
FlowResponse flowResponse=new FlowResponse(faxJob,continueFlow);
return flowResponse;
} } | public class class_name {
public FlowResponse submitFaxJob(T inputData,Object contextData,boolean invokeVendorPolicy)
{
boolean continueFlow=true;
VendorPolicy vendorPolicy=null;
if(invokeVendorPolicy)
{
//get vendor policy
vendorPolicy=this.FAX_BRIDGE.getVendorPolicy(); // depends on control dependency: [if], data = [none]
//invoke policy
continueFlow=vendorPolicy.invokePolicyForRequest(contextData); // depends on control dependency: [if], data = [none]
}
FaxJob faxJob=null;
if(continueFlow)
{
//submit fax
faxJob=this.FAX_BRIDGE.submitFaxJob(inputData); // depends on control dependency: [if], data = [none]
if(invokeVendorPolicy)
{
//invoke policy
continueFlow=vendorPolicy.invokePolicyForResponse(contextData,faxJob); // depends on control dependency: [if], data = [none]
}
}
//create response
FlowResponse flowResponse=new FlowResponse(faxJob,continueFlow);
return flowResponse;
} } |
public class class_name {
public static String getMimeType(byte[] bytes) {
String suffix = getFileSuffix(bytes);
String mimeType;
if ("JPG".equals(suffix)) {
mimeType = "image/jpeg";
} else if ("GIF".equals(suffix)) {
mimeType = "image/gif";
} else if ("PNG".equals(suffix)) {
mimeType = "image/png";
} else if ("BMP".equals(suffix)) {
mimeType = "image/bmp";
} else {
mimeType = "application/octet-stream";
}
return mimeType;
} } | public class class_name {
public static String getMimeType(byte[] bytes) {
String suffix = getFileSuffix(bytes);
String mimeType;
if ("JPG".equals(suffix)) {
mimeType = "image/jpeg"; // depends on control dependency: [if], data = [none]
} else if ("GIF".equals(suffix)) {
mimeType = "image/gif"; // depends on control dependency: [if], data = [none]
} else if ("PNG".equals(suffix)) {
mimeType = "image/png"; // depends on control dependency: [if], data = [none]
} else if ("BMP".equals(suffix)) {
mimeType = "image/bmp"; // depends on control dependency: [if], data = [none]
} else {
mimeType = "application/octet-stream"; // depends on control dependency: [if], data = [none]
}
return mimeType;
} } |
public class class_name {
public static <T> Partition<T> singletons(Collection<T> nodes) {
final Map<T, T> parents = Maps.newHashMap();
final Map<T, Integer> ranks = Maps.newHashMap();
for (T node : nodes) {
parents.put(node, node); // each node is its own head
ranks.put(node, 0); // every node has depth 0 to start
}
return new Partition<T>(parents, ranks);
} } | public class class_name {
public static <T> Partition<T> singletons(Collection<T> nodes) {
final Map<T, T> parents = Maps.newHashMap();
final Map<T, Integer> ranks = Maps.newHashMap();
for (T node : nodes) {
parents.put(node, node); // each node is its own head // depends on control dependency: [for], data = [node]
ranks.put(node, 0); // every node has depth 0 to start // depends on control dependency: [for], data = [node]
}
return new Partition<T>(parents, ranks);
} } |
public class class_name {
public void becomeCloneOf(ManagedObject other)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "becomeCloneOf"
, new Object[] { other }
);
TreeMap otherTree = (TreeMap) other;
root = otherTree.root;
size = otherTree.size;
// Transient state is dealt with by preCommit() and preBackout() methods of Entry.
if (!backingOut) { // Was transient state corrected in preBackout?
availableSize = otherTree.availableSize;
} // if(!backingOut).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "becomeCloneOf"
);
} } | public class class_name {
public void becomeCloneOf(ManagedObject other)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "becomeCloneOf"
, new Object[] { other }
);
TreeMap otherTree = (TreeMap) other;
root = otherTree.root;
size = otherTree.size;
// Transient state is dealt with by preCommit() and preBackout() methods of Entry.
if (!backingOut) { // Was transient state corrected in preBackout?
availableSize = otherTree.availableSize; // depends on control dependency: [if], data = [none]
} // if(!backingOut).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "becomeCloneOf"
);
} } |
public class class_name {
public static boolean equal(Iterator itr1, Iterator itr2) {
if (itr1 == null || itr2 == null) {
return false;
} else {
while (itr1.hasNext() && itr2.hasNext()) {
Object i = itr1.next();
Object i2 = itr2.next();
if ((i == null && i2 != null) || !(i.equals(i2))) {
return false;
}
}
if (itr1.hasNext() || itr2.hasNext()) {
return false;
}
return true;
}
} } | public class class_name {
public static boolean equal(Iterator itr1, Iterator itr2) {
if (itr1 == null || itr2 == null) {
return false; // depends on control dependency: [if], data = [none]
} else {
while (itr1.hasNext() && itr2.hasNext()) {
Object i = itr1.next();
Object i2 = itr2.next();
if ((i == null && i2 != null) || !(i.equals(i2))) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (itr1.hasNext() || itr2.hasNext()) {
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Object loadInstance(Class clazz, Object defaultValue) {
try {
return clazz.newInstance();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} } | public class class_name {
public static Object loadInstance(Class clazz, Object defaultValue) {
try {
return clazz.newInstance(); // depends on control dependency: [try], data = [none]
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void setPrimaryView(@NonNull final View primaryView) {
if (mPrimaryView != null) {
removeView(mPrimaryView);
}
mPrimaryView = primaryView;
addView(mPrimaryView);
} } | public class class_name {
void setPrimaryView(@NonNull final View primaryView) {
if (mPrimaryView != null) {
removeView(mPrimaryView); // depends on control dependency: [if], data = [(mPrimaryView]
}
mPrimaryView = primaryView;
addView(mPrimaryView);
} } |
public class class_name {
public void registerMbeans() {
ServerAdminMBean serverAdministrationBean = new ServerAdmin();
try {
mbeanServer.registerMBean(serverAdministrationBean,
JMXUtils.getObjectName(jmxConfig.getContextName(), "ServerAdmin"));
} catch (InstanceAlreadyExistsException e) {
throw new InitializationException("Could not initialize the MBean.!", e);
} catch (MBeanRegistrationException e) {
throw new InitializationException("Could not initialize the MBean.!", e);
} catch (NotCompliantMBeanException e) {
throw new InitializationException("Could not initialize the MBean.!", e);
}
} } | public class class_name {
public void registerMbeans() {
ServerAdminMBean serverAdministrationBean = new ServerAdmin();
try {
mbeanServer.registerMBean(serverAdministrationBean,
JMXUtils.getObjectName(jmxConfig.getContextName(), "ServerAdmin")); // depends on control dependency: [try], data = [none]
} catch (InstanceAlreadyExistsException e) {
throw new InitializationException("Could not initialize the MBean.!", e);
} catch (MBeanRegistrationException e) { // depends on control dependency: [catch], data = [none]
throw new InitializationException("Could not initialize the MBean.!", e);
} catch (NotCompliantMBeanException e) { // depends on control dependency: [catch], data = [none]
throw new InitializationException("Could not initialize the MBean.!", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static boolean parseOverallSuccess(SpoonSummary summary) {
for (DeviceResult result : summary.getResults().values()) {
if (result.getInstallFailed()) {
return false; // App and/or test installation failed.
}
if (!result.getExceptions().isEmpty() || result.getTestResults().isEmpty()) {
return false; // Top-level exception present, or no tests were run.
}
for (DeviceTestResult methodResult : result.getTestResults().values()) {
if (methodResult.getStatus() == Status.FAIL) {
return false; // Individual test failure.
}
}
}
return true;
} } | public class class_name {
static boolean parseOverallSuccess(SpoonSummary summary) {
for (DeviceResult result : summary.getResults().values()) {
if (result.getInstallFailed()) {
return false; // App and/or test installation failed. // depends on control dependency: [if], data = [none]
}
if (!result.getExceptions().isEmpty() || result.getTestResults().isEmpty()) {
return false; // Top-level exception present, or no tests were run. // depends on control dependency: [if], data = [none]
}
for (DeviceTestResult methodResult : result.getTestResults().values()) {
if (methodResult.getStatus() == Status.FAIL) {
return false; // Individual test failure. // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public static String getProjectUrl(final String group) {
if (group == null) { // prior 4.0
return PLUGIN_ID;
}
else {
return PLUGIN_ID + ParserRegistry.getUrl(group);
}
} } | public class class_name {
public static String getProjectUrl(final String group) {
if (group == null) { // prior 4.0
return PLUGIN_ID; // depends on control dependency: [if], data = [none]
}
else {
return PLUGIN_ID + ParserRegistry.getUrl(group); // depends on control dependency: [if], data = [(group]
}
} } |
public class class_name {
public static Set<IProcessor> createSpringStandardProcessorsSet(
final String dialectPrefix, final boolean renderHiddenMarkersBeforeCheckboxes) {
/*
* It is important that we create new instances here because, if there are
* several dialects in the TemplateEngine that extend StandardDialect, they should
* not be returning the exact same instances for their processors in order
* to allow specific instances to be directly linked with their owner dialect.
*/
final Set<IProcessor> standardProcessors = StandardDialect.createStandardProcessorsSet(dialectPrefix);
final Set<IProcessor> processors = new LinkedHashSet<IProcessor>(40);
/*
* REMOVE STANDARD PROCESSORS THAT WE WILL REPLACE
*/
for (final IProcessor standardProcessor : standardProcessors) {
// There are several processors we need to remove from the Standard Dialect set
if (!(standardProcessor instanceof StandardObjectTagProcessor) &&
!(standardProcessor instanceof StandardActionTagProcessor) &&
!(standardProcessor instanceof StandardHrefTagProcessor) &&
!(standardProcessor instanceof StandardMethodTagProcessor) &&
!(standardProcessor instanceof StandardSrcTagProcessor) &&
!(standardProcessor instanceof StandardValueTagProcessor)) {
processors.add(standardProcessor);
} else if (standardProcessor.getTemplateMode() != TemplateMode.HTML) {
// We only want to remove from the StandardDialect the HTML versions of the attribute processors
processors.add(standardProcessor);
}
}
/*
* ATTRIBUTE TAG PROCESSORS
*/
processors.add(new SpringActionTagProcessor(dialectPrefix));
processors.add(new SpringHrefTagProcessor(dialectPrefix));
processors.add(new SpringMethodTagProcessor(dialectPrefix));
processors.add(new SpringSrcTagProcessor(dialectPrefix));
processors.add(new SpringValueTagProcessor(dialectPrefix));
processors.add(new SpringObjectTagProcessor(dialectPrefix));
processors.add(new SpringErrorsTagProcessor(dialectPrefix));
processors.add(new SpringUErrorsTagProcessor(dialectPrefix));
processors.add(new SpringInputGeneralFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputPasswordFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputCheckboxFieldTagProcessor(dialectPrefix, renderHiddenMarkersBeforeCheckboxes));
processors.add(new SpringInputRadioFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputFileFieldTagProcessor(dialectPrefix));
processors.add(new SpringSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionInSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionFieldTagProcessor(dialectPrefix));
processors.add(new SpringTextareaFieldTagProcessor(dialectPrefix));
processors.add(new SpringErrorClassTagProcessor(dialectPrefix));
return processors;
} } | public class class_name {
public static Set<IProcessor> createSpringStandardProcessorsSet(
final String dialectPrefix, final boolean renderHiddenMarkersBeforeCheckboxes) {
/*
* It is important that we create new instances here because, if there are
* several dialects in the TemplateEngine that extend StandardDialect, they should
* not be returning the exact same instances for their processors in order
* to allow specific instances to be directly linked with their owner dialect.
*/
final Set<IProcessor> standardProcessors = StandardDialect.createStandardProcessorsSet(dialectPrefix);
final Set<IProcessor> processors = new LinkedHashSet<IProcessor>(40);
/*
* REMOVE STANDARD PROCESSORS THAT WE WILL REPLACE
*/
for (final IProcessor standardProcessor : standardProcessors) {
// There are several processors we need to remove from the Standard Dialect set
if (!(standardProcessor instanceof StandardObjectTagProcessor) &&
!(standardProcessor instanceof StandardActionTagProcessor) &&
!(standardProcessor instanceof StandardHrefTagProcessor) &&
!(standardProcessor instanceof StandardMethodTagProcessor) &&
!(standardProcessor instanceof StandardSrcTagProcessor) &&
!(standardProcessor instanceof StandardValueTagProcessor)) {
processors.add(standardProcessor); // depends on control dependency: [if], data = [none]
} else if (standardProcessor.getTemplateMode() != TemplateMode.HTML) {
// We only want to remove from the StandardDialect the HTML versions of the attribute processors
processors.add(standardProcessor); // depends on control dependency: [if], data = [none]
}
}
/*
* ATTRIBUTE TAG PROCESSORS
*/
processors.add(new SpringActionTagProcessor(dialectPrefix));
processors.add(new SpringHrefTagProcessor(dialectPrefix));
processors.add(new SpringMethodTagProcessor(dialectPrefix));
processors.add(new SpringSrcTagProcessor(dialectPrefix));
processors.add(new SpringValueTagProcessor(dialectPrefix));
processors.add(new SpringObjectTagProcessor(dialectPrefix));
processors.add(new SpringErrorsTagProcessor(dialectPrefix));
processors.add(new SpringUErrorsTagProcessor(dialectPrefix));
processors.add(new SpringInputGeneralFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputPasswordFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputCheckboxFieldTagProcessor(dialectPrefix, renderHiddenMarkersBeforeCheckboxes));
processors.add(new SpringInputRadioFieldTagProcessor(dialectPrefix));
processors.add(new SpringInputFileFieldTagProcessor(dialectPrefix));
processors.add(new SpringSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionInSelectFieldTagProcessor(dialectPrefix));
processors.add(new SpringOptionFieldTagProcessor(dialectPrefix));
processors.add(new SpringTextareaFieldTagProcessor(dialectPrefix));
processors.add(new SpringErrorClassTagProcessor(dialectPrefix));
return processors;
} } |
public class class_name {
public static double sum(double[] a, int fromIndex, int toIndex) {
double result = 0.0;
for (int i = fromIndex; i < toIndex; i++) {
result += a[i];
}
return result;
} } | public class class_name {
public static double sum(double[] a, int fromIndex, int toIndex) {
double result = 0.0;
for (int i = fromIndex; i < toIndex; i++) {
result += a[i];
// depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
private static int getMaxLength( String[] values )
{
int result = 0;
for ( int i = 0, curr = 0; i < values.length; i++ )
{
if ( ( curr = values[i].length() ) > result )
{
result = curr;
}
}
return result;
} } | public class class_name {
private static int getMaxLength( String[] values )
{
int result = 0;
for ( int i = 0, curr = 0; i < values.length; i++ )
{
if ( ( curr = values[i].length() ) > result )
{
result = curr; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public final void finished()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "finished");
if (null != _lastLink)
{
_lastLink.cursorRemoved();
_lastLink = null;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "finished");
} } | public class class_name {
public final void finished()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "finished");
if (null != _lastLink)
{
_lastLink.cursorRemoved(); // depends on control dependency: [if], data = [none]
_lastLink = null; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "finished");
} } |
public class class_name {
private static int utf8Length(String string) {
int stringLength = string.length();
int utf8Length = 0;
for (int i = 0; i < stringLength; i++) {
int c = string.charAt(i);
if (c <= 0x007F) {
utf8Length++;
} else if (c > 0x07FF) {
utf8Length += 3;
} else {
utf8Length += 2;
}
}
return utf8Length;
} } | public class class_name {
private static int utf8Length(String string) {
int stringLength = string.length();
int utf8Length = 0;
for (int i = 0; i < stringLength; i++) {
int c = string.charAt(i);
if (c <= 0x007F) {
utf8Length++; // depends on control dependency: [if], data = [none]
} else if (c > 0x07FF) {
utf8Length += 3; // depends on control dependency: [if], data = [none]
} else {
utf8Length += 2; // depends on control dependency: [if], data = [none]
}
}
return utf8Length;
} } |
public class class_name {
public void setDependsOn(java.util.Collection<JobDependency> dependsOn) {
if (dependsOn == null) {
this.dependsOn = null;
return;
}
this.dependsOn = new java.util.ArrayList<JobDependency>(dependsOn);
} } | public class class_name {
public void setDependsOn(java.util.Collection<JobDependency> dependsOn) {
if (dependsOn == null) {
this.dependsOn = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dependsOn = new java.util.ArrayList<JobDependency>(dependsOn);
} } |
public class class_name {
public InputStream getResource (String rset, String path)
throws IOException
{
// grab the resource bundles in the specified resource set
ResourceBundle[] bundles = getResourceSet(rset);
if (bundles == null) {
throw new FileNotFoundException(
"Unable to locate resource [set=" + rset + ", path=" + path + "]");
}
String localePath = getLocalePath(path);
// look for the resource in any of the bundles
for (ResourceBundle bundle : bundles) {
InputStream in;
// Try a localized version first.
if (localePath != null) {
in = bundle.getResource(localePath);
if (in != null) {
return in;
}
}
// If we didn't find that, try a generic.
in = bundle.getResource(path);
if (in != null) {
return in;
}
}
throw new FileNotFoundException(
"Unable to locate resource [set=" + rset + ", path=" + path + "]");
} } | public class class_name {
public InputStream getResource (String rset, String path)
throws IOException
{
// grab the resource bundles in the specified resource set
ResourceBundle[] bundles = getResourceSet(rset);
if (bundles == null) {
throw new FileNotFoundException(
"Unable to locate resource [set=" + rset + ", path=" + path + "]");
}
String localePath = getLocalePath(path);
// look for the resource in any of the bundles
for (ResourceBundle bundle : bundles) {
InputStream in;
// Try a localized version first.
if (localePath != null) {
in = bundle.getResource(localePath); // depends on control dependency: [if], data = [(localePath]
if (in != null) {
return in; // depends on control dependency: [if], data = [none]
}
}
// If we didn't find that, try a generic.
in = bundle.getResource(path);
if (in != null) {
return in; // depends on control dependency: [if], data = [none]
}
}
throw new FileNotFoundException(
"Unable to locate resource [set=" + rset + ", path=" + path + "]");
} } |
public class class_name {
protected boolean isButtonEnabledForSelectedHistoryReferences(List<HistoryReference> historyReferences) {
for (HistoryReference historyReference : historyReferences) {
if (historyReference != null && !isButtonEnabledForHistoryReference(historyReference)) {
return false;
}
}
return true;
} } | public class class_name {
protected boolean isButtonEnabledForSelectedHistoryReferences(List<HistoryReference> historyReferences) {
for (HistoryReference historyReference : historyReferences) {
if (historyReference != null && !isButtonEnabledForHistoryReference(historyReference)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public int doSeekCommand(Script recScript, Map<String,Object> properties)
{
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
String strKeyFieldName = record.getKeyArea(iKeySeq).getKeyField(0).getField(DBConstants.FILE_KEY_AREA).getFieldName(false, false);
if (recScript.getProperty(strKeyFieldName) != null)
{
record.setKeyArea(iKeySeq);
record.getField(strKeyFieldName).setString(recScript.getProperty(strKeyFieldName));
try {
if (record.seek(null))
return DBConstants.NORMAL_RETURN;
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
return DBConstants.ERROR_RETURN;
} } | public class class_name {
public int doSeekCommand(Script recScript, Map<String,Object> properties)
{
Record record = recScript.getTargetRecord(properties, DBParams.RECORD);
if (record == null)
return DBConstants.ERROR_RETURN;
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
String strKeyFieldName = record.getKeyArea(iKeySeq).getKeyField(0).getField(DBConstants.FILE_KEY_AREA).getFieldName(false, false);
if (recScript.getProperty(strKeyFieldName) != null)
{
record.setKeyArea(iKeySeq); // depends on control dependency: [if], data = [none]
record.getField(strKeyFieldName).setString(recScript.getProperty(strKeyFieldName)); // depends on control dependency: [if], data = [(recScript.getProperty(strKeyFieldName)]
try {
if (record.seek(null))
return DBConstants.NORMAL_RETURN;
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
return DBConstants.ERROR_RETURN;
} } |
public class class_name {
public synchronized void startListening(Context context) {
if (!mListening) {
mContext = context;
IntentFilter filter = new IntentFilter();
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
context.registerReceiver(mReceiver, filter);
mListening = true;
}
} } | public class class_name {
public synchronized void startListening(Context context) {
if (!mListening) {
mContext = context; // depends on control dependency: [if], data = [none]
IntentFilter filter = new IntentFilter();
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); // depends on control dependency: [if], data = [none]
context.registerReceiver(mReceiver, filter); // depends on control dependency: [if], data = [none]
mListening = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String exportTargetFolder() {
String targetFolder = null;
if (getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FOLDER) != null) {
targetFolder = (String)getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FOLDER);
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(targetFolder)) {
targetFolder = new Dialog(this).computeCurrentFolder();
}
StringBuffer sb = new StringBuffer();
// var targetFolder = '/demo_t3/';
sb.append(wrapScript("var ", I_CmsUploadConstants.VAR_TARGET_FOLDER, " = \'", targetFolder, "\';"));
return sb.toString();
} } | public class class_name {
private String exportTargetFolder() {
String targetFolder = null;
if (getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FOLDER) != null) {
targetFolder = (String)getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FOLDER); // depends on control dependency: [if], data = [none]
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(targetFolder)) {
targetFolder = new Dialog(this).computeCurrentFolder(); // depends on control dependency: [if], data = [none]
}
StringBuffer sb = new StringBuffer();
// var targetFolder = '/demo_t3/';
sb.append(wrapScript("var ", I_CmsUploadConstants.VAR_TARGET_FOLDER, " = \'", targetFolder, "\';"));
return sb.toString();
} } |
public class class_name {
public void deleteClassArtifactsInTaintedPackages() {
for (String pkg : taintedPackages) {
Map<String,File> arts = fetchPrevArtifacts(pkg);
for (File f : arts.values()) {
if (f.exists() && f.getName().endsWith(".class")) {
f.delete();
}
}
}
} } | public class class_name {
public void deleteClassArtifactsInTaintedPackages() {
for (String pkg : taintedPackages) {
Map<String,File> arts = fetchPrevArtifacts(pkg);
for (File f : arts.values()) {
if (f.exists() && f.getName().endsWith(".class")) {
f.delete(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private void notifyUIRefreshComplete(boolean ignoreHook) {
/**
* After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook.
*/
if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run.");
}
mRefreshCompleteHook.takeOver();
return;
}
if (mPtrUIHandlerHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete");
}
mPtrUIHandlerHolder.onUIRefreshComplete(this);
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset();
} } | public class class_name {
private void notifyUIRefreshComplete(boolean ignoreHook) {
/**
* After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook.
*/
if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run."); // depends on control dependency: [if], data = [none]
}
mRefreshCompleteHook.takeOver(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (mPtrUIHandlerHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete"); // depends on control dependency: [if], data = [none]
}
mPtrUIHandlerHolder.onUIRefreshComplete(this); // depends on control dependency: [if], data = [none]
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset();
} } |
public class class_name {
public java.util.Map<String, java.util.List<String>> getArgs() {
if (args == null) {
args = new com.amazonaws.internal.SdkInternalMap<String, java.util.List<String>>();
}
return args;
} } | public class class_name {
public java.util.Map<String, java.util.List<String>> getArgs() {
if (args == null) {
args = new com.amazonaws.internal.SdkInternalMap<String, java.util.List<String>>(); // depends on control dependency: [if], data = [none]
}
return args;
} } |
public class class_name {
protected static NfsGetAttributes makeNfsGetAttributes(Xdr xdr, boolean force) {
NfsGetAttributes attributes = null;
if (force || xdr.getBoolean()) {
attributes = new NfsGetAttributes();
attributes.unmarshalling(xdr);
}
return attributes;
} } | public class class_name {
protected static NfsGetAttributes makeNfsGetAttributes(Xdr xdr, boolean force) {
NfsGetAttributes attributes = null;
if (force || xdr.getBoolean()) {
attributes = new NfsGetAttributes(); // depends on control dependency: [if], data = [none]
attributes.unmarshalling(xdr); // depends on control dependency: [if], data = [none]
}
return attributes;
} } |
public class class_name {
private void triggerResolveEnd() {
Iterator<TransportResolverListener> iter = getListenersList().iterator();
while (iter.hasNext()) {
TransportResolverListener trl = iter.next();
if (trl instanceof TransportResolverListener.Resolver) {
TransportResolverListener.Resolver li = (TransportResolverListener.Resolver) trl;
li.end();
}
}
} } | public class class_name {
private void triggerResolveEnd() {
Iterator<TransportResolverListener> iter = getListenersList().iterator();
while (iter.hasNext()) {
TransportResolverListener trl = iter.next();
if (trl instanceof TransportResolverListener.Resolver) {
TransportResolverListener.Resolver li = (TransportResolverListener.Resolver) trl;
li.end(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static void setPermissions(DataFormatDefinition dformatDefinition) {
// Use Java Reflection to get the method setPermissions. This is done to allow compatibility between fuse 6.3 and fuse 6.2.1
// The xstream library differs on version between the 6.2.1 and 6.3 version of fuse.
Method setPermissions = null;
try {
setPermissions = dformatDefinition.getClass().getMethod("setPermissions", String.class);
} catch (Exception e) {
}
if (setPermissions != null) {
try {
setPermissions.invoke(dformatDefinition, "+*");
} catch (Exception e) {
}
}
} } | public class class_name {
private static void setPermissions(DataFormatDefinition dformatDefinition) {
// Use Java Reflection to get the method setPermissions. This is done to allow compatibility between fuse 6.3 and fuse 6.2.1
// The xstream library differs on version between the 6.2.1 and 6.3 version of fuse.
Method setPermissions = null;
try {
setPermissions = dformatDefinition.getClass().getMethod("setPermissions", String.class); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
if (setPermissions != null) {
try {
setPermissions.invoke(dformatDefinition, "+*"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Nullable
private View getViewForId(final long itemId) {
ListAdapter adapter = mAdapter;
if (itemId == INVALID_ID || adapter == null) {
return null;
}
int firstVisiblePosition = mWrapper.getFirstVisiblePosition();
View result = null;
for (int i = 0; i < mWrapper.getChildCount() && result == null; i++) {
int position = firstVisiblePosition + i;
if (position - mWrapper.getHeaderViewsCount() >= 0) {
long id = adapter.getItemId(position - mWrapper.getHeaderViewsCount());
if (id == itemId) {
result = mWrapper.getChildAt(i);
}
}
}
return result;
} } | public class class_name {
@Nullable
private View getViewForId(final long itemId) {
ListAdapter adapter = mAdapter;
if (itemId == INVALID_ID || adapter == null) {
return null; // depends on control dependency: [if], data = [none]
}
int firstVisiblePosition = mWrapper.getFirstVisiblePosition();
View result = null;
for (int i = 0; i < mWrapper.getChildCount() && result == null; i++) {
int position = firstVisiblePosition + i;
if (position - mWrapper.getHeaderViewsCount() >= 0) {
long id = adapter.getItemId(position - mWrapper.getHeaderViewsCount());
if (id == itemId) {
result = mWrapper.getChildAt(i); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public Boolean isKeepAlive(boolean useDefault) {
if (m_keepAlive != null) {
return m_keepAlive;
}
if (useDefault) {
return Boolean.TRUE;
} else {
return null;
}
} } | public class class_name {
public Boolean isKeepAlive(boolean useDefault) {
if (m_keepAlive != null) {
return m_keepAlive; // depends on control dependency: [if], data = [none]
}
if (useDefault) {
return Boolean.TRUE; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
<E> Node generate(E entity, PersistenceDelegator delegator, PersistenceCache pc, NodeState state)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(),
entity.getClass());
if (!new NullOrInvalidEntityRule<E>(entityMetadata).validate(entity))
{
Object entityId = onPreChecks(entity, delegator);
// TODO::check for composite key.
Node node = builder.buildNode(entity, delegator, entityId, state);
node = traverseNode(entity, delegator, pc, entityId, node);
return node;
}
return null;
} } | public class class_name {
<E> Node generate(E entity, PersistenceDelegator delegator, PersistenceCache pc, NodeState state)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(),
entity.getClass());
if (!new NullOrInvalidEntityRule<E>(entityMetadata).validate(entity))
{
Object entityId = onPreChecks(entity, delegator);
// TODO::check for composite key.
Node node = builder.buildNode(entity, delegator, entityId, state);
node = traverseNode(entity, delegator, pc, entityId, node); // depends on control dependency: [if], data = [none]
return node; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private List<CmsResource> updateContextDates(CmsDbContext dbc, List<CmsResource> resourceList) {
CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo();
if (info != null) {
for (int i = 0; i < resourceList.size(); i++) {
CmsResource resource = resourceList.get(i);
info.updateFromResource(resource);
}
}
return resourceList;
} } | public class class_name {
private List<CmsResource> updateContextDates(CmsDbContext dbc, List<CmsResource> resourceList) {
CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo();
if (info != null) {
for (int i = 0; i < resourceList.size(); i++) {
CmsResource resource = resourceList.get(i);
info.updateFromResource(resource); // depends on control dependency: [for], data = [none]
}
}
return resourceList;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
protected ConnectionRequest getConnectionRequest(SocketChannel handle) {
SelectionKey key = handle.keyFor(selector);
if ((key == null) || (!key.isValid())) {
return null;
}
return (ConnectionRequest) key.attachment();
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
protected ConnectionRequest getConnectionRequest(SocketChannel handle) {
SelectionKey key = handle.keyFor(selector);
if ((key == null) || (!key.isValid())) {
return null; // depends on control dependency: [if], data = [none]
}
return (ConnectionRequest) key.attachment();
} } |
public class class_name {
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) {
if (!configuration.isWriteThrough() || keys.isEmpty()) {
return null;
}
List<K> keysToDelete = new ArrayList<>(keys);
try {
writer.deleteAll(keysToDelete);
return null;
} catch (CacheWriterException e) {
keys.removeAll(keysToDelete);
throw e;
} catch (RuntimeException e) {
keys.removeAll(keysToDelete);
return new CacheWriterException("Exception in CacheWriter", e);
}
} } | public class class_name {
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) {
if (!configuration.isWriteThrough() || keys.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
List<K> keysToDelete = new ArrayList<>(keys);
try {
writer.deleteAll(keysToDelete); // depends on control dependency: [try], data = [none]
return null; // depends on control dependency: [try], data = [none]
} catch (CacheWriterException e) {
keys.removeAll(keysToDelete);
throw e;
} catch (RuntimeException e) { // depends on control dependency: [catch], data = [none]
keys.removeAll(keysToDelete);
return new CacheWriterException("Exception in CacheWriter", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
int getNumberOfNullEnderParameter(List<String> parameters) {
int nbnull = 0;
for (int i = parameters.size() - 1; i >= 0; i--) {
String parameter = parameters.get(i);
if (parameter.equals("null")) {
nbnull++;
} else {
break;
}
}
return nbnull;
} } | public class class_name {
int getNumberOfNullEnderParameter(List<String> parameters) {
int nbnull = 0;
for (int i = parameters.size() - 1; i >= 0; i--) {
String parameter = parameters.get(i);
if (parameter.equals("null")) {
nbnull++;
// depends on control dependency: [if], data = [none]
} else {
break;
}
}
return nbnull;
} } |
public class class_name {
private void setRange(final double RANGE) {
if (null == range) {
_range = RANGE;
setAngleStep(getAngleRange() / RANGE);
} else {
range.set(RANGE);
}
} } | public class class_name {
private void setRange(final double RANGE) {
if (null == range) {
_range = RANGE; // depends on control dependency: [if], data = [none]
setAngleStep(getAngleRange() / RANGE); // depends on control dependency: [if], data = [none]
} else {
range.set(RANGE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Entry get( String path )
{
Entry entry = backing.get( path );
if ( entry == null )
{
if ( path.startsWith( "/" ) )
{
path = path.substring( 1 );
}
if ( path.length() == 0 )
{
return getRoot();
}
String[] parts = path.split( "/" );
if ( parts.length == 0 )
{
return getRoot();
}
DirectoryEntry parent = getRoot();
for ( int i = 0; i < parts.length - 1; i++ )
{
parent = new DefaultDirectoryEntry( this, parent, parts[i] );
}
String name = parts[parts.length - 1];
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( name.endsWith( factory.getType() ) )
{
Entry shadow =
backing.get( parent.toPath() + "/" + StringUtils.removeEnd( name, factory.getType() ) );
return factory.create( this, parent, (FileEntry) shadow );
}
}
return get( parent, name );
}
else
{
if ( path.startsWith( "/" ) )
{
path = path.substring( 1 );
}
if ( path.length() == 0 )
{
return getRoot();
}
String[] parts = path.split( "/" );
if ( parts.length == 0 )
{
return getRoot();
}
DirectoryEntry parent = getRoot();
for ( int i = 0; i < parts.length - 1; i++ )
{
parent = new DefaultDirectoryEntry( this, parent, parts[i] );
}
if ( entry instanceof FileEntry )
{
// repair filesystems that lie to us because they are caching
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( entry.getName().endsWith( factory.getType() ) )
{
Entry shadow = backing.get(
parent.toPath() + "/" + StringUtils.removeEnd( entry.getName(), factory.getType() ) );
return new GenerateOnErrorFileEntry( this, parent, (FileEntry) entry,
factory.create( this, parent, (FileEntry) shadow ) );
}
}
return new LinkFileEntry( this, parent, (FileEntry) entry );
}
else if ( entry instanceof DirectoryEntry )
{
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( entry.getName().endsWith( factory.getType() ) )
{
Entry shadow = backing.get(
parent.toPath() + "/" + StringUtils.removeEnd( entry.getName(), factory.getType() ) );
return factory.create( this, parent, (FileEntry) shadow );
}
}
return new DefaultDirectoryEntry( this, parent, entry.getName() );
}
}
return null;
} } | public class class_name {
public Entry get( String path )
{
Entry entry = backing.get( path );
if ( entry == null )
{
if ( path.startsWith( "/" ) )
{
path = path.substring( 1 ); // depends on control dependency: [if], data = [none]
}
if ( path.length() == 0 )
{
return getRoot(); // depends on control dependency: [if], data = [none]
}
String[] parts = path.split( "/" );
if ( parts.length == 0 )
{
return getRoot(); // depends on control dependency: [if], data = [none]
}
DirectoryEntry parent = getRoot();
for ( int i = 0; i < parts.length - 1; i++ )
{
parent = new DefaultDirectoryEntry( this, parent, parts[i] ); // depends on control dependency: [for], data = [i]
}
String name = parts[parts.length - 1];
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( name.endsWith( factory.getType() ) )
{
Entry shadow =
backing.get( parent.toPath() + "/" + StringUtils.removeEnd( name, factory.getType() ) );
return factory.create( this, parent, (FileEntry) shadow ); // depends on control dependency: [if], data = [none]
}
}
return get( parent, name ); // depends on control dependency: [if], data = [none]
}
else
{
if ( path.startsWith( "/" ) )
{
path = path.substring( 1 ); // depends on control dependency: [if], data = [none]
}
if ( path.length() == 0 )
{
return getRoot(); // depends on control dependency: [if], data = [none]
}
String[] parts = path.split( "/" );
if ( parts.length == 0 )
{
return getRoot(); // depends on control dependency: [if], data = [none]
}
DirectoryEntry parent = getRoot();
for ( int i = 0; i < parts.length - 1; i++ )
{
parent = new DefaultDirectoryEntry( this, parent, parts[i] ); // depends on control dependency: [for], data = [i]
}
if ( entry instanceof FileEntry )
{
// repair filesystems that lie to us because they are caching
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( entry.getName().endsWith( factory.getType() ) )
{
Entry shadow = backing.get(
parent.toPath() + "/" + StringUtils.removeEnd( entry.getName(), factory.getType() ) );
return new GenerateOnErrorFileEntry( this, parent, (FileEntry) entry,
factory.create( this, parent, (FileEntry) shadow ) ); // depends on control dependency: [if], data = [none]
}
}
return new LinkFileEntry( this, parent, (FileEntry) entry ); // depends on control dependency: [if], data = [none]
}
else if ( entry instanceof DirectoryEntry )
{
for ( DigestFileEntryFactory factory : digestFactories.values() )
{
if ( entry.getName().endsWith( factory.getType() ) )
{
Entry shadow = backing.get(
parent.toPath() + "/" + StringUtils.removeEnd( entry.getName(), factory.getType() ) );
return factory.create( this, parent, (FileEntry) shadow ); // depends on control dependency: [if], data = [none]
}
}
return new DefaultDirectoryEntry( this, parent, entry.getName() ); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public PagedList<CloudTask> list(final String jobId, final TaskListOptions taskListOptions) {
ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> response = listSinglePageAsync(jobId, taskListOptions).toBlocking().single();
return new PagedList<CloudTask>(response.body()) {
@Override
public Page<CloudTask> nextPage(String nextPageLink) {
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body();
}
};
} } | public class class_name {
public PagedList<CloudTask> list(final String jobId, final TaskListOptions taskListOptions) {
ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> response = listSinglePageAsync(jobId, taskListOptions).toBlocking().single();
return new PagedList<CloudTask>(response.body()) {
@Override
public Page<CloudTask> nextPage(String nextPageLink) {
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions(); // depends on control dependency: [if], data = [none]
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); // depends on control dependency: [if], data = [(taskListOptions]
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(taskListOptions]
taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); // depends on control dependency: [if], data = [(taskListOptions]
}
return listNextSinglePageAsync(nextPageLink, taskListNextOptions).toBlocking().single().body();
}
};
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) {
return listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions();
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId());
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId());
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate());
}
return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, accountListPoolNodeCountsNextOptions));
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> listPoolNodeCountsWithServiceResponseAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions) {
return listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); // depends on control dependency: [if], data = [none]
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); // depends on control dependency: [if], data = [(accountListPoolNodeCountsOptions]
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(accountListPoolNodeCountsOptions]
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); // depends on control dependency: [if], data = [(accountListPoolNodeCountsOptions]
}
return Observable.just(page).concatWith(listPoolNodeCountsNextWithServiceResponseAsync(nextPageLink, accountListPoolNodeCountsNextOptions));
}
});
} } |
public class class_name {
public boolean containsKey(String group, String key) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsKey(key);
}
} finally {
readLock.unlock();
}
return false;
} } | public class class_name {
public boolean containsKey(String group, String key) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsKey(key);
// depends on control dependency: [if], data = [none]
}
} finally {
readLock.unlock();
}
return false;
} } |
public class class_name {
protected void set(double values[])
{
this.nRows = values.length;
this.nCols = 1;
this.values = new double[nRows][1];
for (int r = 0; r < nRows; ++r) {
this.values[r][0] = values[r];
}
} } | public class class_name {
protected void set(double values[])
{
this.nRows = values.length;
this.nCols = 1;
this.values = new double[nRows][1];
for (int r = 0; r < nRows; ++r) {
this.values[r][0] = values[r]; // depends on control dependency: [for], data = [r]
}
} } |
public class class_name {
@Override
public Promise subscribe(String channel) {
Promise promise = new Promise();
if (client != null) {
try {
client.subscribe(new Subscription[] { new Subscription(channel, qos) });
subscriptions.put(channel, promise);
} catch (Exception cause) {
promise.complete(cause);
}
} else {
promise.complete(new Throwable("Not connected!"));
}
return promise;
} } | public class class_name {
@Override
public Promise subscribe(String channel) {
Promise promise = new Promise();
if (client != null) {
try {
client.subscribe(new Subscription[] { new Subscription(channel, qos) });
// depends on control dependency: [try], data = [none]
subscriptions.put(channel, promise);
// depends on control dependency: [try], data = [none]
} catch (Exception cause) {
promise.complete(cause);
}
// depends on control dependency: [catch], data = [none]
} else {
promise.complete(new Throwable("Not connected!"));
// depends on control dependency: [if], data = [none]
}
return promise;
} } |
public class class_name {
protected void setFileInfo(final String _filename,
final long _fileLength)
throws EFapsException
{
if (!_filename.equals(this.fileName) || _fileLength != this.fileLength) {
ConnectionResource res = null;
try {
res = Context.getThreadContext().getConnectionResource();
final AbstractDatabase<?> db = Context.getDbType();
final StringBuilder cmd = new StringBuilder().append(db.getSQLPart(SQLPart.UPDATE)).append(" ")
.append(db.getTableQuote()).append(AbstractStoreResource.TABLENAME_STORE)
.append(db.getTableQuote())
.append(" ").append(db.getSQLPart(SQLPart.SET)).append(" ")
.append(db.getColumnQuote())
.append(AbstractStoreResource.COLNAME_FILENAME)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.COMMA))
.append(db.getColumnQuote())
.append(AbstractStoreResource.COLNAME_FILELENGTH)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.WHERE)).append(" ")
.append(db.getColumnQuote()).append("ID").append(db.getColumnQuote())
.append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID());
final PreparedStatement stmt = res.prepareStatement(cmd.toString());
try {
stmt.setString(1, _filename);
stmt.setLong(2, _fileLength);
stmt.execute();
} finally {
stmt.close();
}
} catch (final EFapsException e) {
throw e;
} catch (final SQLException e) {
throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e);
}
}
} } | public class class_name {
protected void setFileInfo(final String _filename,
final long _fileLength)
throws EFapsException
{
if (!_filename.equals(this.fileName) || _fileLength != this.fileLength) {
ConnectionResource res = null;
try {
res = Context.getThreadContext().getConnectionResource(); // depends on control dependency: [try], data = [none]
final AbstractDatabase<?> db = Context.getDbType();
final StringBuilder cmd = new StringBuilder().append(db.getSQLPart(SQLPart.UPDATE)).append(" ")
.append(db.getTableQuote()).append(AbstractStoreResource.TABLENAME_STORE)
.append(db.getTableQuote())
.append(" ").append(db.getSQLPart(SQLPart.SET)).append(" ")
.append(db.getColumnQuote())
.append(AbstractStoreResource.COLNAME_FILENAME)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.COMMA))
.append(db.getColumnQuote())
.append(AbstractStoreResource.COLNAME_FILELENGTH)
.append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ")
.append(db.getSQLPart(SQLPart.WHERE)).append(" ")
.append(db.getColumnQuote()).append("ID").append(db.getColumnQuote())
.append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID());
final PreparedStatement stmt = res.prepareStatement(cmd.toString());
try {
stmt.setString(1, _filename); // depends on control dependency: [try], data = [none]
stmt.setLong(2, _fileLength); // depends on control dependency: [try], data = [none]
stmt.execute(); // depends on control dependency: [try], data = [none]
} finally {
stmt.close();
}
} catch (final EFapsException e) {
throw e;
} catch (final SQLException e) { // depends on control dependency: [catch], data = [none]
throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void sendAppendRequest(RaftMemberContext member, AppendRequest request) {
// If this is a heartbeat message and a heartbeat is already in progress, skip the request.
if (request.entries().isEmpty() && !member.canHeartbeat()) {
return;
}
// Start the append to the member.
member.startAppend();
long timestamp = System.currentTimeMillis();
log.trace("Sending {} to {}", request, member.getMember().memberId());
raft.getProtocol().append(member.getMember().memberId(), request).whenCompleteAsync((response, error) -> {
// Complete the append to the member.
if (!request.entries().isEmpty()) {
member.completeAppend(System.currentTimeMillis() - timestamp);
} else {
member.completeAppend();
}
if (open) {
if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId());
handleAppendResponse(member, request, response, timestamp);
} else {
handleAppendResponseFailure(member, request, error);
}
}
}, raft.getThreadContext());
if (!request.entries().isEmpty() && hasMoreEntries(member)) {
appendEntries(member);
}
} } | public class class_name {
protected void sendAppendRequest(RaftMemberContext member, AppendRequest request) {
// If this is a heartbeat message and a heartbeat is already in progress, skip the request.
if (request.entries().isEmpty() && !member.canHeartbeat()) {
return; // depends on control dependency: [if], data = [none]
}
// Start the append to the member.
member.startAppend();
long timestamp = System.currentTimeMillis();
log.trace("Sending {} to {}", request, member.getMember().memberId());
raft.getProtocol().append(member.getMember().memberId(), request).whenCompleteAsync((response, error) -> {
// Complete the append to the member.
if (!request.entries().isEmpty()) {
member.completeAppend(System.currentTimeMillis() - timestamp); // depends on control dependency: [if], data = [none]
} else {
member.completeAppend(); // depends on control dependency: [if], data = [none]
}
if (open) {
if (error == null) {
log.trace("Received {} from {}", response, member.getMember().memberId()); // depends on control dependency: [if], data = [none]
handleAppendResponse(member, request, response, timestamp); // depends on control dependency: [if], data = [none]
} else {
handleAppendResponseFailure(member, request, error); // depends on control dependency: [if], data = [none]
}
}
}, raft.getThreadContext());
if (!request.entries().isEmpty() && hasMoreEntries(member)) {
appendEntries(member); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static QName getPortQName(ClassInfo classInfo, String seiClassName, String targetNamespace) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Port QName");
if (annotationInfo == null) {
return null;
}
boolean webServiceProviderAnnotation = isProvider(classInfo);
String wsName = webServiceProviderAnnotation ? null : annotationInfo.getValue(JaxWsConstants.NAME_ATTRIBUTE).getStringValue();
return getPortQName(classInfo, targetNamespace, wsName, annotationInfo.getValue(JaxWsConstants.PORTNAME_ATTRIBUTE).getStringValue(),
JaxWsConstants.PORTNAME_ATTRIBUTE_SUFFIX);
} } | public class class_name {
public static QName getPortQName(ClassInfo classInfo, String seiClassName, String targetNamespace) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Port QName");
if (annotationInfo == null) {
return null; // depends on control dependency: [if], data = [none]
}
boolean webServiceProviderAnnotation = isProvider(classInfo);
String wsName = webServiceProviderAnnotation ? null : annotationInfo.getValue(JaxWsConstants.NAME_ATTRIBUTE).getStringValue();
return getPortQName(classInfo, targetNamespace, wsName, annotationInfo.getValue(JaxWsConstants.PORTNAME_ATTRIBUTE).getStringValue(),
JaxWsConstants.PORTNAME_ATTRIBUTE_SUFFIX);
} } |
public class class_name {
public static int indexOneOf(CharSequence string, char... chars)
{
for(int i = 0; i < string.length(); ++i) {
for(int j = 0; j < chars.length; ++j) {
if(string.charAt(i) == chars[j]) {
return i;
}
}
}
return -1;
} } | public class class_name {
public static int indexOneOf(CharSequence string, char... chars)
{
for(int i = 0; i < string.length(); ++i) {
for(int j = 0; j < chars.length; ++j) {
if(string.charAt(i) == chars[j]) {
return i;
// depends on control dependency: [if], data = [none]
}
}
}
return -1;
} } |
public class class_name {
public YarnSubmissionHelper setJobSubmissionEnvMap(final Map<String, String> map) {
for (final Map.Entry<String, String> entry : map.entrySet()) {
environmentVariablesMap.put(entry.getKey(), entry.getValue());
}
return this;
} } | public class class_name {
public YarnSubmissionHelper setJobSubmissionEnvMap(final Map<String, String> map) {
for (final Map.Entry<String, String> entry : map.entrySet()) {
environmentVariablesMap.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return this;
} } |
public class class_name {
public void run(String path, String port) {
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setHost("localhost");
connector.setPort(Integer.parseInt(port));
server.addConnector(connector);
ResourceHandler resource_handler = new ResourceHandler();
resource_handler.setDirectoriesListed(true);
resource_handler.setWelcomeFiles(new String[]{"index.html"});
resource_handler.setResourceBase(path);
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()});
server.setHandler(handlers);
LOGGER.info("Serving out contents of: [{}] on http://localhost:{}/", path, port);
LOGGER.info("(To stop server hit CTRL-C)");
try {
server.start();
server.join();
} catch (Exception e) {
LOGGER.error("unable to start server", e);
}
} } | public class class_name {
public void run(String path, String port) {
Server server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.setHost("localhost");
connector.setPort(Integer.parseInt(port));
server.addConnector(connector);
ResourceHandler resource_handler = new ResourceHandler();
resource_handler.setDirectoriesListed(true);
resource_handler.setWelcomeFiles(new String[]{"index.html"});
resource_handler.setResourceBase(path);
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()});
server.setHandler(handlers);
LOGGER.info("Serving out contents of: [{}] on http://localhost:{}/", path, port);
LOGGER.info("(To stop server hit CTRL-C)");
try {
server.start(); // depends on control dependency: [try], data = [none]
server.join(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error("unable to start server", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void cancelJob(JobListener jobListener)
throws JobException {
synchronized (this.cancellationRequest) {
if (this.cancellationRequested) {
// Return immediately if a cancellation has already been requested
return;
}
this.cancellationRequested = true;
// Notify the cancellation executor that a cancellation has been requested
this.cancellationRequest.notify();
}
synchronized (this.cancellationExecution) {
try {
while (!this.cancellationExecuted) {
// Wait for the cancellation to be executed
this.cancellationExecution.wait();
}
try {
LOG.info("Current job state is: " + this.jobContext.getJobState().getState());
if (this.jobContext.getJobState().getState() != JobState.RunningState.COMMITTED && (
this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_SUCCESSFUL_TASKS
|| this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_ON_PARTIAL_SUCCESS)) {
this.jobContext.finalizeJobStateBeforeCommit();
this.jobContext.commit(true);
}
this.jobContext.close();
} catch (IOException ioe) {
LOG.error("Could not close job context.", ioe);
}
notifyListeners(this.jobContext, jobListener, TimingEvent.LauncherTimings.JOB_CANCEL, new JobListenerAction() {
@Override
public void apply(JobListener jobListener, JobContext jobContext)
throws Exception {
jobListener.onJobCancellation(jobContext);
}
});
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
} } | public class class_name {
@Override
public void cancelJob(JobListener jobListener)
throws JobException {
synchronized (this.cancellationRequest) {
if (this.cancellationRequested) {
// Return immediately if a cancellation has already been requested
return; // depends on control dependency: [if], data = [none]
}
this.cancellationRequested = true;
// Notify the cancellation executor that a cancellation has been requested
this.cancellationRequest.notify();
}
synchronized (this.cancellationExecution) {
try {
while (!this.cancellationExecuted) {
// Wait for the cancellation to be executed
this.cancellationExecution.wait(); // depends on control dependency: [while], data = [none]
}
try {
LOG.info("Current job state is: " + this.jobContext.getJobState().getState()); // depends on control dependency: [try], data = [none]
if (this.jobContext.getJobState().getState() != JobState.RunningState.COMMITTED && (
this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_SUCCESSFUL_TASKS
|| this.jobContext.getJobCommitPolicy() == JobCommitPolicy.COMMIT_ON_PARTIAL_SUCCESS)) {
this.jobContext.finalizeJobStateBeforeCommit(); // depends on control dependency: [if], data = [none]
this.jobContext.commit(true); // depends on control dependency: [if], data = [none]
}
this.jobContext.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
LOG.error("Could not close job context.", ioe);
} // depends on control dependency: [catch], data = [none]
notifyListeners(this.jobContext, jobListener, TimingEvent.LauncherTimings.JOB_CANCEL, new JobListenerAction() {
@Override
public void apply(JobListener jobListener, JobContext jobContext)
throws Exception {
jobListener.onJobCancellation(jobContext);
}
}); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setJobList(java.util.Collection<GlacierJobDescription> jobList) {
if (jobList == null) {
this.jobList = null;
return;
}
this.jobList = new java.util.ArrayList<GlacierJobDescription>(jobList);
} } | public class class_name {
public void setJobList(java.util.Collection<GlacierJobDescription> jobList) {
if (jobList == null) {
this.jobList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.jobList = new java.util.ArrayList<GlacierJobDescription>(jobList);
} } |
public class class_name {
private synchronized void trim() {
while (mCurrentSize > mSizeLimit) {
byte[] buf = mBuffersByLastUse.remove(0);
mBuffersBySize.remove(buf);
mCurrentSize -= buf.length;
}
} } | public class class_name {
private synchronized void trim() {
while (mCurrentSize > mSizeLimit) {
byte[] buf = mBuffersByLastUse.remove(0);
mBuffersBySize.remove(buf); // depends on control dependency: [while], data = [none]
mCurrentSize -= buf.length; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
protected void dispatchQueuedEvents() {
// don't dispatch if we're already dispatching, that would allow reentrancy and out-of-order events. Instead, leave
// the events to be dispatched after the in-progress dispatch is complete.
if (isDispatching.get()) {
return;
}
isDispatching.set(true);
try {
while (true) {
EventWithHandler eventWithHandler = eventsToDispatch.get().poll();
if (eventWithHandler == null) {
break;
}
if (eventWithHandler.handler.isValid()) {
dispatch(eventWithHandler.event, eventWithHandler.handler);
}
}
} finally {
isDispatching.set(false);
}
} } | public class class_name {
protected void dispatchQueuedEvents() {
// don't dispatch if we're already dispatching, that would allow reentrancy and out-of-order events. Instead, leave
// the events to be dispatched after the in-progress dispatch is complete.
if (isDispatching.get()) {
return; // depends on control dependency: [if], data = [none]
}
isDispatching.set(true);
try {
while (true) {
EventWithHandler eventWithHandler = eventsToDispatch.get().poll();
if (eventWithHandler == null) {
break;
}
if (eventWithHandler.handler.isValid()) {
dispatch(eventWithHandler.event, eventWithHandler.handler); // depends on control dependency: [if], data = [none]
}
}
} finally {
isDispatching.set(false);
}
} } |
public class class_name {
public List<ValidatorMetaData> readMetaData( Class<?> clazz, String propertyName ) {
/* Generate a key to the cache based on the classname and the propertyName. */
String propertyKey = clazz.getName() + "." + propertyName;
/* Look up the validation meta data in the cache. */
List<ValidatorMetaData> validatorMetaDataList = metaDataCache.get( propertyKey );
/* If the meta-data was not found, then generate it. */
if ( validatorMetaDataList == null ) { // if not found
validatorMetaDataList = extractValidatorMetaData( clazz, propertyName, validatorMetaDataList );
/* Put it in the cache to avoid the processing in the future.
* Design notes: The processing does a lot of reflection, there
* is no need to do this each time.
*/
metaDataCache.put( propertyKey, validatorMetaDataList );
}
return validatorMetaDataList;
} } | public class class_name {
public List<ValidatorMetaData> readMetaData( Class<?> clazz, String propertyName ) {
/* Generate a key to the cache based on the classname and the propertyName. */
String propertyKey = clazz.getName() + "." + propertyName;
/* Look up the validation meta data in the cache. */
List<ValidatorMetaData> validatorMetaDataList = metaDataCache.get( propertyKey );
/* If the meta-data was not found, then generate it. */
if ( validatorMetaDataList == null ) { // if not found
validatorMetaDataList = extractValidatorMetaData( clazz, propertyName, validatorMetaDataList );
// depends on control dependency: [if], data = [none]
/* Put it in the cache to avoid the processing in the future.
* Design notes: The processing does a lot of reflection, there
* is no need to do this each time.
*/
metaDataCache.put( propertyKey, validatorMetaDataList );
// depends on control dependency: [if], data = [none]
}
return validatorMetaDataList;
} } |
public class class_name {
public static WebElement isElementPresentAndGetFirstOne(By element) {
final WebDriver webDriver = Context.getDriver();
webDriver.manage().timeouts().implicitlyWait(DriverFactory.IMPLICIT_WAIT * 2, TimeUnit.MICROSECONDS);
final List<WebElement> foundElements = webDriver.findElements(element);
final boolean exists = !foundElements.isEmpty();
webDriver.manage().timeouts().implicitlyWait(DriverFactory.IMPLICIT_WAIT, TimeUnit.MICROSECONDS);
if (exists) {
return foundElements.get(0);
} else {
return null;
}
} } | public class class_name {
public static WebElement isElementPresentAndGetFirstOne(By element) {
final WebDriver webDriver = Context.getDriver();
webDriver.manage().timeouts().implicitlyWait(DriverFactory.IMPLICIT_WAIT * 2, TimeUnit.MICROSECONDS);
final List<WebElement> foundElements = webDriver.findElements(element);
final boolean exists = !foundElements.isEmpty();
webDriver.manage().timeouts().implicitlyWait(DriverFactory.IMPLICIT_WAIT, TimeUnit.MICROSECONDS);
if (exists) {
return foundElements.get(0);
// depends on control dependency: [if], data = [none]
} else {
return null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<String> getCSV(HttpHeader header, boolean keepQuotes) {
QuotedCSV values = null;
for (HttpField f : this) {
if (f.getHeader() == header) {
if (values == null)
values = new QuotedCSV(keepQuotes);
values.addValue(f.getValue());
}
}
return values == null ? Collections.emptyList() : values.getValues();
} } | public class class_name {
public List<String> getCSV(HttpHeader header, boolean keepQuotes) {
QuotedCSV values = null;
for (HttpField f : this) {
if (f.getHeader() == header) {
if (values == null)
values = new QuotedCSV(keepQuotes);
values.addValue(f.getValue()); // depends on control dependency: [if], data = [none]
}
}
return values == null ? Collections.emptyList() : values.getValues();
} } |
public class class_name {
public static void initReadme() {
try {
InputStream readmeStream = JavadocFixTool.class.getResourceAsStream("/README");
if (readmeStream != null) {
BufferedReader readmeReader = new BufferedReader(new InputStreamReader(readmeStream));
StringBuilder readmeBuilder = new StringBuilder();
String s;
while ((s = readmeReader.readLine()) != null) {
readmeBuilder.append(s);
readmeBuilder.append("\n");
}
readme = readmeBuilder.toString();
}
} catch (IOException ignore) {} // Ignore exception - readme not initialized
} } | public class class_name {
public static void initReadme() {
try {
InputStream readmeStream = JavadocFixTool.class.getResourceAsStream("/README");
if (readmeStream != null) {
BufferedReader readmeReader = new BufferedReader(new InputStreamReader(readmeStream));
StringBuilder readmeBuilder = new StringBuilder();
String s;
while ((s = readmeReader.readLine()) != null) {
readmeBuilder.append(s); // depends on control dependency: [while], data = [none]
readmeBuilder.append("\n"); // depends on control dependency: [while], data = [none]
}
readme = readmeBuilder.toString(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ignore) {} // Ignore exception - readme not initialized // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public CmsUUID getLockedInProjectId() {
CmsUUID lockedInProject = null;
if (getLock().isNullLock() && !getResource().getState().isUnchanged()) {
// resource is unlocked and modified
lockedInProject = getResource().getProjectLastModified();
} else if (!getResource().getState().isUnchanged()) {
// resource is locked and modified
lockedInProject = getProjectId();
} else if (!getLock().isNullLock()) {
// resource is locked and unchanged
lockedInProject = getLock().getProjectId();
}
return lockedInProject;
} } | public class class_name {
public CmsUUID getLockedInProjectId() {
CmsUUID lockedInProject = null;
if (getLock().isNullLock() && !getResource().getState().isUnchanged()) {
// resource is unlocked and modified
lockedInProject = getResource().getProjectLastModified(); // depends on control dependency: [if], data = [none]
} else if (!getResource().getState().isUnchanged()) {
// resource is locked and modified
lockedInProject = getProjectId(); // depends on control dependency: [if], data = [none]
} else if (!getLock().isNullLock()) {
// resource is locked and unchanged
lockedInProject = getLock().getProjectId(); // depends on control dependency: [if], data = [none]
}
return lockedInProject;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.