code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static Set<PosixFilePermission> convertToPermissionsSet(final int aMode) {
final Set<PosixFilePermission> result = EnumSet.noneOf(PosixFilePermission.class);
if (isSet(aMode, 0400)) {
result.add(PosixFilePermission.OWNER_READ);
}
if (isSet(aMode, 0200)) {
result.add(PosixFilePermission.OWNER_WRITE);
}
if (isSet(aMode, 0100)) {
result.add(PosixFilePermission.OWNER_EXECUTE);
}
if (isSet(aMode, 040)) {
result.add(PosixFilePermission.GROUP_READ);
}
if (isSet(aMode, 020)) {
result.add(PosixFilePermission.GROUP_WRITE);
}
if (isSet(aMode, 010)) {
result.add(PosixFilePermission.GROUP_EXECUTE);
}
if (isSet(aMode, 04)) {
result.add(PosixFilePermission.OTHERS_READ);
}
if (isSet(aMode, 02)) {
result.add(PosixFilePermission.OTHERS_WRITE);
}
if (isSet(aMode, 01)) {
result.add(PosixFilePermission.OTHERS_EXECUTE);
}
return result;
} } | public class class_name {
public static Set<PosixFilePermission> convertToPermissionsSet(final int aMode) {
final Set<PosixFilePermission> result = EnumSet.noneOf(PosixFilePermission.class);
if (isSet(aMode, 0400)) {
result.add(PosixFilePermission.OWNER_READ); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 0200)) {
result.add(PosixFilePermission.OWNER_WRITE); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 0100)) {
result.add(PosixFilePermission.OWNER_EXECUTE); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 040)) {
result.add(PosixFilePermission.GROUP_READ); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 020)) {
result.add(PosixFilePermission.GROUP_WRITE); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 010)) {
result.add(PosixFilePermission.GROUP_EXECUTE); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 04)) {
result.add(PosixFilePermission.OTHERS_READ); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 02)) {
result.add(PosixFilePermission.OTHERS_WRITE); // depends on control dependency: [if], data = [none]
}
if (isSet(aMode, 01)) {
result.add(PosixFilePermission.OTHERS_EXECUTE); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
String activeProfile = System.getProperty("spring.profiles.active");
if (SpringProfiles.OSGI.equalsIgnoreCase(activeProfile)) {
LOGGER.info("Running in OSGI environment");
} else if (SpringProfiles.NON_OSGI.equalsIgnoreCase(activeProfile)) {
LOGGER.info("Running in a non OSGI environment");
} else {
applicationContext.getEnvironment().setActiveProfiles(SpringProfiles.NON_OSGI);
applicationContext.refresh();
LOGGER.info("Switched to a non OSGI environment");
}
} } | public class class_name {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
String activeProfile = System.getProperty("spring.profiles.active");
if (SpringProfiles.OSGI.equalsIgnoreCase(activeProfile)) {
LOGGER.info("Running in OSGI environment"); // depends on control dependency: [if], data = [none]
} else if (SpringProfiles.NON_OSGI.equalsIgnoreCase(activeProfile)) {
LOGGER.info("Running in a non OSGI environment"); // depends on control dependency: [if], data = [none]
} else {
applicationContext.getEnvironment().setActiveProfiles(SpringProfiles.NON_OSGI); // depends on control dependency: [if], data = [none]
applicationContext.refresh(); // depends on control dependency: [if], data = [none]
LOGGER.info("Switched to a non OSGI environment"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean checkArrivedY(double extrp, double sy, double dy)
{
final double y = transformable.getY();
if (sy < 0 && y <= dy || sy >= 0 && y >= dy)
{
transformable.moveLocation(extrp, 0, dy - y);
return true;
}
return false;
} } | public class class_name {
private boolean checkArrivedY(double extrp, double sy, double dy)
{
final double y = transformable.getY();
if (sy < 0 && y <= dy || sy >= 0 && y >= dy)
{
transformable.moveLocation(extrp, 0, dy - y); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static void setLocal(String time) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Date result = null;
try {
result = sdf.parse(time);
}
catch (ParseException pex) {
throw new RuntimeException("Time is not parseable (" + time + ")", pex);
}
setClock(Clock.fixed(result.toInstant(), ZoneId.systemDefault()));
} } | public class class_name {
public static void setLocal(String time) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
Date result = null;
try {
result = sdf.parse(time); // depends on control dependency: [try], data = [none]
}
catch (ParseException pex) {
throw new RuntimeException("Time is not parseable (" + time + ")", pex);
} // depends on control dependency: [catch], data = [none]
setClock(Clock.fixed(result.toInstant(), ZoneId.systemDefault()));
} } |
public class class_name {
public void isInvalid() {
ValidationResult validateResult = validate();
if (validateResult.isValid()) {
throwAssertionError(shouldBeInvalid(actual.getSystemId()));
}
} } | public class class_name {
public void isInvalid() {
ValidationResult validateResult = validate();
if (validateResult.isValid()) {
throwAssertionError(shouldBeInvalid(actual.getSystemId())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Warning withPages(Integer... pages) {
if (this.pages == null) {
setPages(new java.util.ArrayList<Integer>(pages.length));
}
for (Integer ele : pages) {
this.pages.add(ele);
}
return this;
} } | public class class_name {
public Warning withPages(Integer... pages) {
if (this.pages == null) {
setPages(new java.util.ArrayList<Integer>(pages.length)); // depends on control dependency: [if], data = [none]
}
for (Integer ele : pages) {
this.pages.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public SecretKey toAes() {
if (k == null) {
return null;
}
SecretKey secretKey = new SecretKeySpec(k, "AES");
return secretKey;
} } | public class class_name {
public SecretKey toAes() {
if (k == null) {
return null; // depends on control dependency: [if], data = [none]
}
SecretKey secretKey = new SecretKeySpec(k, "AES");
return secretKey;
} } |
public class class_name {
private void updateBetas(final List<Vec> docs, ExecutorService ex)
{
final double[] digammaLambdaSum = new double[K];//TODO may want to move this out & reuse
for(int k = 0; k < K; k++)
digammaLambdaSum[k] = FastMath.digamma(W*eta+lambdaSums.getD(k));
List<List<Vec>> docSplits = ListUtils.splitList(docs, SystemInfo.LogicalCores);
final CountDownLatch latch = new CountDownLatch(docSplits.size());
for(final List<Vec> docsSub : docSplits)
{
ex.submit(new Runnable()
{
@Override
public void run()
{
for(Vec doc : docsSub)//make sure out ELogBeta is up to date
for(IndexValue iv : doc)
{
int indx = iv.getIndex();
if(lastUsed[indx] != t)
{
for(int k = 0; k < K; k++)
{
double lambda_kj = lambda.get(k).get(indx);
double logBeta_kj = FastMath.digamma(eta+lambda_kj)-digammaLambdaSum[k];
ELogBeta.get(k).set(indx, logBeta_kj);
ExpELogBeta.get(k).set(indx, FastMath.exp(logBeta_kj));
}
lastUsed[indx] = t;
}
}
latch.countDown();
}
});
}
try
{
latch.await();
}
catch (InterruptedException ex1)
{
Logger.getLogger(OnlineLDAsvi.class.getName()).log(Level.SEVERE, null, ex1);
}
} } | public class class_name {
private void updateBetas(final List<Vec> docs, ExecutorService ex)
{
final double[] digammaLambdaSum = new double[K];//TODO may want to move this out & reuse
for(int k = 0; k < K; k++)
digammaLambdaSum[k] = FastMath.digamma(W*eta+lambdaSums.getD(k));
List<List<Vec>> docSplits = ListUtils.splitList(docs, SystemInfo.LogicalCores);
final CountDownLatch latch = new CountDownLatch(docSplits.size());
for(final List<Vec> docsSub : docSplits)
{
ex.submit(new Runnable()
{
@Override
public void run()
{
for(Vec doc : docsSub)//make sure out ELogBeta is up to date
for(IndexValue iv : doc)
{
int indx = iv.getIndex();
if(lastUsed[indx] != t)
{
for(int k = 0; k < K; k++)
{
double lambda_kj = lambda.get(k).get(indx);
double logBeta_kj = FastMath.digamma(eta+lambda_kj)-digammaLambdaSum[k];
ELogBeta.get(k).set(indx, logBeta_kj); // depends on control dependency: [for], data = [k]
ExpELogBeta.get(k).set(indx, FastMath.exp(logBeta_kj)); // depends on control dependency: [for], data = [k]
}
lastUsed[indx] = t; // depends on control dependency: [if], data = [none]
}
}
latch.countDown();
}
}); // depends on control dependency: [for], data = [none]
}
try
{
latch.await(); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException ex1)
{
Logger.getLogger(OnlineLDAsvi.class.getName()).log(Level.SEVERE, null, ex1);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void showCliEx(RequestClientErrorException cause, Supplier<String> msgSupplier) {
final DelicateErrorLoggingLevel loggingLevel = cause.getLoggingLevel();
if (DelicateErrorLoggingLevel.DEBUG.equals(loggingLevel)) {
if (logger.isDebugEnabled()) {
logger.debug(msgSupplier.get());
}
} else if (DelicateErrorLoggingLevel.INFO.equals(loggingLevel)) {
if (logger.isInfoEnabled()) {
logger.info(msgSupplier.get());
}
} else if (DelicateErrorLoggingLevel.WARN.equals(loggingLevel)) {
if (logger.isWarnEnabled()) {
logger.warn(msgSupplier.get());
}
} else if (DelicateErrorLoggingLevel.ERROR.equals(loggingLevel)) {
if (logger.isErrorEnabled()) {
logger.error(msgSupplier.get());
}
} else { // as default
if (logger.isInfoEnabled()) {
logger.info(msgSupplier.get());
}
}
} } | public class class_name {
protected void showCliEx(RequestClientErrorException cause, Supplier<String> msgSupplier) {
final DelicateErrorLoggingLevel loggingLevel = cause.getLoggingLevel();
if (DelicateErrorLoggingLevel.DEBUG.equals(loggingLevel)) {
if (logger.isDebugEnabled()) {
logger.debug(msgSupplier.get()); // depends on control dependency: [if], data = [none]
}
} else if (DelicateErrorLoggingLevel.INFO.equals(loggingLevel)) {
if (logger.isInfoEnabled()) {
logger.info(msgSupplier.get()); // depends on control dependency: [if], data = [none]
}
} else if (DelicateErrorLoggingLevel.WARN.equals(loggingLevel)) {
if (logger.isWarnEnabled()) {
logger.warn(msgSupplier.get()); // depends on control dependency: [if], data = [none]
}
} else if (DelicateErrorLoggingLevel.ERROR.equals(loggingLevel)) {
if (logger.isErrorEnabled()) {
logger.error(msgSupplier.get()); // depends on control dependency: [if], data = [none]
}
} else { // as default
if (logger.isInfoEnabled()) {
logger.info(msgSupplier.get()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
void setUndoView(@NonNull final View undoView) {
if (mUndoView != null) {
removeView(mUndoView);
}
mUndoView = undoView;
mUndoView.setVisibility(GONE);
addView(mUndoView);
} } | public class class_name {
void setUndoView(@NonNull final View undoView) {
if (mUndoView != null) {
removeView(mUndoView); // depends on control dependency: [if], data = [(mUndoView]
}
mUndoView = undoView;
mUndoView.setVisibility(GONE);
addView(mUndoView);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public Object parse( String value, Class type )
{
String text = removeSquareBrackets( value );
List<Object> values = new ArrayList<Object>();
if (StringUtil.isBlank( text )) return CollectionUtil.toArray( values, type.getComponentType() );
String[] parts = text.split( separators );
for (String part : parts)
{
values.add( TypeConversion.parse( part.trim(), type.getComponentType() ) );
}
return CollectionUtil.toArray( values, type.getComponentType() );
} } | public class class_name {
@SuppressWarnings("unchecked")
public Object parse( String value, Class type )
{
String text = removeSquareBrackets( value );
List<Object> values = new ArrayList<Object>();
if (StringUtil.isBlank( text )) return CollectionUtil.toArray( values, type.getComponentType() );
String[] parts = text.split( separators );
for (String part : parts)
{
values.add( TypeConversion.parse( part.trim(), type.getComponentType() ) ); // depends on control dependency: [for], data = [part]
}
return CollectionUtil.toArray( values, type.getComponentType() );
} } |
public class class_name {
@Implementation(minSdk = 23)
public boolean isIdle() {
if (Build.VERSION.SDK_INT >= M) {
return directlyOn(realQueue, MessageQueue.class).isIdle();
} else {
ReflectorMessageQueue internalQueue = reflector(ReflectorMessageQueue.class, realQueue);
// this is a copy of the implementation from P
synchronized (realQueue) {
final long now = SystemClock.uptimeMillis();
Message headMsg = internalQueue.getMessages();
if (headMsg == null) {
return true;
}
long when = shadowOfMsg(headMsg).getWhen();
return now < when;
}
}
} } | public class class_name {
@Implementation(minSdk = 23)
public boolean isIdle() {
if (Build.VERSION.SDK_INT >= M) {
return directlyOn(realQueue, MessageQueue.class).isIdle(); // depends on control dependency: [if], data = [none]
} else {
ReflectorMessageQueue internalQueue = reflector(ReflectorMessageQueue.class, realQueue);
// this is a copy of the implementation from P
synchronized (realQueue) { // depends on control dependency: [if], data = [none]
final long now = SystemClock.uptimeMillis();
Message headMsg = internalQueue.getMessages();
if (headMsg == null) {
return true; // depends on control dependency: [if], data = [none]
}
long when = shadowOfMsg(headMsg).getWhen();
return now < when;
}
}
} } |
public class class_name {
public BulkWriteResult insert(List<DBObject> dbObjectList, QueryOptions options) {
// Let's prepare the Bulk object
BulkWriteOperation bulk = dbCollection.initializeUnorderedBulkOperation();
for (DBObject document : dbObjectList) {
bulk.insert(document);
}
if(options != null && (options.containsKey("w") || options.containsKey("wtimeout"))) {
// Some info about params: http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html
return bulk.execute(new WriteConcern(options.getInt("w", 1), options.getInt("wtimeout", 0)));
}else {
return bulk.execute();
}
} } | public class class_name {
public BulkWriteResult insert(List<DBObject> dbObjectList, QueryOptions options) {
// Let's prepare the Bulk object
BulkWriteOperation bulk = dbCollection.initializeUnorderedBulkOperation();
for (DBObject document : dbObjectList) {
bulk.insert(document); // depends on control dependency: [for], data = [document]
}
if(options != null && (options.containsKey("w") || options.containsKey("wtimeout"))) {
// Some info about params: http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html
return bulk.execute(new WriteConcern(options.getInt("w", 1), options.getInt("wtimeout", 0))); // depends on control dependency: [if], data = [(options]
}else {
return bulk.execute(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean resetLayout(String loginId) {
boolean resetSuccess = false;
boolean resetCurrentUserLayout = (null == loginId);
if (resetCurrentUserLayout || (!resetCurrentUserLayout && AdminEvaluator.isAdmin(owner))) {
if (LOG.isDebugEnabled()) {
LOG.debug("Reset layout requested for user with id " + loginId + ".");
}
int portalID = IPerson.UNDEFINED_ID;
IPerson person;
if (resetCurrentUserLayout || loginId.equals(owner.getUserName())) {
person = owner;
portalID = owner.getID();
} else {
// Need to get the portal id
person = PersonFactory.createPerson();
person.setAttribute(IPerson.USERNAME, loginId);
try {
portalID = userIdentityStore.getPortalUID(person);
person.setID(portalID);
} catch (Exception e) {
// ignore since the store will log the problem
}
}
if (portalID != IPerson.UNDEFINED_ID) {
resetSuccess = resetLayout(person);
}
} else {
LOG.error(
"Layout reset requested for user "
+ loginId
+ " by "
+ owner.getID()
+ " who is not an administrative user.");
}
return resetSuccess;
} } | public class class_name {
public boolean resetLayout(String loginId) {
boolean resetSuccess = false;
boolean resetCurrentUserLayout = (null == loginId);
if (resetCurrentUserLayout || (!resetCurrentUserLayout && AdminEvaluator.isAdmin(owner))) {
if (LOG.isDebugEnabled()) {
LOG.debug("Reset layout requested for user with id " + loginId + "."); // depends on control dependency: [if], data = [none]
}
int portalID = IPerson.UNDEFINED_ID;
IPerson person;
if (resetCurrentUserLayout || loginId.equals(owner.getUserName())) {
person = owner; // depends on control dependency: [if], data = [none]
portalID = owner.getID(); // depends on control dependency: [if], data = [none]
} else {
// Need to get the portal id
person = PersonFactory.createPerson(); // depends on control dependency: [if], data = [none]
person.setAttribute(IPerson.USERNAME, loginId); // depends on control dependency: [if], data = [none]
try {
portalID = userIdentityStore.getPortalUID(person); // depends on control dependency: [try], data = [none]
person.setID(portalID); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// ignore since the store will log the problem
} // depends on control dependency: [catch], data = [none]
}
if (portalID != IPerson.UNDEFINED_ID) {
resetSuccess = resetLayout(person); // depends on control dependency: [if], data = [none]
}
} else {
LOG.error(
"Layout reset requested for user "
+ loginId
+ " by "
+ owner.getID()
+ " who is not an administrative user."); // depends on control dependency: [if], data = [none]
}
return resetSuccess;
} } |
public class class_name {
public Map<L,Counter<F>> weightsAsMapOfCounters() {
Map<L,Counter<F>> mapOfCounters = new HashMap<L,Counter<F>>();
for(L label : labelIndex){
int labelID = labelIndex.indexOf(label);
Counter<F> c = new ClassicCounter<F>();
mapOfCounters.put(label, c);
for (F f : featureIndex) {
c.incrementCount(f, weights[featureIndex.indexOf(f)][labelID]);
}
}
return mapOfCounters;
} } | public class class_name {
public Map<L,Counter<F>> weightsAsMapOfCounters() {
Map<L,Counter<F>> mapOfCounters = new HashMap<L,Counter<F>>();
for(L label : labelIndex){
int labelID = labelIndex.indexOf(label);
Counter<F> c = new ClassicCounter<F>();
mapOfCounters.put(label, c);
// depends on control dependency: [for], data = [label]
for (F f : featureIndex) {
c.incrementCount(f, weights[featureIndex.indexOf(f)][labelID]);
// depends on control dependency: [for], data = [f]
}
}
return mapOfCounters;
} } |
public class class_name {
protected void processInput(String input) {
String command = input.trim();
if (!command.isEmpty()) {
runCommand(command);
}
} } | public class class_name {
protected void processInput(String input) {
String command = input.trim();
if (!command.isEmpty()) {
runCommand(command); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private SessionThrottleFilterConfig getConfigFromWebXML(FilterConfig filterConfig){
int limit = -1;
String l = filterConfig.getInitParameter("limit");
try{
if (l!=null)
limit = Integer.parseInt(l);
}catch(NumberFormatException ignored){
//ignored.
}
String target = filterConfig.getInitParameter("redirectTarget");
if (target==null || target.length()==0)
limit = -1;
return new SessionThrottleFilterConfig(limit, target);
} } | public class class_name {
private SessionThrottleFilterConfig getConfigFromWebXML(FilterConfig filterConfig){
int limit = -1;
String l = filterConfig.getInitParameter("limit");
try{
if (l!=null)
limit = Integer.parseInt(l);
}catch(NumberFormatException ignored){
//ignored.
} // depends on control dependency: [catch], data = [none]
String target = filterConfig.getInitParameter("redirectTarget");
if (target==null || target.length()==0)
limit = -1;
return new SessionThrottleFilterConfig(limit, target);
} } |
public class class_name {
public JobScheduleUpdateHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public JobScheduleUpdateHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
public static void i(String tag, String msg, Object... args) {
if (sLevel > LEVEL_INFO) {
return;
}
if (args.length > 0) {
msg = String.format(msg, args);
}
Log.i(tag, msg);
} } | public class class_name {
public static void i(String tag, String msg, Object... args) {
if (sLevel > LEVEL_INFO) {
return; // depends on control dependency: [if], data = [none]
}
if (args.length > 0) {
msg = String.format(msg, args); // depends on control dependency: [if], data = [none]
}
Log.i(tag, msg);
} } |
public class class_name {
protected <T> TypeConverter findTypeConverter(Class<?> sourceType, Class<T> targetType, Class<? extends Annotation> formattingAnnotation) {
TypeConverter typeConverter = null;
List<Class> sourceHierarchy = ClassUtils.resolveHierarchy(sourceType);
List<Class> targetHierarchy = ClassUtils.resolveHierarchy(targetType);
boolean hasFormatting = formattingAnnotation != null;
for (Class sourceSuperType : sourceHierarchy) {
for (Class targetSuperType : targetHierarchy) {
ConvertiblePair pair = new ConvertiblePair(sourceSuperType, targetSuperType, formattingAnnotation);
typeConverter = typeConverters.get(pair);
if (typeConverter != null) {
converterCache.put(pair, typeConverter);
return typeConverter;
}
}
}
if (hasFormatting) {
for (Class sourceSuperType : sourceHierarchy) {
for (Class targetSuperType : targetHierarchy) {
ConvertiblePair pair = new ConvertiblePair(sourceSuperType, targetSuperType);
typeConverter = typeConverters.get(pair);
if (typeConverter != null) {
converterCache.put(pair, typeConverter);
return typeConverter;
}
}
}
}
return typeConverter;
} } | public class class_name {
protected <T> TypeConverter findTypeConverter(Class<?> sourceType, Class<T> targetType, Class<? extends Annotation> formattingAnnotation) {
TypeConverter typeConverter = null;
List<Class> sourceHierarchy = ClassUtils.resolveHierarchy(sourceType);
List<Class> targetHierarchy = ClassUtils.resolveHierarchy(targetType);
boolean hasFormatting = formattingAnnotation != null;
for (Class sourceSuperType : sourceHierarchy) {
for (Class targetSuperType : targetHierarchy) {
ConvertiblePair pair = new ConvertiblePair(sourceSuperType, targetSuperType, formattingAnnotation);
typeConverter = typeConverters.get(pair); // depends on control dependency: [for], data = [none]
if (typeConverter != null) {
converterCache.put(pair, typeConverter); // depends on control dependency: [if], data = [none]
return typeConverter; // depends on control dependency: [if], data = [none]
}
}
}
if (hasFormatting) {
for (Class sourceSuperType : sourceHierarchy) {
for (Class targetSuperType : targetHierarchy) {
ConvertiblePair pair = new ConvertiblePair(sourceSuperType, targetSuperType);
typeConverter = typeConverters.get(pair); // depends on control dependency: [for], data = [none]
if (typeConverter != null) {
converterCache.put(pair, typeConverter); // depends on control dependency: [if], data = [none]
return typeConverter; // depends on control dependency: [if], data = [none]
}
}
}
}
return typeConverter;
} } |
public class class_name {
public void trimToSize() {
if (_size < _data.length) {
_data = _size == 0
? EMPTY_ARRAY
: copyOf(_data, _size);
}
} } | public class class_name {
public void trimToSize() {
if (_size < _data.length) {
_data = _size == 0
? EMPTY_ARRAY
: copyOf(_data, _size); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
protected String getReadOnlyValue(final AbstractUIField _abstractUIField)
throws EFapsException
{
String strValue = "";
if (_abstractUIField.getValue().getDbValue() != null) {
final Object valueObj = _abstractUIField.getValue().getReadOnlyValue(_abstractUIField.getParent()
.getMode());
if (valueObj instanceof List) {
final List<IOption> values = (List<IOption>) valueObj;
if (values != null && !values.isEmpty()) {
if (values.size() == 1) {
strValue = values.get(0).getLabel();
} else {
for (final IOption option : values) {
if (option.isSelected()) {
strValue = option.getLabel();
break;
}
}
}
}
} else if (valueObj != null) {
strValue = valueObj.toString();
}
}
return strValue;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
protected String getReadOnlyValue(final AbstractUIField _abstractUIField)
throws EFapsException
{
String strValue = "";
if (_abstractUIField.getValue().getDbValue() != null) {
final Object valueObj = _abstractUIField.getValue().getReadOnlyValue(_abstractUIField.getParent()
.getMode());
if (valueObj instanceof List) {
final List<IOption> values = (List<IOption>) valueObj;
if (values != null && !values.isEmpty()) {
if (values.size() == 1) {
strValue = values.get(0).getLabel(); // depends on control dependency: [if], data = [none]
} else {
for (final IOption option : values) {
if (option.isSelected()) {
strValue = option.getLabel(); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
} else if (valueObj != null) {
strValue = valueObj.toString();
}
}
return strValue;
} } |
public class class_name {
protected static Throwable newDecoderException() {
try {
return DECODER_EXCEPTION.newInstance();
} catch (final InstantiationException ie) {
throw new RuntimeException(ie);
} catch (final IllegalAccessException iae) {
throw new RuntimeException(iae);
}
} } | public class class_name {
protected static Throwable newDecoderException() {
try {
return DECODER_EXCEPTION.newInstance(); // depends on control dependency: [try], data = [none]
} catch (final InstantiationException ie) {
throw new RuntimeException(ie);
} catch (final IllegalAccessException iae) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(iae);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String applyUriReplace(String uriSource, Configuration conf) {
if (uriSource == null) return null;
String[] uriReplace = conf.getStrings(OUTPUT_URI_REPLACE);
if (uriReplace == null) return uriSource;
for (int i = 0; i < uriReplace.length - 1; i += 2) {
String replacement = uriReplace[i+1].trim();
replacement = replacement.substring(1, replacement.length()-1);
uriSource = uriSource.replaceAll(uriReplace[i], replacement);
}
return uriSource;
} } | public class class_name {
public static String applyUriReplace(String uriSource, Configuration conf) {
if (uriSource == null) return null;
String[] uriReplace = conf.getStrings(OUTPUT_URI_REPLACE);
if (uriReplace == null) return uriSource;
for (int i = 0; i < uriReplace.length - 1; i += 2) {
String replacement = uriReplace[i+1].trim();
replacement = replacement.substring(1, replacement.length()-1); // depends on control dependency: [for], data = [none]
uriSource = uriSource.replaceAll(uriReplace[i], replacement); // depends on control dependency: [for], data = [i]
}
return uriSource;
} } |
public class class_name {
@Override
public Warnings warn(Database database) {
Warnings warnings = new Warnings();
if (generateStatementsVolatile(database)) {
return warnings;
}
SqlStatement[] statements = generateStatements(database);
if (statements == null) {
return warnings;
}
for (SqlStatement statement : statements) {
if (SqlGeneratorFactory.getInstance().supports(statement, database)) {
warnings.addAll(SqlGeneratorFactory.getInstance().warn(statement, database));
} else if (statement.skipOnUnsupported()) {
warnings.addWarning(
statement.getClass().getName() + " is not supported on " + database.getShortName() +
", but " + Scope.getCurrentScope().getSingleton(ChangeFactory.class).getChangeMetaData(this).getName() +
" will still execute");
}
}
return warnings;
} } | public class class_name {
@Override
public Warnings warn(Database database) {
Warnings warnings = new Warnings();
if (generateStatementsVolatile(database)) {
return warnings; // depends on control dependency: [if], data = [none]
}
SqlStatement[] statements = generateStatements(database);
if (statements == null) {
return warnings; // depends on control dependency: [if], data = [none]
}
for (SqlStatement statement : statements) {
if (SqlGeneratorFactory.getInstance().supports(statement, database)) {
warnings.addAll(SqlGeneratorFactory.getInstance().warn(statement, database)); // depends on control dependency: [if], data = [none]
} else if (statement.skipOnUnsupported()) {
warnings.addWarning(
statement.getClass().getName() + " is not supported on " + database.getShortName() +
", but " + Scope.getCurrentScope().getSingleton(ChangeFactory.class).getChangeMetaData(this).getName() +
" will still execute"); // depends on control dependency: [if], data = [none]
}
}
return warnings;
} } |
public class class_name {
public static boolean containsRTLText(String str)
{
if (str != null)
{
for (int i = 0; i < str.length(); i++)
{
char cc = str.charAt(i);
// hebrew extended and basic, arabic basic and extendend
if (cc >= 1425 && cc <= 1785)
{
return true;
}
// alphabetic presentations forms (hebrwew) to arabic presentation forms A
else if (cc >= 64286 && cc <= 65019)
{
return true;
}
// arabic presentation forms B
else if (cc >= 65136 && cc <= 65276)
{
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean containsRTLText(String str)
{
if (str != null)
{
for (int i = 0; i < str.length(); i++)
{
char cc = str.charAt(i);
// hebrew extended and basic, arabic basic and extendend
if (cc >= 1425 && cc <= 1785)
{
return true; // depends on control dependency: [if], data = [none]
}
// alphabetic presentations forms (hebrwew) to arabic presentation forms A
else if (cc >= 64286 && cc <= 65019)
{
return true; // depends on control dependency: [if], data = [none]
}
// arabic presentation forms B
else if (cc >= 65136 && cc <= 65276)
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
@Override
public Value caseACompBinaryExp(ACompBinaryExp node, Context ctxt)
throws AnalysisException
{
// breakpoint.check(location, ctxt);
node.getLocation().hit(); // Mark as covered
Value lv = node.getLeft().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref();
Value rv = node.getRight().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref();
if (lv instanceof MapValue)
{
ValueMap lm = null;
ValueMap rm = null;
try
{
lm = lv.mapValue(ctxt);
rm = rv.mapValue(ctxt);
} catch (ValueException e)
{
return VdmRuntimeError.abort(node.getLocation(), e);
}
ValueMap result = new ValueMap();
for (Value v : rm.keySet())
{
Value rng = lm.get(rm.get(v));
if (rng == null)
{
VdmRuntimeError.abort(node.getLocation(), 4162, "The RHS range is not a subset of the LHS domain", ctxt);
}
Value old = result.put(v, rng);
if (old != null && !old.equals(rng))
{
VdmRuntimeError.abort(node.getLocation(), 4005, "Duplicate map keys have different values", ctxt);
}
}
return new MapValue(result);
}
try
{
FunctionValue f1 = lv.functionValue(ctxt);
FunctionValue f2 = rv.functionValue(ctxt);
return new CompFunctionValue(f1, f2);
} catch (ValueException e)
{
return VdmRuntimeError.abort(node.getLocation(), e);
}
} } | public class class_name {
@Override
public Value caseACompBinaryExp(ACompBinaryExp node, Context ctxt)
throws AnalysisException
{
// breakpoint.check(location, ctxt);
node.getLocation().hit(); // Mark as covered
Value lv = node.getLeft().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref();
Value rv = node.getRight().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref();
if (lv instanceof MapValue)
{
ValueMap lm = null;
ValueMap rm = null;
try
{
lm = lv.mapValue(ctxt); // depends on control dependency: [try], data = [none]
rm = rv.mapValue(ctxt); // depends on control dependency: [try], data = [none]
} catch (ValueException e)
{
return VdmRuntimeError.abort(node.getLocation(), e);
} // depends on control dependency: [catch], data = [none]
ValueMap result = new ValueMap();
for (Value v : rm.keySet())
{
Value rng = lm.get(rm.get(v));
if (rng == null)
{
VdmRuntimeError.abort(node.getLocation(), 4162, "The RHS range is not a subset of the LHS domain", ctxt); // depends on control dependency: [if], data = [none]
}
Value old = result.put(v, rng);
if (old != null && !old.equals(rng))
{
VdmRuntimeError.abort(node.getLocation(), 4005, "Duplicate map keys have different values", ctxt); // depends on control dependency: [if], data = [none]
}
}
return new MapValue(result);
}
try
{
FunctionValue f1 = lv.functionValue(ctxt);
FunctionValue f2 = rv.functionValue(ctxt);
return new CompFunctionValue(f1, f2);
} catch (ValueException e)
{
return VdmRuntimeError.abort(node.getLocation(), e);
}
} } |
public class class_name {
public boolean removeBusItinerary(BusItinerary itinerary) {
final int index = this.itineraries.indexOf(itinerary);
if (index >= 0) {
return removeBusItinerary(index);
}
return false;
} } | public class class_name {
public boolean removeBusItinerary(BusItinerary itinerary) {
final int index = this.itineraries.indexOf(itinerary);
if (index >= 0) {
return removeBusItinerary(index); // depends on control dependency: [if], data = [(index]
}
return false;
} } |
public class class_name {
public void marshall(BatchListObjectParentPathsResponse batchListObjectParentPathsResponse, ProtocolMarshaller protocolMarshaller) {
if (batchListObjectParentPathsResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchListObjectParentPathsResponse.getPathToObjectIdentifiersList(), PATHTOOBJECTIDENTIFIERSLIST_BINDING);
protocolMarshaller.marshall(batchListObjectParentPathsResponse.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchListObjectParentPathsResponse batchListObjectParentPathsResponse, ProtocolMarshaller protocolMarshaller) {
if (batchListObjectParentPathsResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchListObjectParentPathsResponse.getPathToObjectIdentifiersList(), PATHTOOBJECTIDENTIFIERSLIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchListObjectParentPathsResponse.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean isOsgiApp(IServletContext isc) {
Object bundleCtxAttr = isc.getAttribute(BUNDLE_CONTEXT_KEY);
Tr.debug(tc, "Servet context attr for key = " + BUNDLE_CONTEXT_KEY + ", = " + bundleCtxAttr);
if (bundleCtxAttr != null) {
return true;
} else {
return false;
}
} } | public class class_name {
private boolean isOsgiApp(IServletContext isc) {
Object bundleCtxAttr = isc.getAttribute(BUNDLE_CONTEXT_KEY);
Tr.debug(tc, "Servet context attr for key = " + BUNDLE_CONTEXT_KEY + ", = " + bundleCtxAttr);
if (bundleCtxAttr != null) {
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EClass getIfcTendonAnchor() {
if (ifcTendonAnchorEClass == null) {
ifcTendonAnchorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(706);
}
return ifcTendonAnchorEClass;
} } | public class class_name {
@Override
public EClass getIfcTendonAnchor() {
if (ifcTendonAnchorEClass == null) {
ifcTendonAnchorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(706);
// depends on control dependency: [if], data = [none]
}
return ifcTendonAnchorEClass;
} } |
public class class_name {
public synchronized void reject() {
JingleSession session;
synchronized (manager) {
try {
session = manager.createIncomingJingleSession(this);
// Acknowledge the IQ reception
session.setSid(this.getSessionID());
// session.sendAck(this.getJingle());
session.updatePacketListener();
session.terminate("Declined");
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Exception in reject", e);
}
}
} } | public class class_name {
public synchronized void reject() {
JingleSession session;
synchronized (manager) {
try {
session = manager.createIncomingJingleSession(this); // depends on control dependency: [try], data = [none]
// Acknowledge the IQ reception
session.setSid(this.getSessionID()); // depends on control dependency: [try], data = [none]
// session.sendAck(this.getJingle());
session.updatePacketListener(); // depends on control dependency: [try], data = [none]
session.terminate("Declined"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Exception in reject", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(ListUserImportJobsRequest listUserImportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (listUserImportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUserImportJobsRequest.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(listUserImportJobsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listUserImportJobsRequest.getPaginationToken(), PAGINATIONTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListUserImportJobsRequest listUserImportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (listUserImportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUserImportJobsRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUserImportJobsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUserImportJobsRequest.getPaginationToken(), PAGINATIONTOKEN_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 boolean waitForAnswer(long timeout) {
if (callAnswered == true) {
return true;
}
if (waitOutgoingCallResponse(timeout) == false) {
return false;
}
while (returnCode != SipResponse.OK) {
if (returnCode / 100 == 1) {
if (waitOutgoingCallResponse(timeout) == false) {
return false;
}
continue;
} else if ((returnCode == Response.UNAUTHORIZED)
|| (returnCode == Response.PROXY_AUTHENTICATION_REQUIRED)) {
Request msg = getSentRequest();
// modify the request to include user authorization info
msg = parent.processAuthChallenge((Response) getLastReceivedResponse().getMessage(), msg);
if (msg == null) {
return false;
}
if (reInitiateOutgoingCall(msg) == false) {
return false;
}
if (waitOutgoingCallResponse(timeout) == false) {
return false;
}
continue;
} else {
setErrorMessage("Call was not answered, got this instead: " + returnCode);
return false;
}
}
return true;
} } | public class class_name {
public boolean waitForAnswer(long timeout) {
if (callAnswered == true) {
return true; // depends on control dependency: [if], data = [none]
}
if (waitOutgoingCallResponse(timeout) == false) {
return false; // depends on control dependency: [if], data = [none]
}
while (returnCode != SipResponse.OK) {
if (returnCode / 100 == 1) {
if (waitOutgoingCallResponse(timeout) == false) {
return false; // depends on control dependency: [if], data = [none]
}
continue;
} else if ((returnCode == Response.UNAUTHORIZED)
|| (returnCode == Response.PROXY_AUTHENTICATION_REQUIRED)) {
Request msg = getSentRequest();
// modify the request to include user authorization info
msg = parent.processAuthChallenge((Response) getLastReceivedResponse().getMessage(), msg); // depends on control dependency: [if], data = [none]
if (msg == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (reInitiateOutgoingCall(msg) == false) {
return false; // depends on control dependency: [if], data = [none]
}
if (waitOutgoingCallResponse(timeout) == false) {
return false; // depends on control dependency: [if], data = [none]
}
continue;
} else {
setErrorMessage("Call was not answered, got this instead: " + returnCode); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
public boolean hasNext() {
resetToLastKey();
if (mCurrent != null) {
if (mCurrent.hasNext()) {
return true;
} else {
// necessary, because previous hasNext() changes state
resetToLastKey();
}
}
while (mNum < mSeq.size()) {
mCurrent = mSeq.get(mNum++);
if (mCurrent.hasNext()) {
return true;
}
}
resetToStartKey();
return false;
} } | public class class_name {
@Override
public boolean hasNext() {
resetToLastKey();
if (mCurrent != null) {
if (mCurrent.hasNext()) {
return true; // depends on control dependency: [if], data = [none]
} else {
// necessary, because previous hasNext() changes state
resetToLastKey(); // depends on control dependency: [if], data = [none]
}
}
while (mNum < mSeq.size()) {
mCurrent = mSeq.get(mNum++); // depends on control dependency: [while], data = [(mNum]
if (mCurrent.hasNext()) {
return true; // depends on control dependency: [if], data = [none]
}
}
resetToStartKey();
return false;
} } |
public class class_name {
private void growBuffer(int len) throws IOException {
int bufferLength = buf.length;
int newCapacity;
if (bufferLength == SMALL_BUFFER_SIZE) {
if (len + pos < MEDIUM_BUFFER_SIZE) {
newCapacity = MEDIUM_BUFFER_SIZE;
} else if (len + pos < LARGE_BUFFER_SIZE) {
newCapacity = LARGE_BUFFER_SIZE;
} else {
newCapacity = getMaxPacketLength();
}
} else if (bufferLength == MEDIUM_BUFFER_SIZE) {
if (len + pos < LARGE_BUFFER_SIZE) {
newCapacity = LARGE_BUFFER_SIZE;
} else {
newCapacity = getMaxPacketLength();
}
} else if (bufferContainDataAfterMark) {
//want to add some information to buffer without having the command Header
//must grow buffer until having all the query
newCapacity = Math.max(len + pos, getMaxPacketLength());
} else {
newCapacity = getMaxPacketLength();
}
if (mark != -1 && len + pos > newCapacity) {
//buffer is > 16M with mark.
//flush until mark, reset pos at beginning
flushBufferStopAtMark();
if (len + pos <= bufferLength) {
return;
}
//need to keep all data, buffer can grow more than maxPacketLength
//grow buffer if needed
if (len + pos > newCapacity) {
newCapacity = len + pos;
}
}
byte[] newBuf = new byte[newCapacity];
System.arraycopy(buf, 0, newBuf, 0, pos);
buf = newBuf;
} } | public class class_name {
private void growBuffer(int len) throws IOException {
int bufferLength = buf.length;
int newCapacity;
if (bufferLength == SMALL_BUFFER_SIZE) {
if (len + pos < MEDIUM_BUFFER_SIZE) {
newCapacity = MEDIUM_BUFFER_SIZE; // depends on control dependency: [if], data = [none]
} else if (len + pos < LARGE_BUFFER_SIZE) {
newCapacity = LARGE_BUFFER_SIZE; // depends on control dependency: [if], data = [none]
} else {
newCapacity = getMaxPacketLength(); // depends on control dependency: [if], data = [none]
}
} else if (bufferLength == MEDIUM_BUFFER_SIZE) {
if (len + pos < LARGE_BUFFER_SIZE) {
newCapacity = LARGE_BUFFER_SIZE; // depends on control dependency: [if], data = [none]
} else {
newCapacity = getMaxPacketLength(); // depends on control dependency: [if], data = [none]
}
} else if (bufferContainDataAfterMark) {
//want to add some information to buffer without having the command Header
//must grow buffer until having all the query
newCapacity = Math.max(len + pos, getMaxPacketLength());
} else {
newCapacity = getMaxPacketLength();
}
if (mark != -1 && len + pos > newCapacity) {
//buffer is > 16M with mark.
//flush until mark, reset pos at beginning
flushBufferStopAtMark();
if (len + pos <= bufferLength) {
return; // depends on control dependency: [if], data = [none]
}
//need to keep all data, buffer can grow more than maxPacketLength
//grow buffer if needed
if (len + pos > newCapacity) {
newCapacity = len + pos; // depends on control dependency: [if], data = [none]
}
}
byte[] newBuf = new byte[newCapacity];
System.arraycopy(buf, 0, newBuf, 0, pos);
buf = newBuf;
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> listWithServiceResponseAsync(final JobListOptions jobListOptions) {
return listSinglePageAsync(jobListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
JobListNextOptions jobListNextOptions = null;
if (jobListOptions != null) {
jobListNextOptions = new JobListNextOptions();
jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId());
jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId());
jobListNextOptions.withOcpDate(jobListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions));
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> listWithServiceResponseAsync(final JobListOptions jobListOptions) {
return listSinglePageAsync(jobListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
JobListNextOptions jobListNextOptions = null;
if (jobListOptions != null) {
jobListNextOptions = new JobListNextOptions(); // depends on control dependency: [if], data = [none]
jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId()); // depends on control dependency: [if], data = [(jobListOptions]
jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(jobListOptions]
jobListNextOptions.withOcpDate(jobListOptions.ocpDate()); // depends on control dependency: [if], data = [(jobListOptions]
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions));
}
});
} } |
public class class_name {
private boolean checkHostPart(final String label, final Problems problems, final String compName) {
boolean result = true;
if (label.length() > 63) {
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_TOO_LONG", label)); // NOI18N
result = false;
}
if (label.length() == 0) {
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_EMPTY", compName, label)); // NOI18N
}
if (result) {
try {
Integer.parseInt(label);
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "NUMBER_PART_IN_HOSTNAME", label)); // NOI18N
result = false;
} catch (final NumberFormatException e) {
// do nothing
}
if (result) {
if (result) {
result = new EncodableInCharsetValidator().validate(problems, compName, label);
if (result) {
for (final char c : label.toLowerCase().toCharArray()) {
if (c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '-') { // NOI18N
continue;
}
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "BAD_CHAR_IN_HOSTNAME", new String(new char[] { c }))); // NOI18N
result = false;
}
}
}
}
}
return result;
} } | public class class_name {
private boolean checkHostPart(final String label, final Problems problems, final String compName) {
boolean result = true;
if (label.length() > 63) {
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_TOO_LONG", label)); // NOI18N // depends on control dependency: [if], data = [none]
result = false; // depends on control dependency: [if], data = [none]
}
if (label.length() == 0) {
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "LABEL_EMPTY", compName, label)); // NOI18N // depends on control dependency: [if], data = [none]
}
if (result) {
try {
Integer.parseInt(label); // depends on control dependency: [try], data = [none]
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "NUMBER_PART_IN_HOSTNAME", label)); // NOI18N // depends on control dependency: [try], data = [none]
result = false; // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException e) {
// do nothing
} // depends on control dependency: [catch], data = [none]
if (result) {
if (result) {
result = new EncodableInCharsetValidator().validate(problems, compName, label); // depends on control dependency: [if], data = [none]
if (result) {
for (final char c : label.toLowerCase().toCharArray()) {
if (c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '-') { // NOI18N
continue;
}
problems.add(ValidationBundle.getMessage(HostNameValidator.class, "BAD_CHAR_IN_HOSTNAME", new String(new char[] { c }))); // NOI18N // depends on control dependency: [for], data = [c]
result = false; // depends on control dependency: [for], data = [none]
}
}
}
}
}
return result;
} } |
public class class_name {
public static byte[] decompressByGzip(byte[] sourceBytes) {
byte[] buffer = null;
ByteArrayOutputStream out = null;
ByteArrayInputStream in = null;
GZIPInputStream gzip = null;
try {
out = new ByteArrayOutputStream();
buffer = new byte[CHUNK_SIZE];
in = new ByteArrayInputStream(sourceBytes);
gzip = new GZIPInputStream(in);
int len = 0;
while ((len = gzip.read(buffer, 0, CHUNK_SIZE)) != -1) {
out.write(buffer, 0, len);
}
return out.toByteArray();
} catch (IOException ex) {
Log.w(Log.TAG, "Failed to decompress gzipped data: " + ex.getMessage());
return null;
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
}
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
}
try {
if (gzip != null) {
gzip.close();
}
} catch (IOException ex) {
}
}
} } | public class class_name {
public static byte[] decompressByGzip(byte[] sourceBytes) {
byte[] buffer = null;
ByteArrayOutputStream out = null;
ByteArrayInputStream in = null;
GZIPInputStream gzip = null;
try {
out = new ByteArrayOutputStream(); // depends on control dependency: [try], data = [none]
buffer = new byte[CHUNK_SIZE]; // depends on control dependency: [try], data = [none]
in = new ByteArrayInputStream(sourceBytes); // depends on control dependency: [try], data = [none]
gzip = new GZIPInputStream(in); // depends on control dependency: [try], data = [none]
int len = 0;
while ((len = gzip.read(buffer, 0, CHUNK_SIZE)) != -1) {
out.write(buffer, 0, len); // depends on control dependency: [while], data = [none]
}
return out.toByteArray(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
Log.w(Log.TAG, "Failed to decompress gzipped data: " + ex.getMessage());
return null;
} finally { // depends on control dependency: [catch], data = [none]
try {
if (out != null) {
out.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
} // depends on control dependency: [catch], data = [none]
try {
if (in != null) {
in.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
} // depends on control dependency: [catch], data = [none]
try {
if (gzip != null) {
gzip.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public CertificateAddOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public CertificateAddOptions 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 boolean hasMethodAnnotation(final String methodAnnotationName) {
for (final ClassInfo ci : getOverrideOrder()) {
if (ci.hasDeclaredMethodAnnotation(methodAnnotationName)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasMethodAnnotation(final String methodAnnotationName) {
for (final ClassInfo ci : getOverrideOrder()) {
if (ci.hasDeclaredMethodAnnotation(methodAnnotationName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static boolean hasSelectColumns(Object parameter) {
if (parameter != null && parameter instanceof Example) {
Example example = (Example) parameter;
if (example.getSelectColumns() != null && example.getSelectColumns().size() > 0) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean hasSelectColumns(Object parameter) {
if (parameter != null && parameter instanceof Example) {
Example example = (Example) parameter;
if (example.getSelectColumns() != null && example.getSelectColumns().size() > 0) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void setAsContextMenuOf(AbstractClientConnector component) {
if (component instanceof Table) {
setAsTableContextMenu((Table)component);
} else if (component instanceof Tree) {
setAsTreeContextMenu((Tree)component);
} else {
super.extend(component);
}
} } | public class class_name {
public void setAsContextMenuOf(AbstractClientConnector component) {
if (component instanceof Table) {
setAsTableContextMenu((Table)component); // depends on control dependency: [if], data = [none]
} else if (component instanceof Tree) {
setAsTreeContextMenu((Tree)component); // depends on control dependency: [if], data = [none]
} else {
super.extend(component); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final synchronized void setPriority(byte priority) {
if (this.priority == priority) return;
if (status == STATUS_STARTED_READY) {
if (manager.remove(this)) {
this.priority = priority;
while (manager.getTransferTarget() != null)
manager = manager.getTransferTarget();
manager.addReady(this);
return;
}
}
this.priority = priority;
} } | public class class_name {
public final synchronized void setPriority(byte priority) {
if (this.priority == priority) return;
if (status == STATUS_STARTED_READY) {
if (manager.remove(this)) {
this.priority = priority;
// depends on control dependency: [if], data = [none]
while (manager.getTransferTarget() != null)
manager = manager.getTransferTarget();
manager.addReady(this);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
}
this.priority = priority;
} } |
public class class_name {
public void sendResponse(int code, String response) {
if(con.isClosed()) return;
if(response == null || response.isEmpty()) {
response = "Unknown";
}
try {
if(response.charAt(0) == '-') {
writer.write(code + response + "\r\n");
} else {
writer.write(code + " " + response + "\r\n");
}
writer.flush();
} catch(IOException ex) {
Utils.closeQuietly(this);
}
responseSent = true;
} } | public class class_name {
public void sendResponse(int code, String response) {
if(con.isClosed()) return;
if(response == null || response.isEmpty()) {
response = "Unknown"; // depends on control dependency: [if], data = [none]
}
try {
if(response.charAt(0) == '-') {
writer.write(code + response + "\r\n"); // depends on control dependency: [if], data = [none]
} else {
writer.write(code + " " + response + "\r\n"); // depends on control dependency: [if], data = [none]
}
writer.flush(); // depends on control dependency: [try], data = [none]
} catch(IOException ex) {
Utils.closeQuietly(this);
} // depends on control dependency: [catch], data = [none]
responseSent = true;
} } |
public class class_name {
private StringBuffer format(double number, StringBuffer result,
FieldDelegate delegate) {
if (Double.isNaN(number) ||
(Double.isInfinite(number) && multiplier == 0)) {
int iFieldStart = result.length();
result.append(symbols.getNaN());
delegate.formatted(INTEGER_FIELD, Field.INTEGER, Field.INTEGER,
iFieldStart, result.length(), result);
return result;
}
/* Detecting whether a double is negative is easy with the exception of
* the value -0.0. This is a double which has a zero mantissa (and
* exponent), but a negative sign bit. It is semantically distinct from
* a zero with a positive sign bit, and this distinction is important
* to certain kinds of computations. However, it's a little tricky to
* detect, since (-0.0 == 0.0) and !(-0.0 < 0.0). How then, you may
* ask, does it behave distinctly from +0.0? Well, 1/(-0.0) ==
* -Infinity. Proper detection of -0.0 is needed to deal with the
* issues raised by bugs 4106658, 4106667, and 4147706. Liu 7/6/98.
*/
boolean isNegative = ((number < 0.0) || (number == 0.0 && 1/number < 0.0)) ^ (multiplier < 0);
if (multiplier != 1) {
number *= multiplier;
}
if (Double.isInfinite(number)) {
if (isNegative) {
append(result, negativePrefix, delegate,
getNegativePrefixFieldPositions(), Field.SIGN);
} else {
append(result, positivePrefix, delegate,
getPositivePrefixFieldPositions(), Field.SIGN);
}
int iFieldStart = result.length();
result.append(symbols.getInfinity());
delegate.formatted(INTEGER_FIELD, Field.INTEGER, Field.INTEGER,
iFieldStart, result.length(), result);
if (isNegative) {
append(result, negativeSuffix, delegate,
getNegativeSuffixFieldPositions(), Field.SIGN);
} else {
append(result, positiveSuffix, delegate,
getPositiveSuffixFieldPositions(), Field.SIGN);
}
return result;
}
if (isNegative) {
number = -number;
}
// at this point we are guaranteed a nonnegative finite number.
assert(number >= 0 && !Double.isInfinite(number));
synchronized(digitList) {
int maxIntDigits = super.getMaximumIntegerDigits();
int minIntDigits = super.getMinimumIntegerDigits();
int maxFraDigits = super.getMaximumFractionDigits();
int minFraDigits = super.getMinimumFractionDigits();
digitList.set(isNegative, number, useExponentialNotation ?
maxIntDigits + maxFraDigits : maxFraDigits,
!useExponentialNotation);
return subformat(result, delegate, isNegative, false,
maxIntDigits, minIntDigits, maxFraDigits, minFraDigits);
}
} } | public class class_name {
private StringBuffer format(double number, StringBuffer result,
FieldDelegate delegate) {
if (Double.isNaN(number) ||
(Double.isInfinite(number) && multiplier == 0)) {
int iFieldStart = result.length();
result.append(symbols.getNaN()); // depends on control dependency: [if], data = [none]
delegate.formatted(INTEGER_FIELD, Field.INTEGER, Field.INTEGER,
iFieldStart, result.length(), result); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
/* Detecting whether a double is negative is easy with the exception of
* the value -0.0. This is a double which has a zero mantissa (and
* exponent), but a negative sign bit. It is semantically distinct from
* a zero with a positive sign bit, and this distinction is important
* to certain kinds of computations. However, it's a little tricky to
* detect, since (-0.0 == 0.0) and !(-0.0 < 0.0). How then, you may
* ask, does it behave distinctly from +0.0? Well, 1/(-0.0) ==
* -Infinity. Proper detection of -0.0 is needed to deal with the
* issues raised by bugs 4106658, 4106667, and 4147706. Liu 7/6/98.
*/
boolean isNegative = ((number < 0.0) || (number == 0.0 && 1/number < 0.0)) ^ (multiplier < 0);
if (multiplier != 1) {
number *= multiplier; // depends on control dependency: [if], data = [none]
}
if (Double.isInfinite(number)) {
if (isNegative) {
append(result, negativePrefix, delegate,
getNegativePrefixFieldPositions(), Field.SIGN); // depends on control dependency: [if], data = [none]
} else {
append(result, positivePrefix, delegate,
getPositivePrefixFieldPositions(), Field.SIGN); // depends on control dependency: [if], data = [none]
}
int iFieldStart = result.length();
result.append(symbols.getInfinity()); // depends on control dependency: [if], data = [none]
delegate.formatted(INTEGER_FIELD, Field.INTEGER, Field.INTEGER,
iFieldStart, result.length(), result); // depends on control dependency: [if], data = [none]
if (isNegative) {
append(result, negativeSuffix, delegate,
getNegativeSuffixFieldPositions(), Field.SIGN); // depends on control dependency: [if], data = [none]
} else {
append(result, positiveSuffix, delegate,
getPositiveSuffixFieldPositions(), Field.SIGN); // depends on control dependency: [if], data = [none]
}
return result; // depends on control dependency: [if], data = [none]
}
if (isNegative) {
number = -number; // depends on control dependency: [if], data = [none]
}
// at this point we are guaranteed a nonnegative finite number.
assert(number >= 0 && !Double.isInfinite(number));
synchronized(digitList) {
int maxIntDigits = super.getMaximumIntegerDigits();
int minIntDigits = super.getMinimumIntegerDigits();
int maxFraDigits = super.getMaximumFractionDigits();
int minFraDigits = super.getMinimumFractionDigits();
digitList.set(isNegative, number, useExponentialNotation ?
maxIntDigits + maxFraDigits : maxFraDigits,
!useExponentialNotation);
return subformat(result, delegate, isNegative, false,
maxIntDigits, minIntDigits, maxFraDigits, minFraDigits);
}
} } |
public class class_name {
public static Object convertNumberToWrapper(Number num, Class<?> wrapper) {
//XXX Paul: Using valueOf will reduce object creation
if (wrapper.equals(String.class)) {
return num.toString();
} else if (wrapper.equals(Boolean.class)) {
return Boolean.valueOf(num.intValue() == 1);
} else if (wrapper.equals(Double.class)) {
return Double.valueOf(num.doubleValue());
} else if (wrapper.equals(Long.class)) {
return Long.valueOf(num.longValue());
} else if (wrapper.equals(Float.class)) {
return Float.valueOf(num.floatValue());
} else if (wrapper.equals(Integer.class)) {
return Integer.valueOf(num.intValue());
} else if (wrapper.equals(Short.class)) {
return Short.valueOf(num.shortValue());
} else if (wrapper.equals(Byte.class)) {
return Byte.valueOf(num.byteValue());
}
throw new ConversionException(String.format("Unable to convert number to: %s", wrapper));
} } | public class class_name {
public static Object convertNumberToWrapper(Number num, Class<?> wrapper) {
//XXX Paul: Using valueOf will reduce object creation
if (wrapper.equals(String.class)) {
return num.toString();
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Boolean.class)) {
return Boolean.valueOf(num.intValue() == 1);
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Double.class)) {
return Double.valueOf(num.doubleValue());
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Long.class)) {
return Long.valueOf(num.longValue());
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Float.class)) {
return Float.valueOf(num.floatValue());
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Integer.class)) {
return Integer.valueOf(num.intValue());
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Short.class)) {
return Short.valueOf(num.shortValue());
// depends on control dependency: [if], data = [none]
} else if (wrapper.equals(Byte.class)) {
return Byte.valueOf(num.byteValue());
// depends on control dependency: [if], data = [none]
}
throw new ConversionException(String.format("Unable to convert number to: %s", wrapper));
} } |
public class class_name {
public void setVolumeARNs(java.util.Collection<String> volumeARNs) {
if (volumeARNs == null) {
this.volumeARNs = null;
return;
}
this.volumeARNs = new com.amazonaws.internal.SdkInternalList<String>(volumeARNs);
} } | public class class_name {
public void setVolumeARNs(java.util.Collection<String> volumeARNs) {
if (volumeARNs == null) {
this.volumeARNs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.volumeARNs = new com.amazonaws.internal.SdkInternalList<String>(volumeARNs);
} } |
public class class_name {
@Override
public String getReasonPhrase() {
if (null == this.myReason) {
this.myReason = GenericUtils.getEnglishString(getReasonPhraseBytes());
}
return this.myReason;
} } | public class class_name {
@Override
public String getReasonPhrase() {
if (null == this.myReason) {
this.myReason = GenericUtils.getEnglishString(getReasonPhraseBytes()); // depends on control dependency: [if], data = [none]
}
return this.myReason;
} } |
public class class_name {
public static ImageDescriptor createImageDescriptor(Bundle bundle,
IPath path, boolean useMissingImageDescriptor)
{
URL url = FileLocator.find(bundle, path, null);
if (url != null)
{
return ImageDescriptor.createFromURL(url);
}
if (useMissingImageDescriptor)
{
return ImageDescriptor.getMissingImageDescriptor();
}
return null;
} } | public class class_name {
public static ImageDescriptor createImageDescriptor(Bundle bundle,
IPath path, boolean useMissingImageDescriptor)
{
URL url = FileLocator.find(bundle, path, null);
if (url != null)
{
return ImageDescriptor.createFromURL(url); // depends on control dependency: [if], data = [(url]
}
if (useMissingImageDescriptor)
{
return ImageDescriptor.getMissingImageDescriptor(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static <T extends ImageGray<T>>
void rgbToYuv(Planar<T> rgb , Planar<T> yuv) {
yuv.reshape(rgb.width,rgb.height,3);
if( rgb.getBandType() == GrayF32.class ) {
if (BoofConcurrency.USE_CONCURRENT) {
ImplColorYuv_MT.rgbToYuv_F32((Planar<GrayF32>) rgb, (Planar<GrayF32>) yuv);
} else {
ImplColorYuv.rgbToYuv_F32((Planar<GrayF32>) rgb, (Planar<GrayF32>) yuv);
}
} else {
throw new IllegalArgumentException("Unsupported band type "+rgb.getBandType().getSimpleName());
}
} } | public class class_name {
public static <T extends ImageGray<T>>
void rgbToYuv(Planar<T> rgb , Planar<T> yuv) {
yuv.reshape(rgb.width,rgb.height,3);
if( rgb.getBandType() == GrayF32.class ) {
if (BoofConcurrency.USE_CONCURRENT) {
ImplColorYuv_MT.rgbToYuv_F32((Planar<GrayF32>) rgb, (Planar<GrayF32>) yuv); // depends on control dependency: [if], data = [none]
} else {
ImplColorYuv.rgbToYuv_F32((Planar<GrayF32>) rgb, (Planar<GrayF32>) yuv); // depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalArgumentException("Unsupported band type "+rgb.getBandType().getSimpleName());
}
} } |
public class class_name {
protected List<SnakGroup> getQualifierGroups() {
ArrayList<SnakGroup> result = new ArrayList<>(this.qualifiers.size());
for (ArrayList<Snak> statementList : this.qualifiers.values()) {
result.add(factory.getSnakGroup(statementList));
}
return result;
} } | public class class_name {
protected List<SnakGroup> getQualifierGroups() {
ArrayList<SnakGroup> result = new ArrayList<>(this.qualifiers.size());
for (ArrayList<Snak> statementList : this.qualifiers.values()) {
result.add(factory.getSnakGroup(statementList)); // depends on control dependency: [for], data = [statementList]
}
return result;
} } |
public class class_name {
private boolean masterExists() {
String webPort = mAlluxioConf.get(PropertyKey.MASTER_WEB_PORT);
try {
URL myURL = new URL("http://" + mMasterAddress + ":" + webPort + Constants.REST_API_PREFIX + "/master/version");
LOG.debug("Checking for master at: " + myURL.toString());
HttpURLConnection connection = (HttpURLConnection) myURL.openConnection();
connection.setRequestMethod(HttpMethod.GET);
int resCode = connection.getResponseCode();
LOG.debug("Response code from master was: " + Integer.toString(resCode));
connection.disconnect();
return resCode == HttpURLConnection.HTTP_OK;
} catch (MalformedURLException e) {
LOG.error("Malformed URL in attempt to check if master is running already", e);
} catch (IOException e) {
LOG.debug("No existing master found", e);
}
return false;
} } | public class class_name {
private boolean masterExists() {
String webPort = mAlluxioConf.get(PropertyKey.MASTER_WEB_PORT);
try {
URL myURL = new URL("http://" + mMasterAddress + ":" + webPort + Constants.REST_API_PREFIX + "/master/version");
LOG.debug("Checking for master at: " + myURL.toString());
HttpURLConnection connection = (HttpURLConnection) myURL.openConnection();
connection.setRequestMethod(HttpMethod.GET); // depends on control dependency: [try], data = [none]
int resCode = connection.getResponseCode();
LOG.debug("Response code from master was: " + Integer.toString(resCode)); // depends on control dependency: [try], data = [none]
connection.disconnect(); // depends on control dependency: [try], data = [none]
return resCode == HttpURLConnection.HTTP_OK; // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
LOG.error("Malformed URL in attempt to check if master is running already", e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
LOG.debug("No existing master found", e);
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
public void enableMultiTenancyFilter() {
Serializable currentId = Tenants.currentId(this);
if(ConnectionSource.DEFAULT.equals(currentId)) {
disableMultiTenancyFilter();
}
else {
getHibernateTemplate()
.getSessionFactory()
.getCurrentSession()
.enableFilter(GormProperties.TENANT_IDENTITY)
.setParameter(GormProperties.TENANT_IDENTITY, currentId);
}
} } | public class class_name {
public void enableMultiTenancyFilter() {
Serializable currentId = Tenants.currentId(this);
if(ConnectionSource.DEFAULT.equals(currentId)) {
disableMultiTenancyFilter(); // depends on control dependency: [if], data = [none]
}
else {
getHibernateTemplate()
.getSessionFactory()
.getCurrentSession()
.enableFilter(GormProperties.TENANT_IDENTITY)
.setParameter(GormProperties.TENANT_IDENTITY, currentId); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static void initialiseOutbound(Node n, long baseTime, CommunicationDetails cd,
StringBuilder nodeId) {
CommunicationDetails.Outbound ob = new CommunicationDetails.Outbound();
ob.getLinkIds().add(nodeId.toString());
ob.setMultiConsumer(true);
ob.setProducerOffset(n.getTimestamp() - baseTime);
cd.getOutbound().add(ob);
if (n.getClass() == Producer.class) {
ob = new CommunicationDetails.Outbound();
for (int j = 0; j < n.getCorrelationIds().size(); j++) {
CorrelationIdentifier ci = n.getCorrelationIds().get(j);
if (ci.getScope() == Scope.Interaction || ci.getScope() == Scope.ControlFlow) {
ob.getLinkIds().add(ci.getValue());
}
}
// Only record if outbound ids found
if (!ob.getLinkIds().isEmpty()) {
// Check if pub/sub
ob.setMultiConsumer(((Producer) n).multipleConsumers());
ob.setProducerOffset(n.getTimestamp() - baseTime);
cd.getOutbound().add(ob);
}
} else if (n.containerNode()) {
for (int i = 0; i < ((ContainerNode)n).getNodes().size(); i++) {
int len = nodeId.length();
nodeId.append(':');
nodeId.append(i);
initialiseOutbound(((ContainerNode) n).getNodes().get(i), baseTime, cd, nodeId);
// Remove this child's specific path, so that next iteration will add a different path number
nodeId.delete(len, nodeId.length());
}
}
} } | public class class_name {
protected static void initialiseOutbound(Node n, long baseTime, CommunicationDetails cd,
StringBuilder nodeId) {
CommunicationDetails.Outbound ob = new CommunicationDetails.Outbound();
ob.getLinkIds().add(nodeId.toString());
ob.setMultiConsumer(true);
ob.setProducerOffset(n.getTimestamp() - baseTime);
cd.getOutbound().add(ob);
if (n.getClass() == Producer.class) {
ob = new CommunicationDetails.Outbound(); // depends on control dependency: [if], data = [none]
for (int j = 0; j < n.getCorrelationIds().size(); j++) {
CorrelationIdentifier ci = n.getCorrelationIds().get(j);
if (ci.getScope() == Scope.Interaction || ci.getScope() == Scope.ControlFlow) {
ob.getLinkIds().add(ci.getValue()); // depends on control dependency: [if], data = [none]
}
}
// Only record if outbound ids found
if (!ob.getLinkIds().isEmpty()) {
// Check if pub/sub
ob.setMultiConsumer(((Producer) n).multipleConsumers()); // depends on control dependency: [if], data = [none]
ob.setProducerOffset(n.getTimestamp() - baseTime); // depends on control dependency: [if], data = [none]
cd.getOutbound().add(ob); // depends on control dependency: [if], data = [none]
}
} else if (n.containerNode()) {
for (int i = 0; i < ((ContainerNode)n).getNodes().size(); i++) {
int len = nodeId.length();
nodeId.append(':'); // depends on control dependency: [for], data = [none]
nodeId.append(i); // depends on control dependency: [for], data = [i]
initialiseOutbound(((ContainerNode) n).getNodes().get(i), baseTime, cd, nodeId); // depends on control dependency: [for], data = [i]
// Remove this child's specific path, so that next iteration will add a different path number
nodeId.delete(len, nodeId.length()); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void marshall(FindingFilter findingFilter, ProtocolMarshaller protocolMarshaller) {
if (findingFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(findingFilter.getAgentIds(), AGENTIDS_BINDING);
protocolMarshaller.marshall(findingFilter.getAutoScalingGroups(), AUTOSCALINGGROUPS_BINDING);
protocolMarshaller.marshall(findingFilter.getRuleNames(), RULENAMES_BINDING);
protocolMarshaller.marshall(findingFilter.getSeverities(), SEVERITIES_BINDING);
protocolMarshaller.marshall(findingFilter.getRulesPackageArns(), RULESPACKAGEARNS_BINDING);
protocolMarshaller.marshall(findingFilter.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(findingFilter.getUserAttributes(), USERATTRIBUTES_BINDING);
protocolMarshaller.marshall(findingFilter.getCreationTimeRange(), CREATIONTIMERANGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(FindingFilter findingFilter, ProtocolMarshaller protocolMarshaller) {
if (findingFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(findingFilter.getAgentIds(), AGENTIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getAutoScalingGroups(), AUTOSCALINGGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getRuleNames(), RULENAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getSeverities(), SEVERITIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getRulesPackageArns(), RULESPACKAGEARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getUserAttributes(), USERATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(findingFilter.getCreationTimeRange(), CREATIONTIMERANGE_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 {
protected <S,T> void registerBindingConfigurationEntry(BindingConfigurationEntry theBinding) {
/*
* BindingConfigurationEntry has two possible configurations:
*
* bindingClass with an optional qualifier (this defaults to DefaultBinding)
*
* OR
*
* sourceClass and
* targetClass and
* optional qualifier (defaults to DefaultBinding)
* with at least one of either
* toMethod and/or
* fromMethod and/or
* fromConstructor
*
* Depending on which components are populated the entry is interpreted differently.
*/
if (Binding.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the Binding interface then register it.
* When the binding class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
Binding<S,T> binding = (Binding<S,T>)theBinding.getBindingClass().newInstance();
registerBinding(binding.getBoundClass(), binding.getTargetClass(), binding, theBinding.getQualifier());
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
} else if (FromUnmarshaller.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the FromUnmarshaller interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
FromUnmarshaller<S,T> fromUnmarshaller = (FromUnmarshaller<S,T>)theBinding.getBindingClass().newInstance();
registerUnmarshaller(fromUnmarshaller.getBoundClass(), fromUnmarshaller.getTargetClass(), fromUnmarshaller, theBinding.getQualifier());
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
} else if (ToMarshaller.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the ToMarshaller interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
ToMarshaller<S,T> toMarshaller = (ToMarshaller<S,T>)theBinding.getBindingClass().newInstance();
registerMarshaller(toMarshaller.getBoundClass(), toMarshaller.getTargetClass(), toMarshaller, theBinding.getQualifier());
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
} else if (Converter.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the Converter interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
Converter<S,T> converter = (Converter<S,T>)theBinding.getBindingClass().newInstance();
registerConverter(converter.getInputClass(), converter.getOutputClass(), converter, theBinding.getQualifier());
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
} else if (theBinding.getBindingClass() != null) {
/*
* If only the binding class is supplied, then inspect it for bindings, gathering all bindings identified
*/
registerAnnotatedClasses(theBinding.getBindingClass());
} else {
/*
* Register the binding using the explicit method details provided
*/
@SuppressWarnings("unchecked")
ConverterKey<S,T> converterKey = new ConverterKey<S,T>((Class<S>)theBinding.getSourceClass(), (Class<T>)theBinding.getTargetClass(), theBinding.getQualifier());
@SuppressWarnings("unchecked")
Constructor<S> fromConstructor = (Constructor<S>)theBinding.getFromConstructor();
registerForMethods(converterKey, theBinding.getToMethod(), theBinding.getFromMethod(), fromConstructor);
}
} } | public class class_name {
protected <S,T> void registerBindingConfigurationEntry(BindingConfigurationEntry theBinding) {
/*
* BindingConfigurationEntry has two possible configurations:
*
* bindingClass with an optional qualifier (this defaults to DefaultBinding)
*
* OR
*
* sourceClass and
* targetClass and
* optional qualifier (defaults to DefaultBinding)
* with at least one of either
* toMethod and/or
* fromMethod and/or
* fromConstructor
*
* Depending on which components are populated the entry is interpreted differently.
*/
if (Binding.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the Binding interface then register it.
* When the binding class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
Binding<S,T> binding = (Binding<S,T>)theBinding.getBindingClass().newInstance();
registerBinding(binding.getBoundClass(), binding.getTargetClass(), binding, theBinding.getQualifier());
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
// depends on control dependency: [catch], data = [none]
} else if (FromUnmarshaller.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the FromUnmarshaller interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
FromUnmarshaller<S,T> fromUnmarshaller = (FromUnmarshaller<S,T>)theBinding.getBindingClass().newInstance();
registerUnmarshaller(fromUnmarshaller.getBoundClass(), fromUnmarshaller.getTargetClass(), fromUnmarshaller, theBinding.getQualifier());
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
// depends on control dependency: [catch], data = [none]
} else if (ToMarshaller.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the ToMarshaller interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
ToMarshaller<S,T> toMarshaller = (ToMarshaller<S,T>)theBinding.getBindingClass().newInstance();
registerMarshaller(toMarshaller.getBoundClass(), toMarshaller.getTargetClass(), toMarshaller, theBinding.getQualifier());
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
// depends on control dependency: [catch], data = [none]
} else if (Converter.class.isAssignableFrom(theBinding.getBindingClass())) {
/*
* If the binding class is an instance of the Converter interface then register it.
* When the class is an interface, you must define source and target class if they cannot be
* determined from introspecting the interface.
*
* You can optionally supply a qualifier so that the binding is associated with a qualifier
*/
try {
@SuppressWarnings("unchecked")
Converter<S,T> converter = (Converter<S,T>)theBinding.getBindingClass().newInstance();
registerConverter(converter.getInputClass(), converter.getOutputClass(), converter, theBinding.getQualifier());
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw new IllegalStateException("Cannot instantiate binding class: " + theBinding.getBindingClass().getName());
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Cannot access binding class: " + theBinding.getBindingClass().getName());
}
// depends on control dependency: [catch], data = [none]
} else if (theBinding.getBindingClass() != null) {
/*
* If only the binding class is supplied, then inspect it for bindings, gathering all bindings identified
*/
registerAnnotatedClasses(theBinding.getBindingClass());
// depends on control dependency: [if], data = [(theBinding.getBindingClass()]
} else {
/*
* Register the binding using the explicit method details provided
*/
@SuppressWarnings("unchecked")
ConverterKey<S,T> converterKey = new ConverterKey<S,T>((Class<S>)theBinding.getSourceClass(), (Class<T>)theBinding.getTargetClass(), theBinding.getQualifier());
@SuppressWarnings("unchecked")
Constructor<S> fromConstructor = (Constructor<S>)theBinding.getFromConstructor();
registerForMethods(converterKey, theBinding.getToMethod(), theBinding.getFromMethod(), fromConstructor);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public CommerceUserSegmentCriterion remove(Serializable primaryKey)
throws NoSuchUserSegmentCriterionException {
Session session = null;
try {
session = openSession();
CommerceUserSegmentCriterion commerceUserSegmentCriterion = (CommerceUserSegmentCriterion)session.get(CommerceUserSegmentCriterionImpl.class,
primaryKey);
if (commerceUserSegmentCriterion == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchUserSegmentCriterionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceUserSegmentCriterion);
}
catch (NoSuchUserSegmentCriterionException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommerceUserSegmentCriterion remove(Serializable primaryKey)
throws NoSuchUserSegmentCriterionException {
Session session = null;
try {
session = openSession();
CommerceUserSegmentCriterion commerceUserSegmentCriterion = (CommerceUserSegmentCriterion)session.get(CommerceUserSegmentCriterionImpl.class,
primaryKey);
if (commerceUserSegmentCriterion == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchUserSegmentCriterionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceUserSegmentCriterion);
}
catch (NoSuchUserSegmentCriterionException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
public static String toHalfWidth(String input) {
char[] c = input.toCharArray();
for (int i = 0; i< c.length; i++) {
if (c[i] == 12288) {
c[i] = (char) 32;
continue;
}
if (c[i]> 65280&& c[i]< 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
} } | public class class_name {
public static String toHalfWidth(String input) {
char[] c = input.toCharArray();
for (int i = 0; i< c.length; i++) {
if (c[i] == 12288) {
c[i] = (char) 32; // depends on control dependency: [if], data = [none]
continue;
}
if (c[i]> 65280&& c[i]< 65375)
c[i] = (char) (c[i] - 65248);
}
return new String(c);
} } |
public class class_name {
public Reader getReader(InputStream in, String declaredEncoding) {
fDeclaredEncoding = declaredEncoding;
try {
setText(in);
CharsetMatch match = detect();
if (match == null) {
return null;
}
return match.getReader();
} catch (IOException e) {
return null;
}
} } | public class class_name {
public Reader getReader(InputStream in, String declaredEncoding) {
fDeclaredEncoding = declaredEncoding;
try {
setText(in); // depends on control dependency: [try], data = [none]
CharsetMatch match = detect();
if (match == null) {
return null; // depends on control dependency: [if], data = [none]
}
return match.getReader(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean columnExists(String tableName, String columnName) {
boolean exists = false;
Cursor cursor = rawQuery("PRAGMA table_info(" + CoreSQLUtils.quoteWrap(tableName) + ")", null);
try {
int nameIndex = cursor.getColumnIndex(NAME_COLUMN);
while (cursor.moveToNext()) {
String name = cursor.getString(nameIndex);
if (columnName.equals(name)) {
exists = true;
break;
}
}
} finally {
cursor.close();
}
return exists;
} } | public class class_name {
@Override
public boolean columnExists(String tableName, String columnName) {
boolean exists = false;
Cursor cursor = rawQuery("PRAGMA table_info(" + CoreSQLUtils.quoteWrap(tableName) + ")", null);
try {
int nameIndex = cursor.getColumnIndex(NAME_COLUMN);
while (cursor.moveToNext()) {
String name = cursor.getString(nameIndex);
if (columnName.equals(name)) {
exists = true; // depends on control dependency: [if], data = [none]
break;
}
}
} finally {
cursor.close();
}
return exists;
} } |
public class class_name {
public void deriveSrtcpKeys() {
// compute the session encryption key
byte label = 3;
computeIv(label);
KeyParameter encryptionKey = new KeyParameter(masterKey);
cipher.init(true, encryptionKey);
Arrays.fill(masterKey, (byte)0);
cipherCtr.getCipherStream(cipher, encKey, policy.getEncKeyLength(), ivStore);
if (authKey != null) {
label = 4;
computeIv(label);
cipherCtr.getCipherStream(cipher, authKey, policy.getAuthKeyLength(), ivStore);
switch ((policy.getAuthType())) {
case SRTPPolicy.HMACSHA1_AUTHENTICATION:
KeyParameter key = new KeyParameter(authKey);
mac.init(key);
break;
default:
break;
}
}
Arrays.fill(authKey, (byte)0);
// compute the session salt
label = 5;
computeIv(label);
cipherCtr.getCipherStream(cipher, saltKey, policy.getSaltKeyLength(), ivStore);
Arrays.fill(masterSalt, (byte)0);
// As last step: initialize cipher with derived encryption key.
if (cipherF8 != null) {
SRTPCipherF8.deriveForIV(cipherF8, encKey, saltKey);
}
encryptionKey = new KeyParameter(encKey);
cipher.init(true, encryptionKey);
Arrays.fill(encKey, (byte)0);
} } | public class class_name {
public void deriveSrtcpKeys() {
// compute the session encryption key
byte label = 3;
computeIv(label);
KeyParameter encryptionKey = new KeyParameter(masterKey);
cipher.init(true, encryptionKey);
Arrays.fill(masterKey, (byte)0);
cipherCtr.getCipherStream(cipher, encKey, policy.getEncKeyLength(), ivStore);
if (authKey != null) {
label = 4;
// depends on control dependency: [if], data = [none]
computeIv(label);
// depends on control dependency: [if], data = [none]
cipherCtr.getCipherStream(cipher, authKey, policy.getAuthKeyLength(), ivStore);
// depends on control dependency: [if], data = [none]
switch ((policy.getAuthType())) {
case SRTPPolicy.HMACSHA1_AUTHENTICATION:
KeyParameter key = new KeyParameter(authKey);
mac.init(key);
// depends on control dependency: [if], data = [none]
break;
default:
break;
}
}
Arrays.fill(authKey, (byte)0);
// compute the session salt
label = 5;
computeIv(label);
cipherCtr.getCipherStream(cipher, saltKey, policy.getSaltKeyLength(), ivStore);
Arrays.fill(masterSalt, (byte)0);
// As last step: initialize cipher with derived encryption key.
if (cipherF8 != null) {
SRTPCipherF8.deriveForIV(cipherF8, encKey, saltKey);
}
encryptionKey = new KeyParameter(encKey);
cipher.init(true, encryptionKey);
Arrays.fill(encKey, (byte)0);
} } |
public class class_name {
private List<Field> getFieldValuesForFormFromCache(
Long formIdParam,
List<FormFieldListing> listingReturnFieldValsPopulatedParam,
Form[] formsToFetchForLocalCacheArrParam){
if(formIdParam == null || formIdParam.longValue() < 1) {
return null;
}
if(listingReturnFieldValsPopulatedParam == null ||
listingReturnFieldValsPopulatedParam.isEmpty()) {
return null;
}
if(formsToFetchForLocalCacheArrParam == null ||
formsToFetchForLocalCacheArrParam.length == 0) {
return null;
}
for(Form formIter : formsToFetchForLocalCacheArrParam) {
//Form is a match...
if(formIdParam.equals(formIter.getId())) {
String echoToUse = formIter.getEcho();
for(FormFieldListing fieldListing : listingReturnFieldValsPopulatedParam) {
if(echoToUse.equals(fieldListing.getEcho())) {
return fieldListing.getListing();
}
}
}
}
return null;
} } | public class class_name {
private List<Field> getFieldValuesForFormFromCache(
Long formIdParam,
List<FormFieldListing> listingReturnFieldValsPopulatedParam,
Form[] formsToFetchForLocalCacheArrParam){
if(formIdParam == null || formIdParam.longValue() < 1) {
return null; // depends on control dependency: [if], data = [none]
}
if(listingReturnFieldValsPopulatedParam == null ||
listingReturnFieldValsPopulatedParam.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
if(formsToFetchForLocalCacheArrParam == null ||
formsToFetchForLocalCacheArrParam.length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
for(Form formIter : formsToFetchForLocalCacheArrParam) {
//Form is a match...
if(formIdParam.equals(formIter.getId())) {
String echoToUse = formIter.getEcho();
for(FormFieldListing fieldListing : listingReturnFieldValsPopulatedParam) {
if(echoToUse.equals(fieldListing.getEcho())) {
return fieldListing.getListing(); // depends on control dependency: [if], data = [none]
}
}
}
}
return null;
} } |
public class class_name {
public static void normalizeF( DMatrixRMaj A ) {
double val = normF(A);
if( val == 0 )
return;
int size = A.getNumElements();
for( int i = 0; i < size; i++) {
A.div(i , val);
}
} } | public class class_name {
public static void normalizeF( DMatrixRMaj A ) {
double val = normF(A);
if( val == 0 )
return;
int size = A.getNumElements();
for( int i = 0; i < size; i++) {
A.div(i , val); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private String getCompleteTokenInBuffer(Pattern pattern) {
matchValid = false;
// Skip delims first
matcher.usePattern(delimPattern);
if (!skipped) { // Enforcing only one skip of leading delims
matcher.region(position, buf.limit());
if (matcher.lookingAt()) {
// If more input could extend the delimiters then we must wait
// for more input
if (matcher.hitEnd() && !sourceClosed) {
needInput = true;
return null;
}
// The delims were whole and the matcher should skip them
skipped = true;
position = matcher.end();
}
}
// If we are sitting at the end, no more tokens in buffer
if (position == buf.limit()) {
if (sourceClosed)
return null;
needInput = true;
return null;
}
// Must look for next delims. Simply attempting to match the
// pattern at this point may find a match but it might not be
// the first longest match because of missing input, or it might
// match a partial token instead of the whole thing.
// Then look for next delims
matcher.region(position, buf.limit());
boolean foundNextDelim = matcher.find();
if (foundNextDelim && (matcher.end() == position)) {
// Zero length delimiter match; we should find the next one
// using the automatic advance past a zero length match;
// Otherwise we have just found the same one we just skipped
foundNextDelim = matcher.find();
}
if (foundNextDelim) {
// In the rare case that more input could cause the match
// to be lost and there is more input coming we must wait
// for more input. Note that hitting the end is okay as long
// as the match cannot go away. It is the beginning of the
// next delims we want to be sure about, we don't care if
// they potentially extend further.
if (matcher.requireEnd() && !sourceClosed) {
needInput = true;
return null;
}
int tokenEnd = matcher.start();
// There is a complete token.
if (pattern == null) {
// Must continue with match to provide valid MatchResult
pattern = FIND_ANY_PATTERN;
}
// Attempt to match against the desired pattern
matcher.usePattern(pattern);
matcher.region(position, tokenEnd);
if (matcher.matches()) {
String s = matcher.group();
position = matcher.end();
return s;
} else { // Complete token but it does not match
return null;
}
}
// If we can't find the next delims but no more input is coming,
// then we can treat the remainder as a whole token
if (sourceClosed) {
if (pattern == null) {
// Must continue with match to provide valid MatchResult
pattern = FIND_ANY_PATTERN;
}
// Last token; Match the pattern here or throw
matcher.usePattern(pattern);
matcher.region(position, buf.limit());
if (matcher.matches()) {
String s = matcher.group();
position = matcher.end();
return s;
}
// Last piece does not match
return null;
}
// There is a partial token in the buffer; must read more
// to complete it
needInput = true;
return null;
} } | public class class_name {
private String getCompleteTokenInBuffer(Pattern pattern) {
matchValid = false;
// Skip delims first
matcher.usePattern(delimPattern);
if (!skipped) { // Enforcing only one skip of leading delims
matcher.region(position, buf.limit()); // depends on control dependency: [if], data = [none]
if (matcher.lookingAt()) {
// If more input could extend the delimiters then we must wait
// for more input
if (matcher.hitEnd() && !sourceClosed) {
needInput = true; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// The delims were whole and the matcher should skip them
skipped = true; // depends on control dependency: [if], data = [none]
position = matcher.end(); // depends on control dependency: [if], data = [none]
}
}
// If we are sitting at the end, no more tokens in buffer
if (position == buf.limit()) {
if (sourceClosed)
return null;
needInput = true; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// Must look for next delims. Simply attempting to match the
// pattern at this point may find a match but it might not be
// the first longest match because of missing input, or it might
// match a partial token instead of the whole thing.
// Then look for next delims
matcher.region(position, buf.limit());
boolean foundNextDelim = matcher.find();
if (foundNextDelim && (matcher.end() == position)) {
// Zero length delimiter match; we should find the next one
// using the automatic advance past a zero length match;
// Otherwise we have just found the same one we just skipped
foundNextDelim = matcher.find(); // depends on control dependency: [if], data = [none]
}
if (foundNextDelim) {
// In the rare case that more input could cause the match
// to be lost and there is more input coming we must wait
// for more input. Note that hitting the end is okay as long
// as the match cannot go away. It is the beginning of the
// next delims we want to be sure about, we don't care if
// they potentially extend further.
if (matcher.requireEnd() && !sourceClosed) {
needInput = true; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
int tokenEnd = matcher.start();
// There is a complete token.
if (pattern == null) {
// Must continue with match to provide valid MatchResult
pattern = FIND_ANY_PATTERN; // depends on control dependency: [if], data = [none]
}
// Attempt to match against the desired pattern
matcher.usePattern(pattern); // depends on control dependency: [if], data = [none]
matcher.region(position, tokenEnd); // depends on control dependency: [if], data = [none]
if (matcher.matches()) {
String s = matcher.group();
position = matcher.end(); // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
} else { // Complete token but it does not match
return null; // depends on control dependency: [if], data = [none]
}
}
// If we can't find the next delims but no more input is coming,
// then we can treat the remainder as a whole token
if (sourceClosed) {
if (pattern == null) {
// Must continue with match to provide valid MatchResult
pattern = FIND_ANY_PATTERN; // depends on control dependency: [if], data = [none]
}
// Last token; Match the pattern here or throw
matcher.usePattern(pattern); // depends on control dependency: [if], data = [none]
matcher.region(position, buf.limit()); // depends on control dependency: [if], data = [none]
if (matcher.matches()) {
String s = matcher.group();
position = matcher.end(); // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
// Last piece does not match
return null; // depends on control dependency: [if], data = [none]
}
// There is a partial token in the buffer; must read more
// to complete it
needInput = true;
return null;
} } |
public class class_name {
public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass());
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass());
}
throw ie;
}
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} } | public class class_name {
public final Object invokeInterceptor(Object bean, InvocationContext inv, Object[] interceptors) throws Exception {
// Interceptor instance is the bean instance itself if the
// interceptor index is < 0.
Object interceptorInstance = (ivBeanInterceptor) ? bean : interceptors[ivInterceptorIndex];
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d367572.7
{
Tr.debug(tc, "invoking " + this);
Tr.debug(tc, "interceptor instance = " + interceptorInstance);
}
// Does interceptor method require InvocationContext as an argument?
if (ivRequiresInvocationContext) {
try {
// Yes it does, so pass it as an argument.
Object[] args = new Object[] { inv }; // d404122
return ivInterceptorMethod.invoke(interceptorInstance, args); // d404122 // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException ie) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ivInterceptorMethod: " + ivInterceptorMethod.toString() + " class: " + ivInterceptorMethod.getClass() + " declaring class: "
+ ivInterceptorMethod.getDeclaringClass()); // depends on control dependency: [if], data = [none]
Tr.debug(tc, "interceptorInstance: " + interceptorInstance.toString() + " class: " + interceptorInstance.getClass()); // depends on control dependency: [if], data = [none]
}
throw ie;
} // depends on control dependency: [catch], data = [none]
} else {
// Nope, interceptor method takes no arguments.
return ivInterceptorMethod.invoke(interceptorInstance, NO_ARGS);
}
} } |
public class class_name {
public static String getSEIClassNameFromAnnotation(ClassInfo classInfo) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "SEI Name");
if (annotationInfo == null) {
return null;
}
boolean webServiceProviderAnnotation = isProvider(classInfo);
return webServiceProviderAnnotation ? null : annotationInfo.getValue(JaxWsConstants.ENDPOINTINTERFACE_ATTRIBUTE).getStringValue();
} } | public class class_name {
public static String getSEIClassNameFromAnnotation(ClassInfo classInfo) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "SEI Name");
if (annotationInfo == null) {
return null; // depends on control dependency: [if], data = [none]
}
boolean webServiceProviderAnnotation = isProvider(classInfo);
return webServiceProviderAnnotation ? null : annotationInfo.getValue(JaxWsConstants.ENDPOINTINTERFACE_ATTRIBUTE).getStringValue();
} } |
public class class_name {
public static void log(Logger logger,
Level level,
String message,
Throwable throwable,
Object parameter) {
if (logger.isLoggable(level)) {
final String formattedMessage =
MessageFormat.format(localize(logger, message), parameter);
doLog(logger, level, formattedMessage, throwable);
}
} } | public class class_name {
public static void log(Logger logger,
Level level,
String message,
Throwable throwable,
Object parameter) {
if (logger.isLoggable(level)) {
final String formattedMessage =
MessageFormat.format(localize(logger, message), parameter);
doLog(logger, level, formattedMessage, throwable); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public TRow getRow() {
TRow row = cursor.getRow();
if (row.hasId()) {
for (UserColumn column : blobColumns) {
readBlobValue(row, column);
}
}
return row;
} } | public class class_name {
@Override
public TRow getRow() {
TRow row = cursor.getRow();
if (row.hasId()) {
for (UserColumn column : blobColumns) {
readBlobValue(row, column); // depends on control dependency: [for], data = [column]
}
}
return row;
} } |
public class class_name {
public static String infoAll(AerospikeClient client, String cmd) {
Node[] nodes = client.getNodes();
StringBuilder results = new StringBuilder();
for (Node node : nodes) {
results.append(Info.request(node.getHost().name, node.getHost().port, cmd)).append("\n");
}
return results.toString();
} } | public class class_name {
public static String infoAll(AerospikeClient client, String cmd) {
Node[] nodes = client.getNodes();
StringBuilder results = new StringBuilder();
for (Node node : nodes) {
results.append(Info.request(node.getHost().name, node.getHost().port, cmd)).append("\n"); // depends on control dependency: [for], data = [node]
}
return results.toString();
} } |
public class class_name {
public static boolean isValidSignature(HttpServletRequest incoming, String secretKey) {
if (incoming == null || StringUtils.isBlank(secretKey)) {
return false;
}
String auth = incoming.getHeader(HttpHeaders.AUTHORIZATION);
String givenSig = StringUtils.substringAfter(auth, "Signature=");
String sigHeaders = StringUtils.substringBetween(auth, "SignedHeaders=", ",");
String credential = StringUtils.substringBetween(auth, "Credential=", ",");
String accessKey = StringUtils.substringBefore(credential, "/");
if (StringUtils.isBlank(auth)) {
givenSig = incoming.getParameter("X-Amz-Signature");
sigHeaders = incoming.getParameter("X-Amz-SignedHeaders");
credential = incoming.getParameter("X-Amz-Credential");
accessKey = StringUtils.substringBefore(credential, "/");
}
Set<String> headersUsed = new HashSet<>(Arrays.asList(sigHeaders.split(";")));
Map<String, String> headers = new HashMap<>();
for (Enumeration<String> e = incoming.getHeaderNames(); e.hasMoreElements();) {
String head = e.nextElement().toLowerCase();
if (headersUsed.contains(head)) {
headers.put(head, incoming.getHeader(head));
}
}
Map<String, String> params = new HashMap<>();
for (Map.Entry<String, String[]> param : incoming.getParameterMap().entrySet()) {
params.put(param.getKey(), param.getValue()[0]);
}
String path = incoming.getRequestURI();
String endpoint = StringUtils.removeEndIgnoreCase(incoming.getRequestURL().toString(), path);
String httpMethod = incoming.getMethod();
InputStream entity;
try {
entity = new BufferedRequestWrapper(incoming).getInputStream();
if (entity.available() <= 0) {
entity = null;
}
} catch (IOException ex) {
logger.error(null, ex);
entity = null;
}
Signer signer = new Signer();
Map<String, String> sig = signer.sign(httpMethod, endpoint, path, headers, params, entity, accessKey, secretKey);
String auth2 = sig.get(HttpHeaders.AUTHORIZATION);
String recreatedSig = StringUtils.substringAfter(auth2, "Signature=");
return StringUtils.equals(givenSig, recreatedSig);
} } | public class class_name {
public static boolean isValidSignature(HttpServletRequest incoming, String secretKey) {
if (incoming == null || StringUtils.isBlank(secretKey)) {
return false; // depends on control dependency: [if], data = [none]
}
String auth = incoming.getHeader(HttpHeaders.AUTHORIZATION);
String givenSig = StringUtils.substringAfter(auth, "Signature=");
String sigHeaders = StringUtils.substringBetween(auth, "SignedHeaders=", ",");
String credential = StringUtils.substringBetween(auth, "Credential=", ",");
String accessKey = StringUtils.substringBefore(credential, "/");
if (StringUtils.isBlank(auth)) {
givenSig = incoming.getParameter("X-Amz-Signature"); // depends on control dependency: [if], data = [none]
sigHeaders = incoming.getParameter("X-Amz-SignedHeaders"); // depends on control dependency: [if], data = [none]
credential = incoming.getParameter("X-Amz-Credential"); // depends on control dependency: [if], data = [none]
accessKey = StringUtils.substringBefore(credential, "/"); // depends on control dependency: [if], data = [none]
}
Set<String> headersUsed = new HashSet<>(Arrays.asList(sigHeaders.split(";")));
Map<String, String> headers = new HashMap<>();
for (Enumeration<String> e = incoming.getHeaderNames(); e.hasMoreElements();) {
String head = e.nextElement().toLowerCase();
if (headersUsed.contains(head)) {
headers.put(head, incoming.getHeader(head)); // depends on control dependency: [if], data = [none]
}
}
Map<String, String> params = new HashMap<>();
for (Map.Entry<String, String[]> param : incoming.getParameterMap().entrySet()) {
params.put(param.getKey(), param.getValue()[0]); // depends on control dependency: [for], data = [param]
}
String path = incoming.getRequestURI();
String endpoint = StringUtils.removeEndIgnoreCase(incoming.getRequestURL().toString(), path);
String httpMethod = incoming.getMethod();
InputStream entity;
try {
entity = new BufferedRequestWrapper(incoming).getInputStream(); // depends on control dependency: [try], data = [none]
if (entity.available() <= 0) {
entity = null; // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
logger.error(null, ex);
entity = null;
} // depends on control dependency: [catch], data = [none]
Signer signer = new Signer();
Map<String, String> sig = signer.sign(httpMethod, endpoint, path, headers, params, entity, accessKey, secretKey);
String auth2 = sig.get(HttpHeaders.AUTHORIZATION);
String recreatedSig = StringUtils.substringAfter(auth2, "Signature=");
return StringUtils.equals(givenSig, recreatedSig);
} } |
public class class_name {
private void process()
{
if (requestUri.length() > 1) {
parts = new ArrayList<String>(10);
for ( int i = 1; i < requestUri.length(); ) {
int sIdx = i;
int eIdx = requestUri.indexOf('/', sIdx + 1);
//not matched or reach the end
if ( eIdx == -1 ) {
parts.add(requestUri.substring(sIdx));
break;
}
parts.add(requestUri.substring(sIdx, eIdx));
i = eIdx + 1;
}
/*
* check and add a empty method name
* with request style like /tokenizer/
*/
if ( requestUri.charAt(requestUri.length()-1) == '/' ) {
parts.add("");
}
int length = parts.size();
if ( length > 1 ) {
IStringBuffer sb = new IStringBuffer();
for ( int i = 0; i < length - 1; i++ ) {
int l = sb.length();
sb.append(parts.get(i));
//make sure the first letter is uppercase
char chr = sb.charAt(l);
if ( chr >= 90 ) {
chr -= 32;
sb.set(l, chr);
}
}
controller = sb.toString();
}
method = parts.get(length-1);
}
} } | public class class_name {
private void process()
{
if (requestUri.length() > 1) {
parts = new ArrayList<String>(10); // depends on control dependency: [if], data = [none]
for ( int i = 1; i < requestUri.length(); ) {
int sIdx = i;
int eIdx = requestUri.indexOf('/', sIdx + 1);
//not matched or reach the end
if ( eIdx == -1 ) {
parts.add(requestUri.substring(sIdx)); // depends on control dependency: [if], data = [none]
break;
}
parts.add(requestUri.substring(sIdx, eIdx)); // depends on control dependency: [for], data = [none]
i = eIdx + 1; // depends on control dependency: [for], data = [i]
}
/*
* check and add a empty method name
* with request style like /tokenizer/
*/
if ( requestUri.charAt(requestUri.length()-1) == '/' ) {
parts.add(""); // depends on control dependency: [if], data = [none]
}
int length = parts.size();
if ( length > 1 ) {
IStringBuffer sb = new IStringBuffer();
for ( int i = 0; i < length - 1; i++ ) {
int l = sb.length();
sb.append(parts.get(i)); // depends on control dependency: [for], data = [i]
//make sure the first letter is uppercase
char chr = sb.charAt(l);
if ( chr >= 90 ) {
chr -= 32; // depends on control dependency: [if], data = [none]
sb.set(l, chr); // depends on control dependency: [if], data = [none]
}
}
controller = sb.toString(); // depends on control dependency: [if], data = [none]
}
method = parts.get(length-1); // depends on control dependency: [if], data = [1)]
}
} } |
public class class_name {
public static FeaturableConfig imports(Xml root)
{
Check.notNull(root);
final String clazz;
if (root.hasChild(ATT_CLASS))
{
clazz = root.getChild(ATT_CLASS).getText();
}
else
{
clazz = DEFAULT_CLASS_NAME;
}
final String setup;
if (root.hasChild(ATT_SETUP))
{
setup = root.getChild(ATT_SETUP).getText();
}
else
{
setup = Constant.EMPTY_STRING;
}
return new FeaturableConfig(clazz, setup);
} } | public class class_name {
public static FeaturableConfig imports(Xml root)
{
Check.notNull(root);
final String clazz;
if (root.hasChild(ATT_CLASS))
{
clazz = root.getChild(ATT_CLASS).getText(); // depends on control dependency: [if], data = [none]
}
else
{
clazz = DEFAULT_CLASS_NAME; // depends on control dependency: [if], data = [none]
}
final String setup;
if (root.hasChild(ATT_SETUP))
{
setup = root.getChild(ATT_SETUP).getText(); // depends on control dependency: [if], data = [none]
}
else
{
setup = Constant.EMPTY_STRING; // depends on control dependency: [if], data = [none]
}
return new FeaturableConfig(clazz, setup);
} } |
public class class_name {
public Structure getStructureForPdbId(String pdbId) throws IOException, StructureException {
if(pdbId == null)
return null;
if(pdbId.length() != 4) {
throw new StructureException("Unrecognized PDB ID: "+pdbId);
}
while (checkLoading(pdbId)) {
// waiting for loading to be finished...
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.error(e.getMessage());
}
}
Structure s;
if (useMmtf) {
logger.debug("loading from mmtf");
s = loadStructureFromMmtfByPdbId(pdbId);
}
else if (useMmCif) {
logger.debug("loading from mmcif");
s = loadStructureFromCifByPdbId(pdbId);
} else {
logger.debug("loading from pdb");
s = loadStructureFromPdbByPdbId(pdbId);
}
return s;
} } | public class class_name {
public Structure getStructureForPdbId(String pdbId) throws IOException, StructureException {
if(pdbId == null)
return null;
if(pdbId.length() != 4) {
throw new StructureException("Unrecognized PDB ID: "+pdbId);
}
while (checkLoading(pdbId)) {
// waiting for loading to be finished...
try {
Thread.sleep(100); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
logger.error(e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
Structure s;
if (useMmtf) {
logger.debug("loading from mmtf");
s = loadStructureFromMmtfByPdbId(pdbId);
}
else if (useMmCif) {
logger.debug("loading from mmcif");
s = loadStructureFromCifByPdbId(pdbId);
} else {
logger.debug("loading from pdb");
s = loadStructureFromPdbByPdbId(pdbId);
}
return s;
} } |
public class class_name {
public static String[] split(String input, char delimiter){
if(input == null) throw new NullPointerException("input cannot be null");
final int len = input.length();
// find the number of strings to split into
int nSplits = 1;
for (int i = 0; i < len; i++) {
if (input.charAt(i) == delimiter) {
nSplits++;
}
}
// do the actual splitting
String[] result = new String[nSplits];
int lastMark = 0;
int lastSplit = 0;
for (int i = 0; i < len; i++) {
if (input.charAt(i) == delimiter) {
result[lastSplit] = input.substring(lastMark, i);
lastSplit++;
lastMark = i + 1;// 1 == delimiter length
}
}
result[lastSplit] = input.substring(lastMark, len);
return result;
} } | public class class_name {
public static String[] split(String input, char delimiter){
if(input == null) throw new NullPointerException("input cannot be null");
final int len = input.length();
// find the number of strings to split into
int nSplits = 1;
for (int i = 0; i < len; i++) {
if (input.charAt(i) == delimiter) {
nSplits++; // depends on control dependency: [if], data = [none]
}
}
// do the actual splitting
String[] result = new String[nSplits];
int lastMark = 0;
int lastSplit = 0;
for (int i = 0; i < len; i++) {
if (input.charAt(i) == delimiter) {
result[lastSplit] = input.substring(lastMark, i); // depends on control dependency: [if], data = [none]
lastSplit++; // depends on control dependency: [if], data = [none]
lastMark = i + 1;// 1 == delimiter length // depends on control dependency: [if], data = [none]
}
}
result[lastSplit] = input.substring(lastMark, len);
return result;
} } |
public class class_name {
public synchronized MessageResourceBundle getBundle() {
if (isModified()) {
bundle = createBundle(file);
}
if (parent != null) {
bundle.setParent(parent.getBundle());
}
return bundle;
} } | public class class_name {
public synchronized MessageResourceBundle getBundle() {
if (isModified()) {
bundle = createBundle(file); // depends on control dependency: [if], data = [none]
}
if (parent != null) {
bundle.setParent(parent.getBundle()); // depends on control dependency: [if], data = [(parent]
}
return bundle;
} } |
public class class_name {
protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
// Notify the listeners on the lifecycle events inside
// the just spawned agent.
// Usually, only BICs and the AgentLifeCycleSupport in
// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
// is invoked.
final ListenerCollection<SpawnServiceListener> list;
synchronized (this.agentLifecycleListeners) {
list = this.agentLifecycleListeners.get(agent.getID());
}
if (list != null) {
final List<Agent> singleton = Collections.singletonList(agent);
for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
l.agentSpawned(spawningAgent, context, singleton, initializationParameters);
}
}
} } | public class class_name {
protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
// Notify the listeners on the lifecycle events inside
// the just spawned agent.
// Usually, only BICs and the AgentLifeCycleSupport in
// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
// is invoked.
final ListenerCollection<SpawnServiceListener> list;
synchronized (this.agentLifecycleListeners) {
list = this.agentLifecycleListeners.get(agent.getID());
}
if (list != null) {
final List<Agent> singleton = Collections.singletonList(agent);
for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
l.agentSpawned(spawningAgent, context, singleton, initializationParameters); // depends on control dependency: [for], data = [l]
}
}
} } |
public class class_name {
public String[] buildColumnsAs(String[] columns, String value) {
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value;
}
return buildColumnsAs(columns, values);
} } | public class class_name {
public String[] buildColumnsAs(String[] columns, String value) {
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value; // depends on control dependency: [for], data = [i]
}
return buildColumnsAs(columns, values);
} } |
public class class_name {
public static JSLJob buildPartitionLevelJSLJob(long topLevelJobExecutionId, Properties jobProperties, Step step, int partitionInstance) {
ObjectFactory jslFactory = new ObjectFactory();
JSLJob subJob = jslFactory.createJSLJob();
// Uses the top-level job execution id. Note the RI used to use the INSTANCE id, so this is
// a big change.
String subJobId = generateSubJobId(topLevelJobExecutionId, step.getId(), partitionInstance);
subJob.setId(subJobId);
//Copy all job properties (from parent JobContext) to partitioned step threads
subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobProperties));
// Add one step to job
Step newStep = jslFactory.createStep();
//set id
newStep.setId(step.getId());
/***
* deep copy all fields in a step
*/
// Not used at partition level
//newStep.setAllowStartIfComplete(step.getAllowStartIfComplete());
if (step.getBatchlet() != null){
newStep.setBatchlet(CloneUtility.cloneBatchlet(step.getBatchlet()));
}
if (step.getChunk() != null) {
newStep.setChunk(CloneUtility.cloneChunk(step.getChunk()));
}
// Do not copy next attribute and control elements. Transitioning should ONLY
// take place on the main thread.
//Do not add step listeners, only call them on parent thread.
//Add partition artifacts and set instances to 1 as the base case
Partition partition = step.getPartition();
if (partition != null) {
if (partition.getCollector() != null) {
Partition basePartition = jslFactory.createPartition();
PartitionPlan partitionPlan = jslFactory.createPartitionPlan();
partitionPlan.setPartitions(null);
basePartition.setPlan(partitionPlan);
basePartition.setCollector(partition.getCollector());
newStep.setPartition(basePartition);
}
}
// Not used at partition level
//newStep.setStartLimit(step.getStartLimit());
newStep.setProperties(CloneUtility.cloneJSLProperties(step.getProperties()));
// Don't try to only clone based on type (e.g. ChunkListener vs. StepListener).
// We don't know the type at the model level, and a given artifact could implement more
// than one listener interface (e.g. ChunkListener AND StepListener).
newStep.setListeners(CloneUtility.cloneListeners(step.getListeners()));
//Add Step properties, need to be careful here to remember the right precedence
subJob.getExecutionElements().add(newStep);
return subJob;
} } | public class class_name {
public static JSLJob buildPartitionLevelJSLJob(long topLevelJobExecutionId, Properties jobProperties, Step step, int partitionInstance) {
ObjectFactory jslFactory = new ObjectFactory();
JSLJob subJob = jslFactory.createJSLJob();
// Uses the top-level job execution id. Note the RI used to use the INSTANCE id, so this is
// a big change.
String subJobId = generateSubJobId(topLevelJobExecutionId, step.getId(), partitionInstance);
subJob.setId(subJobId);
//Copy all job properties (from parent JobContext) to partitioned step threads
subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobProperties));
// Add one step to job
Step newStep = jslFactory.createStep();
//set id
newStep.setId(step.getId());
/***
* deep copy all fields in a step
*/
// Not used at partition level
//newStep.setAllowStartIfComplete(step.getAllowStartIfComplete());
if (step.getBatchlet() != null){
newStep.setBatchlet(CloneUtility.cloneBatchlet(step.getBatchlet())); // depends on control dependency: [if], data = [(step.getBatchlet()]
}
if (step.getChunk() != null) {
newStep.setChunk(CloneUtility.cloneChunk(step.getChunk())); // depends on control dependency: [if], data = [(step.getChunk()]
}
// Do not copy next attribute and control elements. Transitioning should ONLY
// take place on the main thread.
//Do not add step listeners, only call them on parent thread.
//Add partition artifacts and set instances to 1 as the base case
Partition partition = step.getPartition();
if (partition != null) {
if (partition.getCollector() != null) {
Partition basePartition = jslFactory.createPartition();
PartitionPlan partitionPlan = jslFactory.createPartitionPlan();
partitionPlan.setPartitions(null); // depends on control dependency: [if], data = [null)]
basePartition.setPlan(partitionPlan); // depends on control dependency: [if], data = [none]
basePartition.setCollector(partition.getCollector()); // depends on control dependency: [if], data = [(partition.getCollector()]
newStep.setPartition(basePartition); // depends on control dependency: [if], data = [none]
}
}
// Not used at partition level
//newStep.setStartLimit(step.getStartLimit());
newStep.setProperties(CloneUtility.cloneJSLProperties(step.getProperties()));
// Don't try to only clone based on type (e.g. ChunkListener vs. StepListener).
// We don't know the type at the model level, and a given artifact could implement more
// than one listener interface (e.g. ChunkListener AND StepListener).
newStep.setListeners(CloneUtility.cloneListeners(step.getListeners()));
//Add Step properties, need to be careful here to remember the right precedence
subJob.getExecutionElements().add(newStep);
return subJob;
} } |
public class class_name {
protected static int binarySearchGuessUnsafe(@NotNull final BasePage page, @NotNull final ByteIterable key) {
int index = page.binarySearch(key);
if (index < 0) {
index = -index - 2;
}
return index;
} } | public class class_name {
protected static int binarySearchGuessUnsafe(@NotNull final BasePage page, @NotNull final ByteIterable key) {
int index = page.binarySearch(key);
if (index < 0) {
index = -index - 2; // depends on control dependency: [if], data = [none]
}
return index;
} } |
public class class_name {
private String fullyQualifiedRegistrationDomain() {
if (job.getRegistrationDomain().endsWith(".")) {
return job.getRegistrationDomain();
} else if ("".equals(job.getRegistrationDomain())) {
return defaultRegistrationDomain;
} else {
return job.getRegistrationDomain() + "." + defaultRegistrationDomain;
}
} } | public class class_name {
private String fullyQualifiedRegistrationDomain() {
if (job.getRegistrationDomain().endsWith(".")) {
return job.getRegistrationDomain(); // depends on control dependency: [if], data = [none]
} else if ("".equals(job.getRegistrationDomain())) {
return defaultRegistrationDomain; // depends on control dependency: [if], data = [none]
} else {
return job.getRegistrationDomain() + "." + defaultRegistrationDomain; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DependencyInfo getDependencyInfo(final String sourceRelativeName, final String includePathIdentifier) {
DependencyInfo dependInfo = null;
final DependencyInfo[] dependInfos = (DependencyInfo[]) this.dependencies.get(sourceRelativeName);
if (dependInfos != null) {
for (final DependencyInfo dependInfo2 : dependInfos) {
dependInfo = dependInfo2;
if (dependInfo.getIncludePathIdentifier().equals(includePathIdentifier)) {
return dependInfo;
}
}
}
return null;
} } | public class class_name {
public DependencyInfo getDependencyInfo(final String sourceRelativeName, final String includePathIdentifier) {
DependencyInfo dependInfo = null;
final DependencyInfo[] dependInfos = (DependencyInfo[]) this.dependencies.get(sourceRelativeName);
if (dependInfos != null) {
for (final DependencyInfo dependInfo2 : dependInfos) {
dependInfo = dependInfo2; // depends on control dependency: [for], data = [dependInfo2]
if (dependInfo.getIncludePathIdentifier().equals(includePathIdentifier)) {
return dependInfo; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static DateInterval from(ChronoInterval<PlainDate> interval) {
if (interval instanceof DateInterval) {
return DateInterval.class.cast(interval);
} else {
return new DateInterval(interval.getStart(), interval.getEnd());
}
} } | public class class_name {
public static DateInterval from(ChronoInterval<PlainDate> interval) {
if (interval instanceof DateInterval) {
return DateInterval.class.cast(interval); // depends on control dependency: [if], data = [none]
} else {
return new DateInterval(interval.getStart(), interval.getEnd()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setGeneratorId(java.util.Collection<StringFilter> generatorId) {
if (generatorId == null) {
this.generatorId = null;
return;
}
this.generatorId = new java.util.ArrayList<StringFilter>(generatorId);
} } | public class class_name {
public void setGeneratorId(java.util.Collection<StringFilter> generatorId) {
if (generatorId == null) {
this.generatorId = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.generatorId = new java.util.ArrayList<StringFilter>(generatorId);
} } |
public class class_name {
public PartnerLogData getEntry(int index) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry", index);
_pltReadLock.lock();
try {
final PartnerLogData entry = _partnerLogTable.get(index - 1);
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry", entry);
return entry;
} catch (IndexOutOfBoundsException ioobe) {
// The index was invalid; return null.
FFDCFilter.processException(ioobe, "com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry", "122", this);
} finally {
_pltReadLock.unlock();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry", null);
return null;
} } | public class class_name {
public PartnerLogData getEntry(int index) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry", index);
_pltReadLock.lock();
try {
final PartnerLogData entry = _partnerLogTable.get(index - 1);
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry", entry);
return entry; // depends on control dependency: [try], data = [none]
} catch (IndexOutOfBoundsException ioobe) {
// The index was invalid; return null.
FFDCFilter.processException(ioobe, "com.ibm.ws.Transaction.JTA.PartnerLogTable.getEntry", "122", this);
} finally { // depends on control dependency: [catch], data = [none]
_pltReadLock.unlock();
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry", null);
return null;
} } |
public class class_name {
private static void updateCustomHashtable(Hashtable<String, Object> credData, String realmName, String uniqueId, String securityName, List<?> groupList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "updateCustomHashtable", new Object[] { credData, realmName, uniqueId, securityName, groupList });
}
String cacheKey = getCacheKey(uniqueId, realmName);
credData.put(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY, cacheKey);
credData.put(AttributeNameConstants.WSCREDENTIAL_REALM, realmName);
credData.put(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME, securityName);
if (uniqueId != null) {
credData.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID, uniqueId);
}
// If uniqueId is not set then the login will fail later and the work will not execute
if (groupList != null && !groupList.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding groups found in registry", groupList);
}
credData.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, groupList);
} else {
credData.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, new ArrayList<String>());
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "updateCustomHashtable");
}
} } | public class class_name {
private static void updateCustomHashtable(Hashtable<String, Object> credData, String realmName, String uniqueId, String securityName, List<?> groupList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "updateCustomHashtable", new Object[] { credData, realmName, uniqueId, securityName, groupList }); // depends on control dependency: [if], data = [none]
}
String cacheKey = getCacheKey(uniqueId, realmName);
credData.put(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY, cacheKey);
credData.put(AttributeNameConstants.WSCREDENTIAL_REALM, realmName);
credData.put(AttributeNameConstants.WSCREDENTIAL_SECURITYNAME, securityName);
if (uniqueId != null) {
credData.put(AttributeNameConstants.WSCREDENTIAL_UNIQUEID, uniqueId); // depends on control dependency: [if], data = [none]
}
// If uniqueId is not set then the login will fail later and the work will not execute
if (groupList != null && !groupList.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding groups found in registry", groupList); // depends on control dependency: [if], data = [none]
}
credData.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, groupList); // depends on control dependency: [if], data = [none]
} else {
credData.put(AttributeNameConstants.WSCREDENTIAL_GROUPS, new ArrayList<String>()); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "updateCustomHashtable"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static InternationalFixedDate ofYearDay(int prolepticYear, int dayOfYear) {
YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA);
ChronoField.DAY_OF_YEAR.checkValidValue(dayOfYear);
boolean isLeapYear = INSTANCE.isLeapYear(prolepticYear);
int lastDoy = (DAYS_IN_YEAR + (isLeapYear ? 1 : 0));
if (dayOfYear > lastDoy) {
throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year");
}
if (dayOfYear == lastDoy) {
return new InternationalFixedDate(prolepticYear, 13, 29);
}
if (dayOfYear == LEAP_DAY_AS_DAY_OF_YEAR && isLeapYear) {
return new InternationalFixedDate(prolepticYear, 6, 29);
}
int doy0 = dayOfYear - 1;
if (dayOfYear >= LEAP_DAY_AS_DAY_OF_YEAR && isLeapYear) {
doy0--;
}
int month = (doy0 / DAYS_IN_MONTH) + 1;
int day = (doy0 % DAYS_IN_MONTH) + 1;
return new InternationalFixedDate(prolepticYear, month, day);
} } | public class class_name {
static InternationalFixedDate ofYearDay(int prolepticYear, int dayOfYear) {
YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA);
ChronoField.DAY_OF_YEAR.checkValidValue(dayOfYear);
boolean isLeapYear = INSTANCE.isLeapYear(prolepticYear);
int lastDoy = (DAYS_IN_YEAR + (isLeapYear ? 1 : 0));
if (dayOfYear > lastDoy) {
throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year");
}
if (dayOfYear == lastDoy) {
return new InternationalFixedDate(prolepticYear, 13, 29); // depends on control dependency: [if], data = [none]
}
if (dayOfYear == LEAP_DAY_AS_DAY_OF_YEAR && isLeapYear) {
return new InternationalFixedDate(prolepticYear, 6, 29); // depends on control dependency: [if], data = [none]
}
int doy0 = dayOfYear - 1;
if (dayOfYear >= LEAP_DAY_AS_DAY_OF_YEAR && isLeapYear) {
doy0--; // depends on control dependency: [if], data = [none]
}
int month = (doy0 / DAYS_IN_MONTH) + 1;
int day = (doy0 % DAYS_IN_MONTH) + 1;
return new InternationalFixedDate(prolepticYear, month, day);
} } |
public class class_name {
private void accumulatePersistedGlobalChanges(long delta)
{
long dataSize = 0;
try
{
dataSize = quotaPersister.getGlobalDataSize();
}
catch (UnknownDataSizeException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace(e.getMessage(), e);
}
}
long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency
quotaPersister.setGlobalDataSize(newDataSize);
} } | public class class_name {
private void accumulatePersistedGlobalChanges(long delta)
{
long dataSize = 0;
try
{
dataSize = quotaPersister.getGlobalDataSize(); // depends on control dependency: [try], data = [none]
}
catch (UnknownDataSizeException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace(e.getMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency
quotaPersister.setGlobalDataSize(newDataSize);
} } |
public class class_name {
public void sendMessage(
ABaseFluidJSONObject baseFluidJSONObjectParam,
String requestIdParam)
{
if(baseFluidJSONObjectParam != null) {
baseFluidJSONObjectParam.setServiceTicket(this.serviceTicket);
//Add the echo to the listing if [GenericListMessageHandler].
if(this.getHandler(requestIdParam) instanceof AGenericListMessageHandler) {
AGenericListMessageHandler listHandler =
(AGenericListMessageHandler)this.getHandler(requestIdParam);
listHandler.addExpectedMessage(baseFluidJSONObjectParam.getEcho());
}
}
this.webSocketClient.sendMessage(baseFluidJSONObjectParam);
} } | public class class_name {
public void sendMessage(
ABaseFluidJSONObject baseFluidJSONObjectParam,
String requestIdParam)
{
if(baseFluidJSONObjectParam != null) {
baseFluidJSONObjectParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
//Add the echo to the listing if [GenericListMessageHandler].
if(this.getHandler(requestIdParam) instanceof AGenericListMessageHandler) {
AGenericListMessageHandler listHandler =
(AGenericListMessageHandler)this.getHandler(requestIdParam);
listHandler.addExpectedMessage(baseFluidJSONObjectParam.getEcho()); // depends on control dependency: [if], data = [none]
}
}
this.webSocketClient.sendMessage(baseFluidJSONObjectParam);
} } |
public class class_name {
@SuppressWarnings("deprecation")
public static <T> DataSet newDataSet(Collection<String> columnNames, Collection<T> rowList) {
if (N.isNullOrEmpty(columnNames) && N.isNullOrEmpty(rowList)) {
// throw new IllegalArgumentException("Column name list and row list can not be both null or empty");
return new RowDataSet(new ArrayList<String>(0), new ArrayList<List<Object>>(0));
} else if (N.isNullOrEmpty(rowList)) {
return new RowDataSet(new ArrayList<String>(columnNames), new ArrayList<List<Object>>(0));
}
final int rowSize = rowList.size();
if (N.isNullOrEmpty(columnNames)) {
final Set<String> columnNameSet = new LinkedHashSet<>();
Set<Class<?>> clsSet = null;
Map<Class<?>, Set<String>> clsSignedPropNameSetMap = new HashMap<>();
Class<?> cls = null;
Type<?> type = null;
for (Object e : rowList) {
if (e == null) {
continue;
}
cls = e.getClass();
type = N.typeOf(cls);
if (type.isMap()) {
columnNameSet.addAll(((Map<String, Object>) e).keySet());
} else if (type.isEntity()) {
if (e instanceof DirtyMarker) {
Set<String> clsSignedPropNameSet = clsSignedPropNameSetMap.get(cls);
if (clsSignedPropNameSet == null) {
clsSignedPropNameSet = new HashSet<>();
clsSignedPropNameSetMap.put(cls, clsSignedPropNameSet);
}
Method method = null;
for (String signedPropName : ((DirtyMarker) e).signedPropNames()) {
if (clsSignedPropNameSet.add(signedPropName) == false) {
continue;
}
method = ClassUtil.getPropGetMethod(cls, signedPropName);
if (method != null) {
columnNameSet.add(ClassUtil.getPropNameByMethod(method));
}
}
} else {
if (clsSet == null) {
clsSet = new HashSet<>();
}
if (clsSet.contains(cls)) {
continue;
}
columnNameSet.addAll(ClassUtil.checkPropGetMethodList(cls).keySet());
clsSet.add(cls);
}
} else {
throw new IllegalArgumentException("'columnNameList' is required if the sepcified row type is not Entity or Map");
}
}
// re-order column.
for (Map.Entry<Class<?>, Set<String>> entry : clsSignedPropNameSetMap.entrySet()) {
final List<String> intersecion = N.intersection(ClassUtil.getPropGetMethodList(entry.getKey()).keySet(), columnNameSet);
columnNameSet.removeAll(intersecion);
columnNameSet.addAll(intersecion);
}
columnNames = new ArrayList<>(columnNameSet);
if (N.isNullOrEmpty(columnNames)) {
throw new IllegalArgumentException("Column name list can not be obtained from row list because it's empty or null");
}
}
final int columnCount = columnNames.size();
final List<String> columnNameList = new ArrayList<>(columnNames);
final List<List<Object>> columnList = new ArrayList<>(columnCount);
for (int i = 0; i < columnCount; i++) {
columnList.add(new ArrayList<>(rowSize));
}
Type<?> type = null;
for (Object e : rowList) {
if (e == null) {
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(null);
}
continue;
}
type = N.typeOf(e.getClass());
if (type.isMap()) {
Map<String, Object> props = (Map<String, Object>) e;
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(props.get(columnNameList.get(i)));
}
} else if (type.isEntity()) {
Class<?> cls = e.getClass();
Method method = null;
for (int i = 0; i < columnCount; i++) {
method = ClassUtil.getPropGetMethod(cls, columnNameList.get(i));
if (method == null) {
columnList.get(i).add(null);
} else {
columnList.get(i).add(ClassUtil.getPropValue(e, method));
}
}
} else if (type.isArray()) {
if (type.isPrimitiveArray()) {
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(Array.get(e, i));
}
} else {
Object[] array = (Object[]) e;
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(array[i]);
}
}
} else if (type.isCollection()) {
final Iterator<Object> it = ((Collection<Object>) e).iterator();
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(it.next());
}
} else {
throw new IllegalArgumentException(
"Unsupported row type: " + ClassUtil.getCanonicalClassName(e.getClass()) + ". Only array, collection, map and entity are supported");
}
}
return new RowDataSet(columnNameList, columnList);
} } | public class class_name {
@SuppressWarnings("deprecation")
public static <T> DataSet newDataSet(Collection<String> columnNames, Collection<T> rowList) {
if (N.isNullOrEmpty(columnNames) && N.isNullOrEmpty(rowList)) {
// throw new IllegalArgumentException("Column name list and row list can not be both null or empty");
return new RowDataSet(new ArrayList<String>(0), new ArrayList<List<Object>>(0));
// depends on control dependency: [if], data = [none]
} else if (N.isNullOrEmpty(rowList)) {
return new RowDataSet(new ArrayList<String>(columnNames), new ArrayList<List<Object>>(0));
// depends on control dependency: [if], data = [none]
}
final int rowSize = rowList.size();
if (N.isNullOrEmpty(columnNames)) {
final Set<String> columnNameSet = new LinkedHashSet<>();
Set<Class<?>> clsSet = null;
// depends on control dependency: [if], data = [none]
Map<Class<?>, Set<String>> clsSignedPropNameSetMap = new HashMap<>();
Class<?> cls = null;
// depends on control dependency: [if], data = [none]
Type<?> type = null;
for (Object e : rowList) {
if (e == null) {
continue;
}
cls = e.getClass();
// depends on control dependency: [for], data = [e]
type = N.typeOf(cls);
// depends on control dependency: [for], data = [e]
if (type.isMap()) {
columnNameSet.addAll(((Map<String, Object>) e).keySet());
// depends on control dependency: [if], data = [none]
} else if (type.isEntity()) {
if (e instanceof DirtyMarker) {
Set<String> clsSignedPropNameSet = clsSignedPropNameSetMap.get(cls);
if (clsSignedPropNameSet == null) {
clsSignedPropNameSet = new HashSet<>();
// depends on control dependency: [if], data = [none]
clsSignedPropNameSetMap.put(cls, clsSignedPropNameSet);
// depends on control dependency: [if], data = [none]
}
Method method = null;
for (String signedPropName : ((DirtyMarker) e).signedPropNames()) {
if (clsSignedPropNameSet.add(signedPropName) == false) {
continue;
}
method = ClassUtil.getPropGetMethod(cls, signedPropName);
// depends on control dependency: [for], data = [signedPropName]
if (method != null) {
columnNameSet.add(ClassUtil.getPropNameByMethod(method));
// depends on control dependency: [if], data = [(method]
}
}
} else {
if (clsSet == null) {
clsSet = new HashSet<>();
// depends on control dependency: [if], data = [none]
}
if (clsSet.contains(cls)) {
continue;
}
columnNameSet.addAll(ClassUtil.checkPropGetMethodList(cls).keySet());
// depends on control dependency: [if], data = [none]
clsSet.add(cls);
// depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalArgumentException("'columnNameList' is required if the sepcified row type is not Entity or Map");
}
}
// re-order column.
for (Map.Entry<Class<?>, Set<String>> entry : clsSignedPropNameSetMap.entrySet()) {
final List<String> intersecion = N.intersection(ClassUtil.getPropGetMethodList(entry.getKey()).keySet(), columnNameSet);
columnNameSet.removeAll(intersecion);
columnNameSet.addAll(intersecion);
}
columnNames = new ArrayList<>(columnNameSet);
if (N.isNullOrEmpty(columnNames)) {
throw new IllegalArgumentException("Column name list can not be obtained from row list because it's empty or null");
}
}
final int columnCount = columnNames.size();
final List<String> columnNameList = new ArrayList<>(columnNames);
final List<List<Object>> columnList = new ArrayList<>(columnCount);
for (int i = 0; i < columnCount; i++) {
columnList.add(new ArrayList<>(rowSize));
// depends on control dependency: [for], data = [none]
}
Type<?> type = null;
for (Object e : rowList) {
if (e == null) {
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(null);
// depends on control dependency: [for], data = [i]
}
continue;
}
type = N.typeOf(e.getClass());
// depends on control dependency: [for], data = [e]
if (type.isMap()) {
Map<String, Object> props = (Map<String, Object>) e;
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(props.get(columnNameList.get(i)));
// depends on control dependency: [for], data = [i]
}
} else if (type.isEntity()) {
Class<?> cls = e.getClass();
Method method = null;
// depends on control dependency: [if], data = [none]
for (int i = 0; i < columnCount; i++) {
method = ClassUtil.getPropGetMethod(cls, columnNameList.get(i));
// depends on control dependency: [for], data = [i]
if (method == null) {
columnList.get(i).add(null);
// depends on control dependency: [if], data = [null)]
} else {
columnList.get(i).add(ClassUtil.getPropValue(e, method));
// depends on control dependency: [if], data = [none]
}
}
} else if (type.isArray()) {
if (type.isPrimitiveArray()) {
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(Array.get(e, i));
// depends on control dependency: [for], data = [i]
}
} else {
Object[] array = (Object[]) e;
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(array[i]);
// depends on control dependency: [for], data = [i]
}
}
} else if (type.isCollection()) {
final Iterator<Object> it = ((Collection<Object>) e).iterator();
for (int i = 0; i < columnCount; i++) {
columnList.get(i).add(it.next());
// depends on control dependency: [for], data = [i]
}
} else {
throw new IllegalArgumentException(
"Unsupported row type: " + ClassUtil.getCanonicalClassName(e.getClass()) + ". Only array, collection, map and entity are supported");
}
}
return new RowDataSet(columnNameList, columnList);
// depends on control dependency: [if], data = [none]
} } |
public class class_name {
String getMatchingJavaEncoding(String javaEncoding) {
if (javaEncoding != null && this.javaEncodingsUc.contains(javaEncoding.toUpperCase(Locale.ENGLISH))) {
return javaEncoding;
}
return this.javaEncodingsUc.get(0);
} } | public class class_name {
String getMatchingJavaEncoding(String javaEncoding) {
if (javaEncoding != null && this.javaEncodingsUc.contains(javaEncoding.toUpperCase(Locale.ENGLISH))) {
return javaEncoding;
// depends on control dependency: [if], data = [none]
}
return this.javaEncodingsUc.get(0);
} } |
public class class_name {
public final void expressionList() throws RecognitionException {
int expressionList_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 105) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:5: ( expression ( ',' expression )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:9: expression ( ',' expression )*
{
pushFollow(FOLLOW_expression_in_expressionList4817);
expression();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:20: ( ',' expression )*
loop139:
while (true) {
int alt139=2;
int LA139_0 = input.LA(1);
if ( (LA139_0==43) ) {
alt139=1;
}
switch (alt139) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:21: ',' expression
{
match(input,43,FOLLOW_43_in_expressionList4820); if (state.failed) return;
pushFollow(FOLLOW_expression_in_expressionList4822);
expression();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop139;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 105, expressionList_StartIndex); }
}
} } | public class class_name {
public final void expressionList() throws RecognitionException {
int expressionList_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 105) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:5: ( expression ( ',' expression )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:9: expression ( ',' expression )*
{
pushFollow(FOLLOW_expression_in_expressionList4817);
expression();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:20: ( ',' expression )*
loop139:
while (true) {
int alt139=2;
int LA139_0 = input.LA(1);
if ( (LA139_0==43) ) {
alt139=1; // depends on control dependency: [if], data = [none]
}
switch (alt139) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1107:21: ',' expression
{
match(input,43,FOLLOW_43_in_expressionList4820); if (state.failed) return;
pushFollow(FOLLOW_expression_in_expressionList4822);
expression();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop139;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 105, expressionList_StartIndex); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<EsaResource> queryFeatures(String searchStr) throws InstallException {
List<EsaResource> features = new ArrayList<EsaResource>();
RepositoryConnectionList loginInfo = getResolveDirector().getRepositoryConnectionList(null, null, null, this.getClass().getCanonicalName() + ".queryFeatures");
try {
for (ProductInfo productInfo : ProductInfo.getAllProductInfo().values()) {
log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_SEARCHING_FEATURES"));
features.addAll(loginInfo.findMatchingEsas(searchStr, new ProductInfoProductDefinition(productInfo), Visibility.PUBLIC));
log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_SEARCHING_ADDONS"));
features.addAll(loginInfo.findMatchingEsas(searchStr, new ProductInfoProductDefinition(productInfo), Visibility.INSTALL));
}
log(Level.FINE, " ");
} catch (ProductInfoParseException pipe) {
throw ExceptionUtils.create(pipe);
} catch (DuplicateProductInfoException dpie) {
throw ExceptionUtils.create(dpie);
} catch (ProductInfoReplaceException pire) {
throw ExceptionUtils.create(pire);
} catch (RepositoryException re) {
throw ExceptionUtils.create(re, re.getCause(), getResolveDirector().getProxy(), getResolveDirector().defaultRepo());
}
return features;
} } | public class class_name {
public List<EsaResource> queryFeatures(String searchStr) throws InstallException {
List<EsaResource> features = new ArrayList<EsaResource>();
RepositoryConnectionList loginInfo = getResolveDirector().getRepositoryConnectionList(null, null, null, this.getClass().getCanonicalName() + ".queryFeatures");
try {
for (ProductInfo productInfo : ProductInfo.getAllProductInfo().values()) {
log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_SEARCHING_FEATURES")); // depends on control dependency: [for], data = [none]
features.addAll(loginInfo.findMatchingEsas(searchStr, new ProductInfoProductDefinition(productInfo), Visibility.PUBLIC)); // depends on control dependency: [for], data = [productInfo]
log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("MSG_SEARCHING_ADDONS")); // depends on control dependency: [for], data = [none]
features.addAll(loginInfo.findMatchingEsas(searchStr, new ProductInfoProductDefinition(productInfo), Visibility.INSTALL)); // depends on control dependency: [for], data = [productInfo]
}
log(Level.FINE, " ");
} catch (ProductInfoParseException pipe) {
throw ExceptionUtils.create(pipe);
} catch (DuplicateProductInfoException dpie) {
throw ExceptionUtils.create(dpie);
} catch (ProductInfoReplaceException pire) {
throw ExceptionUtils.create(pire);
} catch (RepositoryException re) {
throw ExceptionUtils.create(re, re.getCause(), getResolveDirector().getProxy(), getResolveDirector().defaultRepo());
}
return features;
} } |
public class class_name {
public ItemRef incr(final String property, final Number value, final OnItemSnapshot onItemSnapshot, final OnError onError){
TableMetadata tm = context.getTableMeta(this.table.name);
if(tm == null){
this.table.meta(new OnTableMetadata(){
@Override
public void run(TableMetadata tableMetadata) {
_in_de_cr(property, value, true, onItemSnapshot, onError);
}
}, onError);
} else {
this._in_de_cr(property, value, true, onItemSnapshot, onError);
}
return this;
} } | public class class_name {
public ItemRef incr(final String property, final Number value, final OnItemSnapshot onItemSnapshot, final OnError onError){
TableMetadata tm = context.getTableMeta(this.table.name);
if(tm == null){
this.table.meta(new OnTableMetadata(){
@Override
public void run(TableMetadata tableMetadata) {
_in_de_cr(property, value, true, onItemSnapshot, onError);
}
}, onError); // depends on control dependency: [if], data = [none]
} else {
this._in_de_cr(property, value, true, onItemSnapshot, onError); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public static Cipher getAESCipher (int mode, byte[] key)
{
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec aesKey = new SecretKeySpec(key, "AES");
cipher.init(mode, aesKey, IVPS);
return cipher;
} catch (GeneralSecurityException gse) {
log.warning("Failed to create cipher", gse);
}
return null;
} } | public class class_name {
public static Cipher getAESCipher (int mode, byte[] key)
{
try {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec aesKey = new SecretKeySpec(key, "AES");
cipher.init(mode, aesKey, IVPS); // depends on control dependency: [try], data = [none]
return cipher; // depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException gse) {
log.warning("Failed to create cipher", gse);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private boolean subArraysEqualWithMask(byte[] a, int aStart, byte[] b, int bStart, byte[] mask, int maskStart, int len) {
for (int i = aStart, j = bStart, k = maskStart; len > 0; i++, j++, k++, len--) {
if ((a[i] & mask[k]) != (b[j] & mask[k])) {
return false;
}
}
return true;
} } | public class class_name {
private boolean subArraysEqualWithMask(byte[] a, int aStart, byte[] b, int bStart, byte[] mask, int maskStart, int len) {
for (int i = aStart, j = bStart, k = maskStart; len > 0; i++, j++, k++, len--) {
if ((a[i] & mask[k]) != (b[j] & mask[k])) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate();
}
Object lhsValue = getLHS().evaluate();
Object rhsValue = getRHS().evaluate();
IType lhsType = getLHS().getType();
IType rhsType = getRHS().getType();
if( _strOperator.equals( ">" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) > 0;
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) > 0;
}
}
}
}
}
}
else if( _strOperator.equals( "<" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) < 0;
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) < 0;
}
}
}
}
}
}
else if( _strOperator.equals( ">=" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) >= 0;
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) >= 0;
}
}
}
}
}
}
else // if( _strOperator.equals( "<=" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) <= 0;
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) <= 0;
}
}
}
}
}
}
throw new UnsupportedOperationException( "Operands are not compile-time constants.\n" +
"(see http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313)" );
} } | public class class_name {
public Object evaluate()
{
if( !isCompileTimeConstant() )
{
return super.evaluate(); // depends on control dependency: [if], data = [none]
}
Object lhsValue = getLHS().evaluate();
Object rhsValue = getRHS().evaluate();
IType lhsType = getLHS().getType();
IType rhsType = getRHS().getType();
if( _strOperator.equals( ">" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) > 0; // depends on control dependency: [if], data = [none]
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) > 0; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
else if( _strOperator.equals( "<" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) < 0; // depends on control dependency: [if], data = [none]
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) < 0; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
else if( _strOperator.equals( ">=" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) >= 0; // depends on control dependency: [if], data = [none]
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) >= 0; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
else // if( _strOperator.equals( "<=" ) )
{
if( BeanAccess.isNumericType( lhsType ) )
{
return compareNumbers( lhsValue, rhsValue, lhsType, rhsType ) <= 0; // depends on control dependency: [if], data = [none]
}
else
{
if( BeanAccess.isBeanType( lhsType ) )
{
if( BeanAccess.isBeanType( rhsType ) )
{
if( lhsType.isAssignableFrom( rhsType ) )
{
if( JavaTypes.COMPARABLE().isAssignableFrom( lhsType ) )
{
//noinspection unchecked
return ((Comparable)lhsValue).compareTo( rhsValue ) <= 0; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
throw new UnsupportedOperationException( "Operands are not compile-time constants.\n" +
"(see http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313)" );
} } |
public class class_name {
protected void delete(Node<K, V> n) {
if (n == root) {
deleteMin();
return;
}
if (n.y_s == null) {
throw new IllegalArgumentException("Invalid handle!");
}
// disconnect and union children of node
Node<K, V> childTree = unlinkAndUnionChildren(n);
// find parent
Node<K, V> p = getParent(n);
// link children tree in place of node
if (childTree == null) {
// no children, just unlink from parent
if (p.o_c == n) {
if (n.y_s == p) {
p.o_c = null;
} else {
p.o_c = n.y_s;
}
} else {
p.o_c.y_s = p;
}
} else {
// link children tree to parent
if (p.o_c == n) {
childTree.y_s = n.y_s;
p.o_c = childTree;
} else {
p.o_c.y_s = childTree;
childTree.y_s = p;
}
}
size--;
n.o_c = null;
n.y_s = null;
} } | public class class_name {
protected void delete(Node<K, V> n) {
if (n == root) {
deleteMin(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (n.y_s == null) {
throw new IllegalArgumentException("Invalid handle!");
}
// disconnect and union children of node
Node<K, V> childTree = unlinkAndUnionChildren(n);
// find parent
Node<K, V> p = getParent(n);
// link children tree in place of node
if (childTree == null) {
// no children, just unlink from parent
if (p.o_c == n) {
if (n.y_s == p) {
p.o_c = null; // depends on control dependency: [if], data = [none]
} else {
p.o_c = n.y_s; // depends on control dependency: [if], data = [none]
}
} else {
p.o_c.y_s = p; // depends on control dependency: [if], data = [none]
}
} else {
// link children tree to parent
if (p.o_c == n) {
childTree.y_s = n.y_s; // depends on control dependency: [if], data = [none]
p.o_c = childTree; // depends on control dependency: [if], data = [none]
} else {
p.o_c.y_s = childTree; // depends on control dependency: [if], data = [none]
childTree.y_s = p; // depends on control dependency: [if], data = [none]
}
}
size--;
n.o_c = null;
n.y_s = null;
} } |
public class class_name {
private void deleteExtraSnapshots() {
if (m_snapshots.size() <= m_retain) {
setState(State.WAITING);
} else {
m_lastSysprocInvocation = System.currentTimeMillis();
setState(State.DELETING);
final int numberToDelete = m_snapshots.size() - m_retain;
String pathsToDelete[] = new String[numberToDelete];
String noncesToDelete[] = new String[numberToDelete];
for (int ii = 0; ii < numberToDelete; ii++) {
final Snapshot s = m_snapshots.poll();
pathsToDelete[ii] = s.path;
noncesToDelete[ii] = s.nonce;
SNAP_LOG.info("Snapshot daemon deleting " + s.nonce);
}
Object params[] =
new Object[] {
pathsToDelete,
noncesToDelete,
SnapshotPathType.SNAP_AUTO.toString()
};
long handle = m_nextCallbackHandle++;
m_procedureCallbacks.put(handle, new ProcedureCallback() {
@Override
public void clientCallback(final ClientResponse clientResponse)
throws Exception {
processClientResponsePrivate(clientResponse);
}
});
m_initiator.initiateSnapshotDaemonWork("@SnapshotDelete", handle, params);
}
} } | public class class_name {
private void deleteExtraSnapshots() {
if (m_snapshots.size() <= m_retain) {
setState(State.WAITING); // depends on control dependency: [if], data = [none]
} else {
m_lastSysprocInvocation = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
setState(State.DELETING); // depends on control dependency: [if], data = [none]
final int numberToDelete = m_snapshots.size() - m_retain;
String pathsToDelete[] = new String[numberToDelete];
String noncesToDelete[] = new String[numberToDelete];
for (int ii = 0; ii < numberToDelete; ii++) {
final Snapshot s = m_snapshots.poll();
pathsToDelete[ii] = s.path; // depends on control dependency: [for], data = [ii]
noncesToDelete[ii] = s.nonce; // depends on control dependency: [for], data = [ii]
SNAP_LOG.info("Snapshot daemon deleting " + s.nonce); // depends on control dependency: [for], data = [none]
}
Object params[] =
new Object[] {
pathsToDelete,
noncesToDelete,
SnapshotPathType.SNAP_AUTO.toString()
};
long handle = m_nextCallbackHandle++;
m_procedureCallbacks.put(handle, new ProcedureCallback() {
@Override
public void clientCallback(final ClientResponse clientResponse)
throws Exception {
processClientResponsePrivate(clientResponse);
}
}); // depends on control dependency: [if], data = [none]
m_initiator.initiateSnapshotDaemonWork("@SnapshotDelete", handle, params); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Integer addOrMergeAMention(Record m,processNAFVariables vars) {
String charS = m.getUnique(NIF.BEGIN_INDEX, Integer.class) + "," + m.getUnique(NIF.END_INDEX, Integer.class);
if (vars.mentionListHash.containsKey(charS)) {
/*
there is a previously accepted mention with the same span: try to enrich it
*/
boolean chk = checkClassCompatibility(vars.mentionListHash.get(charS), m);
if (!chk) {
/*
there is conflict between the input mention and the previously accepted mention with the same span:
check if the new mention can replace the old one, otherwise report the error
*/
if (checkMentionReplaceability(vars.mentionListHash.get(charS), m)){
// replace the old mention with the new one
vars.mentionListHash.put(charS, m);
logDebug("Replacement with Mention: " + m.getID() + ", class(" + getTypeasString(m.get(RDF.TYPE)) + ")", vars);
return 0;
}
String types =getTypeasString(m.get(RDF.TYPE));
if(types.contains(NWR.PARTICIPATION.stringValue())){
logDebug("Participation collision error, mentionID(" + m.getID() + ") class1(" + getTypeasString(m.get(RDF.TYPE)) + "), class-pre-xtracted(" + getTypeasString(vars.mentionListHash.get(charS).get(RDF.TYPE)) + ")", vars);
}else{
logDebug("Generic collision error, mentionID(" + m.getID() + ") class1(" + getTypeasString(m.get(RDF.TYPE)) + "), class-pre-xtracted(" + getTypeasString(vars.mentionListHash.get(charS).get(RDF.TYPE)) + ")", vars);
}
return -1;
} else {
/*
there is compatibility between the input mention and the previously accepted mention with the same span:
enrich old mention with properties from the new one (except participation mentions)
*/
String types =getTypeasString(m.get(RDF.TYPE));
if(types.contains(NWR.PARTICIPATION.stringValue())){//Rule: no enrichment for participation
logDebug("Refused enrichment with participation mention, mentionID(" + m.getID() + ")", vars);
return -1;
}
// enrich mention
ListIterator<URI> mit = m.getProperties().listIterator();
while (mit.hasNext()) {
URI mittmp = mit.next();
for (Object pit : m.get(mittmp)) {
vars.mentionListHash.get(charS).add(mittmp, pit);
}
}
logDebug("Mention enrichment: " + m.getID() + ", class(" + getTypeasString(m.get(RDF.TYPE)) + ")", vars);
return 0;
}
} else {
/*
the mention is new (there is no previously accepted mention with the same span)
*/
vars.mentionListHash.put(charS, m);
logDebug("Created Mention: " + m.getID(),vars);
return 1;
}
} } | public class class_name {
private static Integer addOrMergeAMention(Record m,processNAFVariables vars) {
String charS = m.getUnique(NIF.BEGIN_INDEX, Integer.class) + "," + m.getUnique(NIF.END_INDEX, Integer.class);
if (vars.mentionListHash.containsKey(charS)) {
/*
there is a previously accepted mention with the same span: try to enrich it
*/
boolean chk = checkClassCompatibility(vars.mentionListHash.get(charS), m);
if (!chk) {
/*
there is conflict between the input mention and the previously accepted mention with the same span:
check if the new mention can replace the old one, otherwise report the error
*/
if (checkMentionReplaceability(vars.mentionListHash.get(charS), m)){
// replace the old mention with the new one
vars.mentionListHash.put(charS, m); // depends on control dependency: [if], data = [none]
logDebug("Replacement with Mention: " + m.getID() + ", class(" + getTypeasString(m.get(RDF.TYPE)) + ")", vars); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
String types =getTypeasString(m.get(RDF.TYPE));
if(types.contains(NWR.PARTICIPATION.stringValue())){
logDebug("Participation collision error, mentionID(" + m.getID() + ") class1(" + getTypeasString(m.get(RDF.TYPE)) + "), class-pre-xtracted(" + getTypeasString(vars.mentionListHash.get(charS).get(RDF.TYPE)) + ")", vars);
}else{
logDebug("Generic collision error, mentionID(" + m.getID() + ") class1(" + getTypeasString(m.get(RDF.TYPE)) + "), class-pre-xtracted(" + getTypeasString(vars.mentionListHash.get(charS).get(RDF.TYPE)) + ")", vars);
}
return -1;
} else {
/*
there is compatibility between the input mention and the previously accepted mention with the same span:
enrich old mention with properties from the new one (except participation mentions)
*/
String types =getTypeasString(m.get(RDF.TYPE));
if(types.contains(NWR.PARTICIPATION.stringValue())){//Rule: no enrichment for participation
logDebug("Refused enrichment with participation mention, mentionID(" + m.getID() + ")", vars);
return -1;
}
// enrich mention
ListIterator<URI> mit = m.getProperties().listIterator();
while (mit.hasNext()) {
URI mittmp = mit.next();
for (Object pit : m.get(mittmp)) {
vars.mentionListHash.get(charS).add(mittmp, pit); // depends on control dependency: [if], data = [none]
}
}
logDebug("Mention enrichment: " + m.getID() + ", class(" + getTypeasString(m.get(RDF.TYPE)) + ")", vars); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
} else {
/*
the mention is new (there is no previously accepted mention with the same span)
*/
vars.mentionListHash.put(charS, m);
logDebug("Created Mention: " + m.getID(),vars);
return 1;
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.