code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
private ReadResultEntryBase createDataNotAvailableRead(long streamSegmentOffset, int maxLength) {
maxLength = getLengthUntilNextEntry(streamSegmentOffset, maxLength);
long storageLength = this.metadata.getStorageLength();
if (streamSegmentOffset < storageLength) {
// Requested data exists in Storage.
// Determine actual read length (until Storage Length) and make sure it does not exceed maxLength.
long actualReadLength = storageLength - streamSegmentOffset;
if (actualReadLength > maxLength) {
actualReadLength = maxLength;
}
return createStorageRead(streamSegmentOffset, (int) actualReadLength);
} else {
// Note that Future Reads are not necessarily tail reads. They mean that we cannot return a result given
// the current state of the metadata. An example of when we might return a Future Read that is not a tail read
// is when we receive a read request immediately after recovery, but before the StorageWriter has had a chance
// to refresh the Storage state (the metadata may be a bit out of date). In that case, we record a Future Read
// which will be completed when the StorageWriter invokes triggerFutureReads() upon refreshing the info.
return createFutureRead(streamSegmentOffset, maxLength);
}
} } | public class class_name {
private ReadResultEntryBase createDataNotAvailableRead(long streamSegmentOffset, int maxLength) {
maxLength = getLengthUntilNextEntry(streamSegmentOffset, maxLength);
long storageLength = this.metadata.getStorageLength();
if (streamSegmentOffset < storageLength) {
// Requested data exists in Storage.
// Determine actual read length (until Storage Length) and make sure it does not exceed maxLength.
long actualReadLength = storageLength - streamSegmentOffset;
if (actualReadLength > maxLength) {
actualReadLength = maxLength; // depends on control dependency: [if], data = [none]
}
return createStorageRead(streamSegmentOffset, (int) actualReadLength); // depends on control dependency: [if], data = [(streamSegmentOffset]
} else {
// Note that Future Reads are not necessarily tail reads. They mean that we cannot return a result given
// the current state of the metadata. An example of when we might return a Future Read that is not a tail read
// is when we receive a read request immediately after recovery, but before the StorageWriter has had a chance
// to refresh the Storage state (the metadata may be a bit out of date). In that case, we record a Future Read
// which will be completed when the StorageWriter invokes triggerFutureReads() upon refreshing the info.
return createFutureRead(streamSegmentOffset, maxLength); // depends on control dependency: [if], data = [(streamSegmentOffset]
}
} } |
public class class_name {
public synchronized static void setFormatter(Formatter formatter) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
for (Handler h : root.getHandlers()) {
h.setFormatter(formatter);
}
} } | public class class_name {
public synchronized static void setFormatter(Formatter formatter) {
java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
for (Handler h : root.getHandlers()) {
h.setFormatter(formatter); // depends on control dependency: [for], data = [h]
}
} } |
public class class_name {
private void checkOrMarkPrivateAccess(Expression source, FieldNode fn) {
if (fn!=null && Modifier.isPrivate(fn.getModifiers()) &&
(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) &&
fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) {
addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), StaticTypesMarker.PV_FIELDS_ACCESS, fn);
}
} } | public class class_name {
private void checkOrMarkPrivateAccess(Expression source, FieldNode fn) {
if (fn!=null && Modifier.isPrivate(fn.getModifiers()) &&
(fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) &&
fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) {
addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), StaticTypesMarker.PV_FIELDS_ACCESS, fn); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Map<String, Object> getScopeMap(Scope scope) {
switch(scope) {
case FLASH:
if(flashAttributesFactoryBean != null) {
return flashAttributesFactoryBean.getAttributesMap();
} else {
return getAttributesMap(flashAttributesFactoryBeanName);
}
case REQUEST:
return getAttributesMap(requestAttributesFactoryBeanName);
case SESSION:
return getAttributesMap(sessionAttributesFactoryBeanName);
case USER:
return getAttributesMap(userAttributesFactoryBeanName);
case CLIENTIP:
return getAttributesMap(clientIPAttributesFactoryBeanName);
case INSTANCE:
return getAttributesMap(instanceAttributesFactoryBeanName);
case GLOBAL:
return getAttributesMap(globalAttributesFactoryBeanName);
}
return null;
} } | public class class_name {
private Map<String, Object> getScopeMap(Scope scope) {
switch(scope) {
case FLASH:
if(flashAttributesFactoryBean != null) {
return flashAttributesFactoryBean.getAttributesMap(); // depends on control dependency: [if], data = [none]
} else {
return getAttributesMap(flashAttributesFactoryBeanName); // depends on control dependency: [if], data = [(flashAttributesFactoryBean]
}
case REQUEST:
return getAttributesMap(requestAttributesFactoryBeanName);
case SESSION:
return getAttributesMap(sessionAttributesFactoryBeanName);
case USER:
return getAttributesMap(userAttributesFactoryBeanName);
case CLIENTIP:
return getAttributesMap(clientIPAttributesFactoryBeanName);
case INSTANCE:
return getAttributesMap(instanceAttributesFactoryBeanName);
case GLOBAL:
return getAttributesMap(globalAttributesFactoryBeanName);
}
return null;
} } |
public class class_name {
public List<T> hasValue(String property, String value) {
List<T> geoPackages = new ArrayList<>();
for (PropertiesCoreExtension<T, ?, ?, ?> properties : propertiesMap
.values()) {
if (properties.hasValue(property, value)) {
geoPackages.add(properties.getGeoPackage());
}
}
return geoPackages;
} } | public class class_name {
public List<T> hasValue(String property, String value) {
List<T> geoPackages = new ArrayList<>();
for (PropertiesCoreExtension<T, ?, ?, ?> properties : propertiesMap
.values()) {
if (properties.hasValue(property, value)) {
geoPackages.add(properties.getGeoPackage()); // depends on control dependency: [if], data = [none]
}
}
return geoPackages;
} } |
public class class_name {
String getStatus(CmsUser user, boolean disabled, boolean newUser) {
if (disabled) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0);
}
if (newUser) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0);
}
if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0);
}
if (isUserPasswordReset(user)) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0);
}
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0);
} } | public class class_name {
String getStatus(CmsUser user, boolean disabled, boolean newUser) {
if (disabled) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_0); // depends on control dependency: [if], data = [none]
}
if (newUser) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_0); // depends on control dependency: [if], data = [none]
}
if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_UNLOCK_USER_STATUS_0); // depends on control dependency: [if], data = [none]
}
if (isUserPasswordReset(user)) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_0); // depends on control dependency: [if], data = [none]
}
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_ACTIVE_0);
} } |
public class class_name {
@Override
public Collection<Task> getAppTasks(ApplicationDefinition appDef) {
List<Task> appTasks = new ArrayList<>();
for (TableDefinition tableDef : appDef.getTableDefinitions().values()) {
String dataAgingFreq = getDataAgingFreq(tableDef);
if (dataAgingFreq != null) {
Task task = new SpiderDataAger(tableDef, dataAgingFreq);
appTasks.add(task);
}
}
return appTasks;
} } | public class class_name {
@Override
public Collection<Task> getAppTasks(ApplicationDefinition appDef) {
List<Task> appTasks = new ArrayList<>();
for (TableDefinition tableDef : appDef.getTableDefinitions().values()) {
String dataAgingFreq = getDataAgingFreq(tableDef);
if (dataAgingFreq != null) {
Task task = new SpiderDataAger(tableDef, dataAgingFreq);
appTasks.add(task);
// depends on control dependency: [if], data = [none]
}
}
return appTasks;
} } |
public class class_name {
public static boolean increment(byte[] value) {
for (int i=value.length; --i>=0; ) {
byte newValue = (byte) ((value[i] & 0xff) + 1);
value[i] = newValue;
if (newValue != 0) {
// No carry bit, so done adding.
return true;
}
}
// This point is reached upon overflow.
return false;
} } | public class class_name {
public static boolean increment(byte[] value) {
for (int i=value.length; --i>=0; ) {
byte newValue = (byte) ((value[i] & 0xff) + 1);
value[i] = newValue;
// depends on control dependency: [for], data = [i]
if (newValue != 0) {
// No carry bit, so done adding.
return true;
// depends on control dependency: [if], data = [none]
}
}
// This point is reached upon overflow.
return false;
} } |
public class class_name {
void insertDropElement(
CmsContainerElementData elementData,
I_CmsDropContainer container,
int index,
CmsContainerPageElementPanel draggable,
String modelReplaceId) {
try {
CmsContainerPageElementPanel containerElement = m_controller.getContainerpageUtil().createElement(
elementData,
container,
m_isNew);
if (m_isNew) {
containerElement.setNewType(CmsContainerpageController.getServerId(m_draggableId));
} else {
m_controller.addToRecentList(elementData.getClientId(), null);
}
if (index >= container.getWidgetCount()) {
container.add(containerElement);
} else {
container.insert(containerElement, index);
}
if (draggable != null) {
draggable.removeFromParent();
}
m_controller.initializeSubContainers(containerElement);
if (modelReplaceId != null) {
m_controller.executeCopyModelReplace(
modelReplaceId,
((CmsContainerPageContainer)container).getFormerModelGroupParent(),
m_controller.getCachedElement(m_draggableId));
}
if (!m_controller.isGroupcontainerEditing()) {
if (containerElement.hasReloadMarker()) {
m_controller.setPageChanged(new Runnable() {
public void run() {
CmsContainerpageController.get().reloadPage();
}
});
} else {
m_controller.setPageChanged();
}
}
if (m_controller.isGroupcontainerEditing()) {
container.getElement().removeClassName(
I_CmsLayoutBundle.INSTANCE.containerpageCss().emptyGroupContainer());
}
} catch (Exception e) {
CmsErrorDialog.handleException(e.getMessage(), e);
}
} } | public class class_name {
void insertDropElement(
CmsContainerElementData elementData,
I_CmsDropContainer container,
int index,
CmsContainerPageElementPanel draggable,
String modelReplaceId) {
try {
CmsContainerPageElementPanel containerElement = m_controller.getContainerpageUtil().createElement(
elementData,
container,
m_isNew);
if (m_isNew) {
containerElement.setNewType(CmsContainerpageController.getServerId(m_draggableId)); // depends on control dependency: [if], data = [none]
} else {
m_controller.addToRecentList(elementData.getClientId(), null); // depends on control dependency: [if], data = [none]
}
if (index >= container.getWidgetCount()) {
container.add(containerElement); // depends on control dependency: [if], data = [none]
} else {
container.insert(containerElement, index); // depends on control dependency: [if], data = [none]
}
if (draggable != null) {
draggable.removeFromParent(); // depends on control dependency: [if], data = [none]
}
m_controller.initializeSubContainers(containerElement); // depends on control dependency: [try], data = [none]
if (modelReplaceId != null) {
m_controller.executeCopyModelReplace(
modelReplaceId,
((CmsContainerPageContainer)container).getFormerModelGroupParent(),
m_controller.getCachedElement(m_draggableId)); // depends on control dependency: [if], data = [none]
}
if (!m_controller.isGroupcontainerEditing()) {
if (containerElement.hasReloadMarker()) {
m_controller.setPageChanged(new Runnable() {
public void run() {
CmsContainerpageController.get().reloadPage();
}
}); // depends on control dependency: [if], data = [none]
} else {
m_controller.setPageChanged(); // depends on control dependency: [if], data = [none]
}
}
if (m_controller.isGroupcontainerEditing()) {
container.getElement().removeClassName(
I_CmsLayoutBundle.INSTANCE.containerpageCss().emptyGroupContainer()); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
CmsErrorDialog.handleException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public EEnum getIfcBuildingElementProxyTypeEnum() {
if (ifcBuildingElementProxyTypeEnumEEnum == null) {
ifcBuildingElementProxyTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(925);
}
return ifcBuildingElementProxyTypeEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcBuildingElementProxyTypeEnum() {
if (ifcBuildingElementProxyTypeEnumEEnum == null) {
ifcBuildingElementProxyTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(925);
// depends on control dependency: [if], data = [none]
}
return ifcBuildingElementProxyTypeEnumEEnum;
} } |
public class class_name {
public void broadcast(BehaviorEvent event)
throws AbortProcessingException {
if (null == event) {
throw new NullPointerException();
}
if (null != listeners) {
for (BehaviorListener listener : listeners) {
if (event.isAppropriateListener(listener)) {
event.processListener(listener);
}
}
}
} } | public class class_name {
public void broadcast(BehaviorEvent event)
throws AbortProcessingException {
if (null == event) {
throw new NullPointerException();
}
if (null != listeners) {
for (BehaviorListener listener : listeners) {
if (event.isAppropriateListener(listener)) {
event.processListener(listener); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public Execution execute(Specification specification, SystemUnderTest systemUnderTest, boolean implementedVersion, String sections, String locale)
{
if(isRemote())
{
return executeRemotely(specification, systemUnderTest, implementedVersion, sections, locale);
}
else
{
return executeLocally(specification, systemUnderTest, implementedVersion, sections, locale);
}
} } | public class class_name {
public Execution execute(Specification specification, SystemUnderTest systemUnderTest, boolean implementedVersion, String sections, String locale)
{
if(isRemote())
{
return executeRemotely(specification, systemUnderTest, implementedVersion, sections, locale); // depends on control dependency: [if], data = [none]
}
else
{
return executeLocally(specification, systemUnderTest, implementedVersion, sections, locale); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static <T> void blockyTandemMergeSort(final T[] keyArr, final long[] valArr, final int arrLen,
final int blkSize, final Comparator<? super T> comparator) {
assert blkSize >= 1;
if (arrLen <= blkSize) { return; }
int numblks = arrLen / blkSize;
if ((numblks * blkSize) < arrLen) { numblks += 1; }
assert ((numblks * blkSize) >= arrLen);
// duplicate the input is preparation for the "ping-pong" copy reduction strategy.
final T[] keyTmp = Arrays.copyOf(keyArr, arrLen);
final long[] valTmp = Arrays.copyOf(valArr, arrLen);
blockyTandemMergeSortRecursion(keyTmp, valTmp,
keyArr, valArr,
0, numblks,
blkSize, arrLen, comparator);
} } | public class class_name {
static <T> void blockyTandemMergeSort(final T[] keyArr, final long[] valArr, final int arrLen,
final int blkSize, final Comparator<? super T> comparator) {
assert blkSize >= 1;
if (arrLen <= blkSize) { return; } // depends on control dependency: [if], data = [none]
int numblks = arrLen / blkSize;
if ((numblks * blkSize) < arrLen) { numblks += 1; } // depends on control dependency: [if], data = [none]
assert ((numblks * blkSize) >= arrLen);
// duplicate the input is preparation for the "ping-pong" copy reduction strategy.
final T[] keyTmp = Arrays.copyOf(keyArr, arrLen);
final long[] valTmp = Arrays.copyOf(valArr, arrLen);
blockyTandemMergeSortRecursion(keyTmp, valTmp,
keyArr, valArr,
0, numblks,
blkSize, arrLen, comparator);
} } |
public class class_name {
@NonNull
public static Scheduler initSingleScheduler(@NonNull Callable<Scheduler> defaultScheduler) {
ObjectHelper.requireNonNull(defaultScheduler, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> f = onInitSingleHandler;
if (f == null) {
return callRequireNonNull(defaultScheduler);
}
return applyRequireNonNull(f, defaultScheduler);
} } | public class class_name {
@NonNull
public static Scheduler initSingleScheduler(@NonNull Callable<Scheduler> defaultScheduler) {
ObjectHelper.requireNonNull(defaultScheduler, "Scheduler Callable can't be null");
Function<? super Callable<Scheduler>, ? extends Scheduler> f = onInitSingleHandler;
if (f == null) {
return callRequireNonNull(defaultScheduler); // depends on control dependency: [if], data = [none]
}
return applyRequireNonNull(f, defaultScheduler);
} } |
public class class_name {
public DimensionGroup withDimensions(String... dimensions) {
if (this.dimensions == null) {
setDimensions(new java.util.ArrayList<String>(dimensions.length));
}
for (String ele : dimensions) {
this.dimensions.add(ele);
}
return this;
} } | public class class_name {
public DimensionGroup withDimensions(String... dimensions) {
if (this.dimensions == null) {
setDimensions(new java.util.ArrayList<String>(dimensions.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : dimensions) {
this.dimensions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public boolean hasDeclaredMethodAnnotation(final String methodAnnotationName) {
for (final MethodInfo mi : getDeclaredMethodInfo()) {
if (mi.hasAnnotation(methodAnnotationName)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasDeclaredMethodAnnotation(final String methodAnnotationName) {
for (final MethodInfo mi : getDeclaredMethodInfo()) {
if (mi.hasAnnotation(methodAnnotationName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private String constructMetricQueryKey(Long startTimeStampBoundary, MetricQuery query) {
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb.append(query.getMetric()).append(":");
// sort the tag key and values within each tag key alphabetically
Map<String, String> treeMap = new TreeMap<String, String>();
for (Map.Entry<String, String> tag : query.getTags().entrySet()) {
String[] tagValues = tag.getValue().split("\\|");
Arrays.sort(tagValues);
StringBuilder sbTag = new StringBuilder();
String separator = "";
for (String tagValue : tagValues) {
sbTag.append(separator);
separator = "|";
sbTag.append(tagValue);
}
treeMap.put(tag.getKey(), sbTag.toString());
}
sb.append(treeMap).append(":");
sb.append(query.getAggregator()).append(":");
sb.append(query.getDownsampler()).append(":");
sb.append(query.getDownsamplingPeriod());
return sb.toString();
} } | public class class_name {
private String constructMetricQueryKey(Long startTimeStampBoundary, MetricQuery query) {
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb.append(query.getMetric()).append(":");
// sort the tag key and values within each tag key alphabetically
Map<String, String> treeMap = new TreeMap<String, String>();
for (Map.Entry<String, String> tag : query.getTags().entrySet()) {
String[] tagValues = tag.getValue().split("\\|");
Arrays.sort(tagValues); // depends on control dependency: [for], data = [tag]
StringBuilder sbTag = new StringBuilder();
String separator = "";
for (String tagValue : tagValues) {
sbTag.append(separator); // depends on control dependency: [for], data = [none]
separator = "|"; // depends on control dependency: [for], data = [none]
sbTag.append(tagValue); // depends on control dependency: [for], data = [tagValue]
}
treeMap.put(tag.getKey(), sbTag.toString()); // depends on control dependency: [for], data = [tag]
}
sb.append(treeMap).append(":");
sb.append(query.getAggregator()).append(":");
sb.append(query.getDownsampler()).append(":");
sb.append(query.getDownsamplingPeriod());
return sb.toString();
} } |
public class class_name {
public static Configuration get() {
Configuration conf = new Configuration();
File cloudConfigPath;
if (isWindows()) {
cloudConfigPath = new File(getEnvironment().get("APPDATA"), "gcloud");
} else {
cloudConfigPath = new File(System.getProperty("user.home"), ".config/gcloud");
}
File credentialFilePath = new File(cloudConfigPath, "application_default_credentials.json");
if (!credentialFilePath.exists()) {
return conf;
}
try {
JsonFactory jsonFactory = Utils.getDefaultJsonFactory();
InputStream inputStream = new FileInputStream(credentialFilePath);
JsonObjectParser parser = new JsonObjectParser(jsonFactory);
GenericJson fileContents = parser.parseAndClose(
inputStream, Charsets.UTF_8, GenericJson.class);
String fileType = (String) fileContents.get("type");
if ("authorized_user".equals(fileType)) {
String clientId = (String) fileContents.get("client_id");
String clientSecret = (String) fileContents.get("client_secret");
if (clientId != null && clientSecret != null) {
LOG.debug("Using GCP user credential from '{}'", credentialFilePath);
conf.setIfUnset("fs.gs.impl", GoogleHadoopFileSystem.class.getName());
conf.setIfUnset("fs.AbstractFileSystem.gs.impl", GoogleHadoopFS.class.getName());
conf.setIfUnset(GoogleHadoopFileSystemBase.GCS_PROJECT_ID_KEY, defaultProject());
conf.setIfUnset(GoogleHadoopFileSystemBase.GCS_WORKING_DIRECTORY_KEY, "/hadoop");
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX,
"false");
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.CLIENT_ID_SUFFIX,
clientId);
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.CLIENT_SECRET_SUFFIX,
clientSecret);
}
}
} catch (IOException e) {
LOG.warn("Failed to load GCP user credential from '{}'", credentialFilePath);
}
return conf;
} } | public class class_name {
public static Configuration get() {
Configuration conf = new Configuration();
File cloudConfigPath;
if (isWindows()) {
cloudConfigPath = new File(getEnvironment().get("APPDATA"), "gcloud"); // depends on control dependency: [if], data = [none]
} else {
cloudConfigPath = new File(System.getProperty("user.home"), ".config/gcloud");
}
File credentialFilePath = new File(cloudConfigPath, "application_default_credentials.json");
if (!credentialFilePath.exists()) {
return conf;
}
try {
JsonFactory jsonFactory = Utils.getDefaultJsonFactory();
InputStream inputStream = new FileInputStream(credentialFilePath);
JsonObjectParser parser = new JsonObjectParser(jsonFactory);
GenericJson fileContents = parser.parseAndClose(
inputStream, Charsets.UTF_8, GenericJson.class);
String fileType = (String) fileContents.get("type");
if ("authorized_user".equals(fileType)) {
String clientId = (String) fileContents.get("client_id");
String clientSecret = (String) fileContents.get("client_secret");
if (clientId != null && clientSecret != null) {
LOG.debug("Using GCP user credential from '{}'", credentialFilePath);
conf.setIfUnset("fs.gs.impl", GoogleHadoopFileSystem.class.getName()); // depends on control dependency: [if], data = [none]
conf.setIfUnset("fs.AbstractFileSystem.gs.impl", GoogleHadoopFS.class.getName()); // depends on control dependency: [if], data = [none]
conf.setIfUnset(GoogleHadoopFileSystemBase.GCS_PROJECT_ID_KEY, defaultProject()); // depends on control dependency: [if], data = [none]
conf.setIfUnset(GoogleHadoopFileSystemBase.GCS_WORKING_DIRECTORY_KEY, "/hadoop"); // depends on control dependency: [if], data = [none]
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX,
"false"); // depends on control dependency: [if], data = [none]
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.CLIENT_ID_SUFFIX,
clientId); // depends on control dependency: [if], data = [none]
conf.setIfUnset(
HadoopCredentialConfiguration.BASE_KEY_PREFIX +
HadoopCredentialConfiguration.CLIENT_SECRET_SUFFIX,
clientSecret); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
LOG.warn("Failed to load GCP user credential from '{}'", credentialFilePath);
}
return conf;
} } |
public class class_name {
public static <T> T awaitOrCancel(RedisFuture<T> cmd, long timeout, TimeUnit unit) {
try {
if (!cmd.await(timeout, unit)) {
cmd.cancel(true);
throw ExceptionFactory.createTimeoutException(Duration.ofNanos(unit.toNanos(timeout)));
}
return cmd.get();
} catch (RuntimeException e) {
throw e;
} catch (ExecutionException e) {
if (e.getCause() instanceof RedisCommandExecutionException) {
throw ExceptionFactory.createExecutionException(e.getCause().getMessage(), e.getCause());
}
if (e.getCause() instanceof RedisCommandTimeoutException) {
throw new RedisCommandTimeoutException(e.getCause());
}
throw new RedisException(e.getCause());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RedisCommandInterruptedException(e);
} catch (Exception e) {
throw ExceptionFactory.createExecutionException(null, e);
}
} } | public class class_name {
public static <T> T awaitOrCancel(RedisFuture<T> cmd, long timeout, TimeUnit unit) {
try {
if (!cmd.await(timeout, unit)) {
cmd.cancel(true); // depends on control dependency: [if], data = [none]
throw ExceptionFactory.createTimeoutException(Duration.ofNanos(unit.toNanos(timeout)));
}
return cmd.get(); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw e;
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
if (e.getCause() instanceof RedisCommandExecutionException) {
throw ExceptionFactory.createExecutionException(e.getCause().getMessage(), e.getCause());
}
if (e.getCause() instanceof RedisCommandTimeoutException) {
throw new RedisCommandTimeoutException(e.getCause());
}
throw new RedisException(e.getCause());
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
Thread.currentThread().interrupt();
throw new RedisCommandInterruptedException(e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw ExceptionFactory.createExecutionException(null, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static <N> boolean subgraphHasCycle(
Graph<N> graph,
Map<Object, NodeVisitState> visitedNodes,
N node,
@NullableDecl N previousNode) {
NodeVisitState state = visitedNodes.get(node);
if (state == NodeVisitState.COMPLETE) {
return false;
}
if (state == NodeVisitState.PENDING) {
return true;
}
visitedNodes.put(node, NodeVisitState.PENDING);
for (N nextNode : graph.successors(node)) {
if (canTraverseWithoutReusingEdge(graph, nextNode, previousNode)
&& subgraphHasCycle(graph, visitedNodes, nextNode, node)) {
return true;
}
}
visitedNodes.put(node, NodeVisitState.COMPLETE);
return false;
} } | public class class_name {
private static <N> boolean subgraphHasCycle(
Graph<N> graph,
Map<Object, NodeVisitState> visitedNodes,
N node,
@NullableDecl N previousNode) {
NodeVisitState state = visitedNodes.get(node);
if (state == NodeVisitState.COMPLETE) {
return false; // depends on control dependency: [if], data = [none]
}
if (state == NodeVisitState.PENDING) {
return true; // depends on control dependency: [if], data = [none]
}
visitedNodes.put(node, NodeVisitState.PENDING);
for (N nextNode : graph.successors(node)) {
if (canTraverseWithoutReusingEdge(graph, nextNode, previousNode)
&& subgraphHasCycle(graph, visitedNodes, nextNode, node)) {
return true; // depends on control dependency: [if], data = [none]
}
}
visitedNodes.put(node, NodeVisitState.COMPLETE);
return false;
} } |
public class class_name {
public List<CrowdAgent> getActiveAgents() {
List<CrowdAgent> agents = new ArrayList<>(m_maxAgents);
for (int i = 0; i < m_maxAgents; ++i) {
if (m_agents[i].active) {
agents.add(m_agents[i]);
}
}
return agents;
} } | public class class_name {
public List<CrowdAgent> getActiveAgents() {
List<CrowdAgent> agents = new ArrayList<>(m_maxAgents);
for (int i = 0; i < m_maxAgents; ++i) {
if (m_agents[i].active) {
agents.add(m_agents[i]); // depends on control dependency: [if], data = [none]
}
}
return agents;
} } |
public class class_name {
public void marshall(RebootInstanceRequest rebootInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (rebootInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(rebootInstanceRequest.getInstanceName(), INSTANCENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RebootInstanceRequest rebootInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (rebootInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(rebootInstanceRequest.getInstanceName(), INSTANCENAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setRadarChartMode(final RadarChart.Mode MODE) {
if (null == radarChartMode) {
_radarChartMode = MODE;
fireTileEvent(RECALC_EVENT);
} else {
radarChartMode.set(MODE);
}
} } | public class class_name {
public void setRadarChartMode(final RadarChart.Mode MODE) {
if (null == radarChartMode) {
_radarChartMode = MODE; // depends on control dependency: [if], data = [none]
fireTileEvent(RECALC_EVENT); // depends on control dependency: [if], data = [none]
} else {
radarChartMode.set(MODE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isEqual(String string0, String string1, boolean caseSensitive) {
if (string0 == null && string1 == null) {
return true;
}
if (string0 == null && string1 != null) {
return false;
}
if (string0 != null && string1 == null) {
return false;
}
if (caseSensitive) {
return string0.equals(string1);
} else {
return string0.equalsIgnoreCase(string1);
}
} } | public class class_name {
public static boolean isEqual(String string0, String string1, boolean caseSensitive) {
if (string0 == null && string1 == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (string0 == null && string1 != null) {
return false; // depends on control dependency: [if], data = [none]
}
if (string0 != null && string1 == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (caseSensitive) {
return string0.equals(string1); // depends on control dependency: [if], data = [none]
} else {
return string0.equalsIgnoreCase(string1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setHsmConfigurations(java.util.Collection<HsmConfiguration> hsmConfigurations) {
if (hsmConfigurations == null) {
this.hsmConfigurations = null;
return;
}
this.hsmConfigurations = new com.amazonaws.internal.SdkInternalList<HsmConfiguration>(hsmConfigurations);
} } | public class class_name {
public void setHsmConfigurations(java.util.Collection<HsmConfiguration> hsmConfigurations) {
if (hsmConfigurations == null) {
this.hsmConfigurations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.hsmConfigurations = new com.amazonaws.internal.SdkInternalList<HsmConfiguration>(hsmConfigurations);
} } |
public class class_name {
private JsonToken readingConstant(JsonTokenType type, JsonToken token) {
try {
int numCharsToRead = ((String) type.getValidator()).length();
char[] chars = new char[numCharsToRead];
reader.read(chars);
String stringRead = new String(chars);
if (stringRead.equals(type.getValidator())) {
token.setEndColumn(token.getStartColumn() + numCharsToRead);
token.setText(stringRead);
return token;
} else {
throwJsonException(stringRead, type);
}
} catch (IOException ioe) {
throw new JsonException("An IO exception occurred while reading the JSON payload", ioe);
}
return null;
} } | public class class_name {
private JsonToken readingConstant(JsonTokenType type, JsonToken token) {
try {
int numCharsToRead = ((String) type.getValidator()).length();
char[] chars = new char[numCharsToRead];
reader.read(chars); // depends on control dependency: [try], data = [none]
String stringRead = new String(chars);
if (stringRead.equals(type.getValidator())) {
token.setEndColumn(token.getStartColumn() + numCharsToRead); // depends on control dependency: [if], data = [none]
token.setText(stringRead); // depends on control dependency: [if], data = [none]
return token; // depends on control dependency: [if], data = [none]
} else {
throwJsonException(stringRead, type); // depends on control dependency: [if], data = [none]
}
} catch (IOException ioe) {
throw new JsonException("An IO exception occurred while reading the JSON payload", ioe);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static void load(String confingFilename) {
try {
if (config == null) {
config = new AXUConfig();
logger.debug("create new AXUConfig instance");
}
// DEV ๋ชจ๋์ธ ๊ฒฝ์ฐ ๊ฐ ํ๊ทธ๋ง๋ค config๋ฅผ ์์ฒญํ๋ฏ๋ก 3์ด์ ํ ๋ฒ์ฉ๋ง ์ค์ ์ ๋ก๋ฉํ๋๋ก ํ๋ค.
long nowTime = (new Date()).getTime();
if (nowTime - lastLoadTime < 3000) {
return;
} else {
lastLoadTime = nowTime;
}
Serializer serializer = new Persister();
URL configUrl = config.getClass().getClassLoader().getResource(confingFilename);
if (configUrl == null) {
configUrl = ClassLoader.getSystemClassLoader().getResource(confingFilename);
}
File configFile = new File(configUrl.toURI());
serializer.read(config, configFile);
logger.info("load config from {}", configFile.getAbsolutePath());
if (logger.isDebugEnabled()) {
logger.debug("axu4j.xml\n{}", config);
}
} catch(Exception e) {
logger.error("Fail to load axu4j.xml", e);
}
} } | public class class_name {
public static void load(String confingFilename) {
try {
if (config == null) {
config = new AXUConfig(); // depends on control dependency: [if], data = [none]
logger.debug("create new AXUConfig instance"); // depends on control dependency: [if], data = [none]
}
// DEV ๋ชจ๋์ธ ๊ฒฝ์ฐ ๊ฐ ํ๊ทธ๋ง๋ค config๋ฅผ ์์ฒญํ๋ฏ๋ก 3์ด์ ํ ๋ฒ์ฉ๋ง ์ค์ ์ ๋ก๋ฉํ๋๋ก ํ๋ค.
long nowTime = (new Date()).getTime();
if (nowTime - lastLoadTime < 3000) {
return; // depends on control dependency: [if], data = [none]
} else {
lastLoadTime = nowTime; // depends on control dependency: [if], data = [none]
}
Serializer serializer = new Persister();
URL configUrl = config.getClass().getClassLoader().getResource(confingFilename);
if (configUrl == null) {
configUrl = ClassLoader.getSystemClassLoader().getResource(confingFilename); // depends on control dependency: [if], data = [none]
}
File configFile = new File(configUrl.toURI());
serializer.read(config, configFile); // depends on control dependency: [try], data = [none]
logger.info("load config from {}", configFile.getAbsolutePath()); // depends on control dependency: [try], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("axu4j.xml\n{}", config); // depends on control dependency: [if], data = [none]
}
} catch(Exception e) {
logger.error("Fail to load axu4j.xml", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void updateLayout() {
// TODO: we should not do this kind of things...
if (!isAttached()) {
return;
}
int floatBoxWidth = getFloatBoxWidth();
m_primary.getElement().getStyle().setMarginLeft(floatBoxWidth, Unit.PX);
updateVerticalMargin();
} } | public class class_name {
public void updateLayout() {
// TODO: we should not do this kind of things...
if (!isAttached()) {
return; // depends on control dependency: [if], data = [none]
}
int floatBoxWidth = getFloatBoxWidth();
m_primary.getElement().getStyle().setMarginLeft(floatBoxWidth, Unit.PX);
updateVerticalMargin();
} } |
public class class_name {
public ServiceCall<Void> addWord(AddWordOptions addWordOptions) {
Validator.notNull(addWordOptions, "addWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { addWordOptions.customizationId(), addWordOptions.word() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "addWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("translation", addWordOptions.translation());
if (addWordOptions.partOfSpeech() != null) {
contentJson.addProperty("part_of_speech", addWordOptions.partOfSpeech());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } | public class class_name {
public ServiceCall<Void> addWord(AddWordOptions addWordOptions) {
Validator.notNull(addWordOptions, "addWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { addWordOptions.customizationId(), addWordOptions.word() };
RequestBuilder builder = RequestBuilder.put(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "addWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("translation", addWordOptions.translation());
if (addWordOptions.partOfSpeech() != null) {
contentJson.addProperty("part_of_speech", addWordOptions.partOfSpeech()); // depends on control dependency: [if], data = [none]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } |
public class class_name {
public void addBlackListedHost(final String spec) throws ConfigurationException, FileNotFoundException {
if (spec.length() == 0) return; // Skip empty specs
if (spec.startsWith("file:")) {
final LineIterator lineIterator = new LineIterator(new FastBufferedReader(new InputStreamReader(new FileInputStream(spec.substring(5)), Charsets.ISO_8859_1)));
while (lineIterator.hasNext()) {
final MutableString line = lineIterator.next();
blackListedHostHashes.add(line.toString().trim().hashCode());
}
}
else blackListedHostHashes.add(spec.trim().hashCode());
} } | public class class_name {
public void addBlackListedHost(final String spec) throws ConfigurationException, FileNotFoundException {
if (spec.length() == 0) return; // Skip empty specs
if (spec.startsWith("file:")) {
final LineIterator lineIterator = new LineIterator(new FastBufferedReader(new InputStreamReader(new FileInputStream(spec.substring(5)), Charsets.ISO_8859_1)));
while (lineIterator.hasNext()) {
final MutableString line = lineIterator.next();
blackListedHostHashes.add(line.toString().trim().hashCode()); // depends on control dependency: [while], data = [none]
}
}
else blackListedHostHashes.add(spec.trim().hashCode());
} } |
public class class_name {
private Date[] getBeforeDays(int year, int month) {
Calendar cal = Calendar.getInstance();
cal.set(year, month, 1);
int dayNum = getDayIndex(year, month, 1) - 1;
Date[] date = new Date[dayNum];
if (dayNum > 0)
for (int i = 0; i < dayNum; i++) {
cal.add(Calendar.DAY_OF_MONTH, -1);
date[i] = cal.getTime();
}
return date;
} } | public class class_name {
private Date[] getBeforeDays(int year, int month) {
Calendar cal = Calendar.getInstance();
cal.set(year, month, 1);
int dayNum = getDayIndex(year, month, 1) - 1;
Date[] date = new Date[dayNum];
if (dayNum > 0)
for (int i = 0; i < dayNum; i++) {
cal.add(Calendar.DAY_OF_MONTH, -1); // depends on control dependency: [for], data = [none]
date[i] = cal.getTime(); // depends on control dependency: [for], data = [i]
}
return date;
} } |
public class class_name {
@Override
public int join(final OneSelect _oneSelect,
final SQLSelect _select,
final int _relIndex)
{
final int relIndex = super.join(_oneSelect, _select, _relIndex);
Integer ret;
ret = _oneSelect.getTableIndex(AbstractStoreResource.TABLENAME_STORE, "ID", relIndex, null);
if (ret == null) {
ret = _oneSelect.getNewTableIndex(AbstractStoreResource.TABLENAME_STORE, "ID", relIndex, null);
_select.leftJoin(AbstractStoreResource.TABLENAME_STORE, ret, "ID", relIndex, "ID");
}
_select.column(ret, "ID");
return ret;
} } | public class class_name {
@Override
public int join(final OneSelect _oneSelect,
final SQLSelect _select,
final int _relIndex)
{
final int relIndex = super.join(_oneSelect, _select, _relIndex);
Integer ret;
ret = _oneSelect.getTableIndex(AbstractStoreResource.TABLENAME_STORE, "ID", relIndex, null);
if (ret == null) {
ret = _oneSelect.getNewTableIndex(AbstractStoreResource.TABLENAME_STORE, "ID", relIndex, null); // depends on control dependency: [if], data = [null)]
_select.leftJoin(AbstractStoreResource.TABLENAME_STORE, ret, "ID", relIndex, "ID"); // depends on control dependency: [if], data = [none]
}
_select.column(ret, "ID");
return ret;
} } |
public class class_name {
public ServerGroupReplicationConfiguration withServerReplicationConfigurations(ServerReplicationConfiguration... serverReplicationConfigurations) {
if (this.serverReplicationConfigurations == null) {
setServerReplicationConfigurations(new java.util.ArrayList<ServerReplicationConfiguration>(serverReplicationConfigurations.length));
}
for (ServerReplicationConfiguration ele : serverReplicationConfigurations) {
this.serverReplicationConfigurations.add(ele);
}
return this;
} } | public class class_name {
public ServerGroupReplicationConfiguration withServerReplicationConfigurations(ServerReplicationConfiguration... serverReplicationConfigurations) {
if (this.serverReplicationConfigurations == null) {
setServerReplicationConfigurations(new java.util.ArrayList<ServerReplicationConfiguration>(serverReplicationConfigurations.length)); // depends on control dependency: [if], data = [none]
}
for (ServerReplicationConfiguration ele : serverReplicationConfigurations) {
this.serverReplicationConfigurations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public Instruction find(double lat, double lon, double maxDistance) {
// handle special cases
if (size() == 0) {
return null;
}
PointList points = get(0).getPoints();
double prevLat = points.getLatitude(0);
double prevLon = points.getLongitude(0);
DistanceCalc distCalc = Helper.DIST_EARTH;
double foundMinDistance = distCalc.calcNormalizedDist(lat, lon, prevLat, prevLon);
int foundInstruction = 0;
// Search the closest edge to the query point
if (size() > 1) {
for (int instructionIndex = 0; instructionIndex < size(); instructionIndex++) {
points = get(instructionIndex).getPoints();
for (int pointIndex = 0; pointIndex < points.size(); pointIndex++) {
double currLat = points.getLatitude(pointIndex);
double currLon = points.getLongitude(pointIndex);
if (!(instructionIndex == 0 && pointIndex == 0)) {
// calculate the distance from the point to the edge
double distance;
int index = instructionIndex;
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) {
distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon);
if (pointIndex > 0)
index++;
} else {
distance = distCalc.calcNormalizedDist(lat, lon, currLat, currLon);
if (pointIndex > 0)
index++;
}
if (distance < foundMinDistance) {
foundMinDistance = distance;
foundInstruction = index;
}
}
prevLat = currLat;
prevLon = currLon;
}
}
}
if (distCalc.calcDenormalizedDist(foundMinDistance) > maxDistance)
return null;
// special case finish condition
if (foundInstruction == size())
foundInstruction--;
return get(foundInstruction);
} } | public class class_name {
public Instruction find(double lat, double lon, double maxDistance) {
// handle special cases
if (size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
PointList points = get(0).getPoints();
double prevLat = points.getLatitude(0);
double prevLon = points.getLongitude(0);
DistanceCalc distCalc = Helper.DIST_EARTH;
double foundMinDistance = distCalc.calcNormalizedDist(lat, lon, prevLat, prevLon);
int foundInstruction = 0;
// Search the closest edge to the query point
if (size() > 1) {
for (int instructionIndex = 0; instructionIndex < size(); instructionIndex++) {
points = get(instructionIndex).getPoints(); // depends on control dependency: [for], data = [instructionIndex]
for (int pointIndex = 0; pointIndex < points.size(); pointIndex++) {
double currLat = points.getLatitude(pointIndex);
double currLon = points.getLongitude(pointIndex);
if (!(instructionIndex == 0 && pointIndex == 0)) {
// calculate the distance from the point to the edge
double distance;
int index = instructionIndex;
if (distCalc.validEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon)) {
distance = distCalc.calcNormalizedEdgeDistance(lat, lon, currLat, currLon, prevLat, prevLon); // depends on control dependency: [if], data = [none]
if (pointIndex > 0)
index++;
} else {
distance = distCalc.calcNormalizedDist(lat, lon, currLat, currLon); // depends on control dependency: [if], data = [none]
if (pointIndex > 0)
index++;
}
if (distance < foundMinDistance) {
foundMinDistance = distance; // depends on control dependency: [if], data = [none]
foundInstruction = index; // depends on control dependency: [if], data = [none]
}
}
prevLat = currLat; // depends on control dependency: [for], data = [none]
prevLon = currLon; // depends on control dependency: [for], data = [none]
}
}
}
if (distCalc.calcDenormalizedDist(foundMinDistance) > maxDistance)
return null;
// special case finish condition
if (foundInstruction == size())
foundInstruction--;
return get(foundInstruction);
} } |
public class class_name {
public static String getMd5Hash(String topic, String[] partitions) {
ArrayList<String> elements = new ArrayList<String>();
elements.add(topic);
for (String partition : partitions) {
elements.add(partition);
}
String pathPrefix = StringUtils.join(elements, "/");
try {
final MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] md5Bytes = messageDigest.digest(pathPrefix.getBytes("UTF-8"));
return getHexEncode(md5Bytes).substring(0, 4);
} catch (NoSuchAlgorithmException e) {
LOG.error(e.getMessage());
} catch (UnsupportedEncodingException e) {
LOG.error(e.getMessage());
}
return "";
} } | public class class_name {
public static String getMd5Hash(String topic, String[] partitions) {
ArrayList<String> elements = new ArrayList<String>();
elements.add(topic);
for (String partition : partitions) {
elements.add(partition); // depends on control dependency: [for], data = [partition]
}
String pathPrefix = StringUtils.join(elements, "/");
try {
final MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] md5Bytes = messageDigest.digest(pathPrefix.getBytes("UTF-8"));
return getHexEncode(md5Bytes).substring(0, 4); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
LOG.error(e.getMessage());
} catch (UnsupportedEncodingException e) { // depends on control dependency: [catch], data = [none]
LOG.error(e.getMessage());
} // depends on control dependency: [catch], data = [none]
return "";
} } |
public class class_name {
private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000๏ผ");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // ๅจไปไฝไฝๅพ้ซไฝๅพช็ฏๆถ๏ผ่ฎฐๅฝไธไธไฝๆฐๅญๆฏไธๆฏ 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// ้ซไฝๅทฒๆ ๆฐๆฎ
break;
}
int digit = temp % 10;
if (digit == 0) { // ๅๅฐ็ๆฐๅญไธบ 0
if (false == lastIsZero) {
// ๅไธไธชๆฐๅญไธๆฏ 0๏ผๅๅจๅฝๅๆฑๅญไธฒๅๅ โ้ถโๅญ;
chineseStr = "้ถ" + chineseStr;
}
lastIsZero = true;
} else { // ๅๅฐ็ๆฐๅญไธๆฏ 0
chineseStr = numArray[digit] + units[i] + chineseStr;
lastIsZero = false;
}
temp = temp / 10;
}
return chineseStr;
} } | public class class_name {
private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000๏ผ");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // ๅจไปไฝไฝๅพ้ซไฝๅพช็ฏๆถ๏ผ่ฎฐๅฝไธไธไฝๆฐๅญๆฏไธๆฏ 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// ้ซไฝๅทฒๆ ๆฐๆฎ
break;
}
int digit = temp % 10;
if (digit == 0) { // ๅๅฐ็ๆฐๅญไธบ 0
if (false == lastIsZero) {
// ๅไธไธชๆฐๅญไธๆฏ 0๏ผๅๅจๅฝๅๆฑๅญไธฒๅๅ โ้ถโๅญ;
chineseStr = "้ถ" + chineseStr; // depends on control dependency: [if], data = [none]
}
lastIsZero = true; // depends on control dependency: [if], data = [none]
} else { // ๅๅฐ็ๆฐๅญไธๆฏ 0
chineseStr = numArray[digit] + units[i] + chineseStr; // depends on control dependency: [if], data = [none]
lastIsZero = false; // depends on control dependency: [if], data = [none]
}
temp = temp / 10; // depends on control dependency: [for], data = [none]
}
return chineseStr;
} } |
public class class_name {
public static MonitorableRegistry getNamedInstance(String name) {
MonitorableRegistry instance = NAMED_INSTANCES.get(name);
if (instance == null) {
instance = new MonitorableRegistry();
MonitorableRegistry existing = NAMED_INSTANCES.putIfAbsent(name, instance);
if (existing != null) {
return existing;
}
}
return instance;
} } | public class class_name {
public static MonitorableRegistry getNamedInstance(String name) {
MonitorableRegistry instance = NAMED_INSTANCES.get(name);
if (instance == null) {
instance = new MonitorableRegistry();
// depends on control dependency: [if], data = [none]
MonitorableRegistry existing = NAMED_INSTANCES.putIfAbsent(name, instance);
if (existing != null) {
return existing;
// depends on control dependency: [if], data = [none]
}
}
return instance;
} } |
public class class_name {
@Override
public String[] getStringAttributes(String name) {
try {
List<String> objects = collectAttributeValuesAsList(name, String.class);
return objects.toArray(new String[objects.size()]);
}
catch (NoSuchAttributeException e) {
// The attribute does not exist - contract says to return null.
return null;
}
} } | public class class_name {
@Override
public String[] getStringAttributes(String name) {
try {
List<String> objects = collectAttributeValuesAsList(name, String.class);
return objects.toArray(new String[objects.size()]); // depends on control dependency: [try], data = [none]
}
catch (NoSuchAttributeException e) {
// The attribute does not exist - contract says to return null.
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void setMonth(int newMonth, boolean select) {
if (!initialized || localInitialize) {
return;
}
int oldMonth = month;
month = newMonth;
if (select) {
comboBox.setSelectedIndex(month);
}
if (dayChooser != null) {
dayChooser.setMonth(month);
}
firePropertyChange("month", oldMonth, month);
} } | public class class_name {
private void setMonth(int newMonth, boolean select) {
if (!initialized || localInitialize) {
return; // depends on control dependency: [if], data = [none]
}
int oldMonth = month;
month = newMonth;
if (select) {
comboBox.setSelectedIndex(month); // depends on control dependency: [if], data = [none]
}
if (dayChooser != null) {
dayChooser.setMonth(month); // depends on control dependency: [if], data = [none]
}
firePropertyChange("month", oldMonth, month);
} } |
public class class_name {
public synchronized static final IntervalLoggerController getControllerInstance() {
IntervalLoggerController ic = null;
// If no controller, create a bew instance.
if( instance == null ) {
instance = new DefaultIntervalLoggerController();
ic = new IntervalLoggerControllerWrapper( instance );
}else{
// If background logged stopped then return a new runnable thread. An
// edge case since once a background thread is started it will likely
// run until the application exits.
if( !instance.isRunning() ) {
instance = new DefaultIntervalLoggerController();
ic = new IntervalLoggerControllerWrapper( instance );
}
}
return ic;
} } | public class class_name {
public synchronized static final IntervalLoggerController getControllerInstance() {
IntervalLoggerController ic = null;
// If no controller, create a bew instance.
if( instance == null ) {
instance = new DefaultIntervalLoggerController(); // depends on control dependency: [if], data = [none]
ic = new IntervalLoggerControllerWrapper( instance ); // depends on control dependency: [if], data = [( instance]
}else{
// If background logged stopped then return a new runnable thread. An
// edge case since once a background thread is started it will likely
// run until the application exits.
if( !instance.isRunning() ) {
instance = new DefaultIntervalLoggerController(); // depends on control dependency: [if], data = [none]
ic = new IntervalLoggerControllerWrapper( instance ); // depends on control dependency: [if], data = [none]
}
}
return ic;
} } |
public class class_name {
private static String getLongLiteral(LiteralTree literalTree, VisitorState state) {
JCLiteral longLiteral = (JCLiteral) literalTree;
CharSequence sourceFile = state.getSourceCode();
if (sourceFile == null) {
return null;
}
int start = longLiteral.getStartPosition();
java.util.regex.Matcher matcher =
LONG_LITERAL_PATTERN.matcher(sourceFile.subSequence(start, sourceFile.length()));
if (matcher.lookingAt()) {
return matcher.group();
}
return null;
} } | public class class_name {
private static String getLongLiteral(LiteralTree literalTree, VisitorState state) {
JCLiteral longLiteral = (JCLiteral) literalTree;
CharSequence sourceFile = state.getSourceCode();
if (sourceFile == null) {
return null; // depends on control dependency: [if], data = [none]
}
int start = longLiteral.getStartPosition();
java.util.regex.Matcher matcher =
LONG_LITERAL_PATTERN.matcher(sourceFile.subSequence(start, sourceFile.length()));
if (matcher.lookingAt()) {
return matcher.group(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void cacheBuiltins() {
ctors = new EnumMap<Builtins, BaseFunction>(Builtins.class);
for (Builtins builtin : Builtins.values()) {
Object value = ScriptableObject.getProperty(this, builtin.name());
if (value instanceof BaseFunction) {
ctors.put(builtin, (BaseFunction)value);
}
}
errors = new EnumMap<NativeErrors, BaseFunction>(NativeErrors.class);
for (NativeErrors error : NativeErrors.values()) {
Object value = ScriptableObject.getProperty(this, error.name());
if (value instanceof BaseFunction) {
errors.put(error, (BaseFunction)value);
}
}
} } | public class class_name {
public void cacheBuiltins() {
ctors = new EnumMap<Builtins, BaseFunction>(Builtins.class);
for (Builtins builtin : Builtins.values()) {
Object value = ScriptableObject.getProperty(this, builtin.name());
if (value instanceof BaseFunction) {
ctors.put(builtin, (BaseFunction)value); // depends on control dependency: [if], data = [none]
}
}
errors = new EnumMap<NativeErrors, BaseFunction>(NativeErrors.class);
for (NativeErrors error : NativeErrors.values()) {
Object value = ScriptableObject.getProperty(this, error.name());
if (value instanceof BaseFunction) {
errors.put(error, (BaseFunction)value); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected String getVersionString(int sessionVersion) {
String sessionVersionString = _versionPrefix;
if (_versionPrefixLength > 0) {
if (sessionVersion > 0) {
StringBuffer sb = new StringBuffer();
sb.append(_versionPrefix).append(sessionVersion);
sessionVersionString = sb.substring(sb.length() - _versionPrefixLength, sb.length());
}
} else {
sessionVersionString = "";
}
return sessionVersionString;
} } | public class class_name {
protected String getVersionString(int sessionVersion) {
String sessionVersionString = _versionPrefix;
if (_versionPrefixLength > 0) {
if (sessionVersion > 0) {
StringBuffer sb = new StringBuffer();
sb.append(_versionPrefix).append(sessionVersion); // depends on control dependency: [if], data = [(sessionVersion]
sessionVersionString = sb.substring(sb.length() - _versionPrefixLength, sb.length()); // depends on control dependency: [if], data = [none]
}
} else {
sessionVersionString = ""; // depends on control dependency: [if], data = [none]
}
return sessionVersionString;
} } |
public class class_name {
@Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){
String key = keys.next();
String prop = key;
try {
if (prop.startsWith(getNameSpace())){
prop = prop.substring(getNameSpace().length() + 1);
}
setPropertyInternal(prop, getStringValue(props, key));
} catch (Exception ex) {
throw new RuntimeException(String.format("Property %s is invalid", prop));
}
}
} } | public class class_name {
@Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){
String key = keys.next();
String prop = key;
try {
if (prop.startsWith(getNameSpace())){
prop = prop.substring(getNameSpace().length() + 1); // depends on control dependency: [if], data = [none]
}
setPropertyInternal(prop, getStringValue(props, key)); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new RuntimeException(String.format("Property %s is invalid", prop));
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setOperations(java.util.Collection<OperationSummary> operations) {
if (operations == null) {
this.operations = null;
return;
}
this.operations = new java.util.ArrayList<OperationSummary>(operations);
} } | public class class_name {
public void setOperations(java.util.Collection<OperationSummary> operations) {
if (operations == null) {
this.operations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.operations = new java.util.ArrayList<OperationSummary>(operations);
} } |
public class class_name {
public static URL asUrlOrResource(String s) {
if (Strings.isNullOrEmpty(s)) {
return null;
}
try {
return new URL(s);
} catch (MalformedURLException e) {
//If its not a valid URL try to treat it as a local resource.
return findConfigResource(s);
}
} } | public class class_name {
public static URL asUrlOrResource(String s) {
if (Strings.isNullOrEmpty(s)) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return new URL(s); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
//If its not a valid URL try to treat it as a local resource.
return findConfigResource(s);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isSyncSubscriber(SubscriberConfigProvider.SubscriberConfig subscribe, Class eventClass,
Class subscriberClass) {
if (subscribe.syncIfAllowed() && allowSyncSubs.get()) {
SetMultimap<String, String> whiteList = syncSubsWhiteList.get();
if (whiteList.isEmpty() || !whiteList.containsKey(subscriberClass.getName())) {
return true;
} else {
Set<String> allowedEvents = whiteList.get(subscriberClass.getName());
return allowedEvents.contains(ALLOW_ALL_EVENTS) || allowedEvents.contains(eventClass.getName());
}
}
return false;
} } | public class class_name {
public static boolean isSyncSubscriber(SubscriberConfigProvider.SubscriberConfig subscribe, Class eventClass,
Class subscriberClass) {
if (subscribe.syncIfAllowed() && allowSyncSubs.get()) {
SetMultimap<String, String> whiteList = syncSubsWhiteList.get();
if (whiteList.isEmpty() || !whiteList.containsKey(subscriberClass.getName())) {
return true; // depends on control dependency: [if], data = [none]
} else {
Set<String> allowedEvents = whiteList.get(subscriberClass.getName());
return allowedEvents.contains(ALLOW_ALL_EVENTS) || allowedEvents.contains(eventClass.getName()); // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public final void getAllTagsLemmasToNAF(final KAFDocument kaf) {
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm();
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i));
tokenSpans.add(KAFDocument.newWFSpan(wfTarget));
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
final Term term = kaf.newTerm(tokenSpans.get(i));
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues);
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
final String posId = Resources.getKafTagSet(allPosTags[0][i], lang);
final String type = Resources.setTermType(posId);
term.setType(type);
term.setLemma(posLemmaValues.get(0).split("#")[1]);
term.setPos(posId);
term.setMorphofeat(allPosLemmasSet);
}
}
} } | public class class_name {
public final void getAllTagsLemmasToNAF(final KAFDocument kaf) {
final List<List<WF>> sentences = kaf.getSentences();
for (final List<WF> wfs : sentences) {
final List<ixa.kaflib.Span<WF>> tokenSpans = new ArrayList<ixa.kaflib.Span<WF>>();
final String[] tokens = new String[wfs.size()];
for (int i = 0; i < wfs.size(); i++) {
tokens[i] = wfs.get(i).getForm(); // depends on control dependency: [for], data = [i]
final List<WF> wfTarget = new ArrayList<WF>();
wfTarget.add(wfs.get(i)); // depends on control dependency: [for], data = [i]
tokenSpans.add(KAFDocument.newWFSpan(wfTarget)); // depends on control dependency: [for], data = [none]
}
String[][] allPosTags = this.posTagger.getAllPosTags(tokens);
ListMultimap<String, String> morphMap = lemmatizer.getMultipleLemmas(tokens, allPosTags);
for (int i = 0; i < tokens.length; i++) {
final Term term = kaf.newTerm(tokenSpans.get(i));
List<String> posLemmaValues = morphMap.get(tokens[i]);
if (this.dictLemmatizer != null) {
dictLemmatizer.getAllPosLemmas(tokens[i], posLemmaValues); // depends on control dependency: [if], data = [none]
}
String allPosLemmasSet = StringUtils.getSetStringFromList(posLemmaValues);
final String posId = Resources.getKafTagSet(allPosTags[0][i], lang);
final String type = Resources.setTermType(posId);
term.setType(type); // depends on control dependency: [for], data = [none]
term.setLemma(posLemmaValues.get(0).split("#")[1]); // depends on control dependency: [for], data = [none]
term.setPos(posId); // depends on control dependency: [for], data = [none]
term.setMorphofeat(allPosLemmasSet); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private static double parseResizeWeight(String token) {
if (token.equals("g") || token.equals("grow")) {
return DEFAULT_GROW;
}
if (token.equals("n") || token.equals("nogrow") || token.equals("none")) {
return NO_GROW;
}
// Must have format: grow(<double>)
if ((token.startsWith("grow(") || token.startsWith("g("))
&& token.endsWith(")")) {
int leftParen = token.indexOf('(');
int rightParen = token.indexOf(')');
String substring = token.substring(leftParen + 1, rightParen);
return Double.parseDouble(substring);
}
throw new IllegalArgumentException(
"The resize argument '" + token + "' is invalid. "
+ " Must be one of: grow, g, none, n, grow(<double>), g(<double>)");
} } | public class class_name {
private static double parseResizeWeight(String token) {
if (token.equals("g") || token.equals("grow")) {
return DEFAULT_GROW; // depends on control dependency: [if], data = [none]
}
if (token.equals("n") || token.equals("nogrow") || token.equals("none")) {
return NO_GROW; // depends on control dependency: [if], data = [none]
}
// Must have format: grow(<double>)
if ((token.startsWith("grow(") || token.startsWith("g("))
&& token.endsWith(")")) {
int leftParen = token.indexOf('(');
int rightParen = token.indexOf(')');
String substring = token.substring(leftParen + 1, rightParen);
return Double.parseDouble(substring); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException(
"The resize argument '" + token + "' is invalid. "
+ " Must be one of: grow, g, none, n, grow(<double>), g(<double>)");
} } |
public class class_name {
public static void tripleToEdge(final long[] triple, final long seed, final int numVertices, final int partSize, final int e[]) {
if (numVertices == 0) {
e[0] = e[1] = e[2] = -1;
return;
}
final long[] hash = new long[3];
Hashes.spooky4(triple, seed, hash);
e[0] = (int)((hash[0] & 0x7FFFFFFFFFFFFFFFL) % partSize);
e[1] = (int)(partSize + (hash[1] & 0x7FFFFFFFFFFFFFFFL) % partSize);
e[2] = (int)((partSize << 1) + (hash[2] & 0x7FFFFFFFFFFFFFFFL) % partSize);
} } | public class class_name {
public static void tripleToEdge(final long[] triple, final long seed, final int numVertices, final int partSize, final int e[]) {
if (numVertices == 0) {
e[0] = e[1] = e[2] = -1; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final long[] hash = new long[3];
Hashes.spooky4(triple, seed, hash);
e[0] = (int)((hash[0] & 0x7FFFFFFFFFFFFFFFL) % partSize);
e[1] = (int)(partSize + (hash[1] & 0x7FFFFFFFFFFFFFFFL) % partSize);
e[2] = (int)((partSize << 1) + (hash[2] & 0x7FFFFFFFFFFFFFFFL) % partSize);
} } |
public class class_name {
public void showSitemapView(boolean showSitemap) {
if (showSitemap) {
setSortContainerPropertyId(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT);
setSortAscending(true);
} else {
setSortContainerPropertyId(CAPTION_FOLDERS);
setSortAscending(true);
}
} } | public class class_name {
public void showSitemapView(boolean showSitemap) {
if (showSitemap) {
setSortContainerPropertyId(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT); // depends on control dependency: [if], data = [none]
setSortAscending(true); // depends on control dependency: [if], data = [none]
} else {
setSortContainerPropertyId(CAPTION_FOLDERS); // depends on control dependency: [if], data = [none]
setSortAscending(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void createEncoding() {
if (encoding.startsWith("#")) {
specialMap = new IntHashtable();
StringTokenizer tok = new StringTokenizer(encoding.substring(1), " ,\t\n\r\f");
if (tok.nextToken().equals("full")) {
while (tok.hasMoreTokens()) {
String order = tok.nextToken();
String name = tok.nextToken();
char uni = (char)Integer.parseInt(tok.nextToken(), 16);
int orderK;
if (order.startsWith("'"))
orderK = order.charAt(1);
else
orderK = Integer.parseInt(order);
orderK %= 256;
specialMap.put(uni, orderK);
differences[orderK] = name;
unicodeDifferences[orderK] = uni;
widths[orderK] = getRawWidth(uni, name);
charBBoxes[orderK] = getRawCharBBox(uni, name);
}
}
else {
int k = 0;
if (tok.hasMoreTokens())
k = Integer.parseInt(tok.nextToken());
while (tok.hasMoreTokens() && k < 256) {
String hex = tok.nextToken();
int uni = Integer.parseInt(hex, 16) % 0x10000;
String name = GlyphList.unicodeToName(uni);
if (name != null) {
specialMap.put(uni, k);
differences[k] = name;
unicodeDifferences[k] = (char)uni;
widths[k] = getRawWidth(uni, name);
charBBoxes[k] = getRawCharBBox(uni, name);
++k;
}
}
}
for (int k = 0; k < 256; ++k) {
if (differences[k] == null) {
differences[k] = notdef;
}
}
}
else if (fontSpecific) {
for (int k = 0; k < 256; ++k) {
widths[k] = getRawWidth(k, null);
charBBoxes[k] = getRawCharBBox(k, null);
}
}
else {
String s;
String name;
char c;
byte b[] = new byte[1];
for (int k = 0; k < 256; ++k) {
b[0] = (byte)k;
s = PdfEncodings.convertToString(b, encoding);
if (s.length() > 0) {
c = s.charAt(0);
}
else {
c = '?';
}
name = GlyphList.unicodeToName(c);
if (name == null)
name = notdef;
differences[k] = name;
unicodeDifferences[k] = c;
widths[k] = getRawWidth(c, name);
charBBoxes[k] = getRawCharBBox(c, name);
}
}
} } | public class class_name {
protected void createEncoding() {
if (encoding.startsWith("#")) {
specialMap = new IntHashtable(); // depends on control dependency: [if], data = [none]
StringTokenizer tok = new StringTokenizer(encoding.substring(1), " ,\t\n\r\f");
if (tok.nextToken().equals("full")) {
while (tok.hasMoreTokens()) {
String order = tok.nextToken();
String name = tok.nextToken();
char uni = (char)Integer.parseInt(tok.nextToken(), 16);
int orderK;
if (order.startsWith("'"))
orderK = order.charAt(1);
else
orderK = Integer.parseInt(order);
orderK %= 256; // depends on control dependency: [while], data = [none]
specialMap.put(uni, orderK); // depends on control dependency: [while], data = [none]
differences[orderK] = name; // depends on control dependency: [while], data = [none]
unicodeDifferences[orderK] = uni; // depends on control dependency: [while], data = [none]
widths[orderK] = getRawWidth(uni, name); // depends on control dependency: [while], data = [none]
charBBoxes[orderK] = getRawCharBBox(uni, name); // depends on control dependency: [while], data = [none]
}
}
else {
int k = 0;
if (tok.hasMoreTokens())
k = Integer.parseInt(tok.nextToken());
while (tok.hasMoreTokens() && k < 256) {
String hex = tok.nextToken();
int uni = Integer.parseInt(hex, 16) % 0x10000;
String name = GlyphList.unicodeToName(uni);
if (name != null) {
specialMap.put(uni, k); // depends on control dependency: [if], data = [none]
differences[k] = name; // depends on control dependency: [if], data = [none]
unicodeDifferences[k] = (char)uni; // depends on control dependency: [if], data = [none]
widths[k] = getRawWidth(uni, name); // depends on control dependency: [if], data = [none]
charBBoxes[k] = getRawCharBBox(uni, name); // depends on control dependency: [if], data = [none]
++k; // depends on control dependency: [if], data = [none]
}
}
}
for (int k = 0; k < 256; ++k) {
if (differences[k] == null) {
differences[k] = notdef; // depends on control dependency: [if], data = [none]
}
}
}
else if (fontSpecific) {
for (int k = 0; k < 256; ++k) {
widths[k] = getRawWidth(k, null); // depends on control dependency: [for], data = [k]
charBBoxes[k] = getRawCharBBox(k, null); // depends on control dependency: [for], data = [k]
}
}
else {
String s;
String name;
char c;
byte b[] = new byte[1];
for (int k = 0; k < 256; ++k) {
b[0] = (byte)k; // depends on control dependency: [for], data = [k]
s = PdfEncodings.convertToString(b, encoding); // depends on control dependency: [for], data = [none]
if (s.length() > 0) {
c = s.charAt(0); // depends on control dependency: [if], data = [0)]
}
else {
c = '?'; // depends on control dependency: [if], data = [none]
}
name = GlyphList.unicodeToName(c); // depends on control dependency: [for], data = [none]
if (name == null)
name = notdef;
differences[k] = name; // depends on control dependency: [for], data = [k]
unicodeDifferences[k] = c; // depends on control dependency: [for], data = [k]
widths[k] = getRawWidth(c, name); // depends on control dependency: [for], data = [k]
charBBoxes[k] = getRawCharBBox(c, name); // depends on control dependency: [for], data = [k]
}
}
} } |
public class class_name {
public static void transform( Se3_F64 se, List<Point3D_F64> points ) {
for( Point3D_F64 p : points ) {
transform(se,p,p);
}
} } | public class class_name {
public static void transform( Se3_F64 se, List<Point3D_F64> points ) {
for( Point3D_F64 p : points ) {
transform(se,p,p); // depends on control dependency: [for], data = [p]
}
} } |
public class class_name {
@Override
public String encodeDiff(final RevisionCodecData codecData, final Diff diff)
throws UnsupportedEncodingException, EncodingException
{
String sEncoding;
byte[] bData = encode(codecData, diff);
if (MODE_ZIP_COMPRESSION) {
Deflater compresser = new Deflater();
compresser.setInput(bData);
compresser.finish();
byte[] output = new byte[1000];
ByteArrayOutputStream stream = new ByteArrayOutputStream();
int cLength;
do {
cLength = compresser.deflate(output);
stream.write(output, 0, cLength);
}
while (cLength == 1000);
output = stream.toByteArray();
if (bData.length + 1 < output.length) {
sEncoding = Base64.encodeBase64String(bData);
}
else {
sEncoding = "_" + Base64.encodeBase64String(output);
}
}
else {
sEncoding = Base64.encodeBase64String(bData);
}
return sEncoding;
} } | public class class_name {
@Override
public String encodeDiff(final RevisionCodecData codecData, final Diff diff)
throws UnsupportedEncodingException, EncodingException
{
String sEncoding;
byte[] bData = encode(codecData, diff);
if (MODE_ZIP_COMPRESSION) {
Deflater compresser = new Deflater();
compresser.setInput(bData);
compresser.finish();
byte[] output = new byte[1000];
ByteArrayOutputStream stream = new ByteArrayOutputStream();
int cLength;
do {
cLength = compresser.deflate(output);
stream.write(output, 0, cLength);
}
while (cLength == 1000);
output = stream.toByteArray();
if (bData.length + 1 < output.length) {
sEncoding = Base64.encodeBase64String(bData); // depends on control dependency: [if], data = [none]
}
else {
sEncoding = "_" + Base64.encodeBase64String(output); // depends on control dependency: [if], data = [none]
}
}
else {
sEncoding = Base64.encodeBase64String(bData);
}
return sEncoding;
} } |
public class class_name {
public boolean hasUsersInOtherOus() {
if (m_lazy) {
// if we use database-side paging, we have to assume that there may be users from other OUs
return true;
}
if (m_hasUsersInOtherOus == null) {
// lazzy initialization
m_hasUsersInOtherOus = Boolean.FALSE;
try {
Iterator<CmsUser> itUsers = getUsers(true).iterator();
while (itUsers.hasNext()) {
CmsUser user = itUsers.next();
if (!user.getOuFqn().equals(getParamOufqn())) {
m_hasUsersInOtherOus = Boolean.TRUE;
break;
}
}
} catch (Exception e) {
// ignore
}
}
return m_hasUsersInOtherOus.booleanValue();
} } | public class class_name {
public boolean hasUsersInOtherOus() {
if (m_lazy) {
// if we use database-side paging, we have to assume that there may be users from other OUs
return true; // depends on control dependency: [if], data = [none]
}
if (m_hasUsersInOtherOus == null) {
// lazzy initialization
m_hasUsersInOtherOus = Boolean.FALSE; // depends on control dependency: [if], data = [none]
try {
Iterator<CmsUser> itUsers = getUsers(true).iterator();
while (itUsers.hasNext()) {
CmsUser user = itUsers.next();
if (!user.getOuFqn().equals(getParamOufqn())) {
m_hasUsersInOtherOus = Boolean.TRUE; // depends on control dependency: [if], data = [none]
break;
}
}
} catch (Exception e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
return m_hasUsersInOtherOus.booleanValue();
} } |
public class class_name {
protected String buildSnapshotProps(Map<String, String> props) {
Properties snapshotProperties = new Properties();
for (String key : props.keySet()) {
snapshotProperties.setProperty(key, props.get(key));
}
StringWriter writer = new StringWriter();
try {
snapshotProperties.store(writer, null);
} catch (IOException e) {
throw new TaskException("Could not write snapshot properties: " +
e.getMessage(), e);
}
writer.flush();
return writer.toString();
} } | public class class_name {
protected String buildSnapshotProps(Map<String, String> props) {
Properties snapshotProperties = new Properties();
for (String key : props.keySet()) {
snapshotProperties.setProperty(key, props.get(key)); // depends on control dependency: [for], data = [key]
}
StringWriter writer = new StringWriter();
try {
snapshotProperties.store(writer, null); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new TaskException("Could not write snapshot properties: " +
e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
writer.flush();
return writer.toString();
} } |
public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
currentClass = classContext.getJavaClass();
if (currentClass.getMajor() >= Const.MAJOR_1_8) {
try {
stack = new OpcodeStack();
activeStackOps = new ArrayDeque<>();
super.visitClassContext(classContext);
} finally {
activeStackOps = null;
stack = null;
}
}
currentClass = null;
} } | public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
currentClass = classContext.getJavaClass();
if (currentClass.getMajor() >= Const.MAJOR_1_8) {
try {
stack = new OpcodeStack(); // depends on control dependency: [try], data = [none]
activeStackOps = new ArrayDeque<>(); // depends on control dependency: [try], data = [none]
super.visitClassContext(classContext); // depends on control dependency: [try], data = [none]
} finally {
activeStackOps = null;
stack = null;
}
}
currentClass = null;
} } |
public class class_name {
public static Locale read(String localeString) {
if (localeString == null)
return null;
if (localeString.toLowerCase().equals("default"))
return Locale.getDefault();
int languageIndex = localeString.indexOf('_');
if (languageIndex == -1)
return null;
int countryIndex = localeString.indexOf('_', languageIndex + 1);
String country = null;
if (countryIndex == -1) {
if (localeString.length() > languageIndex) {
country = localeString.substring(languageIndex + 1, localeString.length());
} else {
return null;
}
}
int variantIndex = -1;
if (countryIndex != -1)
countryIndex = localeString.indexOf('_', countryIndex + 1);
String language = localeString.substring(0, languageIndex);
String variant = null;
if (variantIndex != -1) {
variant = localeString.substring(variantIndex + 1, localeString.length());
}
if (variant != null) {
return new Locale(language, country, variant);
} else {
return new Locale(language, country);
}
} } | public class class_name {
public static Locale read(String localeString) {
if (localeString == null)
return null;
if (localeString.toLowerCase().equals("default"))
return Locale.getDefault();
int languageIndex = localeString.indexOf('_');
if (languageIndex == -1)
return null;
int countryIndex = localeString.indexOf('_', languageIndex + 1);
String country = null;
if (countryIndex == -1) {
if (localeString.length() > languageIndex) {
country = localeString.substring(languageIndex + 1, localeString.length()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
int variantIndex = -1;
if (countryIndex != -1)
countryIndex = localeString.indexOf('_', countryIndex + 1);
String language = localeString.substring(0, languageIndex);
String variant = null;
if (variantIndex != -1) {
variant = localeString.substring(variantIndex + 1, localeString.length()); // depends on control dependency: [if], data = [(variantIndex]
}
if (variant != null) {
return new Locale(language, country, variant); // depends on control dependency: [if], data = [none]
} else {
return new Locale(language, country); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void close() {
logger.debug("{} close()", logPrefix());
if (clusterChannelWriter != null) {
retriggerCommands(doExclusive(this::drainCommands));
}
super.close();
} } | public class class_name {
@Override
public void close() {
logger.debug("{} close()", logPrefix());
if (clusterChannelWriter != null) {
retriggerCommands(doExclusive(this::drainCommands)); // depends on control dependency: [if], data = [none]
}
super.close();
} } |
public class class_name {
protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
if (arguments != null && arguments.length > 0) {
return createLambdaLabel(linkInfo, arguments, arguments.length);
}
}
return linkInfo.label;
} } | public class class_name {
protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
if (arguments != null && arguments.length > 0) {
return createLambdaLabel(linkInfo, arguments, arguments.length); // depends on control dependency: [if], data = [none]
}
}
return linkInfo.label;
} } |
public class class_name {
protected Session getProducerSession() throws JMSException {
if (producerSession == null) {
synchronized (this) {
if (producerSession == null) {
producerSession = createSession(Session.AUTO_ACKNOWLEDGE);
}
}
}
return producerSession;
} } | public class class_name {
protected Session getProducerSession() throws JMSException {
if (producerSession == null) {
synchronized (this) {
if (producerSession == null) {
producerSession = createSession(Session.AUTO_ACKNOWLEDGE); // depends on control dependency: [if], data = [none]
}
}
}
return producerSession;
} } |
public class class_name {
public static Predicate<String> notEmptyString() {
return new Predicate<String>() {
@Override
public boolean test(String testValue) {
if (notNull().test(testValue)) {
for (Character c : testValue.toCharArray()) {
if (!Character.isWhitespace(c)) {
return true;
}
}
}
return false;
}
};
} } | public class class_name {
public static Predicate<String> notEmptyString() {
return new Predicate<String>() {
@Override
public boolean test(String testValue) {
if (notNull().test(testValue)) {
for (Character c : testValue.toCharArray()) {
if (!Character.isWhitespace(c)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
}
};
} } |
public class class_name {
public EthBlock getFirstBlock(boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameterName.EARLIEST, includeTransactions).send();
}
catch (IOException ex)
{
LOGGER.error("Not able to find the EARLIEST block. ", ex);
throw new KunderaException("Not able to find the EARLIEST block. ", ex);
}
} } | public class class_name {
public EthBlock getFirstBlock(boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameterName.EARLIEST, includeTransactions).send(); // depends on control dependency: [try], data = [none]
}
catch (IOException ex)
{
LOGGER.error("Not able to find the EARLIEST block. ", ex);
throw new KunderaException("Not able to find the EARLIEST block. ", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public CommerceAccountOrganizationRel fetchByOrganizationId_Last(
long organizationId,
OrderByComparator<CommerceAccountOrganizationRel> orderByComparator) {
int count = countByOrganizationId(organizationId);
if (count == 0) {
return null;
}
List<CommerceAccountOrganizationRel> list = findByOrganizationId(organizationId,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceAccountOrganizationRel fetchByOrganizationId_Last(
long organizationId,
OrderByComparator<CommerceAccountOrganizationRel> orderByComparator) {
int count = countByOrganizationId(organizationId);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommerceAccountOrganizationRel> list = findByOrganizationId(organizationId,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
final Type replacementType = typeVarAssigns.get(type);
if (replacementType == null) {
throw new IllegalArgumentException("missing assignment type for type variable "
+ type);
}
return replacementType;
}
return type;
} } | public class class_name {
private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
final Type replacementType = typeVarAssigns.get(type);
if (replacementType == null) {
throw new IllegalArgumentException("missing assignment type for type variable "
+ type);
}
return replacementType; // depends on control dependency: [if], data = [none]
}
return type;
} } |
public class class_name {
public String buildAcceptHeader() {
StringBuffer mimetypes = new StringBuffer();
Enumeration<ProvFormat> e = mimeTypeMap.keys();
String sep = "";
while (e.hasMoreElements()) {
ProvFormat f = e.nextElement();
if (isInputFormat(f)) {
// careful - cant use .hasMoreElements as we are filtering
mimetypes.append(sep);
sep = ",";
mimetypes.append(mimeTypeMap.get(f));
}
}
mimetypes.append(sep);
mimetypes.append("*/*;q=0.1"); // be liberal
return mimetypes.toString();
} } | public class class_name {
public String buildAcceptHeader() {
StringBuffer mimetypes = new StringBuffer();
Enumeration<ProvFormat> e = mimeTypeMap.keys();
String sep = "";
while (e.hasMoreElements()) {
ProvFormat f = e.nextElement();
if (isInputFormat(f)) {
// careful - cant use .hasMoreElements as we are filtering
mimetypes.append(sep); // depends on control dependency: [if], data = [none]
sep = ","; // depends on control dependency: [if], data = [none]
mimetypes.append(mimeTypeMap.get(f)); // depends on control dependency: [if], data = [none]
}
}
mimetypes.append(sep);
mimetypes.append("*/*;q=0.1"); // be liberal
return mimetypes.toString();
} } |
public class class_name {
final public void increment(long time, long value) {
if (!enabled)
return;
lastSampleTime = time;
if (!sync) {
count += value;
} else {
synchronized (this) {
count += value;
}
}
} } | public class class_name {
final public void increment(long time, long value) {
if (!enabled)
return;
lastSampleTime = time;
if (!sync) {
count += value; // depends on control dependency: [if], data = [none]
} else {
synchronized (this) { // depends on control dependency: [if], data = [none]
count += value;
}
}
} } |
public class class_name {
public EList<JvmFormalParameter> getImplicitFormalParameters()
{
if (implicitFormalParameters == null)
{
implicitFormalParameters = new EObjectContainmentEList<JvmFormalParameter>(JvmFormalParameter.class, this, XbasePackage.XCLOSURE__IMPLICIT_FORMAL_PARAMETERS);
}
return implicitFormalParameters;
} } | public class class_name {
public EList<JvmFormalParameter> getImplicitFormalParameters()
{
if (implicitFormalParameters == null)
{
implicitFormalParameters = new EObjectContainmentEList<JvmFormalParameter>(JvmFormalParameter.class, this, XbasePackage.XCLOSURE__IMPLICIT_FORMAL_PARAMETERS); // depends on control dependency: [if], data = [none]
}
return implicitFormalParameters;
} } |
public class class_name {
public void deploy() {
if (isDeployed) {
LOG.alreadyDeployed();
} else {
// deploy the application
RuntimeContainerDelegate.INSTANCE.get().deployProcessApplication(this);
isDeployed = true;
}
} } | public class class_name {
public void deploy() {
if (isDeployed) {
LOG.alreadyDeployed(); // depends on control dependency: [if], data = [none]
} else {
// deploy the application
RuntimeContainerDelegate.INSTANCE.get().deployProcessApplication(this); // depends on control dependency: [if], data = [none]
isDeployed = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void writeFrame() {
int clocalsSize = frame[1];
int cstackSize = frame[2];
if ((cw.version & 0xFFFF) < Opcodes.V1_6) {
stackMap.putShort(frame[0]).putShort(clocalsSize);
writeFrameTypes(3, 3 + clocalsSize);
stackMap.putShort(cstackSize);
writeFrameTypes(3 + clocalsSize, 3 + clocalsSize + cstackSize);
return;
}
int localsSize = previousFrame[1];
int type = FULL_FRAME;
int k = 0;
int delta;
if (frameCount == 0) {
delta = frame[0];
} else {
delta = frame[0] - previousFrame[0] - 1;
}
if (cstackSize == 0) {
k = clocalsSize - localsSize;
switch (k) {
case -3:
case -2:
case -1:
type = CHOP_FRAME;
localsSize = clocalsSize;
break;
case 0:
type = delta < 64 ? SAME_FRAME : SAME_FRAME_EXTENDED;
break;
case 1:
case 2:
case 3:
type = APPEND_FRAME;
break;
}
} else if (clocalsSize == localsSize && cstackSize == 1) {
type = delta < 63 ? SAME_LOCALS_1_STACK_ITEM_FRAME
: SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED;
}
if (type != FULL_FRAME) {
// verify if locals are the same
int l = 3;
for (int j = 0; j < localsSize; j++) {
if (frame[l] != previousFrame[l]) {
type = FULL_FRAME;
break;
}
l++;
}
}
switch (type) {
case SAME_FRAME:
stackMap.putByte(delta);
break;
case SAME_LOCALS_1_STACK_ITEM_FRAME:
stackMap.putByte(SAME_LOCALS_1_STACK_ITEM_FRAME + delta);
writeFrameTypes(3 + clocalsSize, 4 + clocalsSize);
break;
case SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED:
stackMap.putByte(SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED).putShort(
delta);
writeFrameTypes(3 + clocalsSize, 4 + clocalsSize);
break;
case SAME_FRAME_EXTENDED:
stackMap.putByte(SAME_FRAME_EXTENDED).putShort(delta);
break;
case CHOP_FRAME:
stackMap.putByte(SAME_FRAME_EXTENDED + k).putShort(delta);
break;
case APPEND_FRAME:
stackMap.putByte(SAME_FRAME_EXTENDED + k).putShort(delta);
writeFrameTypes(3 + localsSize, 3 + clocalsSize);
break;
// case FULL_FRAME:
default:
stackMap.putByte(FULL_FRAME).putShort(delta).putShort(clocalsSize);
writeFrameTypes(3, 3 + clocalsSize);
stackMap.putShort(cstackSize);
writeFrameTypes(3 + clocalsSize, 3 + clocalsSize + cstackSize);
}
} } | public class class_name {
private void writeFrame() {
int clocalsSize = frame[1];
int cstackSize = frame[2];
if ((cw.version & 0xFFFF) < Opcodes.V1_6) {
stackMap.putShort(frame[0]).putShort(clocalsSize); // depends on control dependency: [if], data = [none]
writeFrameTypes(3, 3 + clocalsSize); // depends on control dependency: [if], data = [none]
stackMap.putShort(cstackSize); // depends on control dependency: [if], data = [none]
writeFrameTypes(3 + clocalsSize, 3 + clocalsSize + cstackSize); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int localsSize = previousFrame[1];
int type = FULL_FRAME;
int k = 0;
int delta;
if (frameCount == 0) {
delta = frame[0]; // depends on control dependency: [if], data = [none]
} else {
delta = frame[0] - previousFrame[0] - 1; // depends on control dependency: [if], data = [none]
}
if (cstackSize == 0) {
k = clocalsSize - localsSize; // depends on control dependency: [if], data = [none]
switch (k) {
case -3:
case -2:
case -1:
type = CHOP_FRAME;
localsSize = clocalsSize;
break;
case 0:
type = delta < 64 ? SAME_FRAME : SAME_FRAME_EXTENDED;
break;
case 1:
case 2:
case 3:
type = APPEND_FRAME;
break;
}
} else if (clocalsSize == localsSize && cstackSize == 1) {
type = delta < 63 ? SAME_LOCALS_1_STACK_ITEM_FRAME
: SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED; // depends on control dependency: [if], data = [none]
}
if (type != FULL_FRAME) {
// verify if locals are the same
int l = 3;
for (int j = 0; j < localsSize; j++) {
if (frame[l] != previousFrame[l]) {
type = FULL_FRAME; // depends on control dependency: [if], data = [none]
break;
}
l++; // depends on control dependency: [for], data = [none]
}
}
switch (type) {
case SAME_FRAME:
stackMap.putByte(delta);
break;
case SAME_LOCALS_1_STACK_ITEM_FRAME:
stackMap.putByte(SAME_LOCALS_1_STACK_ITEM_FRAME + delta);
writeFrameTypes(3 + clocalsSize, 4 + clocalsSize);
break;
case SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED:
stackMap.putByte(SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED).putShort(
delta);
writeFrameTypes(3 + clocalsSize, 4 + clocalsSize);
break;
case SAME_FRAME_EXTENDED:
stackMap.putByte(SAME_FRAME_EXTENDED).putShort(delta);
break;
case CHOP_FRAME:
stackMap.putByte(SAME_FRAME_EXTENDED + k).putShort(delta);
break;
case APPEND_FRAME:
stackMap.putByte(SAME_FRAME_EXTENDED + k).putShort(delta);
writeFrameTypes(3 + localsSize, 3 + clocalsSize);
break;
// case FULL_FRAME:
default:
stackMap.putByte(FULL_FRAME).putShort(delta).putShort(clocalsSize);
writeFrameTypes(3, 3 + clocalsSize);
stackMap.putShort(cstackSize);
writeFrameTypes(3 + clocalsSize, 3 + clocalsSize + cstackSize);
}
} } |
public class class_name {
public static String encodeUri(final String uri, final String encoding) {
Matcher m = URI_PATTERN.matcher(uri);
if (m.matches()) {
String scheme = m.group(2);
String authority = m.group(3);
String userinfo = m.group(5);
String host = m.group(6);
String port = m.group(8);
String path = m.group(9);
String query = m.group(11);
String fragment = m.group(13);
return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding);
}
throw new IllegalArgumentException("Invalid URI: " + uri);
} } | public class class_name {
public static String encodeUri(final String uri, final String encoding) {
Matcher m = URI_PATTERN.matcher(uri);
if (m.matches()) {
String scheme = m.group(2);
String authority = m.group(3);
String userinfo = m.group(5);
String host = m.group(6);
String port = m.group(8);
String path = m.group(9);
String query = m.group(11);
String fragment = m.group(13);
return encodeUriComponents(scheme, authority, userinfo, host, port, path, query, fragment, encoding); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Invalid URI: " + uri);
} } |
public class class_name {
public static int getNumParameters(String methodSignature) {
int start = methodSignature.indexOf('(') + 1;
int limit = methodSignature.lastIndexOf(')');
if ((limit - start) == 0) {
return 0;
}
int numParms = 0;
for (int i = start; i < limit; i++) {
if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) {
if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) {
i = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1);
} else if (isWonkyEclipseSignature(methodSignature, i)) {
continue;
}
numParms++;
}
}
return numParms;
} } | public class class_name {
public static int getNumParameters(String methodSignature) {
int start = methodSignature.indexOf('(') + 1;
int limit = methodSignature.lastIndexOf(')');
if ((limit - start) == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
int numParms = 0;
for (int i = start; i < limit; i++) {
if (!methodSignature.startsWith(Values.SIG_ARRAY_PREFIX, i)) {
if (methodSignature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX, i)) {
i = methodSignature.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR, i + 1); // depends on control dependency: [if], data = [none]
} else if (isWonkyEclipseSignature(methodSignature, i)) {
continue;
}
numParms++; // depends on control dependency: [if], data = [none]
}
}
return numParms;
} } |
public class class_name {
public static void validateInterfaceBasics
(Class<?> remoteHome,
Class<?> remoteInterface,
Class<?> localHome,
Class<?> localInterface,
Class<?> webServiceEndpointInterface,
Class<?>[] remoteBusinessInterfaces,
Class<?>[] localBusinessInterfaces,
Class<?> ejbClass,
String beanName,
int beanType)
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d576626
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "validateInterfaceBasics : " + beanName);
if (remoteHome != null)
{
EJBHomeImpl.validateInterfaceBasics(remoteHome,
remoteInterface,
REMOTE_HOME,
beanName,
beanType); // d461100
}
if (remoteInterface != null)
{
EJBWrapper.validateInterfaceBasics(remoteInterface,
REMOTE,
beanName);
if (remoteHome == null)
{
// Log the error and throw meaningful exception. d457128.2
Tr.error(tc, "JIT_MISSING_REMOTE_HOME_CNTR5001E",
new Object[] { beanName,
remoteInterface.getName() });
throw new EJBConfigurationException("An EJB remote component interface requires a remote-home interface : "
+ remoteInterface.getName() + " on EJB " + beanName);
}
}
if (localHome != null)
{
EJBHomeImpl.validateInterfaceBasics(localHome,
localInterface,
LOCAL_HOME,
beanName,
beanType); // d461100
}
if (localInterface != null &&
beanType != InternalConstants.TYPE_MESSAGE_DRIVEN) // d443878.1
{
EJBWrapper.validateInterfaceBasics(localInterface,
LOCAL,
beanName);
if (localHome == null)
{
// Log the error and throw meaningful exception. d457128.2
Tr.error(tc, "JIT_MISSING_LOCAL_HOME_CNTR5002E",
new Object[] { beanName,
localInterface.getName() });
throw new EJBConfigurationException("An EJB local component interface requires a local-home interface : "
+ localInterface.getName() + " on EJB " + beanName);
}
}
// JITDeploy now generates the WebService Endpoint wrappers. LI3294-35
if (webServiceEndpointInterface != null)
{
EJBWrapper.validateInterfaceBasics(webServiceEndpointInterface,
SERVICE_ENDPOINT,
beanName);
}
if (remoteBusinessInterfaces != null)
{
for (Class<?> remote : remoteBusinessInterfaces)
{
EJBWrapper.validateInterfaceBasics(remote,
BUSINESS_REMOTE,
beanName);
}
}
if (localBusinessInterfaces != null)
{
EJBWrapperType wrapperType = null;
for (Class<?> local : localBusinessInterfaces)
{
// No-Interface if it is the EJB class, otherwise local. F743-1756
wrapperType = (local == ejbClass) ? LOCAL_BEAN : BUSINESS_LOCAL;
EJBWrapper.validateInterfaceBasics(local,
wrapperType,
beanName);
}
}
// Also validate the EJB Class implementation. d457128
if (ejbClass != null)
{
EJBUtils.validateEjbClass(ejbClass,
beanName,
beanType);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "validateInterfaceBasics : " + beanName);
} } | public class class_name {
public static void validateInterfaceBasics
(Class<?> remoteHome,
Class<?> remoteInterface,
Class<?> localHome,
Class<?> localInterface,
Class<?> webServiceEndpointInterface,
Class<?>[] remoteBusinessInterfaces,
Class<?>[] localBusinessInterfaces,
Class<?> ejbClass,
String beanName,
int beanType)
throws EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d576626
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "validateInterfaceBasics : " + beanName);
if (remoteHome != null)
{
EJBHomeImpl.validateInterfaceBasics(remoteHome,
remoteInterface,
REMOTE_HOME,
beanName,
beanType); // d461100
}
if (remoteInterface != null)
{
EJBWrapper.validateInterfaceBasics(remoteInterface,
REMOTE,
beanName);
if (remoteHome == null)
{
// Log the error and throw meaningful exception. d457128.2
Tr.error(tc, "JIT_MISSING_REMOTE_HOME_CNTR5001E",
new Object[] { beanName,
remoteInterface.getName() }); // depends on control dependency: [if], data = [none]
throw new EJBConfigurationException("An EJB remote component interface requires a remote-home interface : "
+ remoteInterface.getName() + " on EJB " + beanName);
}
}
if (localHome != null)
{
EJBHomeImpl.validateInterfaceBasics(localHome,
localInterface,
LOCAL_HOME,
beanName,
beanType); // d461100
}
if (localInterface != null &&
beanType != InternalConstants.TYPE_MESSAGE_DRIVEN) // d443878.1
{
EJBWrapper.validateInterfaceBasics(localInterface,
LOCAL,
beanName);
if (localHome == null)
{
// Log the error and throw meaningful exception. d457128.2
Tr.error(tc, "JIT_MISSING_LOCAL_HOME_CNTR5002E",
new Object[] { beanName,
localInterface.getName() }); // depends on control dependency: [if], data = [none]
throw new EJBConfigurationException("An EJB local component interface requires a local-home interface : "
+ localInterface.getName() + " on EJB " + beanName);
}
}
// JITDeploy now generates the WebService Endpoint wrappers. LI3294-35
if (webServiceEndpointInterface != null)
{
EJBWrapper.validateInterfaceBasics(webServiceEndpointInterface,
SERVICE_ENDPOINT,
beanName);
}
if (remoteBusinessInterfaces != null)
{
for (Class<?> remote : remoteBusinessInterfaces)
{
EJBWrapper.validateInterfaceBasics(remote,
BUSINESS_REMOTE,
beanName); // depends on control dependency: [for], data = [remote]
}
}
if (localBusinessInterfaces != null)
{
EJBWrapperType wrapperType = null;
for (Class<?> local : localBusinessInterfaces)
{
// No-Interface if it is the EJB class, otherwise local. F743-1756
wrapperType = (local == ejbClass) ? LOCAL_BEAN : BUSINESS_LOCAL;
EJBWrapper.validateInterfaceBasics(local,
wrapperType,
beanName);
}
}
// Also validate the EJB Class implementation. d457128
if (ejbClass != null)
{
EJBUtils.validateEjbClass(ejbClass,
beanName,
beanType);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "validateInterfaceBasics : " + beanName);
} } |
public class class_name {
public void recordCheckoutTimeUs(SocketDestination dest, long checkoutTimeUs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutTimeUs(null, checkoutTimeUs);
recordCheckoutTimeUs(null, checkoutTimeUs);
} else {
this.checkoutTimeRequestCounter.addRequest(checkoutTimeUs * Time.NS_PER_US);
}
} } | public class class_name {
public void recordCheckoutTimeUs(SocketDestination dest, long checkoutTimeUs) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutTimeUs(null, checkoutTimeUs); // depends on control dependency: [if], data = [(dest]
recordCheckoutTimeUs(null, checkoutTimeUs); // depends on control dependency: [if], data = [none]
} else {
this.checkoutTimeRequestCounter.addRequest(checkoutTimeUs * Time.NS_PER_US); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void checkAndNotify(final FileStatusEntry parent, final FileStatusEntry[] previous, final Path[] currentPaths)
throws IOException {
int c = 0;
final FileStatusEntry[] current =
currentPaths.length > 0 ? new FileStatusEntry[currentPaths.length] : FileStatusEntry.EMPTY_ENTRIES;
for (final FileStatusEntry previousEntry : previous) {
while (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) > 0) {
current[c] = createPathEntry(parent, currentPaths[c]);
doCreate(current[c]);
c++;
}
if (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) == 0) {
doMatch(previousEntry, currentPaths[c]);
checkAndNotify(previousEntry, previousEntry.getChildren(), listPaths(currentPaths[c]));
current[c] = previousEntry;
c++;
} else {
checkAndNotify(previousEntry, previousEntry.getChildren(), EMPTY_PATH_ARRAY);
doDelete(previousEntry);
}
}
for (; c < currentPaths.length; c++) {
current[c] = createPathEntry(parent, currentPaths[c]);
doCreate(current[c]);
}
parent.setChildren(current);
} } | public class class_name {
private void checkAndNotify(final FileStatusEntry parent, final FileStatusEntry[] previous, final Path[] currentPaths)
throws IOException {
int c = 0;
final FileStatusEntry[] current =
currentPaths.length > 0 ? new FileStatusEntry[currentPaths.length] : FileStatusEntry.EMPTY_ENTRIES;
for (final FileStatusEntry previousEntry : previous) {
while (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) > 0) {
current[c] = createPathEntry(parent, currentPaths[c]); // depends on control dependency: [while], data = [none]
doCreate(current[c]); // depends on control dependency: [while], data = [none]
c++; // depends on control dependency: [while], data = [none]
}
if (c < currentPaths.length && comparator.compare(previousEntry.getPath(), currentPaths[c]) == 0) {
doMatch(previousEntry, currentPaths[c]); // depends on control dependency: [if], data = [none]
checkAndNotify(previousEntry, previousEntry.getChildren(), listPaths(currentPaths[c])); // depends on control dependency: [if], data = [none]
current[c] = previousEntry; // depends on control dependency: [if], data = [none]
c++; // depends on control dependency: [if], data = [none]
} else {
checkAndNotify(previousEntry, previousEntry.getChildren(), EMPTY_PATH_ARRAY); // depends on control dependency: [if], data = [none]
doDelete(previousEntry); // depends on control dependency: [if], data = [none]
}
}
for (; c < currentPaths.length; c++) {
current[c] = createPathEntry(parent, currentPaths[c]);
doCreate(current[c]);
}
parent.setChildren(current);
} } |
public class class_name {
public static ReposTag parseRepositoryTag(String name) {
int n = name.lastIndexOf(':');
if (n < 0) {
return new ReposTag(name, "");
}
String tag = name.substring(n + 1);
if (StringUtils.containsIgnoreCase(name, SHA256_SEPARATOR)) {
return new ReposTag(name, "");
}
if (!tag.contains("/")) {
return new ReposTag(name.substring(0, n), tag);
}
return new ReposTag(name, "");
} } | public class class_name {
public static ReposTag parseRepositoryTag(String name) {
int n = name.lastIndexOf(':');
if (n < 0) {
return new ReposTag(name, ""); // depends on control dependency: [if], data = [(n]
}
String tag = name.substring(n + 1);
if (StringUtils.containsIgnoreCase(name, SHA256_SEPARATOR)) {
return new ReposTag(name, ""); // depends on control dependency: [if], data = [none]
}
if (!tag.contains("/")) {
return new ReposTag(name.substring(0, n), tag); // depends on control dependency: [if], data = [none]
}
return new ReposTag(name, "");
} } |
public class class_name {
@Override
public Appendable append(CharSequence csq, int start, int end) {
final int otherLen = end - start;
grow(this.len + otherLen);
for (int pos = start; pos < end; pos++) {
this.value[this.len + pos] = csq.charAt(pos);
}
this.len += otherLen;
return this;
} } | public class class_name {
@Override
public Appendable append(CharSequence csq, int start, int end) {
final int otherLen = end - start;
grow(this.len + otherLen);
for (int pos = start; pos < end; pos++) {
this.value[this.len + pos] = csq.charAt(pos); // depends on control dependency: [for], data = [pos]
}
this.len += otherLen;
return this;
} } |
public class class_name {
public int[] gridAt( double x, double y ) {
if (isInRaster(x, y)) {
GridGeometry2D gridGeometry = getGridGeometry();
int[] colRowFromCoordinate = CoverageUtilities.colRowFromCoordinate(new Coordinate(x, y), gridGeometry, null);
return colRowFromCoordinate;
}
return null;
} } | public class class_name {
public int[] gridAt( double x, double y ) {
if (isInRaster(x, y)) {
GridGeometry2D gridGeometry = getGridGeometry();
int[] colRowFromCoordinate = CoverageUtilities.colRowFromCoordinate(new Coordinate(x, y), gridGeometry, null);
return colRowFromCoordinate; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public JobAddOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public JobAddOptions 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 {
private static void drawLine(int... widths) {
for (int width : widths) {
for (int i = 1; i < width; i++) {
System.out.print('-');
}
System.out.print('+');
}
System.out.println();
} } | public class class_name {
private static void drawLine(int... widths) {
for (int width : widths) {
for (int i = 1; i < width; i++) {
System.out.print('-'); // depends on control dependency: [for], data = [none]
}
System.out.print('+'); // depends on control dependency: [for], data = [none]
}
System.out.println();
} } |
public class class_name {
@When("^I delete the text '(.+?)' on the element on index '(\\d+?)'( and replace it for '(.+?)')?$")
public void seleniumDelete(String text, Integer index, String foo, String replacement) {
assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
Actions actions = new Actions(commonspec.getDriver());
actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index), (text.length() / 2), 0);
for (int i = 0; i < (text.length() / 2); i++) {
actions.sendKeys(Keys.ARROW_LEFT);
actions.build().perform();
}
for (int i = 0; i < text.length(); i++) {
actions.sendKeys(Keys.DELETE);
actions.build().perform();
}
if (replacement != null && replacement.length() != 0) {
actions.sendKeys(replacement);
actions.build().perform();
}
} } | public class class_name {
@When("^I delete the text '(.+?)' on the element on index '(\\d+?)'( and replace it for '(.+?)')?$")
public void seleniumDelete(String text, Integer index, String foo, String replacement) {
assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
Actions actions = new Actions(commonspec.getDriver());
actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index), (text.length() / 2), 0);
for (int i = 0; i < (text.length() / 2); i++) {
actions.sendKeys(Keys.ARROW_LEFT); // depends on control dependency: [for], data = [none]
actions.build().perform(); // depends on control dependency: [for], data = [none]
}
for (int i = 0; i < text.length(); i++) {
actions.sendKeys(Keys.DELETE); // depends on control dependency: [for], data = [none]
actions.build().perform(); // depends on control dependency: [for], data = [none]
}
if (replacement != null && replacement.length() != 0) {
actions.sendKeys(replacement); // depends on control dependency: [if], data = [(replacement]
actions.build().perform(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static final MQLinkManager getInstance()
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getInstance");
if (mqLinkManager == null)
{
try
{
Class cls = Class.forName(CommsConstants.JS_COMMS_MQ_LINK_MANAGER_CLASS);
mqLinkManager = (MQLinkManager) cls.newInstance();
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getInstance",
"1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
SibTr.exception(tc, e);
}
throw new RuntimeException(e);
}
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getInstance", mqLinkManager);
return mqLinkManager;
} } | public class class_name {
public static final MQLinkManager getInstance()
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getInstance");
if (mqLinkManager == null)
{
try
{
Class cls = Class.forName(CommsConstants.JS_COMMS_MQ_LINK_MANAGER_CLASS);
mqLinkManager = (MQLinkManager) cls.newInstance();
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".getInstance",
"1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
{
SibTr.exception(tc, e); // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getInstance", mqLinkManager);
return mqLinkManager;
} } |
public class class_name {
public void marshall(KinesisStreamsInput kinesisStreamsInput, ProtocolMarshaller protocolMarshaller) {
if (kinesisStreamsInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(kinesisStreamsInput.getResourceARN(), RESOURCEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(KinesisStreamsInput kinesisStreamsInput, ProtocolMarshaller protocolMarshaller) {
if (kinesisStreamsInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(kinesisStreamsInput.getResourceARN(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void resolveNeutralTypes(int start, int limit, byte level, byte sor, byte eor) {
for (int i = start; i < limit; ++i) {
byte t = resultTypes[i];
if (t == WS || t == ON || t == B || t == S) {
// find bounds of run of neutrals
int runstart = i;
int runlimit = findRunLimit(runstart, limit, new byte[] {B, S, WS, ON});
// determine effective types at ends of run
byte leadingType;
byte trailingType;
if (runstart == start) {
leadingType = sor;
} else {
leadingType = resultTypes[runstart - 1];
if (leadingType == L || leadingType == R) {
// found the strong type
} else if (leadingType == AN) {
leadingType = R;
} else if (leadingType == EN) {
// Since EN's with previous strong L types have been changed
// to L in W7, the leadingType must be R.
leadingType = R;
}
}
if (runlimit == limit) {
trailingType = eor;
} else {
trailingType = resultTypes[runlimit];
if (trailingType == L || trailingType == R) {
// found the strong type
} else if (trailingType == AN) {
trailingType = R;
} else if (trailingType == EN) {
trailingType = R;
}
}
byte resolvedType;
if (leadingType == trailingType) {
// Rule N1.
resolvedType = leadingType;
} else {
// Rule N2.
// Notice the embedding level of the run is used, not
// the paragraph embedding level.
resolvedType = typeForLevel(level);
}
setTypes(runstart, runlimit, resolvedType);
// skip over run of (former) neutrals
i = runlimit;
}
}
} } | public class class_name {
private void resolveNeutralTypes(int start, int limit, byte level, byte sor, byte eor) {
for (int i = start; i < limit; ++i) {
byte t = resultTypes[i];
if (t == WS || t == ON || t == B || t == S) {
// find bounds of run of neutrals
int runstart = i;
int runlimit = findRunLimit(runstart, limit, new byte[] {B, S, WS, ON});
// determine effective types at ends of run
byte leadingType;
byte trailingType;
if (runstart == start) {
leadingType = sor; // depends on control dependency: [if], data = [none]
} else {
leadingType = resultTypes[runstart - 1]; // depends on control dependency: [if], data = [none]
if (leadingType == L || leadingType == R) {
// found the strong type
} else if (leadingType == AN) {
leadingType = R; // depends on control dependency: [if], data = [none]
} else if (leadingType == EN) {
// Since EN's with previous strong L types have been changed
// to L in W7, the leadingType must be R.
leadingType = R; // depends on control dependency: [if], data = [none]
}
}
if (runlimit == limit) {
trailingType = eor; // depends on control dependency: [if], data = [none]
} else {
trailingType = resultTypes[runlimit]; // depends on control dependency: [if], data = [none]
if (trailingType == L || trailingType == R) {
// found the strong type
} else if (trailingType == AN) {
trailingType = R; // depends on control dependency: [if], data = [none]
} else if (trailingType == EN) {
trailingType = R; // depends on control dependency: [if], data = [none]
}
}
byte resolvedType;
if (leadingType == trailingType) {
// Rule N1.
resolvedType = leadingType; // depends on control dependency: [if], data = [none]
} else {
// Rule N2.
// Notice the embedding level of the run is used, not
// the paragraph embedding level.
resolvedType = typeForLevel(level); // depends on control dependency: [if], data = [none]
}
setTypes(runstart, runlimit, resolvedType); // depends on control dependency: [if], data = [none]
// skip over run of (former) neutrals
i = runlimit; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public int indexOf(int[] sequence) {
int index = -1;
for (int i = 0; index == -1 && i <= currentSize - sequence.length;
i++) {
if (buffer[i] == sequence[0]) {
boolean matches = true;
for (int j = 1; matches && j < sequence.length; j++) {
if (buffer[i + j] != sequence[j]) {
matches = false;
}
}
if (matches) {
index = i;
}
}
}
return index;
} } | public class class_name {
public int indexOf(int[] sequence) {
int index = -1;
for (int i = 0; index == -1 && i <= currentSize - sequence.length;
i++) {
if (buffer[i] == sequence[0]) {
boolean matches = true;
for (int j = 1; matches && j < sequence.length; j++) {
if (buffer[i + j] != sequence[j]) {
matches = false; // depends on control dependency: [if], data = [none]
}
}
if (matches) {
index = i; // depends on control dependency: [if], data = [none]
}
}
}
return index;
} } |
public class class_name {
public static String getRDFNamespaceForJcrNamespace(
final String jcrNamespaceUri) {
if (jcrNamespacesToRDFNamespaces.containsKey(jcrNamespaceUri)) {
return jcrNamespacesToRDFNamespaces.get(jcrNamespaceUri);
}
return jcrNamespaceUri;
} } | public class class_name {
public static String getRDFNamespaceForJcrNamespace(
final String jcrNamespaceUri) {
if (jcrNamespacesToRDFNamespaces.containsKey(jcrNamespaceUri)) {
return jcrNamespacesToRDFNamespaces.get(jcrNamespaceUri); // depends on control dependency: [if], data = [none]
}
return jcrNamespaceUri;
} } |
public class class_name {
private void loadProperties(File propFile) {
if (propFile == null) {
return;
}
try {
loadProperties(new FileInputStream(propFile), propFile.getAbsolutePath());
}
catch (FileNotFoundException e) {
Console.warn("Unable to find properties file ["+propFile.getAbsolutePath()+"].");
}
} } | public class class_name {
private void loadProperties(File propFile) {
if (propFile == null) {
return;
// depends on control dependency: [if], data = [none]
}
try {
loadProperties(new FileInputStream(propFile), propFile.getAbsolutePath());
// depends on control dependency: [try], data = [none]
}
catch (FileNotFoundException e) {
Console.warn("Unable to find properties file ["+propFile.getAbsolutePath()+"].");
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void commentLinesAfter( String content, int line )
{
int offset = _root.getElement( line ).getEndOffset();
// End of comment not found, nothing to do
int endDelimiter = indexOf( content, getEndDelimiter(), offset );
if( endDelimiter < 0 )
{
return;
}
// Matching start/end of comment found, comment the lines
int startDelimiter = lastIndexOf( content, getStartDelimiter(), endDelimiter );
if( startDelimiter < 0 || startDelimiter <= offset )
{
setCharacterAttributes( offset, endDelimiter - offset + 1, _comment, false );
}
} } | public class class_name {
private void commentLinesAfter( String content, int line )
{
int offset = _root.getElement( line ).getEndOffset();
// End of comment not found, nothing to do
int endDelimiter = indexOf( content, getEndDelimiter(), offset );
if( endDelimiter < 0 )
{
return; // depends on control dependency: [if], data = [none]
}
// Matching start/end of comment found, comment the lines
int startDelimiter = lastIndexOf( content, getStartDelimiter(), endDelimiter );
if( startDelimiter < 0 || startDelimiter <= offset )
{
setCharacterAttributes( offset, endDelimiter - offset + 1, _comment, false ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getFlexCacheKeyDump() {
if (m_flexCache != null) {
StringBuffer buffer = new StringBuffer();
m_flexCache.dumpKeys(buffer);
return buffer.toString();
} else {
return null;
}
} } | public class class_name {
public String getFlexCacheKeyDump() {
if (m_flexCache != null) {
StringBuffer buffer = new StringBuffer();
m_flexCache.dumpKeys(buffer); // depends on control dependency: [if], data = [none]
return buffer.toString(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<Geometry> flatFeatureList(Geometry geom) {
final List<Geometry> singleGeoms = new ArrayList<>();
final Stack<Geometry> geomStack = new Stack<>();
Geometry nextGeom;
int nextGeomCount;
geomStack.push(geom);
while(!geomStack.isEmpty()) {
nextGeom = geomStack.pop();
if(nextGeom instanceof Point
|| nextGeom instanceof MultiPoint
|| nextGeom instanceof LineString
|| nextGeom instanceof MultiLineString
|| nextGeom instanceof Polygon
|| nextGeom instanceof MultiPolygon) {
singleGeoms.add(nextGeom);
} else if(nextGeom instanceof GeometryCollection) {
// Push all child geometries
nextGeomCount = nextGeom.getNumGeometries();
for(int i = 0; i < nextGeomCount; ++i) {
geomStack.push(nextGeom.getGeometryN(i));
}
}
}
return singleGeoms;
} } | public class class_name {
public static List<Geometry> flatFeatureList(Geometry geom) {
final List<Geometry> singleGeoms = new ArrayList<>();
final Stack<Geometry> geomStack = new Stack<>();
Geometry nextGeom;
int nextGeomCount;
geomStack.push(geom);
while(!geomStack.isEmpty()) {
nextGeom = geomStack.pop(); // depends on control dependency: [while], data = [none]
if(nextGeom instanceof Point
|| nextGeom instanceof MultiPoint
|| nextGeom instanceof LineString
|| nextGeom instanceof MultiLineString
|| nextGeom instanceof Polygon
|| nextGeom instanceof MultiPolygon) {
singleGeoms.add(nextGeom); // depends on control dependency: [if], data = [none]
} else if(nextGeom instanceof GeometryCollection) {
// Push all child geometries
nextGeomCount = nextGeom.getNumGeometries(); // depends on control dependency: [if], data = [none]
for(int i = 0; i < nextGeomCount; ++i) {
geomStack.push(nextGeom.getGeometryN(i)); // depends on control dependency: [for], data = [i]
}
}
}
return singleGeoms;
} } |
public class class_name {
private boolean rsyncRecoveryIndexFromCoordinator() throws IOException
{
File indexDirectory = new File(handler.getContext().getIndexDirectory());
RSyncConfiguration rSyncConfiguration = handler.getRsyncConfiguration();
try
{
IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
// check if index not ready
if (!indexRecovery.checkIndexReady())
{
return false;
}
try
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index offline
indexRecovery.setIndexOffline();
}
String indexPath = handler.getContext().getIndexDirectory();
String urlFormatString =rSyncConfiguration.generateRsyncSource(indexPath);
RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, indexRecovery.getCoordinatorAddress()), indexPath,
rSyncConfiguration.getRsyncUserName(), rSyncConfiguration.getRsyncPassword(), OfflinePersistentIndex.NAME);
rSyncJob.execute();
}
finally
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index online
indexRecovery.setIndexOnline();
}
}
//recovery finish correctly
return true;
}
catch (RepositoryException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
} catch (RepositoryConfigurationException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
}
LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath());
DirectoryHelper.removeDirectory(indexDirectory);
return false;
} } | public class class_name {
private boolean rsyncRecoveryIndexFromCoordinator() throws IOException
{
File indexDirectory = new File(handler.getContext().getIndexDirectory());
RSyncConfiguration rSyncConfiguration = handler.getRsyncConfiguration();
try
{
IndexRecovery indexRecovery = handler.getContext().getIndexRecovery();
// check if index not ready
if (!indexRecovery.checkIndexReady())
{
return false; // depends on control dependency: [if], data = [none]
}
try
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index offline
indexRecovery.setIndexOffline(); // depends on control dependency: [if], data = [none]
}
String indexPath = handler.getContext().getIndexDirectory();
String urlFormatString =rSyncConfiguration.generateRsyncSource(indexPath);
RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, indexRecovery.getCoordinatorAddress()), indexPath,
rSyncConfiguration.getRsyncUserName(), rSyncConfiguration.getRsyncPassword(), OfflinePersistentIndex.NAME);
rSyncJob.execute(); // depends on control dependency: [try], data = [none]
}
finally
{
if(rSyncConfiguration.isRsyncOffline())
{
//Switch index online
indexRecovery.setIndexOnline(); // depends on control dependency: [if], data = [none]
}
}
//recovery finish correctly
return true;
}
catch (RepositoryException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
} catch (RepositoryConfigurationException e)
{
LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing",
e);
}
LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath());
DirectoryHelper.removeDirectory(indexDirectory);
return false;
} } |
public class class_name {
private static boolean isSelector( StringBuilder builder ) {
int length = builder.length();
if( length == 0 ) {
return false;
}
switch( builder.charAt( 0 ) ) {
case '.': // Mixin
case '#': // Mixin
break;
default:
return true;
}
for( int i = 1; i < length; i++ ) {
char ch = builder.charAt( i );
switch( ch ) {
case '>':
case ':':
return true;
}
}
return false;
} } | public class class_name {
private static boolean isSelector( StringBuilder builder ) {
int length = builder.length();
if( length == 0 ) {
return false; // depends on control dependency: [if], data = [none]
}
switch( builder.charAt( 0 ) ) {
case '.': // Mixin
case '#': // Mixin
break;
default:
return true;
}
for( int i = 1; i < length; i++ ) {
char ch = builder.charAt( i );
switch( ch ) {
case '>':
case ':':
return true;
}
}
return false;
} } |
public class class_name {
private Map<CtClass, Set<CtMethod>> find(final CtMethod declaredMethod, final int level, final Map<CtClass, Set<CtMethod>> dict) {
if (level < 0) {
throw new IllegalArgumentException("level < 0");
}
addToMap(declaredMethod.getDeclaringClass(), declaredMethod, dict);
if (level > 0) {
try {
declaredMethod.instrument(new ExprEditor() {
@Override
public void edit(final MethodCall m) throws CannotCompileException {
try {
CtMethod method = m.getMethod();
LOG.info(method.getLongName() + " / " + level);
find(method, level - 1, dict);
} catch (NotFoundException e) {
e.printStackTrace(); // should not happen
}
super.edit(m);
}
});
} catch (CannotCompileException e) {
// cannot possibly be thrown due to the fact that we don't change anything here
e.printStackTrace();
}
}
return dict;
} } | public class class_name {
private Map<CtClass, Set<CtMethod>> find(final CtMethod declaredMethod, final int level, final Map<CtClass, Set<CtMethod>> dict) {
if (level < 0) {
throw new IllegalArgumentException("level < 0");
}
addToMap(declaredMethod.getDeclaringClass(), declaredMethod, dict);
if (level > 0) {
try {
declaredMethod.instrument(new ExprEditor() {
@Override
public void edit(final MethodCall m) throws CannotCompileException {
try {
CtMethod method = m.getMethod();
LOG.info(method.getLongName() + " / " + level);
find(method, level - 1, dict);
} catch (NotFoundException e) {
e.printStackTrace(); // should not happen
}
super.edit(m);
}
}); // depends on control dependency: [try], data = [none]
} catch (CannotCompileException e) {
// cannot possibly be thrown due to the fact that we don't change anything here
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return dict;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> map) {
Comparator<? super K> comparator = map.comparator();
if (comparator == null) {
// If map has a null comparator, the keys should have a natural ordering,
// even though K doesn't explicitly implement Comparable.
comparator = (Comparator<? super K>) NATURAL_ORDER;
}
if (map instanceof ImmutableSortedMap) {
// TODO(kevinb): Prove that this cast is safe, even though
// Collections.unmodifiableSortedMap requires the same key type.
@SuppressWarnings("unchecked")
ImmutableSortedMap<K, V> kvMap = (ImmutableSortedMap<K, V>) map;
if (!kvMap.isPartialView()) {
return kvMap;
}
}
return fromEntries(comparator, true, map.entrySet());
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> map) {
Comparator<? super K> comparator = map.comparator();
if (comparator == null) {
// If map has a null comparator, the keys should have a natural ordering,
// even though K doesn't explicitly implement Comparable.
comparator = (Comparator<? super K>) NATURAL_ORDER; // depends on control dependency: [if], data = [none]
}
if (map instanceof ImmutableSortedMap) {
// TODO(kevinb): Prove that this cast is safe, even though
// Collections.unmodifiableSortedMap requires the same key type.
@SuppressWarnings("unchecked")
ImmutableSortedMap<K, V> kvMap = (ImmutableSortedMap<K, V>) map;
if (!kvMap.isPartialView()) {
return kvMap; // depends on control dependency: [if], data = [none]
}
}
return fromEntries(comparator, true, map.entrySet());
} } |
public class class_name {
private int getStartingPoint(String buffer) {
for (int i = 0; i < buffer.length(); i++) {
if (!Character.isWhitespace(buffer.charAt(i))) {
return i;
}
}
return buffer.length();
} } | public class class_name {
private int getStartingPoint(String buffer) {
for (int i = 0; i < buffer.length(); i++) {
if (!Character.isWhitespace(buffer.charAt(i))) {
return i; // depends on control dependency: [if], data = [none]
}
}
return buffer.length();
} } |
public class class_name {
public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
build();
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.flatten(true);
}
for (InvoiceItem item : proposedItems) {
final UUID subscriptionId = getSubscriptionId(item, null);
SubscriptionItemTree tree = subscriptionItemTree.get(subscriptionId);
if (tree == null) {
tree = new SubscriptionItemTree(subscriptionId, targetInvoiceId);
subscriptionItemTree.put(subscriptionId, tree);
}
tree.mergeProposedItem(item);
}
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.buildForMerge();
}
} } | public class class_name {
public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
build();
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.flatten(true); // depends on control dependency: [for], data = [tree]
}
for (InvoiceItem item : proposedItems) {
final UUID subscriptionId = getSubscriptionId(item, null);
SubscriptionItemTree tree = subscriptionItemTree.get(subscriptionId);
if (tree == null) {
tree = new SubscriptionItemTree(subscriptionId, targetInvoiceId); // depends on control dependency: [if], data = [none]
subscriptionItemTree.put(subscriptionId, tree); // depends on control dependency: [if], data = [none]
}
tree.mergeProposedItem(item); // depends on control dependency: [for], data = [item]
}
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.buildForMerge(); // depends on control dependency: [for], data = [tree]
}
} } |
public class class_name {
public PhotoContext getContext(String photoId, String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("user_id", userId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> payload = response.getPayloadCollection();
PhotoContext photoContext = new PhotoContext();
for (Element element : payload) {
String elementName = element.getTagName();
if (elementName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setPreviousPhoto(photo);
} else if (elementName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setNextPhoto(photo);
} else {
if (logger.isInfoEnabled()) {
logger.info("unsupported element name: " + elementName);
}
}
}
return photoContext;
} } | public class class_name {
public PhotoContext getContext(String photoId, String userId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("user_id", userId);
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection<Element> payload = response.getPayloadCollection();
PhotoContext photoContext = new PhotoContext();
for (Element element : payload) {
String elementName = element.getTagName();
if (elementName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
// depends on control dependency: [if], data = [none]
photoContext.setPreviousPhoto(photo);
// depends on control dependency: [if], data = [none]
} else if (elementName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
// depends on control dependency: [if], data = [none]
photoContext.setNextPhoto(photo);
// depends on control dependency: [if], data = [none]
} else {
if (logger.isInfoEnabled()) {
logger.info("unsupported element name: " + elementName);
// depends on control dependency: [if], data = [none]
}
}
}
return photoContext;
} } |
public class class_name {
@Override
public String[] getSheetNames()
{
String[] ret = null;
if(sheets != null)
{
ret = new String[sheets.size()];
for(int i = 0; i < sheets.size(); i++)
{
Sheet sheet = (Sheet)sheets.get(i);
ret[i] = sheet.getName();
}
}
return ret;
} } | public class class_name {
@Override
public String[] getSheetNames()
{
String[] ret = null;
if(sheets != null)
{
ret = new String[sheets.size()]; // depends on control dependency: [if], data = [none]
for(int i = 0; i < sheets.size(); i++)
{
Sheet sheet = (Sheet)sheets.get(i);
ret[i] = sheet.getName(); // depends on control dependency: [for], data = [i]
}
}
return ret;
} } |
public class class_name {
private StageLibraryDelegate createInstance(StageLibraryDelegateDefinitition def) {
StageLibraryDelegate instance = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(def.getClassLoader());
instance = def.getKlass().newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
LOG.error("Can't create instance of delegator: " + ex.toString(), ex);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
return instance;
} } | public class class_name {
private StageLibraryDelegate createInstance(StageLibraryDelegateDefinitition def) {
StageLibraryDelegate instance = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(def.getClassLoader()); // depends on control dependency: [try], data = [none]
instance = def.getKlass().newInstance(); // depends on control dependency: [try], data = [none]
} catch (InstantiationException | IllegalAccessException ex) {
LOG.error("Can't create instance of delegator: " + ex.toString(), ex);
} finally { // depends on control dependency: [catch], data = [none]
Thread.currentThread().setContextClassLoader(classLoader);
}
return instance;
} } |
public class class_name {
public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"),
configuration.getText("doclet.interfaces"));
String[] interfaceTableHeader = new String[] {
configuration.getText("doclet.Interface"),
configuration.getText("doclet.Description")
};
ClassDoc[] interfaces =
packageDoc.isIncluded()
? packageDoc.interfaces()
: configuration.classDocCatalog.interfaces(
Util.getPackageName(packageDoc));
if (interfaces.length > 0) {
profilePackageWriter.addClassesSummary(
interfaces,
configuration.getText("doclet.Interface_Summary"),
interfaceTableSummary, interfaceTableHeader, summaryContentTree);
}
} } | public class class_name {
public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"),
configuration.getText("doclet.interfaces"));
String[] interfaceTableHeader = new String[] {
configuration.getText("doclet.Interface"),
configuration.getText("doclet.Description")
};
ClassDoc[] interfaces =
packageDoc.isIncluded()
? packageDoc.interfaces()
: configuration.classDocCatalog.interfaces(
Util.getPackageName(packageDoc));
if (interfaces.length > 0) {
profilePackageWriter.addClassesSummary(
interfaces,
configuration.getText("doclet.Interface_Summary"),
interfaceTableSummary, interfaceTableHeader, summaryContentTree); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.