code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public final void mSTRING() throws RecognitionException {
try {
int _type = STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// EventFilter.g:216:5: ( '\"' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\"' )
// EventFilter.g:216:8: '\"' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\"'
{
match('\"');
// EventFilter.g:216:12: ( ESC_SEQ |~ ( '\\\\' | '\"' ) )*
loop16:
do {
int alt16=3;
int LA16_0 = input.LA(1);
if ( (LA16_0=='\\') ) {
alt16=1;
}
else if ( ((LA16_0 >= '\u0000' && LA16_0 <= '!')||(LA16_0 >= '#' && LA16_0 <= '[')||(LA16_0 >= ']' && LA16_0 <= '\uFFFF')) ) {
alt16=2;
}
switch (alt16) {
case 1 :
// EventFilter.g:216:14: ESC_SEQ
{
mESC_SEQ();
}
break;
case 2 :
// EventFilter.g:216:24: ~ ( '\\\\' | '\"' )
{
if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
break loop16;
}
} while (true);
match('\"');
setText(getText().substring(1, getText().length()-1));
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public final void mSTRING() throws RecognitionException {
try {
int _type = STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// EventFilter.g:216:5: ( '\"' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\"' )
// EventFilter.g:216:8: '\"' ( ESC_SEQ |~ ( '\\\\' | '\"' ) )* '\"'
{
match('\"');
// EventFilter.g:216:12: ( ESC_SEQ |~ ( '\\\\' | '\"' ) )*
loop16:
do {
int alt16=3;
int LA16_0 = input.LA(1);
if ( (LA16_0=='\\') ) {
alt16=1; // depends on control dependency: [if], data = [none]
}
else if ( ((LA16_0 >= '\u0000' && LA16_0 <= '!')||(LA16_0 >= '#' && LA16_0 <= '[')||(LA16_0 >= ']' && LA16_0 <= '\uFFFF')) ) {
alt16=2; // depends on control dependency: [if], data = [none]
}
switch (alt16) {
case 1 :
// EventFilter.g:216:14: ESC_SEQ
{
mESC_SEQ();
}
break;
case 2 :
// EventFilter.g:216:24: ~ ( '\\\\' | '\"' )
{
if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
break loop16;
}
} while (true);
match('\"');
setText(getText().substring(1, getText().length()-1));
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
private void logRetryAttempt(ExecutionAttributes attrs) {
IpcLogEntry logEntry = attrs.getAttribute(LOG_ENTRY);
if (logEntry != null) {
if (!isStatusSet(attrs)) {
logEntry.markEnd().withStatus(IpcStatus.unexpected_error);
}
logEntry.log();
}
} }
|
public class class_name {
private void logRetryAttempt(ExecutionAttributes attrs) {
IpcLogEntry logEntry = attrs.getAttribute(LOG_ENTRY);
if (logEntry != null) {
if (!isStatusSet(attrs)) {
logEntry.markEnd().withStatus(IpcStatus.unexpected_error); // depends on control dependency: [if], data = [none]
}
logEntry.log(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<ModelServiceInstance> queryService(List<StringCommand> commands){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.QueryService);
List<QueryCommand> cs = new ArrayList<QueryCommand>();
for(StringCommand c : commands){
cs.add(c.getStringCommand());
}
QueryServiceProtocol p = new QueryServiceProtocol(cs);
QueryServiceResponse resp ;
resp = (QueryServiceResponse) connection.submitRequest(header, p, null);
return resp.getInstances();
} }
|
public class class_name {
public List<ModelServiceInstance> queryService(List<StringCommand> commands){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.QueryService);
List<QueryCommand> cs = new ArrayList<QueryCommand>();
for(StringCommand c : commands){
cs.add(c.getStringCommand()); // depends on control dependency: [for], data = [c]
}
QueryServiceProtocol p = new QueryServiceProtocol(cs);
QueryServiceResponse resp ;
resp = (QueryServiceResponse) connection.submitRequest(header, p, null);
return resp.getInstances();
} }
|
public class class_name {
protected boolean computeStep( double lambda, DMatrixRMaj gradient , DMatrixRMaj step ) {
final double mixture = config.mixture;
for (int i = 0; i < diagOrig.numRows; i++) {
double v = min(config.diagonal_max, max(config.diagonal_min,diagOrig.data[i]));
diagStep.data[i] = v + lambda*(mixture + (1.0-mixture)*v);
}
hessian.setDiagonals( diagStep );
if( !hessian.initializeSolver()) {
return false;
}
// In the book formulation it solves something like (B + lambda*I)*p = -g
// but we don't want to modify g, so we apply the negative to the step instead
if( hessian.solve(gradient,step) ) {
CommonOps_DDRM.scale(-1, step);
return true;
} else {
return false;
}
} }
|
public class class_name {
protected boolean computeStep( double lambda, DMatrixRMaj gradient , DMatrixRMaj step ) {
final double mixture = config.mixture;
for (int i = 0; i < diagOrig.numRows; i++) {
double v = min(config.diagonal_max, max(config.diagonal_min,diagOrig.data[i]));
diagStep.data[i] = v + lambda*(mixture + (1.0-mixture)*v); // depends on control dependency: [for], data = [i]
}
hessian.setDiagonals( diagStep );
if( !hessian.initializeSolver()) {
return false; // depends on control dependency: [if], data = [none]
}
// In the book formulation it solves something like (B + lambda*I)*p = -g
// but we don't want to modify g, so we apply the negative to the step instead
if( hessian.solve(gradient,step) ) {
CommonOps_DDRM.scale(-1, step); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public BaseRuntimeElementDefinition<?> getElementDefinition(Class<? extends IBase> theElementType) {
validateInitialized();
BaseRuntimeElementDefinition<?> retVal = myClassToElementDefinition.get(theElementType);
if (retVal == null) {
retVal = scanDatatype((Class<? extends IElement>) theElementType);
}
return retVal;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public BaseRuntimeElementDefinition<?> getElementDefinition(Class<? extends IBase> theElementType) {
validateInitialized();
BaseRuntimeElementDefinition<?> retVal = myClassToElementDefinition.get(theElementType);
if (retVal == null) {
retVal = scanDatatype((Class<? extends IElement>) theElementType); // depends on control dependency: [if], data = [none]
}
return retVal;
} }
|
public class class_name {
static String getSQL(Token[] statement) {
boolean wasDelimiter = true;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < statement.length; i++) {
// when the previous statement is ')', there should be a blank before the non-delimiter statement.
if (!statement[i].isDelimiter &&
(!wasDelimiter
|| (i > 0 && ")".equals(statement[i - 1].getSQL()))))
{
sb.append(' ');
}
sb.append(statement[i].getSQL());
wasDelimiter = statement[i].isDelimiter;
}
return sb.toString();
} }
|
public class class_name {
static String getSQL(Token[] statement) {
boolean wasDelimiter = true;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < statement.length; i++) {
// when the previous statement is ')', there should be a blank before the non-delimiter statement.
if (!statement[i].isDelimiter &&
(!wasDelimiter
|| (i > 0 && ")".equals(statement[i - 1].getSQL()))))
{
sb.append(' '); // depends on control dependency: [if], data = [none]
}
sb.append(statement[i].getSQL()); // depends on control dependency: [for], data = [i]
wasDelimiter = statement[i].isDelimiter; // depends on control dependency: [for], data = [i]
}
return sb.toString();
} }
|
public class class_name {
public IPromise scheduleSendLoop(ConnectionRegistry reg) {
Promise promise = new Promise();
sendJobs.add(new ScheduleEntry(reg, promise));
synchronized (this) {
if ( ! loopStarted ) {
loopStarted = true;
Actor.current().execute(this);
}
}
return promise;
} }
|
public class class_name {
public IPromise scheduleSendLoop(ConnectionRegistry reg) {
Promise promise = new Promise();
sendJobs.add(new ScheduleEntry(reg, promise));
synchronized (this) {
if ( ! loopStarted ) {
loopStarted = true; // depends on control dependency: [if], data = [none]
Actor.current().execute(this); // depends on control dependency: [if], data = [none]
}
}
return promise;
} }
|
public class class_name {
public void listen(final String address, final int port, final boolean useSSL) throws UnknownHostException {
// Bind and start to accept incoming connections.
ChannelFuture cf = getServerBootstrap(useSSL).bind(address, port);
cf.addListener(new ChannelFutureListener() {
public void operationComplete(final ChannelFuture future) throws Exception {
if (future.isSuccess()) {
context.getEventBus().post(new JNRPEStatusEvent(STATUS.STARTED, this, "JNRPE Server started"));
LOG.info(context, "Listening on " + (useSSL ? "SSL/" : "") + address + ":" + port);
} else {
getExecutionContext().getEventBus().post(new JNRPEStatusEvent(STATUS.FAILED, this, "JNRPE Server start failed"));
LOG.error(context, "Unable to listen on " + (useSSL ? "SSL/" : "") + address + ":" + port, future.cause());
}
}
});
} }
|
public class class_name {
public void listen(final String address, final int port, final boolean useSSL) throws UnknownHostException {
// Bind and start to accept incoming connections.
ChannelFuture cf = getServerBootstrap(useSSL).bind(address, port);
cf.addListener(new ChannelFutureListener() {
public void operationComplete(final ChannelFuture future) throws Exception {
if (future.isSuccess()) {
context.getEventBus().post(new JNRPEStatusEvent(STATUS.STARTED, this, "JNRPE Server started")); // depends on control dependency: [if], data = [none]
LOG.info(context, "Listening on " + (useSSL ? "SSL/" : "") + address + ":" + port); // depends on control dependency: [if], data = [none]
} else {
getExecutionContext().getEventBus().post(new JNRPEStatusEvent(STATUS.FAILED, this, "JNRPE Server start failed")); // depends on control dependency: [if], data = [none]
LOG.error(context, "Unable to listen on " + (useSSL ? "SSL/" : "") + address + ":" + port, future.cause()); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public String buildRule(final ProcessBuildContext context) {
// If there is no compiled code, return
if ( context.getMethods().isEmpty() ) {
return null;
}
final String lineSeparator = System.getProperty( "line.separator" );
final StringBuilder buffer = new StringBuilder();
buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
if ( context.getProcess() != null && ((org.jbpm.process.core.Process) context.getProcess()).getImports() != null) {
for ( String decl : ((org.jbpm.process.core.Process)context.getProcess()).getImports() ) {
buffer.append( "import " + decl + ";" + lineSeparator );
}
}
for ( String systemImport : systemImports ) {
if ( !context.getPkg().getImports().containsKey( systemImport ) ) {
buffer.append( "import ").append( systemImport ).append( ";" ).append( lineSeparator );
}
}
for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
buffer.append( "import static " + it.next() + ";" + lineSeparator );
}
final ProcessDescr processDescr = context.getProcessDescr();
buffer.append( "public class " + StringUtils.ucFirst( processDescr.getClassName() ) + " {" + lineSeparator );
buffer.append( " private static final long serialVersionUID = 510l;" + lineSeparator );
// @TODO record line numbers for each Action method
for ( int i = 0, size = context.getMethods().size(); i < size; i++ ) {
buffer.append( context.getMethods().get( i ) + lineSeparator );
}
final String[] lines = buffer.toString().split( lineSeparator );
buffer.append( "}" );
return buffer.toString();
} }
|
public class class_name {
public String buildRule(final ProcessBuildContext context) {
// If there is no compiled code, return
if ( context.getMethods().isEmpty() ) {
return null; // depends on control dependency: [if], data = [none]
}
final String lineSeparator = System.getProperty( "line.separator" );
final StringBuilder buffer = new StringBuilder();
buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
if ( context.getProcess() != null && ((org.jbpm.process.core.Process) context.getProcess()).getImports() != null) {
for ( String decl : ((org.jbpm.process.core.Process)context.getProcess()).getImports() ) {
buffer.append( "import " + decl + ";" + lineSeparator ); // depends on control dependency: [for], data = [decl]
}
}
for ( String systemImport : systemImports ) {
if ( !context.getPkg().getImports().containsKey( systemImport ) ) {
buffer.append( "import ").append( systemImport ).append( ";" ).append( lineSeparator ); // depends on control dependency: [if], data = [none]
}
}
for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
buffer.append( "import static " + it.next() + ";" + lineSeparator ); // depends on control dependency: [for], data = [it]
}
final ProcessDescr processDescr = context.getProcessDescr();
buffer.append( "public class " + StringUtils.ucFirst( processDescr.getClassName() ) + " {" + lineSeparator );
buffer.append( " private static final long serialVersionUID = 510l;" + lineSeparator );
// @TODO record line numbers for each Action method
for ( int i = 0, size = context.getMethods().size(); i < size; i++ ) {
buffer.append( context.getMethods().get( i ) + lineSeparator ); // depends on control dependency: [for], data = [i]
}
final String[] lines = buffer.toString().split( lineSeparator );
buffer.append( "}" );
return buffer.toString();
} }
|
public class class_name {
private void addCallback(int rc, LedgerHandle handle, long entryId, Object ctx) {
Write write = (Write) ctx;
try {
assert handle.getId() == write.getWriteLedger().ledger.getId()
: "Handle.Id mismatch: " + write.getWriteLedger().ledger.getId() + " vs " + handle.getId();
write.setEntryId(entryId);
if (rc == 0) {
// Successful write. If we get this, then by virtue of how the Writes are executed (always wait for writes
// in previous ledgers to complete before initiating, and BookKeeper guaranteeing that all writes in this
// ledger prior to this writes are done), it is safe to complete the callback future now.
completeWrite(write);
return;
}
// Convert the response code into an Exception. Eventually this will be picked up by the WriteProcessor which
// will retry it or fail it permanently (this includes exceptions from rollovers).
handleWriteException(rc, write);
} catch (Throwable ex) {
// Most likely a bug in our code. We still need to fail the write so we don't leave it hanging.
write.fail(ex, !isRetryable(ex));
} finally {
// Process all the appends in the queue after any change. This finalizes the completion, does retries (if needed)
// and triggers more appends.
try {
this.writeProcessor.runAsync();
} catch (ObjectClosedException ex) {
// In case of failures, the WriteProcessor may already be closed. We don't want the exception to propagate
// to BookKeeper.
log.warn("{}: Not running WriteProcessor as part of callback due to BookKeeperLog being closed.", this.traceObjectId, ex);
}
}
} }
|
public class class_name {
private void addCallback(int rc, LedgerHandle handle, long entryId, Object ctx) {
Write write = (Write) ctx;
try {
assert handle.getId() == write.getWriteLedger().ledger.getId()
: "Handle.Id mismatch: " + write.getWriteLedger().ledger.getId() + " vs " + handle.getId();
write.setEntryId(entryId); // depends on control dependency: [try], data = [none]
if (rc == 0) {
// Successful write. If we get this, then by virtue of how the Writes are executed (always wait for writes
// in previous ledgers to complete before initiating, and BookKeeper guaranteeing that all writes in this
// ledger prior to this writes are done), it is safe to complete the callback future now.
completeWrite(write); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Convert the response code into an Exception. Eventually this will be picked up by the WriteProcessor which
// will retry it or fail it permanently (this includes exceptions from rollovers).
handleWriteException(rc, write); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
// Most likely a bug in our code. We still need to fail the write so we don't leave it hanging.
write.fail(ex, !isRetryable(ex));
} finally { // depends on control dependency: [catch], data = [none]
// Process all the appends in the queue after any change. This finalizes the completion, does retries (if needed)
// and triggers more appends.
try {
this.writeProcessor.runAsync(); // depends on control dependency: [try], data = [none]
} catch (ObjectClosedException ex) {
// In case of failures, the WriteProcessor may already be closed. We don't want the exception to propagate
// to BookKeeper.
log.warn("{}: Not running WriteProcessor as part of callback due to BookKeeperLog being closed.", this.traceObjectId, ex);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void refreshWithSchema(ZooClassDef def) {
ArrayList<ZooFieldDef> pfl = new ArrayList<ZooFieldDef>();
for (ZooFieldDef f: def.getAllFields()) {
if (f.isIndexed()) {
pfl.add(f);
}
}
indFields = pfl.toArray(new ZooFieldDef[pfl.size()]);
} }
|
public class class_name {
public void refreshWithSchema(ZooClassDef def) {
ArrayList<ZooFieldDef> pfl = new ArrayList<ZooFieldDef>();
for (ZooFieldDef f: def.getAllFields()) {
if (f.isIndexed()) {
pfl.add(f); // depends on control dependency: [if], data = [none]
}
}
indFields = pfl.toArray(new ZooFieldDef[pfl.size()]);
} }
|
public class class_name {
private void setUp(Random rand)
{
Ws = new ArrayList<>(npl.length);
bs = new ArrayList<>(npl.length);
//First Hiden layer takes input raw
DenseMatrix W = new DenseMatrix(npl[0], inputSize);
Vec b = new DenseVector(W.rows());
initializeWeights(W, rand);
initializeWeights(b, W.cols(), rand);
Ws.add(W);
bs.add(b);
//Other Hiden Layers Layers
for(int i = 1; i < npl.length; i++)
{
W = new DenseMatrix(npl[i], npl[i-1]);
b = new DenseVector(W.rows());
initializeWeights(W, rand);
initializeWeights(b, W.cols(), rand);
Ws.add(W);
bs.add(b);
}
//Output layer
W = new DenseMatrix(outputSize, npl[npl.length-1]);
b = new DenseVector(W.rows());
initializeWeights(W, rand);
initializeWeights(b, W.cols(), rand);
Ws.add(W);
bs.add(b);
} }
|
public class class_name {
private void setUp(Random rand)
{
Ws = new ArrayList<>(npl.length);
bs = new ArrayList<>(npl.length);
//First Hiden layer takes input raw
DenseMatrix W = new DenseMatrix(npl[0], inputSize);
Vec b = new DenseVector(W.rows());
initializeWeights(W, rand);
initializeWeights(b, W.cols(), rand);
Ws.add(W);
bs.add(b);
//Other Hiden Layers Layers
for(int i = 1; i < npl.length; i++)
{
W = new DenseMatrix(npl[i], npl[i-1]); // depends on control dependency: [for], data = [i]
b = new DenseVector(W.rows()); // depends on control dependency: [for], data = [none]
initializeWeights(W, rand); // depends on control dependency: [for], data = [none]
initializeWeights(b, W.cols(), rand); // depends on control dependency: [for], data = [none]
Ws.add(W); // depends on control dependency: [for], data = [none]
bs.add(b); // depends on control dependency: [for], data = [none]
}
//Output layer
W = new DenseMatrix(outputSize, npl[npl.length-1]);
b = new DenseVector(W.rows());
initializeWeights(W, rand);
initializeWeights(b, W.cols(), rand);
Ws.add(W);
bs.add(b);
} }
|
public class class_name {
private void heartbeatWhenMaster(long now) {
Collection<MemberImpl> members = clusterService.getMemberImpls();
for (MemberImpl member : members) {
if (!member.localMember()) {
try {
logIfConnectionToEndpointIsMissing(now, member);
if (suspectMemberIfNotHeartBeating(now, member)) {
continue;
}
pingMemberIfRequired(now, member);
sendHeartbeat(member);
} catch (Throwable e) {
logger.severe(e);
}
}
}
} }
|
public class class_name {
private void heartbeatWhenMaster(long now) {
Collection<MemberImpl> members = clusterService.getMemberImpls();
for (MemberImpl member : members) {
if (!member.localMember()) {
try {
logIfConnectionToEndpointIsMissing(now, member); // depends on control dependency: [try], data = [none]
if (suspectMemberIfNotHeartBeating(now, member)) {
continue;
}
pingMemberIfRequired(now, member); // depends on control dependency: [try], data = [none]
sendHeartbeat(member); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logger.severe(e);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public void setValue(int size, float[] newValue) {
if ( ((newValue.length%2) == 0) && ((newValue.length/2) == size)) {
try {
for (int i = 0; i < size; i++) {
value.set(i, new SFVec2f(newValue[i*3], newValue[i*3+1]));
}
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f setValue(size,newValue[]) out of bounds." + e);
}
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f setValue(size, newValue[]) exception " + e);
}
}
else {
Log.e(TAG, "X3D MFVec2f setValue() set with newValue[] length not multiple of 2, or equal to size parameter");
}
} }
|
public class class_name {
public void setValue(int size, float[] newValue) {
if ( ((newValue.length%2) == 0) && ((newValue.length/2) == size)) {
try {
for (int i = 0; i < size; i++) {
value.set(i, new SFVec2f(newValue[i*3], newValue[i*3+1])); // depends on control dependency: [for], data = [i]
}
}
catch (IndexOutOfBoundsException e) {
Log.e(TAG, "X3D MFVec2f setValue(size,newValue[]) out of bounds." + e);
} // depends on control dependency: [catch], data = [none]
catch (Exception e) {
Log.e(TAG, "X3D MFVec2f setValue(size, newValue[]) exception " + e);
} // depends on control dependency: [catch], data = [none]
}
else {
Log.e(TAG, "X3D MFVec2f setValue() set with newValue[] length not multiple of 2, or equal to size parameter"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ResourceBundle getBundle()
throws MissingResourceException
{
if( null == m_bundle )
{
// bundle wasn't cached, so load it, cache it, and return it.
ClassLoader classLoader = m_classLoader;
if( null == classLoader )
{
classLoader = Thread.currentThread().getContextClassLoader();
}
if( null != classLoader )
{
m_bundle = ResourceBundle.getBundle( m_baseName, m_locale, classLoader );
}
else
{
m_bundle = ResourceBundle.getBundle( m_baseName, m_locale );
}
}
return m_bundle;
} }
|
public class class_name {
public ResourceBundle getBundle()
throws MissingResourceException
{
if( null == m_bundle )
{
// bundle wasn't cached, so load it, cache it, and return it.
ClassLoader classLoader = m_classLoader;
if( null == classLoader )
{
classLoader = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [if], data = [none]
}
if( null != classLoader )
{
m_bundle = ResourceBundle.getBundle( m_baseName, m_locale, classLoader ); // depends on control dependency: [if], data = [classLoader )]
}
else
{
m_bundle = ResourceBundle.getBundle( m_baseName, m_locale ); // depends on control dependency: [if], data = [none]
}
}
return m_bundle;
} }
|
public class class_name {
public void resetWithShared(char[] buf, int start, int len)
{
// Let's first mark things we need about input buffer
mInputBuffer = buf;
mInputStart = start;
mInputLen = len;
// Then clear intermediate values, if any:
mResultString = null;
mResultArray = null;
// And then reset internal input buffers, if necessary:
if (mHasSegments) {
clearSegments();
}
} }
|
public class class_name {
public void resetWithShared(char[] buf, int start, int len)
{
// Let's first mark things we need about input buffer
mInputBuffer = buf;
mInputStart = start;
mInputLen = len;
// Then clear intermediate values, if any:
mResultString = null;
mResultArray = null;
// And then reset internal input buffers, if necessary:
if (mHasSegments) {
clearSegments(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public java.util.List<ScheduledWindowExecution> getScheduledWindowExecutions() {
if (scheduledWindowExecutions == null) {
scheduledWindowExecutions = new com.amazonaws.internal.SdkInternalList<ScheduledWindowExecution>();
}
return scheduledWindowExecutions;
} }
|
public class class_name {
public java.util.List<ScheduledWindowExecution> getScheduledWindowExecutions() {
if (scheduledWindowExecutions == null) {
scheduledWindowExecutions = new com.amazonaws.internal.SdkInternalList<ScheduledWindowExecution>(); // depends on control dependency: [if], data = [none]
}
return scheduledWindowExecutions;
} }
|
public class class_name {
private void append2slowstr() {
// In case of all NAs and then a string, convert NAs to string NAs
if (_xs != null) {
_xs = null; _ms = null;
alloc_str_indices(_sparseLen);
Arrays.fill(_is,-1);
}
if(_is != null && _is.length > 0){
// Check for sparseness
if(_id == null){
int nzs = 0; // assume one non-null for the element currently being stored
for( int i:_is) if( i != -1 ) ++nzs;
if( (nzs+1)*_sparseRatio < _len)
set_sparse(nzs, Compress.NA);
} else {
if((_sparseRatio*(_sparseLen) >> 2) > _len) cancel_sparse();
else _id = MemoryManager.arrayCopyOf(_id,_sparseLen<<1);
}
_is = MemoryManager.arrayCopyOf(_is, _sparseLen<<1);
/* initialize the memory extension with -1s */
for (int i = _sparseLen; i < _is.length; i++) _is[i] = -1;
} else {
_is = MemoryManager.malloc4 (4);
/* initialize everything with -1s */
for (int i = 0; i < _is.length; i++) _is[i] = -1;
if (sparseZero()||sparseNA()) alloc_indices(4);
}
assert _sparseLen == 0 || _is.length > _sparseLen:"_ls.length = " + _is.length + ", _len = " + _sparseLen;
} }
|
public class class_name {
private void append2slowstr() {
// In case of all NAs and then a string, convert NAs to string NAs
if (_xs != null) {
_xs = null; _ms = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
alloc_str_indices(_sparseLen); // depends on control dependency: [if], data = [none]
Arrays.fill(_is,-1); // depends on control dependency: [if], data = [none]
}
if(_is != null && _is.length > 0){
// Check for sparseness
if(_id == null){
int nzs = 0; // assume one non-null for the element currently being stored
for( int i:_is) if( i != -1 ) ++nzs;
if( (nzs+1)*_sparseRatio < _len)
set_sparse(nzs, Compress.NA);
} else {
if((_sparseRatio*(_sparseLen) >> 2) > _len) cancel_sparse();
else _id = MemoryManager.arrayCopyOf(_id,_sparseLen<<1);
}
_is = MemoryManager.arrayCopyOf(_is, _sparseLen<<1); // depends on control dependency: [if], data = [(_is]
/* initialize the memory extension with -1s */
for (int i = _sparseLen; i < _is.length; i++) _is[i] = -1;
} else {
_is = MemoryManager.malloc4 (4); // depends on control dependency: [if], data = [none]
/* initialize everything with -1s */
for (int i = 0; i < _is.length; i++) _is[i] = -1;
if (sparseZero()||sparseNA()) alloc_indices(4);
}
assert _sparseLen == 0 || _is.length > _sparseLen:"_ls.length = " + _is.length + ", _len = " + _sparseLen;
} }
|
public class class_name {
synchronized void statusUpdate(State runState,
float progress,
String state,
Phase phase,
long finishTime) {
setRunState(runState);
setProgress(progress);
setStateString(state);
setPhase(phase);
if (finishTime > 0) {
setFinishTime(finishTime);
}
} }
|
public class class_name {
synchronized void statusUpdate(State runState,
float progress,
String state,
Phase phase,
long finishTime) {
setRunState(runState);
setProgress(progress);
setStateString(state);
setPhase(phase);
if (finishTime > 0) {
setFinishTime(finishTime); // depends on control dependency: [if], data = [(finishTime]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
// This is not good code, but what's there to be done? TODO
public static <T> T sample(Counter<T> c, Random rand) {
Iterable<T> objects;
Set<T> keySet = c.keySet();
objects = c.keySet();
if (rand == null) {
rand = new Random();
} else { // TODO: Seems like there should be a way to directly check if T is
// comparable
if (!keySet.isEmpty() && keySet.iterator().next() instanceof Comparable) {
List l = new ArrayList<T>(keySet);
Collections.sort(l);
objects = l;
} else {
throw new RuntimeException("Results won't be stable since Counters keys are comparable.");
}
}
double r = rand.nextDouble() * c.totalCount();
double total = 0.0;
for (T t : objects) { // arbitrary ordering
total += c.getCount(t);
if (total >= r)
return t;
}
// only chance of reaching here is if c isn't properly normalized, or if
// double math makes total<1.0
return c.keySet().iterator().next();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
// This is not good code, but what's there to be done? TODO
public static <T> T sample(Counter<T> c, Random rand) {
Iterable<T> objects;
Set<T> keySet = c.keySet();
objects = c.keySet();
if (rand == null) {
rand = new Random();
// depends on control dependency: [if], data = [none]
} else { // TODO: Seems like there should be a way to directly check if T is
// comparable
if (!keySet.isEmpty() && keySet.iterator().next() instanceof Comparable) {
List l = new ArrayList<T>(keySet);
Collections.sort(l);
// depends on control dependency: [if], data = [none]
objects = l;
// depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Results won't be stable since Counters keys are comparable.");
}
}
double r = rand.nextDouble() * c.totalCount();
double total = 0.0;
for (T t : objects) { // arbitrary ordering
total += c.getCount(t);
// depends on control dependency: [for], data = [t]
if (total >= r)
return t;
}
// only chance of reaching here is if c isn't properly normalized, or if
// double math makes total<1.0
return c.keySet().iterator().next();
} }
|
public class class_name {
protected Connection createConnection(Dsn dsn) {
String protocol = dsn.getProtocol();
Connection connection;
if (protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https")) {
logger.debug("Using an {} connection to Sentry.", protocol.toUpperCase());
connection = createHttpConnection(dsn);
} else if (protocol.equalsIgnoreCase("out")) {
logger.debug("Using StdOut to send events.");
connection = createStdOutConnection(dsn);
} else if (protocol.equalsIgnoreCase("noop")) {
logger.debug("Using noop to send events.");
connection = new NoopConnection();
} else {
throw new IllegalStateException("Couldn't create a connection for the protocol '" + protocol + "'");
}
BufferedConnection bufferedConnection = null;
if (getBufferEnabled(dsn)) {
Buffer eventBuffer = getBuffer(dsn);
if (eventBuffer != null) {
long flushtime = getBufferFlushtime(dsn);
boolean gracefulShutdown = getBufferedConnectionGracefulShutdownEnabled(dsn);
Long shutdownTimeout = getBufferedConnectionShutdownTimeout(dsn);
bufferedConnection = new BufferedConnection(connection, eventBuffer, flushtime, gracefulShutdown,
shutdownTimeout);
connection = bufferedConnection;
}
}
// Enable async unless its value is 'false'.
if (getAsyncEnabled(dsn)) {
connection = createAsyncConnection(dsn, connection);
}
// If buffering is enabled, wrap connection with synchronous disk buffering "connection"
if (bufferedConnection != null) {
connection = bufferedConnection.wrapConnectionWithBufferWriter(connection);
}
return connection;
} }
|
public class class_name {
protected Connection createConnection(Dsn dsn) {
String protocol = dsn.getProtocol();
Connection connection;
if (protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https")) {
logger.debug("Using an {} connection to Sentry.", protocol.toUpperCase()); // depends on control dependency: [if], data = [none]
connection = createHttpConnection(dsn); // depends on control dependency: [if], data = [none]
} else if (protocol.equalsIgnoreCase("out")) {
logger.debug("Using StdOut to send events."); // depends on control dependency: [if], data = [none]
connection = createStdOutConnection(dsn); // depends on control dependency: [if], data = [none]
} else if (protocol.equalsIgnoreCase("noop")) {
logger.debug("Using noop to send events."); // depends on control dependency: [if], data = [none]
connection = new NoopConnection(); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("Couldn't create a connection for the protocol '" + protocol + "'");
}
BufferedConnection bufferedConnection = null;
if (getBufferEnabled(dsn)) {
Buffer eventBuffer = getBuffer(dsn);
if (eventBuffer != null) {
long flushtime = getBufferFlushtime(dsn);
boolean gracefulShutdown = getBufferedConnectionGracefulShutdownEnabled(dsn);
Long shutdownTimeout = getBufferedConnectionShutdownTimeout(dsn);
bufferedConnection = new BufferedConnection(connection, eventBuffer, flushtime, gracefulShutdown,
shutdownTimeout); // depends on control dependency: [if], data = [none]
connection = bufferedConnection; // depends on control dependency: [if], data = [none]
}
}
// Enable async unless its value is 'false'.
if (getAsyncEnabled(dsn)) {
connection = createAsyncConnection(dsn, connection); // depends on control dependency: [if], data = [none]
}
// If buffering is enabled, wrap connection with synchronous disk buffering "connection"
if (bufferedConnection != null) {
connection = bufferedConnection.wrapConnectionWithBufferWriter(connection); // depends on control dependency: [if], data = [none]
}
return connection;
} }
|
public class class_name {
public RewriteResult match(String path) {
for (CmsRewriteAlias alias : m_aliases) {
try {
Pattern pattern = Pattern.compile(alias.getPatternString());
Matcher matcher = pattern.matcher(path);
if (matcher.matches()) {
String newPath = matcher.replaceFirst(alias.getReplacementString());
return new RewriteResult(newPath, alias);
}
} catch (PatternSyntaxException e) {
LOG.warn(e.getLocalizedMessage(), e);
} catch (IndexOutOfBoundsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
return null;
} }
|
public class class_name {
public RewriteResult match(String path) {
for (CmsRewriteAlias alias : m_aliases) {
try {
Pattern pattern = Pattern.compile(alias.getPatternString());
Matcher matcher = pattern.matcher(path);
if (matcher.matches()) {
String newPath = matcher.replaceFirst(alias.getReplacementString());
return new RewriteResult(newPath, alias);
// depends on control dependency: [if], data = [none]
}
} catch (PatternSyntaxException e) {
LOG.warn(e.getLocalizedMessage(), e);
} catch (IndexOutOfBoundsException e) {
// depends on control dependency: [catch], data = [none]
LOG.warn(e.getLocalizedMessage(), e);
}
// depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public Observable<ServiceResponse<SasDefinitionBundle>> setSasDefinitionWithServiceResponseAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (storageAccountName == null) {
throw new IllegalArgumentException("Parameter storageAccountName is required and cannot be null.");
}
if (sasDefinitionName == null) {
throw new IllegalArgumentException("Parameter sasDefinitionName is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
if (templateUri == null) {
throw new IllegalArgumentException("Parameter templateUri is required and cannot be null.");
}
if (sasType == null) {
throw new IllegalArgumentException("Parameter sasType is required and cannot be null.");
}
if (validityPeriod == null) {
throw new IllegalArgumentException("Parameter validityPeriod is required and cannot be null.");
}
final SasDefinitionAttributes sasDefinitionAttributes = null;
final Map<String, String> tags = null;
SasDefinitionCreateParameters parameters = new SasDefinitionCreateParameters();
parameters.withTemplateUri(templateUri);
parameters.withSasType(sasType);
parameters.withValidityPeriod(validityPeriod);
parameters.withSasDefinitionAttributes(null);
parameters.withTags(null);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.setSasDefinition(storageAccountName, sasDefinitionName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SasDefinitionBundle>>>() {
@Override
public Observable<ServiceResponse<SasDefinitionBundle>> call(Response<ResponseBody> response) {
try {
ServiceResponse<SasDefinitionBundle> clientResponse = setSasDefinitionDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<SasDefinitionBundle>> setSasDefinitionWithServiceResponseAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (storageAccountName == null) {
throw new IllegalArgumentException("Parameter storageAccountName is required and cannot be null.");
}
if (sasDefinitionName == null) {
throw new IllegalArgumentException("Parameter sasDefinitionName is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
if (templateUri == null) {
throw new IllegalArgumentException("Parameter templateUri is required and cannot be null.");
}
if (sasType == null) {
throw new IllegalArgumentException("Parameter sasType is required and cannot be null.");
}
if (validityPeriod == null) {
throw new IllegalArgumentException("Parameter validityPeriod is required and cannot be null.");
}
final SasDefinitionAttributes sasDefinitionAttributes = null;
final Map<String, String> tags = null;
SasDefinitionCreateParameters parameters = new SasDefinitionCreateParameters();
parameters.withTemplateUri(templateUri);
parameters.withSasType(sasType);
parameters.withValidityPeriod(validityPeriod);
parameters.withSasDefinitionAttributes(null);
parameters.withTags(null);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.setSasDefinition(storageAccountName, sasDefinitionName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SasDefinitionBundle>>>() {
@Override
public Observable<ServiceResponse<SasDefinitionBundle>> call(Response<ResponseBody> response) {
try {
ServiceResponse<SasDefinitionBundle> clientResponse = setSasDefinitionDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
@Override
public void info( Throwable t,
I18nResource message,
Object... params ) {
if (!isInfoEnabled()) return;
if (t == null) {
info(message, params);
return;
}
if (message == null) {
logger.info(null, t);
return;
}
logger.info(message.text(getLoggingLocale(), params), t);
} }
|
public class class_name {
@Override
public void info( Throwable t,
I18nResource message,
Object... params ) {
if (!isInfoEnabled()) return;
if (t == null) {
info(message, params); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (message == null) {
logger.info(null, t); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
logger.info(message.text(getLoggingLocale(), params), t);
} }
|
public class class_name {
public String generateUniqueId(String prefix, String text)
{
// Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.
if (StringUtils.isEmpty(prefix) || !StringUtils.isAlpha(prefix)) {
throw new IllegalArgumentException(
"The prefix [" + prefix + "] should only contain alphanumerical characters and not be empty.");
}
String idPrefix = prefix + normalizeId(text);
int occurence = 0;
String id = idPrefix;
while (this.generatedIds.contains(id)) {
occurence++;
id = idPrefix + "-" + occurence;
}
// Save the generated id so that the next call to this method will not generate the same id.
this.generatedIds.add(id);
return id;
} }
|
public class class_name {
public String generateUniqueId(String prefix, String text)
{
// Verify that the passed prefix contains only alpha characters since the generated id must be a valid HTML id.
if (StringUtils.isEmpty(prefix) || !StringUtils.isAlpha(prefix)) {
throw new IllegalArgumentException(
"The prefix [" + prefix + "] should only contain alphanumerical characters and not be empty.");
}
String idPrefix = prefix + normalizeId(text);
int occurence = 0;
String id = idPrefix;
while (this.generatedIds.contains(id)) {
occurence++; // depends on control dependency: [while], data = [none]
id = idPrefix + "-" + occurence; // depends on control dependency: [while], data = [none]
}
// Save the generated id so that the next call to this method will not generate the same id.
this.generatedIds.add(id);
return id;
} }
|
public class class_name {
public Object cmisValue( PropertyDefinition<?> pdef,
Field field ) {
switch (pdef.getPropertyType()) {
case STRING:
return field.getValueAsString();
case BOOLEAN:
return field.getValueAsBoolean();
case DECIMAL:
return BigDecimal.valueOf(field.getValueAsInt());
case INTEGER:
return field.getValueAsInt();
case DATETIME:
// FIXME
return new GregorianCalendar();
case URI:
try {
return new URI(field.getValueAsString());
} catch (Exception e) {
}
break;
case ID:
return field.getValueAsUuid();
case HTML:
return field.getValueAsString();
}
return null;
} }
|
public class class_name {
public Object cmisValue( PropertyDefinition<?> pdef,
Field field ) {
switch (pdef.getPropertyType()) {
case STRING:
return field.getValueAsString();
case BOOLEAN:
return field.getValueAsBoolean();
case DECIMAL:
return BigDecimal.valueOf(field.getValueAsInt());
case INTEGER:
return field.getValueAsInt();
case DATETIME:
// FIXME
return new GregorianCalendar();
case URI:
try {
return new URI(field.getValueAsString()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
break;
case ID:
return field.getValueAsUuid();
case HTML:
return field.getValueAsString();
}
return null;
} }
|
public class class_name {
private static String getSimpleTypeName(TypeReference typ) {
final Map<String, String> mapFullTypeName =
ImmutableMap.<String, String>builder()
.put("B", "byte")
.put("C", "char")
.put("D", "double")
.put("F", "float")
.put("I", "int")
.put("J", "long")
.put("S", "short")
.put("Z", "boolean")
.build();
if (typ.isArrayType()) return "Array";
String typName = typ.getName().toString();
if (typName.startsWith("L")) {
typName = typName.split("<")[0].substring(1); // handle generics
typName = typName.substring(typName.lastIndexOf('/') + 1); // get unqualified name
typName = typName.substring(typName.lastIndexOf('$') + 1); // handle inner classes
} else {
typName = mapFullTypeName.get(typName);
}
return typName;
} }
|
public class class_name {
private static String getSimpleTypeName(TypeReference typ) {
final Map<String, String> mapFullTypeName =
ImmutableMap.<String, String>builder()
.put("B", "byte")
.put("C", "char")
.put("D", "double")
.put("F", "float")
.put("I", "int")
.put("J", "long")
.put("S", "short")
.put("Z", "boolean")
.build();
if (typ.isArrayType()) return "Array";
String typName = typ.getName().toString();
if (typName.startsWith("L")) {
typName = typName.split("<")[0].substring(1); // handle generics // depends on control dependency: [if], data = [none]
typName = typName.substring(typName.lastIndexOf('/') + 1); // get unqualified name // depends on control dependency: [if], data = [none]
typName = typName.substring(typName.lastIndexOf('$') + 1); // handle inner classes // depends on control dependency: [if], data = [none]
} else {
typName = mapFullTypeName.get(typName); // depends on control dependency: [if], data = [none]
}
return typName;
} }
|
public class class_name {
private void addPoint(int pos, int flag)
{
Point point = new Point();
int len = insertPoints.points.length;
if (len == 0) {
insertPoints.points = new Point[FIRSTALLOC];
len = FIRSTALLOC;
}
if (insertPoints.size >= len) { /* no room for new point */
Point[] savePoints = insertPoints.points;
insertPoints.points = new Point[len * 2];
System.arraycopy(savePoints, 0, insertPoints.points, 0, len);
}
point.pos = pos;
point.flag = flag;
insertPoints.points[insertPoints.size] = point;
insertPoints.size++;
} }
|
public class class_name {
private void addPoint(int pos, int flag)
{
Point point = new Point();
int len = insertPoints.points.length;
if (len == 0) {
insertPoints.points = new Point[FIRSTALLOC]; // depends on control dependency: [if], data = [none]
len = FIRSTALLOC; // depends on control dependency: [if], data = [none]
}
if (insertPoints.size >= len) { /* no room for new point */
Point[] savePoints = insertPoints.points;
insertPoints.points = new Point[len * 2]; // depends on control dependency: [if], data = [none]
System.arraycopy(savePoints, 0, insertPoints.points, 0, len); // depends on control dependency: [if], data = [none]
}
point.pos = pos;
point.flag = flag;
insertPoints.points[insertPoints.size] = point;
insertPoints.size++;
} }
|
public class class_name {
public static String getter(ModelProperty property) {
if (property.isPublicField())
return property.getName();
if (property.isFieldWithGetter()) {
return "get" + converterField2Method.convert(property.getName()) + "()";
} else if (property.isFieldWithIs()) {
return "is" + converterField2Method.convert(property.getName()) + "()";
} else {
throw new PropertyVisibilityException(String.format("In class '%s' property '%s' can not be read",
property.getParent().getElement().asType(), property.getName()));
}
} }
|
public class class_name {
public static String getter(ModelProperty property) {
if (property.isPublicField())
return property.getName();
if (property.isFieldWithGetter()) {
return "get" + converterField2Method.convert(property.getName()) + "()"; // depends on control dependency: [if], data = [none]
} else if (property.isFieldWithIs()) {
return "is" + converterField2Method.convert(property.getName()) + "()"; // depends on control dependency: [if], data = [none]
} else {
throw new PropertyVisibilityException(String.format("In class '%s' property '%s' can not be read",
property.getParent().getElement().asType(), property.getName()));
}
} }
|
public class class_name {
public static void marshallUUID(UUID uuid, ObjectOutput out, boolean checkNull) throws IOException {
if (checkNull) {
if (uuid == null) {
out.writeBoolean(true);
return;
}
out.writeBoolean(false);
}
out.writeLong(uuid.getMostSignificantBits());
out.writeLong(uuid.getLeastSignificantBits());
} }
|
public class class_name {
public static void marshallUUID(UUID uuid, ObjectOutput out, boolean checkNull) throws IOException {
if (checkNull) {
if (uuid == null) {
out.writeBoolean(true); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
out.writeBoolean(false);
}
out.writeLong(uuid.getMostSignificantBits());
out.writeLong(uuid.getLeastSignificantBits());
} }
|
public class class_name {
public boolean canDeliverAssuredInOrder(
long tick,
long prevTick,
int priority)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"canDeliverAssuredInOrder",
new Object[] {
Long.valueOf(tick),
Long.valueOf(prevTick),
Integer.valueOf(priority)});
boolean canDeliverInOrder = false;
synchronized (this)
{
// Is prevTick unknown?
if (prevTick == _mp.getCustomProperties().get_unknown_prev_tick())
{
// start assuming we can deliver, but if we find Q/U, Q/G or undelivered V/U, then we cannot
canDeliverInOrder = true;
long start = _targetStream.getCompletedPrefix() + 1;
if (start < tick)
{
long end = tick - 1;
_targetStream.setCursor(start);
TickRange tr2 = null;
TickRange tr1 = _targetStream.getNext();
do
{
if ((tr1.type == TickRange.Unknown)
|| (tr1.type == TickRange.Requested))
{
canDeliverInOrder = false;
break;
}
else if (tr1.type == TickRange.Value)
{
AIValueTick valueTick = (AIValueTick) tr1.value;
boolean delivered = valueTick.isDelivered();
Reliability currentReliability = valueTick.getMsgReliability();
boolean isAssured =
currentReliability.compareTo(Reliability.RELIABLE_PERSISTENT)
>= 0;
boolean samePriority = (valueTick.getMsgPriority() == priority);
if (isAssured
&& samePriority
&& !delivered) // has it not been delivered?
{
canDeliverInOrder = false;
break;
}
}
tr2 = tr1;
tr1 = _targetStream.getNext();
}
while ((tr1.startstamp <= end) && (tr1 != tr2));
}
}
else // prevTick not unknown
{
_targetStream.setCursor(prevTick);
TickRange prevTickRange = _targetStream.getNext();
if ((prevTickRange.type == TickRange.Completed)
|| (prevTickRange.type == TickRange.Accepted))
{
canDeliverInOrder = true;
}
else if (prevTickRange.type == TickRange.Value)
{
// Can deliver if the previous tick is a value and it has been delivered
canDeliverInOrder = ((AIValueTick) prevTickRange.value).isDelivered();
}
else // prevTickRange is not L/D, L/A or delivered V/U
{
canDeliverInOrder = false;
}
}
} // end synchronized(this)
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(
tc,
"canDeliverAssuredInOrder",
Boolean.valueOf(canDeliverInOrder));
return canDeliverInOrder;
} }
|
public class class_name {
public boolean canDeliverAssuredInOrder(
long tick,
long prevTick,
int priority)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"canDeliverAssuredInOrder",
new Object[] {
Long.valueOf(tick),
Long.valueOf(prevTick),
Integer.valueOf(priority)});
boolean canDeliverInOrder = false;
synchronized (this)
{
// Is prevTick unknown?
if (prevTick == _mp.getCustomProperties().get_unknown_prev_tick())
{
// start assuming we can deliver, but if we find Q/U, Q/G or undelivered V/U, then we cannot
canDeliverInOrder = true; // depends on control dependency: [if], data = [none]
long start = _targetStream.getCompletedPrefix() + 1;
if (start < tick)
{
long end = tick - 1;
_targetStream.setCursor(start); // depends on control dependency: [if], data = [(start]
TickRange tr2 = null;
TickRange tr1 = _targetStream.getNext();
do
{
if ((tr1.type == TickRange.Unknown)
|| (tr1.type == TickRange.Requested))
{
canDeliverInOrder = false; // depends on control dependency: [if], data = [none]
break;
}
else if (tr1.type == TickRange.Value)
{
AIValueTick valueTick = (AIValueTick) tr1.value;
boolean delivered = valueTick.isDelivered();
Reliability currentReliability = valueTick.getMsgReliability();
boolean isAssured =
currentReliability.compareTo(Reliability.RELIABLE_PERSISTENT)
>= 0;
boolean samePriority = (valueTick.getMsgPriority() == priority);
if (isAssured
&& samePriority
&& !delivered) // has it not been delivered?
{
canDeliverInOrder = false; // depends on control dependency: [if], data = [none]
break;
}
}
tr2 = tr1;
tr1 = _targetStream.getNext();
}
while ((tr1.startstamp <= end) && (tr1 != tr2));
}
}
else // prevTick not unknown
{
_targetStream.setCursor(prevTick); // depends on control dependency: [if], data = [(prevTick]
TickRange prevTickRange = _targetStream.getNext();
if ((prevTickRange.type == TickRange.Completed)
|| (prevTickRange.type == TickRange.Accepted))
{
canDeliverInOrder = true; // depends on control dependency: [if], data = [none]
}
else if (prevTickRange.type == TickRange.Value)
{
// Can deliver if the previous tick is a value and it has been delivered
canDeliverInOrder = ((AIValueTick) prevTickRange.value).isDelivered(); // depends on control dependency: [if], data = [none]
}
else // prevTickRange is not L/D, L/A or delivered V/U
{
canDeliverInOrder = false; // depends on control dependency: [if], data = [none]
}
}
} // end synchronized(this)
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(
tc,
"canDeliverAssuredInOrder",
Boolean.valueOf(canDeliverInOrder));
return canDeliverInOrder;
} }
|
public class class_name {
public void startObject(String objectType) {
logger.debug("START:" + objectType);
if (objectType.equals("Molecule")) {
currentMolecule = builder.newInstance(IAtomContainer.class);
atomEnumeration = new Hashtable<String, Integer>();
} else if (objectType.equals("Atom")) {
currentAtom = builder.newInstance(IAtom.class, "H");
logger.debug("Atom # " + numberOfAtoms);
numberOfAtoms++;
} else if (objectType.equals("Bond")) {
bond_id = null;
bond_stereo = (IBond.Stereo) CDKConstants.UNSET;
}
} }
|
public class class_name {
public void startObject(String objectType) {
logger.debug("START:" + objectType);
if (objectType.equals("Molecule")) {
currentMolecule = builder.newInstance(IAtomContainer.class); // depends on control dependency: [if], data = [none]
atomEnumeration = new Hashtable<String, Integer>(); // depends on control dependency: [if], data = [none]
} else if (objectType.equals("Atom")) {
currentAtom = builder.newInstance(IAtom.class, "H"); // depends on control dependency: [if], data = [none]
logger.debug("Atom # " + numberOfAtoms); // depends on control dependency: [if], data = [none]
numberOfAtoms++; // depends on control dependency: [if], data = [none]
} else if (objectType.equals("Bond")) {
bond_id = null; // depends on control dependency: [if], data = [none]
bond_stereo = (IBond.Stereo) CDKConstants.UNSET; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public final void decode(long spatialKey, GHPoint latLon) {
// Performance: calculating 'midLon' and 'midLat' on the fly is not slower than using
// precalculated values from arrays and for 'bits' a precalculated array is even slightly slower!
// Use the value in the middle => start from "min" use "max" as initial step-size
double midLat = (bbox.maxLat - bbox.minLat) / 2;
double midLon = (bbox.maxLon - bbox.minLon) / 2;
double lat = bbox.minLat;
double lon = bbox.minLon;
long bits = initialBits;
while (true) {
if ((spatialKey & bits) != 0) {
lat += midLat;
}
midLat /= 2;
bits >>>= 1;
if ((spatialKey & bits) != 0) {
lon += midLon;
}
midLon /= 2;
if (bits > 1) {
bits >>>= 1;
} else {
break;
}
}
// stable rounding - see testBijection
lat += midLat;
lon += midLon;
latLon.lat = lat;
latLon.lon = lon;
} }
|
public class class_name {
@Override
public final void decode(long spatialKey, GHPoint latLon) {
// Performance: calculating 'midLon' and 'midLat' on the fly is not slower than using
// precalculated values from arrays and for 'bits' a precalculated array is even slightly slower!
// Use the value in the middle => start from "min" use "max" as initial step-size
double midLat = (bbox.maxLat - bbox.minLat) / 2;
double midLon = (bbox.maxLon - bbox.minLon) / 2;
double lat = bbox.minLat;
double lon = bbox.minLon;
long bits = initialBits;
while (true) {
if ((spatialKey & bits) != 0) {
lat += midLat; // depends on control dependency: [if], data = [none]
}
midLat /= 2; // depends on control dependency: [while], data = [none]
bits >>>= 1; // depends on control dependency: [while], data = [none]
if ((spatialKey & bits) != 0) {
lon += midLon; // depends on control dependency: [if], data = [none]
}
midLon /= 2; // depends on control dependency: [while], data = [none]
if (bits > 1) {
bits >>>= 1; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
// stable rounding - see testBijection
lat += midLat;
lon += midLon;
latLon.lat = lat;
latLon.lon = lon;
} }
|
public class class_name {
public void hasValue(long expected) {
if (actual() == null) {
failWithActual("expected an optional with value", expected);
} else if (!actual().isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("but was absent"));
} else {
checkNoNeedToDisplayBothValues("getAsLong()").that(actual().getAsLong()).isEqualTo(expected);
}
} }
|
public class class_name {
public void hasValue(long expected) {
if (actual() == null) {
failWithActual("expected an optional with value", expected); // depends on control dependency: [if], data = [none]
} else if (!actual().isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("but was absent")); // depends on control dependency: [if], data = [none]
} else {
checkNoNeedToDisplayBothValues("getAsLong()").that(actual().getAsLong()).isEqualTo(expected); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(DatasetContentStatus datasetContentStatus, ProtocolMarshaller protocolMarshaller) {
if (datasetContentStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(datasetContentStatus.getState(), STATE_BINDING);
protocolMarshaller.marshall(datasetContentStatus.getReason(), REASON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DatasetContentStatus datasetContentStatus, ProtocolMarshaller protocolMarshaller) {
if (datasetContentStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(datasetContentStatus.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(datasetContentStatus.getReason(), REASON_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 static JSONObject doPostRequest(HttpPost httpPost, HashMap<String, String> params) throws JSONException {
JSONObject json = null;
HttpClient postClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = postClient.execute(httpPost);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close();
json = new JSONObject(result);
}
} else {
json = UpworkRestClient.genError(response);
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpPost.abort();
}
return json;
} }
|
public class class_name {
private static JSONObject doPostRequest(HttpPost httpPost, HashMap<String, String> params) throws JSONException {
JSONObject json = null;
HttpClient postClient = HttpClientBuilder.create().build();
HttpResponse response;
try {
response = postClient.execute(httpPost);
if(response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = convertStreamToString(instream);
instream.close(); // depends on control dependency: [if], data = [none]
json = new JSONObject(result); // depends on control dependency: [if], data = [none]
}
} else {
json = UpworkRestClient.genError(response); // depends on control dependency: [if], data = [none]
}
} catch (ClientProtocolException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: ClientProtocolException");
} catch (IOException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: IOException");
} catch (JSONException e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: JSONException");
} catch (Exception e) {
json = UpworkRestClient.genError(HTTP_RESPONSE_503, "Exception: Exception " + e.toString());
} finally {
httpPost.abort();
}
return json;
} }
|
public class class_name {
private Content linkToUndocumentedDeclaredExceptions(
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
TagletWriter writer) {
Content result = writer.getOutputInstance();
//Add links to the exceptions declared but not documented.
for (int i = 0; i < declaredExceptionTypes.length; i++) {
if (declaredExceptionTypes[i].asClassDoc() != null &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().name()) &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
if (alreadyDocumented.size() == 0) {
result.addContent(writer.getThrowsHeader());
}
result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i]));
alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name());
}
}
return result;
} }
|
public class class_name {
private Content linkToUndocumentedDeclaredExceptions(
Type[] declaredExceptionTypes, Set<String> alreadyDocumented,
TagletWriter writer) {
Content result = writer.getOutputInstance();
//Add links to the exceptions declared but not documented.
for (int i = 0; i < declaredExceptionTypes.length; i++) {
if (declaredExceptionTypes[i].asClassDoc() != null &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().name()) &&
! alreadyDocumented.contains(
declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
if (alreadyDocumented.size() == 0) {
result.addContent(writer.getThrowsHeader()); // depends on control dependency: [if], data = [none]
}
result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i])); // depends on control dependency: [if], data = [none]
alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name()); // depends on control dependency: [if], data = [(declaredExceptionTypes[i].asClassDoc()]
}
}
return result;
} }
|
public class class_name {
public void processDecodes(FacesContext context) {
if (context == null) {
throw new NullPointerException();
}
// Skip processing if our rendered flag is false
if (!isRendered()) {
return;
}
super.processDecodes(context);
if (isImmediate()) {
executeValidate(context);
}
} }
|
public class class_name {
public void processDecodes(FacesContext context) {
if (context == null) {
throw new NullPointerException();
}
// Skip processing if our rendered flag is false
if (!isRendered()) {
return; // depends on control dependency: [if], data = [none]
}
super.processDecodes(context);
if (isImmediate()) {
executeValidate(context); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void removeReporter(ContextAwareReporter reporter) {
if (this.reporters.contains(reporter)) {
reporter.stop();
this.reporters.remove(reporter);
}
} }
|
public class class_name {
public void removeReporter(ContextAwareReporter reporter) {
if (this.reporters.contains(reporter)) {
reporter.stop(); // depends on control dependency: [if], data = [none]
this.reporters.remove(reporter); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Map<String, String> getErrorDetails() {
// Add stacktrace and/or comment fields.
Map<String, String> detailMap = new LinkedHashMap<String, String>();
if (m_resultFields.containsKey(COMMENT)) {
detailMap.put(COMMENT, m_resultFields.get(COMMENT));
}
if (m_resultFields.containsKey(STACK_TRACE)) {
detailMap.put(STACK_TRACE, m_resultFields.get(STACK_TRACE));
}
return detailMap;
} }
|
public class class_name {
public Map<String, String> getErrorDetails() {
// Add stacktrace and/or comment fields.
Map<String, String> detailMap = new LinkedHashMap<String, String>();
if (m_resultFields.containsKey(COMMENT)) {
detailMap.put(COMMENT, m_resultFields.get(COMMENT));
// depends on control dependency: [if], data = [none]
}
if (m_resultFields.containsKey(STACK_TRACE)) {
detailMap.put(STACK_TRACE, m_resultFields.get(STACK_TRACE));
// depends on control dependency: [if], data = [none]
}
return detailMap;
} }
|
public class class_name {
private static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass) {
T annotation = clazz.getAnnotation(annotationClass);
if (annotation == null) {
for (Class<?> interfaceClass : clazz.getInterfaces()) {
annotation = interfaceClass.getAnnotation(annotationClass);
if (annotation != null) {
break;
}
}
}
return annotation;
} }
|
public class class_name {
private static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass) {
T annotation = clazz.getAnnotation(annotationClass);
if (annotation == null) {
for (Class<?> interfaceClass : clazz.getInterfaces()) {
annotation = interfaceClass.getAnnotation(annotationClass);
// depends on control dependency: [for], data = [interfaceClass]
if (annotation != null) {
break;
}
}
}
return annotation;
} }
|
public class class_name {
static List<Map<String, String>> convertConfigToAttributes(String configPath,
List<ChildData> currentData) {
List<Map<String, String>> attributes = new ArrayList<Map<String, String>>();
if (CommonUtils.isEmpty(currentData)) {
return attributes;
}
for (ChildData childData : currentData) {
attributes.add(convertConfigToAttribute(configPath, childData, false));
}
return attributes;
} }
|
public class class_name {
static List<Map<String, String>> convertConfigToAttributes(String configPath,
List<ChildData> currentData) {
List<Map<String, String>> attributes = new ArrayList<Map<String, String>>();
if (CommonUtils.isEmpty(currentData)) {
return attributes; // depends on control dependency: [if], data = [none]
}
for (ChildData childData : currentData) {
attributes.add(convertConfigToAttribute(configPath, childData, false)); // depends on control dependency: [for], data = [childData]
}
return attributes;
} }
|
public class class_name {
public List<Problem> validate(TypeElement type) {
List<Problem> problems = new ArrayList<Problem>();
boolean declared = false;
int constructor = 0;
List<Element> keys = new ArrayList<Element>();
for (Element element : type.getEnclosedElements()) {
ElementKind kind = element.getKind();
if (kind == ElementKind.CONSTRUCTOR) {
constructor++;
if (((ExecutableElement) element).getParameters().isEmpty()) {
if (element.getModifiers().contains(Modifier.PUBLIC)) {
declared = true;
}
}
} else if (kind == ElementKind.FIELD) {
for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
Name name = ((TypeElement) mirror.getAnnotationType()
.asElement()).getQualifiedName();
if (name.contentEquals(KEY)) {
keys.add(element);
break;
}
}
}
}
if (!declared && constructor > 0) {
problems.add(new Problem(Kind.ERROR,
"Entity class must have a public default constructor", type));
return problems;
}
if (keys.isEmpty()) {
problems.add(new Problem(Kind.ERROR,
"Entity class must have one @Key property", type));
return problems;
} else if (keys.size() > 1) {
for (Element key : keys) {
problems.add(new Problem(Kind.ERROR,
"@Key cannot be annotated on multiple properties", key));
}
return problems;
}
VariableElement variableElement = (VariableElement) keys.get(0);
TypeMirror mirror = variableElement.asType();
Element element = (mirror.getKind().isPrimitive())
? types.boxedClass((PrimitiveType) mirror) : types.asElement(mirror);
Name name = ((TypeElement) element).getQualifiedName();
if (!name.contentEquals(JAVA_LANG_LONG)
&& !name.contentEquals(JAVA_LANG_STRING)
&& !name.contentEquals(LONG)) {
problems.add(new Problem(Kind.ERROR, "@Key property must be ["
+ JAVA_LANG_STRING + "] or [" + JAVA_LANG_LONG + "] or [" + LONG + "]", variableElement));
}
return problems;
} }
|
public class class_name {
public List<Problem> validate(TypeElement type) {
List<Problem> problems = new ArrayList<Problem>();
boolean declared = false;
int constructor = 0;
List<Element> keys = new ArrayList<Element>();
for (Element element : type.getEnclosedElements()) {
ElementKind kind = element.getKind();
if (kind == ElementKind.CONSTRUCTOR) {
constructor++; // depends on control dependency: [if], data = [none]
if (((ExecutableElement) element).getParameters().isEmpty()) {
if (element.getModifiers().contains(Modifier.PUBLIC)) {
declared = true; // depends on control dependency: [if], data = [none]
}
}
} else if (kind == ElementKind.FIELD) {
for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
Name name = ((TypeElement) mirror.getAnnotationType()
.asElement()).getQualifiedName();
if (name.contentEquals(KEY)) {
keys.add(element); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
if (!declared && constructor > 0) {
problems.add(new Problem(Kind.ERROR,
"Entity class must have a public default constructor", type)); // depends on control dependency: [if], data = [none]
return problems; // depends on control dependency: [if], data = [none]
}
if (keys.isEmpty()) {
problems.add(new Problem(Kind.ERROR,
"Entity class must have one @Key property", type)); // depends on control dependency: [if], data = [none]
return problems; // depends on control dependency: [if], data = [none]
} else if (keys.size() > 1) {
for (Element key : keys) {
problems.add(new Problem(Kind.ERROR,
"@Key cannot be annotated on multiple properties", key)); // depends on control dependency: [for], data = [none]
}
return problems; // depends on control dependency: [if], data = [none]
}
VariableElement variableElement = (VariableElement) keys.get(0);
TypeMirror mirror = variableElement.asType();
Element element = (mirror.getKind().isPrimitive())
? types.boxedClass((PrimitiveType) mirror) : types.asElement(mirror);
Name name = ((TypeElement) element).getQualifiedName();
if (!name.contentEquals(JAVA_LANG_LONG)
&& !name.contentEquals(JAVA_LANG_STRING)
&& !name.contentEquals(LONG)) {
problems.add(new Problem(Kind.ERROR, "@Key property must be ["
+ JAVA_LANG_STRING + "] or [" + JAVA_LANG_LONG + "] or [" + LONG + "]", variableElement)); // depends on control dependency: [if], data = [none]
}
return problems;
} }
|
public class class_name {
static String processClassLoaderString(String input) {
if (input.contains("DexPathList")) {
return processClassLoaderString43OrLater(input);
} else {
return processClassLoaderString42OrEarlier(input);
}
} }
|
public class class_name {
static String processClassLoaderString(String input) {
if (input.contains("DexPathList")) {
return processClassLoaderString43OrLater(input); // depends on control dependency: [if], data = [none]
} else {
return processClassLoaderString42OrEarlier(input); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Integer getEstimatedTextLines() {
if (!dataObj.has(CUSTOM_FIELD_AVG_TEXT_LENGTH)) {
return null;
}
Integer numLines = null;
try {
JSONObject obj = dataObj.getJSONObject(CUSTOM_FIELD_AVG_TEXT_LENGTH);
numLines = obj.getInt(CUSTOM_FIELD_NUM_LINES);
} catch (JSONException e) {
}
return numLines;
} }
|
public class class_name {
public Integer getEstimatedTextLines() {
if (!dataObj.has(CUSTOM_FIELD_AVG_TEXT_LENGTH)) {
return null; // depends on control dependency: [if], data = [none]
}
Integer numLines = null;
try {
JSONObject obj = dataObj.getJSONObject(CUSTOM_FIELD_AVG_TEXT_LENGTH);
numLines = obj.getInt(CUSTOM_FIELD_NUM_LINES); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
} // depends on control dependency: [catch], data = [none]
return numLines;
} }
|
public class class_name {
public Object getParent(Object child) {
if (child instanceof TreeObject) {
return ((TreeObject)child).getParent();
}
return null;
} }
|
public class class_name {
public Object getParent(Object child) {
if (child instanceof TreeObject) {
return ((TreeObject)child).getParent(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void setPos(int pos) {
position = pos;
NodeAVL n = nPrimaryNode;
while (n != null) {
((NodeAVLDisk) n).iData = position;
n = n.nNext;
}
} }
|
public class class_name {
public void setPos(int pos) {
position = pos;
NodeAVL n = nPrimaryNode;
while (n != null) {
((NodeAVLDisk) n).iData = position; // depends on control dependency: [while], data = [none]
n = n.nNext; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
private RRFedNonFedBudgetDocument getRRFedNonFedBudget() {
RRFedNonFedBudgetDocument rrFedNonFedBudgetDocument = RRFedNonFedBudgetDocument.Factory.newInstance();
RRFedNonFedBudget rrFedNonFedBudget = RRFedNonFedBudget.Factory.newInstance();
rrFedNonFedBudget.setFormVersion(FormVersion.v1_1.getVersion());
if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
rrFedNonFedBudget.setDUNSID(pdDoc.getDevelopmentProposal().getApplicantOrganization().getOrganization().getDunsNumber());
}
if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
rrFedNonFedBudget.setOrganizationName(pdDoc.getDevelopmentProposal().getApplicantOrganization().getOrganization().getOrganizationName());
}
rrFedNonFedBudget.setBudgetType(BudgetTypeDataType.PROJECT);
// Set default values for mandatory fields
validateBudgetForForm(pdDoc);
List<BudgetPeriodDto> budgetPeriodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc);
BudgetSummaryDto budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetPeriodList);
budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
for (BudgetPeriodDto budgetPeriodData : budgetPeriodList) {
if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P1.getNum()) {
rrFedNonFedBudget.setBudgetYear1(getBudgetYear1DataType(budgetPeriodData));
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P2.getNum()) {
rrFedNonFedBudget.setBudgetYear2(getBudgetYearDataType(budgetPeriodData));
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P3.getNum()) {
rrFedNonFedBudget.setBudgetYear3(getBudgetYearDataType(budgetPeriodData));
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P4.getNum()) {
rrFedNonFedBudget.setBudgetYear4(getBudgetYearDataType(budgetPeriodData));
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P5.getNum()) {
rrFedNonFedBudget.setBudgetYear5(getBudgetYearDataType(budgetPeriodData));
}
}
for (BudgetPeriodDto budgetPeriodData : budgetPeriodList) {
if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P1.getNum()) {
rrFedNonFedBudget.setBudgetYear1(getBudgetJustificationAttachment(rrFedNonFedBudget.getBudgetYear1()));
}
}
rrFedNonFedBudget.setBudgetSummary(getBudgetSummary(budgetSummary));
rrFedNonFedBudgetDocument.setRRFedNonFedBudget(rrFedNonFedBudget);
return rrFedNonFedBudgetDocument;
} }
|
public class class_name {
private RRFedNonFedBudgetDocument getRRFedNonFedBudget() {
RRFedNonFedBudgetDocument rrFedNonFedBudgetDocument = RRFedNonFedBudgetDocument.Factory.newInstance();
RRFedNonFedBudget rrFedNonFedBudget = RRFedNonFedBudget.Factory.newInstance();
rrFedNonFedBudget.setFormVersion(FormVersion.v1_1.getVersion());
if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
rrFedNonFedBudget.setDUNSID(pdDoc.getDevelopmentProposal().getApplicantOrganization().getOrganization().getDunsNumber()); // depends on control dependency: [if], data = [(pdDoc.getDevelopmentProposal().getApplicantOrganization()]
}
if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) {
rrFedNonFedBudget.setOrganizationName(pdDoc.getDevelopmentProposal().getApplicantOrganization().getOrganization().getOrganizationName()); // depends on control dependency: [if], data = [(pdDoc.getDevelopmentProposal().getApplicantOrganization()]
}
rrFedNonFedBudget.setBudgetType(BudgetTypeDataType.PROJECT);
// Set default values for mandatory fields
validateBudgetForForm(pdDoc);
List<BudgetPeriodDto> budgetPeriodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc);
BudgetSummaryDto budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetPeriodList);
budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
for (BudgetPeriodDto budgetPeriodData : budgetPeriodList) {
if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P1.getNum()) {
rrFedNonFedBudget.setBudgetYear1(getBudgetYear1DataType(budgetPeriodData)); // depends on control dependency: [if], data = [none]
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P2.getNum()) {
rrFedNonFedBudget.setBudgetYear2(getBudgetYearDataType(budgetPeriodData)); // depends on control dependency: [if], data = [none]
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P3.getNum()) {
rrFedNonFedBudget.setBudgetYear3(getBudgetYearDataType(budgetPeriodData)); // depends on control dependency: [if], data = [none]
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P4.getNum()) {
rrFedNonFedBudget.setBudgetYear4(getBudgetYearDataType(budgetPeriodData)); // depends on control dependency: [if], data = [none]
}
else if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P5.getNum()) {
rrFedNonFedBudget.setBudgetYear5(getBudgetYearDataType(budgetPeriodData)); // depends on control dependency: [if], data = [none]
}
}
for (BudgetPeriodDto budgetPeriodData : budgetPeriodList) {
if (budgetPeriodData.getBudgetPeriod() == BudgetPeriodNum.P1.getNum()) {
rrFedNonFedBudget.setBudgetYear1(getBudgetJustificationAttachment(rrFedNonFedBudget.getBudgetYear1())); // depends on control dependency: [if], data = [none]
}
}
rrFedNonFedBudget.setBudgetSummary(getBudgetSummary(budgetSummary));
rrFedNonFedBudgetDocument.setRRFedNonFedBudget(rrFedNonFedBudget);
return rrFedNonFedBudgetDocument;
} }
|
public class class_name {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if(localName.equals(TAG_LOG_ENTRY)) {
if (currentTags != null) {
throw new IllegalStateException("Should not have tags when a config starts in the XML, but had: " + currentTags);
}
currentTags = new LogEntry();
if(attributes.getValue(TAG_REVISION) != null) {
currentTags.revision = Long.parseLong(attributes.getValue(TAG_REVISION));
}
} else if (localName.equals(TAG_PATH)) {
lastAction = attributes.getValue(TAG_PATH_ACTION);
}
} }
|
public class class_name {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if(localName.equals(TAG_LOG_ENTRY)) {
if (currentTags != null) {
throw new IllegalStateException("Should not have tags when a config starts in the XML, but had: " + currentTags);
}
currentTags = new LogEntry();
if(attributes.getValue(TAG_REVISION) != null) {
currentTags.revision = Long.parseLong(attributes.getValue(TAG_REVISION)); // depends on control dependency: [if], data = [(attributes.getValue(TAG_REVISION)]
}
} else if (localName.equals(TAG_PATH)) {
lastAction = attributes.getValue(TAG_PATH_ACTION);
}
} }
|
public class class_name {
public String getOptionValue(final String optionName) {
if (optionName.length() == 1) {
return getOptionValue(optionName.charAt(0));
}
return (String) commandLine.getValue("--" + optionName);
} }
|
public class class_name {
public String getOptionValue(final String optionName) {
if (optionName.length() == 1) {
return getOptionValue(optionName.charAt(0)); // depends on control dependency: [if], data = [none]
}
return (String) commandLine.getValue("--" + optionName);
} }
|
public class class_name {
protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) {
if (type == null)
return false;
if (annotated) {
return checkAnnotation(type);
} else if (scanpackages != null) {
String classPackage = type.getPackage().getName();
for (String pkg : scanpackages) {
if (classPackage.startsWith(pkg)) {
if (annotated) {
return checkAnnotation(type);
} else
return true;
}
}
return false;
} else if (clazzes != null) {
for (Class<?> cls : clazzes) { // must strictly equal. Don't check
// inheritance
if (cls == type)
return true;
}
return false;
}
return true;
} }
|
public class class_name {
protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) {
if (type == null)
return false;
if (annotated) {
return checkAnnotation(type); // depends on control dependency: [if], data = [none]
} else if (scanpackages != null) {
String classPackage = type.getPackage().getName();
for (String pkg : scanpackages) {
if (classPackage.startsWith(pkg)) {
if (annotated) {
return checkAnnotation(type); // depends on control dependency: [if], data = [none]
} else
return true;
}
}
return false; // depends on control dependency: [if], data = [none]
} else if (clazzes != null) {
for (Class<?> cls : clazzes) { // must strictly equal. Don't check
// inheritance
if (cls == type)
return true;
}
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
protected String getLocaleSpecificTitle(Locale locale) {
String result = null;
try {
if (isDetailRequest()) {
// this is a request to a detail page
CmsResource res = getDetailContent();
CmsFile file = m_cms.readFile(res);
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
result = content.getHandler().getTitleMapping(m_cms, content, m_cms.getRequestContext().getLocale());
if (result == null) {
// title not found, maybe no mapping OR not available in the current locale
// read the title of the detail resource as fall back (may contain mapping from another locale)
result = m_cms.readPropertyObject(
res,
CmsPropertyDefinition.PROPERTY_TITLE,
false,
locale).getValue();
}
}
if (result == null) {
// read the title of the requested resource as fall back
result = m_cms.readPropertyObject(
m_cms.getRequestContext().getUri(),
CmsPropertyDefinition.PROPERTY_TITLE,
true,
locale).getValue();
}
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) {
result = "";
}
return result;
} }
|
public class class_name {
protected String getLocaleSpecificTitle(Locale locale) {
String result = null;
try {
if (isDetailRequest()) {
// this is a request to a detail page
CmsResource res = getDetailContent();
CmsFile file = m_cms.readFile(res);
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
result = content.getHandler().getTitleMapping(m_cms, content, m_cms.getRequestContext().getLocale()); // depends on control dependency: [if], data = [none]
if (result == null) {
// title not found, maybe no mapping OR not available in the current locale
// read the title of the detail resource as fall back (may contain mapping from another locale)
result = m_cms.readPropertyObject(
res,
CmsPropertyDefinition.PROPERTY_TITLE,
false,
locale).getValue(); // depends on control dependency: [if], data = [none]
}
}
if (result == null) {
// read the title of the requested resource as fall back
result = m_cms.readPropertyObject(
m_cms.getRequestContext().getUri(),
CmsPropertyDefinition.PROPERTY_TITLE,
true,
locale).getValue(); // depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) {
result = ""; // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception)
throws IOException {
if (m_editableRequest) {
String stacktrace = CmsException.getStackTraceAsString(exception);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) {
stacktrace = null;
} else {
// stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);
stacktrace = CmsEncoder.escapeXml(stacktrace);
}
StringBuffer errorBox = new StringBuffer(256);
errorBox.append(
"<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\"");
errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR);
errorBox.append("\">");
errorBox.append(
Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath));
errorBox.append("<br />");
errorBox.append(exception.getLocalizedMessage());
if (stacktrace != null) {
errorBox.append(
"<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">");
errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0));
String title = Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath);
errorBox.append("<span title=\"");
errorBox.append(CmsEncoder.escapeXml(title));
errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">");
errorBox.append(stacktrace);
errorBox.append("</span></span>");
}
errorBox.append("</div>");
pageContext.getOut().print(errorBox.toString());
}
} }
|
public class class_name {
private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception)
throws IOException {
if (m_editableRequest) {
String stacktrace = CmsException.getStackTraceAsString(exception);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) {
stacktrace = null; // depends on control dependency: [if], data = [none]
} else {
// stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);
stacktrace = CmsEncoder.escapeXml(stacktrace); // depends on control dependency: [if], data = [none]
}
StringBuffer errorBox = new StringBuffer(256);
errorBox.append(
"<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\"");
errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR);
errorBox.append("\">");
errorBox.append(
Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath));
errorBox.append("<br />");
errorBox.append(exception.getLocalizedMessage());
if (stacktrace != null) {
errorBox.append(
"<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">"); // depends on control dependency: [if], data = [none]
errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0)); // depends on control dependency: [if], data = [none]
String title = Messages.get().getBundle().key(
Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
elementSitePath,
formatterSitePath);
errorBox.append("<span title=\""); // depends on control dependency: [if], data = [none]
errorBox.append(CmsEncoder.escapeXml(title)); // depends on control dependency: [if], data = [none]
errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">"); // depends on control dependency: [if], data = [none]
errorBox.append(stacktrace); // depends on control dependency: [if], data = [(stacktrace]
errorBox.append("</span></span>"); // depends on control dependency: [if], data = [none]
}
errorBox.append("</div>");
pageContext.getOut().print(errorBox.toString());
}
} }
|
public class class_name {
public <R extends RequestQueue> R addQueueMarkerListener(
RequestListener.MarkerListener markerListener) {
if (markerListener != null) {
synchronized (markerListeners) {
this.markerListeners.add(markerListener);
}
}
return (R) this;
} }
|
public class class_name {
public <R extends RequestQueue> R addQueueMarkerListener(
RequestListener.MarkerListener markerListener) {
if (markerListener != null) {
synchronized (markerListeners) { // depends on control dependency: [if], data = [(markerListener]
this.markerListeners.add(markerListener);
}
}
return (R) this;
} }
|
public class class_name {
public void removeSprite (Sprite sprite)
{
_metamgr.removeSprite(sprite);
if (((sprite instanceof ActionSprite) ||
(sprite instanceof HoverSprite)) && (--_actionSpriteCount == 0)) {
removeMouseListener(_actionHandler);
removeMouseMotionListener(_actionHandler);
}
} }
|
public class class_name {
public void removeSprite (Sprite sprite)
{
_metamgr.removeSprite(sprite);
if (((sprite instanceof ActionSprite) ||
(sprite instanceof HoverSprite)) && (--_actionSpriteCount == 0)) {
removeMouseListener(_actionHandler); // depends on control dependency: [if], data = [none]
removeMouseMotionListener(_actionHandler); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void compress() {
resizeLock.lock();
try {
AtomicShortIntBackingArray s = store.get();
if (s instanceof AtomicShortIntUniformBackingArray) {
return;
}
int unique = s.getUnique();
if (AtomicShortIntPaletteBackingArray.roundUpWidth(unique - 1) >= s.width()) {
return;
}
if (unique > AtomicShortIntPaletteBackingArray.getAllowedPalette(s.length())) {
return;
}
if (unique == 1) {
store.set(new AtomicShortIntUniformBackingArray(s));
} else {
store.set(new AtomicShortIntPaletteBackingArray(s, length, true, false, unique));
}
} finally {
resizeLock.unlock();
}
} }
|
public class class_name {
public void compress() {
resizeLock.lock();
try {
AtomicShortIntBackingArray s = store.get();
if (s instanceof AtomicShortIntUniformBackingArray) {
return; // depends on control dependency: [if], data = [none]
}
int unique = s.getUnique();
if (AtomicShortIntPaletteBackingArray.roundUpWidth(unique - 1) >= s.width()) {
return; // depends on control dependency: [if], data = [none]
}
if (unique > AtomicShortIntPaletteBackingArray.getAllowedPalette(s.length())) {
return; // depends on control dependency: [if], data = [none]
}
if (unique == 1) {
store.set(new AtomicShortIntUniformBackingArray(s)); // depends on control dependency: [if], data = [none]
} else {
store.set(new AtomicShortIntPaletteBackingArray(s, length, true, false, unique)); // depends on control dependency: [if], data = [none]
}
} finally {
resizeLock.unlock();
}
} }
|
public class class_name {
public static Optional<byte[]> readMaybeRangedBytes(ByteBuf bf) {
Optional<Integer> length = readMaybeVInt(bf);
if (length.isPresent()) {
int l = length.get();
if (bf.readableBytes() >= l) {
if (l > 0) {
byte[] array = new byte[l];
bf.readBytes(array);
return Optional.of(array);
} else {
return Optional.of(Util.EMPTY_BYTE_ARRAY);
}
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} else return Optional.empty();
} }
|
public class class_name {
public static Optional<byte[]> readMaybeRangedBytes(ByteBuf bf) {
Optional<Integer> length = readMaybeVInt(bf);
if (length.isPresent()) {
int l = length.get();
if (bf.readableBytes() >= l) {
if (l > 0) {
byte[] array = new byte[l];
bf.readBytes(array); // depends on control dependency: [if], data = [none]
return Optional.of(array); // depends on control dependency: [if], data = [none]
} else {
return Optional.of(Util.EMPTY_BYTE_ARRAY); // depends on control dependency: [if], data = [none]
}
} else {
bf.resetReaderIndex(); // depends on control dependency: [if], data = [none]
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
} else return Optional.empty();
} }
|
public class class_name {
public static String map(SlingHttpServletRequest request, String value) {
StringBuilder result = new StringBuilder();
Matcher matcher = HREF_PATTERN.matcher(value);
int len = value.length();
int pos = 0;
while (matcher.find(pos)) {
String unmapped = matcher.group(3);
String mapped = url(request, unmapped);
result.append(value, pos, matcher.start());
result.append(matcher.group(1));
result.append(mapped);
result.append(matcher.group(4));
pos = matcher.end();
}
if (pos >= 0 && pos < len) {
result.append(value, pos, len);
}
return result.toString();
} }
|
public class class_name {
public static String map(SlingHttpServletRequest request, String value) {
StringBuilder result = new StringBuilder();
Matcher matcher = HREF_PATTERN.matcher(value);
int len = value.length();
int pos = 0;
while (matcher.find(pos)) {
String unmapped = matcher.group(3);
String mapped = url(request, unmapped);
result.append(value, pos, matcher.start()); // depends on control dependency: [while], data = [none]
result.append(matcher.group(1)); // depends on control dependency: [while], data = [none]
result.append(mapped); // depends on control dependency: [while], data = [none]
result.append(matcher.group(4)); // depends on control dependency: [while], data = [none]
pos = matcher.end(); // depends on control dependency: [while], data = [none]
}
if (pos >= 0 && pos < len) {
result.append(value, pos, len); // depends on control dependency: [if], data = [none]
}
return result.toString();
} }
|
public class class_name {
private void addAttributes(ConfiguratorRegistration configuratorRegistration, String group) {
// if group == null; group = "DEFAULT_GROUP"
if (StringUtils.isNotEmpty(group)) {
configuratorRegistration.setGroup(group);
}
} }
|
public class class_name {
private void addAttributes(ConfiguratorRegistration configuratorRegistration, String group) {
// if group == null; group = "DEFAULT_GROUP"
if (StringUtils.isNotEmpty(group)) {
configuratorRegistration.setGroup(group); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static List<String> availableDomains(IDBAccess dbAccess) {
List<GrNode> resultList = loadAllDomainInfoNodes(dbAccess);
List<String> domains = new ArrayList<String>();
for (GrNode rNode : resultList) {
domains.add(rNode.getProperty(DomainInfoNameProperty).getValue().toString());
}
return domains;
} }
|
public class class_name {
public static List<String> availableDomains(IDBAccess dbAccess) {
List<GrNode> resultList = loadAllDomainInfoNodes(dbAccess);
List<String> domains = new ArrayList<String>();
for (GrNode rNode : resultList) {
domains.add(rNode.getProperty(DomainInfoNameProperty).getValue().toString());
// depends on control dependency: [for], data = [rNode]
}
return domains;
} }
|
public class class_name {
private int buildDropDown() {
int otherHeights = 0;
if (mDropDownList == null) {
ViewGroup dropDownView;
Context context = mContext;
/**
* This Runnable exists for the sole purpose of checking if the view layout has got
* completed and if so call showDropDown to display the drop down. This is used to show
* the drop down as soon as possible after user opens up the search dialog, without
* waiting for the normal UI pipeline to do it's job which is slower than this method.
*/
mShowDropDownRunnable = new Runnable() {
public void run() {
// View layout should be all done before displaying the drop down.
View view = getAnchorView();
if (view != null && view.getWindowToken() != null) {
show();
}
}
};
mDropDownList = new DropDownListView(context, !mModal);
if (mDropDownListHighlight != null) {
mDropDownList.setSelector(mDropDownListHighlight);
}
mDropDownList.setAdapter(mAdapter);
mDropDownList.setOnItemClickListener(mItemClickListener);
mDropDownList.setFocusable(true);
mDropDownList.setFocusableInTouchMode(true);
mDropDownList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
if (position != -1) {
DropDownListView dropDownList = mDropDownList;
if (dropDownList != null) {
dropDownList.mListSelectionHidden = false;
}
}
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
mDropDownList.setOnScrollListener(mScrollListener);
if (mItemSelectedListener != null) {
mDropDownList.setOnItemSelectedListener(mItemSelectedListener);
}
dropDownView = mDropDownList;
View hintView = mPromptView;
if (hintView != null) {
// if a hint has been specified, we accomodate more space for it and
// add a text view in the drop down menu, at the bottom of the list
LinearLayout hintContainer = new LinearLayout(context);
hintContainer.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams hintParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0f
);
switch (mPromptPosition) {
case POSITION_PROMPT_BELOW:
hintContainer.addView(dropDownView, hintParams);
hintContainer.addView(hintView);
break;
case POSITION_PROMPT_ABOVE:
hintContainer.addView(hintView);
hintContainer.addView(dropDownView, hintParams);
break;
default:
Log.e(TAG, "Invalid hint position " + mPromptPosition);
break;
}
// measure the hint's height to find how much more vertical space
// we need to add to the drop down's height
int widthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.UNSPECIFIED;
hintView.measure(widthSpec, heightSpec);
hintParams = (LinearLayout.LayoutParams) hintView.getLayoutParams();
otherHeights = hintView.getMeasuredHeight() + hintParams.topMargin
+ hintParams.bottomMargin;
dropDownView = hintContainer;
}
mPopup.setContentView(dropDownView);
} else {
final View view = mPromptView;
if (view != null) {
LinearLayout.LayoutParams hintParams =
(LinearLayout.LayoutParams) view.getLayoutParams();
otherHeights = view.getMeasuredHeight() + hintParams.topMargin
+ hintParams.bottomMargin;
}
}
// getMaxAvailableHeight() subtracts the padding, so we put it back
// to get the available height for the whole window
int padding = 0;
Drawable background = mPopup.getBackground();
if (background != null) {
background.getPadding(mTempRect);
padding = mTempRect.top + mTempRect.bottom;
// If we don't have an explicit vertical offset, determine one from the window
// background so that content will line up.
if (!mDropDownVerticalOffsetSet) {
mDropDownVerticalOffset = -mTempRect.top;
}
} else {
mTempRect.setEmpty();
}
int systemBarsReservedSpace = 0;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// getMaxAvailableHeight() on Lollipop seems to ignore the system bars.
systemBarsReservedSpace = Math.max(
getSystemBarHeight("status_bar_height"),
getSystemBarHeight("navigation_bar_height")
);
}
// Max height available on the screen for a popup.
boolean ignoreBottomDecorations =
mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
final int maxHeight = mPopup.getMaxAvailableHeight(
getAnchorView(), mDropDownVerticalOffset /*, ignoreBottomDecorations*/)
- systemBarsReservedSpace;
if (mDropDownAlwaysVisible || mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
return maxHeight + padding;
}
final int childWidthSpec;
switch (mDropDownWidth) {
case ViewGroup.LayoutParams.WRAP_CONTENT:
childWidthSpec = MeasureSpec.makeMeasureSpec(
mContext.getResources().getDisplayMetrics().widthPixels -
(mTempRect.left + mTempRect.right),
MeasureSpec.AT_MOST);
break;
case ViewGroup.LayoutParams.MATCH_PARENT:
childWidthSpec = MeasureSpec.makeMeasureSpec(
mContext.getResources().getDisplayMetrics().widthPixels -
(mTempRect.left + mTempRect.right),
MeasureSpec.EXACTLY);
break;
default:
childWidthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.EXACTLY);
break;
}
final int listContent = mDropDownList.measureHeightOfChildrenCompat(childWidthSpec,
0, DropDownListView.NO_POSITION, maxHeight - otherHeights, -1);
// add padding only if the list has items in it, that way we don't show
// the popup if it is not needed
if (listContent > 0) otherHeights += padding;
return listContent + otherHeights;
} }
|
public class class_name {
private int buildDropDown() {
int otherHeights = 0;
if (mDropDownList == null) {
ViewGroup dropDownView;
Context context = mContext;
/**
* This Runnable exists for the sole purpose of checking if the view layout has got
* completed and if so call showDropDown to display the drop down. This is used to show
* the drop down as soon as possible after user opens up the search dialog, without
* waiting for the normal UI pipeline to do it's job which is slower than this method.
*/
mShowDropDownRunnable = new Runnable() {
public void run() {
// View layout should be all done before displaying the drop down.
View view = getAnchorView();
if (view != null && view.getWindowToken() != null) {
show(); // depends on control dependency: [if], data = [none]
}
}
}; // depends on control dependency: [if], data = [none]
mDropDownList = new DropDownListView(context, !mModal); // depends on control dependency: [if], data = [none]
if (mDropDownListHighlight != null) {
mDropDownList.setSelector(mDropDownListHighlight); // depends on control dependency: [if], data = [(mDropDownListHighlight]
}
mDropDownList.setAdapter(mAdapter); // depends on control dependency: [if], data = [none]
mDropDownList.setOnItemClickListener(mItemClickListener); // depends on control dependency: [if], data = [none]
mDropDownList.setFocusable(true); // depends on control dependency: [if], data = [none]
mDropDownList.setFocusableInTouchMode(true); // depends on control dependency: [if], data = [none]
mDropDownList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
if (position != -1) {
DropDownListView dropDownList = mDropDownList;
if (dropDownList != null) {
dropDownList.mListSelectionHidden = false; // depends on control dependency: [if], data = [none]
}
}
}
public void onNothingSelected(AdapterView<?> parent) {
}
}); // depends on control dependency: [if], data = [none]
mDropDownList.setOnScrollListener(mScrollListener); // depends on control dependency: [if], data = [none]
if (mItemSelectedListener != null) {
mDropDownList.setOnItemSelectedListener(mItemSelectedListener); // depends on control dependency: [if], data = [(mItemSelectedListener]
}
dropDownView = mDropDownList; // depends on control dependency: [if], data = [none]
View hintView = mPromptView;
if (hintView != null) {
// if a hint has been specified, we accomodate more space for it and
// add a text view in the drop down menu, at the bottom of the list
LinearLayout hintContainer = new LinearLayout(context);
hintContainer.setOrientation(LinearLayout.VERTICAL); // depends on control dependency: [if], data = [none]
LinearLayout.LayoutParams hintParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 0, 1.0f
);
switch (mPromptPosition) {
case POSITION_PROMPT_BELOW:
hintContainer.addView(dropDownView, hintParams);
hintContainer.addView(hintView);
break;
case POSITION_PROMPT_ABOVE:
hintContainer.addView(hintView);
hintContainer.addView(dropDownView, hintParams);
break;
default:
Log.e(TAG, "Invalid hint position " + mPromptPosition);
break;
}
// measure the hint's height to find how much more vertical space
// we need to add to the drop down's height
int widthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.UNSPECIFIED;
hintView.measure(widthSpec, heightSpec); // depends on control dependency: [if], data = [none]
hintParams = (LinearLayout.LayoutParams) hintView.getLayoutParams(); // depends on control dependency: [if], data = [none]
otherHeights = hintView.getMeasuredHeight() + hintParams.topMargin
+ hintParams.bottomMargin; // depends on control dependency: [if], data = [none]
dropDownView = hintContainer; // depends on control dependency: [if], data = [none]
}
mPopup.setContentView(dropDownView); // depends on control dependency: [if], data = [none]
} else {
final View view = mPromptView;
if (view != null) {
LinearLayout.LayoutParams hintParams =
(LinearLayout.LayoutParams) view.getLayoutParams();
otherHeights = view.getMeasuredHeight() + hintParams.topMargin
+ hintParams.bottomMargin; // depends on control dependency: [if], data = [none]
}
}
// getMaxAvailableHeight() subtracts the padding, so we put it back
// to get the available height for the whole window
int padding = 0;
Drawable background = mPopup.getBackground();
if (background != null) {
background.getPadding(mTempRect); // depends on control dependency: [if], data = [none]
padding = mTempRect.top + mTempRect.bottom; // depends on control dependency: [if], data = [none]
// If we don't have an explicit vertical offset, determine one from the window
// background so that content will line up.
if (!mDropDownVerticalOffsetSet) {
mDropDownVerticalOffset = -mTempRect.top; // depends on control dependency: [if], data = [none]
}
} else {
mTempRect.setEmpty(); // depends on control dependency: [if], data = [none]
}
int systemBarsReservedSpace = 0;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// getMaxAvailableHeight() on Lollipop seems to ignore the system bars.
systemBarsReservedSpace = Math.max(
getSystemBarHeight("status_bar_height"),
getSystemBarHeight("navigation_bar_height")
); // depends on control dependency: [if], data = [none]
}
// Max height available on the screen for a popup.
boolean ignoreBottomDecorations =
mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
final int maxHeight = mPopup.getMaxAvailableHeight(
getAnchorView(), mDropDownVerticalOffset /*, ignoreBottomDecorations*/)
- systemBarsReservedSpace;
if (mDropDownAlwaysVisible || mDropDownHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
return maxHeight + padding; // depends on control dependency: [if], data = [none]
}
final int childWidthSpec;
switch (mDropDownWidth) {
case ViewGroup.LayoutParams.WRAP_CONTENT:
childWidthSpec = MeasureSpec.makeMeasureSpec(
mContext.getResources().getDisplayMetrics().widthPixels -
(mTempRect.left + mTempRect.right),
MeasureSpec.AT_MOST);
break;
case ViewGroup.LayoutParams.MATCH_PARENT:
childWidthSpec = MeasureSpec.makeMeasureSpec(
mContext.getResources().getDisplayMetrics().widthPixels -
(mTempRect.left + mTempRect.right),
MeasureSpec.EXACTLY);
break;
default:
childWidthSpec = MeasureSpec.makeMeasureSpec(mDropDownWidth, MeasureSpec.EXACTLY);
break;
}
final int listContent = mDropDownList.measureHeightOfChildrenCompat(childWidthSpec,
0, DropDownListView.NO_POSITION, maxHeight - otherHeights, -1);
// add padding only if the list has items in it, that way we don't show
// the popup if it is not needed
if (listContent > 0) otherHeights += padding;
return listContent + otherHeights;
} }
|
public class class_name {
public static boolean setField(Object obj, String prop, Object value) throws PageException {
Class clazz = value.getClass();
try {
Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop);
// exact comparsion
for (int i = 0; i < fields.length; i++) {
if (toReferenceClass(fields[i].getType()) == clazz) {
fields[i].set(obj, value);
return true;
}
}
// like comparsion
for (int i = 0; i < fields.length; i++) {
if (like(fields[i].getType(), clazz)) {
fields[i].set(obj, value);
return true;
}
}
// convert comparsion
for (int i = 0; i < fields.length; i++) {
try {
fields[i].set(obj, convert(value, toReferenceClass(fields[i].getType()), null));
return true;
}
catch (PageException e) {}
}
}
catch (Exception e) {
throw Caster.toPageException(e);
}
return false;
} }
|
public class class_name {
public static boolean setField(Object obj, String prop, Object value) throws PageException {
Class clazz = value.getClass();
try {
Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop);
// exact comparsion
for (int i = 0; i < fields.length; i++) {
if (toReferenceClass(fields[i].getType()) == clazz) {
fields[i].set(obj, value); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
// like comparsion
for (int i = 0; i < fields.length; i++) {
if (like(fields[i].getType(), clazz)) {
fields[i].set(obj, value); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
// convert comparsion
for (int i = 0; i < fields.length; i++) {
try {
fields[i].set(obj, convert(value, toReferenceClass(fields[i].getType()), null)); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
}
catch (PageException e) {} // depends on control dependency: [catch], data = [none]
}
}
catch (Exception e) {
throw Caster.toPageException(e);
}
return false;
} }
|
public class class_name {
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
justification = "Null checks in readResolve are valid since we deserialize and upgrade objects")
protected Object readResolve() {
if (allowEmptyArchive == null) {
this.allowEmptyArchive = SystemProperties.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty");
}
if (defaultExcludes == null){
defaultExcludes = true;
}
if (caseSensitive == null) {
caseSensitive = true;
}
return this;
} }
|
public class class_name {
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
justification = "Null checks in readResolve are valid since we deserialize and upgrade objects")
protected Object readResolve() {
if (allowEmptyArchive == null) {
this.allowEmptyArchive = SystemProperties.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty"); // depends on control dependency: [if], data = [none]
}
if (defaultExcludes == null){
defaultExcludes = true; // depends on control dependency: [if], data = [none]
}
if (caseSensitive == null) {
caseSensitive = true; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static MessageFormat pluralizeFormat(final String pattern, final String... choices)
{
double[] indexes = new double[choices.length];
for (int i = 0; i < choices.length; i++)
{
indexes[i] = i;
}
ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices);
MessageFormat format = (MessageFormat) messageFormat(pattern).clone();
format.setFormat(0, choiceForm);
return format;
} }
|
public class class_name {
public static MessageFormat pluralizeFormat(final String pattern, final String... choices)
{
double[] indexes = new double[choices.length];
for (int i = 0; i < choices.length; i++)
{
indexes[i] = i; // depends on control dependency: [for], data = [i]
}
ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices);
MessageFormat format = (MessageFormat) messageFormat(pattern).clone();
format.setFormat(0, choiceForm);
return format;
} }
|
public class class_name {
public String getFailureStackAsString() {
StringBuilder builder = new StringBuilder();
for (FailureStackElement failureStackElement : getFailureStack()) {
builder.append("\n\t");
builder.append(failureStackElement.getStackMessage());
}
return builder.toString();
} }
|
public class class_name {
public String getFailureStackAsString() {
StringBuilder builder = new StringBuilder();
for (FailureStackElement failureStackElement : getFailureStack()) {
builder.append("\n\t"); // depends on control dependency: [for], data = [none]
builder.append(failureStackElement.getStackMessage()); // depends on control dependency: [for], data = [failureStackElement]
}
return builder.toString();
} }
|
public class class_name {
public java.util.List<SnapshotCopyGrant> getSnapshotCopyGrants() {
if (snapshotCopyGrants == null) {
snapshotCopyGrants = new com.amazonaws.internal.SdkInternalList<SnapshotCopyGrant>();
}
return snapshotCopyGrants;
} }
|
public class class_name {
public java.util.List<SnapshotCopyGrant> getSnapshotCopyGrants() {
if (snapshotCopyGrants == null) {
snapshotCopyGrants = new com.amazonaws.internal.SdkInternalList<SnapshotCopyGrant>(); // depends on control dependency: [if], data = [none]
}
return snapshotCopyGrants;
} }
|
public class class_name {
public void marshall(WriteRequest writeRequest, ProtocolMarshaller protocolMarshaller) {
if (writeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(writeRequest.getPutRequest(), PUTREQUEST_BINDING);
protocolMarshaller.marshall(writeRequest.getDeleteRequest(), DELETEREQUEST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(WriteRequest writeRequest, ProtocolMarshaller protocolMarshaller) {
if (writeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(writeRequest.getPutRequest(), PUTREQUEST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(writeRequest.getDeleteRequest(), DELETEREQUEST_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 void parse(int msgStart, String source, ParsePosition pos,
Object[] args, Map<String, Object> argsMap) {
if (source == null) {
return;
}
String msgString=msgPattern.getPatternString();
int prevIndex=msgPattern.getPart(msgStart).getLimit();
int sourceOffset = pos.getIndex();
ParsePosition tempStatus = new ParsePosition(0);
for(int i=msgStart+1; ; ++i) {
Part part=msgPattern.getPart(i);
Part.Type type=part.getType();
int index=part.getIndex();
// Make sure the literal string matches.
int len = index - prevIndex;
if (len == 0 || msgString.regionMatches(prevIndex, source, sourceOffset, len)) {
sourceOffset += len;
prevIndex += len;
} else {
pos.setErrorIndex(sourceOffset);
return; // leave index as is to signal error
}
if(type==Part.Type.MSG_LIMIT) {
// Things went well! Done.
pos.setIndex(sourceOffset);
return;
}
if(type==Part.Type.SKIP_SYNTAX || type==Part.Type.INSERT_CHAR) {
prevIndex=part.getLimit();
continue;
}
// We do not support parsing Plural formats. (No REPLACE_NUMBER here.)
assert type==Part.Type.ARG_START : "Unexpected Part "+part+" in parsed message.";
int argLimit=msgPattern.getLimitPartIndex(i);
ArgType argType=part.getArgType();
part=msgPattern.getPart(++i);
// Compute the argId, so we can use it as a key.
Object argId=null;
int argNumber = 0;
String key = null;
if(args!=null) {
argNumber=part.getValue(); // ARG_NUMBER
argId = Integer.valueOf(argNumber);
} else {
if(part.getType()==MessagePattern.Part.Type.ARG_NAME) {
key=msgPattern.getSubstring(part);
} else /* ARG_NUMBER */ {
key=Integer.toString(part.getValue());
}
argId = key;
}
++i;
Format formatter = null;
boolean haveArgResult = false;
Object argResult = null;
if(cachedFormatters!=null && (formatter=cachedFormatters.get(i - 2))!=null) {
// Just parse using the formatter.
tempStatus.setIndex(sourceOffset);
argResult = formatter.parseObject(source, tempStatus);
if (tempStatus.getIndex() == sourceOffset) {
pos.setErrorIndex(sourceOffset);
return; // leave index as is to signal error
}
haveArgResult = true;
sourceOffset = tempStatus.getIndex();
} else if(
argType==ArgType.NONE ||
(cachedFormatters!=null && cachedFormatters.containsKey(i - 2))) {
// Match as a string.
// if at end, use longest possible match
// otherwise uses first match to intervening string
// does NOT recursively try all possibilities
String stringAfterArgument = getLiteralStringUntilNextArgument(argLimit);
int next;
if (stringAfterArgument.length() != 0) {
next = source.indexOf(stringAfterArgument, sourceOffset);
} else {
next = source.length();
}
if (next < 0) {
pos.setErrorIndex(sourceOffset);
return; // leave index as is to signal error
} else {
String strValue = source.substring(sourceOffset, next);
if (!strValue.equals("{" + argId.toString() + "}")) {
haveArgResult = true;
argResult = strValue;
}
sourceOffset = next;
}
} else if(argType==ArgType.CHOICE) {
tempStatus.setIndex(sourceOffset);
double choiceResult = parseChoiceArgument(msgPattern, i, source, tempStatus);
if (tempStatus.getIndex() == sourceOffset) {
pos.setErrorIndex(sourceOffset);
return; // leave index as is to signal error
}
argResult = choiceResult;
haveArgResult = true;
sourceOffset = tempStatus.getIndex();
} else if(argType.hasPluralStyle() || argType==ArgType.SELECT) {
// No can do!
throw new UnsupportedOperationException(
"Parsing of plural/select/selectordinal argument is not supported.");
} else {
// This should never happen.
throw new IllegalStateException("unexpected argType "+argType);
}
if (haveArgResult) {
if (args != null) {
args[argNumber] = argResult;
} else if (argsMap != null) {
argsMap.put(key, argResult);
}
}
prevIndex=msgPattern.getPart(argLimit).getLimit();
i=argLimit;
}
} }
|
public class class_name {
private void parse(int msgStart, String source, ParsePosition pos,
Object[] args, Map<String, Object> argsMap) {
if (source == null) {
return; // depends on control dependency: [if], data = [none]
}
String msgString=msgPattern.getPatternString();
int prevIndex=msgPattern.getPart(msgStart).getLimit();
int sourceOffset = pos.getIndex();
ParsePosition tempStatus = new ParsePosition(0);
for(int i=msgStart+1; ; ++i) {
Part part=msgPattern.getPart(i);
Part.Type type=part.getType();
int index=part.getIndex();
// Make sure the literal string matches.
int len = index - prevIndex;
if (len == 0 || msgString.regionMatches(prevIndex, source, sourceOffset, len)) {
sourceOffset += len; // depends on control dependency: [if], data = [none]
prevIndex += len; // depends on control dependency: [if], data = [none]
} else {
pos.setErrorIndex(sourceOffset); // depends on control dependency: [if], data = [none]
return; // leave index as is to signal error // depends on control dependency: [if], data = [none]
}
if(type==Part.Type.MSG_LIMIT) {
// Things went well! Done.
pos.setIndex(sourceOffset); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(type==Part.Type.SKIP_SYNTAX || type==Part.Type.INSERT_CHAR) {
prevIndex=part.getLimit(); // depends on control dependency: [if], data = [none]
continue;
}
// We do not support parsing Plural formats. (No REPLACE_NUMBER here.)
assert type==Part.Type.ARG_START : "Unexpected Part "+part+" in parsed message.";
int argLimit=msgPattern.getLimitPartIndex(i);
ArgType argType=part.getArgType();
part=msgPattern.getPart(++i); // depends on control dependency: [for], data = [i]
// Compute the argId, so we can use it as a key.
Object argId=null;
int argNumber = 0;
String key = null;
if(args!=null) {
argNumber=part.getValue(); // ARG_NUMBER // depends on control dependency: [if], data = [none]
argId = Integer.valueOf(argNumber); // depends on control dependency: [if], data = [none]
} else {
if(part.getType()==MessagePattern.Part.Type.ARG_NAME) {
key=msgPattern.getSubstring(part); // depends on control dependency: [if], data = [none]
} else /* ARG_NUMBER */ {
key=Integer.toString(part.getValue()); // depends on control dependency: [if], data = [none]
}
argId = key; // depends on control dependency: [if], data = [none]
}
++i; // depends on control dependency: [for], data = [i]
Format formatter = null;
boolean haveArgResult = false;
Object argResult = null;
if(cachedFormatters!=null && (formatter=cachedFormatters.get(i - 2))!=null) {
// Just parse using the formatter.
tempStatus.setIndex(sourceOffset); // depends on control dependency: [if], data = [none]
argResult = formatter.parseObject(source, tempStatus); // depends on control dependency: [if], data = [none]
if (tempStatus.getIndex() == sourceOffset) {
pos.setErrorIndex(sourceOffset); // depends on control dependency: [if], data = [sourceOffset)]
return; // leave index as is to signal error // depends on control dependency: [if], data = [none]
}
haveArgResult = true; // depends on control dependency: [if], data = [none]
sourceOffset = tempStatus.getIndex(); // depends on control dependency: [if], data = [none]
} else if(
argType==ArgType.NONE ||
(cachedFormatters!=null && cachedFormatters.containsKey(i - 2))) {
// Match as a string.
// if at end, use longest possible match
// otherwise uses first match to intervening string
// does NOT recursively try all possibilities
String stringAfterArgument = getLiteralStringUntilNextArgument(argLimit);
int next;
if (stringAfterArgument.length() != 0) {
next = source.indexOf(stringAfterArgument, sourceOffset); // depends on control dependency: [if], data = [none]
} else {
next = source.length(); // depends on control dependency: [if], data = [none]
}
if (next < 0) {
pos.setErrorIndex(sourceOffset); // depends on control dependency: [if], data = [none]
return; // leave index as is to signal error // depends on control dependency: [if], data = [none]
} else {
String strValue = source.substring(sourceOffset, next);
if (!strValue.equals("{" + argId.toString() + "}")) {
haveArgResult = true; // depends on control dependency: [if], data = [none]
argResult = strValue; // depends on control dependency: [if], data = [none]
}
sourceOffset = next; // depends on control dependency: [if], data = [none]
}
} else if(argType==ArgType.CHOICE) {
tempStatus.setIndex(sourceOffset); // depends on control dependency: [if], data = [none]
double choiceResult = parseChoiceArgument(msgPattern, i, source, tempStatus);
if (tempStatus.getIndex() == sourceOffset) {
pos.setErrorIndex(sourceOffset); // depends on control dependency: [if], data = [sourceOffset)]
return; // leave index as is to signal error // depends on control dependency: [if], data = [none]
}
argResult = choiceResult; // depends on control dependency: [if], data = [none]
haveArgResult = true; // depends on control dependency: [if], data = [none]
sourceOffset = tempStatus.getIndex(); // depends on control dependency: [if], data = [none]
} else if(argType.hasPluralStyle() || argType==ArgType.SELECT) {
// No can do!
throw new UnsupportedOperationException(
"Parsing of plural/select/selectordinal argument is not supported.");
} else {
// This should never happen.
throw new IllegalStateException("unexpected argType "+argType);
}
if (haveArgResult) {
if (args != null) {
args[argNumber] = argResult; // depends on control dependency: [if], data = [none]
} else if (argsMap != null) {
argsMap.put(key, argResult); // depends on control dependency: [if], data = [none]
}
}
prevIndex=msgPattern.getPart(argLimit).getLimit(); // depends on control dependency: [for], data = [none]
i=argLimit; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public JobTerminateOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} }
|
public class class_name {
public JobTerminateOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} }
|
public class class_name {
public final void transform(final IClassTransformer transformer,
final String inputDir,
final String outputDir,
final Iterator<String> classNames) {
if (null == transformer) {
return;
}
if (null == inputDir || inputDir.trim().isEmpty()) {
return;
}
if (null == classNames || !classNames.hasNext()) {
return;
}
final String inDirectory = inputDir.trim();
try {
final ClassPool classPool = configureClassPool(buildClassPool(), inDirectory);
final String outDirectory = evaluateOutputDirectory(outputDir, inDirectory);
int classCounter = 0;
while (classNames.hasNext()) {
final String className = classNames.next();
if (null == className) {
continue;
}
try {
LOGGER.debug("Got class name {}", className);
classPool.importPackage(className);
final CtClass candidateClass = classPool.get(className);
initializeClass(classPool, candidateClass);
if (!hasStamp(candidateClass) && transformer.shouldTransform(candidateClass)) {
transformer.applyTransformations(candidateClass);
applyStamp(candidateClass);
// #48
for (final CtClass nestedClass : candidateClass.getNestedClasses()) {
if (!nestedClass.isModified() || hasStamp(nestedClass)) {
continue;
}
final CtClass nestedCtClass = classPool.get(nestedClass.getName());
initializeClass(classPool, nestedCtClass);
applyStamp(nestedCtClass);
nestedCtClass.writeFile(outDirectory);
}
candidateClass.writeFile(outDirectory);
LOGGER.debug("Class {} instrumented by {}", className, getClass().getName());
++classCounter;
}
} catch (final NotFoundException e) {
LOGGER.warn("Class {} could not be resolved due to dependencies not found on "
+ "current classpath (usually your class depends on \"provided\""
+ " scoped dependencies).", className);
} catch (final IOException ex) { // EOFException ...
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
} catch (final CannotCompileException ex) {
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
} catch (final JavassistBuildException ex) {
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
}
}
LOGGER.info("#{} classes instrumented by {}", classCounter, getClass().getName());
} catch (final NotFoundException e) {
throw new RuntimeException(e.getMessage(), e);
}
} }
|
public class class_name {
public final void transform(final IClassTransformer transformer,
final String inputDir,
final String outputDir,
final Iterator<String> classNames) {
if (null == transformer) {
return; // depends on control dependency: [if], data = [none]
}
if (null == inputDir || inputDir.trim().isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
if (null == classNames || !classNames.hasNext()) {
return; // depends on control dependency: [if], data = [none]
}
final String inDirectory = inputDir.trim();
try {
final ClassPool classPool = configureClassPool(buildClassPool(), inDirectory);
final String outDirectory = evaluateOutputDirectory(outputDir, inDirectory);
int classCounter = 0;
while (classNames.hasNext()) {
final String className = classNames.next();
if (null == className) {
continue;
}
try {
LOGGER.debug("Got class name {}", className); // depends on control dependency: [try], data = [none]
classPool.importPackage(className); // depends on control dependency: [try], data = [none]
final CtClass candidateClass = classPool.get(className);
initializeClass(classPool, candidateClass); // depends on control dependency: [try], data = [none]
if (!hasStamp(candidateClass) && transformer.shouldTransform(candidateClass)) {
transformer.applyTransformations(candidateClass); // depends on control dependency: [if], data = [none]
applyStamp(candidateClass); // depends on control dependency: [if], data = [none]
// #48
for (final CtClass nestedClass : candidateClass.getNestedClasses()) {
if (!nestedClass.isModified() || hasStamp(nestedClass)) {
continue;
}
final CtClass nestedCtClass = classPool.get(nestedClass.getName());
initializeClass(classPool, nestedCtClass); // depends on control dependency: [for], data = [none]
applyStamp(nestedCtClass); // depends on control dependency: [for], data = [none]
nestedCtClass.writeFile(outDirectory); // depends on control dependency: [for], data = [none]
}
candidateClass.writeFile(outDirectory); // depends on control dependency: [if], data = [none]
LOGGER.debug("Class {} instrumented by {}", className, getClass().getName()); // depends on control dependency: [if], data = [none]
++classCounter; // depends on control dependency: [if], data = [none]
}
} catch (final NotFoundException e) {
LOGGER.warn("Class {} could not be resolved due to dependencies not found on "
+ "current classpath (usually your class depends on \"provided\""
+ " scoped dependencies).", className);
} catch (final IOException ex) { // EOFException ... // depends on control dependency: [catch], data = [none]
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
} catch (final CannotCompileException ex) { // depends on control dependency: [catch], data = [none]
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
} catch (final JavassistBuildException ex) { // depends on control dependency: [catch], data = [none]
LOGGER.error("Class {} could not be instrumented due to initialize FAILED.",
className,
ex);
} // depends on control dependency: [catch], data = [none]
}
LOGGER.info("#{} classes instrumented by {}", classCounter, getClass().getName()); // depends on control dependency: [try], data = [none]
} catch (final NotFoundException e) {
throw new RuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setCmsDefaultUsers(
String userAdmin,
String userGuest,
String userExport,
String userDeletedResource,
String groupAdministrators,
String groupUsers,
String groupGuests) {
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CHECKING_DEFAULT_USER_NAMES_0));
}
m_cmsDefaultUsers = new CmsDefaultUsers(
userAdmin,
userGuest,
userExport,
userDeletedResource,
groupAdministrators,
groupUsers,
groupGuests);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_ADMIN_USER_1, m_cmsDefaultUsers.getUserAdmin()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_GUEST_USER_1, m_cmsDefaultUsers.getUserGuest()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_USER_1, m_cmsDefaultUsers.getUserExport()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_DELETED_RESOURCE_USER_1,
m_cmsDefaultUsers.getUserDeletedResource()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_ADMIN_GROUP_1,
m_cmsDefaultUsers.getGroupAdministrators()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_USERS_GROUP_1, m_cmsDefaultUsers.getGroupUsers()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_GUESTS_GROUP_1, m_cmsDefaultUsers.getGroupGuests()));
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USER_NAMES_INITIALIZED_0));
}
} }
|
public class class_name {
public void setCmsDefaultUsers(
String userAdmin,
String userGuest,
String userExport,
String userDeletedResource,
String groupAdministrators,
String groupUsers,
String groupGuests) {
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_CHECKING_DEFAULT_USER_NAMES_0)); // depends on control dependency: [if], data = [none]
}
m_cmsDefaultUsers = new CmsDefaultUsers(
userAdmin,
userGuest,
userExport,
userDeletedResource,
groupAdministrators,
groupUsers,
groupGuests);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_ADMIN_USER_1, m_cmsDefaultUsers.getUserAdmin())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_GUEST_USER_1, m_cmsDefaultUsers.getUserGuest())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_USER_1, m_cmsDefaultUsers.getUserExport())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_DELETED_RESOURCE_USER_1,
m_cmsDefaultUsers.getUserDeletedResource())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_ADMIN_GROUP_1,
m_cmsDefaultUsers.getGroupAdministrators())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_USERS_GROUP_1, m_cmsDefaultUsers.getGroupUsers())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_GUESTS_GROUP_1, m_cmsDefaultUsers.getGroupGuests())); // depends on control dependency: [if], data = [none]
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_USER_NAMES_INITIALIZED_0)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public <P> void pojoDaoCreated(PojoDaoFactoryEvent<P> event) {
String tableName = event.getTableName();
Schema schema = new Schema();
event.getPojoBinding().describe(schema.createTable(tableName), schema);
schema.items().forEach(schemaItem -> {
final String key = schemaItem.getKey();
final String claimId = UUID.randomUUID().toString();
session.execute(insertStatement.bind(key, claimId));
Row row = session.execute(selectStatement.bind(key)).one();
if (StringUtils.equals(claimId, row.getString(0))) {
final SchemaStatement statement = schemaItem.createStatement();
LOGGER.info("Creating table(s) to support \"{}\":\n\t{}\n", event.getPojoBinding().getPojoType().getSimpleName(), statement);
session.execute(statement);
}
});
} }
|
public class class_name {
@Override
public <P> void pojoDaoCreated(PojoDaoFactoryEvent<P> event) {
String tableName = event.getTableName();
Schema schema = new Schema();
event.getPojoBinding().describe(schema.createTable(tableName), schema);
schema.items().forEach(schemaItem -> {
final String key = schemaItem.getKey();
final String claimId = UUID.randomUUID().toString();
session.execute(insertStatement.bind(key, claimId));
Row row = session.execute(selectStatement.bind(key)).one();
if (StringUtils.equals(claimId, row.getString(0))) {
final SchemaStatement statement = schemaItem.createStatement();
LOGGER.info("Creating table(s) to support \"{}\":\n\t{}\n", event.getPojoBinding().getPojoType().getSimpleName(), statement); // depends on control dependency: [if], data = [none]
session.execute(statement); // depends on control dependency: [if], data = [none]
}
});
} }
|
public class class_name {
public static Element getPositioningParent(Element child) {
Element parent = child.getParentElement();
while (parent != null) {
String parentPositioning = CmsDomUtil.getCurrentStyle(parent, Style.position);
if (Position.RELATIVE.getCssName().equals(parentPositioning)
|| Position.ABSOLUTE.getCssName().equals(parentPositioning)
|| Position.FIXED.getCssName().equals(parentPositioning)) {
return parent;
}
parent = parent.getParentElement();
}
return RootPanel.getBodyElement();
} }
|
public class class_name {
public static Element getPositioningParent(Element child) {
Element parent = child.getParentElement();
while (parent != null) {
String parentPositioning = CmsDomUtil.getCurrentStyle(parent, Style.position);
if (Position.RELATIVE.getCssName().equals(parentPositioning)
|| Position.ABSOLUTE.getCssName().equals(parentPositioning)
|| Position.FIXED.getCssName().equals(parentPositioning)) {
return parent; // depends on control dependency: [if], data = [none]
}
parent = parent.getParentElement(); // depends on control dependency: [while], data = [none]
}
return RootPanel.getBodyElement();
} }
|
public class class_name {
private boolean userSpecifiedPathVerificator(Map<Spec, SpecExecutor> specExecutorInstanceMap, FlowSpec flowSpec) {
Map<Spec, SpecExecutor> tmpSpecExecutorInstanceMap = new HashMap<>();
List<String> userSpecfiedPath = Arrays.asList(optionalUserSpecifiedPath.get().split(","));
for (int i = 0; i < userSpecfiedPath.size() - 1; i++) {
ServiceNode sourceNode = new BaseServiceNodeImpl(userSpecfiedPath.get(i));
ServiceNode targetNode = new BaseServiceNodeImpl(userSpecfiedPath.get(i + 1));
if (weightedGraph.containsVertex(sourceNode) && weightedGraph.containsVertex(targetNode)
&& weightedGraph.containsEdge(sourceNode, targetNode)) {
tmpSpecExecutorInstanceMap.put(convertHopToJobSpec(sourceNode, targetNode, flowSpec),
(((LoadBasedFlowEdgeImpl) weightedGraph.getEdge(sourceNode, targetNode)).getSpecExecutorInstance()));
} else {
log.error("User Specified Path is invalid");
return false;
}
}
specExecutorInstanceMap.putAll(tmpSpecExecutorInstanceMap);
return true;
} }
|
public class class_name {
private boolean userSpecifiedPathVerificator(Map<Spec, SpecExecutor> specExecutorInstanceMap, FlowSpec flowSpec) {
Map<Spec, SpecExecutor> tmpSpecExecutorInstanceMap = new HashMap<>();
List<String> userSpecfiedPath = Arrays.asList(optionalUserSpecifiedPath.get().split(","));
for (int i = 0; i < userSpecfiedPath.size() - 1; i++) {
ServiceNode sourceNode = new BaseServiceNodeImpl(userSpecfiedPath.get(i));
ServiceNode targetNode = new BaseServiceNodeImpl(userSpecfiedPath.get(i + 1));
if (weightedGraph.containsVertex(sourceNode) && weightedGraph.containsVertex(targetNode)
&& weightedGraph.containsEdge(sourceNode, targetNode)) {
tmpSpecExecutorInstanceMap.put(convertHopToJobSpec(sourceNode, targetNode, flowSpec),
(((LoadBasedFlowEdgeImpl) weightedGraph.getEdge(sourceNode, targetNode)).getSpecExecutorInstance())); // depends on control dependency: [if], data = [none]
} else {
log.error("User Specified Path is invalid"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
specExecutorInstanceMap.putAll(tmpSpecExecutorInstanceMap);
return true;
} }
|
public class class_name {
public static void initialize()
{
if (InfinispanCache.get().exists(Association.IDCACHE)) {
InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE).clear();
} else {
InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE)
.addListener(new CacheLogListener(Association.LOG));
}
} }
|
public class class_name {
public static void initialize()
{
if (InfinispanCache.get().exists(Association.IDCACHE)) {
InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE).clear(); // depends on control dependency: [if], data = [none]
} else {
InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE)
.addListener(new CacheLogListener(Association.LOG)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
SingleProofreadingError[] getMatches(int numberOfParagraph, int startOfSentencePosition) {
for (CacheEntry anEntry : entries) {
if (anEntry.numberOfParagraph == numberOfParagraph && anEntry.startOfSentencePosition == startOfSentencePosition) {
return anEntry.errorArray;
}
}
return null;
} }
|
public class class_name {
SingleProofreadingError[] getMatches(int numberOfParagraph, int startOfSentencePosition) {
for (CacheEntry anEntry : entries) {
if (anEntry.numberOfParagraph == numberOfParagraph && anEntry.startOfSentencePosition == startOfSentencePosition) {
return anEntry.errorArray; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public Optional<MethodCall<Object>> getMethodCall() {
final Request<Object> request = requestThreadLocal.get();
if (request instanceof MethodCall) {
return Optional.of(((MethodCall<Object>) request));
}
return Optional.empty();
} }
|
public class class_name {
public Optional<MethodCall<Object>> getMethodCall() {
final Request<Object> request = requestThreadLocal.get();
if (request instanceof MethodCall) {
return Optional.of(((MethodCall<Object>) request)); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} }
|
public class class_name {
public void traverseMethod(String methodID) {
MethodReferenceNode node = (MethodReferenceNode) elementReferenceMap.get(methodID);
if (node == null) {
//TODO(malvania): This might never be reached, because we create a node for every method,
// both invoked and declared.
ErrorUtil.warning("Encountered .class method while accessing: " + methodID);
return;
}
if (node.reachable) {
return;
}
node.reachable = true;
markParentClasses(ElementUtil.getDeclaringClass(node.methodElement));
for (String invokedMethodID : node.invokedMethods) {
traverseMethod(invokedMethodID);
}
for (String overrideMethodID : node.overridingMethods) {
traverseMethod(overrideMethodID);
}
} }
|
public class class_name {
public void traverseMethod(String methodID) {
MethodReferenceNode node = (MethodReferenceNode) elementReferenceMap.get(methodID);
if (node == null) {
//TODO(malvania): This might never be reached, because we create a node for every method,
// both invoked and declared.
ErrorUtil.warning("Encountered .class method while accessing: " + methodID); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (node.reachable) {
return; // depends on control dependency: [if], data = [none]
}
node.reachable = true;
markParentClasses(ElementUtil.getDeclaringClass(node.methodElement));
for (String invokedMethodID : node.invokedMethods) {
traverseMethod(invokedMethodID); // depends on control dependency: [for], data = [invokedMethodID]
}
for (String overrideMethodID : node.overridingMethods) {
traverseMethod(overrideMethodID); // depends on control dependency: [for], data = [overrideMethodID]
}
} }
|
public class class_name {
@Override
public void start(final Infrastructure infra) {
try {
final OutputQuartzHelper outputQuartzHelper = new OutputQuartzHelper();
final JobDetail jobDetail = outputQuartzHelper.getJobDetail(outputInvoker);
final Trigger trigger = outputQuartzHelper.getCronTrigger(cronExpression);
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.scheduleJob(jobDetail, trigger);
scheduler.start();
} catch (final SchedulerException se) {
LOGGER.error("Error occurred while starting the cron scheduler : " + se.getMessage(), se);
}
} }
|
public class class_name {
@Override
public void start(final Infrastructure infra) {
try {
final OutputQuartzHelper outputQuartzHelper = new OutputQuartzHelper();
final JobDetail jobDetail = outputQuartzHelper.getJobDetail(outputInvoker);
final Trigger trigger = outputQuartzHelper.getCronTrigger(cronExpression);
scheduler = StdSchedulerFactory.getDefaultScheduler(); // depends on control dependency: [try], data = [none]
scheduler.scheduleJob(jobDetail, trigger); // depends on control dependency: [try], data = [none]
scheduler.start(); // depends on control dependency: [try], data = [none]
} catch (final SchedulerException se) {
LOGGER.error("Error occurred while starting the cron scheduler : " + se.getMessage(), se);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<Stepdoc> stepdocs(List<CandidateSteps> candidateSteps) {
List<Stepdoc> stepdocs = new LinkedList<>();
for (StepCandidate candidate : collectCandidates(candidateSteps)) {
stepdocs.add(new Stepdoc(candidate));
}
return stepdocs;
} }
|
public class class_name {
public List<Stepdoc> stepdocs(List<CandidateSteps> candidateSteps) {
List<Stepdoc> stepdocs = new LinkedList<>();
for (StepCandidate candidate : collectCandidates(candidateSteps)) {
stepdocs.add(new Stepdoc(candidate)); // depends on control dependency: [for], data = [candidate]
}
return stepdocs;
} }
|
public class class_name {
@Override
public synchronized Integer next() {
if (availablePorts.isEmpty()) {
return null;
}
Collections.sort(availablePorts);
Integer port = availablePorts.get(0);
portsInUse.add(port);
availablePorts.remove(port);
return port;
} }
|
public class class_name {
@Override
public synchronized Integer next() {
if (availablePorts.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
Collections.sort(availablePorts);
Integer port = availablePorts.get(0);
portsInUse.add(port);
availablePorts.remove(port);
return port;
} }
|
public class class_name {
private void logPlaces(final List<PlaceInfo> places) {
if (logger.isDebugEnabled()) {
for (final PlaceInfo place : places) {
this.logger.debug(place);
}
}
} }
|
public class class_name {
private void logPlaces(final List<PlaceInfo> places) {
if (logger.isDebugEnabled()) {
for (final PlaceInfo place : places) {
this.logger.debug(place); // depends on control dependency: [for], data = [place]
}
}
} }
|
public class class_name {
public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this
bis.close(); // close out after reading
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
}
} }
|
public class class_name {
public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this // depends on control dependency: [try], data = [none]
bis.close(); // close out after reading // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
String8 getPathLeaf() {
final int cp;
final String buf = mString.toString();
cp = buf.lastIndexOf('/');
if (cp == -1) {
return new String8(this);
} else {
return new String8(buf.substring(cp + 1));
}
} }
|
public class class_name {
String8 getPathLeaf() {
final int cp;
final String buf = mString.toString();
cp = buf.lastIndexOf('/');
if (cp == -1) {
return new String8(this); // depends on control dependency: [if], data = [none]
} else {
return new String8(buf.substring(cp + 1)); // depends on control dependency: [if], data = [(cp]
}
} }
|
public class class_name {
public String getNamespaceFromURI(String uri) {
String breakChar = "/";
if (uri.contains("#")) {
breakChar = "#";
} else {
if (uri.substring(6).contains(":")) {
breakChar = ":";
}
}
int pos = Math.min(uri.lastIndexOf(breakChar), uri.length());
return uri.substring(0, pos + 1);
} }
|
public class class_name {
public String getNamespaceFromURI(String uri) {
String breakChar = "/";
if (uri.contains("#")) {
breakChar = "#"; // depends on control dependency: [if], data = [none]
} else {
if (uri.substring(6).contains(":")) {
breakChar = ":"; // depends on control dependency: [if], data = [none]
}
}
int pos = Math.min(uri.lastIndexOf(breakChar), uri.length());
return uri.substring(0, pos + 1);
} }
|
public class class_name {
public static Integer getAsInteger(Object value) {
Integer result = null;
try {
if (value instanceof String) {
result = Integer.valueOf((String) value);
} else if (value instanceof Number) {
result = ((Number) value).intValue();
} else {
result = null;
}
} catch (Exception e) {
result = null;
}
return result == null ? 0 : result;
} }
|
public class class_name {
public static Integer getAsInteger(Object value) {
Integer result = null;
try {
if (value instanceof String) {
result = Integer.valueOf((String) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
result = ((Number) value).intValue(); // depends on control dependency: [if], data = [none]
} else {
result = null; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
result = null;
} // depends on control dependency: [catch], data = [none]
return result == null ? 0 : result;
} }
|
public class class_name {
public String getAlbum(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getAlbum();
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.ALBUM);
}
return null;
} }
|
public class class_name {
public String getAlbum(int type)
{
if (allow(type&ID3V1))
{
return id3v1.getAlbum(); // depends on control dependency: [if], data = [none]
}
if (allow(type&ID3V2))
{
return id3v2.getFrameDataString(ID3v2Frames.ALBUM); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void show() {
StringBuffer out = new StringBuffer();
for (Iterator iter = repeater.getBeanList().iterator(); iter.hasNext();) {
MyData data = (MyData) iter.next();
out.append(data.getName()).append(" : ").append(data.getCount()).append('\n');
}
selectorText.setText(out.toString());
} }
|
public class class_name {
public void show() {
StringBuffer out = new StringBuffer();
for (Iterator iter = repeater.getBeanList().iterator(); iter.hasNext();) {
MyData data = (MyData) iter.next();
out.append(data.getName()).append(" : ").append(data.getCount()).append('\n'); // depends on control dependency: [for], data = [none]
}
selectorText.setText(out.toString());
} }
|
public class class_name {
public Property getProperty(String key, int semantic, int index) {
for (Property property : m_properties) {
if (property.getKey().equals(key) &&
property.m_semantic == semantic &&
property.m_index == index) {
return property;
}
}
return null;
} }
|
public class class_name {
public Property getProperty(String key, int semantic, int index) {
for (Property property : m_properties) {
if (property.getKey().equals(key) &&
property.m_semantic == semantic &&
property.m_index == index) {
return property; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public void setEnableListeners(boolean[] rgbEnabled)
{
int iIndex = 0;
FieldListener fieldBehavior = this.getListener();
while (fieldBehavior != null)
{
boolean bEnable = true;
if ((rgbEnabled != null) && (iIndex < rgbEnabled.length))
bEnable = rgbEnabled[iIndex];
fieldBehavior.setEnabledListener(bEnable);
fieldBehavior = (FieldListener)fieldBehavior.getNextListener();
iIndex++;
}
} }
|
public class class_name {
public void setEnableListeners(boolean[] rgbEnabled)
{
int iIndex = 0;
FieldListener fieldBehavior = this.getListener();
while (fieldBehavior != null)
{
boolean bEnable = true;
if ((rgbEnabled != null) && (iIndex < rgbEnabled.length))
bEnable = rgbEnabled[iIndex];
fieldBehavior.setEnabledListener(bEnable); // depends on control dependency: [while], data = [none]
fieldBehavior = (FieldListener)fieldBehavior.getNextListener(); // depends on control dependency: [while], data = [none]
iIndex++; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public void marshall(ChannelSummary channelSummary, ProtocolMarshaller protocolMarshaller) {
if (channelSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(channelSummary.getArn(), ARN_BINDING);
protocolMarshaller.marshall(channelSummary.getChannelClass(), CHANNELCLASS_BINDING);
protocolMarshaller.marshall(channelSummary.getDestinations(), DESTINATIONS_BINDING);
protocolMarshaller.marshall(channelSummary.getEgressEndpoints(), EGRESSENDPOINTS_BINDING);
protocolMarshaller.marshall(channelSummary.getId(), ID_BINDING);
protocolMarshaller.marshall(channelSummary.getInputAttachments(), INPUTATTACHMENTS_BINDING);
protocolMarshaller.marshall(channelSummary.getInputSpecification(), INPUTSPECIFICATION_BINDING);
protocolMarshaller.marshall(channelSummary.getLogLevel(), LOGLEVEL_BINDING);
protocolMarshaller.marshall(channelSummary.getName(), NAME_BINDING);
protocolMarshaller.marshall(channelSummary.getPipelinesRunningCount(), PIPELINESRUNNINGCOUNT_BINDING);
protocolMarshaller.marshall(channelSummary.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(channelSummary.getState(), STATE_BINDING);
protocolMarshaller.marshall(channelSummary.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ChannelSummary channelSummary, ProtocolMarshaller protocolMarshaller) {
if (channelSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(channelSummary.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getChannelClass(), CHANNELCLASS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getDestinations(), DESTINATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getEgressEndpoints(), EGRESSENDPOINTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getInputAttachments(), INPUTATTACHMENTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getInputSpecification(), INPUTSPECIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getLogLevel(), LOGLEVEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getPipelinesRunningCount(), PIPELINESRUNNINGCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(channelSummary.getTags(), TAGS_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 boolean hasInterface(String intf, String cls) {
String key;
key = intf + "-" + cls;
if (m_CheckInterface.containsKey(key))
return m_CheckInterface.get(key);
try {
return hasInterface(Class.forName(intf), Class.forName(cls));
}
catch (Throwable t) {
return false;
}
} }
|
public class class_name {
public static boolean hasInterface(String intf, String cls) {
String key;
key = intf + "-" + cls;
if (m_CheckInterface.containsKey(key))
return m_CheckInterface.get(key);
try {
return hasInterface(Class.forName(intf), Class.forName(cls)); // depends on control dependency: [try], data = [none]
}
catch (Throwable t) {
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public synchronized void remove( Entry entry )
{
List<Entry> entries;
if ( entry == null )
{
return;
}
DirectoryEntry parent = entry.getParent();
if ( parent == null )
{
return;
}
else
{
entries = contents.get( parent );
if ( entries == null )
{
return;
}
}
for ( Iterator<Entry> i = entries.iterator(); i.hasNext(); )
{
Entry e = (Entry) i.next();
if ( entry.equals( e ) )
{
if ( e instanceof DirectoryEntry )
{
Entry[] children = listEntries( (DirectoryEntry) e );
for ( int j = children.length - 1; j >= 0; j-- )
{
remove( children[j] );
}
contents.remove( e );
}
i.remove();
return;
}
}
} }
|
public class class_name {
public synchronized void remove( Entry entry )
{
List<Entry> entries;
if ( entry == null )
{
return; // depends on control dependency: [if], data = [none]
}
DirectoryEntry parent = entry.getParent();
if ( parent == null )
{
return; // depends on control dependency: [if], data = [none]
}
else
{
entries = contents.get( parent ); // depends on control dependency: [if], data = [( parent]
if ( entries == null )
{
return; // depends on control dependency: [if], data = [none]
}
}
for ( Iterator<Entry> i = entries.iterator(); i.hasNext(); )
{
Entry e = (Entry) i.next();
if ( entry.equals( e ) )
{
if ( e instanceof DirectoryEntry )
{
Entry[] children = listEntries( (DirectoryEntry) e );
for ( int j = children.length - 1; j >= 0; j-- )
{
remove( children[j] ); // depends on control dependency: [for], data = [j]
}
contents.remove( e ); // depends on control dependency: [if], data = [none]
}
i.remove(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public Object getBooleanValue(final Boolean _value)
{
Integer ret = 0;
if (_value) {
ret = 1;
}
return ret;
} }
|
public class class_name {
@Override
public Object getBooleanValue(final Boolean _value)
{
Integer ret = 0;
if (_value) {
ret = 1; // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
public boolean addAll(Collection<? extends T> c)
{
if (c instanceof Sizeable)
{
sizeOf += ((Sizeable) c).sizeof();
}
return super.addAll(c);
} }
|
public class class_name {
public boolean addAll(Collection<? extends T> c)
{
if (c instanceof Sizeable)
{
sizeOf += ((Sizeable) c).sizeof(); // depends on control dependency: [if], data = [none]
}
return super.addAll(c);
} }
|
public class class_name {
public Object get(String key) {
try {
return getString(key, null);
} catch (ClassCastException e) {
try {
return getInt(key, 0);
} catch (ClassCastException e1) {
try {
return getLong(key, 0);
} catch (ClassCastException e2) {
try {
return getFloat(key, 0f);
} catch (ClassCastException e3) {
try {
return getBoolean(key, false);
} catch (Exception e4) {
e.printStackTrace();
}
}
}
}
}
return null;
} }
|
public class class_name {
public Object get(String key) {
try {
return getString(key, null); // depends on control dependency: [try], data = [none]
} catch (ClassCastException e) {
try {
return getInt(key, 0); // depends on control dependency: [try], data = [none]
} catch (ClassCastException e1) {
try {
return getLong(key, 0); // depends on control dependency: [try], data = [none]
} catch (ClassCastException e2) {
try {
return getFloat(key, 0f); // depends on control dependency: [try], data = [none]
} catch (ClassCastException e3) {
try {
return getBoolean(key, false); // depends on control dependency: [try], data = [none]
} catch (Exception e4) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
private void visit(Condition condition, Visitor<Condition> visitor)
{
visitor.visit(condition);
if (condition instanceof CompositeCondition) {
if (((CompositeCondition) condition).getConditions() != null) {
for (Condition child : ((CompositeCondition) condition).getConditions()) {
visit(child, visitor);
}
}
}
} }
|
public class class_name {
private void visit(Condition condition, Visitor<Condition> visitor)
{
visitor.visit(condition);
if (condition instanceof CompositeCondition) {
if (((CompositeCondition) condition).getConditions() != null) {
for (Condition child : ((CompositeCondition) condition).getConditions()) {
visit(child, visitor); // depends on control dependency: [for], data = [child]
}
}
}
} }
|
public class class_name {
int flipTriangle(int i, long[] flipped) {
final Triangle cur = tris.get(i);
// Test edge AB:
if(cur.ab >= 0) {
final int ot = cur.ab;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_AB_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_AB_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_AB_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned?");
}
if(cur.inCircle(points.get(opp))) {
// Replace edge AB, connect c with "opp" instead.
final int a = cur.c, b = cur.a, c = opp, d = cur.b;
final int ab = cur.ca, bc = lef, cd = rig, da = cur.bc;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca);
cur.updateCircumcircle(points);
// Update other:
oth.set(c, cd, d, da, a, ac);
oth.updateCircumcircle(points);
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i);
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot);
}
BitsUtil.setI(flipped, i);
BitsUtil.setI(flipped, ot);
return ot;
}
}
// Test edge BC:
if(cur.bc >= 0) {
final int ot = cur.bc;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_BC_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_BC_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_BC_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned? " + orient);
}
if(cur.inCircle(points.get(opp))) {
// Replace edge BC, connect A with "opp" instead.
final int a = cur.a, b = cur.b, c = opp, d = cur.c;
final int ab = cur.ab, bc = lef, cd = rig, da = cur.ca;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca);
cur.updateCircumcircle(points);
// Update other:
oth.set(c, cd, d, da, a, ac);
oth.updateCircumcircle(points);
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i);
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot);
}
BitsUtil.setI(flipped, i);
BitsUtil.setI(flipped, ot);
return ot;
}
}
// Test edge CA:
if(cur.ca >= 0) {
final int ot = cur.ca;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_CA_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_CA_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_CA_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned?");
}
if(cur.inCircle(points.get(opp))) {
// Replace edge CA, connect B with "opp" instead.
final int a = cur.b, b = cur.c, c = opp, d = cur.a;
final int ab = cur.bc, bc = lef, cd = rig, da = cur.ab;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca);
cur.updateCircumcircle(points);
// Update other:
oth.set(c, cd, d, da, a, ac);
oth.updateCircumcircle(points);
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i);
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot);
}
BitsUtil.setI(flipped, i);
BitsUtil.setI(flipped, ot);
return ot;
}
}
return -1;
} }
|
public class class_name {
int flipTriangle(int i, long[] flipped) {
final Triangle cur = tris.get(i);
// Test edge AB:
if(cur.ab >= 0) {
final int ot = cur.ab;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_AB_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_AB_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_AB_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned?");
}
if(cur.inCircle(points.get(opp))) {
// Replace edge AB, connect c with "opp" instead.
final int a = cur.c, b = cur.a, c = opp, d = cur.b;
final int ab = cur.ca, bc = lef, cd = rig, da = cur.bc;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca); // depends on control dependency: [if], data = [none]
cur.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update other:
oth.set(c, cd, d, da, a, ac); // depends on control dependency: [if], data = [none]
oth.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i); // depends on control dependency: [if], data = [(bc]
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot); // depends on control dependency: [if], data = [(da]
}
BitsUtil.setI(flipped, i); // depends on control dependency: [if], data = [none]
BitsUtil.setI(flipped, ot); // depends on control dependency: [if], data = [none]
return ot; // depends on control dependency: [if], data = [none]
}
}
// Test edge BC:
if(cur.bc >= 0) {
final int ot = cur.bc;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_BC_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_BC_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_BC_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned? " + orient);
}
if(cur.inCircle(points.get(opp))) {
// Replace edge BC, connect A with "opp" instead.
final int a = cur.a, b = cur.b, c = opp, d = cur.c;
final int ab = cur.ab, bc = lef, cd = rig, da = cur.ca;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca); // depends on control dependency: [if], data = [none]
cur.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update other:
oth.set(c, cd, d, da, a, ac); // depends on control dependency: [if], data = [none]
oth.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i); // depends on control dependency: [if], data = [(bc]
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot); // depends on control dependency: [if], data = [(da]
}
BitsUtil.setI(flipped, i); // depends on control dependency: [if], data = [none]
BitsUtil.setI(flipped, ot); // depends on control dependency: [if], data = [none]
return ot; // depends on control dependency: [if], data = [none]
}
}
// Test edge CA:
if(cur.ca >= 0) {
final int ot = cur.ca;
Triangle oth = tris.get(ot);
Orientation orient = cur.findOrientation(oth);
final int opp, lef, rig;
switch(orient){
case ORIENT_CA_BA:
opp = oth.c;
lef = oth.bc;
rig = oth.ca;
break;
case ORIENT_CA_CB:
opp = oth.a;
lef = oth.ca;
rig = oth.ab;
break;
case ORIENT_CA_AC:
opp = oth.b;
lef = oth.ab;
rig = oth.bc;
break;
default:
throw new RuntimeException("Neighbor triangles not aligned?");
}
if(cur.inCircle(points.get(opp))) {
// Replace edge CA, connect B with "opp" instead.
final int a = cur.b, b = cur.c, c = opp, d = cur.a;
final int ab = cur.bc, bc = lef, cd = rig, da = cur.ab;
final int ca = ot, ac = i;
// Update current:
cur.set(a, ab, b, bc, c, ca); // depends on control dependency: [if], data = [none]
cur.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update other:
oth.set(c, cd, d, da, a, ac); // depends on control dependency: [if], data = [none]
oth.updateCircumcircle(points); // depends on control dependency: [if], data = [none]
// Update tri touching on BC and DA:
if(bc >= 0) {
tris.get(bc).replaceEdge(c, b, ot, i); // depends on control dependency: [if], data = [(bc]
}
if(da >= 0) {
tris.get(da).replaceEdge(a, d, i, ot); // depends on control dependency: [if], data = [(da]
}
BitsUtil.setI(flipped, i); // depends on control dependency: [if], data = [none]
BitsUtil.setI(flipped, ot); // depends on control dependency: [if], data = [none]
return ot; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
public static byte max(byte... array) {
checkArgument(array.length > 0);
int max = toInt(array[0]);
for (int i = 1; i < array.length; i++) {
int next = toInt(array[i]);
if (next > max) {
max = next;
}
}
return (byte) max;
} }
|
public class class_name {
public static byte max(byte... array) {
checkArgument(array.length > 0);
int max = toInt(array[0]);
for (int i = 1; i < array.length; i++) {
int next = toInt(array[i]);
if (next > max) {
max = next; // depends on control dependency: [if], data = [none]
}
}
return (byte) max;
} }
|
public class class_name {
private static String[] harvestApplicationWithArguments(String arg)
{
List<String> args = new ArrayList<>();
if (arg.trim().length() >= 0)
{
String appl = "", data = "";
/* Find the first occurrence of either '(' or ',' */
int firstc = arg.indexOf(',');
int firstp = arg.indexOf('(');
if (firstc != -1 && (firstp == -1 || firstc < firstp))
{
/* comma found, no parenthesis */
/* or both found, but comma found first */
String[] split = arg.split(",");
appl = split[0];
for (int i = 1; i < split.length; i++)
data += split[i] + (i + 1 < split.length ? "," : "");
}
else if (firstc == -1 && firstp == -1)
{
/* Neither found */
data = "";
}
else
{
/* Final remaining case is parenthesis found first */
String[] split = arg.split("\\(");
appl = split[0];
for (int i = 1; i < split.length; i++)
data += split[i] + (i + 1 < split.length ? "(" : "");
int end = data.lastIndexOf(')');
if (end == -1)
{
// ast_log(LOG_WARNING, "No closing parenthesis found?
// '%s(%s'\n", appl, data);
}
else if (end == data.length() - 1)
{
data = data.substring(0, end);
}
data = processQuotesAndSlashes(data, ',', '|');
}
if (!appl.trim().equals(""))
{
args.add(appl.trim());
if (!data.trim().equals(""))
{
String[] dataSplit = data.split("\\|");
for (String aDataSplit : dataSplit)
{
args.add(aDataSplit.trim());
}
}
}
}
return args.toArray(new String[args.size()]);
} }
|
public class class_name {
private static String[] harvestApplicationWithArguments(String arg)
{
List<String> args = new ArrayList<>();
if (arg.trim().length() >= 0)
{
String appl = "", data = "";
/* Find the first occurrence of either '(' or ',' */
int firstc = arg.indexOf(',');
int firstp = arg.indexOf('(');
if (firstc != -1 && (firstp == -1 || firstc < firstp))
{
/* comma found, no parenthesis */
/* or both found, but comma found first */
String[] split = arg.split(",");
appl = split[0]; // depends on control dependency: [if], data = [none]
for (int i = 1; i < split.length; i++)
data += split[i] + (i + 1 < split.length ? "," : "");
}
else if (firstc == -1 && firstp == -1)
{
/* Neither found */
data = ""; // depends on control dependency: [if], data = [none]
}
else
{
/* Final remaining case is parenthesis found first */
String[] split = arg.split("\\(");
appl = split[0]; // depends on control dependency: [if], data = [none]
for (int i = 1; i < split.length; i++)
data += split[i] + (i + 1 < split.length ? "(" : "");
int end = data.lastIndexOf(')');
if (end == -1)
{
// ast_log(LOG_WARNING, "No closing parenthesis found?
// '%s(%s'\n", appl, data);
}
else if (end == data.length() - 1)
{
data = data.substring(0, end); // depends on control dependency: [if], data = [none]
}
data = processQuotesAndSlashes(data, ',', '|'); // depends on control dependency: [if], data = [none]
}
if (!appl.trim().equals(""))
{
args.add(appl.trim()); // depends on control dependency: [if], data = [none]
if (!data.trim().equals(""))
{
String[] dataSplit = data.split("\\|");
for (String aDataSplit : dataSplit)
{
args.add(aDataSplit.trim()); // depends on control dependency: [for], data = [aDataSplit]
}
}
}
}
return args.toArray(new String[args.size()]);
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.