code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static Type getArrayComponentType(Type type) {
if (type instanceof Class) {
Class<?> clazz = (Class<?>)type;
return clazz.getComponentType();
} else if (type instanceof GenericArrayType) {
GenericArrayType aType = (GenericArrayType) type;
return aType.getGenericComponentType();
} else {
return null;
}
} } | public class class_name {
public static Type getArrayComponentType(Type type) {
if (type instanceof Class) {
Class<?> clazz = (Class<?>)type;
return clazz.getComponentType();
} else if (type instanceof GenericArrayType) {
GenericArrayType aType = (GenericArrayType) type;
return aType.getGenericComponentType(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BigInteger toBigInteger() {
byte[] magnitude = new byte[nWords * 4 + 1];
for (int i = 0; i < nWords; i++) {
int w = data[i];
magnitude[magnitude.length - 4 * i - 1] = (byte) w;
magnitude[magnitude.length - 4 * i - 2] = (byte) (w >> 8);
magnitude[magnitude.length - 4 * i - 3] = (byte) (w >> 16);
magnitude[magnitude.length - 4 * i - 4] = (byte) (w >> 24);
}
return new BigInteger(magnitude).shiftLeft(offset * 32);
} } | public class class_name {
public BigInteger toBigInteger() {
byte[] magnitude = new byte[nWords * 4 + 1];
for (int i = 0; i < nWords; i++) {
int w = data[i];
magnitude[magnitude.length - 4 * i - 1] = (byte) w; // depends on control dependency: [for], data = [i]
magnitude[magnitude.length - 4 * i - 2] = (byte) (w >> 8); // depends on control dependency: [for], data = [i]
magnitude[magnitude.length - 4 * i - 3] = (byte) (w >> 16); // depends on control dependency: [for], data = [i]
magnitude[magnitude.length - 4 * i - 4] = (byte) (w >> 24); // depends on control dependency: [for], data = [i]
}
return new BigInteger(magnitude).shiftLeft(offset * 32);
} } |
public class class_name {
public static <V> DenseGrid<V> create(V[][] array) {
if (array == null) {
throw new IllegalArgumentException("Array must not be null");
}
int rowCount = array.length;
if (rowCount == 0) {
return new DenseGrid<V>(0, 0);
}
int columnCount = array[0].length;
for (int i = 1; i < rowCount; i++) {
columnCount = Math.max(columnCount, array[i].length);
}
DenseGrid<V> created = DenseGrid.create(rowCount, columnCount);
for (int row = 0; row < array.length; row++) {
V[] rowValues = array[row];
for (int column = 0; column < rowValues.length; column++) {
V cellValue = rowValues[column];
if (cellValue != null) {
created.values[row * columnCount + column] = cellValue;
created.size++;
}
}
}
return created;
} } | public class class_name {
public static <V> DenseGrid<V> create(V[][] array) {
if (array == null) {
throw new IllegalArgumentException("Array must not be null");
}
int rowCount = array.length;
if (rowCount == 0) {
return new DenseGrid<V>(0, 0); // depends on control dependency: [if], data = [0)]
}
int columnCount = array[0].length;
for (int i = 1; i < rowCount; i++) {
columnCount = Math.max(columnCount, array[i].length); // depends on control dependency: [for], data = [i]
}
DenseGrid<V> created = DenseGrid.create(rowCount, columnCount);
for (int row = 0; row < array.length; row++) {
V[] rowValues = array[row];
for (int column = 0; column < rowValues.length; column++) {
V cellValue = rowValues[column];
if (cellValue != null) {
created.values[row * columnCount + column] = cellValue; // depends on control dependency: [if], data = [none]
created.size++; // depends on control dependency: [if], data = [none]
}
}
}
return created;
} } |
public class class_name {
protected void storeVersion(final String _userName,
final Long _version)
throws InstallationException
{
try {
Context.begin();
if (Context.getDbType().existsView(Context.getConnection(), "V_ADMINTYPE")
&& CIAdminCommon.ApplicationVersion.getType() != null
&& CIAdminCommon.Application.getType() != null
&& CIAdminCommon.Application.getType().getAttributes().size() > 4) {
Context.commit();
Context.begin(_userName);
// store cached versions
for (final Long version : this.notStoredVersions) {
final QueryBuilder appQueryBldr = new QueryBuilder(CIAdminCommon.Application);
appQueryBldr.addWhereAttrEqValue(CIAdminCommon.Application.Name, this.application);
final InstanceQuery appQuery = appQueryBldr.getQuery();
appQuery.execute();
final Instance appInst;
if (appQuery.next()) {
appInst = appQuery.getCurrentValue();
} else {
final Insert insert = new Insert(CIAdminCommon.Application);
insert.add(CIAdminCommon.Application.Name, this.application);
insert.execute();
appInst = insert.getInstance();
}
final Insert insert = new Insert(CIAdminCommon.ApplicationVersion);
insert.add(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
insert.add(CIAdminCommon.ApplicationVersion.Revision, version);
insert.execute();
}
this.notStoredVersions.clear();
final QueryBuilder appQueryBldr = new QueryBuilder(CIAdminCommon.Application);
appQueryBldr.addWhereAttrEqValue(CIAdminCommon.Application.Name, this.application);
final InstanceQuery appQuery = appQueryBldr.getQuery();
appQuery.execute();
final Instance appInst;
if (appQuery.next()) {
appInst = appQuery.getCurrentValue();
} else {
final Insert insert = new Insert(CIAdminCommon.Application);
insert.add(CIAdminCommon.Application.Name, this.application);
insert.execute();
appInst = insert.getInstance();
}
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.ApplicationVersion);
queryBldr.addWhereAttrEqValue(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
queryBldr.addWhereAttrEqValue(CIAdminCommon.ApplicationVersion.Revision, _version);
final InstanceQuery query = queryBldr.getQuery();
query.execute();
if (!query.next()) {
// store current version
final Insert insert = new Insert(CIAdminCommon.ApplicationVersion);
insert.add(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
insert.add(CIAdminCommon.ApplicationVersion.Revision, _version);
insert.execute();
}
} else {
// if version could not be stored, cache the version information
this.notStoredVersions.add(_version);
}
Context.commit();
} catch (final EFapsException e) {
throw new InstallationException("Update of the version information failed", e);
} catch (final SQLException e) {
throw new InstallationException("Update of the version information failed", e);
}
} } | public class class_name {
protected void storeVersion(final String _userName,
final Long _version)
throws InstallationException
{
try {
Context.begin();
if (Context.getDbType().existsView(Context.getConnection(), "V_ADMINTYPE")
&& CIAdminCommon.ApplicationVersion.getType() != null
&& CIAdminCommon.Application.getType() != null
&& CIAdminCommon.Application.getType().getAttributes().size() > 4) {
Context.commit();
Context.begin(_userName);
// store cached versions
for (final Long version : this.notStoredVersions) {
final QueryBuilder appQueryBldr = new QueryBuilder(CIAdminCommon.Application);
appQueryBldr.addWhereAttrEqValue(CIAdminCommon.Application.Name, this.application);
final InstanceQuery appQuery = appQueryBldr.getQuery();
appQuery.execute();
final Instance appInst;
if (appQuery.next()) {
appInst = appQuery.getCurrentValue(); // depends on control dependency: [if], data = [none]
} else {
final Insert insert = new Insert(CIAdminCommon.Application);
insert.add(CIAdminCommon.Application.Name, this.application); // depends on control dependency: [if], data = [none]
insert.execute(); // depends on control dependency: [if], data = [none]
appInst = insert.getInstance(); // depends on control dependency: [if], data = [none]
}
final Insert insert = new Insert(CIAdminCommon.ApplicationVersion);
insert.add(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
insert.add(CIAdminCommon.ApplicationVersion.Revision, version);
insert.execute();
}
this.notStoredVersions.clear();
final QueryBuilder appQueryBldr = new QueryBuilder(CIAdminCommon.Application);
appQueryBldr.addWhereAttrEqValue(CIAdminCommon.Application.Name, this.application);
final InstanceQuery appQuery = appQueryBldr.getQuery();
appQuery.execute();
final Instance appInst;
if (appQuery.next()) {
appInst = appQuery.getCurrentValue();
} else {
final Insert insert = new Insert(CIAdminCommon.Application);
insert.add(CIAdminCommon.Application.Name, this.application);
insert.execute();
appInst = insert.getInstance();
}
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.ApplicationVersion);
queryBldr.addWhereAttrEqValue(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
queryBldr.addWhereAttrEqValue(CIAdminCommon.ApplicationVersion.Revision, _version);
final InstanceQuery query = queryBldr.getQuery();
query.execute();
if (!query.next()) {
// store current version
final Insert insert = new Insert(CIAdminCommon.ApplicationVersion);
insert.add(CIAdminCommon.ApplicationVersion.ApplicationLink, appInst);
insert.add(CIAdminCommon.ApplicationVersion.Revision, _version);
insert.execute();
}
} else {
// if version could not be stored, cache the version information
this.notStoredVersions.add(_version);
}
Context.commit();
} catch (final EFapsException e) {
throw new InstallationException("Update of the version information failed", e);
} catch (final SQLException e) {
throw new InstallationException("Update of the version information failed", e);
}
} } |
public class class_name {
@Deprecated
public static String getContextPath(final WebApplication application)
{
final String contextPath = application.getServletContext().getContextPath();
if ((null != contextPath) && !contextPath.isEmpty())
{
return contextPath;
}
return "";
} } | public class class_name {
@Deprecated
public static String getContextPath(final WebApplication application)
{
final String contextPath = application.getServletContext().getContextPath();
if ((null != contextPath) && !contextPath.isEmpty())
{
return contextPath;
// depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
private void tryDenseMode() {
if (numSpillFiles != 0) {
return;
}
long minKey = Long.MAX_VALUE;
long maxKey = Long.MIN_VALUE;
long recordCount = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
long partitionRecords = p.getBuildSideRecordCount();
recordCount += partitionRecords;
if (partitionRecords > 0) {
if (p.getMinKey() < minKey) {
minKey = p.getMinKey();
}
if (p.getMaxKey() > maxKey) {
maxKey = p.getMaxKey();
}
}
}
if (buildSpillRetBufferNumbers != 0) {
throw new RuntimeException("buildSpillRetBufferNumbers should be 0: " + buildSpillRetBufferNumbers);
}
long range = maxKey - minKey + 1;
if (range <= recordCount * 4 || range <= segmentSize / 8) {
// try to request memory.
int buffers = (int) Math.ceil(((double) (range * 8)) / segmentSize);
// TODO MemoryManager needs to support flexible larger segment, so that the index area of the
// build side is placed on a segment to avoid the overhead of addressing.
MemorySegment[] denseBuckets = new MemorySegment[buffers];
for (int i = 0; i < buffers; i++) {
MemorySegment seg = getNextBuffer();
if (seg == null) {
returnAll(Arrays.asList(denseBuckets));
return;
}
denseBuckets[i] = seg;
for (int j = 0; j < segmentSize; j += 8) {
seg.putLong(j, INVALID_ADDRESS);
}
}
denseMode = true;
LOG.info("LongHybridHashTable: Use dense mode!");
this.minKey = minKey;
this.maxKey = maxKey;
buildSpillReturnBuffers.drainTo(availableMemory);
ArrayList<MemorySegment> dataBuffers = new ArrayList<>();
long addressOffset = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
p.iteratorToDenseBucket(denseBuckets, addressOffset, minKey);
p.updateDenseAddressOffset(addressOffset);
dataBuffers.addAll(Arrays.asList(p.getPartitionBuffers()));
addressOffset += (p.getPartitionBuffers().length << segmentSizeBits);
returnAll(Arrays.asList(p.getBuckets()));
}
this.denseBuckets = denseBuckets;
this.densePartition = new LongHashPartition(this, buildSideSerializer,
dataBuffers.toArray(new MemorySegment[dataBuffers.size()]));
freeCurrent();
}
} } | public class class_name {
private void tryDenseMode() {
if (numSpillFiles != 0) {
return; // depends on control dependency: [if], data = [none]
}
long minKey = Long.MAX_VALUE;
long maxKey = Long.MIN_VALUE;
long recordCount = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
long partitionRecords = p.getBuildSideRecordCount();
recordCount += partitionRecords; // depends on control dependency: [for], data = [p]
if (partitionRecords > 0) {
if (p.getMinKey() < minKey) {
minKey = p.getMinKey(); // depends on control dependency: [if], data = [none]
}
if (p.getMaxKey() > maxKey) {
maxKey = p.getMaxKey(); // depends on control dependency: [if], data = [none]
}
}
}
if (buildSpillRetBufferNumbers != 0) {
throw new RuntimeException("buildSpillRetBufferNumbers should be 0: " + buildSpillRetBufferNumbers);
}
long range = maxKey - minKey + 1;
if (range <= recordCount * 4 || range <= segmentSize / 8) {
// try to request memory.
int buffers = (int) Math.ceil(((double) (range * 8)) / segmentSize);
// TODO MemoryManager needs to support flexible larger segment, so that the index area of the
// build side is placed on a segment to avoid the overhead of addressing.
MemorySegment[] denseBuckets = new MemorySegment[buffers];
for (int i = 0; i < buffers; i++) {
MemorySegment seg = getNextBuffer();
if (seg == null) {
returnAll(Arrays.asList(denseBuckets)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
denseBuckets[i] = seg; // depends on control dependency: [for], data = [i]
for (int j = 0; j < segmentSize; j += 8) {
seg.putLong(j, INVALID_ADDRESS); // depends on control dependency: [for], data = [j]
}
}
denseMode = true; // depends on control dependency: [if], data = [none]
LOG.info("LongHybridHashTable: Use dense mode!"); // depends on control dependency: [if], data = [none]
this.minKey = minKey; // depends on control dependency: [if], data = [none]
this.maxKey = maxKey; // depends on control dependency: [if], data = [none]
buildSpillReturnBuffers.drainTo(availableMemory); // depends on control dependency: [if], data = [none]
ArrayList<MemorySegment> dataBuffers = new ArrayList<>();
long addressOffset = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
p.iteratorToDenseBucket(denseBuckets, addressOffset, minKey); // depends on control dependency: [for], data = [p]
p.updateDenseAddressOffset(addressOffset); // depends on control dependency: [for], data = [p]
dataBuffers.addAll(Arrays.asList(p.getPartitionBuffers())); // depends on control dependency: [for], data = [p]
addressOffset += (p.getPartitionBuffers().length << segmentSizeBits); // depends on control dependency: [for], data = [p]
returnAll(Arrays.asList(p.getBuckets())); // depends on control dependency: [for], data = [p]
}
this.denseBuckets = denseBuckets; // depends on control dependency: [if], data = [none]
this.densePartition = new LongHashPartition(this, buildSideSerializer,
dataBuffers.toArray(new MemorySegment[dataBuffers.size()])); // depends on control dependency: [if], data = [none]
freeCurrent(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void executeRequest(OkHttpClient httpClient, Request request) {
Object fullBody = null;
Throwable error = null;
Response response = null;
try {
try {
Log.v(TAG, "%s: RemoteMultipartDownloaderRequest call execute(), url: %s", this, url);
call = httpClient.newCall(request);
response = call.execute();
Log.v(TAG, "%s: RemoteMultipartDownloaderRequest called execute(), url: %s", this, url);
storeCookie(response);
// error
if (response.code() >= 300) {
Log.w(TAG, "%s: Got error status: %d for %s. Reason: %s",
this, response.code(), url, response.message());
error = new RemoteRequestResponseException(response.code(), response.message());
RequestUtils.closeResponseBody(response);
}
// success
else {
ResponseBody responseBody = response.body();
InputStream stream = responseBody.byteStream();
try {
// decompress if contentEncoding is gzip
if (Utils.isGzip(response))
stream = new GZIPInputStream(stream);
MediaType type = responseBody.contentType();
if (type != null) {
// multipart
if (type.type().equals("multipart") &&
type.subtype().equals("related")) {
MultipartDocumentReader reader = new MultipartDocumentReader(db);
reader.setHeaders(Utils.headersToMap(response.headers()));
byte[] buffer = new byte[BUF_LEN];
int numBytesRead;
while ((numBytesRead = stream.read(buffer)) != -1)
reader.appendData(buffer, 0, numBytesRead);
reader.finish();
fullBody = reader.getDocumentProperties();
}
// JSON (non-multipart)
else
fullBody = Manager.getObjectMapper().readValue(
stream, Object.class);
}
} finally {
try {
stream.close();
} catch (IOException e) {
}
}
}
} catch (Exception e) {
// call.execute(), GZIPInputStream, or ObjectMapper.readValue()
Log.w(TAG, "%s: executeRequest() Exception: %s. url: %s", this, e, url);
error = e;
}
respondWithResult(fullBody, error, response);
} finally {
RequestUtils.closeResponseBody(response);
}
} } | public class class_name {
protected void executeRequest(OkHttpClient httpClient, Request request) {
Object fullBody = null;
Throwable error = null;
Response response = null;
try {
try {
Log.v(TAG, "%s: RemoteMultipartDownloaderRequest call execute(), url: %s", this, url); // depends on control dependency: [try], data = [none]
call = httpClient.newCall(request); // depends on control dependency: [try], data = [none]
response = call.execute(); // depends on control dependency: [try], data = [none]
Log.v(TAG, "%s: RemoteMultipartDownloaderRequest called execute(), url: %s", this, url); // depends on control dependency: [try], data = [none]
storeCookie(response); // depends on control dependency: [try], data = [none]
// error
if (response.code() >= 300) {
Log.w(TAG, "%s: Got error status: %d for %s. Reason: %s",
this, response.code(), url, response.message()); // depends on control dependency: [if], data = [none]
error = new RemoteRequestResponseException(response.code(), response.message()); // depends on control dependency: [if], data = [(response.code()]
RequestUtils.closeResponseBody(response); // depends on control dependency: [if], data = [none]
}
// success
else {
ResponseBody responseBody = response.body();
InputStream stream = responseBody.byteStream();
try {
// decompress if contentEncoding is gzip
if (Utils.isGzip(response))
stream = new GZIPInputStream(stream);
MediaType type = responseBody.contentType();
if (type != null) {
// multipart
if (type.type().equals("multipart") &&
type.subtype().equals("related")) {
MultipartDocumentReader reader = new MultipartDocumentReader(db);
reader.setHeaders(Utils.headersToMap(response.headers())); // depends on control dependency: [if], data = [none]
byte[] buffer = new byte[BUF_LEN];
int numBytesRead;
while ((numBytesRead = stream.read(buffer)) != -1)
reader.appendData(buffer, 0, numBytesRead);
reader.finish(); // depends on control dependency: [if], data = [none]
fullBody = reader.getDocumentProperties(); // depends on control dependency: [if], data = [none]
}
// JSON (non-multipart)
else
fullBody = Manager.getObjectMapper().readValue(
stream, Object.class);
}
} finally {
try {
stream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
}
} catch (Exception e) {
// call.execute(), GZIPInputStream, or ObjectMapper.readValue()
Log.w(TAG, "%s: executeRequest() Exception: %s. url: %s", this, e, url);
error = e;
} // depends on control dependency: [catch], data = [none]
respondWithResult(fullBody, error, response); // depends on control dependency: [try], data = [none]
} finally {
RequestUtils.closeResponseBody(response);
}
} } |
public class class_name {
private int matchAddress(Matcher matcher) {
int addr = 0;
for (int i = 1; i <= 4; ++i) {
int n = (rangeCheck(Integer.parseInt(matcher.group(i)), 0, 255));
addr |= ((n & 0xff) << 8 * (4 - i));
}
return addr;
} } | public class class_name {
private int matchAddress(Matcher matcher) {
int addr = 0;
for (int i = 1; i <= 4; ++i) {
int n = (rangeCheck(Integer.parseInt(matcher.group(i)), 0, 255));
addr |= ((n & 0xff) << 8 * (4 - i)); // depends on control dependency: [for], data = [i]
}
return addr;
} } |
public class class_name {
public void addEdge(DiEdge e) {
if (edges.add(e)) {
int s = e.get1();
int t = e.get2();
addNode(s);
addNode(t);
predecessors.get(t).add(s);
successors.get(s).add(t);
}
} } | public class class_name {
public void addEdge(DiEdge e) {
if (edges.add(e)) {
int s = e.get1();
int t = e.get2();
addNode(s); // depends on control dependency: [if], data = [none]
addNode(t); // depends on control dependency: [if], data = [none]
predecessors.get(t).add(s); // depends on control dependency: [if], data = [none]
successors.get(s).add(t); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setLocale(Locale locale)
{
if(locale != null && report != null && report instanceof LocalizableReport)
{
((LocalizableReport) report).setLocale(locale);
}
} } | public class class_name {
public void setLocale(Locale locale)
{
if(locale != null && report != null && report instanceof LocalizableReport)
{
((LocalizableReport) report).setLocale(locale); // depends on control dependency: [if], data = [(locale]
}
} } |
public class class_name {
public void onInviteEvent(javax.sip.RequestEvent requestEvent,
ActivityContextInterface aci) {
final ServerTransaction serverTransaction = requestEvent
.getServerTransaction();
try {
// send "trying" response
Response response = messageFactory.createResponse(Response.TRYING,
requestEvent.getRequest());
serverTransaction.sendResponse(response);
// get local object
final SbbLocalObject sbbLocalObject = this.sbbContext
.getSbbLocalObject();
// send 180
response = messageFactory.createResponse(Response.RINGING,
requestEvent.getRequest());
serverTransaction.sendResponse(response);
setFinalReplySent(false);
// set timer of 1 secs on the dialog aci to send 200 OK after that
timerFacility.setTimer(aci, null,
System.currentTimeMillis() + 1000L, getTimerOptions());
} catch (Exception e) {
getTracer().severe("failure while processing initial invite", e);
}
} } | public class class_name {
public void onInviteEvent(javax.sip.RequestEvent requestEvent,
ActivityContextInterface aci) {
final ServerTransaction serverTransaction = requestEvent
.getServerTransaction();
try {
// send "trying" response
Response response = messageFactory.createResponse(Response.TRYING,
requestEvent.getRequest());
serverTransaction.sendResponse(response); // depends on control dependency: [try], data = [none]
// get local object
final SbbLocalObject sbbLocalObject = this.sbbContext
.getSbbLocalObject();
// send 180
response = messageFactory.createResponse(Response.RINGING,
requestEvent.getRequest()); // depends on control dependency: [try], data = [none]
serverTransaction.sendResponse(response); // depends on control dependency: [try], data = [none]
setFinalReplySent(false); // depends on control dependency: [try], data = [none]
// set timer of 1 secs on the dialog aci to send 200 OK after that
timerFacility.setTimer(aci, null,
System.currentTimeMillis() + 1000L, getTimerOptions()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
getTracer().severe("failure while processing initial invite", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void postWorkDirectory() {
// Acquire (or calculate) the work directory path
String workDir = getWorkDir();
if (workDir == null || workDir.length() == 0) {
// Retrieve our parent (normally a host) name
String hostName = null;
String engineName = null;
String hostWorkDir = null;
Container parentHost = getParent();
if (parentHost != null) {
hostName = parentHost.getName();
if (parentHost instanceof StandardHost) {
hostWorkDir = ((StandardHost)parentHost).getWorkDir();
}
Container parentEngine = parentHost.getParent();
if (parentEngine != null) {
engineName = parentEngine.getName();
}
}
if ((hostName == null) || (hostName.length() < 1))
hostName = "_";
if ((engineName == null) || (engineName.length() < 1))
engineName = "_";
String temp = getBaseName();
if (temp.startsWith("/"))
temp = temp.substring(1);
temp = temp.replace('/', '_');
temp = temp.replace('\\', '_');
if (temp.length() < 1)
temp = ContextName.ROOT_NAME;
if (hostWorkDir != null ) {
workDir = hostWorkDir + File.separator + temp;
} else {
workDir = "work" + File.separator + engineName +
File.separator + hostName + File.separator + temp;
}
setWorkDir(workDir);
}
// Create this directory if necessary
File dir = new File(workDir);
if (!dir.isAbsolute()) {
String catalinaHomePath = null;
try {
catalinaHomePath = getCatalinaBase().getCanonicalPath();
dir = new File(catalinaHomePath, workDir);
} catch (IOException e) {
logger.warn(sm.getString("standardContext.workCreateException",
workDir, catalinaHomePath, getName()), e);
}
}
if (!dir.mkdirs() && !dir.isDirectory()) {
logger.warn(sm.getString("standardContext.workCreateFail", dir,
getName()));
}
// Set the appropriate servlet context attribute
if (context == null) {
getServletContext();
}
context.setAttribute(ServletContext.TEMPDIR, dir);
// context.setAttributeReadOnly(ServletContext.TEMPDIR);
} } | public class class_name {
private void postWorkDirectory() {
// Acquire (or calculate) the work directory path
String workDir = getWorkDir();
if (workDir == null || workDir.length() == 0) {
// Retrieve our parent (normally a host) name
String hostName = null;
String engineName = null;
String hostWorkDir = null;
Container parentHost = getParent();
if (parentHost != null) {
hostName = parentHost.getName(); // depends on control dependency: [if], data = [none]
if (parentHost instanceof StandardHost) {
hostWorkDir = ((StandardHost)parentHost).getWorkDir(); // depends on control dependency: [if], data = [none]
}
Container parentEngine = parentHost.getParent();
if (parentEngine != null) {
engineName = parentEngine.getName(); // depends on control dependency: [if], data = [none]
}
}
if ((hostName == null) || (hostName.length() < 1))
hostName = "_";
if ((engineName == null) || (engineName.length() < 1))
engineName = "_";
String temp = getBaseName();
if (temp.startsWith("/"))
temp = temp.substring(1);
temp = temp.replace('/', '_'); // depends on control dependency: [if], data = [none]
temp = temp.replace('\\', '_'); // depends on control dependency: [if], data = [none]
if (temp.length() < 1)
temp = ContextName.ROOT_NAME;
if (hostWorkDir != null ) {
workDir = hostWorkDir + File.separator + temp; // depends on control dependency: [if], data = [none]
} else {
workDir = "work" + File.separator + engineName +
File.separator + hostName + File.separator + temp; // depends on control dependency: [if], data = [none]
}
setWorkDir(workDir); // depends on control dependency: [if], data = [(workDir]
}
// Create this directory if necessary
File dir = new File(workDir);
if (!dir.isAbsolute()) {
String catalinaHomePath = null;
try {
catalinaHomePath = getCatalinaBase().getCanonicalPath(); // depends on control dependency: [try], data = [none]
dir = new File(catalinaHomePath, workDir); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.warn(sm.getString("standardContext.workCreateException",
workDir, catalinaHomePath, getName()), e);
} // depends on control dependency: [catch], data = [none]
}
if (!dir.mkdirs() && !dir.isDirectory()) {
logger.warn(sm.getString("standardContext.workCreateFail", dir,
getName())); // depends on control dependency: [if], data = [none]
}
// Set the appropriate servlet context attribute
if (context == null) {
getServletContext(); // depends on control dependency: [if], data = [none]
}
context.setAttribute(ServletContext.TEMPDIR, dir);
// context.setAttributeReadOnly(ServletContext.TEMPDIR);
} } |
public class class_name {
public void showAlertAddDialog(HistoryReference ref) {
if (dialogAlertAdd == null || !dialogAlertAdd.isVisible()) {
dialogAlertAdd = new AlertAddDialog(getView().getMainFrame(), false);
dialogAlertAdd.setVisible(true);
dialogAlertAdd.setHistoryRef(ref);
}
} } | public class class_name {
public void showAlertAddDialog(HistoryReference ref) {
if (dialogAlertAdd == null || !dialogAlertAdd.isVisible()) {
dialogAlertAdd = new AlertAddDialog(getView().getMainFrame(), false);
// depends on control dependency: [if], data = [none]
dialogAlertAdd.setVisible(true);
// depends on control dependency: [if], data = [none]
dialogAlertAdd.setHistoryRef(ref);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean tryCreatePackageRelationshipAt(int screenX, int screenY,
ERelationshipKind relationshipKind, String kind) {
ShapeFullVarious<?> shapeVarFull = getShapeFullAt(screenX, screenY);
if(shapeVarFull != null) {
double realX = UtilsGraphMath.toRealX(getHolderApp().getSettingsGraphicUml(), screenX);
double realY = UtilsGraphMath.toRealY(getHolderApp().getSettingsGraphicUml(), screenY);
IAsmElementUmlInteractive<RelationshipBinaryVarious, DRI, SD, PRI> relBinVar =
factoryAsmRelationshipBinVar.createAsmElementUml();
relBinVar.getElementUml().setKind(relationshipKind);
relBinVar.getElementUml().getShapeRelationshipStart().setShapeFull(shapeVarFull);
shapeVarFull.getRelationshipsVariousStart().add(relBinVar.getElementUml().getShapeRelationshipStart());
relBinVar.getElementUml().getShapeRelationshipStart().setEndType(ERelationshipEndType.END);
relBinVar.getElementUml().getShapeRelationshipStart().getPointJoint().setX(realX);
relBinVar.getElementUml().getShapeRelationshipStart().getPointJoint().setY(realY);
relBinVar.getElementUml().getShapeRelationshipEnd().getPointJoint().setX(shapeVarFull.getShape().getPointStart().getX() +
shapeVarFull.getShape().getWidth() +
getHolderApp().getSettingsGraphicUml().fromInchToCurrentMeasure(1));
relBinVar.getElementUml().getShapeRelationshipEnd().getPointJoint().setY(realY);
makeElementSelected(relBinVar);
tryToAddIntoContainer(relBinVar, screenX, screenY);
asmListAsmRelationshipsBinVar.addElementUml(relBinVar);
IAsmElementUmlInteractive<TextUml, DRI, SD, PRI> asmText = getFactoryAsmText().createAsmElementUml();
asmText.getElementUml().setItsText(kind);
asmText.getElementUml().getPointStart().setX(shapeVarFull.getShape().getPointStart().getX() +
shapeVarFull.getShape().getWidth() +
getHolderApp().getSettingsGraphicUml().fromInchToCurrentMeasure(1));
asmText.getElementUml().getPointStart().setY(realY);
tryToAddIntoContainer(asmText, screenX, screenY);
getAsmListAsmTexts().addElementUml(asmText);
setIsChanged(true);
refreshGui();
return true;
}
return false;
} } | public class class_name {
public boolean tryCreatePackageRelationshipAt(int screenX, int screenY,
ERelationshipKind relationshipKind, String kind) {
ShapeFullVarious<?> shapeVarFull = getShapeFullAt(screenX, screenY);
if(shapeVarFull != null) {
double realX = UtilsGraphMath.toRealX(getHolderApp().getSettingsGraphicUml(), screenX);
double realY = UtilsGraphMath.toRealY(getHolderApp().getSettingsGraphicUml(), screenY);
IAsmElementUmlInteractive<RelationshipBinaryVarious, DRI, SD, PRI> relBinVar =
factoryAsmRelationshipBinVar.createAsmElementUml();
relBinVar.getElementUml().setKind(relationshipKind); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipStart().setShapeFull(shapeVarFull); // depends on control dependency: [if], data = [(shapeVarFull]
shapeVarFull.getRelationshipsVariousStart().add(relBinVar.getElementUml().getShapeRelationshipStart()); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipStart().setEndType(ERelationshipEndType.END); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipStart().getPointJoint().setX(realX); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipStart().getPointJoint().setY(realY); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipEnd().getPointJoint().setX(shapeVarFull.getShape().getPointStart().getX() +
shapeVarFull.getShape().getWidth() +
getHolderApp().getSettingsGraphicUml().fromInchToCurrentMeasure(1)); // depends on control dependency: [if], data = [none]
relBinVar.getElementUml().getShapeRelationshipEnd().getPointJoint().setY(realY); // depends on control dependency: [if], data = [none]
makeElementSelected(relBinVar); // depends on control dependency: [if], data = [none]
tryToAddIntoContainer(relBinVar, screenX, screenY); // depends on control dependency: [if], data = [none]
asmListAsmRelationshipsBinVar.addElementUml(relBinVar); // depends on control dependency: [if], data = [none]
IAsmElementUmlInteractive<TextUml, DRI, SD, PRI> asmText = getFactoryAsmText().createAsmElementUml();
asmText.getElementUml().setItsText(kind); // depends on control dependency: [if], data = [none]
asmText.getElementUml().getPointStart().setX(shapeVarFull.getShape().getPointStart().getX() +
shapeVarFull.getShape().getWidth() +
getHolderApp().getSettingsGraphicUml().fromInchToCurrentMeasure(1)); // depends on control dependency: [if], data = [(shapeVarFull]
asmText.getElementUml().getPointStart().setY(realY); // depends on control dependency: [if], data = [none]
tryToAddIntoContainer(asmText, screenX, screenY); // depends on control dependency: [if], data = [none]
getAsmListAsmTexts().addElementUml(asmText); // depends on control dependency: [if], data = [none]
setIsChanged(true); // depends on control dependency: [if], data = [none]
refreshGui(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static String resolveClientIds(FacesContext context, UIComponent source, String expressions, int hints) {
if (LangUtils.isValueBlank(expressions)) {
if (SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.PARENT_FALLBACK)) {
return source.getParent().getClientId(context);
}
return null;
}
String[] splittedExpressions = splitExpressions(context, source, expressions);
if (splittedExpressions != null && splittedExpressions.length > 0) {
final char separatorChar = UINamingContainer.getSeparatorChar(context);
StringBuilder expressionsBuffer = SharedStringBuilder.get(context, SHARED_EXPRESSION_BUFFER_KEY);
for (int i = 0; i < splittedExpressions.length; i++) {
String expression = splittedExpressions[i].trim();
if (LangUtils.isValueBlank(expression)) {
continue;
}
validateExpression(context, source, expression, separatorChar);
if (isPassTroughExpression(expression)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(expression);
}
else {
// if it contains a keyword and it's not a nested expression (e.g. @parent:@parent), we don't need to loop
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX) && expression.indexOf(separatorChar) != -1) {
String clientIds = resolveClientIdsByExpressionChain(context, source, expression, separatorChar, hints);
if (!LangUtils.isValueBlank(clientIds)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(clientIds);
}
}
else {
// it's a keyword and not nested, just ask our resolvers
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX)) {
SearchExpressionResolver resolver = SearchExpressionResolverFactory.findResolver(expression);
if (resolver instanceof ClientIdSearchExpressionResolver) {
String clientIds = ((ClientIdSearchExpressionResolver) resolver).resolveClientIds(context, source, source, expression, hints);
if (!LangUtils.isValueBlank(clientIds)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(clientIds);
}
}
else if (resolver instanceof MultiSearchExpressionResolver) {
ArrayList<UIComponent> result = new ArrayList<>();
((MultiSearchExpressionResolver) resolver).resolveComponents(context, source, source, expression, result, hints);
for (int j = 0; j < result.size(); j++) {
UIComponent component = result.get(j);
validateRenderer(context, source, component, expression, hints);
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(component.getClientId());
}
}
else {
UIComponent component = resolver.resolveComponent(context, source, source, expression, hints);
if (component == null) {
if (!SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression);
}
}
else {
validateRenderer(context, source, component, expression, hints);
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(component.getClientId(context));
}
}
}
// default ID case
else {
ResolveClientIdCallback callback = new ResolveClientIdCallback(source, hints, expression);
resolveComponentById(source, expression, separatorChar, context, callback);
if (callback.getClientId() == null && !SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression);
}
if (callback.getClientId() != null) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" ");
}
expressionsBuffer.append(callback.getClientId());
}
}
}
}
}
String clientIds = expressionsBuffer.toString();
if (!LangUtils.isValueBlank(clientIds)) {
return clientIds;
}
}
return null;
} } | public class class_name {
public static String resolveClientIds(FacesContext context, UIComponent source, String expressions, int hints) {
if (LangUtils.isValueBlank(expressions)) {
if (SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.PARENT_FALLBACK)) {
return source.getParent().getClientId(context); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
String[] splittedExpressions = splitExpressions(context, source, expressions);
if (splittedExpressions != null && splittedExpressions.length > 0) {
final char separatorChar = UINamingContainer.getSeparatorChar(context);
StringBuilder expressionsBuffer = SharedStringBuilder.get(context, SHARED_EXPRESSION_BUFFER_KEY);
for (int i = 0; i < splittedExpressions.length; i++) {
String expression = splittedExpressions[i].trim();
if (LangUtils.isValueBlank(expression)) {
continue;
}
validateExpression(context, source, expression, separatorChar); // depends on control dependency: [for], data = [none]
if (isPassTroughExpression(expression)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(expression); // depends on control dependency: [if], data = [none]
}
else {
// if it contains a keyword and it's not a nested expression (e.g. @parent:@parent), we don't need to loop
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX) && expression.indexOf(separatorChar) != -1) {
String clientIds = resolveClientIdsByExpressionChain(context, source, expression, separatorChar, hints);
if (!LangUtils.isValueBlank(clientIds)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(clientIds); // depends on control dependency: [if], data = [none]
}
}
else {
// it's a keyword and not nested, just ask our resolvers
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX)) {
SearchExpressionResolver resolver = SearchExpressionResolverFactory.findResolver(expression);
if (resolver instanceof ClientIdSearchExpressionResolver) {
String clientIds = ((ClientIdSearchExpressionResolver) resolver).resolveClientIds(context, source, source, expression, hints);
if (!LangUtils.isValueBlank(clientIds)) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(clientIds); // depends on control dependency: [if], data = [none]
}
}
else if (resolver instanceof MultiSearchExpressionResolver) {
ArrayList<UIComponent> result = new ArrayList<>();
((MultiSearchExpressionResolver) resolver).resolveComponents(context, source, source, expression, result, hints); // depends on control dependency: [if], data = [none]
for (int j = 0; j < result.size(); j++) {
UIComponent component = result.get(j);
validateRenderer(context, source, component, expression, hints); // depends on control dependency: [for], data = [none]
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(component.getClientId()); // depends on control dependency: [for], data = [none]
}
}
else {
UIComponent component = resolver.resolveComponent(context, source, source, expression, hints);
if (component == null) {
if (!SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression); // depends on control dependency: [if], data = [none]
}
}
else {
validateRenderer(context, source, component, expression, hints); // depends on control dependency: [if], data = [none]
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(component.getClientId(context)); // depends on control dependency: [if], data = [(component]
}
}
}
// default ID case
else {
ResolveClientIdCallback callback = new ResolveClientIdCallback(source, hints, expression);
resolveComponentById(source, expression, separatorChar, context, callback); // depends on control dependency: [if], data = [none]
if (callback.getClientId() == null && !SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression); // depends on control dependency: [if], data = [none]
}
if (callback.getClientId() != null) {
if (expressionsBuffer.length() > 0) {
expressionsBuffer.append(" "); // depends on control dependency: [if], data = [none]
}
expressionsBuffer.append(callback.getClientId()); // depends on control dependency: [if], data = [(callback.getClientId()]
}
}
}
}
}
String clientIds = expressionsBuffer.toString();
if (!LangUtils.isValueBlank(clientIds)) {
return clientIds; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
protected final int serializeBytes8to11() {
try {
return (int) (initiatorSessionID.serialize() >>> Constants.FOUR_BYTES_SHIFT);
} catch (InternetSCSIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
} } | public class class_name {
@Override
protected final int serializeBytes8to11() {
try {
return (int) (initiatorSessionID.serialize() >>> Constants.FOUR_BYTES_SHIFT); // depends on control dependency: [try], data = [none]
} catch (InternetSCSIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return 0;
} } |
public class class_name {
void triggerControlTask() {
migrationQueue.clear();
if (!node.getClusterService().isJoined()) {
logger.fine("Node is not joined, will not trigger ControlTask");
return;
}
if (!node.isMaster()) {
logger.fine("Node is not master, will not trigger ControlTask");
return;
}
migrationQueue.add(new ControlTask());
if (logger.isFinestEnabled()) {
logger.finest("Migration queue is cleared and control task is scheduled");
}
} } | public class class_name {
void triggerControlTask() {
migrationQueue.clear();
if (!node.getClusterService().isJoined()) {
logger.fine("Node is not joined, will not trigger ControlTask"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (!node.isMaster()) {
logger.fine("Node is not master, will not trigger ControlTask"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
migrationQueue.add(new ControlTask());
if (logger.isFinestEnabled()) {
logger.finest("Migration queue is cleared and control task is scheduled"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>> addWithServiceResponseAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (task == null) {
throw new IllegalArgumentException("Parameter task is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(task);
Validator.validate(taskAddOptions);
Integer timeout = null;
if (taskAddOptions != null) {
timeout = taskAddOptions.timeout();
}
UUID clientRequestId = null;
if (taskAddOptions != null) {
clientRequestId = taskAddOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (taskAddOptions != null) {
returnClientRequestId = taskAddOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (taskAddOptions != null) {
ocpDate = taskAddOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, TaskAddHeaders> clientResponse = addDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>> addWithServiceResponseAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (task == null) {
throw new IllegalArgumentException("Parameter task is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(task);
Validator.validate(taskAddOptions);
Integer timeout = null;
if (taskAddOptions != null) {
timeout = taskAddOptions.timeout(); // depends on control dependency: [if], data = [none]
}
UUID clientRequestId = null;
if (taskAddOptions != null) {
clientRequestId = taskAddOptions.clientRequestId(); // depends on control dependency: [if], data = [none]
}
Boolean returnClientRequestId = null;
if (taskAddOptions != null) {
returnClientRequestId = taskAddOptions.returnClientRequestId(); // depends on control dependency: [if], data = [none]
}
DateTime ocpDate = null;
if (taskAddOptions != null) {
ocpDate = taskAddOptions.ocpDate(); // depends on control dependency: [if], data = [none]
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, TaskAddHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, TaskAddHeaders> clientResponse = addDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public static Slice wrappedBuffer(ByteBuffer buffer)
{
if (buffer.isDirect()) {
long address = bufferAddress(buffer);
return new Slice(null, address + buffer.position(), buffer.remaining(), buffer.capacity(), buffer);
}
if (buffer.hasArray()) {
return new Slice(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
}
throw new IllegalArgumentException("cannot wrap " + buffer.getClass().getName());
} } | public class class_name {
public static Slice wrappedBuffer(ByteBuffer buffer)
{
if (buffer.isDirect()) {
long address = bufferAddress(buffer);
return new Slice(null, address + buffer.position(), buffer.remaining(), buffer.capacity(), buffer); // depends on control dependency: [if], data = [none]
}
if (buffer.hasArray()) {
return new Slice(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("cannot wrap " + buffer.getClass().getName());
} } |
public class class_name {
public EmbedBuilder setTitle(String title, String url)
{
if (title == null)
{
this.title = null;
this.url = null;
}
else
{
Checks.notEmpty(title, "Title");
Checks.check(title.length() <= MessageEmbed.TITLE_MAX_LENGTH, "Title cannot be longer than %d characters.", MessageEmbed.TITLE_MAX_LENGTH);
if (Helpers.isBlank(url))
url = null;
urlCheck(url);
this.title = title;
this.url = url;
}
return this;
} } | public class class_name {
public EmbedBuilder setTitle(String title, String url)
{
if (title == null)
{
this.title = null; // depends on control dependency: [if], data = [none]
this.url = null; // depends on control dependency: [if], data = [none]
}
else
{
Checks.notEmpty(title, "Title"); // depends on control dependency: [if], data = [(title]
Checks.check(title.length() <= MessageEmbed.TITLE_MAX_LENGTH, "Title cannot be longer than %d characters.", MessageEmbed.TITLE_MAX_LENGTH); // depends on control dependency: [if], data = [(title]
if (Helpers.isBlank(url))
url = null;
urlCheck(url); // depends on control dependency: [if], data = [none]
this.title = title; // depends on control dependency: [if], data = [none]
this.url = url; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public static nstrafficdomain_binding[] get(nitro_service service, Long td[]) throws Exception{
if (td !=null && td.length>0) {
nstrafficdomain_binding response[] = new nstrafficdomain_binding[td.length];
nstrafficdomain_binding obj[] = new nstrafficdomain_binding[td.length];
for (int i=0;i<td.length;i++) {
obj[i] = new nstrafficdomain_binding();
obj[i].set_td(td[i]);
response[i] = (nstrafficdomain_binding) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static nstrafficdomain_binding[] get(nitro_service service, Long td[]) throws Exception{
if (td !=null && td.length>0) {
nstrafficdomain_binding response[] = new nstrafficdomain_binding[td.length];
nstrafficdomain_binding obj[] = new nstrafficdomain_binding[td.length];
for (int i=0;i<td.length;i++) {
obj[i] = new nstrafficdomain_binding(); // depends on control dependency: [for], data = [i]
obj[i].set_td(td[i]); // depends on control dependency: [for], data = [i]
response[i] = (nstrafficdomain_binding) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
private void parseDefault(String elementName, String name, String type,
String enumer) throws Exception {
int valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
String value = null;
int flags = LIT_ATTRIBUTE;
boolean saved = expandPE;
String defaultType = null;
// LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
// chars to spaces (doesn't matter when that's done if it doesn't
// interfere with char refs expanding to whitespace).
if (!skippedPE) {
flags |= LIT_ENTITY_REF;
if (handler.stringInterning) {
if ("CDATA" != type) {
flags |= LIT_NORMALIZE;
}
} else {
if (!"CDATA".equals(type)) {
flags |= LIT_NORMALIZE;
}
}
}
expandPE = false;
if (tryRead('#')) {
if (tryRead("FIXED")) {
defaultType = "#FIXED";
valueType = ATTRIBUTE_DEFAULT_FIXED;
requireWhitespace();
value = readLiteral(flags);
} else if (tryRead("REQUIRED")) {
defaultType = "#REQUIRED";
valueType = ATTRIBUTE_DEFAULT_REQUIRED;
} else if (tryRead("IMPLIED")) {
defaultType = "#IMPLIED";
valueType = ATTRIBUTE_DEFAULT_IMPLIED;
} else {
fatal("illegal keyword for attribute default value");
}
} else {
value = readLiteral(flags);
}
expandPE = saved;
setAttribute(elementName, name, type, enumer, value, valueType);
if (handler.stringInterning) {
if ("ENUMERATION" == type) {
type = enumer;
} else if ("NOTATION" == type) {
type = "NOTATION " + enumer;
}
} else {
if ("ENUMERATION".equals(type)) {
type = enumer;
} else if ("NOTATION".equals(type)) {
type = "NOTATION " + enumer;
}
}
if (!skippedPE) {
handler.getDeclHandler().attributeDecl(elementName, name, type,
defaultType, value);
}
} } | public class class_name {
private void parseDefault(String elementName, String name, String type,
String enumer) throws Exception {
int valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
String value = null;
int flags = LIT_ATTRIBUTE;
boolean saved = expandPE;
String defaultType = null;
// LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
// chars to spaces (doesn't matter when that's done if it doesn't
// interfere with char refs expanding to whitespace).
if (!skippedPE) {
flags |= LIT_ENTITY_REF;
if (handler.stringInterning) {
if ("CDATA" != type) {
flags |= LIT_NORMALIZE; // depends on control dependency: [if], data = [none]
}
} else {
if (!"CDATA".equals(type)) {
flags |= LIT_NORMALIZE; // depends on control dependency: [if], data = [none]
}
}
}
expandPE = false;
if (tryRead('#')) {
if (tryRead("FIXED")) {
defaultType = "#FIXED"; // depends on control dependency: [if], data = [none]
valueType = ATTRIBUTE_DEFAULT_FIXED; // depends on control dependency: [if], data = [none]
requireWhitespace(); // depends on control dependency: [if], data = [none]
value = readLiteral(flags); // depends on control dependency: [if], data = [none]
} else if (tryRead("REQUIRED")) {
defaultType = "#REQUIRED"; // depends on control dependency: [if], data = [none]
valueType = ATTRIBUTE_DEFAULT_REQUIRED; // depends on control dependency: [if], data = [none]
} else if (tryRead("IMPLIED")) {
defaultType = "#IMPLIED"; // depends on control dependency: [if], data = [none]
valueType = ATTRIBUTE_DEFAULT_IMPLIED; // depends on control dependency: [if], data = [none]
} else {
fatal("illegal keyword for attribute default value"); // depends on control dependency: [if], data = [none]
}
} else {
value = readLiteral(flags);
}
expandPE = saved;
setAttribute(elementName, name, type, enumer, value, valueType);
if (handler.stringInterning) {
if ("ENUMERATION" == type) {
type = enumer; // depends on control dependency: [if], data = [none]
} else if ("NOTATION" == type) {
type = "NOTATION " + enumer; // depends on control dependency: [if], data = [none]
}
} else {
if ("ENUMERATION".equals(type)) {
type = enumer; // depends on control dependency: [if], data = [none]
} else if ("NOTATION".equals(type)) {
type = "NOTATION " + enumer; // depends on control dependency: [if], data = [none]
}
}
if (!skippedPE) {
handler.getDeclHandler().attributeDecl(elementName, name, type,
defaultType, value);
}
} } |
public class class_name {
private void evictEntry(Node node) {
data.remove(node.key);
node.remove();
if (node.freq.isEmpty()) {
node.freq.remove();
}
} } | public class class_name {
private void evictEntry(Node node) {
data.remove(node.key);
node.remove();
if (node.freq.isEmpty()) {
node.freq.remove(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void updateButtonVisibility(CmsContainerPageElementPanel elementWidget) {
Iterator<Widget> it = elementWidget.getElementOptionBar().iterator();
while (it.hasNext()) {
Widget w = it.next();
if (w instanceof I_CmsGroupEditorOption) {
if (((I_CmsGroupEditorOption)w).checkVisibility()) {
w.getElement().getStyle().clearDisplay();
} else {
w.getElement().getStyle().setDisplay(Display.NONE);
}
}
}
} } | public class class_name {
private void updateButtonVisibility(CmsContainerPageElementPanel elementWidget) {
Iterator<Widget> it = elementWidget.getElementOptionBar().iterator();
while (it.hasNext()) {
Widget w = it.next();
if (w instanceof I_CmsGroupEditorOption) {
if (((I_CmsGroupEditorOption)w).checkVisibility()) {
w.getElement().getStyle().clearDisplay();
// depends on control dependency: [if], data = [none]
} else {
w.getElement().getStyle().setDisplay(Display.NONE);
// depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public Registration readClass (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
try {
return classResolver.readClass(input);
} finally {
if (depth == 0 && autoReset) reset();
}
} } | public class class_name {
public Registration readClass (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
try {
return classResolver.readClass(input);
// depends on control dependency: [try], data = [none]
} finally {
if (depth == 0 && autoReset) reset();
}
} } |
public class class_name {
public static <P_IN, P_OUT> Node<P_OUT> collect(PipelineHelper<P_OUT> helper,
Spliterator<P_IN> spliterator,
boolean flattenTree,
IntFunction<P_OUT[]> generator) {
long size = helper.exactOutputSizeIfKnown(spliterator);
if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
if (size >= MAX_ARRAY_SIZE)
throw new IllegalArgumentException(BAD_SIZE);
P_OUT[] array = generator.apply((int) size);
new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke();
return node(array);
} else {
Node<P_OUT> node = new CollectorTask.OfRef<>(helper, generator, spliterator).invoke();
return flattenTree ? flatten(node, generator) : node;
}
} } | public class class_name {
public static <P_IN, P_OUT> Node<P_OUT> collect(PipelineHelper<P_OUT> helper,
Spliterator<P_IN> spliterator,
boolean flattenTree,
IntFunction<P_OUT[]> generator) {
long size = helper.exactOutputSizeIfKnown(spliterator);
if (size >= 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) {
if (size >= MAX_ARRAY_SIZE)
throw new IllegalArgumentException(BAD_SIZE);
P_OUT[] array = generator.apply((int) size);
new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke(); // depends on control dependency: [if], data = [none]
return node(array); // depends on control dependency: [if], data = [none]
} else {
Node<P_OUT> node = new CollectorTask.OfRef<>(helper, generator, spliterator).invoke();
return flattenTree ? flatten(node, generator) : node; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void removeByCompanyId(long companyId) {
for (CommerceAccount commerceAccount : findByCompanyId(companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAccount);
}
} } | public class class_name {
@Override
public void removeByCompanyId(long companyId) {
for (CommerceAccount commerceAccount : findByCompanyId(companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceAccount); // depends on control dependency: [for], data = [commerceAccount]
}
} } |
public class class_name {
@Override
public boolean addTransaction(SIPTransaction transaction) {
if(transaction instanceof ServerTransaction) {
isLatestTxServer = true;
} else {
isLatestTxServer = false;
}
return super.addTransaction(transaction);
} } | public class class_name {
@Override
public boolean addTransaction(SIPTransaction transaction) {
if(transaction instanceof ServerTransaction) {
isLatestTxServer = true; // depends on control dependency: [if], data = [none]
} else {
isLatestTxServer = false; // depends on control dependency: [if], data = [none]
}
return super.addTransaction(transaction);
} } |
public class class_name {
@Override
public void generate(final Module module, final Element parent) {
final AppModule m = (AppModule) module;
if (m.getDraft() != null) {
final String draft = m.getDraft().booleanValue() ? "yes" : "no";
final Element control = new Element("control", APP_NS);
control.addContent(generateSimpleElement("draft", draft));
parent.addContent(control);
}
if (m.getEdited() != null) {
final Element edited = new Element("edited", APP_NS);
// Inclulde millis in date/time
final SimpleDateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
dateFormater.setTimeZone(TimeZone.getTimeZone("GMT"));
edited.addContent(dateFormater.format(m.getEdited()));
parent.addContent(edited);
}
} } | public class class_name {
@Override
public void generate(final Module module, final Element parent) {
final AppModule m = (AppModule) module;
if (m.getDraft() != null) {
final String draft = m.getDraft().booleanValue() ? "yes" : "no";
final Element control = new Element("control", APP_NS);
control.addContent(generateSimpleElement("draft", draft)); // depends on control dependency: [if], data = [none]
parent.addContent(control); // depends on control dependency: [if], data = [none]
}
if (m.getEdited() != null) {
final Element edited = new Element("edited", APP_NS);
// Inclulde millis in date/time
final SimpleDateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
dateFormater.setTimeZone(TimeZone.getTimeZone("GMT")); // depends on control dependency: [if], data = [none]
edited.addContent(dateFormater.format(m.getEdited())); // depends on control dependency: [if], data = [(m.getEdited()]
parent.addContent(edited); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList();
} else {
try {
return client.getChildren().forPath(path);
} catch (KeeperException.NoNodeException ignored) {
// Concurrent deletion, retry
}
}
}
} } | public class class_name {
public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
} else {
try {
return client.getChildren().forPath(path); // depends on control dependency: [try], data = [none]
} catch (KeeperException.NoNodeException ignored) {
// Concurrent deletion, retry
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public CmsTreeItem removeChild(final CmsTreeItem item) {
item.setParentItem(null);
item.setTree(null);
if ((m_tree != null) && m_tree.isAnimationEnabled()) {
// could be null if already detached
// animate
(new Animation() {
/**
* @see com.google.gwt.animation.client.Animation#onComplete()
*/
@Override
protected void onComplete() {
super.onComplete();
m_children.removeItem(item);
onChangeChildren();
}
/**
* @see com.google.gwt.animation.client.Animation#onUpdate(double)
*/
@Override
protected void onUpdate(double progress) {
item.getElement().getStyle().setOpacity(1 - progress);
}
}).run(ANIMATION_DURATION);
} else {
m_children.removeItem(item);
onChangeChildren();
}
return item;
} } | public class class_name {
public CmsTreeItem removeChild(final CmsTreeItem item) {
item.setParentItem(null);
item.setTree(null);
if ((m_tree != null) && m_tree.isAnimationEnabled()) {
// could be null if already detached
// animate
(new Animation() {
/**
* @see com.google.gwt.animation.client.Animation#onComplete()
*/
@Override
protected void onComplete() {
super.onComplete();
m_children.removeItem(item);
onChangeChildren();
}
/**
* @see com.google.gwt.animation.client.Animation#onUpdate(double)
*/
@Override
protected void onUpdate(double progress) {
item.getElement().getStyle().setOpacity(1 - progress);
}
}).run(ANIMATION_DURATION); // depends on control dependency: [if], data = [none]
} else {
m_children.removeItem(item); // depends on control dependency: [if], data = [none]
onChangeChildren(); // depends on control dependency: [if], data = [none]
}
return item;
} } |
public class class_name {
protected void initialize(AccessControlSchema config) {
LOG.debug("Initializing.");
List<AccessControlGroup> groups = config.getGroups();
if (groups.size() == 0) {
throw new IllegalStateException("AccessControlSchema is empty - please configure at least one group!");
}
Set<AccessControlGroup> toplevelGroups = new HashSet<>(groups);
for (AccessControlGroup group : groups) {
collectAccessControls(group, toplevelGroups);
List<AccessControlGroup> groupList = new ArrayList<>();
groupList.add(group);
checkForCyclicDependencies(group, groupList);
}
} } | public class class_name {
protected void initialize(AccessControlSchema config) {
LOG.debug("Initializing.");
List<AccessControlGroup> groups = config.getGroups();
if (groups.size() == 0) {
throw new IllegalStateException("AccessControlSchema is empty - please configure at least one group!");
}
Set<AccessControlGroup> toplevelGroups = new HashSet<>(groups);
for (AccessControlGroup group : groups) {
collectAccessControls(group, toplevelGroups); // depends on control dependency: [for], data = [group]
List<AccessControlGroup> groupList = new ArrayList<>();
groupList.add(group); // depends on control dependency: [for], data = [group]
checkForCyclicDependencies(group, groupList); // depends on control dependency: [for], data = [group]
}
} } |
public class class_name {
public static <V> V wrapCheckedException(StatementWithReturnValue<V> statement) {
try {
return statement.evaluate();
} catch (RuntimeException e) {
throw e;
} catch (Error e) {
throw e;
} catch (Throwable e) {
throw new WrappedException(e);
}
} } | public class class_name {
public static <V> V wrapCheckedException(StatementWithReturnValue<V> statement) {
try {
return statement.evaluate(); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw e;
} catch (Error e) { // depends on control dependency: [catch], data = [none]
throw e;
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
throw new WrappedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static PublicKey stringToRSAPublicKey (String str)
{
try {
BigInteger mod = new BigInteger(str.substring(0, str.indexOf(SPLIT)), 16);
BigInteger exp = new BigInteger(str.substring(str.indexOf(SPLIT) + 1), 16);
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(mod, exp);
KeyFactory kf = KeyFactory.getInstance("RSA");
return kf.generatePublic(keySpec);
} catch (NumberFormatException nfe) {
log.warning("Failed to read key from string.", "str", str, nfe);
} catch (GeneralSecurityException gse) {
log.warning("Failed to read key from string.", "str", str, gse);
}
return null;
} } | public class class_name {
public static PublicKey stringToRSAPublicKey (String str)
{
try {
BigInteger mod = new BigInteger(str.substring(0, str.indexOf(SPLIT)), 16);
BigInteger exp = new BigInteger(str.substring(str.indexOf(SPLIT) + 1), 16);
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(mod, exp);
KeyFactory kf = KeyFactory.getInstance("RSA");
return kf.generatePublic(keySpec); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
log.warning("Failed to read key from string.", "str", str, nfe);
} catch (GeneralSecurityException gse) { // depends on control dependency: [catch], data = [none]
log.warning("Failed to read key from string.", "str", str, gse);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if ((!m.isStatic() || !Values.STATIC_INITIALIZER.equals(m.getName())) && (!m.getName().contains("enum constant"))) { // a findbugs thing!!
byte[] code = obj.getCode();
if (code.length >= UNJITABLE_CODE_LENGTH) {
bugReporter.reportBug(new BugInstance(this, BugType.UJM_UNJITABLE_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addString("Code Bytes: " + code.length));
}
}
} } | public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if ((!m.isStatic() || !Values.STATIC_INITIALIZER.equals(m.getName())) && (!m.getName().contains("enum constant"))) { // a findbugs thing!!
byte[] code = obj.getCode();
if (code.length >= UNJITABLE_CODE_LENGTH) {
bugReporter.reportBug(new BugInstance(this, BugType.UJM_UNJITABLE_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addString("Code Bytes: " + code.length)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void setInterpolator(/*Time*/Interpolator value) {
if (value != null) {
mInterpolator = value;
} else {
mInterpolator = new LinearInterpolator();
}
} } | public class class_name {
@Override
public void setInterpolator(/*Time*/Interpolator value) {
if (value != null) {
mInterpolator = value; // depends on control dependency: [if], data = [none]
} else {
mInterpolator = new LinearInterpolator(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void removeDiscriminator(Discriminator d) throws DiscriminationProcessException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeDiscriminator: " + d);
}
if (status == STARTED) {
DiscriminationProcessException e = new DiscriminationProcessException("Should not remove form DiscriminationGroup while started!");
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "401", this, new Object[] { d });
throw e;
}
// remove it from the list
if (!discAL.remove(d)) {
NoSuchElementException e = new NoSuchElementException("Discriminator does not exist, " + d.getChannel().getName());
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "410", this, new Object[] { d });
throw e;
}
this.changed = true;
String chanName = d.getChannel().getName();
if (channelList == null) {
NoSuchElementException e = new NoSuchElementException("No Channel's exist, " + chanName);
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "422", this, new Object[] { d });
throw e;
}
Channel[] oldList = channelList;
channelList = new Channel[oldList.length - 1];
for (int i = 0, j = 0; i < oldList.length; i++) {
String tempName = oldList[i].getName();
if (tempName != null && !(tempName.equals(chanName))) {
if (j >= oldList.length) {
NoSuchElementException e = new NoSuchElementException("Channel does not exist, " + d.getChannel().getName());
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "440", this, new Object[] { d });
throw e;
}
channelList[j++] = oldList[i];
} else if (chanName == null) {
DiscriminationProcessException e = new DiscriminationProcessException("Channel does not have a name associated with it, " + oldList[i]);
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "454", this, new Object[] { oldList[i] });
throw e;
}
}
// remove it from the node list
removeDiscriminatorNode(d);
} } | public class class_name {
@Override
public void removeDiscriminator(Discriminator d) throws DiscriminationProcessException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "removeDiscriminator: " + d);
}
if (status == STARTED) {
DiscriminationProcessException e = new DiscriminationProcessException("Should not remove form DiscriminationGroup while started!");
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "401", this, new Object[] { d });
throw e;
}
// remove it from the list
if (!discAL.remove(d)) {
NoSuchElementException e = new NoSuchElementException("Discriminator does not exist, " + d.getChannel().getName());
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "410", this, new Object[] { d });
throw e;
}
this.changed = true;
String chanName = d.getChannel().getName();
if (channelList == null) {
NoSuchElementException e = new NoSuchElementException("No Channel's exist, " + chanName);
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "422", this, new Object[] { d });
throw e;
}
Channel[] oldList = channelList;
channelList = new Channel[oldList.length - 1];
for (int i = 0, j = 0; i < oldList.length; i++) {
String tempName = oldList[i].getName();
if (tempName != null && !(tempName.equals(chanName))) {
if (j >= oldList.length) {
NoSuchElementException e = new NoSuchElementException("Channel does not exist, " + d.getChannel().getName());
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "440", this, new Object[] { d }); // depends on control dependency: [if], data = [none]
throw e;
}
channelList[j++] = oldList[i];
} else if (chanName == null) {
DiscriminationProcessException e = new DiscriminationProcessException("Channel does not have a name associated with it, " + oldList[i]);
FFDCFilter.processException(e, getClass().getName() + ".removeDiscriminator", "454", this, new Object[] { oldList[i] });
throw e;
}
}
// remove it from the node list
removeDiscriminatorNode(d);
} } |
public class class_name {
public Option xAxis(Axis... values) {
if (values == null || values.length == 0) {
return this;
}
if (this.xAxis().size() == 2) {
throw new RuntimeException("xAxis已经存在2个,无法继续添加!");
}
if (this.xAxis().size() + values.length > 2) {
throw new RuntimeException("添加的xAxis超出了最大允许的范围:2!");
}
this.xAxis().addAll(Arrays.asList(values));
return this;
} } | public class class_name {
public Option xAxis(Axis... values) {
if (values == null || values.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
if (this.xAxis().size() == 2) {
throw new RuntimeException("xAxis已经存在2个,无法继续添加!");
}
if (this.xAxis().size() + values.length > 2) {
throw new RuntimeException("添加的xAxis超出了最大允许的范围:2!");
}
this.xAxis().addAll(Arrays.asList(values));
return this;
} } |
public class class_name {
private TableLoadResult copy (Table table, boolean createIndexes) {
// This object will be returned to the caller to summarize the contents of the table and any errors.
// FIXME: Should there be a separate TableSnapshotResult? Load result is empty except for fatal exception.
TableLoadResult tableLoadResult = new TableLoadResult();
try {
// FIXME this is confusing, we only create a new table object so we can call a couple of methods on it,
// all of which just need a list of fields.
Table targetTable = new Table(tablePrefix + table.name, table.entityClass, table.required, table.fields);
boolean success;
if (feedIdToSnapshot == null) {
// If there is no feedId to snapshot (i.e., we're making an empty snapshot), simply create the table.
success = targetTable.createSqlTable(connection, true);
} else {
// Otherwise, use the createTableFrom method to copy the data from the original.
String fromTableName = String.format("%s.%s", feedIdToSnapshot, table.name);
LOG.info("Copying table {} to {}", fromTableName, targetTable.name);
success = targetTable.createSqlTableFrom(connection, fromTableName);
}
// Only create indexes if table creation was successful.
if (success && createIndexes) {
addEditorSpecificFields(connection, tablePrefix, table);
// Use spec table to create indexes. See createIndexes method for more info on why.
table.createIndexes(connection, tablePrefix);
// Populate default values for editor fields, including normalization of stop time stop sequences.
populateDefaultEditorValues(connection, tablePrefix, table);
}
LOG.info("Committing transaction...");
connection.commit();
LOG.info("Done.");
} catch (Exception ex) {
tableLoadResult.fatalException = ex.toString();
LOG.error("Error: ", ex);
try {
connection.rollback();
} catch (SQLException e) {
e.printStackTrace();
}
}
return tableLoadResult;
} } | public class class_name {
private TableLoadResult copy (Table table, boolean createIndexes) {
// This object will be returned to the caller to summarize the contents of the table and any errors.
// FIXME: Should there be a separate TableSnapshotResult? Load result is empty except for fatal exception.
TableLoadResult tableLoadResult = new TableLoadResult();
try {
// FIXME this is confusing, we only create a new table object so we can call a couple of methods on it,
// all of which just need a list of fields.
Table targetTable = new Table(tablePrefix + table.name, table.entityClass, table.required, table.fields);
boolean success;
if (feedIdToSnapshot == null) {
// If there is no feedId to snapshot (i.e., we're making an empty snapshot), simply create the table.
success = targetTable.createSqlTable(connection, true); // depends on control dependency: [if], data = [none]
} else {
// Otherwise, use the createTableFrom method to copy the data from the original.
String fromTableName = String.format("%s.%s", feedIdToSnapshot, table.name);
LOG.info("Copying table {} to {}", fromTableName, targetTable.name); // depends on control dependency: [if], data = [none]
success = targetTable.createSqlTableFrom(connection, fromTableName); // depends on control dependency: [if], data = [none]
}
// Only create indexes if table creation was successful.
if (success && createIndexes) {
addEditorSpecificFields(connection, tablePrefix, table); // depends on control dependency: [if], data = [none]
// Use spec table to create indexes. See createIndexes method for more info on why.
table.createIndexes(connection, tablePrefix); // depends on control dependency: [if], data = [none]
// Populate default values for editor fields, including normalization of stop time stop sequences.
populateDefaultEditorValues(connection, tablePrefix, table); // depends on control dependency: [if], data = [none]
}
LOG.info("Committing transaction..."); // depends on control dependency: [try], data = [none]
connection.commit(); // depends on control dependency: [try], data = [none]
LOG.info("Done."); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
tableLoadResult.fatalException = ex.toString();
LOG.error("Error: ", ex);
try {
connection.rollback(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return tableLoadResult;
} } |
public class class_name {
private void setArg(OptionInfo oi, String argName, @Nullable String argValue)
throws ArgException {
Field f = oi.field;
Class<?> type = oi.baseType;
// Keep track of all of the options specified
if (optionsString.length() > 0) {
optionsString += " ";
}
optionsString += argName;
if (argValue != null) {
if (!argValue.contains(" ")) {
optionsString += "=" + argValue;
} else if (!argValue.contains("'")) {
optionsString += "='" + argValue + "'";
} else if (!argValue.contains("\"")) {
optionsString += "=\"" + argValue + "\"";
} else {
throw new ArgException("Can't quote for internal debugging: " + argValue);
}
}
// Argument values are required for everything but booleans
if (argValue == null) {
if ((type != Boolean.TYPE) || (type != Boolean.class)) {
argValue = "true";
} else {
throw new ArgException("Value required for option " + argName);
}
}
try {
if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
boolean val;
String argValueLowercase = argValue.toLowerCase();
if (argValueLowercase.equals("true") || (argValueLowercase.equals("t"))) {
val = true;
} else if (argValueLowercase.equals("false") || argValueLowercase.equals("f")) {
val = false;
} else {
throw new ArgException(
"Value \"%s\" for argument %s is not a boolean", argValue, argName);
}
argValue = (val) ? "true" : "false";
// System.out.printf ("Setting %s to %s%n", argName, val);
f.setBoolean(oi.obj, val);
} else if (type == Byte.TYPE) {
byte val;
try {
val = Byte.decode(argValue);
} catch (Exception e) {
throw new ArgException("Value \"%s\" for argument %s is not a byte", argValue, argName);
}
f.setByte(oi.obj, val);
} else if (type == Character.TYPE) {
if (argValue.length() != 1) {
throw new ArgException(
"Value \"%s\" for argument %s is not a single character", argValue, argName);
}
char val = argValue.charAt(0);
f.setChar(oi.obj, val);
} else if (type == Short.TYPE) {
short val;
try {
val = Short.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a short integer", argValue, argName);
}
f.setShort(oi.obj, val);
} else if (type == Integer.TYPE) {
int val;
try {
val = Integer.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not an integer", argValue, argName);
}
f.setInt(oi.obj, val);
} else if (type == Long.TYPE) {
long val;
try {
val = Long.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a long integer", argValue, argName);
}
f.setLong(oi.obj, val);
} else if (type == Float.TYPE) {
Float val;
try {
val = Float.valueOf(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a float", argValue, argName);
}
f.setFloat(oi.obj, val);
} else if (type == Double.TYPE) {
Double val;
try {
val = Double.valueOf(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a double", argValue, argName);
}
f.setDouble(oi.obj, val);
} else { // unexpected type
throw new Error("Unexpected type " + type);
}
} else { // reference type
// If the argument is a list, add repeated arguments or multiple
// blank separated arguments to the list, otherwise just set the
// argument value.
if (oi.list != null) {
if (spaceSeparatedLists) {
String[] aarr = argValue.split(" *");
for (String aval : aarr) {
Object val = getRefArg(oi, argName, aval);
oi.list.add(val); // uncheck cast
}
} else {
Object val = getRefArg(oi, argName, argValue);
oi.list.add(val);
}
} else {
Object val = getRefArg(oi, argName, argValue);
f.set(oi.obj, val);
}
}
} catch (ArgException ae) {
throw ae;
} catch (Exception e) {
throw new Error("Unexpected error ", e);
}
} } | public class class_name {
private void setArg(OptionInfo oi, String argName, @Nullable String argValue)
throws ArgException {
Field f = oi.field;
Class<?> type = oi.baseType;
// Keep track of all of the options specified
if (optionsString.length() > 0) {
optionsString += " ";
}
optionsString += argName;
if (argValue != null) {
if (!argValue.contains(" ")) {
optionsString += "=" + argValue; // depends on control dependency: [if], data = [none]
} else if (!argValue.contains("'")) {
optionsString += "='" + argValue + "'"; // depends on control dependency: [if], data = [none]
} else if (!argValue.contains("\"")) {
optionsString += "=\"" + argValue + "\""; // depends on control dependency: [if], data = [none]
} else {
throw new ArgException("Can't quote for internal debugging: " + argValue);
}
}
// Argument values are required for everything but booleans
if (argValue == null) {
if ((type != Boolean.TYPE) || (type != Boolean.class)) {
argValue = "true";
} else {
throw new ArgException("Value required for option " + argName);
}
}
try {
if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
boolean val;
String argValueLowercase = argValue.toLowerCase();
if (argValueLowercase.equals("true") || (argValueLowercase.equals("t"))) {
val = true;
} else if (argValueLowercase.equals("false") || argValueLowercase.equals("f")) {
val = false;
} else {
throw new ArgException(
"Value \"%s\" for argument %s is not a boolean", argValue, argName);
}
argValue = (val) ? "true" : "false";
// System.out.printf ("Setting %s to %s%n", argName, val);
f.setBoolean(oi.obj, val);
} else if (type == Byte.TYPE) {
byte val;
try {
val = Byte.decode(argValue);
} catch (Exception e) {
throw new ArgException("Value \"%s\" for argument %s is not a byte", argValue, argName);
}
f.setByte(oi.obj, val);
} else if (type == Character.TYPE) {
if (argValue.length() != 1) {
throw new ArgException(
"Value \"%s\" for argument %s is not a single character", argValue, argName);
}
char val = argValue.charAt(0);
f.setChar(oi.obj, val);
} else if (type == Short.TYPE) {
short val;
try {
val = Short.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a short integer", argValue, argName);
}
f.setShort(oi.obj, val);
} else if (type == Integer.TYPE) {
int val;
try {
val = Integer.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not an integer", argValue, argName);
}
f.setInt(oi.obj, val);
} else if (type == Long.TYPE) {
long val;
try {
val = Long.decode(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a long integer", argValue, argName);
}
f.setLong(oi.obj, val);
} else if (type == Float.TYPE) {
Float val;
try {
val = Float.valueOf(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a float", argValue, argName);
}
f.setFloat(oi.obj, val);
} else if (type == Double.TYPE) {
Double val;
try {
val = Double.valueOf(argValue);
} catch (Exception e) {
throw new ArgException(
"Value \"%s\" for argument %s is not a double", argValue, argName);
}
f.setDouble(oi.obj, val);
} else { // unexpected type
throw new Error("Unexpected type " + type);
}
} else { // reference type
// If the argument is a list, add repeated arguments or multiple
// blank separated arguments to the list, otherwise just set the
// argument value.
if (oi.list != null) {
if (spaceSeparatedLists) {
String[] aarr = argValue.split(" *");
for (String aval : aarr) {
Object val = getRefArg(oi, argName, aval);
oi.list.add(val); // uncheck cast
}
} else {
Object val = getRefArg(oi, argName, argValue);
oi.list.add(val);
}
} else {
Object val = getRefArg(oi, argName, argValue);
f.set(oi.obj, val);
}
}
} catch (ArgException ae) {
throw ae;
} catch (Exception e) {
throw new Error("Unexpected error ", e);
}
} } |
public class class_name {
protected Map<QueryParameter, String> getParameters(final UriInfo uri, final JaxRx jaxrx) {
final MultivaluedMap<String, String> params = uri.getQueryParameters();
final Map<QueryParameter, String> newParam = createMap();
final Set<QueryParameter> impl = jaxrx.getParameters();
for (final String key : params.keySet()) {
for (final String s : params.get(key)) {
addParameter(key, s, newParam, impl);
}
}
return newParam;
} } | public class class_name {
protected Map<QueryParameter, String> getParameters(final UriInfo uri, final JaxRx jaxrx) {
final MultivaluedMap<String, String> params = uri.getQueryParameters();
final Map<QueryParameter, String> newParam = createMap();
final Set<QueryParameter> impl = jaxrx.getParameters();
for (final String key : params.keySet()) {
for (final String s : params.get(key)) {
addParameter(key, s, newParam, impl);
// depends on control dependency: [for], data = [s]
}
}
return newParam;
} } |
public class class_name {
public List<String> introspect() {
List<String> rc = new LinkedList<String>();
String prefix = getClass().getSimpleName() + "@" + hashCode() + ": ";
rc.add(prefix + "tcpChannel=" + this.tcpChannel);
rc.add(prefix + "closed=" + this.closed);
rc.add(prefix + "socketIOChannel=" + this.socketIOChannel);
if (null != this.socketIOChannel) {
rc.addAll(this.socketIOChannel.introspect());
}
rc.add(prefix + "numReads=" + this.numReads);
rc.add(prefix + "numWrites=" + this.numWrites);
rc.add(prefix + "callCompleteLocal=" + this.callCompleteLocal);
return rc;
} } | public class class_name {
public List<String> introspect() {
List<String> rc = new LinkedList<String>();
String prefix = getClass().getSimpleName() + "@" + hashCode() + ": ";
rc.add(prefix + "tcpChannel=" + this.tcpChannel);
rc.add(prefix + "closed=" + this.closed);
rc.add(prefix + "socketIOChannel=" + this.socketIOChannel);
if (null != this.socketIOChannel) {
rc.addAll(this.socketIOChannel.introspect()); // depends on control dependency: [if], data = [none]
}
rc.add(prefix + "numReads=" + this.numReads);
rc.add(prefix + "numWrites=" + this.numWrites);
rc.add(prefix + "callCompleteLocal=" + this.callCompleteLocal);
return rc;
} } |
public class class_name {
@Override
public CommerceWarehouse fetchByG_C_First(long groupId,
long commerceCountryId,
OrderByComparator<CommerceWarehouse> orderByComparator) {
List<CommerceWarehouse> list = findByG_C(groupId, commerceCountryId, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceWarehouse fetchByG_C_First(long groupId,
long commerceCountryId,
OrderByComparator<CommerceWarehouse> orderByComparator) {
List<CommerceWarehouse> list = findByG_C(groupId, commerceCountryId, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@SuppressWarnings("WeakerAccess")
public static boolean isMimeType(@Nonnull final MimePart part, @Nonnull final String mimeType) {
// Do not use part.isMimeType(String) as it is broken for MimeBodyPart
// and does not really check the actual content type.
try {
final ContentType contentType = new ContentType(retrieveDataHandler(part).getContentType());
return contentType.match(mimeType);
} catch (final ParseException ex) {
return retrieveContentType(part).equalsIgnoreCase(mimeType);
}
} } | public class class_name {
@SuppressWarnings("WeakerAccess")
public static boolean isMimeType(@Nonnull final MimePart part, @Nonnull final String mimeType) {
// Do not use part.isMimeType(String) as it is broken for MimeBodyPart
// and does not really check the actual content type.
try {
final ContentType contentType = new ContentType(retrieveDataHandler(part).getContentType());
return contentType.match(mimeType); // depends on control dependency: [try], data = [none]
} catch (final ParseException ex) {
return retrieveContentType(part).equalsIgnoreCase(mimeType);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void mergeFields() {
for (int k = 0; k < fields.size(); ++k) {
HashMap fd = ((AcroFields)fields.get(k)).getFields();
mergeWithMaster(fd);
}
} } | public class class_name {
void mergeFields() {
for (int k = 0; k < fields.size(); ++k) {
HashMap fd = ((AcroFields)fields.get(k)).getFields();
mergeWithMaster(fd); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (isInEditMode())
super.onLayout(changed, left, top, right, bottom);
else if (isDragViewAtTop()) {
dragView.layout(left, top, right, transformer.getOriginalHeight());
secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
ViewHelper.setY(dragView, top);
ViewHelper.setY(secondView, transformer.getOriginalHeight());
} else {
secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
}
} } | public class class_name {
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (isInEditMode())
super.onLayout(changed, left, top, right, bottom);
else if (isDragViewAtTop()) {
dragView.layout(left, top, right, transformer.getOriginalHeight()); // depends on control dependency: [if], data = [none]
secondView.layout(left, transformer.getOriginalHeight(), right, bottom); // depends on control dependency: [if], data = [none]
ViewHelper.setY(dragView, top); // depends on control dependency: [if], data = [none]
ViewHelper.setY(secondView, transformer.getOriginalHeight()); // depends on control dependency: [if], data = [none]
} else {
secondView.layout(left, transformer.getOriginalHeight(), right, bottom); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Version max(Version... versions) {
if (versions.length == 0) {
throw new IllegalArgumentException(
"At least one version needs to be provided for maximum calculation.");
}
Version maximum = versions[0];
for (int index = 1; index < versions.length; ++index) {
Version version = versions[index];
if (maximum.compareTo(version) < 0) {
maximum = version;
}
}
return maximum;
} } | public class class_name {
public static Version max(Version... versions) {
if (versions.length == 0) {
throw new IllegalArgumentException(
"At least one version needs to be provided for maximum calculation.");
}
Version maximum = versions[0];
for (int index = 1; index < versions.length; ++index) {
Version version = versions[index];
if (maximum.compareTo(version) < 0) {
maximum = version; // depends on control dependency: [if], data = [none]
}
}
return maximum;
} } |
public class class_name {
private void printText(PrintWriter pw, String key, String defaultText) {
String text = null;
if (key != null) {
ResourceBundle bundle = null;
// retrieve the resource bundle
try {
bundle = ResourceBundle.getBundle(DIST_EX_RESOURCE_BUNDLE_NAME);
} catch (MissingResourceException e) {
text = defaultText;
}
// if the resource bundle was successfully retrieved, get the specific text based
// on the resource key
if (bundle != null) {
try {
text = bundle.getString(key);
} catch (MissingResourceException e) {
text = defaultText;
}
}
} else { // no key was provided
text = defaultText;
}
pw.println(text);
} } | public class class_name {
private void printText(PrintWriter pw, String key, String defaultText) {
String text = null;
if (key != null) {
ResourceBundle bundle = null;
// retrieve the resource bundle
try {
bundle = ResourceBundle.getBundle(DIST_EX_RESOURCE_BUNDLE_NAME); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
text = defaultText;
} // depends on control dependency: [catch], data = [none]
// if the resource bundle was successfully retrieved, get the specific text based
// on the resource key
if (bundle != null) {
try {
text = bundle.getString(key); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
text = defaultText;
} // depends on control dependency: [catch], data = [none]
}
} else { // no key was provided
text = defaultText; // depends on control dependency: [if], data = [none]
}
pw.println(text);
} } |
public class class_name {
public List<OntologyTerm> findOntologyTerms(
List<String> ontologyIds, Set<String> terms, int pageSize) {
List<QueryRule> rules = new ArrayList<>();
for (String term : terms) {
if (!rules.isEmpty()) {
rules.add(new QueryRule(Operator.OR));
}
rules.add(
new QueryRule(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM, Operator.FUZZY_MATCH, term));
}
rules =
Arrays.asList(
new QueryRule(ONTOLOGY, Operator.IN, ontologyIds),
new QueryRule(Operator.AND),
new QueryRule(rules));
final List<QueryRule> finalRules = rules;
Iterable<Entity> termEntities =
() ->
dataService
.findAll(ONTOLOGY_TERM, new QueryImpl<>(finalRules).pageSize(pageSize))
.iterator();
return Lists.newArrayList(
Iterables.transform(termEntities, OntologyTermRepository::toOntologyTerm));
} } | public class class_name {
public List<OntologyTerm> findOntologyTerms(
List<String> ontologyIds, Set<String> terms, int pageSize) {
List<QueryRule> rules = new ArrayList<>();
for (String term : terms) {
if (!rules.isEmpty()) {
rules.add(new QueryRule(Operator.OR)); // depends on control dependency: [if], data = [none]
}
rules.add(
new QueryRule(OntologyTermMetadata.ONTOLOGY_TERM_SYNONYM, Operator.FUZZY_MATCH, term)); // depends on control dependency: [for], data = [none]
}
rules =
Arrays.asList(
new QueryRule(ONTOLOGY, Operator.IN, ontologyIds),
new QueryRule(Operator.AND),
new QueryRule(rules));
final List<QueryRule> finalRules = rules;
Iterable<Entity> termEntities =
() ->
dataService
.findAll(ONTOLOGY_TERM, new QueryImpl<>(finalRules).pageSize(pageSize))
.iterator();
return Lists.newArrayList(
Iterables.transform(termEntities, OntologyTermRepository::toOntologyTerm));
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public Object convertToObject(OpenType openType, Object pValue) {
if (pValue == null) {
return null;
} else {
for (OpenTypeConverter converter : converters) {
if (converter.canConvert(openType)) {
return converter.convertToObject(openType,pValue);
}
}
throw new IllegalArgumentException(
"Cannot convert " + pValue + " to " + openType + ": " + "No converter could be found");
}
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public Object convertToObject(OpenType openType, Object pValue) {
if (pValue == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
for (OpenTypeConverter converter : converters) {
if (converter.canConvert(openType)) {
return converter.convertToObject(openType,pValue); // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException(
"Cannot convert " + pValue + " to " + openType + ": " + "No converter could be found");
}
} } |
public class class_name {
public CellStyle getOrCreateColumnStyle(int x) {
CellStyle columnStyle = this.sheet.getColumnStyle(x);
if (null == columnStyle) {
columnStyle = this.workbook.createCellStyle();
this.sheet.setDefaultColumnStyle(x, columnStyle);
}
return columnStyle;
} } | public class class_name {
public CellStyle getOrCreateColumnStyle(int x) {
CellStyle columnStyle = this.sheet.getColumnStyle(x);
if (null == columnStyle) {
columnStyle = this.workbook.createCellStyle();
// depends on control dependency: [if], data = [none]
this.sheet.setDefaultColumnStyle(x, columnStyle);
// depends on control dependency: [if], data = [columnStyle)]
}
return columnStyle;
} } |
public class class_name {
public Flux<ServiceMessage> requestMany(ServiceMessage request, Class<?> responseType) {
return Flux.defer(
() -> {
String qualifier = request.qualifier();
if (methodRegistry.containsInvoker(qualifier)) { // local service.
return methodRegistry
.getInvoker(request.qualifier())
.invokeMany(request, ServiceMessageCodec::decodeData)
.map(this::throwIfError);
} else {
return addressLookup(request)
.flatMapMany(
address -> requestMany(request, responseType, address)); // remote service
}
});
} } | public class class_name {
public Flux<ServiceMessage> requestMany(ServiceMessage request, Class<?> responseType) {
return Flux.defer(
() -> {
String qualifier = request.qualifier();
if (methodRegistry.containsInvoker(qualifier)) { // local service.
return methodRegistry
.getInvoker(request.qualifier())
.invokeMany(request, ServiceMessageCodec::decodeData)
.map(this::throwIfError); // depends on control dependency: [if], data = [none]
} else {
return addressLookup(request)
.flatMapMany(
address -> requestMany(request, responseType, address)); // remote service // depends on control dependency: [if], data = [none]
}
});
} } |
public class class_name {
private String buildAliasKey(String aPath, List hintClasses)
{
if (hintClasses == null || hintClasses.isEmpty())
{
return aPath;
}
StringBuffer buf = new StringBuffer(aPath);
for (Iterator iter = hintClasses.iterator(); iter.hasNext();)
{
Class hint = (Class) iter.next();
buf.append(" ");
buf.append(hint.getName());
}
return buf.toString();
} } | public class class_name {
private String buildAliasKey(String aPath, List hintClasses)
{
if (hintClasses == null || hintClasses.isEmpty())
{
return aPath;
// depends on control dependency: [if], data = [none]
}
StringBuffer buf = new StringBuffer(aPath);
for (Iterator iter = hintClasses.iterator(); iter.hasNext();)
{
Class hint = (Class) iter.next();
// depends on control dependency: [for], data = [iter]
buf.append(" ");
// depends on control dependency: [for], data = [none]
buf.append(hint.getName());
// depends on control dependency: [for], data = [none]
}
return buf.toString();
} } |
public class class_name {
private String readString() throws IOException
{
final StringBuilder str = strBuf;
final StringBuilder hex = hexBuf;
str.setLength(0);
int state = STRING_START;
final FastPushbackReader in = input;
while (true)
{
final int c = in.read();
if (c == -1)
{
error("EOF reached while reading JSON string");
}
if (state == STRING_START)
{
if (c == '"')
{
break;
}
else if (c == '\\')
{
state = STRING_SLASH;
}
else
{
str.appendCodePoint(c);
}
}
else if (state == STRING_SLASH)
{
switch(c)
{
case '\\':
str.appendCodePoint('\\');
break;
case '/':
str.appendCodePoint('/');
break;
case '"':
str.appendCodePoint('"');
break;
case '\'':
str.appendCodePoint('\'');
break;
case 'b':
str.appendCodePoint('\b');
break;
case 'f':
str.appendCodePoint('\f');
break;
case 'n':
str.appendCodePoint('\n');
break;
case 'r':
str.appendCodePoint('\r');
break;
case 't':
str.appendCodePoint('\t');
break;
case 'u':
hex.setLength(0);
state = HEX_DIGITS;
break;
default:
error("Invalid character escape sequence specified: " + c);
}
if (c != 'u')
{
state = STRING_START;
}
}
else
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
{
hex.appendCodePoint((char) c);
if (hex.length() == 4)
{
int value = Integer.parseInt(hex.toString(), 16);
str.appendCodePoint(value);
state = STRING_START;
}
}
else
{
error("Expected hexadecimal digits");
}
}
}
final String s = str.toString();
final String translate = stringCache.get(s);
return translate == null ? s : translate;
} } | public class class_name {
private String readString() throws IOException
{
final StringBuilder str = strBuf;
final StringBuilder hex = hexBuf;
str.setLength(0);
int state = STRING_START;
final FastPushbackReader in = input;
while (true)
{
final int c = in.read();
if (c == -1)
{
error("EOF reached while reading JSON string"); // depends on control dependency: [if], data = [none]
}
if (state == STRING_START)
{
if (c == '"')
{
break;
}
else if (c == '\\')
{
state = STRING_SLASH; // depends on control dependency: [if], data = [none]
}
else
{
str.appendCodePoint(c); // depends on control dependency: [if], data = [(c]
}
}
else if (state == STRING_SLASH)
{
switch(c)
{
case '\\':
str.appendCodePoint('\\');
break;
case '/':
str.appendCodePoint('/');
break;
case '"':
str.appendCodePoint('"');
break;
case '\'':
str.appendCodePoint('\'');
break;
case 'b':
str.appendCodePoint('\b');
break;
case 'f':
str.appendCodePoint('\f');
break;
case 'n':
str.appendCodePoint('\n');
break;
case 'r':
str.appendCodePoint('\r');
break;
case 't':
str.appendCodePoint('\t');
break;
case 'u':
hex.setLength(0);
state = HEX_DIGITS;
break;
default:
error("Invalid character escape sequence specified: " + c);
}
if (c != 'u')
{
state = STRING_START; // depends on control dependency: [if], data = [none]
}
}
else
{
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
{
hex.appendCodePoint((char) c); // depends on control dependency: [if], data = [((c]
if (hex.length() == 4)
{
int value = Integer.parseInt(hex.toString(), 16);
str.appendCodePoint(value); // depends on control dependency: [if], data = [none]
state = STRING_START; // depends on control dependency: [if], data = [none]
}
}
else
{
error("Expected hexadecimal digits"); // depends on control dependency: [if], data = [none]
}
}
}
final String s = str.toString();
final String translate = stringCache.get(s);
return translate == null ? s : translate;
} } |
public class class_name {
@Override
protected StringBuilder getAlterColumnIsNotNull(final String _columnName,
final boolean _isNotNull)
{
final StringBuilder ret = new StringBuilder()
.append(" alter column ").append(getColumnQuote()).append(_columnName).append(getColumnQuote());
if (_isNotNull) {
ret.append(" set ");
} else {
ret.append(" drop ");
}
ret.append(" not null");
return ret;
} } | public class class_name {
@Override
protected StringBuilder getAlterColumnIsNotNull(final String _columnName,
final boolean _isNotNull)
{
final StringBuilder ret = new StringBuilder()
.append(" alter column ").append(getColumnQuote()).append(_columnName).append(getColumnQuote());
if (_isNotNull) {
ret.append(" set "); // depends on control dependency: [if], data = [none]
} else {
ret.append(" drop "); // depends on control dependency: [if], data = [none]
}
ret.append(" not null");
return ret;
} } |
public class class_name {
@Override
protected ControllerEntityLinks createInstance() {
Collection<Class<?>> controllerTypes = new HashSet<>();
for (Class<?> controllerType : getBeanTypesWithAnnotation(annotation)) {
if (AnnotationUtils.findAnnotation(controllerType, ExposesResourceFor.class) != null) {
controllerTypes.add(controllerType);
}
}
return new ControllerEntityLinks(controllerTypes, linkBuilderFactory);
} } | public class class_name {
@Override
protected ControllerEntityLinks createInstance() {
Collection<Class<?>> controllerTypes = new HashSet<>();
for (Class<?> controllerType : getBeanTypesWithAnnotation(annotation)) {
if (AnnotationUtils.findAnnotation(controllerType, ExposesResourceFor.class) != null) {
controllerTypes.add(controllerType); // depends on control dependency: [if], data = [none]
}
}
return new ControllerEntityLinks(controllerTypes, linkBuilderFactory);
} } |
public class class_name {
static SibRaDispatchEndpointActivation getEndpointActivation(
final String j2eeName) {
final String methodName = "getEndpointActivation";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(SibRaDispatchEndpointActivation.class,
TRACE, methodName, new Object [] { j2eeName } );
}
SibRaDispatchEndpointActivation endpoint = null;
synchronized (_endpointActivations) {
SibRaEndpointArray endpointActivationArray = (SibRaEndpointArray) _endpointActivations.get(j2eeName);
if (endpointActivationArray != null) {
// Get the next endpoint
endpoint = endpointActivationArray.getNextEndpoint();
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(SibRaDispatchEndpointActivation.class, TRACE, methodName, endpoint);
}
return endpoint;
} } | public class class_name {
static SibRaDispatchEndpointActivation getEndpointActivation(
final String j2eeName) {
final String methodName = "getEndpointActivation";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(SibRaDispatchEndpointActivation.class,
TRACE, methodName, new Object [] { j2eeName } ); // depends on control dependency: [if], data = [none]
}
SibRaDispatchEndpointActivation endpoint = null;
synchronized (_endpointActivations) {
SibRaEndpointArray endpointActivationArray = (SibRaEndpointArray) _endpointActivations.get(j2eeName);
if (endpointActivationArray != null) {
// Get the next endpoint
endpoint = endpointActivationArray.getNextEndpoint(); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(SibRaDispatchEndpointActivation.class, TRACE, methodName, endpoint); // depends on control dependency: [if], data = [none]
}
return endpoint;
} } |
public class class_name {
public List<T> pollN(int n) {
if (n >= size) {
// if we need to remove all elements then do fast polling
return pollAll();
}
List<T> retList = new ArrayList<T>(n);
pollNToList(n, retList);
return retList;
} } | public class class_name {
public List<T> pollN(int n) {
if (n >= size) {
// if we need to remove all elements then do fast polling
return pollAll(); // depends on control dependency: [if], data = [none]
}
List<T> retList = new ArrayList<T>(n);
pollNToList(n, retList);
return retList;
} } |
public class class_name {
public static String className(Class<?> clazz) { //todo: rename
//todo: is that correct algorithm?
final String naiveName = clazz.getName();
if (!clazz.isArray()) { //todo: what about enum
return naiveName;
} else {
int count = 0;
String ending = "";
while (clazz.isArray()) {
count++;
ending += "[]";
clazz = clazz.getComponentType();
}
if (clazz.isPrimitive()) {
String primitiveClassName;
if (clazz == boolean.class) {
primitiveClassName = "boolean";
} else if (clazz == byte.class) {
primitiveClassName = "byte";
} else if (clazz == char.class) {
primitiveClassName = "char";
} else if (clazz == short.class) {
primitiveClassName = "short";
} else if (clazz == int.class) {
primitiveClassName = "int";
} else if (clazz == long.class) {
primitiveClassName = "long";
} else if (clazz == float.class) {
primitiveClassName = "float";
} else if (clazz == double.class) {
primitiveClassName = "double";
} else {
throw new RuntimeException("Never here! - You try to generate code for Void[]...[]: clazz = " + clazz);
}
return primitiveClassName + ending;
} else {
return naiveName.substring(count + 1, naiveName.length() - 1) + ending;
}
}
} } | public class class_name {
public static String className(Class<?> clazz) { //todo: rename
//todo: is that correct algorithm?
final String naiveName = clazz.getName();
if (!clazz.isArray()) { //todo: what about enum
return naiveName; // depends on control dependency: [if], data = [none]
} else {
int count = 0;
String ending = "";
while (clazz.isArray()) {
count++; // depends on control dependency: [while], data = [none]
ending += "[]";
clazz = clazz.getComponentType(); // depends on control dependency: [while], data = [none]
}
if (clazz.isPrimitive()) {
String primitiveClassName;
if (clazz == boolean.class) {
primitiveClassName = "boolean"; // depends on control dependency: [if], data = [none]
} else if (clazz == byte.class) {
primitiveClassName = "byte"; // depends on control dependency: [if], data = [none]
} else if (clazz == char.class) {
primitiveClassName = "char"; // depends on control dependency: [if], data = [none]
} else if (clazz == short.class) {
primitiveClassName = "short"; // depends on control dependency: [if], data = [none]
} else if (clazz == int.class) {
primitiveClassName = "int"; // depends on control dependency: [if], data = [none]
} else if (clazz == long.class) {
primitiveClassName = "long"; // depends on control dependency: [if], data = [none]
} else if (clazz == float.class) {
primitiveClassName = "float"; // depends on control dependency: [if], data = [none]
} else if (clazz == double.class) {
primitiveClassName = "double"; // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Never here! - You try to generate code for Void[]...[]: clazz = " + clazz);
}
return primitiveClassName + ending; // depends on control dependency: [if], data = [none]
} else {
return naiveName.substring(count + 1, naiveName.length() - 1) + ending; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public Image getIcon(int iconType) {
Pair<String, Image> pair = iconInformation.get(iconType);
String imagePath = pair.first;
Image imageOrNull = pair.second;
if ((imageOrNull == null) && (imagePath != null)) {
imageOrNull = loadImage(imagePath);
}
return imageOrNull;
} } | public class class_name {
@Override
public Image getIcon(int iconType) {
Pair<String, Image> pair = iconInformation.get(iconType);
String imagePath = pair.first;
Image imageOrNull = pair.second;
if ((imageOrNull == null) && (imagePath != null)) {
imageOrNull = loadImage(imagePath); // depends on control dependency: [if], data = [none]
}
return imageOrNull;
} } |
public class class_name {
void editUserData() {
if (m_context instanceof CmsEmbeddedDialogContext) {
((CmsEmbeddedDialogContext)m_context).closeWindow(true);
} else {
A_CmsUI.get().closeWindows();
}
CmsUserDataDialog dialog = new CmsUserDataDialog(m_context);
m_context.start(CmsVaadinUtils.getMessageText(Messages.GUI_USER_EDIT_0), dialog);
} } | public class class_name {
void editUserData() {
if (m_context instanceof CmsEmbeddedDialogContext) {
((CmsEmbeddedDialogContext)m_context).closeWindow(true); // depends on control dependency: [if], data = [none]
} else {
A_CmsUI.get().closeWindows(); // depends on control dependency: [if], data = [none]
}
CmsUserDataDialog dialog = new CmsUserDataDialog(m_context);
m_context.start(CmsVaadinUtils.getMessageText(Messages.GUI_USER_EDIT_0), dialog);
} } |
public class class_name {
@Override
public void validate() {
boolean valid = true;
if (hasValue()) {
Long value = getValue();
if (value != null) {
// scrub the value to format properly
setText(value2text(value));
}
else {
// empty is ok and value != null ok, this is invalid
valid = false;
}
}
setStyleName(CLASSNAME_INVALID, !valid);
} } | public class class_name {
@Override
public void validate() {
boolean valid = true;
if (hasValue()) {
Long value = getValue();
if (value != null) {
// scrub the value to format properly
setText(value2text(value)); // depends on control dependency: [if], data = [(value]
}
else {
// empty is ok and value != null ok, this is invalid
valid = false; // depends on control dependency: [if], data = [none]
}
}
setStyleName(CLASSNAME_INVALID, !valid);
} } |
public class class_name {
protected ClassInfo mergeClassConfigInfo(ClassInfo classInfo) {
// Update introspected class information from introspected package
PackageInfo packageInfo = configFileParser.getPackageInfo(classInfo.getInternalPackageName());
if (packageInfo == null) {
packageInfo = getPackageInfo(classInfo.getInternalPackageName());
}
classInfo.updateDefaultValuesFromPackageInfo(packageInfo);
// Override introspected class information from configuration document
ClassInfo ci = configFileParser.getClassInfo(classInfo.getInternalClassName());
if (ci != null) {
classInfo.overrideValuesFromExplicitClassInfo(ci);
}
return classInfo;
} } | public class class_name {
protected ClassInfo mergeClassConfigInfo(ClassInfo classInfo) {
// Update introspected class information from introspected package
PackageInfo packageInfo = configFileParser.getPackageInfo(classInfo.getInternalPackageName());
if (packageInfo == null) {
packageInfo = getPackageInfo(classInfo.getInternalPackageName()); // depends on control dependency: [if], data = [none]
}
classInfo.updateDefaultValuesFromPackageInfo(packageInfo);
// Override introspected class information from configuration document
ClassInfo ci = configFileParser.getClassInfo(classInfo.getInternalClassName());
if (ci != null) {
classInfo.overrideValuesFromExplicitClassInfo(ci); // depends on control dependency: [if], data = [(ci]
}
return classInfo;
} } |
public class class_name {
@Override
public void decode(FacesContext context, UIComponent component) {
SelectOneMenu menu = (SelectOneMenu) component;
if (menu.isDisabled() || menu.isReadonly()) {
return;
}
String outerClientId = menu.getClientId(context);
String clientId = outerClientId + "Inner";
String submittedOptionValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId);
Converter converter = menu.getConverter();
if (null == converter) {
converter = findImplicitConverter(context, component);
}
List<SelectItemAndComponent> items = SelectItemUtils.collectOptions(context, menu, converter);
if (null != submittedOptionValue) {
for (int index = 0; index < items.size(); index++) {
Object currentOption = items.get(index).getSelectItem();
String currentOptionValueAsString;
Object currentOptionValue = null;
if (currentOption instanceof SelectItem) {
if (!((SelectItem) currentOption).isDisabled()) {
currentOptionValue = ((SelectItem) currentOption).getValue();
}
}
if (currentOptionValue instanceof String) {
currentOptionValueAsString = (String) currentOptionValue;
} else if (null != converter) {
currentOptionValueAsString = converter.getAsString(context, component, currentOptionValue);
} else if (currentOptionValue != null) {
currentOptionValueAsString = String.valueOf(index);
} else {
currentOptionValueAsString = ""; // null values are submitted as empty strings
}
if (submittedOptionValue.equals(currentOptionValueAsString)) {
Object submittedValue = null;
if (currentOptionValue == null) {
submittedValue = null;
} else {
submittedValue = null != converter ? currentOptionValueAsString : currentOptionValue;
}
menu.setSubmittedValue(submittedValue);
menu.setValid(true);
menu.validateValue(context, submittedValue);
new AJAXRenderer().decode(context, component, clientId);
if (menu.isValid()) {
if (currentOptionValue == null) {
menu.setLocalValueSet(true);
}
}
return;
}
}
menu.validateValue(context, null);
menu.setSubmittedValue(null);
menu.setValid(false);
return;
}
menu.setValid(true);
menu.validateValue(context, submittedOptionValue);
menu.setSubmittedValue(submittedOptionValue);
new AJAXRenderer().decode(context, component, clientId);
} } | public class class_name {
@Override
public void decode(FacesContext context, UIComponent component) {
SelectOneMenu menu = (SelectOneMenu) component;
if (menu.isDisabled() || menu.isReadonly()) {
return; // depends on control dependency: [if], data = [none]
}
String outerClientId = menu.getClientId(context);
String clientId = outerClientId + "Inner";
String submittedOptionValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId);
Converter converter = menu.getConverter();
if (null == converter) {
converter = findImplicitConverter(context, component); // depends on control dependency: [if], data = [none]
}
List<SelectItemAndComponent> items = SelectItemUtils.collectOptions(context, menu, converter);
if (null != submittedOptionValue) {
for (int index = 0; index < items.size(); index++) {
Object currentOption = items.get(index).getSelectItem();
String currentOptionValueAsString;
Object currentOptionValue = null;
if (currentOption instanceof SelectItem) {
if (!((SelectItem) currentOption).isDisabled()) {
currentOptionValue = ((SelectItem) currentOption).getValue(); // depends on control dependency: [if], data = [none]
}
}
if (currentOptionValue instanceof String) {
currentOptionValueAsString = (String) currentOptionValue; // depends on control dependency: [if], data = [none]
} else if (null != converter) {
currentOptionValueAsString = converter.getAsString(context, component, currentOptionValue); // depends on control dependency: [if], data = [none]
} else if (currentOptionValue != null) {
currentOptionValueAsString = String.valueOf(index); // depends on control dependency: [if], data = [none]
} else {
currentOptionValueAsString = ""; // null values are submitted as empty strings // depends on control dependency: [if], data = [none]
}
if (submittedOptionValue.equals(currentOptionValueAsString)) {
Object submittedValue = null;
if (currentOptionValue == null) {
submittedValue = null; // depends on control dependency: [if], data = [none]
} else {
submittedValue = null != converter ? currentOptionValueAsString : currentOptionValue; // depends on control dependency: [if], data = [none]
}
menu.setSubmittedValue(submittedValue); // depends on control dependency: [if], data = [none]
menu.setValid(true); // depends on control dependency: [if], data = [none]
menu.validateValue(context, submittedValue); // depends on control dependency: [if], data = [none]
new AJAXRenderer().decode(context, component, clientId); // depends on control dependency: [if], data = [none]
if (menu.isValid()) {
if (currentOptionValue == null) {
menu.setLocalValueSet(true); // depends on control dependency: [if], data = [none]
}
}
return; // depends on control dependency: [if], data = [none]
}
}
menu.validateValue(context, null); // depends on control dependency: [if], data = [none]
menu.setSubmittedValue(null); // depends on control dependency: [if], data = [(null]
menu.setValid(false); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
menu.setValid(true);
menu.validateValue(context, submittedOptionValue);
menu.setSubmittedValue(submittedOptionValue);
new AJAXRenderer().decode(context, component, clientId);
} } |
public class class_name {
public void marshall(PutLifecyclePolicyRequest putLifecyclePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (putLifecyclePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putLifecyclePolicyRequest.getContainerName(), CONTAINERNAME_BINDING);
protocolMarshaller.marshall(putLifecyclePolicyRequest.getLifecyclePolicy(), LIFECYCLEPOLICY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutLifecyclePolicyRequest putLifecyclePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (putLifecyclePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putLifecyclePolicyRequest.getContainerName(), CONTAINERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putLifecyclePolicyRequest.getLifecyclePolicy(), LIFECYCLEPOLICY_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 ListAttachedGroupPoliciesResult withAttachedPolicies(AttachedPolicy... attachedPolicies) {
if (this.attachedPolicies == null) {
setAttachedPolicies(new com.amazonaws.internal.SdkInternalList<AttachedPolicy>(attachedPolicies.length));
}
for (AttachedPolicy ele : attachedPolicies) {
this.attachedPolicies.add(ele);
}
return this;
} } | public class class_name {
public ListAttachedGroupPoliciesResult withAttachedPolicies(AttachedPolicy... attachedPolicies) {
if (this.attachedPolicies == null) {
setAttachedPolicies(new com.amazonaws.internal.SdkInternalList<AttachedPolicy>(attachedPolicies.length)); // depends on control dependency: [if], data = [none]
}
for (AttachedPolicy ele : attachedPolicies) {
this.attachedPolicies.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality,
long[] possibleValues) {
boolean ok = true;
int tagid = TiffTags.getTagId(tagName);
if (!metadata.containsTagId(tagid)) {
validation.addErrorLoc("Missing required tag for TiffIT" + profile + " " + tagName, "IFD"
+ currentIfd);
ok = false;
} else if (cardinality != -1 && metadata.get(tagid).getCardinality() != cardinality) {
validation.addError("Invalid cardinality for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd,
metadata.get(tagid)
.getCardinality());
} else if (cardinality == 1 && possibleValues != null) {
long val = metadata.get(tagid).getFirstNumericValue();
boolean contained = false;
int i = 0;
while (i < possibleValues.length && !contained) {
contained = possibleValues[i] == val;
i++;
}
if (!contained)
validation.addError("Invalid value for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd, val);
}
return ok;
} } | public class class_name {
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality,
long[] possibleValues) {
boolean ok = true;
int tagid = TiffTags.getTagId(tagName);
if (!metadata.containsTagId(tagid)) {
validation.addErrorLoc("Missing required tag for TiffIT" + profile + " " + tagName, "IFD"
+ currentIfd); // depends on control dependency: [if], data = [none]
ok = false; // depends on control dependency: [if], data = [none]
} else if (cardinality != -1 && metadata.get(tagid).getCardinality() != cardinality) {
validation.addError("Invalid cardinality for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd,
metadata.get(tagid)
.getCardinality()); // depends on control dependency: [if], data = [none]
} else if (cardinality == 1 && possibleValues != null) {
long val = metadata.get(tagid).getFirstNumericValue();
boolean contained = false;
int i = 0;
while (i < possibleValues.length && !contained) {
contained = possibleValues[i] == val; // depends on control dependency: [while], data = [none]
i++; // depends on control dependency: [while], data = [none]
}
if (!contained)
validation.addError("Invalid value for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd, val);
}
return ok;
} } |
public class class_name {
public static int getStickyFooterPositionByIdentifier(DrawerBuilder drawer, long identifier) {
if (identifier != -1) {
if (drawer.mStickyFooterView != null && drawer.mStickyFooterView instanceof LinearLayout) {
LinearLayout footer = (LinearLayout) drawer.mStickyFooterView;
int shadowOffset = 0;
for (int i = 0; i < footer.getChildCount(); i++) {
Object o = footer.getChildAt(i).getTag(R.id.material_drawer_item);
//count up the shadowOffset to return the correct position of the given item
if (o == null && drawer.mStickyFooterDivider) {
shadowOffset = shadowOffset + 1;
}
if (o != null && o instanceof IDrawerItem && ((IDrawerItem) o).getIdentifier() == identifier) {
return i - shadowOffset;
}
}
}
}
return -1;
} } | public class class_name {
public static int getStickyFooterPositionByIdentifier(DrawerBuilder drawer, long identifier) {
if (identifier != -1) {
if (drawer.mStickyFooterView != null && drawer.mStickyFooterView instanceof LinearLayout) {
LinearLayout footer = (LinearLayout) drawer.mStickyFooterView;
int shadowOffset = 0;
for (int i = 0; i < footer.getChildCount(); i++) {
Object o = footer.getChildAt(i).getTag(R.id.material_drawer_item);
//count up the shadowOffset to return the correct position of the given item
if (o == null && drawer.mStickyFooterDivider) {
shadowOffset = shadowOffset + 1; // depends on control dependency: [if], data = [none]
}
if (o != null && o instanceof IDrawerItem && ((IDrawerItem) o).getIdentifier() == identifier) {
return i - shadowOffset; // depends on control dependency: [if], data = [none]
}
}
}
}
return -1;
} } |
public class class_name {
public static io.grpc.Status toGrpcStatus(io.opencensus.trace.Status opencensusStatus) {
io.grpc.Status status =
grpcStatusFromOpencensusCanonicalCode(opencensusStatus.getCanonicalCode());
if (opencensusStatus.getDescription() != null) {
status = status.withDescription(opencensusStatus.getDescription());
}
return status;
} } | public class class_name {
public static io.grpc.Status toGrpcStatus(io.opencensus.trace.Status opencensusStatus) {
io.grpc.Status status =
grpcStatusFromOpencensusCanonicalCode(opencensusStatus.getCanonicalCode());
if (opencensusStatus.getDescription() != null) {
status = status.withDescription(opencensusStatus.getDescription()); // depends on control dependency: [if], data = [(opencensusStatus.getDescription()]
}
return status;
} } |
public class class_name {
private static void mergeInto(double[] first, double[] second) {
for (int j = 0; j < first.length / 2; j++) {
first[j] = Math.min(first[j], second[j]);
first[j + first.length / 2] = Math.max(first[j + first.length / 2], second[j + first.length / 2]);
}
} } | public class class_name {
private static void mergeInto(double[] first, double[] second) {
for (int j = 0; j < first.length / 2; j++) {
first[j] = Math.min(first[j], second[j]); // depends on control dependency: [for], data = [j]
first[j + first.length / 2] = Math.max(first[j + first.length / 2], second[j + first.length / 2]); // depends on control dependency: [for], data = [j]
}
} } |
public class class_name {
public Object getStateOrCreate(long txid, StateInitializer init) {
if(_curr.containsKey(txid)) {
return _curr.get(txid);
} else {
getState(txid, init);
return null;
}
} } | public class class_name {
public Object getStateOrCreate(long txid, StateInitializer init) {
if(_curr.containsKey(txid)) {
return _curr.get(txid); // depends on control dependency: [if], data = [none]
} else {
getState(txid, init); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void compile() throws JasperException, FileNotFoundException {
createCompiler();
if (jspCompiler.isOutDated()) {
if (isRemoved()) {
throw new FileNotFoundException(jspUri);
}
try {
jspCompiler.removeGeneratedFiles();
jspLoader = null;
jspCompiler.compile();
jsw.setReload(true);
jsw.setCompilationException(null);
} catch (JasperException ex) {
// Cache compilation exception
jsw.setCompilationException(ex);
if (options.getDevelopment() && options.getRecompileOnFail()) {
// Force a recompilation attempt on next access
jsw.setLastModificationTest(-1);
}
throw ex;
} catch (FileNotFoundException fnfe) {
// Re-throw to let caller handle this - will result in a 404
throw fnfe;
} catch (Exception ex) {
JasperException je = new JasperException(
Localizer.getMessage("jsp.error.unable.compile"),
ex);
// Cache compilation exception
jsw.setCompilationException(je);
throw je;
}
}
} } | public class class_name {
public void compile() throws JasperException, FileNotFoundException {
createCompiler();
if (jspCompiler.isOutDated()) {
if (isRemoved()) {
throw new FileNotFoundException(jspUri);
}
try {
jspCompiler.removeGeneratedFiles();
jspLoader = null;
jspCompiler.compile();
jsw.setReload(true);
jsw.setCompilationException(null);
} catch (JasperException ex) {
// Cache compilation exception
jsw.setCompilationException(ex);
if (options.getDevelopment() && options.getRecompileOnFail()) {
// Force a recompilation attempt on next access
jsw.setLastModificationTest(-1);
// depends on control dependency: [if], data = [none]
}
throw ex;
} catch (FileNotFoundException fnfe) {
// Re-throw to let caller handle this - will result in a 404
throw fnfe;
} catch (Exception ex) {
JasperException je = new JasperException(
Localizer.getMessage("jsp.error.unable.compile"),
ex);
// Cache compilation exception
jsw.setCompilationException(je);
throw je;
}
}
} } |
public class class_name {
public double optFmeasure(int recall) {
double max = 0;
for (int i = 0; i < (recall + 1); i++) {
double f = fmeasure(i, recall - i);
if (f > max) {
max = f;
}
}
return max;
} } | public class class_name {
public double optFmeasure(int recall) {
double max = 0;
for (int i = 0; i < (recall + 1); i++) {
double f = fmeasure(i, recall - i);
if (f > max) {
max = f;
// depends on control dependency: [if], data = [none]
}
}
return max;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public Collection<CmsCategory> getSelectedCategories() {
Set<CmsCategory> result = new HashSet<CmsCategory>();
if (m_isDiplayOny) {
// in case of display only, all displayed categories are assume selected
result.addAll((Collection<? extends CmsCategory>)getItemIds());
} else {
for (Entry<CmsCategory, CheckBox> entry : m_checkboxes.entrySet()) {
if (entry.getValue().getValue().booleanValue()) {
result.add(entry.getKey());
}
}
}
return result;
} } | public class class_name {
@SuppressWarnings("unchecked")
public Collection<CmsCategory> getSelectedCategories() {
Set<CmsCategory> result = new HashSet<CmsCategory>();
if (m_isDiplayOny) {
// in case of display only, all displayed categories are assume selected
result.addAll((Collection<? extends CmsCategory>)getItemIds()); // depends on control dependency: [if], data = [none]
} else {
for (Entry<CmsCategory, CheckBox> entry : m_checkboxes.entrySet()) {
if (entry.getValue().getValue().booleanValue()) {
result.add(entry.getKey()); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public static DateList getDateListInstance(final DateList origList) {
final DateList list = new DateList(origList.getType());
if (origList.isUtc()) {
list.setUtc(true);
} else {
list.setTimeZone(origList.getTimeZone());
}
return list;
} } | public class class_name {
public static DateList getDateListInstance(final DateList origList) {
final DateList list = new DateList(origList.getType());
if (origList.isUtc()) {
list.setUtc(true); // depends on control dependency: [if], data = [none]
} else {
list.setTimeZone(origList.getTimeZone()); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
static <T> Binding<T> scope(final Binding<T> binding) {
if (!binding.isSingleton() || binding instanceof SingletonBinding) {
return binding; // Default scoped binding or already a scoped binding.
}
return new SingletonBinding<T>(binding);
} } | public class class_name {
static <T> Binding<T> scope(final Binding<T> binding) {
if (!binding.isSingleton() || binding instanceof SingletonBinding) {
return binding; // Default scoped binding or already a scoped binding. // depends on control dependency: [if], data = [none]
}
return new SingletonBinding<T>(binding);
} } |
public class class_name {
public static String getPrefixWarningMessage(final Object pObject) {
StringBuilder buffer = new StringBuilder();
buffer.append(WARNING);
buffer.append(getTimestamp());
buffer.append(" ");
if (pObject == null) {
buffer.append("[unknown class]");
} else {
if (pObject instanceof String) {
buffer.append((String) pObject);
} else {
buffer.append(getClassName(pObject));
}
}
buffer.append(": ");
return buffer.toString();
} } | public class class_name {
public static String getPrefixWarningMessage(final Object pObject) {
StringBuilder buffer = new StringBuilder();
buffer.append(WARNING);
buffer.append(getTimestamp());
buffer.append(" ");
if (pObject == null) {
buffer.append("[unknown class]");
// depends on control dependency: [if], data = [none]
} else {
if (pObject instanceof String) {
buffer.append((String) pObject);
// depends on control dependency: [if], data = [none]
} else {
buffer.append(getClassName(pObject));
// depends on control dependency: [if], data = [none]
}
}
buffer.append(": ");
return buffer.toString();
} } |
public class class_name {
@Override
public Wave waveBeanList(final List<WaveBean> waveBeanList) {
if (waveBeanList != null && !waveBeanList.isEmpty()) {
waveBeanList.forEach(wb -> getWaveBeanMap().put(wb.getClass(), wb));
}
return this;
} } | public class class_name {
@Override
public Wave waveBeanList(final List<WaveBean> waveBeanList) {
if (waveBeanList != null && !waveBeanList.isEmpty()) {
waveBeanList.forEach(wb -> getWaveBeanMap().put(wb.getClass(), wb)); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public String getContext(int wordsLeft, int wordsRight){
final String text = home_cc.getText();
int temp;
// get the left start position
int posLeft = pos.getStart();
temp = posLeft-1;
while( posLeft != 0 && wordsLeft > 0 ){
while( temp > 0 && text.charAt( temp ) < 48 ) {
temp--;
}
while( temp > 0 && text.charAt( temp ) >= 48 ) {
temp--;
}
posLeft = ( temp>0 ? temp+1 : 0 );
wordsLeft--;
}
// get the right end position
int posRight = pos.getEnd();
temp = posRight;
while( posRight != text.length() && wordsRight > 0 ){
while( temp < text.length() && text.charAt( temp ) < 48 ) {
temp++;
}
while( temp < text.length() && text.charAt( temp ) >= 48 ) {
temp++;
}
posRight = temp;
wordsRight--;
}
// retrun a string...
return
text.substring(posLeft, pos.getStart() ) +
text.substring(pos.getEnd(), posRight);
} } | public class class_name {
public String getContext(int wordsLeft, int wordsRight){
final String text = home_cc.getText();
int temp;
// get the left start position
int posLeft = pos.getStart();
temp = posLeft-1;
while( posLeft != 0 && wordsLeft > 0 ){
while( temp > 0 && text.charAt( temp ) < 48 ) {
temp--; // depends on control dependency: [while], data = [none]
}
while( temp > 0 && text.charAt( temp ) >= 48 ) {
temp--; // depends on control dependency: [while], data = [none]
}
posLeft = ( temp>0 ? temp+1 : 0 ); // depends on control dependency: [while], data = [none]
wordsLeft--; // depends on control dependency: [while], data = [none]
}
// get the right end position
int posRight = pos.getEnd();
temp = posRight;
while( posRight != text.length() && wordsRight > 0 ){
while( temp < text.length() && text.charAt( temp ) < 48 ) {
temp++; // depends on control dependency: [while], data = [none]
}
while( temp < text.length() && text.charAt( temp ) >= 48 ) {
temp++; // depends on control dependency: [while], data = [none]
}
posRight = temp; // depends on control dependency: [while], data = [none]
wordsRight--; // depends on control dependency: [while], data = [none]
}
// retrun a string...
return
text.substring(posLeft, pos.getStart() ) +
text.substring(pos.getEnd(), posRight);
} } |
public class class_name {
Node compile(final Object root)
{
if (compiled == null)
{
compiled = compileExpression(root, this.expr);
parsed = null;
if (this.notifyOnCompiled != null)
this.notifyOnCompiled.accept(this.expr, this);
}
return compiled;
} } | public class class_name {
Node compile(final Object root)
{
if (compiled == null)
{
compiled = compileExpression(root, this.expr); // depends on control dependency: [if], data = [none]
parsed = null; // depends on control dependency: [if], data = [none]
if (this.notifyOnCompiled != null)
this.notifyOnCompiled.accept(this.expr, this);
}
return compiled;
} } |
public class class_name {
protected void diagnoseMultistepList(
int matchCount,
int lengthToTest,
boolean isGlobal)
{
if (matchCount > 0)
{
System.err.print(
"Found multistep matches: " + matchCount + ", " + lengthToTest + " length");
if (isGlobal)
System.err.println(" (global)");
else
System.err.println();
}
} } | public class class_name {
protected void diagnoseMultistepList(
int matchCount,
int lengthToTest,
boolean isGlobal)
{
if (matchCount > 0)
{
System.err.print(
"Found multistep matches: " + matchCount + ", " + lengthToTest + " length"); // depends on control dependency: [if], data = [none]
if (isGlobal)
System.err.println(" (global)");
else
System.err.println();
}
} } |
public class class_name {
public void setExecutionSummaries(java.util.Collection<JobExecutionSummaryForJob> executionSummaries) {
if (executionSummaries == null) {
this.executionSummaries = null;
return;
}
this.executionSummaries = new java.util.ArrayList<JobExecutionSummaryForJob>(executionSummaries);
} } | public class class_name {
public void setExecutionSummaries(java.util.Collection<JobExecutionSummaryForJob> executionSummaries) {
if (executionSummaries == null) {
this.executionSummaries = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.executionSummaries = new java.util.ArrayList<JobExecutionSummaryForJob>(executionSummaries);
} } |
public class class_name {
final void launchIntent(Intent intent) {
try {
rawLaunchIntent(intent);
} catch (ActivityNotFoundException ignored) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.app_name);
builder.setMessage(R.string.msg_intent_failed);
builder.setPositiveButton(R.string.button_ok, null);
builder.show();
}
} } | public class class_name {
final void launchIntent(Intent intent) {
try {
rawLaunchIntent(intent); // depends on control dependency: [try], data = [none]
} catch (ActivityNotFoundException ignored) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.app_name);
builder.setMessage(R.string.msg_intent_failed);
builder.setPositiveButton(R.string.button_ok, null);
builder.show();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
ObjectStreamField[] fields() {
if (fields == null) {
Class<?> forCl = forClass();
if (forCl != null && isSerializable() && !forCl.isArray()) {
buildFieldDescriptors(forCl.getDeclaredFields());
} else {
// Externalizables or arrays do not need FieldDesc info
setFields(NO_FIELDS);
}
}
return fields;
} } | public class class_name {
ObjectStreamField[] fields() {
if (fields == null) {
Class<?> forCl = forClass();
if (forCl != null && isSerializable() && !forCl.isArray()) {
buildFieldDescriptors(forCl.getDeclaredFields()); // depends on control dependency: [if], data = [(forCl]
} else {
// Externalizables or arrays do not need FieldDesc info
setFields(NO_FIELDS); // depends on control dependency: [if], data = [none]
}
}
return fields;
} } |
public class class_name {
protected void ensureNotifications() {
I_CmsNotificationWidget oldWidget = CmsNotification.get().getWidget();
if (oldWidget == null) {
CmsNotificationWidget newWidget = new CmsNotificationWidget();
CmsNotification.get().setWidget(newWidget);
RootPanel.get().add(newWidget);
}
} } | public class class_name {
protected void ensureNotifications() {
I_CmsNotificationWidget oldWidget = CmsNotification.get().getWidget();
if (oldWidget == null) {
CmsNotificationWidget newWidget = new CmsNotificationWidget();
CmsNotification.get().setWidget(newWidget); // depends on control dependency: [if], data = [none]
RootPanel.get().add(newWidget); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int determinePort() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPort();
}
Address address = this.parsedAddresses.get(0);
return address.port;
} } | public class class_name {
public int determinePort() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPort(); // depends on control dependency: [if], data = [none]
}
Address address = this.parsedAddresses.get(0);
return address.port;
} } |
public class class_name {
private void query(String zipcode) {
/* Setup YQL query statement using dynamic zipcode. The statement searches geo.places
for the zipcode and returns XML which includes the WOEID. For more info about YQL go
to: http://developer.yahoo.com/yql/ */
String qry = URLEncoder.encode("SELECT woeid FROM geo.places WHERE text=" + zipcode + " LIMIT 1");
// Generate request URI using the query statement
URL url;
try {
// get URL content
url = new URL("http://query.yahooapis.com/v1/public/yql?q=" + qry);
URLConnection conn = url.openConnection();
InputStream content = conn.getInputStream();
parseResponse(content);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
private void query(String zipcode) {
/* Setup YQL query statement using dynamic zipcode. The statement searches geo.places
for the zipcode and returns XML which includes the WOEID. For more info about YQL go
to: http://developer.yahoo.com/yql/ */
String qry = URLEncoder.encode("SELECT woeid FROM geo.places WHERE text=" + zipcode + " LIMIT 1");
// Generate request URI using the query statement
URL url;
try {
// get URL content
url = new URL("http://query.yahooapis.com/v1/public/yql?q=" + qry);
URLConnection conn = url.openConnection(); // depends on control dependency: [try], data = [none]
InputStream content = conn.getInputStream();
parseResponse(content); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked") //also used by ItemsSketch and ItemsUnion
static <T> void downSamplingMergeInto(final ItemsSketch<T> src, final ItemsSketch<T> tgt) {
final int targetK = tgt.getK();
final int sourceK = src.getK();
if ((sourceK % targetK) != 0) {
throw new SketchesArgumentException(
"source.getK() must equal target.getK() * 2^(nonnegative integer).");
}
final int downFactor = sourceK / targetK;
checkIfPowerOf2(downFactor, "source.getK()/target.getK() ratio");
final int lgDownFactor = Integer.numberOfTrailingZeros(downFactor);
final Object[] sourceLevels = src.getCombinedBuffer(); // aliasing is a bit dangerous
final Object[] sourceBaseBuffer = src.getCombinedBuffer(); // aliasing is a bit dangerous
final long nFinal = tgt.getN() + src.getN();
for (int i = 0; i < src.getBaseBufferCount(); i++) {
tgt.update((T) sourceBaseBuffer[i]);
}
ItemsUpdateImpl.maybeGrowLevels(tgt, nFinal);
final Object[] scratchBuf = new Object[2 * targetK];
final Object[] downBuf = new Object[targetK];
long srcBitPattern = src.getBitPattern();
for (int srcLvl = 0; srcBitPattern != 0L; srcLvl++, srcBitPattern >>>= 1) {
if ((srcBitPattern & 1L) > 0L) {
ItemsMergeImpl.justZipWithStride(
sourceLevels, (2 + srcLvl) * sourceK,
downBuf, 0,
targetK,
downFactor);
ItemsUpdateImpl.inPlacePropagateCarry(
srcLvl + lgDownFactor,
(T[]) downBuf, 0,
(T[]) scratchBuf, 0,
false, tgt);
// won't update target.n_ until the very end
}
}
tgt.n_ = nFinal;
assert (tgt.getN() / (2L * targetK)) == tgt.getBitPattern(); // internal consistency check
final T srcMax = src.getMaxValue();
final T srcMin = src.getMinValue();
final T tgtMax = tgt.getMaxValue();
final T tgtMin = tgt.getMinValue();
if ((srcMax != null) && (tgtMax != null)) {
tgt.maxValue_ = (src.getComparator().compare(srcMax, tgtMax) > 0) ? srcMax : tgtMax;
} //only one could be null
else if (tgtMax == null) { //if srcMax were null we would leave tgt alone
tgt.maxValue_ = srcMax;
}
if ((srcMin != null) && (tgtMin != null)) {
tgt.minValue_ = (src.getComparator().compare(srcMin, tgtMin) > 0) ? tgtMin : srcMin;
} //only one could be null
else if (tgtMin == null) { //if srcMin were null we would leave tgt alone
tgt.minValue_ = srcMin;
}
} } | public class class_name {
@SuppressWarnings("unchecked") //also used by ItemsSketch and ItemsUnion
static <T> void downSamplingMergeInto(final ItemsSketch<T> src, final ItemsSketch<T> tgt) {
final int targetK = tgt.getK();
final int sourceK = src.getK();
if ((sourceK % targetK) != 0) {
throw new SketchesArgumentException(
"source.getK() must equal target.getK() * 2^(nonnegative integer).");
}
final int downFactor = sourceK / targetK;
checkIfPowerOf2(downFactor, "source.getK()/target.getK() ratio");
final int lgDownFactor = Integer.numberOfTrailingZeros(downFactor);
final Object[] sourceLevels = src.getCombinedBuffer(); // aliasing is a bit dangerous
final Object[] sourceBaseBuffer = src.getCombinedBuffer(); // aliasing is a bit dangerous
final long nFinal = tgt.getN() + src.getN();
for (int i = 0; i < src.getBaseBufferCount(); i++) {
tgt.update((T) sourceBaseBuffer[i]); // depends on control dependency: [for], data = [i]
}
ItemsUpdateImpl.maybeGrowLevels(tgt, nFinal);
final Object[] scratchBuf = new Object[2 * targetK];
final Object[] downBuf = new Object[targetK];
long srcBitPattern = src.getBitPattern();
for (int srcLvl = 0; srcBitPattern != 0L; srcLvl++, srcBitPattern >>>= 1) {
if ((srcBitPattern & 1L) > 0L) {
ItemsMergeImpl.justZipWithStride(
sourceLevels, (2 + srcLvl) * sourceK,
downBuf, 0,
targetK,
downFactor); // depends on control dependency: [if], data = [none]
ItemsUpdateImpl.inPlacePropagateCarry(
srcLvl + lgDownFactor,
(T[]) downBuf, 0,
(T[]) scratchBuf, 0,
false, tgt); // depends on control dependency: [if], data = [none]
// won't update target.n_ until the very end
}
}
tgt.n_ = nFinal;
assert (tgt.getN() / (2L * targetK)) == tgt.getBitPattern(); // internal consistency check
final T srcMax = src.getMaxValue();
final T srcMin = src.getMinValue();
final T tgtMax = tgt.getMaxValue();
final T tgtMin = tgt.getMinValue();
if ((srcMax != null) && (tgtMax != null)) {
tgt.maxValue_ = (src.getComparator().compare(srcMax, tgtMax) > 0) ? srcMax : tgtMax; // depends on control dependency: [if], data = [none]
} //only one could be null
else if (tgtMax == null) { //if srcMax were null we would leave tgt alone
tgt.maxValue_ = srcMax; // depends on control dependency: [if], data = [none]
}
if ((srcMin != null) && (tgtMin != null)) {
tgt.minValue_ = (src.getComparator().compare(srcMin, tgtMin) > 0) ? tgtMin : srcMin; // depends on control dependency: [if], data = [none]
} //only one could be null
else if (tgtMin == null) { //if srcMin were null we would leave tgt alone
tgt.minValue_ = srcMin; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EClass getIfcElectricalElement() {
if (ifcElectricalElementEClass == null) {
ifcElectricalElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(195);
}
return ifcElectricalElementEClass;
} } | public class class_name {
public EClass getIfcElectricalElement() {
if (ifcElectricalElementEClass == null) {
ifcElectricalElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(195);
// depends on control dependency: [if], data = [none]
}
return ifcElectricalElementEClass;
} } |
public class class_name {
public void onCloseSession(ExtendedSession session)
{
SessionImpl sessionImpl = (SessionImpl)session;
int length = lockedNodes.size();
if (length > 0)
{
String[] nodeIds = new String[length];
lockedNodes.keySet().toArray(nodeIds);
for (int i = 0; i < length; i++)
{
String nodeId = nodeIds[i];
LockData lock = lockedNodes.remove(nodeId);
if (lock.isSessionScoped() && !pendingLocks.contains(nodeId))
{
try
{
NodeImpl node =
((NodeImpl)sessionImpl.getTransientNodesManager()
.getItemByIdentifier(lock.getNodeIdentifier(), false));
if (node != null)
{
node.unlock();
}
}
catch (UnsupportedRepositoryOperationException e)
{
LOG.error(e.getLocalizedMessage());
}
catch (LockException e)
{
LOG.error(e.getLocalizedMessage());
}
catch (AccessDeniedException e)
{
LOG.error(e.getLocalizedMessage());
}
catch (RepositoryException e)
{
LOG.error(e.getLocalizedMessage());
}
}
}
lockedNodes.clear();
}
pendingLocks.clear();
tokens.clear();
lockManager.closeSessionLockManager(sessionID);
} } | public class class_name {
public void onCloseSession(ExtendedSession session)
{
SessionImpl sessionImpl = (SessionImpl)session;
int length = lockedNodes.size();
if (length > 0)
{
String[] nodeIds = new String[length];
lockedNodes.keySet().toArray(nodeIds);
// depends on control dependency: [if], data = [none]
for (int i = 0; i < length; i++)
{
String nodeId = nodeIds[i];
LockData lock = lockedNodes.remove(nodeId);
if (lock.isSessionScoped() && !pendingLocks.contains(nodeId))
{
try
{
NodeImpl node =
((NodeImpl)sessionImpl.getTransientNodesManager()
.getItemByIdentifier(lock.getNodeIdentifier(), false));
if (node != null)
{
node.unlock();
// depends on control dependency: [if], data = [none]
}
}
catch (UnsupportedRepositoryOperationException e)
{
LOG.error(e.getLocalizedMessage());
}
// depends on control dependency: [catch], data = [none]
catch (LockException e)
{
LOG.error(e.getLocalizedMessage());
}
// depends on control dependency: [catch], data = [none]
catch (AccessDeniedException e)
{
LOG.error(e.getLocalizedMessage());
}
// depends on control dependency: [catch], data = [none]
catch (RepositoryException e)
{
LOG.error(e.getLocalizedMessage());
}
// depends on control dependency: [catch], data = [none]
}
}
lockedNodes.clear();
// depends on control dependency: [if], data = [none]
}
pendingLocks.clear();
tokens.clear();
lockManager.closeSessionLockManager(sessionID);
} } |
public class class_name {
public static DMatrixRMaj insideSpan(DMatrixRMaj[] span , double min , double max , Random rand ) {
DMatrixRMaj A = new DMatrixRMaj(span.length,1);
DMatrixRMaj B = new DMatrixRMaj(span[0].getNumElements(),1);
for( int i = 0; i < span.length; i++ ) {
B.set(span[i]);
double val = rand.nextDouble()*(max-min)+min;
CommonOps_DDRM.scale(val,B);
CommonOps_DDRM.add(A,B,A);
}
return A;
} } | public class class_name {
public static DMatrixRMaj insideSpan(DMatrixRMaj[] span , double min , double max , Random rand ) {
DMatrixRMaj A = new DMatrixRMaj(span.length,1);
DMatrixRMaj B = new DMatrixRMaj(span[0].getNumElements(),1);
for( int i = 0; i < span.length; i++ ) {
B.set(span[i]); // depends on control dependency: [for], data = [i]
double val = rand.nextDouble()*(max-min)+min;
CommonOps_DDRM.scale(val,B); // depends on control dependency: [for], data = [none]
CommonOps_DDRM.add(A,B,A); // depends on control dependency: [for], data = [none]
}
return A;
} } |
public class class_name {
private synchronized Vector resolveAllSubordinateCatalogs(int entityType,
String entityName,
String publicId,
String systemId)
throws MalformedURLException, IOException {
Vector resolutions = new Vector();
for (int catPos = 0; catPos < catalogs.size(); catPos++) {
Resolver c = null;
try {
c = (Resolver) catalogs.elementAt(catPos);
} catch (ClassCastException e) {
String catfile = (String) catalogs.elementAt(catPos);
c = (Resolver) newCatalog();
try {
c.parseCatalog(catfile);
} catch (MalformedURLException mue) {
catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
} catch (FileNotFoundException fnfe) {
catalogManager.debug.message(1, "Failed to load catalog, file not found",
catfile);
} catch (IOException ioe) {
catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
}
catalogs.setElementAt(c, catPos);
}
String resolved = null;
// Ok, now what are we supposed to call here?
if (entityType == DOCTYPE) {
resolved = c.resolveDoctype(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one DOCTYPE resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == DOCUMENT) {
resolved = c.resolveDocument();
if (resolved != null) {
// Only find one DOCUMENT resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == ENTITY) {
resolved = c.resolveEntity(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one ENTITY resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == NOTATION) {
resolved = c.resolveNotation(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one NOTATION resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == PUBLIC) {
resolved = c.resolvePublic(publicId, systemId);
if (resolved != null) {
// Only find one PUBLIC resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == SYSTEM) {
Vector localResolutions = c.resolveAllSystem(systemId);
resolutions = appendVector(resolutions, localResolutions);
break;
} else if (entityType == SYSTEMREVERSE) {
Vector localResolutions = c.resolveAllSystemReverse(systemId);
resolutions = appendVector(resolutions, localResolutions);
}
}
if (resolutions != null) {
return resolutions;
} else {
return null;
}
} } | public class class_name {
private synchronized Vector resolveAllSubordinateCatalogs(int entityType,
String entityName,
String publicId,
String systemId)
throws MalformedURLException, IOException {
Vector resolutions = new Vector();
for (int catPos = 0; catPos < catalogs.size(); catPos++) {
Resolver c = null;
try {
c = (Resolver) catalogs.elementAt(catPos);
} catch (ClassCastException e) {
String catfile = (String) catalogs.elementAt(catPos);
c = (Resolver) newCatalog();
try {
c.parseCatalog(catfile); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException mue) {
catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
} catch (FileNotFoundException fnfe) { // depends on control dependency: [catch], data = [none]
catalogManager.debug.message(1, "Failed to load catalog, file not found",
catfile);
} catch (IOException ioe) { // depends on control dependency: [catch], data = [none]
catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
} // depends on control dependency: [catch], data = [none]
catalogs.setElementAt(c, catPos);
}
String resolved = null;
// Ok, now what are we supposed to call here?
if (entityType == DOCTYPE) {
resolved = c.resolveDoctype(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one DOCTYPE resolution
resolutions.addElement(resolved); // depends on control dependency: [if], data = [(resolved]
return resolutions; // depends on control dependency: [if], data = [none]
}
} else if (entityType == DOCUMENT) {
resolved = c.resolveDocument();
if (resolved != null) {
// Only find one DOCUMENT resolution
resolutions.addElement(resolved); // depends on control dependency: [if], data = [(resolved]
return resolutions; // depends on control dependency: [if], data = [none]
}
} else if (entityType == ENTITY) {
resolved = c.resolveEntity(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one ENTITY resolution
resolutions.addElement(resolved); // depends on control dependency: [if], data = [(resolved]
return resolutions; // depends on control dependency: [if], data = [none]
}
} else if (entityType == NOTATION) {
resolved = c.resolveNotation(entityName,
publicId,
systemId);
if (resolved != null) {
// Only find one NOTATION resolution
resolutions.addElement(resolved); // depends on control dependency: [if], data = [(resolved]
return resolutions; // depends on control dependency: [if], data = [none]
}
} else if (entityType == PUBLIC) {
resolved = c.resolvePublic(publicId, systemId);
if (resolved != null) {
// Only find one PUBLIC resolution
resolutions.addElement(resolved);
return resolutions;
}
} else if (entityType == SYSTEM) {
Vector localResolutions = c.resolveAllSystem(systemId);
resolutions = appendVector(resolutions, localResolutions);
break;
} else if (entityType == SYSTEMREVERSE) {
Vector localResolutions = c.resolveAllSystemReverse(systemId);
resolutions = appendVector(resolutions, localResolutions);
}
}
if (resolutions != null) {
return resolutions;
} else {
return null;
}
} } |
public class class_name {
public T get() {
Object object = null;
try {
ProxyTarget target = locator.locateProxyTarget();
if (target != null) {
try {
object = target.getTarget();
} finally {
if (target instanceof ReleasableProxyTarget) {
// Sadly we don't know much what is done with the target by the caller, so we just release it
// right now
((ReleasableProxyTarget) target).releaseTarget();
}
}
}
} catch (RuntimeException e) {
LOG.trace("locating target failed, will return null then", e);
}
return type.cast(object);
} } | public class class_name {
public T get() {
Object object = null;
try {
ProxyTarget target = locator.locateProxyTarget();
if (target != null) {
try {
object = target.getTarget(); // depends on control dependency: [try], data = [none]
} finally {
if (target instanceof ReleasableProxyTarget) {
// Sadly we don't know much what is done with the target by the caller, so we just release it
// right now
((ReleasableProxyTarget) target).releaseTarget(); // depends on control dependency: [if], data = [none]
}
}
}
} catch (RuntimeException e) {
LOG.trace("locating target failed, will return null then", e);
} // depends on control dependency: [catch], data = [none]
return type.cast(object);
} } |
public class class_name {
protected void _generate(SarlConstructor constructor, PyAppendable it, IExtraLanguageGeneratorContext context) {
if (constructor.isStatic()) {
generateExecutable("___static_init___", constructor, false, false, null, //$NON-NLS-1$
getTypeBuilder().getDocumentation(constructor),
it, context);
it.newLine().append("___static_init___()"); //$NON-NLS-1$
} else {
generateExecutable("__init__", constructor, true, false, null, //$NON-NLS-1$
getTypeBuilder().getDocumentation(constructor),
it, context);
}
} } | public class class_name {
protected void _generate(SarlConstructor constructor, PyAppendable it, IExtraLanguageGeneratorContext context) {
if (constructor.isStatic()) {
generateExecutable("___static_init___", constructor, false, false, null, //$NON-NLS-1$
getTypeBuilder().getDocumentation(constructor),
it, context); // depends on control dependency: [if], data = [none]
it.newLine().append("___static_init___()"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
generateExecutable("__init__", constructor, true, false, null, //$NON-NLS-1$
getTypeBuilder().getDocumentation(constructor),
it, context); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public CompletableFuture<Void> process(Operation operation) {
CompletableFuture<Void> result = new CompletableFuture<>();
if (!isRunning()) {
result.completeExceptionally(new IllegalContainerStateException("OperationProcessor is not running."));
} else {
log.debug("{}: process {}.", this.traceObjectId, operation);
try {
this.operationQueue.add(new CompletableOperation(operation, result));
} catch (Throwable e) {
if (Exceptions.mustRethrow(e)) {
throw e;
}
result.completeExceptionally(e);
}
}
return result;
} } | public class class_name {
public CompletableFuture<Void> process(Operation operation) {
CompletableFuture<Void> result = new CompletableFuture<>();
if (!isRunning()) {
result.completeExceptionally(new IllegalContainerStateException("OperationProcessor is not running.")); // depends on control dependency: [if], data = [none]
} else {
log.debug("{}: process {}.", this.traceObjectId, operation); // depends on control dependency: [if], data = [none]
try {
this.operationQueue.add(new CompletableOperation(operation, result)); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
if (Exceptions.mustRethrow(e)) {
throw e;
}
result.completeExceptionally(e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
private ExtensionUserManagement getExtensionUserManagement() {
if (extensionUsers == null) {
extensionUsers = Control.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class);
}
return extensionUsers;
} } | public class class_name {
private ExtensionUserManagement getExtensionUserManagement() {
if (extensionUsers == null) {
extensionUsers = Control.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class); // depends on control dependency: [if], data = [none]
}
return extensionUsers;
} } |
public class class_name {
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) {
if (session == null) {
return;
}
if (inputStream == null) {
throw new IllegalArgumentException("inputStream must not be null");
}
log.debugf("Attempting to send async binary data to client [%s]", session.getId());
if (session.isOpen()) {
if (this.asyncTimeout != null) {
// TODO: what to do with timeout?
}
CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream);
threadPool.execute(runnable);
}
return;
} } | public class class_name {
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) {
if (session == null) {
return; // depends on control dependency: [if], data = [none]
}
if (inputStream == null) {
throw new IllegalArgumentException("inputStream must not be null");
}
log.debugf("Attempting to send async binary data to client [%s]", session.getId());
if (session.isOpen()) {
if (this.asyncTimeout != null) {
// TODO: what to do with timeout?
}
CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream);
threadPool.execute(runnable); // depends on control dependency: [if], data = [none]
}
return;
} } |
public class class_name {
private static int getHashCode(String buf) {
int hash = 5381;
int len = buf.length();
while (len-- > 0) {
hash = ((hash << 5) + hash) + buf.charAt(len);
}
return hash;
} } | public class class_name {
private static int getHashCode(String buf) {
int hash = 5381;
int len = buf.length();
while (len-- > 0) {
hash = ((hash << 5) + hash) + buf.charAt(len);
// depends on control dependency: [while], data = [none]
}
return hash;
} } |
public class class_name {
public List<VectorLayer> getVectorLayers() {
ArrayList<VectorLayer> list = new ArrayList<VectorLayer>();
for (Layer<?> layer : layers) {
if (layer instanceof VectorLayer) {
list.add((VectorLayer) layer);
}
}
return list;
} } | public class class_name {
public List<VectorLayer> getVectorLayers() {
ArrayList<VectorLayer> list = new ArrayList<VectorLayer>();
for (Layer<?> layer : layers) {
if (layer instanceof VectorLayer) {
list.add((VectorLayer) layer); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
@Override
public boolean validate(List<String> warnings) {
// 插件使用前提是数据库为MySQL
if ("com.mysql.jdbc.Driver".equalsIgnoreCase(this.getContext().getJdbcConnectionConfiguration().getDriverClass()) == false
&& "com.mysql.cj.jdbc.Driver".equalsIgnoreCase(this.getContext().getJdbcConnectionConfiguration().getDriverClass()) == false) {
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件使用前提是数据库为MySQL!");
return false;
}
// 插件是否开启了多sql提交
Properties properties = this.getProperties();
String allowMultiQueries = properties.getProperty(PRO_ALLOW_MULTI_QUERIES);
this.allowMultiQueries = allowMultiQueries == null ? false : StringUtility.isTrue(allowMultiQueries);
if (this.allowMultiQueries) {
// 提示用户注意信息
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件您开启了allowMultiQueries支持,注意在jdbc url 配置中增加“allowMultiQueries=true”支持(不怎么建议使用该功能,开启多sql提交会增加sql注入的风险,请确保你所有sql都使用MyBatis书写,请不要使用statement进行sql提交)!");
}
// 是否允许批量
String allowBatchUpsert = properties.getProperty(PRO_ALLOW_BATCH_UPSERT);
this.allowBatchUpsert = allowBatchUpsert == null ? false : StringUtility.isTrue(allowBatchUpsert);
// 批量时依赖插件 ModelColumnPlugin
if (this.allowBatchUpsert && !PluginTools.checkDependencyPlugin(context, ModelColumnPlugin.class)) {
// 提示用户注意信息
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件您开启了allowBatchUpsert支持,请配置依赖的插件" + ModelColumnPlugin.class.getTypeName() + "!");
}
return super.validate(warnings);
} } | public class class_name {
@Override
public boolean validate(List<String> warnings) {
// 插件使用前提是数据库为MySQL
if ("com.mysql.jdbc.Driver".equalsIgnoreCase(this.getContext().getJdbcConnectionConfiguration().getDriverClass()) == false
&& "com.mysql.cj.jdbc.Driver".equalsIgnoreCase(this.getContext().getJdbcConnectionConfiguration().getDriverClass()) == false) {
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件使用前提是数据库为MySQL!"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [false]
}
// 插件是否开启了多sql提交
Properties properties = this.getProperties();
String allowMultiQueries = properties.getProperty(PRO_ALLOW_MULTI_QUERIES);
this.allowMultiQueries = allowMultiQueries == null ? false : StringUtility.isTrue(allowMultiQueries);
if (this.allowMultiQueries) {
// 提示用户注意信息
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件您开启了allowMultiQueries支持,注意在jdbc url 配置中增加“allowMultiQueries=true”支持(不怎么建议使用该功能,开启多sql提交会增加sql注入的风险,请确保你所有sql都使用MyBatis书写,请不要使用statement进行sql提交)!"); // depends on control dependency: [if], data = [none]
}
// 是否允许批量
String allowBatchUpsert = properties.getProperty(PRO_ALLOW_BATCH_UPSERT);
this.allowBatchUpsert = allowBatchUpsert == null ? false : StringUtility.isTrue(allowBatchUpsert);
// 批量时依赖插件 ModelColumnPlugin
if (this.allowBatchUpsert && !PluginTools.checkDependencyPlugin(context, ModelColumnPlugin.class)) {
// 提示用户注意信息
warnings.add("itfsw:插件" + this.getClass().getTypeName() + "插件您开启了allowBatchUpsert支持,请配置依赖的插件" + ModelColumnPlugin.class.getTypeName() + "!"); // depends on control dependency: [if], data = [none]
}
return super.validate(warnings);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.