code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) {
JsonResultSet similar = new JsonResultSet();
byte[] vectorInBytes = new byte[8 * vector.length];
ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes);
for (double value : vector) {
bbuf.putDouble(value);
}
PostMethod queryMethod = null;
String response = null;
try {
ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes);
Part[] parts = {
new StringPart("id", id),
new FilePart("vector", source),
new StringPart("threshold", String.valueOf(threshold))
};
queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + collectionName);
queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams()));
int code = httpClient.executeMethod(queryMethod);
if (code == 200) {
InputStream inputStream = queryMethod.getResponseBodyAsStream();
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer);
response = writer.toString();
queryMethod.releaseConnection();
similar = parseResponse(response);
}
} catch (Exception e) {
_logger.error("Exception for vector of length " + vector.length, e);
response = null;
} finally {
if (queryMethod != null) {
queryMethod.releaseConnection();
}
}
return similar;
} }
|
public class class_name {
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) {
JsonResultSet similar = new JsonResultSet();
byte[] vectorInBytes = new byte[8 * vector.length];
ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes);
for (double value : vector) {
bbuf.putDouble(value); // depends on control dependency: [for], data = [value]
}
PostMethod queryMethod = null;
String response = null;
try {
ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes);
Part[] parts = {
new StringPart("id", id),
new FilePart("vector", source),
new StringPart("threshold", String.valueOf(threshold))
};
queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + collectionName); // depends on control dependency: [try], data = [none]
queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); // depends on control dependency: [try], data = [none]
int code = httpClient.executeMethod(queryMethod);
if (code == 200) {
InputStream inputStream = queryMethod.getResponseBodyAsStream();
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer); // depends on control dependency: [if], data = [none]
response = writer.toString(); // depends on control dependency: [if], data = [none]
queryMethod.releaseConnection(); // depends on control dependency: [if], data = [none]
similar = parseResponse(response); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
_logger.error("Exception for vector of length " + vector.length, e);
response = null;
} finally { // depends on control dependency: [catch], data = [none]
if (queryMethod != null) {
queryMethod.releaseConnection(); // depends on control dependency: [if], data = [none]
}
}
return similar;
} }
|
public class class_name {
@Override
public void onDraw(Canvas canvas) {
if (animationOn) {
if (angleRecalculate(new Date().getTime())) {
this.setRotation(angle1);
}
} else {
this.setRotation(angle1);
}
super.onDraw(canvas);
if (animationOn) {
this.invalidate();
}
} }
|
public class class_name {
@Override
public void onDraw(Canvas canvas) {
if (animationOn) {
if (angleRecalculate(new Date().getTime())) {
this.setRotation(angle1); // depends on control dependency: [if], data = [none]
}
} else {
this.setRotation(angle1); // depends on control dependency: [if], data = [none]
}
super.onDraw(canvas);
if (animationOn) {
this.invalidate(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setField(int fieldNum, Value value) {
// range check
if (fieldNum < 0) {
throw new IndexOutOfBoundsException();
}
// if the field number is beyond the size, the tuple is expanded
if (fieldNum >= this.numFields) {
setNumFields(fieldNum + 1);
}
internallySetField(fieldNum, value);
} }
|
public class class_name {
public void setField(int fieldNum, Value value) {
// range check
if (fieldNum < 0) {
throw new IndexOutOfBoundsException();
}
// if the field number is beyond the size, the tuple is expanded
if (fieldNum >= this.numFields) {
setNumFields(fieldNum + 1); // depends on control dependency: [if], data = [(fieldNum]
}
internallySetField(fieldNum, value);
} }
|
public class class_name {
private void doWork()
{
while (cancelled.get() == false)
{
TimeoutExt work = queue.take();
// Do work, if any
if (work != null)
{
// Wrap the TimeoutExt with a runnable that invokes the target callback
TimeoutWorker worker = new TimeoutWorker(work);
try
{
threadPool.run(worker);
}
catch (Throwable t)
{
// protect the worker thread from pool enqueue errors
ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
}
synchronized (work)
{
work.done();
}
}
}
// TimeoutFactory was cancelled
queue.cancel();
} }
|
public class class_name {
private void doWork()
{
while (cancelled.get() == false)
{
TimeoutExt work = queue.take();
// Do work, if any
if (work != null)
{
// Wrap the TimeoutExt with a runnable that invokes the target callback
TimeoutWorker worker = new TimeoutWorker(work);
try
{
threadPool.run(worker); // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
// protect the worker thread from pool enqueue errors
ThrowableHandler.add(ThrowableHandler.Type.ERROR, t);
} // depends on control dependency: [catch], data = [none]
synchronized (work) // depends on control dependency: [if], data = [(work]
{
work.done();
}
}
}
// TimeoutFactory was cancelled
queue.cancel();
} }
|
public class class_name {
public final EObject entryRuleJvmArgumentTypeReference() throws RecognitionException {
EObject current = null;
EObject iv_ruleJvmArgumentTypeReference = null;
try {
// InternalXbaseWithAnnotations.g:6286:65: (iv_ruleJvmArgumentTypeReference= ruleJvmArgumentTypeReference EOF )
// InternalXbaseWithAnnotations.g:6287:2: iv_ruleJvmArgumentTypeReference= ruleJvmArgumentTypeReference EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceRule());
}
pushFollow(FOLLOW_1);
iv_ruleJvmArgumentTypeReference=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleJvmArgumentTypeReference;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject entryRuleJvmArgumentTypeReference() throws RecognitionException {
EObject current = null;
EObject iv_ruleJvmArgumentTypeReference = null;
try {
// InternalXbaseWithAnnotations.g:6286:65: (iv_ruleJvmArgumentTypeReference= ruleJvmArgumentTypeReference EOF )
// InternalXbaseWithAnnotations.g:6287:2: iv_ruleJvmArgumentTypeReference= ruleJvmArgumentTypeReference EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleJvmArgumentTypeReference=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleJvmArgumentTypeReference; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private CharType nearestCharType(CharType... types) {
for (Character chr : chars) {
for (CharType type : types) {
if (type.isMatchedBy(chr)) {
return type;
}
}
}
return CharType.EOL;
} }
|
public class class_name {
private CharType nearestCharType(CharType... types) {
for (Character chr : chars) {
for (CharType type : types) {
if (type.isMatchedBy(chr)) {
return type; // depends on control dependency: [if], data = [none]
}
}
}
return CharType.EOL;
} }
|
public class class_name {
private static void initURLTemplates( ServletContext servletContext )
{
TemplatedURLFormatter formatter = TemplatedURLFormatter.getTemplatedURLFormatter( servletContext );
if ( formatter == null )
{
// get the default template formatter class name from the config file
formatter = getTemplatedURLFormatter();
assert formatter != null : "Found a non-null URL formatter";
// set the TemplatedURLFormatter attribute on the context.
TemplatedURLFormatter.initServletContext( servletContext, formatter );
}
URLTemplatesFactory templatesFactory = URLTemplatesFactory.getURLTemplatesFactory( servletContext );
if ( templatesFactory == null )
{
// URLTemplatesFactory has not been initialized,
// get a URLTemplatesFactory object from the containerAdapter.
templatesFactory = PageFlowUtils.createURLTemplatesFactory( servletContext );
// get the known/req tokens from the default formatter for the factory to use to verify templates
templatesFactory.setKnownTokens( formatter.getKnownTokens() );
templatesFactory.setRequiredTokens( formatter.getRequiredTokens() );
templatesFactory.load( servletContext );
// set the URLTemplatesFactory attribute on the context.
URLTemplatesFactory.initServletContext( servletContext, templatesFactory );
}
} }
|
public class class_name {
private static void initURLTemplates( ServletContext servletContext )
{
TemplatedURLFormatter formatter = TemplatedURLFormatter.getTemplatedURLFormatter( servletContext );
if ( formatter == null )
{
// get the default template formatter class name from the config file
formatter = getTemplatedURLFormatter(); // depends on control dependency: [if], data = [none]
assert formatter != null : "Found a non-null URL formatter";
// set the TemplatedURLFormatter attribute on the context.
TemplatedURLFormatter.initServletContext( servletContext, formatter ); // depends on control dependency: [if], data = [none]
}
URLTemplatesFactory templatesFactory = URLTemplatesFactory.getURLTemplatesFactory( servletContext );
if ( templatesFactory == null )
{
// URLTemplatesFactory has not been initialized,
// get a URLTemplatesFactory object from the containerAdapter.
templatesFactory = PageFlowUtils.createURLTemplatesFactory( servletContext ); // depends on control dependency: [if], data = [none]
// get the known/req tokens from the default formatter for the factory to use to verify templates
templatesFactory.setKnownTokens( formatter.getKnownTokens() ); // depends on control dependency: [if], data = [none]
templatesFactory.setRequiredTokens( formatter.getRequiredTokens() ); // depends on control dependency: [if], data = [none]
templatesFactory.load( servletContext ); // depends on control dependency: [if], data = [none]
// set the URLTemplatesFactory attribute on the context.
URLTemplatesFactory.initServletContext( servletContext, templatesFactory ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addContext(Context c) {
if (c == null) {
throw new IllegalArgumentException("The context must not be null. ");
}
validateContextName(c.getName());
this.contexts.add(c);
this.model.loadContext(c);
for (OnContextsChangedListener l : contextsChangedListeners) {
l.contextAdded(c);
}
if (View.isInitialised()) {
View.getSingleton().addContext(c);
}
} }
|
public class class_name {
public void addContext(Context c) {
if (c == null) {
throw new IllegalArgumentException("The context must not be null. ");
}
validateContextName(c.getName());
this.contexts.add(c);
this.model.loadContext(c);
for (OnContextsChangedListener l : contextsChangedListeners) {
l.contextAdded(c);
// depends on control dependency: [for], data = [l]
}
if (View.isInitialised()) {
View.getSingleton().addContext(c);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getIfcSizeSelect() {
if (ifcSizeSelectEClass == null) {
ifcSizeSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(970);
}
return ifcSizeSelectEClass;
} }
|
public class class_name {
public EClass getIfcSizeSelect() {
if (ifcSizeSelectEClass == null) {
ifcSizeSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(970);
// depends on control dependency: [if], data = [none]
}
return ifcSizeSelectEClass;
} }
|
public class class_name {
private String restoreMultidots(String line) {
while (line.contains("DOTDOTMULTI")) {
line = line.replaceAll("DOTDOTMULTI", "DOTMULTI.");
}
line = line.replaceAll("DOTMULTI", ".");
return line;
} }
|
public class class_name {
private String restoreMultidots(String line) {
while (line.contains("DOTDOTMULTI")) {
line = line.replaceAll("DOTDOTMULTI", "DOTMULTI."); // depends on control dependency: [while], data = [none]
}
line = line.replaceAll("DOTMULTI", ".");
return line;
} }
|
public class class_name {
public void sendWithAttachment(String subject,
String textBody,
String attachmentType,
String attachmentName,
InputStream is)
{
try {
MimeMessage msg = new MimeMessage(getSession());
if(_from.length > 0)
msg.addFrom(_from);
msg.addRecipients(RecipientType.TO, _to);
if(subject != null)
msg.setSubject(subject);
// msg.setContent(textBody, "multipart/mime");
MimeMultipart multipart = new MimeMultipart();
MimeBodyPart textBodyPart = new MimeBodyPart();
textBodyPart.setText(textBody);
multipart.addBodyPart(textBodyPart);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TempBuffer tb = TempBuffer.create();
byte []buffer = tb.buffer();
int len;
while ((len = is.read(buffer, 0, buffer.length)) >= 0) {
bos.write(buffer, 0, len);
}
bos.close();
byte []content = bos.toByteArray();
TempBuffer.free(tb);
DataSource dataSource
= new ByteArrayDataSource(content, attachmentType);
MimeBodyPart pdfBodyPart = new MimeBodyPart();
pdfBodyPart.setDataHandler(new DataHandler(dataSource));
pdfBodyPart.setFileName(attachmentName);
multipart.addBodyPart(pdfBodyPart);
msg.setContent(multipart);
send(msg);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public void sendWithAttachment(String subject,
String textBody,
String attachmentType,
String attachmentName,
InputStream is)
{
try {
MimeMessage msg = new MimeMessage(getSession());
if(_from.length > 0)
msg.addFrom(_from);
msg.addRecipients(RecipientType.TO, _to); // depends on control dependency: [try], data = [none]
if(subject != null)
msg.setSubject(subject);
// msg.setContent(textBody, "multipart/mime");
MimeMultipart multipart = new MimeMultipart();
MimeBodyPart textBodyPart = new MimeBodyPart();
textBodyPart.setText(textBody); // depends on control dependency: [try], data = [none]
multipart.addBodyPart(textBodyPart); // depends on control dependency: [try], data = [none]
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TempBuffer tb = TempBuffer.create();
byte []buffer = tb.buffer();
int len;
while ((len = is.read(buffer, 0, buffer.length)) >= 0) {
bos.write(buffer, 0, len); // depends on control dependency: [while], data = [none]
}
bos.close(); // depends on control dependency: [try], data = [none]
byte []content = bos.toByteArray();
TempBuffer.free(tb); // depends on control dependency: [try], data = [none]
DataSource dataSource
= new ByteArrayDataSource(content, attachmentType);
MimeBodyPart pdfBodyPart = new MimeBodyPart();
pdfBodyPart.setDataHandler(new DataHandler(dataSource)); // depends on control dependency: [try], data = [none]
pdfBodyPart.setFileName(attachmentName); // depends on control dependency: [try], data = [none]
multipart.addBodyPart(pdfBodyPart); // depends on control dependency: [try], data = [none]
msg.setContent(multipart); // depends on control dependency: [try], data = [none]
send(msg); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw e;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Date[] removeDatastream(String id, Date start, Date end)
throws ServerException {
assertNotInvalidated();
assertNotPendingRemoval();
ArrayList<Datastream> removeList = new ArrayList<Datastream>();
for (Datastream ds : m_obj.datastreams(id)) {
boolean doRemove = false;
if (start != null) {
if (end != null) {
if (ds.DSCreateDT.compareTo(start) >= 0
&& ds.DSCreateDT.compareTo(end) <= 0) {
doRemove = true;
}
} else {
if (ds.DSCreateDT.compareTo(start) >= 0) {
doRemove = true;
}
}
} else {
if (end != null) {
if (ds.DSCreateDT.compareTo(end) <= 0) {
doRemove = true;
}
} else {
doRemove = true;
}
}
if (doRemove) {
// Note: We don't remove old audit records by design.
// add this datastream to the datastream to-be-removed list.
removeList.add(ds);
}
}
/* Now that we've identified all ds versions to remove, remove 'em */
for (Datastream toRemove : removeList) {
m_obj.removeDatastreamVersion(toRemove);
}
// finally, return the dates of each deleted item
Date[] deletedDates = new Date[removeList.size()];
for (int i = 0; i < removeList.size(); i++) {
deletedDates[i] = (removeList.get(i)).DSCreateDT;
}
return deletedDates;
} }
|
public class class_name {
public Date[] removeDatastream(String id, Date start, Date end)
throws ServerException {
assertNotInvalidated();
assertNotPendingRemoval();
ArrayList<Datastream> removeList = new ArrayList<Datastream>();
for (Datastream ds : m_obj.datastreams(id)) {
boolean doRemove = false;
if (start != null) {
if (end != null) {
if (ds.DSCreateDT.compareTo(start) >= 0
&& ds.DSCreateDT.compareTo(end) <= 0) {
doRemove = true; // depends on control dependency: [if], data = [none]
}
} else {
if (ds.DSCreateDT.compareTo(start) >= 0) {
doRemove = true; // depends on control dependency: [if], data = [none]
}
}
} else {
if (end != null) {
if (ds.DSCreateDT.compareTo(end) <= 0) {
doRemove = true; // depends on control dependency: [if], data = [none]
}
} else {
doRemove = true; // depends on control dependency: [if], data = [none]
}
}
if (doRemove) {
// Note: We don't remove old audit records by design.
// add this datastream to the datastream to-be-removed list.
removeList.add(ds); // depends on control dependency: [if], data = [none]
}
}
/* Now that we've identified all ds versions to remove, remove 'em */
for (Datastream toRemove : removeList) {
m_obj.removeDatastreamVersion(toRemove);
}
// finally, return the dates of each deleted item
Date[] deletedDates = new Date[removeList.size()];
for (int i = 0; i < removeList.size(); i++) {
deletedDates[i] = (removeList.get(i)).DSCreateDT;
}
return deletedDates;
} }
|
public class class_name {
private byte[][] toByteArrays(final byte[] keyspace, final byte[] uid, final byte[] serviceCode,
final long expireMillis, final byte[][] keys) {
final byte[][] allArgs = new byte[keys.length + 4][];
int index = 0;
allArgs[index++] = keyspace;
allArgs[index++] = uid;
allArgs[index++] = serviceCode;
allArgs[index++] = RedisProtocol.toByteArray(expireMillis);
for (int i = 0; i < keys.length; i++) {
allArgs[index++] = keys[i];
}
return allArgs;
} }
|
public class class_name {
private byte[][] toByteArrays(final byte[] keyspace, final byte[] uid, final byte[] serviceCode,
final long expireMillis, final byte[][] keys) {
final byte[][] allArgs = new byte[keys.length + 4][];
int index = 0;
allArgs[index++] = keyspace;
allArgs[index++] = uid;
allArgs[index++] = serviceCode;
allArgs[index++] = RedisProtocol.toByteArray(expireMillis);
for (int i = 0; i < keys.length; i++) {
allArgs[index++] = keys[i]; // depends on control dependency: [for], data = [i]
}
return allArgs;
} }
|
public class class_name {
public static String getTargetUrl() {
String targetUrl = System.getenv(ENV_API_URL_KEY);
if (targetUrl != null) {
return targetUrl;
} else {
targetUrl = apiUrl;
}
return targetUrl;
} }
|
public class class_name {
public static String getTargetUrl() {
String targetUrl = System.getenv(ENV_API_URL_KEY);
if (targetUrl != null) {
return targetUrl; // depends on control dependency: [if], data = [none]
} else {
targetUrl = apiUrl; // depends on control dependency: [if], data = [none]
}
return targetUrl;
} }
|
public class class_name {
public void addDateRangeFilter(String key, DateRange dateRange) {
JsonObject opObj = new JsonObject();
if (dateRange.getFromDate() != null) {
String dateGtString = BoxDateFormat.format(dateRange.getFromDate());
//workaround replacing + and - 000 at the end with 'Z'
dateGtString = dateGtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("gt", dateGtString);
}
if (dateRange.getToDate() != null) {
String dateLtString = BoxDateFormat.format(dateRange.getToDate());
//workaround replacing + and - 000 at the end with 'Z'
dateLtString = dateLtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("lt", dateLtString);
}
this.filtersList.add(key, opObj);
} }
|
public class class_name {
public void addDateRangeFilter(String key, DateRange dateRange) {
JsonObject opObj = new JsonObject();
if (dateRange.getFromDate() != null) {
String dateGtString = BoxDateFormat.format(dateRange.getFromDate());
//workaround replacing + and - 000 at the end with 'Z'
dateGtString = dateGtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("gt", dateGtString); // depends on control dependency: [if], data = [none]
}
if (dateRange.getToDate() != null) {
String dateLtString = BoxDateFormat.format(dateRange.getToDate());
//workaround replacing + and - 000 at the end with 'Z'
dateLtString = dateLtString.replaceAll("(\\+|-)(?!-\\|?!\\+)\\d+$", "Z");
opObj.add("lt", dateLtString); // depends on control dependency: [if], data = [none]
}
this.filtersList.add(key, opObj);
} }
|
public class class_name {
public String whenAsText() {
if (whenAsText == null) {
whenAsText = DateTimeFormatter.ISO_INSTANT.format(Instant.ofEpochMilli(when()));
}
return whenAsText;
} }
|
public class class_name {
public String whenAsText() {
if (whenAsText == null) {
whenAsText = DateTimeFormatter.ISO_INSTANT.format(Instant.ofEpochMilli(when())); // depends on control dependency: [if], data = [none]
}
return whenAsText;
} }
|
public class class_name {
private boolean isFresh(final YokeRequest request) {
// defaults
boolean etagMatches = true;
boolean notModified = true;
// fields
String modifiedSince = request.getHeader("if-modified-since");
String noneMatch = request.getHeader("if-none-match");
String[] noneMatchTokens = null;
String lastModified = request.response().getHeader("last-modified");
String etag = request.response().getHeader("etag");
// unconditional request
if (modifiedSince == null && noneMatch == null) {
return false;
}
// parse if-none-match
if (noneMatch != null) {
noneMatchTokens = noneMatch.split(" *, *");
}
// if-none-match
if (noneMatchTokens != null) {
etagMatches = false;
for (String s : noneMatchTokens) {
if (etag.equals(s) || "*".equals(noneMatchTokens[0])) {
etagMatches = true;
break;
}
}
}
// if-modified-since
if (modifiedSince != null) {
try {
Date modifiedSinceDate = parse(modifiedSince);
Date lastModifiedDate = parse(lastModified);
notModified = lastModifiedDate.getTime() <= modifiedSinceDate.getTime();
} catch (ParseException e) {
notModified = false;
}
}
return etagMatches && notModified;
} }
|
public class class_name {
private boolean isFresh(final YokeRequest request) {
// defaults
boolean etagMatches = true;
boolean notModified = true;
// fields
String modifiedSince = request.getHeader("if-modified-since");
String noneMatch = request.getHeader("if-none-match");
String[] noneMatchTokens = null;
String lastModified = request.response().getHeader("last-modified");
String etag = request.response().getHeader("etag");
// unconditional request
if (modifiedSince == null && noneMatch == null) {
return false; // depends on control dependency: [if], data = [none]
}
// parse if-none-match
if (noneMatch != null) {
noneMatchTokens = noneMatch.split(" *, *"); // depends on control dependency: [if], data = [none]
}
// if-none-match
if (noneMatchTokens != null) {
etagMatches = false; // depends on control dependency: [if], data = [none]
for (String s : noneMatchTokens) {
if (etag.equals(s) || "*".equals(noneMatchTokens[0])) {
etagMatches = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
// if-modified-since
if (modifiedSince != null) {
try {
Date modifiedSinceDate = parse(modifiedSince);
Date lastModifiedDate = parse(lastModified);
notModified = lastModifiedDate.getTime() <= modifiedSinceDate.getTime(); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
notModified = false;
} // depends on control dependency: [catch], data = [none]
}
return etagMatches && notModified;
} }
|
public class class_name {
public void removeMessages(final int index) {
MessageModel model = getOrCreateComponentModel();
if (model.messages != null) {
model.messages.remove(index);
}
} }
|
public class class_name {
public void removeMessages(final int index) {
MessageModel model = getOrCreateComponentModel();
if (model.messages != null) {
model.messages.remove(index); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
boolean equalsSorted(TouchState ts) {
if (ts.pointCount == pointCount
&& ts.primaryID == primaryID
&& ts.window == window) {
for (int i = 0; i < pointCount; i++) {
Point p1 = ts.points[i];
Point p2 = points[i];
if (p1.x != p2.x || p1.y != p2.y || p1.id != p2.id) {
return false;
}
}
return true;
} else {
return false;
}
} }
|
public class class_name {
boolean equalsSorted(TouchState ts) {
if (ts.pointCount == pointCount
&& ts.primaryID == primaryID
&& ts.window == window) {
for (int i = 0; i < pointCount; i++) {
Point p1 = ts.points[i];
Point p2 = points[i];
if (p1.x != p2.x || p1.y != p2.y || p1.id != p2.id) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void appendElapsed(StringBuilder buf, long elapsedNanos) {
if (elapsedNanos >= 100000000000L) { // >= 100 s
buf.append(elapsedNanos / 1000000000L).append("s(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000000L) { // >= 100 ms
buf.append(elapsedNanos / 1000000L).append("ms(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000L) { // >= 100 us
buf.append(elapsedNanos / 1000L).append("\u00B5s(").append(elapsedNanos).append("ns)"); // microsecs
} else {
buf.append(elapsedNanos).append("ns");
}
} }
|
public class class_name {
public static void appendElapsed(StringBuilder buf, long elapsedNanos) {
if (elapsedNanos >= 100000000000L) { // >= 100 s
buf.append(elapsedNanos / 1000000000L).append("s(").append(elapsedNanos).append("ns)"); // depends on control dependency: [if], data = [(elapsedNanos]
} else if (elapsedNanos >= 100000000L) { // >= 100 ms
buf.append(elapsedNanos / 1000000L).append("ms(").append(elapsedNanos).append("ns)"); // depends on control dependency: [if], data = [(elapsedNanos]
} else if (elapsedNanos >= 100000L) { // >= 100 us
buf.append(elapsedNanos / 1000L).append("\u00B5s(").append(elapsedNanos).append("ns)"); // microsecs // depends on control dependency: [if], data = [(elapsedNanos]
} else {
buf.append(elapsedNanos).append("ns"); // depends on control dependency: [if], data = [(elapsedNanos]
}
} }
|
public class class_name {
public void setLifecycleOwner(@Nullable LifecycleOwner lifecycleOwner) {
this.lifecycleOwner = lifecycleOwner;
if (recyclerView != null) {
for (int i = 0; i < recyclerView.getChildCount(); i++) {
View child = recyclerView.getChildAt(i);
ViewDataBinding binding = DataBindingUtil.getBinding(child);
if (binding != null) {
binding.setLifecycleOwner(lifecycleOwner);
}
}
}
} }
|
public class class_name {
public void setLifecycleOwner(@Nullable LifecycleOwner lifecycleOwner) {
this.lifecycleOwner = lifecycleOwner;
if (recyclerView != null) {
for (int i = 0; i < recyclerView.getChildCount(); i++) {
View child = recyclerView.getChildAt(i);
ViewDataBinding binding = DataBindingUtil.getBinding(child);
if (binding != null) {
binding.setLifecycleOwner(lifecycleOwner); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@Override
JSONObject toJson() {
JSONObject ret = super.toJson();
if (hasSingleAttribute()) {
ret.put("attribute",attributes.get(0));
} else if (!hasAllAttributes()) {
JSONArray attrs = new JSONArray();
attrs.addAll(attributes);
ret.put("attribute",attrs);
}
if (path != null) {
ret.put("path",path);
}
return ret;
} }
|
public class class_name {
@Override
JSONObject toJson() {
JSONObject ret = super.toJson();
if (hasSingleAttribute()) {
ret.put("attribute",attributes.get(0)); // depends on control dependency: [if], data = [none]
} else if (!hasAllAttributes()) {
JSONArray attrs = new JSONArray();
attrs.addAll(attributes); // depends on control dependency: [if], data = [none]
ret.put("attribute",attrs); // depends on control dependency: [if], data = [none]
}
if (path != null) {
ret.put("path",path); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
public Optional<String[]> splitPath(URI resource) {
int matchRes = matches(resource);
if (matchRes < 0) {
return Optional.empty();
}
return Optional.of(split(resource.getPath(), matchRes + 1));
} }
|
public class class_name {
public Optional<String[]> splitPath(URI resource) {
int matchRes = matches(resource);
if (matchRes < 0) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
return Optional.of(split(resource.getPath(), matchRes + 1));
} }
|
public class class_name {
public void marshall(StartTaskRequest startTaskRequest, ProtocolMarshaller protocolMarshaller) {
if (startTaskRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startTaskRequest.getCluster(), CLUSTER_BINDING);
protocolMarshaller.marshall(startTaskRequest.getTaskDefinition(), TASKDEFINITION_BINDING);
protocolMarshaller.marshall(startTaskRequest.getOverrides(), OVERRIDES_BINDING);
protocolMarshaller.marshall(startTaskRequest.getContainerInstances(), CONTAINERINSTANCES_BINDING);
protocolMarshaller.marshall(startTaskRequest.getStartedBy(), STARTEDBY_BINDING);
protocolMarshaller.marshall(startTaskRequest.getGroup(), GROUP_BINDING);
protocolMarshaller.marshall(startTaskRequest.getNetworkConfiguration(), NETWORKCONFIGURATION_BINDING);
protocolMarshaller.marshall(startTaskRequest.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(startTaskRequest.getEnableECSManagedTags(), ENABLEECSMANAGEDTAGS_BINDING);
protocolMarshaller.marshall(startTaskRequest.getPropagateTags(), PROPAGATETAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StartTaskRequest startTaskRequest, ProtocolMarshaller protocolMarshaller) {
if (startTaskRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startTaskRequest.getCluster(), CLUSTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getTaskDefinition(), TASKDEFINITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getOverrides(), OVERRIDES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getContainerInstances(), CONTAINERINSTANCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getStartedBy(), STARTEDBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getGroup(), GROUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getNetworkConfiguration(), NETWORKCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getEnableECSManagedTags(), ENABLEECSMANAGEDTAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startTaskRequest.getPropagateTags(), PROPAGATETAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException
{
BeanMetaData bmd = super.beanMetaData;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.entry(tc, "MEF.isDeliveryTransacted called for "
+ bmd.enterpriseBeanName + "." + method.getName());
}
/*
* Get EJBMethodInfo object for the specified method.
*/
EJBMethodInfoImpl minfo = getEJBMethodInfo(method);
if (minfo == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted failed to find method "
+ bmd.enterpriseBeanName + "." + method.getName());
}
// CNTR0085E: MDB {0} must implement method {1} of interface {2}.
Tr.error(tc, "NO_SUCH_MDB_METHOD_CNTR0085E",
bmd.j2eeName, method.getName(), bmd.localInterfaceClass);
throw new NoSuchMethodException(bmd.enterpriseBeanName + "." + method.getName()
+ " not found");
}
/*
* Use EJBMethodInfo object to determine if transacted or not.
* The assumption is true is returned only for TX_REQUIRED and
* false is returned for both BMT and TX_NOT_SUPPORTED.
*/
EJBTransactionAttribute txAttr = minfo.getEJBTransactionAttribute();
//TransactionAttribute txAttr = minfo.getTransactionAttribute();
boolean transacted;
if (txAttr == EJBTransactionAttribute.REQUIRED)
{
transacted = true;
}
else if (txAttr == EJBTransactionAttribute.NOT_SUPPORTED)
{
transacted = false;
}
else if (txAttr == EJBTransactionAttribute.BEAN_MANAGED)
{
// JCA 1.5 only addresses CMT. Our guess is BMT
// should return false. Would be nice to have a
// clarification to JCA spec regarding this case.
transacted = false;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted detected invalid TX attribute for "
+ bmd.enterpriseBeanName + "." + method.getName()
+ ", TX attribute is " + txAttr);
}
// Something is wrong since we should not have allowed a MDB to be installed
// with invalid deployment for transaction attributes.
// CNTR0084E: Method {0} of MDB {1} is deployed with an incorrect transaction attribute.
Tr.error(tc, "INVALID_MDB_TX_ATTR_CNTR0084E",
method.getName(), bmd.j2eeName);
ResourceException r;
r = new ApplicationServerInternalException(
"Method exists, but TX attribute is neither REQUIRED, NOT_SUPPORTED, nor BEAN_MANAGED: "
+ txAttr);
NoSuchMethodException ex = new NoSuchMethodException("see chained exception");
ex.initCause(r);
throw ex;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted returning " + transacted + " for "
+ bmd.enterpriseBeanName + "." + method.getName());
}
return transacted;
} }
|
public class class_name {
@Override
public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException
{
BeanMetaData bmd = super.beanMetaData;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.entry(tc, "MEF.isDeliveryTransacted called for "
+ bmd.enterpriseBeanName + "." + method.getName());
}
/*
* Get EJBMethodInfo object for the specified method.
*/
EJBMethodInfoImpl minfo = getEJBMethodInfo(method);
if (minfo == null)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted failed to find method "
+ bmd.enterpriseBeanName + "." + method.getName()); // depends on control dependency: [if], data = [none]
}
// CNTR0085E: MDB {0} must implement method {1} of interface {2}.
Tr.error(tc, "NO_SUCH_MDB_METHOD_CNTR0085E",
bmd.j2eeName, method.getName(), bmd.localInterfaceClass);
throw new NoSuchMethodException(bmd.enterpriseBeanName + "." + method.getName()
+ " not found");
}
/*
* Use EJBMethodInfo object to determine if transacted or not.
* The assumption is true is returned only for TX_REQUIRED and
* false is returned for both BMT and TX_NOT_SUPPORTED.
*/
EJBTransactionAttribute txAttr = minfo.getEJBTransactionAttribute();
//TransactionAttribute txAttr = minfo.getTransactionAttribute();
boolean transacted;
if (txAttr == EJBTransactionAttribute.REQUIRED)
{
transacted = true;
}
else if (txAttr == EJBTransactionAttribute.NOT_SUPPORTED)
{
transacted = false;
}
else if (txAttr == EJBTransactionAttribute.BEAN_MANAGED)
{
// JCA 1.5 only addresses CMT. Our guess is BMT
// should return false. Would be nice to have a
// clarification to JCA spec regarding this case.
transacted = false;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted detected invalid TX attribute for "
+ bmd.enterpriseBeanName + "." + method.getName()
+ ", TX attribute is " + txAttr);
}
// Something is wrong since we should not have allowed a MDB to be installed
// with invalid deployment for transaction attributes.
// CNTR0084E: Method {0} of MDB {1} is deployed with an incorrect transaction attribute.
Tr.error(tc, "INVALID_MDB_TX_ATTR_CNTR0084E",
method.getName(), bmd.j2eeName);
ResourceException r;
r = new ApplicationServerInternalException(
"Method exists, but TX attribute is neither REQUIRED, NOT_SUPPORTED, nor BEAN_MANAGED: "
+ txAttr);
NoSuchMethodException ex = new NoSuchMethodException("see chained exception");
ex.initCause(r);
throw ex;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
Tr.exit(tc, "MEF.isDeliveryTransacted returning " + transacted + " for "
+ bmd.enterpriseBeanName + "." + method.getName());
}
return transacted;
} }
|
public class class_name {
protected File newConfigurationDirectory(final @NonNull String parent,
final @NonNull String child)
{
File configurationDir = new File(parent, child);
if (!configurationDir.exists())
{
configurationDir.mkdir();
}
return configurationDir;
} }
|
public class class_name {
protected File newConfigurationDirectory(final @NonNull String parent,
final @NonNull String child)
{
File configurationDir = new File(parent, child);
if (!configurationDir.exists())
{
configurationDir.mkdir(); // depends on control dependency: [if], data = [none]
}
return configurationDir;
} }
|
public class class_name {
@Override
public EClass getIfcWasteTerminalType() {
if (ifcWasteTerminalTypeEClass == null) {
ifcWasteTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(763);
}
return ifcWasteTerminalTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcWasteTerminalType() {
if (ifcWasteTerminalTypeEClass == null) {
ifcWasteTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(763);
// depends on control dependency: [if], data = [none]
}
return ifcWasteTerminalTypeEClass;
} }
|
public class class_name {
@Override
public int setPageID(P page) {
int pageID = page.getPageID();
if(pageID == -1) {
pageID = getNextEmptyPageID();
if(pageID == -1) {
pageID = nextPageID++;
}
page.setPageID(pageID);
}
return pageID;
} }
|
public class class_name {
@Override
public int setPageID(P page) {
int pageID = page.getPageID();
if(pageID == -1) {
pageID = getNextEmptyPageID(); // depends on control dependency: [if], data = [none]
if(pageID == -1) {
pageID = nextPageID++; // depends on control dependency: [if], data = [none]
}
page.setPageID(pageID); // depends on control dependency: [if], data = [(pageID]
}
return pageID;
} }
|
public class class_name {
public DevicePoolCompatibilityResult withIncompatibilityMessages(IncompatibilityMessage... incompatibilityMessages) {
if (this.incompatibilityMessages == null) {
setIncompatibilityMessages(new java.util.ArrayList<IncompatibilityMessage>(incompatibilityMessages.length));
}
for (IncompatibilityMessage ele : incompatibilityMessages) {
this.incompatibilityMessages.add(ele);
}
return this;
} }
|
public class class_name {
public DevicePoolCompatibilityResult withIncompatibilityMessages(IncompatibilityMessage... incompatibilityMessages) {
if (this.incompatibilityMessages == null) {
setIncompatibilityMessages(new java.util.ArrayList<IncompatibilityMessage>(incompatibilityMessages.length)); // depends on control dependency: [if], data = [none]
}
for (IncompatibilityMessage ele : incompatibilityMessages) {
this.incompatibilityMessages.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void setPartitionsToGet(java.util.Collection<PartitionValueList> partitionsToGet) {
if (partitionsToGet == null) {
this.partitionsToGet = null;
return;
}
this.partitionsToGet = new java.util.ArrayList<PartitionValueList>(partitionsToGet);
} }
|
public class class_name {
public void setPartitionsToGet(java.util.Collection<PartitionValueList> partitionsToGet) {
if (partitionsToGet == null) {
this.partitionsToGet = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.partitionsToGet = new java.util.ArrayList<PartitionValueList>(partitionsToGet);
} }
|
public class class_name {
@Override
protected void resumeFaxJobImpl(FaxJob faxJob)
{
String name=VBSFaxClientSpi.VBS_WIN_XP_RESUME_SCRIPT;
if(this.useWin2kAPI)
{
name=VBSFaxClientSpi.VBS_WIN_2K_RESUME_SCRIPT;
}
//invoke script
this.invokeExistingFaxJobAction(name,faxJob,FaxActionType.RESUME_FAX_JOB);
} }
|
public class class_name {
@Override
protected void resumeFaxJobImpl(FaxJob faxJob)
{
String name=VBSFaxClientSpi.VBS_WIN_XP_RESUME_SCRIPT;
if(this.useWin2kAPI)
{
name=VBSFaxClientSpi.VBS_WIN_2K_RESUME_SCRIPT; // depends on control dependency: [if], data = [none]
}
//invoke script
this.invokeExistingFaxJobAction(name,faxJob,FaxActionType.RESUME_FAX_JOB);
} }
|
public class class_name {
public static <T> T max(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
int params = closure.getMaximumNumberOfParameters();
if (params != 1) {
return max(self, new ClosureComparator<T>(closure));
}
boolean first = true;
T answer = null;
Object answerValue = null;
for (T item : self) {
Object value = closure.call(item);
if (first) {
first = false;
answer = item;
answerValue = value;
} else if (ScriptBytecodeAdapter.compareLessThan(answerValue, value)) {
answer = item;
answerValue = value;
}
}
return answer;
} }
|
public class class_name {
public static <T> T max(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
int params = closure.getMaximumNumberOfParameters();
if (params != 1) {
return max(self, new ClosureComparator<T>(closure)); // depends on control dependency: [if], data = [none]
}
boolean first = true;
T answer = null;
Object answerValue = null;
for (T item : self) {
Object value = closure.call(item);
if (first) {
first = false; // depends on control dependency: [if], data = [none]
answer = item; // depends on control dependency: [if], data = [none]
answerValue = value; // depends on control dependency: [if], data = [none]
} else if (ScriptBytecodeAdapter.compareLessThan(answerValue, value)) {
answer = item; // depends on control dependency: [if], data = [none]
answerValue = value; // depends on control dependency: [if], data = [none]
}
}
return answer;
} }
|
public class class_name {
private static boolean isFloat( Number n ) {
if( n instanceof Float ){
return true;
}
try{
float f = Float.parseFloat( String.valueOf( n ) );
return !Float.isInfinite( f );
}catch( NumberFormatException e ){
return false;
}
} }
|
public class class_name {
private static boolean isFloat( Number n ) {
if( n instanceof Float ){
return true; // depends on control dependency: [if], data = [none]
}
try{
float f = Float.parseFloat( String.valueOf( n ) );
return !Float.isInfinite( f ); // depends on control dependency: [try], data = [none]
}catch( NumberFormatException e ){
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static SecureRandom getNativeInstance() {
try {
return SecureRandom.getInstance(NATIVE_NON_BLOCKING_ALGORITHM);
} catch (final NoSuchAlgorithmException e) {
LOGGER.trace(e.getMessage(), e);
return new SecureRandom();
}
} }
|
public class class_name {
public static SecureRandom getNativeInstance() {
try {
return SecureRandom.getInstance(NATIVE_NON_BLOCKING_ALGORITHM); // depends on control dependency: [try], data = [none]
} catch (final NoSuchAlgorithmException e) {
LOGGER.trace(e.getMessage(), e);
return new SecureRandom();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ITileSource getTileSource(final String aName) throws IllegalArgumentException {
for (final ITileSource tileSource : mTileSources) {
if (tileSource.name().equals(aName)) {
return tileSource;
}
}
throw new IllegalArgumentException("No such tile source: " + aName);
} }
|
public class class_name {
public static ITileSource getTileSource(final String aName) throws IllegalArgumentException {
for (final ITileSource tileSource : mTileSources) {
if (tileSource.name().equals(aName)) {
return tileSource; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("No such tile source: " + aName);
} }
|
public class class_name {
@Override
public CPDAvailabilityEstimate remove(Serializable primaryKey)
throws NoSuchCPDAvailabilityEstimateException {
Session session = null;
try {
session = openSession();
CPDAvailabilityEstimate cpdAvailabilityEstimate = (CPDAvailabilityEstimate)session.get(CPDAvailabilityEstimateImpl.class,
primaryKey);
if (cpdAvailabilityEstimate == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchCPDAvailabilityEstimateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpdAvailabilityEstimate);
}
catch (NoSuchCPDAvailabilityEstimateException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} }
|
public class class_name {
@Override
public CPDAvailabilityEstimate remove(Serializable primaryKey)
throws NoSuchCPDAvailabilityEstimateException {
Session session = null;
try {
session = openSession();
CPDAvailabilityEstimate cpdAvailabilityEstimate = (CPDAvailabilityEstimate)session.get(CPDAvailabilityEstimateImpl.class,
primaryKey);
if (cpdAvailabilityEstimate == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchCPDAvailabilityEstimateException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpdAvailabilityEstimate);
}
catch (NoSuchCPDAvailabilityEstimateException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} }
|
public class class_name {
public void log(Logger targetLogger)
{
Object[] argumentArray = getArgumentArray();
if (getArgumentArray() == null) {
log(targetLogger, getLevel(), getMarker(), getMessage(), getThrowable());
} else {
if (getThrowable() != null) {
argumentArray = ArrayUtils.add(getArgumentArray(), getThrowable());
}
log(targetLogger, getLevel(), getMarker(), getMessage(), argumentArray);
}
} }
|
public class class_name {
public void log(Logger targetLogger)
{
Object[] argumentArray = getArgumentArray();
if (getArgumentArray() == null) {
log(targetLogger, getLevel(), getMarker(), getMessage(), getThrowable()); // depends on control dependency: [if], data = [none]
} else {
if (getThrowable() != null) {
argumentArray = ArrayUtils.add(getArgumentArray(), getThrowable()); // depends on control dependency: [if], data = [none]
}
log(targetLogger, getLevel(), getMarker(), getMessage(), argumentArray); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void addJavaResource( JarArchiver jarArchiver, Resource javaResource )
{
if ( javaResource != null )
{
final File javaResourceDirectory = new File( javaResource.getDirectory() );
if ( javaResourceDirectory.exists() )
{
final DefaultFileSet javaResourceFileSet = new DefaultFileSet();
javaResourceFileSet.setDirectory( javaResourceDirectory );
javaResourceFileSet.setPrefix( endWithSlash( "src/main/resources" ) );
jarArchiver.addFileSet( javaResourceFileSet );
}
}
} }
|
public class class_name {
protected void addJavaResource( JarArchiver jarArchiver, Resource javaResource )
{
if ( javaResource != null )
{
final File javaResourceDirectory = new File( javaResource.getDirectory() );
if ( javaResourceDirectory.exists() )
{
final DefaultFileSet javaResourceFileSet = new DefaultFileSet();
javaResourceFileSet.setDirectory( javaResourceDirectory ); // depends on control dependency: [if], data = [none]
javaResourceFileSet.setPrefix( endWithSlash( "src/main/resources" ) ); // depends on control dependency: [if], data = [none]
jarArchiver.addFileSet( javaResourceFileSet ); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static List<Example<String, String>> exampleArrayToList(String[][] data) {
List<Example<String, String>> pairs = Lists.newArrayList();
for (int i = 0; i < data.length; i++) {
pairs.add(new Example<String, String>(data[i][0], data[i][1]));
}
return pairs;
} }
|
public class class_name {
public static List<Example<String, String>> exampleArrayToList(String[][] data) {
List<Example<String, String>> pairs = Lists.newArrayList();
for (int i = 0; i < data.length; i++) {
pairs.add(new Example<String, String>(data[i][0], data[i][1])); // depends on control dependency: [for], data = [i]
}
return pairs;
} }
|
public class class_name {
private Interval createInterval(String aName, int aLength) {
if (aName.equals("1m")){
System.out.println("CREATE INTERVAL 1M CALLED ");
new RuntimeException().fillInStackTrace().printStackTrace();
}
IntervalImpl interval = new IntervalImpl(obtainNextUniqueId(), aName, aLength);
if (aLength!=-1)
updateTriggerService.addUpdateable(interval, aLength);
intervalsById.put(interval.getId(), interval);
intervalsByName.put(interval.getName(), interval);
for (IntervalRegistryListener listener : registryListeners) {
listener.intervalCreated(interval);
}
//add new listener to each interval to store update timestamps
interval.addSecondaryIntervalListener(new IIntervalListener() {
@Override
public void intervalUpdated(Interval aCaller) {
intervalUpdateTimestamp.put(aCaller.getName(), System.currentTimeMillis());
}
});
return interval;
} }
|
public class class_name {
private Interval createInterval(String aName, int aLength) {
if (aName.equals("1m")){
System.out.println("CREATE INTERVAL 1M CALLED "); // depends on control dependency: [if], data = [none]
new RuntimeException().fillInStackTrace().printStackTrace(); // depends on control dependency: [if], data = [none]
}
IntervalImpl interval = new IntervalImpl(obtainNextUniqueId(), aName, aLength);
if (aLength!=-1)
updateTriggerService.addUpdateable(interval, aLength);
intervalsById.put(interval.getId(), interval);
intervalsByName.put(interval.getName(), interval);
for (IntervalRegistryListener listener : registryListeners) {
listener.intervalCreated(interval); // depends on control dependency: [for], data = [listener]
}
//add new listener to each interval to store update timestamps
interval.addSecondaryIntervalListener(new IIntervalListener() {
@Override
public void intervalUpdated(Interval aCaller) {
intervalUpdateTimestamp.put(aCaller.getName(), System.currentTimeMillis());
}
});
return interval;
} }
|
public class class_name {
public Coordinate getCentroid() {
if (isEmpty()) {
return null;
}
double area = getSignedArea();
double x = 0;
double y = 0;
Coordinate[] coordinates = getCoordinates();
for (int i = 1; i < coordinates.length; i++) {
double x1 = coordinates[i - 1].getX();
double y1 = coordinates[i - 1].getY();
double x2 = coordinates[i].getX();
double y2 = coordinates[i].getY();
x += (x1 + x2) * (x1 * y2 - x2 * y1);
y += (y1 + y2) * (x1 * y2 - x2 * y1);
}
x = x / (6 * area);
y = y / (6 * area);
return new Coordinate(x, y);
} }
|
public class class_name {
public Coordinate getCentroid() {
if (isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
double area = getSignedArea();
double x = 0;
double y = 0;
Coordinate[] coordinates = getCoordinates();
for (int i = 1; i < coordinates.length; i++) {
double x1 = coordinates[i - 1].getX();
double y1 = coordinates[i - 1].getY();
double x2 = coordinates[i].getX();
double y2 = coordinates[i].getY();
x += (x1 + x2) * (x1 * y2 - x2 * y1); // depends on control dependency: [for], data = [none]
y += (y1 + y2) * (x1 * y2 - x2 * y1); // depends on control dependency: [for], data = [none]
}
x = x / (6 * area);
y = y / (6 * area);
return new Coordinate(x, y);
} }
|
public class class_name {
public static int getDBLength(String str, int n) {
if (str == null) {
return 0;
}
char[] chars = str.toCharArray();
int len = 0;
for (int i = 0; i < chars.length; i++) {
if (Character.UnicodeBlock.of(chars[i]) == Character.UnicodeBlock.BASIC_LATIN) {
len++;
} else {
len += n;
}
}
return len;
} }
|
public class class_name {
public static int getDBLength(String str, int n) {
if (str == null) {
return 0; // depends on control dependency: [if], data = [none]
}
char[] chars = str.toCharArray();
int len = 0;
for (int i = 0; i < chars.length; i++) {
if (Character.UnicodeBlock.of(chars[i]) == Character.UnicodeBlock.BASIC_LATIN) {
len++; // depends on control dependency: [if], data = [none]
} else {
len += n; // depends on control dependency: [if], data = [none]
}
}
return len;
} }
|
public class class_name {
@Override
public void clear() {
for (ThreadLocal<Object> threadLocal : instancesPool.values()) {
threadLocal.remove();
}
instancesPool.clear();
} }
|
public class class_name {
@Override
public void clear() {
for (ThreadLocal<Object> threadLocal : instancesPool.values()) {
threadLocal.remove();
// depends on control dependency: [for], data = [threadLocal]
}
instancesPool.clear();
} }
|
public class class_name {
void setActive(boolean active) {
m_deactivationPanel.setVisible(!active);
m_datesPanel.setVisible(active);
if (m_seriesCheckBox.getFormValue().booleanValue()) {
setSerialOptionsVisible(active);
}
m_controller.sizeChanged();
} }
|
public class class_name {
void setActive(boolean active) {
m_deactivationPanel.setVisible(!active);
m_datesPanel.setVisible(active);
if (m_seriesCheckBox.getFormValue().booleanValue()) {
setSerialOptionsVisible(active); // depends on control dependency: [if], data = [none]
}
m_controller.sizeChanged();
} }
|
public class class_name {
private static Cursor queryProvider(final Context context) {
Cursor c = context.getContentResolver().query(Constants.URI_CONTENT_BASALT, null, null, null, null);
if (c != null) {
if (c.moveToFirst()) {
// If Basalt app is connected, talk to that (return the open cursor)
if (c.getInt(KIT_STATE_COLUMN_CONNECTED) == 1) {
c.moveToPrevious();
return c;
}
}
// Else close the cursor and try the primary authority
c.close();
}
c = context.getContentResolver().query(Constants.URI_CONTENT_PRIMARY, null, null, null, null);
// Do nothing with this cursor - the calling method will check it for whatever it is looking for
return c;
} }
|
public class class_name {
private static Cursor queryProvider(final Context context) {
Cursor c = context.getContentResolver().query(Constants.URI_CONTENT_BASALT, null, null, null, null);
if (c != null) {
if (c.moveToFirst()) {
// If Basalt app is connected, talk to that (return the open cursor)
if (c.getInt(KIT_STATE_COLUMN_CONNECTED) == 1) {
c.moveToPrevious(); // depends on control dependency: [if], data = [none]
return c; // depends on control dependency: [if], data = [none]
}
}
// Else close the cursor and try the primary authority
c.close(); // depends on control dependency: [if], data = [none]
}
c = context.getContentResolver().query(Constants.URI_CONTENT_PRIMARY, null, null, null, null);
// Do nothing with this cursor - the calling method will check it for whatever it is looking for
return c;
} }
|
public class class_name {
public static LdapName newLdapName(Name name) {
Assert.notNull(name, "name must not be null");
if(name instanceof LdapName) {
return (LdapName) name.clone();
} else if (name instanceof CompositeName) {
CompositeName compositeName = (CompositeName) name;
try {
return new LdapName(convertCompositeNameToString(compositeName));
} catch (InvalidNameException e) {
throw convertLdapException(e);
}
} else {
LdapName result = emptyLdapName();
try {
result.addAll(0, name);
} catch (InvalidNameException e) {
throw convertLdapException(e);
}
return result;
}
} }
|
public class class_name {
public static LdapName newLdapName(Name name) {
Assert.notNull(name, "name must not be null");
if(name instanceof LdapName) {
return (LdapName) name.clone(); // depends on control dependency: [if], data = [none]
} else if (name instanceof CompositeName) {
CompositeName compositeName = (CompositeName) name;
try {
return new LdapName(convertCompositeNameToString(compositeName)); // depends on control dependency: [try], data = [none]
} catch (InvalidNameException e) {
throw convertLdapException(e);
} // depends on control dependency: [catch], data = [none]
} else {
LdapName result = emptyLdapName();
try {
result.addAll(0, name); // depends on control dependency: [try], data = [none]
} catch (InvalidNameException e) {
throw convertLdapException(e);
} // depends on control dependency: [catch], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final void mDigits() throws RecognitionException {
try {
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:7: ( Digit ( ( DigitOrUnderscore )* Digit )? )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:9: Digit ( ( DigitOrUnderscore )* Digit )?
{
mDigit();
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:15: ( ( DigitOrUnderscore )* Digit )?
int alt18=2;
int LA18_0 = input.LA(1);
if ( ((LA18_0 >= '0' && LA18_0 <= '9')||LA18_0=='_') ) {
alt18=1;
}
switch (alt18) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:16: ( DigitOrUnderscore )* Digit
{
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:16: ( DigitOrUnderscore )*
loop17:
while (true) {
int alt17=2;
int LA17_0 = input.LA(1);
if ( ((LA17_0 >= '0' && LA17_0 <= '9')) ) {
int LA17_1 = input.LA(2);
if ( ((LA17_1 >= '0' && LA17_1 <= '9')||LA17_1=='_') ) {
alt17=1;
}
}
else if ( (LA17_0=='_') ) {
alt17=1;
}
switch (alt17) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||input.LA(1)=='_' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
break loop17;
}
}
mDigit();
}
break;
}
}
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public final void mDigits() throws RecognitionException {
try {
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:7: ( Digit ( ( DigitOrUnderscore )* Digit )? )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:9: Digit ( ( DigitOrUnderscore )* Digit )?
{
mDigit();
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:15: ( ( DigitOrUnderscore )* Digit )?
int alt18=2;
int LA18_0 = input.LA(1);
if ( ((LA18_0 >= '0' && LA18_0 <= '9')||LA18_0=='_') ) {
alt18=1;
}
switch (alt18) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:16: ( DigitOrUnderscore )* Digit
{
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1323:16: ( DigitOrUnderscore )*
loop17:
while (true) {
int alt17=2;
int LA17_0 = input.LA(1);
if ( ((LA17_0 >= '0' && LA17_0 <= '9')) ) {
int LA17_1 = input.LA(2);
if ( ((LA17_1 >= '0' && LA17_1 <= '9')||LA17_1=='_') ) {
alt17=1; // depends on control dependency: [if], data = [none]
}
}
else if ( (LA17_0=='_') ) {
alt17=1; // depends on control dependency: [if], data = [none]
}
switch (alt17) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||input.LA(1)=='_' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
break loop17;
}
}
mDigit();
}
break;
}
}
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
protected Double getNearestNeighborValue(GriddedTile griddedTile,
TImage image, Double[][] leftLastColumns, Double[][] topLeftRows,
Double[][] topRows, int y, int x, float widthRatio,
float heightRatio, float destTop, float destLeft, float srcTop,
float srcLeft) {
// Determine which source pixel to use
float xSource = getXSource(x, destLeft, srcLeft, widthRatio);
float ySource = getYSource(y, destTop, srcTop, heightRatio);
// Get the closest nearest neighbors
List<int[]> nearestNeighbors = getNearestNeighbors(xSource, ySource);
// Get the coverage data value from the source pixel nearest neighbors
// until one is found
Double value = null;
for (int[] nearestNeighbor : nearestNeighbors) {
value = getValueOverBorders(griddedTile, image, leftLastColumns,
topLeftRows, topRows, nearestNeighbor[0],
nearestNeighbor[1]);
if (value != null) {
break;
}
}
return value;
} }
|
public class class_name {
protected Double getNearestNeighborValue(GriddedTile griddedTile,
TImage image, Double[][] leftLastColumns, Double[][] topLeftRows,
Double[][] topRows, int y, int x, float widthRatio,
float heightRatio, float destTop, float destLeft, float srcTop,
float srcLeft) {
// Determine which source pixel to use
float xSource = getXSource(x, destLeft, srcLeft, widthRatio);
float ySource = getYSource(y, destTop, srcTop, heightRatio);
// Get the closest nearest neighbors
List<int[]> nearestNeighbors = getNearestNeighbors(xSource, ySource);
// Get the coverage data value from the source pixel nearest neighbors
// until one is found
Double value = null;
for (int[] nearestNeighbor : nearestNeighbors) {
value = getValueOverBorders(griddedTile, image, leftLastColumns,
topLeftRows, topRows, nearestNeighbor[0],
nearestNeighbor[1]); // depends on control dependency: [for], data = [none]
if (value != null) {
break;
}
}
return value;
} }
|
public class class_name {
public boolean unbindFromApplication( String externalExportPrefix, String applicationName ) {
boolean result = false;
Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
if( bounds != null ) {
result = bounds.remove( applicationName );
if( bounds.isEmpty())
this.applicationBindings.remove( externalExportPrefix );
}
return result;
} }
|
public class class_name {
public boolean unbindFromApplication( String externalExportPrefix, String applicationName ) {
boolean result = false;
Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
if( bounds != null ) {
result = bounds.remove( applicationName ); // depends on control dependency: [if], data = [none]
if( bounds.isEmpty())
this.applicationBindings.remove( externalExportPrefix );
}
return result;
} }
|
public class class_name {
public static final StringBuilder sprintf0d(StringBuilder sb, int value, int width) {
long d = value;
if (d < 0) {
sb.append('-');
d = -d;
--width;
}
int n = 10;
for (int i = 2; i < width; i++) {
n *= 10;
}
for (int i = 1; i < width && d < n; i++) {
sb.append('0');
n /= 10;
}
sb.append(d);
return sb;
} }
|
public class class_name {
public static final StringBuilder sprintf0d(StringBuilder sb, int value, int width) {
long d = value;
if (d < 0) {
sb.append('-'); // depends on control dependency: [if], data = [none]
d = -d; // depends on control dependency: [if], data = [none]
--width; // depends on control dependency: [if], data = [none]
}
int n = 10;
for (int i = 2; i < width; i++) {
n *= 10; // depends on control dependency: [for], data = [none]
}
for (int i = 1; i < width && d < n; i++) {
sb.append('0'); // depends on control dependency: [for], data = [none]
n /= 10; // depends on control dependency: [for], data = [none]
}
sb.append(d);
return sb;
} }
|
public class class_name {
public AutoCompleteBehavior.Type getAutoType()
{
if (this.autoType == null) {
if (isRequired()) {
setAutoType(Type.COMPLETE);
} else {
setAutoType(Type.SUGGESTION);
}
}
return this.autoType;
} }
|
public class class_name {
public AutoCompleteBehavior.Type getAutoType()
{
if (this.autoType == null) {
if (isRequired()) {
setAutoType(Type.COMPLETE); // depends on control dependency: [if], data = [none]
} else {
setAutoType(Type.SUGGESTION); // depends on control dependency: [if], data = [none]
}
}
return this.autoType;
} }
|
public class class_name {
protected void onRouteDispatch(Request request, Response response) {
final String requestPath = request.getPath();
final String requestMethod = request.getMethod();
if (shouldIgnorePath(requestPath)) {
// NOT FOUND (404)
RouteContext routeContext = routeContextFactory.createRouteContext(application, request, response, noMatches);
ROUTE_CONTEXT_THREAD_LOCAL.set(routeContext);
errorHandler.handle(HttpServletResponse.SC_NOT_FOUND, routeContext);
ROUTE_CONTEXT_THREAD_LOCAL.remove();
log.debug("Returned status code {} for {} '{}' (IGNORED)", response.getStatus(), requestMethod, requestPath);
return;
}
List<RouteMatch> routeMatches = router.findRoutes(requestMethod, requestPath);
RouteContext routeContext = routeContextFactory.createRouteContext(application, request, response, routeMatches);
ROUTE_CONTEXT_THREAD_LOCAL.set(routeContext);
try {
if (routeMatches.isEmpty()) {
if (notFoundRouteHandler != null) {
notFoundRouteHandler.handle(routeContext);
} else {
// NOT FOUND (404)
errorHandler.handle(HttpConstants.StatusCode.NOT_FOUND, routeContext);
}
} else {
processFlash(routeContext);
}
// execute the chain
routeContext.next();
if (!response.isCommitted()) {
if (response.getStatus() == 0) {
log.debug("Status code not set for {} '{}'", requestMethod, requestPath);
response.notFound();
}
log.debug("Auto-committing response for {} '{}'", requestMethod, requestPath);
if (response.getStatus() >= HttpServletResponse.SC_BAD_REQUEST) {
// delegate response to the error handler.
// this will generate response content appropriate for the request
errorHandler.handle(response.getStatus(), routeContext);
} else {
response.commit();
}
}
} catch (Exception e) {
errorHandler.handle(e, routeContext);
} finally {
routeContext.runFinallyRoutes();
log.debug("Returned status code {} for {} '{}'", response.getStatus(), requestMethod, requestPath);
ROUTE_CONTEXT_THREAD_LOCAL.remove();
}
} }
|
public class class_name {
protected void onRouteDispatch(Request request, Response response) {
final String requestPath = request.getPath();
final String requestMethod = request.getMethod();
if (shouldIgnorePath(requestPath)) {
// NOT FOUND (404)
RouteContext routeContext = routeContextFactory.createRouteContext(application, request, response, noMatches);
ROUTE_CONTEXT_THREAD_LOCAL.set(routeContext); // depends on control dependency: [if], data = [none]
errorHandler.handle(HttpServletResponse.SC_NOT_FOUND, routeContext); // depends on control dependency: [if], data = [none]
ROUTE_CONTEXT_THREAD_LOCAL.remove(); // depends on control dependency: [if], data = [none]
log.debug("Returned status code {} for {} '{}' (IGNORED)", response.getStatus(), requestMethod, requestPath); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
List<RouteMatch> routeMatches = router.findRoutes(requestMethod, requestPath);
RouteContext routeContext = routeContextFactory.createRouteContext(application, request, response, routeMatches);
ROUTE_CONTEXT_THREAD_LOCAL.set(routeContext);
try {
if (routeMatches.isEmpty()) {
if (notFoundRouteHandler != null) {
notFoundRouteHandler.handle(routeContext); // depends on control dependency: [if], data = [none]
} else {
// NOT FOUND (404)
errorHandler.handle(HttpConstants.StatusCode.NOT_FOUND, routeContext); // depends on control dependency: [if], data = [none]
}
} else {
processFlash(routeContext); // depends on control dependency: [if], data = [none]
}
// execute the chain
routeContext.next();
if (!response.isCommitted()) {
if (response.getStatus() == 0) {
log.debug("Status code not set for {} '{}'", requestMethod, requestPath);
response.notFound();
}
log.debug("Auto-committing response for {} '{}'", requestMethod, requestPath);
if (response.getStatus() >= HttpServletResponse.SC_BAD_REQUEST) {
// delegate response to the error handler.
// this will generate response content appropriate for the request
errorHandler.handle(response.getStatus(), routeContext);
} else {
response.commit();
}
}
} catch (Exception e) {
errorHandler.handle(e, routeContext);
} finally {
routeContext.runFinallyRoutes();
log.debug("Returned status code {} for {} '{}'", response.getStatus(), requestMethod, requestPath);
ROUTE_CONTEXT_THREAD_LOCAL.remove();
}
} }
|
public class class_name {
@Override
public void setRendererModel(RendererModel rendererModel) {
this.rendererModel = rendererModel;
if (rendererModel.hasParameter(UseAntiAliasing.class)) {
if (rendererModel.getParameter(UseAntiAliasing.class).getValue()) {
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// g.setStroke(new BasicStroke((int)rendererModel.getBondWidth()));
}
}
} }
|
public class class_name {
@Override
public void setRendererModel(RendererModel rendererModel) {
this.rendererModel = rendererModel;
if (rendererModel.hasParameter(UseAntiAliasing.class)) {
if (rendererModel.getParameter(UseAntiAliasing.class).getValue()) {
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // depends on control dependency: [if], data = [none]
// g.setStroke(new BasicStroke((int)rendererModel.getBondWidth()));
}
}
} }
|
public class class_name {
@Override
public boolean removeEventListener(IEventListener listener) {
// remove the listener from the so
so.unregister(listener);
// if we have not been released by all that acquired then keep on
// disconnection of the last listener
if (so.isAcquired()) {
log.debug("Shared object has been aquired so setting keep on disconnect");
keepOnDisconnect = true;
}
// remove the listener
boolean result = super.removeEventListener(listener);
// notify other listeners that someone has stopped listening
serverListeners.forEach(soListener -> {
soListener.onSharedObjectDisconnect(this);
});
// check that linger job has be set
if (lingerJobName == null) {
// start a job to allow the so to linger for just a few ticks
ISchedulingService scheduler = (ISchedulingService) getParent().getContext().getBean(ISchedulingService.BEAN_NAME);
lingerJobName = scheduler.addScheduledOnceJob(lingerPeriod, new IScheduledJob() {
public void execute(ISchedulingService service) {
if (so != null && !so.isClosed()) {
so.checkRelease();
}
}
});
}
// check acquire
if (so.isClosed()) {
log.debug("Removing scope: {}", this);
getParent().removeChildScope(this);
}
return result;
} }
|
public class class_name {
@Override
public boolean removeEventListener(IEventListener listener) {
// remove the listener from the so
so.unregister(listener);
// if we have not been released by all that acquired then keep on
// disconnection of the last listener
if (so.isAcquired()) {
log.debug("Shared object has been aquired so setting keep on disconnect");
// depends on control dependency: [if], data = [none]
keepOnDisconnect = true;
// depends on control dependency: [if], data = [none]
}
// remove the listener
boolean result = super.removeEventListener(listener);
// notify other listeners that someone has stopped listening
serverListeners.forEach(soListener -> {
soListener.onSharedObjectDisconnect(this);
});
// check that linger job has be set
if (lingerJobName == null) {
// start a job to allow the so to linger for just a few ticks
ISchedulingService scheduler = (ISchedulingService) getParent().getContext().getBean(ISchedulingService.BEAN_NAME);
lingerJobName = scheduler.addScheduledOnceJob(lingerPeriod, new IScheduledJob() {
public void execute(ISchedulingService service) {
if (so != null && !so.isClosed()) {
so.checkRelease();
// depends on control dependency: [if], data = [none]
}
}
});
}
// check acquire
if (so.isClosed()) {
log.debug("Removing scope: {}", this);
getParent().removeChildScope(this);
}
return result;
} }
|
public class class_name {
private static void writeToFile(InputStream in, File file) {
try {
OutputStream out = new FileOutputStream(file);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
}
} }
|
public class class_name {
private static void writeToFile(InputStream in, File file) {
try {
OutputStream out = new FileOutputStream(file);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len); // depends on control dependency: [while], data = [none]
}
out.close(); // depends on control dependency: [try], data = [none]
in.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Violation isFieldImmutable(
Optional<Tree> tree,
ImmutableSet<String> immutableTyParams,
ClassSymbol classSym,
ClassType classType,
VarSymbol var,
ViolationReporter reporter) {
if (bugChecker.isSuppressed(var)) {
return Violation.absent();
}
if (!var.getModifiers().contains(Modifier.FINAL)
&& !ASTHelpers.hasAnnotation(var, LazyInit.class, state)) {
Violation info =
Violation.of(
String.format(
"'%s' has non-final field '%s'",
threadSafety.getPrettyName(classSym), var.getSimpleName()));
if (tree.isPresent()) {
// If we have a tree to attach diagnostics to, report the error immediately instead of
// accumulating the path to the error from the top-level class being checked
state.reportMatch(
reporter.report(
tree.get(), info, SuggestedFixes.addModifiers(tree.get(), state, Modifier.FINAL)));
return Violation.absent();
}
return info;
}
Type varType = state.getTypes().memberType(classType, var);
Violation info =
threadSafety.isThreadSafeType(
/* allowContainerTypeParameters= */ true, immutableTyParams, varType);
if (info.isPresent()) {
info =
info.plus(
String.format(
"'%s' has field '%s' of type '%s'",
threadSafety.getPrettyName(classSym), var.getSimpleName(), varType));
if (tree.isPresent()) {
// If we have a tree to attach diagnostics to, report the error immediately instead of
// accumulating the path to the error from the top-level class being checked
state.reportMatch(reporter.report(tree.get(), info, Optional.empty()));
return Violation.absent();
}
return info;
}
return Violation.absent();
} }
|
public class class_name {
private Violation isFieldImmutable(
Optional<Tree> tree,
ImmutableSet<String> immutableTyParams,
ClassSymbol classSym,
ClassType classType,
VarSymbol var,
ViolationReporter reporter) {
if (bugChecker.isSuppressed(var)) {
return Violation.absent(); // depends on control dependency: [if], data = [none]
}
if (!var.getModifiers().contains(Modifier.FINAL)
&& !ASTHelpers.hasAnnotation(var, LazyInit.class, state)) {
Violation info =
Violation.of(
String.format(
"'%s' has non-final field '%s'",
threadSafety.getPrettyName(classSym), var.getSimpleName()));
if (tree.isPresent()) {
// If we have a tree to attach diagnostics to, report the error immediately instead of
// accumulating the path to the error from the top-level class being checked
state.reportMatch(
reporter.report(
tree.get(), info, SuggestedFixes.addModifiers(tree.get(), state, Modifier.FINAL)));
return Violation.absent();
}
return info;
}
Type varType = state.getTypes().memberType(classType, var);
Violation info =
threadSafety.isThreadSafeType(
/* allowContainerTypeParameters= */ true, immutableTyParams, varType);
if (info.isPresent()) {
info =
info.plus(
String.format(
"'%s' has field '%s' of type '%s'",
threadSafety.getPrettyName(classSym), var.getSimpleName(), varType));
if (tree.isPresent()) {
// If we have a tree to attach diagnostics to, report the error immediately instead of
// accumulating the path to the error from the top-level class being checked
state.reportMatch(reporter.report(tree.get(), info, Optional.empty())); // depends on control dependency: [if], data = [none]
return Violation.absent(); // depends on control dependency: [if], data = [none]
}
return info; // depends on control dependency: [if], data = [none]
}
return Violation.absent();
} }
|
public class class_name {
public void marshall(InstanceAggregatedAssociationOverview instanceAggregatedAssociationOverview, ProtocolMarshaller protocolMarshaller) {
if (instanceAggregatedAssociationOverview == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceAggregatedAssociationOverview.getDetailedStatus(), DETAILEDSTATUS_BINDING);
protocolMarshaller.marshall(instanceAggregatedAssociationOverview.getInstanceAssociationStatusAggregatedCount(),
INSTANCEASSOCIATIONSTATUSAGGREGATEDCOUNT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InstanceAggregatedAssociationOverview instanceAggregatedAssociationOverview, ProtocolMarshaller protocolMarshaller) {
if (instanceAggregatedAssociationOverview == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceAggregatedAssociationOverview.getDetailedStatus(), DETAILEDSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceAggregatedAssociationOverview.getInstanceAssociationStatusAggregatedCount(),
INSTANCEASSOCIATIONSTATUSAGGREGATEDCOUNT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Duration<U> multipliedBy(int factor) {
if (
this.isEmpty()
|| (factor == 1)
) {
return this;
} else if (factor == 0) {
return ofZero();
} else if (factor == -1) {
return new Duration<>(this, true);
}
List<Item<U>> newItems = new ArrayList<>(this.count());
int scalar = Math.abs(factor);
for (int i = 0, n = this.count(); i < n; i++) {
Item<U> item = this.getTotalLength().get(i);
newItems.add(
Item.of(
MathUtils.safeMultiply(item.getAmount(), scalar),
item.getUnit()
)
);
}
return new Duration<>(
newItems,
((factor < 0) != this.isNegative())
);
} }
|
public class class_name {
public Duration<U> multipliedBy(int factor) {
if (
this.isEmpty()
|| (factor == 1)
) {
return this; // depends on control dependency: [if], data = []
} else if (factor == 0) {
return ofZero(); // depends on control dependency: [if], data = [none]
} else if (factor == -1) {
return new Duration<>(this, true); // depends on control dependency: [if], data = [none]
}
List<Item<U>> newItems = new ArrayList<>(this.count());
int scalar = Math.abs(factor);
for (int i = 0, n = this.count(); i < n; i++) {
Item<U> item = this.getTotalLength().get(i);
newItems.add(
Item.of(
MathUtils.safeMultiply(item.getAmount(), scalar),
item.getUnit()
)
); // depends on control dependency: [for], data = [none]
}
return new Duration<>(
newItems,
((factor < 0) != this.isNegative())
);
} }
|
public class class_name {
@Override
public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) {
StringBuilder fullQuery = new StringBuilder();
appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys);
if(limit != -1){
fullQuery.append(" LIMIT ").append(limit);
}
if(offset != -1){
fullQuery.append(" OFFSET ").append(offset);
}
return fullQuery.toString();
} }
|
public class class_name {
@Override
public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) {
StringBuilder fullQuery = new StringBuilder();
appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys);
if(limit != -1){
fullQuery.append(" LIMIT ").append(limit); // depends on control dependency: [if], data = [(limit]
}
if(offset != -1){
fullQuery.append(" OFFSET ").append(offset); // depends on control dependency: [if], data = [(offset]
}
return fullQuery.toString();
} }
|
public class class_name {
public Iterator<IntTaggedWord> ruleIteratorByWord(int word, int loc, String featureSpec) {
// if (rulesWithWord == null) { // tested in isKnown already
// initRulesWithWord();
// }
List<IntTaggedWord> wordTaggings;
if (isKnown(word)) {
if ( ! flexiTag) {
// Strict lexical tagging for seen items
wordTaggings = rulesWithWord[word];
} else {
/* Allow all tags with same basicCategory */
/* Allow all scored taggings, unless very common */
IntTaggedWord iW = new IntTaggedWord(word, nullTag);
if (seenCounter.getCount(iW) > smoothInUnknownsThreshold) {
return rulesWithWord[word].iterator();
} else {
// give it flexible tagging not just lexicon
wordTaggings = new ArrayList<IntTaggedWord>(40);
for (IntTaggedWord iTW2 : tags) {
IntTaggedWord iTW = new IntTaggedWord(word, iTW2.tag);
if (score(iTW, loc, wordIndex.get(word)) > Float.NEGATIVE_INFINITY) {
wordTaggings.add(iTW);
}
}
}
}
} else {
// we copy list so we can insert correct word in each item
wordTaggings = new ArrayList<IntTaggedWord>(40);
for (IntTaggedWord iTW : rulesWithWord[wordIndex.indexOf(UNKNOWN_WORD)]) {
wordTaggings.add(new IntTaggedWord(word, iTW.tag));
}
}
if (DEBUG_LEXICON) {
EncodingPrintWriter.err.println("Lexicon: " + wordIndex.get(word) + " (" +
(isKnown(word) ? "known": "unknown") + ", loc=" + loc + ", n=" +
(isKnown(word) ? word: wordIndex.indexOf(UNKNOWN_WORD)) + ") " +
(flexiTag ? "flexi": "lexicon") + " taggings: " + wordTaggings, "UTF-8");
}
return wordTaggings.iterator();
} }
|
public class class_name {
public Iterator<IntTaggedWord> ruleIteratorByWord(int word, int loc, String featureSpec) {
// if (rulesWithWord == null) { // tested in isKnown already
// initRulesWithWord();
// }
List<IntTaggedWord> wordTaggings;
if (isKnown(word)) {
if ( ! flexiTag) {
// Strict lexical tagging for seen items
wordTaggings = rulesWithWord[word];
// depends on control dependency: [if], data = [none]
} else {
/* Allow all tags with same basicCategory */
/* Allow all scored taggings, unless very common */
IntTaggedWord iW = new IntTaggedWord(word, nullTag);
if (seenCounter.getCount(iW) > smoothInUnknownsThreshold) {
return rulesWithWord[word].iterator();
// depends on control dependency: [if], data = [none]
} else {
// give it flexible tagging not just lexicon
wordTaggings = new ArrayList<IntTaggedWord>(40);
// depends on control dependency: [if], data = [none]
for (IntTaggedWord iTW2 : tags) {
IntTaggedWord iTW = new IntTaggedWord(word, iTW2.tag);
if (score(iTW, loc, wordIndex.get(word)) > Float.NEGATIVE_INFINITY) {
wordTaggings.add(iTW);
// depends on control dependency: [if], data = [none]
}
}
}
}
} else {
// we copy list so we can insert correct word in each item
wordTaggings = new ArrayList<IntTaggedWord>(40);
// depends on control dependency: [if], data = [none]
for (IntTaggedWord iTW : rulesWithWord[wordIndex.indexOf(UNKNOWN_WORD)]) {
wordTaggings.add(new IntTaggedWord(word, iTW.tag));
// depends on control dependency: [for], data = [iTW]
}
}
if (DEBUG_LEXICON) {
EncodingPrintWriter.err.println("Lexicon: " + wordIndex.get(word) + " (" +
(isKnown(word) ? "known": "unknown") + ", loc=" + loc + ", n=" +
(isKnown(word) ? word: wordIndex.indexOf(UNKNOWN_WORD)) + ") " +
(flexiTag ? "flexi": "lexicon") + " taggings: " + wordTaggings, "UTF-8");
// depends on control dependency: [if], data = [none]
}
return wordTaggings.iterator();
} }
|
public class class_name {
Instance getNearestGCRootPointer(Instance instance) {
if (heap.getGCRoot(instance) != null) {
return instance;
}
computeGCRoots();
long nextGCPathId = heap.idToOffsetMap.get(instance.getInstanceId()).getNearestGCRootPointer();
return heap.getInstanceByID(nextGCPathId);
} }
|
public class class_name {
Instance getNearestGCRootPointer(Instance instance) {
if (heap.getGCRoot(instance) != null) {
return instance; // depends on control dependency: [if], data = [none]
}
computeGCRoots();
long nextGCPathId = heap.idToOffsetMap.get(instance.getInstanceId()).getNearestGCRootPointer();
return heap.getInstanceByID(nextGCPathId);
} }
|
public class class_name {
protected static void write(List<Is24CsvRecord> records, OutputStream output) {
LOGGER.info("writing document");
try {
Is24CsvPrinter printer = Is24CsvPrinter.create(output);
printer.printRecords(records);
LOGGER.info("> written to a java.io.OutputStream");
} catch (Exception ex) {
LOGGER.error("Can't write document into an OutputStream!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
System.exit(1);
}
} }
|
public class class_name {
protected static void write(List<Is24CsvRecord> records, OutputStream output) {
LOGGER.info("writing document");
try {
Is24CsvPrinter printer = Is24CsvPrinter.create(output);
printer.printRecords(records); // depends on control dependency: [try], data = [none]
LOGGER.info("> written to a java.io.OutputStream"); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOGGER.error("Can't write document into an OutputStream!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
System.exit(1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected static void sendLogsToServer(boolean setSentTime){
long timeSent = new Date().getTime();
String appFeedBackSummary = Utility.convertFileToString("AppFeedBackSummary.json");
if ( "".equals(appFeedBackSummary) || "{}".equals(appFeedBackSummary) ) {
return;
}else{
try{
JSONObject appFeedBacksummaryJSON = new JSONObject(appFeedBackSummary);
JSONArray savedArray = (JSONArray) appFeedBacksummaryJSON.get("saved");
HashMap<String, String> timeSentMap = new HashMap<>();
//Add timeSent to all the json file's which are not set with timeSent
for (int i = 0; i < savedArray.length(); i++) {
String instanceName = (String) savedArray.get(i);
String screenFeedBackJsonFile = Utility.getJSONfileName(instanceName);
String actualTimeSent = Utility.addAndFetchSentTimeFromScreenFeedBackJson(screenFeedBackJsonFile, timeSent, setSentTime);
if(actualTimeSent != null){
timeSentMap.put(instanceName,actualTimeSent);
}
}
//Iterate each feedback element which is not yet sent
for (int i = 0; i < savedArray.length(); i++) {
String instanceName = (String)savedArray.get(i);
String screenFeedBackJsonFile = Utility.getJSONfileName(instanceName);
String actualTimeSent = timeSentMap.get(instanceName);
String zipFile = Utility.storageDirectory+instanceName+"_"+ actualTimeSent+".zip";
List<String> fileList = new ArrayList<>();
fileList.add(Utility.getImageFileName(instanceName));
fileList.add(screenFeedBackJsonFile);
Utility.createZipArchive(fileList,zipFile);
LogPersister.sendInAppFeedBackFile(zipFile, new FeedBackUploadResponseListener(instanceName,zipFile,actualTimeSent));
}
}catch (JSONException je){
}
}
} }
|
public class class_name {
protected static void sendLogsToServer(boolean setSentTime){
long timeSent = new Date().getTime();
String appFeedBackSummary = Utility.convertFileToString("AppFeedBackSummary.json");
if ( "".equals(appFeedBackSummary) || "{}".equals(appFeedBackSummary) ) {
return; // depends on control dependency: [if], data = [none]
}else{
try{
JSONObject appFeedBacksummaryJSON = new JSONObject(appFeedBackSummary);
JSONArray savedArray = (JSONArray) appFeedBacksummaryJSON.get("saved");
HashMap<String, String> timeSentMap = new HashMap<>();
//Add timeSent to all the json file's which are not set with timeSent
for (int i = 0; i < savedArray.length(); i++) {
String instanceName = (String) savedArray.get(i);
String screenFeedBackJsonFile = Utility.getJSONfileName(instanceName);
String actualTimeSent = Utility.addAndFetchSentTimeFromScreenFeedBackJson(screenFeedBackJsonFile, timeSent, setSentTime);
if(actualTimeSent != null){
timeSentMap.put(instanceName,actualTimeSent); // depends on control dependency: [if], data = [none]
}
}
//Iterate each feedback element which is not yet sent
for (int i = 0; i < savedArray.length(); i++) {
String instanceName = (String)savedArray.get(i);
String screenFeedBackJsonFile = Utility.getJSONfileName(instanceName);
String actualTimeSent = timeSentMap.get(instanceName);
String zipFile = Utility.storageDirectory+instanceName+"_"+ actualTimeSent+".zip";
List<String> fileList = new ArrayList<>();
fileList.add(Utility.getImageFileName(instanceName)); // depends on control dependency: [for], data = [none]
fileList.add(screenFeedBackJsonFile); // depends on control dependency: [for], data = [none]
Utility.createZipArchive(fileList,zipFile); // depends on control dependency: [for], data = [none]
LogPersister.sendInAppFeedBackFile(zipFile, new FeedBackUploadResponseListener(instanceName,zipFile,actualTimeSent)); // depends on control dependency: [for], data = [none]
}
}catch (JSONException je){
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
Diagnostic createDiagnostic( Instance instance ) {
Diagnostic result = new Diagnostic( InstanceHelpers.computeInstancePath( instance ));
for( Map.Entry<String,Boolean> entry : ComponentHelpers.findComponentDependenciesFor( instance.getComponent()).entrySet()) {
String facetOrComponentName = entry.getKey();
Collection<Import> imports = instance.getImports().get( facetOrComponentName );
boolean resolved = imports != null && ! imports.isEmpty();
boolean optional = entry.getValue();
result.getDependenciesInformation().add( new DependencyInformation( facetOrComponentName, optional, resolved ));
}
return result;
} }
|
public class class_name {
Diagnostic createDiagnostic( Instance instance ) {
Diagnostic result = new Diagnostic( InstanceHelpers.computeInstancePath( instance ));
for( Map.Entry<String,Boolean> entry : ComponentHelpers.findComponentDependenciesFor( instance.getComponent()).entrySet()) {
String facetOrComponentName = entry.getKey();
Collection<Import> imports = instance.getImports().get( facetOrComponentName );
boolean resolved = imports != null && ! imports.isEmpty();
boolean optional = entry.getValue();
result.getDependenciesInformation().add( new DependencyInformation( facetOrComponentName, optional, resolved )); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
synchronized public void setNeedClientAuth(boolean flag) {
doClientAuth = (flag ?
SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none);
if ((handshaker != null) &&
(handshaker instanceof ServerHandshaker) &&
!handshaker.activated()) {
((ServerHandshaker) handshaker).setClientAuth(doClientAuth);
}
} }
|
public class class_name {
synchronized public void setNeedClientAuth(boolean flag) {
doClientAuth = (flag ?
SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none);
if ((handshaker != null) &&
(handshaker instanceof ServerHandshaker) &&
!handshaker.activated()) {
((ServerHandshaker) handshaker).setClientAuth(doClientAuth); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean isConstraintViolation(Exception e) {
Throwable cause = e;
while (cause != cause.getCause() && cause.getCause() != null) {
if (cause.getClass().getSimpleName().equals("ConstraintViolationException")) //$NON-NLS-1$
return true;
cause = cause.getCause();
}
return false;
} }
|
public class class_name {
public static boolean isConstraintViolation(Exception e) {
Throwable cause = e;
while (cause != cause.getCause() && cause.getCause() != null) {
if (cause.getClass().getSimpleName().equals("ConstraintViolationException")) //$NON-NLS-1$
return true;
cause = cause.getCause(); // depends on control dependency: [while], data = [none]
}
return false;
} }
|
public class class_name {
public static <T> List<T> filter( Iterable<T> collection, Predicate<T> predicate)
{
List<T> filtered = new ArrayList<T>();
for (T element : collection)
{
if (predicate.isVerifiedBy(element))
{
filtered.add(element);
}
}
return filtered;
} }
|
public class class_name {
public static <T> List<T> filter( Iterable<T> collection, Predicate<T> predicate)
{
List<T> filtered = new ArrayList<T>();
for (T element : collection)
{
if (predicate.isVerifiedBy(element))
{
filtered.add(element); // depends on control dependency: [if], data = [none]
}
}
return filtered;
} }
|
public class class_name {
protected List<String> getAlternatePaths(String path) {
List<String> alternatePaths = new ArrayList<>();
if (path.startsWith("/")) { //People are often confused about leading slashes in resource paths...
alternatePaths.add(path.substring(1));
}
return alternatePaths;
} }
|
public class class_name {
protected List<String> getAlternatePaths(String path) {
List<String> alternatePaths = new ArrayList<>();
if (path.startsWith("/")) { //People are often confused about leading slashes in resource paths...
alternatePaths.add(path.substring(1)); // depends on control dependency: [if], data = [none]
}
return alternatePaths;
} }
|
public class class_name {
public static Map<String, Object> toMap(String xml){
xml = xml.replaceAll("(\\r|\\n)", "");
if (Strings.isNullOrEmpty(xml)){
return Collections.emptyMap();
}
XmlReaders readers = XmlReaders.create(xml);
return toMap(readers);
} }
|
public class class_name {
public static Map<String, Object> toMap(String xml){
xml = xml.replaceAll("(\\r|\\n)", "");
if (Strings.isNullOrEmpty(xml)){
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
XmlReaders readers = XmlReaders.create(xml);
return toMap(readers);
} }
|
public class class_name {
public static AlertDto transformToDto(Alert alert) {
if (alert == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
AlertDto result = createDtoObject(AlertDto.class, alert);
result.setOwnerName(alert.getOwner().getUserName());
for (Trigger trigger : alert.getTriggers()) {
result.addTriggersIds(trigger);
}
for (Notification notification : alert.getNotifications()) {
result.addNotificationsIds(notification);
}
return result;
} }
|
public class class_name {
public static AlertDto transformToDto(Alert alert) {
if (alert == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
AlertDto result = createDtoObject(AlertDto.class, alert);
result.setOwnerName(alert.getOwner().getUserName());
for (Trigger trigger : alert.getTriggers()) {
result.addTriggersIds(trigger); // depends on control dependency: [for], data = [trigger]
}
for (Notification notification : alert.getNotifications()) {
result.addNotificationsIds(notification); // depends on control dependency: [for], data = [notification]
}
return result;
} }
|
public class class_name {
public void setLastPoint(double x, double y, double z) {
if (this.numCoordsProperty.get()>=3) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x);
this.coordsProperty[this.numCoordsProperty.get()-2].set(y);
this.coordsProperty[this.numCoordsProperty.get()-1].set(z);
this.graphicalBounds = null;
this.logicalBounds = null;
}
} }
|
public class class_name {
public void setLastPoint(double x, double y, double z) {
if (this.numCoordsProperty.get()>=3) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x); // depends on control dependency: [if], data = [none]
this.coordsProperty[this.numCoordsProperty.get()-2].set(y); // depends on control dependency: [if], data = [none]
this.coordsProperty[this.numCoordsProperty.get()-1].set(z); // depends on control dependency: [if], data = [none]
this.graphicalBounds = null; // depends on control dependency: [if], data = [none]
this.logicalBounds = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void makeFileSubType() {
// determine file type
Key key = findKey(GempakStation.SLAT);
if (key == null)
throw new IllegalStateException("File does not have key="+GempakStation.SLAT);
String latType = key.type;
Key dateKey = findKey(DATE);
if (dateKey != null && !dateKey.type.equals(latType)) {
if (latType.equals(ROW)) {
subType = CLIMATE;
} else {
subType = STANDARD;
}
} else {
subType = SHIP;
}
} }
|
public class class_name {
protected void makeFileSubType() {
// determine file type
Key key = findKey(GempakStation.SLAT);
if (key == null)
throw new IllegalStateException("File does not have key="+GempakStation.SLAT);
String latType = key.type;
Key dateKey = findKey(DATE);
if (dateKey != null && !dateKey.type.equals(latType)) {
if (latType.equals(ROW)) {
subType = CLIMATE;
// depends on control dependency: [if], data = [none]
} else {
subType = STANDARD;
// depends on control dependency: [if], data = [none]
}
} else {
subType = SHIP;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?>... clauses) {
SQLInsertClause insert = insert(entity);
StringBuilder flag = new StringBuilder(" on duplicate key update ");
for (int i = 0; i < clauses.length; i++) {
flag.append(i > 0 ? ", " : "").append("{" + i + "}");
}
insert.addFlag(Position.END, ExpressionUtils.template(String.class, flag.toString(), clauses));
return insert;
} }
|
public class class_name {
public SQLInsertClause insertOnDuplicateKeyUpdate(RelationalPath<?> entity, Expression<?>... clauses) {
SQLInsertClause insert = insert(entity);
StringBuilder flag = new StringBuilder(" on duplicate key update ");
for (int i = 0; i < clauses.length; i++) {
flag.append(i > 0 ? ", " : "").append("{" + i + "}"); // depends on control dependency: [for], data = [i]
}
insert.addFlag(Position.END, ExpressionUtils.template(String.class, flag.toString(), clauses));
return insert;
} }
|
public class class_name {
public List<GrantedAuthority> getGrantedAuthorities(Collection<String> attributes) {
List<GrantedAuthority> result = new ArrayList<>(attributes.size());
for (String attribute : attributes) {
result.add(getGrantedAuthority(attribute));
}
return result;
} }
|
public class class_name {
public List<GrantedAuthority> getGrantedAuthorities(Collection<String> attributes) {
List<GrantedAuthority> result = new ArrayList<>(attributes.size());
for (String attribute : attributes) {
result.add(getGrantedAuthority(attribute)); // depends on control dependency: [for], data = [attribute]
}
return result;
} }
|
public class class_name {
public Task resume(String taskId, String operator) {
HistoryTask histTask = access().getHistTask(taskId);
AssertHelper.notNull(histTask, "指定的历史任务[id=" + taskId + "]不存在");
boolean isAllowed = true;
if(StringHelper.isNotEmpty(histTask.getOperator())) {
isAllowed = histTask.getOperator().equals(operator);
}
if(isAllowed) {
Task task = histTask.undoTask();
task.setId(StringHelper.getPrimaryKey());
task.setCreateTime(DateHelper.getTime());
access().saveTask(task);
assignTask(task.getId(), task.getOperator());
return task;
} else {
throw new SnakerException("当前参与者[" + operator + "]不允许唤醒历史任务[taskId=" + taskId + "]");
}
} }
|
public class class_name {
public Task resume(String taskId, String operator) {
HistoryTask histTask = access().getHistTask(taskId);
AssertHelper.notNull(histTask, "指定的历史任务[id=" + taskId + "]不存在");
boolean isAllowed = true;
if(StringHelper.isNotEmpty(histTask.getOperator())) {
isAllowed = histTask.getOperator().equals(operator); // depends on control dependency: [if], data = [none]
}
if(isAllowed) {
Task task = histTask.undoTask();
task.setId(StringHelper.getPrimaryKey()); // depends on control dependency: [if], data = [none]
task.setCreateTime(DateHelper.getTime()); // depends on control dependency: [if], data = [none]
access().saveTask(task); // depends on control dependency: [if], data = [none]
assignTask(task.getId(), task.getOperator()); // depends on control dependency: [if], data = [none]
return task; // depends on control dependency: [if], data = [none]
} else {
throw new SnakerException("当前参与者[" + operator + "]不允许唤醒历史任务[taskId=" + taskId + "]");
}
} }
|
public class class_name {
public static final GlobalProperties combine(GlobalProperties gp1, GlobalProperties gp2) {
if (gp1.isFullyReplicated()) {
if (gp2.isFullyReplicated()) {
return new GlobalProperties();
} else {
return gp2;
}
} else if (gp2.isFullyReplicated()) {
return gp1;
} else if (gp1.ordering != null) {
return gp1;
} else if (gp2.ordering != null) {
return gp2;
} else if (gp1.partitioningFields != null) {
return gp1;
} else if (gp2.partitioningFields != null) {
return gp2;
} else if (gp1.uniqueFieldCombinations != null) {
return gp1;
} else if (gp2.uniqueFieldCombinations != null) {
return gp2;
} else if (gp1.getPartitioning().isPartitioned()) {
return gp1;
} else if (gp2.getPartitioning().isPartitioned()) {
return gp2;
} else {
return gp1;
}
} }
|
public class class_name {
public static final GlobalProperties combine(GlobalProperties gp1, GlobalProperties gp2) {
if (gp1.isFullyReplicated()) {
if (gp2.isFullyReplicated()) {
return new GlobalProperties(); // depends on control dependency: [if], data = [none]
} else {
return gp2; // depends on control dependency: [if], data = [none]
}
} else if (gp2.isFullyReplicated()) {
return gp1; // depends on control dependency: [if], data = [none]
} else if (gp1.ordering != null) {
return gp1; // depends on control dependency: [if], data = [none]
} else if (gp2.ordering != null) {
return gp2; // depends on control dependency: [if], data = [none]
} else if (gp1.partitioningFields != null) {
return gp1; // depends on control dependency: [if], data = [none]
} else if (gp2.partitioningFields != null) {
return gp2; // depends on control dependency: [if], data = [none]
} else if (gp1.uniqueFieldCombinations != null) {
return gp1; // depends on control dependency: [if], data = [none]
} else if (gp2.uniqueFieldCombinations != null) {
return gp2; // depends on control dependency: [if], data = [none]
} else if (gp1.getPartitioning().isPartitioned()) {
return gp1; // depends on control dependency: [if], data = [none]
} else if (gp2.getPartitioning().isPartitioned()) {
return gp2; // depends on control dependency: [if], data = [none]
} else {
return gp1; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static base_responses delete(nitro_service client, route resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
route deleteresources[] = new route[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new route();
deleteresources[i].network = resources[i].network;
deleteresources[i].netmask = resources[i].netmask;
deleteresources[i].gateway = resources[i].gateway;
deleteresources[i].td = resources[i].td;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} }
|
public class class_name {
public static base_responses delete(nitro_service client, route resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
route deleteresources[] = new route[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new route(); // depends on control dependency: [for], data = [i]
deleteresources[i].network = resources[i].network; // depends on control dependency: [for], data = [i]
deleteresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i]
deleteresources[i].gateway = resources[i].gateway; // depends on control dependency: [for], data = [i]
deleteresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i]
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} }
|
public class class_name {
private ObjectMetadata getObjectMetadataUsingRange(final PresignedUrlDownloadRequest request) {
PresignedUrlDownloadRequest copy = request.clone();
try {
return s3.download(copy.withRange(0, 1))
.getS3Object()
.getObjectMetadata();
} catch (AmazonS3Exception exception) {
// This handles error case when trying a range GET on object with zero size
if (exception.getStatusCode() == 416 && "InvalidRange".equals(exception.getErrorCode())) {
return null;
}
throw exception;
}
} }
|
public class class_name {
private ObjectMetadata getObjectMetadataUsingRange(final PresignedUrlDownloadRequest request) {
PresignedUrlDownloadRequest copy = request.clone();
try {
return s3.download(copy.withRange(0, 1))
.getS3Object()
.getObjectMetadata(); // depends on control dependency: [try], data = [none]
} catch (AmazonS3Exception exception) {
// This handles error case when trying a range GET on object with zero size
if (exception.getStatusCode() == 416 && "InvalidRange".equals(exception.getErrorCode())) {
return null; // depends on control dependency: [if], data = [none]
}
throw exception;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public final DescriptionProvider getModelDescription(final PathAddress address) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getModelDescription(ri.pathAddress.append(address));
}
// else we are the root
return getModelDescription(address.iterator());
} }
|
public class class_name {
@Override
public final DescriptionProvider getModelDescription(final PathAddress address) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getModelDescription(ri.pathAddress.append(address)); // depends on control dependency: [if], data = [none]
}
// else we are the root
return getModelDescription(address.iterator());
} }
|
public class class_name {
public GeneratorConfig2 install(final ResourceSet resourceSet, GeneratorConfig2 config) {
GeneratorConfigAdapter adapter = GeneratorConfigAdapter.findInEmfObject(resourceSet);
if (adapter == null) {
adapter = new GeneratorConfigAdapter();
}
adapter.attachToEmfObject(resourceSet);
return adapter.getLanguage2GeneratorConfig().put(this.languageId, config);
} }
|
public class class_name {
public GeneratorConfig2 install(final ResourceSet resourceSet, GeneratorConfig2 config) {
GeneratorConfigAdapter adapter = GeneratorConfigAdapter.findInEmfObject(resourceSet);
if (adapter == null) {
adapter = new GeneratorConfigAdapter(); // depends on control dependency: [if], data = [none]
}
adapter.attachToEmfObject(resourceSet);
return adapter.getLanguage2GeneratorConfig().put(this.languageId, config);
} }
|
public class class_name {
public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom;
}
}
return null;
} }
|
public class class_name {
public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static void window(int[] samples, int count, int start, int increment,
int[] windowedSamples) {
int[] values = windowedSamples;
int loopCount = 0;
float halfway = count/2.0f;
float hth = halfway*halfway;
float windowCount = -halfway;
int limit = count*increment+start;
for(int i = start; i < limit; i+=increment) {
//float innerCount = (windowCount < 0) ? -windowCount:windowCount;
float innerCountSquared = windowCount*windowCount;
windowCount++;
//double val = 1.0-(double)(innerCount/halfway);
float val = 1.0f-( innerCountSquared/hth );
double temp = ((double)samples[i])*val;
temp = (temp >0) ? temp+0.5:temp-0.5;
values[loopCount++] = (int)temp;
}
} }
|
public class class_name {
public static void window(int[] samples, int count, int start, int increment,
int[] windowedSamples) {
int[] values = windowedSamples;
int loopCount = 0;
float halfway = count/2.0f;
float hth = halfway*halfway;
float windowCount = -halfway;
int limit = count*increment+start;
for(int i = start; i < limit; i+=increment) {
//float innerCount = (windowCount < 0) ? -windowCount:windowCount;
float innerCountSquared = windowCount*windowCount;
windowCount++; // depends on control dependency: [for], data = [none]
//double val = 1.0-(double)(innerCount/halfway);
float val = 1.0f-( innerCountSquared/hth );
double temp = ((double)samples[i])*val;
temp = (temp >0) ? temp+0.5:temp-0.5; // depends on control dependency: [for], data = [none]
values[loopCount++] = (int)temp; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public int compareTo(ReadablePartial other) {
if (this == other) {
return 0;
}
if (size() != other.size()) {
throw new ClassCastException("ReadablePartial objects must have matching field types");
}
for (int i = 0, isize = size(); i < isize; i++) {
if (getFieldType(i) != other.getFieldType(i)) {
throw new ClassCastException("ReadablePartial objects must have matching field types");
}
}
// fields are ordered largest first
for (int i = 0, isize = size(); i < isize; i++) {
if (getValue(i) > other.getValue(i)) {
return 1;
}
if (getValue(i) < other.getValue(i)) {
return -1;
}
}
return 0;
} }
|
public class class_name {
public int compareTo(ReadablePartial other) {
if (this == other) {
return 0; // depends on control dependency: [if], data = [none]
}
if (size() != other.size()) {
throw new ClassCastException("ReadablePartial objects must have matching field types");
}
for (int i = 0, isize = size(); i < isize; i++) {
if (getFieldType(i) != other.getFieldType(i)) {
throw new ClassCastException("ReadablePartial objects must have matching field types");
}
}
// fields are ordered largest first
for (int i = 0, isize = size(); i < isize; i++) {
if (getValue(i) > other.getValue(i)) {
return 1; // depends on control dependency: [if], data = [none]
}
if (getValue(i) < other.getValue(i)) {
return -1; // depends on control dependency: [if], data = [none]
}
}
return 0;
} }
|
public class class_name {
@Override
public EClass getIfcRelDefines() {
if (ifcRelDefinesEClass == null) {
ifcRelDefinesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(547);
}
return ifcRelDefinesEClass;
} }
|
public class class_name {
@Override
public EClass getIfcRelDefines() {
if (ifcRelDefinesEClass == null) {
ifcRelDefinesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(547);
// depends on control dependency: [if], data = [none]
}
return ifcRelDefinesEClass;
} }
|
public class class_name {
public static PaxDate from(TemporalAccessor temporal) {
if (temporal instanceof PaxDate) {
return (PaxDate) temporal;
}
return PaxDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
} }
|
public class class_name {
public static PaxDate from(TemporalAccessor temporal) {
if (temporal instanceof PaxDate) {
return (PaxDate) temporal; // depends on control dependency: [if], data = [none]
}
return PaxDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
} }
|
public class class_name {
public void persistConnection(HttpConnection connection)
{
try
{
Socket socket=(Socket)(connection.getConnection());
if (_lowResourcePersistTimeMs>0 && isLowOnResources())
{
socket.setSoTimeout(_lowResourcePersistTimeMs);
connection.setThrottled(true);
}
else
connection.setThrottled(false);
}
catch(Exception e)
{
LogSupport.ignore(log,e);
}
} }
|
public class class_name {
public void persistConnection(HttpConnection connection)
{
try
{
Socket socket=(Socket)(connection.getConnection());
if (_lowResourcePersistTimeMs>0 && isLowOnResources())
{
socket.setSoTimeout(_lowResourcePersistTimeMs); // depends on control dependency: [if], data = [(_lowResourcePersistTimeMs]
connection.setThrottled(true); // depends on control dependency: [if], data = [none]
}
else
connection.setThrottled(false);
}
catch(Exception e)
{
LogSupport.ignore(log,e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<RollupInterval> getRollupInterval(final long interval,
final String str_interval) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval cannot be null or empty");
}
final Map<Long, RollupInterval> rollups =
new TreeMap<Long, RollupInterval>(Collections.reverseOrder());
boolean right_match = false;
for (RollupInterval rollup: forward_intervals.values()) {
if (rollup.getIntervalSeconds() == interval) {
rollups.put((long) rollup.getIntervalSeconds(), rollup);
right_match = true;
}
else if (interval % rollup.getIntervalSeconds() == 0) {
rollups.put((long) rollup.getIntervalSeconds(), rollup);
}
}
if (rollups.isEmpty()) {
throw new NoSuchRollupForIntervalException(Long.toString(interval));
}
List<RollupInterval> best_matches =
new ArrayList<RollupInterval>(rollups.values());
if (!right_match) {
LOG.warn("No such rollup interval found, " + str_interval + ". So falling "
+ "back to the next best match " + best_matches.get(0).
getInterval());
}
return best_matches;
} }
|
public class class_name {
public List<RollupInterval> getRollupInterval(final long interval,
final String str_interval) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval cannot be null or empty");
}
final Map<Long, RollupInterval> rollups =
new TreeMap<Long, RollupInterval>(Collections.reverseOrder());
boolean right_match = false;
for (RollupInterval rollup: forward_intervals.values()) {
if (rollup.getIntervalSeconds() == interval) {
rollups.put((long) rollup.getIntervalSeconds(), rollup); // depends on control dependency: [if], data = [none]
right_match = true; // depends on control dependency: [if], data = [none]
}
else if (interval % rollup.getIntervalSeconds() == 0) {
rollups.put((long) rollup.getIntervalSeconds(), rollup); // depends on control dependency: [if], data = [none]
}
}
if (rollups.isEmpty()) {
throw new NoSuchRollupForIntervalException(Long.toString(interval));
}
List<RollupInterval> best_matches =
new ArrayList<RollupInterval>(rollups.values());
if (!right_match) {
LOG.warn("No such rollup interval found, " + str_interval + ". So falling "
+ "back to the next best match " + best_matches.get(0).
getInterval()); // depends on control dependency: [if], data = [none]
}
return best_matches;
} }
|
public class class_name {
public static LicenseProvider createInstance(ZipFile zipFile, String laPrefix) {
JarFile jar = null;
try {
jar = getJarFile(zipFile);
} catch (IOException e) {
}
if (jar == null) {
return null;
}
return ContentLicenseProvider.createInstance(new Content.JarContent(jar), laPrefix);
} }
|
public class class_name {
public static LicenseProvider createInstance(ZipFile zipFile, String laPrefix) {
JarFile jar = null;
try {
jar = getJarFile(zipFile); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
if (jar == null) {
return null; // depends on control dependency: [if], data = [none]
}
return ContentLicenseProvider.createInstance(new Content.JarContent(jar), laPrefix);
} }
|
public class class_name {
protected void cons3(final List<String> features, final Cons c0,
final Cons c1, final Cons c2, final Collection<Parse> punct1s,
final Collection<Parse> punct2s, final boolean trigram,
final boolean bigram1, final boolean bigram2) {
// features.add("stage=cons(0),cons(1),cons(2)");
if (punct1s != null) {
if (c0.index == -2) {
for (final Parse p : punct1s) {
// String punct = punct(p,c1.index);
final String punctbo = punctbo(p,
c1.index <= 0 ? c1.index - 1 : c1.index);
// punct(-2)
// TODO consider changing
// features.add(punct);
// punctbo(-2)
features.add(punctbo);
}
}
}
if (punct2s != null) {
if (c2.index == 2) {
for (final Parse p : punct2s) {
// String punct = punct(p,c2.index);
final String punctbo = punctbo(p,
c2.index <= 0 ? c2.index - 1 : c2.index);
// punct(2)
// TODO consider changing
// features.add(punct);
// punctbo(2)
features.add(punctbo);
}
}
if (punct1s != null) {
// cons(0),punctbo(1),cons(1),punctbo(2),cons(2)
for (final Parse parse : punct2s) {
final String punctbo2 = punctbo(parse,
c2.index <= 0 ? c2.index - 1 : c2.index);
for (final Parse parse2 : punct1s) {
final String punctbo1 = punctbo(parse2,
c1.index <= 0 ? c1.index - 1 : c1.index);
if (trigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.cons);
}
if (bigram2) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.cons);
}
if (c0.unigram && c2.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.cons);
}
if (bigram1) {
features.add(c0.cons + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.consbo);
}
if (c2.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.cons);
}
if (c1.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.consbo);
}
if (c0.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.consbo);
}
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.consbo);
if (this.zeroBackOff) {
if (bigram1) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.cons + "," + punctbo2);
}
if (c1.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2);
}
if (c0.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2);
}
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2);
}
}
}
} else { // punct1s == null
// cons(0),cons(1),punctbo(2),cons(2)
for (final Parse parse : punct2s) {
final String punctbo2 = punctbo(parse,
c2.index <= 0 ? c2.index - 1 : c2.index);
if (trigram) {
features
.add(c0.cons + "," + c1.cons + "," + punctbo2 + "," + c2.cons);
}
if (bigram2) {
features.add(
c0.consbo + "," + c1.cons + "," + punctbo2 + "," + c2.cons);
}
if (c0.unigram && c2.unigram) {
features.add(
c0.cons + "," + c1.consbo + "," + punctbo2 + "," + c2.cons);
}
if (bigram1) {
features.add(
c0.cons + "," + c1.cons + "," + punctbo2 + "," + c2.consbo);
}
if (c2.unigram) {
features.add(
c0.consbo + "," + c1.consbo + "," + punctbo2 + "," + c2.cons);
}
if (c1.unigram) {
features.add(
c0.consbo + "," + c1.cons + "," + punctbo2 + "," + c2.consbo);
}
if (c0.unigram) {
features.add(
c0.cons + "," + c1.consbo + "," + punctbo2 + "," + c2.consbo);
}
features.add(
c0.consbo + "," + c1.consbo + "," + punctbo2 + "," + c2.consbo);
if (this.zeroBackOff) {
if (bigram1) {
features.add(c0.cons + "," + c1.cons + "," + punctbo2);
}
if (c1.unigram) {
features.add(c0.consbo + "," + c1.cons + "," + punctbo2);
}
if (c0.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + punctbo2);
}
features.add(c0.consbo + "," + c1.consbo + "," + punctbo2);
}
}
}
} else {
if (punct1s != null) {
// cons(0),punctbo(1),cons(1),cons(2)
for (final Parse parse : punct1s) {
final String punctbo1 = punctbo(parse,
c1.index <= 0 ? c1.index - 1 : c1.index);
if (trigram) {
features
.add(c0.cons + "," + punctbo1 + "," + c1.cons + "," + c2.cons);
}
if (bigram2) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.cons + "," + c2.cons);
}
if (c0.unigram && c2.unigram) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.consbo + "," + c2.cons);
}
if (bigram1) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.cons + "," + c2.consbo);
}
if (c2.unigram) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.consbo + "," + c2.cons);
}
if (c1.unigram) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.cons + "," + c2.consbo);
}
if (c0.unigram) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.consbo + "," + c2.consbo);
}
features.add(
c0.consbo + "," + punctbo1 + "," + c1.consbo + "," + c2.consbo);
// zero backoff case covered by cons(0)cons(1)
}
} else {
// cons(0),cons(1),cons(2)
if (trigram) {
features.add(c0.cons + "," + c1.cons + "," + c2.cons);
}
if (bigram2) {
features.add(c0.consbo + "," + c1.cons + "," + c2.cons);
}
if (c0.unigram && c2.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + c2.cons);
}
if (bigram1) {
features.add(c0.cons + "," + c1.cons + "," + c2.consbo);
}
if (c2.unigram) {
features.add(c0.consbo + "," + c1.consbo + "," + c2.cons);
}
if (c1.unigram) {
features.add(c0.consbo + "," + c1.cons + "," + c2.consbo);
}
if (c0.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + c2.consbo);
}
features.add(c0.consbo + "," + c1.consbo + "," + c2.consbo);
}
}
} }
|
public class class_name {
protected void cons3(final List<String> features, final Cons c0,
final Cons c1, final Cons c2, final Collection<Parse> punct1s,
final Collection<Parse> punct2s, final boolean trigram,
final boolean bigram1, final boolean bigram2) {
// features.add("stage=cons(0),cons(1),cons(2)");
if (punct1s != null) {
if (c0.index == -2) {
for (final Parse p : punct1s) {
// String punct = punct(p,c1.index);
final String punctbo = punctbo(p,
c1.index <= 0 ? c1.index - 1 : c1.index);
// punct(-2)
// TODO consider changing
// features.add(punct);
// punctbo(-2)
features.add(punctbo); // depends on control dependency: [for], data = [p]
}
}
}
if (punct2s != null) {
if (c2.index == 2) {
for (final Parse p : punct2s) {
// String punct = punct(p,c2.index);
final String punctbo = punctbo(p,
c2.index <= 0 ? c2.index - 1 : c2.index);
// punct(2)
// TODO consider changing
// features.add(punct);
// punctbo(2)
features.add(punctbo); // depends on control dependency: [for], data = [p]
}
}
if (punct1s != null) {
// cons(0),punctbo(1),cons(1),punctbo(2),cons(2)
for (final Parse parse : punct2s) {
final String punctbo2 = punctbo(parse,
c2.index <= 0 ? c2.index - 1 : c2.index);
for (final Parse parse2 : punct1s) {
final String punctbo1 = punctbo(parse2,
c1.index <= 0 ? c1.index - 1 : c1.index);
if (trigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram2) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c0.unigram && c2.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram1) {
features.add(c0.cons + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c2.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2 + "," + c2.consbo); // depends on control dependency: [for], data = [none]
if (this.zeroBackOff) {
if (bigram1) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.cons + "," + punctbo2); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(c0.consbo + "," + punctbo1 + "," + c1.cons + ","
+ punctbo2); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(c0.cons + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2); // depends on control dependency: [if], data = [none]
}
features.add(c0.consbo + "," + punctbo1 + "," + c1.consbo + ","
+ punctbo2); // depends on control dependency: [if], data = [none]
}
}
}
} else { // punct1s == null
// cons(0),cons(1),punctbo(2),cons(2)
for (final Parse parse : punct2s) {
final String punctbo2 = punctbo(parse,
c2.index <= 0 ? c2.index - 1 : c2.index);
if (trigram) {
features
.add(c0.cons + "," + c1.cons + "," + punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram2) {
features.add(
c0.consbo + "," + c1.cons + "," + punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c0.unigram && c2.unigram) {
features.add(
c0.cons + "," + c1.consbo + "," + punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram1) {
features.add(
c0.cons + "," + c1.cons + "," + punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c2.unigram) {
features.add(
c0.consbo + "," + c1.consbo + "," + punctbo2 + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(
c0.consbo + "," + c1.cons + "," + punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(
c0.cons + "," + c1.consbo + "," + punctbo2 + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
features.add(
c0.consbo + "," + c1.consbo + "," + punctbo2 + "," + c2.consbo); // depends on control dependency: [for], data = [none]
if (this.zeroBackOff) {
if (bigram1) {
features.add(c0.cons + "," + c1.cons + "," + punctbo2); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(c0.consbo + "," + c1.cons + "," + punctbo2); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + punctbo2); // depends on control dependency: [if], data = [none]
}
features.add(c0.consbo + "," + c1.consbo + "," + punctbo2); // depends on control dependency: [if], data = [none]
}
}
}
} else {
if (punct1s != null) {
// cons(0),punctbo(1),cons(1),cons(2)
for (final Parse parse : punct1s) {
final String punctbo1 = punctbo(parse,
c1.index <= 0 ? c1.index - 1 : c1.index);
if (trigram) {
features
.add(c0.cons + "," + punctbo1 + "," + c1.cons + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram2) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.cons + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c0.unigram && c2.unigram) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.consbo + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram1) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.cons + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c2.unigram) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.consbo + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(
c0.consbo + "," + punctbo1 + "," + c1.cons + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(
c0.cons + "," + punctbo1 + "," + c1.consbo + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
features.add(
c0.consbo + "," + punctbo1 + "," + c1.consbo + "," + c2.consbo); // depends on control dependency: [for], data = [none]
// zero backoff case covered by cons(0)cons(1)
}
} else {
// cons(0),cons(1),cons(2)
if (trigram) {
features.add(c0.cons + "," + c1.cons + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram2) {
features.add(c0.consbo + "," + c1.cons + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c0.unigram && c2.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (bigram1) {
features.add(c0.cons + "," + c1.cons + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c2.unigram) {
features.add(c0.consbo + "," + c1.consbo + "," + c2.cons); // depends on control dependency: [if], data = [none]
}
if (c1.unigram) {
features.add(c0.consbo + "," + c1.cons + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
if (c0.unigram) {
features.add(c0.cons + "," + c1.consbo + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
features.add(c0.consbo + "," + c1.consbo + "," + c2.consbo); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
static int collapse(char[] chars, int len) {
// collapse
// After the processing implied by replace, contiguous sequences of
// #x20's are collapsed to a single #x20, and leading and trailing
// #x20's are removed.
replace(chars, len);
int newLen = len;
// contiguous sequences of #x20's are collapsed to a single #x20
if (newLen > 1) {
int i = 0;
while (i < (newLen - 1)) {
char thisChar = chars[i];
char nextChar = chars[i + 1];
if (thisChar == ' ' && nextChar == ' ') {
// eliminate one space
shiftLeft(chars, i, newLen - i);
newLen--;
} else {
i++;
}
}
}
// leading and trailing #x20's are removed
newLen = trimSpaces(chars, newLen);
return newLen;
} }
|
public class class_name {
static int collapse(char[] chars, int len) {
// collapse
// After the processing implied by replace, contiguous sequences of
// #x20's are collapsed to a single #x20, and leading and trailing
// #x20's are removed.
replace(chars, len);
int newLen = len;
// contiguous sequences of #x20's are collapsed to a single #x20
if (newLen > 1) {
int i = 0;
while (i < (newLen - 1)) {
char thisChar = chars[i];
char nextChar = chars[i + 1];
if (thisChar == ' ' && nextChar == ' ') {
// eliminate one space
shiftLeft(chars, i, newLen - i); // depends on control dependency: [if], data = [none]
newLen--; // depends on control dependency: [if], data = [none]
} else {
i++; // depends on control dependency: [if], data = [none]
}
}
}
// leading and trailing #x20's are removed
newLen = trimSpaces(chars, newLen);
return newLen;
} }
|
public class class_name {
public static char[] binToHex(byte[] bytes, int offset, int len) {
final char[] sb = new char[len * 2];
final int end = offset + len;
int index = 0;
final char[] hexs = hex;
for (int i = offset; i < end; i++) {
byte b = bytes[i];
sb[index++] = (hexs[((b >> 4) & 0xF)]);
sb[index++] = hexs[((b) & 0xF)];
}
return sb;
} }
|
public class class_name {
public static char[] binToHex(byte[] bytes, int offset, int len) {
final char[] sb = new char[len * 2];
final int end = offset + len;
int index = 0;
final char[] hexs = hex;
for (int i = offset; i < end; i++) {
byte b = bytes[i];
sb[index++] = (hexs[((b >> 4) & 0xF)]);
// depends on control dependency: [for], data = [none]
sb[index++] = hexs[((b) & 0xF)];
// depends on control dependency: [for], data = [none]
}
return sb;
} }
|
public class class_name {
public static Chart getMSDLineChart(ArrayList<? extends Trajectory> t, int lagMin,
int lagMax, AbstractMeanSquaredDisplacmentEvaluator msdeval) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
for (int j = lagMin; j < lagMax + 1; j++) {
double msd = 0;
int N = 0;
for (int i = 0; i < t.size(); i++) {
if(t.get(i).size()>lagMax){
msdeval.setTrajectory(t.get(i));
msdeval.setTimelag(j);
msd += msdeval.evaluate()[0];
N++;
}
}
msd = 1.0 / N * msd;
xData[j - lagMin] = j;
yData[j - lagMin] = msd;
}
// Create Chart
Chart chart = QuickChart.getChart("MSD Line", "LAG", "MSD", "MSD",
xData, yData);
// Show it
// new SwingWrapper(chart).displayChart();
return chart;
} }
|
public class class_name {
public static Chart getMSDLineChart(ArrayList<? extends Trajectory> t, int lagMin,
int lagMax, AbstractMeanSquaredDisplacmentEvaluator msdeval) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
for (int j = lagMin; j < lagMax + 1; j++) {
double msd = 0;
int N = 0;
for (int i = 0; i < t.size(); i++) {
if(t.get(i).size()>lagMax){
msdeval.setTrajectory(t.get(i)); // depends on control dependency: [if], data = [none]
msdeval.setTimelag(j); // depends on control dependency: [if], data = [none]
msd += msdeval.evaluate()[0]; // depends on control dependency: [if], data = [none]
N++; // depends on control dependency: [if], data = [none]
}
}
msd = 1.0 / N * msd; // depends on control dependency: [for], data = [none]
xData[j - lagMin] = j; // depends on control dependency: [for], data = [j]
yData[j - lagMin] = msd; // depends on control dependency: [for], data = [j]
}
// Create Chart
Chart chart = QuickChart.getChart("MSD Line", "LAG", "MSD", "MSD",
xData, yData);
// Show it
// new SwingWrapper(chart).displayChart();
return chart;
} }
|
public class class_name {
public static INDArray reverseTimeSeries(INDArray in){
if(in == null){
return null;
}
if(in.ordering() != 'f' || in.isView() || !Shape.strideDescendingCAscendingF(in)){
in = in.dup('f');
}
// FIXME: int cast
int[] idxs = new int[(int) in.size(2)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i;
}
INDArray inReshape = in.reshape('f', in.size(0)*in.size(1), in.size(2));
INDArray outReshape = Nd4j.pullRows(inReshape, 0, idxs, 'f');
return outReshape.reshape('f', in.size(0), in.size(1), in.size(2));
} }
|
public class class_name {
public static INDArray reverseTimeSeries(INDArray in){
if(in == null){
return null; // depends on control dependency: [if], data = [none]
}
if(in.ordering() != 'f' || in.isView() || !Shape.strideDescendingCAscendingF(in)){
in = in.dup('f'); // depends on control dependency: [if], data = [none]
}
// FIXME: int cast
int[] idxs = new int[(int) in.size(2)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i; // depends on control dependency: [for], data = [i]
}
INDArray inReshape = in.reshape('f', in.size(0)*in.size(1), in.size(2));
INDArray outReshape = Nd4j.pullRows(inReshape, 0, idxs, 'f');
return outReshape.reshape('f', in.size(0), in.size(1), in.size(2));
} }
|
public class class_name {
public void setItems(java.util.Collection<UsagePlanKey> items) {
if (items == null) {
this.items = null;
return;
}
this.items = new java.util.ArrayList<UsagePlanKey>(items);
} }
|
public class class_name {
public void setItems(java.util.Collection<UsagePlanKey> items) {
if (items == null) {
this.items = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.items = new java.util.ArrayList<UsagePlanKey>(items);
} }
|
public class class_name {
public static boolean isLafAqua() {
ensureValidCache();
if (cachedIsLafAqua == null) {
cachedIsLafAqua = Boolean.valueOf(computeIsLafAqua());
}
return cachedIsLafAqua.booleanValue();
} }
|
public class class_name {
public static boolean isLafAqua() {
ensureValidCache();
if (cachedIsLafAqua == null) {
cachedIsLafAqua = Boolean.valueOf(computeIsLafAqua()); // depends on control dependency: [if], data = [none]
}
return cachedIsLafAqua.booleanValue();
} }
|
public class class_name {
private boolean rebalance(final NodeInterval newNode) {
NodeInterval prevRebalanced = null;
NodeInterval curChild = leftChild;
List<NodeInterval> toBeRebalanced = Lists.newLinkedList();
do {
if (curChild.isItemOverlap(newNode)) {
toBeRebalanced.add(curChild);
} else {
if (toBeRebalanced.size() > 0) {
break;
}
prevRebalanced = curChild;
}
curChild = curChild.rightSibling;
} while (curChild != null);
if (toBeRebalanced.isEmpty()) {
return false;
}
newNode.parent = this;
final NodeInterval lastNodeToRebalance = toBeRebalanced.get(toBeRebalanced.size() - 1);
newNode.rightSibling = lastNodeToRebalance.rightSibling;
lastNodeToRebalance.rightSibling = null;
if (prevRebalanced == null) {
leftChild = newNode;
} else {
prevRebalanced.rightSibling = newNode;
}
NodeInterval prev = null;
for (NodeInterval cur : toBeRebalanced) {
cur.parent = newNode;
if (prev == null) {
newNode.leftChild = cur;
} else {
prev.rightSibling = cur;
}
prev = cur;
}
return true;
} }
|
public class class_name {
private boolean rebalance(final NodeInterval newNode) {
NodeInterval prevRebalanced = null;
NodeInterval curChild = leftChild;
List<NodeInterval> toBeRebalanced = Lists.newLinkedList();
do {
if (curChild.isItemOverlap(newNode)) {
toBeRebalanced.add(curChild); // depends on control dependency: [if], data = [none]
} else {
if (toBeRebalanced.size() > 0) {
break;
}
prevRebalanced = curChild; // depends on control dependency: [if], data = [none]
}
curChild = curChild.rightSibling;
} while (curChild != null);
if (toBeRebalanced.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
newNode.parent = this;
final NodeInterval lastNodeToRebalance = toBeRebalanced.get(toBeRebalanced.size() - 1);
newNode.rightSibling = lastNodeToRebalance.rightSibling;
lastNodeToRebalance.rightSibling = null;
if (prevRebalanced == null) {
leftChild = newNode; // depends on control dependency: [if], data = [none]
} else {
prevRebalanced.rightSibling = newNode; // depends on control dependency: [if], data = [none]
}
NodeInterval prev = null;
for (NodeInterval cur : toBeRebalanced) {
cur.parent = newNode; // depends on control dependency: [for], data = [cur]
if (prev == null) {
newNode.leftChild = cur; // depends on control dependency: [if], data = [none]
} else {
prev.rightSibling = cur; // depends on control dependency: [if], data = [none]
}
prev = cur; // depends on control dependency: [for], data = [cur]
}
return true;
} }
|
public class class_name {
public final int getActiveConnectionCount() {
if(!isActive) {
return 0;
}
int count = 0;
for(ConnectionPoolConnection conn : connections) {
if(conn.state.get() != ConnectionPoolConnection.STATE_AVAILABLE) {
count++;
}
}
return count;
} }
|
public class class_name {
public final int getActiveConnectionCount() {
if(!isActive) {
return 0; // depends on control dependency: [if], data = [none]
}
int count = 0;
for(ConnectionPoolConnection conn : connections) {
if(conn.state.get() != ConnectionPoolConnection.STATE_AVAILABLE) {
count++; // depends on control dependency: [if], data = [none]
}
}
return count;
} }
|
public class class_name {
public int read(Pointer buf, JechtIO.Str str, int max_size, int skip) {
int len = 0;
max_size -= skip;
if(max_size <= 0) {
max_size = 0;
} else {
IRubyObject src = port;
IRubyObject n = RubyNumeric.int2fix(port.getRuntime(), max_size);
IRubyObject str2 = src.callMethod(port.getRuntime().getCurrentContext(), "read", n);
if(!str2.isNil()) {
ByteList res = str2.convertToString().getByteList();
len = res.realSize;
System.arraycopy(res.bytes, res.begin, buf.buffer, buf.start+skip, len);
}
}
len += skip;
buf.buffer[buf.start+len] = 0;
return len;
} }
|
public class class_name {
public int read(Pointer buf, JechtIO.Str str, int max_size, int skip) {
int len = 0;
max_size -= skip;
if(max_size <= 0) {
max_size = 0; // depends on control dependency: [if], data = [none]
} else {
IRubyObject src = port;
IRubyObject n = RubyNumeric.int2fix(port.getRuntime(), max_size);
IRubyObject str2 = src.callMethod(port.getRuntime().getCurrentContext(), "read", n);
if(!str2.isNil()) {
ByteList res = str2.convertToString().getByteList();
len = res.realSize; // depends on control dependency: [if], data = [none]
System.arraycopy(res.bytes, res.begin, buf.buffer, buf.start+skip, len); // depends on control dependency: [if], data = [none]
}
}
len += skip;
buf.buffer[buf.start+len] = 0;
return len;
} }
|
public class class_name {
private IPortletDefinitionParameter postProcessIconUrlParameter(
final IPortletDefinitionParameter iconUrl, WebRequest req) {
if (!ICON_URL_PARAMETER_NAME.equals(iconUrl.getName())) {
String msg =
"Only iconUrl should be processed this way; parameter was: "
+ iconUrl.getName();
throw new IllegalArgumentException(msg);
}
final String value = spELService.parseString(iconUrl.getValue(), req);
return new IPortletDefinitionParameter() {
@Override
public String getName() {
return ICON_URL_PARAMETER_NAME;
}
@Override
public String getValue() {
return value;
}
@Override
public String getDescription() {
return iconUrl.getDescription();
}
@Override
public void setValue(String value) {
throw new UnsupportedOperationException();
}
@Override
public void setDescription(String descr) {
throw new UnsupportedOperationException();
}
};
} }
|
public class class_name {
private IPortletDefinitionParameter postProcessIconUrlParameter(
final IPortletDefinitionParameter iconUrl, WebRequest req) {
if (!ICON_URL_PARAMETER_NAME.equals(iconUrl.getName())) {
String msg =
"Only iconUrl should be processed this way; parameter was: "
+ iconUrl.getName(); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(msg);
}
final String value = spELService.parseString(iconUrl.getValue(), req);
return new IPortletDefinitionParameter() {
@Override
public String getName() {
return ICON_URL_PARAMETER_NAME;
}
@Override
public String getValue() {
return value;
}
@Override
public String getDescription() {
return iconUrl.getDescription();
}
@Override
public void setValue(String value) {
throw new UnsupportedOperationException();
}
@Override
public void setDescription(String descr) {
throw new UnsupportedOperationException();
}
};
} }
|
public class class_name {
public static Pair<HashMap<Node, Integer>, HashMap<Node, Integer>>
getDonorsAndStealersForBalance(final Cluster nextCandidateCluster,
Map<Integer, List<Integer>> numPartitionsPerNodePerZone) {
HashMap<Node, Integer> donorNodes = Maps.newHashMap();
HashMap<Node, Integer> stealerNodes = Maps.newHashMap();
HashMap<Integer, Integer> numNodesAssignedInZone = Maps.newHashMap();
for(Integer zoneId: nextCandidateCluster.getZoneIds()) {
numNodesAssignedInZone.put(zoneId, 0);
}
for(Node node: nextCandidateCluster.getNodes()) {
int zoneId = node.getZoneId();
int offset = numNodesAssignedInZone.get(zoneId);
numNodesAssignedInZone.put(zoneId, offset + 1);
int numPartitions = numPartitionsPerNodePerZone.get(zoneId).get(offset);
if(numPartitions < node.getNumberOfPartitions()) {
donorNodes.put(node, numPartitions);
} else if(numPartitions > node.getNumberOfPartitions()) {
stealerNodes.put(node, numPartitions);
}
}
// Print out donor/stealer information
for(Node node: donorNodes.keySet()) {
System.out.println("Donor Node: " + node.getId() + ", zoneId " + node.getZoneId()
+ ", numPartitions " + node.getNumberOfPartitions()
+ ", target number of partitions " + donorNodes.get(node));
}
for(Node node: stealerNodes.keySet()) {
System.out.println("Stealer Node: " + node.getId() + ", zoneId " + node.getZoneId()
+ ", numPartitions " + node.getNumberOfPartitions()
+ ", target number of partitions " + stealerNodes.get(node));
}
return new Pair<HashMap<Node, Integer>, HashMap<Node, Integer>>(donorNodes, stealerNodes);
} }
|
public class class_name {
public static Pair<HashMap<Node, Integer>, HashMap<Node, Integer>>
getDonorsAndStealersForBalance(final Cluster nextCandidateCluster,
Map<Integer, List<Integer>> numPartitionsPerNodePerZone) {
HashMap<Node, Integer> donorNodes = Maps.newHashMap();
HashMap<Node, Integer> stealerNodes = Maps.newHashMap();
HashMap<Integer, Integer> numNodesAssignedInZone = Maps.newHashMap();
for(Integer zoneId: nextCandidateCluster.getZoneIds()) {
numNodesAssignedInZone.put(zoneId, 0); // depends on control dependency: [for], data = [zoneId]
}
for(Node node: nextCandidateCluster.getNodes()) {
int zoneId = node.getZoneId();
int offset = numNodesAssignedInZone.get(zoneId);
numNodesAssignedInZone.put(zoneId, offset + 1); // depends on control dependency: [for], data = [none]
int numPartitions = numPartitionsPerNodePerZone.get(zoneId).get(offset);
if(numPartitions < node.getNumberOfPartitions()) {
donorNodes.put(node, numPartitions); // depends on control dependency: [if], data = [none]
} else if(numPartitions > node.getNumberOfPartitions()) {
stealerNodes.put(node, numPartitions); // depends on control dependency: [if], data = [none]
}
}
// Print out donor/stealer information
for(Node node: donorNodes.keySet()) {
System.out.println("Donor Node: " + node.getId() + ", zoneId " + node.getZoneId()
+ ", numPartitions " + node.getNumberOfPartitions()
+ ", target number of partitions " + donorNodes.get(node)); // depends on control dependency: [for], data = [node]
}
for(Node node: stealerNodes.keySet()) {
System.out.println("Stealer Node: " + node.getId() + ", zoneId " + node.getZoneId()
+ ", numPartitions " + node.getNumberOfPartitions()
+ ", target number of partitions " + stealerNodes.get(node)); // depends on control dependency: [for], data = [node]
}
return new Pair<HashMap<Node, Integer>, HashMap<Node, Integer>>(donorNodes, stealerNodes);
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.