code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void removeArgFromFunction(String varName, DifferentialFunction function) {
val args = function.args();
for (int i = 0; i < args.length; i++) {
if (args[i].getVarName().equals(varName)) {
/**
* Since we are removing the variable reference
* from the arguments we need to update both
* the reverse and forward arguments.
*/
List<String> reverseArgs = ops.get(function.getOwnName()).getInputsToOp();
val newArgs = new ArrayList<String>(args.length - 1);
for (int arg = 0; arg < args.length; arg++) {
if (!reverseArgs.get(arg).equals(varName)) {
newArgs.add(reverseArgs.get(arg));
}
}
ops.get(function.getOwnName()).setInputsToOp(newArgs);
break;
}
}
} } | public class class_name {
public void removeArgFromFunction(String varName, DifferentialFunction function) {
val args = function.args();
for (int i = 0; i < args.length; i++) {
if (args[i].getVarName().equals(varName)) {
/**
* Since we are removing the variable reference
* from the arguments we need to update both
* the reverse and forward arguments.
*/
List<String> reverseArgs = ops.get(function.getOwnName()).getInputsToOp();
val newArgs = new ArrayList<String>(args.length - 1);
for (int arg = 0; arg < args.length; arg++) {
if (!reverseArgs.get(arg).equals(varName)) {
newArgs.add(reverseArgs.get(arg)); // depends on control dependency: [if], data = [none]
}
}
ops.get(function.getOwnName()).setInputsToOp(newArgs); // depends on control dependency: [if], data = [none]
break;
}
}
} } |
public class class_name {
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) {
List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false);
if (subscribers != null) {
subscribers.remove(subscriber);
if (subscribers.isEmpty()) {
subscriptions.remove(eventName);
}
return subscribers.size();
}
return -1;
} } | public class class_name {
public synchronized int removeSubscriber(String eventName, IGenericEvent<T> subscriber) {
List<IGenericEvent<T>> subscribers = getSubscribers(eventName, false);
if (subscribers != null) {
subscribers.remove(subscriber); // depends on control dependency: [if], data = [none]
if (subscribers.isEmpty()) {
subscriptions.remove(eventName); // depends on control dependency: [if], data = [none]
}
return subscribers.size(); // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
public Object createInstance(StoreConfiguration storeConfiguration) {
for(CacheStoreFactory factory : factories) {
Object instance = factory.createInstance(storeConfiguration);
if(instance != null) {
return instance;
}
}
throw log.unableToInstantiateClass(storeConfiguration.getClass());
} } | public class class_name {
public Object createInstance(StoreConfiguration storeConfiguration) {
for(CacheStoreFactory factory : factories) {
Object instance = factory.createInstance(storeConfiguration);
if(instance != null) {
return instance; // depends on control dependency: [if], data = [none]
}
}
throw log.unableToInstantiateClass(storeConfiguration.getClass());
} } |
public class class_name {
private void reconstituteTargetStreams(ProducerInputHandler inputHandler)
throws MessageStoreException,
SIException,
SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "reconstituteTargetStreams");
/*
* Iterate through all contained Protocol Items, rebuilding
* associated target streams for each.
*/
NonLockingCursor cursor = null;
try
{
cursor = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class));
AbstractItem item = null;
while (null != (item = cursor.next()))
{
StreamSet streamSet = (StreamSet)item;
inputHandler.reconstituteTargetStreams(streamSet);
}
}
finally
{
if (cursor != null)
cursor.finished();
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "reconstituteTargetStreams");
} } | public class class_name {
private void reconstituteTargetStreams(ProducerInputHandler inputHandler)
throws MessageStoreException,
SIException,
SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "reconstituteTargetStreams");
/*
* Iterate through all contained Protocol Items, rebuilding
* associated target streams for each.
*/
NonLockingCursor cursor = null;
try
{
cursor = newNonLockingItemCursor(new ClassEqualsFilter(StreamSet.class));
AbstractItem item = null;
while (null != (item = cursor.next()))
{
StreamSet streamSet = (StreamSet)item;
inputHandler.reconstituteTargetStreams(streamSet); // depends on control dependency: [while], data = [none]
}
}
finally
{
if (cursor != null)
cursor.finished();
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "reconstituteTargetStreams");
} } |
public class class_name {
public String format(Map<?, ?> map, char keyValueSeparator) {
if (map == null) {
return StringUtils.EMPTY;
}
Preconditions.checkArgument(keyValueSeparator != ' ');
StringBuilder rowString = new StringBuilder();
for (Iterator<?> itr = map.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry<?, ?> entry = Cast.as(itr.next());
String key = entry.getKey() == null ? "null" : entry.getKey().toString();
String value = entry.getValue() == null ? "null" : entry.getValue().toString();
key = key.replaceAll(Pattern.quote(escape), doubleEscape + doubleEscape);
value = value.replaceAll(Pattern.quote(escape), doubleEscape + doubleEscape);
rowString.append(quote);
if (key.indexOf(keyValueSeparator) >= 0) {
rowString.append(doubleQuote).append(key.replaceAll(quote, doubleQuote))
.append(doubleQuote);
} else {
rowString.append(key.replaceAll(quote, doubleQuote));
}
rowString.append(keyValueSeparator);
if (value.indexOf(keyValueSeparator) >= 0) {
rowString.append(doubleQuote).append(value.replaceAll(quote, doubleQuote))
.append(doubleQuote);
} else {
rowString.append(value.replaceAll(quote, doubleQuote));
}
rowString.append(quote);
if (itr.hasNext()) {
rowString.append(delimiter);
}
}
return rowString.toString();
} } | public class class_name {
public String format(Map<?, ?> map, char keyValueSeparator) {
if (map == null) {
return StringUtils.EMPTY; // depends on control dependency: [if], data = [none]
}
Preconditions.checkArgument(keyValueSeparator != ' ');
StringBuilder rowString = new StringBuilder();
for (Iterator<?> itr = map.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry<?, ?> entry = Cast.as(itr.next());
String key = entry.getKey() == null ? "null" : entry.getKey().toString();
String value = entry.getValue() == null ? "null" : entry.getValue().toString();
key = key.replaceAll(Pattern.quote(escape), doubleEscape + doubleEscape); // depends on control dependency: [for], data = [none]
value = value.replaceAll(Pattern.quote(escape), doubleEscape + doubleEscape); // depends on control dependency: [for], data = [none]
rowString.append(quote); // depends on control dependency: [for], data = [none]
if (key.indexOf(keyValueSeparator) >= 0) {
rowString.append(doubleQuote).append(key.replaceAll(quote, doubleQuote))
.append(doubleQuote); // depends on control dependency: [if], data = [none]
} else {
rowString.append(key.replaceAll(quote, doubleQuote)); // depends on control dependency: [if], data = [none]
}
rowString.append(keyValueSeparator); // depends on control dependency: [for], data = [none]
if (value.indexOf(keyValueSeparator) >= 0) {
rowString.append(doubleQuote).append(value.replaceAll(quote, doubleQuote))
.append(doubleQuote); // depends on control dependency: [if], data = [none]
} else {
rowString.append(value.replaceAll(quote, doubleQuote)); // depends on control dependency: [if], data = [none]
}
rowString.append(quote); // depends on control dependency: [for], data = [none]
if (itr.hasNext()) {
rowString.append(delimiter); // depends on control dependency: [if], data = [none]
}
}
return rowString.toString();
} } |
public class class_name {
public void setLifecycleHookTypes(java.util.Collection<String> lifecycleHookTypes) {
if (lifecycleHookTypes == null) {
this.lifecycleHookTypes = null;
return;
}
this.lifecycleHookTypes = new com.amazonaws.internal.SdkInternalList<String>(lifecycleHookTypes);
} } | public class class_name {
public void setLifecycleHookTypes(java.util.Collection<String> lifecycleHookTypes) {
if (lifecycleHookTypes == null) {
this.lifecycleHookTypes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.lifecycleHookTypes = new com.amazonaws.internal.SdkInternalList<String>(lifecycleHookTypes);
} } |
public class class_name {
public static /*@pure@*/ String doubleToString(double value, int afterDecimalPoint) {
StringBuffer stringBuffer;
double temp;
int dotPosition;
long precisionValue;
temp = value * Math.pow(10.0, afterDecimalPoint);
if (Math.abs(temp) < Long.MAX_VALUE) {
precisionValue = (temp > 0) ? (long)(temp + 0.5)
: -(long)(Math.abs(temp) + 0.5);
if (precisionValue == 0) {
stringBuffer = new StringBuffer(String.valueOf(0));
} else {
stringBuffer = new StringBuffer(String.valueOf(precisionValue));
}
if (afterDecimalPoint == 0) {
return stringBuffer.toString();
}
dotPosition = stringBuffer.length() - afterDecimalPoint;
while (((precisionValue < 0) && (dotPosition < 1)) ||
(dotPosition < 0)) {
if (precisionValue < 0) {
stringBuffer.insert(1, '0');
} else {
stringBuffer.insert(0, '0');
}
dotPosition++;
}
stringBuffer.insert(dotPosition, '.');
if ((precisionValue < 0) && (stringBuffer.charAt(1) == '.')) {
stringBuffer.insert(1, '0');
} else if (stringBuffer.charAt(0) == '.') {
stringBuffer.insert(0, '0');
}
int currentPos = stringBuffer.length() - 1;
while ((currentPos > dotPosition) &&
(stringBuffer.charAt(currentPos) == '0')) {
stringBuffer.setCharAt(currentPos--, ' ');
}
if (stringBuffer.charAt(currentPos) == '.') {
stringBuffer.setCharAt(currentPos, ' ');
}
return stringBuffer.toString().trim();
}
return new String("" + value);
} } | public class class_name {
public static /*@pure@*/ String doubleToString(double value, int afterDecimalPoint) {
StringBuffer stringBuffer;
double temp;
int dotPosition;
long precisionValue;
temp = value * Math.pow(10.0, afterDecimalPoint);
if (Math.abs(temp) < Long.MAX_VALUE) {
precisionValue = (temp > 0) ? (long)(temp + 0.5)
: -(long)(Math.abs(temp) + 0.5); // depends on control dependency: [if], data = [none]
if (precisionValue == 0) {
stringBuffer = new StringBuffer(String.valueOf(0)); // depends on control dependency: [if], data = [0)]
} else {
stringBuffer = new StringBuffer(String.valueOf(precisionValue)); // depends on control dependency: [if], data = [(precisionValue]
}
if (afterDecimalPoint == 0) {
return stringBuffer.toString(); // depends on control dependency: [if], data = [none]
}
dotPosition = stringBuffer.length() - afterDecimalPoint; // depends on control dependency: [if], data = [none]
while (((precisionValue < 0) && (dotPosition < 1)) ||
(dotPosition < 0)) {
if (precisionValue < 0) {
stringBuffer.insert(1, '0'); // depends on control dependency: [if], data = [none]
} else {
stringBuffer.insert(0, '0'); // depends on control dependency: [if], data = [none]
}
dotPosition++; // depends on control dependency: [while], data = [none]
}
stringBuffer.insert(dotPosition, '.'); // depends on control dependency: [if], data = [none]
if ((precisionValue < 0) && (stringBuffer.charAt(1) == '.')) {
stringBuffer.insert(1, '0'); // depends on control dependency: [if], data = [none]
} else if (stringBuffer.charAt(0) == '.') {
stringBuffer.insert(0, '0'); // depends on control dependency: [if], data = [none]
}
int currentPos = stringBuffer.length() - 1;
while ((currentPos > dotPosition) &&
(stringBuffer.charAt(currentPos) == '0')) {
stringBuffer.setCharAt(currentPos--, ' '); // depends on control dependency: [while], data = [none]
}
if (stringBuffer.charAt(currentPos) == '.') {
stringBuffer.setCharAt(currentPos, ' '); // depends on control dependency: [if], data = [none]
}
return stringBuffer.toString().trim(); // depends on control dependency: [if], data = [none]
}
return new String("" + value);
} } |
public class class_name {
@Override
public int compareTo(final Coordinate other) {
if (getX() < other.getX()) {
return -1;
}
if (getX() > other.getX()) {
return 1;
}
if (getY() < other.getY()) {
return -1;
}
if (getY() > other.getY()) {
return 1;
}
return 0;
} } | public class class_name {
@Override
public int compareTo(final Coordinate other) {
if (getX() < other.getX()) {
return -1; // depends on control dependency: [if], data = [none]
}
if (getX() > other.getX()) {
return 1; // depends on control dependency: [if], data = [none]
}
if (getY() < other.getY()) {
return -1; // depends on control dependency: [if], data = [none]
}
if (getY() > other.getY()) {
return 1; // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
public int getNumberBetween(final int min, final int max) {
if (max < min) {
throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max));
}
if (max == min) {
return min;
}
return min + random.nextInt(max - min);
} } | public class class_name {
public int getNumberBetween(final int min, final int max) {
if (max < min) {
throw new IllegalArgumentException(String.format("Minimum must be less than minimum (min=%d, max=%d)", min, max));
}
if (max == min) {
return min;
// depends on control dependency: [if], data = [none]
}
return min + random.nextInt(max - min);
} } |
public class class_name {
public void marshall(UpdateItemRequest updateItemRequest, ProtocolMarshaller protocolMarshaller) {
if (updateItemRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateItemRequest.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(updateItemRequest.getKey(), KEY_BINDING);
protocolMarshaller.marshall(updateItemRequest.getAttributeUpdates(), ATTRIBUTEUPDATES_BINDING);
protocolMarshaller.marshall(updateItemRequest.getExpected(), EXPECTED_BINDING);
protocolMarshaller.marshall(updateItemRequest.getConditionalOperator(), CONDITIONALOPERATOR_BINDING);
protocolMarshaller.marshall(updateItemRequest.getReturnValues(), RETURNVALUES_BINDING);
protocolMarshaller.marshall(updateItemRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING);
protocolMarshaller.marshall(updateItemRequest.getReturnItemCollectionMetrics(), RETURNITEMCOLLECTIONMETRICS_BINDING);
protocolMarshaller.marshall(updateItemRequest.getUpdateExpression(), UPDATEEXPRESSION_BINDING);
protocolMarshaller.marshall(updateItemRequest.getConditionExpression(), CONDITIONEXPRESSION_BINDING);
protocolMarshaller.marshall(updateItemRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING);
protocolMarshaller.marshall(updateItemRequest.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateItemRequest updateItemRequest, ProtocolMarshaller protocolMarshaller) {
if (updateItemRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateItemRequest.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getAttributeUpdates(), ATTRIBUTEUPDATES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getExpected(), EXPECTED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getConditionalOperator(), CONDITIONALOPERATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getReturnValues(), RETURNVALUES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getReturnItemCollectionMetrics(), RETURNITEMCOLLECTIONMETRICS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getUpdateExpression(), UPDATEEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getConditionExpression(), CONDITIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateItemRequest.getExpressionAttributeValues(), EXPRESSIONATTRIBUTEVALUES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean fillAttachmentList(@NonNull Context context, @NonNull String reportText, @NonNull List<Uri> attachments) {
final InstanceCreator instanceCreator = new InstanceCreator();
attachments.addAll(instanceCreator.create(config.attachmentUriProvider(), DefaultAttachmentProvider::new).getAttachments(context, config));
if (mailConfig.reportAsFile()) {
final Uri report = createAttachmentFromString(context, mailConfig.reportFileName(), reportText);
if (report != null) {
attachments.add(report);
return true;
}
}
return false;
} } | public class class_name {
protected boolean fillAttachmentList(@NonNull Context context, @NonNull String reportText, @NonNull List<Uri> attachments) {
final InstanceCreator instanceCreator = new InstanceCreator();
attachments.addAll(instanceCreator.create(config.attachmentUriProvider(), DefaultAttachmentProvider::new).getAttachments(context, config));
if (mailConfig.reportAsFile()) {
final Uri report = createAttachmentFromString(context, mailConfig.reportFileName(), reportText);
if (report != null) {
attachments.add(report); // depends on control dependency: [if], data = [(report]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static void unregisterMbean(ObjectName name) {
try {
ManagementFactory.getPlatformMBeanServer().unregisterMBean(name);
} catch(Exception e) {
logger.error("Error unregistering mbean", e);
}
} } | public class class_name {
public static void unregisterMbean(ObjectName name) {
try {
ManagementFactory.getPlatformMBeanServer().unregisterMBean(name); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
logger.error("Error unregistering mbean", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String getVariable(GDLParser.HeaderContext header) {
if (header != null && header.Identifier() != null) {
return header.Identifier().getText();
}
return null;
} } | public class class_name {
private String getVariable(GDLParser.HeaderContext header) {
if (header != null && header.Identifier() != null) {
return header.Identifier().getText(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private ResponseEntity<String> makeRestCall(String instanceUrl, String endpoint) {
String url = normalizeUrl(instanceUrl, "/deployit/" + endpoint);
ResponseEntity<String> response = null;
try {
response = restOperations.exchange(url, HttpMethod.GET,
new HttpEntity<>(createHeaders(instanceUrl)), String.class);
} catch (RestClientException re) {
LOGGER.error("Error with REST url: " + url);
LOGGER.error(re.getMessage());
}
return response;
} } | public class class_name {
private ResponseEntity<String> makeRestCall(String instanceUrl, String endpoint) {
String url = normalizeUrl(instanceUrl, "/deployit/" + endpoint);
ResponseEntity<String> response = null;
try {
response = restOperations.exchange(url, HttpMethod.GET,
new HttpEntity<>(createHeaders(instanceUrl)), String.class);
// depends on control dependency: [try], data = [none]
} catch (RestClientException re) {
LOGGER.error("Error with REST url: " + url);
LOGGER.error(re.getMessage());
}
// depends on control dependency: [catch], data = [none]
return response;
} } |
public class class_name {
Scope enterScope() {
final Map<VarKey, Variable> currentFrame = new LinkedHashMap<>();
final Label scopeExit = new Label();
frames.push(currentFrame);
return new Scope() {
boolean exited;
@Override
Variable createSynthetic(
SyntheticVarName varName, Expression initExpr, SaveStrategy strategy) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.SYNTHETIC, varName.name());
// synthetics are prefixed by $ by convention
String name = fieldNames.generateName("$" + varName.name());
return doCreate(name, new Label(), scopeExit, initExpr, key, strategy);
}
@Override
Variable createTemporary(String name, Expression initExpr) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.TEMPORARY, name);
name = fieldNames.generateName("$$" + name);
return doCreate(name, new Label(), scopeExit, initExpr, key, SaveStrategy.NEVER);
}
@Override
Variable create(String name, Expression initExpr, SaveStrategy strategy) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.USER_DEFINED, name);
name = fieldNames.generateName(name);
return doCreate(name, new Label(), scopeExit, initExpr, key, strategy);
}
@Override
Statement exitScope() {
checkState(!exited, "Scope already exited");
exited = true;
frames.pop();
// Use identity semantics to make sure we visit each label at most once. visiting a label
// more than once tends to corrupt internal asm state.
final Set<Label> endLabels = Sets.newIdentityHashSet();
for (Variable var : currentFrame.values()) {
endLabels.add(var.local.end());
availableSlots.clear(
var.local.index(), var.local.index() + var.local.resultType().getSize());
}
return new Statement() {
// TODO(lukes): we could generate null writes for when object typed fields go out of
// scope. This would potentially allow intermediate results to be collected sooner.
@Override
protected void doGen(CodeBuilder adapter) {
for (Label label : endLabels) {
adapter.visitLabel(label);
}
}
};
}
private Variable doCreate(
String name,
Label start,
Label end,
Expression initExpr,
VarKey key,
SaveStrategy strategy) {
int index = reserveSlotFor(initExpr.resultType());
LocalVariable local =
LocalVariable.createLocal(name, index, initExpr.resultType(), start, end);
Variable var;
switch (strategy) {
case DERIVED:
var = new DerivedVariable(initExpr, local);
break;
case NEVER:
var = new TemporaryVariable(initExpr, local);
break;
case STORE:
var = new FieldSavedVariable(initExpr, local);
break;
default:
throw new AssertionError();
}
currentFrame.put(key, var);
allVariables.add(var);
return var;
}
};
} } | public class class_name {
Scope enterScope() {
final Map<VarKey, Variable> currentFrame = new LinkedHashMap<>();
final Label scopeExit = new Label();
frames.push(currentFrame);
return new Scope() {
boolean exited;
@Override
Variable createSynthetic(
SyntheticVarName varName, Expression initExpr, SaveStrategy strategy) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.SYNTHETIC, varName.name());
// synthetics are prefixed by $ by convention
String name = fieldNames.generateName("$" + varName.name());
return doCreate(name, new Label(), scopeExit, initExpr, key, strategy);
}
@Override
Variable createTemporary(String name, Expression initExpr) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.TEMPORARY, name);
name = fieldNames.generateName("$$" + name);
return doCreate(name, new Label(), scopeExit, initExpr, key, SaveStrategy.NEVER);
}
@Override
Variable create(String name, Expression initExpr, SaveStrategy strategy) {
checkState(!exited, "Scope already exited");
VarKey key = VarKey.create(Kind.USER_DEFINED, name);
name = fieldNames.generateName(name);
return doCreate(name, new Label(), scopeExit, initExpr, key, strategy);
}
@Override
Statement exitScope() {
checkState(!exited, "Scope already exited");
exited = true;
frames.pop();
// Use identity semantics to make sure we visit each label at most once. visiting a label
// more than once tends to corrupt internal asm state.
final Set<Label> endLabels = Sets.newIdentityHashSet();
for (Variable var : currentFrame.values()) {
endLabels.add(var.local.end()); // depends on control dependency: [for], data = [var]
availableSlots.clear(
var.local.index(), var.local.index() + var.local.resultType().getSize()); // depends on control dependency: [for], data = [none]
}
return new Statement() {
// TODO(lukes): we could generate null writes for when object typed fields go out of
// scope. This would potentially allow intermediate results to be collected sooner.
@Override
protected void doGen(CodeBuilder adapter) {
for (Label label : endLabels) {
adapter.visitLabel(label); // depends on control dependency: [for], data = [label]
}
}
};
}
private Variable doCreate(
String name,
Label start,
Label end,
Expression initExpr,
VarKey key,
SaveStrategy strategy) {
int index = reserveSlotFor(initExpr.resultType());
LocalVariable local =
LocalVariable.createLocal(name, index, initExpr.resultType(), start, end);
Variable var;
switch (strategy) {
case DERIVED:
var = new DerivedVariable(initExpr, local);
break;
case NEVER:
var = new TemporaryVariable(initExpr, local);
break;
case STORE:
var = new FieldSavedVariable(initExpr, local);
break;
default:
throw new AssertionError();
}
currentFrame.put(key, var);
allVariables.add(var);
return var;
}
};
} } |
public class class_name {
private void render(SVG.Symbol obj, Box viewPort)
{
debug("Symbol render");
if (viewPort.width == 0f || viewPort.height == 0f)
return;
// "If attribute 'preserveAspectRatio' is not specified, then the effect is as if a value of xMidYMid meet were specified."
PreserveAspectRatio positioning = (obj.preserveAspectRatio != null) ? obj.preserveAspectRatio : PreserveAspectRatio.LETTERBOX;
updateStyleForElement(state, obj);
state.viewPort = viewPort;
if (!state.style.overflow) {
setClipRect(state.viewPort.minX, state.viewPort.minY, state.viewPort.width, state.viewPort.height);
}
if (obj.viewBox != null) {
canvas.concat(calculateViewBoxTransform(state.viewPort, obj.viewBox, positioning));
state.viewBox = obj.viewBox;
} else {
canvas.translate(state.viewPort.minX, state.viewPort.minY);
}
boolean compositing = pushLayer();
renderChildren(obj, true);
if (compositing)
popLayer(obj);
updateParentBoundingBox(obj);
} } | public class class_name {
private void render(SVG.Symbol obj, Box viewPort)
{
debug("Symbol render");
if (viewPort.width == 0f || viewPort.height == 0f)
return;
// "If attribute 'preserveAspectRatio' is not specified, then the effect is as if a value of xMidYMid meet were specified."
PreserveAspectRatio positioning = (obj.preserveAspectRatio != null) ? obj.preserveAspectRatio : PreserveAspectRatio.LETTERBOX;
updateStyleForElement(state, obj);
state.viewPort = viewPort;
if (!state.style.overflow) {
setClipRect(state.viewPort.minX, state.viewPort.minY, state.viewPort.width, state.viewPort.height);
// depends on control dependency: [if], data = [none]
}
if (obj.viewBox != null) {
canvas.concat(calculateViewBoxTransform(state.viewPort, obj.viewBox, positioning));
// depends on control dependency: [if], data = [none]
state.viewBox = obj.viewBox;
// depends on control dependency: [if], data = [none]
} else {
canvas.translate(state.viewPort.minX, state.viewPort.minY);
// depends on control dependency: [if], data = [none]
}
boolean compositing = pushLayer();
renderChildren(obj, true);
if (compositing)
popLayer(obj);
updateParentBoundingBox(obj);
} } |
public class class_name {
private void maybeAddGoogScopeUsage(NodeTraversal t, Node n, Node parent) {
checkState(NodeUtil.isNameDeclaration(n));
if (n.hasOneChild() && parent == googScopeBlock) {
Node rhs = n.getFirstFirstChild();
if (rhs != null && rhs.isQualifiedName()) {
Node root = NodeUtil.getRootOfQualifiedName(rhs);
if (root.isName()) {
Var var = t.getScope().getVar(root.getString());
if (var == null || (var.isGlobal() && !var.isExtern())) {
usages.put(rhs.getQualifiedName(), rhs);
}
}
}
}
} } | public class class_name {
private void maybeAddGoogScopeUsage(NodeTraversal t, Node n, Node parent) {
checkState(NodeUtil.isNameDeclaration(n));
if (n.hasOneChild() && parent == googScopeBlock) {
Node rhs = n.getFirstFirstChild();
if (rhs != null && rhs.isQualifiedName()) {
Node root = NodeUtil.getRootOfQualifiedName(rhs);
if (root.isName()) {
Var var = t.getScope().getVar(root.getString());
if (var == null || (var.isGlobal() && !var.isExtern())) {
usages.put(rhs.getQualifiedName(), rhs); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public static String validateAttributeNames(
Enumeration<String> attributeNames) {
while (attributeNames.hasMoreElements()) {
String attribute = attributeNames.nextElement();
if (!attribute.equals("users") && !attribute.equals("poolGroups") &&
!attribute.equals("poolInfos") && !attribute.equals("toKillSessionId")
&& !attribute.equals("killSessionsToken")) {
return
"Illegal parameter " + attribute + ", only 'users, " +
"poolGroups, 'poolInfos', 'toKillSessionId' and 'killSessionsToken'" +
"parameters allowed.";
}
}
return null;
} } | public class class_name {
public static String validateAttributeNames(
Enumeration<String> attributeNames) {
while (attributeNames.hasMoreElements()) {
String attribute = attributeNames.nextElement();
if (!attribute.equals("users") && !attribute.equals("poolGroups") &&
!attribute.equals("poolInfos") && !attribute.equals("toKillSessionId")
&& !attribute.equals("killSessionsToken")) {
return
"Illegal parameter " + attribute + ", only 'users, " +
"poolGroups, 'poolInfos', 'toKillSessionId' and 'killSessionsToken'" +
"parameters allowed."; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private Connection getConnection() {
JdbcTransaction tx = transationHandler.get();
try {
if (tx == null) {
return dataSource.getConnection();
} else {
return tx.getConnection();
}
} catch (SQLException e) {
throw new DbException(e);
}
} } | public class class_name {
private Connection getConnection() {
JdbcTransaction tx = transationHandler.get();
try {
if (tx == null) {
return dataSource.getConnection(); // depends on control dependency: [if], data = [none]
} else {
return tx.getConnection(); // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
throw new DbException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void info( Marker marker, String msg, Throwable t )
{
if( m_delegate.isInfoEnabled() )
{
setMDCMarker( marker );
m_delegate.inform( msg, t );
resetMDCMarker();
}
} } | public class class_name {
public void info( Marker marker, String msg, Throwable t )
{
if( m_delegate.isInfoEnabled() )
{
setMDCMarker( marker ); // depends on control dependency: [if], data = [none]
m_delegate.inform( msg, t ); // depends on control dependency: [if], data = [none]
resetMDCMarker(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void applyDrawerWithHeader() {
setType(SideNavType.DRAWER_WITH_HEADER);
applyBodyScroll();
if (isShowOnAttach()) {
Scheduler.get().scheduleDeferred(() -> {
pushElement(getHeader(), 0);
pushElement(getMain(), 0);
});
}
} } | public class class_name {
protected void applyDrawerWithHeader() {
setType(SideNavType.DRAWER_WITH_HEADER);
applyBodyScroll();
if (isShowOnAttach()) {
Scheduler.get().scheduleDeferred(() -> {
pushElement(getHeader(), 0); // depends on control dependency: [if], data = [none]
pushElement(getMain(), 0); // depends on control dependency: [if], data = [none]
});
}
} } |
public class class_name {
public void close() throws WLFormatException {
if (closed) {
return;
}
closed = true;
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent e;
try {
if (this.xmlEventWriter != null) {
// rewrite all before end of ExternalData or, if ExternalData is not present, before start of TextCorpus
if (!this.hasExtData) {
// up to TextCorpus start
xmlReaderWriter.readWriteUpToStartElement(TextCorpusStored.XML_NAME);
// create the ExternalData start element
List<Attribute> attrs = new ArrayList<Attribute>(0);
Namespace ns = eventFactory.createNamespace(ExternalDataStored.XML_NAMESPACE);
List<Namespace> nss = new ArrayList<Namespace>();
nss.add(ns);
e = eventFactory.createStartElement("",
ExternalDataStored.XML_NAMESPACE, ExternalDataStored.XML_NAME,
attrs.iterator(), nss.iterator());
xmlEventWriter.add(e);
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE);
xmlEventWriter.add(e);
} else {
xmlReaderWriter.readWriteUpToEndElement(ExternalDataStored.XML_NAME);
}
// write new layers of ExternalData
List<ExternalDataLayer> edLayers = extData.getLayers();
for (ExternalDataLayer layer : edLayers) {
if (!edLayersToRead.contains(ExternalDataLayerTag.getFromClass(layer.getClass()))) {
marshall(layer);
}
}
if (!this.hasExtData) {
// create the ExternalData end element
e = eventFactory.createEndElement("",
ExternalDataStored.XML_NAMESPACE, ExternalDataStored.XML_NAME);
xmlEventWriter.add(e);
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE);
xmlEventWriter.add(e);
}
if (!this.hasTextCorpus) {
// up to end D-Spin
xmlReaderWriter.readWriteUpToStartElement(WLData.XML_NAME);
// create the TextCorpus start element
List<Attribute> attrs = new ArrayList<Attribute>(0);
Namespace ns = eventFactory.createNamespace(TextCorpusStored.XML_NAMESPACE);
List<Namespace> nss = new ArrayList<Namespace>();
nss.add(ns);
e = eventFactory.createStartElement("",
TextCorpusStored.XML_NAMESPACE, TextCorpusStored.XML_NAME,
attrs.iterator(), nss.iterator());
xmlEventWriter.add(e);
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE);
xmlEventWriter.add(e);
} else {
// rewrite all before end of TextCorpus
xmlReaderWriter.readWriteUpToEndElement(TextCorpusStored.XML_NAME);
}
// write new layers of TextCorpus:
List<TextCorpusLayer> tcLayers = textCorpus.getLayers();
for (TextCorpusLayer layer : tcLayers) {
if (!tcLayersToRead.contains(TextCorpusLayerTag.getFromClass(layer.getClass()))) {
marshall(layer);
}
}
if (!this.hasTextCorpus) {
// create the TextCorpus end element
e = eventFactory.createEndElement("",
TextCorpusStored.XML_NAMESPACE, TextCorpusStored.XML_NAME);
xmlEventWriter.add(e);
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE);
xmlEventWriter.add(e);
}
// write to the end
xmlReaderWriter.readWriteToTheEnd();
}
} catch (XMLStreamException ex) {
throw new WLFormatException(ex.getMessage(), ex);
} finally {
cleanup();
}
} } | public class class_name {
public void close() throws WLFormatException {
if (closed) {
return;
}
closed = true;
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent e;
try {
if (this.xmlEventWriter != null) {
// rewrite all before end of ExternalData or, if ExternalData is not present, before start of TextCorpus
if (!this.hasExtData) {
// up to TextCorpus start
xmlReaderWriter.readWriteUpToStartElement(TextCorpusStored.XML_NAME); // depends on control dependency: [if], data = [none]
// create the ExternalData start element
List<Attribute> attrs = new ArrayList<Attribute>(0);
Namespace ns = eventFactory.createNamespace(ExternalDataStored.XML_NAMESPACE);
List<Namespace> nss = new ArrayList<Namespace>();
nss.add(ns); // depends on control dependency: [if], data = [none]
e = eventFactory.createStartElement("",
ExternalDataStored.XML_NAMESPACE, ExternalDataStored.XML_NAME,
attrs.iterator(), nss.iterator()); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
} else {
xmlReaderWriter.readWriteUpToEndElement(ExternalDataStored.XML_NAME); // depends on control dependency: [if], data = [none]
}
// write new layers of ExternalData
List<ExternalDataLayer> edLayers = extData.getLayers();
for (ExternalDataLayer layer : edLayers) {
if (!edLayersToRead.contains(ExternalDataLayerTag.getFromClass(layer.getClass()))) {
marshall(layer); // depends on control dependency: [if], data = [none]
}
}
if (!this.hasExtData) {
// create the ExternalData end element
e = eventFactory.createEndElement("",
ExternalDataStored.XML_NAMESPACE, ExternalDataStored.XML_NAME); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
}
if (!this.hasTextCorpus) {
// up to end D-Spin
xmlReaderWriter.readWriteUpToStartElement(WLData.XML_NAME); // depends on control dependency: [if], data = [none]
// create the TextCorpus start element
List<Attribute> attrs = new ArrayList<Attribute>(0);
Namespace ns = eventFactory.createNamespace(TextCorpusStored.XML_NAMESPACE);
List<Namespace> nss = new ArrayList<Namespace>();
nss.add(ns); // depends on control dependency: [if], data = [none]
e = eventFactory.createStartElement("",
TextCorpusStored.XML_NAMESPACE, TextCorpusStored.XML_NAME,
attrs.iterator(), nss.iterator()); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
} else {
// rewrite all before end of TextCorpus
xmlReaderWriter.readWriteUpToEndElement(TextCorpusStored.XML_NAME); // depends on control dependency: [if], data = [none]
}
// write new layers of TextCorpus:
List<TextCorpusLayer> tcLayers = textCorpus.getLayers();
for (TextCorpusLayer layer : tcLayers) {
if (!tcLayersToRead.contains(TextCorpusLayerTag.getFromClass(layer.getClass()))) {
marshall(layer); // depends on control dependency: [if], data = [none]
}
}
if (!this.hasTextCorpus) {
// create the TextCorpus end element
e = eventFactory.createEndElement("",
TextCorpusStored.XML_NAMESPACE, TextCorpusStored.XML_NAME); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
e = eventFactory.createIgnorableSpace(XmlReaderWriter.NEW_LINE); // depends on control dependency: [if], data = [none]
xmlEventWriter.add(e); // depends on control dependency: [if], data = [none]
}
// write to the end
xmlReaderWriter.readWriteToTheEnd(); // depends on control dependency: [if], data = [none]
}
} catch (XMLStreamException ex) {
throw new WLFormatException(ex.getMessage(), ex);
} finally {
cleanup();
}
} } |
public class class_name {
@Override
public int equivalence() {
int eqct = 0;
final List<String> nodes = pnt.getProtoNodes();
final Map<Integer, Integer> nodeTerms = pnt.getNodeTermIndex();
final int termct = nodeTerms.size();
final Map<EquivalentTerm, Integer> nodeCache = sizedHashMap(termct);
final Map<Integer, Integer> eqn = pnt.getEquivalences();
// clear out equivalences, since we're rebuilding them
eqn.clear();
// Iterate each node
int eq = 0;
for (int i = 0, n = nodes.size(); i < n; i++) {
final Integer termidx = nodeTerms.get(i);
final Term term = tt.getIndexedTerms().get(termidx);
// Convert to an equivalent term
EquivalentTerm equiv = eqCvtr.convert(term);
Integer eqId = nodeCache.get(equiv);
if (eqId != null) {
// We've seen an equivalent term before, use that.
eqn.put(i, eqId);
eqct++;
continue;
}
nodeCache.put(equiv, eq);
eqn.put(i, eq);
eq++;
}
return eqct;
} } | public class class_name {
@Override
public int equivalence() {
int eqct = 0;
final List<String> nodes = pnt.getProtoNodes();
final Map<Integer, Integer> nodeTerms = pnt.getNodeTermIndex();
final int termct = nodeTerms.size();
final Map<EquivalentTerm, Integer> nodeCache = sizedHashMap(termct);
final Map<Integer, Integer> eqn = pnt.getEquivalences();
// clear out equivalences, since we're rebuilding them
eqn.clear();
// Iterate each node
int eq = 0;
for (int i = 0, n = nodes.size(); i < n; i++) {
final Integer termidx = nodeTerms.get(i);
final Term term = tt.getIndexedTerms().get(termidx);
// Convert to an equivalent term
EquivalentTerm equiv = eqCvtr.convert(term);
Integer eqId = nodeCache.get(equiv);
if (eqId != null) {
// We've seen an equivalent term before, use that.
eqn.put(i, eqId); // depends on control dependency: [if], data = [none]
eqct++; // depends on control dependency: [if], data = [none]
continue;
}
nodeCache.put(equiv, eq); // depends on control dependency: [for], data = [none]
eqn.put(i, eq); // depends on control dependency: [for], data = [i]
eq++; // depends on control dependency: [for], data = [none]
}
return eqct;
} } |
public class class_name {
void addOrder(String condition) {
condition = condition.trim();
boolean descending = false;
if (condition.startsWith("-")) {
descending = true;
condition = condition.substring(1).trim();
}
// Prevent ordering by @Id or @Parent fields, which are really part of the key
if (this.classRestriction != null) {
final KeyMetadata<?> meta = loader.ofy.factory().keys().getMetadataSafe(this.classRestriction);
if (condition.equals(meta.getParentFieldName()))
throw new IllegalArgumentException("You cannot order by @Parent field. Perhaps you wish to order by __key__ instead?");
if (condition.equals(meta.getIdFieldName())) {
throw new IllegalArgumentException("You cannot order by @Id field. Perhaps you wish to order by __key__ instead?");
}
}
this.actual = actual.orderBy(descending ? OrderBy.desc(condition) : OrderBy.asc(condition));
} } | public class class_name {
void addOrder(String condition) {
condition = condition.trim();
boolean descending = false;
if (condition.startsWith("-")) {
descending = true;
// depends on control dependency: [if], data = [none]
condition = condition.substring(1).trim();
// depends on control dependency: [if], data = [none]
}
// Prevent ordering by @Id or @Parent fields, which are really part of the key
if (this.classRestriction != null) {
final KeyMetadata<?> meta = loader.ofy.factory().keys().getMetadataSafe(this.classRestriction);
if (condition.equals(meta.getParentFieldName()))
throw new IllegalArgumentException("You cannot order by @Parent field. Perhaps you wish to order by __key__ instead?");
if (condition.equals(meta.getIdFieldName())) {
throw new IllegalArgumentException("You cannot order by @Id field. Perhaps you wish to order by __key__ instead?");
}
}
this.actual = actual.orderBy(descending ? OrderBy.desc(condition) : OrderBy.asc(condition));
} } |
public class class_name {
public void setMinimumSignificantDigits(int min) {
if (min < 1) {
min = 1;
}
// pin max sig dig to >= min
int max = Math.max(maxSignificantDigits, min);
minSignificantDigits = min;
maxSignificantDigits = max;
setSignificantDigitsUsed(true);
} } | public class class_name {
public void setMinimumSignificantDigits(int min) {
if (min < 1) {
min = 1; // depends on control dependency: [if], data = [none]
}
// pin max sig dig to >= min
int max = Math.max(maxSignificantDigits, min);
minSignificantDigits = min;
maxSignificantDigits = max;
setSignificantDigitsUsed(true);
} } |
public class class_name {
public CreateLoadBalancerRequest withSubnetMappings(SubnetMapping... subnetMappings) {
if (this.subnetMappings == null) {
setSubnetMappings(new java.util.ArrayList<SubnetMapping>(subnetMappings.length));
}
for (SubnetMapping ele : subnetMappings) {
this.subnetMappings.add(ele);
}
return this;
} } | public class class_name {
public CreateLoadBalancerRequest withSubnetMappings(SubnetMapping... subnetMappings) {
if (this.subnetMappings == null) {
setSubnetMappings(new java.util.ArrayList<SubnetMapping>(subnetMappings.length)); // depends on control dependency: [if], data = [none]
}
for (SubnetMapping ele : subnetMappings) {
this.subnetMappings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(CreateDeliveryStreamRequest createDeliveryStreamRequest, ProtocolMarshaller protocolMarshaller) {
if (createDeliveryStreamRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDeliveryStreamRequest.getDeliveryStreamName(), DELIVERYSTREAMNAME_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getDeliveryStreamType(), DELIVERYSTREAMTYPE_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getKinesisStreamSourceConfiguration(), KINESISSTREAMSOURCECONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getS3DestinationConfiguration(), S3DESTINATIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getExtendedS3DestinationConfiguration(), EXTENDEDS3DESTINATIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getRedshiftDestinationConfiguration(), REDSHIFTDESTINATIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getElasticsearchDestinationConfiguration(), ELASTICSEARCHDESTINATIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getSplunkDestinationConfiguration(), SPLUNKDESTINATIONCONFIGURATION_BINDING);
protocolMarshaller.marshall(createDeliveryStreamRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateDeliveryStreamRequest createDeliveryStreamRequest, ProtocolMarshaller protocolMarshaller) {
if (createDeliveryStreamRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDeliveryStreamRequest.getDeliveryStreamName(), DELIVERYSTREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getDeliveryStreamType(), DELIVERYSTREAMTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getKinesisStreamSourceConfiguration(), KINESISSTREAMSOURCECONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getS3DestinationConfiguration(), S3DESTINATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getExtendedS3DestinationConfiguration(), EXTENDEDS3DESTINATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getRedshiftDestinationConfiguration(), REDSHIFTDESTINATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getElasticsearchDestinationConfiguration(), ELASTICSEARCHDESTINATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getSplunkDestinationConfiguration(), SPLUNKDESTINATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeliveryStreamRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <E> void dotProductInPlace(Counter<E> target, Counter<E> term) {
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) * term.getCount(key));
}
} } | public class class_name {
public static <E> void dotProductInPlace(Counter<E> target, Counter<E> term) {
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) * term.getCount(key));
// depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
public CmsJspInstanceDateBean getFirst() {
if ((m_firstEvent == null) && (m_dates != null) && (!m_dates.isEmpty())) {
m_firstEvent = new CmsJspInstanceDateBean((Date)m_dates.first().clone(), CmsJspDateSeriesBean.this);
}
return m_firstEvent;
} } | public class class_name {
public CmsJspInstanceDateBean getFirst() {
if ((m_firstEvent == null) && (m_dates != null) && (!m_dates.isEmpty())) {
m_firstEvent = new CmsJspInstanceDateBean((Date)m_dates.first().clone(), CmsJspDateSeriesBean.this); // depends on control dependency: [if], data = [none]
}
return m_firstEvent;
} } |
public class class_name {
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) {
if (source == null) {
return null;
}
PlanVersionBean bean = new PlanVersionBean();
bean.setVersion(asString(source.get("version")));
bean.setStatus(asEnum(source.get("status"), PlanStatus.class));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
bean.setLockedOn(asDate(source.get("lockedOn")));
postMarshall(bean);
return bean;
} } | public class class_name {
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) {
if (source == null) {
return null; // depends on control dependency: [if], data = [none]
}
PlanVersionBean bean = new PlanVersionBean();
bean.setVersion(asString(source.get("version")));
bean.setStatus(asEnum(source.get("status"), PlanStatus.class));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
bean.setLockedOn(asDate(source.get("lockedOn")));
postMarshall(bean);
return bean;
} } |
public class class_name {
@Override
protected Object handleGetObject(String key) {
try {
return this.messageSource.getMessage(key, null, this.locale);
} catch (NoSuchMessageException ex) {
return null;
}
} } | public class class_name {
@Override
protected Object handleGetObject(String key) {
try {
return this.messageSource.getMessage(key, null, this.locale); // depends on control dependency: [try], data = [none]
} catch (NoSuchMessageException ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void readMethods() throws IOException, ClassfileFormatException {
// Methods
final int methodCount = inputStreamOrByteBuffer.readUnsignedShort();
for (int i = 0; i < methodCount; i++) {
// Info on modifier flags: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6
final int methodModifierFlags = inputStreamOrByteBuffer.readUnsignedShort();
final boolean isPublicMethod = ((methodModifierFlags & 0x0001) == 0x0001);
final boolean methodIsVisible = isPublicMethod || scanSpec.ignoreMethodVisibility;
String methodName = null;
String methodTypeDescriptor = null;
String methodTypeSignature = null;
// Always enable MethodInfo for annotations (this is how annotation constants are defined)
final boolean enableMethodInfo = scanSpec.enableMethodInfo || isAnnotation;
if (enableMethodInfo || isAnnotation) { // Annotations store defaults in method_info
final int methodNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
methodName = getConstantPoolString(methodNameCpIdx);
final int methodTypeDescriptorCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
methodTypeDescriptor = getConstantPoolString(methodTypeDescriptorCpIdx);
} else {
inputStreamOrByteBuffer.skip(4); // name_index, descriptor_index
}
final int attributesCount = inputStreamOrByteBuffer.readUnsignedShort();
String[] methodParameterNames = null;
int[] methodParameterModifiers = null;
AnnotationInfo[][] methodParameterAnnotations = null;
AnnotationInfoList methodAnnotationInfo = null;
boolean methodHasBody = false;
if (!methodIsVisible || (!enableMethodInfo && !isAnnotation)) {
// Skip method attributes
for (int j = 0; j < attributesCount; j++) {
inputStreamOrByteBuffer.skip(2); // attribute_name_index
final int attributeLength = inputStreamOrByteBuffer.readInt();
inputStreamOrByteBuffer.skip(attributeLength);
}
} else {
// Look for method annotations
for (int j = 0; j < attributesCount; j++) {
final int attributeNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
final int attributeLength = inputStreamOrByteBuffer.readInt();
if (scanSpec.enableAnnotationInfo
&& (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleAnnotations")
|| (!scanSpec.disableRuntimeInvisibleAnnotations && constantPoolStringEquals(
attributeNameCpIdx, "RuntimeInvisibleAnnotations")))) {
final int methodAnnotationCount = inputStreamOrByteBuffer.readUnsignedShort();
if (methodAnnotationCount > 0) {
if (methodAnnotationInfo == null) {
methodAnnotationInfo = new AnnotationInfoList(1);
}
for (int k = 0; k < methodAnnotationCount; k++) {
final AnnotationInfo annotationInfo = readAnnotation();
methodAnnotationInfo.add(annotationInfo);
}
}
} else if (scanSpec.enableAnnotationInfo
&& (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleParameterAnnotations")
|| (!scanSpec.disableRuntimeInvisibleAnnotations && constantPoolStringEquals(
attributeNameCpIdx, "RuntimeInvisibleParameterAnnotations")))) {
// Merge together runtime visible and runtime invisible annotations into a single array
// of annotations for each method parameter (runtime visible and runtime invisible
// annotations are given in separate attributes, so if both attributes are present,
// have to make the parameter annotation arrays larger when the second attribute is
// encountered).
final int numParams = inputStreamOrByteBuffer.readUnsignedByte();
if (methodParameterAnnotations == null) {
methodParameterAnnotations = new AnnotationInfo[numParams][];
} else if (methodParameterAnnotations.length != numParams) {
throw new ClassfileFormatException(
"Mismatch in number of parameters between RuntimeVisibleParameterAnnotations "
+ "and RuntimeInvisibleParameterAnnotations");
}
for (int paramIdx = 0; paramIdx < numParams; paramIdx++) {
final int numAnnotations = inputStreamOrByteBuffer.readUnsignedShort();
if (numAnnotations > 0) {
int annStartIdx = 0;
if (methodParameterAnnotations[paramIdx] != null) {
annStartIdx = methodParameterAnnotations[paramIdx].length;
methodParameterAnnotations[paramIdx] = Arrays.copyOf(
methodParameterAnnotations[paramIdx], annStartIdx + numAnnotations);
} else {
methodParameterAnnotations[paramIdx] = new AnnotationInfo[numAnnotations];
}
for (int annIdx = 0; annIdx < numAnnotations; annIdx++) {
methodParameterAnnotations[paramIdx][annStartIdx + annIdx] = readAnnotation();
}
} else if (methodParameterAnnotations[paramIdx] == null) {
methodParameterAnnotations[paramIdx] = NO_ANNOTATIONS;
}
}
} else if (constantPoolStringEquals(attributeNameCpIdx, "MethodParameters")) {
// Read method parameters. For Java, these are only produced in JDK8+, and only if the
// commandline switch `-parameters` is provided at compiletime.
final int paramCount = inputStreamOrByteBuffer.readUnsignedByte();
methodParameterNames = new String[paramCount];
methodParameterModifiers = new int[paramCount];
for (int k = 0; k < paramCount; k++) {
final int cpIdx = inputStreamOrByteBuffer.readUnsignedShort();
// If the constant pool index is zero, then the parameter is unnamed => use null
methodParameterNames[k] = cpIdx == 0 ? null : getConstantPoolString(cpIdx);
methodParameterModifiers[k] = inputStreamOrByteBuffer.readUnsignedShort();
}
} else if (constantPoolStringEquals(attributeNameCpIdx, "Signature")) {
// Add type params to method type signature
methodTypeSignature = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
} else if (constantPoolStringEquals(attributeNameCpIdx, "AnnotationDefault")) {
if (annotationParamDefaultValues == null) {
annotationParamDefaultValues = new AnnotationParameterValueList();
}
this.annotationParamDefaultValues.add(new AnnotationParameterValue(methodName,
// Get annotation parameter default value
readAnnotationElementValue()));
} else if (constantPoolStringEquals(attributeNameCpIdx, "Code")) {
methodHasBody = true;
inputStreamOrByteBuffer.skip(attributeLength);
} else {
inputStreamOrByteBuffer.skip(attributeLength);
}
}
// Create MethodInfo
if (enableMethodInfo) {
if (methodInfoList == null) {
methodInfoList = new MethodInfoList();
}
methodInfoList.add(new MethodInfo(className, methodName, methodAnnotationInfo,
methodModifierFlags, methodTypeDescriptor, methodTypeSignature, methodParameterNames,
methodParameterModifiers, methodParameterAnnotations, methodHasBody));
}
}
}
} } | public class class_name {
private void readMethods() throws IOException, ClassfileFormatException {
// Methods
final int methodCount = inputStreamOrByteBuffer.readUnsignedShort();
for (int i = 0; i < methodCount; i++) {
// Info on modifier flags: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6
final int methodModifierFlags = inputStreamOrByteBuffer.readUnsignedShort();
final boolean isPublicMethod = ((methodModifierFlags & 0x0001) == 0x0001);
final boolean methodIsVisible = isPublicMethod || scanSpec.ignoreMethodVisibility;
String methodName = null;
String methodTypeDescriptor = null;
String methodTypeSignature = null;
// Always enable MethodInfo for annotations (this is how annotation constants are defined)
final boolean enableMethodInfo = scanSpec.enableMethodInfo || isAnnotation;
if (enableMethodInfo || isAnnotation) { // Annotations store defaults in method_info
final int methodNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
methodName = getConstantPoolString(methodNameCpIdx);
final int methodTypeDescriptorCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
methodTypeDescriptor = getConstantPoolString(methodTypeDescriptorCpIdx);
} else {
inputStreamOrByteBuffer.skip(4); // name_index, descriptor_index
}
final int attributesCount = inputStreamOrByteBuffer.readUnsignedShort();
String[] methodParameterNames = null;
int[] methodParameterModifiers = null;
AnnotationInfo[][] methodParameterAnnotations = null;
AnnotationInfoList methodAnnotationInfo = null;
boolean methodHasBody = false;
if (!methodIsVisible || (!enableMethodInfo && !isAnnotation)) {
// Skip method attributes
for (int j = 0; j < attributesCount; j++) {
inputStreamOrByteBuffer.skip(2); // attribute_name_index // depends on control dependency: [for], data = [none]
final int attributeLength = inputStreamOrByteBuffer.readInt();
inputStreamOrByteBuffer.skip(attributeLength); // depends on control dependency: [for], data = [none]
}
} else {
// Look for method annotations
for (int j = 0; j < attributesCount; j++) {
final int attributeNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
final int attributeLength = inputStreamOrByteBuffer.readInt();
if (scanSpec.enableAnnotationInfo
&& (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleAnnotations")
|| (!scanSpec.disableRuntimeInvisibleAnnotations && constantPoolStringEquals(
attributeNameCpIdx, "RuntimeInvisibleAnnotations")))) {
final int methodAnnotationCount = inputStreamOrByteBuffer.readUnsignedShort();
if (methodAnnotationCount > 0) {
if (methodAnnotationInfo == null) {
methodAnnotationInfo = new AnnotationInfoList(1); // depends on control dependency: [if], data = [none]
}
for (int k = 0; k < methodAnnotationCount; k++) {
final AnnotationInfo annotationInfo = readAnnotation();
methodAnnotationInfo.add(annotationInfo); // depends on control dependency: [for], data = [none]
}
}
} else if (scanSpec.enableAnnotationInfo
&& (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleParameterAnnotations")
|| (!scanSpec.disableRuntimeInvisibleAnnotations && constantPoolStringEquals(
attributeNameCpIdx, "RuntimeInvisibleParameterAnnotations")))) {
// Merge together runtime visible and runtime invisible annotations into a single array
// of annotations for each method parameter (runtime visible and runtime invisible
// annotations are given in separate attributes, so if both attributes are present,
// have to make the parameter annotation arrays larger when the second attribute is
// encountered).
final int numParams = inputStreamOrByteBuffer.readUnsignedByte();
if (methodParameterAnnotations == null) {
methodParameterAnnotations = new AnnotationInfo[numParams][]; // depends on control dependency: [if], data = [none]
} else if (methodParameterAnnotations.length != numParams) {
throw new ClassfileFormatException(
"Mismatch in number of parameters between RuntimeVisibleParameterAnnotations "
+ "and RuntimeInvisibleParameterAnnotations");
}
for (int paramIdx = 0; paramIdx < numParams; paramIdx++) {
final int numAnnotations = inputStreamOrByteBuffer.readUnsignedShort();
if (numAnnotations > 0) {
int annStartIdx = 0;
if (methodParameterAnnotations[paramIdx] != null) {
annStartIdx = methodParameterAnnotations[paramIdx].length; // depends on control dependency: [if], data = [none]
methodParameterAnnotations[paramIdx] = Arrays.copyOf(
methodParameterAnnotations[paramIdx], annStartIdx + numAnnotations); // depends on control dependency: [if], data = [none]
} else {
methodParameterAnnotations[paramIdx] = new AnnotationInfo[numAnnotations]; // depends on control dependency: [if], data = [none]
}
for (int annIdx = 0; annIdx < numAnnotations; annIdx++) {
methodParameterAnnotations[paramIdx][annStartIdx + annIdx] = readAnnotation(); // depends on control dependency: [for], data = [annIdx]
}
} else if (methodParameterAnnotations[paramIdx] == null) {
methodParameterAnnotations[paramIdx] = NO_ANNOTATIONS; // depends on control dependency: [if], data = [none]
}
}
} else if (constantPoolStringEquals(attributeNameCpIdx, "MethodParameters")) {
// Read method parameters. For Java, these are only produced in JDK8+, and only if the
// commandline switch `-parameters` is provided at compiletime.
final int paramCount = inputStreamOrByteBuffer.readUnsignedByte();
methodParameterNames = new String[paramCount]; // depends on control dependency: [if], data = [none]
methodParameterModifiers = new int[paramCount]; // depends on control dependency: [if], data = [none]
for (int k = 0; k < paramCount; k++) {
final int cpIdx = inputStreamOrByteBuffer.readUnsignedShort();
// If the constant pool index is zero, then the parameter is unnamed => use null
methodParameterNames[k] = cpIdx == 0 ? null : getConstantPoolString(cpIdx); // depends on control dependency: [for], data = [k]
methodParameterModifiers[k] = inputStreamOrByteBuffer.readUnsignedShort(); // depends on control dependency: [for], data = [k]
}
} else if (constantPoolStringEquals(attributeNameCpIdx, "Signature")) {
// Add type params to method type signature
methodTypeSignature = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort()); // depends on control dependency: [if], data = [none]
} else if (constantPoolStringEquals(attributeNameCpIdx, "AnnotationDefault")) {
if (annotationParamDefaultValues == null) {
annotationParamDefaultValues = new AnnotationParameterValueList(); // depends on control dependency: [if], data = [none]
}
this.annotationParamDefaultValues.add(new AnnotationParameterValue(methodName,
// Get annotation parameter default value
readAnnotationElementValue())); // depends on control dependency: [if], data = [none]
} else if (constantPoolStringEquals(attributeNameCpIdx, "Code")) {
methodHasBody = true; // depends on control dependency: [if], data = [none]
inputStreamOrByteBuffer.skip(attributeLength); // depends on control dependency: [if], data = [none]
} else {
inputStreamOrByteBuffer.skip(attributeLength); // depends on control dependency: [if], data = [none]
}
}
// Create MethodInfo
if (enableMethodInfo) {
if (methodInfoList == null) {
methodInfoList = new MethodInfoList(); // depends on control dependency: [if], data = [none]
}
methodInfoList.add(new MethodInfo(className, methodName, methodAnnotationInfo,
methodModifierFlags, methodTypeDescriptor, methodTypeSignature, methodParameterNames,
methodParameterModifiers, methodParameterAnnotations, methodHasBody)); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private boolean updateDelivered(Message message) {
if (consumers.size() <= 1) {
return true;
}
String pubid = (String) message.getMetadata("cwf.pub.event");
return deliveredMessageCache.putIfAbsent(pubid, "") == null;
} } | public class class_name {
private boolean updateDelivered(Message message) {
if (consumers.size() <= 1) {
return true; // depends on control dependency: [if], data = [none]
}
String pubid = (String) message.getMetadata("cwf.pub.event");
return deliveredMessageCache.putIfAbsent(pubid, "") == null;
} } |
public class class_name {
public InternalIndex matchIndex(String pattern, QueryContext.IndexMatchHint matchHint) {
if (matchHint == QueryContext.IndexMatchHint.EXACT_NAME) {
return indexesByName.get(pattern);
} else {
return attributeIndexRegistry.match(pattern, matchHint);
}
} } | public class class_name {
public InternalIndex matchIndex(String pattern, QueryContext.IndexMatchHint matchHint) {
if (matchHint == QueryContext.IndexMatchHint.EXACT_NAME) {
return indexesByName.get(pattern); // depends on control dependency: [if], data = [none]
} else {
return attributeIndexRegistry.match(pattern, matchHint); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private <T> Optional<T> getValue(Object object, Supplier<Object> method, WaveItem<T> waveItem) {
T source = null;
if (ClassUtility.getClassFromType(waveItem.type()).isInstance(method.get())) {
source = (T) method.get();
} else {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("Cannot cast object " + method.get() + " to " + waveItem.type().toString());
}
}
return Optional.ofNullable(source);
} } | public class class_name {
@SuppressWarnings("unchecked")
private <T> Optional<T> getValue(Object object, Supplier<Object> method, WaveItem<T> waveItem) {
T source = null;
if (ClassUtility.getClassFromType(waveItem.type()).isInstance(method.get())) {
source = (T) method.get(); // depends on control dependency: [if], data = [none]
} else {
if (CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException("Cannot cast object " + method.get() + " to " + waveItem.type().toString());
}
}
return Optional.ofNullable(source);
} } |
public class class_name {
private boolean isCandidate(String name, List<Node> refs) {
if (!OptimizeCalls.mayBeOptimizableName(compiler, name)) {
return false;
}
boolean seenCandidateDefiniton = false;
boolean seenUse = false;
for (Node n : refs) {
// Assume indirect definitions references use the result
if (ReferenceMap.isCallTarget(n)) {
Node callNode = ReferenceMap.getCallOrNewNodeForTarget(n);
if (NodeUtil.isExpressionResultUsed(callNode)) {
// At least one call site uses the return value, this
// is not a candidate.
return false;
}
seenUse = true;
} else if (isCandidateDefinition(n)) {
// NOTE: While is is possible to optimize calls to functions for which we know
// only some of the definition are candidates but to keep things simple, only
// optimize if all of the definitions are known.
seenCandidateDefiniton = true;
} else {
// If this isn't an non-aliasing reference (typeof, instanceof, etc)
// then there is nothing that can be done.
if (!OptimizeCalls.isAllowedReference(n)) {
return false;
}
}
}
return seenUse && seenCandidateDefiniton;
} } | public class class_name {
private boolean isCandidate(String name, List<Node> refs) {
if (!OptimizeCalls.mayBeOptimizableName(compiler, name)) {
return false; // depends on control dependency: [if], data = [none]
}
boolean seenCandidateDefiniton = false;
boolean seenUse = false;
for (Node n : refs) {
// Assume indirect definitions references use the result
if (ReferenceMap.isCallTarget(n)) {
Node callNode = ReferenceMap.getCallOrNewNodeForTarget(n);
if (NodeUtil.isExpressionResultUsed(callNode)) {
// At least one call site uses the return value, this
// is not a candidate.
return false; // depends on control dependency: [if], data = [none]
}
seenUse = true; // depends on control dependency: [if], data = [none]
} else if (isCandidateDefinition(n)) {
// NOTE: While is is possible to optimize calls to functions for which we know
// only some of the definition are candidates but to keep things simple, only
// optimize if all of the definitions are known.
seenCandidateDefiniton = true; // depends on control dependency: [if], data = [none]
} else {
// If this isn't an non-aliasing reference (typeof, instanceof, etc)
// then there is nothing that can be done.
if (!OptimizeCalls.isAllowedReference(n)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return seenUse && seenCandidateDefiniton;
} } |
public class class_name {
public void publish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Publishing web application [{}]", webApp);
final BundleContext webAppBundleContext = BundleUtils
.getBundleContext(webApp.getBundle());
if (webAppBundleContext != null) {
try {
Filter filter = webAppBundleContext.createFilter(String.format(
"(&(objectClass=%s)(bundle.id=%d))",
WebAppDependencyHolder.class.getName(), webApp
.getBundle().getBundleId()));
ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder> dependencyTracker = new ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder>(
webAppBundleContext, filter,
new WebAppDependencyListener(webApp, eventDispatcher,
bundleContext));
webApps.put(webApp, dependencyTracker);
dependencyTracker.open();
} catch (InvalidSyntaxException exc) {
throw new IllegalArgumentException(exc);
}
} else {
LOG.warn("Bundle context could not be discovered for bundle ["
+ webApp.getBundle() + "]"
+ "Skipping publishing of web application [" + webApp + "]");
}
} } | public class class_name {
public void publish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Publishing web application [{}]", webApp);
final BundleContext webAppBundleContext = BundleUtils
.getBundleContext(webApp.getBundle());
if (webAppBundleContext != null) {
try {
Filter filter = webAppBundleContext.createFilter(String.format(
"(&(objectClass=%s)(bundle.id=%d))",
WebAppDependencyHolder.class.getName(), webApp
.getBundle().getBundleId()));
ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder> dependencyTracker = new ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder>(
webAppBundleContext, filter,
new WebAppDependencyListener(webApp, eventDispatcher,
bundleContext));
webApps.put(webApp, dependencyTracker);
// depends on control dependency: [try], data = [none]
dependencyTracker.open();
// depends on control dependency: [try], data = [none]
} catch (InvalidSyntaxException exc) {
throw new IllegalArgumentException(exc);
}
// depends on control dependency: [catch], data = [none]
} else {
LOG.warn("Bundle context could not be discovered for bundle ["
+ webApp.getBundle() + "]"
+ "Skipping publishing of web application [" + webApp + "]");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public double execute(Geometry geom1, Geometry geom2,
ProgressTracker progressTracker) {
if (null == geom1 || null == geom2) {
throw new IllegalArgumentException();
}
Geometry geometryA = geom1;
Geometry geometryB = geom2;
if (geometryA.isEmpty() || geometryB.isEmpty())
return NumberUtils.TheNaN;
Polygon polygonA;
Polygon polygonB;
MultiPoint multiPointA;
MultiPoint multiPointB;
// if geometryA is an envelope use a polygon instead (if geom1 was
// folded, then geometryA will already be a polygon)
// if geometryA is a point use a multipoint instead
Geometry.Type gtA = geometryA.getType();
Geometry.Type gtB = geometryB.getType();
if (gtA == Geometry.Type.Point) {
if (gtB == Geometry.Type.Point) {
return Point2D.distance(((Point)geometryA).getXY(), ((Point)geometryB).getXY());
}
else if (gtB == Geometry.Type.Envelope) {
Envelope2D envB = new Envelope2D();
geometryB.queryEnvelope2D(envB);
return envB.distance(((Point)geometryA).getXY());
}
multiPointA = new MultiPoint();
multiPointA.add((Point) geometryA);
geometryA = multiPointA;
} else if (gtA == Geometry.Type.Envelope) {
if (gtB == Geometry.Type.Envelope) {
Envelope2D envA = new Envelope2D();
geometryA.queryEnvelope2D(envA);
Envelope2D envB = new Envelope2D();
geometryB.queryEnvelope2D(envB);
return envB.distance(envA);
}
polygonA = new Polygon();
polygonA.addEnvelope((Envelope) geometryA, false);
geometryA = polygonA;
}
// if geom_2 is an envelope use a polygon instead
// if geom_2 is a point use a multipoint instead
if (gtB == Geometry.Type.Point) {
multiPointB = new MultiPoint();
multiPointB.add((Point) geometryB);
geometryB = multiPointB;
} else if (gtB == Geometry.Type.Envelope) {
polygonB = new Polygon();
polygonB.addEnvelope((Envelope) geometryB, false);
geometryB = polygonB;
}
DistanceCalculator distanceCalculator = new DistanceCalculator(
progressTracker);
double distance = distanceCalculator.calculate(geometryA, geometryB);
return distance;
} } | public class class_name {
@Override
public double execute(Geometry geom1, Geometry geom2,
ProgressTracker progressTracker) {
if (null == geom1 || null == geom2) {
throw new IllegalArgumentException();
}
Geometry geometryA = geom1;
Geometry geometryB = geom2;
if (geometryA.isEmpty() || geometryB.isEmpty())
return NumberUtils.TheNaN;
Polygon polygonA;
Polygon polygonB;
MultiPoint multiPointA;
MultiPoint multiPointB;
// if geometryA is an envelope use a polygon instead (if geom1 was
// folded, then geometryA will already be a polygon)
// if geometryA is a point use a multipoint instead
Geometry.Type gtA = geometryA.getType();
Geometry.Type gtB = geometryB.getType();
if (gtA == Geometry.Type.Point) {
if (gtB == Geometry.Type.Point) {
return Point2D.distance(((Point)geometryA).getXY(), ((Point)geometryB).getXY()); // depends on control dependency: [if], data = [none]
}
else if (gtB == Geometry.Type.Envelope) {
Envelope2D envB = new Envelope2D();
geometryB.queryEnvelope2D(envB); // depends on control dependency: [if], data = [none]
return envB.distance(((Point)geometryA).getXY()); // depends on control dependency: [if], data = [none]
}
multiPointA = new MultiPoint(); // depends on control dependency: [if], data = [none]
multiPointA.add((Point) geometryA); // depends on control dependency: [if], data = [none]
geometryA = multiPointA; // depends on control dependency: [if], data = [none]
} else if (gtA == Geometry.Type.Envelope) {
if (gtB == Geometry.Type.Envelope) {
Envelope2D envA = new Envelope2D();
geometryA.queryEnvelope2D(envA); // depends on control dependency: [if], data = [none]
Envelope2D envB = new Envelope2D();
geometryB.queryEnvelope2D(envB); // depends on control dependency: [if], data = [none]
return envB.distance(envA); // depends on control dependency: [if], data = [none]
}
polygonA = new Polygon(); // depends on control dependency: [if], data = [none]
polygonA.addEnvelope((Envelope) geometryA, false); // depends on control dependency: [if], data = [none]
geometryA = polygonA; // depends on control dependency: [if], data = [none]
}
// if geom_2 is an envelope use a polygon instead
// if geom_2 is a point use a multipoint instead
if (gtB == Geometry.Type.Point) {
multiPointB = new MultiPoint(); // depends on control dependency: [if], data = [none]
multiPointB.add((Point) geometryB); // depends on control dependency: [if], data = [none]
geometryB = multiPointB; // depends on control dependency: [if], data = [none]
} else if (gtB == Geometry.Type.Envelope) {
polygonB = new Polygon(); // depends on control dependency: [if], data = [none]
polygonB.addEnvelope((Envelope) geometryB, false); // depends on control dependency: [if], data = [none]
geometryB = polygonB; // depends on control dependency: [if], data = [none]
}
DistanceCalculator distanceCalculator = new DistanceCalculator(
progressTracker);
double distance = distanceCalculator.calculate(geometryA, geometryB);
return distance;
} } |
public class class_name {
public List<String> prefixMatch(String prefix)
{
int curState = 1;
IntArrayList bytes = new IntArrayList(prefix.length() * 4);
for (int i = 0; i < prefix.length(); i++)
{
int codePoint = prefix.charAt(i);
if (curState < 1)
{
return Collections.emptyList();
}
if ((curState != 1) && (isEmpty(curState)))
{
return Collections.emptyList();
}
int[] ids = this.charMap.toIdList(codePoint);
if (ids.length == 0)
{
return Collections.emptyList();
}
for (int j = 0; j < ids.length; j++)
{
int c = ids[j];
if ((getBase(curState) + c < getBaseArraySize())
&& (getCheck(getBase(curState) + c) == curState))
{
bytes.append(c);
curState = getBase(curState) + c;
}
else
{
return Collections.emptyList();
}
}
}
List<String> result = new ArrayList<String>();
recursiveAddSubTree(curState, result, bytes);
return result;
} } | public class class_name {
public List<String> prefixMatch(String prefix)
{
int curState = 1;
IntArrayList bytes = new IntArrayList(prefix.length() * 4);
for (int i = 0; i < prefix.length(); i++)
{
int codePoint = prefix.charAt(i);
if (curState < 1)
{
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
if ((curState != 1) && (isEmpty(curState)))
{
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
int[] ids = this.charMap.toIdList(codePoint);
if (ids.length == 0)
{
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < ids.length; j++)
{
int c = ids[j];
if ((getBase(curState) + c < getBaseArraySize())
&& (getCheck(getBase(curState) + c) == curState))
{
bytes.append(c); // depends on control dependency: [if], data = [none]
curState = getBase(curState) + c; // depends on control dependency: [if], data = [none]
}
else
{
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
}
}
List<String> result = new ArrayList<String>();
recursiveAddSubTree(curState, result, bytes);
return result;
} } |
public class class_name {
public boolean validateAllFields() {
boolean cardNumberIsValid =
CardUtils.isValidCardNumber(mCardNumberEditText.getCardNumber());
boolean expiryIsValid = mExpiryDateEditText.getValidDateFields() != null &&
mExpiryDateEditText.isDateValid();
boolean cvcIsValid = isCvcLengthValid();
mCardNumberEditText.setShouldShowError(!cardNumberIsValid);
mExpiryDateEditText.setShouldShowError(!expiryIsValid);
mCvcEditText.setShouldShowError(!cvcIsValid);
boolean postalCodeIsValidOrGone;
if (mShouldShowPostalCode) {
postalCodeIsValidOrGone = isPostalCodeMaximalLength(true,
mPostalCodeEditText.getText().toString());
mPostalCodeEditText.setShouldShowError(!postalCodeIsValidOrGone);
} else {
postalCodeIsValidOrGone = true;
}
return cardNumberIsValid
&& expiryIsValid
&& cvcIsValid
&& postalCodeIsValidOrGone;
} } | public class class_name {
public boolean validateAllFields() {
boolean cardNumberIsValid =
CardUtils.isValidCardNumber(mCardNumberEditText.getCardNumber());
boolean expiryIsValid = mExpiryDateEditText.getValidDateFields() != null &&
mExpiryDateEditText.isDateValid();
boolean cvcIsValid = isCvcLengthValid();
mCardNumberEditText.setShouldShowError(!cardNumberIsValid);
mExpiryDateEditText.setShouldShowError(!expiryIsValid);
mCvcEditText.setShouldShowError(!cvcIsValid);
boolean postalCodeIsValidOrGone;
if (mShouldShowPostalCode) {
postalCodeIsValidOrGone = isPostalCodeMaximalLength(true,
mPostalCodeEditText.getText().toString()); // depends on control dependency: [if], data = [none]
mPostalCodeEditText.setShouldShowError(!postalCodeIsValidOrGone); // depends on control dependency: [if], data = [none]
} else {
postalCodeIsValidOrGone = true; // depends on control dependency: [if], data = [none]
}
return cardNumberIsValid
&& expiryIsValid
&& cvcIsValid
&& postalCodeIsValidOrGone;
} } |
public class class_name {
public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds(final long compute)
{
long uebrig = -1;
final int[] result = new int[6];
final int years = (int)this.calculateInYears(compute);
if (0 < years)
{
result[0] = years;
uebrig = compute - years * ONE_YEAR;
}
else
{
result[0] = 0;
}
final int months = (int)this.calculateInDefaultMonth(uebrig);
if (0 < months)
{
result[1] = months;
uebrig -= months * ONE_DEFAULT_MONTH;
}
else
{
result[1] = 0;
}
final int days = (int)this.calculateInDays(uebrig);
if (0 < days)
{
result[2] = days;
uebrig -= days * ONE_DAY;
}
else
{
result[2] = 0;
}
final int hours = (int)this.calculateInHours(uebrig);
if (0 < hours)
{
result[3] = hours;
uebrig -= hours * ONE_HOUR;
}
else
{
result[3] = 0;
}
final int minutes = (int)this.calculateInMinutes(uebrig);
if (0 < minutes)
{
result[4] = minutes;
uebrig -= minutes * ONE_MINUTE;
}
else
{
result[4] = 0;
}
final int seconds = (int)this.calculateInSeconds(uebrig);
if (0 < seconds)
{
result[5] = seconds;
}
else
{
result[5] = 0;
}
return result;
} } | public class class_name {
public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds(final long compute)
{
long uebrig = -1;
final int[] result = new int[6];
final int years = (int)this.calculateInYears(compute);
if (0 < years)
{
result[0] = years; // depends on control dependency: [if], data = [none]
uebrig = compute - years * ONE_YEAR; // depends on control dependency: [if], data = [none]
}
else
{
result[0] = 0; // depends on control dependency: [if], data = [none]
}
final int months = (int)this.calculateInDefaultMonth(uebrig);
if (0 < months)
{
result[1] = months; // depends on control dependency: [if], data = [none]
uebrig -= months * ONE_DEFAULT_MONTH; // depends on control dependency: [if], data = [none]
}
else
{
result[1] = 0; // depends on control dependency: [if], data = [none]
}
final int days = (int)this.calculateInDays(uebrig);
if (0 < days)
{
result[2] = days; // depends on control dependency: [if], data = [none]
uebrig -= days * ONE_DAY; // depends on control dependency: [if], data = [none]
}
else
{
result[2] = 0; // depends on control dependency: [if], data = [none]
}
final int hours = (int)this.calculateInHours(uebrig);
if (0 < hours)
{
result[3] = hours; // depends on control dependency: [if], data = [none]
uebrig -= hours * ONE_HOUR; // depends on control dependency: [if], data = [none]
}
else
{
result[3] = 0; // depends on control dependency: [if], data = [none]
}
final int minutes = (int)this.calculateInMinutes(uebrig);
if (0 < minutes)
{
result[4] = minutes; // depends on control dependency: [if], data = [none]
uebrig -= minutes * ONE_MINUTE; // depends on control dependency: [if], data = [none]
}
else
{
result[4] = 0; // depends on control dependency: [if], data = [none]
}
final int seconds = (int)this.calculateInSeconds(uebrig);
if (0 < seconds)
{
result[5] = seconds; // depends on control dependency: [if], data = [none]
}
else
{
result[5] = 0; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Internal
public Plan createProgramPlan(String jobName, boolean clearSinks) {
if (this.sinks.isEmpty()) {
if (wasExecuted) {
throw new RuntimeException("No new data sinks have been defined since the " +
"last execution. The last execution refers to the latest call to " +
"'execute()', 'count()', 'collect()', or 'print()'.");
} else {
throw new RuntimeException("No data sinks have been created yet. " +
"A program needs at least one sink that consumes data. " +
"Examples are writing the data set or printing it.");
}
}
if (jobName == null) {
jobName = getDefaultName();
}
OperatorTranslation translator = new OperatorTranslation();
Plan plan = translator.translateToPlan(this.sinks, jobName);
if (getParallelism() > 0) {
plan.setDefaultParallelism(getParallelism());
}
plan.setExecutionConfig(getConfig());
// Check plan for GenericTypeInfo's and register the types at the serializers.
if (!config.isAutoTypeRegistrationDisabled()) {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
private final Set<Class<?>> registeredTypes = new HashSet<>();
private final Set<org.apache.flink.api.common.operators.Operator<?>> visitedOperators = new HashSet<>();
@Override
public boolean preVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {
if (!visitedOperators.add(visitable)) {
return false;
}
OperatorInformation<?> opInfo = visitable.getOperatorInfo();
Serializers.recursivelyRegisterType(opInfo.getOutputType(), config, registeredTypes);
return true;
}
@Override
public void postVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {}
});
}
try {
registerCachedFilesWithPlan(plan);
} catch (Exception e) {
throw new RuntimeException("Error while registering cached files: " + e.getMessage(), e);
}
// clear all the sinks such that the next execution does not redo everything
if (clearSinks) {
this.sinks.clear();
wasExecuted = true;
}
// All types are registered now. Print information.
int registeredTypes = config.getRegisteredKryoTypes().size() +
config.getRegisteredPojoTypes().size() +
config.getRegisteredTypesWithKryoSerializerClasses().size() +
config.getRegisteredTypesWithKryoSerializers().size();
int defaultKryoSerializers = config.getDefaultKryoSerializers().size() +
config.getDefaultKryoSerializerClasses().size();
LOG.info("The job has {} registered types and {} default Kryo serializers", registeredTypes, defaultKryoSerializers);
if (config.isForceKryoEnabled() && config.isForceAvroEnabled()) {
LOG.warn("In the ExecutionConfig, both Avro and Kryo are enforced. Using Kryo serializer");
}
if (config.isForceKryoEnabled()) {
LOG.info("Using KryoSerializer for serializing POJOs");
}
if (config.isForceAvroEnabled()) {
LOG.info("Using AvroSerializer for serializing POJOs");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Registered Kryo types: {}", config.getRegisteredKryoTypes().toString());
LOG.debug("Registered Kryo with Serializers types: {}", config.getRegisteredTypesWithKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo with Serializer Classes types: {}", config.getRegisteredTypesWithKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered Kryo default Serializers: {}", config.getDefaultKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo default Serializers Classes {}", config.getDefaultKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered POJO types: {}", config.getRegisteredPojoTypes().toString());
// print information about static code analysis
LOG.debug("Static code analysis mode: {}", config.getCodeAnalysisMode());
}
return plan;
} } | public class class_name {
@Internal
public Plan createProgramPlan(String jobName, boolean clearSinks) {
if (this.sinks.isEmpty()) {
if (wasExecuted) {
throw new RuntimeException("No new data sinks have been defined since the " +
"last execution. The last execution refers to the latest call to " +
"'execute()', 'count()', 'collect()', or 'print()'.");
} else {
throw new RuntimeException("No data sinks have been created yet. " +
"A program needs at least one sink that consumes data. " +
"Examples are writing the data set or printing it.");
}
}
if (jobName == null) {
jobName = getDefaultName(); // depends on control dependency: [if], data = [none]
}
OperatorTranslation translator = new OperatorTranslation();
Plan plan = translator.translateToPlan(this.sinks, jobName);
if (getParallelism() > 0) {
plan.setDefaultParallelism(getParallelism()); // depends on control dependency: [if], data = [(getParallelism()]
}
plan.setExecutionConfig(getConfig());
// Check plan for GenericTypeInfo's and register the types at the serializers.
if (!config.isAutoTypeRegistrationDisabled()) {
plan.accept(new Visitor<org.apache.flink.api.common.operators.Operator<?>>() {
private final Set<Class<?>> registeredTypes = new HashSet<>();
private final Set<org.apache.flink.api.common.operators.Operator<?>> visitedOperators = new HashSet<>();
@Override
public boolean preVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {
if (!visitedOperators.add(visitable)) {
return false;
}
OperatorInformation<?> opInfo = visitable.getOperatorInfo();
Serializers.recursivelyRegisterType(opInfo.getOutputType(), config, registeredTypes);
return true;
}
@Override
public void postVisit(org.apache.flink.api.common.operators.Operator<?> visitable) {}
}); // depends on control dependency: [if], data = [none]
}
try {
registerCachedFilesWithPlan(plan); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Error while registering cached files: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
// clear all the sinks such that the next execution does not redo everything
if (clearSinks) {
this.sinks.clear(); // depends on control dependency: [if], data = [none]
wasExecuted = true; // depends on control dependency: [if], data = [none]
}
// All types are registered now. Print information.
int registeredTypes = config.getRegisteredKryoTypes().size() +
config.getRegisteredPojoTypes().size() +
config.getRegisteredTypesWithKryoSerializerClasses().size() +
config.getRegisteredTypesWithKryoSerializers().size();
int defaultKryoSerializers = config.getDefaultKryoSerializers().size() +
config.getDefaultKryoSerializerClasses().size();
LOG.info("The job has {} registered types and {} default Kryo serializers", registeredTypes, defaultKryoSerializers);
if (config.isForceKryoEnabled() && config.isForceAvroEnabled()) {
LOG.warn("In the ExecutionConfig, both Avro and Kryo are enforced. Using Kryo serializer");
}
if (config.isForceKryoEnabled()) {
LOG.info("Using KryoSerializer for serializing POJOs");
}
if (config.isForceAvroEnabled()) {
LOG.info("Using AvroSerializer for serializing POJOs");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Registered Kryo types: {}", config.getRegisteredKryoTypes().toString());
LOG.debug("Registered Kryo with Serializers types: {}", config.getRegisteredTypesWithKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo with Serializer Classes types: {}", config.getRegisteredTypesWithKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered Kryo default Serializers: {}", config.getDefaultKryoSerializers().entrySet().toString());
LOG.debug("Registered Kryo default Serializers Classes {}", config.getDefaultKryoSerializerClasses().entrySet().toString());
LOG.debug("Registered POJO types: {}", config.getRegisteredPojoTypes().toString());
// print information about static code analysis
LOG.debug("Static code analysis mode: {}", config.getCodeAnalysisMode());
}
return plan;
} } |
public class class_name {
public long getNodeChangedSize(String nodePath)
{
long nodeDelta = 0;
Iterator<ChangesItem> changes = iterator();
while (changes.hasNext())
{
nodeDelta += changes.next().getNodeChangedSize(nodePath);
}
return nodeDelta;
} } | public class class_name {
public long getNodeChangedSize(String nodePath)
{
long nodeDelta = 0;
Iterator<ChangesItem> changes = iterator();
while (changes.hasNext())
{
nodeDelta += changes.next().getNodeChangedSize(nodePath); // depends on control dependency: [while], data = [none]
}
return nodeDelta;
} } |
public class class_name {
public Integer getAsInteger() {
if (value instanceof String) {
return Integer.valueOf((String)value);
} else if (value instanceof Long) {
return ((Long)value).intValue();
}
return (Integer)value;
} } | public class class_name {
public Integer getAsInteger() {
if (value instanceof String) {
return Integer.valueOf((String)value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Long) {
return ((Long)value).intValue(); // depends on control dependency: [if], data = [none]
}
return (Integer)value;
} } |
public class class_name {
public void hideHelpBubbles(Widget formPanel, boolean hide) {
if (hide) {
formPanel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().hideHelpBubbles());
} else {
formPanel.removeStyleName(I_CmsLayoutBundle.INSTANCE.form().hideHelpBubbles());
}
} } | public class class_name {
public void hideHelpBubbles(Widget formPanel, boolean hide) {
if (hide) {
formPanel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().hideHelpBubbles());
// depends on control dependency: [if], data = [none]
} else {
formPanel.removeStyleName(I_CmsLayoutBundle.INSTANCE.form().hideHelpBubbles());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void shutdown() {
if (shutdown.compareAndSet(false, true)) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
try {
acceptorSvr.close();
selector.close();
} catch (Throwable t) {
log.error("An error occurs when shutdown telnet server.", t);
throw new TelnetException(t);
}
}
} } | public class class_name {
public void shutdown() {
if (shutdown.compareAndSet(false, true)) {
Runtime.getRuntime().removeShutdownHook(shutdownHook); // depends on control dependency: [if], data = [none]
try {
acceptorSvr.close(); // depends on control dependency: [try], data = [none]
selector.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log.error("An error occurs when shutdown telnet server.", t);
throw new TelnetException(t);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public void removePointOfInterest(PointOfInterest poi) {
try {
if (this.deletePoiLocStatement == null) {
this.deletePoiLocStatement = this.conn.prepareStatement(DbConstants.DELETE_INDEX_STATEMENT);
}
if (this.deletePoiDataStatement == null) {
this.deletePoiDataStatement = this.conn.prepareStatement(DbConstants.DELETE_DATA_STATEMENT);
}
if (this.deletePoiCatStatement == null) {
this.deletePoiCatStatement = this.conn.prepareStatement(DbConstants.DELETE_CATEGORY_MAP_STATEMENT);
}
this.deletePoiLocStatement.clearParameters();
this.deletePoiDataStatement.clearParameters();
this.deletePoiCatStatement.clearParameters();
Statement stmt = this.conn.createStatement();
stmt.execute("BEGIN;");
this.deletePoiLocStatement.setLong(1, poi.getId());
this.deletePoiDataStatement.setLong(1, poi.getId());
this.deletePoiCatStatement.setLong(1, poi.getId());
this.deletePoiLocStatement.executeUpdate();
this.deletePoiDataStatement.executeUpdate();
this.deletePoiCatStatement.executeUpdate();
stmt.execute("COMMIT;");
stmt.close();
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
} } | public class class_name {
@Override
public void removePointOfInterest(PointOfInterest poi) {
try {
if (this.deletePoiLocStatement == null) {
this.deletePoiLocStatement = this.conn.prepareStatement(DbConstants.DELETE_INDEX_STATEMENT); // depends on control dependency: [if], data = [none]
}
if (this.deletePoiDataStatement == null) {
this.deletePoiDataStatement = this.conn.prepareStatement(DbConstants.DELETE_DATA_STATEMENT); // depends on control dependency: [if], data = [none]
}
if (this.deletePoiCatStatement == null) {
this.deletePoiCatStatement = this.conn.prepareStatement(DbConstants.DELETE_CATEGORY_MAP_STATEMENT); // depends on control dependency: [if], data = [none]
}
this.deletePoiLocStatement.clearParameters(); // depends on control dependency: [try], data = [none]
this.deletePoiDataStatement.clearParameters(); // depends on control dependency: [try], data = [none]
this.deletePoiCatStatement.clearParameters(); // depends on control dependency: [try], data = [none]
Statement stmt = this.conn.createStatement();
stmt.execute("BEGIN;"); // depends on control dependency: [try], data = [none]
this.deletePoiLocStatement.setLong(1, poi.getId()); // depends on control dependency: [try], data = [none]
this.deletePoiDataStatement.setLong(1, poi.getId()); // depends on control dependency: [try], data = [none]
this.deletePoiCatStatement.setLong(1, poi.getId()); // depends on control dependency: [try], data = [none]
this.deletePoiLocStatement.executeUpdate(); // depends on control dependency: [try], data = [none]
this.deletePoiDataStatement.executeUpdate(); // depends on control dependency: [try], data = [none]
this.deletePoiCatStatement.executeUpdate(); // depends on control dependency: [try], data = [none]
stmt.execute("COMMIT;"); // depends on control dependency: [try], data = [none]
stmt.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setInventoryDeletions(java.util.Collection<InventoryDeletionStatusItem> inventoryDeletions) {
if (inventoryDeletions == null) {
this.inventoryDeletions = null;
return;
}
this.inventoryDeletions = new com.amazonaws.internal.SdkInternalList<InventoryDeletionStatusItem>(inventoryDeletions);
} } | public class class_name {
public void setInventoryDeletions(java.util.Collection<InventoryDeletionStatusItem> inventoryDeletions) {
if (inventoryDeletions == null) {
this.inventoryDeletions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.inventoryDeletions = new com.amazonaws.internal.SdkInternalList<InventoryDeletionStatusItem>(inventoryDeletions);
} } |
public class class_name {
private String formatNode(PatriciaTrie.PatriciaNode<V> node, int bit, KeyMapper<String> keyMapper,
boolean formatBitString) {
if (node.getBit() <= bit) {
return "";
} else {
StringBuffer buffer = new StringBuffer();
buffer.append("\"");
buffer.append(getNodeId(node));
buffer.append("\"");
buffer.append(" [ ");
buffer.append("label=");
buffer.append(formatNodeLabel(node, keyMapper, formatBitString));
buffer.append(" ]");
buffer.append("\n");
buffer.append(formatPointer(node, node.getLeft(), "l", "sw"));
buffer.append(formatPointer(node, node.getRight(), "r", "se"));
buffer.append(formatNode(node.getLeft(), node.getBit(), keyMapper, formatBitString));
buffer.append(formatNode(node.getRight(), node.getBit(), keyMapper, formatBitString));
return buffer.toString();
}
} } | public class class_name {
private String formatNode(PatriciaTrie.PatriciaNode<V> node, int bit, KeyMapper<String> keyMapper,
boolean formatBitString) {
if (node.getBit() <= bit) {
return ""; // depends on control dependency: [if], data = [none]
} else {
StringBuffer buffer = new StringBuffer();
buffer.append("\""); // depends on control dependency: [if], data = [none]
buffer.append(getNodeId(node)); // depends on control dependency: [if], data = [none]
buffer.append("\""); // depends on control dependency: [if], data = [none]
buffer.append(" [ "); // depends on control dependency: [if], data = [none]
buffer.append("label="); // depends on control dependency: [if], data = [none]
buffer.append(formatNodeLabel(node, keyMapper, formatBitString)); // depends on control dependency: [if], data = [none]
buffer.append(" ]"); // depends on control dependency: [if], data = [none]
buffer.append("\n"); // depends on control dependency: [if], data = [none]
buffer.append(formatPointer(node, node.getLeft(), "l", "sw")); // depends on control dependency: [if], data = [none]
buffer.append(formatPointer(node, node.getRight(), "r", "se")); // depends on control dependency: [if], data = [none]
buffer.append(formatNode(node.getLeft(), node.getBit(), keyMapper, formatBitString)); // depends on control dependency: [if], data = [none]
buffer.append(formatNode(node.getRight(), node.getBit(), keyMapper, formatBitString)); // depends on control dependency: [if], data = [none]
return buffer.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addContextDataFactory(ContextDataFactory contextDataFactory) {
if (contextDataFactories == null) {
contextDataFactories = new ArrayList<>();
}
contextDataFactories.add(contextDataFactory);
} } | public class class_name {
public void addContextDataFactory(ContextDataFactory contextDataFactory) {
if (contextDataFactories == null) {
contextDataFactories = new ArrayList<>();
// depends on control dependency: [if], data = [none]
}
contextDataFactories.add(contextDataFactory);
} } |
public class class_name {
private Formula constructAnd(final LinkedHashSet<? extends Formula> operands) {
And tempAnd = null;
Map<LinkedHashSet<? extends Formula>, And> opAndMap = this.andsN;
if (operands.size() > 1) {
switch (operands.size()) {
case 2:
opAndMap = this.ands2;
break;
case 3:
opAndMap = this.ands3;
break;
case 4:
opAndMap = this.ands4;
break;
default:
break;
}
tempAnd = opAndMap.get(operands);
}
if (tempAnd != null)
return tempAnd;
final LinkedHashSet<? extends Formula> condensedOperands = operands.size() < 2
? operands
: this.condenseOperandsAnd(operands);
if (condensedOperands == null)
return this.falsum();
if (condensedOperands.isEmpty())
return this.verum();
if (condensedOperands.size() == 1)
return condensedOperands.iterator().next();
final And and;
Map<LinkedHashSet<? extends Formula>, And> condAndMap = this.andsN;
switch (condensedOperands.size()) {
case 2:
condAndMap = this.ands2;
break;
case 3:
condAndMap = this.ands3;
break;
case 4:
condAndMap = this.ands4;
break;
default:
break;
}
and = condAndMap.get(condensedOperands);
if (and == null) {
tempAnd = new And(condensedOperands, this, this.cnfCheck);
opAndMap.put(operands, tempAnd);
condAndMap.put(condensedOperands, tempAnd);
return tempAnd;
}
opAndMap.put(operands, and);
return and;
} } | public class class_name {
private Formula constructAnd(final LinkedHashSet<? extends Formula> operands) {
And tempAnd = null;
Map<LinkedHashSet<? extends Formula>, And> opAndMap = this.andsN;
if (operands.size() > 1) {
switch (operands.size()) {
case 2:
opAndMap = this.ands2;
break;
case 3:
opAndMap = this.ands3;
break;
case 4:
opAndMap = this.ands4;
break;
default:
break;
}
tempAnd = opAndMap.get(operands); // depends on control dependency: [if], data = [none]
}
if (tempAnd != null)
return tempAnd;
final LinkedHashSet<? extends Formula> condensedOperands = operands.size() < 2
? operands
: this.condenseOperandsAnd(operands);
if (condensedOperands == null)
return this.falsum();
if (condensedOperands.isEmpty())
return this.verum();
if (condensedOperands.size() == 1)
return condensedOperands.iterator().next();
final And and;
Map<LinkedHashSet<? extends Formula>, And> condAndMap = this.andsN;
switch (condensedOperands.size()) {
case 2:
condAndMap = this.ands2;
break;
case 3:
condAndMap = this.ands3;
break;
case 4:
condAndMap = this.ands4;
break;
default:
break;
}
and = condAndMap.get(condensedOperands);
if (and == null) {
tempAnd = new And(condensedOperands, this, this.cnfCheck);
opAndMap.put(operands, tempAnd);
condAndMap.put(condensedOperands, tempAnd);
return tempAnd;
}
opAndMap.put(operands, and);
return and;
} } |
public class class_name {
public static void checkExit(ProcessAttributes attributes, ProcessResult result) {
Set<Integer> allowedExitValues = attributes.getAllowedExitValues();
if (allowedExitValues != null && !allowedExitValues.contains(result.getExitValue())) {
StringBuilder sb = new StringBuilder();
sb.append("Unexpected exit value: ").append(result.getExitValue());
sb.append(", allowed exit values: ").append(allowedExitValues);
addExceptionMessageSuffix(attributes, sb, result.hasOutput() ? result.getOutput() : null);
throw new InvalidExitValueException(sb.toString(), result);
}
} } | public class class_name {
public static void checkExit(ProcessAttributes attributes, ProcessResult result) {
Set<Integer> allowedExitValues = attributes.getAllowedExitValues();
if (allowedExitValues != null && !allowedExitValues.contains(result.getExitValue())) {
StringBuilder sb = new StringBuilder();
sb.append("Unexpected exit value: ").append(result.getExitValue()); // depends on control dependency: [if], data = [none]
sb.append(", allowed exit values: ").append(allowedExitValues); // depends on control dependency: [if], data = [(allowedExitValues]
addExceptionMessageSuffix(attributes, sb, result.hasOutput() ? result.getOutput() : null); // depends on control dependency: [if], data = [none]
throw new InvalidExitValueException(sb.toString(), result);
}
} } |
public class class_name {
public synchronized void addSyncHandler(SynchronousHandler syncHandler) {
// Send messages from EMQ to synchronous handler when it subscribes to
// receive messages
if (earlyMessageQueue != null && earlyMessageQueue.size() != 0
&& !synchronousHandlerSet.contains(syncHandler)) {
for (Object message : earlyMessageQueue.toArray()) {
if (message != null){
syncHandler.synchronousWrite(message);
}
}
}
Set<SynchronousHandler> synchronousHandlerSetCopy = new HashSet<SynchronousHandler>(synchronousHandlerSet);
synchronousHandlerSetCopy.add(syncHandler);
Tr.event(tc, "Added Synchronous Handler: " + syncHandler.getHandlerName());
synchronousHandlerSet = synchronousHandlerSetCopy;
} } | public class class_name {
public synchronized void addSyncHandler(SynchronousHandler syncHandler) {
// Send messages from EMQ to synchronous handler when it subscribes to
// receive messages
if (earlyMessageQueue != null && earlyMessageQueue.size() != 0
&& !synchronousHandlerSet.contains(syncHandler)) {
for (Object message : earlyMessageQueue.toArray()) {
if (message != null){
syncHandler.synchronousWrite(message); // depends on control dependency: [if], data = [(message]
}
}
}
Set<SynchronousHandler> synchronousHandlerSetCopy = new HashSet<SynchronousHandler>(synchronousHandlerSet);
synchronousHandlerSetCopy.add(syncHandler);
Tr.event(tc, "Added Synchronous Handler: " + syncHandler.getHandlerName());
synchronousHandlerSet = synchronousHandlerSetCopy;
} } |
public class class_name {
public static Point3D_F64 closestPoint(LineParametric3D_F64 line, Point3D_F64 pt, Point3D_F64 ret)
{
if( ret == null ) {
ret = new Point3D_F64();
}
double dx = pt.x - line.p.x;
double dy = pt.y - line.p.y;
double dz = pt.z - line.p.z;
double n2 = line.slope.normSq();
double d = (line.slope.x*dx + line.slope.y*dy + line.slope.z*dz);
ret.x = line.p.x + d * line.slope.x / n2;
ret.y = line.p.y + d * line.slope.y / n2;
ret.z = line.p.z + d * line.slope.z / n2;
return ret;
} } | public class class_name {
public static Point3D_F64 closestPoint(LineParametric3D_F64 line, Point3D_F64 pt, Point3D_F64 ret)
{
if( ret == null ) {
ret = new Point3D_F64(); // depends on control dependency: [if], data = [none]
}
double dx = pt.x - line.p.x;
double dy = pt.y - line.p.y;
double dz = pt.z - line.p.z;
double n2 = line.slope.normSq();
double d = (line.slope.x*dx + line.slope.y*dy + line.slope.z*dz);
ret.x = line.p.x + d * line.slope.x / n2;
ret.y = line.p.y + d * line.slope.y / n2;
ret.z = line.p.z + d * line.slope.z / n2;
return ret;
} } |
public class class_name {
private static void applyVersionForCompatibility(ResTable_config config) {
if (config == null) {
return;
}
int min_sdk = 0;
if (((config.uiMode & ResTable_config.MASK_UI_MODE_TYPE)
== ResTable_config.UI_MODE_TYPE_VR_HEADSET) ||
(config.colorMode & ResTable_config.MASK_WIDE_COLOR_GAMUT) != 0 ||
(config.colorMode & ResTable_config.MASK_HDR) != 0) {
min_sdk = SDK_O;
} else if (isTruthy(config.screenLayout2 & ResTable_config.MASK_SCREENROUND)) {
min_sdk = SDK_MNC;
} else if (config.density == ResTable_config.DENSITY_ANY) {
min_sdk = SDK_LOLLIPOP;
} else if (config.smallestScreenWidthDp != ResTable_config.SCREENWIDTH_ANY
|| config.screenWidthDp != ResTable_config.SCREENWIDTH_ANY
|| config.screenHeightDp != ResTable_config.SCREENHEIGHT_ANY) {
min_sdk = SDK_HONEYCOMB_MR2;
} else if ((config.uiMode & ResTable_config.MASK_UI_MODE_TYPE)
!= ResTable_config.UI_MODE_TYPE_ANY
|| (config.uiMode & ResTable_config.MASK_UI_MODE_NIGHT)
!= ResTable_config.UI_MODE_NIGHT_ANY) {
min_sdk = SDK_FROYO;
} else if ((config.screenLayout & ResTable_config.MASK_SCREENSIZE)
!= ResTable_config.SCREENSIZE_ANY
|| (config.screenLayout & ResTable_config.MASK_SCREENLONG)
!= ResTable_config.SCREENLONG_ANY
|| config.density != ResTable_config.DENSITY_DEFAULT) {
min_sdk = SDK_DONUT;
}
if (min_sdk > config.sdkVersion) {
config.sdkVersion = min_sdk;
}
} } | public class class_name {
private static void applyVersionForCompatibility(ResTable_config config) {
if (config == null) {
return; // depends on control dependency: [if], data = [none]
}
int min_sdk = 0;
if (((config.uiMode & ResTable_config.MASK_UI_MODE_TYPE)
== ResTable_config.UI_MODE_TYPE_VR_HEADSET) ||
(config.colorMode & ResTable_config.MASK_WIDE_COLOR_GAMUT) != 0 ||
(config.colorMode & ResTable_config.MASK_HDR) != 0) {
min_sdk = SDK_O; // depends on control dependency: [if], data = [none]
} else if (isTruthy(config.screenLayout2 & ResTable_config.MASK_SCREENROUND)) {
min_sdk = SDK_MNC; // depends on control dependency: [if], data = [none]
} else if (config.density == ResTable_config.DENSITY_ANY) {
min_sdk = SDK_LOLLIPOP; // depends on control dependency: [if], data = [none]
} else if (config.smallestScreenWidthDp != ResTable_config.SCREENWIDTH_ANY
|| config.screenWidthDp != ResTable_config.SCREENWIDTH_ANY
|| config.screenHeightDp != ResTable_config.SCREENHEIGHT_ANY) {
min_sdk = SDK_HONEYCOMB_MR2; // depends on control dependency: [if], data = [none]
} else if ((config.uiMode & ResTable_config.MASK_UI_MODE_TYPE)
!= ResTable_config.UI_MODE_TYPE_ANY
|| (config.uiMode & ResTable_config.MASK_UI_MODE_NIGHT)
!= ResTable_config.UI_MODE_NIGHT_ANY) {
min_sdk = SDK_FROYO; // depends on control dependency: [if], data = [none]
} else if ((config.screenLayout & ResTable_config.MASK_SCREENSIZE)
!= ResTable_config.SCREENSIZE_ANY
|| (config.screenLayout & ResTable_config.MASK_SCREENLONG)
!= ResTable_config.SCREENLONG_ANY
|| config.density != ResTable_config.DENSITY_DEFAULT) {
min_sdk = SDK_DONUT; // depends on control dependency: [if], data = [none]
}
if (min_sdk > config.sdkVersion) {
config.sdkVersion = min_sdk; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static LdapIdentityProviderDefinition fromConfig(Map<String, Object> ldapConfig) {
Assert.notNull(ldapConfig);
LdapIdentityProviderDefinition definition = new LdapIdentityProviderDefinition();
if (ldapConfig==null || ldapConfig.isEmpty()) {
return definition;
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_STORE_CUSTOM_ATTRIBUTES)!=null) {
definition.setStoreCustomAttributes((boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_STORE_CUSTOM_ATTRIBUTES));
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EMAIL_DOMAIN)!=null) {
definition.setEmailDomain((List<String>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EMAIL_DOMAIN));
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EXTERNAL_GROUPS_WHITELIST)!=null) {
definition.setExternalGroupsWhitelist((List<String>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EXTERNAL_GROUPS_WHITELIST));
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS)!=null) {
definition.setAttributeMappings((Map<String, Object>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS));
}
if (ldapConfig.get("ldap.addShadowUserOnLogin") != null) {
definition.setAddShadowUserOnLogin((boolean) ldapConfig.get("ldap.addShadowUserOnLogin"));
}
definition.setLdapProfileFile((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_PROFILE_FILE));
final String profileFile = definition.getLdapProfileFile();
if (StringUtils.hasText(profileFile)) {
switch (profileFile) {
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SIMPLE_BIND: {
definition.setUserDNPattern((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN));
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN_DELIMITER) != null) {
definition.setUserDNPatternDelimiter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN_DELIMITER));
}
break;
}
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SEARCH_AND_COMPARE:
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SEARCH_AND_BIND: {
definition.setBindUserDn((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN));
definition.setBindPassword((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD));
definition.setUserSearchBase((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_SEARCH_BASE));
definition.setUserSearchFilter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_SEARCH_FILTER));
break;
}
default:
break;
}
}
definition.setBaseUrl((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_URL));
definition.setSkipSSLVerification((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_SSL_SKIPVERIFICATION));
definition.setTlsConfiguration((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_SSL_TLS));
definition.setReferral((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_REFERRAL));
definition.setMailSubstituteOverridesLdap((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_SUBSTITUTE_OVERRIDES_LDAP));
if (StringUtils.hasText((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_ATTRIBUTE_NAME))) {
definition.setMailAttributeName((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_ATTRIBUTE_NAME));
}
definition.setMailSubstitute((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_SUBSTITUTE));
definition.setPasswordAttributeName((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD_ATTRIBUTE_NAME));
definition.setPasswordEncoder((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD_ENCODER));
definition.setLocalPasswordCompare((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_LOCAL_PASSWORD_COMPARE));
if (StringUtils.hasText((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_FILE))) {
definition.setLdapGroupFile((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_FILE));
}
if (StringUtils.hasText(definition.getLdapGroupFile()) && !LdapIdentityProviderDefinition.LDAP_GROUP_FILE_GROUPS_NULL_XML.equals(definition.getLdapGroupFile())) {
definition.setGroupSearchBase((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_SEARCH_BASE));
definition.setGroupSearchFilter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_GROUP_SEARCH_FILTER));
definition.setGroupsIgnorePartialResults((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_IGNORE_PARTIAL_RESULT_EXCEPTION));
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_MAX_SEARCH_DEPTH) != null) {
definition.setMaxGroupSearchDepth((Integer) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_MAX_SEARCH_DEPTH));
}
definition.setGroupSearchSubTree((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_SEARCH_SUBTREE));
definition.setAutoAddGroups((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_AUTO_ADD));
definition.setGroupRoleAttribute((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_GROUP_ROLE_ATTRIBUTE));
}
//if flat attributes are set in the properties
final String LDAP_ATTR_MAP_PREFIX = LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS+".";
for (Map.Entry<String,Object> entry : ldapConfig.entrySet()) {
if (!LdapIdentityProviderDefinition.LDAP_PROPERTY_NAMES.contains(entry.getKey()) &&
entry.getKey().startsWith(LDAP_ATTR_MAP_PREFIX) &&
entry.getValue() instanceof String) {
definition.addAttributeMapping(entry.getKey().substring(LDAP_ATTR_MAP_PREFIX.length()), entry.getValue());
}
}
if (ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION)!=null && ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION) instanceof String) {
definition.setProviderDescription((String)ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION));
}
return definition;
} } | public class class_name {
public static LdapIdentityProviderDefinition fromConfig(Map<String, Object> ldapConfig) {
Assert.notNull(ldapConfig);
LdapIdentityProviderDefinition definition = new LdapIdentityProviderDefinition();
if (ldapConfig==null || ldapConfig.isEmpty()) {
return definition; // depends on control dependency: [if], data = [none]
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_STORE_CUSTOM_ATTRIBUTES)!=null) {
definition.setStoreCustomAttributes((boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_STORE_CUSTOM_ATTRIBUTES)); // depends on control dependency: [if], data = [none]
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EMAIL_DOMAIN)!=null) {
definition.setEmailDomain((List<String>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EMAIL_DOMAIN)); // depends on control dependency: [if], data = [none]
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EXTERNAL_GROUPS_WHITELIST)!=null) {
definition.setExternalGroupsWhitelist((List<String>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_EXTERNAL_GROUPS_WHITELIST)); // depends on control dependency: [if], data = [none]
}
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS)!=null) {
definition.setAttributeMappings((Map<String, Object>) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS)); // depends on control dependency: [if], data = [none]
}
if (ldapConfig.get("ldap.addShadowUserOnLogin") != null) {
definition.setAddShadowUserOnLogin((boolean) ldapConfig.get("ldap.addShadowUserOnLogin"));
}
definition.setLdapProfileFile((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_PROFILE_FILE));
final String profileFile = definition.getLdapProfileFile();
if (StringUtils.hasText(profileFile)) {
switch (profileFile) {
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SIMPLE_BIND: {
definition.setUserDNPattern((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN));
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN_DELIMITER) != null) {
definition.setUserDNPatternDelimiter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN_PATTERN_DELIMITER));
}
break;
}
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SEARCH_AND_COMPARE:
case LdapIdentityProviderDefinition.LDAP_PROFILE_FILE_SEARCH_AND_BIND: {
definition.setBindUserDn((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_USER_DN));
definition.setBindPassword((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD));
definition.setUserSearchBase((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_SEARCH_BASE));
definition.setUserSearchFilter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_SEARCH_FILTER));
break;
}
default:
break;
}
}
definition.setBaseUrl((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_URL));
definition.setSkipSSLVerification((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_SSL_SKIPVERIFICATION));
definition.setTlsConfiguration((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_SSL_TLS));
definition.setReferral((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_REFERRAL));
definition.setMailSubstituteOverridesLdap((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_SUBSTITUTE_OVERRIDES_LDAP));
if (StringUtils.hasText((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_ATTRIBUTE_NAME))) {
definition.setMailAttributeName((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_ATTRIBUTE_NAME));
}
definition.setMailSubstitute((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_MAIL_SUBSTITUTE));
definition.setPasswordAttributeName((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD_ATTRIBUTE_NAME));
definition.setPasswordEncoder((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_PASSWORD_ENCODER));
definition.setLocalPasswordCompare((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_BASE_LOCAL_PASSWORD_COMPARE));
if (StringUtils.hasText((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_FILE))) {
definition.setLdapGroupFile((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_FILE));
}
if (StringUtils.hasText(definition.getLdapGroupFile()) && !LdapIdentityProviderDefinition.LDAP_GROUP_FILE_GROUPS_NULL_XML.equals(definition.getLdapGroupFile())) {
definition.setGroupSearchBase((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_SEARCH_BASE));
definition.setGroupSearchFilter((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_GROUP_SEARCH_FILTER));
definition.setGroupsIgnorePartialResults((Boolean)ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_IGNORE_PARTIAL_RESULT_EXCEPTION));
if (ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_MAX_SEARCH_DEPTH) != null) {
definition.setMaxGroupSearchDepth((Integer) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_MAX_SEARCH_DEPTH));
}
definition.setGroupSearchSubTree((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_SEARCH_SUBTREE));
definition.setAutoAddGroups((Boolean) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_AUTO_ADD));
definition.setGroupRoleAttribute((String) ldapConfig.get(LdapIdentityProviderDefinition.LDAP_GROUPS_GROUP_ROLE_ATTRIBUTE));
}
//if flat attributes are set in the properties
final String LDAP_ATTR_MAP_PREFIX = LdapIdentityProviderDefinition.LDAP_ATTRIBUTE_MAPPINGS+".";
for (Map.Entry<String,Object> entry : ldapConfig.entrySet()) {
if (!LdapIdentityProviderDefinition.LDAP_PROPERTY_NAMES.contains(entry.getKey()) &&
entry.getKey().startsWith(LDAP_ATTR_MAP_PREFIX) &&
entry.getValue() instanceof String) {
definition.addAttributeMapping(entry.getKey().substring(LDAP_ATTR_MAP_PREFIX.length()), entry.getValue());
}
}
if (ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION)!=null && ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION) instanceof String) {
definition.setProviderDescription((String)ldapConfig.get(LDAP_PREFIX+PROVIDER_DESCRIPTION));
}
return definition;
} } |
public class class_name {
public <T> T get(Class<T> targetClass) {
try {
return doGet(targetClass);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public <T> T get(Class<T> targetClass) {
try {
return doGet(targetClass);
// depends on control dependency: [try], data = [none]
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void onPrintTweets(final List<Tweets> tweets)
{
for (Iterator<Tweets> iterator = tweets.iterator(); iterator.hasNext();)
{
int counter = 1;
while (iterator.hasNext())
{
logger.info("\n");
logger.info("\t\t Tweet No:#" + counter++);
Tweets rec = (Tweets) iterator.next();
logger.info("\t\t tweet is ->" + rec.getBody());
logger.info("\t\t Tweeted at ->" + rec.getTweetDate());
if (rec.getVideos() != null)
{
logger.info("\t\t Tweeted Contains Video ->" + rec.getVideos().size());
for (Iterator<Video> iteratorVideo = rec.getVideos().iterator(); iteratorVideo.hasNext();)
{
Video video = (Video) iteratorVideo.next();
logger.info(video);
}
}
}
}
} } | public class class_name {
private static void onPrintTweets(final List<Tweets> tweets)
{
for (Iterator<Tweets> iterator = tweets.iterator(); iterator.hasNext();)
{
int counter = 1;
while (iterator.hasNext())
{
logger.info("\n");
// depends on control dependency: [while], data = [none]
logger.info("\t\t Tweet No:#" + counter++);
// depends on control dependency: [while], data = [none]
Tweets rec = (Tweets) iterator.next();
logger.info("\t\t tweet is ->" + rec.getBody());
// depends on control dependency: [while], data = [none]
logger.info("\t\t Tweeted at ->" + rec.getTweetDate());
// depends on control dependency: [while], data = [none]
if (rec.getVideos() != null)
{
logger.info("\t\t Tweeted Contains Video ->" + rec.getVideos().size());
// depends on control dependency: [if], data = [none]
for (Iterator<Video> iteratorVideo = rec.getVideos().iterator(); iteratorVideo.hasNext();)
{
Video video = (Video) iteratorVideo.next();
logger.info(video);
// depends on control dependency: [for], data = [none]
}
}
}
}
} } |
public class class_name {
@SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final void indexProperty(
@Nonnull Class<? extends Annotation> annotationType,
@Nonnull String propertyName,
@Nonnull String annotationValue) {
indexProperty(annotationType, propertyName);
if (StringUtils.isNotEmpty(annotationValue) && StringUtils.isNotEmpty(propertyName)) {
if (indexedValues == null) {
indexedValues = new HashMap<>(10);
}
final BeanProperty<T, Object> property = beanProperties.get(propertyName);
indexedValues.put(new AnnotationValueKey(annotationType, annotationValue), property);
}
} } | public class class_name {
@SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected final void indexProperty(
@Nonnull Class<? extends Annotation> annotationType,
@Nonnull String propertyName,
@Nonnull String annotationValue) {
indexProperty(annotationType, propertyName);
if (StringUtils.isNotEmpty(annotationValue) && StringUtils.isNotEmpty(propertyName)) {
if (indexedValues == null) {
indexedValues = new HashMap<>(10); // depends on control dependency: [if], data = [none]
}
final BeanProperty<T, Object> property = beanProperties.get(propertyName);
indexedValues.put(new AnnotationValueKey(annotationType, annotationValue), property); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String changeCharset(String str, String newCharset) {
if (str != null) {
// 用默认字符编码解码字符串。
byte[] bs = str.getBytes();
// 用新的字符编码生成字符串
try {
return new String(bs, newCharset);
} catch (UnsupportedEncodingException e) {}
}
return "";
} } | public class class_name {
public static String changeCharset(String str, String newCharset) {
if (str != null) {
// 用默认字符编码解码字符串。
byte[] bs = str.getBytes();
// 用新的字符编码生成字符串
try {
return new String(bs, newCharset); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {} // depends on control dependency: [catch], data = [none]
}
return "";
} } |
public class class_name {
public static void setCookie(HttpServletRequest request, HttpServletResponse response,
String name,
String value, int maxAge, boolean all_sub_domain) {
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(maxAge);
if (all_sub_domain) {
String serverName = request.getServerName();
String domain = domainOfServerName(serverName);
if (domain != null && domain.indexOf('.') != -1) {
cookie.setDomain('.' + domain);
}
}
cookie.setPath(StringPool.SLASH);
response.addCookie(cookie);
} } | public class class_name {
public static void setCookie(HttpServletRequest request, HttpServletResponse response,
String name,
String value, int maxAge, boolean all_sub_domain) {
Cookie cookie = new Cookie(name, value);
cookie.setMaxAge(maxAge);
if (all_sub_domain) {
String serverName = request.getServerName();
String domain = domainOfServerName(serverName);
if (domain != null && domain.indexOf('.') != -1) {
cookie.setDomain('.' + domain); // depends on control dependency: [if], data = [none]
}
}
cookie.setPath(StringPool.SLASH);
response.addCookie(cookie);
} } |
public class class_name {
public void setPortInfos(java.util.Collection<PortInfo> portInfos) {
if (portInfos == null) {
this.portInfos = null;
return;
}
this.portInfos = new java.util.ArrayList<PortInfo>(portInfos);
} } | public class class_name {
public void setPortInfos(java.util.Collection<PortInfo> portInfos) {
if (portInfos == null) {
this.portInfos = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.portInfos = new java.util.ArrayList<PortInfo>(portInfos);
} } |
public class class_name {
public synchronized void addTarget(
Conjunction conjunction,
MatchTarget object)
throws MatchingException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(
this,cclass,
"addTarget",
new Object[] { conjunction, object });
// Deal with Conjunctions that test equality on rootId when cacheing is enabled
if (rootId != null)
{
// Cacheing is enabled.
OrdinalPosition rootOrd = new OrdinalPosition(0,0);
SimpleTest test = Factory.findTest(rootOrd, conjunction);
if (test != null && test.getKind() == SimpleTest.EQ) {
// This is an equality test, so it goes in the cache only.
CacheEntry e = getCacheEntry(test.getValue(), true);
e.exactGeneration++; // even-odd transition: show we are changing it
ContentMatcher exact = e.exactMatcher;
e.exactMatcher = exact = Factory.createMatcher(rootOrd, conjunction, exact);
e.cachedResults = null;
try
{
exact.put(conjunction, object, subExpr);
e.noResultCache |= exact.hasTests();
}
catch (RuntimeException exc)
{
// No FFDC Code Needed.
// FFDC driven by wrapper class.
FFDC.processException(this,
cclass,
"com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.addTarget",
exc,
"1:303:1.44");
//TODO: tc.exception(tc, exc);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget", e);
throw new MatchingException(exc);
}
finally
{
e.exactGeneration++; // odd-even transition: show change is complete
}
exactPuts++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget");
return;
}
}
// Either cacheing is not enabled or this isn't an equality test on rootId.
matchTreeGeneration++; // even-odd transition: show we are changing it
try
{
matchTree.put(conjunction, object, subExpr);
}
catch (RuntimeException e)
{
// No FFDC Code Needed.
// FFDC driven by wrapper class.
FFDC.processException(this,
cclass,
"com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.addTarget",
e,
"1:333:1.44");
//TODO: tc.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget", e);
throw new MatchingException(e);
}
finally
{
matchTreeGeneration++;
/* odd-even transition: show change is complete. Also
invalidates non-equality information in the cache */
}
wildPuts++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget");
} } | public class class_name {
public synchronized void addTarget(
Conjunction conjunction,
MatchTarget object)
throws MatchingException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(
this,cclass,
"addTarget",
new Object[] { conjunction, object });
// Deal with Conjunctions that test equality on rootId when cacheing is enabled
if (rootId != null)
{
// Cacheing is enabled.
OrdinalPosition rootOrd = new OrdinalPosition(0,0);
SimpleTest test = Factory.findTest(rootOrd, conjunction);
if (test != null && test.getKind() == SimpleTest.EQ) {
// This is an equality test, so it goes in the cache only.
CacheEntry e = getCacheEntry(test.getValue(), true);
e.exactGeneration++; // even-odd transition: show we are changing it
ContentMatcher exact = e.exactMatcher;
e.exactMatcher = exact = Factory.createMatcher(rootOrd, conjunction, exact);
e.cachedResults = null;
try
{
exact.put(conjunction, object, subExpr); // depends on control dependency: [try], data = [none]
e.noResultCache |= exact.hasTests(); // depends on control dependency: [try], data = [none]
}
catch (RuntimeException exc)
{
// No FFDC Code Needed.
// FFDC driven by wrapper class.
FFDC.processException(this,
cclass,
"com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.addTarget",
exc,
"1:303:1.44");
//TODO: tc.exception(tc, exc);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget", e);
throw new MatchingException(exc);
} // depends on control dependency: [catch], data = [none]
finally
{
e.exactGeneration++; // odd-even transition: show change is complete
}
exactPuts++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget");
return;
}
}
// Either cacheing is not enabled or this isn't an equality test on rootId.
matchTreeGeneration++; // even-odd transition: show we are changing it
try
{
matchTree.put(conjunction, object, subExpr);
}
catch (RuntimeException e)
{
// No FFDC Code Needed.
// FFDC driven by wrapper class.
FFDC.processException(this,
cclass,
"com.ibm.ws.sib.matchspace.impl.MatchSpaceImpl.addTarget",
e,
"1:333:1.44");
//TODO: tc.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget", e);
throw new MatchingException(e);
}
finally
{
matchTreeGeneration++;
/* odd-even transition: show change is complete. Also
invalidates non-equality information in the cache */
}
wildPuts++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "addTarget");
} } |
public class class_name {
public static Resource getBigIconResource(CmsExplorerTypeSettings explorerType, String resourceName) {
if (explorerType == null) {
explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
(resourceName == null) && !CmsResource.isFolder(resourceName)
? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME
: CmsResourceTypeUnknownFolder.RESOURCE_TYPE_NAME);
}
if (!explorerType.getIconRules().isEmpty() && (resourceName != null)) {
String extension = CmsResource.getExtension(resourceName);
if (extension != null) {
CmsIconRule rule = explorerType.getIconRules().get(extension);
if ((rule != null) && (rule.getBigIconStyle() != null)) {
return new CmsCssIcon(rule.getBigIconStyle());
}
}
}
if (explorerType.getBigIconStyle() != null) {
return new CmsCssIcon(explorerType.getBigIconStyle());
} else if (explorerType.getBigIcon() != null) {
return new ExternalResource(
CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + explorerType.getBigIcon()));
} else {
return new CmsCssIcon(CmsExplorerTypeSettings.ICON_STYLE_DEFAULT_BIG);
}
} } | public class class_name {
public static Resource getBigIconResource(CmsExplorerTypeSettings explorerType, String resourceName) {
if (explorerType == null) {
explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
(resourceName == null) && !CmsResource.isFolder(resourceName)
? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME
: CmsResourceTypeUnknownFolder.RESOURCE_TYPE_NAME); // depends on control dependency: [if], data = [none]
}
if (!explorerType.getIconRules().isEmpty() && (resourceName != null)) {
String extension = CmsResource.getExtension(resourceName);
if (extension != null) {
CmsIconRule rule = explorerType.getIconRules().get(extension);
if ((rule != null) && (rule.getBigIconStyle() != null)) {
return new CmsCssIcon(rule.getBigIconStyle()); // depends on control dependency: [if], data = [none]
}
}
}
if (explorerType.getBigIconStyle() != null) {
return new CmsCssIcon(explorerType.getBigIconStyle()); // depends on control dependency: [if], data = [(explorerType.getBigIconStyle()]
} else if (explorerType.getBigIcon() != null) {
return new ExternalResource(
CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + explorerType.getBigIcon())); // depends on control dependency: [if], data = [none]
} else {
return new CmsCssIcon(CmsExplorerTypeSettings.ICON_STYLE_DEFAULT_BIG); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FunctionTypeReference getAsFunctionTypeReference(ParameterizedTypeReference typeReference) {
FunctionTypeKind functionTypeKind = getFunctionTypeKind(typeReference);
if (functionTypeKind == FunctionTypeKind.PROCEDURE) {
return getAsProcedureOrNull(typeReference);
} else if (functionTypeKind == FunctionTypeKind.FUNCTION) {
return getAsFunctionOrNull(typeReference);
}
return null;
} } | public class class_name {
public FunctionTypeReference getAsFunctionTypeReference(ParameterizedTypeReference typeReference) {
FunctionTypeKind functionTypeKind = getFunctionTypeKind(typeReference);
if (functionTypeKind == FunctionTypeKind.PROCEDURE) {
return getAsProcedureOrNull(typeReference); // depends on control dependency: [if], data = [none]
} else if (functionTypeKind == FunctionTypeKind.FUNCTION) {
return getAsFunctionOrNull(typeReference); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
protected final void destroyHandleList() // d662032
{
if (connectionHandleList != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "destroyHandleList: destroying " + connectionHandleList);
connectionHandleList.componentDestroyed();
connectionHandleList = null;
}
} } | public class class_name {
protected final void destroyHandleList() // d662032
{
if (connectionHandleList != null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "destroyHandleList: destroying " + connectionHandleList);
connectionHandleList.componentDestroyed(); // depends on control dependency: [if], data = [none]
connectionHandleList = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final StringBuilder newHeaderValueBuffer() {
final StringBuilder buf = new StringBuilder(40);
if (noCache) {
buf.append(", no-cache");
}
if (noStore) {
buf.append(", no-store");
}
if (noTransform) {
buf.append(", no-transform");
}
if (maxAgeSeconds >= 0) {
buf.append(", max-age=").append(maxAgeSeconds);
}
return buf;
} } | public class class_name {
protected final StringBuilder newHeaderValueBuffer() {
final StringBuilder buf = new StringBuilder(40);
if (noCache) {
buf.append(", no-cache"); // depends on control dependency: [if], data = [none]
}
if (noStore) {
buf.append(", no-store"); // depends on control dependency: [if], data = [none]
}
if (noTransform) {
buf.append(", no-transform"); // depends on control dependency: [if], data = [none]
}
if (maxAgeSeconds >= 0) {
buf.append(", max-age=").append(maxAgeSeconds); // depends on control dependency: [if], data = [(maxAgeSeconds]
}
return buf;
} } |
public class class_name {
public void showDataSet(
int mtLv,
String itemCode,
DataSet ds,
int in_Digits,
int ot_Digits,
int r_End_I,
int c_End_I
) {
//
mtLv++;
//
String oinfo = "";
//
String methodName = moduleCode + "." + "showDataSet";
//
if ( ds == null ) {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += methodName + ": ";
oinfo += "\"" + itemCode + "\": ";
oinfo += " == null !!!; ";
oinfo += BTools.getSLcDtTm();
sis.info( oinfo );
return;
}
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += methodName + ": ";
oinfo += "\"" + itemCode + "\": ";
oinfo += "in_Digits: " + in_Digits + "; ";
oinfo += "ot_Digits: " + ot_Digits + "; ";
sis.info( oinfo );
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "r_End_I: " + r_End_I + "; ";
oinfo += "c_End_I: " + c_End_I + "; ";
oinfo += BTools.getSLcDtTm();
sis.info( oinfo );
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "ds: ";
oinfo += ".numInputs: " + ds.numInputs() + "; ";
oinfo += ".numOutcomes: " + ds.numOutcomes() + "; ";
oinfo += ".numExamples: " + ds.numExamples() + "; ";
oinfo += ".hasMaskArrays: " + BTools.getSBln( ds.hasMaskArrays() ) + "; ";
sis.info( oinfo );
//
if ( in_Digits < 0 ) in_Digits = 0;
if ( ot_Digits < 0 ) ot_Digits = 0;
//
INDArray in_INDA; // I = Input
INDArray ot_INDA; // O = Output
//
in_INDA = ds.getFeatures();
ot_INDA = ds.getLabels();
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "in_INDA: ";
oinfo += ".rows: " + in_INDA.rows() + "; ";
oinfo += ".columns: " + in_INDA.columns() + "; ";
oinfo += ".rank: " + in_INDA.rank() + "; ";
oinfo += ".shape: " + BTools.getSIntA( ArrayUtil.toInts(in_INDA.shape()) ) + "; ";
oinfo += ".length: " + in_INDA.length() + "; ";
oinfo += ".size( 0 ): " + in_INDA.size( 0 ) + "; ";
sis.info( oinfo );
//
if ( ot_INDA != null ) {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "ot_INDA: ";
oinfo += ".rows: " + ot_INDA.rows() + "; ";
oinfo += ".columns: " + ot_INDA.columns() + "; ";
oinfo += ".rank: " + ot_INDA.rank() + "; ";
oinfo += ".shape: " + BTools.getSIntA( ArrayUtil.toInts(ot_INDA.shape()) ) + "; ";
oinfo += ".length: " + ot_INDA.length() + "; ";
oinfo += ".size( 0 ): " + ot_INDA.size( 0 ) + "; ";
sis.info( oinfo );
} else {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "ot_INDA == null ! ";
sis.info( oinfo );
}
//
if ( in_INDA.rows() != ot_INDA.rows() ) {
oinfo = "===";
oinfo += methodName + ": ";
oinfo += "in_INDA.rows() != ot_INDA.rows() !!! ; ";
oinfo += BTools.getSLcDtTm();
sis.info( oinfo );
//
return;
}
//
boolean wasShownTitle = false;
//
InfoLine il;
InfoValues iv;
//
double j_Dbl = -1;
// FIXME: int cast
int i_CharsCount = BTools.getIndexCharsCount( (int) in_INDA.rows() - 1 );
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "Data: j: IN->I0; ";
sis.info( oinfo );
//
for ( int i = 0; i < in_INDA.rows(); i++ ) {
//
if ( i > r_End_I ) break;
//
il = new InfoLine();
//
iv = new InfoValues( "i", "" ); il.ivL.add( iv );
iv.vsL.add( BTools.getSInt( i, i_CharsCount ) );
//
iv = new InfoValues( "", "", "" ); il.ivL.add( iv );
iv.vsL.add( "" );
//
int c_I = 0;
//
for ( int j = (int) in_INDA.columns() - 1; j >= 0; j-- ) {
//
if ( c_I > c_End_I ) break;
//
j_Dbl = in_INDA.getDouble( i, j );
//
iv = new InfoValues( "In", "j", BTools.getSInt( j ) ); il.ivL.add( iv );
iv.vsL.add( BTools.getSDbl( j_Dbl, in_Digits, true, in_Digits + 4 ) );
//
c_I++;
}
//
iv = new InfoValues( "", "", "" ); il.ivL.add( iv );
iv.vsL.add( "" );
//
c_I = 0;
//
if ( ot_INDA != null ) {
// FIXME: int cast
for ( int j = (int) ot_INDA.columns() - 1; j >= 0; j-- ) {
//
if ( c_I > c_End_I ) break;
//
j_Dbl = ot_INDA.getDouble( i, j );
//
iv = new InfoValues( "Ot", "j", BTools.getSInt( j ) ); il.ivL.add( iv );
iv.vsL.add( BTools.getSDbl( j_Dbl, ot_Digits, true, ot_Digits + 4 ) );
//
c_I++;
}
}
//
if ( !wasShownTitle ) {
oinfo = il.getTitleLine( mtLv, 0 ); sis.info( oinfo );
oinfo = il.getTitleLine( mtLv, 1 ); sis.info( oinfo );
oinfo = il.getTitleLine( mtLv, 2 ); sis.info( oinfo );
// oinfo = il.getTitleLine( mtLv, 3 ); sis.info( oinfo );
// oinfo = il.getTitleLine( mtLv, 4 ); sis.info( oinfo );
wasShownTitle = true;
}
oinfo = il.getValuesLine( mtLv ); sis.info( oinfo );
}
//
} } | public class class_name {
public void showDataSet(
int mtLv,
String itemCode,
DataSet ds,
int in_Digits,
int ot_Digits,
int r_End_I,
int c_End_I
) {
//
mtLv++;
//
String oinfo = "";
//
String methodName = moduleCode + "." + "showDataSet";
//
if ( ds == null ) {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv ); // depends on control dependency: [if], data = [none]
oinfo += methodName + ": "; // depends on control dependency: [if], data = [none]
oinfo += "\"" + itemCode + "\": "; // depends on control dependency: [if], data = [none]
oinfo += " == null !!!; "; // depends on control dependency: [if], data = [none]
oinfo += BTools.getSLcDtTm(); // depends on control dependency: [if], data = [none]
sis.info( oinfo ); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += methodName + ": ";
oinfo += "\"" + itemCode + "\": ";
oinfo += "in_Digits: " + in_Digits + "; ";
oinfo += "ot_Digits: " + ot_Digits + "; ";
sis.info( oinfo );
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "r_End_I: " + r_End_I + "; ";
oinfo += "c_End_I: " + c_End_I + "; ";
oinfo += BTools.getSLcDtTm();
sis.info( oinfo );
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "ds: ";
oinfo += ".numInputs: " + ds.numInputs() + "; ";
oinfo += ".numOutcomes: " + ds.numOutcomes() + "; ";
oinfo += ".numExamples: " + ds.numExamples() + "; ";
oinfo += ".hasMaskArrays: " + BTools.getSBln( ds.hasMaskArrays() ) + "; ";
sis.info( oinfo );
//
if ( in_Digits < 0 ) in_Digits = 0;
if ( ot_Digits < 0 ) ot_Digits = 0;
//
INDArray in_INDA; // I = Input
INDArray ot_INDA; // O = Output
//
in_INDA = ds.getFeatures();
ot_INDA = ds.getLabels();
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "in_INDA: ";
oinfo += ".rows: " + in_INDA.rows() + "; ";
oinfo += ".columns: " + in_INDA.columns() + "; ";
oinfo += ".rank: " + in_INDA.rank() + "; ";
oinfo += ".shape: " + BTools.getSIntA( ArrayUtil.toInts(in_INDA.shape()) ) + "; ";
oinfo += ".length: " + in_INDA.length() + "; ";
oinfo += ".size( 0 ): " + in_INDA.size( 0 ) + "; ";
sis.info( oinfo );
//
if ( ot_INDA != null ) {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv ); // depends on control dependency: [if], data = [none]
oinfo += BTools.getMtLvISS(); // depends on control dependency: [if], data = [none]
oinfo += "ot_INDA: "; // depends on control dependency: [if], data = [none]
oinfo += ".rows: " + ot_INDA.rows() + "; ";
oinfo += ".columns: " + ot_INDA.columns() + "; ";
oinfo += ".rank: " + ot_INDA.rank() + "; ";
oinfo += ".shape: " + BTools.getSIntA( ArrayUtil.toInts(ot_INDA.shape()) ) + "; ";
oinfo += ".length: " + ot_INDA.length() + "; ";
oinfo += ".size( 0 ): " + ot_INDA.size( 0 ) + "; ";
sis.info( oinfo ); // depends on control dependency: [if], data = [none]
} else {
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv ); // depends on control dependency: [if], data = [none]
oinfo += BTools.getMtLvISS(); // depends on control dependency: [if], data = [none]
oinfo += "ot_INDA == null ! "; // depends on control dependency: [if], data = [none]
sis.info( oinfo ); // depends on control dependency: [if], data = [none]
}
//
if ( in_INDA.rows() != ot_INDA.rows() ) {
oinfo = "==="; // depends on control dependency: [if], data = [none]
oinfo += methodName + ": "; // depends on control dependency: [if], data = [none]
oinfo += "in_INDA.rows() != ot_INDA.rows() !!! ; "; // depends on control dependency: [if], data = [none]
oinfo += BTools.getSLcDtTm(); // depends on control dependency: [if], data = [none]
sis.info( oinfo ); // depends on control dependency: [if], data = [none]
//
return; // depends on control dependency: [if], data = [none]
}
//
boolean wasShownTitle = false;
//
InfoLine il;
InfoValues iv;
//
double j_Dbl = -1;
// FIXME: int cast
int i_CharsCount = BTools.getIndexCharsCount( (int) in_INDA.rows() - 1 );
//
oinfo = "";
oinfo += BTools.getMtLvESS( mtLv );
oinfo += BTools.getMtLvISS();
oinfo += "Data: j: IN->I0; ";
sis.info( oinfo );
//
for ( int i = 0; i < in_INDA.rows(); i++ ) {
//
if ( i > r_End_I ) break;
//
il = new InfoLine(); // depends on control dependency: [for], data = [none]
//
iv = new InfoValues( "i", "" ); il.ivL.add( iv ); // depends on control dependency: [for], data = [i] // depends on control dependency: [for], data = [none]
iv.vsL.add( BTools.getSInt( i, i_CharsCount ) ); // depends on control dependency: [for], data = [i]
//
iv = new InfoValues( "", "", "" ); il.ivL.add( iv ); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
iv.vsL.add( "" ); // depends on control dependency: [for], data = [none]
//
int c_I = 0;
//
for ( int j = (int) in_INDA.columns() - 1; j >= 0; j-- ) {
//
if ( c_I > c_End_I ) break;
//
j_Dbl = in_INDA.getDouble( i, j ); // depends on control dependency: [for], data = [j]
//
iv = new InfoValues( "In", "j", BTools.getSInt( j ) ); il.ivL.add( iv ); // depends on control dependency: [for], data = [j] // depends on control dependency: [for], data = [none]
iv.vsL.add( BTools.getSDbl( j_Dbl, in_Digits, true, in_Digits + 4 ) ); // depends on control dependency: [for], data = [none]
//
c_I++; // depends on control dependency: [for], data = [none]
}
//
iv = new InfoValues( "", "", "" ); il.ivL.add( iv ); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
iv.vsL.add( "" ); // depends on control dependency: [for], data = [none]
//
c_I = 0; // depends on control dependency: [for], data = [none]
//
if ( ot_INDA != null ) {
// FIXME: int cast
for ( int j = (int) ot_INDA.columns() - 1; j >= 0; j-- ) {
//
if ( c_I > c_End_I ) break;
//
j_Dbl = ot_INDA.getDouble( i, j ); // depends on control dependency: [for], data = [j]
//
iv = new InfoValues( "Ot", "j", BTools.getSInt( j ) ); il.ivL.add( iv ); // depends on control dependency: [for], data = [j] // depends on control dependency: [for], data = [none]
iv.vsL.add( BTools.getSDbl( j_Dbl, ot_Digits, true, ot_Digits + 4 ) ); // depends on control dependency: [for], data = [none]
//
c_I++; // depends on control dependency: [for], data = [none]
}
}
//
if ( !wasShownTitle ) {
oinfo = il.getTitleLine( mtLv, 0 ); sis.info( oinfo ); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
oinfo = il.getTitleLine( mtLv, 1 ); sis.info( oinfo ); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
oinfo = il.getTitleLine( mtLv, 2 ); sis.info( oinfo ); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
// oinfo = il.getTitleLine( mtLv, 3 ); sis.info( oinfo );
// oinfo = il.getTitleLine( mtLv, 4 ); sis.info( oinfo );
wasShownTitle = true; // depends on control dependency: [if], data = [none]
}
oinfo = il.getValuesLine( mtLv ); sis.info( oinfo ); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
}
//
} } |
public class class_name {
private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
logger.info("Waiting for streams to resubscribe (max wait time {} msec)", MAX_WAIT_TIME_IN_MS);
synchronized (channelIdToHandlerMap) {
while(channelIdToHandlerMap.size() != oldChannelIdSymbolMap.size()) {
if(stopwatch.elapsed(TimeUnit.MILLISECONDS) > MAX_WAIT_TIME_IN_MS) {
// Raise BitfinexClientException
handleResubscribeFailed(oldChannelIdSymbolMap);
}
channelIdToHandlerMap.wait(500);
}
}
} } | public class class_name {
private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap)
throws BitfinexClientException, InterruptedException {
final Stopwatch stopwatch = Stopwatch.createStarted();
final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3);
logger.info("Waiting for streams to resubscribe (max wait time {} msec)", MAX_WAIT_TIME_IN_MS);
synchronized (channelIdToHandlerMap) {
while(channelIdToHandlerMap.size() != oldChannelIdSymbolMap.size()) {
if(stopwatch.elapsed(TimeUnit.MILLISECONDS) > MAX_WAIT_TIME_IN_MS) {
// Raise BitfinexClientException
handleResubscribeFailed(oldChannelIdSymbolMap); // depends on control dependency: [if], data = [none]
}
channelIdToHandlerMap.wait(500); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY;
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY;
} else {
return Time.SUNDAY;
}
} } | public class class_name {
public static int getFirstDayOfWeek(Context context) {
int startDay = Calendar.getInstance().getFirstDayOfWeek();
if (startDay == Calendar.SATURDAY) {
return Time.SATURDAY; // depends on control dependency: [if], data = [none]
} else if (startDay == Calendar.MONDAY) {
return Time.MONDAY; // depends on control dependency: [if], data = [none]
} else {
return Time.SUNDAY; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true;
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(ConnectionPoolDataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID);
if (className == null) {
//if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName()));
}
className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true));
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue();
if (className == null)
throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} } | public class class_name {
public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException {
lock.readLock().lock();
try {
if (!isInitialized)
try {
// Switch to write lock for lazy initialization
lock.readLock().unlock(); // depends on control dependency: [try], data = [none]
lock.writeLock().lock(); // depends on control dependency: [try], data = [none]
if (!isInitialized) {
if (!loadFromApp())
classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
isInitialized = true; // depends on control dependency: [if], data = [none]
}
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
String className = (String) properties.get(ConnectionPoolDataSource.class.getName());
if (className == null) {
String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID); // depends on control dependency: [if], data = [none]
if (className == null) {
//if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated
//they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)
if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName()));
}
className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true)); // depends on control dependency: [if], data = [none]
if (className == null) {
Set<String> packagesSearched = new LinkedHashSet<String>();
SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
(classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE);
className = dsEntry == null ? null : dsEntry.getValue(); // depends on control dependency: [if], data = [none]
if (className == null)
throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null);
}
}
}
return create(className, props, dataSourceID);
} finally {
lock.readLock().unlock();
}
} } |
public class class_name {
@Override
public CommerceWarehouse fetchByG_C_P_First(long groupId,
long commerceCountryId, boolean primary,
OrderByComparator<CommerceWarehouse> orderByComparator) {
List<CommerceWarehouse> list = findByG_C_P(groupId, commerceCountryId,
primary, 0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceWarehouse fetchByG_C_P_First(long groupId,
long commerceCountryId, boolean primary,
OrderByComparator<CommerceWarehouse> orderByComparator) {
List<CommerceWarehouse> list = findByG_C_P(groupId, commerceCountryId,
primary, 0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static Optional<Symbol> filterOrRewrite(Collection<Symbol> columns, Collection<JoinNode.EquiJoinClause> equalities, Symbol column)
{
// symbol is exposed directly, so no translation needed
if (columns.contains(column)) {
return Optional.of(column);
}
// if the column is part of the equality conditions and its counterpart
// is exposed, use that, instead
for (JoinNode.EquiJoinClause equality : equalities) {
if (equality.getLeft().equals(column) && columns.contains(equality.getRight())) {
return Optional.of(equality.getRight());
}
else if (equality.getRight().equals(column) && columns.contains(equality.getLeft())) {
return Optional.of(equality.getLeft());
}
}
return Optional.empty();
} } | public class class_name {
public static Optional<Symbol> filterOrRewrite(Collection<Symbol> columns, Collection<JoinNode.EquiJoinClause> equalities, Symbol column)
{
// symbol is exposed directly, so no translation needed
if (columns.contains(column)) {
return Optional.of(column); // depends on control dependency: [if], data = [none]
}
// if the column is part of the equality conditions and its counterpart
// is exposed, use that, instead
for (JoinNode.EquiJoinClause equality : equalities) {
if (equality.getLeft().equals(column) && columns.contains(equality.getRight())) {
return Optional.of(equality.getRight()); // depends on control dependency: [if], data = [none]
}
else if (equality.getRight().equals(column) && columns.contains(equality.getLeft())) {
return Optional.of(equality.getLeft()); // depends on control dependency: [if], data = [none]
}
}
return Optional.empty();
} } |
public class class_name {
private Scope getMethodScope(boolean isDestroy, Method method) {
Scope methodScope;
if ( isDestroy ) {
Destroy annotation = method.getAnnotation(Destroy.class);
methodScope = annotation != null ? annotation.scope() : null;
} else {
Initialize annotation = method.getAnnotation(Initialize.class);
methodScope = annotation != null ? annotation.scope() : null;
}
return methodScope;
} } | public class class_name {
private Scope getMethodScope(boolean isDestroy, Method method) {
Scope methodScope;
if ( isDestroy ) {
Destroy annotation = method.getAnnotation(Destroy.class);
methodScope = annotation != null ? annotation.scope() : null; // depends on control dependency: [if], data = [none]
} else {
Initialize annotation = method.getAnnotation(Initialize.class);
methodScope = annotation != null ? annotation.scope() : null; // depends on control dependency: [if], data = [none]
}
return methodScope;
} } |
public class class_name {
protected final void waitForDeliverySync()
{
List<AbstractSession> sessionsSnapshot = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsSnapshot.addAll(sessions.values());
}
for(int n=0;n<sessionsSnapshot.size();n++)
{
AbstractSession session = sessionsSnapshot.get(n);
session.waitForDeliverySync();
}
} } | public class class_name {
protected final void waitForDeliverySync()
{
List<AbstractSession> sessionsSnapshot = new ArrayList<>(sessions.size());
synchronized (sessions)
{
sessionsSnapshot.addAll(sessions.values());
}
for(int n=0;n<sessionsSnapshot.size();n++)
{
AbstractSession session = sessionsSnapshot.get(n);
session.waitForDeliverySync(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public DescribeNotebookInstanceResult withAcceleratorTypes(NotebookInstanceAcceleratorType... acceleratorTypes) {
java.util.ArrayList<String> acceleratorTypesCopy = new java.util.ArrayList<String>(acceleratorTypes.length);
for (NotebookInstanceAcceleratorType value : acceleratorTypes) {
acceleratorTypesCopy.add(value.toString());
}
if (getAcceleratorTypes() == null) {
setAcceleratorTypes(acceleratorTypesCopy);
} else {
getAcceleratorTypes().addAll(acceleratorTypesCopy);
}
return this;
} } | public class class_name {
public DescribeNotebookInstanceResult withAcceleratorTypes(NotebookInstanceAcceleratorType... acceleratorTypes) {
java.util.ArrayList<String> acceleratorTypesCopy = new java.util.ArrayList<String>(acceleratorTypes.length);
for (NotebookInstanceAcceleratorType value : acceleratorTypes) {
acceleratorTypesCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getAcceleratorTypes() == null) {
setAcceleratorTypes(acceleratorTypesCopy); // depends on control dependency: [if], data = [none]
} else {
getAcceleratorTypes().addAll(acceleratorTypesCopy); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public static boolean waitForRemovalFromJNDI(final Context ctx, final String jndiName, long timeout) {
boolean removed = false;
while (!removed && timeout > 0) {
try {
ctx.lookup(jndiName);
} catch (NameNotFoundException ex) {
removed = true;
} catch (NamingException ex) {
throw new RuntimeException("Failed JNDI lookup for " + jndiName, ex);
}
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
throw new RuntimeException("Interrupted while doing JNDI lookup for " + jndiName);
}
timeout -= 10;
}
return removed;
} } | public class class_name {
public static boolean waitForRemovalFromJNDI(final Context ctx, final String jndiName, long timeout) {
boolean removed = false;
while (!removed && timeout > 0) {
try {
ctx.lookup(jndiName); // depends on control dependency: [try], data = [none]
} catch (NameNotFoundException ex) {
removed = true;
} catch (NamingException ex) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Failed JNDI lookup for " + jndiName, ex);
} // depends on control dependency: [catch], data = [none]
try {
Thread.sleep(10); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {
throw new RuntimeException("Interrupted while doing JNDI lookup for " + jndiName);
} // depends on control dependency: [catch], data = [none]
timeout -= 10; // depends on control dependency: [while], data = [none]
}
return removed;
} } |
public class class_name {
private Set<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, OmemoTrustCallback callback, Set<OmemoDevice> devices) {
Set<OmemoDevice> undecidedDevices = new HashSet<>();
for (OmemoDevice device : devices) {
OmemoFingerprint fingerprint;
try {
fingerprint = getOmemoStoreBackend().getFingerprint(userDevice, device);
} catch (CorruptedOmemoKeyException | NoIdentityKeyException e) {
// TODO: Best solution?
LOGGER.log(Level.WARNING, "Could not load fingerprint of " + device, e);
undecidedDevices.add(device);
continue;
}
if (callback.getTrust(device, fingerprint) == TrustState.undecided) {
undecidedDevices.add(device);
}
}
return undecidedDevices;
} } | public class class_name {
private Set<OmemoDevice> getUndecidedDevices(OmemoDevice userDevice, OmemoTrustCallback callback, Set<OmemoDevice> devices) {
Set<OmemoDevice> undecidedDevices = new HashSet<>();
for (OmemoDevice device : devices) {
OmemoFingerprint fingerprint;
try {
fingerprint = getOmemoStoreBackend().getFingerprint(userDevice, device); // depends on control dependency: [try], data = [none]
} catch (CorruptedOmemoKeyException | NoIdentityKeyException e) {
// TODO: Best solution?
LOGGER.log(Level.WARNING, "Could not load fingerprint of " + device, e);
undecidedDevices.add(device);
continue;
} // depends on control dependency: [catch], data = [none]
if (callback.getTrust(device, fingerprint) == TrustState.undecided) {
undecidedDevices.add(device); // depends on control dependency: [if], data = [none]
}
}
return undecidedDevices;
} } |
public class class_name {
protected static void populateRequestOptions(RequestOptions modifiedOptions,
final RequestOptions clientOptions, final boolean setStartTime) {
if (modifiedOptions.getRetryPolicyFactory() == null) {
modifiedOptions.setRetryPolicyFactory(clientOptions.getRetryPolicyFactory());
}
if (modifiedOptions.getLocationMode() == null) {
modifiedOptions.setLocationMode(clientOptions.getLocationMode());
}
if (modifiedOptions.getTimeoutIntervalInMs() == null) {
modifiedOptions.setTimeoutIntervalInMs(clientOptions.getTimeoutIntervalInMs());
}
if (modifiedOptions.getMaximumExecutionTimeInMs() == null) {
modifiedOptions.setMaximumExecutionTimeInMs(clientOptions.getMaximumExecutionTimeInMs());
}
if (modifiedOptions.getMaximumExecutionTimeInMs() != null
&& modifiedOptions.getOperationExpiryTimeInMs() == null && setStartTime) {
modifiedOptions.setOperationExpiryTimeInMs(new Date().getTime()
+ modifiedOptions.getMaximumExecutionTimeInMs());
}
} } | public class class_name {
protected static void populateRequestOptions(RequestOptions modifiedOptions,
final RequestOptions clientOptions, final boolean setStartTime) {
if (modifiedOptions.getRetryPolicyFactory() == null) {
modifiedOptions.setRetryPolicyFactory(clientOptions.getRetryPolicyFactory()); // depends on control dependency: [if], data = [none]
}
if (modifiedOptions.getLocationMode() == null) {
modifiedOptions.setLocationMode(clientOptions.getLocationMode()); // depends on control dependency: [if], data = [none]
}
if (modifiedOptions.getTimeoutIntervalInMs() == null) {
modifiedOptions.setTimeoutIntervalInMs(clientOptions.getTimeoutIntervalInMs()); // depends on control dependency: [if], data = [none]
}
if (modifiedOptions.getMaximumExecutionTimeInMs() == null) {
modifiedOptions.setMaximumExecutionTimeInMs(clientOptions.getMaximumExecutionTimeInMs()); // depends on control dependency: [if], data = [none]
}
if (modifiedOptions.getMaximumExecutionTimeInMs() != null
&& modifiedOptions.getOperationExpiryTimeInMs() == null && setStartTime) {
modifiedOptions.setOperationExpiryTimeInMs(new Date().getTime()
+ modifiedOptions.getMaximumExecutionTimeInMs()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void add(int index, int element)
{
if (index == size())//special case, just appending
{
add(element);
}
else
{
boundsCheck(index);
enlargeIfNeeded(1);
System.arraycopy(array, index, array, index+1, end-index);
array[index] = element;
end++;
}
} } | public class class_name {
public void add(int index, int element)
{
if (index == size())//special case, just appending
{
add(element); // depends on control dependency: [if], data = [none]
}
else
{
boundsCheck(index); // depends on control dependency: [if], data = [(index]
enlargeIfNeeded(1); // depends on control dependency: [if], data = [none]
System.arraycopy(array, index, array, index+1, end-index); // depends on control dependency: [if], data = [none]
array[index] = element; // depends on control dependency: [if], data = [none]
end++; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setSettings(Map<String, String> settings) {
if (settings == null) {
m_settings = null;
} else {
m_settings = new CmsNullIgnoringConcurrentMap<String, String>(settings);
}
} } | public class class_name {
private void setSettings(Map<String, String> settings) {
if (settings == null) {
m_settings = null; // depends on control dependency: [if], data = [none]
} else {
m_settings = new CmsNullIgnoringConcurrentMap<String, String>(settings); // depends on control dependency: [if], data = [(settings]
}
} } |
public class class_name {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
LepServiceProvider scanner = getScanner();
Set<String> basePackages = getBasePackages(importingClassMetadata);
for (String basePackage : basePackages) {
Set<BeanDefinition> candidateComponents = scanner.findCandidateComponents(basePackage);
for (BeanDefinition candidateComponent : candidateComponents) {
if (candidateComponent instanceof AnnotatedBeanDefinition) {
AnnotatedBeanDefinition beanDefinition = (AnnotatedBeanDefinition) candidateComponent;
AnnotationMetadata annotationMetadata = beanDefinition.getMetadata();
Map<String, Object> attributes = annotationMetadata
.getAnnotationAttributes(LepService.class.getCanonicalName());
registerLepService(registry, annotationMetadata, attributes);
}
}
}
} } | public class class_name {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
LepServiceProvider scanner = getScanner();
Set<String> basePackages = getBasePackages(importingClassMetadata);
for (String basePackage : basePackages) {
Set<BeanDefinition> candidateComponents = scanner.findCandidateComponents(basePackage);
for (BeanDefinition candidateComponent : candidateComponents) {
if (candidateComponent instanceof AnnotatedBeanDefinition) {
AnnotatedBeanDefinition beanDefinition = (AnnotatedBeanDefinition) candidateComponent;
AnnotationMetadata annotationMetadata = beanDefinition.getMetadata();
Map<String, Object> attributes = annotationMetadata
.getAnnotationAttributes(LepService.class.getCanonicalName());
registerLepService(registry, annotationMetadata, attributes); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public synchronized static JsonMapper nonDefaultMapper() {
if (nonDefaultJsonMapper == null) {
nonDefaultJsonMapper = new JsonMapper(JsonInclude.Include.NON_DEFAULT, false);
}
return nonDefaultJsonMapper;
} } | public class class_name {
public synchronized static JsonMapper nonDefaultMapper() {
if (nonDefaultJsonMapper == null) {
nonDefaultJsonMapper = new JsonMapper(JsonInclude.Include.NON_DEFAULT, false);
// depends on control dependency: [if], data = [none]
}
return nonDefaultJsonMapper;
} } |
public class class_name {
public final EObject ruleNamedArgument() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_calledByName_1_0=null;
EObject lv_value_2_0 = null;
enterRule();
try {
// InternalXtext.g:1657:2: ( ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) ) )
// InternalXtext.g:1658:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) )
{
// InternalXtext.g:1658:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) )
// InternalXtext.g:1659:3: ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) )
{
// InternalXtext.g:1659:3: ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )?
int alt42=2;
int LA42_0 = input.LA(1);
if ( (LA42_0==RULE_ID) ) {
int LA42_1 = input.LA(2);
if ( (LA42_1==35) ) {
alt42=1;
}
}
switch (alt42) {
case 1 :
// InternalXtext.g:1660:4: ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) )
{
// InternalXtext.g:1660:4: ( (otherlv_0= RULE_ID ) )
// InternalXtext.g:1661:5: (otherlv_0= RULE_ID )
{
// InternalXtext.g:1661:5: (otherlv_0= RULE_ID )
// InternalXtext.g:1662:6: otherlv_0= RULE_ID
{
if (current==null) {
current = createModelElement(grammarAccess.getNamedArgumentRule());
}
otherlv_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_36);
newLeafNode(otherlv_0, grammarAccess.getNamedArgumentAccess().getParameterParameterCrossReference_0_0_0());
}
}
// InternalXtext.g:1673:4: ( (lv_calledByName_1_0= '=' ) )
// InternalXtext.g:1674:5: (lv_calledByName_1_0= '=' )
{
// InternalXtext.g:1674:5: (lv_calledByName_1_0= '=' )
// InternalXtext.g:1675:6: lv_calledByName_1_0= '='
{
lv_calledByName_1_0=(Token)match(input,35,FollowSets000.FOLLOW_26);
newLeafNode(lv_calledByName_1_0, grammarAccess.getNamedArgumentAccess().getCalledByNameEqualsSignKeyword_0_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getNamedArgumentRule());
}
setWithLastConsumed(current, "calledByName", true, "=");
}
}
}
break;
}
// InternalXtext.g:1688:3: ( (lv_value_2_0= ruleDisjunction ) )
// InternalXtext.g:1689:4: (lv_value_2_0= ruleDisjunction )
{
// InternalXtext.g:1689:4: (lv_value_2_0= ruleDisjunction )
// InternalXtext.g:1690:5: lv_value_2_0= ruleDisjunction
{
newCompositeNode(grammarAccess.getNamedArgumentAccess().getValueDisjunctionParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_value_2_0=ruleDisjunction();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getNamedArgumentRule());
}
set(
current,
"value",
lv_value_2_0,
"org.eclipse.xtext.Xtext.Disjunction");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleNamedArgument() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_calledByName_1_0=null;
EObject lv_value_2_0 = null;
enterRule();
try {
// InternalXtext.g:1657:2: ( ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) ) )
// InternalXtext.g:1658:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) )
{
// InternalXtext.g:1658:2: ( ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) ) )
// InternalXtext.g:1659:3: ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )? ( (lv_value_2_0= ruleDisjunction ) )
{
// InternalXtext.g:1659:3: ( ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) ) )?
int alt42=2;
int LA42_0 = input.LA(1);
if ( (LA42_0==RULE_ID) ) {
int LA42_1 = input.LA(2);
if ( (LA42_1==35) ) {
alt42=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt42) {
case 1 :
// InternalXtext.g:1660:4: ( (otherlv_0= RULE_ID ) ) ( (lv_calledByName_1_0= '=' ) )
{
// InternalXtext.g:1660:4: ( (otherlv_0= RULE_ID ) )
// InternalXtext.g:1661:5: (otherlv_0= RULE_ID )
{
// InternalXtext.g:1661:5: (otherlv_0= RULE_ID )
// InternalXtext.g:1662:6: otherlv_0= RULE_ID
{
if (current==null) {
current = createModelElement(grammarAccess.getNamedArgumentRule()); // depends on control dependency: [if], data = [none]
}
otherlv_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_36);
newLeafNode(otherlv_0, grammarAccess.getNamedArgumentAccess().getParameterParameterCrossReference_0_0_0());
}
}
// InternalXtext.g:1673:4: ( (lv_calledByName_1_0= '=' ) )
// InternalXtext.g:1674:5: (lv_calledByName_1_0= '=' )
{
// InternalXtext.g:1674:5: (lv_calledByName_1_0= '=' )
// InternalXtext.g:1675:6: lv_calledByName_1_0= '='
{
lv_calledByName_1_0=(Token)match(input,35,FollowSets000.FOLLOW_26);
newLeafNode(lv_calledByName_1_0, grammarAccess.getNamedArgumentAccess().getCalledByNameEqualsSignKeyword_0_1_0());
if (current==null) {
current = createModelElement(grammarAccess.getNamedArgumentRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "calledByName", true, "=");
}
}
}
break;
}
// InternalXtext.g:1688:3: ( (lv_value_2_0= ruleDisjunction ) )
// InternalXtext.g:1689:4: (lv_value_2_0= ruleDisjunction )
{
// InternalXtext.g:1689:4: (lv_value_2_0= ruleDisjunction )
// InternalXtext.g:1690:5: lv_value_2_0= ruleDisjunction
{
newCompositeNode(grammarAccess.getNamedArgumentAccess().getValueDisjunctionParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_value_2_0=ruleDisjunction();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getNamedArgumentRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"value",
lv_value_2_0,
"org.eclipse.xtext.Xtext.Disjunction");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
@Override
protected synchronized void includeBaseLocation(String baseLocation) {
_locations.add(baseLocation);
// only do the processing if the cache has been read.
if (_cacheRead) {
File[] files = new File(_installDir, baseLocation).listFiles(new FileFilter() {
@Override
public boolean accept(File arg0) {
// select files only if they end .jar and they aren't in the cache already.
return arg0.getName().endsWith(".jar") && !!!_bundleLocations.contains(arg0);
}
});
if (files != null) {
for (File f : files) {
BundleInfo bInfo;
try {
bInfo = new BundleInfo(f, baseLocation);
if (bInfo.symbolicName != null) {
_dirty = true;
addToCache(bInfo);
}
} catch (IOException e) {
}
}
}
}
} } | public class class_name {
@Override
protected synchronized void includeBaseLocation(String baseLocation) {
_locations.add(baseLocation);
// only do the processing if the cache has been read.
if (_cacheRead) {
File[] files = new File(_installDir, baseLocation).listFiles(new FileFilter() {
@Override
public boolean accept(File arg0) {
// select files only if they end .jar and they aren't in the cache already.
return arg0.getName().endsWith(".jar") && !!!_bundleLocations.contains(arg0);
}
});
if (files != null) {
for (File f : files) {
BundleInfo bInfo;
try {
bInfo = new BundleInfo(f, baseLocation); // depends on control dependency: [try], data = [none]
if (bInfo.symbolicName != null) {
_dirty = true; // depends on control dependency: [if], data = [none]
addToCache(bInfo); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
}
}
} } |
public class class_name {
void rollback() {
if (publishedFullRegistry == null) {
return;
}
writeLock.lock();
try {
publishedFullRegistry.readLock.lock();
try {
clear(true);
copy(publishedFullRegistry, this);
modified = false;
} finally {
publishedFullRegistry.readLock.unlock();
}
} finally {
writeLock.unlock();
}
} } | public class class_name {
void rollback() {
if (publishedFullRegistry == null) {
return; // depends on control dependency: [if], data = [none]
}
writeLock.lock();
try {
publishedFullRegistry.readLock.lock(); // depends on control dependency: [try], data = [none]
try {
clear(true); // depends on control dependency: [try], data = [none]
copy(publishedFullRegistry, this); // depends on control dependency: [try], data = [none]
modified = false; // depends on control dependency: [try], data = [none]
} finally {
publishedFullRegistry.readLock.unlock();
}
} finally {
writeLock.unlock();
}
} } |
public class class_name {
public void read(String filePath) throws IOException{
String line;
ArrayList<String> words = new ArrayList<String>();
ArrayList<String> markP = new ArrayList<String>();
ArrayList<String> typeP = new ArrayList<String>();
ArrayList<String> markC = new ArrayList<String>();
ArrayList<String> typeC = new ArrayList<String>();
if(filePath == null)
return;
File file = new File(filePath);
BufferedReader reader = null;
entityType = new HashSet<String>();
//按行读取文件内容,一次读一整行
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
//从文件中提取实体并存入队列中
while ((line = reader.readLine()) != null) {
line = line.trim();
if(line.equals("")){
newextract(words, markP, typeP, markC, typeC);
}else{
//判断实体,实体开始的边界为B-***或者S-***,结束的边界为E-***或N(O)或空白字符或B-***
//predict
String[] toks = line.split("\\s+");
int ci = 1;
int cj=2;
if(toks.length>3){//如果列数大于三,默认取最后两列
ci=toks.length-2;
cj=toks.length-1;
}else if(toks.length<3){
System.out.println(line);
return;
}
String[] marktype = getMarkType(toks[ci]);
words.add(toks[0]);
markP.add(marktype[0]);
typeP.add(marktype[1]);
entityType.add(marktype[1]);
//correct
marktype = getMarkType(toks[cj]);
markC.add(marktype[0]);
typeC.add(marktype[1]);
entityType.add(marktype[1]);
}
}
reader.close();
if(words.size()>0){
newextract(words, markP, typeP, markC, typeC);
}
//从entityPs和entityCs提取正确估计的实体,存到entityCinPs,并更新mpc中的统计信息
extractCInPEntity();
} } | public class class_name {
public void read(String filePath) throws IOException{
String line;
ArrayList<String> words = new ArrayList<String>();
ArrayList<String> markP = new ArrayList<String>();
ArrayList<String> typeP = new ArrayList<String>();
ArrayList<String> markC = new ArrayList<String>();
ArrayList<String> typeC = new ArrayList<String>();
if(filePath == null)
return;
File file = new File(filePath);
BufferedReader reader = null;
entityType = new HashSet<String>();
//按行读取文件内容,一次读一整行
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
//从文件中提取实体并存入队列中
while ((line = reader.readLine()) != null) {
line = line.trim();
if(line.equals("")){
newextract(words, markP, typeP, markC, typeC);
// depends on control dependency: [if], data = [none]
}else{
//判断实体,实体开始的边界为B-***或者S-***,结束的边界为E-***或N(O)或空白字符或B-***
//predict
String[] toks = line.split("\\s+");
int ci = 1;
int cj=2;
if(toks.length>3){//如果列数大于三,默认取最后两列
ci=toks.length-2; // depends on control dependency: [if], data = [none]
cj=toks.length-1; // depends on control dependency: [if], data = [none]
}else if(toks.length<3){
System.out.println(line); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String[] marktype = getMarkType(toks[ci]);
words.add(toks[0]);
// depends on control dependency: [if], data = [none]
markP.add(marktype[0]);
// depends on control dependency: [if], data = [none]
typeP.add(marktype[1]);
// depends on control dependency: [if], data = [none]
entityType.add(marktype[1]);
// depends on control dependency: [if], data = [none]
//correct
marktype = getMarkType(toks[cj]);
// depends on control dependency: [if], data = [none]
markC.add(marktype[0]);
// depends on control dependency: [if], data = [none]
typeC.add(marktype[1]);
// depends on control dependency: [if], data = [none]
entityType.add(marktype[1]);
// depends on control dependency: [if], data = [none]
}
}
reader.close();
if(words.size()>0){
newextract(words, markP, typeP, markC, typeC);
}
//从entityPs和entityCs提取正确估计的实体,存到entityCinPs,并更新mpc中的统计信息
extractCInPEntity();
} } |
public class class_name {
public static <E, T, U extends T, V extends T> T inject(E[] self, U initialValue, @ClosureParams(value=FromString.class,options="U,E") Closure<V> closure) {
Object[] params = new Object[2];
T value = initialValue;
for (Object next : self) {
params[0] = value;
params[1] = next;
value = closure.call(params);
}
return value;
} } | public class class_name {
public static <E, T, U extends T, V extends T> T inject(E[] self, U initialValue, @ClosureParams(value=FromString.class,options="U,E") Closure<V> closure) {
Object[] params = new Object[2];
T value = initialValue;
for (Object next : self) {
params[0] = value; // depends on control dependency: [for], data = [none]
params[1] = next; // depends on control dependency: [for], data = [next]
value = closure.call(params); // depends on control dependency: [for], data = [none]
}
return value;
} } |
public class class_name {
protected void openToThePublic ()
{
if (getListenPorts().length != 0 && !_socketAcceptor.bind()) {
queueShutdown();
} else {
_datagramReader.bind();
_conmgr.start();
}
} } | public class class_name {
protected void openToThePublic ()
{
if (getListenPorts().length != 0 && !_socketAcceptor.bind()) {
queueShutdown(); // depends on control dependency: [if], data = [none]
} else {
_datagramReader.bind(); // depends on control dependency: [if], data = [none]
_conmgr.start(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static SoyExpression isNonNull(final Expression expr) {
if (BytecodeUtils.isPrimitive(expr.resultType())) {
return SoyExpression.TRUE;
}
return SoyExpression.forBool(
new Expression(Type.BOOLEAN_TYPE, expr.features()) {
@Override
protected void doGen(CodeBuilder adapter) {
expr.gen(adapter);
Label isNull = new Label();
adapter.ifNull(isNull);
// non-null
adapter.pushBoolean(true);
Label end = new Label();
adapter.goTo(end);
adapter.mark(isNull);
adapter.pushBoolean(false);
adapter.mark(end);
}
});
} } | public class class_name {
public static SoyExpression isNonNull(final Expression expr) {
if (BytecodeUtils.isPrimitive(expr.resultType())) {
return SoyExpression.TRUE; // depends on control dependency: [if], data = [none]
}
return SoyExpression.forBool(
new Expression(Type.BOOLEAN_TYPE, expr.features()) {
@Override
protected void doGen(CodeBuilder adapter) {
expr.gen(adapter);
Label isNull = new Label();
adapter.ifNull(isNull);
// non-null
adapter.pushBoolean(true);
Label end = new Label();
adapter.goTo(end);
adapter.mark(isNull);
adapter.pushBoolean(false);
adapter.mark(end);
}
});
} } |
public class class_name {
public void marshall(ListSuitesRequest listSuitesRequest, ProtocolMarshaller protocolMarshaller) {
if (listSuitesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSuitesRequest.getArn(), ARN_BINDING);
protocolMarshaller.marshall(listSuitesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListSuitesRequest listSuitesRequest, ProtocolMarshaller protocolMarshaller) {
if (listSuitesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSuitesRequest.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listSuitesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Tree evaluate(Tree t, TregexMatcher m) {
newNodeNames = new HashMap<String,Tree>();
coindexer.setLastIndex(t);
for (TsurgeonPattern child : children) {
t = child.evaluate(t, m);
if (t == null) {
return null;
}
}
return t;
} } | public class class_name {
@Override
public Tree evaluate(Tree t, TregexMatcher m) {
newNodeNames = new HashMap<String,Tree>();
coindexer.setLastIndex(t);
for (TsurgeonPattern child : children) {
t = child.evaluate(t, m);
// depends on control dependency: [for], data = [child]
if (t == null) {
return null;
// depends on control dependency: [if], data = [none]
}
}
return t;
} } |
public class class_name {
public void setUpdates(java.util.Collection<IPSetUpdate> updates) {
if (updates == null) {
this.updates = null;
return;
}
this.updates = new java.util.ArrayList<IPSetUpdate>(updates);
} } | public class class_name {
public void setUpdates(java.util.Collection<IPSetUpdate> updates) {
if (updates == null) {
this.updates = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.updates = new java.util.ArrayList<IPSetUpdate>(updates);
} } |
public class class_name {
private static void walkComponentTree(Component c, Consumer<Component> visitor) {
visitor.accept(c);
if (c instanceof HasComponents) {
for (Component child : ((HasComponents) c)) {
walkComponentTree(child, visitor);
}
}
} } | public class class_name {
private static void walkComponentTree(Component c, Consumer<Component> visitor) {
visitor.accept(c);
if (c instanceof HasComponents) {
for (Component child : ((HasComponents) c)) {
walkComponentTree(child, visitor);
// depends on control dependency: [for], data = [child]
}
}
} } |
public class class_name {
public Subnet withIpv6CidrBlockAssociationSet(SubnetIpv6CidrBlockAssociation... ipv6CidrBlockAssociationSet) {
if (this.ipv6CidrBlockAssociationSet == null) {
setIpv6CidrBlockAssociationSet(new com.amazonaws.internal.SdkInternalList<SubnetIpv6CidrBlockAssociation>(ipv6CidrBlockAssociationSet.length));
}
for (SubnetIpv6CidrBlockAssociation ele : ipv6CidrBlockAssociationSet) {
this.ipv6CidrBlockAssociationSet.add(ele);
}
return this;
} } | public class class_name {
public Subnet withIpv6CidrBlockAssociationSet(SubnetIpv6CidrBlockAssociation... ipv6CidrBlockAssociationSet) {
if (this.ipv6CidrBlockAssociationSet == null) {
setIpv6CidrBlockAssociationSet(new com.amazonaws.internal.SdkInternalList<SubnetIpv6CidrBlockAssociation>(ipv6CidrBlockAssociationSet.length)); // depends on control dependency: [if], data = [none]
}
for (SubnetIpv6CidrBlockAssociation ele : ipv6CidrBlockAssociationSet) {
this.ipv6CidrBlockAssociationSet.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static <E extends Comparable<E>> int search(E[] array, E value) {
int start = 0;
int end = array.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value.equals(array[middle])) {
return middle;
}
if(value.compareTo(array[middle]) < 0) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} } | public class class_name {
public static <E extends Comparable<E>> int search(E[] array, E value) {
int start = 0;
int end = array.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1; // depends on control dependency: [while], data = [(start]
if(value.equals(array[middle])) {
return middle; // depends on control dependency: [if], data = [none]
}
if(value.compareTo(array[middle]) < 0) {
end = middle - 1 ; // depends on control dependency: [if], data = [none]
}
else {
start = middle + 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public java.util.List<AttachedPolicy> getAttachedPolicies() {
if (attachedPolicies == null) {
attachedPolicies = new com.amazonaws.internal.SdkInternalList<AttachedPolicy>();
}
return attachedPolicies;
} } | public class class_name {
public java.util.List<AttachedPolicy> getAttachedPolicies() {
if (attachedPolicies == null) {
attachedPolicies = new com.amazonaws.internal.SdkInternalList<AttachedPolicy>(); // depends on control dependency: [if], data = [none]
}
return attachedPolicies;
} } |
public class class_name {
public void addTokens(String[] tokens, Node rootNode) {
Node thenode = rootNode;
for (int i = 0; i < tokens.length; i++) {
Node newnode = thenode.addToken(tokens[i]);
thenode = newnode;
}
} } | public class class_name {
public void addTokens(String[] tokens, Node rootNode) {
Node thenode = rootNode;
for (int i = 0; i < tokens.length; i++) {
Node newnode = thenode.addToken(tokens[i]);
thenode = newnode; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public synchronized byte[] allocate(int minSize) {
if (minSize <= MAX_SIZE) {
for (int i = 0; i < SIZES.length; i++) {
if (minSize < SIZES[i]) {
if (!fastBuffers.get(SIZES[i]).isEmpty()) {
Iterator<byte[]> interator = fastBuffers.get(SIZES[i]).iterator();
byte[] res = interator.next();
interator.remove();
mainFilter.remove(res);
if (TRACK_ALLOCATIONS) {
references.put(res, Thread.currentThread().getStackTrace());
}
return res;
}
return new byte[SIZES[i]];
}
}
} else {
byte[] res = null;
for (byte[] cached : byteBuffer) {
if (cached.length < minSize) {
continue;
}
if (res == null) {
res = cached;
} else if (res.length > cached.length) {
res = cached;
}
}
if (res != null) {
byteBuffer.remove(res);
mainFilter.remove(res);
if (TRACK_ALLOCATIONS) {
references.put(res, Thread.currentThread().getStackTrace());
}
return res;
}
}
return new byte[minSize];
} } | public class class_name {
public synchronized byte[] allocate(int minSize) {
if (minSize <= MAX_SIZE) {
for (int i = 0; i < SIZES.length; i++) {
if (minSize < SIZES[i]) {
if (!fastBuffers.get(SIZES[i]).isEmpty()) {
Iterator<byte[]> interator = fastBuffers.get(SIZES[i]).iterator();
byte[] res = interator.next();
interator.remove(); // depends on control dependency: [if], data = [none]
mainFilter.remove(res); // depends on control dependency: [if], data = [none]
if (TRACK_ALLOCATIONS) {
references.put(res, Thread.currentThread().getStackTrace()); // depends on control dependency: [if], data = [none]
}
return res; // depends on control dependency: [if], data = [none]
}
return new byte[SIZES[i]]; // depends on control dependency: [if], data = [none]
}
}
} else {
byte[] res = null;
for (byte[] cached : byteBuffer) {
if (cached.length < minSize) {
continue;
}
if (res == null) {
res = cached; // depends on control dependency: [if], data = [none]
} else if (res.length > cached.length) {
res = cached; // depends on control dependency: [if], data = [none]
}
}
if (res != null) {
byteBuffer.remove(res); // depends on control dependency: [if], data = [(res]
mainFilter.remove(res); // depends on control dependency: [if], data = [(res]
if (TRACK_ALLOCATIONS) {
references.put(res, Thread.currentThread().getStackTrace()); // depends on control dependency: [if], data = [none]
}
return res; // depends on control dependency: [if], data = [none]
}
}
return new byte[minSize];
} } |
public class class_name {
@Override
public Set<Principal> getPrincipals(final HttpServletRequest request) {
LOGGER.debug("Checking for principals using {}", ContainerRolesPrincipalProvider.class.getSimpleName());
if (request == null) {
LOGGER.debug("Servlet request was null");
return emptySet();
}
if (roleNames == null) {
LOGGER.debug("Role names Set was never initialized");
return emptySet();
}
final Iterator<String> iterator = roleNames.iterator();
final Set<Principal> principals = new HashSet<>();
while (iterator.hasNext()) {
final String role = iterator.next().trim();
if (request.isUserInRole(role)) {
LOGGER.debug("Adding container role as principal: {}", role);
principals.add(new ContainerRolesPrincipal(role));
}
}
return principals;
} } | public class class_name {
@Override
public Set<Principal> getPrincipals(final HttpServletRequest request) {
LOGGER.debug("Checking for principals using {}", ContainerRolesPrincipalProvider.class.getSimpleName());
if (request == null) {
LOGGER.debug("Servlet request was null"); // depends on control dependency: [if], data = [none]
return emptySet(); // depends on control dependency: [if], data = [none]
}
if (roleNames == null) {
LOGGER.debug("Role names Set was never initialized"); // depends on control dependency: [if], data = [none]
return emptySet(); // depends on control dependency: [if], data = [none]
}
final Iterator<String> iterator = roleNames.iterator();
final Set<Principal> principals = new HashSet<>();
while (iterator.hasNext()) {
final String role = iterator.next().trim();
if (request.isUserInRole(role)) {
LOGGER.debug("Adding container role as principal: {}", role); // depends on control dependency: [if], data = [none]
principals.add(new ContainerRolesPrincipal(role)); // depends on control dependency: [if], data = [none]
}
}
return principals;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.