code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static DMatrixRMaj transpose(DMatrixRMaj A, DMatrixRMaj A_tran)
{
if( A_tran == null ) {
A_tran = new DMatrixRMaj(A.numCols,A.numRows);
} else {
if( A.numRows != A_tran.numCols || A.numCols != A_tran.numRows ) {
throw new MatrixDimensionException("Incompatible matrix dimensions");
}
}
if( A.numRows > EjmlParameters.TRANSPOSE_SWITCH &&
A.numCols > EjmlParameters.TRANSPOSE_SWITCH )
TransposeAlgs_DDRM.block(A,A_tran,EjmlParameters.BLOCK_WIDTH);
else
TransposeAlgs_DDRM.standard(A,A_tran);
return A_tran;
} }
|
public class class_name {
public static DMatrixRMaj transpose(DMatrixRMaj A, DMatrixRMaj A_tran)
{
if( A_tran == null ) {
A_tran = new DMatrixRMaj(A.numCols,A.numRows); // depends on control dependency: [if], data = [none]
} else {
if( A.numRows != A_tran.numCols || A.numCols != A_tran.numRows ) {
throw new MatrixDimensionException("Incompatible matrix dimensions");
}
}
if( A.numRows > EjmlParameters.TRANSPOSE_SWITCH &&
A.numCols > EjmlParameters.TRANSPOSE_SWITCH )
TransposeAlgs_DDRM.block(A,A_tran,EjmlParameters.BLOCK_WIDTH);
else
TransposeAlgs_DDRM.standard(A,A_tran);
return A_tran;
} }
|
public class class_name {
protected JSONObject getDetectorOptions(Configuration pConfig, LogHandler pLogHandler) {
String options = pConfig.get(ConfigKey.DETECTOR_OPTIONS);
try {
if (options != null) {
JSONObject opts = (JSONObject) new JSONParser().parse(options);
return (JSONObject) opts.get(getProduct());
}
return null;
} catch (ParseException e) {
pLogHandler.error("Could not parse detector options '" + options + "' as JSON object: " + e,e);
}
return null;
} }
|
public class class_name {
protected JSONObject getDetectorOptions(Configuration pConfig, LogHandler pLogHandler) {
String options = pConfig.get(ConfigKey.DETECTOR_OPTIONS);
try {
if (options != null) {
JSONObject opts = (JSONObject) new JSONParser().parse(options);
return (JSONObject) opts.get(getProduct()); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
pLogHandler.error("Could not parse detector options '" + options + "' as JSON object: " + e,e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public boolean onDelete()
{
Record record = this.getMainRecord();
if (record == null)
return false;
if (record.getEditMode() == Constants.EDIT_NONE)
return true;
if (record.getEditMode() == Constants.EDIT_ADD)
{ // If they're adding, can't delete nothing!
this.onRefresh();
return true;
}
try {
if (record.getEditMode() != Constants.EDIT_IN_PROGRESS)
record.edit();
record.remove();
record.addNew();
this.clearStatusText();
} catch(DBException ex) {
this.displayError(ex);
return false;
}
return true;
} }
|
public class class_name {
public boolean onDelete()
{
Record record = this.getMainRecord();
if (record == null)
return false;
if (record.getEditMode() == Constants.EDIT_NONE)
return true;
if (record.getEditMode() == Constants.EDIT_ADD)
{ // If they're adding, can't delete nothing!
this.onRefresh(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
try {
if (record.getEditMode() != Constants.EDIT_IN_PROGRESS)
record.edit();
record.remove(); // depends on control dependency: [try], data = [none]
record.addNew(); // depends on control dependency: [try], data = [none]
this.clearStatusText(); // depends on control dependency: [try], data = [none]
} catch(DBException ex) {
this.displayError(ex);
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
public Proxy setType( String type )
{
if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) )
{
return this;
}
return new Proxy( type, host, port, auth );
} }
|
public class class_name {
public Proxy setType( String type )
{
if ( this.type.equals( type ) || ( type == null && this.type.length() <= 0 ) )
{
return this; // depends on control dependency: [if], data = [none]
}
return new Proxy( type, host, port, auth );
} }
|
public class class_name {
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
public IBaseBundle processMessage(
HttpServletRequest theServletRequest,
RequestDetails theRequestDetails,
@OperationParam(name = "content", min = 1, max = 1)
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
Bundle theMessageToProcess
) {
startRequest(theServletRequest);
try {
return getDao().processMessage(theRequestDetails, theMessageToProcess);
} finally {
endRequest(theServletRequest);
}
} }
|
public class class_name {
@Operation(name = JpaConstants.OPERATION_PROCESS_MESSAGE, idempotent = false)
public IBaseBundle processMessage(
HttpServletRequest theServletRequest,
RequestDetails theRequestDetails,
@OperationParam(name = "content", min = 1, max = 1)
@Description(formalDefinition = "The message to process (or, if using asynchronous messaging, it may be a response message to accept)")
Bundle theMessageToProcess
) {
startRequest(theServletRequest);
try {
return getDao().processMessage(theRequestDetails, theMessageToProcess); // depends on control dependency: [try], data = [none]
} finally {
endRequest(theServletRequest);
}
} }
|
public class class_name {
public static void disableTlsServerCertificateCheck(Client client) {
if (!(client.getConduit() instanceof HTTPConduit)) {
log.warn("Conduit not of type HTTPConduit (" + client.getConduit().getClass().getName() + ") , skip disabling server certification validation.");
return;
}
log.warn("Disables server certification validation for: " + client.getEndpoint().getEndpointInfo().getAddress());
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustAllCerts = new TrustManager[] { new FakeTrustManager() };
tlsParams.setTrustManagers(trustAllCerts);
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
} }
|
public class class_name {
public static void disableTlsServerCertificateCheck(Client client) {
if (!(client.getConduit() instanceof HTTPConduit)) {
log.warn("Conduit not of type HTTPConduit (" + client.getConduit().getClass().getName() + ") , skip disabling server certification validation."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
log.warn("Disables server certification validation for: " + client.getEndpoint().getEndpointInfo().getAddress());
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = new TLSClientParameters();
TrustManager[] trustAllCerts = new TrustManager[] { new FakeTrustManager() };
tlsParams.setTrustManagers(trustAllCerts);
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
} }
|
public class class_name {
public static final double[] replaceValues(double[] v, double oldValue, double newValue) {
double[] ret = new double[v.length];
for (int i = 0; i < v.length; i++) {
double vi = v[i];
if (Double.compare(oldValue, vi) != 0) {
// no substitution
ret[i] = vi;
} else {
ret[i] = newValue;
}
}
return ret;
} }
|
public class class_name {
public static final double[] replaceValues(double[] v, double oldValue, double newValue) {
double[] ret = new double[v.length];
for (int i = 0; i < v.length; i++) {
double vi = v[i];
if (Double.compare(oldValue, vi) != 0) {
// no substitution
ret[i] = vi;
// depends on control dependency: [if], data = [none]
} else {
ret[i] = newValue;
// depends on control dependency: [if], data = [none]
}
}
return ret;
} }
|
public class class_name {
public static boolean isValidId(String id) {
if(id == null) return false;
int len = id.length();
if(len == 0) return false;
// First character must be [A-Za-z]
char ch = id.charAt(0);
if(
(ch<'A' || ch>'Z')
&& (ch<'a' || ch>'z')
) {
return false;
}
// Remaining characters must match [A-Za-z0-9:_.-]
for(int i = 1; i < len; i++) {
if(
(ch < 'A' || ch > 'Z')
&& (ch < 'a' || ch > 'z')
&& (ch < '0' || ch > '9')
&& ch != ':'
&& ch != '_'
&& ch != '.'
&& ch != '-'
) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean isValidId(String id) {
if(id == null) return false;
int len = id.length();
if(len == 0) return false;
// First character must be [A-Za-z]
char ch = id.charAt(0);
if(
(ch<'A' || ch>'Z')
&& (ch<'a' || ch>'z')
) {
return false; // depends on control dependency: [if], data = []
}
// Remaining characters must match [A-Za-z0-9:_.-]
for(int i = 1; i < len; i++) {
if(
(ch < 'A' || ch > 'Z')
&& (ch < 'a' || ch > 'z')
&& (ch < '0' || ch > '9')
&& ch != ':'
&& ch != '_'
&& ch != '.'
&& ch != '-'
) {
return false; // depends on control dependency: [if], data = []
}
}
return true;
} }
|
public class class_name {
public CompoundTag add(Tag ch) {
subElements.put(ch.getName(), ch);
long sz = getSize() + ch.totalSize();
byte length = 1;
long v = (sz + 1) >> BIT_IN_BYTE;
while (v > 0) {
length++;
v = v >> BIT_IN_BYTE;
}
size = new VINT(0L, length, sz);
return this;
} }
|
public class class_name {
public CompoundTag add(Tag ch) {
subElements.put(ch.getName(), ch);
long sz = getSize() + ch.totalSize();
byte length = 1;
long v = (sz + 1) >> BIT_IN_BYTE;
while (v > 0) {
length++; // depends on control dependency: [while], data = [none]
v = v >> BIT_IN_BYTE; // depends on control dependency: [while], data = [none]
}
size = new VINT(0L, length, sz);
return this;
} }
|
public class class_name {
public void setMax(int max) {
if (!(max <= 0)) { // Check to make sure it's greater than zero
if (max <= mProgress) {
mProgress = 0; // If the new max is less than current progress, set progress to zero
if (mOnCircularSeekBarChangeListener != null) {
mOnCircularSeekBarChangeListener.onProgressChanged(this, mProgress, false);
}
}
mMax = max;
recalculateAll();
invalidate();
}
} }
|
public class class_name {
public void setMax(int max) {
if (!(max <= 0)) { // Check to make sure it's greater than zero
if (max <= mProgress) {
mProgress = 0; // If the new max is less than current progress, set progress to zero // depends on control dependency: [if], data = [none]
if (mOnCircularSeekBarChangeListener != null) {
mOnCircularSeekBarChangeListener.onProgressChanged(this, mProgress, false); // depends on control dependency: [if], data = [none]
}
}
mMax = max; // depends on control dependency: [if], data = [none]
recalculateAll(); // depends on control dependency: [if], data = [none]
invalidate(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean optimizeSort(OClass iSchemaClass) {
OIndexCursor cursor = getOptimizedSortCursor(iSchemaClass);
if (cursor != null) {
fetchValuesFromIndexCursor(cursor);
return true;
}
return false;
} }
|
public class class_name {
private boolean optimizeSort(OClass iSchemaClass) {
OIndexCursor cursor = getOptimizedSortCursor(iSchemaClass);
if (cursor != null) {
fetchValuesFromIndexCursor(cursor);
// depends on control dependency: [if], data = [(cursor]
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
void removeOutStandingDatanodes(boolean logOutStandingOnly) {
try {
removeOutstandingDatanodesInternal(outStandingHeartbeats, logOutStandingOnly);
removeOutstandingDatanodesInternal(outStandingReports, logOutStandingOnly);
} catch (Exception e) {
LOG.warn(
"Failover - caught exception when removing outstanding datanodes", e);
}
} }
|
public class class_name {
void removeOutStandingDatanodes(boolean logOutStandingOnly) {
try {
removeOutstandingDatanodesInternal(outStandingHeartbeats, logOutStandingOnly); // depends on control dependency: [try], data = [none]
removeOutstandingDatanodesInternal(outStandingReports, logOutStandingOnly); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn(
"Failover - caught exception when removing outstanding datanodes", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static final Parser<Date> instance() { // NOPMD it's thread save!
if (DateTimeLocalParser.instanceParser == null) {
synchronized (DateTimeLocalParser.class) {
if (DateTimeLocalParser.instanceParser == null) {
DateTimeLocalParser.instanceParser = new DateTimeLocalParser("yyyy-MM-dd'T'HH:mm:ss");
}
}
}
return DateTimeLocalParser.instanceParser;
} }
|
public class class_name {
public static final Parser<Date> instance() { // NOPMD it's thread save!
if (DateTimeLocalParser.instanceParser == null) {
synchronized (DateTimeLocalParser.class) { // depends on control dependency: [if], data = [none]
if (DateTimeLocalParser.instanceParser == null) {
DateTimeLocalParser.instanceParser = new DateTimeLocalParser("yyyy-MM-dd'T'HH:mm:ss"); // depends on control dependency: [if], data = [none]
}
}
}
return DateTimeLocalParser.instanceParser;
} }
|
public class class_name {
private Vector getAllTables() {
Vector result = new Vector(20);
try {
if (cConn == null) {
return null;
}
dbmeta = cConn.getMetaData();
String[] tableTypes = { "TABLE" };
ResultSet allTables = dbmeta.getTables(null, null, null,
tableTypes);
while (allTables.next()) {
String aktTable = allTables.getString("TABLE_NAME");
ResultSet primKeys = dbmeta.getPrimaryKeys(null, null,
aktTable);
// take only table with a primary key
if (primKeys.next()) {
result.addElement(aktTable);
}
primKeys.close();
}
allTables.close();
} catch (SQLException e) {
// System.out.println("SQL Exception: " + e.getMessage());
}
return result;
} }
|
public class class_name {
private Vector getAllTables() {
Vector result = new Vector(20);
try {
if (cConn == null) {
return null; // depends on control dependency: [if], data = [none]
}
dbmeta = cConn.getMetaData(); // depends on control dependency: [try], data = [none]
String[] tableTypes = { "TABLE" };
ResultSet allTables = dbmeta.getTables(null, null, null,
tableTypes);
while (allTables.next()) {
String aktTable = allTables.getString("TABLE_NAME");
ResultSet primKeys = dbmeta.getPrimaryKeys(null, null,
aktTable);
// take only table with a primary key
if (primKeys.next()) {
result.addElement(aktTable); // depends on control dependency: [if], data = [none]
}
primKeys.close(); // depends on control dependency: [while], data = [none]
}
allTables.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// System.out.println("SQL Exception: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
public void update(ChannelData channelData) {
synchronized (this.udpChannelConfig) {
// can't do two updates at the same time
try {
this.udpChannelConfig.setChannelData(channelData);
} catch (ChannelException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Error updating config:" + e.getMessage());
}
}
}
} }
|
public class class_name {
public void update(ChannelData channelData) {
synchronized (this.udpChannelConfig) {
// can't do two updates at the same time
try {
this.udpChannelConfig.setChannelData(channelData); // depends on control dependency: [try], data = [none]
} catch (ChannelException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Error updating config:" + e.getMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public synchronized void write(int b) throws IOException {
eventStartWrite();
try {
sum.update(b);
buf[count++] = (byte) b;
if (bytesSentInChunk + count == buf.length) {
flushBuffer(true, shouldKeepPartialChunkData());
}
} finally {
eventEndWrite();
}
} }
|
public class class_name {
public synchronized void write(int b) throws IOException {
eventStartWrite();
try {
sum.update(b);
buf[count++] = (byte) b;
if (bytesSentInChunk + count == buf.length) {
flushBuffer(true, shouldKeepPartialChunkData()); // depends on control dependency: [if], data = [none]
}
} finally {
eventEndWrite();
}
} }
|
public class class_name {
public static String compressChars(final String s, final char c) {
int len = s.length();
StringBuilder sb = new StringBuilder(len);
boolean wasChar = false;
for (int i = 0; i < len; i++) {
char c1 = s.charAt(i);
if (c1 == c) {
if (wasChar) {
continue;
}
wasChar = true;
} else {
wasChar = false;
}
sb.append(c1);
}
if (sb.length() == len) {
return s;
}
return sb.toString();
} }
|
public class class_name {
public static String compressChars(final String s, final char c) {
int len = s.length();
StringBuilder sb = new StringBuilder(len);
boolean wasChar = false;
for (int i = 0; i < len; i++) {
char c1 = s.charAt(i);
if (c1 == c) {
if (wasChar) {
continue;
}
wasChar = true; // depends on control dependency: [if], data = [none]
} else {
wasChar = false; // depends on control dependency: [if], data = [none]
}
sb.append(c1); // depends on control dependency: [for], data = [none]
}
if (sb.length() == len) {
return s; // depends on control dependency: [if], data = [none]
}
return sb.toString();
} }
|
public class class_name {
public String getStepProperty(String nameParam)
{
if(this.getStepProperties() == null || this.getStepProperties().isEmpty())
{
return null;
}
if(nameParam == null || nameParam.trim().isEmpty())
{
return null;
}
String paramLower = nameParam.toLowerCase();
for(StepProperty stepProperty : this.getStepProperties())
{
if(stepProperty.getName().toLowerCase().equals(paramLower))
{
return stepProperty.getValue();
}
}
return null;
} }
|
public class class_name {
public String getStepProperty(String nameParam)
{
if(this.getStepProperties() == null || this.getStepProperties().isEmpty())
{
return null; // depends on control dependency: [if], data = [none]
}
if(nameParam == null || nameParam.trim().isEmpty())
{
return null; // depends on control dependency: [if], data = [none]
}
String paramLower = nameParam.toLowerCase();
for(StepProperty stepProperty : this.getStepProperties())
{
if(stepProperty.getName().toLowerCase().equals(paramLower))
{
return stepProperty.getValue(); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public Double getColumnValueAsDouble(final int col, final double defaultValue) {
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
}
return value;
} }
|
public class class_name {
public Double getColumnValueAsDouble(final int col, final double defaultValue) {
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
// depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
private void installShutdownHook() {
if (shutdownHook == null) {
this.shutdownHook = ShutdownHookUtil.addShutdownHook(this::dispose, getClass().getSimpleName(), LOG);
}
} }
|
public class class_name {
private void installShutdownHook() {
if (shutdownHook == null) {
this.shutdownHook = ShutdownHookUtil.addShutdownHook(this::dispose, getClass().getSimpleName(), LOG); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buffer.append(index++ > 0 ? ", :" : ":");
buffer.append(getSimpleName(parameterType));
}
}
buffer.append("):");
buffer.append(returnType == null || Void.class.equals(returnType) ? "void" : getSimpleName(returnType));
return buffer.toString();
} }
|
public class class_name {
protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buffer.append(index++ > 0 ? ", :" : ":"); // depends on control dependency: [for], data = [none]
buffer.append(getSimpleName(parameterType)); // depends on control dependency: [for], data = [parameterType]
}
}
buffer.append("):");
buffer.append(returnType == null || Void.class.equals(returnType) ? "void" : getSimpleName(returnType));
return buffer.toString();
} }
|
public class class_name {
@Override
protected final void initialize(boolean reactivate) throws RemoteException, InvocationTargetException {
// ---------------------------------------------------------
// Set state to PRE_CREATE so only methods that we permitted
// to be called during dependency injection are allowed and
// those methods that are not allowed (e.g. SessionContext.lookup)
// result in IllegalStateException.
// ---------------------------------------------------------
state = PRE_CREATE;
// Not a home bean, so set the BeanId for the SLSB.
BeanMetaData bmd = home.beanMetaData;
setId(home.ivStatelessId);
// We may have InterceptorMetaData to process.
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
// F743-21481
// Created new try/catch block to ensure that both the creation of the interceptor
// classes and the injecting of the bean class itself inside run inside the
// scope of our location transaction. Previously, the creation of the
// interceptors and the injection of those interceptors took place at
// different points in time, and so the creation of the interceptor
// classes was not under the scope of the local tran. Now, however, the
// creation of the interceptor classes and the injection into them occur
// at the same time, and so it must be covered by the local tran.
//
// d578360 - For other bean types, the local transaction surrounds
// injection methods and PostConstruct lifecycle methods. Because
// singleton lifecycle methods run in a defined transaction context,
// we only need the local transaction for injection methods.
CallbackContextHelper contextHelper = new CallbackContextHelper(this);
contextHelper.begin(CallbackContextHelper.Tx.LTC,
CallbackContextHelper.Contexts.CallbackBean);
try {
createInterceptorsAndInstance(contextHelper);
// Singleton do not support 2.1 client view, so we do not need to ever
// call setSessionContext method, so just perform dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this);
} finally {
contextHelper.complete(true);
}
// ---------------------------------------------------------
// Now that dependencies injection has occured, change state
// to CREATING state to allow additional methods to be called by the
// PostConstruct interceptor methods (e.g. lookup method).
// ---------------------------------------------------------
setState(CREATING);
//-------------------------------------------------------------------
// Call PostConstruct interceptor method if necessary. Note, Singleton
// does not have any EJB 2.1 client view, so not reason to worry about
// calling ejbCreate method.
//-------------------------------------------------------------------
if (imd != null && ivCallbackKind == CallbackKind.InvocationContext) // d402681 // d571981
{
// This is a 3.1 Singleton that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is at least 1
// PostConstruct interceptor.
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
callTransactionalLifecycleInterceptors(proxies, LifecycleInterceptorWrapper.MID_POST_CONSTRUCT); // F743-1751
}
}
//---------------------------------------------------------
// Now that create has completed, change state to METHOD_READY.
//---------------------------------------------------------
setState(METHOD_READY);
} }
|
public class class_name {
@Override
protected final void initialize(boolean reactivate) throws RemoteException, InvocationTargetException {
// ---------------------------------------------------------
// Set state to PRE_CREATE so only methods that we permitted
// to be called during dependency injection are allowed and
// those methods that are not allowed (e.g. SessionContext.lookup)
// result in IllegalStateException.
// ---------------------------------------------------------
state = PRE_CREATE;
// Not a home bean, so set the BeanId for the SLSB.
BeanMetaData bmd = home.beanMetaData;
setId(home.ivStatelessId);
// We may have InterceptorMetaData to process.
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
// F743-21481
// Created new try/catch block to ensure that both the creation of the interceptor
// classes and the injecting of the bean class itself inside run inside the
// scope of our location transaction. Previously, the creation of the
// interceptors and the injection of those interceptors took place at
// different points in time, and so the creation of the interceptor
// classes was not under the scope of the local tran. Now, however, the
// creation of the interceptor classes and the injection into them occur
// at the same time, and so it must be covered by the local tran.
//
// d578360 - For other bean types, the local transaction surrounds
// injection methods and PostConstruct lifecycle methods. Because
// singleton lifecycle methods run in a defined transaction context,
// we only need the local transaction for injection methods.
CallbackContextHelper contextHelper = new CallbackContextHelper(this);
contextHelper.begin(CallbackContextHelper.Tx.LTC,
CallbackContextHelper.Contexts.CallbackBean);
try {
createInterceptorsAndInstance(contextHelper);
// Singleton do not support 2.1 client view, so we do not need to ever
// call setSessionContext method, so just perform dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this);
} finally {
contextHelper.complete(true);
}
// ---------------------------------------------------------
// Now that dependencies injection has occured, change state
// to CREATING state to allow additional methods to be called by the
// PostConstruct interceptor methods (e.g. lookup method).
// ---------------------------------------------------------
setState(CREATING);
//-------------------------------------------------------------------
// Call PostConstruct interceptor method if necessary. Note, Singleton
// does not have any EJB 2.1 client view, so not reason to worry about
// calling ejbCreate method.
//-------------------------------------------------------------------
if (imd != null && ivCallbackKind == CallbackKind.InvocationContext) // d402681 // d571981
{
// This is a 3.1 Singleton that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is at least 1
// PostConstruct interceptor.
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
callTransactionalLifecycleInterceptors(proxies, LifecycleInterceptorWrapper.MID_POST_CONSTRUCT); // F743-1751 // depends on control dependency: [if], data = [(proxies]
}
}
//---------------------------------------------------------
// Now that create has completed, change state to METHOD_READY.
//---------------------------------------------------------
setState(METHOD_READY);
} }
|
public class class_name {
public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setSnapClosedSize(snapClosedSize);
}
} }
|
public class class_name {
public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setSnapClosedSize(snapClosedSize); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Bundle getBundle(String bundleName) {
final String sourceMethod = "getBundle"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(FallbackBundleResolver.class.getName(), sourceMethod, new Object[]{bundleName});
}
Bundle result = Platform.getBundle(bundleName);
if (isTraceLogging) {
log.exiting(FallbackBundleResolver.class.getName(), sourceMethod, result);
}
return result;
} }
|
public class class_name {
@Override
public Bundle getBundle(String bundleName) {
final String sourceMethod = "getBundle"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(FallbackBundleResolver.class.getName(), sourceMethod, new Object[]{bundleName});
// depends on control dependency: [if], data = [none]
}
Bundle result = Platform.getBundle(bundleName);
if (isTraceLogging) {
log.exiting(FallbackBundleResolver.class.getName(), sourceMethod, result);
// depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public Embeddable<OrmDescriptor> getOrCreateEmbeddable()
{
List<Node> nodeList = model.get("embeddable");
if (nodeList != null && nodeList.size() > 0)
{
return new EmbeddableImpl<OrmDescriptor>(this, "embeddable", model, nodeList.get(0));
}
return createEmbeddable();
} }
|
public class class_name {
public Embeddable<OrmDescriptor> getOrCreateEmbeddable()
{
List<Node> nodeList = model.get("embeddable");
if (nodeList != null && nodeList.size() > 0)
{
return new EmbeddableImpl<OrmDescriptor>(this, "embeddable", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createEmbeddable();
} }
|
public class class_name {
public static java.sql.Timestamp toTimestamp(Object value) {
if (value == null) {
return null;
} else if (value instanceof java.sql.Timestamp) {
return (java.sql.Timestamp) value;
} else if (value instanceof java.util.Date) {
return new java.sql.Timestamp(((java.util.Date) value).getTime());
} else if (value instanceof Number) {
return new java.sql.Timestamp(((Number) value).longValue());
} else {
return java.sql.Timestamp.valueOf(value.toString().trim());
}
} }
|
public class class_name {
public static java.sql.Timestamp toTimestamp(Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (value instanceof java.sql.Timestamp) {
return (java.sql.Timestamp) value; // depends on control dependency: [if], data = [none]
} else if (value instanceof java.util.Date) {
return new java.sql.Timestamp(((java.util.Date) value).getTime()); // depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
return new java.sql.Timestamp(((Number) value).longValue()); // depends on control dependency: [if], data = [none]
} else {
return java.sql.Timestamp.valueOf(value.toString().trim()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@When("^I execute an elasticsearch query over index '(.*?)' and mapping '(.*?)' and column '(.*?)' with value '(.*?)' to '(.*?)'$")
public void elasticSearchQueryWithFilter(String indexName, String mappingName, String
columnName, String filterType, String value) {
try {
commonspec.setResultsType("elasticsearch");
commonspec.setElasticsearchResults(
commonspec.getElasticSearchClient()
.searchSimpleFilterElasticsearchQuery(indexName, mappingName, columnName,
value, filterType)
);
} catch (Exception e) {
commonspec.getLogger().debug("Exception captured");
commonspec.getLogger().debug(e.toString());
commonspec.getExceptions().add(e);
}
} }
|
public class class_name {
@When("^I execute an elasticsearch query over index '(.*?)' and mapping '(.*?)' and column '(.*?)' with value '(.*?)' to '(.*?)'$")
public void elasticSearchQueryWithFilter(String indexName, String mappingName, String
columnName, String filterType, String value) {
try {
commonspec.setResultsType("elasticsearch"); // depends on control dependency: [try], data = [none]
commonspec.setElasticsearchResults(
commonspec.getElasticSearchClient()
.searchSimpleFilterElasticsearchQuery(indexName, mappingName, columnName,
value, filterType)
); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
commonspec.getLogger().debug("Exception captured");
commonspec.getLogger().debug(e.toString());
commonspec.getExceptions().add(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws FHIRException {
if (value == null) {
// deleting the extension
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl()))
((BackboneElement) element).getModifierExtension().remove(e);
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl()))
element.getExtension().remove(e);
}
} else {
// it would probably be easier to delete and then create, but this would re-order the extensions
// not that order matters, but we'll preserve it anyway
boolean found = false;
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl())) {
if (!modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
e.setValue(value);
found = true;
}
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl())) {
if (modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
e.setValue(value);
found = true;
}
}
if (!found) {
Extension ex = new Extension().setUrl(uri).setValue(value);
if (modifier) {
if (!(element instanceof BackboneElement))
throw new FHIRException("Error adding extension \""+uri+"\": extension is marked as a modifier, but element is not a backbone element");
((BackboneElement) element).getModifierExtension().add(ex);
} else {
element.getExtension().add(ex);
}
}
}
} }
|
public class class_name {
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws FHIRException {
if (value == null) {
// deleting the extension
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl()))
((BackboneElement) element).getModifierExtension().remove(e);
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl()))
element.getExtension().remove(e);
}
} else {
// it would probably be easier to delete and then create, but this would re-order the extensions
// not that order matters, but we'll preserve it anyway
boolean found = false;
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl())) {
if (!modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
e.setValue(value);
// depends on control dependency: [if], data = [none]
found = true;
// depends on control dependency: [if], data = [none]
}
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl())) {
if (modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
e.setValue(value);
// depends on control dependency: [if], data = [none]
found = true;
// depends on control dependency: [if], data = [none]
}
}
if (!found) {
Extension ex = new Extension().setUrl(uri).setValue(value);
if (modifier) {
if (!(element instanceof BackboneElement))
throw new FHIRException("Error adding extension \""+uri+"\": extension is marked as a modifier, but element is not a backbone element");
((BackboneElement) element).getModifierExtension().add(ex);
// depends on control dependency: [if], data = [none]
} else {
element.getExtension().add(ex);
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public void setContainers(java.util.Collection<ModelPackageContainerDefinition> containers) {
if (containers == null) {
this.containers = null;
return;
}
this.containers = new java.util.ArrayList<ModelPackageContainerDefinition>(containers);
} }
|
public class class_name {
public void setContainers(java.util.Collection<ModelPackageContainerDefinition> containers) {
if (containers == null) {
this.containers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.containers = new java.util.ArrayList<ModelPackageContainerDefinition>(containers);
} }
|
public class class_name {
protected R setCollectionId(String id) {
JsonArray jsonArray = new JsonArray();
if (!TextUtils.isEmpty(id)) {
BoxCollection col = BoxCollection.createFromId(id);
jsonArray.add(col.toJsonObject());
}
mBodyMap.put(FIELD_COLLECTIONS, jsonArray);
return (R) this;
} }
|
public class class_name {
protected R setCollectionId(String id) {
JsonArray jsonArray = new JsonArray();
if (!TextUtils.isEmpty(id)) {
BoxCollection col = BoxCollection.createFromId(id);
jsonArray.add(col.toJsonObject()); // depends on control dependency: [if], data = [none]
}
mBodyMap.put(FIELD_COLLECTIONS, jsonArray);
return (R) this;
} }
|
public class class_name {
public boolean isJavaInheritance()
{
if(javaInheritance == null)
{
javaInheritance = getClassDescriptor().getSuperClassDescriptor().getClassOfObject()
.isAssignableFrom(getClassDescriptor().getClassOfObject()) ? Boolean.TRUE : Boolean.FALSE;
}
return javaInheritance.booleanValue();
} }
|
public class class_name {
public boolean isJavaInheritance()
{
if(javaInheritance == null)
{
javaInheritance = getClassDescriptor().getSuperClassDescriptor().getClassOfObject()
.isAssignableFrom(getClassDescriptor().getClassOfObject()) ? Boolean.TRUE : Boolean.FALSE;
// depends on control dependency: [if], data = [none]
}
return javaInheritance.booleanValue();
} }
|
public class class_name {
public synchronized Table<V> setCellSelection(boolean cellSelection) {
this.cellSelection = cellSelection;
if(cellSelection && selectedColumn == -1) {
selectedColumn = 0;
}
else if(!cellSelection) {
selectedColumn = -1;
}
return this;
} }
|
public class class_name {
public synchronized Table<V> setCellSelection(boolean cellSelection) {
this.cellSelection = cellSelection;
if(cellSelection && selectedColumn == -1) {
selectedColumn = 0; // depends on control dependency: [if], data = [none]
}
else if(!cellSelection) {
selectedColumn = -1; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public void transmit(final int msgTypeId, final DirectBuffer srcBuffer, final int srcIndex, final int length)
{
checkTypeId(msgTypeId);
checkMessageLength(length);
final AtomicBuffer buffer = this.buffer;
long currentTail = buffer.getLong(tailCounterIndex);
int recordOffset = (int)currentTail & (capacity - 1);
final int recordLength = HEADER_LENGTH + length;
final int recordLengthAligned = BitUtil.align(recordLength, RECORD_ALIGNMENT);
final long newTail = currentTail + recordLengthAligned;
final int toEndOfBuffer = capacity - recordOffset;
if (toEndOfBuffer < recordLengthAligned)
{
signalTailIntent(buffer, newTail + toEndOfBuffer);
insertPaddingRecord(buffer, recordOffset, toEndOfBuffer);
currentTail += toEndOfBuffer;
recordOffset = 0;
}
else
{
signalTailIntent(buffer, newTail);
}
buffer.putInt(lengthOffset(recordOffset), recordLength);
buffer.putInt(typeOffset(recordOffset), msgTypeId);
buffer.putBytes(msgOffset(recordOffset), srcBuffer, srcIndex, length);
buffer.putLong(latestCounterIndex, currentTail);
buffer.putLongOrdered(tailCounterIndex, currentTail + recordLengthAligned);
} }
|
public class class_name {
public void transmit(final int msgTypeId, final DirectBuffer srcBuffer, final int srcIndex, final int length)
{
checkTypeId(msgTypeId);
checkMessageLength(length);
final AtomicBuffer buffer = this.buffer;
long currentTail = buffer.getLong(tailCounterIndex);
int recordOffset = (int)currentTail & (capacity - 1);
final int recordLength = HEADER_LENGTH + length;
final int recordLengthAligned = BitUtil.align(recordLength, RECORD_ALIGNMENT);
final long newTail = currentTail + recordLengthAligned;
final int toEndOfBuffer = capacity - recordOffset;
if (toEndOfBuffer < recordLengthAligned)
{
signalTailIntent(buffer, newTail + toEndOfBuffer); // depends on control dependency: [if], data = [none]
insertPaddingRecord(buffer, recordOffset, toEndOfBuffer); // depends on control dependency: [if], data = [none]
currentTail += toEndOfBuffer; // depends on control dependency: [if], data = [none]
recordOffset = 0; // depends on control dependency: [if], data = [none]
}
else
{
signalTailIntent(buffer, newTail); // depends on control dependency: [if], data = [none]
}
buffer.putInt(lengthOffset(recordOffset), recordLength);
buffer.putInt(typeOffset(recordOffset), msgTypeId);
buffer.putBytes(msgOffset(recordOffset), srcBuffer, srcIndex, length);
buffer.putLong(latestCounterIndex, currentTail);
buffer.putLongOrdered(tailCounterIndex, currentTail + recordLengthAligned);
} }
|
public class class_name {
private void searchMatchSpace(
SIMPMessage msg,
MessageProcessorSearchResults searchResults)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "searchMatchSpace", new Object[] { msg, searchResults });
// Defect 382250, set the unlockCount from MsgStore into the message
// in the case where the message is being redelivered.
JsMessage searchMsg = msg.getMessage();
int redelCount = msg.guessRedeliveredCount();
if (redelCount > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
searchMsg.setDeliveryCount(redelCount);
}
// Search the match space.
_messageProcessor
.getMessageProcessorMatching()
.retrieveMatchingConsumerPoints(
_baseDestHandler.getUuid(), // the uuid of the destination
getUuid(), // the uuid of the ConsumerDispatcher
searchMsg,
searchResults);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "searchMatchSpace", searchResults);
} }
|
public class class_name {
private void searchMatchSpace(
SIMPMessage msg,
MessageProcessorSearchResults searchResults)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "searchMatchSpace", new Object[] { msg, searchResults });
// Defect 382250, set the unlockCount from MsgStore into the message
// in the case where the message is being redelivered.
JsMessage searchMsg = msg.getMessage();
int redelCount = msg.guessRedeliveredCount();
if (redelCount > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
searchMsg.setDeliveryCount(redelCount); // depends on control dependency: [if], data = [(redelCount]
}
// Search the match space.
_messageProcessor
.getMessageProcessorMatching()
.retrieveMatchingConsumerPoints(
_baseDestHandler.getUuid(), // the uuid of the destination
getUuid(), // the uuid of the ConsumerDispatcher
searchMsg,
searchResults);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "searchMatchSpace", searchResults);
} }
|
public class class_name {
@Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double mind = Double.MAX_VALUE;
for (final Point2d p : points()) {
final double d = p.getDistance(point);
if (d < mind) {
mind = d;
}
}
return mind;
} }
|
public class class_name {
@Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double mind = Double.MAX_VALUE;
for (final Point2d p : points()) {
final double d = p.getDistance(point);
if (d < mind) {
mind = d; // depends on control dependency: [if], data = [none]
}
}
return mind;
} }
|
public class class_name {
private static boolean spanWillOverlap(Spannable spanText, URLSpan[] spanList, int start,
int end) {
if (start == end) {
// empty span, ignore
return false;
}
for (URLSpan span : spanList) {
int existingStart = spanText.getSpanStart(span);
int existingEnd = spanText.getSpanEnd(span);
if ((start >= existingStart && start < existingEnd) ||
end > existingStart && end <= existingEnd) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
CharSequence seq = spanText.subSequence(start, end);
Log.v(TAG, "Not linkifying " + seq + " as phone number due to overlap");
}
return true;
}
}
return false;
} }
|
public class class_name {
private static boolean spanWillOverlap(Spannable spanText, URLSpan[] spanList, int start,
int end) {
if (start == end) {
// empty span, ignore
return false; // depends on control dependency: [if], data = [none]
}
for (URLSpan span : spanList) {
int existingStart = spanText.getSpanStart(span);
int existingEnd = spanText.getSpanEnd(span);
if ((start >= existingStart && start < existingEnd) ||
end > existingStart && end <= existingEnd) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
CharSequence seq = spanText.subSequence(start, end);
Log.v(TAG, "Not linkifying " + seq + " as phone number due to overlap"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public void setContract(Contract c) {
super.setContract(c);
for (Field f : params) {
f.setContract(c);
}
if (returns != null) {
returns.setContract(c);
}
} }
|
public class class_name {
@Override
public void setContract(Contract c) {
super.setContract(c);
for (Field f : params) {
f.setContract(c); // depends on control dependency: [for], data = [f]
}
if (returns != null) {
returns.setContract(c); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(KinesisFirehoseInputDescription kinesisFirehoseInputDescription, ProtocolMarshaller protocolMarshaller) {
if (kinesisFirehoseInputDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(kinesisFirehoseInputDescription.getResourceARN(), RESOURCEARN_BINDING);
protocolMarshaller.marshall(kinesisFirehoseInputDescription.getRoleARN(), ROLEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(KinesisFirehoseInputDescription kinesisFirehoseInputDescription, ProtocolMarshaller protocolMarshaller) {
if (kinesisFirehoseInputDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(kinesisFirehoseInputDescription.getResourceARN(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(kinesisFirehoseInputDescription.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static List<PostAggregator> pruneDependentPostAgg(List<PostAggregator> postAggregatorList, String postAggName)
{
ArrayList<PostAggregator> rv = new ArrayList<>();
Set<String> deps = new HashSet<>();
deps.add(postAggName);
// Iterate backwards to find the last calculated aggregate and add dependent aggregator as we find dependencies
// in reverse order
for (PostAggregator agg : Lists.reverse(postAggregatorList)) {
if (deps.contains(agg.getName())) {
rv.add(agg); // add to the beginning of List
deps.remove(agg.getName());
deps.addAll(agg.getDependentFields());
}
}
Collections.reverse(rv);
return rv;
} }
|
public class class_name {
public static List<PostAggregator> pruneDependentPostAgg(List<PostAggregator> postAggregatorList, String postAggName)
{
ArrayList<PostAggregator> rv = new ArrayList<>();
Set<String> deps = new HashSet<>();
deps.add(postAggName);
// Iterate backwards to find the last calculated aggregate and add dependent aggregator as we find dependencies
// in reverse order
for (PostAggregator agg : Lists.reverse(postAggregatorList)) {
if (deps.contains(agg.getName())) {
rv.add(agg); // add to the beginning of List // depends on control dependency: [if], data = [none]
deps.remove(agg.getName()); // depends on control dependency: [if], data = [none]
deps.addAll(agg.getDependentFields()); // depends on control dependency: [if], data = [none]
}
}
Collections.reverse(rv);
return rv;
} }
|
public class class_name {
protected void BuildGSubrsUsed(int Font)
{
int LBias = 0;
int SizeOfNonCIDSubrsUsed = 0;
if (fonts[Font].privateSubrs>=0)
{
LBias = CalcBias(fonts[Font].privateSubrs,Font);
SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size();
}
// For each global subr used
for (int i=0;i<lGSubrsUsed.size();i++)
{
//Pop the value + check valid
int Subr = ((Integer)lGSubrsUsed.get(i)).intValue();
if (Subr < gsubrOffsets.length-1 && Subr>=0)
{
// Read the subr and process
int Start = gsubrOffsets[Subr];
int End = gsubrOffsets[Subr+1];
if (fonts[Font].isCID)
ReadASubr(Start,End,GBias,0,hGSubrsUsed,lGSubrsUsed,null);
else
{
ReadASubr(Start,End,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets);
if (SizeOfNonCIDSubrsUsed < lSubrsUsedNonCID.size())
{
for (int j=SizeOfNonCIDSubrsUsed;j<lSubrsUsedNonCID.size();j++)
{
//Pop the value + check valid
int LSubr = ((Integer)lSubrsUsedNonCID.get(j)).intValue();
if (LSubr < fonts[Font].SubrsOffsets.length-1 && LSubr>=0)
{
// Read the subr and process
int LStart = fonts[Font].SubrsOffsets[LSubr];
int LEnd = fonts[Font].SubrsOffsets[LSubr+1];
ReadASubr(LStart,LEnd,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets);
}
}
SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size();
}
}
}
}
} }
|
public class class_name {
protected void BuildGSubrsUsed(int Font)
{
int LBias = 0;
int SizeOfNonCIDSubrsUsed = 0;
if (fonts[Font].privateSubrs>=0)
{
LBias = CalcBias(fonts[Font].privateSubrs,Font); // depends on control dependency: [if], data = [(fonts[Font].privateSubrs]
SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size(); // depends on control dependency: [if], data = [none]
}
// For each global subr used
for (int i=0;i<lGSubrsUsed.size();i++)
{
//Pop the value + check valid
int Subr = ((Integer)lGSubrsUsed.get(i)).intValue();
if (Subr < gsubrOffsets.length-1 && Subr>=0)
{
// Read the subr and process
int Start = gsubrOffsets[Subr];
int End = gsubrOffsets[Subr+1];
if (fonts[Font].isCID)
ReadASubr(Start,End,GBias,0,hGSubrsUsed,lGSubrsUsed,null);
else
{
ReadASubr(Start,End,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets); // depends on control dependency: [if], data = [none]
if (SizeOfNonCIDSubrsUsed < lSubrsUsedNonCID.size())
{
for (int j=SizeOfNonCIDSubrsUsed;j<lSubrsUsedNonCID.size();j++)
{
//Pop the value + check valid
int LSubr = ((Integer)lSubrsUsedNonCID.get(j)).intValue();
if (LSubr < fonts[Font].SubrsOffsets.length-1 && LSubr>=0)
{
// Read the subr and process
int LStart = fonts[Font].SubrsOffsets[LSubr];
int LEnd = fonts[Font].SubrsOffsets[LSubr+1];
ReadASubr(LStart,LEnd,GBias,LBias,hSubrsUsedNonCID,lSubrsUsedNonCID,fonts[Font].SubrsOffsets); // depends on control dependency: [if], data = [none]
}
}
SizeOfNonCIDSubrsUsed = lSubrsUsedNonCID.size(); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
public String build(final UrlMapping urlMapping, final boolean encodeUrl, final List<UIParameter> parameters)
{
String result = "";
if (urlMapping != null)
{
URLPatternParser parser = urlMapping.getPatternParser();
List<String> pathParams = new ArrayList<String>();
List<QueryParameter> queryParams = new ArrayList<QueryParameter>();
if(parameters != null)
{
// TODO this logic should be in the components, not in the builder
if (parameters.size() == 1)
{
UIParameter firstParam = parameters.get(0);
if (((firstParam.getValue() != null)) && (firstParam.getName() == null))
{
if (firstParam.getValue() instanceof List<?>)
{
URL url = parser.getMappedURL(firstParam.getValue());
return url.toURL();
}
else if (firstParam.getValue().getClass().isArray())
{
// The Object[] cast here is required, otherwise Java treats
// getValue() as a single Object.
List<Object> list = Arrays.asList((Object[]) firstParam.getValue());
URL url = parser.getMappedURL(list);
return url.toURL();
}
}
}
for (UIParameter parameter : parameters)
{
String name = parameter.getName();
Object value = parameter.getValue();
if ((name == null) && (value != null))
{
pathParams.add(value.toString());
}
else
{
List<?> values = null;
if ((value != null) && value.getClass().isArray())
{
values = Arrays.asList((Object[]) value);
}
else if (value instanceof List<?>)
{
values = (List<?>) value;
}
else if (value != null)
{
values = Arrays.asList(value);
}
if (values != null)
{
for (Object object : values)
{
String tempValue = null;
if (object != null)
{
tempValue = object.toString();
}
queryParams.add(new QueryParameter(name, tempValue));
}
}
else
{
queryParams.add(new QueryParameter(name, null));
}
}
}
}
// build URL object for given path parameter set
URL mappedURL = parser.getMappedURL(pathParams.toArray());
// create encoded/unicode URL
String url = encodeUrl ? mappedURL.encode().toURL() : mappedURL.toURL();
// append query string
result = url + QueryString.build(queryParams).toQueryString();
}
return result;
} }
|
public class class_name {
public String build(final UrlMapping urlMapping, final boolean encodeUrl, final List<UIParameter> parameters)
{
String result = "";
if (urlMapping != null)
{
URLPatternParser parser = urlMapping.getPatternParser();
List<String> pathParams = new ArrayList<String>();
List<QueryParameter> queryParams = new ArrayList<QueryParameter>();
if(parameters != null)
{
// TODO this logic should be in the components, not in the builder
if (parameters.size() == 1)
{
UIParameter firstParam = parameters.get(0);
if (((firstParam.getValue() != null)) && (firstParam.getName() == null))
{
if (firstParam.getValue() instanceof List<?>)
{
URL url = parser.getMappedURL(firstParam.getValue());
return url.toURL(); // depends on control dependency: [if], data = [)]
}
else if (firstParam.getValue().getClass().isArray())
{
// The Object[] cast here is required, otherwise Java treats
// getValue() as a single Object.
List<Object> list = Arrays.asList((Object[]) firstParam.getValue());
URL url = parser.getMappedURL(list);
return url.toURL(); // depends on control dependency: [if], data = [none]
}
}
}
for (UIParameter parameter : parameters)
{
String name = parameter.getName();
Object value = parameter.getValue();
if ((name == null) && (value != null))
{
pathParams.add(value.toString()); // depends on control dependency: [if], data = [none]
}
else
{
List<?> values = null;
if ((value != null) && value.getClass().isArray())
{
values = Arrays.asList((Object[]) value); // depends on control dependency: [if], data = [none]
}
else if (value instanceof List<?>)
{
values = (List<?>) value; // depends on control dependency: [if], data = [)]
}
else if (value != null)
{
values = Arrays.asList(value); // depends on control dependency: [if], data = [(value]
}
if (values != null)
{
for (Object object : values)
{
String tempValue = null;
if (object != null)
{
tempValue = object.toString(); // depends on control dependency: [if], data = [none]
}
queryParams.add(new QueryParameter(name, tempValue)); // depends on control dependency: [for], data = [none]
}
}
else
{
queryParams.add(new QueryParameter(name, null)); // depends on control dependency: [if], data = [null)]
}
}
}
}
// build URL object for given path parameter set
URL mappedURL = parser.getMappedURL(pathParams.toArray());
// create encoded/unicode URL
String url = encodeUrl ? mappedURL.encode().toURL() : mappedURL.toURL();
// append query string
result = url + QueryString.build(queryParams).toQueryString(); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@Nullable
public static String getURLValue (@Nullable final String sValue)
{
if (isURLValue (sValue))
{
return CSSParseHelper.trimUrl (sValue);
}
return null;
} }
|
public class class_name {
@Nullable
public static String getURLValue (@Nullable final String sValue)
{
if (isURLValue (sValue))
{
return CSSParseHelper.trimUrl (sValue); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void marshall(MeshData meshData, ProtocolMarshaller protocolMarshaller) {
if (meshData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(meshData.getMeshName(), MESHNAME_BINDING);
protocolMarshaller.marshall(meshData.getMetadata(), METADATA_BINDING);
protocolMarshaller.marshall(meshData.getSpec(), SPEC_BINDING);
protocolMarshaller.marshall(meshData.getStatus(), STATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(MeshData meshData, ProtocolMarshaller protocolMarshaller) {
if (meshData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(meshData.getMeshName(), MESHNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(meshData.getMetadata(), METADATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(meshData.getSpec(), SPEC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(meshData.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void execBackwards(Map<String,INDArray> placeholders){
if (getFunction("grad") == null) {
createGradFunction();
}
//Collect (unique) list of gradient names...
Set<String> varGradNames = new HashSet<>();
for(Variable v : variables.values()){
if(v.getVariable().getVariableType() == VariableType.VARIABLE){
SDVariable g = v.getVariable().gradient();
if(g != null) {
//Not all variables can have gradients... for example: suppose graph has 2 independent loss functions,
// optimizing only 1 might not require changing all variables
varGradNames.add(g.getVarName());
}
}
}
//Edge case: if no variables, no variable gradients to calculate...
if(varGradNames.isEmpty()){
log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" +
"If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead");
return;
}
List<String> vargradNamesList = new ArrayList<>(varGradNames);
execBackwards(placeholders, vargradNamesList);
} }
|
public class class_name {
public void execBackwards(Map<String,INDArray> placeholders){
if (getFunction("grad") == null) {
createGradFunction(); // depends on control dependency: [if], data = [none]
}
//Collect (unique) list of gradient names...
Set<String> varGradNames = new HashSet<>();
for(Variable v : variables.values()){
if(v.getVariable().getVariableType() == VariableType.VARIABLE){
SDVariable g = v.getVariable().gradient();
if(g != null) {
//Not all variables can have gradients... for example: suppose graph has 2 independent loss functions,
// optimizing only 1 might not require changing all variables
varGradNames.add(g.getVarName()); // depends on control dependency: [if], data = [(g]
}
}
}
//Edge case: if no variables, no variable gradients to calculate...
if(varGradNames.isEmpty()){
log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" +
"If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
List<String> vargradNamesList = new ArrayList<>(varGradNames);
execBackwards(placeholders, vargradNamesList);
} }
|
public class class_name {
public static void reorderVisually(byte[] levels,
int levelStart,
Object[] objects,
int objectStart,
int count)
{
byte[] reorderLevels = new byte[count];
System.arraycopy(levels, levelStart, reorderLevels, 0, count);
int[] indexMap = reorderVisual(reorderLevels);
Object[] temp = new Object[count];
System.arraycopy(objects, objectStart, temp, 0, count);
for (int i = 0; i < count; ++i) {
objects[objectStart + i] = temp[indexMap[i]];
}
} }
|
public class class_name {
public static void reorderVisually(byte[] levels,
int levelStart,
Object[] objects,
int objectStart,
int count)
{
byte[] reorderLevels = new byte[count];
System.arraycopy(levels, levelStart, reorderLevels, 0, count);
int[] indexMap = reorderVisual(reorderLevels);
Object[] temp = new Object[count];
System.arraycopy(objects, objectStart, temp, 0, count);
for (int i = 0; i < count; ++i) {
objects[objectStart + i] = temp[indexMap[i]]; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void setRefreshCompleteHook(PtrUIHandlerHook hook) {
mRefreshCompleteHook = hook;
hook.setResumeAction(new Runnable() {
@Override
public void run() {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "mRefreshCompleteHook resume.");
}
notifyUIRefreshComplete(true);
}
});
} }
|
public class class_name {
public void setRefreshCompleteHook(PtrUIHandlerHook hook) {
mRefreshCompleteHook = hook;
hook.setResumeAction(new Runnable() {
@Override
public void run() {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "mRefreshCompleteHook resume."); // depends on control dependency: [if], data = [none]
}
notifyUIRefreshComplete(true);
}
});
} }
|
public class class_name {
@Override
public EClass getIfcFanType() {
if (ifcFanTypeEClass == null) {
ifcFanTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(262);
}
return ifcFanTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcFanType() {
if (ifcFanTypeEClass == null) {
ifcFanTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(262);
// depends on control dependency: [if], data = [none]
}
return ifcFanTypeEClass;
} }
|
public class class_name {
private void remapEdges(ProtoNetwork protoNetwork1,
ProtoNetwork protoNetwork2, int documentId,
Map<Integer, Integer> termMap, int newStatementIndex,
List<TableProtoEdge> edges, Set<Integer> edgeIndices) {
ProtoNodeTable nt = protoNetwork2.getProtoNodeTable();
Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex();
TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()];
int i = 0;
for (Integer edgeIndex : edgeIndices) {
TableProtoEdge edge = edges.get(edgeIndex);
int sourceBefore = edge.getSource();
int targetBefore = edge.getTarget();
Integer sourceTerm = nodeTermIndex.get(sourceBefore);
Integer targetTerm = nodeTermIndex.get(targetBefore);
Integer newSource = termMap.get(sourceTerm);
if (newSource == null) {
newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2,
documentId, termMap);
}
Integer newTarget = termMap.get(targetTerm);
if (newTarget == null) {
newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2,
documentId, termMap);
}
remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(),
newTarget);
}
ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable();
edgeTable.addEdges(newStatementIndex, remappedEdges);
} }
|
public class class_name {
private void remapEdges(ProtoNetwork protoNetwork1,
ProtoNetwork protoNetwork2, int documentId,
Map<Integer, Integer> termMap, int newStatementIndex,
List<TableProtoEdge> edges, Set<Integer> edgeIndices) {
ProtoNodeTable nt = protoNetwork2.getProtoNodeTable();
Map<Integer, Integer> nodeTermIndex = nt.getNodeTermIndex();
TableProtoEdge[] remappedEdges = new TableProtoEdge[edgeIndices.size()];
int i = 0;
for (Integer edgeIndex : edgeIndices) {
TableProtoEdge edge = edges.get(edgeIndex);
int sourceBefore = edge.getSource();
int targetBefore = edge.getTarget();
Integer sourceTerm = nodeTermIndex.get(sourceBefore);
Integer targetTerm = nodeTermIndex.get(targetBefore);
Integer newSource = termMap.get(sourceTerm);
if (newSource == null) {
newSource = mergeTerm(sourceTerm, protoNetwork1, protoNetwork2,
documentId, termMap); // depends on control dependency: [if], data = [none]
}
Integer newTarget = termMap.get(targetTerm);
if (newTarget == null) {
newTarget = mergeTerm(targetTerm, protoNetwork1, protoNetwork2,
documentId, termMap); // depends on control dependency: [if], data = [none]
}
remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(),
newTarget); // depends on control dependency: [for], data = [none]
}
ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable();
edgeTable.addEdges(newStatementIndex, remappedEdges);
} }
|
public class class_name {
public synchronized boolean addDriveListener(final IUSBDriveListener listener) {
if (listeners.contains(listener)) {
return false;
}
listeners.add(listener);
start();
return true;
} }
|
public class class_name {
public synchronized boolean addDriveListener(final IUSBDriveListener listener) {
if (listeners.contains(listener)) {
return false; // depends on control dependency: [if], data = [none]
}
listeners.add(listener);
start();
return true;
} }
|
public class class_name {
public static Object beanClone(Object obj, Set<String> ignoreProperties) throws CloneNotSupportedException {
final Class<?> clazz = obj.getClass();
try {
final Object clonedBean = clazz.newInstance();
final List<PropertyDescriptor> propertyDescriptors = BeanIntrospector.getPropertyDescriptorsWithGettersAndSetters(clazz);
for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {
final String propertyName = propertyDescriptor.getName();
final boolean ignoredProperty = ignoreProperties.contains(propertyName);
if (!ignoredProperty) {
final Method getter = propertyDescriptor.getReadMethod();
final Method setter = propertyDescriptor.getWriteMethod();
Object value = getter.invoke(obj, NO_PARAMS);
if (value != null) {
value = doClone(value);
setter.invoke(clonedBean, new Object[] { value });
}
}
}
return clonedBean;
} catch (final CloneNotSupportedException e) {
LOG.error("Error while cloning bean", e);
throw e;
} catch (final Exception e) {
LOG.error("Error while cloning bean", e);
throw new CloneNotSupportedException("Cannot clone a " + clazz + " object");
}
} }
|
public class class_name {
public static Object beanClone(Object obj, Set<String> ignoreProperties) throws CloneNotSupportedException {
final Class<?> clazz = obj.getClass();
try {
final Object clonedBean = clazz.newInstance();
final List<PropertyDescriptor> propertyDescriptors = BeanIntrospector.getPropertyDescriptorsWithGettersAndSetters(clazz);
for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {
final String propertyName = propertyDescriptor.getName();
final boolean ignoredProperty = ignoreProperties.contains(propertyName);
if (!ignoredProperty) {
final Method getter = propertyDescriptor.getReadMethod();
final Method setter = propertyDescriptor.getWriteMethod();
Object value = getter.invoke(obj, NO_PARAMS);
if (value != null) {
value = doClone(value); // depends on control dependency: [if], data = [(value]
setter.invoke(clonedBean, new Object[] { value }); // depends on control dependency: [if], data = [none]
}
}
}
return clonedBean;
} catch (final CloneNotSupportedException e) {
LOG.error("Error while cloning bean", e);
throw e;
} catch (final Exception e) {
LOG.error("Error while cloning bean", e);
throw new CloneNotSupportedException("Cannot clone a " + clazz + " object");
}
} }
|
public class class_name {
public void emmitCode(ByteBuffer buffer, WAMMachine machine, WAMCallPoint callPoint) throws LinkageException
{
// Ensure that the size of the instruction listing does not exceed max int (highly unlikely).
if (sizeof() > Integer.MAX_VALUE)
{
throw new IllegalStateException("The instruction listing size exceeds Integer.MAX_VALUE.");
}
// Used to keep track of the size of the emitted code, in bytes, as it is written.
int length = 0;
// Insert the compiled code into the byte code machine's code area.
for (WAMInstruction instruction : instructions)
{
instruction.emmitCode(buffer, machine);
length += instruction.sizeof();
}
// Keep record of the machine that the code is hosted in, and the call point of the functor within the machine.
this.machine = machine;
this.callPoint = callPoint;
// Record the fact that the code is now linked into a machine.
this.status = LinkStatus.Linked;
} }
|
public class class_name {
public void emmitCode(ByteBuffer buffer, WAMMachine machine, WAMCallPoint callPoint) throws LinkageException
{
// Ensure that the size of the instruction listing does not exceed max int (highly unlikely).
if (sizeof() > Integer.MAX_VALUE)
{
throw new IllegalStateException("The instruction listing size exceeds Integer.MAX_VALUE.");
}
// Used to keep track of the size of the emitted code, in bytes, as it is written.
int length = 0;
// Insert the compiled code into the byte code machine's code area.
for (WAMInstruction instruction : instructions)
{
instruction.emmitCode(buffer, machine); // depends on control dependency: [for], data = [instruction]
length += instruction.sizeof(); // depends on control dependency: [for], data = [instruction]
}
// Keep record of the machine that the code is hosted in, and the call point of the functor within the machine.
this.machine = machine;
this.callPoint = callPoint;
// Record the fact that the code is now linked into a machine.
this.status = LinkStatus.Linked;
} }
|
public class class_name {
public Collection<Parameter<?>> getParameters() {
if (_parameters == null) {
return Collections.<Parameter<?>>emptyList();
}
return Collections.unmodifiableCollection(_parameters);
} }
|
public class class_name {
public Collection<Parameter<?>> getParameters() {
if (_parameters == null) {
return Collections.<Parameter<?>>emptyList(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableCollection(_parameters);
} }
|
public class class_name {
private void stripTrailingDelimiters(StringBuilder buffer)
{
int index = buffer.length() - 1;
while (index > 0 && buffer.charAt(index) == m_delimiter)
{
--index;
}
buffer.setLength(index + 1);
} }
|
public class class_name {
private void stripTrailingDelimiters(StringBuilder buffer)
{
int index = buffer.length() - 1;
while (index > 0 && buffer.charAt(index) == m_delimiter)
{
--index; // depends on control dependency: [while], data = [none]
}
buffer.setLength(index + 1);
} }
|
public class class_name {
protected XExpression _generate(XIfExpression ifStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
it.append("if "); //$NON-NLS-1$
generate(ifStatement.getIf(), it, context);
it.append(":"); //$NON-NLS-1$
it.increaseIndentation().newLine();
if (ifStatement.getThen() != null) {
generate(ifStatement.getThen(), context.getExpectedExpressionType(), it, context);
} else if (context.getExpectedExpressionType() == null) {
it.append("pass"); //$NON-NLS-1$
} else {
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$
}
it.decreaseIndentation();
if (ifStatement.getElse() != null) {
it.newLine().append("else:"); //$NON-NLS-1$
it.increaseIndentation().newLine();
generate(ifStatement.getElse(), context.getExpectedExpressionType(), it, context);
it.decreaseIndentation();
} else if (context.getExpectedExpressionType() != null) {
it.newLine().append("else:"); //$NON-NLS-1$
it.increaseIndentation().newLine();
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$
it.decreaseIndentation();
}
return ifStatement;
} }
|
public class class_name {
protected XExpression _generate(XIfExpression ifStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
it.append("if "); //$NON-NLS-1$
generate(ifStatement.getIf(), it, context);
it.append(":"); //$NON-NLS-1$
it.increaseIndentation().newLine();
if (ifStatement.getThen() != null) {
generate(ifStatement.getThen(), context.getExpectedExpressionType(), it, context); // depends on control dependency: [if], data = [(ifStatement.getThen()]
} else if (context.getExpectedExpressionType() == null) {
it.append("pass"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$ // depends on control dependency: [if], data = [(context.getExpectedExpressionType()]
}
it.decreaseIndentation();
if (ifStatement.getElse() != null) {
it.newLine().append("else:"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.increaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
generate(ifStatement.getElse(), context.getExpectedExpressionType(), it, context); // depends on control dependency: [if], data = [(ifStatement.getElse()]
it.decreaseIndentation(); // depends on control dependency: [if], data = [none]
} else if (context.getExpectedExpressionType() != null) {
it.newLine().append("else:"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.increaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$ // depends on control dependency: [if], data = [(context.getExpectedExpressionType()]
it.decreaseIndentation(); // depends on control dependency: [if], data = [none]
}
return ifStatement;
} }
|
public class class_name {
public static int getConsoleWidth() {
if(width > 0) {
return width;
}
final int default_termwidth = 78;
try {
final String env = System.getenv("COLUMNS");
if(env != null) {
int columns = ParseUtil.parseIntBase10(env);
return width = (columns > 50 ? columns - 1 : default_termwidth);
}
}
catch(SecurityException | NumberFormatException e) {
// OK. Probably not exported.
}
try {
Process p = Runtime.getRuntime().exec(new String[] { "sh", "-c", "tput cols 2> /dev/tty" });
byte[] buf = new byte[16];
p.getOutputStream().close(); // We do not intend to write.
int l = p.getInputStream().read(buf);
if(l >= 2 && l < buf.length) {
int columns = ParseUtil.parseIntBase10(new String(buf, 0, buf[l - 1] == '\n' ? l - 1 : l));
return width = (columns > 50 ? columns - 1 : default_termwidth);
}
p.destroy();
}
catch(IOException | SecurityException | NumberFormatException e) {
// Ok. Probably not a unix system.
}
// We could use the jLine library, but that would introduce another
// dependency. :-(
return width = default_termwidth;
} }
|
public class class_name {
public static int getConsoleWidth() {
if(width > 0) {
return width; // depends on control dependency: [if], data = [none]
}
final int default_termwidth = 78;
try {
final String env = System.getenv("COLUMNS");
if(env != null) {
int columns = ParseUtil.parseIntBase10(env);
return width = (columns > 50 ? columns - 1 : default_termwidth); // depends on control dependency: [if], data = [none]
}
}
catch(SecurityException | NumberFormatException e) {
// OK. Probably not exported.
} // depends on control dependency: [catch], data = [none]
try {
Process p = Runtime.getRuntime().exec(new String[] { "sh", "-c", "tput cols 2> /dev/tty" });
byte[] buf = new byte[16];
p.getOutputStream().close(); // We do not intend to write. // depends on control dependency: [try], data = [none]
int l = p.getInputStream().read(buf);
if(l >= 2 && l < buf.length) {
int columns = ParseUtil.parseIntBase10(new String(buf, 0, buf[l - 1] == '\n' ? l - 1 : l));
return width = (columns > 50 ? columns - 1 : default_termwidth); // depends on control dependency: [if], data = [none]
}
p.destroy(); // depends on control dependency: [try], data = [none]
}
catch(IOException | SecurityException | NumberFormatException e) {
// Ok. Probably not a unix system.
} // depends on control dependency: [catch], data = [none]
// We could use the jLine library, but that would introduce another
// dependency. :-(
return width = default_termwidth;
} }
|
public class class_name {
public String toIcal() {
StringBuilder buf = new StringBuilder();
buf.append(this.getName().toUpperCase());
buf.append(";TZID=\"").append(tzid.getID()).append('"');
buf.append(";VALUE=").append(valueType.toIcal());
if (hasExtParams()) {
for (Map.Entry<String, String> param : getExtParams().entrySet()) {
String k = param.getKey(),
v = param.getValue();
if (ICAL_SPECIALS.matcher(v).find()) {
v = "\"" + v + "\"";
}
buf.append(';').append(k).append('=').append(v);
}
}
buf.append(':');
for (int i = 0; i < datesUtc.length; ++i) {
if (0 != i) {
buf.append(',');
}
DateValue v = datesUtc[i];
buf.append(v);
if (v instanceof TimeValue) {
buf.append('Z');
}
}
return buf.toString();
} }
|
public class class_name {
public String toIcal() {
StringBuilder buf = new StringBuilder();
buf.append(this.getName().toUpperCase());
buf.append(";TZID=\"").append(tzid.getID()).append('"');
buf.append(";VALUE=").append(valueType.toIcal());
if (hasExtParams()) {
for (Map.Entry<String, String> param : getExtParams().entrySet()) {
String k = param.getKey(),
v = param.getValue();
if (ICAL_SPECIALS.matcher(v).find()) {
v = "\"" + v + "\""; // depends on control dependency: [if], data = [none]
}
buf.append(';').append(k).append('=').append(v); // depends on control dependency: [for], data = [none]
}
}
buf.append(':');
for (int i = 0; i < datesUtc.length; ++i) {
if (0 != i) {
buf.append(','); // depends on control dependency: [if], data = [none]
}
DateValue v = datesUtc[i];
buf.append(v); // depends on control dependency: [for], data = [none]
if (v instanceof TimeValue) {
buf.append('Z'); // depends on control dependency: [if], data = [none]
}
}
return buf.toString();
} }
|
public class class_name {
public void addPhoto(Photo photo) {
Photo.PhotoType type = photo.getType();
if (postType != null && !postType.equals(type)) {
throw new IllegalArgumentException("Photos must all be the same type (source or data)");
}
if (pendingPhotos == null) {
pendingPhotos = new ArrayList<Photo>();
}
pendingPhotos.add(photo);
this.postType = type;
} }
|
public class class_name {
public void addPhoto(Photo photo) {
Photo.PhotoType type = photo.getType();
if (postType != null && !postType.equals(type)) {
throw new IllegalArgumentException("Photos must all be the same type (source or data)");
}
if (pendingPhotos == null) {
pendingPhotos = new ArrayList<Photo>(); // depends on control dependency: [if], data = [none]
}
pendingPhotos.add(photo);
this.postType = type;
} }
|
public class class_name {
public static byte[] readBytes(File file) throws IOException {
FileInputStream fis = null;
ByteArrayOutputStream bos = null;
if (file == null) {
throw new FileNotFoundException("No file specified");
}
try {
fis = new FileInputStream(file);
bos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int remaining;
while ((remaining = fis.read(buffer)) > 0) {
bos.write(buffer, 0, remaining);
}
return bos.toByteArray();
} finally {
Closeables.closeQuietly(fis);
Closeables.closeQuietly(bos);
}
} }
|
public class class_name {
public static byte[] readBytes(File file) throws IOException {
FileInputStream fis = null;
ByteArrayOutputStream bos = null;
if (file == null) {
throw new FileNotFoundException("No file specified");
}
try {
fis = new FileInputStream(file);
bos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int remaining;
while ((remaining = fis.read(buffer)) > 0) {
bos.write(buffer, 0, remaining); // depends on control dependency: [while], data = [none]
}
return bos.toByteArray();
} finally {
Closeables.closeQuietly(fis);
Closeables.closeQuietly(bos);
}
} }
|
public class class_name {
public static <T, C extends Collection<T>> Map<T, C> makeElementsToContainersMap(
final Iterable<C> collections) {
final ImmutableMap.Builder<T, C> ret = ImmutableMap.builder();
for (final C collection : collections) {
for (final T item : collection) {
ret.put(item, collection);
}
}
return ret.build();
} }
|
public class class_name {
public static <T, C extends Collection<T>> Map<T, C> makeElementsToContainersMap(
final Iterable<C> collections) {
final ImmutableMap.Builder<T, C> ret = ImmutableMap.builder();
for (final C collection : collections) {
for (final T item : collection) {
ret.put(item, collection); // depends on control dependency: [for], data = [item]
}
}
return ret.build();
} }
|
public class class_name {
@Deprecated
public void setFrom(String from) {
Jid jid;
try {
jid = JidCreate.from(from);
}
catch (XmppStringprepException e) {
throw new IllegalArgumentException(e);
}
setFrom(jid);
} }
|
public class class_name {
@Deprecated
public void setFrom(String from) {
Jid jid;
try {
jid = JidCreate.from(from); // depends on control dependency: [try], data = [none]
}
catch (XmppStringprepException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
setFrom(jid);
} }
|
public class class_name {
static Tuple<String, Class> splitClassAndName(String classLabel) {
String[] stringNameSplit = classLabel.split("@");
// If i don't have a @, then no name is provided, use the class as the name.
if (stringNameSplit.length == 1) {
try {
return new Tuple<>(classLabel, Class.forName(classLabel));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + classLabel + " has not been found");
}
} else if (stringNameSplit.length > 1) { // Found a @, use that as the name, and
try {
return new Tuple<>(stringNameSplit[1], Class.forName(stringNameSplit[0]));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + stringNameSplit[0]
+ " has not been found. Declared label was: " + stringNameSplit[1]);
}
}
throw new RuntimeException("Invalid format provided for class label: " + classLabel);
} }
|
public class class_name {
static Tuple<String, Class> splitClassAndName(String classLabel) {
String[] stringNameSplit = classLabel.split("@");
// If i don't have a @, then no name is provided, use the class as the name.
if (stringNameSplit.length == 1) {
try {
return new Tuple<>(classLabel, Class.forName(classLabel)); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + classLabel + " has not been found");
} // depends on control dependency: [catch], data = [none]
} else if (stringNameSplit.length > 1) { // Found a @, use that as the name, and
try {
return new Tuple<>(stringNameSplit[1], Class.forName(stringNameSplit[0])); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + stringNameSplit[0]
+ " has not been found. Declared label was: " + stringNameSplit[1]);
} // depends on control dependency: [catch], data = [none]
}
throw new RuntimeException("Invalid format provided for class label: " + classLabel);
} }
|
public class class_name {
@Override
public AbstractIoBufferEx limit(int newLimit) {
autoExpand(newLimit, 0);
buf().limit(newLimit);
if (mark > newLimit) {
mark = -1;
}
return this;
} }
|
public class class_name {
@Override
public AbstractIoBufferEx limit(int newLimit) {
autoExpand(newLimit, 0);
buf().limit(newLimit);
if (mark > newLimit) {
mark = -1; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static void addComment(TapElement element, String comment) {
if (comment != null && comment.trim().length() > 0) {
element.setComment(new Comment(comment, true));
}
} }
|
public class class_name {
public static void addComment(TapElement element, String comment) {
if (comment != null && comment.trim().length() > 0) {
element.setComment(new Comment(comment, true)); // depends on control dependency: [if], data = [(comment]
}
} }
|
public class class_name {
protected void removeAll()
{
List<LockData> locks = getLockList();
for (LockData lockData : locks)
{
removeLock(lockData.getNodeIdentifier());
}
} }
|
public class class_name {
protected void removeAll()
{
List<LockData> locks = getLockList();
for (LockData lockData : locks)
{
removeLock(lockData.getNodeIdentifier()); // depends on control dependency: [for], data = [lockData]
}
} }
|
public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>> getDataFetchSequence() {
if (mDataFetchSequence == null) {
Producer<EncodedImage> inputProducer = mProducerFactory.newDataFetchProducer();
if (WebpSupportStatus.sIsWebpSupportRequired &&
(!mWebpSupportEnabled || WebpSupportStatus.sWebpBitmapFactory == null)) {
inputProducer = mProducerFactory.newWebpTranscodeProducer(inputProducer);
}
inputProducer = mProducerFactory.newAddImageTransformMetaDataProducer(inputProducer);
inputProducer =
mProducerFactory.newResizeAndRotateProducer(inputProducer, true, mImageTranscoderFactory);
mDataFetchSequence = newBitmapCacheGetToDecodeSequence(inputProducer);
}
return mDataFetchSequence;
} }
|
public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>> getDataFetchSequence() {
if (mDataFetchSequence == null) {
Producer<EncodedImage> inputProducer = mProducerFactory.newDataFetchProducer();
if (WebpSupportStatus.sIsWebpSupportRequired &&
(!mWebpSupportEnabled || WebpSupportStatus.sWebpBitmapFactory == null)) {
inputProducer = mProducerFactory.newWebpTranscodeProducer(inputProducer); // depends on control dependency: [if], data = [none]
}
inputProducer = mProducerFactory.newAddImageTransformMetaDataProducer(inputProducer); // depends on control dependency: [if], data = [none]
inputProducer =
mProducerFactory.newResizeAndRotateProducer(inputProducer, true, mImageTranscoderFactory); // depends on control dependency: [if], data = [none]
mDataFetchSequence = newBitmapCacheGetToDecodeSequence(inputProducer); // depends on control dependency: [if], data = [none]
}
return mDataFetchSequence;
} }
|
public class class_name {
protected synchronized void flushSenders() {
if(flushingSenders) {
throw UndertowMessages.MESSAGES.recursiveCallToFlushingSenders();
}
flushingSenders = true;
try {
int toSend = 0;
while (!newFrames.isEmpty()) {
S frame = newFrames.poll();
frame.preWrite();
if (framePriority.insertFrame(frame, pendingFrames)) {
if (!heldFrames.isEmpty()) {
framePriority.frameAdded(frame, pendingFrames, heldFrames);
}
} else {
heldFrames.add(frame);
}
}
boolean finalFrame = false;
ListIterator<S> it = pendingFrames.listIterator();
while (it.hasNext()) {
S sender = it.next();
if (sender.isReadyForFlush()) {
++toSend;
} else {
break;
}
if (sender.isLastFrame()) {
finalFrame = true;
}
}
if (toSend == 0) {
//if there is nothing to send we just attempt a flush on the underlying channel
try {
if(channel.getSinkChannel().flush()) {
channel.getSinkChannel().suspendWrites();
}
} catch (Throwable e) {
safeClose(channel);
markWritesBroken(e);
}
return;
}
ByteBuffer[] data = new ByteBuffer[toSend * 3];
int j = 0;
it = pendingFrames.listIterator();
try {
while (j < toSend) {
S next = it.next();
//todo: rather than adding empty buffers just store the offsets
SendFrameHeader frameHeader = next.getFrameHeader();
PooledByteBuffer frameHeaderByteBuffer = frameHeader.getByteBuffer();
ByteBuffer frameTrailerBuffer = frameHeader.getTrailer();
data[j * 3] = frameHeaderByteBuffer != null
? frameHeaderByteBuffer.getBuffer()
: Buffers.EMPTY_BYTE_BUFFER;
data[(j * 3) + 1] = next.getBuffer() == null ? Buffers.EMPTY_BYTE_BUFFER : next.getBuffer();
data[(j * 3) + 2] = frameTrailerBuffer != null ? frameTrailerBuffer : Buffers.EMPTY_BYTE_BUFFER;
++j;
}
long toWrite = Buffers.remaining(data);
long res;
do {
res = channel.getSinkChannel().write(data);
toWrite -= res;
} while (res > 0 && toWrite > 0);
int max = toSend;
while (max > 0) {
S sinkChannel = pendingFrames.get(0);
PooledByteBuffer frameHeaderByteBuffer = sinkChannel.getFrameHeader().getByteBuffer();
ByteBuffer frameTrailerBuffer = sinkChannel.getFrameHeader().getTrailer();
if (frameHeaderByteBuffer != null && frameHeaderByteBuffer.getBuffer().hasRemaining()
|| sinkChannel.getBuffer() != null && sinkChannel.getBuffer().hasRemaining()
|| frameTrailerBuffer != null && frameTrailerBuffer.hasRemaining()) {
break;
}
sinkChannel.flushComplete();
pendingFrames.remove(sinkChannel);
max--;
}
if (!pendingFrames.isEmpty() || !channel.getSinkChannel().flush()) {
channel.getSinkChannel().resumeWrites();
} else {
channel.getSinkChannel().suspendWrites();
}
if (pendingFrames.isEmpty() && finalFrame) {
//all data has been sent. Close gracefully
channel.getSinkChannel().shutdownWrites();
if (!channel.getSinkChannel().flush()) {
channel.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(null, null));
channel.getSinkChannel().resumeWrites();
}
}
} catch (IOException|RuntimeException|Error e) {
safeClose(channel);
markWritesBroken(e);
}
} finally {
flushingSenders = false;
if(!newFrames.isEmpty()) {
runInIoThread(new Runnable() {
@Override
public void run() {
flushSenders();
}
});
}
}
} }
|
public class class_name {
protected synchronized void flushSenders() {
if(flushingSenders) {
throw UndertowMessages.MESSAGES.recursiveCallToFlushingSenders();
}
flushingSenders = true;
try {
int toSend = 0;
while (!newFrames.isEmpty()) {
S frame = newFrames.poll();
frame.preWrite(); // depends on control dependency: [while], data = [none]
if (framePriority.insertFrame(frame, pendingFrames)) {
if (!heldFrames.isEmpty()) {
framePriority.frameAdded(frame, pendingFrames, heldFrames); // depends on control dependency: [if], data = [none]
}
} else {
heldFrames.add(frame); // depends on control dependency: [if], data = [none]
}
}
boolean finalFrame = false;
ListIterator<S> it = pendingFrames.listIterator();
while (it.hasNext()) {
S sender = it.next();
if (sender.isReadyForFlush()) {
++toSend; // depends on control dependency: [if], data = [none]
} else {
break;
}
if (sender.isLastFrame()) {
finalFrame = true; // depends on control dependency: [if], data = [none]
}
}
if (toSend == 0) {
//if there is nothing to send we just attempt a flush on the underlying channel
try {
if(channel.getSinkChannel().flush()) {
channel.getSinkChannel().suspendWrites(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
safeClose(channel);
markWritesBroken(e);
} // depends on control dependency: [catch], data = [none]
return; // depends on control dependency: [if], data = [none]
}
ByteBuffer[] data = new ByteBuffer[toSend * 3];
int j = 0;
it = pendingFrames.listIterator(); // depends on control dependency: [try], data = [none]
try {
while (j < toSend) {
S next = it.next();
//todo: rather than adding empty buffers just store the offsets
SendFrameHeader frameHeader = next.getFrameHeader();
PooledByteBuffer frameHeaderByteBuffer = frameHeader.getByteBuffer();
ByteBuffer frameTrailerBuffer = frameHeader.getTrailer();
data[j * 3] = frameHeaderByteBuffer != null
? frameHeaderByteBuffer.getBuffer()
: Buffers.EMPTY_BYTE_BUFFER; // depends on control dependency: [while], data = [none]
data[(j * 3) + 1] = next.getBuffer() == null ? Buffers.EMPTY_BYTE_BUFFER : next.getBuffer(); // depends on control dependency: [while], data = [(j]
data[(j * 3) + 2] = frameTrailerBuffer != null ? frameTrailerBuffer : Buffers.EMPTY_BYTE_BUFFER; // depends on control dependency: [while], data = [(j]
++j; // depends on control dependency: [while], data = [none]
}
long toWrite = Buffers.remaining(data);
long res;
do {
res = channel.getSinkChannel().write(data);
toWrite -= res;
} while (res > 0 && toWrite > 0);
int max = toSend;
while (max > 0) {
S sinkChannel = pendingFrames.get(0);
PooledByteBuffer frameHeaderByteBuffer = sinkChannel.getFrameHeader().getByteBuffer();
ByteBuffer frameTrailerBuffer = sinkChannel.getFrameHeader().getTrailer();
if (frameHeaderByteBuffer != null && frameHeaderByteBuffer.getBuffer().hasRemaining()
|| sinkChannel.getBuffer() != null && sinkChannel.getBuffer().hasRemaining()
|| frameTrailerBuffer != null && frameTrailerBuffer.hasRemaining()) {
break;
}
sinkChannel.flushComplete(); // depends on control dependency: [while], data = [none]
pendingFrames.remove(sinkChannel); // depends on control dependency: [while], data = [none]
max--; // depends on control dependency: [while], data = [none]
}
if (!pendingFrames.isEmpty() || !channel.getSinkChannel().flush()) {
channel.getSinkChannel().resumeWrites(); // depends on control dependency: [if], data = [none]
} else {
channel.getSinkChannel().suspendWrites(); // depends on control dependency: [if], data = [none]
}
if (pendingFrames.isEmpty() && finalFrame) {
//all data has been sent. Close gracefully
channel.getSinkChannel().shutdownWrites(); // depends on control dependency: [if], data = [none]
if (!channel.getSinkChannel().flush()) {
channel.getSinkChannel().setWriteListener(ChannelListeners.flushingChannelListener(null, null)); // depends on control dependency: [if], data = [none]
channel.getSinkChannel().resumeWrites(); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException|RuntimeException|Error e) {
safeClose(channel);
markWritesBroken(e);
} // depends on control dependency: [catch], data = [none]
} finally {
flushingSenders = false;
if(!newFrames.isEmpty()) {
runInIoThread(new Runnable() {
@Override
public void run() {
flushSenders();
}
}); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public AppIdentity getAppIdentity(final String applicationName) {
if (isCached(applicationName)) {
return applicationIdentityCache.get(applicationName).getAppIdentity();
} else {
// Update environment detail with new configured application name
final EnvironmentDetail updatedEnvDetail =
updateEnvironmentDetail(defaultApiConfig.getEnvDetail(), applicationName);
// use existing apiConfig, with new application name
final ApiConfiguration updatedApiConfig = defaultApiConfig.toBuilder()
.application(applicationName)
.envDetail(updatedEnvDetail)
.build();
return getAppIdentity(updatedApiConfig);
}
} }
|
public class class_name {
public AppIdentity getAppIdentity(final String applicationName) {
if (isCached(applicationName)) {
return applicationIdentityCache.get(applicationName).getAppIdentity(); // depends on control dependency: [if], data = [none]
} else {
// Update environment detail with new configured application name
final EnvironmentDetail updatedEnvDetail =
updateEnvironmentDetail(defaultApiConfig.getEnvDetail(), applicationName);
// use existing apiConfig, with new application name
final ApiConfiguration updatedApiConfig = defaultApiConfig.toBuilder()
.application(applicationName)
.envDetail(updatedEnvDetail)
.build();
return getAppIdentity(updatedApiConfig); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public T add(T setting) {
String key = key(setting);
if (settings.containsKey(key)) {
T instance = settings.get(key);
if (instance.getClass() == setting.getClass()) {
return instance;
}
}
// we could not add if we have a clash, but actual it might be useful
// to 'override' a setting in sub classes with a new one
settings.put(key(setting), setting);
return setting;
} }
|
public class class_name {
public T add(T setting) {
String key = key(setting);
if (settings.containsKey(key)) {
T instance = settings.get(key);
if (instance.getClass() == setting.getClass()) {
return instance; // depends on control dependency: [if], data = [none]
}
}
// we could not add if we have a clash, but actual it might be useful
// to 'override' a setting in sub classes with a new one
settings.put(key(setting), setting);
return setting;
} }
|
public class class_name {
@Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
this.reducer = red;
FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());
TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
this.serializer = serializerFactory.getSerializer();
if (LOG.isDebugEnabled()) {
LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} }
|
public class class_name {
@Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
this.reducer = red;
FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());
TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
this.serializer = serializerFactory.getSerializer();
if (LOG.isDebugEnabled()) {
LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + "."); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(ListAvailableManagementCidrRangesRequest listAvailableManagementCidrRangesRequest, ProtocolMarshaller protocolMarshaller) {
if (listAvailableManagementCidrRangesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getManagementCidrRangeConstraint(), MANAGEMENTCIDRRANGECONSTRAINT_BINDING);
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListAvailableManagementCidrRangesRequest listAvailableManagementCidrRangesRequest, ProtocolMarshaller protocolMarshaller) {
if (listAvailableManagementCidrRangesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getManagementCidrRangeConstraint(), MANAGEMENTCIDRRANGECONSTRAINT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listAvailableManagementCidrRangesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String keyWithParams(String keyName) {
if (keyName.indexOf('|') == -1) {
// no separator found, key has no parameters
return key(keyName, false);
} else {
// this key contains parameters
String[] values = CmsStringUtil.splitAsArray(keyName, '|');
String cutKeyName = values[0];
String[] params = new String[values.length - 1];
System.arraycopy(values, 1, params, 0, params.length);
return key(cutKeyName, params);
}
} }
|
public class class_name {
public String keyWithParams(String keyName) {
if (keyName.indexOf('|') == -1) {
// no separator found, key has no parameters
return key(keyName, false); // depends on control dependency: [if], data = [none]
} else {
// this key contains parameters
String[] values = CmsStringUtil.splitAsArray(keyName, '|');
String cutKeyName = values[0];
String[] params = new String[values.length - 1];
System.arraycopy(values, 1, params, 0, params.length); // depends on control dependency: [if], data = [none]
return key(cutKeyName, params); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addMithraNotificationEvent(String databaseIdentifier, String classname, byte databaseOperation,
List mithraObjects, Object sourceAttribute)
{
MithraDataObject[] dataObjects = new MithraDataObject[mithraObjects.size()];
MithraDataObject dataObject;
for (int i = 0; i < mithraObjects.size(); i++)
{
dataObject = ((MithraTransactionalObject) mithraObjects.get(i)).zGetTxDataForRead();
dataObjects[i] = dataObject;
}
createAndAddNotificationEvent(databaseIdentifier, classname, databaseOperation, dataObjects, null, null, sourceAttribute);
} }
|
public class class_name {
public void addMithraNotificationEvent(String databaseIdentifier, String classname, byte databaseOperation,
List mithraObjects, Object sourceAttribute)
{
MithraDataObject[] dataObjects = new MithraDataObject[mithraObjects.size()];
MithraDataObject dataObject;
for (int i = 0; i < mithraObjects.size(); i++)
{
dataObject = ((MithraTransactionalObject) mithraObjects.get(i)).zGetTxDataForRead();
// depends on control dependency: [for], data = [i]
dataObjects[i] = dataObject;
// depends on control dependency: [for], data = [i]
}
createAndAddNotificationEvent(databaseIdentifier, classname, databaseOperation, dataObjects, null, null, sourceAttribute);
} }
|
public class class_name {
public void setFooter(HeaderFooter footer) {
this.footer = footer;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next();
listener.setFooter(footer);
}
} }
|
public class class_name {
public void setFooter(HeaderFooter footer) {
this.footer = footer;
DocListener listener;
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
listener = (DocListener) iterator.next(); // depends on control dependency: [for], data = [iterator]
listener.setFooter(footer); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
protected ModelNode convertParameterExpressions(ModelNode parameter) {
ModelNode result = parameter;
List<Property> asList;
try {
asList = parameter.asPropertyList();
} catch (IllegalArgumentException iae) {
// We can't convert; we'll just return parameter
asList = null;
}
if (asList != null) {
boolean changeMade = false;
ModelNode newMap = new ModelNode().setEmptyObject();
for (Property prop : parameter.asPropertyList()) {
ModelNode converted = convertParameterElementExpressions(prop.getValue());
newMap.get(prop.getName()).set(converted);
changeMade |= !converted.equals(prop.getValue());
}
if (changeMade) {
result = newMap;
}
}
return result;
} }
|
public class class_name {
@Override
protected ModelNode convertParameterExpressions(ModelNode parameter) {
ModelNode result = parameter;
List<Property> asList;
try {
asList = parameter.asPropertyList(); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iae) {
// We can't convert; we'll just return parameter
asList = null;
} // depends on control dependency: [catch], data = [none]
if (asList != null) {
boolean changeMade = false;
ModelNode newMap = new ModelNode().setEmptyObject();
for (Property prop : parameter.asPropertyList()) {
ModelNode converted = convertParameterElementExpressions(prop.getValue());
newMap.get(prop.getName()).set(converted); // depends on control dependency: [for], data = [prop]
changeMade |= !converted.equals(prop.getValue()); // depends on control dependency: [for], data = [prop]
}
if (changeMade) {
result = newMap; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// if there aren't any changes, save time and bandwidth by not writing to
// storage
boolean has_changes = false;
for (Map.Entry<String, Boolean> entry : changed.entrySet()) {
if (entry.getValue()) {
has_changes = true;
break;
}
}
if (!has_changes) {
LOG.debug(this + " does not have changes, skipping sync to storage");
throw new IllegalStateException("No changes detected in the tree");
}
/**
* Callback executed after loading a tree from storage so that we can
* synchronize changes to the meta data and write them back to storage.
*/
final class StoreTreeCB implements Callback<Deferred<Boolean>, Tree> {
final private Tree local_tree;
public StoreTreeCB(final Tree local_tree) {
this.local_tree = local_tree;
}
/**
* Synchronizes the stored tree object (if found) with the local tree
* and issues a CAS call to write the update to storage.
* @return True if the CAS was successful, false if something changed
* in flight
*/
@Override
public Deferred<Boolean> call(final Tree fetched_tree) throws Exception {
Tree stored_tree = fetched_tree;
final byte[] original_tree = stored_tree == null ? new byte[0] :
stored_tree.toStorageJson();
// now copy changes
if (stored_tree == null) {
stored_tree = local_tree;
} else {
stored_tree.copyChanges(local_tree, overwrite);
}
// reset the change map so we don't keep writing
initializeChangedMap();
final PutRequest put = new PutRequest(tsdb.treeTable(),
Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER,
stored_tree.toStorageJson());
return tsdb.getClient().compareAndSet(put, original_tree);
}
}
// initiate the sync by attempting to fetch an existing tree from storage
return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this));
} }
|
public class class_name {
public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) {
if (tree_id < 1 || tree_id > 65535) {
throw new IllegalArgumentException("Invalid Tree ID");
}
// if there aren't any changes, save time and bandwidth by not writing to
// storage
boolean has_changes = false;
for (Map.Entry<String, Boolean> entry : changed.entrySet()) {
if (entry.getValue()) {
has_changes = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!has_changes) {
LOG.debug(this + " does not have changes, skipping sync to storage"); // depends on control dependency: [if], data = [none]
throw new IllegalStateException("No changes detected in the tree");
}
/**
* Callback executed after loading a tree from storage so that we can
* synchronize changes to the meta data and write them back to storage.
*/
final class StoreTreeCB implements Callback<Deferred<Boolean>, Tree> {
final private Tree local_tree;
public StoreTreeCB(final Tree local_tree) {
this.local_tree = local_tree;
}
/**
* Synchronizes the stored tree object (if found) with the local tree
* and issues a CAS call to write the update to storage.
* @return True if the CAS was successful, false if something changed
* in flight
*/
@Override
public Deferred<Boolean> call(final Tree fetched_tree) throws Exception {
Tree stored_tree = fetched_tree;
final byte[] original_tree = stored_tree == null ? new byte[0] :
stored_tree.toStorageJson();
// now copy changes
if (stored_tree == null) {
stored_tree = local_tree;
} else {
stored_tree.copyChanges(local_tree, overwrite);
}
// reset the change map so we don't keep writing
initializeChangedMap();
final PutRequest put = new PutRequest(tsdb.treeTable(),
Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER,
stored_tree.toStorageJson());
return tsdb.getClient().compareAndSet(put, original_tree);
}
}
// initiate the sync by attempting to fetch an existing tree from storage
return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this));
} }
|
public class class_name {
public void marshall(DetectFacesRequest detectFacesRequest, ProtocolMarshaller protocolMarshaller) {
if (detectFacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detectFacesRequest.getImage(), IMAGE_BINDING);
protocolMarshaller.marshall(detectFacesRequest.getAttributes(), ATTRIBUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DetectFacesRequest detectFacesRequest, ProtocolMarshaller protocolMarshaller) {
if (detectFacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detectFacesRequest.getImage(), IMAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detectFacesRequest.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private boolean checkObjectId(int dtx, int dty)
{
final int tw = transformable.getWidth() / map.getTileWidth();
final int th = transformable.getHeight() / map.getTileHeight();
for (int tx = dtx; tx < dtx + tw; tx++)
{
for (int ty = dty; ty < dty + th; ty++)
{
final Collection<Integer> ids = mapPath.getObjectsId(tx, ty);
if (!ids.isEmpty() && !ids.contains(id))
{
return false;
}
}
}
return mapPath.isAreaAvailable(this, dtx, dty, tw, th, id);
} }
|
public class class_name {
private boolean checkObjectId(int dtx, int dty)
{
final int tw = transformable.getWidth() / map.getTileWidth();
final int th = transformable.getHeight() / map.getTileHeight();
for (int tx = dtx; tx < dtx + tw; tx++)
{
for (int ty = dty; ty < dty + th; ty++)
{
final Collection<Integer> ids = mapPath.getObjectsId(tx, ty);
if (!ids.isEmpty() && !ids.contains(id))
{
return false; // depends on control dependency: [if], data = [none]
}
}
}
return mapPath.isAreaAvailable(this, dtx, dty, tw, th, id);
} }
|
public class class_name {
public Long getInsertNumber() {
Long insertNumber = 0L;
if (items.size() != 0) {
for (TableStat item : items) {
insertNumber += item.getInsertCount();
}
}
return insertNumber;
} }
|
public class class_name {
public Long getInsertNumber() {
Long insertNumber = 0L;
if (items.size() != 0) {
for (TableStat item : items) {
insertNumber += item.getInsertCount(); // depends on control dependency: [for], data = [item]
}
}
return insertNumber;
} }
|
public class class_name {
public DomainCommandBuilder addProcessControllerJavaOption(final String arg) {
if (arg != null && !arg.trim().isEmpty()) {
final Argument argument = Arguments.parse(arg);
if (argument.getKey().equals(SECURITY_MANAGER_PROP)) {
setUseSecurityManager(true);
} else {
processControllerJavaOpts.add(argument);
}
}
return this;
} }
|
public class class_name {
public DomainCommandBuilder addProcessControllerJavaOption(final String arg) {
if (arg != null && !arg.trim().isEmpty()) {
final Argument argument = Arguments.parse(arg);
if (argument.getKey().equals(SECURITY_MANAGER_PROP)) {
setUseSecurityManager(true); // depends on control dependency: [if], data = [none]
} else {
processControllerJavaOpts.add(argument); // depends on control dependency: [if], data = [none]
}
}
return this;
} }
|
public class class_name {
public static InputStream inputStream(File file) {
// workaround http://stackoverflow.com/questions/36880692/java-file-does-not-exists-but-file-getabsolutefile-exists
if (!file.exists()) {
file = file.getAbsoluteFile();
}
if (!file.exists()) {
throw E.ioException("File does not exists: %s", file.getPath());
}
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
throw E.ioException(e);
}
} }
|
public class class_name {
public static InputStream inputStream(File file) {
// workaround http://stackoverflow.com/questions/36880692/java-file-does-not-exists-but-file-getabsolutefile-exists
if (!file.exists()) {
file = file.getAbsoluteFile(); // depends on control dependency: [if], data = [none]
}
if (!file.exists()) {
throw E.ioException("File does not exists: %s", file.getPath());
}
try {
return new FileInputStream(file); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw E.ioException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int previousNode()
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null)); //"This NodeSetDTM can not iterate to a previous node!");
if ((m_next - 1) > 0)
{
m_next--;
return this.elementAt(m_next);
}
else
return DTM.NULL;
} }
|
public class class_name {
public int previousNode()
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null)); //"This NodeSetDTM can not iterate to a previous node!");
if ((m_next - 1) > 0)
{
m_next--; // depends on control dependency: [if], data = [none]
return this.elementAt(m_next); // depends on control dependency: [if], data = [none]
}
else
return DTM.NULL;
} }
|
public class class_name {
@VisibleForTesting
static ProcessIdentifier getProcessIdentifier(String jvmName, Timestamp censusTimestamp) {
String hostname;
int pid;
// jvmName should be something like '<pid>@<hostname>', at least in Oracle and OpenJdk JVMs
int delimiterIndex = jvmName.indexOf('@');
if (delimiterIndex < 1) {
// Not the expected format, generate a random number.
try {
hostname = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
hostname = "localhost";
}
// Generate a random number as the PID.
pid = new SecureRandom().nextInt();
} else {
hostname = jvmName.substring(delimiterIndex + 1, jvmName.length());
try {
pid = Integer.parseInt(jvmName.substring(0, delimiterIndex));
} catch (NumberFormatException e) {
// Generate a random number as the PID if format is unexpected.
pid = new SecureRandom().nextInt();
}
}
return ProcessIdentifier.newBuilder()
.setHostName(hostname)
.setPid(pid)
.setStartTimestamp(MetricsProtoUtils.toTimestampProto(censusTimestamp))
.build();
} }
|
public class class_name {
@VisibleForTesting
static ProcessIdentifier getProcessIdentifier(String jvmName, Timestamp censusTimestamp) {
String hostname;
int pid;
// jvmName should be something like '<pid>@<hostname>', at least in Oracle and OpenJdk JVMs
int delimiterIndex = jvmName.indexOf('@');
if (delimiterIndex < 1) {
// Not the expected format, generate a random number.
try {
hostname = InetAddress.getLocalHost().getHostName(); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
hostname = "localhost";
} // depends on control dependency: [catch], data = [none]
// Generate a random number as the PID.
pid = new SecureRandom().nextInt(); // depends on control dependency: [if], data = [none]
} else {
hostname = jvmName.substring(delimiterIndex + 1, jvmName.length()); // depends on control dependency: [if], data = [(delimiterIndex]
try {
pid = Integer.parseInt(jvmName.substring(0, delimiterIndex)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// Generate a random number as the PID if format is unexpected.
pid = new SecureRandom().nextInt();
} // depends on control dependency: [catch], data = [none]
}
return ProcessIdentifier.newBuilder()
.setHostName(hostname)
.setPid(pid)
.setStartTimestamp(MetricsProtoUtils.toTimestampProto(censusTimestamp))
.build();
} }
|
public class class_name {
public void marshall(SplunkRetryOptions splunkRetryOptions, ProtocolMarshaller protocolMarshaller) {
if (splunkRetryOptions == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(splunkRetryOptions.getDurationInSeconds(), DURATIONINSECONDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SplunkRetryOptions splunkRetryOptions, ProtocolMarshaller protocolMarshaller) {
if (splunkRetryOptions == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(splunkRetryOptions.getDurationInSeconds(), DURATIONINSECONDS_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 T validationCallback(ValidationCallback callback) {
if (callback instanceof ApplicationContextAware) {
((ApplicationContextAware) callback).setApplicationContext(applicationContext);
}
getAction().setValidationCallback(callback);
return self;
} }
|
public class class_name {
public T validationCallback(ValidationCallback callback) {
if (callback instanceof ApplicationContextAware) {
((ApplicationContextAware) callback).setApplicationContext(applicationContext); // depends on control dependency: [if], data = [none]
}
getAction().setValidationCallback(callback);
return self;
} }
|
public class class_name {
public void addDeprecationInfo(Content div) {
List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(packageElement)) {
CommentHelper ch = utils.getCommentHelper(packageElement);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.addStyle(HtmlStyle.deprecatedContent);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv);
}
}
div.addContent(deprDiv);
}
} }
|
public class class_name {
public void addDeprecationInfo(Content div) {
List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(packageElement)) {
CommentHelper ch = utils.getCommentHelper(packageElement);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.addStyle(HtmlStyle.deprecatedContent); // depends on control dependency: [if], data = [none]
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.addContent(deprPhrase); // depends on control dependency: [if], data = [none]
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); // depends on control dependency: [if], data = [none]
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv); // depends on control dependency: [if], data = [none]
}
}
div.addContent(deprDiv); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void pdb_ATOM_Handler(String line) {
if ( params.isHeaderOnly())
return;
// let's first get the chain name which will serve to identify if we are starting a new molecule
String chainName = line.substring(21,22);
if (chainName.equals(" ")) {
blankChainIdsPresent = true;
}
if (currentChain!=null && !currentChain.getName().equals(chainName)) {
// new chain name: another molecule coming
startOfMolecule = true;
}
if (startOfMolecule) {
// we add last chain if there was one
if (currentChain!=null) {
currentModel.add(currentChain);
// let's not forget adding the last group to the finishing chain
if (currentGroup!=null) {
currentChain.addGroup(currentGroup);
}
}
// we initialise the new molecule to come
currentChain = new ChainImpl();
// note that the chainId (asym id) is set properly later in assignAsymIds
currentChain.setId(chainName);
currentChain.setName(chainName);
}
if (startOfModel) {
// we add last model if there was one
if (currentModel!=null) {
allModels.add(currentModel);
}
// we initialise the model to come
currentModel = new ArrayList<>();
}
// let's get the residue number and see if we need to start a new group
String groupCode3 = line.substring(17,20).trim();
String resNum = line.substring(22,26).trim();
Character iCode = line.substring(26,27).charAt(0);
if ( iCode == ' ')
iCode = null;
ResidueNumber residueNumber = new ResidueNumber(chainName, Integer.valueOf(resNum), iCode);
//recordName groupCode3
//| | resNum
//| | | iCode
//| | | | | ||
//ATOM 1 N ASP A 15 110.964 24.941 59.191 1.00 83.44 N
//ATOM 1964 N ARG H 221A 5.963 -16.715 27.669 1.00 28.59 N
Character aminoCode1 = StructureTools.get1LetterCode(groupCode3);
String recordName = line.substring (0, 6).trim ();
boolean isHetAtomInFile = false;
if (recordName.equals("HETATM") ){
// HETATOM RECORDS are treated slightly differently
// some modified amino acids that we want to treat as amino acids
// can be found as HETATOM records
if ( aminoCode1 != null && aminoCode1.equals(StructureTools.UNKNOWN_GROUP_LABEL))
aminoCode1 = null;
isHetAtomInFile = true;
}
if ( startOfMolecule) {
currentGroup = getNewGroup(recordName, aminoCode1, groupCode3);
currentGroup.setPDBName(groupCode3);
currentGroup.setResidueNumber(residueNumber);
currentGroup.setHetAtomInFile(isHetAtomInFile);
}
// resetting states
startOfModel = false;
startOfMolecule = false;
Character altLoc = new Character(line.substring (16, 17).charAt(0));
Group altGroup = null;
// check if residue number is the same ...
if ( ! residueNumber.equals(currentGroup.getResidueNumber())) {
currentChain.addGroup(currentGroup);
currentGroup.trimToSize();
currentGroup = getNewGroup(recordName, aminoCode1, groupCode3);
currentGroup.setPDBName(groupCode3);
currentGroup.setResidueNumber(residueNumber);
currentGroup.setHetAtomInFile(isHetAtomInFile);
} else {
// same residueNumber, but altLocs...
// test altLoc
if ( ! altLoc.equals(' ')) {
logger.debug("found altLoc! " + currentGroup + " " + altGroup);
altGroup = getCorrectAltLocGroup( altLoc,recordName,aminoCode1,groupCode3);
if ( altGroup.getChain() == null) {
// need to set current chain
altGroup.setChain(currentChain);
}
}
}
atomCount++;
if ( atomCount == atomCAThreshold ) {
// throw away the SEQRES lines - too much to deal with...
logger.warn("more than " + atomCAThreshold + " atoms in this structure, ignoring the SEQRES lines");
seqResChains.clear();
switchCAOnly();
}
if ( atomCount == loadMaxAtoms){
logger.warn("File has more atoms than max specified in parsing parameters ({}). Ignoring atoms after line: {}", loadMaxAtoms, line);
return;
}
if ( atomCount > loadMaxAtoms){
return;
}
// 1 2 3 4 5 6
//012345678901234567890123456789012345678901234567890123456789
//ATOM 1 N MET 1 20.154 29.699 5.276 1.0
//ATOM 112 CA ASP 112 41.017 33.527 28.371 1.00 0.00
//ATOM 53 CA MET 7 23.772 33.989 -21.600 1.00 0.00 C
//ATOM 112 CA ASP 112 37.613 26.621 33.571 0 0
String fullname = line.substring (12, 16);
// check for CA only if requested
if ( parseCAonly ){
// yes , user wants to get CA only
// only parse CA atoms...
if (! fullname.equals(" CA ")){
//System.out.println("ignoring " + line);
atomCount--;
return;
}
}
if ( params.getAcceptedAtomNames() != null) {
boolean found = false;
for (String ok : params.getAcceptedAtomNames()){
//System.out.println(ok + "< >" + fullname +"<");
if ( ok.equals(fullname.trim())) {
found = true;
break;
}
}
if ( ! found) {
atomCount--;
return;
}
}
// create new atom
int pdbnumber = Integer.parseInt (line.substring (6, 11).trim ());
AtomImpl atom = new AtomImpl() ;
atom.setPDBserial(pdbnumber) ;
atom.setAltLoc(altLoc);
atom.setName(fullname.trim());
double x = Double.parseDouble (line.substring (30, 38).trim());
double y = Double.parseDouble (line.substring (38, 46).trim());
double z = Double.parseDouble (line.substring (46, 54).trim());
double[] coords = new double[3];
coords[0] = x ;
coords[1] = y ;
coords[2] = z ;
atom.setCoords(coords);
float occu = 1.0f;
if ( line.length() > 59 ) {
try {
// occu and tempf are sometimes not used :-/
occu = Float.parseFloat (line.substring (54, 60).trim());
} catch (NumberFormatException e){}
}
float tempf = 0.0f;
if ( line.length() > 65) {
try {
tempf = Float.parseFloat (line.substring (60, 66).trim());
} catch (NumberFormatException e){}
}
atom.setOccupancy( occu );
atom.setTempFactor( tempf );
// Parse element from the element field. If this field is
// missing (i.e. misformatted PDB file), then parse the
// element from the chemical component.
Element element = Element.R;
boolean guessElement = true;
if ( line.length() > 77 ) {
// parse element from element field
String elementSymbol = line.substring(76, 78).trim();
if (elementSymbol.isEmpty()) {
logger.info("Element column was empty for atom {} {}. Assigning atom element "
+ "from Chemical Component Dictionary information", fullname.trim(), pdbnumber);
} else {
try {
element = Element.valueOfIgnoreCase(elementSymbol);
guessElement = false;
} catch (IllegalArgumentException e){
logger.info("Element {} of atom {} {} was not recognised. Assigning atom element "
+ "from Chemical Component Dictionary information", elementSymbol,
fullname.trim(), pdbnumber);
}
}
} else {
logger.info("Missformatted PDB file: element column of atom {} {} is not present. "
+ "Assigning atom element from Chemical Component Dictionary information",
fullname.trim(), pdbnumber);
}
if (guessElement) {
String elementSymbol = null;
if (currentGroup.getChemComp() != null) {
for (ChemCompAtom a : currentGroup.getChemComp().getAtoms()) {
if (a.getAtom_id().equals(fullname.trim())) {
elementSymbol = a.getType_symbol();
break;
}
}
if (elementSymbol == null) {
logger.info("Atom name {} was not found in the Chemical Component Dictionary information of {}. "
+ "Assigning generic element R to it", fullname.trim(), currentGroup.getPDBName());
} else {
try {
element = Element.valueOfIgnoreCase(elementSymbol);
} catch (IllegalArgumentException e) {
// this can still happen for cases like UNK
logger.info("Element symbol {} found in chemical component dictionary for Atom {} {} could not be recognised as a known element. "
+ "Assigning generic element R to it", elementSymbol, fullname.trim(), pdbnumber);
}
}
} else {
logger.warn("Chemical Component Dictionary information was not found for Atom name {}. "
+ "Assigning generic element R to it", fullname.trim());
}
}
atom.setElement(element);
//see if chain_id is one of the previous chains ...
if ( altGroup != null) {
altGroup.addAtom(atom);
altGroup = null;
}
else {
currentGroup.addAtom(atom);
}
// make sure that main group has all atoms
// GitHub issue: #76
if ( ! currentGroup.hasAtom(atom.getName())) {
currentGroup.addAtom(atom);
}
} }
|
public class class_name {
private void pdb_ATOM_Handler(String line) {
if ( params.isHeaderOnly())
return;
// let's first get the chain name which will serve to identify if we are starting a new molecule
String chainName = line.substring(21,22);
if (chainName.equals(" ")) {
blankChainIdsPresent = true; // depends on control dependency: [if], data = [none]
}
if (currentChain!=null && !currentChain.getName().equals(chainName)) {
// new chain name: another molecule coming
startOfMolecule = true; // depends on control dependency: [if], data = [none]
}
if (startOfMolecule) {
// we add last chain if there was one
if (currentChain!=null) {
currentModel.add(currentChain); // depends on control dependency: [if], data = [(currentChain]
// let's not forget adding the last group to the finishing chain
if (currentGroup!=null) {
currentChain.addGroup(currentGroup); // depends on control dependency: [if], data = [(currentGroup]
}
}
// we initialise the new molecule to come
currentChain = new ChainImpl(); // depends on control dependency: [if], data = [none]
// note that the chainId (asym id) is set properly later in assignAsymIds
currentChain.setId(chainName); // depends on control dependency: [if], data = [none]
currentChain.setName(chainName); // depends on control dependency: [if], data = [none]
}
if (startOfModel) {
// we add last model if there was one
if (currentModel!=null) {
allModels.add(currentModel); // depends on control dependency: [if], data = [(currentModel]
}
// we initialise the model to come
currentModel = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
// let's get the residue number and see if we need to start a new group
String groupCode3 = line.substring(17,20).trim();
String resNum = line.substring(22,26).trim();
Character iCode = line.substring(26,27).charAt(0);
if ( iCode == ' ')
iCode = null;
ResidueNumber residueNumber = new ResidueNumber(chainName, Integer.valueOf(resNum), iCode);
//recordName groupCode3
//| | resNum
//| | | iCode
//| | | | | ||
//ATOM 1 N ASP A 15 110.964 24.941 59.191 1.00 83.44 N
//ATOM 1964 N ARG H 221A 5.963 -16.715 27.669 1.00 28.59 N
Character aminoCode1 = StructureTools.get1LetterCode(groupCode3);
String recordName = line.substring (0, 6).trim ();
boolean isHetAtomInFile = false;
if (recordName.equals("HETATM") ){
// HETATOM RECORDS are treated slightly differently
// some modified amino acids that we want to treat as amino acids
// can be found as HETATOM records
if ( aminoCode1 != null && aminoCode1.equals(StructureTools.UNKNOWN_GROUP_LABEL))
aminoCode1 = null;
isHetAtomInFile = true; // depends on control dependency: [if], data = [none]
}
if ( startOfMolecule) {
currentGroup = getNewGroup(recordName, aminoCode1, groupCode3); // depends on control dependency: [if], data = [none]
currentGroup.setPDBName(groupCode3); // depends on control dependency: [if], data = [none]
currentGroup.setResidueNumber(residueNumber); // depends on control dependency: [if], data = [none]
currentGroup.setHetAtomInFile(isHetAtomInFile); // depends on control dependency: [if], data = [none]
}
// resetting states
startOfModel = false;
startOfMolecule = false;
Character altLoc = new Character(line.substring (16, 17).charAt(0));
Group altGroup = null;
// check if residue number is the same ...
if ( ! residueNumber.equals(currentGroup.getResidueNumber())) {
currentChain.addGroup(currentGroup); // depends on control dependency: [if], data = [none]
currentGroup.trimToSize(); // depends on control dependency: [if], data = [none]
currentGroup = getNewGroup(recordName, aminoCode1, groupCode3); // depends on control dependency: [if], data = [none]
currentGroup.setPDBName(groupCode3); // depends on control dependency: [if], data = [none]
currentGroup.setResidueNumber(residueNumber); // depends on control dependency: [if], data = [none]
currentGroup.setHetAtomInFile(isHetAtomInFile); // depends on control dependency: [if], data = [none]
} else {
// same residueNumber, but altLocs...
// test altLoc
if ( ! altLoc.equals(' ')) {
logger.debug("found altLoc! " + currentGroup + " " + altGroup); // depends on control dependency: [if], data = [none]
altGroup = getCorrectAltLocGroup( altLoc,recordName,aminoCode1,groupCode3); // depends on control dependency: [if], data = [none]
if ( altGroup.getChain() == null) {
// need to set current chain
altGroup.setChain(currentChain); // depends on control dependency: [if], data = [none]
}
}
}
atomCount++;
if ( atomCount == atomCAThreshold ) {
// throw away the SEQRES lines - too much to deal with...
logger.warn("more than " + atomCAThreshold + " atoms in this structure, ignoring the SEQRES lines"); // depends on control dependency: [if], data = [none]
seqResChains.clear(); // depends on control dependency: [if], data = [none]
switchCAOnly(); // depends on control dependency: [if], data = [none]
}
if ( atomCount == loadMaxAtoms){
logger.warn("File has more atoms than max specified in parsing parameters ({}). Ignoring atoms after line: {}", loadMaxAtoms, line); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if ( atomCount > loadMaxAtoms){
return; // depends on control dependency: [if], data = [none]
}
// 1 2 3 4 5 6
//012345678901234567890123456789012345678901234567890123456789
//ATOM 1 N MET 1 20.154 29.699 5.276 1.0
//ATOM 112 CA ASP 112 41.017 33.527 28.371 1.00 0.00
//ATOM 53 CA MET 7 23.772 33.989 -21.600 1.00 0.00 C
//ATOM 112 CA ASP 112 37.613 26.621 33.571 0 0
String fullname = line.substring (12, 16);
// check for CA only if requested
if ( parseCAonly ){
// yes , user wants to get CA only
// only parse CA atoms...
if (! fullname.equals(" CA ")){
//System.out.println("ignoring " + line);
atomCount--; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
if ( params.getAcceptedAtomNames() != null) {
boolean found = false;
for (String ok : params.getAcceptedAtomNames()){
//System.out.println(ok + "< >" + fullname +"<");
if ( ok.equals(fullname.trim())) {
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if ( ! found) {
atomCount--; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// create new atom
int pdbnumber = Integer.parseInt (line.substring (6, 11).trim ());
AtomImpl atom = new AtomImpl() ;
atom.setPDBserial(pdbnumber) ;
atom.setAltLoc(altLoc);
atom.setName(fullname.trim());
double x = Double.parseDouble (line.substring (30, 38).trim());
double y = Double.parseDouble (line.substring (38, 46).trim());
double z = Double.parseDouble (line.substring (46, 54).trim());
double[] coords = new double[3];
coords[0] = x ;
coords[1] = y ;
coords[2] = z ;
atom.setCoords(coords);
float occu = 1.0f;
if ( line.length() > 59 ) {
try {
// occu and tempf are sometimes not used :-/
occu = Float.parseFloat (line.substring (54, 60).trim()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e){} // depends on control dependency: [catch], data = [none]
}
float tempf = 0.0f;
if ( line.length() > 65) {
try {
tempf = Float.parseFloat (line.substring (60, 66).trim()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e){} // depends on control dependency: [catch], data = [none]
}
atom.setOccupancy( occu );
atom.setTempFactor( tempf );
// Parse element from the element field. If this field is
// missing (i.e. misformatted PDB file), then parse the
// element from the chemical component.
Element element = Element.R;
boolean guessElement = true;
if ( line.length() > 77 ) {
// parse element from element field
String elementSymbol = line.substring(76, 78).trim();
if (elementSymbol.isEmpty()) {
logger.info("Element column was empty for atom {} {}. Assigning atom element "
+ "from Chemical Component Dictionary information", fullname.trim(), pdbnumber); // depends on control dependency: [if], data = [none]
} else {
try {
element = Element.valueOfIgnoreCase(elementSymbol); // depends on control dependency: [try], data = [none]
guessElement = false; // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e){
logger.info("Element {} of atom {} {} was not recognised. Assigning atom element "
+ "from Chemical Component Dictionary information", elementSymbol,
fullname.trim(), pdbnumber);
} // depends on control dependency: [catch], data = [none]
}
} else {
logger.info("Missformatted PDB file: element column of atom {} {} is not present. "
+ "Assigning atom element from Chemical Component Dictionary information",
fullname.trim(), pdbnumber); // depends on control dependency: [if], data = [none]
}
if (guessElement) {
String elementSymbol = null;
if (currentGroup.getChemComp() != null) {
for (ChemCompAtom a : currentGroup.getChemComp().getAtoms()) {
if (a.getAtom_id().equals(fullname.trim())) {
elementSymbol = a.getType_symbol(); // depends on control dependency: [if], data = [none]
break;
}
}
if (elementSymbol == null) {
logger.info("Atom name {} was not found in the Chemical Component Dictionary information of {}. "
+ "Assigning generic element R to it", fullname.trim(), currentGroup.getPDBName());
} else {
try {
element = Element.valueOfIgnoreCase(elementSymbol);
} catch (IllegalArgumentException e) {
// this can still happen for cases like UNK
logger.info("Element symbol {} found in chemical component dictionary for Atom {} {} could not be recognised as a known element. "
+ "Assigning generic element R to it", elementSymbol, fullname.trim(), pdbnumber);
}
}
} else {
logger.warn("Chemical Component Dictionary information was not found for Atom name {}. "
+ "Assigning generic element R to it", fullname.trim());
}
}
atom.setElement(element);
//see if chain_id is one of the previous chains ...
if ( altGroup != null) {
altGroup.addAtom(atom);
altGroup = null;
}
else {
currentGroup.addAtom(atom);
}
// make sure that main group has all atoms
// GitHub issue: #76
if ( ! currentGroup.hasAtom(atom.getName())) {
currentGroup.addAtom(atom);
}
} }
|
public class class_name {
public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
Map<String, ?> sharedState, Map<String, ?> options) {
log.debug("Initializing YubikeyLoginModule");
this.subject = newSubject;
this.callbackHandler = newCallbackHandler;
/* Yubico verification client */
Integer clientId = Integer.parseInt(options.get(OPTION_YUBICO_CLIENT_ID).toString());
String clientKey = options.get(OPTION_YUBICO_CLIENT_KEY).toString();
this.yc = YubicoClient.getClient(clientId, clientKey);
/* Realm of principals added after authentication */
if (options.containsKey(OPTION_YUBICO_ID_REALM)) {
this.idRealm = options.get(OPTION_YUBICO_ID_REALM).toString();
}
/* Should this JAAS module be ignored when no OTPs are supplied? */
if (options.containsKey(OPTION_YUBICO_SOFT_FAIL_NO_OTPS)) {
if ("true".equals(options.get(OPTION_YUBICO_SOFT_FAIL_NO_OTPS).toString())) {
this.soft_fail_on_no_otps = true;
}
}
/* Should this JAAS module uses j_otp form to pick up otp */
if (options.containsKey(OPTION_YUBICO_JACC)) {
if ("true".equals(options.get(OPTION_YUBICO_JACC).toString())) {
this.jacc = true;
}
}
/* User-provided URLs to the Yubico validation service, separated by "|". */
if (options.containsKey(OPTION_YUBICO_WSAPI_URLS)) {
String in = options.get(OPTION_YUBICO_WSAPI_URLS).toString();
String l[] = in.split("\\|");
this.yc.setWsapiUrls(l);
}
if (options.containsKey(OPTION_YUBICO_SYNC_POLICY)) {
this.yc.setSync(Integer.parseInt(options.get(OPTION_YUBICO_SYNC_POLICY).toString()));
}
/* Instantiate the specified usermap implementation. */
String usermap_class_name = null;
if (options.containsKey(OPTION_YUBICO_USERMAP_CLASS)) {
usermap_class_name = options.get(OPTION_YUBICO_USERMAP_CLASS).toString();
} else {
usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl"; // Default implementation
}
try {
log.debug("Trying to instantiate {}",usermap_class_name);
this.ykmap = (YubikeyToUserMap) Class.forName(usermap_class_name).newInstance();
this.ykmap.setOptions(options);
} catch (ClassNotFoundException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
} catch (InstantiationException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
} catch (IllegalAccessException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
}
} }
|
public class class_name {
public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
Map<String, ?> sharedState, Map<String, ?> options) {
log.debug("Initializing YubikeyLoginModule");
this.subject = newSubject;
this.callbackHandler = newCallbackHandler;
/* Yubico verification client */
Integer clientId = Integer.parseInt(options.get(OPTION_YUBICO_CLIENT_ID).toString());
String clientKey = options.get(OPTION_YUBICO_CLIENT_KEY).toString();
this.yc = YubicoClient.getClient(clientId, clientKey);
/* Realm of principals added after authentication */
if (options.containsKey(OPTION_YUBICO_ID_REALM)) {
this.idRealm = options.get(OPTION_YUBICO_ID_REALM).toString();
}
/* Should this JAAS module be ignored when no OTPs are supplied? */
if (options.containsKey(OPTION_YUBICO_SOFT_FAIL_NO_OTPS)) {
if ("true".equals(options.get(OPTION_YUBICO_SOFT_FAIL_NO_OTPS).toString())) {
this.soft_fail_on_no_otps = true; // depends on control dependency: [if], data = [none]
}
}
/* Should this JAAS module uses j_otp form to pick up otp */
if (options.containsKey(OPTION_YUBICO_JACC)) {
if ("true".equals(options.get(OPTION_YUBICO_JACC).toString())) {
this.jacc = true; // depends on control dependency: [if], data = [none]
}
}
/* User-provided URLs to the Yubico validation service, separated by "|". */
if (options.containsKey(OPTION_YUBICO_WSAPI_URLS)) {
String in = options.get(OPTION_YUBICO_WSAPI_URLS).toString();
String l[] = in.split("\\|");
this.yc.setWsapiUrls(l);
}
if (options.containsKey(OPTION_YUBICO_SYNC_POLICY)) {
this.yc.setSync(Integer.parseInt(options.get(OPTION_YUBICO_SYNC_POLICY).toString()));
}
/* Instantiate the specified usermap implementation. */
String usermap_class_name = null;
if (options.containsKey(OPTION_YUBICO_USERMAP_CLASS)) {
usermap_class_name = options.get(OPTION_YUBICO_USERMAP_CLASS).toString();
} else {
usermap_class_name = "com.yubico.jaas.impl.YubikeyToUserMapImpl"; // Default implementation
}
try {
log.debug("Trying to instantiate {}",usermap_class_name);
this.ykmap = (YubikeyToUserMap) Class.forName(usermap_class_name).newInstance();
this.ykmap.setOptions(options);
} catch (ClassNotFoundException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
} catch (InstantiationException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
} catch (IllegalAccessException ex) {
log.error("Could not create usermap from class " + usermap_class_name, ex);
}
} }
|
public class class_name {
public String buildAsHex(BuilderMode builderMode) {
byte[] ret = build(builderMode);
if (Validator.isEmpty(ret)) {
return null;
}
return DatatypeConverter.printHexBinary(ret);
} }
|
public class class_name {
public String buildAsHex(BuilderMode builderMode) {
byte[] ret = build(builderMode);
if (Validator.isEmpty(ret)) {
return null; // depends on control dependency: [if], data = [none]
}
return DatatypeConverter.printHexBinary(ret);
} }
|
public class class_name {
public void uninstallProfileSpecification(ProfileSpecificationComponent component) throws UnrecognizedProfileSpecificationException {
Collection<String> profileTableNames = getDeclaredProfileTableNames(component.getProfileSpecificationID());
for(String profileTableName:profileTableNames) {
try {
this.removeProfileTable(profileTableName, true);
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
}
}
// FIXME: For JBoss 7.2.0.Final:
// we have a problem with org.hibernate.service.UnknownServiceException:
// Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry]
// see https://hibernate.atlassian.net/browse/HHH-8586
//component.getProfileEntityFramework().uninstall();
} }
|
public class class_name {
public void uninstallProfileSpecification(ProfileSpecificationComponent component) throws UnrecognizedProfileSpecificationException {
Collection<String> profileTableNames = getDeclaredProfileTableNames(component.getProfileSpecificationID());
for(String profileTableName:profileTableNames) {
try {
this.removeProfileTable(profileTableName, true); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
}
// FIXME: For JBoss 7.2.0.Final:
// we have a problem with org.hibernate.service.UnknownServiceException:
// Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry]
// see https://hibernate.atlassian.net/browse/HHH-8586
//component.getProfileEntityFramework().uninstall();
} }
|
public class class_name {
public void printStackTrace() {
if (detail == null) {
super.printStackTrace();
} else {
synchronized(System.err) {
System.err.println(super.getMessage() + "; nested exception is:");
detail.printStackTrace();
}
}
} }
|
public class class_name {
public void printStackTrace() {
if (detail == null) {
super.printStackTrace(); // depends on control dependency: [if], data = [none]
} else {
synchronized(System.err) { // depends on control dependency: [if], data = [none]
System.err.println(super.getMessage() + "; nested exception is:");
detail.printStackTrace();
}
}
} }
|
public class class_name {
static void serialize(DataOutput out, Serializers serializers)
throws IOException {
StringBuilder msg = new StringBuilder(String.format("Serialize %d serializer classes:", serializers.serializers.values().size()));
int size = serializers.serializers.values().size();
out.writeInt(size);
if (size > 0) {
for (SerializerWrapper sw : serializers.serializers.values()) {
int index = sw.index;
String name = sw.serializer.getClass().getName();
out.writeInt(index);
out.writeUTF(name);
msg.append(String.format("%n (%d) %s", index, name));
}
LOGGER.info(msg.toString());
}
} }
|
public class class_name {
static void serialize(DataOutput out, Serializers serializers)
throws IOException {
StringBuilder msg = new StringBuilder(String.format("Serialize %d serializer classes:", serializers.serializers.values().size()));
int size = serializers.serializers.values().size();
out.writeInt(size);
if (size > 0) {
for (SerializerWrapper sw : serializers.serializers.values()) {
int index = sw.index;
String name = sw.serializer.getClass().getName();
out.writeInt(index); // depends on control dependency: [for], data = [none]
out.writeUTF(name); // depends on control dependency: [for], data = [none]
msg.append(String.format("%n (%d) %s", index, name)); // depends on control dependency: [for], data = [none]
}
LOGGER.info(msg.toString());
}
} }
|
public class class_name {
public static String[] removeNull(String[] in) {
if (in == null) {
return new String[0];
}
ArrayList<String> arr = new ArrayList();
for (int i = 0; i < in.length; i++) {
if (in[i] != null) {
arr.add(in[i]);
}
}
if (in.length == arr.size()) {
return in;
} else {
return arr.toArray(new String[0]);
}
} }
|
public class class_name {
public static String[] removeNull(String[] in) {
if (in == null) {
return new String[0]; // depends on control dependency: [if], data = [none]
}
ArrayList<String> arr = new ArrayList();
for (int i = 0; i < in.length; i++) {
if (in[i] != null) {
arr.add(in[i]); // depends on control dependency: [if], data = [(in[i]]
}
}
if (in.length == arr.size()) {
return in; // depends on control dependency: [if], data = [none]
} else {
return arr.toArray(new String[0]); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private CompletableFuture<Void> bind(Bootstrap bootstrap) {
CompletableFuture<Void> future = new CompletableFuture<>();
int port = config.getPort() != null ? config.getPort() : address.port();
if (config.getInterfaces().isEmpty()) {
bind(bootstrap, Lists.newArrayList("0.0.0.0").iterator(), port, future);
} else {
bind(bootstrap, config.getInterfaces().iterator(), port, future);
}
return future;
} }
|
public class class_name {
private CompletableFuture<Void> bind(Bootstrap bootstrap) {
CompletableFuture<Void> future = new CompletableFuture<>();
int port = config.getPort() != null ? config.getPort() : address.port();
if (config.getInterfaces().isEmpty()) {
bind(bootstrap, Lists.newArrayList("0.0.0.0").iterator(), port, future); // depends on control dependency: [if], data = [none]
} else {
bind(bootstrap, config.getInterfaces().iterator(), port, future); // depends on control dependency: [if], data = [none]
}
return future;
} }
|
public class class_name {
public java.util.List<ClientVpnConnection> getConnections() {
if (connections == null) {
connections = new com.amazonaws.internal.SdkInternalList<ClientVpnConnection>();
}
return connections;
} }
|
public class class_name {
public java.util.List<ClientVpnConnection> getConnections() {
if (connections == null) {
connections = new com.amazonaws.internal.SdkInternalList<ClientVpnConnection>(); // depends on control dependency: [if], data = [none]
}
return connections;
} }
|
public class class_name {
public void appendTextContent(final Appendable appendable) {
if (nodeValue != null) {
if ((nodeType == NodeType.TEXT) || (nodeType == NodeType.CDATA)) {
try {
appendable.append(nodeValue);
} catch (IOException ioex) {
throw new LagartoDOMException(ioex);
}
}
}
if (childNodes != null) {
for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) {
Node childNode = childNodes.get(i);
childNode.appendTextContent(appendable);
}
}
} }
|
public class class_name {
public void appendTextContent(final Appendable appendable) {
if (nodeValue != null) {
if ((nodeType == NodeType.TEXT) || (nodeType == NodeType.CDATA)) {
try {
appendable.append(nodeValue); // depends on control dependency: [try], data = [none]
} catch (IOException ioex) {
throw new LagartoDOMException(ioex);
} // depends on control dependency: [catch], data = [none]
}
}
if (childNodes != null) {
for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) {
Node childNode = childNodes.get(i);
childNode.appendTextContent(appendable); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
private void dispatchServerChannelChangeOverwrittenPermissionsEvent(
ServerChannel channel, Permissions newPermissions, Permissions oldPermissions, DiscordEntity entity) {
if (newPermissions.equals(oldPermissions)) {
// This can be caused by adding a user/role in a channels overwritten permissions without modifying
// any of its values. We don't need to dispatch an event for this.
return;
}
ServerChannelChangeOverwrittenPermissionsEvent event =
new ServerChannelChangeOverwrittenPermissionsEventImpl(
channel, newPermissions, oldPermissions, entity);
api.getEventDispatcher().dispatchServerChannelChangeOverwrittenPermissionsEvent(
(DispatchQueueSelector) channel.getServer(),
(entity instanceof Role) ? (Role) entity : null,
channel.getServer(),
channel,
(entity instanceof User) ? (User) entity : null,
event);
} }
|
public class class_name {
private void dispatchServerChannelChangeOverwrittenPermissionsEvent(
ServerChannel channel, Permissions newPermissions, Permissions oldPermissions, DiscordEntity entity) {
if (newPermissions.equals(oldPermissions)) {
// This can be caused by adding a user/role in a channels overwritten permissions without modifying
// any of its values. We don't need to dispatch an event for this.
return; // depends on control dependency: [if], data = [none]
}
ServerChannelChangeOverwrittenPermissionsEvent event =
new ServerChannelChangeOverwrittenPermissionsEventImpl(
channel, newPermissions, oldPermissions, entity);
api.getEventDispatcher().dispatchServerChannelChangeOverwrittenPermissionsEvent(
(DispatchQueueSelector) channel.getServer(),
(entity instanceof Role) ? (Role) entity : null,
channel.getServer(),
channel,
(entity instanceof User) ? (User) entity : null,
event);
} }
|
public class class_name {
public void startWrite() {
SynchronizationPoint<NoException> sp;
synchronized (this) {
// if nobody is using the resource, we can start writing
if (readers == 0 && !writer) {
writer = true;
return;
}
// someone is doing something, we need to block
sp = new SynchronizationPoint<NoException>();
if (writersWaiting == null) writersWaiting = new LinkedList<>();
writersWaiting.add(sp);
}
sp.block(0);
} }
|
public class class_name {
public void startWrite() {
SynchronizationPoint<NoException> sp;
synchronized (this) {
// if nobody is using the resource, we can start writing
if (readers == 0 && !writer) {
writer = true; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// someone is doing something, we need to block
sp = new SynchronizationPoint<NoException>();
if (writersWaiting == null) writersWaiting = new LinkedList<>();
writersWaiting.add(sp);
}
sp.block(0);
} }
|
public class class_name {
public synchronized void pushMetric(final MetricsRecord mr) {
if (changed) {
try {
mr.setMetric(getName(), value);
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
}
}
changed = false;
} }
|
public class class_name {
public synchronized void pushMetric(final MetricsRecord mr) {
if (changed) {
try {
mr.setMetric(getName(), value); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.info("pushMetric failed for " + getName() + "\n" +
StringUtils.stringifyException(e));
} // depends on control dependency: [catch], data = [none]
}
changed = false;
} }
|
public class class_name {
public boolean hasMembersToDocument() {
if (classDoc instanceof AnnotationTypeDoc) {
return ((AnnotationTypeDoc) classDoc).elements().length > 0;
}
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
VisibleMemberMap members = visibleMemberMaps[i];
if (!members.noVisibleMembers()) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean hasMembersToDocument() {
if (classDoc instanceof AnnotationTypeDoc) {
return ((AnnotationTypeDoc) classDoc).elements().length > 0; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
VisibleMemberMap members = visibleMemberMaps[i];
if (!members.noVisibleMembers()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static MOAObject fromCommandLine(Class requiredType, String commandline) {
MOAObject result;
String[] tmpOptions;
String classname;
try {
tmpOptions = Utils.splitOptions(commandline);
classname = tmpOptions[0];
tmpOptions[0] = "";
try {
result = (MOAObject) Class.forName(classname).newInstance();
}
catch (Exception e) {
// try to prepend package name
result = (MOAObject) Class.forName(requiredType.getPackage().getName() + "." + classname).newInstance();
}
if (result instanceof AbstractOptionHandler) {
((AbstractOptionHandler) result).getOptions().setViaCLIString(Utils.joinOptions(tmpOptions));
((AbstractOptionHandler) result).prepareForUse();
}
}
catch (Exception e) {
e.printStackTrace();
result = null;
}
return result;
} }
|
public class class_name {
public static MOAObject fromCommandLine(Class requiredType, String commandline) {
MOAObject result;
String[] tmpOptions;
String classname;
try {
tmpOptions = Utils.splitOptions(commandline); // depends on control dependency: [try], data = [none]
classname = tmpOptions[0]; // depends on control dependency: [try], data = [none]
tmpOptions[0] = ""; // depends on control dependency: [try], data = [none]
try {
result = (MOAObject) Class.forName(classname).newInstance(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
// try to prepend package name
result = (MOAObject) Class.forName(requiredType.getPackage().getName() + "." + classname).newInstance();
} // depends on control dependency: [catch], data = [none]
if (result instanceof AbstractOptionHandler) {
((AbstractOptionHandler) result).getOptions().setViaCLIString(Utils.joinOptions(tmpOptions)); // depends on control dependency: [if], data = [none]
((AbstractOptionHandler) result).prepareForUse(); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
e.printStackTrace();
result = null;
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.