code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public Iterator<URL> getResources(String name) {
ArrayList<URL> collectedResources = new ArrayList<URL>();
for (IClassResolver resolver : resolvers) {
try {
Iterator<URL> iterator = resolver.getResources(name);
if (iterator == null) {
continue;
}
while (iterator.hasNext()) {
collectedResources.add(iterator.next());
}
} catch (RuntimeException e) {
LOGGER.warn("ClassResolver {} threw an unexpected exception.", resolver, e);
return collectedResources.iterator();
}
}
return collectedResources.iterator();
} } | public class class_name {
public Iterator<URL> getResources(String name) {
ArrayList<URL> collectedResources = new ArrayList<URL>();
for (IClassResolver resolver : resolvers) {
try {
Iterator<URL> iterator = resolver.getResources(name);
if (iterator == null) {
continue;
}
while (iterator.hasNext()) {
collectedResources.add(iterator.next()); // depends on control dependency: [while], data = [none]
}
} catch (RuntimeException e) {
LOGGER.warn("ClassResolver {} threw an unexpected exception.", resolver, e);
return collectedResources.iterator();
} // depends on control dependency: [catch], data = [none]
}
return collectedResources.iterator();
} } |
public class class_name {
protected void normalizeAndPrint(String s, boolean isAttValue) {
int len = (s != null) ? s.length() : 0;
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
normalizeAndPrint(c, isAttValue);
}
} } | public class class_name {
protected void normalizeAndPrint(String s, boolean isAttValue) {
int len = (s != null) ? s.length() : 0;
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
normalizeAndPrint(c, isAttValue); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private void linearScan(Relation<? extends O> relation, DBIDIter iter, O obj, double range, ModifiableDoubleDBIDList result) {
final SquaredEuclideanDistanceFunction squared = SquaredEuclideanDistanceFunction.STATIC;
// Avoid a loss in numerical precision when using the squared radius:
final double upper = range * 1.0000001;
// This should be more precise, but slower:
// upper = MathUtil.floatToDoubleUpper((float)range);
final double sqrange = upper * upper;
while(iter.valid()) {
final double sqdistance = squared.distance(obj, relation.get(iter));
if(sqdistance <= sqrange) {
final double dist = FastMath.sqrt(sqdistance);
if(dist <= range) { // double check, as we increased the radius above
result.add(dist, iter);
}
}
iter.advance();
}
} } | public class class_name {
private void linearScan(Relation<? extends O> relation, DBIDIter iter, O obj, double range, ModifiableDoubleDBIDList result) {
final SquaredEuclideanDistanceFunction squared = SquaredEuclideanDistanceFunction.STATIC;
// Avoid a loss in numerical precision when using the squared radius:
final double upper = range * 1.0000001;
// This should be more precise, but slower:
// upper = MathUtil.floatToDoubleUpper((float)range);
final double sqrange = upper * upper;
while(iter.valid()) {
final double sqdistance = squared.distance(obj, relation.get(iter));
if(sqdistance <= sqrange) {
final double dist = FastMath.sqrt(sqdistance);
if(dist <= range) { // double check, as we increased the radius above
result.add(dist, iter); // depends on control dependency: [if], data = [(dist]
}
}
iter.advance(); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public HystrixCommandExecutionHook getCommandExecutionHook() {
if (commandExecutionHook.get() == null) {
// check for an implementation from Archaius first
Object impl = getPluginImplementation(HystrixCommandExecutionHook.class);
if (impl == null) {
// nothing set via Archaius so initialize with default
commandExecutionHook.compareAndSet(null, HystrixCommandExecutionHookDefault.getInstance());
// we don't return from here but call get() again in case of thread-race so the winner will always get returned
} else {
// we received an implementation from Archaius so use it
commandExecutionHook.compareAndSet(null, (HystrixCommandExecutionHook) impl);
}
}
return commandExecutionHook.get();
} } | public class class_name {
public HystrixCommandExecutionHook getCommandExecutionHook() {
if (commandExecutionHook.get() == null) {
// check for an implementation from Archaius first
Object impl = getPluginImplementation(HystrixCommandExecutionHook.class);
if (impl == null) {
// nothing set via Archaius so initialize with default
commandExecutionHook.compareAndSet(null, HystrixCommandExecutionHookDefault.getInstance()); // depends on control dependency: [if], data = [none]
// we don't return from here but call get() again in case of thread-race so the winner will always get returned
} else {
// we received an implementation from Archaius so use it
commandExecutionHook.compareAndSet(null, (HystrixCommandExecutionHook) impl); // depends on control dependency: [if], data = [none]
}
}
return commandExecutionHook.get();
} } |
public class class_name {
private void crossOutLinkerTables(){
String[] primaryKeys = model.getPrimaryAttributes();
if(primaryKeys != null && primaryKeys.length == 2){//there are only 2 primary keys
//if both primary keys look up to different table which is also a primary key
String[] hasOne = model.getHasOne();
String[] hasOneLocalColum = model.getHasOneLocalColumn();
String[] hasOneReferencedColumn = model.getHasOneReferencedColumn();
int indexP1 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[0]);
int indexP2 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[1]);
if(indexP1 >= 0 && indexP2 >= 0){
String t1 = hasOne[indexP1];
String t2 = hasOne[indexP2];
String ref1 = hasOneReferencedColumn[indexP1];
String ref2 = hasOneReferencedColumn[indexP2];
ModelDef m1 = getModel(t1);
boolean isRef1Primary = CStringUtils.inArray(m1.getPrimaryAttributes(), ref1);
ModelDef m2 = getModel(t2);
boolean isRef2Primary = CStringUtils.inArray(m2.getPrimaryAttributes(), ref2);
if(model != m1 && model != m2
&& isRef1Primary
&& isRef2Primary
){
removeFromHasMany(m1, model.getTableName());//remove the hasMany of this table
removeFromHasMany(m2, model.getTableName());//remove the hasMany of this table
addToHasMany(m1, m2.getTableName(), ref2, null);
addToHasMany(m2, m1.getTableName(), ref1, null);
}
}
}
} } | public class class_name {
private void crossOutLinkerTables(){
String[] primaryKeys = model.getPrimaryAttributes();
if(primaryKeys != null && primaryKeys.length == 2){//there are only 2 primary keys
//if both primary keys look up to different table which is also a primary key
String[] hasOne = model.getHasOne();
String[] hasOneLocalColum = model.getHasOneLocalColumn();
String[] hasOneReferencedColumn = model.getHasOneReferencedColumn();
int indexP1 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[0]);
int indexP2 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[1]);
if(indexP1 >= 0 && indexP2 >= 0){
String t1 = hasOne[indexP1];
String t2 = hasOne[indexP2];
String ref1 = hasOneReferencedColumn[indexP1];
String ref2 = hasOneReferencedColumn[indexP2];
ModelDef m1 = getModel(t1);
boolean isRef1Primary = CStringUtils.inArray(m1.getPrimaryAttributes(), ref1);
ModelDef m2 = getModel(t2);
boolean isRef2Primary = CStringUtils.inArray(m2.getPrimaryAttributes(), ref2);
if(model != m1 && model != m2
&& isRef1Primary
&& isRef2Primary
){
removeFromHasMany(m1, model.getTableName());//remove the hasMany of this table // depends on control dependency: [if], data = [(]
removeFromHasMany(m2, model.getTableName());//remove the hasMany of this table // depends on control dependency: [if], data = [(]
addToHasMany(m1, m2.getTableName(), ref2, null); // depends on control dependency: [if], data = [(]
addToHasMany(m2, m1.getTableName(), ref1, null); // depends on control dependency: [if], data = [(]
}
}
}
} } |
public class class_name {
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
if (this.isDrpc) {
declarer.declare(new Fields("id", this.emitFieldForRowKey, this.emitFieldForColumnName));
} else {
declarer.declare(new Fields(this.emitFieldForRowKey, this.emitFieldForColumnName));
}
} } | public class class_name {
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
if (this.isDrpc) {
declarer.declare(new Fields("id", this.emitFieldForRowKey, this.emitFieldForColumnName)); // depends on control dependency: [if], data = [none]
} else {
declarer.declare(new Fields(this.emitFieldForRowKey, this.emitFieldForColumnName)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setNode(int number, Vector3D v) {
if (number <= 0) {
number = 0;
} else if (3 <= number) {
number = 3;
}
this.points[number * 3] = (float)v.getX();
this.points[number * 3 + 1] = (float)v.getY();
this.points[number * 3 + 2] = (float)v.getZ();
set();
} } | public class class_name {
public void setNode(int number, Vector3D v) {
if (number <= 0) {
number = 0; // depends on control dependency: [if], data = [none]
} else if (3 <= number) {
number = 3; // depends on control dependency: [if], data = [none]
}
this.points[number * 3] = (float)v.getX();
this.points[number * 3 + 1] = (float)v.getY();
this.points[number * 3 + 2] = (float)v.getZ();
set();
} } |
public class class_name {
static ImmutableSet<ExecutableElement> propertyMethodsIn(Set<ExecutableElement> abstractMethods) {
ImmutableSet.Builder<ExecutableElement> properties = ImmutableSet.builder();
for (ExecutableElement method : abstractMethods) {
if (method.getParameters().isEmpty()
&& method.getReturnType().getKind() != TypeKind.VOID
&& objectMethodToOverride(method) == ObjectMethod.NONE) {
properties.add(method);
}
}
return properties.build();
} } | public class class_name {
static ImmutableSet<ExecutableElement> propertyMethodsIn(Set<ExecutableElement> abstractMethods) {
ImmutableSet.Builder<ExecutableElement> properties = ImmutableSet.builder();
for (ExecutableElement method : abstractMethods) {
if (method.getParameters().isEmpty()
&& method.getReturnType().getKind() != TypeKind.VOID
&& objectMethodToOverride(method) == ObjectMethod.NONE) {
properties.add(method); // depends on control dependency: [if], data = [none]
}
}
return properties.build();
} } |
public class class_name {
public void init() {
log.debug("Init scope: {} parent: {}", name, parent);
if (hasParent()) {
if (!parent.hasChildScope(name)) {
if (parent.addChildScope(this)) {
log.debug("Scope added to parent");
} else {
log.warn("Scope not added to parent");
//throw new ScopeException("Scope not added to parent");
return;
}
} else {
throw new ScopeException("Scope already exists in parent");
}
} else {
log.debug("Scope has no parent");
}
if (autoStart) {
start();
}
} } | public class class_name {
public void init() {
log.debug("Init scope: {} parent: {}", name, parent);
if (hasParent()) {
if (!parent.hasChildScope(name)) {
if (parent.addChildScope(this)) {
log.debug("Scope added to parent");
// depends on control dependency: [if], data = [none]
} else {
log.warn("Scope not added to parent");
// depends on control dependency: [if], data = [none]
//throw new ScopeException("Scope not added to parent");
return;
// depends on control dependency: [if], data = [none]
}
} else {
throw new ScopeException("Scope already exists in parent");
}
} else {
log.debug("Scope has no parent");
// depends on control dependency: [if], data = [none]
}
if (autoStart) {
start();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String replace(String s, Map<String, Object> map) {
StringBuilder ret = new StringBuilder((int) (s.length() * 1.5));
int cursor = 0;
for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf("}", start)) != -1; ) {
ret.append(s, cursor, start).append(map.get(s.substring(start + 2, end)));
cursor = end + 1;
}
ret.append(s, cursor, s.length());
return ret.toString();
} } | public class class_name {
public static String replace(String s, Map<String, Object> map) {
StringBuilder ret = new StringBuilder((int) (s.length() * 1.5));
int cursor = 0;
for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf("}", start)) != -1; ) {
ret.append(s, cursor, start).append(map.get(s.substring(start + 2, end)));
// depends on control dependency: [for], data = [none]
cursor = end + 1;
// depends on control dependency: [for], data = [none]
}
ret.append(s, cursor, s.length());
return ret.toString();
} } |
public class class_name {
private void readConfigFile() {
File configFile = new File(CONFIG_FILE_PATH);
/* config file is not there -> create config file with default */
if (!configFile.exists()) {
resetConfigToDefault();
}
try {
PropertiesConfiguration conf = new PropertiesConfiguration(CONFIG_FILE_PATH);
chemistry = conf.getString(CHEMISTRY_PLUGIN);
} catch (ConfigurationException e) {
resetConfigToDefault();
e.printStackTrace();
}
} } | public class class_name {
private void readConfigFile() {
File configFile = new File(CONFIG_FILE_PATH);
/* config file is not there -> create config file with default */
if (!configFile.exists()) {
resetConfigToDefault();
// depends on control dependency: [if], data = [none]
}
try {
PropertiesConfiguration conf = new PropertiesConfiguration(CONFIG_FILE_PATH);
chemistry = conf.getString(CHEMISTRY_PLUGIN);
// depends on control dependency: [try], data = [none]
} catch (ConfigurationException e) {
resetConfigToDefault();
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Histogram histogram(String id, int[] data, double[] breaks, Color color) {
if (base.dimension != 2) {
throw new IllegalArgumentException("Histogram can be only painted in a 2D canvas.");
}
Histogram histogram = new Histogram(data, breaks);
histogram.setID(id);
histogram.setColor(color);
double[] lowerBound = {Math.min(data) - 0.5, 0};
double[] upperBound = {Math.max(data) + 0.5, 0};
double[][] freq = histogram.getHistogram();
for (int i = 0; i < freq.length; i++) {
if (freq[i][1] > upperBound[1]) {
upperBound[1] = freq[i][1];
}
}
extendBound(lowerBound, upperBound);
add(histogram);
return histogram;
} } | public class class_name {
public Histogram histogram(String id, int[] data, double[] breaks, Color color) {
if (base.dimension != 2) {
throw new IllegalArgumentException("Histogram can be only painted in a 2D canvas.");
}
Histogram histogram = new Histogram(data, breaks);
histogram.setID(id);
histogram.setColor(color);
double[] lowerBound = {Math.min(data) - 0.5, 0};
double[] upperBound = {Math.max(data) + 0.5, 0};
double[][] freq = histogram.getHistogram();
for (int i = 0; i < freq.length; i++) {
if (freq[i][1] > upperBound[1]) {
upperBound[1] = freq[i][1]; // depends on control dependency: [if], data = [none]
}
}
extendBound(lowerBound, upperBound);
add(histogram);
return histogram;
} } |
public class class_name {
public List<String> getFileAsList(final String fileName,
final String encoding) throws IOException {
LOG.info("Get file as list. file: " + fileName);
List<String> result = new ArrayList<String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(fileName), encoding));
String line = null;
while ((line = reader.readLine()) != null) {
result.add(line);
}
} finally {
if (reader != null) {
reader.close();
}
}
LOG.info("Returning: " + result);
return result;
} } | public class class_name {
public List<String> getFileAsList(final String fileName,
final String encoding) throws IOException {
LOG.info("Get file as list. file: " + fileName);
List<String> result = new ArrayList<String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(
new FileInputStream(fileName), encoding));
String line = null;
while ((line = reader.readLine()) != null) {
result.add(line); // depends on control dependency: [while], data = [none]
}
} finally {
if (reader != null) {
reader.close(); // depends on control dependency: [if], data = [none]
}
}
LOG.info("Returning: " + result);
return result;
} } |
public class class_name {
public void openPopup() {
// If the component is disabled, do nothing.
if (!isEnabled()) {
return;
}
// If the show popup menu button is not shown, do nothing.
if (settings.getDisplayToggleTimeMenuButton() == false) {
return;
}
// If this function was called programmatically, we may need to change the focus to this
// popup.
if (!timeTextField.hasFocus()) {
timeTextField.requestFocusInWindow();
}
// Create a new time menu.
timeMenuPanel = new TimeMenuPanel(this, settings);
// Create a new custom popup.
popup = new CustomPopup(timeMenuPanel, SwingUtilities.getWindowAncestor(this),
this, settings.borderTimePopup);
popup.setMinimumSize(new Dimension(
this.getSize().width + 1, timeMenuPanel.getSize().height));
// Calculate the default origin for the popup.
int defaultX = timeTextField.getLocationOnScreen().x;
int defaultY = timeTextField.getLocationOnScreen().y + timeTextField.getSize().height - 1;
// Set the popup location. (Shared function.)
DatePicker.zSetPopupLocation(popup, defaultX, defaultY, this, timeTextField, -1, 1);
// Show the popup and request focus.
popup.show();
timeMenuPanel.requestListFocus();
} } | public class class_name {
public void openPopup() {
// If the component is disabled, do nothing.
if (!isEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
// If the show popup menu button is not shown, do nothing.
if (settings.getDisplayToggleTimeMenuButton() == false) {
return; // depends on control dependency: [if], data = [none]
}
// If this function was called programmatically, we may need to change the focus to this
// popup.
if (!timeTextField.hasFocus()) {
timeTextField.requestFocusInWindow(); // depends on control dependency: [if], data = [none]
}
// Create a new time menu.
timeMenuPanel = new TimeMenuPanel(this, settings);
// Create a new custom popup.
popup = new CustomPopup(timeMenuPanel, SwingUtilities.getWindowAncestor(this),
this, settings.borderTimePopup);
popup.setMinimumSize(new Dimension(
this.getSize().width + 1, timeMenuPanel.getSize().height));
// Calculate the default origin for the popup.
int defaultX = timeTextField.getLocationOnScreen().x;
int defaultY = timeTextField.getLocationOnScreen().y + timeTextField.getSize().height - 1;
// Set the popup location. (Shared function.)
DatePicker.zSetPopupLocation(popup, defaultX, defaultY, this, timeTextField, -1, 1);
// Show the popup and request focus.
popup.show();
timeMenuPanel.requestListFocus();
} } |
public class class_name {
private void addTypeMessages(CmsExplorerTypeSettings setting, String moduleFolder)
throws CmsException, UnsupportedEncodingException {
Map<String, String> messages = new HashMap<String, String>();
CmsObject cms = getCms();
// check if any messages to set
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getNiceName())) {
String key = KEY_PREFIX_NAME + m_resInfo.getName();
messages.put(key, m_resInfo.getNiceName());
setting.setKey(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getDescription())) {
String key = KEY_PREFIX_DESCRIPTION + m_resInfo.getName();
messages.put(key, m_resInfo.getDescription());
setting.setInfo(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getTitle())) {
String key = KEY_PREFIX_TITLE + m_resInfo.getName();
messages.put(key, m_resInfo.getTitle());
setting.setTitleKey(key);
}
if (!messages.isEmpty()) {
// add the messages to the module's workplace bundle
//1. check if the bundle exists as raw Java bundle
String workplacePropertiesFile = CmsStringUtil.joinPaths(
moduleFolder,
CmsModulesEditBase.PATH_CLASSES,
m_resInfo.getModuleName().replace(".", "/"),
PROPERTIES_FILE_NAME);
if (cms.existsResource(workplacePropertiesFile)) {
addMessagesToPropertiesFile(messages, cms.readFile(workplacePropertiesFile), true);
} else {
//2. check if the bundle exists as XML bundle
String vfsBundleFileName = CmsStringUtil.joinPaths(
moduleFolder,
PATH_I18N,
m_resInfo.getModuleName() + SUFFIX_BUNDLE_FILE);
OpenCms.getLocaleManager();
if (cms.existsResource(vfsBundleFileName)) {
addMessagesToVfsBundle(messages, cms.readFile(vfsBundleFileName));
} else {
//3. check if the bundle exists as property bundle
// we always write to the default locale
String propertyBundleFileName = vfsBundleFileName + "_" + CmsLocaleManager.getDefaultLocale();
if (!cms.existsResource(propertyBundleFileName)) {
//if non of the checked bundles exist, create one.
String bundleFolder = CmsStringUtil.joinPaths(moduleFolder, PATH_I18N);
if (!cms.existsResource(bundleFolder)) {
cms.createResource(
bundleFolder,
OpenCms.getResourceManager().getResourceType(
CmsResourceTypeFolder.getStaticTypeName()));
}
CmsResource res = cms.createResource(
propertyBundleFileName,
OpenCms.getResourceManager().getResourceType(CmsVfsBundleManager.TYPE_PROPERTIES_BUNDLE),
null,
null);
cms.writeResource(res);
}
addMessagesToPropertiesFile(messages, cms.readFile(propertyBundleFileName), false);
}
}
}
} } | public class class_name {
private void addTypeMessages(CmsExplorerTypeSettings setting, String moduleFolder)
throws CmsException, UnsupportedEncodingException {
Map<String, String> messages = new HashMap<String, String>();
CmsObject cms = getCms();
// check if any messages to set
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getNiceName())) {
String key = KEY_PREFIX_NAME + m_resInfo.getName();
messages.put(key, m_resInfo.getNiceName());
setting.setKey(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getDescription())) {
String key = KEY_PREFIX_DESCRIPTION + m_resInfo.getName();
messages.put(key, m_resInfo.getDescription());
setting.setInfo(key);
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_resInfo.getTitle())) {
String key = KEY_PREFIX_TITLE + m_resInfo.getName();
messages.put(key, m_resInfo.getTitle());
setting.setTitleKey(key);
}
if (!messages.isEmpty()) {
// add the messages to the module's workplace bundle
//1. check if the bundle exists as raw Java bundle
String workplacePropertiesFile = CmsStringUtil.joinPaths(
moduleFolder,
CmsModulesEditBase.PATH_CLASSES,
m_resInfo.getModuleName().replace(".", "/"),
PROPERTIES_FILE_NAME);
if (cms.existsResource(workplacePropertiesFile)) {
addMessagesToPropertiesFile(messages, cms.readFile(workplacePropertiesFile), true);
} else {
//2. check if the bundle exists as XML bundle
String vfsBundleFileName = CmsStringUtil.joinPaths(
moduleFolder,
PATH_I18N,
m_resInfo.getModuleName() + SUFFIX_BUNDLE_FILE);
OpenCms.getLocaleManager();
if (cms.existsResource(vfsBundleFileName)) {
addMessagesToVfsBundle(messages, cms.readFile(vfsBundleFileName)); // depends on control dependency: [if], data = [none]
} else {
//3. check if the bundle exists as property bundle
// we always write to the default locale
String propertyBundleFileName = vfsBundleFileName + "_" + CmsLocaleManager.getDefaultLocale();
if (!cms.existsResource(propertyBundleFileName)) {
//if non of the checked bundles exist, create one.
String bundleFolder = CmsStringUtil.joinPaths(moduleFolder, PATH_I18N);
if (!cms.existsResource(bundleFolder)) {
cms.createResource(
bundleFolder,
OpenCms.getResourceManager().getResourceType(
CmsResourceTypeFolder.getStaticTypeName())); // depends on control dependency: [if], data = [none]
}
CmsResource res = cms.createResource(
propertyBundleFileName,
OpenCms.getResourceManager().getResourceType(CmsVfsBundleManager.TYPE_PROPERTIES_BUNDLE),
null,
null);
cms.writeResource(res); // depends on control dependency: [if], data = [none]
}
addMessagesToPropertiesFile(messages, cms.readFile(propertyBundleFileName), false); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void close()
{
forwardEngine.close();
if (forwardEngine != reverseEngine)
reverseEngine.close();
Iterator<Map.Entry<Long, SRTCPCryptoContext>> iter
= contexts.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry<Long, SRTCPCryptoContext> entry = iter.next();
SRTCPCryptoContext context = entry.getValue();
iter.remove();
if (context != null)
context.close();
}
} } | public class class_name {
public void close()
{
forwardEngine.close();
if (forwardEngine != reverseEngine)
reverseEngine.close();
Iterator<Map.Entry<Long, SRTCPCryptoContext>> iter
= contexts.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry<Long, SRTCPCryptoContext> entry = iter.next();
SRTCPCryptoContext context = entry.getValue();
iter.remove(); // depends on control dependency: [while], data = [none]
if (context != null)
context.close();
}
} } |
public class class_name {
public boolean remove(String field) {
try {
return getJedisCommands(groupName).hdel(key, field).equals(RESP_OK);
} finally {
getJedisProvider(groupName).release();
}
} } | public class class_name {
public boolean remove(String field) {
try {
return getJedisCommands(groupName).hdel(key, field).equals(RESP_OK); // depends on control dependency: [try], data = [none]
} finally {
getJedisProvider(groupName).release();
}
} } |
public class class_name {
public static String removeEmptyLine(String str) {
assertStringNotNull(str);
final StringBuilder sb = new StringBuilder();
final List<String> lineList = splitList(str, "\n");
for (String line : lineList) {
if (is_Null_or_TrimmedEmpty(line)) {
continue; // skip
}
sb.append(removeCR(line)).append("\n");
}
final String filtered = sb.toString();
return filtered.substring(0, filtered.length() - "\n".length());
} } | public class class_name {
public static String removeEmptyLine(String str) {
assertStringNotNull(str);
final StringBuilder sb = new StringBuilder();
final List<String> lineList = splitList(str, "\n");
for (String line : lineList) {
if (is_Null_or_TrimmedEmpty(line)) {
continue; // skip
}
sb.append(removeCR(line)).append("\n"); // depends on control dependency: [for], data = [line]
}
final String filtered = sb.toString();
return filtered.substring(0, filtered.length() - "\n".length());
} } |
public class class_name {
@EventHandler
protected void onEvent(IncomingDataTransferReceivedEvent event,
@MetaData(value = CorrelationToken.KEY, required = false) CorrelationToken correlationToken) {
/*
* Handle the incoming datatransfer message here, to complete the loop we now
* just return ACCEPTED and no response data.
*/
IncomingDataTransferResultStatus processingStatus = IncomingDataTransferResultStatus.ACCEPTED;
String responseData = "";
CommandMessage commandMessage = asCommandMessage(new IncomingDataTransferResponseCommand(event.getChargingStationId(), responseData, processingStatus, event.getIdentityContext()));
if (correlationToken != null) {
commandMessage = commandMessage.andMetaData(Collections.singletonMap(CorrelationToken.KEY, correlationToken));
}
commandGateway.send(commandMessage);
} } | public class class_name {
@EventHandler
protected void onEvent(IncomingDataTransferReceivedEvent event,
@MetaData(value = CorrelationToken.KEY, required = false) CorrelationToken correlationToken) {
/*
* Handle the incoming datatransfer message here, to complete the loop we now
* just return ACCEPTED and no response data.
*/
IncomingDataTransferResultStatus processingStatus = IncomingDataTransferResultStatus.ACCEPTED;
String responseData = "";
CommandMessage commandMessage = asCommandMessage(new IncomingDataTransferResponseCommand(event.getChargingStationId(), responseData, processingStatus, event.getIdentityContext()));
if (correlationToken != null) {
commandMessage = commandMessage.andMetaData(Collections.singletonMap(CorrelationToken.KEY, correlationToken)); // depends on control dependency: [if], data = [none]
}
commandGateway.send(commandMessage);
} } |
public class class_name {
public void marshall(EntitlementValue entitlementValue, ProtocolMarshaller protocolMarshaller) {
if (entitlementValue == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(entitlementValue.getIntegerValue(), INTEGERVALUE_BINDING);
protocolMarshaller.marshall(entitlementValue.getDoubleValue(), DOUBLEVALUE_BINDING);
protocolMarshaller.marshall(entitlementValue.getBooleanValue(), BOOLEANVALUE_BINDING);
protocolMarshaller.marshall(entitlementValue.getStringValue(), STRINGVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EntitlementValue entitlementValue, ProtocolMarshaller protocolMarshaller) {
if (entitlementValue == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(entitlementValue.getIntegerValue(), INTEGERVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(entitlementValue.getDoubleValue(), DOUBLEVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(entitlementValue.getBooleanValue(), BOOLEANVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(entitlementValue.getStringValue(), STRINGVALUE_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 {
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
// create a new Scrap
Scrap item = new Scrap(scrap, true);
if (viewTypeCount == 1) {
currentScraps.put(position, item);
} else {
scraps[viewType].put(position, item);
}
if (Build.VERSION.SDK_INT >= 14) {
scrap.setAccessibilityDelegate(null);
}
} } | public class class_name {
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
// create a new Scrap
Scrap item = new Scrap(scrap, true);
if (viewTypeCount == 1) {
currentScraps.put(position, item); // depends on control dependency: [if], data = [none]
} else {
scraps[viewType].put(position, item); // depends on control dependency: [if], data = [none]
}
if (Build.VERSION.SDK_INT >= 14) {
scrap.setAccessibilityDelegate(null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static File[] findLPMFXmlFiles(File wlpInstallationDirectory) {
File lpmfDirectory = new File(wlpInstallationDirectory, "lib/fixes");
if (!lpmfDirectory.exists() || !lpmfDirectory.isDirectory()) {
return new File[0];
}
File[] lpmfFiles = lpmfDirectory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String fileName) {
return FileUtils.matchesFileExtension(".lpmf", fileName);
}
});
return lpmfFiles;
} } | public class class_name {
private static File[] findLPMFXmlFiles(File wlpInstallationDirectory) {
File lpmfDirectory = new File(wlpInstallationDirectory, "lib/fixes");
if (!lpmfDirectory.exists() || !lpmfDirectory.isDirectory()) {
return new File[0]; // depends on control dependency: [if], data = [none]
}
File[] lpmfFiles = lpmfDirectory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String fileName) {
return FileUtils.matchesFileExtension(".lpmf", fileName);
}
});
return lpmfFiles;
} } |
public class class_name {
public static String getValue(Document document, String xPath) {
Node node = document.selectSingleNode(xPath);
if (node != null) {
// return the value
return node.getText();
} else {
return null;
}
} } | public class class_name {
public static String getValue(Document document, String xPath) {
Node node = document.selectSingleNode(xPath);
if (node != null) {
// return the value
return node.getText(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(UtilizationByTime utilizationByTime, ProtocolMarshaller protocolMarshaller) {
if (utilizationByTime == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(utilizationByTime.getTimePeriod(), TIMEPERIOD_BINDING);
protocolMarshaller.marshall(utilizationByTime.getGroups(), GROUPS_BINDING);
protocolMarshaller.marshall(utilizationByTime.getTotal(), TOTAL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UtilizationByTime utilizationByTime, ProtocolMarshaller protocolMarshaller) {
if (utilizationByTime == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(utilizationByTime.getTimePeriod(), TIMEPERIOD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(utilizationByTime.getGroups(), GROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(utilizationByTime.getTotal(), TOTAL_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 {
@Override
public final void makeOtherEntries(final Map<String, Object> pAddParam,
final Wage pEntity, final IRequestData pRequestData,
final boolean pIsNew) throws Exception {
String actionAdd = pRequestData.getParameter("actionAdd");
if ("fill".equals(actionAdd)) {
//User can change method as he want
String srvFillWgLnNm = getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getWageTaxesMethod().getServiceName();
ISrvFillWageLines srvFillWageLines = (ISrvFillWageLines) this
.factoryAppBeans.lazyGet(srvFillWgLnNm);
srvFillWageLines.fillWageLines(pAddParam, pEntity);
} else if ("makeAccEntries".equals(actionAdd)) {
if (pEntity.getReversedId() == null) {
WageLine wl = new WageLine();
wl.setItsOwner(pEntity);
List<WageLine> wageLines = getSrvOrm().
retrieveListForField(pAddParam, wl, "itsOwner");
for (WageLine wageLine : wageLines) {
String whereStr = " where ITSOWNER=" + pEntity.getEmployee()
.getItsId() + " and WAGETYPE=" + wageLine.getWageType().getItsId();
EmployeeYearWage employeeYearWage = getSrvOrm()
.retrieveEntityWithConditions(pAddParam,
EmployeeYearWage.class, whereStr);
if (employeeYearWage == null) {
employeeYearWage = new EmployeeYearWage();
employeeYearWage.setItsOwner(pEntity.getEmployee());
employeeYearWage.setIsNew(true);
employeeYearWage.setIdDatabaseBirth(getSrvOrm().getIdDatabase());
employeeYearWage.setWageType(wageLine.getWageType());
}
employeeYearWage.setTotalWageYear(employeeYearWage.getTotalWageYear()
.add(wageLine.getGrossWage())
.subtract(wageLine.getTaxesEmployee()));
if (employeeYearWage.getIsNew()) {
getSrvOrm().insertEntity(pAddParam, employeeYearWage);
employeeYearWage.setIsNew(false);
} else {
getSrvOrm().updateEntity(pAddParam, employeeYearWage);
}
}
} else {
WageLine wl = new WageLine();
Wage reversed = getSrvOrm().
retrieveEntityById(pAddParam, Wage.class, pEntity.getReversedId());
wl.setItsOwner(reversed);
List<WageLine> wageLines = getSrvOrm().
retrieveListForField(pAddParam, wl, "itsOwner");
for (WageLine wageLine : wageLines) {
String whereStr = " where ITSOWNER=" + pEntity.getEmployee()
.getItsId() + " and WAGETYPE=" + wageLine.getWageType().getItsId();
EmployeeYearWage employeeYearWage = getSrvOrm()
.retrieveEntityWithConditions(pAddParam,
EmployeeYearWage.class, whereStr);
employeeYearWage.setTotalWageYear(employeeYearWage.getTotalWageYear()
.subtract(wageLine.getGrossWage())
.add(wageLine.getTaxesEmployee()));
getSrvOrm().updateEntity(pAddParam, employeeYearWage);
}
}
}
} } | public class class_name {
@Override
public final void makeOtherEntries(final Map<String, Object> pAddParam,
final Wage pEntity, final IRequestData pRequestData,
final boolean pIsNew) throws Exception {
String actionAdd = pRequestData.getParameter("actionAdd");
if ("fill".equals(actionAdd)) {
//User can change method as he want
String srvFillWgLnNm = getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getWageTaxesMethod().getServiceName();
ISrvFillWageLines srvFillWageLines = (ISrvFillWageLines) this
.factoryAppBeans.lazyGet(srvFillWgLnNm);
srvFillWageLines.fillWageLines(pAddParam, pEntity);
} else if ("makeAccEntries".equals(actionAdd)) {
if (pEntity.getReversedId() == null) {
WageLine wl = new WageLine();
wl.setItsOwner(pEntity); // depends on control dependency: [if], data = [none]
List<WageLine> wageLines = getSrvOrm().
retrieveListForField(pAddParam, wl, "itsOwner");
for (WageLine wageLine : wageLines) {
String whereStr = " where ITSOWNER=" + pEntity.getEmployee()
.getItsId() + " and WAGETYPE=" + wageLine.getWageType().getItsId();
EmployeeYearWage employeeYearWage = getSrvOrm()
.retrieveEntityWithConditions(pAddParam,
EmployeeYearWage.class, whereStr);
if (employeeYearWage == null) {
employeeYearWage = new EmployeeYearWage(); // depends on control dependency: [if], data = [none]
employeeYearWage.setItsOwner(pEntity.getEmployee()); // depends on control dependency: [if], data = [none]
employeeYearWage.setIsNew(true); // depends on control dependency: [if], data = [none]
employeeYearWage.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); // depends on control dependency: [if], data = [none]
employeeYearWage.setWageType(wageLine.getWageType()); // depends on control dependency: [if], data = [none]
}
employeeYearWage.setTotalWageYear(employeeYearWage.getTotalWageYear()
.add(wageLine.getGrossWage())
.subtract(wageLine.getTaxesEmployee())); // depends on control dependency: [for], data = [none]
if (employeeYearWage.getIsNew()) {
getSrvOrm().insertEntity(pAddParam, employeeYearWage); // depends on control dependency: [if], data = [none]
employeeYearWage.setIsNew(false); // depends on control dependency: [if], data = [none]
} else {
getSrvOrm().updateEntity(pAddParam, employeeYearWage); // depends on control dependency: [if], data = [none]
}
}
} else {
WageLine wl = new WageLine();
Wage reversed = getSrvOrm().
retrieveEntityById(pAddParam, Wage.class, pEntity.getReversedId());
wl.setItsOwner(reversed); // depends on control dependency: [if], data = [none]
List<WageLine> wageLines = getSrvOrm().
retrieveListForField(pAddParam, wl, "itsOwner");
for (WageLine wageLine : wageLines) {
String whereStr = " where ITSOWNER=" + pEntity.getEmployee()
.getItsId() + " and WAGETYPE=" + wageLine.getWageType().getItsId();
EmployeeYearWage employeeYearWage = getSrvOrm()
.retrieveEntityWithConditions(pAddParam,
EmployeeYearWage.class, whereStr);
employeeYearWage.setTotalWageYear(employeeYearWage.getTotalWageYear()
.subtract(wageLine.getGrossWage())
.add(wageLine.getTaxesEmployee())); // depends on control dependency: [for], data = [none]
getSrvOrm().updateEntity(pAddParam, employeeYearWage); // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
protected void checkPauseAndWait() {
pauseLock.lock();
try {
while (paused && ! stopped) {
pausedCondition.await();
}
} catch (InterruptedException e) {
} finally {
pauseLock.unlock();
}
} } | public class class_name {
protected void checkPauseAndWait() {
pauseLock.lock();
try {
while (paused && ! stopped) {
pausedCondition.await(); // depends on control dependency: [while], data = [none]
}
} catch (InterruptedException e) {
} finally { // depends on control dependency: [catch], data = [none]
pauseLock.unlock();
}
} } |
public class class_name {
public void setRemotePath(String pRemotePath) {
if (StringUtil.isEmpty(pRemotePath)) {
pRemotePath = "";
}
else if (pRemotePath.charAt(0) != '/') {
pRemotePath = "/" + pRemotePath;
}
remotePath = pRemotePath;
} } | public class class_name {
public void setRemotePath(String pRemotePath) {
if (StringUtil.isEmpty(pRemotePath)) {
pRemotePath = "";
// depends on control dependency: [if], data = [none]
}
else if (pRemotePath.charAt(0) != '/') {
pRemotePath = "/" + pRemotePath;
// depends on control dependency: [if], data = [none]
}
remotePath = pRemotePath;
} } |
public class class_name {
private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIdentifier.class, id);
child.bindVolatileParameter(EvaluatorManager.EvaluatorDescriptorName.class, desc);
} catch (final BindException e) {
throw new RuntimeException("Unable to bind evaluator identifier and name.", e);
}
final EvaluatorManager result;
try {
result = child.getInstance(EvaluatorManager.class);
} catch (final InjectionException e) {
throw new RuntimeException("Unable to instantiate a new EvaluatorManager for Evaluator ID: " + id, e);
}
return result;
} } | public class class_name {
private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIdentifier.class, id); // depends on control dependency: [try], data = [none]
child.bindVolatileParameter(EvaluatorManager.EvaluatorDescriptorName.class, desc); // depends on control dependency: [try], data = [none]
} catch (final BindException e) {
throw new RuntimeException("Unable to bind evaluator identifier and name.", e);
} // depends on control dependency: [catch], data = [none]
final EvaluatorManager result;
try {
result = child.getInstance(EvaluatorManager.class); // depends on control dependency: [try], data = [none]
} catch (final InjectionException e) {
throw new RuntimeException("Unable to instantiate a new EvaluatorManager for Evaluator ID: " + id, e);
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
public static void recursivelyDeleteDirectoryOnExit(final File directory) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
recursivelyDeleteDirectory(directory);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
} } | public class class_name {
public static void recursivelyDeleteDirectoryOnExit(final File directory) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
recursivelyDeleteDirectory(directory); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public void merge(MessageDestinationRef msgDestRef) throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "merge", msgDestRef);
ResourceImpl curAnnotation = (ResourceImpl) this.getAnnotation();
String jndiName = msgDestRef.getName();
String curJndiName = curAnnotation.name();
String mappedName = msgDestRef.getMappedName();
String curMappedName = curAnnotation.mappedName();
String typeName = msgDestRef.getType();
//The link parameter is "optional"
String link = msgDestRef.getLink();
String curLink = this.ivLink;
String lookup = msgDestRef.getLookupName(); // F743-21028.4
if (lookup != null) {
lookup = lookup.trim();
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "new=" + jndiName + ":" + mappedName + ":" + typeName + ":" + link + ":" + lookup);
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "cur=" + curJndiName + ":" + curMappedName + ":" + getInjectionClassTypeName() + ":" + curLink + ":" + ivLookup);
//The mappedName parameter is "optional"
if (curAnnotation.ivIsSetMappedName && mappedName != null)
{
if (!curMappedName.equals(mappedName))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"mapped-name",
"message-destination-ref",
"message-destination-ref-name",
getJndiName(),
curMappedName,
mappedName); // d479669
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + "mapped-name" +
" element values exist for multiple " + "message-destination-ref" +
" elements with the same " + "message-destination-ref-name" +
" element value : " +
getJndiName() + ". The conflicting " + "mapped-name" +
" element values are " + curMappedName + " and " +
mappedName + "."; // d479669
throw new InjectionConfigurationException(exMsg);
}
}
else if (mappedName != null && !curAnnotation.ivIsSetMappedName)
{
curAnnotation.ivMappedName = mappedName;
curAnnotation.ivIsSetMappedName = true;
}
setXMLType(typeName,
"message-destination-ref",
"message-destination-ref-name",
"message-destination-type"); // F743-32443
//The link parameter is "optional"
if (curLink != null && link != null)
{
if (!curLink.equals(link))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"message-destination-link",
"message-destination-ref",
"message-destination-ref-name",
getJndiName(),
curLink,
link); // d479669
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + "message-destination-link" +
" element values exist for multiple " + "message-destination-ref" +
" elements with the same " + "message-destination-ref-name" + " element value : " +
getJndiName() + ". The conflicting " + "message-destination-link" +
" element values are " + curLink + " and " +
link + "."; // d479669
throw new InjectionConfigurationException(exMsg);
}
}
else if (link != null && curLink == null)
{
this.ivLink = link;
}
// -----------------------------------------------------------------------
// Merge : lookup - "optional parameter F743-21028.4
//
// If present in XML, even if the empty string (""), it will override
// any setting via annotations. An empty string would effectivly turn
// off this setting.
//
// When a message-destination-ref appears multiple times in XML, an empty
// string is considered to be a confilct with a non-empty string, since
// both were explicitly specified.
// -----------------------------------------------------------------------
if (lookup != null)
{
if (ivLookupInXml)
{
if (!lookup.equals(ivLookup))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"lookup-name",
"message-destination-ref",
"message-destination-ref-name",
jndiName,
ivLookup,
lookup);
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + "lookup-name" +
" element values exist for multiple " +
"message-destination-ref" + " elements with the same " +
"message-destination-ref-name" +
" element value : " + jndiName + ". The conflicting " +
"lookup-name" + " element values are \"" + ivLookup +
"\" and \"" + lookup + "\".";
throw new InjectionConfigurationException(exMsg);
}
}
else
{
ivLookup = lookup;
ivLookupInXml = true;
curAnnotation.ivLookup = lookup;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "ivLookup = " + ivLookup);
}
}
//Loop through the InjectionTargets and call addInjectionTarget.... which
//already accounts for duplicates (in case they duplicated some between the two ref definitions.
List<InjectionTarget> targets = msgDestRef.getInjectionTargets();
String targetName = null;
String targetClassName = null;
Class<?> injectionType = getInjectionClassType();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "targetType : " + injectionType);
if (!targets.isEmpty())
{
for (InjectionTarget target : targets)
{
targetClassName = target.getInjectionTargetClassName();
targetName = target.getInjectionTargetName();
this.addInjectionTarget(injectionType, targetName, targetClassName);
} //for loop
} //targets !null
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "merge", this);
} } | public class class_name {
public void merge(MessageDestinationRef msgDestRef) throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "merge", msgDestRef);
ResourceImpl curAnnotation = (ResourceImpl) this.getAnnotation();
String jndiName = msgDestRef.getName();
String curJndiName = curAnnotation.name();
String mappedName = msgDestRef.getMappedName();
String curMappedName = curAnnotation.mappedName();
String typeName = msgDestRef.getType();
//The link parameter is "optional"
String link = msgDestRef.getLink();
String curLink = this.ivLink;
String lookup = msgDestRef.getLookupName(); // F743-21028.4
if (lookup != null) {
lookup = lookup.trim();
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "new=" + jndiName + ":" + mappedName + ":" + typeName + ":" + link + ":" + lookup);
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "cur=" + curJndiName + ":" + curMappedName + ":" + getInjectionClassTypeName() + ":" + curLink + ":" + ivLookup);
//The mappedName parameter is "optional"
if (curAnnotation.ivIsSetMappedName && mappedName != null)
{
if (!curMappedName.equals(mappedName))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"mapped-name",
"message-destination-ref",
"message-destination-ref-name",
getJndiName(),
curMappedName,
mappedName); // d479669 // depends on control dependency: [if], data = [none]
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication + // depends on control dependency: [if], data = [none]
" application has conflicting configuration data in the XML" + // depends on control dependency: [if], data = [none]
" deployment descriptor. Conflicting " + "mapped-name" +
" element values exist for multiple " + "message-destination-ref" + // depends on control dependency: [if], data = [none]
" elements with the same " + "message-destination-ref-name" +
" element value : " + // depends on control dependency: [if], data = [none]
getJndiName() + ". The conflicting " + "mapped-name" +
" element values are " + curMappedName + " and " +
mappedName + "."; // d479669 // depends on control dependency: [if], data = [none]
throw new InjectionConfigurationException(exMsg);
}
}
else if (mappedName != null && !curAnnotation.ivIsSetMappedName)
{
curAnnotation.ivMappedName = mappedName;
curAnnotation.ivIsSetMappedName = true;
}
setXMLType(typeName,
"message-destination-ref",
"message-destination-ref-name",
"message-destination-type"); // F743-32443
//The link parameter is "optional"
if (curLink != null && link != null)
{
if (!curLink.equals(link))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"message-destination-link",
"message-destination-ref",
"message-destination-ref-name",
getJndiName(),
curLink,
link); // d479669 // depends on control dependency: [if], data = [none]
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication + // depends on control dependency: [if], data = [none]
" application has conflicting configuration data in the XML" + // depends on control dependency: [if], data = [none]
" deployment descriptor. Conflicting " + "message-destination-link" +
" element values exist for multiple " + "message-destination-ref" + // depends on control dependency: [if], data = [none]
" elements with the same " + "message-destination-ref-name" + " element value : " + // depends on control dependency: [if], data = [none]
getJndiName() + ". The conflicting " + "message-destination-link" +
" element values are " + curLink + " and " +
link + "."; // d479669 // depends on control dependency: [if], data = [none]
throw new InjectionConfigurationException(exMsg);
}
}
else if (link != null && curLink == null)
{
this.ivLink = link;
}
// -----------------------------------------------------------------------
// Merge : lookup - "optional parameter F743-21028.4
//
// If present in XML, even if the empty string (""), it will override
// any setting via annotations. An empty string would effectivly turn
// off this setting.
//
// When a message-destination-ref appears multiple times in XML, an empty
// string is considered to be a confilct with a non-empty string, since
// both were explicitly specified.
// -----------------------------------------------------------------------
if (lookup != null)
{
if (ivLookupInXml)
{
if (!lookup.equals(ivLookup))
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
"lookup-name",
"message-destination-ref",
"message-destination-ref-name",
jndiName,
ivLookup,
lookup); // depends on control dependency: [if], data = [none]
String exMsg = "The " + ivComponent + " bean in the " +
ivModule + " module of the " + ivApplication + // depends on control dependency: [if], data = [none]
" application has conflicting configuration data in the XML" + // depends on control dependency: [if], data = [none]
" deployment descriptor. Conflicting " + "lookup-name" +
" element values exist for multiple " + // depends on control dependency: [if], data = [none]
"message-destination-ref" + " elements with the same " +
"message-destination-ref-name" +
" element value : " + jndiName + ". The conflicting " + // depends on control dependency: [if], data = [none]
"lookup-name" + " element values are \"" + ivLookup +
"\" and \"" + lookup + "\"."; // depends on control dependency: [if], data = [none]
throw new InjectionConfigurationException(exMsg);
}
}
else
{
ivLookup = lookup;
ivLookupInXml = true;
curAnnotation.ivLookup = lookup;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "ivLookup = " + ivLookup);
}
}
//Loop through the InjectionTargets and call addInjectionTarget.... which
//already accounts for duplicates (in case they duplicated some between the two ref definitions.
List<InjectionTarget> targets = msgDestRef.getInjectionTargets();
String targetName = null;
String targetClassName = null;
Class<?> injectionType = getInjectionClassType();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "targetType : " + injectionType);
if (!targets.isEmpty())
{
for (InjectionTarget target : targets)
{
targetClassName = target.getInjectionTargetClassName();
targetName = target.getInjectionTargetName();
this.addInjectionTarget(injectionType, targetName, targetClassName);
} //for loop
} //targets !null
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "merge", this);
} } |
public class class_name {
public static SocketAddress resolve(InetSocketAddress inetSocketAddress, DnsResolver dnsResolver) {
try {
InetAddress inetAddress = dnsResolver.resolve(inetSocketAddress.getHostString())[0];
return new InetSocketAddress(inetAddress, inetSocketAddress.getPort());
} catch (UnknownHostException e) {
return new InetSocketAddress(inetSocketAddress.getHostString(), inetSocketAddress.getPort());
}
} } | public class class_name {
public static SocketAddress resolve(InetSocketAddress inetSocketAddress, DnsResolver dnsResolver) {
try {
InetAddress inetAddress = dnsResolver.resolve(inetSocketAddress.getHostString())[0];
return new InetSocketAddress(inetAddress, inetSocketAddress.getPort()); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
return new InetSocketAddress(inetSocketAddress.getHostString(), inetSocketAddress.getPort());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0;
for (int i = offset; i < offset + 2; ++i) {
result = (short) ((result) << 8);
result |= (bytes[i] & 0x00FF);
}
return result;
} } | public class class_name {
public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0;
for (int i = offset; i < offset + 2; ++i) {
result = (short) ((result) << 8); // depends on control dependency: [for], data = [none]
result |= (bytes[i] & 0x00FF); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
private static Method[] getAllDeclaredMethods(Class<?> classHierarchy)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Collection<MethodMap.MethodInfo> methodInfos = MethodMap.getAllDeclaredMethods(classHierarchy);
Method[] methods = new Method[methodInfos.size()];
int index = 0;
for (MethodMap.MethodInfo methodInfo : methodInfos)
{
Method method = methodInfo.getMethod();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "adding method " + method);
methods[index++] = method;
}
return methods;
} } | public class class_name {
private static Method[] getAllDeclaredMethods(Class<?> classHierarchy)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Collection<MethodMap.MethodInfo> methodInfos = MethodMap.getAllDeclaredMethods(classHierarchy);
Method[] methods = new Method[methodInfos.size()];
int index = 0;
for (MethodMap.MethodInfo methodInfo : methodInfos)
{
Method method = methodInfo.getMethod();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "adding method " + method);
methods[index++] = method; // depends on control dependency: [for], data = [none]
}
return methods;
} } |
public class class_name {
private List<Entry<V>> filterEntryList(List<Entry<V>> entryList, long minScn, long maxScn) {
List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size());
for (Entry<V> e : entryList) {
if (minScn <= e.getMinScn() && e.getMaxScn() <= maxScn) {
result.add(e);
}
}
return result;
} } | public class class_name {
private List<Entry<V>> filterEntryList(List<Entry<V>> entryList, long minScn, long maxScn) {
List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size());
for (Entry<V> e : entryList) {
if (minScn <= e.getMinScn() && e.getMaxScn() <= maxScn) {
result.add(e); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if (prescreen(m)) {
stack.resetForMethodEntry(this);
popStack.clear();
super.visitCode(obj);
}
} } | public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if (prescreen(m)) {
stack.resetForMethodEntry(this); // depends on control dependency: [if], data = [none]
popStack.clear(); // depends on control dependency: [if], data = [none]
super.visitCode(obj); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void startLayerTranslation() {
if (USE_TRANSLATIONS && mHardwareLayersEnabled && !mLayerTypeHardware) {
mLayerTypeHardware = true;
mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mSwipeBackContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
} } | public class class_name {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
protected void startLayerTranslation() {
if (USE_TRANSLATIONS && mHardwareLayersEnabled && !mLayerTypeHardware) {
mLayerTypeHardware = true; // depends on control dependency: [if], data = [none]
mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null); // depends on control dependency: [if], data = [none]
mSwipeBackContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final Flux<T> startWith(Publisher<? extends T> publisher) {
if (this instanceof FluxConcatArray) {
FluxConcatArray<T> fluxConcatArray = (FluxConcatArray<T>) this;
return fluxConcatArray.concatAdditionalSourceFirst(publisher);
}
return concat(publisher, this);
} } | public class class_name {
public final Flux<T> startWith(Publisher<? extends T> publisher) {
if (this instanceof FluxConcatArray) {
FluxConcatArray<T> fluxConcatArray = (FluxConcatArray<T>) this;
return fluxConcatArray.concatAdditionalSourceFirst(publisher); // depends on control dependency: [if], data = [none]
}
return concat(publisher, this);
} } |
public class class_name {
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i] - data[i - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 2*data[i-1] + data[i-2] */
residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */
residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */
residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4];
}
break;
default :
}
} } | public class class_name {
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i]; // depends on control dependency: [for], data = [i]
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i] - data[i - 1]; // depends on control dependency: [for], data = [i]
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 2*data[i-1] + data[i-2] */
residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2]; // depends on control dependency: [for], data = [i]
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */
residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3]; // depends on control dependency: [for], data = [i]
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */
residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4]; // depends on control dependency: [for], data = [i]
}
break;
default :
}
} } |
public class class_name {
public void setPhysicalResourceIdContext(java.util.Collection<PhysicalResourceIdContextKeyValuePair> physicalResourceIdContext) {
if (physicalResourceIdContext == null) {
this.physicalResourceIdContext = null;
return;
}
this.physicalResourceIdContext = new com.amazonaws.internal.SdkInternalList<PhysicalResourceIdContextKeyValuePair>(physicalResourceIdContext);
} } | public class class_name {
public void setPhysicalResourceIdContext(java.util.Collection<PhysicalResourceIdContextKeyValuePair> physicalResourceIdContext) {
if (physicalResourceIdContext == null) {
this.physicalResourceIdContext = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.physicalResourceIdContext = new com.amazonaws.internal.SdkInternalList<PhysicalResourceIdContextKeyValuePair>(physicalResourceIdContext);
} } |
public class class_name {
public void addSysControllerFilters() {
for(SystemRequest rq : SystemRequest.values()) {
ISystemFilterChain filterChain = new SysControllerFilterChain();
filterChain.addFilter("EzyFoxFilterChain#" + rq,
new BaseSysControllerFilter(appContext(), rq));
getParentZone().setFilterChain(rq, filterChain);
}
} } | public class class_name {
public void addSysControllerFilters() {
for(SystemRequest rq : SystemRequest.values()) {
ISystemFilterChain filterChain = new SysControllerFilterChain();
filterChain.addFilter("EzyFoxFilterChain#" + rq,
new BaseSysControllerFilter(appContext(), rq)); // depends on control dependency: [for], data = [rq]
getParentZone().setFilterChain(rq, filterChain); // depends on control dependency: [for], data = [rq]
}
} } |
public class class_name {
public String getProviderAddress() {
if (providerAddress!=null) {
Matcher matcher = HOST_PORT_PATTERN.matcher(providerAddress);
if (matcher.matches() && isValidPort(matcher.group(2))) {
return matcher.group(1);
}
}else if(providerId!=null){
Matcher matcher = HOST_PORT_PATTERN.matcher(providerId);
if (matcher.matches() && isValidPort(matcher.group(2))) {
return matcher.group(1);
}
}
return providerAddress;
} } | public class class_name {
public String getProviderAddress() {
if (providerAddress!=null) {
Matcher matcher = HOST_PORT_PATTERN.matcher(providerAddress);
if (matcher.matches() && isValidPort(matcher.group(2))) {
return matcher.group(1); // depends on control dependency: [if], data = [none]
}
}else if(providerId!=null){
Matcher matcher = HOST_PORT_PATTERN.matcher(providerId);
if (matcher.matches() && isValidPort(matcher.group(2))) {
return matcher.group(1); // depends on control dependency: [if], data = [none]
}
}
return providerAddress;
} } |
public class class_name {
void deleteProperty(final String key, final Configuration config) {
if (config.containsKey(key)) {
logger.debug("deleting property key [" + key + "]");
config.clearProperty(key);
}
} } | public class class_name {
void deleteProperty(final String key, final Configuration config) {
if (config.containsKey(key)) {
logger.debug("deleting property key [" + key + "]"); // depends on control dependency: [if], data = [none]
config.clearProperty(key); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Map<String, String> getQueryStringParams() {
try {
Map<String, String> params = new HashMap<String, String>();
String queryString = new URL(url).getQuery();
params.putAll(URLUtils.queryStringToMap(queryString));
params.putAll(this.querystringParams);
return params;
} catch (MalformedURLException mue) {
throw new OAuthException("Malformed URL", mue);
}
} } | public class class_name {
public Map<String, String> getQueryStringParams() {
try {
Map<String, String> params = new HashMap<String, String>();
String queryString = new URL(url).getQuery();
params.putAll(URLUtils.queryStringToMap(queryString)); // depends on control dependency: [try], data = [none]
params.putAll(this.querystringParams); // depends on control dependency: [try], data = [none]
return params; // depends on control dependency: [try], data = [none]
} catch (MalformedURLException mue) {
throw new OAuthException("Malformed URL", mue);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int estimateSize(Object message) {
if (message == null) {
return 8;
}
int answer = 8 + estimateSize(message.getClass(), null);
if (message instanceof IoBuffer) {
answer += ((IoBuffer) message).remaining();
} else if (message instanceof WriteRequest) {
answer += estimateSize(((WriteRequest) message).getMessage());
} else if (message instanceof CharSequence) {
answer += ((CharSequence) message).length() << 1;
} else if (message instanceof Iterable) {
for (Object m: (Iterable<?>) message) {
answer += estimateSize(m);
}
}
return align(answer);
} } | public class class_name {
public int estimateSize(Object message) {
if (message == null) {
return 8; // depends on control dependency: [if], data = [none]
}
int answer = 8 + estimateSize(message.getClass(), null);
if (message instanceof IoBuffer) {
answer += ((IoBuffer) message).remaining(); // depends on control dependency: [if], data = [none]
} else if (message instanceof WriteRequest) {
answer += estimateSize(((WriteRequest) message).getMessage()); // depends on control dependency: [if], data = [none]
} else if (message instanceof CharSequence) {
answer += ((CharSequence) message).length() << 1; // depends on control dependency: [if], data = [none]
} else if (message instanceof Iterable) {
for (Object m: (Iterable<?>) message) {
answer += estimateSize(m); // depends on control dependency: [for], data = [m]
}
}
return align(answer);
} } |
public class class_name {
public boolean setPublicAddress(String host, int port) {
try {
// set 'sentBy' in the listening point for outbound messages
parent.getSipProvider().getListeningPoints()[0].setSentBy(host + ":" + port);
// update my contact info
SipURI my_uri = (SipURI) contactInfo.getContactHeader().getAddress().getURI();
my_uri.setHost(host);
my_uri.setPort(port);
// update my via header
ViaHeader my_via = (ViaHeader) viaHeaders.get(0);
my_via.setHost(host);
my_via.setPort(port);
// update my host
myhost = host;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
// LOG.info("my public IP {}", host);
// LOG.info("my public port = {}", port);
// LOG.info("my sentby = {}",
// parent.getSipProvider().getListeningPoints()[0].getSentBy());
return true;
} } | public class class_name {
public boolean setPublicAddress(String host, int port) {
try {
// set 'sentBy' in the listening point for outbound messages
parent.getSipProvider().getListeningPoints()[0].setSentBy(host + ":" + port); // depends on control dependency: [try], data = [none]
// update my contact info
SipURI my_uri = (SipURI) contactInfo.getContactHeader().getAddress().getURI();
my_uri.setHost(host); // depends on control dependency: [try], data = [none]
my_uri.setPort(port); // depends on control dependency: [try], data = [none]
// update my via header
ViaHeader my_via = (ViaHeader) viaHeaders.get(0);
my_via.setHost(host); // depends on control dependency: [try], data = [none]
my_via.setPort(port); // depends on control dependency: [try], data = [none]
// update my host
myhost = host; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
} // depends on control dependency: [catch], data = [none]
// LOG.info("my public IP {}", host);
// LOG.info("my public port = {}", port);
// LOG.info("my sentby = {}",
// parent.getSipProvider().getListeningPoints()[0].getSentBy());
return true;
} } |
public class class_name {
private static void copyValue(final Map<String, ?> sourceMap, final String sourceKey,
final Map<String, String> targetMap, final String targetKey) {
if (getOption(sourceKey, sourceMap) != null && String.class.isInstance(getOption(sourceKey, sourceMap))) {
targetMap.put(targetKey, (String) getOption(sourceKey, sourceMap));
}
} } | public class class_name {
private static void copyValue(final Map<String, ?> sourceMap, final String sourceKey,
final Map<String, String> targetMap, final String targetKey) {
if (getOption(sourceKey, sourceMap) != null && String.class.isInstance(getOption(sourceKey, sourceMap))) {
targetMap.put(targetKey, (String) getOption(sourceKey, sourceMap)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void startHandleChallenges(JSONObject jsonChallenges, Response response) {
ArrayList<String> challenges = getRealmsFromJson(jsonChallenges);
MCAAuthorizationManager authManager = (MCAAuthorizationManager) BMSClient.getInstance().getAuthorizationManager();
if (isAuthorizationRequired(response)) {
setExpectedAnswers(challenges);
}
for (String realm : challenges) {
ChallengeHandler handler = authManager.getChallengeHandler(realm);
if (handler != null) {
JSONObject challenge = jsonChallenges.optJSONObject(realm);
handler.handleChallenge(this, challenge, context);
} else {
throw new RuntimeException("Challenge handler for realm is not found: " + realm);
}
}
} } | public class class_name {
private void startHandleChallenges(JSONObject jsonChallenges, Response response) {
ArrayList<String> challenges = getRealmsFromJson(jsonChallenges);
MCAAuthorizationManager authManager = (MCAAuthorizationManager) BMSClient.getInstance().getAuthorizationManager();
if (isAuthorizationRequired(response)) {
setExpectedAnswers(challenges); // depends on control dependency: [if], data = [none]
}
for (String realm : challenges) {
ChallengeHandler handler = authManager.getChallengeHandler(realm);
if (handler != null) {
JSONObject challenge = jsonChallenges.optJSONObject(realm);
handler.handleChallenge(this, challenge, context); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Challenge handler for realm is not found: " + realm);
}
}
} } |
public class class_name {
public java.util.List<String> getZoneIds() {
if (zoneIds == null) {
zoneIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return zoneIds;
} } | public class class_name {
public java.util.List<String> getZoneIds() {
if (zoneIds == null) {
zoneIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return zoneIds;
} } |
public class class_name {
public void removePropertyChangeListener(String p, PropertyChangeListener l)
{
if (listeners == null)
{
return;
}
synchronized (listeners)
{
listeners.remove(l);
}
} } | public class class_name {
public void removePropertyChangeListener(String p, PropertyChangeListener l)
{
if (listeners == null)
{
return; // depends on control dependency: [if], data = [none]
}
synchronized (listeners)
{
listeners.remove(l);
}
} } |
public class class_name {
@Override
protected void doPerform() {
org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode());
if (isSourceDocumentRoot()) {
keyboard().pressKey(seleniumKeys);
} else {
getActions().keyDown(getFirstElement(), seleniumKeys).perform();
}
} } | public class class_name {
@Override
protected void doPerform() {
org.openqa.selenium.Keys seleniumKeys = org.openqa.selenium.Keys.getKeyFromUnicode(keys.getKeyCode());
if (isSourceDocumentRoot()) {
keyboard().pressKey(seleniumKeys); // depends on control dependency: [if], data = [none]
} else {
getActions().keyDown(getFirstElement(), seleniumKeys).perform(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FacesConfigManagedBeanType<WebFacesConfigDescriptor> getOrCreateManagedBean()
{
List<Node> nodeList = model.get("managed-bean");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigManagedBeanTypeImpl<WebFacesConfigDescriptor>(this, "managed-bean", model, nodeList.get(0));
}
return createManagedBean();
} } | public class class_name {
public FacesConfigManagedBeanType<WebFacesConfigDescriptor> getOrCreateManagedBean()
{
List<Node> nodeList = model.get("managed-bean");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigManagedBeanTypeImpl<WebFacesConfigDescriptor>(this, "managed-bean", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createManagedBean();
} } |
public class class_name {
private void parseRequestSmugglingProtection(Map<Object, Object> props) {
// PK53193 - allow this to be disabled
Object value = props.get(HttpConfigConstants.PROPNAME_ENABLE_SMUGGLING_PROTECTION);
if (null != value) {
this.bEnableSmugglingProtection = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: request smuggling protection is " + this.bEnableSmugglingProtection);
}
}
} } | public class class_name {
private void parseRequestSmugglingProtection(Map<Object, Object> props) {
// PK53193 - allow this to be disabled
Object value = props.get(HttpConfigConstants.PROPNAME_ENABLE_SMUGGLING_PROTECTION);
if (null != value) {
this.bEnableSmugglingProtection = convertBoolean(value); // depends on control dependency: [if], data = [value)]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Config: request smuggling protection is " + this.bEnableSmugglingProtection); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(DescribeWorkspacesRequest describeWorkspacesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeWorkspacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeWorkspacesRequest.getWorkspaceIds(), WORKSPACEIDS_BINDING);
protocolMarshaller.marshall(describeWorkspacesRequest.getDirectoryId(), DIRECTORYID_BINDING);
protocolMarshaller.marshall(describeWorkspacesRequest.getUserName(), USERNAME_BINDING);
protocolMarshaller.marshall(describeWorkspacesRequest.getBundleId(), BUNDLEID_BINDING);
protocolMarshaller.marshall(describeWorkspacesRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(describeWorkspacesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeWorkspacesRequest describeWorkspacesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeWorkspacesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeWorkspacesRequest.getWorkspaceIds(), WORKSPACEIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkspacesRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkspacesRequest.getUserName(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkspacesRequest.getBundleId(), BUNDLEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkspacesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkspacesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public short[] getShortArray(final String key, final short[] def) {
try {
final short[] result = getShortArray(key);
return result != null ? result : def;
} catch (final NumberFormatException nfe) {
return def;
}
} } | public class class_name {
public short[] getShortArray(final String key, final short[] def) {
try {
final short[] result = getShortArray(key);
return result != null ? result : def; // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException nfe) {
return def;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static JobDef map(ResultSet rs, int colShift)
{
JobDef tmp = new JobDef();
try
{
tmp.id = rs.getInt(1 + colShift);
tmp.application = rs.getString(2 + colShift);
tmp.applicationName = rs.getString(3 + colShift);
tmp.canBeRestarted = true;
tmp.classLoader = rs.getInt(4 + colShift) > 0 ? rs.getInt(4 + colShift) : null;
tmp.description = rs.getString(5 + colShift);
tmp.enabled = rs.getBoolean(6 + colShift);
tmp.external = rs.getBoolean(7 + colShift);
tmp.highlander = rs.getBoolean(8 + colShift);
tmp.jarPath = rs.getString(9 + colShift);
tmp.javaClassName = rs.getString(10 + colShift);
tmp.javaOpts = rs.getString(11 + colShift);
tmp.keyword1 = rs.getString(12 + colShift);
tmp.keyword2 = rs.getString(13 + colShift);
tmp.keyword3 = rs.getString(14 + colShift);
tmp.maxTimeRunning = rs.getInt(15 + colShift);
tmp.module = rs.getString(16 + colShift);
tmp.pathType = PathType.valueOf(rs.getString(17 + colShift));
tmp.queue_id = rs.getInt(18 + colShift);
tmp.priority = rs.getInt(19 + colShift) > 0 ? rs.getInt(19 + colShift) : null;
}
catch (SQLException e)
{
throw new DatabaseException(e);
}
return tmp;
} } | public class class_name {
static JobDef map(ResultSet rs, int colShift)
{
JobDef tmp = new JobDef();
try
{
tmp.id = rs.getInt(1 + colShift); // depends on control dependency: [try], data = [none]
tmp.application = rs.getString(2 + colShift); // depends on control dependency: [try], data = [none]
tmp.applicationName = rs.getString(3 + colShift); // depends on control dependency: [try], data = [none]
tmp.canBeRestarted = true; // depends on control dependency: [try], data = [none]
tmp.classLoader = rs.getInt(4 + colShift) > 0 ? rs.getInt(4 + colShift) : null; // depends on control dependency: [try], data = [none]
tmp.description = rs.getString(5 + colShift); // depends on control dependency: [try], data = [none]
tmp.enabled = rs.getBoolean(6 + colShift); // depends on control dependency: [try], data = [none]
tmp.external = rs.getBoolean(7 + colShift); // depends on control dependency: [try], data = [none]
tmp.highlander = rs.getBoolean(8 + colShift); // depends on control dependency: [try], data = [none]
tmp.jarPath = rs.getString(9 + colShift); // depends on control dependency: [try], data = [none]
tmp.javaClassName = rs.getString(10 + colShift); // depends on control dependency: [try], data = [none]
tmp.javaOpts = rs.getString(11 + colShift); // depends on control dependency: [try], data = [none]
tmp.keyword1 = rs.getString(12 + colShift); // depends on control dependency: [try], data = [none]
tmp.keyword2 = rs.getString(13 + colShift); // depends on control dependency: [try], data = [none]
tmp.keyword3 = rs.getString(14 + colShift); // depends on control dependency: [try], data = [none]
tmp.maxTimeRunning = rs.getInt(15 + colShift); // depends on control dependency: [try], data = [none]
tmp.module = rs.getString(16 + colShift); // depends on control dependency: [try], data = [none]
tmp.pathType = PathType.valueOf(rs.getString(17 + colShift)); // depends on control dependency: [try], data = [none]
tmp.queue_id = rs.getInt(18 + colShift); // depends on control dependency: [try], data = [none]
tmp.priority = rs.getInt(19 + colShift) > 0 ? rs.getInt(19 + colShift) : null; // depends on control dependency: [try], data = [none]
}
catch (SQLException e)
{
throw new DatabaseException(e);
} // depends on control dependency: [catch], data = [none]
return tmp;
} } |
public class class_name {
public DevState extractDevState() throws DevFailed {
manageExceptions("extractDevState");
if (use_union) {
// Check if saclar (State attribute itself !)
if (attributeValue_5.value.discriminator().value() == AttributeDataType._DEVICE_STATE) {
return attributeValue_5.value.dev_state_att();
} else {
return attributeValue_5.value.state_att_value()[0];
}
} else {
return deviceAttribute_3.extractDevState();
}
} } | public class class_name {
public DevState extractDevState() throws DevFailed {
manageExceptions("extractDevState");
if (use_union) {
// Check if saclar (State attribute itself !)
if (attributeValue_5.value.discriminator().value() == AttributeDataType._DEVICE_STATE) {
return attributeValue_5.value.dev_state_att(); // depends on control dependency: [if], data = [none]
} else {
return attributeValue_5.value.state_att_value()[0]; // depends on control dependency: [if], data = [none]
}
} else {
return deviceAttribute_3.extractDevState();
}
} } |
public class class_name {
@Trivial
private void transferOrReleasePermit() {
maxConcurrencyConstraint.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "expedites/maxConcurrency available",
expeditesAvailable, maxConcurrencyConstraint.availablePermits());
// The permit might be needed to run tasks on the global executor,
if (!queue.isEmpty() && withheldConcurrency.get() > 0 && maxConcurrencyConstraint.tryAcquire()) {
decrementWithheldConcurrency();
if (acquireExpedite() > 0)
expediteGlobal(new GlobalPoolTask());
else
enqueueGlobal(new GlobalPoolTask());
}
} } | public class class_name {
@Trivial
private void transferOrReleasePermit() {
maxConcurrencyConstraint.release();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "expedites/maxConcurrency available",
expeditesAvailable, maxConcurrencyConstraint.availablePermits());
// The permit might be needed to run tasks on the global executor,
if (!queue.isEmpty() && withheldConcurrency.get() > 0 && maxConcurrencyConstraint.tryAcquire()) {
decrementWithheldConcurrency(); // depends on control dependency: [if], data = [none]
if (acquireExpedite() > 0)
expediteGlobal(new GlobalPoolTask());
else
enqueueGlobal(new GlobalPoolTask());
}
} } |
public class class_name {
public static String unescape(String htmlStr) {
if (StrUtil.isBlank(htmlStr)) {
return htmlStr;
}
return htmlStr.replace(StrUtil.HTML_APOS, "'")//
.replace("'", "'")//
.replace("'", "'")//
.replace(StrUtil.HTML_LT, "<")//
.replace(StrUtil.HTML_GT, ">")//
.replace(StrUtil.HTML_QUOTE, "\"")//
.replace(StrUtil.HTML_AMP, "&")//
.replace(StrUtil.HTML_NBSP, " "//
);
} } | public class class_name {
public static String unescape(String htmlStr) {
if (StrUtil.isBlank(htmlStr)) {
return htmlStr;
// depends on control dependency: [if], data = [none]
}
return htmlStr.replace(StrUtil.HTML_APOS, "'")//
.replace("'", "'")//
.replace("'", "'")//
.replace(StrUtil.HTML_LT, "<")//
.replace(StrUtil.HTML_GT, ">")//
.replace(StrUtil.HTML_QUOTE, "\"")//
.replace(StrUtil.HTML_AMP, "&")//
.replace(StrUtil.HTML_NBSP, " "//
);
} } |
public class class_name {
public Optional<TypeInformation<?>> getFieldType(String fieldName) {
if (fieldNameToIndex.containsKey(fieldName)) {
return Optional.of(fieldTypes[fieldNameToIndex.get(fieldName)]);
}
return Optional.empty();
} } | public class class_name {
public Optional<TypeInformation<?>> getFieldType(String fieldName) {
if (fieldNameToIndex.containsKey(fieldName)) {
return Optional.of(fieldTypes[fieldNameToIndex.get(fieldName)]); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public void marshall(ProcessorParameter processorParameter, ProtocolMarshaller protocolMarshaller) {
if (processorParameter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(processorParameter.getParameterName(), PARAMETERNAME_BINDING);
protocolMarshaller.marshall(processorParameter.getParameterValue(), PARAMETERVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ProcessorParameter processorParameter, ProtocolMarshaller protocolMarshaller) {
if (processorParameter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(processorParameter.getParameterName(), PARAMETERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(processorParameter.getParameterValue(), PARAMETERVALUE_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 createIndexesTemplates() {
try {
initIndexesTemplates();
updateIndexesNames();
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(this::updateIndexesNames, 0, 1, TimeUnit.HOURS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} } | public class class_name {
private void createIndexesTemplates() {
try {
initIndexesTemplates(); // depends on control dependency: [try], data = [none]
updateIndexesNames(); // depends on control dependency: [try], data = [none]
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(this::updateIndexesNames, 0, 1, TimeUnit.HOURS); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Date parseDate(String dateStr, String pattern) {
try {
SimpleDateFormat format = null;
if (StringUtils.isBlank(dateStr))
return null;
if (StringUtils.isNotBlank(pattern)) {
format = new SimpleDateFormat(pattern);
return format.parse(dateStr);
}
return parseDate(dateStr);
} catch (Exception e) {
throw new RuntimeException("无法解析日期字符[" + dateStr + "]");
}
} } | public class class_name {
public static Date parseDate(String dateStr, String pattern) {
try {
SimpleDateFormat format = null;
if (StringUtils.isBlank(dateStr))
return null;
if (StringUtils.isNotBlank(pattern)) {
format = new SimpleDateFormat(pattern); // depends on control dependency: [if], data = [none]
return format.parse(dateStr); // depends on control dependency: [if], data = [none]
}
return parseDate(dateStr); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("无法解析日期字符[" + dateStr + "]");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void deleteLinkInverseValue(String targetObjID) {
int shardNo = m_tableDef.getShardNumber(m_dbObj);
if (shardNo > 0 && m_invLinkDef.isSharded()) {
m_dbTran.deleteShardedLinkValue(targetObjID, m_invLinkDef, m_dbObj.getObjectID(), shardNo);
} else {
m_dbTran.deleteLinkValue(targetObjID, m_invLinkDef, m_dbObj.getObjectID());
}
} } | public class class_name {
private void deleteLinkInverseValue(String targetObjID) {
int shardNo = m_tableDef.getShardNumber(m_dbObj);
if (shardNo > 0 && m_invLinkDef.isSharded()) {
m_dbTran.deleteShardedLinkValue(targetObjID, m_invLinkDef, m_dbObj.getObjectID(), shardNo);
// depends on control dependency: [if], data = [none]
} else {
m_dbTran.deleteLinkValue(targetObjID, m_invLinkDef, m_dbObj.getObjectID());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getDefault(final String key) {
if (defaultValues.containsKey(key)) {
return defaultValues.get(key);
}
return "";
} } | public class class_name {
public String getDefault(final String key) {
if (defaultValues.containsKey(key)) {
return defaultValues.get(key); // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
public String format(Style style, TimeZone tz, long date, Output<TimeType> timeType) {
String result = null;
if (timeType != null) {
timeType.value = TimeType.UNKNOWN;
}
boolean noOffsetFormatFallback = false;
switch (style) {
case GENERIC_LOCATION:
result = getTimeZoneGenericNames().getGenericLocationName(ZoneMeta.getCanonicalCLDRID(tz));
break;
case GENERIC_LONG:
result = getTimeZoneGenericNames().getDisplayName(tz, GenericNameType.LONG, date);
break;
case GENERIC_SHORT:
result = getTimeZoneGenericNames().getDisplayName(tz, GenericNameType.SHORT, date);
break;
case SPECIFIC_LONG:
result = formatSpecific(tz, NameType.LONG_STANDARD, NameType.LONG_DAYLIGHT, date, timeType);
break;
case SPECIFIC_SHORT:
result = formatSpecific(tz, NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT, date, timeType);
break;
case ZONE_ID:
result = tz.getID();
noOffsetFormatFallback = true;
break;
case ZONE_ID_SHORT:
result = ZoneMeta.getShortID(tz);
if (result == null) {
result = UNKNOWN_SHORT_ZONE_ID;
}
noOffsetFormatFallback = true;
break;
case EXEMPLAR_LOCATION:
result = formatExemplarLocation(tz);
noOffsetFormatFallback = true;
break;
default:
// will be handled below
break;
}
if (result == null && !noOffsetFormatFallback) {
int[] offsets = {0, 0};
tz.getOffset(date, false, offsets);
int offset = offsets[0] + offsets[1];
switch (style) {
case GENERIC_LOCATION:
case GENERIC_LONG:
case SPECIFIC_LONG:
case LOCALIZED_GMT:
result = formatOffsetLocalizedGMT(offset);
break;
case GENERIC_SHORT:
case SPECIFIC_SHORT:
case LOCALIZED_GMT_SHORT:
result = formatOffsetShortLocalizedGMT(offset);
break;
case ISO_BASIC_SHORT:
result = formatOffsetISO8601Basic(offset, true, true, true);
break;
case ISO_BASIC_LOCAL_SHORT:
result = formatOffsetISO8601Basic(offset, false, true, true);
break;
case ISO_BASIC_FIXED:
result = formatOffsetISO8601Basic(offset, true, false, true);
break;
case ISO_BASIC_LOCAL_FIXED:
result = formatOffsetISO8601Basic(offset, false, false, true);
break;
case ISO_BASIC_FULL:
result = formatOffsetISO8601Basic(offset, true, false, false);
break;
case ISO_BASIC_LOCAL_FULL:
result = formatOffsetISO8601Basic(offset, false, false, false);
break;
case ISO_EXTENDED_FIXED:
result = formatOffsetISO8601Extended(offset, true, false, true);
break;
case ISO_EXTENDED_LOCAL_FIXED:
result = formatOffsetISO8601Extended(offset, false, false, true);
break;
case ISO_EXTENDED_FULL:
result = formatOffsetISO8601Extended(offset, true, false, false);
break;
case ISO_EXTENDED_LOCAL_FULL:
result = formatOffsetISO8601Extended(offset, false, false, false);
break;
default:
// Other cases are handled earlier and never comes into this
// switch statement.
assert false;
break;
}
// time type
if (timeType != null) {
timeType.value = (offsets[1] != 0) ? TimeType.DAYLIGHT : TimeType.STANDARD;
}
}
assert(result != null);
return result;
} } | public class class_name {
public String format(Style style, TimeZone tz, long date, Output<TimeType> timeType) {
String result = null;
if (timeType != null) {
timeType.value = TimeType.UNKNOWN; // depends on control dependency: [if], data = [none]
}
boolean noOffsetFormatFallback = false;
switch (style) {
case GENERIC_LOCATION:
result = getTimeZoneGenericNames().getGenericLocationName(ZoneMeta.getCanonicalCLDRID(tz));
break;
case GENERIC_LONG:
result = getTimeZoneGenericNames().getDisplayName(tz, GenericNameType.LONG, date);
break;
case GENERIC_SHORT:
result = getTimeZoneGenericNames().getDisplayName(tz, GenericNameType.SHORT, date);
break;
case SPECIFIC_LONG:
result = formatSpecific(tz, NameType.LONG_STANDARD, NameType.LONG_DAYLIGHT, date, timeType);
break;
case SPECIFIC_SHORT:
result = formatSpecific(tz, NameType.SHORT_STANDARD, NameType.SHORT_DAYLIGHT, date, timeType);
break;
case ZONE_ID:
result = tz.getID();
noOffsetFormatFallback = true;
break;
case ZONE_ID_SHORT:
result = ZoneMeta.getShortID(tz);
if (result == null) {
result = UNKNOWN_SHORT_ZONE_ID; // depends on control dependency: [if], data = [none]
}
noOffsetFormatFallback = true;
break;
case EXEMPLAR_LOCATION:
result = formatExemplarLocation(tz);
noOffsetFormatFallback = true;
break;
default:
// will be handled below
break;
}
if (result == null && !noOffsetFormatFallback) {
int[] offsets = {0, 0};
tz.getOffset(date, false, offsets); // depends on control dependency: [if], data = [none]
int offset = offsets[0] + offsets[1];
switch (style) {
case GENERIC_LOCATION:
case GENERIC_LONG:
case SPECIFIC_LONG:
case LOCALIZED_GMT:
result = formatOffsetLocalizedGMT(offset);
break;
case GENERIC_SHORT:
case SPECIFIC_SHORT:
case LOCALIZED_GMT_SHORT:
result = formatOffsetShortLocalizedGMT(offset);
break;
case ISO_BASIC_SHORT:
result = formatOffsetISO8601Basic(offset, true, true, true);
break;
case ISO_BASIC_LOCAL_SHORT:
result = formatOffsetISO8601Basic(offset, false, true, true);
break;
case ISO_BASIC_FIXED:
result = formatOffsetISO8601Basic(offset, true, false, true);
break;
case ISO_BASIC_LOCAL_FIXED:
result = formatOffsetISO8601Basic(offset, false, false, true);
break;
case ISO_BASIC_FULL:
result = formatOffsetISO8601Basic(offset, true, false, false);
break;
case ISO_BASIC_LOCAL_FULL:
result = formatOffsetISO8601Basic(offset, false, false, false);
break;
case ISO_EXTENDED_FIXED:
result = formatOffsetISO8601Extended(offset, true, false, true);
break;
case ISO_EXTENDED_LOCAL_FIXED:
result = formatOffsetISO8601Extended(offset, false, false, true);
break;
case ISO_EXTENDED_FULL:
result = formatOffsetISO8601Extended(offset, true, false, false);
break;
case ISO_EXTENDED_LOCAL_FULL:
result = formatOffsetISO8601Extended(offset, false, false, false);
break;
default:
// Other cases are handled earlier and never comes into this
// switch statement.
assert false;
break;
}
// time type
if (timeType != null) {
timeType.value = (offsets[1] != 0) ? TimeType.DAYLIGHT : TimeType.STANDARD; // depends on control dependency: [if], data = [none]
}
}
assert(result != null);
return result;
} } |
public class class_name {
public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return;
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return;
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath());
toFile.copyFile(fromfile);
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
}
} } | public class class_name {
public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return; // depends on control dependency: [if], data = [none]
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath()); // depends on control dependency: [try], data = [none]
toFile.copyFile(fromfile); // depends on control dependency: [try], data = [none]
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Vector3f getAxesAnglesRad() {
final double roll;
final double pitch;
double yaw;
final double test = w * x - y * z;
if (Math.abs(test) < 0.4999) {
roll = TrigMath.atan2(2 * (w * z + x * y), 1 - 2 * (x * x + z * z));
pitch = TrigMath.asin(2 * test);
yaw = TrigMath.atan2(2 * (w * y + z * x), 1 - 2 * (x * x + y * y));
} else {
final int sign = (test < 0) ? -1 : 1;
roll = 0;
pitch = sign * Math.PI / 2;
yaw = -sign * 2 * TrigMath.atan2(z, w);
}
return new Vector3f(pitch, yaw, roll);
} } | public class class_name {
public Vector3f getAxesAnglesRad() {
final double roll;
final double pitch;
double yaw;
final double test = w * x - y * z;
if (Math.abs(test) < 0.4999) {
roll = TrigMath.atan2(2 * (w * z + x * y), 1 - 2 * (x * x + z * z)); // depends on control dependency: [if], data = [none]
pitch = TrigMath.asin(2 * test); // depends on control dependency: [if], data = [none]
yaw = TrigMath.atan2(2 * (w * y + z * x), 1 - 2 * (x * x + y * y)); // depends on control dependency: [if], data = [none]
} else {
final int sign = (test < 0) ? -1 : 1;
roll = 0; // depends on control dependency: [if], data = [none]
pitch = sign * Math.PI / 2; // depends on control dependency: [if], data = [none]
yaw = -sign * 2 * TrigMath.atan2(z, w); // depends on control dependency: [if], data = [none]
}
return new Vector3f(pitch, yaw, roll);
} } |
public class class_name {
public void setAllowedHttpMethods(Collection<String> allowedHttpMethods) {
if (allowedHttpMethods == null) {
throw new IllegalArgumentException("allowedHttpMethods cannot be null");
}
if (allowedHttpMethods == ALLOW_ANY_HTTP_METHOD) {
this.allowedHttpMethods = ALLOW_ANY_HTTP_METHOD;
} else {
this.allowedHttpMethods = new HashSet<>(allowedHttpMethods);
}
} } | public class class_name {
public void setAllowedHttpMethods(Collection<String> allowedHttpMethods) {
if (allowedHttpMethods == null) {
throw new IllegalArgumentException("allowedHttpMethods cannot be null");
}
if (allowedHttpMethods == ALLOW_ANY_HTTP_METHOD) {
this.allowedHttpMethods = ALLOW_ANY_HTTP_METHOD; // depends on control dependency: [if], data = [none]
} else {
this.allowedHttpMethods = new HashSet<>(allowedHttpMethods); // depends on control dependency: [if], data = [(allowedHttpMethods]
}
} } |
public class class_name {
protected boolean hasIndexProperty(final BeanProperty bp) {
if (bp.bean == null) {
return false;
}
String indexString = extractIndex(bp);
if (indexString == null) {
return hasSimpleProperty(bp);
}
Object resultBean = getSimpleProperty(bp);
if (resultBean == null) {
return false;
}
// try: property[index]
if (resultBean.getClass().isArray()) {
int index = parseInt(indexString, bp);
return (index >= 0) && (index < Array.getLength(resultBean));
}
// try: list.get(index)
if (resultBean instanceof List) {
int index = parseInt(indexString, bp);
return (index >= 0) && (index < ((List)resultBean).size());
}
if (resultBean instanceof Map) {
return ((Map)resultBean).containsKey(indexString);
}
// failed
return false;
} } | public class class_name {
protected boolean hasIndexProperty(final BeanProperty bp) {
if (bp.bean == null) {
return false; // depends on control dependency: [if], data = [none]
}
String indexString = extractIndex(bp);
if (indexString == null) {
return hasSimpleProperty(bp); // depends on control dependency: [if], data = [none]
}
Object resultBean = getSimpleProperty(bp);
if (resultBean == null) {
return false; // depends on control dependency: [if], data = [none]
}
// try: property[index]
if (resultBean.getClass().isArray()) {
int index = parseInt(indexString, bp);
return (index >= 0) && (index < Array.getLength(resultBean)); // depends on control dependency: [if], data = [none]
}
// try: list.get(index)
if (resultBean instanceof List) {
int index = parseInt(indexString, bp);
return (index >= 0) && (index < ((List)resultBean).size()); // depends on control dependency: [if], data = [none]
}
if (resultBean instanceof Map) {
return ((Map)resultBean).containsKey(indexString); // depends on control dependency: [if], data = [none]
}
// failed
return false;
} } |
public class class_name {
void destroy() {
for (DistributedObjectFuture future : proxies.values()) {
if (!future.isSetAndInitialized()) {
continue;
}
DistributedObject distributedObject = extractDistributedObject(future);
invalidate(distributedObject);
}
proxies.clear();
} } | public class class_name {
void destroy() {
for (DistributedObjectFuture future : proxies.values()) {
if (!future.isSetAndInitialized()) {
continue;
}
DistributedObject distributedObject = extractDistributedObject(future);
invalidate(distributedObject); // depends on control dependency: [for], data = [none]
}
proxies.clear();
} } |
public class class_name {
public void setTempo(double bpm) {
if (bpm == 0.0) {
throw new IllegalArgumentException("Tempo cannot be zero.");
}
final double oldTempo = metronome.getTempo();
metronome.setTempo(bpm);
notifyBeatSenderOfChange();
if (isTempoMaster() && (Math.abs(bpm - oldTempo) > getTempoEpsilon())) {
deliverTempoChangedAnnouncement(bpm);
}
} } | public class class_name {
public void setTempo(double bpm) {
if (bpm == 0.0) {
throw new IllegalArgumentException("Tempo cannot be zero.");
}
final double oldTempo = metronome.getTempo();
metronome.setTempo(bpm);
notifyBeatSenderOfChange();
if (isTempoMaster() && (Math.abs(bpm - oldTempo) > getTempoEpsilon())) {
deliverTempoChangedAnnouncement(bpm); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean updateMemoryWithYieldInfo()
{
long memorySize = getSizeInMemory();
if (partial && maxPartialMemory.isPresent()) {
updateMemory(memorySize);
full = (memorySize > maxPartialMemory.getAsLong());
return true;
}
// Operator/driver will be blocked on memory after we call setBytes.
// If memory is not available, once we return, this operator will be blocked until memory is available.
updateMemory(memorySize);
// If memory is not available, inform the caller that we cannot proceed for allocation.
return operatorContext.isWaitingForMemory().isDone();
} } | public class class_name {
private boolean updateMemoryWithYieldInfo()
{
long memorySize = getSizeInMemory();
if (partial && maxPartialMemory.isPresent()) {
updateMemory(memorySize); // depends on control dependency: [if], data = [none]
full = (memorySize > maxPartialMemory.getAsLong()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// Operator/driver will be blocked on memory after we call setBytes.
// If memory is not available, once we return, this operator will be blocked until memory is available.
updateMemory(memorySize);
// If memory is not available, inform the caller that we cannot proceed for allocation.
return operatorContext.isWaitingForMemory().isDone();
} } |
public class class_name {
public static Rule getRule(final String value) {
Level thisLevel;
if (levelList.contains(value.toUpperCase())) {
thisLevel = Level.toLevel(value.toUpperCase());
} else {
thisLevel = UtilLoggingLevel.toLevel(value.toUpperCase());
}
return new NotLevelEqualsRule(thisLevel);
} } | public class class_name {
public static Rule getRule(final String value) {
Level thisLevel;
if (levelList.contains(value.toUpperCase())) {
thisLevel = Level.toLevel(value.toUpperCase()); // depends on control dependency: [if], data = [none]
} else {
thisLevel = UtilLoggingLevel.toLevel(value.toUpperCase()); // depends on control dependency: [if], data = [none]
}
return new NotLevelEqualsRule(thisLevel);
} } |
public class class_name {
public AmazonWebServiceRequest getCloneRoot() {
AmazonWebServiceRequest cloneRoot = cloneSource;
if (cloneRoot != null) {
while (cloneRoot.getCloneSource() != null) {
cloneRoot = cloneRoot.getCloneSource();
}
}
return cloneRoot;
} } | public class class_name {
public AmazonWebServiceRequest getCloneRoot() {
AmazonWebServiceRequest cloneRoot = cloneSource;
if (cloneRoot != null) {
while (cloneRoot.getCloneSource() != null) {
cloneRoot = cloneRoot.getCloneSource(); // depends on control dependency: [while], data = [none]
}
}
return cloneRoot;
} } |
public class class_name {
public void setCreatedTimestampMetadata(PropertyMetadata createdTimestampMetadata) {
if (this.createdTimestampMetadata != null) {
throwDuplicateAnnotationException(entityClass, CreatedTimestamp.class,
this.createdTimestampMetadata, createdTimestampMetadata);
}
this.createdTimestampMetadata = createdTimestampMetadata;
} } | public class class_name {
public void setCreatedTimestampMetadata(PropertyMetadata createdTimestampMetadata) {
if (this.createdTimestampMetadata != null) {
throwDuplicateAnnotationException(entityClass, CreatedTimestamp.class,
this.createdTimestampMetadata, createdTimestampMetadata); // depends on control dependency: [if], data = [none]
}
this.createdTimestampMetadata = createdTimestampMetadata;
} } |
public class class_name {
protected int getProximityPosition(int predicateIndex)
{
// A negative predicate index seems to occur with
// (preceding-sibling::*|following-sibling::*)/ancestor::*[position()]/*[position()]
// -sb
if(predicateIndex < 0)
return -1;
int count = m_proximityPositions[predicateIndex];
if (count <= 0)
{
AxesWalker savedWalker = wi().getLastUsedWalker();
try
{
ReverseAxesWalker clone = (ReverseAxesWalker) this.clone();
clone.setRoot(this.getRoot());
clone.setPredicateCount(predicateIndex);
clone.setPrevWalker(null);
clone.setNextWalker(null);
wi().setLastUsedWalker(clone);
// Count 'em all
count++;
int next;
while (DTM.NULL != (next = clone.nextNode()))
{
count++;
}
m_proximityPositions[predicateIndex] = count;
}
catch (CloneNotSupportedException cnse)
{
// can't happen
}
finally
{
wi().setLastUsedWalker(savedWalker);
}
}
return count;
} } | public class class_name {
protected int getProximityPosition(int predicateIndex)
{
// A negative predicate index seems to occur with
// (preceding-sibling::*|following-sibling::*)/ancestor::*[position()]/*[position()]
// -sb
if(predicateIndex < 0)
return -1;
int count = m_proximityPositions[predicateIndex];
if (count <= 0)
{
AxesWalker savedWalker = wi().getLastUsedWalker();
try
{
ReverseAxesWalker clone = (ReverseAxesWalker) this.clone();
clone.setRoot(this.getRoot()); // depends on control dependency: [try], data = [none]
clone.setPredicateCount(predicateIndex); // depends on control dependency: [try], data = [none]
clone.setPrevWalker(null); // depends on control dependency: [try], data = [none]
clone.setNextWalker(null); // depends on control dependency: [try], data = [none]
wi().setLastUsedWalker(clone); // depends on control dependency: [try], data = [none]
// Count 'em all
count++; // depends on control dependency: [try], data = [none]
int next;
while (DTM.NULL != (next = clone.nextNode()))
{
count++; // depends on control dependency: [while], data = [none]
}
m_proximityPositions[predicateIndex] = count; // depends on control dependency: [try], data = [none]
}
catch (CloneNotSupportedException cnse)
{
// can't happen
} // depends on control dependency: [catch], data = [none]
finally
{
wi().setLastUsedWalker(savedWalker);
}
}
return count;
} } |
public class class_name {
public static String quote(final String value) {
if (value == null) {
return null;
}
String result = value;
if (!result.startsWith("\"")) {
result = "\"" + result;
}
if (!result.endsWith("\"")) {
result = result + "\"";
}
return result;
} } | public class class_name {
public static String quote(final String value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
String result = value;
if (!result.startsWith("\"")) {
result = "\"" + result; // depends on control dependency: [if], data = [none]
}
if (!result.endsWith("\"")) {
result = result + "\""; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
protected void onOutboundComplete() {
if (log.isDebugEnabled()) {
log.debug(format(channel(), "[{}] User Handler requesting close connection"), formatName());
}
markPersistent(false);
terminate();
} } | public class class_name {
protected void onOutboundComplete() {
if (log.isDebugEnabled()) {
log.debug(format(channel(), "[{}] User Handler requesting close connection"), formatName()); // depends on control dependency: [if], data = [none]
}
markPersistent(false);
terminate();
} } |
public class class_name {
@PostConstruct
public void init() {
final String thumbnailPath = System.getProperty(Constants.FESS_THUMBNAIL_PATH);
if (thumbnailPath != null) {
baseDir = new File(thumbnailPath);
} else {
final String varPath = System.getProperty(Constants.FESS_VAR_PATH);
if (varPath != null) {
baseDir = new File(varPath, THUMBNAILS_DIR_NAME);
} else {
baseDir = ResourceUtil.getThumbnailPath().toFile();
}
}
if (baseDir.mkdirs()) {
logger.info("Created: " + baseDir.getAbsolutePath());
}
if (!baseDir.isDirectory()) {
throw new FessSystemException("Not found: " + baseDir.getAbsolutePath());
}
if (logger.isDebugEnabled()) {
logger.debug("Thumbnail Directory: " + baseDir.getAbsolutePath());
}
thumbnailTaskQueue = new LinkedBlockingQueue<>(thumbnailTaskQueueSize);
generating = !Constants.TRUE.equalsIgnoreCase(System.getProperty("fess.thumbnail.process"));
thumbnailQueueThread = new Thread((Runnable) () -> {
final List<Tuple3<String, String, String>> taskList = new ArrayList<>();
while (generating) {
try {
final Tuple3<String, String, String> task = thumbnailTaskQueue.poll(thumbnailTaskQueueTimeout, TimeUnit.MILLISECONDS);
if (task == null) {
if (!taskList.isEmpty()) {
storeQueue(taskList);
}
} else if (!taskList.contains(task)) {
taskList.add(task);
if (taskList.size() > thumbnailTaskBulkSize) {
storeQueue(taskList);
}
}
} catch (final InterruptedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Interupted task.", e);
}
} catch (final Exception e) {
if (generating) {
logger.warn("Failed to generate thumbnail.", e);
}
}
}
if (!taskList.isEmpty()) {
storeQueue(taskList);
}
}, "ThumbnailGenerator");
thumbnailQueueThread.start();
} } | public class class_name {
@PostConstruct
public void init() {
final String thumbnailPath = System.getProperty(Constants.FESS_THUMBNAIL_PATH);
if (thumbnailPath != null) {
baseDir = new File(thumbnailPath); // depends on control dependency: [if], data = [(thumbnailPath]
} else {
final String varPath = System.getProperty(Constants.FESS_VAR_PATH);
if (varPath != null) {
baseDir = new File(varPath, THUMBNAILS_DIR_NAME); // depends on control dependency: [if], data = [(varPath]
} else {
baseDir = ResourceUtil.getThumbnailPath().toFile(); // depends on control dependency: [if], data = [none]
}
}
if (baseDir.mkdirs()) {
logger.info("Created: " + baseDir.getAbsolutePath()); // depends on control dependency: [if], data = [none]
}
if (!baseDir.isDirectory()) {
throw new FessSystemException("Not found: " + baseDir.getAbsolutePath());
}
if (logger.isDebugEnabled()) {
logger.debug("Thumbnail Directory: " + baseDir.getAbsolutePath());
}
thumbnailTaskQueue = new LinkedBlockingQueue<>(thumbnailTaskQueueSize);
generating = !Constants.TRUE.equalsIgnoreCase(System.getProperty("fess.thumbnail.process"));
thumbnailQueueThread = new Thread((Runnable) () -> {
final List<Tuple3<String, String, String>> taskList = new ArrayList<>();
while (generating) {
try {
final Tuple3<String, String, String> task = thumbnailTaskQueue.poll(thumbnailTaskQueueTimeout, TimeUnit.MILLISECONDS);
if (task == null) {
if (!taskList.isEmpty()) {
storeQueue(taskList);
}
} else if (!taskList.contains(task)) {
taskList.add(task);
if (taskList.size() > thumbnailTaskBulkSize) {
storeQueue(taskList);
}
}
} catch (final InterruptedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Interupted task.", e);
}
} catch (final Exception e) {
if (generating) {
logger.warn("Failed to generate thumbnail.", e);
}
}
}
if (!taskList.isEmpty()) {
storeQueue(taskList);
}
}, "ThumbnailGenerator");
thumbnailQueueThread.start();
} } |
public class class_name {
public static byte[] readBytes(String path)
{
try
{
if (IOAdapter == null) return readBytesFromFileInputStream(new FileInputStream(path));
InputStream is = IOAdapter.open(path);
if (is instanceof FileInputStream)
return readBytesFromFileInputStream((FileInputStream) is);
else
return readBytesFromOtherInputStream(is);
}
catch (Exception e)
{
logger.warning("读取" + path + "时发生异常" + e);
}
return null;
} } | public class class_name {
public static byte[] readBytes(String path)
{
try
{
if (IOAdapter == null) return readBytesFromFileInputStream(new FileInputStream(path));
InputStream is = IOAdapter.open(path);
if (is instanceof FileInputStream)
return readBytesFromFileInputStream((FileInputStream) is);
else
return readBytesFromOtherInputStream(is);
}
catch (Exception e)
{
logger.warning("读取" + path + "时发生异常" + e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private String listToString(List<String> stringList){
StringBuilder concat = new StringBuilder();
for(String str:stringList){
concat.append(str);
concat.append(System.getProperty("line.separator"));
}
return concat.toString();
} } | public class class_name {
private String listToString(List<String> stringList){
StringBuilder concat = new StringBuilder();
for(String str:stringList){
concat.append(str); // depends on control dependency: [for], data = [str]
concat.append(System.getProperty("line.separator"));
}
return concat.toString(); // depends on control dependency: [for], data = [none]
} } |
public class class_name {
@Override
public MoveSelector buildBaseMoveSelector(HeuristicConfigPolicy configPolicy,
SelectionCacheType minimumCacheType, boolean randomSelection) {
List<MoveSelector> moveSelectorList = new ArrayList<>(moveSelectorConfigList.size());
for (MoveSelectorConfig moveSelectorConfig : moveSelectorConfigList) {
moveSelectorList.add(
moveSelectorConfig.buildMoveSelector(configPolicy,
minimumCacheType, SelectionOrder.fromRandomSelectionBoolean(randomSelection)));
}
SelectionProbabilityWeightFactory selectorProbabilityWeightFactory;
if (selectorProbabilityWeightFactoryClass != null) {
if (!randomSelection) {
throw new IllegalArgumentException("The moveSelectorConfig (" + this
+ ") with selectorProbabilityWeightFactoryClass (" + selectorProbabilityWeightFactoryClass
+ ") has non-random randomSelection (" + randomSelection + ").");
}
selectorProbabilityWeightFactory = ConfigUtils.newInstance(this,
"selectorProbabilityWeightFactoryClass", selectorProbabilityWeightFactoryClass);
} else if (randomSelection) {
Map<MoveSelector, Double> fixedProbabilityWeightMap = new HashMap<>(
moveSelectorConfigList.size());
for (int i = 0; i < moveSelectorConfigList.size(); i++) {
MoveSelectorConfig moveSelectorConfig = moveSelectorConfigList.get(i);
MoveSelector moveSelector = moveSelectorList.get(i);
Double fixedProbabilityWeight = moveSelectorConfig.getFixedProbabilityWeight();
if (fixedProbabilityWeight == null) {
// Default to equal probability for each move type => unequal probability for each move instance
fixedProbabilityWeight = 1.0;
}
fixedProbabilityWeightMap.put(moveSelector, fixedProbabilityWeight);
}
selectorProbabilityWeightFactory = new FixedSelectorProbabilityWeightFactory(fixedProbabilityWeightMap);
} else {
selectorProbabilityWeightFactory = null;
}
return new UnionMoveSelector(moveSelectorList, randomSelection,
selectorProbabilityWeightFactory);
} } | public class class_name {
@Override
public MoveSelector buildBaseMoveSelector(HeuristicConfigPolicy configPolicy,
SelectionCacheType minimumCacheType, boolean randomSelection) {
List<MoveSelector> moveSelectorList = new ArrayList<>(moveSelectorConfigList.size());
for (MoveSelectorConfig moveSelectorConfig : moveSelectorConfigList) {
moveSelectorList.add(
moveSelectorConfig.buildMoveSelector(configPolicy,
minimumCacheType, SelectionOrder.fromRandomSelectionBoolean(randomSelection))); // depends on control dependency: [for], data = [none]
}
SelectionProbabilityWeightFactory selectorProbabilityWeightFactory;
if (selectorProbabilityWeightFactoryClass != null) {
if (!randomSelection) {
throw new IllegalArgumentException("The moveSelectorConfig (" + this
+ ") with selectorProbabilityWeightFactoryClass (" + selectorProbabilityWeightFactoryClass
+ ") has non-random randomSelection (" + randomSelection + ").");
}
selectorProbabilityWeightFactory = ConfigUtils.newInstance(this,
"selectorProbabilityWeightFactoryClass", selectorProbabilityWeightFactoryClass);
} else if (randomSelection) {
Map<MoveSelector, Double> fixedProbabilityWeightMap = new HashMap<>(
moveSelectorConfigList.size());
for (int i = 0; i < moveSelectorConfigList.size(); i++) {
MoveSelectorConfig moveSelectorConfig = moveSelectorConfigList.get(i);
MoveSelector moveSelector = moveSelectorList.get(i);
Double fixedProbabilityWeight = moveSelectorConfig.getFixedProbabilityWeight();
if (fixedProbabilityWeight == null) {
// Default to equal probability for each move type => unequal probability for each move instance
fixedProbabilityWeight = 1.0;
}
fixedProbabilityWeightMap.put(moveSelector, fixedProbabilityWeight);
}
selectorProbabilityWeightFactory = new FixedSelectorProbabilityWeightFactory(fixedProbabilityWeightMap);
} else {
selectorProbabilityWeightFactory = null;
}
return new UnionMoveSelector(moveSelectorList, randomSelection,
selectorProbabilityWeightFactory);
} } |
public class class_name {
@Override
protected void initializeImpl()
{
//create properties from configuration (all javax mail properties will be defined in the fax4j properties)
this.mailConnectionProperties=new Properties();
Map<String,String> configuration=this.factoryConfigurationHolder.getConfiguration();
Iterator<Entry<String,String>> iterator=configuration.entrySet().iterator();
Entry<String,String> entry=null;
String key=null;
String value=null;
while(iterator.hasNext())
{
//get next entry
entry=iterator.next();
//get next key
key=entry.getKey();
if((key!=null)&&(key.indexOf("org.fax4j.")==-1)) //filter out fax4j properties
{
//get next value
value=entry.getValue();
//put in properties
this.mailConnectionProperties.setProperty(key,value);
}
}
//get user/password values
this.userName=this.factoryConfigurationHolder.getConfigurationValue(FaxClientSpiConfigurationConstants.USER_NAME_PROPERTY_KEY);
this.password=this.factoryConfigurationHolder.getConfigurationValue(FaxClientSpiConfigurationConstants.PASSWORD_PROPERTY_KEY);
//get transport protocol
this.transportProtocol=this.factoryConfigurationHolder.getConfigurationValue("mail.transport.protocol");
if(this.transportProtocol==null)
{
this.transportProtocol="smtp";
}
//get transport host
this.transportHost=this.factoryConfigurationHolder.getConfigurationValue("mail.smtp.host");
//get transport port
String transportPortStr=this.factoryConfigurationHolder.getConfigurationValue("mail.smtp.port");
this.transportPort=-1;
if(transportPortStr!=null)
{
this.transportPort=Integer.parseInt(transportPortStr);
}
} } | public class class_name {
@Override
protected void initializeImpl()
{
//create properties from configuration (all javax mail properties will be defined in the fax4j properties)
this.mailConnectionProperties=new Properties();
Map<String,String> configuration=this.factoryConfigurationHolder.getConfiguration();
Iterator<Entry<String,String>> iterator=configuration.entrySet().iterator();
Entry<String,String> entry=null;
String key=null;
String value=null;
while(iterator.hasNext())
{
//get next entry
entry=iterator.next(); // depends on control dependency: [while], data = [none]
//get next key
key=entry.getKey(); // depends on control dependency: [while], data = [none]
if((key!=null)&&(key.indexOf("org.fax4j.")==-1)) //filter out fax4j properties
{
//get next value
value=entry.getValue(); // depends on control dependency: [if], data = [none]
//put in properties
this.mailConnectionProperties.setProperty(key,value); // depends on control dependency: [if], data = [none]
}
}
//get user/password values
this.userName=this.factoryConfigurationHolder.getConfigurationValue(FaxClientSpiConfigurationConstants.USER_NAME_PROPERTY_KEY);
this.password=this.factoryConfigurationHolder.getConfigurationValue(FaxClientSpiConfigurationConstants.PASSWORD_PROPERTY_KEY);
//get transport protocol
this.transportProtocol=this.factoryConfigurationHolder.getConfigurationValue("mail.transport.protocol");
if(this.transportProtocol==null)
{
this.transportProtocol="smtp"; // depends on control dependency: [if], data = [none]
}
//get transport host
this.transportHost=this.factoryConfigurationHolder.getConfigurationValue("mail.smtp.host");
//get transport port
String transportPortStr=this.factoryConfigurationHolder.getConfigurationValue("mail.smtp.port");
this.transportPort=-1;
if(transportPortStr!=null)
{
this.transportPort=Integer.parseInt(transportPortStr); // depends on control dependency: [if], data = [(transportPortStr]
}
} } |
public class class_name {
public Direction direction() {
if (!Op.isFinite(slope) || Op.isEq(slope, 0.0)) {
return Direction.Zero;
}
if (Op.isGt(slope, 0.0)) {
return Direction.Positive;
}
return Direction.Negative;
} } | public class class_name {
public Direction direction() {
if (!Op.isFinite(slope) || Op.isEq(slope, 0.0)) {
return Direction.Zero; // depends on control dependency: [if], data = [none]
}
if (Op.isGt(slope, 0.0)) {
return Direction.Positive; // depends on control dependency: [if], data = [none]
}
return Direction.Negative;
} } |
public class class_name {
public void marshall(GetDataRetrievalPolicyRequest getDataRetrievalPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (getDataRetrievalPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDataRetrievalPolicyRequest.getAccountId(), ACCOUNTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetDataRetrievalPolicyRequest getDataRetrievalPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (getDataRetrievalPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDataRetrievalPolicyRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean verifyRecordInRange(
final PartitionIdType partition,
final SequenceOffsetType recordOffset
)
{
// Verify that the record is at least as high as its currOffset.
final SequenceOffsetType currOffset = Preconditions.checkNotNull(
currOffsets.get(partition),
"Current offset is null for sequenceNumber[%s] and partition[%s]",
recordOffset,
partition
);
final OrderedSequenceNumber<SequenceOffsetType> recordSequenceNumber = createSequenceNumber(recordOffset);
final OrderedSequenceNumber<SequenceOffsetType> currentSequenceNumber = createSequenceNumber(currOffset);
final int comparisonToCurrent = recordSequenceNumber.compareTo(currentSequenceNumber);
if (comparisonToCurrent < 0) {
throw new ISE(
"Record sequenceNumber[%s] is smaller than current sequenceNumber[%s] for partition[%s]",
recordOffset,
currOffset,
partition
);
}
// Check if the record has already been read.
if (isRecordAlreadyRead(partition, recordOffset)) {
return false;
}
// Finally, check if this record comes before the endOffsets for this partition.
return isMoreToReadBeforeReadingRecord(recordSequenceNumber.get(), endOffsets.get(partition));
} } | public class class_name {
private boolean verifyRecordInRange(
final PartitionIdType partition,
final SequenceOffsetType recordOffset
)
{
// Verify that the record is at least as high as its currOffset.
final SequenceOffsetType currOffset = Preconditions.checkNotNull(
currOffsets.get(partition),
"Current offset is null for sequenceNumber[%s] and partition[%s]",
recordOffset,
partition
);
final OrderedSequenceNumber<SequenceOffsetType> recordSequenceNumber = createSequenceNumber(recordOffset);
final OrderedSequenceNumber<SequenceOffsetType> currentSequenceNumber = createSequenceNumber(currOffset);
final int comparisonToCurrent = recordSequenceNumber.compareTo(currentSequenceNumber);
if (comparisonToCurrent < 0) {
throw new ISE(
"Record sequenceNumber[%s] is smaller than current sequenceNumber[%s] for partition[%s]",
recordOffset,
currOffset,
partition
);
}
// Check if the record has already been read.
if (isRecordAlreadyRead(partition, recordOffset)) {
return false; // depends on control dependency: [if], data = [none]
}
// Finally, check if this record comes before the endOffsets for this partition.
return isMoreToReadBeforeReadingRecord(recordSequenceNumber.get(), endOffsets.get(partition));
} } |
public class class_name {
public IconRow getIcon(String featureTable, long featureId,
GeometryType geometryType, boolean tableIcon) {
IconRow iconRow = null;
// Feature Icon
Icons icons = getIcons(featureTable, featureId);
if (icons != null) {
iconRow = icons.getIcon(geometryType);
}
if (iconRow == null && tableIcon) {
// Table Icon
iconRow = getTableIcon(featureTable, geometryType);
}
return iconRow;
} } | public class class_name {
public IconRow getIcon(String featureTable, long featureId,
GeometryType geometryType, boolean tableIcon) {
IconRow iconRow = null;
// Feature Icon
Icons icons = getIcons(featureTable, featureId);
if (icons != null) {
iconRow = icons.getIcon(geometryType); // depends on control dependency: [if], data = [none]
}
if (iconRow == null && tableIcon) {
// Table Icon
iconRow = getTableIcon(featureTable, geometryType); // depends on control dependency: [if], data = [none]
}
return iconRow;
} } |
public class class_name {
private void handleHeaders(HttpRequestBase httpRequest) {
for (HttpHeader header : headers.values()) {
httpRequest.addHeader(header.getName(), header.serializeValues());
}
} } | public class class_name {
private void handleHeaders(HttpRequestBase httpRequest) {
for (HttpHeader header : headers.values()) {
httpRequest.addHeader(header.getName(), header.serializeValues()); // depends on control dependency: [for], data = [header]
}
} } |
public class class_name {
public Optional<DeployKey> getOptionalDeployKey(Object projectIdOrPath, Integer keyId) {
try {
return (Optional.ofNullable(getDeployKey(projectIdOrPath, keyId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} } | public class class_name {
public Optional<DeployKey> getOptionalDeployKey(Object projectIdOrPath, Integer keyId) {
try {
return (Optional.ofNullable(getDeployKey(projectIdOrPath, keyId))); // depends on control dependency: [try], data = [none]
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Object getLastModified(int iHandleType)
{
Object varBookmark = null;
boolean[] rgbEnabled = null;
int iOrigOrder = DBConstants.MAIN_KEY_AREA;
boolean bOrigDirection = DBConstants.ASCENDING;
Record record = this.getCurrentTable().getRecord();
try {
// Save current order and ascending/descending
iOrigOrder = record.getDefaultOrder();
bOrigDirection = record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder();
// Set reverse order, descending
record.setKeyArea(DBConstants.MAIN_KEY_AREA);
record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).setKeyOrder(DBConstants.DESCENDING);
// Read the highest key in the record
rgbEnabled = record.setEnableListeners(false);
this.close();
int iCount = 0;
Record newRecord = null; // Special case - Updated, must move updated key to field (Last in Recordset).
while ((newRecord = (Record)this.move(DBConstants.NEXT_RECORD)) != null)
{ // Go thru the last 10 record to see if this is it
if ((m_iLastModType > -1) && (m_iLastModType < record.getFieldCount() + DBConstants.MAIN_FIELD))
{
Object objCompareData = newRecord.getField(m_iLastModType).getData();
if ((m_objLastModHint == objCompareData) || (m_objLastModHint.equals(objCompareData)))
break; // This is the right one
}
else
break;
iCount++;
if (iCount >= 10)
{
Utility.getLogger().warning("Error (BaseTable/getLastModified): Get last not found");
newRecord = null;
break; // Error
}
}
if (newRecord == null)
newRecord = (Record)this.move(DBConstants.FIRST_RECORD); // Guessed wrong, just use the last record
varBookmark = this.getHandle(iHandleType);
} catch (DBException e) {
varBookmark = null;
} finally {
// Restore current order and ascending/descending
record.setKeyArea(iOrigOrder);
record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).setKeyOrder(bOrigDirection);
record.setEnableListeners(rgbEnabled);
}
return varBookmark;
} } | public class class_name {
public Object getLastModified(int iHandleType)
{
Object varBookmark = null;
boolean[] rgbEnabled = null;
int iOrigOrder = DBConstants.MAIN_KEY_AREA;
boolean bOrigDirection = DBConstants.ASCENDING;
Record record = this.getCurrentTable().getRecord();
try {
// Save current order and ascending/descending
iOrigOrder = record.getDefaultOrder(); // depends on control dependency: [try], data = [none]
bOrigDirection = record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder(); // depends on control dependency: [try], data = [none]
// Set reverse order, descending
record.setKeyArea(DBConstants.MAIN_KEY_AREA); // depends on control dependency: [try], data = [none]
record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).setKeyOrder(DBConstants.DESCENDING); // depends on control dependency: [try], data = [none]
// Read the highest key in the record
rgbEnabled = record.setEnableListeners(false); // depends on control dependency: [try], data = [none]
this.close(); // depends on control dependency: [try], data = [none]
int iCount = 0;
Record newRecord = null; // Special case - Updated, must move updated key to field (Last in Recordset).
while ((newRecord = (Record)this.move(DBConstants.NEXT_RECORD)) != null)
{ // Go thru the last 10 record to see if this is it
if ((m_iLastModType > -1) && (m_iLastModType < record.getFieldCount() + DBConstants.MAIN_FIELD))
{
Object objCompareData = newRecord.getField(m_iLastModType).getData();
if ((m_objLastModHint == objCompareData) || (m_objLastModHint.equals(objCompareData)))
break; // This is the right one
}
else
break;
iCount++; // depends on control dependency: [while], data = [none]
if (iCount >= 10)
{
Utility.getLogger().warning("Error (BaseTable/getLastModified): Get last not found"); // depends on control dependency: [if], data = [none]
newRecord = null; // depends on control dependency: [if], data = [none]
break; // Error
}
}
if (newRecord == null)
newRecord = (Record)this.move(DBConstants.FIRST_RECORD); // Guessed wrong, just use the last record
varBookmark = this.getHandle(iHandleType); // depends on control dependency: [try], data = [none]
} catch (DBException e) {
varBookmark = null;
} finally { // depends on control dependency: [catch], data = [none]
// Restore current order and ascending/descending
record.setKeyArea(iOrigOrder);
record.getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyField(DBConstants.MAIN_KEY_FIELD).setKeyOrder(bOrigDirection);
record.setEnableListeners(rgbEnabled);
}
return varBookmark;
} } |
public class class_name {
public void fireRelationReadEvent(Relation relation)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.relationRead(relation);
}
}
} } | public class class_name {
public void fireRelationReadEvent(Relation relation)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.relationRead(relation); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
private void fill() throws IOException
{
if (eof)
return;
// as long as we are not just starting up
if (count > 0)
{
// if the caller left the requisite amount spare in the buffer
if (count - pos == 2) {
// copy it back to the start of the buffer
System.arraycopy(buf, pos, buf, 0, count - pos);
count -= pos;
pos = 0;
} else {
// should never happen, but just in case
throw new IllegalStateException("fill() detected illegal buffer state");
}
}
// Try and fill the entire buffer, starting at count, line by line
// but never read so close to the end that we might split a boundary
// Thanks to Tony Chu, tony.chu@brio.com, for the -2 suggestion.
int read = 0;
int boundaryLength = boundary.length();
int maxRead = buf.length - boundaryLength - 2; // -2 is for /r/n
while (count < maxRead) {
// read a line
read = ((ServletInputStream)in).readLine(buf, count, buf.length - count);
// check for eof and boundary
if (read == -1) {
throw new IOException("unexpected end of part");
} else {
if (read >= boundaryLength) {
eof = true;
for (int i=0; i < boundaryLength; i++) {
if (boundary.charAt(i) != buf[count + i]) {
// Not the boundary!
eof = false;
break;
}
}
if (eof) {
break;
}
}
}
// success
count += read;
}
} } | public class class_name {
private void fill() throws IOException
{
if (eof)
return;
// as long as we are not just starting up
if (count > 0)
{
// if the caller left the requisite amount spare in the buffer
if (count - pos == 2) {
// copy it back to the start of the buffer
System.arraycopy(buf, pos, buf, 0, count - pos); // depends on control dependency: [if], data = [none]
count -= pos; // depends on control dependency: [if], data = [none]
pos = 0; // depends on control dependency: [if], data = [none]
} else {
// should never happen, but just in case
throw new IllegalStateException("fill() detected illegal buffer state");
}
}
// Try and fill the entire buffer, starting at count, line by line
// but never read so close to the end that we might split a boundary
// Thanks to Tony Chu, tony.chu@brio.com, for the -2 suggestion.
int read = 0;
int boundaryLength = boundary.length();
int maxRead = buf.length - boundaryLength - 2; // -2 is for /r/n
while (count < maxRead) {
// read a line
read = ((ServletInputStream)in).readLine(buf, count, buf.length - count);
// check for eof and boundary
if (read == -1) {
throw new IOException("unexpected end of part");
} else {
if (read >= boundaryLength) {
eof = true; // depends on control dependency: [if], data = [none]
for (int i=0; i < boundaryLength; i++) {
if (boundary.charAt(i) != buf[count + i]) {
// Not the boundary!
eof = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (eof) {
break;
}
}
}
// success
count += read;
}
} } |
public class class_name {
@Override
public Object getInstanceToSerialize(Object instance) {
if (this.conversionService.canConvert(instance.getClass(), this.beanType)) {
return this.conversionService.convert(instance, this.beanType);
} else {
return instance;
}
} } | public class class_name {
@Override
public Object getInstanceToSerialize(Object instance) {
if (this.conversionService.canConvert(instance.getClass(), this.beanType)) {
return this.conversionService.convert(instance, this.beanType); // depends on control dependency: [if], data = [none]
} else {
return instance; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void stop() {
if (session == null) {
return;
}
sync.lock();
try {
if (session == null) {
return;
}
onBeforeStop();
session s = session;
session = null; // stop alerts loop and session methods
// guarantee one more alert is post and detected
s.post_session_stats();
try {
// 250 is to ensure that the sleep is bigger
// than the wait in alerts loop
Thread.sleep(ALERTS_LOOP_WAIT_MILLIS + 250);
} catch (InterruptedException ignore) {
}
if (alertsLoop != null) {
try {
alertsLoop.join();
} catch (Throwable e) {
// ignore
}
}
resetState();
s.delete();
onAfterStop();
} finally {
sync.unlock();
}
} } | public class class_name {
public void stop() {
if (session == null) {
return; // depends on control dependency: [if], data = [none]
}
sync.lock();
try {
if (session == null) {
return; // depends on control dependency: [if], data = [none]
}
onBeforeStop(); // depends on control dependency: [try], data = [none]
session s = session;
session = null; // stop alerts loop and session methods // depends on control dependency: [try], data = [none]
// guarantee one more alert is post and detected
s.post_session_stats(); // depends on control dependency: [try], data = [none]
try {
// 250 is to ensure that the sleep is bigger
// than the wait in alerts loop
Thread.sleep(ALERTS_LOOP_WAIT_MILLIS + 250); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ignore) {
} // depends on control dependency: [catch], data = [none]
if (alertsLoop != null) {
try {
alertsLoop.join(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
resetState(); // depends on control dependency: [try], data = [none]
s.delete(); // depends on control dependency: [try], data = [none]
onAfterStop(); // depends on control dependency: [try], data = [none]
} finally {
sync.unlock();
}
} } |
public class class_name {
public static User createInstance(String user) {
if (user.equals("$authenticated")) {
return new UserAuthenticated();
} else if (user.equals("$anonymous")) {
return new UserAnonymous();
} else if (user.equals("*")) {
return new UserAsterik();
} else {
return new User(user);
}
} } | public class class_name {
public static User createInstance(String user) {
if (user.equals("$authenticated")) {
return new UserAuthenticated(); // depends on control dependency: [if], data = [none]
} else if (user.equals("$anonymous")) {
return new UserAnonymous(); // depends on control dependency: [if], data = [none]
} else if (user.equals("*")) {
return new UserAsterik(); // depends on control dependency: [if], data = [none]
} else {
return new User(user); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<TimephasedWork> getTimephasedOvertimeWork()
{
if (m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork() != null)
{
double perDayFactor = getRemainingOvertimeWork().getDuration() / (getRemainingWork().getDuration() - getRemainingOvertimeWork().getDuration());
double totalFactor = getRemainingOvertimeWork().getDuration() / getRemainingWork().getDuration();
perDayFactor = Double.isNaN(perDayFactor) ? 0 : perDayFactor;
totalFactor = Double.isNaN(totalFactor) ? 0 : totalFactor;
m_timephasedOvertimeWork = new DefaultTimephasedWorkContainer(m_timephasedWork, perDayFactor, totalFactor);
}
return m_timephasedOvertimeWork == null ? null : m_timephasedOvertimeWork.getData();
} } | public class class_name {
public List<TimephasedWork> getTimephasedOvertimeWork()
{
if (m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork() != null)
{
double perDayFactor = getRemainingOvertimeWork().getDuration() / (getRemainingWork().getDuration() - getRemainingOvertimeWork().getDuration());
double totalFactor = getRemainingOvertimeWork().getDuration() / getRemainingWork().getDuration();
perDayFactor = Double.isNaN(perDayFactor) ? 0 : perDayFactor; // depends on control dependency: [if], data = [none]
totalFactor = Double.isNaN(totalFactor) ? 0 : totalFactor; // depends on control dependency: [if], data = [none]
m_timephasedOvertimeWork = new DefaultTimephasedWorkContainer(m_timephasedWork, perDayFactor, totalFactor); // depends on control dependency: [if], data = [none]
}
return m_timephasedOvertimeWork == null ? null : m_timephasedOvertimeWork.getData();
} } |
public class class_name {
@Override
public final void setDefaultLocalAddresses(SocketAddress firstLocalAddress, SocketAddress... otherLocalAddresses) {
if (otherLocalAddresses == null) {
otherLocalAddresses = new SocketAddress[0];
}
Collection<SocketAddress> newLocalAddresses =
new ArrayList<>(otherLocalAddresses.length + 1);
newLocalAddresses.add(firstLocalAddress);
Collections.addAll(newLocalAddresses, otherLocalAddresses);
setDefaultLocalAddresses(newLocalAddresses);
} } | public class class_name {
@Override
public final void setDefaultLocalAddresses(SocketAddress firstLocalAddress, SocketAddress... otherLocalAddresses) {
if (otherLocalAddresses == null) {
otherLocalAddresses = new SocketAddress[0]; // depends on control dependency: [if], data = [none]
}
Collection<SocketAddress> newLocalAddresses =
new ArrayList<>(otherLocalAddresses.length + 1);
newLocalAddresses.add(firstLocalAddress);
Collections.addAll(newLocalAddresses, otherLocalAddresses);
setDefaultLocalAddresses(newLocalAddresses);
} } |
public class class_name {
private RecyclerView.OnScrollListener createScrollListener() {
return new RecyclerView.OnScrollListener() {
/**
* True, if the view is currently scrolling up, false otherwise.
*/
private boolean scrollingUp;
@Override
public void onScrollStateChanged(final RecyclerView recyclerView, final int newState) {
}
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
boolean isScrollingUp = dy < 0;
if (scrollingUp != isScrollingUp) {
scrollingUp = isScrollingUp;
if (scrollingUp) {
floatingActionButton.show();
} else {
floatingActionButton.hide();
}
}
}
};
} } | public class class_name {
private RecyclerView.OnScrollListener createScrollListener() {
return new RecyclerView.OnScrollListener() {
/**
* True, if the view is currently scrolling up, false otherwise.
*/
private boolean scrollingUp;
@Override
public void onScrollStateChanged(final RecyclerView recyclerView, final int newState) {
}
@Override
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
boolean isScrollingUp = dy < 0;
if (scrollingUp != isScrollingUp) {
scrollingUp = isScrollingUp; // depends on control dependency: [if], data = [none]
if (scrollingUp) {
floatingActionButton.show(); // depends on control dependency: [if], data = [none]
} else {
floatingActionButton.hide(); // depends on control dependency: [if], data = [none]
}
}
}
};
} } |
public class class_name {
@Override
public void setDestinationLookup(String _destinationLookup) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.entry(this, TRACE, "setDestinationLookup", _destinationLookup);
}
if (!isValueCanBeSet(_destinationLookup)) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, " destinationLookup property value is "
+ _destinationLookup + ", so ignoring");
}
return;
}
this._destinationLookup = _destinationLookup;
try {
this._destination = (Destination) new InitialContext().lookup(_destinationLookup);
} catch (NamingException e) {
//TODo - Do we need to just log the warning or throw the error to the user?
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Invalid Destination JNDI name "
+ _destinationLookup);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.exit(this, TRACE, "setDestinationLookup", _destinationLookup);
}
} } | public class class_name {
@Override
public void setDestinationLookup(String _destinationLookup) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.entry(this, TRACE, "setDestinationLookup", _destinationLookup); // depends on control dependency: [if], data = [none]
}
if (!isValueCanBeSet(_destinationLookup)) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, " destinationLookup property value is "
+ _destinationLookup + ", so ignoring"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
this._destinationLookup = _destinationLookup;
try {
this._destination = (Destination) new InitialContext().lookup(_destinationLookup); // depends on control dependency: [try], data = [none]
} catch (NamingException e) {
//TODo - Do we need to just log the warning or throw the error to the user?
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Invalid Destination JNDI name "
+ _destinationLookup); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.exit(this, TRACE, "setDestinationLookup", _destinationLookup); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Packet build(IoBuffer buffer) {
if (buffer.hasArray()) {
return new Packet(buffer.array());
}
byte[] buf = new byte[buffer.remaining()];
buffer.get(buf);
return new Packet(buf);
} } | public class class_name {
public static Packet build(IoBuffer buffer) {
if (buffer.hasArray()) {
return new Packet(buffer.array());
// depends on control dependency: [if], data = [none]
}
byte[] buf = new byte[buffer.remaining()];
buffer.get(buf);
return new Packet(buf);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.