code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private List<IBond> makeIonicBonds(final List<IAtomContainer> frags) {
assert frags.size() > 1;
// merge duplicates together, e.g. [H-].[H-].[H-].[Na+].[Na+].[Na+]
// would be two needsMerge fragments. We currently only do single
// atoms but in theory could also do larger ones
final List<IAtomContainer> mergedFrags = mergeAtomicIons(frags);
final List<IAtomContainer> posFrags = new ArrayList<>();
final List<IAtomContainer> negFrags = new ArrayList<>();
int chgSum = 0;
for (IAtomContainer frag : mergedFrags) {
int chg = 0;
for (final IAtom atom : frag.atoms())
chg += nullAsZero(atom.getFormalCharge());
chgSum += chg;
frag.setProperty(FRAGMENT_CHARGE, chg);
if (chg < 0)
negFrags.add(frag);
else if (chg > 0)
posFrags.add(frag);
}
// non-neutral or we only have one needsMerge fragment?
if (chgSum != 0 || mergedFrags.size() == 1)
return Collections.emptyList();
List<IAtom> cations = new ArrayList<>();
List<IAtom> anions = new ArrayList<>();
// trivial case
if (posFrags.size() == 1 && negFrags.size() == 1) {
cations.addAll(selectIons(posFrags.get(0), +1));
anions.addAll(selectIons(negFrags.get(0), -1));
} else {
// sort hi->lo fragment charge, if same charge then we put smaller
// fragments (bond count) before in cations and after in anions
Comparator<IAtomContainer> comparator = new Comparator<IAtomContainer>() {
@Override
public int compare(IAtomContainer a, IAtomContainer b) {
int qA = a.getProperty(FRAGMENT_CHARGE);
int qB = b.getProperty(FRAGMENT_CHARGE);
int cmp = Integer.compare(Math.abs(qA), Math.abs(qB));
if (cmp != 0) return cmp;
int sign = Integer.signum(qA);
return Integer.compare(sign * a.getBondCount(), sign * b.getBondCount());
}
};
// greedy selection
Collections.sort(posFrags, comparator);
Collections.sort(negFrags, comparator);
for (IAtomContainer posFrag : posFrags)
cations.addAll(selectIons(posFrag, +1));
for (IAtomContainer negFrag : negFrags)
anions.addAll(selectIons(negFrag, -1));
}
if (cations.size() != anions.size() && cations.isEmpty())
return Collections.emptyList();
final IChemObjectBuilder bldr = frags.get(0).getBuilder();
// make the bonds
final List<IBond> ionicBonds = new ArrayList<>(cations.size());
for (int i = 0; i < cations.size(); i++) {
final IAtom beg = cations.get(i);
final IAtom end = anions.get(i);
boolean unique = true;
for (IBond bond : ionicBonds)
if (bond.getBegin().equals(beg) && bond.getEnd().equals(end) ||
bond.getEnd().equals(beg) && bond.getBegin().equals(end))
unique = false;
if (unique)
ionicBonds.add(bldr.newInstance(IBond.class, beg, end));
}
// we could merge the fragments here using union-find structures
// but it's much simpler (and probably more efficient) to return
// the new bonds and re-fragment the molecule with these bonds added.
return ionicBonds;
} }
|
public class class_name {
private List<IBond> makeIonicBonds(final List<IAtomContainer> frags) {
assert frags.size() > 1;
// merge duplicates together, e.g. [H-].[H-].[H-].[Na+].[Na+].[Na+]
// would be two needsMerge fragments. We currently only do single
// atoms but in theory could also do larger ones
final List<IAtomContainer> mergedFrags = mergeAtomicIons(frags);
final List<IAtomContainer> posFrags = new ArrayList<>();
final List<IAtomContainer> negFrags = new ArrayList<>();
int chgSum = 0;
for (IAtomContainer frag : mergedFrags) {
int chg = 0;
for (final IAtom atom : frag.atoms())
chg += nullAsZero(atom.getFormalCharge());
chgSum += chg; // depends on control dependency: [for], data = [none]
frag.setProperty(FRAGMENT_CHARGE, chg); // depends on control dependency: [for], data = [frag]
if (chg < 0)
negFrags.add(frag);
else if (chg > 0)
posFrags.add(frag);
}
// non-neutral or we only have one needsMerge fragment?
if (chgSum != 0 || mergedFrags.size() == 1)
return Collections.emptyList();
List<IAtom> cations = new ArrayList<>();
List<IAtom> anions = new ArrayList<>();
// trivial case
if (posFrags.size() == 1 && negFrags.size() == 1) {
cations.addAll(selectIons(posFrags.get(0), +1)); // depends on control dependency: [if], data = [none]
anions.addAll(selectIons(negFrags.get(0), -1)); // depends on control dependency: [if], data = [none]
} else {
// sort hi->lo fragment charge, if same charge then we put smaller
// fragments (bond count) before in cations and after in anions
Comparator<IAtomContainer> comparator = new Comparator<IAtomContainer>() {
@Override
public int compare(IAtomContainer a, IAtomContainer b) {
int qA = a.getProperty(FRAGMENT_CHARGE);
int qB = b.getProperty(FRAGMENT_CHARGE);
int cmp = Integer.compare(Math.abs(qA), Math.abs(qB));
if (cmp != 0) return cmp;
int sign = Integer.signum(qA);
return Integer.compare(sign * a.getBondCount(), sign * b.getBondCount());
}
};
// greedy selection
Collections.sort(posFrags, comparator); // depends on control dependency: [if], data = [none]
Collections.sort(negFrags, comparator); // depends on control dependency: [if], data = [none]
for (IAtomContainer posFrag : posFrags)
cations.addAll(selectIons(posFrag, +1));
for (IAtomContainer negFrag : negFrags)
anions.addAll(selectIons(negFrag, -1));
}
if (cations.size() != anions.size() && cations.isEmpty())
return Collections.emptyList();
final IChemObjectBuilder bldr = frags.get(0).getBuilder();
// make the bonds
final List<IBond> ionicBonds = new ArrayList<>(cations.size());
for (int i = 0; i < cations.size(); i++) {
final IAtom beg = cations.get(i);
final IAtom end = anions.get(i);
boolean unique = true;
for (IBond bond : ionicBonds)
if (bond.getBegin().equals(beg) && bond.getEnd().equals(end) ||
bond.getEnd().equals(beg) && bond.getBegin().equals(end))
unique = false;
if (unique)
ionicBonds.add(bldr.newInstance(IBond.class, beg, end));
}
// we could merge the fragments here using union-find structures
// but it's much simpler (and probably more efficient) to return
// the new bonds and re-fragment the molecule with these bonds added.
return ionicBonds;
} }
|
public class class_name {
public static SQLXML createSQLXML(final Connection conn) {
try {
return conn.createSQLXML();
} catch (SQLException e) {
throw new UroborosqlRuntimeException(e);
}
} }
|
public class class_name {
public static SQLXML createSQLXML(final Connection conn) {
try {
return conn.createSQLXML(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new UroborosqlRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private int dropUnusedTracks() {
List<PointTrack> all = trackerLeft.getAllTracks(null);
int num = 0;
for( PointTrack t : all ) {
LeftTrackInfo info = t.getCookie();
if( tick - info.lastInlier > thresholdRetire ) {
if( !trackerLeft.dropTrack(t) )
throw new IllegalArgumentException("failed to drop unused left track");
if( !trackerRight.dropTrack(info.right) )
throw new IllegalArgumentException("failed to drop unused right track");
num++;
}
}
// System.out.println(" total unused dropped "+num);
return num;
} }
|
public class class_name {
private int dropUnusedTracks() {
List<PointTrack> all = trackerLeft.getAllTracks(null);
int num = 0;
for( PointTrack t : all ) {
LeftTrackInfo info = t.getCookie();
if( tick - info.lastInlier > thresholdRetire ) {
if( !trackerLeft.dropTrack(t) )
throw new IllegalArgumentException("failed to drop unused left track");
if( !trackerRight.dropTrack(info.right) )
throw new IllegalArgumentException("failed to drop unused right track");
num++; // depends on control dependency: [if], data = [none]
}
}
// System.out.println(" total unused dropped "+num);
return num;
} }
|
public class class_name {
public static Assignment unionAll(Collection<Assignment> assignments) {
int numVars = 0;
for (Assignment assignment : assignments) {
numVars += assignment.size();
}
int[] vars = new int[numVars];
Object[] values = new Object[numVars];
int numFilled = 0;
for (Assignment assignment : assignments) {
int[] assignmentVars = assignment.vars;
Object[] assignmentValues = assignment.values;
int numAssignmentVars = assignment.vars.length;
for (int i = 0; i < numAssignmentVars; i++) {
vars[numFilled] = assignmentVars[i];
values[numFilled] = assignmentValues[i];
numFilled++;
}
}
Preconditions.checkState(numFilled == numVars);
return Assignment.fromUnsortedArrays(vars, values);
} }
|
public class class_name {
public static Assignment unionAll(Collection<Assignment> assignments) {
int numVars = 0;
for (Assignment assignment : assignments) {
numVars += assignment.size(); // depends on control dependency: [for], data = [assignment]
}
int[] vars = new int[numVars];
Object[] values = new Object[numVars];
int numFilled = 0;
for (Assignment assignment : assignments) {
int[] assignmentVars = assignment.vars;
Object[] assignmentValues = assignment.values;
int numAssignmentVars = assignment.vars.length;
for (int i = 0; i < numAssignmentVars; i++) {
vars[numFilled] = assignmentVars[i]; // depends on control dependency: [for], data = [i]
values[numFilled] = assignmentValues[i]; // depends on control dependency: [for], data = [i]
numFilled++; // depends on control dependency: [for], data = [none]
}
}
Preconditions.checkState(numFilled == numVars);
return Assignment.fromUnsortedArrays(vars, values);
} }
|
public class class_name {
public void writeNotificationRecords(OutputStream out, NotificationRecord[] value) throws IOException {
writeStartArray(out);
if (value == null) {
writeEndArray(out);
return;
}
for (NotificationRecord nr : value) {
Notification item = nr.getNotification();
writeArrayItem(out);
writeStartObject(out);
// Fields common to all notification classes
Class<?> clazz = item.getClass();
writeSimpleStringField(out, OM_CLASSNAME, clazz.getName());
writeStringField(out, OM_TYPE, item.getType());
ObjectName on = null;
if (item.getSource() instanceof String) {
try {
on = new ObjectName((String) item.getSource());
} catch (Exception e) {
}
} else {
on = (ObjectName) item.getSource();
}
writeObjectNameField(out, OM_SOURCE, on);
writeLongField(out, OM_SEQUENCENUMBER, item.getSequenceNumber());
writeLongField(out, OM_TIMESTAMP, item.getTimeStamp());
writeStringField(out, OM_MESSAGE, item.getMessage());
writePOJOField(out, OM_USERDATA, item.getUserData());
// Write routing information (host name, server name, server user dir) if this is a routed notification.
final Map<String, Object> routingInfo = nr.getNotificationTargetInformation().getRoutingInformation();
if (routingInfo != null) {
String hostName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME);
String serverName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME);
String serverUserDir = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR);
writeStringField(out, OM_HOSTNAME, hostName);
writeStringField(out, OM_SERVERNAME, serverName);
writeStringField(out, OM_SERVERUSERDIR, serverUserDir);
}
if (clazz == Notification.class) {
} else if (clazz == AttributeChangeNotification.class) {
AttributeChangeNotification v = (AttributeChangeNotification) item;
writeStringField(out, OM_ATTRIBUTENAME, v.getAttributeName());
writeStringField(out, OM_ATTRIBUTETYPE, v.getAttributeType());
writePOJOField(out, OM_OLDVALUE, v.getOldValue());
writePOJOField(out, OM_NEWVALUE, v.getNewValue());
} else if (clazz == JMXConnectionNotification.class) {
JMXConnectionNotification v = (JMXConnectionNotification) item;
writeStringField(out, OM_CONNECTIONID, v.getConnectionId());
} else if (clazz == MBeanServerNotification.class) {
MBeanServerNotification v = (MBeanServerNotification) item;
writeObjectNameField(out, OM_MBEANNAME, v.getMBeanName());
} else if (clazz == RelationNotification.class) {
RelationNotification v = (RelationNotification) item;
writeStringField(out, OM_RELATIONID, v.getRelationId());
writeStringField(out, OM_RELATIONTYPENAME, v.getRelationTypeName());
writeObjectNameField(out, OM_OBJECTNAME, v.getObjectName());
String roleName = v.getRoleName();
if (roleName == null) {
writeObjectNameListField(out, OM_MBEANSTOUNREGISTER, v.getMBeansToUnregister());
} else {
writeStringField(out, OM_ROLENAME, v.getRoleName());
writeObjectNameListField(out, OM_OLDROLEVALUE, v.getOldRoleValue());
writeObjectNameListField(out, OM_NEWROLEVALUE, v.getNewRoleValue());
}
} else if (clazz == TimerNotification.class) {
TimerNotification v = (TimerNotification) item;
writeIntField(out, OM_NOTIFICATIONID, v.getNotificationID());
} else {
// MonitorNotification and TimerAlarmClockNotification are
// known, but either the class or the constructor is not
// visible, and we have to use base64.
// SnmpTableEntryNotification is a sun specific implementation.
writeSerializedField(out, OM_SERIALIZED, item);
}
writeEndObject(out);
}
writeEndArray(out);
} }
|
public class class_name {
public void writeNotificationRecords(OutputStream out, NotificationRecord[] value) throws IOException {
writeStartArray(out);
if (value == null) {
writeEndArray(out);
return;
}
for (NotificationRecord nr : value) {
Notification item = nr.getNotification();
writeArrayItem(out);
writeStartObject(out);
// Fields common to all notification classes
Class<?> clazz = item.getClass();
writeSimpleStringField(out, OM_CLASSNAME, clazz.getName());
writeStringField(out, OM_TYPE, item.getType());
ObjectName on = null;
if (item.getSource() instanceof String) {
try {
on = new ObjectName((String) item.getSource()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
} else {
on = (ObjectName) item.getSource(); // depends on control dependency: [if], data = [none]
}
writeObjectNameField(out, OM_SOURCE, on);
writeLongField(out, OM_SEQUENCENUMBER, item.getSequenceNumber());
writeLongField(out, OM_TIMESTAMP, item.getTimeStamp());
writeStringField(out, OM_MESSAGE, item.getMessage());
writePOJOField(out, OM_USERDATA, item.getUserData());
// Write routing information (host name, server name, server user dir) if this is a routed notification.
final Map<String, Object> routingInfo = nr.getNotificationTargetInformation().getRoutingInformation();
if (routingInfo != null) {
String hostName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_HOST_NAME);
String serverName = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_NAME);
String serverUserDir = (String) routingInfo.get(ClientProvider.ROUTING_KEY_SERVER_USER_DIR);
writeStringField(out, OM_HOSTNAME, hostName); // depends on control dependency: [if], data = [none]
writeStringField(out, OM_SERVERNAME, serverName); // depends on control dependency: [if], data = [none]
writeStringField(out, OM_SERVERUSERDIR, serverUserDir); // depends on control dependency: [if], data = [none]
}
if (clazz == Notification.class) {
} else if (clazz == AttributeChangeNotification.class) {
AttributeChangeNotification v = (AttributeChangeNotification) item;
writeStringField(out, OM_ATTRIBUTENAME, v.getAttributeName()); // depends on control dependency: [if], data = [none]
writeStringField(out, OM_ATTRIBUTETYPE, v.getAttributeType()); // depends on control dependency: [if], data = [none]
writePOJOField(out, OM_OLDVALUE, v.getOldValue()); // depends on control dependency: [if], data = [none]
writePOJOField(out, OM_NEWVALUE, v.getNewValue()); // depends on control dependency: [if], data = [none]
} else if (clazz == JMXConnectionNotification.class) {
JMXConnectionNotification v = (JMXConnectionNotification) item;
writeStringField(out, OM_CONNECTIONID, v.getConnectionId()); // depends on control dependency: [if], data = [none]
} else if (clazz == MBeanServerNotification.class) {
MBeanServerNotification v = (MBeanServerNotification) item;
writeObjectNameField(out, OM_MBEANNAME, v.getMBeanName()); // depends on control dependency: [if], data = [none]
} else if (clazz == RelationNotification.class) {
RelationNotification v = (RelationNotification) item;
writeStringField(out, OM_RELATIONID, v.getRelationId()); // depends on control dependency: [if], data = [none]
writeStringField(out, OM_RELATIONTYPENAME, v.getRelationTypeName()); // depends on control dependency: [if], data = [none]
writeObjectNameField(out, OM_OBJECTNAME, v.getObjectName()); // depends on control dependency: [if], data = [none]
String roleName = v.getRoleName();
if (roleName == null) {
writeObjectNameListField(out, OM_MBEANSTOUNREGISTER, v.getMBeansToUnregister()); // depends on control dependency: [if], data = [none]
} else {
writeStringField(out, OM_ROLENAME, v.getRoleName()); // depends on control dependency: [if], data = [none]
writeObjectNameListField(out, OM_OLDROLEVALUE, v.getOldRoleValue()); // depends on control dependency: [if], data = [none]
writeObjectNameListField(out, OM_NEWROLEVALUE, v.getNewRoleValue()); // depends on control dependency: [if], data = [none]
}
} else if (clazz == TimerNotification.class) {
TimerNotification v = (TimerNotification) item;
writeIntField(out, OM_NOTIFICATIONID, v.getNotificationID()); // depends on control dependency: [if], data = [none]
} else {
// MonitorNotification and TimerAlarmClockNotification are
// known, but either the class or the constructor is not
// visible, and we have to use base64.
// SnmpTableEntryNotification is a sun specific implementation.
writeSerializedField(out, OM_SERIALIZED, item); // depends on control dependency: [if], data = [none]
}
writeEndObject(out);
}
writeEndArray(out);
} }
|
public class class_name {
private void processScores(String line) {
String[] values = line.trim().split(" +");
// increment the current row we are talking about
currentRowPos++;
for ( int i =0 ; i < values.length ; i++){
if ( values[i].endsWith(".")) {
values[i] = values[i] + "0";
}
// special case: MEHP950101
if (values[i].equals("-")) {
values[i] = "0";
}
if ( scale == -1 ) {
scale = determineScale(values[0]);
}
Float score = Float.parseFloat(values[i]);
score = scale * score;
Short s = (short) Math.round(score);
matrix[currentRowPos][i] = s;
if ( values.length < cols.size() || ( symmetricMatrix)){
//System.out.println(values.length + " " + cols.size() + " " + currentRowPos + " " + i + " " + line);
matrix[i][currentRowPos] = s;
symmetricMatrix = true;
}
if ( score > max)
max = s;
if ( score < min)
min = s;
}
} }
|
public class class_name {
private void processScores(String line) {
String[] values = line.trim().split(" +");
// increment the current row we are talking about
currentRowPos++;
for ( int i =0 ; i < values.length ; i++){
if ( values[i].endsWith(".")) {
values[i] = values[i] + "0"; // depends on control dependency: [if], data = [none]
}
// special case: MEHP950101
if (values[i].equals("-")) {
values[i] = "0"; // depends on control dependency: [if], data = [none]
}
if ( scale == -1 ) {
scale = determineScale(values[0]); // depends on control dependency: [if], data = [none]
}
Float score = Float.parseFloat(values[i]);
score = scale * score; // depends on control dependency: [for], data = [none]
Short s = (short) Math.round(score);
matrix[currentRowPos][i] = s; // depends on control dependency: [for], data = [i]
if ( values.length < cols.size() || ( symmetricMatrix)){
//System.out.println(values.length + " " + cols.size() + " " + currentRowPos + " " + i + " " + line);
matrix[i][currentRowPos] = s; // depends on control dependency: [if], data = [none]
symmetricMatrix = true; // depends on control dependency: [if], data = [none]
}
if ( score > max)
max = s;
if ( score < min)
min = s;
}
} }
|
public class class_name {
public static int FVN32hash(byte[] bytes) {
long hash = FNV_BASIS;
for (int i = 0; i < bytes.length; i++) {
hash ^= 0xFF & bytes[i];
hash *= FNV_PRIME_32;
}
return (int) hash;
} }
|
public class class_name {
public static int FVN32hash(byte[] bytes) {
long hash = FNV_BASIS;
for (int i = 0; i < bytes.length; i++) {
hash ^= 0xFF & bytes[i]; // depends on control dependency: [for], data = [i]
hash *= FNV_PRIME_32; // depends on control dependency: [for], data = [none]
}
return (int) hash;
} }
|
public class class_name {
private void executeUpdatesAsynchronous(DBTransaction transaction) {
Collection<BoundStatement> mutations = getMutations(transaction);
List<ResultSetFuture> futureList = new ArrayList<>(mutations.size());
for(BoundStatement mutation: mutations) {
ResultSetFuture future = m_dbservice.getSession().executeAsync(mutation);
futureList.add(future);
}
m_logger.debug("Waiting for {} asynchronous futures", futureList.size());
for (ResultSetFuture future : futureList) {
future.getUninterruptibly();
}
} }
|
public class class_name {
private void executeUpdatesAsynchronous(DBTransaction transaction) {
Collection<BoundStatement> mutations = getMutations(transaction);
List<ResultSetFuture> futureList = new ArrayList<>(mutations.size());
for(BoundStatement mutation: mutations) {
ResultSetFuture future = m_dbservice.getSession().executeAsync(mutation);
futureList.add(future); // depends on control dependency: [for], data = [none]
}
m_logger.debug("Waiting for {} asynchronous futures", futureList.size());
for (ResultSetFuture future : futureList) {
future.getUninterruptibly(); // depends on control dependency: [for], data = [future]
}
} }
|
public class class_name {
public static Object getId(Object object) {
Objects.nonNull(object);
try {
Field idField = getIdField(object.getClass());
if (idField == null) throw new IllegalArgumentException(object.getClass().getName() + " has no id field to get");
Object id = idField.get(object);
return id;
} catch (SecurityException | IllegalAccessException e) {
throw new LoggingRuntimeException(e, logger, "getting Id failed");
}
} }
|
public class class_name {
public static Object getId(Object object) {
Objects.nonNull(object);
try {
Field idField = getIdField(object.getClass());
if (idField == null) throw new IllegalArgumentException(object.getClass().getName() + " has no id field to get");
Object id = idField.get(object);
return id; // depends on control dependency: [try], data = [none]
} catch (SecurityException | IllegalAccessException e) {
throw new LoggingRuntimeException(e, logger, "getting Id failed");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> getEndpointHealthNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.getEndpointHealthNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<EndpointHealthDataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<EndpointHealthDataInner>> result = getEndpointHealthNextDelegate(response);
return Observable.just(new ServiceResponse<Page<EndpointHealthDataInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> getEndpointHealthNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.getEndpointHealthNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<EndpointHealthDataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<EndpointHealthDataInner>> result = getEndpointHealthNextDelegate(response);
return Observable.just(new ServiceResponse<Page<EndpointHealthDataInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public DMatrixRMaj getQ(DMatrixRMaj Q ) {
Q = UtilDecompositons_DDRM.checkIdentity(Q,N,N);
for( int j = N-2; j >= 0; j-- ) {
u[j+1] = 1;
for( int i = j+2; i < N; i++ ) {
u[i] = QH.get(i,j);
}
QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j + 1, j + 1, N, b);
}
return Q;
} }
|
public class class_name {
public DMatrixRMaj getQ(DMatrixRMaj Q ) {
Q = UtilDecompositons_DDRM.checkIdentity(Q,N,N);
for( int j = N-2; j >= 0; j-- ) {
u[j+1] = 1; // depends on control dependency: [for], data = [j]
for( int i = j+2; i < N; i++ ) {
u[i] = QH.get(i,j); // depends on control dependency: [for], data = [i]
}
QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j + 1, j + 1, N, b); // depends on control dependency: [for], data = [j]
}
return Q;
} }
|
public class class_name {
public void scythe() {
log.debug("Starting Audit Cleanup");
if (maxAuditAllowedDays >= 0) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, maxAuditAllowedDays * -1);
final Date since = new Date(calendar.getTimeInMillis());
final List<? extends AuditModel> toDelete = auditService.getAuditLogs(since, new Date());
if (toDelete != null) {
final List<String> idstoDel = getIdList(toDelete);
log.info("Deleting {} audit entries ", idstoDel.size());
if (toDelete != null) {
auditService.deleteAudits(idstoDel);
}
log.info("Going to sleep now");
} else {
log.info("AuditService return null when ask to give audits with in this range {} {}", since,
new Date());
}
} else {
log.info("Skipping scythe maxAuditAllowedDays is set to infinity");
}
} }
|
public class class_name {
public void scythe() {
log.debug("Starting Audit Cleanup");
if (maxAuditAllowedDays >= 0) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, maxAuditAllowedDays * -1); // depends on control dependency: [if], data = [none]
final Date since = new Date(calendar.getTimeInMillis());
final List<? extends AuditModel> toDelete = auditService.getAuditLogs(since, new Date());
if (toDelete != null) {
final List<String> idstoDel = getIdList(toDelete);
log.info("Deleting {} audit entries ", idstoDel.size()); // depends on control dependency: [if], data = [none]
if (toDelete != null) {
auditService.deleteAudits(idstoDel); // depends on control dependency: [if], data = [none]
}
log.info("Going to sleep now"); // depends on control dependency: [if], data = [none]
} else {
log.info("AuditService return null when ask to give audits with in this range {} {}", since,
new Date()); // depends on control dependency: [if], data = [none]
}
} else {
log.info("Skipping scythe maxAuditAllowedDays is set to infinity"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void generateOutput() {
final Filer filer = processingEnv.getFiler();
writeJsonToFile(filer, "JSONClasses", jsonClasses);
writeJsonToFile(filer, "debugcrud", debugMessages);
final List<ResourceMethod> resources = Lists.newArrayList();
for (ResourceClass klass : resourceClasses.values()) {
final String path = klass.getPath();
for (final ResourceMethod method : klass.getMembers()) {
resources.add(new ResourceMethod("", method.getMethod(),
computeDisplayPath(path, method.getPath()),
method.getReturnContentType(), method.getReturnType(), method.getArguments(),
method.getJavadoc()));
}
}
writeJsonToFile(filer, "RESTEndpoints", resources);
} }
|
public class class_name {
private void generateOutput() {
final Filer filer = processingEnv.getFiler();
writeJsonToFile(filer, "JSONClasses", jsonClasses);
writeJsonToFile(filer, "debugcrud", debugMessages);
final List<ResourceMethod> resources = Lists.newArrayList();
for (ResourceClass klass : resourceClasses.values()) {
final String path = klass.getPath();
for (final ResourceMethod method : klass.getMembers()) {
resources.add(new ResourceMethod("", method.getMethod(),
computeDisplayPath(path, method.getPath()),
method.getReturnContentType(), method.getReturnType(), method.getArguments(),
method.getJavadoc())); // depends on control dependency: [for], data = [none]
}
}
writeJsonToFile(filer, "RESTEndpoints", resources);
} }
|
public class class_name {
public PreparedStatement getPreparedQuery(String tableName, Query query) {
synchronized (m_prepQueryMap) {
Map<Query, PreparedStatement> statementMap = m_prepQueryMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>();
m_prepQueryMap.put(tableName, statementMap);
}
PreparedStatement prepState = statementMap.get(query);
if (prepState == null) {
prepState = prepareQuery(tableName, query);
statementMap.put(query, prepState);
}
return prepState;
}
} }
|
public class class_name {
public PreparedStatement getPreparedQuery(String tableName, Query query) {
synchronized (m_prepQueryMap) {
Map<Query, PreparedStatement> statementMap = m_prepQueryMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>(); // depends on control dependency: [if], data = [none]
m_prepQueryMap.put(tableName, statementMap); // depends on control dependency: [if], data = [none]
}
PreparedStatement prepState = statementMap.get(query);
if (prepState == null) {
prepState = prepareQuery(tableName, query); // depends on control dependency: [if], data = [none]
statementMap.put(query, prepState); // depends on control dependency: [if], data = [none]
}
return prepState;
}
} }
|
public class class_name {
protected void handlePropertyClassName(
EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
String className =
propertyClassNameResolver.resolve(entityDesc, propertyDesc.getName(), defaultClassName);
if (className == null) {
Logger.info(
Message.DOMAGEN0018.getMessage(
columnMeta.getTableMeta().getName(),
columnMeta.getName(),
columnMeta.getTypeName(),
columnMeta.getSqlType()));
className = String.class.getName();
}
propertyDesc.setPropertyClassName(className);
} }
|
public class class_name {
protected void handlePropertyClassName(
EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
String className =
propertyClassNameResolver.resolve(entityDesc, propertyDesc.getName(), defaultClassName);
if (className == null) {
Logger.info(
Message.DOMAGEN0018.getMessage(
columnMeta.getTableMeta().getName(),
columnMeta.getName(),
columnMeta.getTypeName(),
columnMeta.getSqlType())); // depends on control dependency: [if], data = [none]
className = String.class.getName(); // depends on control dependency: [if], data = [none]
}
propertyDesc.setPropertyClassName(className);
} }
|
public class class_name {
protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) {
try {
bind.toConstructor(DefaultWebSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton();
} catch (NoSuchMethodException e) {
throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.", e);
}
} }
|
public class class_name {
protected void bindWebSecurityManager(AnnotatedBindingBuilder<? super WebSecurityManager> bind) {
try {
bind.toConstructor(DefaultWebSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in ShiroModule.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public CreateApplicationRequest withLabels(String... labels) {
if (this.labels == null) {
setLabels(new java.util.ArrayList<String>(labels.length));
}
for (String ele : labels) {
this.labels.add(ele);
}
return this;
} }
|
public class class_name {
public CreateApplicationRequest withLabels(String... labels) {
if (this.labels == null) {
setLabels(new java.util.ArrayList<String>(labels.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : labels) {
this.labels.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private int readAndWriteCData(Writer w)
throws IOException, XMLStreamException
{
mTokenState = TOKEN_FULL_SINGLE; // we'll read it all
/* Ok; here we can basically have 2 modes; first the big loop to
* gather all data up until a ']'; and then another loop to see
* if ']' is part of ']]>', and after this if no end marker found,
* go back to the first part.
*/
char c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextChar(SUFFIX_IN_CDATA);
int count = 0;
main_loop:
while (true) {
int start = mInputPtr-1;
quick_loop:
while (true) {
if (c > CHAR_CR_LF_OR_NULL) {
if (c == ']') {
break quick_loop;
}
} else {
if (c < CHAR_SPACE) {
if (c == '\n') {
markLF();
} else if (c == '\r') {
char d;
if (mInputPtr >= mInputEnd) {
/* If we can't peek easily, let's flush past stuff
* and load more... (have to flush, since new read
* will overwrite inbut buffers)
*/
int len = mInputPtr - start;
if (len > 0) {
w.write(mInputBuffer, start, len);
count += len;
}
d = getNextChar(SUFFIX_IN_CDATA);
start = mInputPtr; // to mark 'no past content'
} else {
d = mInputBuffer[mInputPtr++];
}
if (d == '\n') {
if (mNormalizeLFs) {
/* Let's flush content prior to 2-char LF, and
* start the new segment on the second char...
* this way, no mods are needed for the buffer,
* AND it'll also work on split 2-char lf!
*/
int len = mInputPtr - 2 - start;
if (len > 0) {
w.write(mInputBuffer, start, len);
count += len;
}
start = mInputPtr-1; // so '\n' is the first char
} else {
// otherwise it's good as is
}
} else { // not 2-char... need to replace?
--mInputPtr;
if (mNormalizeLFs) {
mInputBuffer[mInputPtr-1] = '\n';
}
}
markLF();
} else if (c != '\t') {
throwInvalidSpace(c);
}
}
}
// Reached the end of buffer? Need to flush, then
if (mInputPtr >= mInputEnd) {
int len = mInputPtr - start;
if (len > 0) {
w.write(mInputBuffer, start, len);
count += len;
}
start = 0;
c = getNextChar(SUFFIX_IN_CDATA);
} else {
c = mInputBuffer[mInputPtr++];
}
} // while (true)
// Anything to flush once we hit ']'?
{
/* -1 since the last char in there (a '[') is NOT to be
* output at this point
*/
int len = mInputPtr - start - 1;
if (len > 0) {
w.write(mInputBuffer, start, len);
count += len;
}
}
/* Ok; we only get this far when we hit a ']'. We got one,
* so let's see if we can find at least one more bracket,
* immediately followed by '>'...
*/
int bracketCount = 0;
do {
++bracketCount;
c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
: getNextCharFromCurrent(SUFFIX_IN_CDATA);
} while (c == ']');
boolean match = (bracketCount >= 2 && c == '>');
if (match) {
bracketCount -= 2;
}
while (bracketCount > 0) {
--bracketCount;
w.write(']');
++count;
}
if (match) {
break main_loop;
}
/* Otherwise we'll just loop; now c is properly set to be
* the next char as well.
*/
} // while (true)
return count;
} }
|
public class class_name {
private int readAndWriteCData(Writer w)
throws IOException, XMLStreamException
{
mTokenState = TOKEN_FULL_SINGLE; // we'll read it all
/* Ok; here we can basically have 2 modes; first the big loop to
* gather all data up until a ']'; and then another loop to see
* if ']' is part of ']]>', and after this if no end marker found,
* go back to the first part.
*/
char c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextChar(SUFFIX_IN_CDATA);
int count = 0;
main_loop:
while (true) {
int start = mInputPtr-1;
quick_loop:
while (true) {
if (c > CHAR_CR_LF_OR_NULL) {
if (c == ']') {
break quick_loop;
}
} else {
if (c < CHAR_SPACE) {
if (c == '\n') {
markLF(); // depends on control dependency: [if], data = [none]
} else if (c == '\r') {
char d;
if (mInputPtr >= mInputEnd) {
/* If we can't peek easily, let's flush past stuff
* and load more... (have to flush, since new read
* will overwrite inbut buffers)
*/
int len = mInputPtr - start;
if (len > 0) {
w.write(mInputBuffer, start, len); // depends on control dependency: [if], data = [none]
count += len; // depends on control dependency: [if], data = [none]
}
d = getNextChar(SUFFIX_IN_CDATA); // depends on control dependency: [if], data = [none]
start = mInputPtr; // to mark 'no past content' // depends on control dependency: [if], data = [none]
} else {
d = mInputBuffer[mInputPtr++]; // depends on control dependency: [if], data = [none]
}
if (d == '\n') {
if (mNormalizeLFs) {
/* Let's flush content prior to 2-char LF, and
* start the new segment on the second char...
* this way, no mods are needed for the buffer,
* AND it'll also work on split 2-char lf!
*/
int len = mInputPtr - 2 - start;
if (len > 0) {
w.write(mInputBuffer, start, len); // depends on control dependency: [if], data = [none]
count += len; // depends on control dependency: [if], data = [none]
}
start = mInputPtr-1; // so '\n' is the first char // depends on control dependency: [if], data = [none]
} else {
// otherwise it's good as is
}
} else { // not 2-char... need to replace?
--mInputPtr; // depends on control dependency: [if], data = [none]
if (mNormalizeLFs) {
mInputBuffer[mInputPtr-1] = '\n'; // depends on control dependency: [if], data = [none]
}
}
markLF(); // depends on control dependency: [if], data = [none]
} else if (c != '\t') {
throwInvalidSpace(c); // depends on control dependency: [if], data = [(c]
}
}
}
// Reached the end of buffer? Need to flush, then
if (mInputPtr >= mInputEnd) {
int len = mInputPtr - start;
if (len > 0) {
w.write(mInputBuffer, start, len); // depends on control dependency: [if], data = [none]
count += len; // depends on control dependency: [if], data = [none]
}
start = 0; // depends on control dependency: [if], data = [none]
c = getNextChar(SUFFIX_IN_CDATA); // depends on control dependency: [if], data = [none]
} else {
c = mInputBuffer[mInputPtr++]; // depends on control dependency: [if], data = [none]
}
} // while (true)
// Anything to flush once we hit ']'?
{
/* -1 since the last char in there (a '[') is NOT to be
* output at this point
*/
int len = mInputPtr - start - 1;
if (len > 0) {
w.write(mInputBuffer, start, len); // depends on control dependency: [if], data = [none]
count += len; // depends on control dependency: [if], data = [none]
}
}
/* Ok; we only get this far when we hit a ']'. We got one,
* so let's see if we can find at least one more bracket,
* immediately followed by '>'...
*/
int bracketCount = 0;
do {
++bracketCount;
c = (mInputPtr < mInputEnd) ? mInputBuffer[mInputPtr++]
: getNextCharFromCurrent(SUFFIX_IN_CDATA);
} while (c == ']');
boolean match = (bracketCount >= 2 && c == '>');
if (match) {
bracketCount -= 2; // depends on control dependency: [if], data = [none]
}
while (bracketCount > 0) {
--bracketCount; // depends on control dependency: [while], data = [none]
w.write(']'); // depends on control dependency: [while], data = [none]
++count; // depends on control dependency: [while], data = [none]
}
if (match) {
break main_loop;
}
/* Otherwise we'll just loop; now c is properly set to be
* the next char as well.
*/
} // while (true)
return count;
} }
|
public class class_name {
public static void deleteAllMeta(DbConn cnx, boolean force)
{
if (force)
{
deleteAllTransac(cnx);
}
cnx.runUpdate("globalprm_delete_all");
cnx.runUpdate("dp_delete_all");
cnx.runUpdate("sjprm_delete_all");
cnx.runUpdate("sj_delete_all");
cnx.runUpdate("jdprm_delete_all");
cnx.runUpdate("node_delete_all");
cnx.runUpdate("jd_delete_all");
cnx.runUpdate("q_delete_all");
cnx.runUpdate("jndiprm_delete_all");
cnx.runUpdate("jndi_delete_all");
cnx.runUpdate("pki_delete_all"); // No corresponding DTO.
cnx.runUpdate("perm_delete_all");
cnx.runUpdate("role_delete_all");
cnx.runUpdate("user_delete_all");
} }
|
public class class_name {
public static void deleteAllMeta(DbConn cnx, boolean force)
{
if (force)
{
deleteAllTransac(cnx); // depends on control dependency: [if], data = [none]
}
cnx.runUpdate("globalprm_delete_all");
cnx.runUpdate("dp_delete_all");
cnx.runUpdate("sjprm_delete_all");
cnx.runUpdate("sj_delete_all");
cnx.runUpdate("jdprm_delete_all");
cnx.runUpdate("node_delete_all");
cnx.runUpdate("jd_delete_all");
cnx.runUpdate("q_delete_all");
cnx.runUpdate("jndiprm_delete_all");
cnx.runUpdate("jndi_delete_all");
cnx.runUpdate("pki_delete_all"); // No corresponding DTO.
cnx.runUpdate("perm_delete_all");
cnx.runUpdate("role_delete_all");
cnx.runUpdate("user_delete_all");
} }
|
public class class_name {
static final String createTag(final String name) {
if (name.length() <= MAX_TAG_LEN) {
return name;
}
final char[] tag = name.toCharArray();
final int arrayLen = tag.length;
int len = 0;
int mark = 0;
for (int i = 0; i < arrayLen; i++, len++) {
if (tag[i] == '.') {
len = mark;
if (tag[len] != '.') {
len++;
}
mark = len;
if (i + 1 < arrayLen && tag[i + 1] != '.') {
mark++;
}
}
tag[len] = tag[i];
}
if (len > MAX_TAG_LEN) {
int i = 0;
mark--;
for (int j = 0; j < len; j++) {
if (tag[j] == '.' && ((j != mark) || (i >= MAX_TAG_LEN - 1))) {
continue;
}
tag[i++] = tag[j];
}
len = i;
if (len > MAX_TAG_LEN) {
len = MAX_TAG_LEN;
}
}
return new String(tag, 0, len);
} }
|
public class class_name {
static final String createTag(final String name) {
if (name.length() <= MAX_TAG_LEN) {
return name; // depends on control dependency: [if], data = [none]
}
final char[] tag = name.toCharArray();
final int arrayLen = tag.length;
int len = 0;
int mark = 0;
for (int i = 0; i < arrayLen; i++, len++) {
if (tag[i] == '.') {
len = mark; // depends on control dependency: [if], data = [none]
if (tag[len] != '.') {
len++; // depends on control dependency: [if], data = [none]
}
mark = len; // depends on control dependency: [if], data = [none]
if (i + 1 < arrayLen && tag[i + 1] != '.') {
mark++; // depends on control dependency: [if], data = [none]
}
}
tag[len] = tag[i]; // depends on control dependency: [for], data = [i]
}
if (len > MAX_TAG_LEN) {
int i = 0;
mark--; // depends on control dependency: [if], data = [none]
for (int j = 0; j < len; j++) {
if (tag[j] == '.' && ((j != mark) || (i >= MAX_TAG_LEN - 1))) {
continue;
}
tag[i++] = tag[j]; // depends on control dependency: [for], data = [j]
}
len = i; // depends on control dependency: [if], data = [none]
if (len > MAX_TAG_LEN) {
len = MAX_TAG_LEN; // depends on control dependency: [if], data = [none]
}
}
return new String(tag, 0, len);
} }
|
public class class_name {
private long[] getUsersListMembers(String[] tUserlists) {
logger.debug("Fetching user id of given lists");
List<Long> listUserIdToFollow = new ArrayList<Long>();
Configuration cb = buildTwitterConfiguration();
Twitter twitterImpl = new TwitterFactory(cb).getInstance();
//For each list given in parameter
for (String listId : tUserlists) {
logger.debug("Adding users of list {} ",listId);
String[] splitListId = listId.split("/");
try {
long cursor = -1;
PagableResponseList<User> itUserListMembers;
do {
itUserListMembers = twitterImpl.getUserListMembers(splitListId[0], splitListId[1], cursor);
for (User member : itUserListMembers) {
long userId = member.getId();
listUserIdToFollow.add(userId);
}
} while ((cursor = itUserListMembers.getNextCursor()) != 0);
} catch (TwitterException te) {
logger.error("Failed to get list members for : {}", listId, te);
}
}
//Just casting from Long to long
long ret[] = new long[listUserIdToFollow.size()];
int pos = 0;
for (Long userId : listUserIdToFollow) {
ret[pos] = userId;
pos++;
}
return ret;
} }
|
public class class_name {
private long[] getUsersListMembers(String[] tUserlists) {
logger.debug("Fetching user id of given lists");
List<Long> listUserIdToFollow = new ArrayList<Long>();
Configuration cb = buildTwitterConfiguration();
Twitter twitterImpl = new TwitterFactory(cb).getInstance();
//For each list given in parameter
for (String listId : tUserlists) {
logger.debug("Adding users of list {} ",listId); // depends on control dependency: [for], data = [listId]
String[] splitListId = listId.split("/");
try {
long cursor = -1;
PagableResponseList<User> itUserListMembers;
do {
itUserListMembers = twitterImpl.getUserListMembers(splitListId[0], splitListId[1], cursor);
for (User member : itUserListMembers) {
long userId = member.getId();
listUserIdToFollow.add(userId); // depends on control dependency: [for], data = [none]
}
} while ((cursor = itUserListMembers.getNextCursor()) != 0);
} catch (TwitterException te) {
logger.error("Failed to get list members for : {}", listId, te);
} // depends on control dependency: [catch], data = [none]
}
//Just casting from Long to long
long ret[] = new long[listUserIdToFollow.size()];
int pos = 0;
for (Long userId : listUserIdToFollow) {
ret[pos] = userId; // depends on control dependency: [for], data = [userId]
pos++; // depends on control dependency: [for], data = [none]
}
return ret;
} }
|
public class class_name {
public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixThreadPoolKey threadPoolKey, HystrixCommandProperties properties) {
// attempt to retrieve from cache first
HystrixCommandMetrics commandMetrics = metrics.get(key.name());
if (commandMetrics != null) {
return commandMetrics;
} else {
synchronized (HystrixCommandMetrics.class) {
HystrixCommandMetrics existingMetrics = metrics.get(key.name());
if (existingMetrics != null) {
return existingMetrics;
} else {
HystrixThreadPoolKey nonNullThreadPoolKey;
if (threadPoolKey == null) {
nonNullThreadPoolKey = HystrixThreadPoolKey.Factory.asKey(commandGroup.name());
} else {
nonNullThreadPoolKey = threadPoolKey;
}
HystrixCommandMetrics newCommandMetrics = new HystrixCommandMetrics(key, commandGroup, nonNullThreadPoolKey, properties, HystrixPlugins.getInstance().getEventNotifier());
metrics.putIfAbsent(key.name(), newCommandMetrics);
return newCommandMetrics;
}
}
}
} }
|
public class class_name {
public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixThreadPoolKey threadPoolKey, HystrixCommandProperties properties) {
// attempt to retrieve from cache first
HystrixCommandMetrics commandMetrics = metrics.get(key.name());
if (commandMetrics != null) {
return commandMetrics; // depends on control dependency: [if], data = [none]
} else {
synchronized (HystrixCommandMetrics.class) { // depends on control dependency: [if], data = [none]
HystrixCommandMetrics existingMetrics = metrics.get(key.name());
if (existingMetrics != null) {
return existingMetrics; // depends on control dependency: [if], data = [none]
} else {
HystrixThreadPoolKey nonNullThreadPoolKey;
if (threadPoolKey == null) {
nonNullThreadPoolKey = HystrixThreadPoolKey.Factory.asKey(commandGroup.name()); // depends on control dependency: [if], data = [none]
} else {
nonNullThreadPoolKey = threadPoolKey; // depends on control dependency: [if], data = [none]
}
HystrixCommandMetrics newCommandMetrics = new HystrixCommandMetrics(key, commandGroup, nonNullThreadPoolKey, properties, HystrixPlugins.getInstance().getEventNotifier());
metrics.putIfAbsent(key.name(), newCommandMetrics); // depends on control dependency: [if], data = [none]
return newCommandMetrics; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private void addVertex(String data)
{
String coords[] = data.split("\\s+");
float x = 0;
float y = 0;
float z = 0;
if (coords.length != 3)
{
MalisisCore.log.error("[ObjFileImporter] Wrong coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine);
}
else
{
x = Float.parseFloat(coords[0]);
y = Float.parseFloat(coords[1]);
z = Float.parseFloat(coords[2]);
}
vertexes.add(new Vertex(x, y, z));
} }
|
public class class_name {
private void addVertex(String data)
{
String coords[] = data.split("\\s+");
float x = 0;
float y = 0;
float z = 0;
if (coords.length != 3)
{
MalisisCore.log.error("[ObjFileImporter] Wrong coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine); // depends on control dependency: [if], data = [none]
}
else
{
x = Float.parseFloat(coords[0]); // depends on control dependency: [if], data = [none]
y = Float.parseFloat(coords[1]); // depends on control dependency: [if], data = [none]
z = Float.parseFloat(coords[2]); // depends on control dependency: [if], data = [none]
}
vertexes.add(new Vertex(x, y, z));
} }
|
public class class_name {
public void reverse() {
int[] newBits = new int[bits.length];
// reverse all int's first
int len = (size - 1) / 32;
int oldBitsLen = len + 1;
for (int i = 0; i < oldBitsLen; i++) {
long x = bits[i];
x = ((x >> 1) & 0x55555555L) | ((x & 0x55555555L) << 1);
x = ((x >> 2) & 0x33333333L) | ((x & 0x33333333L) << 2);
x = ((x >> 4) & 0x0f0f0f0fL) | ((x & 0x0f0f0f0fL) << 4);
x = ((x >> 8) & 0x00ff00ffL) | ((x & 0x00ff00ffL) << 8);
x = ((x >> 16) & 0x0000ffffL) | ((x & 0x0000ffffL) << 16);
newBits[len - i] = (int) x;
}
// now correct the int's if the bit size isn't a multiple of 32
if (size != oldBitsLen * 32) {
int leftOffset = oldBitsLen * 32 - size;
int currentInt = newBits[0] >>> leftOffset;
for (int i = 1; i < oldBitsLen; i++) {
int nextInt = newBits[i];
currentInt |= nextInt << (32 - leftOffset);
newBits[i - 1] = currentInt;
currentInt = nextInt >>> leftOffset;
}
newBits[oldBitsLen - 1] = currentInt;
}
bits = newBits;
} }
|
public class class_name {
public void reverse() {
int[] newBits = new int[bits.length];
// reverse all int's first
int len = (size - 1) / 32;
int oldBitsLen = len + 1;
for (int i = 0; i < oldBitsLen; i++) {
long x = bits[i];
x = ((x >> 1) & 0x55555555L) | ((x & 0x55555555L) << 1); // depends on control dependency: [for], data = [none]
x = ((x >> 2) & 0x33333333L) | ((x & 0x33333333L) << 2); // depends on control dependency: [for], data = [none]
x = ((x >> 4) & 0x0f0f0f0fL) | ((x & 0x0f0f0f0fL) << 4); // depends on control dependency: [for], data = [none]
x = ((x >> 8) & 0x00ff00ffL) | ((x & 0x00ff00ffL) << 8); // depends on control dependency: [for], data = [none]
x = ((x >> 16) & 0x0000ffffL) | ((x & 0x0000ffffL) << 16); // depends on control dependency: [for], data = [none]
newBits[len - i] = (int) x; // depends on control dependency: [for], data = [i]
}
// now correct the int's if the bit size isn't a multiple of 32
if (size != oldBitsLen * 32) {
int leftOffset = oldBitsLen * 32 - size;
int currentInt = newBits[0] >>> leftOffset;
for (int i = 1; i < oldBitsLen; i++) {
int nextInt = newBits[i];
currentInt |= nextInt << (32 - leftOffset); // depends on control dependency: [for], data = [none]
newBits[i - 1] = currentInt; // depends on control dependency: [for], data = [i]
currentInt = nextInt >>> leftOffset; // depends on control dependency: [for], data = [none]
}
newBits[oldBitsLen - 1] = currentInt; // depends on control dependency: [if], data = [none]
}
bits = newBits;
} }
|
public class class_name {
public int set(int value)
{
String prevValue = setString(Integer.toString(limit(value)));
if (prevValue == null) {
prevValue = getDefaultValue();
if (prevValue == null) {
return noValue();
}
}
int v = Integer.parseInt(prevValue);
return limit(v);
} }
|
public class class_name {
public int set(int value)
{
String prevValue = setString(Integer.toString(limit(value)));
if (prevValue == null) {
prevValue = getDefaultValue(); // depends on control dependency: [if], data = [none]
if (prevValue == null) {
return noValue(); // depends on control dependency: [if], data = [none]
}
}
int v = Integer.parseInt(prevValue);
return limit(v);
} }
|
public class class_name {
public void setIpAddresses(java.util.Collection<IpAddressResponse> ipAddresses) {
if (ipAddresses == null) {
this.ipAddresses = null;
return;
}
this.ipAddresses = new java.util.ArrayList<IpAddressResponse>(ipAddresses);
} }
|
public class class_name {
public void setIpAddresses(java.util.Collection<IpAddressResponse> ipAddresses) {
if (ipAddresses == null) {
this.ipAddresses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.ipAddresses = new java.util.ArrayList<IpAddressResponse>(ipAddresses);
} }
|
public class class_name {
public DroolsLineBreakpoint getDroolsBreakpoint(String source) {
if ( source == null ) {
return null;
}
Iterator<IBreakpoint> iterator = getBreakpoints().iterator();
while ( iterator.hasNext() ) {
IJavaBreakpoint element = (IJavaBreakpoint) iterator.next();
if ( element instanceof DroolsLineBreakpoint && ((DroolsLineBreakpoint) element).getDialectName().equals( "mvel" ) ) {
DroolsLineBreakpoint l = (DroolsLineBreakpoint) element;
try {
int matchLine = l.getLineNumber();
String matchSource = l.getRuleName();
if ( source.equals( matchSource ) || l.getFileRuleMappings().containsKey( source ) ) {
return l;
}
} catch ( CoreException e ) {
logError( e );
}
}
}
return null;
} }
|
public class class_name {
public DroolsLineBreakpoint getDroolsBreakpoint(String source) {
if ( source == null ) {
return null; // depends on control dependency: [if], data = [none]
}
Iterator<IBreakpoint> iterator = getBreakpoints().iterator();
while ( iterator.hasNext() ) {
IJavaBreakpoint element = (IJavaBreakpoint) iterator.next();
if ( element instanceof DroolsLineBreakpoint && ((DroolsLineBreakpoint) element).getDialectName().equals( "mvel" ) ) {
DroolsLineBreakpoint l = (DroolsLineBreakpoint) element;
try {
int matchLine = l.getLineNumber();
String matchSource = l.getRuleName();
if ( source.equals( matchSource ) || l.getFileRuleMappings().containsKey( source ) ) {
return l; // depends on control dependency: [if], data = [none]
}
} catch ( CoreException e ) {
logError( e );
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} }
|
public class class_name {
@Override
public void endArray()
{
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
if (p == PEEKED_END_ARRAY) {
stackSize--;
peeked = PEEKED_NONE;
} else {
throw new IllegalStateException("Expected END_ARRAY but was " + peek()
+ " at line " + getLineNumber() + " column " + getColumnNumber());
}
} }
|
public class class_name {
@Override
public void endArray()
{
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek(); // depends on control dependency: [if], data = [none]
}
if (p == PEEKED_END_ARRAY) {
stackSize--; // depends on control dependency: [if], data = [none]
peeked = PEEKED_NONE; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("Expected END_ARRAY but was " + peek()
+ " at line " + getLineNumber() + " column " + getColumnNumber());
}
} }
|
public class class_name {
private Set<Map.Entry<Object,Double>> entrySet(Set<Map.Entry<Object,Double>> s, Object[] key, boolean useLists) {
if (depth == 1) {
//System.out.println("key is long enough to add to set");
Set<K> keys = map.keySet();
for (K finalKey: keys) {
// array doesn't escape
K[] newKey = ErasureUtils.<K>mkTArray(Object.class,key.length + 1);
if (key.length > 0) {
System.arraycopy(key, 0, newKey, 0, key.length);
}
newKey[key.length] = finalKey;
MutableDouble value = (MutableDouble) map.get(finalKey);
Double value1 = new Double(value.doubleValue());
if (useLists) {
s.add(new Entry<Object,Double>(Arrays.asList(newKey), value1));
} else {
s.add(new Entry<Object,Double>(newKey[0], value1));
}
}
} else {
Set<K> keys = map.keySet();
//System.out.println("key length " + key.length);
//System.out.println("keyset level " + depth + " " + keys);
for (K o: keys) {
Object[] newKey = new Object[key.length + 1];
if (key.length > 0) {
System.arraycopy(key, 0, newKey, 0, key.length);
}
newKey[key.length] = o;
//System.out.println("level " + key.length + " current key " + Arrays.asList(newKey));
conditionalizeHelper(o).entrySet(s, newKey, true);
}
}
//System.out.println("leaving key length " + key.length);
return s;
} }
|
public class class_name {
private Set<Map.Entry<Object,Double>> entrySet(Set<Map.Entry<Object,Double>> s, Object[] key, boolean useLists) {
if (depth == 1) {
//System.out.println("key is long enough to add to set");
Set<K> keys = map.keySet();
for (K finalKey: keys) {
// array doesn't escape
K[] newKey = ErasureUtils.<K>mkTArray(Object.class,key.length + 1);
if (key.length > 0) {
System.arraycopy(key, 0, newKey, 0, key.length);
// depends on control dependency: [if], data = [none]
}
newKey[key.length] = finalKey;
// depends on control dependency: [for], data = [finalKey]
MutableDouble value = (MutableDouble) map.get(finalKey);
Double value1 = new Double(value.doubleValue());
if (useLists) {
s.add(new Entry<Object,Double>(Arrays.asList(newKey), value1));
// depends on control dependency: [if], data = [none]
} else {
s.add(new Entry<Object,Double>(newKey[0], value1));
// depends on control dependency: [if], data = [none]
}
}
} else {
Set<K> keys = map.keySet();
//System.out.println("key length " + key.length);
//System.out.println("keyset level " + depth + " " + keys);
for (K o: keys) {
Object[] newKey = new Object[key.length + 1];
if (key.length > 0) {
System.arraycopy(key, 0, newKey, 0, key.length);
// depends on control dependency: [if], data = [none]
}
newKey[key.length] = o;
// depends on control dependency: [for], data = [o]
//System.out.println("level " + key.length + " current key " + Arrays.asList(newKey));
conditionalizeHelper(o).entrySet(s, newKey, true);
// depends on control dependency: [for], data = [o]
}
}
//System.out.println("leaving key length " + key.length);
return s;
} }
|
public class class_name {
public static ObjectReference getObjectRefByPath(final String path) {
if (path == null) {
return null;
}
return new ObjectReference().withSelector(path);
} }
|
public class class_name {
public static ObjectReference getObjectRefByPath(final String path) {
if (path == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new ObjectReference().withSelector(path);
} }
|
public class class_name {
List<Cookie> getCookies(String domain) {
cookieManager.removeExpiredCookie();
String cookies = cookieManager.getCookie(domain);
List<Cookie> result = new LinkedList<Cookie>();
if (cookies == null) {
return result;
}
for (String cookie : cookies.split(COOKIE_SEPARATOR)) {
String[] cookieValues = cookie.split("=",2);
if (cookieValues.length >= 2) {
result.add(new Cookie(cookieValues[0].trim(), cookieValues[1], domain, null, null));
}
}
return result;
} }
|
public class class_name {
List<Cookie> getCookies(String domain) {
cookieManager.removeExpiredCookie();
String cookies = cookieManager.getCookie(domain);
List<Cookie> result = new LinkedList<Cookie>();
if (cookies == null) {
return result; // depends on control dependency: [if], data = [none]
}
for (String cookie : cookies.split(COOKIE_SEPARATOR)) {
String[] cookieValues = cookie.split("=",2);
if (cookieValues.length >= 2) {
result.add(new Cookie(cookieValues[0].trim(), cookieValues[1], domain, null, null)); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
@Override
public int getType(int columnIndex) {
int type;
try {
int resultSetMetadataType = resultSet.getMetaData().getColumnType(
resultIndexToResultSetIndex(columnIndex));
type = resultSetTypeToSqlLite(resultSetMetadataType);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get column type for column index: "
+ columnIndex, e);
}
return type;
} }
|
public class class_name {
@Override
public int getType(int columnIndex) {
int type;
try {
int resultSetMetadataType = resultSet.getMetaData().getColumnType(
resultIndexToResultSetIndex(columnIndex));
type = resultSetTypeToSqlLite(resultSetMetadataType); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get column type for column index: "
+ columnIndex, e);
} // depends on control dependency: [catch], data = [none]
return type;
} }
|
public class class_name {
public String getNavText() {
String navText = "";
try {
navText = getCms().readPropertyObject(
getCms().getSitePath(m_resource),
CmsPropertyDefinition.PROPERTY_NAVTEXT,
false).getValue();
} catch (Throwable e) {
String storedSiteRoot = getCms().getRequestContext().getSiteRoot();
try {
getCms().getRequestContext().setSiteRoot("");
navText = getCms().readPropertyObject(
m_resource.getRootPath(),
CmsPropertyDefinition.PROPERTY_NAVTEXT,
false).getValue();
} catch (Exception e1) {
// should usually never happen
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
} finally {
getCms().getRequestContext().setSiteRoot(storedSiteRoot);
}
}
if (navText == null) {
navText = "";
}
return navText;
} }
|
public class class_name {
public String getNavText() {
String navText = "";
try {
navText = getCms().readPropertyObject(
getCms().getSitePath(m_resource),
CmsPropertyDefinition.PROPERTY_NAVTEXT,
false).getValue(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
String storedSiteRoot = getCms().getRequestContext().getSiteRoot();
try {
getCms().getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none]
navText = getCms().readPropertyObject(
m_resource.getRootPath(),
CmsPropertyDefinition.PROPERTY_NAVTEXT,
false).getValue(); // depends on control dependency: [try], data = [none]
} catch (Exception e1) {
// should usually never happen
if (LOG.isInfoEnabled()) {
LOG.info(e); // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
getCms().getRequestContext().setSiteRoot(storedSiteRoot);
}
} // depends on control dependency: [catch], data = [none]
if (navText == null) {
navText = ""; // depends on control dependency: [if], data = [none]
}
return navText;
} }
|
public class class_name {
public boolean replace(final TransportRequest request, boolean retainMode, String... replacements) {
return getOrReplaceAllIndices(request, new IndicesProvider() {
@Override
public String[] provide(String[] original, Object request, boolean supportsReplace) {
if(supportsReplace) {
if(retainMode && !isAllWithNoRemote(original)) {
final Resolved resolved = resolveRequest(request);
final List<String> retained = WildcardMatcher.getMatchAny(resolved.getAllIndices(), replacements);
retained.addAll(resolved.getRemoteIndices());
return retained.toArray(new String[0]);
}
return replacements;
} else {
return NOOP;
}
}
}, false);
} }
|
public class class_name {
public boolean replace(final TransportRequest request, boolean retainMode, String... replacements) {
return getOrReplaceAllIndices(request, new IndicesProvider() {
@Override
public String[] provide(String[] original, Object request, boolean supportsReplace) {
if(supportsReplace) {
if(retainMode && !isAllWithNoRemote(original)) {
final Resolved resolved = resolveRequest(request);
final List<String> retained = WildcardMatcher.getMatchAny(resolved.getAllIndices(), replacements);
retained.addAll(resolved.getRemoteIndices()); // depends on control dependency: [if], data = [none]
return retained.toArray(new String[0]); // depends on control dependency: [if], data = [none]
}
return replacements; // depends on control dependency: [if], data = [none]
} else {
return NOOP; // depends on control dependency: [if], data = [none]
}
}
}, false);
} }
|
public class class_name {
@Override
protected void checkForTimeouts() {
// See if anything may have timed out
if (currentTime < nextTimeoutTime) {
return;
}
Set<SelectionKey> selectorKeys = selector.keys();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "checkForTimeouts - checking " + selectorKeys.size() + " keys for timeouts");
}
if (selectorKeys.isEmpty()) {
// if this isn't the primary (first) selector, see if it should be closed
if (countIndex != 0) {
// if we have already been waiting, and still no keys, and this isn't
// the primary
// selector, we should close this selector/thread
if (waitingToQuit) {
quit = true;
} else {
wqm.updateCount(countIndex, WorkQueueManager.CS_DELETE_IN_PROGRESS, channelType);
waitingToQuit = true;
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorWaitToTerminate();
}
} else {
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorIdleTimeout();
}
} else {
waitingToQuit = false;
// go through requests, timing out those that need it, and calculating new
// timeout
// set nexttimeouttime to whatever the selectoridletimeout is, and work
// back from there
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorIdleTimeout();
for (SelectionKey key : selectorKeys) {
try {
if (0 == key.interestOps()) {
// not active
continue;
}
// only consider keys that are currently waiting for connect
ConnectInfo ci = (ConnectInfo) key.attachment();
if (ci.timeout != TCPConnectRequestContext.NO_TIMEOUT) {
if (ci.nextTimeoutTime <= currentTime) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Inactivity timeout on connect operation for channel" + ci.ioSocket.getChannel());
}
// create timeout exception to pass to callback error method
// Add local and remote address information
InetSocketAddress iaRemote = ci.remoteAddress;
InetSocketAddress iaLocal = ci.localAddress;
IOException e = new SocketTimeoutException("Socket operation timed out before it could be completed. local=" + iaLocal + " remote=" + iaRemote);
// Hand off to another thread
ci.setError(e);
if (wqm.dispatchConnect(ci)) {
// unable to dispatch error, handle now
key.cancel();
ci.ioSocket.close();
}
} else {
// see if we should timeout sooner than our current setting
if (ci.nextTimeoutTime < nextTimeoutTime) {
nextTimeoutTime = ci.nextTimeoutTime;
}
}
}
} catch (CancelledKeyException cke) {
// either we didn't get the key, or we already dispatched the
// error. In either case, there is nothing more to do
continue;
}
}
}
} }
|
public class class_name {
@Override
protected void checkForTimeouts() {
// See if anything may have timed out
if (currentTime < nextTimeoutTime) {
return; // depends on control dependency: [if], data = [none]
}
Set<SelectionKey> selectorKeys = selector.keys();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "checkForTimeouts - checking " + selectorKeys.size() + " keys for timeouts"); // depends on control dependency: [if], data = [none]
}
if (selectorKeys.isEmpty()) {
// if this isn't the primary (first) selector, see if it should be closed
if (countIndex != 0) {
// if we have already been waiting, and still no keys, and this isn't
// the primary
// selector, we should close this selector/thread
if (waitingToQuit) {
quit = true; // depends on control dependency: [if], data = [none]
} else {
wqm.updateCount(countIndex, WorkQueueManager.CS_DELETE_IN_PROGRESS, channelType); // depends on control dependency: [if], data = [none]
waitingToQuit = true; // depends on control dependency: [if], data = [none]
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorWaitToTerminate(); // depends on control dependency: [if], data = [none]
}
} else {
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorIdleTimeout(); // depends on control dependency: [if], data = [none]
}
} else {
waitingToQuit = false; // depends on control dependency: [if], data = [none]
// go through requests, timing out those that need it, and calculating new
// timeout
// set nexttimeouttime to whatever the selectoridletimeout is, and work
// back from there
nextTimeoutTime = currentTime + TCPFactoryConfiguration.getChannelSelectorIdleTimeout(); // depends on control dependency: [if], data = [none]
for (SelectionKey key : selectorKeys) {
try {
if (0 == key.interestOps()) {
// not active
continue;
}
// only consider keys that are currently waiting for connect
ConnectInfo ci = (ConnectInfo) key.attachment();
if (ci.timeout != TCPConnectRequestContext.NO_TIMEOUT) {
if (ci.nextTimeoutTime <= currentTime) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(this, tc, "Inactivity timeout on connect operation for channel" + ci.ioSocket.getChannel()); // depends on control dependency: [if], data = [none]
}
// create timeout exception to pass to callback error method
// Add local and remote address information
InetSocketAddress iaRemote = ci.remoteAddress;
InetSocketAddress iaLocal = ci.localAddress;
IOException e = new SocketTimeoutException("Socket operation timed out before it could be completed. local=" + iaLocal + " remote=" + iaRemote);
// Hand off to another thread
ci.setError(e); // depends on control dependency: [if], data = [none]
if (wqm.dispatchConnect(ci)) {
// unable to dispatch error, handle now
key.cancel(); // depends on control dependency: [if], data = [none]
ci.ioSocket.close(); // depends on control dependency: [if], data = [none]
}
} else {
// see if we should timeout sooner than our current setting
if (ci.nextTimeoutTime < nextTimeoutTime) {
nextTimeoutTime = ci.nextTimeoutTime; // depends on control dependency: [if], data = [none]
}
}
}
} catch (CancelledKeyException cke) {
// either we didn't get the key, or we already dispatched the
// error. In either case, there is nothing more to do
continue;
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public Date setEndDate(Date time)
{
try {
this.getTable().edit();
this.getField("EndDateTime").setData(time);
this.getTable().set(this);
this.getTable().seek(null); // Read this record
} catch (Exception ex) {
ex.printStackTrace();
}
return this.getEndDate();
} }
|
public class class_name {
public Date setEndDate(Date time)
{
try {
this.getTable().edit(); // depends on control dependency: [try], data = [none]
this.getField("EndDateTime").setData(time); // depends on control dependency: [try], data = [none]
this.getTable().set(this); // depends on control dependency: [try], data = [none]
this.getTable().seek(null); // Read this record // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return this.getEndDate();
} }
|
public class class_name {
public HttpResponse doAction(HttpRequest request, String form, HttpMethod method)
throws ClientException, ServerException {
request.validate();
// try refresh credentials if CredentialProvider set
this.config.refreshCredentials();
try {
int retryTimes = 0;
HttpResponse response = null;
boolean httpInvoke = false;
if (request instanceof HttpInvokeFunctionRequest) {
httpInvoke = true;
}
do {
if (!httpInvoke
|| !ANONYMOUS.equals(((HttpInvokeFunctionRequest) request).getAuthType())) {
signRequest(request, form, method, httpInvoke);
}
PrepareUrl prepareUrl = prepareUrl(request.getPath(), request.getQueryParams());
response = HttpResponse.getResponse(prepareUrl.getUrl(), request, method,
config.getConnectTimeoutMillis(), config.getReadTimeoutMillis());
retryTimes++;
if (httpInvoke) {
return response;
}
} while (500 <= response.getStatus() && AUTO_RETRY && retryTimes < MAX_RETRIES);
if (response.getStatus() >= 500) {
String requestId = response.getHeader(HeaderKeys.REQUEST_ID);
String stringContent =
response.getContent() == null ? "" : new String(response.getContent());
ServerException se;
try {
se = new Gson().fromJson(stringContent, ServerException.class);
} catch (JsonParseException e) {
se = new ServerException("InternalServiceError",
"Failed to parse response content", requestId);
}
se.setStatusCode(response.getStatus());
se.setRequestId(requestId);
throw se;
} else if (response.getStatus() >= 300) {
ClientException ce;
if (response.getContent() == null) {
ce = new ClientException("SDK.ServerUnreachable",
"Failed to get response content from server");
} else {
try {
ce = new Gson()
.fromJson(new String(response.getContent()), ClientException.class);
} catch (JsonParseException e) {
ce = new ClientException("SDK.ResponseNotParsable",
"Failed to parse response content", e);
}
}
if (ce == null) {
ce = new ClientException("SDK.UnknownError", "Unknown client error");
}
ce.setStatusCode(response.getStatus());
ce.setRequestId(response.getHeader(HeaderKeys.REQUEST_ID));
throw ce;
}
return response;
} catch (InvalidKeyException exp) {
throw new ClientException("SDK.InvalidAccessSecret",
"Speicified access secret is not valid.");
} catch (SocketTimeoutException exp) {
throw new ClientException("SDK.ServerUnreachable",
"SocketTimeoutException has occurred on a socket read or accept.");
} catch (IOException exp) {
throw new ClientException("SDK.ServerUnreachable",
"Server unreachable: " + exp.toString());
} catch (NoSuchAlgorithmException exp) {
throw new ClientException("SDK.InvalidMD5Algorithm",
"MD5 hash is not supported by client side.");
} catch (URISyntaxException e) {
throw new ClientException("SDK.InvalidURL", "url is not valid: " + e.getMessage());
}
} }
|
public class class_name {
public HttpResponse doAction(HttpRequest request, String form, HttpMethod method)
throws ClientException, ServerException {
request.validate();
// try refresh credentials if CredentialProvider set
this.config.refreshCredentials();
try {
int retryTimes = 0;
HttpResponse response = null;
boolean httpInvoke = false;
if (request instanceof HttpInvokeFunctionRequest) {
httpInvoke = true; // depends on control dependency: [if], data = [none]
}
do {
if (!httpInvoke
|| !ANONYMOUS.equals(((HttpInvokeFunctionRequest) request).getAuthType())) {
signRequest(request, form, method, httpInvoke); // depends on control dependency: [if], data = [none]
}
PrepareUrl prepareUrl = prepareUrl(request.getPath(), request.getQueryParams());
response = HttpResponse.getResponse(prepareUrl.getUrl(), request, method,
config.getConnectTimeoutMillis(), config.getReadTimeoutMillis());
retryTimes++;
if (httpInvoke) {
return response; // depends on control dependency: [if], data = [none]
}
} while (500 <= response.getStatus() && AUTO_RETRY && retryTimes < MAX_RETRIES);
if (response.getStatus() >= 500) {
String requestId = response.getHeader(HeaderKeys.REQUEST_ID);
String stringContent =
response.getContent() == null ? "" : new String(response.getContent());
ServerException se;
try {
se = new Gson().fromJson(stringContent, ServerException.class); // depends on control dependency: [try], data = [none]
} catch (JsonParseException e) {
se = new ServerException("InternalServiceError",
"Failed to parse response content", requestId);
} // depends on control dependency: [catch], data = [none]
se.setStatusCode(response.getStatus()); // depends on control dependency: [if], data = [(response.getStatus()]
se.setRequestId(requestId); // depends on control dependency: [if], data = [none]
throw se;
} else if (response.getStatus() >= 300) {
ClientException ce;
if (response.getContent() == null) {
ce = new ClientException("SDK.ServerUnreachable",
"Failed to get response content from server"); // depends on control dependency: [if], data = [none]
} else {
try {
ce = new Gson()
.fromJson(new String(response.getContent()), ClientException.class); // depends on control dependency: [try], data = [none]
} catch (JsonParseException e) {
ce = new ClientException("SDK.ResponseNotParsable",
"Failed to parse response content", e);
} // depends on control dependency: [catch], data = [none]
}
if (ce == null) {
ce = new ClientException("SDK.UnknownError", "Unknown client error"); // depends on control dependency: [if], data = [none]
}
ce.setStatusCode(response.getStatus()); // depends on control dependency: [if], data = [(response.getStatus()]
ce.setRequestId(response.getHeader(HeaderKeys.REQUEST_ID)); // depends on control dependency: [if], data = [none]
throw ce;
}
return response;
} catch (InvalidKeyException exp) {
throw new ClientException("SDK.InvalidAccessSecret",
"Speicified access secret is not valid.");
} catch (SocketTimeoutException exp) {
throw new ClientException("SDK.ServerUnreachable",
"SocketTimeoutException has occurred on a socket read or accept.");
} catch (IOException exp) {
throw new ClientException("SDK.ServerUnreachable",
"Server unreachable: " + exp.toString());
} catch (NoSuchAlgorithmException exp) {
throw new ClientException("SDK.InvalidMD5Algorithm",
"MD5 hash is not supported by client side.");
} catch (URISyntaxException e) {
throw new ClientException("SDK.InvalidURL", "url is not valid: " + e.getMessage());
}
} }
|
public class class_name {
@Provides
@Singleton
@JFunkVersion
protected String providePerfLoadVersion() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream is = loader.getResourceAsStream("com/mgmtp/jfunk/common/version.txt");
try {
return IOUtils.toString(is, "UTF-8");
} catch (IOException ex) {
throw new IllegalStateException("Could not read jFunk version.", ex);
} finally {
IOUtils.closeQuietly(is);
}
} }
|
public class class_name {
@Provides
@Singleton
@JFunkVersion
protected String providePerfLoadVersion() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream is = loader.getResourceAsStream("com/mgmtp/jfunk/common/version.txt");
try {
return IOUtils.toString(is, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new IllegalStateException("Could not read jFunk version.", ex);
} finally { // depends on control dependency: [catch], data = [none]
IOUtils.closeQuietly(is);
}
} }
|
public class class_name {
public static ExceptionUtil getInstance() {
if (instance == null) {
synchronized (ExceptionUtilImpl.class) {
if (instance == null) {
instance = new ExceptionUtilImpl();
}
}
}
return instance;
} }
|
public class class_name {
public static ExceptionUtil getInstance() {
if (instance == null) {
synchronized (ExceptionUtilImpl.class) { // depends on control dependency: [if], data = [none]
if (instance == null) {
instance = new ExceptionUtilImpl(); // depends on control dependency: [if], data = [none]
}
}
}
return instance;
} }
|
public class class_name {
ParseTask parse(final String source) {
ParseTask pt = state.taskFactory.new ParseTask(source, false);
if (!pt.units().isEmpty()
&& pt.units().get(0).getKind() == Kind.EXPRESSION_STATEMENT
&& pt.getDiagnostics().hasOtherThanNotStatementErrors()) {
// It failed, it may be an expression being incorrectly
// parsed as having a leading type variable, example: a < b
// Try forcing interpretation as an expression
ParseTask ept = state.taskFactory.new ParseTask(source, true);
if (!ept.getDiagnostics().hasOtherThanNotStatementErrors()) {
return ept;
}
}
return pt;
} }
|
public class class_name {
ParseTask parse(final String source) {
ParseTask pt = state.taskFactory.new ParseTask(source, false);
if (!pt.units().isEmpty()
&& pt.units().get(0).getKind() == Kind.EXPRESSION_STATEMENT
&& pt.getDiagnostics().hasOtherThanNotStatementErrors()) {
// It failed, it may be an expression being incorrectly
// parsed as having a leading type variable, example: a < b
// Try forcing interpretation as an expression
ParseTask ept = state.taskFactory.new ParseTask(source, true);
if (!ept.getDiagnostics().hasOtherThanNotStatementErrors()) {
return ept; // depends on control dependency: [if], data = [none]
}
}
return pt;
} }
|
public class class_name {
public void addProvider(String name, MetricsProvider provider) {
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name);
}
container.put(name, provider);
} }
|
public class class_name {
public void addProvider(String name, MetricsProvider provider) {
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name); // depends on control dependency: [if], data = [none]
}
container.put(name, provider);
} }
|
public class class_name {
public ValidationResult append(
Collection<ValidationMessage<Origin>> messages) {
if (messages == null) {
return this;
}
for (ValidationMessage<Origin> message : messages) {
addMessage(message);
}
return this;
} }
|
public class class_name {
public ValidationResult append(
Collection<ValidationMessage<Origin>> messages) {
if (messages == null) {
return this; // depends on control dependency: [if], data = [none]
}
for (ValidationMessage<Origin> message : messages) {
addMessage(message); // depends on control dependency: [for], data = [message]
}
return this;
} }
|
public class class_name {
public Set<VertexInfo> getCompositeVertices(AtlasVertex entityVertex) throws AtlasException {
Set<VertexInfo> result = new HashSet<>();
Stack<AtlasVertex> vertices = new Stack<>();
vertices.push(entityVertex);
while (vertices.size() > 0) {
AtlasVertex vertex = vertices.pop();
String typeName = GraphHelper.getTypeName(vertex);
String guid = GraphHelper.getGuid(vertex);
Id.EntityState state = GraphHelper.getState(vertex);
if (state == Id.EntityState.DELETED) {
//If the reference vertex is marked for deletion, skip it
continue;
}
result.add(new VertexInfo(guid, vertex, typeName));
ClassType classType = typeSystem.getDataType(ClassType.class, typeName);
for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
if (!attributeInfo.isComposite) {
continue;
}
String edgeLabel = GraphHelper.getEdgeLabel(classType, attributeInfo);
switch (attributeInfo.dataType().getTypeCategory()) {
case CLASS:
AtlasEdge edge = getEdgeForLabel(vertex, edgeLabel);
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex);
}
break;
case ARRAY:
IDataType elementType = ((DataTypes.ArrayType) attributeInfo.dataType()).getElemType();
DataTypes.TypeCategory elementTypeCategory = elementType.getTypeCategory();
if (elementTypeCategory != TypeCategory.CLASS) {
continue;
}
Iterator<AtlasEdge> edges = getOutGoingEdgesByLabel(vertex, edgeLabel);
if (edges != null) {
while (edges.hasNext()) {
edge = edges.next();
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex);
}
}
}
break;
case MAP:
DataTypes.MapType mapType = (DataTypes.MapType) attributeInfo.dataType();
DataTypes.TypeCategory valueTypeCategory = mapType.getValueType().getTypeCategory();
if (valueTypeCategory != TypeCategory.CLASS) {
continue;
}
String propertyName = GraphHelper.getQualifiedFieldName(classType, attributeInfo.name);
List<String> keys = vertex.getProperty(propertyName, List.class);
if (keys != null) {
for (String key : keys) {
String mapEdgeLabel = GraphHelper.getQualifiedNameForMapKey(edgeLabel, key);
edge = getEdgeForLabel(vertex, mapEdgeLabel);
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex);
}
}
}
break;
default:
}
}
}
return result;
} }
|
public class class_name {
public Set<VertexInfo> getCompositeVertices(AtlasVertex entityVertex) throws AtlasException {
Set<VertexInfo> result = new HashSet<>();
Stack<AtlasVertex> vertices = new Stack<>();
vertices.push(entityVertex);
while (vertices.size() > 0) {
AtlasVertex vertex = vertices.pop();
String typeName = GraphHelper.getTypeName(vertex);
String guid = GraphHelper.getGuid(vertex);
Id.EntityState state = GraphHelper.getState(vertex);
if (state == Id.EntityState.DELETED) {
//If the reference vertex is marked for deletion, skip it
continue;
}
result.add(new VertexInfo(guid, vertex, typeName));
ClassType classType = typeSystem.getDataType(ClassType.class, typeName);
for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
if (!attributeInfo.isComposite) {
continue;
}
String edgeLabel = GraphHelper.getEdgeLabel(classType, attributeInfo);
switch (attributeInfo.dataType().getTypeCategory()) {
case CLASS:
AtlasEdge edge = getEdgeForLabel(vertex, edgeLabel);
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex);
}
break;
case ARRAY:
IDataType elementType = ((DataTypes.ArrayType) attributeInfo.dataType()).getElemType();
DataTypes.TypeCategory elementTypeCategory = elementType.getTypeCategory();
if (elementTypeCategory != TypeCategory.CLASS) {
continue;
}
Iterator<AtlasEdge> edges = getOutGoingEdgesByLabel(vertex, edgeLabel);
if (edges != null) {
while (edges.hasNext()) {
edge = edges.next();
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex); // depends on control dependency: [if], data = [none]
}
}
}
break;
case MAP:
DataTypes.MapType mapType = (DataTypes.MapType) attributeInfo.dataType();
DataTypes.TypeCategory valueTypeCategory = mapType.getValueType().getTypeCategory();
if (valueTypeCategory != TypeCategory.CLASS) {
continue;
}
String propertyName = GraphHelper.getQualifiedFieldName(classType, attributeInfo.name);
List<String> keys = vertex.getProperty(propertyName, List.class);
if (keys != null) {
for (String key : keys) {
String mapEdgeLabel = GraphHelper.getQualifiedNameForMapKey(edgeLabel, key);
edge = getEdgeForLabel(vertex, mapEdgeLabel);
if (edge != null && GraphHelper.getState(edge) == Id.EntityState.ACTIVE) {
AtlasVertex compositeVertex = edge.getInVertex();
vertices.push(compositeVertex); // depends on control dependency: [if], data = [none]
}
}
}
break;
default:
}
}
}
return result;
} }
|
public class class_name {
public Img copyArea(int x, int y, int w, int h, Img dest, int destX, int destY){
ImagingKitUtils.requireAreaInImageBounds(x, y, w, h, this);
if(dest == null){
return copyArea(x, y, w, h, new Img(w,h), 0, 0);
}
if(x==0 && destX==0 && w==dest.getWidth() && w==this.getWidth()){
if(destY < 0){
/* negative destination y
* need to shrink area by overlap and translate area origin */
y -= destY;
h += destY;
destY = 0;
}
// limit area height to not exceed targets bounds
h = Math.min(h, dest.getHeight()-destY);
if(h > 0){
System.arraycopy(this.getData(), y*w, dest.getData(), destY*w, w*h);
}
} else {
if(destX < 0){
/* negative destination x
* need to shrink area by overlap and translate area origin */
x -= destX;
w += destX;
destX = 0;
}
if(destY < 0){
/* negative destination y
* need to shrink area by overlap and translate area origin */
y -= destY;
h += destY;
destY = 0;
}
// limit area to not exceed targets bounds
w = Math.min(w, dest.getWidth()-destX);
h = Math.min(h, dest.getHeight()-destY);
if(w > 0 && h > 0){
for(int i = 0; i < h; i++){
System.arraycopy(
this.getData(), (y+i)*getWidth()+x,
dest.getData(), (destY+i)*dest.getWidth()+destX,
w);
}
}
}
return dest;
} }
|
public class class_name {
public Img copyArea(int x, int y, int w, int h, Img dest, int destX, int destY){
ImagingKitUtils.requireAreaInImageBounds(x, y, w, h, this);
if(dest == null){
return copyArea(x, y, w, h, new Img(w,h), 0, 0); // depends on control dependency: [if], data = [none]
}
if(x==0 && destX==0 && w==dest.getWidth() && w==this.getWidth()){
if(destY < 0){
/* negative destination y
* need to shrink area by overlap and translate area origin */
y -= destY; // depends on control dependency: [if], data = [none]
h += destY; // depends on control dependency: [if], data = [none]
destY = 0; // depends on control dependency: [if], data = [none]
}
// limit area height to not exceed targets bounds
h = Math.min(h, dest.getHeight()-destY); // depends on control dependency: [if], data = [none]
if(h > 0){
System.arraycopy(this.getData(), y*w, dest.getData(), destY*w, w*h); // depends on control dependency: [if], data = [none]
}
} else {
if(destX < 0){
/* negative destination x
* need to shrink area by overlap and translate area origin */
x -= destX; // depends on control dependency: [if], data = [none]
w += destX; // depends on control dependency: [if], data = [none]
destX = 0; // depends on control dependency: [if], data = [none]
}
if(destY < 0){
/* negative destination y
* need to shrink area by overlap and translate area origin */
y -= destY; // depends on control dependency: [if], data = [none]
h += destY; // depends on control dependency: [if], data = [none]
destY = 0; // depends on control dependency: [if], data = [none]
}
// limit area to not exceed targets bounds
w = Math.min(w, dest.getWidth()-destX); // depends on control dependency: [if], data = [none]
h = Math.min(h, dest.getHeight()-destY); // depends on control dependency: [if], data = [none]
if(w > 0 && h > 0){
for(int i = 0; i < h; i++){
System.arraycopy(
this.getData(), (y+i)*getWidth()+x,
dest.getData(), (destY+i)*dest.getWidth()+destX,
w); // depends on control dependency: [for], data = [none]
}
}
}
return dest;
} }
|
public class class_name {
@Override
public String getLocalHost()
{
if (_localName == null) {
byte []localAddrBuffer = _localAddrBuffer;
char []localAddrCharBuffer = _localAddrCharBuffer;
if (_localAddrLength <= 0) {
_localAddrLength = InetAddressUtil.createIpAddress(localAddrBuffer,
localAddrCharBuffer);
}
_localName = new String(localAddrCharBuffer, 0, _localAddrLength);
}
return _localName;
} }
|
public class class_name {
@Override
public String getLocalHost()
{
if (_localName == null) {
byte []localAddrBuffer = _localAddrBuffer;
char []localAddrCharBuffer = _localAddrCharBuffer;
if (_localAddrLength <= 0) {
_localAddrLength = InetAddressUtil.createIpAddress(localAddrBuffer,
localAddrCharBuffer); // depends on control dependency: [if], data = [none]
}
_localName = new String(localAddrCharBuffer, 0, _localAddrLength); // depends on control dependency: [if], data = [none]
}
return _localName;
} }
|
public class class_name {
public void removeItem(ContextMenuItem contextMenuItem) {
if (!hasMenuItem(contextMenuItem)) {
return;
}
if (contextMenuItem.isRootItem()) {
getState().getRootItems().remove(contextMenuItem.m_state);
} else {
ContextMenuItem parent = contextMenuItem.getParent();
parent.m_state.getChildren().remove(contextMenuItem.m_state);
}
Set<ContextMenuItem> children = contextMenuItem.getAllChildren();
m_items.remove(contextMenuItem.m_state.getId());
for (ContextMenuItem child : children) {
m_items.remove(child.m_state.getId());
}
markAsDirty();
} }
|
public class class_name {
public void removeItem(ContextMenuItem contextMenuItem) {
if (!hasMenuItem(contextMenuItem)) {
return; // depends on control dependency: [if], data = [none]
}
if (contextMenuItem.isRootItem()) {
getState().getRootItems().remove(contextMenuItem.m_state); // depends on control dependency: [if], data = [none]
} else {
ContextMenuItem parent = contextMenuItem.getParent();
parent.m_state.getChildren().remove(contextMenuItem.m_state); // depends on control dependency: [if], data = [none]
}
Set<ContextMenuItem> children = contextMenuItem.getAllChildren();
m_items.remove(contextMenuItem.m_state.getId());
for (ContextMenuItem child : children) {
m_items.remove(child.m_state.getId()); // depends on control dependency: [for], data = [child]
}
markAsDirty();
} }
|
public class class_name {
public static double round(double x, int decimal) {
if (decimal < 0) {
return round(x / pow(10, -decimal)) * pow(10, -decimal);
} else {
return round(x * pow(10, decimal)) / pow(10, decimal);
}
} }
|
public class class_name {
public static double round(double x, int decimal) {
if (decimal < 0) {
return round(x / pow(10, -decimal)) * pow(10, -decimal); // depends on control dependency: [if], data = [none]
} else {
return round(x * pow(10, decimal)) / pow(10, decimal); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static boolean isUptoEligible(Temporal from, Temporal to) {
TemporalAmount amount = rightShift(from, to);
if (amount instanceof Period) {
return isNonnegative((Period) amount);
} else if (amount instanceof Duration) {
return isNonnegative((Duration) amount);
} else {
throw new GroovyRuntimeException("Temporal implementations of "
+ from.getClass().getCanonicalName() + " are not supported by upto().");
}
} }
|
public class class_name {
private static boolean isUptoEligible(Temporal from, Temporal to) {
TemporalAmount amount = rightShift(from, to);
if (amount instanceof Period) {
return isNonnegative((Period) amount); // depends on control dependency: [if], data = [none]
} else if (amount instanceof Duration) {
return isNonnegative((Duration) amount); // depends on control dependency: [if], data = [none]
} else {
throw new GroovyRuntimeException("Temporal implementations of "
+ from.getClass().getCanonicalName() + " are not supported by upto().");
}
} }
|
public class class_name {
private DiscountCurve createDiscountCurve(String discountCurveName) {
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
if(discountCurve == null) {
discountCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors(discountCurveName, new double[] { 0.0 }, new double[] { 1.0 });
model = model.addCurves(discountCurve);
}
return discountCurve;
} }
|
public class class_name {
private DiscountCurve createDiscountCurve(String discountCurveName) {
DiscountCurve discountCurve = model.getDiscountCurve(discountCurveName);
if(discountCurve == null) {
discountCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors(discountCurveName, new double[] { 0.0 }, new double[] { 1.0 }); // depends on control dependency: [if], data = [(discountCurve]
model = model.addCurves(discountCurve); // depends on control dependency: [if], data = [(discountCurve]
}
return discountCurve;
} }
|
public class class_name {
int findPossibleMarker(char[] chars, int limit) {
search:
for (int i = 0; true; i++) {
for (int m = 0; m < marker.length() && i + m < limit; m++) {
if (chars[i + m] != marker.charAt(m)) {
continue search;
}
}
return i;
}
} }
|
public class class_name {
int findPossibleMarker(char[] chars, int limit) {
search:
for (int i = 0; true; i++) {
for (int m = 0; m < marker.length() && i + m < limit; m++) {
if (chars[i + m] != marker.charAt(m)) {
continue search;
}
}
return i; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public static List<TriggerDto> transformToDto(List<Trigger> triggers) {
List<TriggerDto> result = new ArrayList<TriggerDto>();
for (Trigger trigger : triggers) {
result.add(transformToDto(trigger));
}
return result;
} }
|
public class class_name {
public static List<TriggerDto> transformToDto(List<Trigger> triggers) {
List<TriggerDto> result = new ArrayList<TriggerDto>();
for (Trigger trigger : triggers) {
result.add(transformToDto(trigger)); // depends on control dependency: [for], data = [trigger]
}
return result;
} }
|
public class class_name {
@Override
public void aborted(DataBinder parameters, Throwable throwable) {
try { first.aborted(parameters, throwable); } catch (Throwable t) {}
try { second.aborted(parameters, throwable); } catch (Throwable t) {}
} }
|
public class class_name {
@Override
public void aborted(DataBinder parameters, Throwable throwable) {
try { first.aborted(parameters, throwable); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
try { second.aborted(parameters, throwable); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void main(String[] args) {
try {
System.out.println("setting up fonts and images directories\n");
System.out.println("FOP ExampleFO2PDF\n");
System.out.println("Preparing...");
//Setup directories
File sourceDir = new File("/Users/salmanqureshi/Projects/Rackspace/Dev/compute-api-final/openstack-compute-api-2/src");
File baseDir = new File("/Users/salmanqureshi/Projects/Rackspace/Dev/compute-api-final/openstack-compute-api-2");
// File outDir = new File(baseDir, "out");
// outDir.mkdirs();
//Setup input and output files
//File fofile = new File(baseDir, "xml/fo/helloworld.fo");
//File fofile = new File(baseDir, "os-compute-devguide.fo");
//File fofile = new File(baseDir, "../fo/pagination/franklin_2pageseqs.fo");
//File pdffile = new File(outDir, "ResultFO2PDF.pdf");
//System.out.println("Input: XSL-FO (" + fofile + ")");
//System.out.println("Output: PDF (" + pdffile + ")");
System.out.println("Transforming...");
PDFBuilder pdfBuilder = new PDFBuilder();
File targetDir = new File(baseDir, "target/docbkx/pdf1");
pdfBuilder.setSourceDirectory(sourceDir);
pdfBuilder.setAutopdfTargetDirectory(targetDir);
pdfBuilder.setImageDirectory(targetDir.getParentFile());
pdfBuilder.setBranding("rackspace");
pdfBuilder.setInputFilename("os-compute-devguide.xml");
pdfBuilder.setSourceFilePath(new File(sourceDir, "os-compute-devguide.xml"));
pdfBuilder.setProjectBuildDirectory(sourceDir.getParentFile());
pdfBuilder.preProcess();
//File fofile = pdfBuilder.processSources();
//pdfBuilder.convertFO2PDF(fofile);
System.out.println("Success!");
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
}
} }
|
public class class_name {
public static void main(String[] args) {
try {
System.out.println("setting up fonts and images directories\n"); // depends on control dependency: [try], data = [none]
System.out.println("FOP ExampleFO2PDF\n"); // depends on control dependency: [try], data = [none]
System.out.println("Preparing..."); // depends on control dependency: [try], data = [none]
//Setup directories
File sourceDir = new File("/Users/salmanqureshi/Projects/Rackspace/Dev/compute-api-final/openstack-compute-api-2/src");
File baseDir = new File("/Users/salmanqureshi/Projects/Rackspace/Dev/compute-api-final/openstack-compute-api-2");
// File outDir = new File(baseDir, "out");
// outDir.mkdirs();
//Setup input and output files
//File fofile = new File(baseDir, "xml/fo/helloworld.fo");
//File fofile = new File(baseDir, "os-compute-devguide.fo");
//File fofile = new File(baseDir, "../fo/pagination/franklin_2pageseqs.fo");
//File pdffile = new File(outDir, "ResultFO2PDF.pdf");
//System.out.println("Input: XSL-FO (" + fofile + ")");
//System.out.println("Output: PDF (" + pdffile + ")");
System.out.println("Transforming..."); // depends on control dependency: [try], data = [none]
PDFBuilder pdfBuilder = new PDFBuilder();
File targetDir = new File(baseDir, "target/docbkx/pdf1");
pdfBuilder.setSourceDirectory(sourceDir); // depends on control dependency: [try], data = [none]
pdfBuilder.setAutopdfTargetDirectory(targetDir); // depends on control dependency: [try], data = [none]
pdfBuilder.setImageDirectory(targetDir.getParentFile()); // depends on control dependency: [try], data = [none]
pdfBuilder.setBranding("rackspace"); // depends on control dependency: [try], data = [none]
pdfBuilder.setInputFilename("os-compute-devguide.xml");
pdfBuilder.setSourceFilePath(new File(sourceDir, "os-compute-devguide.xml")); // depends on control dependency: [try], data = [none]
pdfBuilder.setProjectBuildDirectory(sourceDir.getParentFile()); // depends on control dependency: [try], data = [none]
pdfBuilder.preProcess(); // depends on control dependency: [try], data = [none]
//File fofile = pdfBuilder.processSources();
//pdfBuilder.convertFO2PDF(fofile);
System.out.println("Success!"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final boolean datastoreExists() {
String thisMethodName = "datastoreExists";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(false));
}
return false;
} }
|
public class class_name {
public final boolean datastoreExists() {
String thisMethodName = "datastoreExists";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, new Boolean(false)); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public boolean generate(File cobolFile, String cobolFileEncoding,
final File targetFolder, String targetPackageName,
final String xsltFileName) {
try {
log.info("COBOL to Avro generation for: {}", cobolFile);
Reader reader = cobolFileEncoding == null ? new InputStreamReader(
new FileInputStream(cobolFile)) : new InputStreamReader(
new FileInputStream(cobolFile), cobolFileEncoding);
String targetSchemaName = FilenameUtils.getBaseName(cobolFile
.getName().toLowerCase());
return generate(reader, targetFolder, targetPackageName,
targetSchemaName, xsltFileName);
} catch (UnsupportedEncodingException e) {
throw new Cob2AvroGeneratotException(e);
} catch (FileNotFoundException e) {
throw new Cob2AvroGeneratotException(e);
}
} }
|
public class class_name {
public boolean generate(File cobolFile, String cobolFileEncoding,
final File targetFolder, String targetPackageName,
final String xsltFileName) {
try {
log.info("COBOL to Avro generation for: {}", cobolFile); // depends on control dependency: [try], data = [none]
Reader reader = cobolFileEncoding == null ? new InputStreamReader(
new FileInputStream(cobolFile)) : new InputStreamReader(
new FileInputStream(cobolFile), cobolFileEncoding);
String targetSchemaName = FilenameUtils.getBaseName(cobolFile
.getName().toLowerCase());
return generate(reader, targetFolder, targetPackageName,
targetSchemaName, xsltFileName); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new Cob2AvroGeneratotException(e);
} catch (FileNotFoundException e) { // depends on control dependency: [catch], data = [none]
throw new Cob2AvroGeneratotException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getName(final int parts) {
final StringBuilder buff = new StringBuilder();
for (int i = 0; i < parts; i++) {
if (buff.length() != 0) {
buff.append('-');
}
buff.append(NATOALPHABET[(int) (Math.random() * NATOALPHABET.length)]);
}
return buff.toString();
} }
|
public class class_name {
public static String getName(final int parts) {
final StringBuilder buff = new StringBuilder();
for (int i = 0; i < parts; i++) {
if (buff.length() != 0) {
buff.append('-'); // depends on control dependency: [if], data = [none]
}
buff.append(NATOALPHABET[(int) (Math.random() * NATOALPHABET.length)]); // depends on control dependency: [for], data = [none]
}
return buff.toString();
} }
|
public class class_name {
@Override
public Atom getAtom(String name) {
if ( atomNameLookup != null)
return atomNameLookup.get(name);
else {
/** This is the performance penalty we pay for NOT using the atomnameLookup in PerformanceBehaviour.LESS_MEMORY_SLOWER_PERFORMANCE
*/
for (Atom a : atoms) {
if (a.getName().equals(name)) {
return a;
}
}
return null;
}
} }
|
public class class_name {
@Override
public Atom getAtom(String name) {
if ( atomNameLookup != null)
return atomNameLookup.get(name);
else {
/** This is the performance penalty we pay for NOT using the atomnameLookup in PerformanceBehaviour.LESS_MEMORY_SLOWER_PERFORMANCE
*/
for (Atom a : atoms) {
if (a.getName().equals(name)) {
return a; // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void parentStateChanged(PropertyChangeEvent evt) {
if (ENABLED_PROPERTY.equals(evt.getPropertyName())) {
enabledUpdated();
}
else if (READONLY_PROPERTY.equals(evt.getPropertyName())) {
readOnlyUpdated();
}
} }
|
public class class_name {
protected void parentStateChanged(PropertyChangeEvent evt) {
if (ENABLED_PROPERTY.equals(evt.getPropertyName())) {
enabledUpdated(); // depends on control dependency: [if], data = [none]
}
else if (READONLY_PROPERTY.equals(evt.getPropertyName())) {
readOnlyUpdated(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setLocation(String location, Job job) throws IOException
{
conf = HadoopCompat.getConfiguration(job);
setLocationFromUri(location);
if (ConfigHelper.getInputSlicePredicate(conf) == null)
{
SliceRange range = new SliceRange(slice_start, slice_end, slice_reverse, limit);
SlicePredicate predicate = new SlicePredicate().setSlice_range(range);
ConfigHelper.setInputSlicePredicate(conf, predicate);
}
if (System.getenv(PIG_WIDEROW_INPUT) != null)
widerows = Boolean.parseBoolean(System.getenv(PIG_WIDEROW_INPUT));
if (System.getenv(PIG_USE_SECONDARY) != null)
usePartitionFilter = Boolean.parseBoolean(System.getenv(PIG_USE_SECONDARY));
if (System.getenv(PIG_INPUT_SPLIT_SIZE) != null)
{
try
{
ConfigHelper.setInputSplitSize(conf, Integer.parseInt(System.getenv(PIG_INPUT_SPLIT_SIZE)));
}
catch (NumberFormatException e)
{
throw new IOException("PIG_INPUT_SPLIT_SIZE is not a number", e);
}
}
if (usePartitionFilter && getIndexExpressions() != null)
ConfigHelper.setInputRange(conf, getIndexExpressions());
if (username != null && password != null)
ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, username, password);
if (splitSize > 0)
ConfigHelper.setInputSplitSize(conf, splitSize);
if (partitionerClass!= null)
ConfigHelper.setInputPartitioner(conf, partitionerClass);
if (rpcPort != null)
ConfigHelper.setInputRpcPort(conf, rpcPort);
if (initHostAddress != null)
ConfigHelper.setInputInitialAddress(conf, initHostAddress);
ConfigHelper.setInputColumnFamily(conf, keyspace, column_family, widerows);
setConnectionInformation();
if (ConfigHelper.getInputRpcPort(conf) == 0)
throw new IOException("PIG_INPUT_RPC_PORT or PIG_RPC_PORT environment variable not set");
if (ConfigHelper.getInputInitialAddress(conf) == null)
throw new IOException("PIG_INPUT_INITIAL_ADDRESS or PIG_INITIAL_ADDRESS environment variable not set");
if (ConfigHelper.getInputPartitioner(conf) == null)
throw new IOException("PIG_INPUT_PARTITIONER or PIG_PARTITIONER environment variable not set");
if (loadSignature == null)
loadSignature = location;
initSchema(loadSignature);
} }
|
public class class_name {
public void setLocation(String location, Job job) throws IOException
{
conf = HadoopCompat.getConfiguration(job);
setLocationFromUri(location);
if (ConfigHelper.getInputSlicePredicate(conf) == null)
{
SliceRange range = new SliceRange(slice_start, slice_end, slice_reverse, limit);
SlicePredicate predicate = new SlicePredicate().setSlice_range(range);
ConfigHelper.setInputSlicePredicate(conf, predicate);
}
if (System.getenv(PIG_WIDEROW_INPUT) != null)
widerows = Boolean.parseBoolean(System.getenv(PIG_WIDEROW_INPUT));
if (System.getenv(PIG_USE_SECONDARY) != null)
usePartitionFilter = Boolean.parseBoolean(System.getenv(PIG_USE_SECONDARY));
if (System.getenv(PIG_INPUT_SPLIT_SIZE) != null)
{
try
{
ConfigHelper.setInputSplitSize(conf, Integer.parseInt(System.getenv(PIG_INPUT_SPLIT_SIZE))); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e)
{
throw new IOException("PIG_INPUT_SPLIT_SIZE is not a number", e);
} // depends on control dependency: [catch], data = [none]
}
if (usePartitionFilter && getIndexExpressions() != null)
ConfigHelper.setInputRange(conf, getIndexExpressions());
if (username != null && password != null)
ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, username, password);
if (splitSize > 0)
ConfigHelper.setInputSplitSize(conf, splitSize);
if (partitionerClass!= null)
ConfigHelper.setInputPartitioner(conf, partitionerClass);
if (rpcPort != null)
ConfigHelper.setInputRpcPort(conf, rpcPort);
if (initHostAddress != null)
ConfigHelper.setInputInitialAddress(conf, initHostAddress);
ConfigHelper.setInputColumnFamily(conf, keyspace, column_family, widerows);
setConnectionInformation();
if (ConfigHelper.getInputRpcPort(conf) == 0)
throw new IOException("PIG_INPUT_RPC_PORT or PIG_RPC_PORT environment variable not set");
if (ConfigHelper.getInputInitialAddress(conf) == null)
throw new IOException("PIG_INPUT_INITIAL_ADDRESS or PIG_INITIAL_ADDRESS environment variable not set");
if (ConfigHelper.getInputPartitioner(conf) == null)
throw new IOException("PIG_INPUT_PARTITIONER or PIG_PARTITIONER environment variable not set");
if (loadSignature == null)
loadSignature = location;
initSchema(loadSignature);
} }
|
public class class_name {
private static Path getDirectory(FileSystem fs, Path path) {
try {
if (!fs.exists(path) || fs.isDirectory(path)) {
return path;
} else {
return path.getParent();
}
} catch (IOException e) {
throw new DatasetIOException("Cannot access path: " + path, e);
}
} }
|
public class class_name {
private static Path getDirectory(FileSystem fs, Path path) {
try {
if (!fs.exists(path) || fs.isDirectory(path)) {
return path; // depends on control dependency: [if], data = [none]
} else {
return path.getParent(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
throw new DatasetIOException("Cannot access path: " + path, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Unstable
public static String toAlphaNumeric(String text)
{
if (isEmpty(text)) {
return text;
}
return stripAccents(text).replaceAll("[^a-zA-Z0-9]", "");
} }
|
public class class_name {
@Unstable
public static String toAlphaNumeric(String text)
{
if (isEmpty(text)) {
return text; // depends on control dependency: [if], data = [none]
}
return stripAccents(text).replaceAll("[^a-zA-Z0-9]", "");
} }
|
public class class_name {
public void unregisterMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
log.trace("Unregistering jmx resources..");
try {
for (ResourceDMBean resource : resourceDMBeans) {
JmxUtil.unregisterMBean(getObjectName(resource), mBeanServer);
}
}
catch (Exception e) {
throw new CacheException("Failure while unregistering mbeans", e);
}
} }
|
public class class_name {
public void unregisterMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
log.trace("Unregistering jmx resources..");
try {
for (ResourceDMBean resource : resourceDMBeans) {
JmxUtil.unregisterMBean(getObjectName(resource), mBeanServer); // depends on control dependency: [for], data = [resource]
}
}
catch (Exception e) {
throw new CacheException("Failure while unregistering mbeans", e);
}
} }
|
public class class_name {
@Nonnull
public static ESuccess parseJson (@Nonnull @WillClose final Reader aReader,
@Nonnull final IJsonParserHandler aParserHandler,
@Nullable final IJsonParserCustomizeCallback aCustomizeCallback,
@Nullable final IJsonParseExceptionCallback aCustomExceptionCallback)
{
ValueEnforcer.notNull (aReader, "Reader");
ValueEnforcer.notNull (aParserHandler, "ParserHandler");
try
{
final JsonParser aParser = new JsonParser (aReader, aParserHandler);
if (aCustomizeCallback != null)
aCustomizeCallback.customizeJsonParser (aParser);
aParser.parse ();
return ESuccess.SUCCESS;
}
catch (final JsonParseException ex)
{
// Unrecoverable error
if (aCustomExceptionCallback != null)
aCustomExceptionCallback.onException (ex);
else
getDefaultParseExceptionCallback ().onException (ex);
return ESuccess.FAILURE;
}
finally
{
StreamHelper.close (aReader);
}
} }
|
public class class_name {
@Nonnull
public static ESuccess parseJson (@Nonnull @WillClose final Reader aReader,
@Nonnull final IJsonParserHandler aParserHandler,
@Nullable final IJsonParserCustomizeCallback aCustomizeCallback,
@Nullable final IJsonParseExceptionCallback aCustomExceptionCallback)
{
ValueEnforcer.notNull (aReader, "Reader");
ValueEnforcer.notNull (aParserHandler, "ParserHandler");
try
{
final JsonParser aParser = new JsonParser (aReader, aParserHandler);
if (aCustomizeCallback != null)
aCustomizeCallback.customizeJsonParser (aParser);
aParser.parse (); // depends on control dependency: [try], data = [none]
return ESuccess.SUCCESS; // depends on control dependency: [try], data = [none]
}
catch (final JsonParseException ex)
{
// Unrecoverable error
if (aCustomExceptionCallback != null)
aCustomExceptionCallback.onException (ex);
else
getDefaultParseExceptionCallback ().onException (ex);
return ESuccess.FAILURE;
} // depends on control dependency: [catch], data = [none]
finally
{
StreamHelper.close (aReader);
}
} }
|
public class class_name {
public static <E extends Enum<E>> int getFlag(EnumSet<E> eSet)
{
int flag = 0;
for (Enum<E> en : eSet)
{
int ordinal = en.ordinal();
if (ordinal >= Integer.SIZE)
{
throw new IllegalArgumentException(eSet+" contains too many enums for int");
}
flag |= 1 << ordinal;
}
return flag;
} }
|
public class class_name {
public static <E extends Enum<E>> int getFlag(EnumSet<E> eSet)
{
int flag = 0;
for (Enum<E> en : eSet)
{
int ordinal = en.ordinal();
if (ordinal >= Integer.SIZE)
{
throw new IllegalArgumentException(eSet+" contains too many enums for int");
}
flag |= 1 << ordinal;
// depends on control dependency: [for], data = [none]
}
return flag;
} }
|
public class class_name {
public static String unCamelify(CharSequence original) {
StringBuilder result = new StringBuilder(original.length());
boolean wasLowercase = false;
for (int i = 0; i < original.length(); i++) {
char ch = original.charAt(i);
if (Character.isUpperCase(ch) && wasLowercase) {
result.append('-');
}
wasLowercase = Character.isLowerCase(ch);
result.append(Character.toLowerCase(ch));
}
return result.toString();
} }
|
public class class_name {
public static String unCamelify(CharSequence original) {
StringBuilder result = new StringBuilder(original.length());
boolean wasLowercase = false;
for (int i = 0; i < original.length(); i++) {
char ch = original.charAt(i);
if (Character.isUpperCase(ch) && wasLowercase) {
result.append('-'); // depends on control dependency: [if], data = [none]
}
wasLowercase = Character.isLowerCase(ch); // depends on control dependency: [for], data = [none]
result.append(Character.toLowerCase(ch)); // depends on control dependency: [for], data = [none]
}
return result.toString();
} }
|
public class class_name {
public UserFieldListing getAllUserFieldValuesByUser(User userParam)
{
if(userParam == null)
{
return null;
}
if(this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket);
}
try {
return new UserFieldListing(this.postJson(
userParam,
WS.Path.User.Version1.getUserFieldValuesByUser()));
}
//
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
FluidClientException.ErrorCode.JSON_PARSING);
}
} }
|
public class class_name {
public UserFieldListing getAllUserFieldValuesByUser(User userParam)
{
if(userParam == null)
{
return null; // depends on control dependency: [if], data = [none]
}
if(this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket]
}
try {
return new UserFieldListing(this.postJson(
userParam,
WS.Path.User.Version1.getUserFieldValuesByUser())); // depends on control dependency: [try], data = [none]
}
//
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
FluidClientException.ErrorCode.JSON_PARSING);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static void inflater(InputStream in, OutputStream out) {
final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
IoUtil.copy(in, ios);
try {
ios.finish();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} }
|
public class class_name {
private static void inflater(InputStream in, OutputStream out) {
final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
IoUtil.copy(in, ios);
try {
ios.finish();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IORuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static AbstractJournalOperation readJournalOperation( DataInputStream in )
{
try
{
int operationType = in.read();
if (operationType == -1)
return null; // EOF
switch (operationType)
{
case 0 : // Padding
return null;
case AbstractJournalOperation.TYPE_META_DATA_WRITE :
return readMetaDataWriteOperation(in);
case AbstractJournalOperation.TYPE_META_DATA_BLOCK_WRITE :
return readMetaDataBlockWriteOperation(in);
case AbstractJournalOperation.TYPE_DATA_BLOCK_WRITE :
return readDataBlockWriteOperation(in);
case AbstractJournalOperation.TYPE_STORE_EXTEND :
return readStoreExtendOperation(in);
case AbstractJournalOperation.TYPE_COMMIT :
return readCommitOperation(in);
default:
throw new IllegalArgumentException("Invalid operation type : "+operationType);
}
}
catch (Exception e)
{
log.error("Corrupted or truncated journal operation, skipping.",e);
return null;
}
} }
|
public class class_name {
public static AbstractJournalOperation readJournalOperation( DataInputStream in )
{
try
{
int operationType = in.read();
if (operationType == -1)
return null; // EOF
switch (operationType)
{
case 0 : // Padding
return null;
case AbstractJournalOperation.TYPE_META_DATA_WRITE :
return readMetaDataWriteOperation(in);
case AbstractJournalOperation.TYPE_META_DATA_BLOCK_WRITE :
return readMetaDataBlockWriteOperation(in);
case AbstractJournalOperation.TYPE_DATA_BLOCK_WRITE :
return readDataBlockWriteOperation(in);
case AbstractJournalOperation.TYPE_STORE_EXTEND :
return readStoreExtendOperation(in);
case AbstractJournalOperation.TYPE_COMMIT :
return readCommitOperation(in);
default:
throw new IllegalArgumentException("Invalid operation type : "+operationType);
}
}
catch (Exception e)
{
log.error("Corrupted or truncated journal operation, skipping.",e);
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void addModifier(String modifier) {
if (!Strings.isEmpty(modifier)) {
this.sarlEnumeration.getModifiers().add(modifier);
}
} }
|
public class class_name {
public void addModifier(String modifier) {
if (!Strings.isEmpty(modifier)) {
this.sarlEnumeration.getModifiers().add(modifier); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static int extractVersionFromSchemaName(String clz_name) {
int idx = clz_name.lastIndexOf('V');
if (idx == -1) return -1;
try { return Integer.valueOf(clz_name.substring(idx+1)); }
catch( NumberFormatException ex) { return -1; }
} }
|
public class class_name {
public static int extractVersionFromSchemaName(String clz_name) {
int idx = clz_name.lastIndexOf('V');
if (idx == -1) return -1;
try { return Integer.valueOf(clz_name.substring(idx+1)); } // depends on control dependency: [try], data = [none]
catch( NumberFormatException ex) { return -1; } // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
if(synchronous || method.isAnnotationPresent(Synchronous.class) || !isVoidMethod(method)) {
Context context = findContext(args);
if(context != null) {
synchronized (this) {
SocializeService socialize = Socialize.getSocialize();
if(!socialize.isInitialized(context)) {
socialize.init(context);
if(!socialize.isAuthenticated() && !method.isAnnotationPresent(NoAuth.class)) {
socialize.authenticateSynchronous(context);
}
}
}
}
return method.invoke(getBean(), args);
}
else {
Activity context = findActivity(args);
if(context != null) {
SocializeListener listener = findListener(args);
// Always init to set the context
invokeWithInit(context, listener, method, args);
}
else {
throw new MethodNotSupportedException("No activity found in method arguments for method [" +
method.getName() +
"]");
}
}
// Always void
return null;
}
catch (Throwable e) {
SocializeLogger.e(e.getMessage(), e);
throw e;
}
} }
|
public class class_name {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
if(synchronous || method.isAnnotationPresent(Synchronous.class) || !isVoidMethod(method)) {
Context context = findContext(args);
if(context != null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
SocializeService socialize = Socialize.getSocialize();
if(!socialize.isInitialized(context)) {
socialize.init(context); // depends on control dependency: [if], data = [none]
if(!socialize.isAuthenticated() && !method.isAnnotationPresent(NoAuth.class)) {
socialize.authenticateSynchronous(context); // depends on control dependency: [if], data = [none]
}
}
}
}
return method.invoke(getBean(), args);
}
else {
Activity context = findActivity(args);
if(context != null) {
SocializeListener listener = findListener(args);
// Always init to set the context
invokeWithInit(context, listener, method, args); // depends on control dependency: [if], data = [(context]
}
else {
throw new MethodNotSupportedException("No activity found in method arguments for method [" +
method.getName() +
"]");
}
}
// Always void
return null;
}
catch (Throwable e) {
SocializeLogger.e(e.getMessage(), e);
throw e;
}
} }
|
public class class_name {
public static Cookie convertNettyCookieToWisdomCookie(DefaultCookie cookie) {
Preconditions.checkNotNull(cookie);
String value = cookie.value();
// // Netty append some data at the end f the cookie:
// // -createdBy=wisdom&at=3+nov.+2013+11%3A52%3A15&___TS=1383475935779, path=/, maxAge=3600s, secure, HTTPOnly
// // We have to remove them
// // TODO Do we really need this ? It was probably related to the cookie encoding issue.
// if (value.contains(PATH)) {
// value = value.substring(0, value.indexOf(PATH));
// }
Cookie.Builder builder
= Cookie.builder(cookie.name(), value);
builder.setMaxAge(cookie.maxAge());
if (cookie.domain() != null) {
builder.setDomain(cookie.domain());
}
builder.setSecure(cookie.isSecure());
if (cookie.path() != null) {
builder.setPath(cookie.path());
}
builder.setHttpOnly(cookie.isHttpOnly());
return builder.build();
} }
|
public class class_name {
public static Cookie convertNettyCookieToWisdomCookie(DefaultCookie cookie) {
Preconditions.checkNotNull(cookie);
String value = cookie.value();
// // Netty append some data at the end f the cookie:
// // -createdBy=wisdom&at=3+nov.+2013+11%3A52%3A15&___TS=1383475935779, path=/, maxAge=3600s, secure, HTTPOnly
// // We have to remove them
// // TODO Do we really need this ? It was probably related to the cookie encoding issue.
// if (value.contains(PATH)) {
// value = value.substring(0, value.indexOf(PATH));
// }
Cookie.Builder builder
= Cookie.builder(cookie.name(), value);
builder.setMaxAge(cookie.maxAge());
if (cookie.domain() != null) {
builder.setDomain(cookie.domain()); // depends on control dependency: [if], data = [(cookie.domain()]
}
builder.setSecure(cookie.isSecure());
if (cookie.path() != null) {
builder.setPath(cookie.path()); // depends on control dependency: [if], data = [(cookie.path()]
}
builder.setHttpOnly(cookie.isHttpOnly());
return builder.build();
} }
|
public class class_name {
private void run(String key, ConcurrentLinkedQueue<Work> workQueue) {
Work work = workQueue.poll();
CompletableFuture<Void> future;
try {
future = processEvent(work.getEvent());
} catch (Exception e) {
future = Futures.failedFuture(e);
}
future.whenComplete((r, e) -> {
if (e != null && toPostpone(work.getEvent(), work.getPickupTime(), e)) {
handleWorkPostpone(key, workQueue, work);
} else {
if (e != null) {
work.getResult().completeExceptionally(e);
} else {
work.getResult().complete(r);
}
handleWorkComplete(key, workQueue, work);
}
});
} }
|
public class class_name {
private void run(String key, ConcurrentLinkedQueue<Work> workQueue) {
Work work = workQueue.poll();
CompletableFuture<Void> future;
try {
future = processEvent(work.getEvent()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
future = Futures.failedFuture(e);
} // depends on control dependency: [catch], data = [none]
future.whenComplete((r, e) -> {
if (e != null && toPostpone(work.getEvent(), work.getPickupTime(), e)) {
handleWorkPostpone(key, workQueue, work); // depends on control dependency: [if], data = [none]
} else {
if (e != null) {
work.getResult().completeExceptionally(e); // depends on control dependency: [if], data = [(e]
} else {
work.getResult().complete(r); // depends on control dependency: [if], data = [none]
}
handleWorkComplete(key, workQueue, work); // depends on control dependency: [if], data = [none]
}
});
} }
|
public class class_name {
public static String getContextPath(final HttpServletRequest request) {
String contextPath = request.getContextPath();
if (contextPath == null || contextPath.equals(StringPool.SLASH)) {
contextPath = StringPool.EMPTY;
}
return contextPath;
} }
|
public class class_name {
public static String getContextPath(final HttpServletRequest request) {
String contextPath = request.getContextPath();
if (contextPath == null || contextPath.equals(StringPool.SLASH)) {
contextPath = StringPool.EMPTY; // depends on control dependency: [if], data = [none]
}
return contextPath;
} }
|
public class class_name {
public HttpRequestMessageImpl getRequest() {
HttpRequestMessageImpl req = (HttpRequestMessageImpl) this.reqPool.get();
if (null == req) {
req = new HttpRequestMessageImpl();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getRequest(): " + req);
}
return req;
} }
|
public class class_name {
public HttpRequestMessageImpl getRequest() {
HttpRequestMessageImpl req = (HttpRequestMessageImpl) this.reqPool.get();
if (null == req) {
req = new HttpRequestMessageImpl(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getRequest(): " + req); // depends on control dependency: [if], data = [none]
}
return req;
} }
|
public class class_name {
@Override
protected boolean hasNoStringCache() {
if(stringCache == null) {
synchronized(this) {
if(stringCache == null) {
stringCache = new IPv6StringCache();
return true;
}
}
}
return false;
} }
|
public class class_name {
@Override
protected boolean hasNoStringCache() {
if(stringCache == null) {
synchronized(this) { // depends on control dependency: [if], data = [none]
if(stringCache == null) {
stringCache = new IPv6StringCache(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public void processLocalTransactionStartedEvent(Object handle) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn)
{
if (tc.isEntryEnabled())
Tr.entry(this, tc, "processLocalTransactionStartedEvent", handle);
if (tc.isDebugEnabled())
{
String cId = null;
try {
cId = mcf.getCorrelator(this);
} catch (SQLException x) {
// will just log the exception here and ignore it since its in trace
Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
}
if (cId != null) {
StringBuffer stbuf = new StringBuffer(200);
stbuf.append("Correlator: DB2, ID: ");
stbuf.append(cId);
if (xares != null) {
stbuf.append(" Transaction : ");
stbuf.append(xares);
}
stbuf.append(" BEGIN");
Tr.debug(this, tc, stbuf.toString());
}
}
}
// An application level local transaction has been requested started
//The isValid method returns an exception if it is not valid. This allows the
// WSStateManager to create a more detailed message than this class could.
ResourceException re = stateMgr.isValid(WSStateManager.LT_BEGIN);
if (re == null) {
if (currentAutoCommit) {
try {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "current autocommit is true, set to false");
setAutoCommit(false);
} catch (SQLException sqle) {
FFDCFilter.processException(sqle, getClass().getName() + ".processLocalTransactionStartedEvent",
"550", this);
throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass());
}
}
// Already validated the state so just set it.
stateMgr.transtate = WSStateManager.LOCAL_TRANSACTION_ACTIVE;
} else {
throw re;
}
// Fill in the ConnectionEvent only if needed.
connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_STARTED, null, handle);
if (isTraceOn && tc.isEventEnabled())
Tr.event(this, tc,
"Firing LOCAL TRANSACTION STARTED event for: " + handle, this);
//Notification of the eventListeners must happen after the state change because if the statechange
// is illegal, we need to throw an exception. If this exception occurs, we do not want to
// notify the cm of the tx started because we are not allowing it to start.
// loop through the listeners
for (int i = 0; i < numListeners; i++) {
// send Local Transaction Started event to the current listener
ivEventListeners[i].localTransactionStarted(connEvent);
}
// Replace ConnectionEvent caching with a single reusable instance per
// ManagedConnection.
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(this, tc, "processLocalTransactionStartedEvent", handle);
}
} }
|
public class class_name {
public void processLocalTransactionStartedEvent(Object handle) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn)
{
if (tc.isEntryEnabled())
Tr.entry(this, tc, "processLocalTransactionStartedEvent", handle);
if (tc.isDebugEnabled())
{
String cId = null;
try {
cId = mcf.getCorrelator(this); // depends on control dependency: [try], data = [none]
} catch (SQLException x) {
// will just log the exception here and ignore it since its in trace
Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
} // depends on control dependency: [catch], data = [none]
if (cId != null) {
StringBuffer stbuf = new StringBuffer(200);
stbuf.append("Correlator: DB2, ID: "); // depends on control dependency: [if], data = [none]
stbuf.append(cId); // depends on control dependency: [if], data = [(cId]
if (xares != null) {
stbuf.append(" Transaction : "); // depends on control dependency: [if], data = [none]
stbuf.append(xares); // depends on control dependency: [if], data = [(xares]
}
stbuf.append(" BEGIN"); // depends on control dependency: [if], data = [none]
Tr.debug(this, tc, stbuf.toString()); // depends on control dependency: [if], data = [none]
}
}
}
// An application level local transaction has been requested started
//The isValid method returns an exception if it is not valid. This allows the
// WSStateManager to create a more detailed message than this class could.
ResourceException re = stateMgr.isValid(WSStateManager.LT_BEGIN);
if (re == null) {
if (currentAutoCommit) {
try {
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(this, tc, "current autocommit is true, set to false");
setAutoCommit(false); // depends on control dependency: [try], data = [none]
} catch (SQLException sqle) {
FFDCFilter.processException(sqle, getClass().getName() + ".processLocalTransactionStartedEvent",
"550", this);
throw new DataStoreAdapterException("DSA_ERROR", sqle, getClass());
} // depends on control dependency: [catch], data = [none]
}
// Already validated the state so just set it.
stateMgr.transtate = WSStateManager.LOCAL_TRANSACTION_ACTIVE;
} else {
throw re;
}
// Fill in the ConnectionEvent only if needed.
connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_STARTED, null, handle);
if (isTraceOn && tc.isEventEnabled())
Tr.event(this, tc,
"Firing LOCAL TRANSACTION STARTED event for: " + handle, this);
//Notification of the eventListeners must happen after the state change because if the statechange
// is illegal, we need to throw an exception. If this exception occurs, we do not want to
// notify the cm of the tx started because we are not allowing it to start.
// loop through the listeners
for (int i = 0; i < numListeners; i++) {
// send Local Transaction Started event to the current listener
ivEventListeners[i].localTransactionStarted(connEvent);
}
// Replace ConnectionEvent caching with a single reusable instance per
// ManagedConnection.
if (isTraceOn && tc.isEntryEnabled())
{
Tr.exit(this, tc, "processLocalTransactionStartedEvent", handle);
}
} }
|
public class class_name {
public final void renderEdges(int fillMode) {
evenOdd_ = fillMode == EVEN_ODD;
for (int line = minY_; line <= maxY_; line++) {
advanceAET_();
addNewEdgesToAET_(line);
emitScans_();
}
startAddingEdges();//reset for new edges
} }
|
public class class_name {
public final void renderEdges(int fillMode) {
evenOdd_ = fillMode == EVEN_ODD;
for (int line = minY_; line <= maxY_; line++) {
advanceAET_(); // depends on control dependency: [for], data = [none]
addNewEdgesToAET_(line); // depends on control dependency: [for], data = [line]
emitScans_(); // depends on control dependency: [for], data = [none]
}
startAddingEdges();//reset for new edges
} }
|
public class class_name {
public static IPv6Address fromBigInteger(final BigInteger bigInteger)
{
if (bigInteger == null)
throw new IllegalArgumentException("can not construct from [null]");
if (bigInteger.compareTo(BigInteger.ZERO) < 0)
throw new IllegalArgumentException("can not construct from negative value");
if (bigInteger.compareTo(MAX.toBigInteger()) > 0)
throw new IllegalArgumentException("bigInteger represents a value bigger than 2^128 - 1");
byte[] bytes = bigInteger.toByteArray();
if (bytes[0] == 0)
{
// a zero byte was added to represent the (always positive, hence zero) sign bit
return fromByteArray(prefixWithZeroBytes(Arrays.copyOfRange(bytes, 1, bytes.length), N_BYTES));
}
else
{
return fromByteArray(prefixWithZeroBytes(bytes, N_BYTES));
}
} }
|
public class class_name {
public static IPv6Address fromBigInteger(final BigInteger bigInteger)
{
if (bigInteger == null)
throw new IllegalArgumentException("can not construct from [null]");
if (bigInteger.compareTo(BigInteger.ZERO) < 0)
throw new IllegalArgumentException("can not construct from negative value");
if (bigInteger.compareTo(MAX.toBigInteger()) > 0)
throw new IllegalArgumentException("bigInteger represents a value bigger than 2^128 - 1");
byte[] bytes = bigInteger.toByteArray();
if (bytes[0] == 0)
{
// a zero byte was added to represent the (always positive, hence zero) sign bit
return fromByteArray(prefixWithZeroBytes(Arrays.copyOfRange(bytes, 1, bytes.length), N_BYTES)); // depends on control dependency: [if], data = [none]
}
else
{
return fromByteArray(prefixWithZeroBytes(bytes, N_BYTES)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static JMenuItem addActionToMenu( JMenu menu, Action act, int menuPos) {
JMenuItem mi = makeMenuItemFromAction( act);
if (menuPos >= 0)
menu.add( mi, menuPos);
else
menu.add( mi);
Boolean tog = (Boolean) act.getValue( BAMutil.TOGGLE);
boolean is_toggle = (tog == null ) ? false : tog.booleanValue();
// set state for toggle buttons
if (is_toggle) {
if (debugToggle)
System.out.println("addActionToMenu: "+ act.getValue( Action.SHORT_DESCRIPTION)+" "+act.getValue( BAMutil.STATE));
Boolean state = (Boolean) act.getValue( BAMutil.STATE);
if (state == null) state = Boolean.FALSE;
act.putValue(BAMutil.STATE, state);
mi.setSelected(state.booleanValue());
}
// add event listeners
Action myAct = is_toggle ? new ToggleAction( act) : act;
mi.addActionListener( myAct);
act.addPropertyChangeListener(new myActionChangedListener(mi));
return mi;
} }
|
public class class_name {
public static JMenuItem addActionToMenu( JMenu menu, Action act, int menuPos) {
JMenuItem mi = makeMenuItemFromAction( act);
if (menuPos >= 0)
menu.add( mi, menuPos);
else
menu.add( mi);
Boolean tog = (Boolean) act.getValue( BAMutil.TOGGLE);
boolean is_toggle = (tog == null ) ? false : tog.booleanValue();
// set state for toggle buttons
if (is_toggle) {
if (debugToggle)
System.out.println("addActionToMenu: "+ act.getValue( Action.SHORT_DESCRIPTION)+" "+act.getValue( BAMutil.STATE));
Boolean state = (Boolean) act.getValue( BAMutil.STATE);
if (state == null) state = Boolean.FALSE;
act.putValue(BAMutil.STATE, state); // depends on control dependency: [if], data = [none]
mi.setSelected(state.booleanValue()); // depends on control dependency: [if], data = [none]
}
// add event listeners
Action myAct = is_toggle ? new ToggleAction( act) : act;
mi.addActionListener( myAct);
act.addPropertyChangeListener(new myActionChangedListener(mi));
return mi;
} }
|
public class class_name {
public static HashMap<String, StormBase> get_all_StormBase(StormClusterState zkCluster) throws Exception {
HashMap<String, StormBase> rtn = new HashMap<>();
List<String> active_storms = zkCluster.active_storms();
if (active_storms != null) {
for (String topology_id : active_storms) {
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null) {
rtn.put(topology_id, base);
}
}
}
return rtn;
} }
|
public class class_name {
public static HashMap<String, StormBase> get_all_StormBase(StormClusterState zkCluster) throws Exception {
HashMap<String, StormBase> rtn = new HashMap<>();
List<String> active_storms = zkCluster.active_storms();
if (active_storms != null) {
for (String topology_id : active_storms) {
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null) {
rtn.put(topology_id, base); // depends on control dependency: [if], data = [none]
}
}
}
return rtn;
} }
|
public class class_name {
@UiThread
public void notifyChildRangeChanged(int parentPosition, int childPositionStart, int itemCount) {
P parent = mParentList.get(parentPosition);
int flatParentPosition = getFlatParentPosition(parentPosition);
ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition);
parentWrapper.setParent(parent);
if (parentWrapper.isExpanded()) {
int flatChildPosition = flatParentPosition + childPositionStart + 1;
for (int i = 0; i < itemCount; i++) {
ExpandableWrapper<P, C> child
= parentWrapper.getWrappedChildList().get(childPositionStart + i);
mFlatItemList.set(flatChildPosition + i, child);
}
notifyItemRangeChanged(flatChildPosition, itemCount);
}
} }
|
public class class_name {
@UiThread
public void notifyChildRangeChanged(int parentPosition, int childPositionStart, int itemCount) {
P parent = mParentList.get(parentPosition);
int flatParentPosition = getFlatParentPosition(parentPosition);
ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition);
parentWrapper.setParent(parent);
if (parentWrapper.isExpanded()) {
int flatChildPosition = flatParentPosition + childPositionStart + 1;
for (int i = 0; i < itemCount; i++) {
ExpandableWrapper<P, C> child
= parentWrapper.getWrappedChildList().get(childPositionStart + i);
mFlatItemList.set(flatChildPosition + i, child); // depends on control dependency: [for], data = [i]
}
notifyItemRangeChanged(flatChildPosition, itemCount); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
boolean symtabExtends(SymbolTable other)
{
// Throws ClassCastException if other isn't a local symtab
LocalSymbolTable subset = (LocalSymbolTable) other;
// Gather snapshots of each LST's data, so we don't
// Superset must have same/more known symbols than subset.
if (getMaxId() < subset.getMaxId()) return false;
// TODO amzn/ion-java/issues/18 Currently, we check imports by their refs. which
// might be overly strict; imports which are not the same ref.
// but have the same semantic states fails the extension check.
if (! myImportsList.equalImports(subset.myImportsList))
return false;
int subLocalSymbolCount = subset.mySymbolsCount;
// Superset extends subset if subset doesn't have any declared symbols.
if (subLocalSymbolCount == 0) return true;
// Superset must have same/more declared (local) symbols than subset.
if (mySymbolsCount < subLocalSymbolCount) return false;
String[] subsetSymbols = subset.mySymbolNames;
// Before we go through the expensive iteration from the front,
// check the last (largest) declared symbol in subset beforehand
if (! safeEquals(mySymbolNames[subLocalSymbolCount- 1],
subsetSymbols[subLocalSymbolCount- 1]))
{
return false;
}
// Now, we iterate from the first declared symbol, note that the
// iteration below is O(n)!
for (int i = 0; i < subLocalSymbolCount - 1; i++)
{
if (! safeEquals(mySymbolNames[i], subsetSymbols[i]))
return false;
}
return true;
} }
|
public class class_name {
boolean symtabExtends(SymbolTable other)
{
// Throws ClassCastException if other isn't a local symtab
LocalSymbolTable subset = (LocalSymbolTable) other;
// Gather snapshots of each LST's data, so we don't
// Superset must have same/more known symbols than subset.
if (getMaxId() < subset.getMaxId()) return false;
// TODO amzn/ion-java/issues/18 Currently, we check imports by their refs. which
// might be overly strict; imports which are not the same ref.
// but have the same semantic states fails the extension check.
if (! myImportsList.equalImports(subset.myImportsList))
return false;
int subLocalSymbolCount = subset.mySymbolsCount;
// Superset extends subset if subset doesn't have any declared symbols.
if (subLocalSymbolCount == 0) return true;
// Superset must have same/more declared (local) symbols than subset.
if (mySymbolsCount < subLocalSymbolCount) return false;
String[] subsetSymbols = subset.mySymbolNames;
// Before we go through the expensive iteration from the front,
// check the last (largest) declared symbol in subset beforehand
if (! safeEquals(mySymbolNames[subLocalSymbolCount- 1],
subsetSymbols[subLocalSymbolCount- 1]))
{
return false; // depends on control dependency: [if], data = [none]
}
// Now, we iterate from the first declared symbol, note that the
// iteration below is O(n)!
for (int i = 0; i < subLocalSymbolCount - 1; i++)
{
if (! safeEquals(mySymbolNames[i], subsetSymbols[i]))
return false;
}
return true;
} }
|
public class class_name {
protected CmsMenuItemVisibilityMode onlyVisibleForOU(Set<String> context) {
for (String id : context) {
if (!onlyVisibleForOU(new CmsUUID(id))) {
return CmsMenuItemVisibilityMode.VISIBILITY_INACTIVE;
}
}
return CmsMenuItemVisibilityMode.VISIBILITY_ACTIVE;
} }
|
public class class_name {
protected CmsMenuItemVisibilityMode onlyVisibleForOU(Set<String> context) {
for (String id : context) {
if (!onlyVisibleForOU(new CmsUUID(id))) {
return CmsMenuItemVisibilityMode.VISIBILITY_INACTIVE; // depends on control dependency: [if], data = [none]
}
}
return CmsMenuItemVisibilityMode.VISIBILITY_ACTIVE;
} }
|
public class class_name {
public void marshall(UpdateFlowEntitlementRequest updateFlowEntitlementRequest, ProtocolMarshaller protocolMarshaller) {
if (updateFlowEntitlementRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateFlowEntitlementRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(updateFlowEntitlementRequest.getEncryption(), ENCRYPTION_BINDING);
protocolMarshaller.marshall(updateFlowEntitlementRequest.getEntitlementArn(), ENTITLEMENTARN_BINDING);
protocolMarshaller.marshall(updateFlowEntitlementRequest.getFlowArn(), FLOWARN_BINDING);
protocolMarshaller.marshall(updateFlowEntitlementRequest.getSubscribers(), SUBSCRIBERS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateFlowEntitlementRequest updateFlowEntitlementRequest, ProtocolMarshaller protocolMarshaller) {
if (updateFlowEntitlementRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateFlowEntitlementRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateFlowEntitlementRequest.getEncryption(), ENCRYPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateFlowEntitlementRequest.getEntitlementArn(), ENTITLEMENTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateFlowEntitlementRequest.getFlowArn(), FLOWARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateFlowEntitlementRequest.getSubscribers(), SUBSCRIBERS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String getEmailAddresses() {
List<String> emails = new ArrayList<String>();
Iterator<String> itIds = idsList().iterator();
while (itIds.hasNext()) {
String id = itIds.next();
CmsSessionInfo session = OpenCms.getSessionManager().getSessionInfo(id);
if (session != null) {
try {
String emailAddress = getCms().readUser(session.getUserId()).getEmail();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(emailAddress) && !emails.contains(emailAddress)) {
emails.add(emailAddress);
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
StringBuffer result = new StringBuffer(256);
Iterator<String> itEmails = emails.iterator();
while (itEmails.hasNext()) {
result.append(itEmails.next());
if (itEmails.hasNext()) {
result.append("; ");
}
}
return result.toString();
} }
|
public class class_name {
private String getEmailAddresses() {
List<String> emails = new ArrayList<String>();
Iterator<String> itIds = idsList().iterator();
while (itIds.hasNext()) {
String id = itIds.next();
CmsSessionInfo session = OpenCms.getSessionManager().getSessionInfo(id);
if (session != null) {
try {
String emailAddress = getCms().readUser(session.getUserId()).getEmail();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(emailAddress) && !emails.contains(emailAddress)) {
emails.add(emailAddress); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
StringBuffer result = new StringBuffer(256);
Iterator<String> itEmails = emails.iterator();
while (itEmails.hasNext()) {
result.append(itEmails.next()); // depends on control dependency: [while], data = [none]
if (itEmails.hasNext()) {
result.append("; "); // depends on control dependency: [if], data = [none]
}
}
return result.toString();
} }
|
public class class_name {
private static CharSequence js_substring(Context cx, CharSequence target,
Object[] args)
{
int length = target.length();
double start = ScriptRuntime.toInteger(args, 0);
double end;
if (start < 0)
start = 0;
else if (start > length)
start = length;
if (args.length <= 1 || args[1] == Undefined.instance) {
end = length;
} else {
end = ScriptRuntime.toInteger(args[1]);
if (end < 0)
end = 0;
else if (end > length)
end = length;
// swap if end < start
if (end < start) {
if (cx.getLanguageVersion() != Context.VERSION_1_2) {
double temp = start;
start = end;
end = temp;
} else {
// Emulate old JDK1.0 java.lang.String.substring()
end = start;
}
}
}
return target.subSequence((int)start, (int)end);
} }
|
public class class_name {
private static CharSequence js_substring(Context cx, CharSequence target,
Object[] args)
{
int length = target.length();
double start = ScriptRuntime.toInteger(args, 0);
double end;
if (start < 0)
start = 0;
else if (start > length)
start = length;
if (args.length <= 1 || args[1] == Undefined.instance) {
end = length; // depends on control dependency: [if], data = [none]
} else {
end = ScriptRuntime.toInteger(args[1]); // depends on control dependency: [if], data = [none]
if (end < 0)
end = 0;
else if (end > length)
end = length;
// swap if end < start
if (end < start) {
if (cx.getLanguageVersion() != Context.VERSION_1_2) {
double temp = start;
start = end; // depends on control dependency: [if], data = [none]
end = temp; // depends on control dependency: [if], data = [none]
} else {
// Emulate old JDK1.0 java.lang.String.substring()
end = start; // depends on control dependency: [if], data = [none]
}
}
}
return target.subSequence((int)start, (int)end);
} }
|
public class class_name {
private void refine(PermutationGroup group, Partition coarser) {
int vertexCount = getVertexCount();
Partition finer = equitableRefiner.refine(coarser);
int firstNonDiscreteCell = finer.getIndexOfFirstNonDiscreteCell();
if (firstNonDiscreteCell == -1) {
firstNonDiscreteCell = vertexCount;
}
Permutation pi1 = new Permutation(firstNonDiscreteCell);
Result result = Result.BETTER;
if (bestExist) {
pi1 = finer.setAsPermutation(firstNonDiscreteCell);
result = compareRowwise(pi1);
}
// partition is discrete
if (finer.size() == vertexCount) {
if (!bestExist) {
best = finer.toPermutation();
first = finer.toPermutation();
bestExist = true;
} else {
if (result == Result.BETTER) {
best = new Permutation(pi1);
} else if (result == Result.EQUAL) {
group.enter(pi1.multiply(best.invert()));
}
}
} else {
if (result != Result.WORSE) {
Set<Integer> blockCopy = finer.copyBlock(firstNonDiscreteCell);
for (int vertexInBlock = 0; vertexInBlock < vertexCount; vertexInBlock++) {
if (blockCopy.contains(vertexInBlock)) {
Partition nextPartition = finer.splitBefore(firstNonDiscreteCell, vertexInBlock);
this.refine(group, nextPartition);
int[] permF = new int[vertexCount];
int[] invF = new int[vertexCount];
for (int i = 0; i < vertexCount; i++) {
permF[i] = i;
invF[i] = i;
}
for (int j = 0; j <= firstNonDiscreteCell; j++) {
int x = nextPartition.getFirstInCell(j);
int i = invF[x];
int h = permF[j];
permF[j] = x;
permF[i] = h;
invF[h] = i;
invF[x] = j;
}
Permutation pPermF = new Permutation(permF);
group.changeBase(pPermF);
for (int j = 0; j < vertexCount; j++) {
Permutation g = group.get(firstNonDiscreteCell, j);
if (g != null) {
blockCopy.remove(g.get(vertexInBlock));
}
}
}
}
}
}
} }
|
public class class_name {
private void refine(PermutationGroup group, Partition coarser) {
int vertexCount = getVertexCount();
Partition finer = equitableRefiner.refine(coarser);
int firstNonDiscreteCell = finer.getIndexOfFirstNonDiscreteCell();
if (firstNonDiscreteCell == -1) {
firstNonDiscreteCell = vertexCount; // depends on control dependency: [if], data = [none]
}
Permutation pi1 = new Permutation(firstNonDiscreteCell);
Result result = Result.BETTER;
if (bestExist) {
pi1 = finer.setAsPermutation(firstNonDiscreteCell); // depends on control dependency: [if], data = [none]
result = compareRowwise(pi1); // depends on control dependency: [if], data = [none]
}
// partition is discrete
if (finer.size() == vertexCount) {
if (!bestExist) {
best = finer.toPermutation(); // depends on control dependency: [if], data = [none]
first = finer.toPermutation(); // depends on control dependency: [if], data = [none]
bestExist = true; // depends on control dependency: [if], data = [none]
} else {
if (result == Result.BETTER) {
best = new Permutation(pi1); // depends on control dependency: [if], data = [none]
} else if (result == Result.EQUAL) {
group.enter(pi1.multiply(best.invert())); // depends on control dependency: [if], data = [none]
}
}
} else {
if (result != Result.WORSE) {
Set<Integer> blockCopy = finer.copyBlock(firstNonDiscreteCell);
for (int vertexInBlock = 0; vertexInBlock < vertexCount; vertexInBlock++) {
if (blockCopy.contains(vertexInBlock)) {
Partition nextPartition = finer.splitBefore(firstNonDiscreteCell, vertexInBlock);
this.refine(group, nextPartition); // depends on control dependency: [if], data = [none]
int[] permF = new int[vertexCount];
int[] invF = new int[vertexCount];
for (int i = 0; i < vertexCount; i++) {
permF[i] = i; // depends on control dependency: [for], data = [i]
invF[i] = i; // depends on control dependency: [for], data = [i]
}
for (int j = 0; j <= firstNonDiscreteCell; j++) {
int x = nextPartition.getFirstInCell(j);
int i = invF[x];
int h = permF[j];
permF[j] = x; // depends on control dependency: [for], data = [j]
permF[i] = h; // depends on control dependency: [for], data = [none]
invF[h] = i; // depends on control dependency: [for], data = [none]
invF[x] = j; // depends on control dependency: [for], data = [j]
}
Permutation pPermF = new Permutation(permF);
group.changeBase(pPermF); // depends on control dependency: [if], data = [none]
for (int j = 0; j < vertexCount; j++) {
Permutation g = group.get(firstNonDiscreteCell, j);
if (g != null) {
blockCopy.remove(g.get(vertexInBlock)); // depends on control dependency: [if], data = [(g]
}
}
}
}
}
}
} }
|
public class class_name {
private void bindEvents() {
visibilityToggle.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (visibilityToggle.isEnabled()) {
layer.setMarkedAsVisible(!layer.isMarkedAsVisible());
visibilityToggle.setEnabled(true); // Works because JavaScript is single threaded...
}
}
});
} }
|
public class class_name {
private void bindEvents() {
visibilityToggle.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (visibilityToggle.isEnabled()) {
layer.setMarkedAsVisible(!layer.isMarkedAsVisible()); // depends on control dependency: [if], data = [none]
visibilityToggle.setEnabled(true); // Works because JavaScript is single threaded... // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public Object invoke(ELContext context,
Object base,
Object method,
Class<?>[] paramTypes,
Object[] params) {
if (base == null || method == null) {
return null;
}
Method m = ELUtil.findMethod(base.getClass(), method.toString(),
paramTypes,params, false);
m = BeanPropertiesCache.getMethod(base.getClass(), m);
for (Object p: params) {
// If the parameters is a LambdaExpression, set the ELContext
// for its evaluation
if (p instanceof javax.el.LambdaExpression) {
((javax.el.LambdaExpression) p).setELContext(context);
}
}
Object ret = ELUtil.invokeMethod(context, m, base, params);
context.setPropertyResolved(base, method);
return ret;
} }
|
public class class_name {
public Object invoke(ELContext context,
Object base,
Object method,
Class<?>[] paramTypes,
Object[] params) {
if (base == null || method == null) {
return null; // depends on control dependency: [if], data = [none]
}
Method m = ELUtil.findMethod(base.getClass(), method.toString(),
paramTypes,params, false);
m = BeanPropertiesCache.getMethod(base.getClass(), m);
for (Object p: params) {
// If the parameters is a LambdaExpression, set the ELContext
// for its evaluation
if (p instanceof javax.el.LambdaExpression) {
((javax.el.LambdaExpression) p).setELContext(context); // depends on control dependency: [if], data = [none]
}
}
Object ret = ELUtil.invokeMethod(context, m, base, params);
context.setPropertyResolved(base, method);
return ret;
} }
|
public class class_name {
public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> listAvailableWafRuleSetsWithServiceResponseAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-06-01";
return service.listAvailableWafRuleSets(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>>>() {
@Override
public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner> clientResponse = listAvailableWafRuleSetsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> listAvailableWafRuleSetsWithServiceResponseAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-06-01";
return service.listAvailableWafRuleSets(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>>>() {
@Override
public Observable<ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ApplicationGatewayAvailableWafRuleSetsResultInner> clientResponse = listAvailableWafRuleSetsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static Object getStaticPropertyValue(Class<?> clazz, String name) {
Method getter = BeanUtils.findDeclaredMethod(clazz, getGetterName(name), (Class[])null);
try {
if (getter != null) {
ReflectionUtils.makeAccessible(getter);
return getter.invoke(clazz);
}
return getStaticFieldValue(clazz, name);
}
catch (Exception ignored) {
// ignored
}
return null;
} }
|
public class class_name {
public static Object getStaticPropertyValue(Class<?> clazz, String name) {
Method getter = BeanUtils.findDeclaredMethod(clazz, getGetterName(name), (Class[])null);
try {
if (getter != null) {
ReflectionUtils.makeAccessible(getter); // depends on control dependency: [if], data = [(getter]
return getter.invoke(clazz); // depends on control dependency: [if], data = [none]
}
return getStaticFieldValue(clazz, name); // depends on control dependency: [try], data = [none]
}
catch (Exception ignored) {
// ignored
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public static UserProfile getUserProfile() {
UserProfile userProfile = null;
Subject subject = getSubject();
Iterator<UserProfile> userProfilesIterator = subject.getPrivateCredentials(UserProfile.class).iterator();
if (userProfilesIterator.hasNext()) {
userProfile = userProfilesIterator.next();
}
return userProfile;
} }
|
public class class_name {
public static UserProfile getUserProfile() {
UserProfile userProfile = null;
Subject subject = getSubject();
Iterator<UserProfile> userProfilesIterator = subject.getPrivateCredentials(UserProfile.class).iterator();
if (userProfilesIterator.hasNext()) {
userProfile = userProfilesIterator.next(); // depends on control dependency: [if], data = [none]
}
return userProfile;
} }
|
public class class_name {
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException {
if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) {
return null;
}
if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) {
throw new SQLException("At least two points are required to make a line.");
}
List<Coordinate> coordinateList = new LinkedList<Coordinate>();
addCoordinatesToList(pointA, coordinateList);
for (Geometry optionalPoint : optionalPoints) {
addCoordinatesToList(optionalPoint, coordinateList);
}
return ((Geometry) pointA).getFactory().createLineString(
coordinateList.toArray(new Coordinate[optionalPoints.length]));
} }
|
public class class_name {
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException {
if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) {
throw new SQLException("At least two points are required to make a line.");
}
List<Coordinate> coordinateList = new LinkedList<Coordinate>();
addCoordinatesToList(pointA, coordinateList);
for (Geometry optionalPoint : optionalPoints) {
addCoordinatesToList(optionalPoint, coordinateList); // depends on control dependency: [for], data = [optionalPoint]
}
return ((Geometry) pointA).getFactory().createLineString(
coordinateList.toArray(new Coordinate[optionalPoints.length]));
} }
|
public class class_name {
@Override
public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {
Collection entities = new ArrayList();
Connection conn = null;
String groupID = group.getLocalKey();
Class cls = group.getLeafType();
try {
conn = RDBMServices.getConnection();
Statement stmnt = conn.createStatement();
try {
String query =
"SELECT "
+ MEMBER_MEMBER_KEY_COLUMN
+ " FROM "
+ MEMBER_TABLE
+ " WHERE "
+ MEMBER_GROUP_ID_COLUMN
+ " = '"
+ groupID
+ "' AND "
+ MEMBER_IS_GROUP_COLUMN
+ " = '"
+ MEMBER_IS_ENTITY
+ "'";
ResultSet rs = stmnt.executeQuery(query);
try {
while (rs.next()) {
String key = rs.getString(1);
IEntity e = newEntity(cls, key);
entities.add(e);
}
} finally {
rs.close();
}
} finally {
stmnt.close();
}
} catch (SQLException sqle) {
LOG.error("Problem retrieving Entities for Group: " + group, sqle);
throw new GroupsException("Problem retrieving Entities for Group", sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
return entities.iterator();
} }
|
public class class_name {
@Override
public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {
Collection entities = new ArrayList();
Connection conn = null;
String groupID = group.getLocalKey();
Class cls = group.getLeafType();
try {
conn = RDBMServices.getConnection();
Statement stmnt = conn.createStatement();
try {
String query =
"SELECT "
+ MEMBER_MEMBER_KEY_COLUMN
+ " FROM "
+ MEMBER_TABLE
+ " WHERE "
+ MEMBER_GROUP_ID_COLUMN
+ " = '"
+ groupID
+ "' AND "
+ MEMBER_IS_GROUP_COLUMN
+ " = '"
+ MEMBER_IS_ENTITY
+ "'";
ResultSet rs = stmnt.executeQuery(query);
try {
while (rs.next()) {
String key = rs.getString(1);
IEntity e = newEntity(cls, key);
entities.add(e); // depends on control dependency: [while], data = [none]
}
} finally {
rs.close();
}
} finally {
stmnt.close();
}
} catch (SQLException sqle) {
LOG.error("Problem retrieving Entities for Group: " + group, sqle);
throw new GroupsException("Problem retrieving Entities for Group", sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
return entities.iterator();
} }
|
public class class_name {
private void writeMethods(Definition def, Writer out, int indent) throws IOException
{
if (def.getMcfDefs().get(0).isDefineMethodInConnection())
{
if (def.getMcfDefs().get(0).getMethods().size() > 0)
{
for (MethodForConnection method : def.getMcfDefs().get(0).getMethods())
{
writeMethodSignature(out, indent, method);
writeLeftCurlyBracket(out, indent);
writeIndent(out, indent + 1);
if (!method.getReturnType().equals("void"))
{
out.write("return ");
}
out.write("getConnection()." + method.getMethodName() + "(");
int paramSize = method.getParams().size();
for (int i = 0; i < paramSize; i++)
{
MethodParam param = method.getParams().get(i);
out.write(param.getName());
if (i + 1 < paramSize)
out.write(", ");
}
out.write(");\n");
writeRightCurlyBracket(out, indent);
}
}
}
else
{
writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "try");
writeLeftCurlyBracket(out, indent + 1);
writeWithIndent(out, indent + 2, "getConnection().callMe();");
writeRightCurlyBracket(out, indent + 1);
writeWithIndent(out, indent + 1, "catch (Exception e)");
writeLeftCurlyBracket(out, indent + 1);
writeRightCurlyBracket(out, indent + 1);
writeRightCurlyBracket(out, indent);
}
} }
|
public class class_name {
private void writeMethods(Definition def, Writer out, int indent) throws IOException
{
if (def.getMcfDefs().get(0).isDefineMethodInConnection())
{
if (def.getMcfDefs().get(0).getMethods().size() > 0)
{
for (MethodForConnection method : def.getMcfDefs().get(0).getMethods())
{
writeMethodSignature(out, indent, method); // depends on control dependency: [for], data = [method]
writeLeftCurlyBracket(out, indent); // depends on control dependency: [for], data = [none]
writeIndent(out, indent + 1); // depends on control dependency: [for], data = [none]
if (!method.getReturnType().equals("void"))
{
out.write("return "); // depends on control dependency: [if], data = [none]
}
out.write("getConnection()." + method.getMethodName() + "("); // depends on control dependency: [for], data = [method]
int paramSize = method.getParams().size();
for (int i = 0; i < paramSize; i++)
{
MethodParam param = method.getParams().get(i);
out.write(param.getName()); // depends on control dependency: [for], data = [none]
if (i + 1 < paramSize)
out.write(", ");
}
out.write(");\n"); // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
writeRightCurlyBracket(out, indent); // depends on control dependency: [for], data = [none]
}
}
}
else
{
writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "try");
writeLeftCurlyBracket(out, indent + 1);
writeWithIndent(out, indent + 2, "getConnection().callMe();");
writeRightCurlyBracket(out, indent + 1);
writeWithIndent(out, indent + 1, "catch (Exception e)");
writeLeftCurlyBracket(out, indent + 1);
writeRightCurlyBracket(out, indent + 1);
writeRightCurlyBracket(out, indent);
}
} }
|
public class class_name {
private void applyMax(Dimension dim) {
if (getMaxHeight() > 0) {
dim.height = Math.min(dim.height, getMaxHeight());
}
if (getMaxWidth() > 0) {
dim.width = Math.min(dim.width, getMaxWidth());
}
} }
|
public class class_name {
private void applyMax(Dimension dim) {
if (getMaxHeight() > 0) {
dim.height = Math.min(dim.height, getMaxHeight());
// depends on control dependency: [if], data = [none]
}
if (getMaxWidth() > 0) {
dim.width = Math.min(dim.width, getMaxWidth());
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void visitFiles(final FileVisitor visitor) {
final Project p = getProject();
if (p == null) {
throw new java.lang.IllegalStateException("project must be set before this call");
}
if (isReference()) {
((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).visitFiles(visitor);
}
//
// if this processor extends another,
// visit its files first
//
final ProcessorDef extendsDef = getExtends();
if (extendsDef != null) {
extendsDef.visitFiles(visitor);
}
for (int i = 0; i < this.srcSets.size(); i++) {
final ConditionalFileSet srcSet = (ConditionalFileSet) this.srcSets.elementAt(i);
if (srcSet.isActive()) {
// Find matching source files
final DirectoryScanner scanner = srcSet.getDirectoryScanner(p);
// Check each source file - see if it needs compilation
final String[] fileNames = scanner.getIncludedFiles();
final File parentDir = scanner.getBasedir();
for (final String currentFile : fileNames) {
visitor.visit(parentDir, currentFile);
}
}
}
} }
|
public class class_name {
public void visitFiles(final FileVisitor visitor) {
final Project p = getProject();
if (p == null) {
throw new java.lang.IllegalStateException("project must be set before this call");
}
if (isReference()) {
((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).visitFiles(visitor); // depends on control dependency: [if], data = [none]
}
//
// if this processor extends another,
// visit its files first
//
final ProcessorDef extendsDef = getExtends();
if (extendsDef != null) {
extendsDef.visitFiles(visitor); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < this.srcSets.size(); i++) {
final ConditionalFileSet srcSet = (ConditionalFileSet) this.srcSets.elementAt(i);
if (srcSet.isActive()) {
// Find matching source files
final DirectoryScanner scanner = srcSet.getDirectoryScanner(p);
// Check each source file - see if it needs compilation
final String[] fileNames = scanner.getIncludedFiles();
final File parentDir = scanner.getBasedir();
for (final String currentFile : fileNames) {
visitor.visit(parentDir, currentFile); // depends on control dependency: [for], data = [currentFile]
}
}
}
} }
|
public class class_name {
@Override
public void await() throws InterruptedException {
queueLock.lock();
try {
while(test()) {
condition.await();
}
}
finally {
queueLock.unlock();
}
} }
|
public class class_name {
@Override
public void await() throws InterruptedException {
queueLock.lock();
try {
while(test()) {
condition.await(); // depends on control dependency: [while], data = [none]
}
}
finally {
queueLock.unlock();
}
} }
|
public class class_name {
public void hideMenuButton(final boolean animate) {
if (!isMenuButtonHidden() && !mIsMenuButtonAnimationRunning) {
mIsMenuButtonAnimationRunning = true;
if (isOpened()) {
close(animate);
mUiHandler.postDelayed(new Runnable() {
@Override
public void run() {
hideMenuButtonWithImage(animate);
}
}, mAnimationDelayPerItem * mButtonsCount);
} else {
hideMenuButtonWithImage(animate);
}
}
} }
|
public class class_name {
public void hideMenuButton(final boolean animate) {
if (!isMenuButtonHidden() && !mIsMenuButtonAnimationRunning) {
mIsMenuButtonAnimationRunning = true; // depends on control dependency: [if], data = [none]
if (isOpened()) {
close(animate); // depends on control dependency: [if], data = [none]
mUiHandler.postDelayed(new Runnable() {
@Override
public void run() {
hideMenuButtonWithImage(animate);
}
}, mAnimationDelayPerItem * mButtonsCount); // depends on control dependency: [if], data = [none]
} else {
hideMenuButtonWithImage(animate); // depends on control dependency: [if], data = [none]
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.