code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
protected int selectRecordId(String hash) throws SQLException {
int id = -1;
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.GET_RECORD_ID,
hash);
ResultSet rs = ps.executeQuery();
try {
while (rs.next()) {
id = rs.getInt("id");
break;
}
} finally {
rs.close();
ps.close();
}
} finally {
connection.close();
}
return id;
} } | public class class_name {
protected int selectRecordId(String hash) throws SQLException {
int id = -1;
Connection connection = getConnection();
try {
PreparedStatement ps = setObjects(connection, Query.GET_RECORD_ID,
hash);
ResultSet rs = ps.executeQuery();
try {
while (rs.next()) {
id = rs.getInt("id"); // depends on control dependency: [while], data = [none]
break;
}
} finally {
rs.close();
ps.close();
}
} finally {
connection.close();
}
return id;
} } |
public class class_name {
public final String getTypeSignature() {
final StringBuffer sb = new StringBuffer();
sb.append(getName());
sb.append("(");
for (int i = 0; i < getArguments().size(); i++) {
if (i > 0) {
sb.append(", ");
}
final SgArgument arg = getArguments().get(i);
sb.append(arg.getType().getSimpleName());
}
sb.append(")");
return sb.toString();
} } | public class class_name {
public final String getTypeSignature() {
final StringBuffer sb = new StringBuffer();
sb.append(getName());
sb.append("(");
for (int i = 0; i < getArguments().size(); i++) {
if (i > 0) {
sb.append(", ");
// depends on control dependency: [if], data = [none]
}
final SgArgument arg = getArguments().get(i);
sb.append(arg.getType().getSimpleName());
// depends on control dependency: [for], data = [none]
}
sb.append(")");
return sb.toString();
} } |
public class class_name {
public long getCumulativeVmem(int olderThanAge) {
long total = 0;
for (ProcessInfo p : processTree.values()) {
if ((p != null) && (p.getAge() > olderThanAge)) {
total += p.getVmem();
}
}
return total;
} } | public class class_name {
public long getCumulativeVmem(int olderThanAge) {
long total = 0;
for (ProcessInfo p : processTree.values()) {
if ((p != null) && (p.getAge() > olderThanAge)) {
total += p.getVmem(); // depends on control dependency: [if], data = [none]
}
}
return total;
} } |
public class class_name {
public boolean read(Input in) throws NamingException {
clear();
this.in = in;
// somedata = false;
haveControls = false;
crec = null;
for (;;) {
int alen = -1;
try {
crec = in.readFullLine();
} catch (Exception e) {
throwmsg(e.getMessage());
}
int inLen = 0;
if (crec != null) {
inLen = crec.length();
}
/*
System.out.println("ldifrec len=" + inLen + " data=" + crec +
" state=" + state); */
if (crec != null) {
ldifData.addElement(crec);
alen = crec.indexOf(':');
}
// Null terminator means we're done
if (inLen == 0) {
// There are some state we should not be in here
if (state == stateModSpec) { // Any others?
invalid();
}
break;
}
if ((inLen > 0) && (crec.startsWith("#"))) {
// Comment line. Ignore it.
} else if (alen > 0) {
/** We have something of the form
<name> : <val> or
<name> :: <encoded-val> or for base-64 encoded data
<name> :< <url> for the url of an inclusion
*/
String attr = null;
StringBuffer val = null;
boolean encoded = false;
boolean url = false;
int valStart;
valStart = alen + 1;
if (valStart == inLen) {
throw new NamingException("Bad input value \"" + crec + "\"");
} else if ((alen < inLen) && (crec.charAt(valStart) == ':')) {
valStart++;
encoded = true;
} else if ((alen < inLen) && (crec.charAt(valStart) == '<')) {
valStart++;
url = true;
}
while ((valStart < inLen) && (crec.charAt(valStart) == ' ')) {
valStart++;
}
attr = crec.substring(0, alen).toLowerCase();
val = new StringBuffer(crec.substring(valStart));
addAttrVal(attr, val.toString(), encoded, url);
} else if ((state == stateModSpec) && (inLen == 1) && (crec.equals("-"))) {
// We have a current change to add to the change vector.
if (changes == null) {
changes = new Vector();
}
changes.addElement(curChange);
curChange = null;
state = stateModify;
} else if (inLen > 0) {
invalid();
}
}
return somedata;
} } | public class class_name {
public boolean read(Input in) throws NamingException {
clear();
this.in = in;
// somedata = false;
haveControls = false;
crec = null;
for (;;) {
int alen = -1;
try {
crec = in.readFullLine(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throwmsg(e.getMessage());
} // depends on control dependency: [catch], data = [none]
int inLen = 0;
if (crec != null) {
inLen = crec.length(); // depends on control dependency: [if], data = [none]
}
/*
System.out.println("ldifrec len=" + inLen + " data=" + crec +
" state=" + state); */
if (crec != null) {
ldifData.addElement(crec); // depends on control dependency: [if], data = [(crec]
alen = crec.indexOf(':'); // depends on control dependency: [if], data = [none]
}
// Null terminator means we're done
if (inLen == 0) {
// There are some state we should not be in here
if (state == stateModSpec) { // Any others?
invalid(); // depends on control dependency: [if], data = [none]
}
break;
}
if ((inLen > 0) && (crec.startsWith("#"))) {
// Comment line. Ignore it.
} else if (alen > 0) {
/** We have something of the form
<name> : <val> or
<name> :: <encoded-val> or for base-64 encoded data
<name> :< <url> for the url of an inclusion
*/
String attr = null;
StringBuffer val = null;
boolean encoded = false;
boolean url = false;
int valStart;
valStart = alen + 1; // depends on control dependency: [if], data = [none]
if (valStart == inLen) {
throw new NamingException("Bad input value \"" + crec + "\"");
} else if ((alen < inLen) && (crec.charAt(valStart) == ':')) {
valStart++; // depends on control dependency: [if], data = [none]
encoded = true; // depends on control dependency: [if], data = [none]
} else if ((alen < inLen) && (crec.charAt(valStart) == '<')) {
valStart++; // depends on control dependency: [if], data = [none]
url = true; // depends on control dependency: [if], data = [none]
}
while ((valStart < inLen) && (crec.charAt(valStart) == ' ')) {
valStart++; // depends on control dependency: [while], data = [none]
}
attr = crec.substring(0, alen).toLowerCase(); // depends on control dependency: [if], data = [none]
val = new StringBuffer(crec.substring(valStart)); // depends on control dependency: [if], data = [none]
addAttrVal(attr, val.toString(), encoded, url); // depends on control dependency: [if], data = [none]
} else if ((state == stateModSpec) && (inLen == 1) && (crec.equals("-"))) {
// We have a current change to add to the change vector.
if (changes == null) {
changes = new Vector(); // depends on control dependency: [if], data = [none]
}
changes.addElement(curChange); // depends on control dependency: [if], data = [none]
curChange = null; // depends on control dependency: [if], data = [none]
state = stateModify; // depends on control dependency: [if], data = [none]
} else if (inLen > 0) {
invalid(); // depends on control dependency: [if], data = [none]
}
}
return somedata;
} } |
public class class_name {
public List<Type> insert(List<Type> cl, Type t, BiPredicate<Type, Type> shouldSkip) {
if (cl.isEmpty()) {
return cl.prepend(t);
} else if (shouldSkip.test(t, cl.head)) {
return cl;
} else if (t.tsym.precedes(cl.head.tsym, this)) {
return cl.prepend(t);
} else {
// t comes after head, or the two are unrelated
return insert(cl.tail, t, shouldSkip).prepend(cl.head);
}
} } | public class class_name {
public List<Type> insert(List<Type> cl, Type t, BiPredicate<Type, Type> shouldSkip) {
if (cl.isEmpty()) {
return cl.prepend(t); // depends on control dependency: [if], data = [none]
} else if (shouldSkip.test(t, cl.head)) {
return cl; // depends on control dependency: [if], data = [none]
} else if (t.tsym.precedes(cl.head.tsym, this)) {
return cl.prepend(t); // depends on control dependency: [if], data = [none]
} else {
// t comes after head, or the two are unrelated
return insert(cl.tail, t, shouldSkip).prepend(cl.head); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
<S extends StaticSlot, R extends StaticRef> void addSymbolsFrom(
StaticSymbolTable<S, R> otherSymbolTable) {
for (S otherSymbol : otherSymbolTable.getAllSymbols()) {
String name = otherSymbol.getName();
SymbolScope myScope = createScopeFrom(otherSymbolTable.getScope(otherSymbol));
StaticRef decl = findBestDeclToAdd(otherSymbolTable, otherSymbol);
Symbol mySymbol = null;
if (decl != null) {
Node declNode = decl.getNode();
// If we have a declaration node, we can ensure the symbol is declared.
mySymbol = isAnySymbolDeclared(name, declNode, myScope);
if (mySymbol == null) {
mySymbol = copySymbolTo(otherSymbol, declNode, myScope);
}
} else {
// If we don't have a declaration node, we won't be able to declare
// a symbol in this symbol table. But we may be able to salvage the
// references if we already have a symbol.
mySymbol = myScope.getOwnSlot(name);
}
if (mySymbol != null) {
for (R otherRef : otherSymbolTable.getReferences(otherSymbol)) {
if (isGoodRefToAdd(otherRef)) {
mySymbol.defineReferenceAt(otherRef.getNode());
}
}
}
}
} } | public class class_name {
<S extends StaticSlot, R extends StaticRef> void addSymbolsFrom(
StaticSymbolTable<S, R> otherSymbolTable) {
for (S otherSymbol : otherSymbolTable.getAllSymbols()) {
String name = otherSymbol.getName();
SymbolScope myScope = createScopeFrom(otherSymbolTable.getScope(otherSymbol));
StaticRef decl = findBestDeclToAdd(otherSymbolTable, otherSymbol);
Symbol mySymbol = null;
if (decl != null) {
Node declNode = decl.getNode();
// If we have a declaration node, we can ensure the symbol is declared.
mySymbol = isAnySymbolDeclared(name, declNode, myScope); // depends on control dependency: [if], data = [none]
if (mySymbol == null) {
mySymbol = copySymbolTo(otherSymbol, declNode, myScope); // depends on control dependency: [if], data = [none]
}
} else {
// If we don't have a declaration node, we won't be able to declare
// a symbol in this symbol table. But we may be able to salvage the
// references if we already have a symbol.
mySymbol = myScope.getOwnSlot(name); // depends on control dependency: [if], data = [none]
}
if (mySymbol != null) {
for (R otherRef : otherSymbolTable.getReferences(otherSymbol)) {
if (isGoodRefToAdd(otherRef)) {
mySymbol.defineReferenceAt(otherRef.getNode()); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
private Map<String, Object> getDialogObjectMap() {
@SuppressWarnings("unchecked")
Map<String, Object> objects = (Map<String, Object>)getSettings().getDialogObject();
if (objects == null) {
// using hash table as most efficient version of a synchronized map
objects = new Hashtable<String, Object>();
getSettings().setDialogObject(objects);
}
return objects;
} } | public class class_name {
private Map<String, Object> getDialogObjectMap() {
@SuppressWarnings("unchecked")
Map<String, Object> objects = (Map<String, Object>)getSettings().getDialogObject();
if (objects == null) {
// using hash table as most efficient version of a synchronized map
objects = new Hashtable<String, Object>(); // depends on control dependency: [if], data = [none]
getSettings().setDialogObject(objects); // depends on control dependency: [if], data = [(objects]
}
return objects;
} } |
public class class_name {
public List<String> getValues(final String propertyName) {
Preconditions.checkNotNull(propertyName);
List<String> values = properties.get(propertyName);
if (values == null) {
return null;
}
// creates a shallow defensive copy
return new ArrayList<>(values);
} } | public class class_name {
public List<String> getValues(final String propertyName) {
Preconditions.checkNotNull(propertyName);
List<String> values = properties.get(propertyName);
if (values == null) {
return null; // depends on control dependency: [if], data = [none]
}
// creates a shallow defensive copy
return new ArrayList<>(values);
} } |
public class class_name {
public void setIdentityPoolUsages(java.util.Collection<IdentityPoolUsage> identityPoolUsages) {
if (identityPoolUsages == null) {
this.identityPoolUsages = null;
return;
}
this.identityPoolUsages = new com.amazonaws.internal.SdkInternalList<IdentityPoolUsage>(identityPoolUsages);
} } | public class class_name {
public void setIdentityPoolUsages(java.util.Collection<IdentityPoolUsage> identityPoolUsages) {
if (identityPoolUsages == null) {
this.identityPoolUsages = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.identityPoolUsages = new com.amazonaws.internal.SdkInternalList<IdentityPoolUsage>(identityPoolUsages);
} } |
public class class_name {
public void setAttributes(Attribute[] v) {
this.attributes = v;
this.numberAttributes=v.length;
this.indexValues = new int[numberAttributes];
for (int i = 0; i < numberAttributes; i++) {
this.indexValues[i]=i;
}
} } | public class class_name {
public void setAttributes(Attribute[] v) {
this.attributes = v;
this.numberAttributes=v.length;
this.indexValues = new int[numberAttributes];
for (int i = 0; i < numberAttributes; i++) {
this.indexValues[i]=i; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private <I extends Message, O extends Message> void invoke(
ServerMethod<I, O> method, ByteString payload, long requestId, Channel channel) {
FutureCallback<O> callback = new ServerMethodCallback<>(method, requestId, channel);
try {
I request = method.inputParser().parseFrom(payload);
ListenableFuture<O> result = method.invoke(request);
pendingRequests.put(requestId, result);
Futures.addCallback(result, callback, responseCallbackExecutor);
} catch (InvalidProtocolBufferException ipbe) {
callback.onFailure(ipbe);
}
} } | public class class_name {
private <I extends Message, O extends Message> void invoke(
ServerMethod<I, O> method, ByteString payload, long requestId, Channel channel) {
FutureCallback<O> callback = new ServerMethodCallback<>(method, requestId, channel);
try {
I request = method.inputParser().parseFrom(payload);
ListenableFuture<O> result = method.invoke(request);
pendingRequests.put(requestId, result); // depends on control dependency: [try], data = [none]
Futures.addCallback(result, callback, responseCallbackExecutor); // depends on control dependency: [try], data = [none]
} catch (InvalidProtocolBufferException ipbe) {
callback.onFailure(ipbe);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void cleanSpecTopicWhenCreatedOrUpdated(final ITopicNode topicNode) {
topicNode.setDescription(null);
topicNode.setTags(new ArrayList<String>());
topicNode.setRemoveTags(new ArrayList<String>());
topicNode.setAssignedWriter(null);
if (topicNode instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topicNode;
specTopic.setSourceUrls(new ArrayList<String>());
specTopic.setType(null);
}
} } | public class class_name {
protected void cleanSpecTopicWhenCreatedOrUpdated(final ITopicNode topicNode) {
topicNode.setDescription(null);
topicNode.setTags(new ArrayList<String>());
topicNode.setRemoveTags(new ArrayList<String>());
topicNode.setAssignedWriter(null);
if (topicNode instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topicNode;
specTopic.setSourceUrls(new ArrayList<String>()); // depends on control dependency: [if], data = [none]
specTopic.setType(null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setValue(Object target, Object value, OCommandContext ctx) {
if (target == null) {
return;
}
if (target.getClass().isArray()) {
setArrayValue(target, value, ctx);
} else if (target instanceof List) {
setValue((List) target, value, ctx);
} else if (OMultiValue.isMultiValue(value)) {
//TODO
}
//TODO
} } | public class class_name {
public void setValue(Object target, Object value, OCommandContext ctx) {
if (target == null) {
return; // depends on control dependency: [if], data = [none]
}
if (target.getClass().isArray()) {
setArrayValue(target, value, ctx); // depends on control dependency: [if], data = [none]
} else if (target instanceof List) {
setValue((List) target, value, ctx); // depends on control dependency: [if], data = [none]
} else if (OMultiValue.isMultiValue(value)) {
//TODO
}
//TODO
} } |
public class class_name {
protected ActionWrapper[] createExecutionArray() {
int totalInterceptors = (this.actionRuntime.getInterceptors() != null ? this.actionRuntime.getInterceptors().length : 0);
int totalFilters = (this.actionRuntime.getFilters() != null ? this.actionRuntime.getFilters().length : 0);
ActionWrapper[] executionArray = new ActionWrapper[totalFilters + 1 + totalInterceptors + 1];
// filters
int index = 0;
if (totalFilters > 0) {
System.arraycopy(actionRuntime.getFilters(), 0, executionArray, index, totalFilters);
index += totalFilters;
}
// result is executed AFTER the action AND interceptors
executionArray[index++] = actionRequest -> {
Object actionResult = actionRequest.invoke();
ActionRequest.this.madvocController.render(ActionRequest.this, actionResult);
return actionResult;
};
// interceptors
if (totalInterceptors > 0) {
System.arraycopy(actionRuntime.getInterceptors(), 0, executionArray, index, totalInterceptors);
index += totalInterceptors;
}
// action
executionArray[index] = actionRequest -> {
actionResult = invokeActionMethod();
return actionResult;
};
return executionArray;
} } | public class class_name {
protected ActionWrapper[] createExecutionArray() {
int totalInterceptors = (this.actionRuntime.getInterceptors() != null ? this.actionRuntime.getInterceptors().length : 0);
int totalFilters = (this.actionRuntime.getFilters() != null ? this.actionRuntime.getFilters().length : 0);
ActionWrapper[] executionArray = new ActionWrapper[totalFilters + 1 + totalInterceptors + 1];
// filters
int index = 0;
if (totalFilters > 0) {
System.arraycopy(actionRuntime.getFilters(), 0, executionArray, index, totalFilters); // depends on control dependency: [if], data = [none]
index += totalFilters; // depends on control dependency: [if], data = [none]
}
// result is executed AFTER the action AND interceptors
executionArray[index++] = actionRequest -> {
Object actionResult = actionRequest.invoke();
ActionRequest.this.madvocController.render(ActionRequest.this, actionResult);
return actionResult;
};
// interceptors
if (totalInterceptors > 0) {
System.arraycopy(actionRuntime.getInterceptors(), 0, executionArray, index, totalInterceptors);
index += totalInterceptors;
}
// action
executionArray[index] = actionRequest -> {
actionResult = invokeActionMethod();
return actionResult;
};
return executionArray;
} } |
public class class_name {
public final void selector() throws RecognitionException {
Token DOT20=null;
Token DOT21=null;
Token DOT22=null;
Token ID23=null;
Token LEFT_SQUARE24=null;
Token RIGHT_SQUARE25=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:697:5: ( ( DOT super_key )=> DOT super_key superSuffix | ( DOT new_key )=> DOT new_key ( nonWildcardTypeArguments )? innerCreator | ( DOT ID )=> DOT ID ( ( LEFT_PAREN )=> arguments )? | ( LEFT_SQUARE )=> LEFT_SQUARE expression RIGHT_SQUARE )
int alt91=4;
int LA91_0 = input.LA(1);
if ( (LA91_0==DOT) ) {
int LA91_1 = input.LA(2);
if ( (synpred41_DRL6Expressions()) ) {
alt91=1;
}
else if ( (synpred42_DRL6Expressions()) ) {
alt91=2;
}
else if ( (synpred43_DRL6Expressions()) ) {
alt91=3;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae =
new NoViableAltException("", 91, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else if ( (LA91_0==LEFT_SQUARE) && (synpred45_DRL6Expressions())) {
alt91=4;
}
switch (alt91) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:697:9: ( DOT super_key )=> DOT super_key superSuffix
{
DOT20=(Token)match(input,DOT,FOLLOW_DOT_in_selector4235); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT20, DroolsEditorType.SYMBOL); }
pushFollow(FOLLOW_super_key_in_selector4239);
super_key();
state._fsp--;
if (state.failed) return;
pushFollow(FOLLOW_superSuffix_in_selector4241);
superSuffix();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:9: ( DOT new_key )=> DOT new_key ( nonWildcardTypeArguments )? innerCreator
{
DOT21=(Token)match(input,DOT,FOLLOW_DOT_in_selector4257); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT21, DroolsEditorType.SYMBOL); }
pushFollow(FOLLOW_new_key_in_selector4261);
new_key();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:84: ( nonWildcardTypeArguments )?
int alt89=2;
int LA89_0 = input.LA(1);
if ( (LA89_0==LESS) ) {
alt89=1;
}
switch (alt89) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:85: nonWildcardTypeArguments
{
pushFollow(FOLLOW_nonWildcardTypeArguments_in_selector4264);
nonWildcardTypeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
pushFollow(FOLLOW_innerCreator_in_selector4268);
innerCreator();
state._fsp--;
if (state.failed) return;
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:699:9: ( DOT ID )=> DOT ID ( ( LEFT_PAREN )=> arguments )?
{
DOT22=(Token)match(input,DOT,FOLLOW_DOT_in_selector4284); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT22, DroolsEditorType.SYMBOL); }
ID23=(Token)match(input,ID,FOLLOW_ID_in_selector4306); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(ID23, DroolsEditorType.IDENTIFIER); }
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:701:19: ( ( LEFT_PAREN )=> arguments )?
int alt90=2;
int LA90_0 = input.LA(1);
if ( (LA90_0==LEFT_PAREN) ) {
int LA90_1 = input.LA(2);
if ( (synpred44_DRL6Expressions()) ) {
alt90=1;
}
}
switch (alt90) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:701:20: ( LEFT_PAREN )=> arguments
{
pushFollow(FOLLOW_arguments_in_selector4335);
arguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:703:9: ( LEFT_SQUARE )=> LEFT_SQUARE expression RIGHT_SQUARE
{
LEFT_SQUARE24=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_selector4356); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(LEFT_SQUARE24, DroolsEditorType.SYMBOL); }
pushFollow(FOLLOW_expression_in_selector4383);
expression();
state._fsp--;
if (state.failed) return;
RIGHT_SQUARE25=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_selector4408); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(RIGHT_SQUARE25, DroolsEditorType.SYMBOL); }
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void selector() throws RecognitionException {
Token DOT20=null;
Token DOT21=null;
Token DOT22=null;
Token ID23=null;
Token LEFT_SQUARE24=null;
Token RIGHT_SQUARE25=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:697:5: ( ( DOT super_key )=> DOT super_key superSuffix | ( DOT new_key )=> DOT new_key ( nonWildcardTypeArguments )? innerCreator | ( DOT ID )=> DOT ID ( ( LEFT_PAREN )=> arguments )? | ( LEFT_SQUARE )=> LEFT_SQUARE expression RIGHT_SQUARE )
int alt91=4;
int LA91_0 = input.LA(1);
if ( (LA91_0==DOT) ) {
int LA91_1 = input.LA(2);
if ( (synpred41_DRL6Expressions()) ) {
alt91=1; // depends on control dependency: [if], data = [none]
}
else if ( (synpred42_DRL6Expressions()) ) {
alt91=2; // depends on control dependency: [if], data = [none]
}
else if ( (synpred43_DRL6Expressions()) ) {
alt91=3; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
int nvaeMark = input.mark();
try {
input.consume(); // depends on control dependency: [try], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 91, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else if ( (LA91_0==LEFT_SQUARE) && (synpred45_DRL6Expressions())) {
alt91=4; // depends on control dependency: [if], data = [none]
}
switch (alt91) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:697:9: ( DOT super_key )=> DOT super_key superSuffix
{
DOT20=(Token)match(input,DOT,FOLLOW_DOT_in_selector4235); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT20, DroolsEditorType.SYMBOL); } // depends on control dependency: [if], data = [none]
pushFollow(FOLLOW_super_key_in_selector4239);
super_key();
state._fsp--;
if (state.failed) return;
pushFollow(FOLLOW_superSuffix_in_selector4241);
superSuffix();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:9: ( DOT new_key )=> DOT new_key ( nonWildcardTypeArguments )? innerCreator
{
DOT21=(Token)match(input,DOT,FOLLOW_DOT_in_selector4257); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT21, DroolsEditorType.SYMBOL); } // depends on control dependency: [if], data = [none]
pushFollow(FOLLOW_new_key_in_selector4261);
new_key();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:84: ( nonWildcardTypeArguments )?
int alt89=2;
int LA89_0 = input.LA(1);
if ( (LA89_0==LESS) ) {
alt89=1; // depends on control dependency: [if], data = [none]
}
switch (alt89) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:698:85: nonWildcardTypeArguments
{
pushFollow(FOLLOW_nonWildcardTypeArguments_in_selector4264);
nonWildcardTypeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
pushFollow(FOLLOW_innerCreator_in_selector4268);
innerCreator();
state._fsp--;
if (state.failed) return;
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:699:9: ( DOT ID )=> DOT ID ( ( LEFT_PAREN )=> arguments )?
{
DOT22=(Token)match(input,DOT,FOLLOW_DOT_in_selector4284); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(DOT22, DroolsEditorType.SYMBOL); } // depends on control dependency: [if], data = [none]
ID23=(Token)match(input,ID,FOLLOW_ID_in_selector4306); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(ID23, DroolsEditorType.IDENTIFIER); } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:701:19: ( ( LEFT_PAREN )=> arguments )?
int alt90=2;
int LA90_0 = input.LA(1);
if ( (LA90_0==LEFT_PAREN) ) {
int LA90_1 = input.LA(2);
if ( (synpred44_DRL6Expressions()) ) {
alt90=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt90) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:701:20: ( LEFT_PAREN )=> arguments
{
pushFollow(FOLLOW_arguments_in_selector4335);
arguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:703:9: ( LEFT_SQUARE )=> LEFT_SQUARE expression RIGHT_SQUARE
{
LEFT_SQUARE24=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_selector4356); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(LEFT_SQUARE24, DroolsEditorType.SYMBOL); } // depends on control dependency: [if], data = [none]
pushFollow(FOLLOW_expression_in_selector4383);
expression();
state._fsp--;
if (state.failed) return;
RIGHT_SQUARE25=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_selector4408); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(RIGHT_SQUARE25, DroolsEditorType.SYMBOL); } // depends on control dependency: [if], data = [none]
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
protected void dialogButtonsHtml(StringBuffer result, int button, String attribute) {
attribute = appendDelimiter(attribute);
switch (button) {
case BUTTON_OK:
result.append("<input name=\"ok\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_OK_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" type=\"submit\"");
} else {
result.append(" type=\"button\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CANCEL:
result.append("<input name=\"cancel\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CANCEL_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_EDIT:
result.append("<input name=\"ok\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_EDIT_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" type=\"submit\"");
} else {
result.append(" type=\"button\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_DISCARD:
result.append("<input name=\"cancel\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_DISCARD_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CLOSE:
result.append("<input name=\"close\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CLOSE_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_ADVANCED:
result.append("<input name=\"advanced\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_ADVANCED_0) + "\"");
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_SET:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_SET_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_SET + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_BACK:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_BACK_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_BACK + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CONTINUE:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CONTINUE_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CONTINUE + "', form);\"");
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_DETAILS:
result.append("<input name=\"details\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_DETAIL_0) + "\"");
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
default:
// not a valid button code, just insert a warning in the HTML
result.append("<!-- invalid button code: ");
result.append(button);
result.append(" -->\n");
}
} } | public class class_name {
protected void dialogButtonsHtml(StringBuffer result, int button, String attribute) {
attribute = appendDelimiter(attribute);
switch (button) {
case BUTTON_OK:
result.append("<input name=\"ok\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_OK_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" type=\"submit\""); // depends on control dependency: [if], data = [none]
} else {
result.append(" type=\"button\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CANCEL:
result.append("<input name=\"cancel\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CANCEL_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_EDIT:
result.append("<input name=\"ok\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_EDIT_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" type=\"submit\""); // depends on control dependency: [if], data = [none]
} else {
result.append(" type=\"button\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_DISCARD:
result.append("<input name=\"cancel\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_DISCARD_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CLOSE:
result.append("<input name=\"close\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CLOSE_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_ADVANCED:
result.append("<input name=\"advanced\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_ADVANCED_0) + "\"");
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_SET:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_SET_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_SET + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_BACK:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_BACK_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_BACK + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_CONTINUE:
result.append("<input name=\"set\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_CONTINUE_0) + "\"");
if (attribute.toLowerCase().indexOf("onclick") == -1) {
result.append(" onclick=\"submitAction('" + DIALOG_CONTINUE + "', form);\""); // depends on control dependency: [if], data = [none]
}
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
case BUTTON_DETAILS:
result.append("<input name=\"details\" type=\"button\" value=\"");
result.append(key(Messages.GUI_DIALOG_BUTTON_DETAIL_0) + "\"");
result.append(" class=\"dialogbutton\"");
result.append(attribute);
result.append(">\n");
break;
default:
// not a valid button code, just insert a warning in the HTML
result.append("<!-- invalid button code: ");
result.append(button);
result.append(" -->\n");
}
} } |
public class class_name {
public ObserverList<T> toObserverList ()
{
ObserverList<T> list = ObserverList.newSafeInOrder();
while (!isEmpty()) {
list.add(removeAvailableElement());
}
return list;
} } | public class class_name {
public ObserverList<T> toObserverList ()
{
ObserverList<T> list = ObserverList.newSafeInOrder();
while (!isEmpty()) {
list.add(removeAvailableElement()); // depends on control dependency: [while], data = [none]
}
return list;
} } |
public class class_name {
protected SelectBody wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
SelectBody setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
if (!(setSelectBody instanceof PlainSelect)) {
throw new PageException("目前无法处理该SQL,您可以将该SQL发送给abel533@gmail.com协助作者解决!");
}
PlainSelect plainSelect = (PlainSelect) setSelectBody;
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements());
plainSelect.setOrderByElements(null);
}
return selectBody;
} } | public class class_name {
protected SelectBody wrapSetOperationList(SetOperationList setOperationList) {
//获取最后一个plainSelect
SelectBody setSelectBody = setOperationList.getSelects().get(setOperationList.getSelects().size() - 1);
if (!(setSelectBody instanceof PlainSelect)) {
throw new PageException("目前无法处理该SQL,您可以将该SQL发送给abel533@gmail.com协助作者解决!");
}
PlainSelect plainSelect = (PlainSelect) setSelectBody;
PlainSelect selectBody = new PlainSelect();
List<SelectItem> selectItems = getSelectItems(plainSelect);
selectBody.setSelectItems(selectItems);
//设置fromIterm
SubSelect fromItem = new SubSelect();
fromItem.setSelectBody(setOperationList);
fromItem.setAlias(new Alias(WRAP_TABLE));
selectBody.setFromItem(fromItem);
//order by
if (isNotEmptyList(plainSelect.getOrderByElements())) {
selectBody.setOrderByElements(plainSelect.getOrderByElements()); // depends on control dependency: [if], data = [none]
plainSelect.setOrderByElements(null); // depends on control dependency: [if], data = [none]
}
return selectBody;
} } |
public class class_name {
public <T> T execute(WebDriverLikeRequest request) {
Response response = null;
long total = 0;
try {
HttpClient client = newHttpClientWithTimeout();
String url = remoteURL + request.getPath();
BasicHttpEntityEnclosingRequest
r =
new BasicHttpEntityEnclosingRequest(request.getMethod(), url);
if (request.hasPayload()) {
r.setEntity(new StringEntity(request.getPayload().toString(), "UTF-8"));
}
HttpHost h = new HttpHost(remoteURL.getHost(), remoteURL.getPort());
long start = System.currentTimeMillis();
HttpResponse res = client.execute(h, r);
total = System.currentTimeMillis() - start;
response = Helper.exctractResponse(res);
} catch (Exception e) {
throw new WebDriverException(e);
}
response = errorHandler.throwIfResponseFailed(response, total);
try{
return cast(response.getValue());
}catch (ClassCastException e){
log.warning(e.getMessage()+" for "+response.getValue());
throw e;
}
} } | public class class_name {
public <T> T execute(WebDriverLikeRequest request) {
Response response = null;
long total = 0;
try {
HttpClient client = newHttpClientWithTimeout();
String url = remoteURL + request.getPath();
BasicHttpEntityEnclosingRequest
r =
new BasicHttpEntityEnclosingRequest(request.getMethod(), url);
if (request.hasPayload()) {
r.setEntity(new StringEntity(request.getPayload().toString(), "UTF-8")); // depends on control dependency: [if], data = [none]
}
HttpHost h = new HttpHost(remoteURL.getHost(), remoteURL.getPort());
long start = System.currentTimeMillis();
HttpResponse res = client.execute(h, r);
total = System.currentTimeMillis() - start; // depends on control dependency: [try], data = [none]
response = Helper.exctractResponse(res); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new WebDriverException(e);
} // depends on control dependency: [catch], data = [none]
response = errorHandler.throwIfResponseFailed(response, total);
try{
return cast(response.getValue()); // depends on control dependency: [try], data = [none]
}catch (ClassCastException e){
log.warning(e.getMessage()+" for "+response.getValue());
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean accept(StringBuffer buff){
if (!validate(buff)) {
validate(buff);
return false;
}
if (acceptIfDifferent( getEditValue())) {
setStoreValue( validValue);
sendEvent();
}
return true;
} } | public class class_name {
protected boolean accept(StringBuffer buff){
if (!validate(buff)) {
validate(buff);
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
if (acceptIfDifferent( getEditValue())) {
setStoreValue( validValue);
// depends on control dependency: [if], data = [none]
sendEvent();
// depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
{
String strBaseClass, strMethodVariables = DBConstants.BLANK;
Record recClassInfo = this.getMainRecord();
LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // Get the base class name
strMethodVariables = this.getMethodVariables(strMethodInterface);
if (strClassName.equals(strMethodName))
{ // Call super.NewC initializer
if (strMethodVariables.equalsIgnoreCase("VOID"))
strMethodVariables = "";
if (strMethodInterface.length() == 0)
m_StreamOut.writeit("\tsuper();\n");
else
{
boolean bSuperFound = false;
if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0)
strMethodReturns = strMethodVariables; // Special case - if you have code, pass the default variables
if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
else
{ // Special Case - Different variables are passed in, must supply and init method w/the correct interface
if (!strMethodReturns.equalsIgnoreCase("INIT"))
{
m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
m_StreamOut.writeit("}\n");
m_strLastMethodInterface = strMethodInterface;
m_strLastMethod = strMethodName;
this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null);
if (strMethodReturns.equalsIgnoreCase("VOID"))
strMethodReturns = "";
this.writeClassInitialize(true);
}
else
bSuperFound = true; // Don't call init.super();
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
{
m_StreamOut.setTabs(+1);
//x bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n");
bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName);
m_StreamOut.setTabs(-1);
}
if (!bSuperFound)
m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n");
}
}
}
else
{ // Call super.NewC
if (!strMethodName.equals("setupSFields"))
{
String beginString = "";
if (strMethodReturns.length() == 0)
beginString = "return ";
m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n");
}
else
this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName);
}
} } | public class class_name {
public void writeDefaultMethodCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
{
String strBaseClass, strMethodVariables = DBConstants.BLANK;
Record recClassInfo = this.getMainRecord();
LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
strBaseClass = recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getString(); // Get the base class name
strMethodVariables = this.getMethodVariables(strMethodInterface);
if (strClassName.equals(strMethodName))
{ // Call super.NewC initializer
if (strMethodVariables.equalsIgnoreCase("VOID"))
strMethodVariables = "";
if (strMethodInterface.length() == 0)
m_StreamOut.writeit("\tsuper();\n");
else
{
boolean bSuperFound = false;
if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getLength() > 0)
strMethodReturns = strMethodVariables; // Special case - if you have code, pass the default variables
if ((strMethodReturns.length() == 0) || (strMethodReturns.equalsIgnoreCase("void")))
m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
else
{ // Special Case - Different variables are passed in, must supply and init method w/the correct interface
if (!strMethodReturns.equalsIgnoreCase("INIT"))
{
m_StreamOut.writeit("\tthis();\n\tthis.init(" + strMethodVariables + ");\n");
m_StreamOut.writeit("}\n");
m_strLastMethodInterface = strMethodInterface;
m_strLastMethod = strMethodName;
this.writeMethodInterface(null, "init", "void", strMethodInterface, "", "Initialize class fields", null); // depends on control dependency: [if], data = [none]
if (strMethodReturns.equalsIgnoreCase("VOID"))
strMethodReturns = "";
this.writeClassInitialize(true);
}
else
bSuperFound = true; // Don't call init.super();
if (recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString().length() != 0)
{
m_StreamOut.setTabs(+1); // depends on control dependency: [if], data = [none]
//x bSuperFound = m_MethodsOut.writeit(recLogicFile.getField(LogicFile.LOGIC_SOURCE).getString() + "\n");
bSuperFound = bSuperFound | this.writeTextField(recLogicFile.getField(LogicFile.LOGIC_SOURCE), strBaseClass, "init", strMethodReturns, strClassName); // depends on control dependency: [if], data = [none]
m_StreamOut.setTabs(-1); // depends on control dependency: [if], data = [none]
}
if (!bSuperFound)
m_StreamOut.writeit("\tsuper.init(" + strMethodReturns + ");\n");
}
}
}
else
{ // Call super.NewC
if (!strMethodName.equals("setupSFields"))
{
String beginString = "";
if (strMethodReturns.length() == 0)
beginString = "return ";
m_StreamOut.writeit("\t" + beginString + "super." + strMethodName + "(" + strMethodVariables + ");\n"); // depends on control dependency: [if], data = [none]
}
else
this.writeSetupSCode(strMethodName, strMethodReturns, strMethodInterface, strClassName);
}
} } |
public class class_name {
public static String caculatorDateToString(Date date) {
long milliSecond = compareDate(date);
List dateCaculators = DateCalculator.getDateCalculators();
for (Iterator iterator = dateCaculators.iterator(); iterator.hasNext(); ) {
DateCalculator dateCalculator = (DateCalculator) iterator.next();
if (milliSecond >= dateCalculator.getMinMilliSecond()
&& milliSecond <= dateCalculator.getMaxMilliSecond()) {
String displayStr = dateCalculator.getDisplayStr();
long numberOfUnit = 0;
if (dateCalculator.getMinMilliSecond() == 0) { // 分母为零,则直接为0
numberOfUnit = 0;
} else {
numberOfUnit = milliSecond / dateCalculator.getMinMilliSecond();
}
// 替代所有{0}
Pattern p = Pattern.compile("(\\{.+?\\})");
Matcher m = p.matcher(displayStr);
displayStr = m.replaceAll(numberOfUnit + "");
// displayStr = displayStr.replace("\\{0\\}", numberOfUnit +
// "");
return displayStr;
}
}
return milliSecond + "";
} } | public class class_name {
public static String caculatorDateToString(Date date) {
long milliSecond = compareDate(date);
List dateCaculators = DateCalculator.getDateCalculators();
for (Iterator iterator = dateCaculators.iterator(); iterator.hasNext(); ) {
DateCalculator dateCalculator = (DateCalculator) iterator.next();
if (milliSecond >= dateCalculator.getMinMilliSecond()
&& milliSecond <= dateCalculator.getMaxMilliSecond()) {
String displayStr = dateCalculator.getDisplayStr();
long numberOfUnit = 0;
if (dateCalculator.getMinMilliSecond() == 0) { // 分母为零,则直接为0
numberOfUnit = 0; // depends on control dependency: [if], data = [none]
} else {
numberOfUnit = milliSecond / dateCalculator.getMinMilliSecond(); // depends on control dependency: [if], data = [none]
}
// 替代所有{0}
Pattern p = Pattern.compile("(\\{.+?\\})");
Matcher m = p.matcher(displayStr);
displayStr = m.replaceAll(numberOfUnit + ""); // depends on control dependency: [if], data = [none]
// displayStr = displayStr.replace("\\{0\\}", numberOfUnit +
// "");
return displayStr; // depends on control dependency: [if], data = [none]
}
}
return milliSecond + "";
} } |
public class class_name {
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher, JedisCluster jedis) throws JobPersistenceException {
Set<String> pausedTriggerGroups = new HashSet<>();
if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) {
final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue()));
final long addResult = jedis.sadd(redisSchema.pausedTriggerGroupsSet(), triggerGroupSetKey);
if (addResult > 0) {
for (final String trigger : jedis.smembers(triggerGroupSetKey)) {
pauseTrigger(redisSchema.triggerKey(trigger), jedis);
}
pausedTriggerGroups.add(redisSchema.triggerGroup(triggerGroupSetKey));
}
} else {
Map<String, Set<String>> triggerGroups = new HashMap<>();
for (final String triggerGroupSetKey : jedis.smembers(redisSchema.triggerGroupsSet())) {
if (matcher.getCompareWithOperator().evaluate(redisSchema.triggerGroup(triggerGroupSetKey), matcher.getCompareToValue())) {
triggerGroups.put(triggerGroupSetKey, jedis.smembers(triggerGroupSetKey));
}
}
for (final Map.Entry<String, Set<String>> entry : triggerGroups.entrySet()) {
if (jedis.sadd(redisSchema.pausedJobGroupsSet(), entry.getKey()) > 0) {
// This trigger group was not paused. Pause it now.
pausedTriggerGroups.add(redisSchema.triggerGroup(entry.getKey()));
for (final String triggerHashKey : entry.getValue()) {
pauseTrigger(redisSchema.triggerKey(triggerHashKey), jedis);
}
}
}
}
return pausedTriggerGroups;
} } | public class class_name {
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher, JedisCluster jedis) throws JobPersistenceException {
Set<String> pausedTriggerGroups = new HashSet<>();
if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) {
final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue()));
final long addResult = jedis.sadd(redisSchema.pausedTriggerGroupsSet(), triggerGroupSetKey);
if (addResult > 0) {
for (final String trigger : jedis.smembers(triggerGroupSetKey)) {
pauseTrigger(redisSchema.triggerKey(trigger), jedis); // depends on control dependency: [for], data = [trigger]
}
pausedTriggerGroups.add(redisSchema.triggerGroup(triggerGroupSetKey)); // depends on control dependency: [if], data = [none]
}
} else {
Map<String, Set<String>> triggerGroups = new HashMap<>();
for (final String triggerGroupSetKey : jedis.smembers(redisSchema.triggerGroupsSet())) {
if (matcher.getCompareWithOperator().evaluate(redisSchema.triggerGroup(triggerGroupSetKey), matcher.getCompareToValue())) {
triggerGroups.put(triggerGroupSetKey, jedis.smembers(triggerGroupSetKey)); // depends on control dependency: [if], data = [none]
}
}
for (final Map.Entry<String, Set<String>> entry : triggerGroups.entrySet()) {
if (jedis.sadd(redisSchema.pausedJobGroupsSet(), entry.getKey()) > 0) {
// This trigger group was not paused. Pause it now.
pausedTriggerGroups.add(redisSchema.triggerGroup(entry.getKey())); // depends on control dependency: [if], data = [none]
for (final String triggerHashKey : entry.getValue()) {
pauseTrigger(redisSchema.triggerKey(triggerHashKey), jedis); // depends on control dependency: [for], data = [triggerHashKey]
}
}
}
}
return pausedTriggerGroups;
} } |
public class class_name {
@Override
@FFDCIgnore(IllegalStateException.class)
public Collection<URL> getURLs() {
try {
URL u = this.bundle.getEntry("/");
return Collections.singleton(u);
} catch (IllegalStateException ise) {
return Collections.emptyList();
}
} } | public class class_name {
@Override
@FFDCIgnore(IllegalStateException.class)
public Collection<URL> getURLs() {
try {
URL u = this.bundle.getEntry("/");
return Collections.singleton(u); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException ise) {
return Collections.emptyList();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean canRetry(RetryContext context) {
RetryContext[] contexts = ((CompositeRetryContext) context).contexts;
RetryPolicy[] policies = ((CompositeRetryContext) context).policies;
boolean retryable = true;
if (this.optimistic) {
retryable = false;
for (int i = 0; i < contexts.length; i++) {
if (policies[i].canRetry(contexts[i])) {
retryable = true;
}
}
}
else {
for (int i = 0; i < contexts.length; i++) {
if (!policies[i].canRetry(contexts[i])) {
retryable = false;
}
}
}
return retryable;
} } | public class class_name {
@Override
public boolean canRetry(RetryContext context) {
RetryContext[] contexts = ((CompositeRetryContext) context).contexts;
RetryPolicy[] policies = ((CompositeRetryContext) context).policies;
boolean retryable = true;
if (this.optimistic) {
retryable = false; // depends on control dependency: [if], data = [none]
for (int i = 0; i < contexts.length; i++) {
if (policies[i].canRetry(contexts[i])) {
retryable = true; // depends on control dependency: [if], data = [none]
}
}
}
else {
for (int i = 0; i < contexts.length; i++) {
if (!policies[i].canRetry(contexts[i])) {
retryable = false; // depends on control dependency: [if], data = [none]
}
}
}
return retryable;
} } |
public class class_name {
public Object getProperty(String propName)
{
/* Related to [WSTX-243]; would be nice to not to have to throw an
* exception; but Stax spec suggests that we do need to indicate
* unrecognized property by exception.
*/
int id = findPropertyId(propName);
if (id >= 0) {
return getProperty(id);
}
id = findStdPropertyId(propName);
if (id < 0) {
reportUnknownProperty(propName);
return null;
}
return getStdProperty(id);
} } | public class class_name {
public Object getProperty(String propName)
{
/* Related to [WSTX-243]; would be nice to not to have to throw an
* exception; but Stax spec suggests that we do need to indicate
* unrecognized property by exception.
*/
int id = findPropertyId(propName);
if (id >= 0) {
return getProperty(id); // depends on control dependency: [if], data = [(id]
}
id = findStdPropertyId(propName);
if (id < 0) {
reportUnknownProperty(propName); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return getStdProperty(id);
} } |
public class class_name {
public String getSelectedFeature() {
if (getNrSelectedFeatures() == 1) {
for (VectorLayer layer : getVectorLayers()) {
if (layer.getSelectedFeatures().size() > 0) {
return layer.getSelectedFeatures().iterator().next();
}
}
}
return null;
} } | public class class_name {
public String getSelectedFeature() {
if (getNrSelectedFeatures() == 1) {
for (VectorLayer layer : getVectorLayers()) {
if (layer.getSelectedFeatures().size() > 0) {
return layer.getSelectedFeatures().iterator().next(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
private void parseFlexKey(String key) {
List<String> tokens = CmsStringUtil.splitAsList(key, ';', false);
Iterator<String> i = tokens.iterator();
try {
while (i.hasNext()) {
String t = i.next();
String k = null;
String v = null;
int idx = t.indexOf('=');
if (idx >= 0) {
k = t.substring(0, idx).trim();
if (t.length() > idx) {
v = t.substring(idx + 1).trim();
}
} else {
k = t.trim();
}
m_always = 0;
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEKEY_PARSE_FLEXKEY_3, t, k, v));
}
switch (CACHE_COMMANDS.indexOf(k)) {
case 0: // always
case 12: // true
m_always = 1;
// continue processing (make sure we find a "never" behind "always")
break;
case 1: // never
case 10: // false
m_always = -1;
// no need for any further processing
return;
case 2: // uri
m_uri = IS_USED; // marks m_uri as being used
break;
case 3: // user
m_user = IS_USED; // marks m_user as being used
break;
case 4: // params
if (v != null) {
m_params = parseValueList(v);
} else {
m_params = Collections.emptySet();
}
if (m_params.contains(I_CmsResourceLoader.PARAMETER_ELEMENT)) {
// workaround for element setting by parameter in OpenCms < 6.0
m_element = IS_USED;
m_params.remove(I_CmsResourceLoader.PARAMETER_ELEMENT);
if (m_params.size() == 0) {
m_params = null;
}
}
break;
case 5: // no-params
if (v != null) {
// no-params are present
m_noparams = parseValueList(v);
} else {
// never cache with parameters
m_noparams = Collections.emptySet();
}
break;
case 6: // timeout
m_timeout = Integer.parseInt(v);
break;
case 7: // session
m_session = parseValueList(v);
if (m_session.size() <= 0) {
// session must have at last one variable set
m_parseError = true;
}
break;
case 8: // schemes
m_schemes = parseValueList(v);
break;
case 9: // ports
Set<String> ports = parseValueList(v);
m_ports = new HashSet<Integer>(ports.size());
for (String p : ports) {
try {
m_ports.add(Integer.valueOf(p));
} catch (NumberFormatException e) {
// ignore this number
}
}
break;
case 11: // previous parse error - ignore
break;
case 13: // ip
m_ip = IS_USED; // marks ip as being used
break;
case 14: // element
m_element = IS_USED;
break;
case 15: // locale
m_locale = IS_USED;
break;
case 16: // encoding
m_encoding = IS_USED;
break;
case 17: // site
m_site = IS_USED;
break;
case 18: // attrs
if (v != null) {
m_attrs = parseValueList(v);
} else {
m_attrs = null;
}
break;
case 19: // no-attrs
if (v != null) {
// no-attrs are present
m_noattrs = parseValueList(v);
} else {
// never cache with attributes
m_noattrs = Collections.emptySet();
}
break;
case 20: // device
m_device = IS_USED; // marks m_device as being used
break;
case 21: // container element
m_containerElement = IS_USED;
break;
default: // unknown directive, throw error
m_parseError = true;
}
}
} catch (Exception e) {
// any Exception here indicates a parsing error
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEKEY_PARSE_ERROR_1, e.toString()), e);
}
m_parseError = true;
}
if (m_parseError) {
// If string is invalid set cache to "never"
m_always = -1;
}
} } | public class class_name {
private void parseFlexKey(String key) {
List<String> tokens = CmsStringUtil.splitAsList(key, ';', false);
Iterator<String> i = tokens.iterator();
try {
while (i.hasNext()) {
String t = i.next();
String k = null;
String v = null;
int idx = t.indexOf('=');
if (idx >= 0) {
k = t.substring(0, idx).trim(); // depends on control dependency: [if], data = [none]
if (t.length() > idx) {
v = t.substring(idx + 1).trim(); // depends on control dependency: [if], data = [none]
}
} else {
k = t.trim(); // depends on control dependency: [if], data = [none]
}
m_always = 0; // depends on control dependency: [while], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEKEY_PARSE_FLEXKEY_3, t, k, v)); // depends on control dependency: [if], data = [none]
}
switch (CACHE_COMMANDS.indexOf(k)) {
case 0: // always
case 12: // true
m_always = 1;
// continue processing (make sure we find a "never" behind "always")
break;
case 1: // never
case 10: // false
m_always = -1;
// no need for any further processing
return; // depends on control dependency: [while], data = [none]
case 2: // uri
m_uri = IS_USED; // marks m_uri as being used
break;
case 3: // user
m_user = IS_USED; // marks m_user as being used
break;
case 4: // params
if (v != null) {
m_params = parseValueList(v); // depends on control dependency: [if], data = [(v]
} else {
m_params = Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
if (m_params.contains(I_CmsResourceLoader.PARAMETER_ELEMENT)) {
// workaround for element setting by parameter in OpenCms < 6.0
m_element = IS_USED; // depends on control dependency: [if], data = [none]
m_params.remove(I_CmsResourceLoader.PARAMETER_ELEMENT); // depends on control dependency: [if], data = [none]
if (m_params.size() == 0) {
m_params = null; // depends on control dependency: [if], data = [none]
}
}
break;
case 5: // no-params
if (v != null) {
// no-params are present
m_noparams = parseValueList(v); // depends on control dependency: [if], data = [(v]
} else {
// never cache with parameters
m_noparams = Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
break;
case 6: // timeout
m_timeout = Integer.parseInt(v);
break;
case 7: // session
m_session = parseValueList(v);
if (m_session.size() <= 0) {
// session must have at last one variable set
m_parseError = true; // depends on control dependency: [if], data = [none]
}
break;
case 8: // schemes
m_schemes = parseValueList(v);
break;
case 9: // ports
Set<String> ports = parseValueList(v);
m_ports = new HashSet<Integer>(ports.size()); // depends on control dependency: [while], data = [none]
for (String p : ports) {
try {
m_ports.add(Integer.valueOf(p)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// ignore this number
} // depends on control dependency: [catch], data = [none]
}
break;
case 11: // previous parse error - ignore
break;
case 13: // ip
m_ip = IS_USED; // marks ip as being used
break;
case 14: // element
m_element = IS_USED;
break;
case 15: // locale
m_locale = IS_USED;
break;
case 16: // encoding
m_encoding = IS_USED;
break;
case 17: // site
m_site = IS_USED;
break;
case 18: // attrs
if (v != null) {
m_attrs = parseValueList(v); // depends on control dependency: [if], data = [(v]
} else {
m_attrs = null; // depends on control dependency: [if], data = [none]
}
break;
case 19: // no-attrs
if (v != null) {
// no-attrs are present
m_noattrs = parseValueList(v); // depends on control dependency: [if], data = [(v]
} else {
// never cache with attributes
m_noattrs = Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
break;
case 20: // device
m_device = IS_USED; // marks m_device as being used
break;
case 21: // container element
m_containerElement = IS_USED;
break;
default: // unknown directive, throw error
m_parseError = true;
}
}
} catch (Exception e) {
// any Exception here indicates a parsing error
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_FLEXCACHEKEY_PARSE_ERROR_1, e.toString()), e); // depends on control dependency: [if], data = [none]
}
m_parseError = true;
} // depends on control dependency: [catch], data = [none]
if (m_parseError) {
// If string is invalid set cache to "never"
m_always = -1; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) {
boolean complete = false;
if ( V8JavaScriptEngine) {
GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File();
String paramString = "var params =[";
for (int i = 0; i < parameters.length; i++ ) {
paramString += (parameters[i] + ", ");
}
paramString = paramString.substring(0, (paramString.length()-2)) + "];";
final GVRJavascriptV8File gvrJavascriptV8FileFinal = gvrJavascriptV8File;
final InteractiveObject interactiveObjectFinal = interactiveObject;
final String functionNameFinal = functionName;
final Object[] parametersFinal = parameters;
final String paramStringFinal = paramString;
gvrContext.runOnGlThread(new Runnable() {
@Override
public void run() {
RunScriptThread (gvrJavascriptV8FileFinal, interactiveObjectFinal, functionNameFinal, parametersFinal, paramStringFinal);
}
});
} // end V8JavaScriptEngine
else {
// Mozilla Rhino engine
GVRJavascriptScriptFile gvrJavascriptFile = interactiveObject.getScriptObject().getGVRJavascriptScriptFile();
complete = gvrJavascriptFile.invokeFunction(functionName, parameters);
if (complete) {
// The JavaScript (JS) ran. Now get the return
// values (saved as X3D data types such as SFColor)
// stored in 'localBindings'.
// Then call SetResultsFromScript() to set the GearVR values
Bindings localBindings = gvrJavascriptFile.getLocalBindings();
SetResultsFromScript(interactiveObject, localBindings);
} else {
Log.e(TAG, "Error in SCRIPT node '" + interactiveObject.getScriptObject().getName() +
"' running Rhino Engine JavaScript function '" + functionName + "'");
}
}
} } | public class class_name {
private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) {
boolean complete = false;
if ( V8JavaScriptEngine) {
GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File();
String paramString = "var params =[";
for (int i = 0; i < parameters.length; i++ ) {
paramString += (parameters[i] + ", "); // depends on control dependency: [for], data = [i]
}
paramString = paramString.substring(0, (paramString.length()-2)) + "];"; // depends on control dependency: [if], data = [none]
final GVRJavascriptV8File gvrJavascriptV8FileFinal = gvrJavascriptV8File;
final InteractiveObject interactiveObjectFinal = interactiveObject;
final String functionNameFinal = functionName;
final Object[] parametersFinal = parameters;
final String paramStringFinal = paramString;
gvrContext.runOnGlThread(new Runnable() {
@Override
public void run() {
RunScriptThread (gvrJavascriptV8FileFinal, interactiveObjectFinal, functionNameFinal, parametersFinal, paramStringFinal);
}
}); // depends on control dependency: [if], data = [none]
} // end V8JavaScriptEngine
else {
// Mozilla Rhino engine
GVRJavascriptScriptFile gvrJavascriptFile = interactiveObject.getScriptObject().getGVRJavascriptScriptFile();
complete = gvrJavascriptFile.invokeFunction(functionName, parameters); // depends on control dependency: [if], data = [none]
if (complete) {
// The JavaScript (JS) ran. Now get the return
// values (saved as X3D data types such as SFColor)
// stored in 'localBindings'.
// Then call SetResultsFromScript() to set the GearVR values
Bindings localBindings = gvrJavascriptFile.getLocalBindings();
SetResultsFromScript(interactiveObject, localBindings); // depends on control dependency: [if], data = [none]
} else {
Log.e(TAG, "Error in SCRIPT node '" + interactiveObject.getScriptObject().getName() +
"' running Rhino Engine JavaScript function '" + functionName + "'"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected Collection<JcrRepository> repositories() {
if (this.state == State.RUNNING) {
final Lock lock = this.lock.readLock();
try {
lock.lock();
return new ArrayList<JcrRepository>(repositories.values());
} finally {
lock.unlock();
}
}
return Collections.emptyList();
} } | public class class_name {
protected Collection<JcrRepository> repositories() {
if (this.state == State.RUNNING) {
final Lock lock = this.lock.readLock();
try {
lock.lock(); // depends on control dependency: [try], data = [none]
return new ArrayList<JcrRepository>(repositories.values()); // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
}
return Collections.emptyList();
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
private void writeComponent(ICalComponent component, ICalComponent parent) throws IOException {
boolean inICalendar = component instanceof ICalendar;
boolean inVCalRoot = inICalendar && getTargetVersion() == ICalVersion.V1_0;
boolean inICalRoot = inICalendar && getTargetVersion() != ICalVersion.V1_0;
ICalComponentScribe componentScribe = index.getComponentScribe(component);
try {
componentScribe.checkForDataModelConversions(component, parent, getTargetVersion());
} catch (DataModelConversionException e) {
for (ICalComponent c : e.getComponents()) {
writeComponent(c, parent);
}
for (ICalProperty p : e.getProperties()) {
writeProperty(p);
}
return;
}
writer.writeBeginComponent(componentScribe.getComponentName());
List propertyObjs = componentScribe.getProperties(component);
if (inICalendar && component.getProperty(Version.class) == null) {
propertyObjs.add(0, new Version(getTargetVersion()));
}
for (Object propertyObj : propertyObjs) {
context.setParent(component); //set parent here incase a scribe resets the parent
ICalProperty property = (ICalProperty) propertyObj;
writeProperty(property);
}
List subComponents = componentScribe.getComponents(component);
if (inICalRoot) {
//add the VTIMEZONE components
Collection<VTimezone> timezones = getTimezoneComponents();
for (VTimezone timezone : timezones) {
if (!subComponents.contains(timezone)) {
subComponents.add(0, timezone);
}
}
}
for (Object subComponentObj : subComponents) {
ICalComponent subComponent = (ICalComponent) subComponentObj;
writeComponent(subComponent, component);
}
if (inVCalRoot) {
Collection<VTimezone> timezones = getTimezoneComponents();
if (!timezones.isEmpty()) {
VTimezone timezone = timezones.iterator().next();
VCalTimezoneProperties props = convert(timezone, context.getDates());
Timezone tz = props.getTz();
if (tz != null) {
writeProperty(tz);
}
for (Daylight daylight : props.getDaylights()) {
writeProperty(daylight);
}
}
}
writer.writeEndComponent(componentScribe.getComponentName());
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
private void writeComponent(ICalComponent component, ICalComponent parent) throws IOException {
boolean inICalendar = component instanceof ICalendar;
boolean inVCalRoot = inICalendar && getTargetVersion() == ICalVersion.V1_0;
boolean inICalRoot = inICalendar && getTargetVersion() != ICalVersion.V1_0;
ICalComponentScribe componentScribe = index.getComponentScribe(component);
try {
componentScribe.checkForDataModelConversions(component, parent, getTargetVersion());
} catch (DataModelConversionException e) {
for (ICalComponent c : e.getComponents()) {
writeComponent(c, parent); // depends on control dependency: [for], data = [c]
}
for (ICalProperty p : e.getProperties()) {
writeProperty(p); // depends on control dependency: [for], data = [p]
}
return;
}
writer.writeBeginComponent(componentScribe.getComponentName());
List propertyObjs = componentScribe.getProperties(component);
if (inICalendar && component.getProperty(Version.class) == null) {
propertyObjs.add(0, new Version(getTargetVersion()));
}
for (Object propertyObj : propertyObjs) {
context.setParent(component); //set parent here incase a scribe resets the parent
ICalProperty property = (ICalProperty) propertyObj;
writeProperty(property);
}
List subComponents = componentScribe.getComponents(component);
if (inICalRoot) {
//add the VTIMEZONE components
Collection<VTimezone> timezones = getTimezoneComponents();
for (VTimezone timezone : timezones) {
if (!subComponents.contains(timezone)) {
subComponents.add(0, timezone); // depends on control dependency: [if], data = [none]
}
}
}
for (Object subComponentObj : subComponents) {
ICalComponent subComponent = (ICalComponent) subComponentObj;
writeComponent(subComponent, component);
}
if (inVCalRoot) {
Collection<VTimezone> timezones = getTimezoneComponents();
if (!timezones.isEmpty()) {
VTimezone timezone = timezones.iterator().next();
VCalTimezoneProperties props = convert(timezone, context.getDates());
Timezone tz = props.getTz();
if (tz != null) {
writeProperty(tz); // depends on control dependency: [if], data = [(tz]
}
for (Daylight daylight : props.getDaylights()) {
writeProperty(daylight); // depends on control dependency: [for], data = [daylight]
}
}
}
writer.writeEndComponent(componentScribe.getComponentName());
} } |
public class class_name {
@Override
public EClass getIfcFillAreaStyle() {
if (ifcFillAreaStyleEClass == null) {
ifcFillAreaStyleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(268);
}
return ifcFillAreaStyleEClass;
} } | public class class_name {
@Override
public EClass getIfcFillAreaStyle() {
if (ifcFillAreaStyleEClass == null) {
ifcFillAreaStyleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(268);
// depends on control dependency: [if], data = [none]
}
return ifcFillAreaStyleEClass;
} } |
public class class_name {
public static ITag getNotNull(final byte[] tagBytes) {
ITag tag = find(tagBytes);
if (tag == null) {
tag = createUnknownTag(tagBytes);
}
return tag;
} } | public class class_name {
public static ITag getNotNull(final byte[] tagBytes) {
ITag tag = find(tagBytes);
if (tag == null) {
tag = createUnknownTag(tagBytes); // depends on control dependency: [if], data = [(tag]
}
return tag;
} } |
public class class_name {
public void setDecimalSeparatorString(String decimalSeparatorString) {
if (decimalSeparatorString == null) {
throw new NullPointerException("The input decimal separator is null");
}
this.decimalSeparatorString = decimalSeparatorString;
if (decimalSeparatorString.length() == 1) {
this.decimalSeparator = decimalSeparatorString.charAt(0);
} else {
// Use the default decimal separator character as fallback
this.decimalSeparator = DEF_DECIMAL_SEPARATOR;
}
} } | public class class_name {
public void setDecimalSeparatorString(String decimalSeparatorString) {
if (decimalSeparatorString == null) {
throw new NullPointerException("The input decimal separator is null");
}
this.decimalSeparatorString = decimalSeparatorString;
if (decimalSeparatorString.length() == 1) {
this.decimalSeparator = decimalSeparatorString.charAt(0); // depends on control dependency: [if], data = [none]
} else {
// Use the default decimal separator character as fallback
this.decimalSeparator = DEF_DECIMAL_SEPARATOR; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void updateEqualSets(Set<AbstractExpression> values,
HashMap<AbstractExpression, Set<AbstractExpression>> valueEquivalence,
Set< Set<AbstractExpression> > eqSets,
AbstractExpression tveKey, AbstractExpression spExpr) {
boolean hasLegacyValues = false;
if (eqSets.contains(values)) {
eqSets.remove(values);
hasLegacyValues = true;
}
values.add(spExpr);
values.add(tveKey);
if (hasLegacyValues) {
eqSets.add(values);
}
valueEquivalence.put(spExpr, values);
valueEquivalence.put(tveKey, values);
} } | public class class_name {
private void updateEqualSets(Set<AbstractExpression> values,
HashMap<AbstractExpression, Set<AbstractExpression>> valueEquivalence,
Set< Set<AbstractExpression> > eqSets,
AbstractExpression tveKey, AbstractExpression spExpr) {
boolean hasLegacyValues = false;
if (eqSets.contains(values)) {
eqSets.remove(values); // depends on control dependency: [if], data = [none]
hasLegacyValues = true; // depends on control dependency: [if], data = [none]
}
values.add(spExpr);
values.add(tveKey);
if (hasLegacyValues) {
eqSets.add(values); // depends on control dependency: [if], data = [none]
}
valueEquivalence.put(spExpr, values);
valueEquivalence.put(tveKey, values);
} } |
public class class_name {
public void setDateCreated(String dateCreated) {
try {
if (dateCreated != null) {
m_dateCreated = convertTimestamp(dateCreated);
} else {
m_dateCreated = System.currentTimeMillis();
}
} catch (Throwable e) {
setThrowable(e);
}
} } | public class class_name {
public void setDateCreated(String dateCreated) {
try {
if (dateCreated != null) {
m_dateCreated = convertTimestamp(dateCreated); // depends on control dependency: [if], data = [(dateCreated]
} else {
m_dateCreated = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
setThrowable(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private CmsResource getResourceToEdit(CmsObject cms) {
CmsResource resource = null;
if (m_uuid != null) {
try {
CmsUUID uuid = new CmsUUID(m_uuid);
resource = cms.readResource(uuid, CmsResourceFilter.ignoreExpirationOffline(cms));
} catch (NumberFormatException | CmsException e) {
LOG.warn("UUID was not valid or there is no resource with the given UUID.", e);
}
}
return resource;
} } | public class class_name {
private CmsResource getResourceToEdit(CmsObject cms) {
CmsResource resource = null;
if (m_uuid != null) {
try {
CmsUUID uuid = new CmsUUID(m_uuid);
resource = cms.readResource(uuid, CmsResourceFilter.ignoreExpirationOffline(cms)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException | CmsException e) {
LOG.warn("UUID was not valid or there is no resource with the given UUID.", e);
} // depends on control dependency: [catch], data = [none]
}
return resource;
} } |
public class class_name {
public static HolidayCalendar<Calendar> toHolidayCalendarSet(final HolidayCalendar<Date> dates) {
final Set<Calendar> calendars = new HashSet<>();
for (final Date date : dates.getHolidays()) {
calendars.add(getCal(date));
}
return new DefaultHolidayCalendar<>(calendars, getCal(dates.getEarlyBoundary()), getCal(dates.getLateBoundary()));
} } | public class class_name {
public static HolidayCalendar<Calendar> toHolidayCalendarSet(final HolidayCalendar<Date> dates) {
final Set<Calendar> calendars = new HashSet<>();
for (final Date date : dates.getHolidays()) {
calendars.add(getCal(date));
// depends on control dependency: [for], data = [date]
}
return new DefaultHolidayCalendar<>(calendars, getCal(dates.getEarlyBoundary()), getCal(dates.getLateBoundary()));
} } |
public class class_name {
public Table withPartitionKeys(Column... partitionKeys) {
if (this.partitionKeys == null) {
setPartitionKeys(new java.util.ArrayList<Column>(partitionKeys.length));
}
for (Column ele : partitionKeys) {
this.partitionKeys.add(ele);
}
return this;
} } | public class class_name {
public Table withPartitionKeys(Column... partitionKeys) {
if (this.partitionKeys == null) {
setPartitionKeys(new java.util.ArrayList<Column>(partitionKeys.length)); // depends on control dependency: [if], data = [none]
}
for (Column ele : partitionKeys) {
this.partitionKeys.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public TimeColumn set(Selection rowSelection, LocalTime newValue) {
for (int row : rowSelection) {
set(row, newValue);
}
return this;
} } | public class class_name {
public TimeColumn set(Selection rowSelection, LocalTime newValue) {
for (int row : rowSelection) {
set(row, newValue); // depends on control dependency: [for], data = [row]
}
return this;
} } |
public class class_name {
public Set<Type> getTypes(String path)
{
LinkedList<Type> types = new LinkedList<>();
for (Reference reference : references)
{
if (Preconditions.checkNotNull(path).equals(reference.refResource))
{
types.add(reference.type);
}
}
return Sets.immutableEnumSet(types);
} } | public class class_name {
public Set<Type> getTypes(String path)
{
LinkedList<Type> types = new LinkedList<>();
for (Reference reference : references)
{
if (Preconditions.checkNotNull(path).equals(reference.refResource))
{
types.add(reference.type); // depends on control dependency: [if], data = [none]
}
}
return Sets.immutableEnumSet(types);
} } |
public class class_name {
public static int getAvailablePort() {
for (int i = 0; i < 50; i++) {
try (ServerSocket serverSocket = new ServerSocket(0)) {
int port = serverSocket.getLocalPort();
if (port != 0) {
return port;
}
}
catch (IOException ignored) {}
}
throw new RuntimeException("Could not find a free permitted port on the machine.");
} } | public class class_name {
public static int getAvailablePort() {
for (int i = 0; i < 50; i++) {
try (ServerSocket serverSocket = new ServerSocket(0)) {
int port = serverSocket.getLocalPort();
if (port != 0) {
return port; // depends on control dependency: [if], data = [none]
}
}
catch (IOException ignored) {}
}
throw new RuntimeException("Could not find a free permitted port on the machine.");
} } |
public class class_name {
public static String generateFlyweightPropertyJavadoc(
final String indent, final Token propertyToken, final String typeName)
{
final String description = propertyToken.description();
if (null == description || description.isEmpty())
{
return "";
}
return
indent + "/**\n" +
indent + " * " + description + '\n' +
indent + " *\n" +
indent + " * @return " + typeName + " : " + description + "\n" +
indent + " */\n";
} } | public class class_name {
public static String generateFlyweightPropertyJavadoc(
final String indent, final Token propertyToken, final String typeName)
{
final String description = propertyToken.description();
if (null == description || description.isEmpty())
{
return ""; // depends on control dependency: [if], data = [none]
}
return
indent + "/**\n" +
indent + " * " + description + '\n' +
indent + " *\n" +
indent + " * @return " + typeName + " : " + description + "\n" +
indent + " */\n";
} } |
public class class_name {
public void setWeekOfMonth(String weekOfMonthStr) {
final WeekOfMonth weekOfMonth = WeekOfMonth.valueOf(weekOfMonthStr);
if ((null == m_model.getWeekOfMonth()) || !m_model.getWeekOfMonth().equals(weekOfMonth)) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekOfMonth(weekOfMonth);
onValueChange();
}
});
}
} } | public class class_name {
public void setWeekOfMonth(String weekOfMonthStr) {
final WeekOfMonth weekOfMonth = WeekOfMonth.valueOf(weekOfMonthStr);
if ((null == m_model.getWeekOfMonth()) || !m_model.getWeekOfMonth().equals(weekOfMonth)) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setWeekOfMonth(weekOfMonth);
onValueChange();
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Object[] convertArguments(Object obj, String methodName, Object[] args)
{
for (Method method : obj.getClass().getMethods()) {
if (method.getName().equalsIgnoreCase(methodName)
&& (method.getGenericParameterTypes().length == args.length || method.isVarArgs())) {
try {
return convertArguments(args, method.getGenericParameterTypes(), method.isVarArgs());
} catch (Exception e) {
// Ignore and try the next method.
}
}
}
return null;
} } | public class class_name {
private Object[] convertArguments(Object obj, String methodName, Object[] args)
{
for (Method method : obj.getClass().getMethods()) {
if (method.getName().equalsIgnoreCase(methodName)
&& (method.getGenericParameterTypes().length == args.length || method.isVarArgs())) {
try {
return convertArguments(args, method.getGenericParameterTypes(), method.isVarArgs()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Ignore and try the next method.
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} } |
public class class_name {
public Object fromString(String str)
{
if (StringUtils.isNotBlank(str)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.readValue(str, Object.class);
} catch (Exception e) {
LOGGER.info("Failed to parse JSON [{}]: ", StringUtils.abbreviate(str, 32),
ExceptionUtils.getRootCauseMessage(e));
return null;
}
}
return null;
} } | public class class_name {
public Object fromString(String str)
{
if (StringUtils.isNotBlank(str)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.readValue(str, Object.class); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.info("Failed to parse JSON [{}]: ", StringUtils.abbreviate(str, 32),
ExceptionUtils.getRootCauseMessage(e));
return null;
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public synchronized void insertConfigMethod(String suite, String test, String packages, String classname,
ITestResult result) {
logger.entering(new Object[] { suite, test, packages, classname, result });
String type = null;
if (result.getMethod().isBeforeSuiteConfiguration()) {
type = BEFORE_SUITE;
} else if (result.getMethod().isBeforeTestConfiguration()) {
type = BEFORE_TEST;
} else if (result.getMethod().isBeforeGroupsConfiguration()) {
type = BEFORE_GROUP;
} else if (result.getMethod().isBeforeClassConfiguration()) {
type = BEFORE_CLASS;
} else if (result.getMethod().isBeforeMethodConfiguration()) {
type = BEFORE_METHOD;
} else if (result.getMethod().isAfterSuiteConfiguration()) {
type = AFTER_SUITE;
} else if (result.getMethod().isAfterTestConfiguration()) {
type = AFTER_TEST;
} else if (result.getMethod().isAfterGroupsConfiguration()) {
type = AFTER_GROUP;
} else if (result.getMethod().isAfterClassConfiguration()) {
type = AFTER_CLASS;
} else if (result.getMethod().isAfterMethodConfiguration()) {
type = AFTER_METHOD;
}
ConfigMethodInfo config1 = new ConfigMethodInfo(suite, test, packages, classname, type, result);
if (result.getStatus() == ITestResult.STARTED) {
runningConfig.add(config1);
return;
}
for (ConfigMethodInfo temp : runningConfig) {
if (temp.getResult().getMethod().equals(result.getMethod())) {
runningConfig.remove(temp);
break;
}
}
appendFile(jsonCompletedConfig, config1.toJson().concat(",\n"));
logger.exiting();
} } | public class class_name {
public synchronized void insertConfigMethod(String suite, String test, String packages, String classname,
ITestResult result) {
logger.entering(new Object[] { suite, test, packages, classname, result });
String type = null;
if (result.getMethod().isBeforeSuiteConfiguration()) {
type = BEFORE_SUITE; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isBeforeTestConfiguration()) {
type = BEFORE_TEST; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isBeforeGroupsConfiguration()) {
type = BEFORE_GROUP; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isBeforeClassConfiguration()) {
type = BEFORE_CLASS; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isBeforeMethodConfiguration()) {
type = BEFORE_METHOD; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isAfterSuiteConfiguration()) {
type = AFTER_SUITE; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isAfterTestConfiguration()) {
type = AFTER_TEST; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isAfterGroupsConfiguration()) {
type = AFTER_GROUP; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isAfterClassConfiguration()) {
type = AFTER_CLASS; // depends on control dependency: [if], data = [none]
} else if (result.getMethod().isAfterMethodConfiguration()) {
type = AFTER_METHOD; // depends on control dependency: [if], data = [none]
}
ConfigMethodInfo config1 = new ConfigMethodInfo(suite, test, packages, classname, type, result);
if (result.getStatus() == ITestResult.STARTED) {
runningConfig.add(config1); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (ConfigMethodInfo temp : runningConfig) {
if (temp.getResult().getMethod().equals(result.getMethod())) {
runningConfig.remove(temp); // depends on control dependency: [if], data = [none]
break;
}
}
appendFile(jsonCompletedConfig, config1.toJson().concat(",\n"));
logger.exiting();
} } |
public class class_name {
static void export(SSTableReader reader, PrintStream outs, String[] excludes, CFMetaData metadata) throws IOException
{
Set<String> excludeSet = new HashSet<String>();
if (excludes != null)
excludeSet = new HashSet<String>(Arrays.asList(excludes));
SSTableIdentityIterator row;
ISSTableScanner scanner = reader.getScanner();
try
{
outs.println("[");
int i = 0;
// collecting keys to export
while (scanner.hasNext())
{
row = (SSTableIdentityIterator) scanner.next();
String currentKey = row.getColumnFamily().metadata().getKeyValidator().getString(row.getKey().getKey());
if (excludeSet.contains(currentKey))
continue;
else if (i != 0)
outs.println(",");
serializeRow(row, row.getKey(), outs);
checkStream(outs);
i++;
}
outs.println("\n]");
outs.flush();
}
finally
{
scanner.close();
}
} } | public class class_name {
static void export(SSTableReader reader, PrintStream outs, String[] excludes, CFMetaData metadata) throws IOException
{
Set<String> excludeSet = new HashSet<String>();
if (excludes != null)
excludeSet = new HashSet<String>(Arrays.asList(excludes));
SSTableIdentityIterator row;
ISSTableScanner scanner = reader.getScanner();
try
{
outs.println("[");
int i = 0;
// collecting keys to export
while (scanner.hasNext())
{
row = (SSTableIdentityIterator) scanner.next(); // depends on control dependency: [while], data = [none]
String currentKey = row.getColumnFamily().metadata().getKeyValidator().getString(row.getKey().getKey());
if (excludeSet.contains(currentKey))
continue;
else if (i != 0)
outs.println(",");
serializeRow(row, row.getKey(), outs); // depends on control dependency: [while], data = [none]
checkStream(outs); // depends on control dependency: [while], data = [none]
i++; // depends on control dependency: [while], data = [none]
}
outs.println("\n]");
outs.flush();
}
finally
{
scanner.close();
}
} } |
public class class_name {
public static final Path smoothPath(final ObservableList<PathElement> ELEMENTS, final boolean FILLED) {
if (ELEMENTS.isEmpty()) { return new Path(); }
final Point[] dataPoints = new Point[ELEMENTS.size()];
for (int i = 0; i < ELEMENTS.size(); i++) {
final PathElement element = ELEMENTS.get(i);
if (element instanceof MoveTo) {
MoveTo move = (MoveTo) element;
dataPoints[i] = new Point(move.getX(), move.getY());
} else if (element instanceof LineTo) {
LineTo line = (LineTo) element;
dataPoints[i] = new Point(line.getX(), line.getY());
}
}
double zeroY = ((MoveTo) ELEMENTS.get(0)).getY();
List<PathElement> smoothedElements = new ArrayList<>();
Pair<Point[], Point[]> result = calcCurveControlPoints(dataPoints);
Point[] firstControlPoints = result.getKey();
Point[] secondControlPoints = result.getValue();
// Start path dependent on filled or not
if (FILLED) {
smoothedElements.add(new MoveTo(dataPoints[0].getX(), zeroY));
smoothedElements.add(new LineTo(dataPoints[0].getX(), dataPoints[0].getY()));
} else {
smoothedElements.add(new MoveTo(dataPoints[0].getX(), dataPoints[0].getY()));
}
// Add curves
for (int i = 2; i < dataPoints.length; i++) {
final int ci = i - 1;
smoothedElements.add(new CubicCurveTo(
firstControlPoints[ci].getX(), firstControlPoints[ci].getY(),
secondControlPoints[ci].getX(), secondControlPoints[ci].getY(),
dataPoints[i].getX(), dataPoints[i].getY()));
}
// Close the path if filled
if (FILLED) {
smoothedElements.add(new LineTo(dataPoints[dataPoints.length - 1].getX(), zeroY));
smoothedElements.add(new ClosePath());
}
return new Path(smoothedElements);
} } | public class class_name {
public static final Path smoothPath(final ObservableList<PathElement> ELEMENTS, final boolean FILLED) {
if (ELEMENTS.isEmpty()) { return new Path(); } // depends on control dependency: [if], data = [none]
final Point[] dataPoints = new Point[ELEMENTS.size()];
for (int i = 0; i < ELEMENTS.size(); i++) {
final PathElement element = ELEMENTS.get(i);
if (element instanceof MoveTo) {
MoveTo move = (MoveTo) element;
dataPoints[i] = new Point(move.getX(), move.getY()); // depends on control dependency: [if], data = [none]
} else if (element instanceof LineTo) {
LineTo line = (LineTo) element;
dataPoints[i] = new Point(line.getX(), line.getY()); // depends on control dependency: [if], data = [none]
}
}
double zeroY = ((MoveTo) ELEMENTS.get(0)).getY();
List<PathElement> smoothedElements = new ArrayList<>();
Pair<Point[], Point[]> result = calcCurveControlPoints(dataPoints);
Point[] firstControlPoints = result.getKey();
Point[] secondControlPoints = result.getValue();
// Start path dependent on filled or not
if (FILLED) {
smoothedElements.add(new MoveTo(dataPoints[0].getX(), zeroY)); // depends on control dependency: [if], data = [none]
smoothedElements.add(new LineTo(dataPoints[0].getX(), dataPoints[0].getY())); // depends on control dependency: [if], data = [none]
} else {
smoothedElements.add(new MoveTo(dataPoints[0].getX(), dataPoints[0].getY())); // depends on control dependency: [if], data = [none]
}
// Add curves
for (int i = 2; i < dataPoints.length; i++) {
final int ci = i - 1;
smoothedElements.add(new CubicCurveTo(
firstControlPoints[ci].getX(), firstControlPoints[ci].getY(),
secondControlPoints[ci].getX(), secondControlPoints[ci].getY(),
dataPoints[i].getX(), dataPoints[i].getY())); // depends on control dependency: [for], data = [none]
}
// Close the path if filled
if (FILLED) {
smoothedElements.add(new LineTo(dataPoints[dataPoints.length - 1].getX(), zeroY)); // depends on control dependency: [if], data = [none]
smoothedElements.add(new ClosePath()); // depends on control dependency: [if], data = [none]
}
return new Path(smoothedElements);
} } |
public class class_name {
public Reference setType(String value) {
if (Utilities.noString(value))
this.type = null;
else {
if (this.type == null)
this.type = new UriType();
this.type.setValue(value);
}
return this;
} } | public class class_name {
public Reference setType(String value) {
if (Utilities.noString(value))
this.type = null;
else {
if (this.type == null)
this.type = new UriType();
this.type.setValue(value); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private QueryTypeAndQuery extractQueryAnnotation(Class<?> clazz, Method method) {
Query q = method.getAnnotation(Query.class);
QueriesOverride qs = method.getAnnotation(QueriesOverride.class);
// only one @Query annotation, thus we return the value without checking the database
if (qs == null) {
return new QueryTypeAndQuery(q.type(), q.value(), q.mapper());
}
for (QueryOverride query : qs.value()) {
if (query.db().equals(activeDb)) {
return new QueryTypeAndQuery(q.type(), query.value(), query.mapper());
}
}
return new QueryTypeAndQuery(q.type(), q.value(), q.mapper());
} } | public class class_name {
private QueryTypeAndQuery extractQueryAnnotation(Class<?> clazz, Method method) {
Query q = method.getAnnotation(Query.class);
QueriesOverride qs = method.getAnnotation(QueriesOverride.class);
// only one @Query annotation, thus we return the value without checking the database
if (qs == null) {
return new QueryTypeAndQuery(q.type(), q.value(), q.mapper()); // depends on control dependency: [if], data = [none]
}
for (QueryOverride query : qs.value()) {
if (query.db().equals(activeDb)) {
return new QueryTypeAndQuery(q.type(), query.value(), query.mapper()); // depends on control dependency: [if], data = [none]
}
}
return new QueryTypeAndQuery(q.type(), q.value(), q.mapper());
} } |
public class class_name {
public static void updateNumberOfBigtableNodes(
final BigtableOptions bigtableOptions,
final int numberOfNodes,
final Duration sleepDuration
) throws IOException, InterruptedException {
final ChannelPool channelPool =
ChannelPoolCreator.createPool(bigtableOptions.getAdminHost());
try {
final BigtableInstanceClient bigtableInstanceClient = new BigtableInstanceGrpcClient(channelPool);
final String instanceName = bigtableOptions.getInstanceName().toString();
// Fetch clusters in Bigtable instance
final ListClustersRequest clustersRequest =
ListClustersRequest.newBuilder().setParent(instanceName).build();
final ListClustersResponse clustersResponse =
bigtableInstanceClient.listCluster(clustersRequest);
// For each cluster update the number of nodes
for (Cluster cluster : clustersResponse.getClustersList()) {
final Cluster updatedCluster = Cluster.newBuilder()
.setName(cluster.getName())
.setServeNodes(numberOfNodes)
.build();
LOG.info("Updating number of nodes to {} for cluster {}", numberOfNodes, cluster.getName());
bigtableInstanceClient.updateCluster(updatedCluster);
}
// Wait for the new nodes to be provisioned
if (sleepDuration.getMillis() > 0) {
LOG.info("Sleeping for {} after update", formatter.print(sleepDuration.toPeriod()));
Thread.sleep(sleepDuration.getMillis());
}
} finally {
channelPool.shutdownNow();
}
} } | public class class_name {
public static void updateNumberOfBigtableNodes(
final BigtableOptions bigtableOptions,
final int numberOfNodes,
final Duration sleepDuration
) throws IOException, InterruptedException {
final ChannelPool channelPool =
ChannelPoolCreator.createPool(bigtableOptions.getAdminHost());
try {
final BigtableInstanceClient bigtableInstanceClient = new BigtableInstanceGrpcClient(channelPool);
final String instanceName = bigtableOptions.getInstanceName().toString();
// Fetch clusters in Bigtable instance
final ListClustersRequest clustersRequest =
ListClustersRequest.newBuilder().setParent(instanceName).build();
final ListClustersResponse clustersResponse =
bigtableInstanceClient.listCluster(clustersRequest);
// For each cluster update the number of nodes
for (Cluster cluster : clustersResponse.getClustersList()) {
final Cluster updatedCluster = Cluster.newBuilder()
.setName(cluster.getName())
.setServeNodes(numberOfNodes)
.build();
LOG.info("Updating number of nodes to {} for cluster {}", numberOfNodes, cluster.getName()); // depends on control dependency: [for], data = [cluster]
bigtableInstanceClient.updateCluster(updatedCluster); // depends on control dependency: [for], data = [none]
}
// Wait for the new nodes to be provisioned
if (sleepDuration.getMillis() > 0) {
LOG.info("Sleeping for {} after update", formatter.print(sleepDuration.toPeriod())); // depends on control dependency: [if], data = [none]
Thread.sleep(sleepDuration.getMillis()); // depends on control dependency: [if], data = [(sleepDuration.getMillis()]
}
} finally {
channelPool.shutdownNow();
}
} } |
public class class_name {
@Override
public EClass getIfcStructuralItem() {
if (ifcStructuralItemEClass == null) {
ifcStructuralItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(638);
}
return ifcStructuralItemEClass;
} } | public class class_name {
@Override
public EClass getIfcStructuralItem() {
if (ifcStructuralItemEClass == null) {
ifcStructuralItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(638);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralItemEClass;
} } |
public class class_name {
private void completeTasks() {
synchronized (_userTasks) {
if (_userTasks.size() > 0) {
for (TaskSummary task : _userTasks) {
_taskService.claim(task.getId(), _userId);
_taskService.start(task.getId(), _userId);
Map<String, Object> results = new HashMap<String, Object>();
Ticket ticket = _userTickets.get(task.getProcessInstanceId());
results.put(TICKET, ticket);
_taskService.complete(task.getId(), _userId, results);
}
}
}
} } | public class class_name {
private void completeTasks() {
synchronized (_userTasks) {
if (_userTasks.size() > 0) {
for (TaskSummary task : _userTasks) {
_taskService.claim(task.getId(), _userId); // depends on control dependency: [for], data = [task]
_taskService.start(task.getId(), _userId); // depends on control dependency: [for], data = [task]
Map<String, Object> results = new HashMap<String, Object>();
Ticket ticket = _userTickets.get(task.getProcessInstanceId());
results.put(TICKET, ticket); // depends on control dependency: [for], data = [none]
_taskService.complete(task.getId(), _userId, results); // depends on control dependency: [for], data = [task]
}
}
}
} } |
public class class_name {
public void marshall(ListWorkerBlocksRequest listWorkerBlocksRequest, ProtocolMarshaller protocolMarshaller) {
if (listWorkerBlocksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listWorkerBlocksRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listWorkerBlocksRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListWorkerBlocksRequest listWorkerBlocksRequest, ProtocolMarshaller protocolMarshaller) {
if (listWorkerBlocksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listWorkerBlocksRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listWorkerBlocksRequest.getMaxResults(), MAXRESULTS_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 VectorIterator nonZeroIteratorOfColumn(int j) {
final int jj = j;
return new VectorIterator(rows) {
private int i = -1;
@Override
public int index() {
return i;
}
@Override
public double get() {
return SparseMatrix.this.get(i, jj);
}
@Override
public void set(double value) {
SparseMatrix.this.set(i, jj, value);
}
@Override
public boolean hasNext() {
while (i + 1 < rows && SparseMatrix.this.isZeroAt(i + 1, jj)) {
i++;
}
return i + 1 < rows;
}
@Override
public Double next() {
if(!hasNext()) {
throw new NoSuchElementException();
}
i++;
return get();
}
};
} } | public class class_name {
public VectorIterator nonZeroIteratorOfColumn(int j) {
final int jj = j;
return new VectorIterator(rows) {
private int i = -1;
@Override
public int index() {
return i;
}
@Override
public double get() {
return SparseMatrix.this.get(i, jj);
}
@Override
public void set(double value) {
SparseMatrix.this.set(i, jj, value);
}
@Override
public boolean hasNext() {
while (i + 1 < rows && SparseMatrix.this.isZeroAt(i + 1, jj)) {
i++; // depends on control dependency: [while], data = [none]
}
return i + 1 < rows;
}
@Override
public Double next() {
if(!hasNext()) {
throw new NoSuchElementException();
}
i++;
return get();
}
};
} } |
public class class_name {
@SuppressWarnings("rawtypes")
protected <S> ServiceRegistration registerService(Class<S> clazz, S service,
Map<String, ?> props) {
if (service instanceof IBundleAwareService) {
((IBundleAwareService) service).setBundle(bundle);
}
Dictionary<String, Object> _p = new Hashtable<String, Object>();
if (props != null) {
for (Entry<String, ?> entry : props.entrySet()) {
_p.put(entry.getKey(), entry.getValue());
}
}
ServiceRegistration sr = bundleContext.registerService(clazz, service, _p);
registeredServices.add(sr);
return sr;
} } | public class class_name {
@SuppressWarnings("rawtypes")
protected <S> ServiceRegistration registerService(Class<S> clazz, S service,
Map<String, ?> props) {
if (service instanceof IBundleAwareService) {
((IBundleAwareService) service).setBundle(bundle); // depends on control dependency: [if], data = [none]
}
Dictionary<String, Object> _p = new Hashtable<String, Object>();
if (props != null) {
for (Entry<String, ?> entry : props.entrySet()) {
_p.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
}
ServiceRegistration sr = bundleContext.registerService(clazz, service, _p);
registeredServices.add(sr);
return sr;
} } |
public class class_name {
static String findName(Header header, Object nameRetrievalTarget) {
requireNonNull(nameRetrievalTarget, "nameRetrievalTarget");
final String value = header.value();
if (DefaultValues.isSpecified(value)) {
checkArgument(!value.isEmpty(), "value is empty");
return value;
}
return toHeaderName(getName(nameRetrievalTarget));
} } | public class class_name {
static String findName(Header header, Object nameRetrievalTarget) {
requireNonNull(nameRetrievalTarget, "nameRetrievalTarget");
final String value = header.value();
if (DefaultValues.isSpecified(value)) {
checkArgument(!value.isEmpty(), "value is empty"); // depends on control dependency: [if], data = [none]
return value; // depends on control dependency: [if], data = [none]
}
return toHeaderName(getName(nameRetrievalTarget));
} } |
public class class_name {
public Storage<S> storageDelegate(StorableIndex<S> index) {
if (mAllIndexInfoMap.get(index) instanceof ManagedIndex) {
// Index is managed by this storage, which is typical.
return null;
}
// Index is managed by master storage, most likely a primary key index.
return mMasterStorage;
} } | public class class_name {
public Storage<S> storageDelegate(StorableIndex<S> index) {
if (mAllIndexInfoMap.get(index) instanceof ManagedIndex) {
// Index is managed by this storage, which is typical.
return null;
// depends on control dependency: [if], data = [none]
}
// Index is managed by master storage, most likely a primary key index.
return mMasterStorage;
} } |
public class class_name {
public static long murmur(final BitVector bv, final long prefixLength, final long[] state) {
final long precomputedUpTo = prefixLength - prefixLength % Long.SIZE;
long h = state[(int) (precomputedUpTo / Long.SIZE)], k;
if (prefixLength > precomputedUpTo) {
k = bv.getLong(precomputedUpTo, prefixLength);
k *= M;
k ^= k >>> R;
k *= M;
h ^= k;
h *= M;
}
k = prefixLength;
k *= M;
k ^= k >>> R;
k *= M;
h ^= k;
h *= M;
return h;
} } | public class class_name {
public static long murmur(final BitVector bv, final long prefixLength, final long[] state) {
final long precomputedUpTo = prefixLength - prefixLength % Long.SIZE;
long h = state[(int) (precomputedUpTo / Long.SIZE)], k;
if (prefixLength > precomputedUpTo) {
k = bv.getLong(precomputedUpTo, prefixLength); // depends on control dependency: [if], data = [none]
k *= M; // depends on control dependency: [if], data = [none]
k ^= k >>> R; // depends on control dependency: [if], data = [none]
k *= M; // depends on control dependency: [if], data = [none]
h ^= k; // depends on control dependency: [if], data = [none]
h *= M; // depends on control dependency: [if], data = [none]
}
k = prefixLength;
k *= M;
k ^= k >>> R;
k *= M;
h ^= k;
h *= M;
return h;
} } |
public class class_name {
@Override
public void del(byte[] key) {
if (key == null) {
return;
}
Jedis jedis = getJedis();
try {
jedis.del(key);
} finally {
jedis.close();
}
} } | public class class_name {
@Override
public void del(byte[] key) {
if (key == null) {
return; // depends on control dependency: [if], data = [none]
}
Jedis jedis = getJedis();
try {
jedis.del(key); // depends on control dependency: [try], data = [none]
} finally {
jedis.close();
}
} } |
public class class_name {
@Override
public void launchFramework() {
ClassLoader loader = config.getFrameworkClassloader();
if (loader == null)
loader = this.getClass().getClassLoader();
try {
// initialize RAS
LogProvider provider = getLogProviderImpl(loader, config);
// get framework/platform manager
manager = new FrameworkManager();
managerLatch.countDown();
// Update framework configuration
FrameworkConfigurator.configure(config);
doFrameworkLaunch(provider);
} catch (LaunchException le) {
throw le;
} catch (RuntimeException re) {
throw re;
} catch (Throwable e) {
throw new RuntimeException(e);
} finally {
// In case an error occurs before launching.
managerLatch.countDown();
}
} } | public class class_name {
@Override
public void launchFramework() {
ClassLoader loader = config.getFrameworkClassloader();
if (loader == null)
loader = this.getClass().getClassLoader();
try {
// initialize RAS
LogProvider provider = getLogProviderImpl(loader, config);
// get framework/platform manager
manager = new FrameworkManager(); // depends on control dependency: [try], data = [none]
managerLatch.countDown(); // depends on control dependency: [try], data = [none]
// Update framework configuration
FrameworkConfigurator.configure(config); // depends on control dependency: [try], data = [none]
doFrameworkLaunch(provider); // depends on control dependency: [try], data = [none]
} catch (LaunchException le) {
throw le;
} catch (RuntimeException re) { // depends on control dependency: [catch], data = [none]
throw re;
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} finally { // depends on control dependency: [catch], data = [none]
// In case an error occurs before launching.
managerLatch.countDown();
}
} } |
public class class_name {
private void populateLocalCache() {
CloseableIterator iterator = cache.keySet().iterator();
try {
while (iterator.hasNext()) {
get(null, iterator.next());
}
} finally {
iterator.close();
}
} } | public class class_name {
private void populateLocalCache() {
CloseableIterator iterator = cache.keySet().iterator();
try {
while (iterator.hasNext()) {
get(null, iterator.next()); // depends on control dependency: [while], data = [none]
}
} finally {
iterator.close();
}
} } |
public class class_name {
private static int add(int set[], StringBuffer str)
{
int result = str.length();
for (int i = result - 1; i >= 0; i --) {
add(set, str.charAt(i));
}
return result;
} } | public class class_name {
private static int add(int set[], StringBuffer str)
{
int result = str.length();
for (int i = result - 1; i >= 0; i --) {
add(set, str.charAt(i)); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public static Pattern catalysisPrecedes(Blacklist blacklist)
{
Pattern p = new Pattern(SequenceEntityReference.class, "first ER");
p.add(linkedER(true), "first ER", "first generic ER");
p.add(erToPE(), "first generic ER", "first simple controller PE");
p.add(linkToComplex(), "first simple controller PE", "first controller PE");
p.add(peToControl(), "first controller PE", "first Control");
p.add(controlToConv(), "first Control", "first Conversion");
p.add(new Participant(RelType.OUTPUT, blacklist, true), "first Control", "first Conversion", "linker PE");
p.add(new NOT(new ConstraintChain(new ConversionSide(ConversionSide.Type.OTHER_SIDE), linkToSpecific())), "linker PE", "first Conversion", "linker PE");
p.add(type(SmallMolecule.class), "linker PE");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "linker PE", "second Conversion");
p.add(new NOT(new ConstraintChain(new ConversionSide(ConversionSide.Type.OTHER_SIDE), linkToSpecific())), "linker PE", "second Conversion", "linker PE");
p.add(equal(false), "first Conversion", "second Conversion");
// make sure that conversions are not replicates or reverse of each other
// and also outward facing sides of reactions contain at least one non ubique
p.add(new ConstraintAdapter(3, blacklist)
{
@Override
public boolean satisfies(Match match, int... ind)
{
Conversion cnv1 = (Conversion) match.get(ind[0]);
Conversion cnv2 = (Conversion) match.get(ind[1]);
SmallMolecule linker = (SmallMolecule) match.get(ind[2]);
Set<PhysicalEntity> input1 = cnv1.getLeft().contains(linker) ? cnv1.getRight() : cnv1.getLeft();
Set<PhysicalEntity> input2 = cnv2.getLeft().contains(linker) ? cnv2.getLeft() : cnv2.getRight();
Set<PhysicalEntity> output1 = cnv1.getLeft().contains(linker) ? cnv1.getLeft() : cnv1.getRight();
Set<PhysicalEntity> output2 = cnv2.getLeft().contains(linker) ? cnv2.getRight() : cnv2.getLeft();
if (input1.equals(input2) && output1.equals(output2)) return false;
if (input1.equals(output2) && output1.equals(input2)) return false;
if (blacklist != null)
{
Set<PhysicalEntity> set = new HashSet<PhysicalEntity>(input1);
set = blacklist.getNonUbiques(set, RelType.INPUT);
set.removeAll(output2);
if (set.isEmpty())
{
set.addAll(output2);
set = blacklist.getNonUbiques(set, RelType.OUTPUT);
set.removeAll(input1);
if (set.isEmpty()) return false;
}
}
return true;
}
}, "first Conversion", "second Conversion", "linker PE");
p.add(new RelatedControl(RelType.INPUT, blacklist), "linker PE", "second Conversion", "second Control");
p.add(controllerPE(), "second Control", "second controller PE");
p.add(new NOT(compToER()), "second controller PE", "first ER");
p.add(linkToSpecific(), "second controller PE", "second simple controller PE");
p.add(type(SequenceEntity.class), "second simple controller PE");
p.add(peToER(), "second simple controller PE", "second generic ER");
p.add(linkedER(false), "second generic ER", "second ER");
p.add(equal(false), "first ER", "second ER");
return p;
} } | public class class_name {
public static Pattern catalysisPrecedes(Blacklist blacklist)
{
Pattern p = new Pattern(SequenceEntityReference.class, "first ER");
p.add(linkedER(true), "first ER", "first generic ER");
p.add(erToPE(), "first generic ER", "first simple controller PE");
p.add(linkToComplex(), "first simple controller PE", "first controller PE");
p.add(peToControl(), "first controller PE", "first Control");
p.add(controlToConv(), "first Control", "first Conversion");
p.add(new Participant(RelType.OUTPUT, blacklist, true), "first Control", "first Conversion", "linker PE");
p.add(new NOT(new ConstraintChain(new ConversionSide(ConversionSide.Type.OTHER_SIDE), linkToSpecific())), "linker PE", "first Conversion", "linker PE");
p.add(type(SmallMolecule.class), "linker PE");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "linker PE", "second Conversion");
p.add(new NOT(new ConstraintChain(new ConversionSide(ConversionSide.Type.OTHER_SIDE), linkToSpecific())), "linker PE", "second Conversion", "linker PE");
p.add(equal(false), "first Conversion", "second Conversion");
// make sure that conversions are not replicates or reverse of each other
// and also outward facing sides of reactions contain at least one non ubique
p.add(new ConstraintAdapter(3, blacklist)
{
@Override
public boolean satisfies(Match match, int... ind)
{
Conversion cnv1 = (Conversion) match.get(ind[0]);
Conversion cnv2 = (Conversion) match.get(ind[1]);
SmallMolecule linker = (SmallMolecule) match.get(ind[2]);
Set<PhysicalEntity> input1 = cnv1.getLeft().contains(linker) ? cnv1.getRight() : cnv1.getLeft();
Set<PhysicalEntity> input2 = cnv2.getLeft().contains(linker) ? cnv2.getLeft() : cnv2.getRight();
Set<PhysicalEntity> output1 = cnv1.getLeft().contains(linker) ? cnv1.getLeft() : cnv1.getRight();
Set<PhysicalEntity> output2 = cnv2.getLeft().contains(linker) ? cnv2.getRight() : cnv2.getLeft();
if (input1.equals(input2) && output1.equals(output2)) return false;
if (input1.equals(output2) && output1.equals(input2)) return false;
if (blacklist != null)
{
Set<PhysicalEntity> set = new HashSet<PhysicalEntity>(input1);
set = blacklist.getNonUbiques(set, RelType.INPUT); // depends on control dependency: [if], data = [none]
set.removeAll(output2); // depends on control dependency: [if], data = [none]
if (set.isEmpty())
{
set.addAll(output2); // depends on control dependency: [if], data = [none]
set = blacklist.getNonUbiques(set, RelType.OUTPUT); // depends on control dependency: [if], data = [none]
set.removeAll(input1); // depends on control dependency: [if], data = [none]
if (set.isEmpty()) return false;
}
}
return true;
}
}, "first Conversion", "second Conversion", "linker PE");
p.add(new RelatedControl(RelType.INPUT, blacklist), "linker PE", "second Conversion", "second Control");
p.add(controllerPE(), "second Control", "second controller PE");
p.add(new NOT(compToER()), "second controller PE", "first ER");
p.add(linkToSpecific(), "second controller PE", "second simple controller PE");
p.add(type(SequenceEntity.class), "second simple controller PE");
p.add(peToER(), "second simple controller PE", "second generic ER");
p.add(linkedER(false), "second generic ER", "second ER");
p.add(equal(false), "first ER", "second ER");
return p;
} } |
public class class_name {
public int compareTo(Object object) {
if (image != null)
return 0;
if (object == null) {
return -1;
}
PdfFont pdfFont;
try {
pdfFont = (PdfFont) object;
if (font != pdfFont.font) {
return 1;
}
if (this.size() != pdfFont.size()) {
return 2;
}
return 0;
}
catch(ClassCastException cce) {
return -2;
}
} } | public class class_name {
public int compareTo(Object object) {
if (image != null)
return 0;
if (object == null) {
return -1; // depends on control dependency: [if], data = [none]
}
PdfFont pdfFont;
try {
pdfFont = (PdfFont) object; // depends on control dependency: [try], data = [none]
if (font != pdfFont.font) {
return 1; // depends on control dependency: [if], data = [none]
}
if (this.size() != pdfFont.size()) {
return 2; // depends on control dependency: [if], data = [none]
}
return 0; // depends on control dependency: [try], data = [none]
}
catch(ClassCastException cce) {
return -2;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nullable
@Override
public E poll() {
LinkedQueueNode<E> currConsumerNode = consumerNode; // don't load twice, it's alright
LinkedQueueNode<E> nextNode = currConsumerNode.lvNext();
if (nextNode != null)
{
// we have to null out the value because we are going to hang on to the node
final E nextValue = nextNode.getAndNullValue();
// Fix up the next ref of currConsumerNode to prevent promoted nodes from keeping new ones alive.
// We use a reference to self instead of null because null is already a meaningful value (the next of
// producer node is null).
currConsumerNode.soNext(currConsumerNode);
CONSUMER_NODE_UPDATER.lazySet(this, nextNode);
// currConsumerNode is now no longer referenced and can be collected
return nextValue;
}
else if (currConsumerNode != producerNode)
{
while ((nextNode = currConsumerNode.lvNext()) == null) { }
// got the next node...
// we have to null out the value because we are going to hang on to the node
final E nextValue = nextNode.getAndNullValue();
// Fix up the next ref of currConsumerNode to prevent promoted nodes from keeping new ones alive.
// We use a reference to self instead of null because null is already a meaningful value (the next of
// producer node is null).
currConsumerNode.soNext(currConsumerNode);
CONSUMER_NODE_UPDATER.lazySet(this, nextNode);
// currConsumerNode is now no longer referenced and can be collected
return nextValue;
}
return null;
} } | public class class_name {
@Nullable
@Override
public E poll() {
LinkedQueueNode<E> currConsumerNode = consumerNode; // don't load twice, it's alright
LinkedQueueNode<E> nextNode = currConsumerNode.lvNext();
if (nextNode != null)
{
// we have to null out the value because we are going to hang on to the node
final E nextValue = nextNode.getAndNullValue();
// Fix up the next ref of currConsumerNode to prevent promoted nodes from keeping new ones alive.
// We use a reference to self instead of null because null is already a meaningful value (the next of
// producer node is null).
currConsumerNode.soNext(currConsumerNode); // depends on control dependency: [if], data = [none]
CONSUMER_NODE_UPDATER.lazySet(this, nextNode); // depends on control dependency: [if], data = [none]
// currConsumerNode is now no longer referenced and can be collected
return nextValue; // depends on control dependency: [if], data = [none]
}
else if (currConsumerNode != producerNode)
{
while ((nextNode = currConsumerNode.lvNext()) == null) { }
// got the next node...
// we have to null out the value because we are going to hang on to the node
final E nextValue = nextNode.getAndNullValue();
// Fix up the next ref of currConsumerNode to prevent promoted nodes from keeping new ones alive.
// We use a reference to self instead of null because null is already a meaningful value (the next of
// producer node is null).
currConsumerNode.soNext(currConsumerNode); // depends on control dependency: [if], data = [(currConsumerNode]
CONSUMER_NODE_UPDATER.lazySet(this, nextNode); // depends on control dependency: [if], data = [none]
// currConsumerNode is now no longer referenced and can be collected
return nextValue; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static void writeCmd(final int statementId, final ParameterHolder[] parameters,
final int parameterCount,
ColumnType[] parameterTypeHeader, final PacketOutputStream pos,
final byte cursorFlag) throws IOException {
pos.write(Packet.COM_STMT_EXECUTE);
pos.writeInt(statementId);
pos.write(cursorFlag);
pos.writeInt(1); //Iteration pos
//create null bitmap
if (parameterCount > 0) {
int nullCount = (parameterCount + 7) / 8;
byte[] nullBitsBuffer = new byte[nullCount];
for (int i = 0; i < parameterCount; i++) {
if (parameters[i].isNullData()) {
nullBitsBuffer[i / 8] |= (1 << (i % 8));
}
}
pos.write(nullBitsBuffer, 0, nullCount);
//check if parameters type (using setXXX) have change since previous request, and resend new header type if so
boolean mustSendHeaderType = false;
if (parameterTypeHeader[0] == null) {
mustSendHeaderType = true;
} else {
for (int i = 0; i < parameterCount; i++) {
if (!parameterTypeHeader[i].equals(parameters[i].getColumnType())) {
mustSendHeaderType = true;
break;
}
}
}
if (mustSendHeaderType) {
pos.write((byte) 0x01);
//Store types of parameters in first in first package that is sent to the server.
for (int i = 0; i < parameterCount; i++) {
parameterTypeHeader[i] = parameters[i].getColumnType();
pos.writeShort(parameterTypeHeader[i].getType());
}
} else {
pos.write((byte) 0x00);
}
}
for (int i = 0; i < parameterCount; i++) {
ParameterHolder holder = parameters[i];
if (!holder.isNullData() && !holder.isLongData()) {
holder.writeBinary(pos);
}
}
} } | public class class_name {
public static void writeCmd(final int statementId, final ParameterHolder[] parameters,
final int parameterCount,
ColumnType[] parameterTypeHeader, final PacketOutputStream pos,
final byte cursorFlag) throws IOException {
pos.write(Packet.COM_STMT_EXECUTE);
pos.writeInt(statementId);
pos.write(cursorFlag);
pos.writeInt(1); //Iteration pos
//create null bitmap
if (parameterCount > 0) {
int nullCount = (parameterCount + 7) / 8;
byte[] nullBitsBuffer = new byte[nullCount];
for (int i = 0; i < parameterCount; i++) {
if (parameters[i].isNullData()) {
nullBitsBuffer[i / 8] |= (1 << (i % 8)); // depends on control dependency: [if], data = [none]
}
}
pos.write(nullBitsBuffer, 0, nullCount);
//check if parameters type (using setXXX) have change since previous request, and resend new header type if so
boolean mustSendHeaderType = false;
if (parameterTypeHeader[0] == null) {
mustSendHeaderType = true; // depends on control dependency: [if], data = [none]
} else {
for (int i = 0; i < parameterCount; i++) {
if (!parameterTypeHeader[i].equals(parameters[i].getColumnType())) {
mustSendHeaderType = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (mustSendHeaderType) {
pos.write((byte) 0x01); // depends on control dependency: [if], data = [none]
//Store types of parameters in first in first package that is sent to the server.
for (int i = 0; i < parameterCount; i++) {
parameterTypeHeader[i] = parameters[i].getColumnType(); // depends on control dependency: [for], data = [i]
pos.writeShort(parameterTypeHeader[i].getType()); // depends on control dependency: [for], data = [i]
}
} else {
pos.write((byte) 0x00); // depends on control dependency: [if], data = [none]
}
}
for (int i = 0; i < parameterCount; i++) {
ParameterHolder holder = parameters[i];
if (!holder.isNullData() && !holder.isLongData()) {
holder.writeBinary(pos);
}
}
} } |
public class class_name {
private void layoutChild(
Component component, int cellX, int cellY, int cellSizeX, int cellSizeY)
{
int maxAspectW = (int)(cellSizeY * aspect);
int maxAspectH = (int)(cellSizeX / aspect);
if (maxAspectW > cellSizeX)
{
int w = cellSizeX;
int h = maxAspectH;
int space = cellSizeY - h;
int offset = (int)(alignment * space);
component.setBounds(cellX, cellY + offset, w, h);
}
else
{
int w = maxAspectW;
int h = cellSizeY;
int space = cellSizeX - w;
int offset = (int)(alignment * space);
component.setBounds(cellX + offset, cellY, w, h);
}
} } | public class class_name {
private void layoutChild(
Component component, int cellX, int cellY, int cellSizeX, int cellSizeY)
{
int maxAspectW = (int)(cellSizeY * aspect);
int maxAspectH = (int)(cellSizeX / aspect);
if (maxAspectW > cellSizeX)
{
int w = cellSizeX;
int h = maxAspectH;
int space = cellSizeY - h;
int offset = (int)(alignment * space);
component.setBounds(cellX, cellY + offset, w, h);
// depends on control dependency: [if], data = [none]
}
else
{
int w = maxAspectW;
int h = cellSizeY;
int space = cellSizeX - w;
int offset = (int)(alignment * space);
component.setBounds(cellX + offset, cellY, w, h);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setRobotDeploymentSummary(java.util.Collection<RobotDeployment> robotDeploymentSummary) {
if (robotDeploymentSummary == null) {
this.robotDeploymentSummary = null;
return;
}
this.robotDeploymentSummary = new java.util.ArrayList<RobotDeployment>(robotDeploymentSummary);
} } | public class class_name {
public void setRobotDeploymentSummary(java.util.Collection<RobotDeployment> robotDeploymentSummary) {
if (robotDeploymentSummary == null) {
this.robotDeploymentSummary = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.robotDeploymentSummary = new java.util.ArrayList<RobotDeployment>(robotDeploymentSummary);
} } |
public class class_name {
public Connection createDBConnection() {
if (mDBConnInfo != null) {
return getConnectionViaDriverMangaer(mDBConnInfo.DBDriver, mDBConnInfo.DBUrl, mDBConnInfo.DBUser, mDBConnInfo.DBPassword);
} else {
return null;
}
} } | public class class_name {
public Connection createDBConnection() {
if (mDBConnInfo != null) {
return getConnectionViaDriverMangaer(mDBConnInfo.DBDriver, mDBConnInfo.DBUrl, mDBConnInfo.DBUser, mDBConnInfo.DBPassword);
// depends on control dependency: [if], data = [(mDBConnInfo]
} else {
return null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void removeBinding(String prefix) {
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
defaultNamespaceUri = "";
} else {
String namespaceUri = prefixToNamespaceUri.remove(prefix);
List<String> prefixes = getPrefixesInternal(namespaceUri);
prefixes.remove(prefix);
}
} } | public class class_name {
public void removeBinding(String prefix) {
if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
defaultNamespaceUri = ""; // depends on control dependency: [if], data = [none]
} else {
String namespaceUri = prefixToNamespaceUri.remove(prefix);
List<String> prefixes = getPrefixesInternal(namespaceUri);
prefixes.remove(prefix); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final AntlrDatatypeRuleToken ruleMethodCallLiteral() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_FQN_0 = null;
AntlrDatatypeRuleToken this_Argument_2 = null;
AntlrDatatypeRuleToken this_Argument_4 = null;
AntlrDatatypeRuleToken this_MethodCallLiteral_7 = null;
enterRule();
try {
// InternalSimpleExpressions.g:643:28: ( (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? ) )
// InternalSimpleExpressions.g:644:1: (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? )
{
// InternalSimpleExpressions.g:644:1: (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? )
// InternalSimpleExpressions.g:645:5: this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )?
{
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getFQNParserRuleCall_0());
pushFollow(FOLLOW_11);
this_FQN_0=ruleFQN();
state._fsp--;
current.merge(this_FQN_0);
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:655:1: (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )?
int alt12=2;
int LA12_0 = input.LA(1);
if ( (LA12_0==13) ) {
alt12=1;
}
switch (alt12) {
case 1 :
// InternalSimpleExpressions.g:656:2: kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )?
{
kw=(Token)match(input,13,FOLLOW_12);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getLeftParenthesisKeyword_1_0());
// InternalSimpleExpressions.g:661:1: (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )?
int alt10=2;
int LA10_0 = input.LA(1);
if ( ((LA10_0>=RULE_INT && LA10_0<=RULE_ID)) ) {
alt10=1;
}
switch (alt10) {
case 1 :
// InternalSimpleExpressions.g:662:5: this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )*
{
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getArgumentParserRuleCall_1_1_0());
pushFollow(FOLLOW_13);
this_Argument_2=ruleArgument();
state._fsp--;
current.merge(this_Argument_2);
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:672:1: (kw= ',' this_Argument_4= ruleArgument )*
loop9:
do {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==24) ) {
alt9=1;
}
switch (alt9) {
case 1 :
// InternalSimpleExpressions.g:673:2: kw= ',' this_Argument_4= ruleArgument
{
kw=(Token)match(input,24,FOLLOW_14);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getCommaKeyword_1_1_1_0());
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getArgumentParserRuleCall_1_1_1_1());
pushFollow(FOLLOW_13);
this_Argument_4=ruleArgument();
state._fsp--;
current.merge(this_Argument_4);
afterParserOrEnumRuleCall();
}
break;
default :
break loop9;
}
} while (true);
}
break;
}
kw=(Token)match(input,14,FOLLOW_15);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getRightParenthesisKeyword_1_2());
// InternalSimpleExpressions.g:695:1: (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )?
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==25) ) {
alt11=1;
}
switch (alt11) {
case 1 :
// InternalSimpleExpressions.g:696:2: kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral
{
kw=(Token)match(input,25,FOLLOW_16);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getFullStopKeyword_1_3_0());
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getMethodCallLiteralParserRuleCall_1_3_1());
pushFollow(FOLLOW_2);
this_MethodCallLiteral_7=ruleMethodCallLiteral();
state._fsp--;
current.merge(this_MethodCallLiteral_7);
afterParserOrEnumRuleCall();
}
break;
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final AntlrDatatypeRuleToken ruleMethodCallLiteral() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_FQN_0 = null;
AntlrDatatypeRuleToken this_Argument_2 = null;
AntlrDatatypeRuleToken this_Argument_4 = null;
AntlrDatatypeRuleToken this_MethodCallLiteral_7 = null;
enterRule();
try {
// InternalSimpleExpressions.g:643:28: ( (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? ) )
// InternalSimpleExpressions.g:644:1: (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? )
{
// InternalSimpleExpressions.g:644:1: (this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )? )
// InternalSimpleExpressions.g:645:5: this_FQN_0= ruleFQN (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )?
{
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getFQNParserRuleCall_0());
pushFollow(FOLLOW_11);
this_FQN_0=ruleFQN();
state._fsp--;
current.merge(this_FQN_0);
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:655:1: (kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )? )?
int alt12=2;
int LA12_0 = input.LA(1);
if ( (LA12_0==13) ) {
alt12=1; // depends on control dependency: [if], data = [none]
}
switch (alt12) {
case 1 :
// InternalSimpleExpressions.g:656:2: kw= '(' (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )? kw= ')' (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )?
{
kw=(Token)match(input,13,FOLLOW_12);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getLeftParenthesisKeyword_1_0());
// InternalSimpleExpressions.g:661:1: (this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )* )?
int alt10=2;
int LA10_0 = input.LA(1);
if ( ((LA10_0>=RULE_INT && LA10_0<=RULE_ID)) ) {
alt10=1; // depends on control dependency: [if], data = [none]
}
switch (alt10) {
case 1 :
// InternalSimpleExpressions.g:662:5: this_Argument_2= ruleArgument (kw= ',' this_Argument_4= ruleArgument )*
{
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getArgumentParserRuleCall_1_1_0());
pushFollow(FOLLOW_13);
this_Argument_2=ruleArgument();
state._fsp--;
current.merge(this_Argument_2);
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:672:1: (kw= ',' this_Argument_4= ruleArgument )*
loop9:
do {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==24) ) {
alt9=1; // depends on control dependency: [if], data = [none]
}
switch (alt9) {
case 1 :
// InternalSimpleExpressions.g:673:2: kw= ',' this_Argument_4= ruleArgument
{
kw=(Token)match(input,24,FOLLOW_14);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getCommaKeyword_1_1_1_0());
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getArgumentParserRuleCall_1_1_1_1());
pushFollow(FOLLOW_13);
this_Argument_4=ruleArgument();
state._fsp--;
current.merge(this_Argument_4);
afterParserOrEnumRuleCall();
}
break;
default :
break loop9;
}
} while (true);
}
break;
}
kw=(Token)match(input,14,FOLLOW_15);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getRightParenthesisKeyword_1_2());
// InternalSimpleExpressions.g:695:1: (kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral )?
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==25) ) {
alt11=1; // depends on control dependency: [if], data = [none]
}
switch (alt11) {
case 1 :
// InternalSimpleExpressions.g:696:2: kw= '.' this_MethodCallLiteral_7= ruleMethodCallLiteral
{
kw=(Token)match(input,25,FOLLOW_16);
current.merge(kw);
newLeafNode(kw, grammarAccess.getMethodCallLiteralAccess().getFullStopKeyword_1_3_0());
newCompositeNode(grammarAccess.getMethodCallLiteralAccess().getMethodCallLiteralParserRuleCall_1_3_1());
pushFollow(FOLLOW_2);
this_MethodCallLiteral_7=ruleMethodCallLiteral();
state._fsp--;
current.merge(this_MethodCallLiteral_7);
afterParserOrEnumRuleCall();
}
break;
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private void maybeUpdatePicker(ConnectivityState state, RoundRobinPicker picker) {
// Discard the new picker if we are sure it won't make any difference, in order to save
// re-processing pending streams, and avoid unnecessary resetting of the pointer in
// RoundRobinPicker.
if (picker.dropList.equals(currentPicker.dropList)
&& picker.pickList.equals(currentPicker.pickList)) {
return;
}
currentPicker = picker;
logger.log(
ChannelLogLevel.INFO, "{0}: picks={1}, drops={2}", state, picker.pickList, picker.dropList);
helper.updateBalancingState(state, picker);
} } | public class class_name {
private void maybeUpdatePicker(ConnectivityState state, RoundRobinPicker picker) {
// Discard the new picker if we are sure it won't make any difference, in order to save
// re-processing pending streams, and avoid unnecessary resetting of the pointer in
// RoundRobinPicker.
if (picker.dropList.equals(currentPicker.dropList)
&& picker.pickList.equals(currentPicker.pickList)) {
return; // depends on control dependency: [if], data = [none]
}
currentPicker = picker;
logger.log(
ChannelLogLevel.INFO, "{0}: picks={1}, drops={2}", state, picker.pickList, picker.dropList);
helper.updateBalancingState(state, picker);
} } |
public class class_name {
private static byte[] decodePem(InputStream keyInputStream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(keyInputStream));
try {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("-----BEGIN ")) {
return readBytes(reader, line.trim().replace("BEGIN", "END"));
}
}
throw new IOException("PEM is invalid: no begin marker");
} finally {
reader.close();
}
} } | public class class_name {
private static byte[] decodePem(InputStream keyInputStream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(keyInputStream));
try {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("-----BEGIN ")) {
return readBytes(reader, line.trim().replace("BEGIN", "END")); // depends on control dependency: [if], data = [none]
}
}
throw new IOException("PEM is invalid: no begin marker");
} finally {
reader.close();
}
} } |
public class class_name {
public ModelAndView getRule(long id) {
Rule rule = ruleDao.getRule(id);
if (rule == null) {
return new ModelAndView(view, "object", new SimpleError("Rule "
+ id + " does not exist.", 404));
}
return new ModelAndView(view, "object", rule);
} } | public class class_name {
public ModelAndView getRule(long id) {
Rule rule = ruleDao.getRule(id);
if (rule == null) {
return new ModelAndView(view, "object", new SimpleError("Rule "
+ id + " does not exist.", 404)); // depends on control dependency: [if], data = [none]
}
return new ModelAndView(view, "object", rule);
} } |
public class class_name {
private static void addTimePerComponent(HashMap<String, Long> mapComponentTimes, Component component) {
Long currentTimeOfComponent = 0L;
String key = component.getComponentType();
if (mapComponentTimes.containsKey(key)) {
currentTimeOfComponent = mapComponentTimes.get(key);
}
//when transactions are run in parallel, we should log the longest transaction only to avoid that
//for ex 'Total time' would be 100ms and transactions in parallel to hornetQ will be 2000ms
Long maxTime = Math.max(component.getTime(), currentTimeOfComponent);
mapComponentTimes.put(key, maxTime);
} } | public class class_name {
private static void addTimePerComponent(HashMap<String, Long> mapComponentTimes, Component component) {
Long currentTimeOfComponent = 0L;
String key = component.getComponentType();
if (mapComponentTimes.containsKey(key)) {
currentTimeOfComponent = mapComponentTimes.get(key); // depends on control dependency: [if], data = [none]
}
//when transactions are run in parallel, we should log the longest transaction only to avoid that
//for ex 'Total time' would be 100ms and transactions in parallel to hornetQ will be 2000ms
Long maxTime = Math.max(component.getTime(), currentTimeOfComponent);
mapComponentTimes.put(key, maxTime);
} } |
public class class_name {
public AstRoot getAstRoot() {
AstNode parent = this; // this node could be the AstRoot
while (parent != null && !(parent instanceof AstRoot)) {
parent = parent.getParent();
}
return (AstRoot)parent;
} } | public class class_name {
public AstRoot getAstRoot() {
AstNode parent = this; // this node could be the AstRoot
while (parent != null && !(parent instanceof AstRoot)) {
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
}
return (AstRoot)parent;
} } |
public class class_name {
@Override
public void startSetup(@Nullable final IabHelper.OnIabSetupFinishedListener listener) {
Logger.i("NokiaStoreHelper.startSetup");
mServiceConn = new ServiceConnection() {
@Override
public void onServiceConnected(final ComponentName name, final IBinder service) {
Logger.i("NokiaStoreHelper:startSetup.onServiceConnected");
Logger.d("name = " + name);
mService = INokiaIAPService.Stub.asInterface(service);
try {
final int response = mService.isBillingSupported(3, getPackageName(), IabHelper.ITEM_TYPE_INAPP);
if (response != IabHelper.BILLING_RESPONSE_RESULT_OK) {
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(response,
"Error checking for billing support."));
}
return;
}
} catch (RemoteException e) {
if (listener != null) {
listener.onIabSetupFinished(
new NokiaResult(IabHelper.IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")
);
}
Logger.e(e, "Exception: ", e);
return;
}
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_OK, "Setup successful."));
}
}
@Override
public void onServiceDisconnected(final ComponentName name) {
Logger.i("NokiaStoreHelper:startSetup.onServiceDisconnected");
Logger.d("name = ", name);
mService = null;
}
};
final Intent serviceIntent = getServiceIntent();
final List<ResolveInfo> servicesList = mContext.getPackageManager().queryIntentServices(serviceIntent, 0);
if (servicesList == null || servicesList.isEmpty()) {
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device."));
}
} else {
try {
mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
} catch (SecurityException e) {
Logger.e("Can't bind to the service", e);
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device due to lack of the permission \"com.nokia.payment.BILLING\"."));
}
}
}
} } | public class class_name {
@Override
public void startSetup(@Nullable final IabHelper.OnIabSetupFinishedListener listener) {
Logger.i("NokiaStoreHelper.startSetup");
mServiceConn = new ServiceConnection() {
@Override
public void onServiceConnected(final ComponentName name, final IBinder service) {
Logger.i("NokiaStoreHelper:startSetup.onServiceConnected");
Logger.d("name = " + name);
mService = INokiaIAPService.Stub.asInterface(service);
try {
final int response = mService.isBillingSupported(3, getPackageName(), IabHelper.ITEM_TYPE_INAPP);
if (response != IabHelper.BILLING_RESPONSE_RESULT_OK) {
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(response,
"Error checking for billing support.")); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
} catch (RemoteException e) {
if (listener != null) {
listener.onIabSetupFinished(
new NokiaResult(IabHelper.IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")
); // depends on control dependency: [if], data = [none]
}
Logger.e(e, "Exception: ", e);
return;
} // depends on control dependency: [catch], data = [none]
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_OK, "Setup successful.")); // depends on control dependency: [if], data = [none]
}
}
@Override
public void onServiceDisconnected(final ComponentName name) {
Logger.i("NokiaStoreHelper:startSetup.onServiceDisconnected");
Logger.d("name = ", name);
mService = null;
}
};
final Intent serviceIntent = getServiceIntent();
final List<ResolveInfo> servicesList = mContext.getPackageManager().queryIntentServices(serviceIntent, 0);
if (servicesList == null || servicesList.isEmpty()) {
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device.")); // depends on control dependency: [if], data = [none]
}
} else {
try {
mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); // depends on control dependency: [try], data = [none]
} catch (SecurityException e) {
Logger.e("Can't bind to the service", e);
if (listener != null) {
listener.onIabSetupFinished(new NokiaResult(RESULT_BILLING_UNAVAILABLE,
"Billing service unavailable on device due to lack of the permission \"com.nokia.payment.BILLING\".")); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected String makeHeaderNamesLowercaseInLogFormat(String logformat) {
// In vim I would simply do: %s@{\([^}]*\)}@{\L\1\E@g
// But such an expression is not (yet) possible in Java
StringBuffer sb = new StringBuffer(logformat.length());
// All patterns that have a 'name' (note we do NOT do it to %{...}t )
Pattern p = Pattern.compile("%\\{([^}]*)}([^t])");
Matcher m = p.matcher(logformat);
while (m.find()) {
m.appendReplacement(sb, "%{"+m.group(1).toLowerCase()+'}'+m.group(2));
}
m.appendTail(sb);
return sb.toString();
} } | public class class_name {
protected String makeHeaderNamesLowercaseInLogFormat(String logformat) {
// In vim I would simply do: %s@{\([^}]*\)}@{\L\1\E@g
// But such an expression is not (yet) possible in Java
StringBuffer sb = new StringBuffer(logformat.length());
// All patterns that have a 'name' (note we do NOT do it to %{...}t )
Pattern p = Pattern.compile("%\\{([^}]*)}([^t])");
Matcher m = p.matcher(logformat);
while (m.find()) {
m.appendReplacement(sb, "%{"+m.group(1).toLowerCase()+'}'+m.group(2)); // depends on control dependency: [while], data = [none]
}
m.appendTail(sb);
return sb.toString();
} } |
public class class_name {
public void marshall(BatchDisableStandardsRequest batchDisableStandardsRequest, ProtocolMarshaller protocolMarshaller) {
if (batchDisableStandardsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDisableStandardsRequest.getStandardsSubscriptionArns(), STANDARDSSUBSCRIPTIONARNS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchDisableStandardsRequest batchDisableStandardsRequest, ProtocolMarshaller protocolMarshaller) {
if (batchDisableStandardsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDisableStandardsRequest.getStandardsSubscriptionArns(), STANDARDSSUBSCRIPTIONARNS_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 void checkDoFirstInstall(){
if ( ! downloadAll ) {
return;
}
// this makes sure there is a file separator between every component,
// if path has a trailing file separator or not, it will work for both cases
File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY);
File f = new File(dir, "components.cif.gz");
if ( ! f.exists()) {
downloadAllDefinitions();
} else {
// file exists.. did it get extracted?
FilenameFilter filter =new FilenameFilter() {
@Override
public boolean accept(File dir, String file) {
return file.endsWith(".cif.gz");
}
};
String[] files = dir.list(filter);
if ( files.length < 500) {
// not all did get unpacked
try {
split();
} catch (IOException e) {
logger.error("Could not split file {} into individual chemical component files. Error: {}",
f.toString(), e.getMessage());
}
}
}
} } | public class class_name {
public void checkDoFirstInstall(){
if ( ! downloadAll ) {
return; // depends on control dependency: [if], data = [none]
}
// this makes sure there is a file separator between every component,
// if path has a trailing file separator or not, it will work for both cases
File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY);
File f = new File(dir, "components.cif.gz");
if ( ! f.exists()) {
downloadAllDefinitions();
} else {
// file exists.. did it get extracted?
FilenameFilter filter =new FilenameFilter() {
@Override
public boolean accept(File dir, String file) {
return file.endsWith(".cif.gz");
}
};
String[] files = dir.list(filter);
if ( files.length < 500) {
// not all did get unpacked
try {
split(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Could not split file {} into individual chemical component files. Error: {}",
f.toString(), e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) {
// split the root site:
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(explorerRootPath);
if (targetSiteRoot == null) {
if (OpenCms.getSiteManager().startsWithShared(explorerRootPath)) {
targetSiteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
targetSiteRoot = "";
}
}
String targetVfsFolder;
if (explorerRootPath.startsWith(targetSiteRoot)) {
targetVfsFolder = explorerRootPath.substring(targetSiteRoot.length());
targetVfsFolder = CmsStringUtil.joinPaths("/", targetVfsFolder);
} else {
targetVfsFolder = "/";
// happens in case of the shared site
}
StringBuilder link2Source = new StringBuilder();
link2Source.append(JSP_WORKPLACE_URI);
link2Source.append("?");
link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE);
link2Source.append("=");
link2Source.append(targetVfsFolder);
link2Source.append("&");
link2Source.append(PARAM_WP_VIEW);
link2Source.append("=");
link2Source.append(
OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
"/system/workplace/views/explorer/explorer_fs.jsp"));
link2Source.append("&");
link2Source.append(PARAM_WP_SITE);
link2Source.append("=");
link2Source.append(targetSiteRoot);
String result = link2Source.toString();
result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result);
return result;
} } | public class class_name {
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) {
// split the root site:
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(explorerRootPath);
if (targetSiteRoot == null) {
if (OpenCms.getSiteManager().startsWithShared(explorerRootPath)) {
targetSiteRoot = OpenCms.getSiteManager().getSharedFolder(); // depends on control dependency: [if], data = [none]
} else {
targetSiteRoot = ""; // depends on control dependency: [if], data = [none]
}
}
String targetVfsFolder;
if (explorerRootPath.startsWith(targetSiteRoot)) {
targetVfsFolder = explorerRootPath.substring(targetSiteRoot.length()); // depends on control dependency: [if], data = [none]
targetVfsFolder = CmsStringUtil.joinPaths("/", targetVfsFolder); // depends on control dependency: [if], data = [none]
} else {
targetVfsFolder = "/"; // depends on control dependency: [if], data = [none]
// happens in case of the shared site
}
StringBuilder link2Source = new StringBuilder();
link2Source.append(JSP_WORKPLACE_URI);
link2Source.append("?");
link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE);
link2Source.append("=");
link2Source.append(targetVfsFolder);
link2Source.append("&");
link2Source.append(PARAM_WP_VIEW);
link2Source.append("=");
link2Source.append(
OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
"/system/workplace/views/explorer/explorer_fs.jsp"));
link2Source.append("&");
link2Source.append(PARAM_WP_SITE);
link2Source.append("=");
link2Source.append(targetSiteRoot);
String result = link2Source.toString();
result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result);
return result;
} } |
public class class_name {
private Object retrieveLock(String key)
{
Object lock = this.lockMap.get(key);
if(lock == null)
{
lock = key;
this.lockMap.put(key, lock);
}
return lock;
} } | public class class_name {
private Object retrieveLock(String key)
{
Object lock = this.lockMap.get(key);
if(lock == null)
{
lock = key;
// depends on control dependency: [if], data = [none]
this.lockMap.put(key, lock);
// depends on control dependency: [if], data = [none]
}
return lock;
} } |
public class class_name {
public static boolean isNumber(final String num) {
if (num == null || num.length() == 0) {
return false;
}
final boolean firstIsDigit = Character.isDigit(num.charAt(0));
if (!firstIsDigit && num.charAt(0) != '-') {
return false;
}
boolean dig = firstIsDigit;
for (int i = 1; i < num.length(); i++) {
if (!Character.isDigit(num.charAt(i))) {
return false;
}
dig = true;
}
return dig;
} } | public class class_name {
public static boolean isNumber(final String num) {
if (num == null || num.length() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
final boolean firstIsDigit = Character.isDigit(num.charAt(0));
if (!firstIsDigit && num.charAt(0) != '-') {
return false; // depends on control dependency: [if], data = [none]
}
boolean dig = firstIsDigit;
for (int i = 1; i < num.length(); i++) {
if (!Character.isDigit(num.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
dig = true; // depends on control dependency: [for], data = [none]
}
return dig;
} } |
public class class_name {
protected void setGroup(String group) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setGroup(group, false);
}
} } | public class class_name {
protected void setGroup(String group) {
for (INodeHardLinkFile linkedFile : linkedFiles) {
linkedFile.setGroup(group, false); // depends on control dependency: [for], data = [linkedFile]
}
} } |
public class class_name {
boolean canSelect(Table table, boolean[] columnCheckList) {
if (isFull || isFullSelect) {
return true;
}
return containsAllColumns(selectColumnSet, table, columnCheckList);
} } | public class class_name {
boolean canSelect(Table table, boolean[] columnCheckList) {
if (isFull || isFullSelect) {
return true; // depends on control dependency: [if], data = [none]
}
return containsAllColumns(selectColumnSet, table, columnCheckList);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T lookup(URI rmiUrl)
{
try
{
return (T)Naming.lookup(rmiUrl.toString());
}
catch(Exception e)
{
throw new ConnectionException(rmiUrl+" ERROR:"+Debugger.stackTrace(e));
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T lookup(URI rmiUrl)
{
try
{
return (T)Naming.lookup(rmiUrl.toString());
// depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
throw new ConnectionException(rmiUrl+" ERROR:"+Debugger.stackTrace(e));
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Collection<T> getDescriptors(TestClass testClass) {
final List<T> descriptors = new ArrayList<T>();
for (Method testMethod : testClass.getMethods(resourceAnnotation)) {
descriptors.addAll(getDescriptorsDefinedFor(testMethod));
}
descriptors.addAll(obtainClassLevelDescriptor(testClass.getAnnotation(resourceAnnotation)));
return descriptors;
} } | public class class_name {
public Collection<T> getDescriptors(TestClass testClass) {
final List<T> descriptors = new ArrayList<T>();
for (Method testMethod : testClass.getMethods(resourceAnnotation)) {
descriptors.addAll(getDescriptorsDefinedFor(testMethod)); // depends on control dependency: [for], data = [testMethod]
}
descriptors.addAll(obtainClassLevelDescriptor(testClass.getAnnotation(resourceAnnotation)));
return descriptors;
} } |
public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof StreamValueData)
{
StreamValueData streamValue = (StreamValueData)another;
if (isByteArray())
{
return another.isByteArray() && Arrays.equals(streamValue.data, data);
}
else
{
if (stream != null && stream == streamValue.stream)
{
return true;
}
else if (spoolFile != null && spoolFile.equals(streamValue.spoolFile))
{
return true;
}
}
}
return false;
} } | public class class_name {
protected boolean internalEquals(ValueData another)
{
if (another instanceof StreamValueData)
{
StreamValueData streamValue = (StreamValueData)another;
if (isByteArray())
{
return another.isByteArray() && Arrays.equals(streamValue.data, data); // depends on control dependency: [if], data = [none]
}
else
{
if (stream != null && stream == streamValue.stream)
{
return true; // depends on control dependency: [if], data = [none]
}
else if (spoolFile != null && spoolFile.equals(streamValue.spoolFile))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
private void updateChildrenInfo(Map myChild) {
if (myChild != null) {
Iterator values = myChild.values().iterator();
while (values.hasNext()) {
ModuleItem childMI = (ModuleItem) values.next();
if (childMI.getInstance() instanceof PmiModuleAggregate) {
// no op
} else {
((PmiModuleAggregate) this.instance).add(childMI.getInstance());
((PmiAbstractModule) this.instance).updateDataList();
}
updateChildrenInfo(childMI.children);
}
}
} } | public class class_name {
private void updateChildrenInfo(Map myChild) {
if (myChild != null) {
Iterator values = myChild.values().iterator();
while (values.hasNext()) {
ModuleItem childMI = (ModuleItem) values.next();
if (childMI.getInstance() instanceof PmiModuleAggregate) {
// no op
} else {
((PmiModuleAggregate) this.instance).add(childMI.getInstance()); // depends on control dependency: [if], data = [none]
((PmiAbstractModule) this.instance).updateDataList(); // depends on control dependency: [if], data = [none]
}
updateChildrenInfo(childMI.children); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
private Expr parseLogicalExpression(EnclosingScope scope, boolean terminated) {
checkNotEof();
int start = index;
Expr lhs = parseAndOrExpression(scope, terminated);
Token lookahead = tryAndMatch(terminated, LogicalImplication, LogicalIff);
if (lookahead != null) {
switch (lookahead.kind) {
case LogicalImplication: {
Expr rhs = parseExpression(scope, terminated);
lhs = new Expr.LogicalImplication(lhs, rhs);
break;
}
case LogicalIff: {
Expr rhs = parseExpression(scope, terminated);
lhs = new Expr.LogicalIff(lhs, rhs);
break;
}
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs,start);
}
return lhs;
} } | public class class_name {
private Expr parseLogicalExpression(EnclosingScope scope, boolean terminated) {
checkNotEof();
int start = index;
Expr lhs = parseAndOrExpression(scope, terminated);
Token lookahead = tryAndMatch(terminated, LogicalImplication, LogicalIff);
if (lookahead != null) {
switch (lookahead.kind) {
case LogicalImplication: {
Expr rhs = parseExpression(scope, terminated);
lhs = new Expr.LogicalImplication(lhs, rhs);
break;
}
case LogicalIff: {
Expr rhs = parseExpression(scope, terminated);
lhs = new Expr.LogicalIff(lhs, rhs); // depends on control dependency: [if], data = [none]
break;
}
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs,start);
}
return lhs;
} } |
public class class_name {
private byte[] getHMAC(byte[] message) {
try {
return getMacInstance(mode, key).doFinal(message);
}
catch (InvalidKeyException e) {
// As the key is verified during construction of the TOTPGenerator,
// this should never happen
throw new IllegalStateException("Provided key became invalid after "
+ "passing validation.", e);
}
} } | public class class_name {
private byte[] getHMAC(byte[] message) {
try {
return getMacInstance(mode, key).doFinal(message); // depends on control dependency: [try], data = [none]
}
catch (InvalidKeyException e) {
// As the key is verified during construction of the TOTPGenerator,
// this should never happen
throw new IllegalStateException("Provided key became invalid after "
+ "passing validation.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public KeyData getEncryptionKeyData() {
KeyData encryptionData = null;
String savedValue = this.prefs.getString(preferenceKey, null);
if (savedValue != null) {
JSONObject savedObject = null;
try {
savedObject = new JSONObject(savedValue);
encryptionData = new KeyData(DPKEncryptionUtil.hexStringToByteArray(savedObject
.getString(KEY_DPK)), DPKEncryptionUtil.hexStringToByteArray
(savedObject.getString(KEY_SALT)), DPKEncryptionUtil
.hexStringToByteArray(savedObject.getString(KEY_IV)), savedObject.getInt
(KEY_ITERATIONS), savedObject.getString(KEY_VERSION));
} catch (JSONException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return null;
} catch (DecoderException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return null;
}
}
return encryptionData;
} } | public class class_name {
public KeyData getEncryptionKeyData() {
KeyData encryptionData = null;
String savedValue = this.prefs.getString(preferenceKey, null);
if (savedValue != null) {
JSONObject savedObject = null;
try {
savedObject = new JSONObject(savedValue); // depends on control dependency: [try], data = [none]
encryptionData = new KeyData(DPKEncryptionUtil.hexStringToByteArray(savedObject
.getString(KEY_DPK)), DPKEncryptionUtil.hexStringToByteArray
(savedObject.getString(KEY_SALT)), DPKEncryptionUtil
.hexStringToByteArray(savedObject.getString(KEY_IV)), savedObject.getInt
(KEY_ITERATIONS), savedObject.getString(KEY_VERSION)); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return null;
} catch (DecoderException e) { // depends on control dependency: [catch], data = [none]
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return null;
} // depends on control dependency: [catch], data = [none]
}
return encryptionData;
} } |
public class class_name {
public static boolean fixPSQ(Document doc) {
Element datasources = XMLConfigWebFactory.getChildByName(doc.getDocumentElement(), "data-sources", false, true);
if (datasources != null && datasources.hasAttribute("preserve-single-quote")) {
Boolean b = Caster.toBoolean(datasources.getAttribute("preserve-single-quote"), null);
if (b != null) datasources.setAttribute("psq", Caster.toString(!b.booleanValue()));
datasources.removeAttribute("preserve-single-quote");
return true;
}
return false;
} } | public class class_name {
public static boolean fixPSQ(Document doc) {
Element datasources = XMLConfigWebFactory.getChildByName(doc.getDocumentElement(), "data-sources", false, true);
if (datasources != null && datasources.hasAttribute("preserve-single-quote")) {
Boolean b = Caster.toBoolean(datasources.getAttribute("preserve-single-quote"), null);
if (b != null) datasources.setAttribute("psq", Caster.toString(!b.booleanValue()));
datasources.removeAttribute("preserve-single-quote"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private void changeAvailability(
CmsResource resource,
Date released,
boolean resetReleased,
Date expired,
boolean resetExpired,
boolean modifySubresources)
throws CmsException {
CmsObject cms = m_dialogContext.getCms();
CmsLockActionRecord lockActionRecord = CmsLockUtil.ensureLock(cms, resource);
try {
long newDateReleased;
if (resetReleased || (released != null)) {
newDateReleased = released != null ? released.getTime() : CmsResource.DATE_RELEASED_DEFAULT;
cms.setDateReleased(resource, newDateReleased, modifySubresources);
}
long newDateExpired;
if (resetExpired || (expired != null)) {
newDateExpired = expired != null ? expired.getTime() : CmsResource.DATE_EXPIRED_DEFAULT;
cms.setDateExpired(resource, newDateExpired, modifySubresources);
}
} finally {
if (lockActionRecord.getChange() == LockChange.locked) {
try {
cms.unlockResource(resource);
} catch (CmsLockException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
}
} } | public class class_name {
private void changeAvailability(
CmsResource resource,
Date released,
boolean resetReleased,
Date expired,
boolean resetExpired,
boolean modifySubresources)
throws CmsException {
CmsObject cms = m_dialogContext.getCms();
CmsLockActionRecord lockActionRecord = CmsLockUtil.ensureLock(cms, resource);
try {
long newDateReleased;
if (resetReleased || (released != null)) {
newDateReleased = released != null ? released.getTime() : CmsResource.DATE_RELEASED_DEFAULT; // depends on control dependency: [if], data = [none]
cms.setDateReleased(resource, newDateReleased, modifySubresources); // depends on control dependency: [if], data = [none]
}
long newDateExpired;
if (resetExpired || (expired != null)) {
newDateExpired = expired != null ? expired.getTime() : CmsResource.DATE_EXPIRED_DEFAULT; // depends on control dependency: [if], data = [none]
cms.setDateExpired(resource, newDateExpired, modifySubresources); // depends on control dependency: [if], data = [none]
}
} finally {
if (lockActionRecord.getChange() == LockChange.locked) {
try {
cms.unlockResource(resource); // depends on control dependency: [try], data = [none]
} catch (CmsLockException e) {
LOG.warn(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public String toQueryString() {
String encoding = request.getCharacterEncoding();
try {
return WebUtils.toQueryString(this, encoding);
}
catch (UnsupportedEncodingException e) {
throw new ControllerExecutionException("Unable to convert parameter map [" + this +
"] to a query string: " + e.getMessage(), e);
}
} } | public class class_name {
public String toQueryString() {
String encoding = request.getCharacterEncoding();
try {
return WebUtils.toQueryString(this, encoding); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
throw new ControllerExecutionException("Unable to convert parameter map [" + this +
"] to a query string: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Object mod(Object a, Object b) {
if (a == null || b == null) {
return null;
}
switch (typeCode) {
case Types.SQL_REAL :
case Types.SQL_FLOAT :
case Types.SQL_DOUBLE : {
double ad = ((Number) a).doubleValue();
double bd = ((Number) b).doubleValue();
if (bd == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getDouble(Double.doubleToLongBits(ad % bd));
}
case Types.SQL_DECIMAL : {
if ((b).equals(0)) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getBigDecimal(((BigDecimal) a).remainder((BigDecimal) b));
}
case Types.TINYINT :
case Types.SQL_SMALLINT :
case Types.SQL_INTEGER : {
int ai = ((Number) a).intValue();
int bi = ((Number) b).intValue();
if (bi == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getInt(ai % bi);
}
case Types.SQL_BIGINT : {
long al = ((Number) a).longValue();
long bl = ((Number) b).longValue();
if (bl == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getLong(al % bl);
}
default :
throw Error.runtimeError(ErrorCode.U_S0500, "NumberType");
}
} } | public class class_name {
public Object mod(Object a, Object b) {
if (a == null || b == null) {
return null; // depends on control dependency: [if], data = [none]
}
switch (typeCode) {
case Types.SQL_REAL :
case Types.SQL_FLOAT :
case Types.SQL_DOUBLE : {
double ad = ((Number) a).doubleValue();
double bd = ((Number) b).doubleValue();
if (bd == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getDouble(Double.doubleToLongBits(ad % bd));
}
case Types.SQL_DECIMAL : {
if ((b).equals(0)) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getBigDecimal(((BigDecimal) a).remainder((BigDecimal) b));
}
case Types.TINYINT :
case Types.SQL_SMALLINT :
case Types.SQL_INTEGER : {
int ai = ((Number) a).intValue();
int bi = ((Number) b).intValue();
if (bi == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getInt(ai % bi);
}
case Types.SQL_BIGINT : {
long al = ((Number) a).longValue();
long bl = ((Number) b).longValue();
if (bl == 0) {
throw Error.error(ErrorCode.X_22012);
}
return ValuePool.getLong(al % bl);
}
default :
throw Error.runtimeError(ErrorCode.U_S0500, "NumberType");
}
} } |
public class class_name {
static <T extends Annotation> List<T> find(AnnotatedElement element, Class<T> annotationType,
EnumSet<FindOption> findOptions) {
requireNonNull(element, "element");
requireNonNull(annotationType, "annotationType");
final Builder<T> builder = new Builder<>();
// Repeatable is not a repeatable. So the length of the returning array is 0 or 1.
final Repeatable[] repeatableAnnotations = annotationType.getAnnotationsByType(Repeatable.class);
final Class<? extends Annotation> containerType =
repeatableAnnotations.length > 0 ? repeatableAnnotations[0].value() : null;
for (final AnnotatedElement e : resolveTargetElements(element, findOptions)) {
for (final Annotation annotation : e.getDeclaredAnnotations()) {
if (findOptions.contains(FindOption.LOOKUP_META_ANNOTATIONS)) {
findMetaAnnotations(builder, annotation, annotationType, containerType);
}
collectAnnotations(builder, annotation, annotationType, containerType);
}
}
return builder.build();
} } | public class class_name {
static <T extends Annotation> List<T> find(AnnotatedElement element, Class<T> annotationType,
EnumSet<FindOption> findOptions) {
requireNonNull(element, "element");
requireNonNull(annotationType, "annotationType");
final Builder<T> builder = new Builder<>();
// Repeatable is not a repeatable. So the length of the returning array is 0 or 1.
final Repeatable[] repeatableAnnotations = annotationType.getAnnotationsByType(Repeatable.class);
final Class<? extends Annotation> containerType =
repeatableAnnotations.length > 0 ? repeatableAnnotations[0].value() : null;
for (final AnnotatedElement e : resolveTargetElements(element, findOptions)) {
for (final Annotation annotation : e.getDeclaredAnnotations()) {
if (findOptions.contains(FindOption.LOOKUP_META_ANNOTATIONS)) {
findMetaAnnotations(builder, annotation, annotationType, containerType); // depends on control dependency: [if], data = [none]
}
collectAnnotations(builder, annotation, annotationType, containerType); // depends on control dependency: [for], data = [annotation]
}
}
return builder.build();
} } |
public class class_name {
void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) {
Env<GenContext> last = null;
while (last != to) {
endFinalizerGap(from);
last = from;
from = from.next;
}
} } | public class class_name {
void endFinalizerGaps(Env<GenContext> from, Env<GenContext> to) {
Env<GenContext> last = null;
while (last != to) {
endFinalizerGap(from); // depends on control dependency: [while], data = [none]
last = from; // depends on control dependency: [while], data = [none]
from = from.next; // depends on control dependency: [while], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.