code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private List<Word> segSentence(final String sentence){
if(sentence.length() == 1){
if(KEEP_WHITESPACE){
List<Word> result = new ArrayList<>(1);
result.add(new Word(KEEP_CASE ? sentence : sentence.toLowerCase()));
return result;
}else{
if(!Character.isWhitespace(sentence.charAt(0))){
List<Word> result = new ArrayList<>(1);
result.add(new Word(KEEP_CASE ? sentence : sentence.toLowerCase()));
return result;
}
}
}
if(sentence.length() > 1){
List<Word> list = segImpl(sentence);
if(list != null){
if(PERSON_NAME_RECOGNIZE){
list = PersonName.recognize(list);
}
return list;
}else{
LOGGER.error("文本 "+sentence+" 没有获得分词结果");
}
}
return Collections.emptyList();
} }
|
public class class_name {
private List<Word> segSentence(final String sentence){
if(sentence.length() == 1){
if(KEEP_WHITESPACE){
List<Word> result = new ArrayList<>(1);
result.add(new Word(KEEP_CASE ? sentence : sentence.toLowerCase())); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}else{
if(!Character.isWhitespace(sentence.charAt(0))){
List<Word> result = new ArrayList<>(1);
result.add(new Word(KEEP_CASE ? sentence : sentence.toLowerCase())); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
}
}
if(sentence.length() > 1){
List<Word> list = segImpl(sentence);
if(list != null){
if(PERSON_NAME_RECOGNIZE){
list = PersonName.recognize(list); // depends on control dependency: [if], data = [none]
}
return list; // depends on control dependency: [if], data = [none]
}else{
LOGGER.error("文本 "+sentence+" 没有获得分词结果"); // depends on control dependency: [if], data = [none]
}
}
return Collections.emptyList();
} }
|
public class class_name {
public static float optFloat(@Nullable Bundle bundle, @Nullable String key, float fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getFloat(key, fallback);
} }
|
public class class_name {
public static float optFloat(@Nullable Bundle bundle, @Nullable String key, float fallback) {
if (bundle == null) {
return fallback; // depends on control dependency: [if], data = [none]
}
return bundle.getFloat(key, fallback);
} }
|
public class class_name {
protected void addWord(List<Word> result, String text, int start, int len){
Word word = getWord(text, start, len);
if(word != null){
result.add(word);
}
} }
|
public class class_name {
protected void addWord(List<Word> result, String text, int start, int len){
Word word = getWord(text, start, len);
if(word != null){
result.add(word); // depends on control dependency: [if], data = [(word]
}
} }
|
public class class_name {
public Object get(Object propertyName) {
if (propertyName instanceof CharSequence) {
propertyName = propertyName.toString();
}
if (propertyName instanceof List) {
Map submap = new HashMap();
List propertyNames = (List)propertyName;
for (Object currentName : propertyNames) {
if (currentName != null) {
currentName = currentName.toString();
if (containsKey(currentName)) {
submap.put(currentName, get(currentName));
}
}
}
return submap;
}
if (NameUtils.isConfigurational(propertyName.toString())) {
return null;
}
Object val = null;
MetaProperty mp = metaClass.getMetaProperty(propertyName.toString());
if (mp != null) {
val = mp.getProperty(instance);
}
return val;
} }
|
public class class_name {
public Object get(Object propertyName) {
if (propertyName instanceof CharSequence) {
propertyName = propertyName.toString(); // depends on control dependency: [if], data = [none]
}
if (propertyName instanceof List) {
Map submap = new HashMap();
List propertyNames = (List)propertyName;
for (Object currentName : propertyNames) {
if (currentName != null) {
currentName = currentName.toString(); // depends on control dependency: [if], data = [none]
if (containsKey(currentName)) {
submap.put(currentName, get(currentName)); // depends on control dependency: [if], data = [none]
}
}
}
return submap; // depends on control dependency: [if], data = [none]
}
if (NameUtils.isConfigurational(propertyName.toString())) {
return null; // depends on control dependency: [if], data = [none]
}
Object val = null;
MetaProperty mp = metaClass.getMetaProperty(propertyName.toString());
if (mp != null) {
val = mp.getProperty(instance); // depends on control dependency: [if], data = [none]
}
return val;
} }
|
public class class_name {
private void removeOldFiles()
{
if (_retainDays>0)
{
Calendar retainDate = Calendar.getInstance();
retainDate.add(Calendar.DATE,-_retainDays);
int borderYear = retainDate.get(java.util.Calendar.YEAR);
int borderMonth = retainDate.get(java.util.Calendar.MONTH) + 1;
int borderDay = retainDate.get(java.util.Calendar.DAY_OF_MONTH);
File file= new File(_filename);
File dir = new File(file.getParent());
String fn=file.getName();
int s=fn.toLowerCase().indexOf(YYYY_MM_DD);
if (s<0)
return;
String prefix=fn.substring(0,s);
String suffix=fn.substring(s+YYYY_MM_DD.length());
String[] logList=dir.list();
for (int i=0;i<logList.length;i++)
{
fn = logList[i];
if(fn.startsWith(prefix)&&fn.indexOf(suffix,prefix.length())>=0)
{
try
{
StringTokenizer st = new StringTokenizer (fn.substring(prefix.length(), prefix.length()+YYYY_MM_DD.length()), "_.");
int nYear = Integer.parseInt(st.nextToken());
int nMonth = Integer.parseInt(st.nextToken());
int nDay = Integer.parseInt(st.nextToken());
if (nYear<borderYear ||
(nYear==borderYear && nMonth<borderMonth) ||
(nYear==borderYear &&
nMonth==borderMonth &&
nDay<=borderDay))
{
log.info("Log age "+fn);
new File(dir,fn).delete();
}
}
catch(Exception e)
{
if (log.isDebugEnabled())
e.printStackTrace();
}
}
}
}
} }
|
public class class_name {
private void removeOldFiles()
{
if (_retainDays>0)
{
Calendar retainDate = Calendar.getInstance();
retainDate.add(Calendar.DATE,-_retainDays); // depends on control dependency: [if], data = [none]
int borderYear = retainDate.get(java.util.Calendar.YEAR);
int borderMonth = retainDate.get(java.util.Calendar.MONTH) + 1;
int borderDay = retainDate.get(java.util.Calendar.DAY_OF_MONTH);
File file= new File(_filename);
File dir = new File(file.getParent());
String fn=file.getName();
int s=fn.toLowerCase().indexOf(YYYY_MM_DD);
if (s<0)
return;
String prefix=fn.substring(0,s);
String suffix=fn.substring(s+YYYY_MM_DD.length());
String[] logList=dir.list();
for (int i=0;i<logList.length;i++)
{
fn = logList[i]; // depends on control dependency: [for], data = [i]
if(fn.startsWith(prefix)&&fn.indexOf(suffix,prefix.length())>=0)
{
try
{
StringTokenizer st = new StringTokenizer (fn.substring(prefix.length(), prefix.length()+YYYY_MM_DD.length()), "_.");
int nYear = Integer.parseInt(st.nextToken());
int nMonth = Integer.parseInt(st.nextToken());
int nDay = Integer.parseInt(st.nextToken());
if (nYear<borderYear ||
(nYear==borderYear && nMonth<borderMonth) ||
(nYear==borderYear &&
nMonth==borderMonth &&
nDay<=borderDay))
{
log.info("Log age "+fn); // depends on control dependency: [if], data = [none]
new File(dir,fn).delete(); // depends on control dependency: [if], data = [none]
}
}
catch(Exception e)
{
if (log.isDebugEnabled())
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
}
} }
|
public class class_name {
public static final <T> T getSingleton(Class<T> clazz, Object... args) throws Exception {
T instance = null;
synchronized (LOCK) {
instance = (T) singletonMap.get(clazz);
if (instance == null) {
Constructor<?> constructor = null;
try {
constructor = getConstructor(clazz, args);
} catch (SecurityException e1) {
} catch (NoSuchMethodException e1) {
}
if (constructor != null) {
try {
instance = (T) constructor.newInstance(args);
} catch (IllegalArgumentException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
if (instance == null) {
Constructor<?>[] constructors = clazz.getConstructors();
for (int i = 0; i < constructors.length; i++) {
Constructor<?> constructorVar = constructors[i];
try {
instance = (T) constructorVar.newInstance(args);
} catch (IllegalArgumentException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
}
}
if (instance == null) {
throw new NoSuchMethodException("无法初始化对象: " + clazz + "; 请检查传入的参数是否吻合");
}
}
singletonMap.put(clazz, instance);
}
return instance;
} }
|
public class class_name {
public static final <T> T getSingleton(Class<T> clazz, Object... args) throws Exception {
T instance = null;
synchronized (LOCK) {
instance = (T) singletonMap.get(clazz);
if (instance == null) {
Constructor<?> constructor = null;
try {
constructor = getConstructor(clazz, args); // depends on control dependency: [try], data = [none]
} catch (SecurityException e1) {
} catch (NoSuchMethodException e1) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
if (constructor != null) {
try {
instance = (T) constructor.newInstance(args); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (instance == null) {
Constructor<?>[] constructors = clazz.getConstructors();
for (int i = 0; i < constructors.length; i++) {
Constructor<?> constructorVar = constructors[i];
try {
instance = (T) constructorVar.newInstance(args); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
}
if (instance == null) {
throw new NoSuchMethodException("无法初始化对象: " + clazz + "; 请检查传入的参数是否吻合");
}
}
singletonMap.put(clazz, instance);
}
return instance;
} }
|
public class class_name {
public final EObject entryRuleOrExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleOrExpression = null;
try {
// InternalSimpleAntlr.g:950:2: (iv_ruleOrExpression= ruleOrExpression EOF )
// InternalSimpleAntlr.g:951:2: iv_ruleOrExpression= ruleOrExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOrExpressionRule());
}
pushFollow(FOLLOW_1);
iv_ruleOrExpression=ruleOrExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleOrExpression;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject entryRuleOrExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleOrExpression = null;
try {
// InternalSimpleAntlr.g:950:2: (iv_ruleOrExpression= ruleOrExpression EOF )
// InternalSimpleAntlr.g:951:2: iv_ruleOrExpression= ruleOrExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getOrExpressionRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleOrExpression=ruleOrExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleOrExpression; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) {
// Try to get the state attribute - if it's not there, we have a problem
RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE);
if (stateAttr == null) {
logger.error("Something went wrong, state attribute not present.");
logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge.");
return null;
}
// We need to get the reply message so we know what to ask the user
RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE);
if (replyAttr == null) {
logger.error("No reply message received from the server.");
logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one.");
return null;
}
// We have the required attributes - convert to strings and then generate the additional login box/field
String replyMsg = replyAttr.toString();
String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes());
Field radiusResponseField = new RadiusChallengeResponseField(replyMsg);
Field radiusStateField = new RadiusStateField(radiusState);
// Return the CredentialsInfo object that has the state and the expected response.
return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField));
} }
|
public class class_name {
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) {
// Try to get the state attribute - if it's not there, we have a problem
RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE);
if (stateAttr == null) {
logger.error("Something went wrong, state attribute not present."); // depends on control dependency: [if], data = [none]
logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// We need to get the reply message so we know what to ask the user
RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE);
if (replyAttr == null) {
logger.error("No reply message received from the server."); // depends on control dependency: [if], data = [none]
logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// We have the required attributes - convert to strings and then generate the additional login box/field
String replyMsg = replyAttr.toString();
String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes());
Field radiusResponseField = new RadiusChallengeResponseField(replyMsg);
Field radiusStateField = new RadiusStateField(radiusState);
// Return the CredentialsInfo object that has the state and the expected response.
return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField));
} }
|
public class class_name {
public String quotedPrintable(Object content)
{
if (content != null) {
try {
return new QuotedPrintableCodec().encode(String.valueOf(content));
} catch (EncoderException ex) {
// Just return null
}
}
return null;
} }
|
public class class_name {
public String quotedPrintable(Object content)
{
if (content != null) {
try {
return new QuotedPrintableCodec().encode(String.valueOf(content)); // depends on control dependency: [try], data = [none]
} catch (EncoderException ex) {
// Just return null
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private FeatureInstaller findInstaller(final Class<?> type, final ExtensionsHolder holder) {
for (FeatureInstaller installer : holder.getInstallers()) {
if (installer.matches(type)) {
return installer;
}
}
return null;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private FeatureInstaller findInstaller(final Class<?> type, final ExtensionsHolder holder) {
for (FeatureInstaller installer : holder.getInstallers()) {
if (installer.matches(type)) {
return installer; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public Whitelist addAttributes(String tag, String... attributes) {
Validate.notEmpty(tag);
Validate.notNull(attributes);
Validate.isTrue(attributes.length > 0, "No attribute names supplied.");
TagName tagName = TagName.valueOf(tag);
tagNames.add(tagName);
Set<AttributeKey> attributeSet = new HashSet<>();
for (String key : attributes) {
Validate.notEmpty(key);
attributeSet.add(AttributeKey.valueOf(key));
}
if (this.attributes.containsKey(tagName)) {
Set<AttributeKey> currentSet = this.attributes.get(tagName);
currentSet.addAll(attributeSet);
} else {
this.attributes.put(tagName, attributeSet);
}
return this;
} }
|
public class class_name {
public Whitelist addAttributes(String tag, String... attributes) {
Validate.notEmpty(tag);
Validate.notNull(attributes);
Validate.isTrue(attributes.length > 0, "No attribute names supplied.");
TagName tagName = TagName.valueOf(tag);
tagNames.add(tagName);
Set<AttributeKey> attributeSet = new HashSet<>();
for (String key : attributes) {
Validate.notEmpty(key); // depends on control dependency: [for], data = [key]
attributeSet.add(AttributeKey.valueOf(key)); // depends on control dependency: [for], data = [key]
}
if (this.attributes.containsKey(tagName)) {
Set<AttributeKey> currentSet = this.attributes.get(tagName);
currentSet.addAll(attributeSet); // depends on control dependency: [if], data = [none]
} else {
this.attributes.put(tagName, attributeSet); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public UrlBuilder addParameter(String name, String value) {
if (value == null) {
value = "";
}
params.put(name, value);
return this;
} }
|
public class class_name {
public UrlBuilder addParameter(String name, String value) {
if (value == null) {
value = ""; // depends on control dependency: [if], data = [none]
}
params.put(name, value);
return this;
} }
|
public class class_name {
private void applyDataUpdate(final M data) {
this.data = data;
CompletableFutureLite<M> currentSyncFuture = null;
Future<M> currentSyncTask = null;
// Check if sync is in process.
synchronized (syncMonitor) {
if (syncFuture != null) {
currentSyncFuture = syncFuture;
currentSyncTask = syncTask;
syncFuture = null;
syncTask = null;
}
}
if (currentSyncFuture != null) {
currentSyncFuture.complete(data);
}
if (currentSyncTask != null && !currentSyncTask.isDone()) {
currentSyncTask.cancel(false);
}
setConnectionState(CONNECTED);
// Notify data update
try {
notifyPrioritizedObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger);
}
try {
dataObservable.notifyObservers(data);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger);
}
} }
|
public class class_name {
private void applyDataUpdate(final M data) {
this.data = data;
CompletableFutureLite<M> currentSyncFuture = null;
Future<M> currentSyncTask = null;
// Check if sync is in process.
synchronized (syncMonitor) {
if (syncFuture != null) {
currentSyncFuture = syncFuture; // depends on control dependency: [if], data = [none]
currentSyncTask = syncTask; // depends on control dependency: [if], data = [none]
syncFuture = null; // depends on control dependency: [if], data = [none]
syncTask = null; // depends on control dependency: [if], data = [none]
}
}
if (currentSyncFuture != null) {
currentSyncFuture.complete(data); // depends on control dependency: [if], data = [none]
}
if (currentSyncTask != null && !currentSyncTask.isDone()) {
currentSyncTask.cancel(false); // depends on control dependency: [if], data = [none]
}
setConnectionState(CONNECTED);
// Notify data update
try {
notifyPrioritizedObservers(data); // depends on control dependency: [try], data = [none]
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update!", ex), logger);
} // depends on control dependency: [catch], data = [none]
try {
dataObservable.notifyObservers(data); // depends on control dependency: [try], data = [none]
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify data update to all observer!", ex), logger);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static List<LocalDate> untilDays(LocalDate startDate, LocalDate endDate) {
long until = startDate.until(endDate, ChronoUnit.DAYS) + 1;
List<LocalDate> dates = new ArrayList<>();
for (long i = 0; i < until; i++) {
dates.add(startDate.plusDays(i));
}
return dates;
} }
|
public class class_name {
public static List<LocalDate> untilDays(LocalDate startDate, LocalDate endDate) {
long until = startDate.until(endDate, ChronoUnit.DAYS) + 1;
List<LocalDate> dates = new ArrayList<>();
for (long i = 0; i < until; i++) {
dates.add(startDate.plusDays(i)); // depends on control dependency: [for], data = [i]
}
return dates;
} }
|
public class class_name {
private static void processProperty(final ClassNode cNode, PropertyNode node) {
String name = node.getName();
FieldNode field = node.getField();
int propNodeModifiers = node.getModifiers();
String getterName = "get" + Verifier.capitalize(name);
String setterName = "set" + Verifier.capitalize(name);
// GROOVY-3726: clear volatile, transient modifiers so that they don't get applied to methods
if ((propNodeModifiers & Modifier.VOLATILE) != 0) {
propNodeModifiers = propNodeModifiers - Modifier.VOLATILE;
}
if ((propNodeModifiers & Modifier.TRANSIENT) != 0) {
propNodeModifiers = propNodeModifiers - Modifier.TRANSIENT;
}
Statement getterBlock = node.getGetterBlock();
if (getterBlock == null) {
MethodNode getter = cNode.getGetterMethod(getterName);
if (getter == null && ClassHelper.boolean_TYPE == node.getType()) {
String secondGetterName = "is" + Verifier.capitalize(name);
getter = cNode.getGetterMethod(secondGetterName);
}
if (!node.isPrivate() && methodNeedsReplacement(cNode, getter)) {
getterBlock = new ExpressionStatement(new FieldExpression(field));
}
}
Statement setterBlock = node.getSetterBlock();
if (setterBlock == null) {
// 2nd arg false below: though not usual, allow setter with non-void return type
MethodNode setter = cNode.getSetterMethod(setterName, false);
if (!node.isPrivate() &&
(propNodeModifiers & ACC_FINAL) == 0 &&
methodNeedsReplacement(cNode, setter)) {
setterBlock = new ExpressionStatement(
new BinaryExpression(
new FieldExpression(field),
Token.newSymbol(Types.EQUAL, 0, 0),
new VariableExpression("value")
)
);
}
}
if (getterBlock != null) {
MethodNode getter =
new MethodNode(getterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
getter.setSynthetic(true);
cNode.addMethod(getter);
if (ClassHelper.boolean_TYPE == node.getType() || ClassHelper.Boolean_TYPE == node.getType()) {
String secondGetterName = "is" + Verifier.capitalize(name);
MethodNode secondGetter =
new MethodNode(secondGetterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
secondGetter.setSynthetic(true);
cNode.addMethod(secondGetter);
}
}
if (setterBlock != null) {
Parameter[] setterParameterTypes = {new Parameter(node.getType(), "value")};
VariableExpression var = (VariableExpression) ((BinaryExpression) ((ExpressionStatement) setterBlock).getExpression()).getRightExpression();
var.setAccessedVariable(setterParameterTypes[0]);
MethodNode setter =
new MethodNode(setterName, propNodeModifiers, ClassHelper.VOID_TYPE, setterParameterTypes, ClassNode.EMPTY_ARRAY, setterBlock);
setter.setSynthetic(true);
cNode.addMethod(setter);
}
} }
|
public class class_name {
private static void processProperty(final ClassNode cNode, PropertyNode node) {
String name = node.getName();
FieldNode field = node.getField();
int propNodeModifiers = node.getModifiers();
String getterName = "get" + Verifier.capitalize(name);
String setterName = "set" + Verifier.capitalize(name);
// GROOVY-3726: clear volatile, transient modifiers so that they don't get applied to methods
if ((propNodeModifiers & Modifier.VOLATILE) != 0) {
propNodeModifiers = propNodeModifiers - Modifier.VOLATILE; // depends on control dependency: [if], data = [none]
}
if ((propNodeModifiers & Modifier.TRANSIENT) != 0) {
propNodeModifiers = propNodeModifiers - Modifier.TRANSIENT; // depends on control dependency: [if], data = [none]
}
Statement getterBlock = node.getGetterBlock();
if (getterBlock == null) {
MethodNode getter = cNode.getGetterMethod(getterName);
if (getter == null && ClassHelper.boolean_TYPE == node.getType()) {
String secondGetterName = "is" + Verifier.capitalize(name);
getter = cNode.getGetterMethod(secondGetterName); // depends on control dependency: [if], data = [none]
}
if (!node.isPrivate() && methodNeedsReplacement(cNode, getter)) {
getterBlock = new ExpressionStatement(new FieldExpression(field)); // depends on control dependency: [if], data = [none]
}
}
Statement setterBlock = node.getSetterBlock();
if (setterBlock == null) {
// 2nd arg false below: though not usual, allow setter with non-void return type
MethodNode setter = cNode.getSetterMethod(setterName, false);
if (!node.isPrivate() &&
(propNodeModifiers & ACC_FINAL) == 0 &&
methodNeedsReplacement(cNode, setter)) {
setterBlock = new ExpressionStatement(
new BinaryExpression(
new FieldExpression(field),
Token.newSymbol(Types.EQUAL, 0, 0),
new VariableExpression("value")
)
); // depends on control dependency: [if], data = [none]
}
}
if (getterBlock != null) {
MethodNode getter =
new MethodNode(getterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
getter.setSynthetic(true); // depends on control dependency: [if], data = [none]
cNode.addMethod(getter); // depends on control dependency: [if], data = [none]
if (ClassHelper.boolean_TYPE == node.getType() || ClassHelper.Boolean_TYPE == node.getType()) {
String secondGetterName = "is" + Verifier.capitalize(name);
MethodNode secondGetter =
new MethodNode(secondGetterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
secondGetter.setSynthetic(true); // depends on control dependency: [if], data = [none]
cNode.addMethod(secondGetter); // depends on control dependency: [if], data = [none]
}
}
if (setterBlock != null) {
Parameter[] setterParameterTypes = {new Parameter(node.getType(), "value")};
VariableExpression var = (VariableExpression) ((BinaryExpression) ((ExpressionStatement) setterBlock).getExpression()).getRightExpression();
var.setAccessedVariable(setterParameterTypes[0]); // depends on control dependency: [if], data = [none]
MethodNode setter =
new MethodNode(setterName, propNodeModifiers, ClassHelper.VOID_TYPE, setterParameterTypes, ClassNode.EMPTY_ARRAY, setterBlock);
setter.setSynthetic(true); // depends on control dependency: [if], data = [none]
cNode.addMethod(setter); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public HppRequest encode(String charset) throws UnsupportedEncodingException {
if (null != this.account) {
this.account = new String(Base64.encodeBase64(this.account.getBytes(charset)), charset);
}
if (null != this.amount) {
this.amount = new String(Base64.encodeBase64(this.amount.getBytes(charset)), charset);
}
if (null != this.autoSettleFlag) {
this.autoSettleFlag = new String(Base64.encodeBase64(this.autoSettleFlag.getBytes(charset)), charset);
}
if (null != this.billingCode) {
this.billingCode = new String(Base64.encodeBase64(this.billingCode.getBytes(charset)), charset);
}
if (null != this.billingCountry) {
this.billingCountry = new String(Base64.encodeBase64(this.billingCountry.getBytes(charset)), charset);
}
if (null != this.cardPaymentButtonText) {
this.cardPaymentButtonText = new String(Base64.encodeBase64(this.cardPaymentButtonText.getBytes(charset)), charset);
}
if (null != this.cardStorageEnable) {
this.cardStorageEnable = new String(Base64.encodeBase64(this.cardStorageEnable.getBytes(charset)), charset);
}
if (null != this.commentOne) {
this.commentOne = new String(Base64.encodeBase64(this.commentOne.getBytes(charset)), charset);
}
if (null != this.commentTwo) {
this.commentTwo = new String(Base64.encodeBase64(this.commentTwo.getBytes(charset)), charset);
}
if (null != this.currency) {
this.currency = new String(Base64.encodeBase64(this.currency.getBytes(charset)), charset);
}
if (null != this.customerNumber) {
this.customerNumber = new String(Base64.encodeBase64(this.customerNumber.getBytes(charset)), charset);
}
if (null != this.hash) {
this.hash = new String(Base64.encodeBase64(this.hash.getBytes(charset)), charset);
}
if (null != this.language) {
this.language = new String(Base64.encodeBase64(this.language.getBytes(charset)), charset);
}
if (null != this.merchantId) {
this.merchantId = new String(Base64.encodeBase64(this.merchantId.getBytes(charset)), charset);
}
if (null != this.offerSaveCard) {
this.offerSaveCard = new String(Base64.encodeBase64(this.offerSaveCard.getBytes(charset)), charset);
}
if (null != this.orderId) {
this.orderId = new String(Base64.encodeBase64(this.orderId.getBytes(charset)), charset);
}
if (null != this.payerExists) {
this.payerExists = new String(Base64.encodeBase64(this.payerExists.getBytes(charset)), charset);
}
if (null != this.payerReference) {
this.payerReference = new String(Base64.encodeBase64(this.payerReference.getBytes(charset)), charset);
}
if (null != this.paymentReference) {
this.paymentReference = new String(Base64.encodeBase64(this.paymentReference.getBytes(charset)), charset);
}
if (null != this.productId) {
this.productId = new String(Base64.encodeBase64(this.productId.getBytes(charset)), charset);
}
if (null != this.returnTss) {
this.returnTss = new String(Base64.encodeBase64(this.returnTss.getBytes(charset)), charset);
}
if (null != this.shippingCode) {
this.shippingCode = new String(Base64.encodeBase64(this.shippingCode.getBytes(charset)), charset);
}
if (null != this.shippingCountry) {
this.shippingCountry = new String(Base64.encodeBase64(this.shippingCountry.getBytes(charset)), charset);
}
if (null != this.timeStamp) {
this.timeStamp = new String(Base64.encodeBase64(this.timeStamp.getBytes(charset)), charset);
}
if (null != this.variableReference) {
this.variableReference = new String(Base64.encodeBase64(this.variableReference.getBytes(charset)));
}
if (null != this.supplementaryData) {
Map<String, String> supplementaryDataMap = new HashMap<String, String>();
for (String key : supplementaryData.keySet()) {
supplementaryDataMap.put(key, new String(Base64.encodeBase64(supplementaryData.get(key).getBytes(charset)), charset));
}
this.supplementaryData.putAll(supplementaryDataMap);
}
if (null != this.validateCardOnly) {
this.validateCardOnly = new String(Base64.encodeBase64(this.validateCardOnly.getBytes(charset)));
}
if (null != this.dccEnable) {
this.dccEnable = new String(Base64.encodeBase64(this.dccEnable.getBytes(charset)));
}
if (null != this.hppFraudFilterMode) {
this.hppFraudFilterMode = new String(Base64.encodeBase64(this.hppFraudFilterMode.getBytes(charset)));
}
if (null != this.hppVersion) {
this.hppVersion = new String(Base64.encodeBase64(this.hppVersion.getBytes(charset)));
}
if (null != this.hppSelectStoredCard) {
this.hppSelectStoredCard = new String(Base64.encodeBase64(this.hppSelectStoredCard.getBytes(charset)));
}
return this;
} }
|
public class class_name {
public HppRequest encode(String charset) throws UnsupportedEncodingException {
if (null != this.account) {
this.account = new String(Base64.encodeBase64(this.account.getBytes(charset)), charset);
}
if (null != this.amount) {
this.amount = new String(Base64.encodeBase64(this.amount.getBytes(charset)), charset);
}
if (null != this.autoSettleFlag) {
this.autoSettleFlag = new String(Base64.encodeBase64(this.autoSettleFlag.getBytes(charset)), charset);
}
if (null != this.billingCode) {
this.billingCode = new String(Base64.encodeBase64(this.billingCode.getBytes(charset)), charset);
}
if (null != this.billingCountry) {
this.billingCountry = new String(Base64.encodeBase64(this.billingCountry.getBytes(charset)), charset);
}
if (null != this.cardPaymentButtonText) {
this.cardPaymentButtonText = new String(Base64.encodeBase64(this.cardPaymentButtonText.getBytes(charset)), charset);
}
if (null != this.cardStorageEnable) {
this.cardStorageEnable = new String(Base64.encodeBase64(this.cardStorageEnable.getBytes(charset)), charset);
}
if (null != this.commentOne) {
this.commentOne = new String(Base64.encodeBase64(this.commentOne.getBytes(charset)), charset);
}
if (null != this.commentTwo) {
this.commentTwo = new String(Base64.encodeBase64(this.commentTwo.getBytes(charset)), charset);
}
if (null != this.currency) {
this.currency = new String(Base64.encodeBase64(this.currency.getBytes(charset)), charset);
}
if (null != this.customerNumber) {
this.customerNumber = new String(Base64.encodeBase64(this.customerNumber.getBytes(charset)), charset);
}
if (null != this.hash) {
this.hash = new String(Base64.encodeBase64(this.hash.getBytes(charset)), charset);
}
if (null != this.language) {
this.language = new String(Base64.encodeBase64(this.language.getBytes(charset)), charset);
}
if (null != this.merchantId) {
this.merchantId = new String(Base64.encodeBase64(this.merchantId.getBytes(charset)), charset);
}
if (null != this.offerSaveCard) {
this.offerSaveCard = new String(Base64.encodeBase64(this.offerSaveCard.getBytes(charset)), charset);
}
if (null != this.orderId) {
this.orderId = new String(Base64.encodeBase64(this.orderId.getBytes(charset)), charset);
}
if (null != this.payerExists) {
this.payerExists = new String(Base64.encodeBase64(this.payerExists.getBytes(charset)), charset);
}
if (null != this.payerReference) {
this.payerReference = new String(Base64.encodeBase64(this.payerReference.getBytes(charset)), charset);
}
if (null != this.paymentReference) {
this.paymentReference = new String(Base64.encodeBase64(this.paymentReference.getBytes(charset)), charset);
}
if (null != this.productId) {
this.productId = new String(Base64.encodeBase64(this.productId.getBytes(charset)), charset);
}
if (null != this.returnTss) {
this.returnTss = new String(Base64.encodeBase64(this.returnTss.getBytes(charset)), charset);
}
if (null != this.shippingCode) {
this.shippingCode = new String(Base64.encodeBase64(this.shippingCode.getBytes(charset)), charset);
}
if (null != this.shippingCountry) {
this.shippingCountry = new String(Base64.encodeBase64(this.shippingCountry.getBytes(charset)), charset);
}
if (null != this.timeStamp) {
this.timeStamp = new String(Base64.encodeBase64(this.timeStamp.getBytes(charset)), charset);
}
if (null != this.variableReference) {
this.variableReference = new String(Base64.encodeBase64(this.variableReference.getBytes(charset)));
}
if (null != this.supplementaryData) {
Map<String, String> supplementaryDataMap = new HashMap<String, String>();
for (String key : supplementaryData.keySet()) {
supplementaryDataMap.put(key, new String(Base64.encodeBase64(supplementaryData.get(key).getBytes(charset)), charset)); // depends on control dependency: [for], data = [key]
}
this.supplementaryData.putAll(supplementaryDataMap);
}
if (null != this.validateCardOnly) {
this.validateCardOnly = new String(Base64.encodeBase64(this.validateCardOnly.getBytes(charset)));
}
if (null != this.dccEnable) {
this.dccEnable = new String(Base64.encodeBase64(this.dccEnable.getBytes(charset)));
}
if (null != this.hppFraudFilterMode) {
this.hppFraudFilterMode = new String(Base64.encodeBase64(this.hppFraudFilterMode.getBytes(charset)));
}
if (null != this.hppVersion) {
this.hppVersion = new String(Base64.encodeBase64(this.hppVersion.getBytes(charset)));
}
if (null != this.hppSelectStoredCard) {
this.hppSelectStoredCard = new String(Base64.encodeBase64(this.hppSelectStoredCard.getBytes(charset)));
}
return this;
} }
|
public class class_name {
public void run() {
SupervisorManger supervisorManager;
try {
Map<Object, Object> conf = Utils.readStormConfig();
StormConfig.validate_distributed_mode(conf);
createPid(conf);
supervisorManager = mkSupervisor(conf, null);
JStormUtils.redirectOutput("/dev/null");
initShutdownHook(supervisorManager);
while (!supervisorManager.isFinishShutdown()) {
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
}
}
} catch (Throwable e) {
if (e instanceof OutOfMemoryError) {
LOG.error("Halting due to out of memory error...");
}
LOG.error("Fail to run supervisor ", e);
System.exit(1);
} finally {
LOG.info("Shutdown supervisor!!!");
}
} }
|
public class class_name {
public void run() {
SupervisorManger supervisorManager;
try {
Map<Object, Object> conf = Utils.readStormConfig();
StormConfig.validate_distributed_mode(conf); // depends on control dependency: [try], data = [none]
createPid(conf); // depends on control dependency: [try], data = [none]
supervisorManager = mkSupervisor(conf, null); // depends on control dependency: [try], data = [none]
JStormUtils.redirectOutput("/dev/null"); // depends on control dependency: [try], data = [none]
initShutdownHook(supervisorManager); // depends on control dependency: [try], data = [none]
while (!supervisorManager.isFinishShutdown()) {
try {
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ignored) {
} // depends on control dependency: [catch], data = [none]
}
} catch (Throwable e) {
if (e instanceof OutOfMemoryError) {
LOG.error("Halting due to out of memory error..."); // depends on control dependency: [if], data = [none]
}
LOG.error("Fail to run supervisor ", e);
System.exit(1);
} finally { // depends on control dependency: [catch], data = [none]
LOG.info("Shutdown supervisor!!!");
}
} }
|
public class class_name {
public void marshall(Address address, ProtocolMarshaller protocolMarshaller) {
if (address == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(address.getAddressId(), ADDRESSID_BINDING);
protocolMarshaller.marshall(address.getName(), NAME_BINDING);
protocolMarshaller.marshall(address.getCompany(), COMPANY_BINDING);
protocolMarshaller.marshall(address.getStreet1(), STREET1_BINDING);
protocolMarshaller.marshall(address.getStreet2(), STREET2_BINDING);
protocolMarshaller.marshall(address.getStreet3(), STREET3_BINDING);
protocolMarshaller.marshall(address.getCity(), CITY_BINDING);
protocolMarshaller.marshall(address.getStateOrProvince(), STATEORPROVINCE_BINDING);
protocolMarshaller.marshall(address.getPrefectureOrDistrict(), PREFECTUREORDISTRICT_BINDING);
protocolMarshaller.marshall(address.getLandmark(), LANDMARK_BINDING);
protocolMarshaller.marshall(address.getCountry(), COUNTRY_BINDING);
protocolMarshaller.marshall(address.getPostalCode(), POSTALCODE_BINDING);
protocolMarshaller.marshall(address.getPhoneNumber(), PHONENUMBER_BINDING);
protocolMarshaller.marshall(address.getIsRestricted(), ISRESTRICTED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Address address, ProtocolMarshaller protocolMarshaller) {
if (address == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(address.getAddressId(), ADDRESSID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getCompany(), COMPANY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getStreet1(), STREET1_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getStreet2(), STREET2_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getStreet3(), STREET3_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getCity(), CITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getStateOrProvince(), STATEORPROVINCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getPrefectureOrDistrict(), PREFECTUREORDISTRICT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getLandmark(), LANDMARK_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getCountry(), COUNTRY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getPostalCode(), POSTALCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getPhoneNumber(), PHONENUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(address.getIsRestricted(), ISRESTRICTED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected Object getValue() {
Object value = this.value;
if (value == null) {
this.value = value = fromBinary("value");
}
return value;
} }
|
public class class_name {
protected Object getValue() {
Object value = this.value;
if (value == null) {
this.value = value = fromBinary("value"); // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
public void group(
@NonNull final String groupId,
@Nullable final Traits groupTraits,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(groupId)) {
throw new IllegalArgumentException("groupId must not be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void run() {
final Traits finalGroupTraits;
if (groupTraits == null) {
finalGroupTraits = new Traits();
} else {
finalGroupTraits = groupTraits;
}
final Options finalOptions;
if (options == null) {
finalOptions = defaultOptions;
} else {
finalOptions = options;
}
GroupPayload.Builder builder =
new GroupPayload.Builder().groupId(groupId).traits(finalGroupTraits);
fillAndEnqueue(builder, finalOptions);
}
});
} }
|
public class class_name {
public void group(
@NonNull final String groupId,
@Nullable final Traits groupTraits,
@Nullable final Options options) {
assertNotShutdown();
if (isNullOrEmpty(groupId)) {
throw new IllegalArgumentException("groupId must not be null or empty.");
}
analyticsExecutor.submit(
new Runnable() {
@Override
public void run() {
final Traits finalGroupTraits;
if (groupTraits == null) {
finalGroupTraits = new Traits(); // depends on control dependency: [if], data = [none]
} else {
finalGroupTraits = groupTraits; // depends on control dependency: [if], data = [none]
}
final Options finalOptions;
if (options == null) {
finalOptions = defaultOptions; // depends on control dependency: [if], data = [none]
} else {
finalOptions = options; // depends on control dependency: [if], data = [none]
}
GroupPayload.Builder builder =
new GroupPayload.Builder().groupId(groupId).traits(finalGroupTraits);
fillAndEnqueue(builder, finalOptions);
}
});
} }
|
public class class_name {
@Override
public EClass getIfcLuminousIntensityMeasure() {
if (ifcLuminousIntensityMeasureEClass == null) {
ifcLuminousIntensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(831);
}
return ifcLuminousIntensityMeasureEClass;
} }
|
public class class_name {
@Override
public EClass getIfcLuminousIntensityMeasure() {
if (ifcLuminousIntensityMeasureEClass == null) {
ifcLuminousIntensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(831);
// depends on control dependency: [if], data = [none]
}
return ifcLuminousIntensityMeasureEClass;
} }
|
public class class_name {
public void marshall(Location location, ProtocolMarshaller protocolMarshaller) {
if (location == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(location.getLocationCode(), LOCATIONCODE_BINDING);
protocolMarshaller.marshall(location.getLocationName(), LOCATIONNAME_BINDING);
protocolMarshaller.marshall(location.getRegion(), REGION_BINDING);
protocolMarshaller.marshall(location.getAvailablePortSpeeds(), AVAILABLEPORTSPEEDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Location location, ProtocolMarshaller protocolMarshaller) {
if (location == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(location.getLocationCode(), LOCATIONCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(location.getLocationName(), LOCATIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(location.getRegion(), REGION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(location.getAvailablePortSpeeds(), AVAILABLEPORTSPEEDS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static double[] rowMax(double[][] data) {
double[] x = new double[data.length];
for (int i = 0; i < x.length; i++) {
x[i] = max(data[i]);
}
return x;
} }
|
public class class_name {
public static double[] rowMax(double[][] data) {
double[] x = new double[data.length];
for (int i = 0; i < x.length; i++) {
x[i] = max(data[i]); // depends on control dependency: [for], data = [i]
}
return x;
} }
|
public class class_name {
public void setRoleUsageList(java.util.Collection<RoleUsageType> roleUsageList) {
if (roleUsageList == null) {
this.roleUsageList = null;
return;
}
this.roleUsageList = new com.amazonaws.internal.SdkInternalList<RoleUsageType>(roleUsageList);
} }
|
public class class_name {
public void setRoleUsageList(java.util.Collection<RoleUsageType> roleUsageList) {
if (roleUsageList == null) {
this.roleUsageList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.roleUsageList = new com.amazonaws.internal.SdkInternalList<RoleUsageType>(roleUsageList);
} }
|
public class class_name {
@Override
public void writeRecord(Row row) throws IOException {
if (typesArray != null && typesArray.length > 0 && typesArray.length != row.getArity()) {
LOG.warn("Column SQL types array doesn't match arity of passed Row! Check the passed array...");
}
try {
if (typesArray == null) {
// no types provided
for (int index = 0; index < row.getArity(); index++) {
LOG.warn("Unknown column type for column {}. Best effort approach to set its value: {}.", index + 1, row.getField(index));
upload.setObject(index + 1, row.getField(index));
}
} else {
// types provided
for (int index = 0; index < row.getArity(); index++) {
if (row.getField(index) == null) {
upload.setNull(index + 1, typesArray[index]);
} else {
try {
// casting values as suggested by http://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html
switch (typesArray[index]) {
case java.sql.Types.NULL:
upload.setNull(index + 1, typesArray[index]);
break;
case java.sql.Types.BOOLEAN:
case java.sql.Types.BIT:
upload.setBoolean(index + 1, (boolean) row.getField(index));
break;
case java.sql.Types.CHAR:
case java.sql.Types.NCHAR:
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
case java.sql.Types.LONGNVARCHAR:
upload.setString(index + 1, (String) row.getField(index));
break;
case java.sql.Types.TINYINT:
upload.setByte(index + 1, (byte) row.getField(index));
break;
case java.sql.Types.SMALLINT:
upload.setShort(index + 1, (short) row.getField(index));
break;
case java.sql.Types.INTEGER:
upload.setInt(index + 1, (int) row.getField(index));
break;
case java.sql.Types.BIGINT:
upload.setLong(index + 1, (long) row.getField(index));
break;
case java.sql.Types.REAL:
upload.setFloat(index + 1, (float) row.getField(index));
break;
case java.sql.Types.FLOAT:
case java.sql.Types.DOUBLE:
upload.setDouble(index + 1, (double) row.getField(index));
break;
case java.sql.Types.DECIMAL:
case java.sql.Types.NUMERIC:
upload.setBigDecimal(index + 1, (java.math.BigDecimal) row.getField(index));
break;
case java.sql.Types.DATE:
upload.setDate(index + 1, (java.sql.Date) row.getField(index));
break;
case java.sql.Types.TIME:
upload.setTime(index + 1, (java.sql.Time) row.getField(index));
break;
case java.sql.Types.TIMESTAMP:
upload.setTimestamp(index + 1, (java.sql.Timestamp) row.getField(index));
break;
case java.sql.Types.BINARY:
case java.sql.Types.VARBINARY:
case java.sql.Types.LONGVARBINARY:
upload.setBytes(index + 1, (byte[]) row.getField(index));
break;
default:
upload.setObject(index + 1, row.getField(index));
LOG.warn("Unmanaged sql type ({}) for column {}. Best effort approach to set its value: {}.",
typesArray[index], index + 1, row.getField(index));
// case java.sql.Types.SQLXML
// case java.sql.Types.ARRAY:
// case java.sql.Types.JAVA_OBJECT:
// case java.sql.Types.BLOB:
// case java.sql.Types.CLOB:
// case java.sql.Types.NCLOB:
// case java.sql.Types.DATALINK:
// case java.sql.Types.DISTINCT:
// case java.sql.Types.OTHER:
// case java.sql.Types.REF:
// case java.sql.Types.ROWID:
// case java.sql.Types.STRUC
}
} catch (ClassCastException e) {
// enrich the exception with detailed information.
String errorMessage = String.format(
"%s, field index: %s, field value: %s.", e.getMessage(), index, row.getField(index));
ClassCastException enrichedException = new ClassCastException(errorMessage);
enrichedException.setStackTrace(e.getStackTrace());
throw enrichedException;
}
}
}
}
upload.addBatch();
batchCount++;
} catch (SQLException e) {
throw new RuntimeException("Preparation of JDBC statement failed.", e);
}
if (batchCount >= batchInterval) {
// execute batch
flush();
}
} }
|
public class class_name {
@Override
public void writeRecord(Row row) throws IOException {
if (typesArray != null && typesArray.length > 0 && typesArray.length != row.getArity()) {
LOG.warn("Column SQL types array doesn't match arity of passed Row! Check the passed array...");
}
try {
if (typesArray == null) {
// no types provided
for (int index = 0; index < row.getArity(); index++) {
LOG.warn("Unknown column type for column {}. Best effort approach to set its value: {}.", index + 1, row.getField(index)); // depends on control dependency: [for], data = [index]
upload.setObject(index + 1, row.getField(index)); // depends on control dependency: [for], data = [index]
}
} else {
// types provided
for (int index = 0; index < row.getArity(); index++) {
if (row.getField(index) == null) {
upload.setNull(index + 1, typesArray[index]); // depends on control dependency: [if], data = [none]
} else {
try {
// casting values as suggested by http://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html
switch (typesArray[index]) {
case java.sql.Types.NULL:
upload.setNull(index + 1, typesArray[index]);
break;
case java.sql.Types.BOOLEAN:
case java.sql.Types.BIT:
upload.setBoolean(index + 1, (boolean) row.getField(index));
break;
case java.sql.Types.CHAR:
case java.sql.Types.NCHAR:
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
case java.sql.Types.LONGNVARCHAR:
upload.setString(index + 1, (String) row.getField(index));
break;
case java.sql.Types.TINYINT:
upload.setByte(index + 1, (byte) row.getField(index));
break;
case java.sql.Types.SMALLINT:
upload.setShort(index + 1, (short) row.getField(index));
break;
case java.sql.Types.INTEGER:
upload.setInt(index + 1, (int) row.getField(index));
break;
case java.sql.Types.BIGINT:
upload.setLong(index + 1, (long) row.getField(index));
break;
case java.sql.Types.REAL:
upload.setFloat(index + 1, (float) row.getField(index));
break;
case java.sql.Types.FLOAT:
case java.sql.Types.DOUBLE:
upload.setDouble(index + 1, (double) row.getField(index));
break;
case java.sql.Types.DECIMAL:
case java.sql.Types.NUMERIC:
upload.setBigDecimal(index + 1, (java.math.BigDecimal) row.getField(index));
break;
case java.sql.Types.DATE:
upload.setDate(index + 1, (java.sql.Date) row.getField(index));
break;
case java.sql.Types.TIME:
upload.setTime(index + 1, (java.sql.Time) row.getField(index));
break;
case java.sql.Types.TIMESTAMP:
upload.setTimestamp(index + 1, (java.sql.Timestamp) row.getField(index));
break;
case java.sql.Types.BINARY:
case java.sql.Types.VARBINARY:
case java.sql.Types.LONGVARBINARY:
upload.setBytes(index + 1, (byte[]) row.getField(index));
break;
default:
upload.setObject(index + 1, row.getField(index));
LOG.warn("Unmanaged sql type ({}) for column {}. Best effort approach to set its value: {}.",
typesArray[index], index + 1, row.getField(index));
// case java.sql.Types.SQLXML
// case java.sql.Types.ARRAY:
// case java.sql.Types.JAVA_OBJECT:
// case java.sql.Types.BLOB:
// case java.sql.Types.CLOB:
// case java.sql.Types.NCLOB:
// case java.sql.Types.DATALINK:
// case java.sql.Types.DISTINCT:
// case java.sql.Types.OTHER:
// case java.sql.Types.REF:
// case java.sql.Types.ROWID:
// case java.sql.Types.STRUC
}
} catch (ClassCastException e) {
// enrich the exception with detailed information.
String errorMessage = String.format(
"%s, field index: %s, field value: %s.", e.getMessage(), index, row.getField(index));
ClassCastException enrichedException = new ClassCastException(errorMessage);
enrichedException.setStackTrace(e.getStackTrace());
throw enrichedException;
} // depends on control dependency: [catch], data = [none]
}
}
}
upload.addBatch();
batchCount++;
} catch (SQLException e) {
throw new RuntimeException("Preparation of JDBC statement failed.", e);
}
if (batchCount >= batchInterval) {
// execute batch
flush();
}
} }
|
public class class_name {
public void merge(ExtractionResult extractionResult) {
for (Result result : extractionResult.results) {
add(result.getObject(), result.getResultName());
}
} }
|
public class class_name {
public void merge(ExtractionResult extractionResult) {
for (Result result : extractionResult.results) {
add(result.getObject(), result.getResultName()); // depends on control dependency: [for], data = [result]
}
} }
|
public class class_name {
public static void multiplyComplex( ImageInterleaved complexA , ImageInterleaved complexB , ImageInterleaved complexC ) {
if( complexB instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.multiplyComplex((InterleavedF32) complexA, (InterleavedF32) complexB, (InterleavedF32) complexC);
} else if( complexB instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.multiplyComplex((InterleavedF64) complexA, (InterleavedF64) complexB, (InterleavedF64) complexC);
} else {
throw new IllegalArgumentException("Unknown image type");
}
} }
|
public class class_name {
public static void multiplyComplex( ImageInterleaved complexA , ImageInterleaved complexB , ImageInterleaved complexC ) {
if( complexB instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.multiplyComplex((InterleavedF32) complexA, (InterleavedF32) complexB, (InterleavedF32) complexC); // depends on control dependency: [if], data = [none]
} else if( complexB instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.multiplyComplex((InterleavedF64) complexA, (InterleavedF64) complexB, (InterleavedF64) complexC); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown image type");
}
} }
|
public class class_name {
protected String[] readClassActionPath(final Class actionClass) {
// read class annotation
MadvocAction madvocActionAnnotation = ((Class<?>)actionClass).getAnnotation(MadvocAction.class);
String classActionPath = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null;
if (StringUtil.isEmpty(classActionPath)) {
classActionPath = null;
}
String actionClassName = actionClass.getSimpleName();
actionClassName = StringUtil.uncapitalize(actionClassName);
actionClassName = MadvocUtil.stripLastCamelWord(actionClassName); // removes 'Action' from the class name
if (classActionPath == null) {
classActionPath = actionClassName;
}
return ArraysUtil.array(actionClassName, classActionPath);
} }
|
public class class_name {
protected String[] readClassActionPath(final Class actionClass) {
// read class annotation
MadvocAction madvocActionAnnotation = ((Class<?>)actionClass).getAnnotation(MadvocAction.class);
String classActionPath = madvocActionAnnotation != null ? madvocActionAnnotation.value().trim() : null;
if (StringUtil.isEmpty(classActionPath)) {
classActionPath = null; // depends on control dependency: [if], data = [none]
}
String actionClassName = actionClass.getSimpleName();
actionClassName = StringUtil.uncapitalize(actionClassName);
actionClassName = MadvocUtil.stripLastCamelWord(actionClassName); // removes 'Action' from the class name
if (classActionPath == null) {
classActionPath = actionClassName; // depends on control dependency: [if], data = [none]
}
return ArraysUtil.array(actionClassName, classActionPath);
} }
|
public class class_name {
public static ConditionFactor create(StreamTokenizer tokenizer) throws WebDAVException {
EntityTag entityTag = new EntityTag();
try {
int token = tokenizer.ttype;
if (token == '[')
token = tokenizer.nextToken();
else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "[")); //$NON-NLS-1$ //$NON-NLS-2$
if (token == '"') { //$NON-NLS-1$
entityTag.setETag(tokenizer.sval);
token = tokenizer.nextToken();
} else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingQuotedString", String.valueOf(token))); //$NON-NLS-1$
if (token == ']')
token = tokenizer.nextToken();
else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "]")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (IOException exc) {
// ignore or log?
}
return entityTag;
} }
|
public class class_name {
public static ConditionFactor create(StreamTokenizer tokenizer) throws WebDAVException {
EntityTag entityTag = new EntityTag();
try {
int token = tokenizer.ttype;
if (token == '[')
token = tokenizer.nextToken();
else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "[")); //$NON-NLS-1$ //$NON-NLS-2$
if (token == '"') { //$NON-NLS-1$
entityTag.setETag(tokenizer.sval); // depends on control dependency: [if], data = [(token]
token = tokenizer.nextToken(); // depends on control dependency: [if], data = [none]
} else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissingQuotedString", String.valueOf(token))); //$NON-NLS-1$
if (token == ']')
token = tokenizer.nextToken();
else
throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseMissing", String.valueOf(token), "]")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (IOException exc) {
// ignore or log?
}
return entityTag;
} }
|
public class class_name {
private static boolean isComposingCharOrSurrogate(char c) {
if (UCharacter.isHighSurrogate(c) || UCharacter.isLowSurrogate(c)) {
return true;
}
return isComposingChar(c);
} }
|
public class class_name {
private static boolean isComposingCharOrSurrogate(char c) {
if (UCharacter.isHighSurrogate(c) || UCharacter.isLowSurrogate(c)) {
return true; // depends on control dependency: [if], data = [none]
}
return isComposingChar(c);
} }
|
public class class_name {
public static String formatLsString(boolean hSize, boolean acl, boolean isFolder, String
permission,
String userName, String groupName, long size, long lastModifiedTime, int inAlluxioPercentage,
String persistenceState, String path, String dateFormatPattern) {
String inAlluxioState;
String sizeStr;
if (isFolder) {
inAlluxioState = IN_ALLUXIO_STATE_DIR;
sizeStr = String.valueOf(size);
} else {
inAlluxioState = String.format(IN_ALLUXIO_STATE_FILE_FORMAT, inAlluxioPercentage);
sizeStr = hSize ? FormatUtils.getSizeFromBytes(size) : String.valueOf(size);
}
if (acl) {
return String.format(LS_FORMAT, permission, userName, groupName,
sizeStr, persistenceState, CommonUtils.convertMsToDate(lastModifiedTime,
dateFormatPattern), inAlluxioState, path);
} else {
return String.format(LS_FORMAT_NO_ACL, sizeStr,
persistenceState, CommonUtils.convertMsToDate(lastModifiedTime, dateFormatPattern),
inAlluxioState, path);
}
} }
|
public class class_name {
public static String formatLsString(boolean hSize, boolean acl, boolean isFolder, String
permission,
String userName, String groupName, long size, long lastModifiedTime, int inAlluxioPercentage,
String persistenceState, String path, String dateFormatPattern) {
String inAlluxioState;
String sizeStr;
if (isFolder) {
inAlluxioState = IN_ALLUXIO_STATE_DIR; // depends on control dependency: [if], data = [none]
sizeStr = String.valueOf(size); // depends on control dependency: [if], data = [none]
} else {
inAlluxioState = String.format(IN_ALLUXIO_STATE_FILE_FORMAT, inAlluxioPercentage); // depends on control dependency: [if], data = [none]
sizeStr = hSize ? FormatUtils.getSizeFromBytes(size) : String.valueOf(size); // depends on control dependency: [if], data = [none]
}
if (acl) {
return String.format(LS_FORMAT, permission, userName, groupName,
sizeStr, persistenceState, CommonUtils.convertMsToDate(lastModifiedTime,
dateFormatPattern), inAlluxioState, path); // depends on control dependency: [if], data = [none]
} else {
return String.format(LS_FORMAT_NO_ACL, sizeStr,
persistenceState, CommonUtils.convertMsToDate(lastModifiedTime, dateFormatPattern),
inAlluxioState, path); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void addChild(ElementBase child, boolean doEvent) {
if (!child.canAcceptParent(this)) {
CWFException.raise(child.rejectReason);
}
if (!canAcceptChild(child)) {
CWFException.raise(rejectReason);
}
if (doEvent) {
beforeAddChild(child);
}
if (child.getParent() != null) {
child.getParent().removeChild(child, false);
}
children.add(child);
child.updateParent(this);
if (doEvent) {
afterAddChild(child);
}
} }
|
public class class_name {
protected void addChild(ElementBase child, boolean doEvent) {
if (!child.canAcceptParent(this)) {
CWFException.raise(child.rejectReason); // depends on control dependency: [if], data = [none]
}
if (!canAcceptChild(child)) {
CWFException.raise(rejectReason); // depends on control dependency: [if], data = [none]
}
if (doEvent) {
beforeAddChild(child); // depends on control dependency: [if], data = [none]
}
if (child.getParent() != null) {
child.getParent().removeChild(child, false); // depends on control dependency: [if], data = [none]
}
children.add(child);
child.updateParent(this);
if (doEvent) {
afterAddChild(child); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean gbyTablesEqual(MaterializedViewInfo mv) {
if (m_selectStmt.hasComplexGroupby() != mv.getGroupbyexpressionsjson().isEmpty()) {
if (m_selectStmt.hasComplexGroupby()) { // when both have complex GBY expressions, anonymize table/column of SEL stmt and compare the two expressions.
final Set<AbstractExpression>
selGby = m_selectStmt.groupByColumns().stream()
.map(ci -> transformExpressionRidofPVE(ci.m_expression).anonymize())
.collect(Collectors.toSet()),
viewGby = new HashSet<>(getGbyExpressions(mv));
return selGby.equals(viewGby) && // NOTE: as TVE's equal() method misses column index comparison,
// which is almost the whole point, and we need to do the checking here. This is quite hacky, but
// is the only way to do it here.
selGby.stream().map(MVQueryRewriter::extractTVEIndices).collect(Collectors.toSet()).equals(
viewGby.stream().map(MVQueryRewriter::extractTVEIndices).collect(Collectors.toSet()));
} else { // when neither has complex GBY expression, we already know that GBY table names match, since
return true; // we are only checking SELECT query from a single table.
}
} else { // unequal when one has complex gby and the other doesn't
return false;
}
} }
|
public class class_name {
private boolean gbyTablesEqual(MaterializedViewInfo mv) {
if (m_selectStmt.hasComplexGroupby() != mv.getGroupbyexpressionsjson().isEmpty()) {
if (m_selectStmt.hasComplexGroupby()) { // when both have complex GBY expressions, anonymize table/column of SEL stmt and compare the two expressions.
final Set<AbstractExpression>
selGby = m_selectStmt.groupByColumns().stream()
.map(ci -> transformExpressionRidofPVE(ci.m_expression).anonymize())
.collect(Collectors.toSet()),
viewGby = new HashSet<>(getGbyExpressions(mv));
return selGby.equals(viewGby) && // NOTE: as TVE's equal() method misses column index comparison,
// which is almost the whole point, and we need to do the checking here. This is quite hacky, but
// is the only way to do it here.
selGby.stream().map(MVQueryRewriter::extractTVEIndices).collect(Collectors.toSet()).equals(
viewGby.stream().map(MVQueryRewriter::extractTVEIndices).collect(Collectors.toSet())); // depends on control dependency: [if], data = [none]
} else { // when neither has complex GBY expression, we already know that GBY table names match, since
return true; // we are only checking SELECT query from a single table. // depends on control dependency: [if], data = [none]
}
} else { // unequal when one has complex gby and the other doesn't
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public final IoBuffer limit(int newLimit) {
autoExpand(newLimit, 0);
buf().limit(newLimit);
if (mark > newLimit) {
mark = -1;
}
return this;
} }
|
public class class_name {
@Override
public final IoBuffer limit(int newLimit) {
autoExpand(newLimit, 0);
buf().limit(newLimit);
if (mark > newLimit) {
mark = -1; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
protected void dispatch(Throwable object, boolean child) {
if (object instanceof CompilationFailedException) {
report((CompilationFailedException) object, child);
} else if (object instanceof GroovyExceptionInterface) {
report((GroovyExceptionInterface) object, child);
} else if (object instanceof GroovyRuntimeException) {
report((GroovyRuntimeException) object, child);
} else if (object instanceof Exception) {
report((Exception) object, child);
} else {
report(object, child);
}
} }
|
public class class_name {
protected void dispatch(Throwable object, boolean child) {
if (object instanceof CompilationFailedException) {
report((CompilationFailedException) object, child); // depends on control dependency: [if], data = [none]
} else if (object instanceof GroovyExceptionInterface) {
report((GroovyExceptionInterface) object, child); // depends on control dependency: [if], data = [none]
} else if (object instanceof GroovyRuntimeException) {
report((GroovyRuntimeException) object, child); // depends on control dependency: [if], data = [none]
} else if (object instanceof Exception) {
report((Exception) object, child); // depends on control dependency: [if], data = [none]
} else {
report(object, child); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean hasNextCase() {
// this method only returns true if dependent values are grouped
if (!dependent) {
return false;
}
for (Constraint c : constraints) {
if (c.hasNextCase()) {
return true;
}
}
return false;
} }
|
public class class_name {
@Override
public boolean hasNextCase() {
// this method only returns true if dependent values are grouped
if (!dependent) {
return false;
// depends on control dependency: [if], data = [none]
}
for (Constraint c : constraints) {
if (c.hasNextCase()) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public int getIconWidth(SynthContext context) {
if (context == null) {
return width;
}
JComponent c = context.getComponent();
if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (c.getBorder() instanceof UIResource) {
return c.getWidth() - 1;
} else {
return c.getWidth();
}
} else {
return scale(context, width);
}
} }
|
public class class_name {
@Override
public int getIconWidth(SynthContext context) {
if (context == null) {
return width; // depends on control dependency: [if], data = [none]
}
JComponent c = context.getComponent();
if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (c.getBorder() instanceof UIResource) {
return c.getWidth() - 1; // depends on control dependency: [if], data = [none]
} else {
return c.getWidth(); // depends on control dependency: [if], data = [none]
}
} else {
return scale(context, width); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void merge(Object dest, Object orig) {
String attr = "";
try {
Set attrs = org.apache.commons.beanutils.PropertyUtils.describe(orig).keySet();
attrs.remove("class");
for (Iterator it = attrs.iterator(); it.hasNext();) {
attr = (String) it.next();
if (!PropertyUtils.isWriteable(orig, attr)) {
continue;
}
Object value = PropertyUtils.getProperty(orig, attr);
if (null != value) {
if (value instanceof Component) {
Object savedValue = PropertyUtils.getProperty(dest, attr);
if (null == savedValue) {
PropertyUtils.setProperty(dest, attr, value);
} else {
merge(savedValue, value);
}
} else if (value instanceof Collection) {
continue;
} else if (value instanceof Entity) {
Serializable key = (Serializable) PropertyUtils.getProperty(value, "id");
if (null == key) {
continue;
} else if (new EmptyKeyPredicate().apply(key)) {
PropertyUtils.setProperty(dest, attr, null);
} else {
PropertyUtils.setProperty(dest, attr, value);
}
} else {
PropertyUtils.setProperty(dest, attr, value);
}
}
}
} catch (Exception e) {
logger.error("meger error", e);
if (logger.isDebugEnabled()) {
logger.debug("error occur in reflection of attr:" + attr + " of entity " + dest.getClass().getName());
}
return;
}
} }
|
public class class_name {
public static void merge(Object dest, Object orig) {
String attr = "";
try {
Set attrs = org.apache.commons.beanutils.PropertyUtils.describe(orig).keySet();
attrs.remove("class"); // depends on control dependency: [try], data = [none]
for (Iterator it = attrs.iterator(); it.hasNext();) {
attr = (String) it.next(); // depends on control dependency: [for], data = [it]
if (!PropertyUtils.isWriteable(orig, attr)) {
continue;
}
Object value = PropertyUtils.getProperty(orig, attr);
if (null != value) {
if (value instanceof Component) {
Object savedValue = PropertyUtils.getProperty(dest, attr);
if (null == savedValue) {
PropertyUtils.setProperty(dest, attr, value); // depends on control dependency: [if], data = [none]
} else {
merge(savedValue, value);
}
} else if (value instanceof Collection) {
continue;
} else if (value instanceof Entity) {
Serializable key = (Serializable) PropertyUtils.getProperty(value, "id");
if (null == key) {
continue;
} else if (new EmptyKeyPredicate().apply(key)) {
PropertyUtils.setProperty(dest, attr, null); // depends on control dependency: [if], data = [none]
} else {
PropertyUtils.setProperty(dest, attr, value); // depends on control dependency: [if], data = [none]
}
} else {
PropertyUtils.setProperty(dest, attr, value); // depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
logger.error("meger error", e);
if (logger.isDebugEnabled()) {
logger.debug("error occur in reflection of attr:" + attr + " of entity " + dest.getClass().getName()); // depends on control dependency: [if], data = [none]
}
return;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void paint (Graphics2D gfx)
{
gfx.setColor(Color.red);
Point prev = null;
int size = size();
for (int ii = 0; ii < size; ii++) {
PathNode n = getNode(ii);
if (prev != null) {
gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y);
}
prev = n.loc;
}
} }
|
public class class_name {
public void paint (Graphics2D gfx)
{
gfx.setColor(Color.red);
Point prev = null;
int size = size();
for (int ii = 0; ii < size; ii++) {
PathNode n = getNode(ii);
if (prev != null) {
gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y); // depends on control dependency: [if], data = [(prev]
}
prev = n.loc; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
protected void doIterationProcedure (final int n)
{
if (n == 1)
return; // already initialized
if (m_fMid < 0)
{
m_fXNeg = m_fXMid; // the root is in the xPos half
m_fNeg = m_fMid;
}
else
{
m_fXPos = m_fXMid; // the root is in the xNeg half
m_fPos = m_fMid;
}
} }
|
public class class_name {
@Override
protected void doIterationProcedure (final int n)
{
if (n == 1)
return; // already initialized
if (m_fMid < 0)
{
m_fXNeg = m_fXMid; // the root is in the xPos half // depends on control dependency: [if], data = [none]
m_fNeg = m_fMid; // depends on control dependency: [if], data = [none]
}
else
{
m_fXPos = m_fXMid; // the root is in the xNeg half // depends on control dependency: [if], data = [none]
m_fPos = m_fMid; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) {
int arity = 0;
TypeDescription componentType = typeDescription;
while (componentType.isArray()) {
componentType = componentType.getComponentType();
arity++;
}
return componentType.represents(TargetType.class)
? TypeDescription.ArrayProjection.of(targetType, arity)
: typeDescription;
} }
|
public class class_name {
public static TypeDescription resolve(TypeDescription typeDescription, TypeDescription targetType) {
int arity = 0;
TypeDescription componentType = typeDescription;
while (componentType.isArray()) {
componentType = componentType.getComponentType(); // depends on control dependency: [while], data = [none]
arity++; // depends on control dependency: [while], data = [none]
}
return componentType.represents(TargetType.class)
? TypeDescription.ArrayProjection.of(targetType, arity)
: typeDescription;
} }
|
public class class_name {
public void addRow(final String[] data) {
if (anyStringContainsNewLine(data)) {
final String[][] theMatrix = Util.createMatrix(data);
for (int i = 0; i < theMatrix.length; i++) {
addRow(theMatrix[i]);
}
} else {
final Row myRow = new Row(this, data);
rows.add(myRow);
}
} }
|
public class class_name {
public void addRow(final String[] data) {
if (anyStringContainsNewLine(data)) {
final String[][] theMatrix = Util.createMatrix(data);
for (int i = 0; i < theMatrix.length; i++) {
addRow(theMatrix[i]); // depends on control dependency: [for], data = [i]
}
} else {
final Row myRow = new Row(this, data);
rows.add(myRow); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String getMatchedFigureKeyword(String line) {
for (String keyword : Config.FIGURE_KEYWORDS) {
if (line.startsWith(keyword)) {
return keyword;
}
}
return null;
} }
|
public class class_name {
private String getMatchedFigureKeyword(String line) {
for (String keyword : Config.FIGURE_KEYWORDS) {
if (line.startsWith(keyword)) {
return keyword;
// depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public boolean supportsGetGeneratedKeys(DatabaseMetaData meta) {
try {
//
// invoking JDK 1.4 method by reflection
//
return ((Boolean) DatabaseMetaData.class.getMethod("supportsGetGeneratedKeys", null).invoke(meta, null)).booleanValue();
} catch(Throwable e) {
getLogger().info("Could not call supportsGetGeneratedKeys method. This may be recoverable");
return false;
}
} }
|
public class class_name {
public boolean supportsGetGeneratedKeys(DatabaseMetaData meta) {
try {
//
// invoking JDK 1.4 method by reflection
//
return ((Boolean) DatabaseMetaData.class.getMethod("supportsGetGeneratedKeys", null).invoke(meta, null)).booleanValue(); // depends on control dependency: [try], data = [none]
} catch(Throwable e) {
getLogger().info("Could not call supportsGetGeneratedKeys method. This may be recoverable");
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Map<String, Object> parseInsertIntoQuery(String query)
{
Map<String, Object> persistDetails = new HashMap<String, Object>();
String insertReg = "(?i)^insert\\s+into\\s+(\\S+)\\s+(?:as\\s+(\\S+)\\s+)?FROM\\s+\\((.*)\\)$";
Pattern r = Pattern.compile(insertReg);
Matcher m = r.matcher(query);
if (m.find())
{
try
{
parsePersistClause(m.group(1), persistDetails);
persistDetails.put("format", m.group(2));
persistDetails.put("fetchQuery", m.group(3));
}
catch (Exception e)
{
throw new KunderaException("Invalid Query");
}
}
else
{
throw new KunderaException("Invalid Query");
}
return persistDetails;
} }
|
public class class_name {
private Map<String, Object> parseInsertIntoQuery(String query)
{
Map<String, Object> persistDetails = new HashMap<String, Object>();
String insertReg = "(?i)^insert\\s+into\\s+(\\S+)\\s+(?:as\\s+(\\S+)\\s+)?FROM\\s+\\((.*)\\)$";
Pattern r = Pattern.compile(insertReg);
Matcher m = r.matcher(query);
if (m.find())
{
try
{
parsePersistClause(m.group(1), persistDetails); // depends on control dependency: [try], data = [none]
persistDetails.put("format", m.group(2)); // depends on control dependency: [try], data = [none]
persistDetails.put("fetchQuery", m.group(3)); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
throw new KunderaException("Invalid Query");
} // depends on control dependency: [catch], data = [none]
}
else
{
throw new KunderaException("Invalid Query");
}
return persistDetails;
} }
|
public class class_name {
public boolean readHistoryEnabledForIndex(String index) {
if(!this.enabled) {
return false;
}
if(searchguardIndex.equals(index)) {
return logInternalConfig;
}
try {
return !cache.get(index).isEmpty();
} catch (ExecutionException e) {
log.error(e);
return true;
}
} }
|
public class class_name {
public boolean readHistoryEnabledForIndex(String index) {
if(!this.enabled) {
return false; // depends on control dependency: [if], data = [none]
}
if(searchguardIndex.equals(index)) {
return logInternalConfig; // depends on control dependency: [if], data = [none]
}
try {
return !cache.get(index).isEmpty(); // depends on control dependency: [try], data = [none]
} catch (ExecutionException e) {
log.error(e);
return true;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void stripAsterisk(final StringBuilder javaDoc) {
int index = javaDoc.indexOf("*");
while (index != -1) {
javaDoc.replace(index, index + 1, "");
index = javaDoc.indexOf("*");
}
} }
|
public class class_name {
private void stripAsterisk(final StringBuilder javaDoc) {
int index = javaDoc.indexOf("*");
while (index != -1) {
javaDoc.replace(index, index + 1, ""); // depends on control dependency: [while], data = [(index]
index = javaDoc.indexOf("*"); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public void addMasterListeners()
{
super.addMasterListeners();
this.getField(ProgramControl.LAST_PACKAGE_UPDATE).setEnabled(false);
this.addListener(new FileListener()
{
public void doNewRecord(boolean bDisplayOption)
{
super.doNewRecord(bDisplayOption);
PropertiesStringField field = (PropertiesStringField)this.getOwner().getField(ProgramControl.BASE_DIRECTORY);
field.enableConversion = false;
if (!field.isModified())
if (field.getDefault().equals(field.getData()))
{
try {
String home = System.getProperty("user.home");
String current = System.getProperty("user.dir");
if (!home.equals(current))
if (current.startsWith(home))
{ // Set the base directory to the current directories' home
current = Utility.addToPath((String)field.getDefault(), current.substring(home.length()));
int lastPathSeparator = current.lastIndexOf(File.separator);
if (lastPathSeparator == -1)
lastPathSeparator = current.lastIndexOf('/');
if (lastPathSeparator != -1)
{
((InitOnceFieldHandler)field.getListener(InitOnceFieldHandler.class)).setFirstTime(true);
field.setString(current.substring(0, lastPathSeparator), DBConstants.DISPLAY, DBConstants.INIT_MOVE);
}
}
} catch (SecurityException e) {
// Ignore (default is fine)
}
}
field.enableConversion = true;
}
});
} }
|
public class class_name {
public void addMasterListeners()
{
super.addMasterListeners();
this.getField(ProgramControl.LAST_PACKAGE_UPDATE).setEnabled(false);
this.addListener(new FileListener()
{
public void doNewRecord(boolean bDisplayOption)
{
super.doNewRecord(bDisplayOption);
PropertiesStringField field = (PropertiesStringField)this.getOwner().getField(ProgramControl.BASE_DIRECTORY);
field.enableConversion = false;
if (!field.isModified())
if (field.getDefault().equals(field.getData()))
{
try {
String home = System.getProperty("user.home");
String current = System.getProperty("user.dir");
if (!home.equals(current))
if (current.startsWith(home))
{ // Set the base directory to the current directories' home
current = Utility.addToPath((String)field.getDefault(), current.substring(home.length())); // depends on control dependency: [if], data = [none]
int lastPathSeparator = current.lastIndexOf(File.separator);
if (lastPathSeparator == -1)
lastPathSeparator = current.lastIndexOf('/');
if (lastPathSeparator != -1)
{
((InitOnceFieldHandler)field.getListener(InitOnceFieldHandler.class)).setFirstTime(true); // depends on control dependency: [if], data = [none]
field.setString(current.substring(0, lastPathSeparator), DBConstants.DISPLAY, DBConstants.INIT_MOVE); // depends on control dependency: [if], data = [none]
}
}
} catch (SecurityException e) {
// Ignore (default is fine)
} // depends on control dependency: [catch], data = [none]
}
field.enableConversion = true;
}
});
} }
|
public class class_name {
public void marshall(Record record, ProtocolMarshaller protocolMarshaller) {
if (record == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(record.getKey(), KEY_BINDING);
protocolMarshaller.marshall(record.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(record.getSyncCount(), SYNCCOUNT_BINDING);
protocolMarshaller.marshall(record.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(record.getLastModifiedBy(), LASTMODIFIEDBY_BINDING);
protocolMarshaller.marshall(record.getDeviceLastModifiedDate(), DEVICELASTMODIFIEDDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Record record, ProtocolMarshaller protocolMarshaller) {
if (record == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(record.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(record.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(record.getSyncCount(), SYNCCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(record.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(record.getLastModifiedBy(), LASTMODIFIEDBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(record.getDeviceLastModifiedDate(), DEVICELASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static MimeType mimeType(String type) {
try {
return new MimeType(type);
} catch (MimeTypeParseException ex) {
throw new RuntimeException(ex);
}
} }
|
public class class_name {
public static MimeType mimeType(String type) {
try {
return new MimeType(type); // depends on control dependency: [try], data = [none]
} catch (MimeTypeParseException ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void close()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIProducerSession.tc, "close", this);
boolean closedNow = _close();
if (closedNow)
{
_conn.removeProducerSession(this);
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIProducerSession.tc, "close", this);
} }
|
public class class_name {
public void close()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
SibTr.entry(CoreSPIProducerSession.tc, "close", this);
boolean closedNow = _close();
if (closedNow)
{
_conn.removeProducerSession(this); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPIProducerSession.tc.isEntryEnabled())
SibTr.exit(CoreSPIProducerSession.tc, "close", this);
} }
|
public class class_name {
void registerSyncConsumer(MessageConsumer consumer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "registerSyncConsumer", consumer);
// ensure that movement between lists is atomic
synchronized (consumerListsLock) {
// remove the consumer from the async list
asyncConsumers.remove(consumer);
// add the consumer to the sync list if it's not
// already present
if (!syncConsumers.contains(consumer)) {
syncConsumers.add(consumer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "registerSyncConsumer");
} }
|
public class class_name {
void registerSyncConsumer(MessageConsumer consumer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "registerSyncConsumer", consumer);
// ensure that movement between lists is atomic
synchronized (consumerListsLock) {
// remove the consumer from the async list
asyncConsumers.remove(consumer);
// add the consumer to the sync list if it's not
// already present
if (!syncConsumers.contains(consumer)) {
syncConsumers.add(consumer); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "registerSyncConsumer");
} }
|
public class class_name {
public void add(ObjectType type, boolean explicit) {
int index = factory.getIndexOfType(type);
if (!exceptionSet.get(index)) {
++size;
}
exceptionSet.set(index);
if (explicit) {
explicitSet.set(index);
}
commonSupertype = null;
} }
|
public class class_name {
public void add(ObjectType type, boolean explicit) {
int index = factory.getIndexOfType(type);
if (!exceptionSet.get(index)) {
++size; // depends on control dependency: [if], data = [none]
}
exceptionSet.set(index);
if (explicit) {
explicitSet.set(index); // depends on control dependency: [if], data = [none]
}
commonSupertype = null;
} }
|
public class class_name {
public static Response getVotingResponse(ParaObject object, Map<String, Object> entity) {
boolean voteSuccess = false;
if (object != null && entity != null) {
String upvoterId = (String) entity.get("_voteup");
String downvoterId = (String) entity.get("_votedown");
if (!StringUtils.isBlank(upvoterId)) {
voteSuccess = object.voteUp(upvoterId);
} else if (!StringUtils.isBlank(downvoterId)) {
voteSuccess = object.voteDown(downvoterId);
}
if (voteSuccess) {
object.update();
}
}
return Response.ok(voteSuccess).build();
} }
|
public class class_name {
public static Response getVotingResponse(ParaObject object, Map<String, Object> entity) {
boolean voteSuccess = false;
if (object != null && entity != null) {
String upvoterId = (String) entity.get("_voteup");
String downvoterId = (String) entity.get("_votedown");
if (!StringUtils.isBlank(upvoterId)) {
voteSuccess = object.voteUp(upvoterId); // depends on control dependency: [if], data = [none]
} else if (!StringUtils.isBlank(downvoterId)) {
voteSuccess = object.voteDown(downvoterId); // depends on control dependency: [if], data = [none]
}
if (voteSuccess) {
object.update(); // depends on control dependency: [if], data = [none]
}
}
return Response.ok(voteSuccess).build();
} }
|
public class class_name {
public final void start() {
if (this.started) {
log.warn(String.format("Reporter %s has already been started.", this.name));
return;
}
try {
startImpl();
this.started = true;
} catch (Exception exception) {
log.warn(String.format("Reporter %s did not start correctly.", this.name), exception);
}
} }
|
public class class_name {
public final void start() {
if (this.started) {
log.warn(String.format("Reporter %s has already been started.", this.name)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
startImpl(); // depends on control dependency: [try], data = [none]
this.started = true; // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
log.warn(String.format("Reporter %s did not start correctly.", this.name), exception);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String formatDate(final WPartialDateField dateField) {
Integer day = dateField.getDay();
Integer month = dateField.getMonth();
Integer year = dateField.getYear();
if (day != null || month != null || year != null) {
StringBuffer buf = new StringBuffer(10);
append(buf, year, 4);
buf.append('-');
append(buf, month, 2);
buf.append('-');
append(buf, day, 2);
return buf.toString();
}
return null;
} }
|
public class class_name {
private String formatDate(final WPartialDateField dateField) {
Integer day = dateField.getDay();
Integer month = dateField.getMonth();
Integer year = dateField.getYear();
if (day != null || month != null || year != null) {
StringBuffer buf = new StringBuffer(10);
append(buf, year, 4); // depends on control dependency: [if], data = [none]
buf.append('-'); // depends on control dependency: [if], data = [none]
append(buf, month, 2); // depends on control dependency: [if], data = [none]
buf.append('-'); // depends on control dependency: [if], data = [none]
append(buf, day, 2); // depends on control dependency: [if], data = [none]
return buf.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
protected File zipSubfolder(File rootDir, String zipSubFolder, String zipFileName, String archiveFolder)
throws MojoExecutionException
{
int resultCode = 0;
try {
File scriptDirectory = new File(project.getBuild().getDirectory(), "scripts").getCanonicalFile();
scriptDirectory.deleteOnExit();
if (archiveFolder != null)
{
resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh",
scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName, archiveFolder);
}
else
{
resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh",
scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName);
}
}
catch (Exception ex) {
throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.", ex);
}
if (resultCode != 0) {
throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.");
}
getLog().info("Zip file '" + zipFileName + "' created.");
return new File(rootDir, zipFileName);
} }
|
public class class_name {
protected File zipSubfolder(File rootDir, String zipSubFolder, String zipFileName, String archiveFolder)
throws MojoExecutionException
{
int resultCode = 0;
try {
File scriptDirectory = new File(project.getBuild().getDirectory(), "scripts").getCanonicalFile();
scriptDirectory.deleteOnExit();
if (archiveFolder != null)
{
resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh",
scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName, archiveFolder); // depends on control dependency: [if], data = [none]
}
else
{
resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh",
scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName); // depends on control dependency: [if], data = [none]
}
}
catch (Exception ex) {
throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.", ex);
}
if (resultCode != 0) {
throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.");
}
getLog().info("Zip file '" + zipFileName + "' created.");
return new File(rootDir, zipFileName);
} }
|
public class class_name {
public ClientConfig getClientConfig() {
ClientConfig rescuConfig = new ClientConfig(); // create default rescu config
// set per exchange connection- and read-timeout (if they have been set in the
// ExchangeSpecification)
int customHttpConnTimeout = exchange.getExchangeSpecification().getHttpConnTimeout();
if (customHttpConnTimeout > 0) {
rescuConfig.setHttpConnTimeout(customHttpConnTimeout);
}
int customHttpReadTimeout = exchange.getExchangeSpecification().getHttpReadTimeout();
if (customHttpReadTimeout > 0) {
rescuConfig.setHttpReadTimeout(customHttpReadTimeout);
}
if (exchange.getExchangeSpecification().getProxyHost() != null) {
rescuConfig.setProxyHost(exchange.getExchangeSpecification().getProxyHost());
}
if (exchange.getExchangeSpecification().getProxyPort() != null) {
rescuConfig.setProxyPort(exchange.getExchangeSpecification().getProxyPort());
}
return rescuConfig;
} }
|
public class class_name {
public ClientConfig getClientConfig() {
ClientConfig rescuConfig = new ClientConfig(); // create default rescu config
// set per exchange connection- and read-timeout (if they have been set in the
// ExchangeSpecification)
int customHttpConnTimeout = exchange.getExchangeSpecification().getHttpConnTimeout();
if (customHttpConnTimeout > 0) {
rescuConfig.setHttpConnTimeout(customHttpConnTimeout); // depends on control dependency: [if], data = [(customHttpConnTimeout]
}
int customHttpReadTimeout = exchange.getExchangeSpecification().getHttpReadTimeout();
if (customHttpReadTimeout > 0) {
rescuConfig.setHttpReadTimeout(customHttpReadTimeout); // depends on control dependency: [if], data = [(customHttpReadTimeout]
}
if (exchange.getExchangeSpecification().getProxyHost() != null) {
rescuConfig.setProxyHost(exchange.getExchangeSpecification().getProxyHost()); // depends on control dependency: [if], data = [(exchange.getExchangeSpecification().getProxyHost()]
}
if (exchange.getExchangeSpecification().getProxyPort() != null) {
rescuConfig.setProxyPort(exchange.getExchangeSpecification().getProxyPort()); // depends on control dependency: [if], data = [(exchange.getExchangeSpecification().getProxyPort()]
}
return rescuConfig;
} }
|
public class class_name {
public static boolean isConstructor(JCTree tree) {
if (tree.hasTag(METHODDEF)) {
Name name = ((JCMethodDecl) tree).name;
return name == name.table.names.init;
} else {
return false;
}
} }
|
public class class_name {
public static boolean isConstructor(JCTree tree) {
if (tree.hasTag(METHODDEF)) {
Name name = ((JCMethodDecl) tree).name;
return name == name.table.names.init; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public NlsFormatterPlugin<?> getFormatter(String formatType, String formatStyle) {
NlsFormatterPlugin<?> result = null;
Map<String, NlsFormatterPlugin<?>> style2builderMap = this.builders.get(formatType);
if (style2builderMap != null) {
result = style2builderMap.get(formatStyle);
if ((result == null) && (formatStyle == null)) {
result = style2builderMap.get(NlsFormatterManager.STYLE_MEDIUM);
}
}
return result;
} }
|
public class class_name {
public NlsFormatterPlugin<?> getFormatter(String formatType, String formatStyle) {
NlsFormatterPlugin<?> result = null;
Map<String, NlsFormatterPlugin<?>> style2builderMap = this.builders.get(formatType);
if (style2builderMap != null) {
result = style2builderMap.get(formatStyle);
// depends on control dependency: [if], data = [none]
if ((result == null) && (formatStyle == null)) {
result = style2builderMap.get(NlsFormatterManager.STYLE_MEDIUM);
// depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public Endpoint withIpAddr(@Nullable String ipAddr) {
ensureSingle();
if (ipAddr == null) {
return withoutIpAddr();
}
if (NetUtil.isValidIpV4Address(ipAddr)) {
return withIpAddr(ipAddr, StandardProtocolFamily.INET);
}
if (NetUtil.isValidIpV6Address(ipAddr)) {
if (ipAddr.charAt(0) == '[') {
ipAddr = ipAddr.substring(1, ipAddr.length() - 1);
}
return withIpAddr(ipAddr, StandardProtocolFamily.INET6);
}
throw new IllegalArgumentException("ipAddr: " + ipAddr + " (expected: an IP address)");
} }
|
public class class_name {
public Endpoint withIpAddr(@Nullable String ipAddr) {
ensureSingle();
if (ipAddr == null) {
return withoutIpAddr(); // depends on control dependency: [if], data = [none]
}
if (NetUtil.isValidIpV4Address(ipAddr)) {
return withIpAddr(ipAddr, StandardProtocolFamily.INET); // depends on control dependency: [if], data = [none]
}
if (NetUtil.isValidIpV6Address(ipAddr)) {
if (ipAddr.charAt(0) == '[') {
ipAddr = ipAddr.substring(1, ipAddr.length() - 1); // depends on control dependency: [if], data = [none]
}
return withIpAddr(ipAddr, StandardProtocolFamily.INET6); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("ipAddr: " + ipAddr + " (expected: an IP address)");
} }
|
public class class_name {
private synchronized void recover() {
try {
// close all reopen dataRecorders
this.close();
Set<String> loggerNames = this.dataLoggerFactory.findLoggerNames();
// recover all logs
for (String loggerName : loggerNames) {
IDataLogger dataLogger = this.dataLoggerFactory.instanciateLogger(loggerName);
XADataLogger xaLogger = new XADataLogger(dataLogger);
PhynixxXADataRecorder phynixxXADataRecorder = PhynixxXADataRecorder.recoverDataRecorder(xaLogger, this);
this.addXADataRecorder(phynixxXADataRecorder);
}
} catch (Exception e) {
throw new DelegatedRuntimeException(e);
}
} }
|
public class class_name {
private synchronized void recover() {
try {
// close all reopen dataRecorders
this.close(); // depends on control dependency: [try], data = [none]
Set<String> loggerNames = this.dataLoggerFactory.findLoggerNames();
// recover all logs
for (String loggerName : loggerNames) {
IDataLogger dataLogger = this.dataLoggerFactory.instanciateLogger(loggerName);
XADataLogger xaLogger = new XADataLogger(dataLogger);
PhynixxXADataRecorder phynixxXADataRecorder = PhynixxXADataRecorder.recoverDataRecorder(xaLogger, this);
this.addXADataRecorder(phynixxXADataRecorder); // depends on control dependency: [for], data = [none]
}
} catch (Exception e) {
throw new DelegatedRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int[] getSentenceIds() {
ArrayList<IntNaryTree> leaves = getLeaves();
int[] sent = new int[leaves.size()];
for (int i=0; i<sent.length; i++) {
sent[i] = leaves.get(i).symbol;
}
return sent;
} }
|
public class class_name {
public int[] getSentenceIds() {
ArrayList<IntNaryTree> leaves = getLeaves();
int[] sent = new int[leaves.size()];
for (int i=0; i<sent.length; i++) {
sent[i] = leaves.get(i).symbol; // depends on control dependency: [for], data = [i]
}
return sent;
} }
|
public class class_name {
public static DigestUtils getDigestUtils() {
if (digestUtils == null) {
try {
Class clazz = Class.forName(DIGEST_UTILS);
digestUtils = (DigestUtils) clazz.newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOGGER.warn("Cannot instanciate util: {}", e.getMessage());
throw new IllegalStateException(e);
}
}
return digestUtils;
} }
|
public class class_name {
public static DigestUtils getDigestUtils() {
if (digestUtils == null) {
try {
Class clazz = Class.forName(DIGEST_UTILS);
digestUtils = (DigestUtils) clazz.newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOGGER.warn("Cannot instanciate util: {}", e.getMessage());
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
}
return digestUtils;
} }
|
public class class_name {
public void signalEvent(String compensationType, Object activityRefStr) {
if( activityRefStr == null || ! (activityRefStr instanceof String) ) {
throw new WorkflowRuntimeException(null, getProcessInstance(),
"Compensation can only be triggered with String events, not an event of type "
+ activityRefStr == null ? "null" : activityRefStr.getClass().getSimpleName());
}
// 1. parse the activity ref (is it general or specific compensation?)
String activityRef = (String) activityRefStr;
String toCompensateNodeId = activityRef;
boolean generalCompensation = false;
if( activityRef.startsWith(IMPLICIT_COMPENSATION_PREFIX) ) {
toCompensateNodeId = activityRef.substring(IMPLICIT_COMPENSATION_PREFIX.length());
generalCompensation = true;
}
org.jbpm.process.core.Process process = (org.jbpm.process.core.Process) instance.getProcess();
// 2. for specific compensation: find the node that will be compensated
// for general compensation: find the compensation scope container that contains all the visible compensation handlers
Node toCompensateNode = null;
ContextContainer compensationScopeContainer = null;
if( generalCompensation ) {
if( toCompensateNodeId.equals(instance.getProcessId()) ) {
compensationScopeContainer = process;
} else {
compensationScopeContainer = (ContextContainer) findNode(toCompensateNodeId);
}
} else {
toCompensateNode = findNode(toCompensateNodeId);
}
// 3. If the node exists,
// a. find the node container for which the compensation handler is visible
// b. create the compensation scope instance
// c. handle the exception (which also cleans up the generated node instances)
if( toCompensateNode != null || compensationScopeContainer != null ) {
CompensationScope compensationScope = null;
if( compensationScopeContainer != null ) {
compensationScope = (CompensationScope) compensationScopeContainer.getDefaultContext(COMPENSATION_SCOPE);
} else {
compensationScope
= (CompensationScope) ((NodeImpl) toCompensateNode).resolveContext(COMPENSATION_SCOPE, toCompensateNodeId);
}
assert compensationScope != null : "Compensation scope for node [" + toCompensateNodeId + "] could not be found!";
CompensationScopeInstance scopeInstance;
if( compensationScope.getContextContainerId().equals(process.getId()) ) {
// process level compensation
scopeInstance = (CompensationScopeInstance) instance.getContextInstance(compensationScope);
} else {
// nested compensation
Stack<NodeInstance> generatedInstances;
if( toCompensateNode == null ) {
// logic is the same if it's specific or general
generatedInstances = createNodeInstanceContainers((Node) compensationScopeContainer, true);
} else {
generatedInstances = createNodeInstanceContainers(toCompensateNode, false);
}
NodeInstance nodeInstanceContainer = generatedInstances.peek();
scopeInstance
= ((CompensationScopeInstance)
((ContextInstanceContainer) nodeInstanceContainer).getContextInstance(compensationScope));
scopeInstance.addCompensationInstances(generatedInstances);
}
scopeInstance.handleException(activityRef, null);
}
} }
|
public class class_name {
public void signalEvent(String compensationType, Object activityRefStr) {
if( activityRefStr == null || ! (activityRefStr instanceof String) ) {
throw new WorkflowRuntimeException(null, getProcessInstance(),
"Compensation can only be triggered with String events, not an event of type "
+ activityRefStr == null ? "null" : activityRefStr.getClass().getSimpleName());
}
// 1. parse the activity ref (is it general or specific compensation?)
String activityRef = (String) activityRefStr;
String toCompensateNodeId = activityRef;
boolean generalCompensation = false;
if( activityRef.startsWith(IMPLICIT_COMPENSATION_PREFIX) ) {
toCompensateNodeId = activityRef.substring(IMPLICIT_COMPENSATION_PREFIX.length()); // depends on control dependency: [if], data = [none]
generalCompensation = true; // depends on control dependency: [if], data = [none]
}
org.jbpm.process.core.Process process = (org.jbpm.process.core.Process) instance.getProcess();
// 2. for specific compensation: find the node that will be compensated
// for general compensation: find the compensation scope container that contains all the visible compensation handlers
Node toCompensateNode = null;
ContextContainer compensationScopeContainer = null;
if( generalCompensation ) {
if( toCompensateNodeId.equals(instance.getProcessId()) ) {
compensationScopeContainer = process; // depends on control dependency: [if], data = [none]
} else {
compensationScopeContainer = (ContextContainer) findNode(toCompensateNodeId); // depends on control dependency: [if], data = [none]
}
} else {
toCompensateNode = findNode(toCompensateNodeId); // depends on control dependency: [if], data = [none]
}
// 3. If the node exists,
// a. find the node container for which the compensation handler is visible
// b. create the compensation scope instance
// c. handle the exception (which also cleans up the generated node instances)
if( toCompensateNode != null || compensationScopeContainer != null ) {
CompensationScope compensationScope = null;
if( compensationScopeContainer != null ) {
compensationScope = (CompensationScope) compensationScopeContainer.getDefaultContext(COMPENSATION_SCOPE); // depends on control dependency: [if], data = [none]
} else {
compensationScope
= (CompensationScope) ((NodeImpl) toCompensateNode).resolveContext(COMPENSATION_SCOPE, toCompensateNodeId); // depends on control dependency: [if], data = [none]
}
assert compensationScope != null : "Compensation scope for node [" + toCompensateNodeId + "] could not be found!";
CompensationScopeInstance scopeInstance;
if( compensationScope.getContextContainerId().equals(process.getId()) ) {
// process level compensation
scopeInstance = (CompensationScopeInstance) instance.getContextInstance(compensationScope); // depends on control dependency: [if], data = [none]
} else {
// nested compensation
Stack<NodeInstance> generatedInstances;
if( toCompensateNode == null ) {
// logic is the same if it's specific or general
generatedInstances = createNodeInstanceContainers((Node) compensationScopeContainer, true); // depends on control dependency: [if], data = [none]
} else {
generatedInstances = createNodeInstanceContainers(toCompensateNode, false); // depends on control dependency: [if], data = [none]
}
NodeInstance nodeInstanceContainer = generatedInstances.peek();
scopeInstance
= ((CompensationScopeInstance)
((ContextInstanceContainer) nodeInstanceContainer).getContextInstance(compensationScope)); // depends on control dependency: [if], data = [none]
scopeInstance.addCompensationInstances(generatedInstances); // depends on control dependency: [if], data = [none]
}
scopeInstance.handleException(activityRef, null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setItems(java.util.Collection<Authorizer> items) {
if (items == null) {
this.items = null;
return;
}
this.items = new java.util.ArrayList<Authorizer>(items);
} }
|
public class class_name {
public void setItems(java.util.Collection<Authorizer> items) {
if (items == null) {
this.items = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.items = new java.util.ArrayList<Authorizer>(items);
} }
|
public class class_name {
public Filters withExtendedKeyUsage(ExtendedKeyUsageName... extendedKeyUsage) {
java.util.ArrayList<String> extendedKeyUsageCopy = new java.util.ArrayList<String>(extendedKeyUsage.length);
for (ExtendedKeyUsageName value : extendedKeyUsage) {
extendedKeyUsageCopy.add(value.toString());
}
if (getExtendedKeyUsage() == null) {
setExtendedKeyUsage(extendedKeyUsageCopy);
} else {
getExtendedKeyUsage().addAll(extendedKeyUsageCopy);
}
return this;
} }
|
public class class_name {
public Filters withExtendedKeyUsage(ExtendedKeyUsageName... extendedKeyUsage) {
java.util.ArrayList<String> extendedKeyUsageCopy = new java.util.ArrayList<String>(extendedKeyUsage.length);
for (ExtendedKeyUsageName value : extendedKeyUsage) {
extendedKeyUsageCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getExtendedKeyUsage() == null) {
setExtendedKeyUsage(extendedKeyUsageCopy); // depends on control dependency: [if], data = [none]
} else {
getExtendedKeyUsage().addAll(extendedKeyUsageCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
@ReadOperation
public Map<?, ?> getReport(@Nullable final String flowId) {
val jsonMap = new LinkedHashMap<String, Object>();
val map = this.applicationContext.getBeansOfType(FlowDefinitionRegistry.class, false, true);
map.forEach((k, v) -> Arrays.stream(v.getFlowDefinitionIds())
.filter(currentId -> {
if (StringUtils.isNotBlank(flowId)) {
return flowId.equalsIgnoreCase(currentId);
}
return true;
})
.forEach(id -> {
val flowDetails = new LinkedHashMap<String, Object>();
val def = Flow.class.cast(v.getFlowDefinition(id));
flowDetails.put("startState", def.getStartState().getId());
val states = new LinkedHashMap<String, Map>();
Arrays.stream(def.getStateIds()).forEach(st -> {
val state = (State) def.getState(st);
val stateMap = new LinkedHashMap<String, Object>();
if (!state.getAttributes().asMap().isEmpty()) {
stateMap.put("attributes", CollectionUtils.wrap(state.getAttributes()));
}
if (StringUtils.isNotBlank(state.getCaption())) {
stateMap.put("caption", state.getCaption());
}
var acts = StreamSupport.stream(state.getEntryActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("entryActions", acts);
}
if (state instanceof ActionState) {
acts = StreamSupport.stream(ActionState.class.cast(state).getActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("actionList", acts);
}
}
if (state instanceof EndState) {
stateMap.put("isEndState", Boolean.TRUE);
}
if (state.isViewState()) {
stateMap.put("isViewState", state.isViewState());
stateMap.put("isRedirect", ((ViewState) state).getRedirect());
acts = StreamSupport.stream(state.getEntryActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("renderActions", ((ViewState) state).getRenderActionList());
}
acts = Arrays.stream(((ViewState) state).getVariables())
.map(value -> value.getName() + " -> " + value.getValueFactory().toString())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("viewVariables", acts);
}
val field = ReflectionUtils.findField(((ViewState) state).getViewFactory().getClass(), "viewId");
if (field != null) {
ReflectionUtils.makeAccessible(field);
val exp = (Expression) ReflectionUtils.getField(field, ((ViewState) state).getViewFactory());
stateMap.put("viewId", StringUtils.defaultIfBlank(exp.getExpressionString(), exp.getValue(null).toString()));
} else {
LOGGER.warn("Field viewId cannot be located on view state [{}]", state);
}
}
if (state instanceof TransitionableState) {
val stDef = TransitionableState.class.cast(state);
acts = StreamSupport.stream(stDef.getExitActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("exitActions", acts);
}
acts = Arrays.stream(stDef.getTransitions())
.map(tr -> tr.getId() + " -> " + tr.getTargetStateId())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("transitions", acts);
}
}
states.put(st, stateMap);
});
flowDetails.put("states", states);
flowDetails.put("possibleOutcomes", def.getPossibleOutcomes());
flowDetails.put("stateCount", def.getStateCount());
var acts = StreamSupport.stream(def.getEndActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("endActions", acts);
}
acts = StreamSupport.stream(def.getGlobalTransitionSet().spliterator(), false)
.map(tr -> tr.getId() + " -> " + tr.getTargetStateId() + " @ " + tr.getExecutionCriteria().toString())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("globalTransitions", acts);
}
acts = Arrays.stream(def.getExceptionHandlerSet().toArray())
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("exceptionHandlers", acts);
}
val vars = Arrays.stream(def.getVariables())
.map(FlowVariable::getName)
.collect(Collectors.joining(","));
if (StringUtils.isNotBlank(vars)) {
flowDetails.put("variables", vars);
}
jsonMap.put(id, flowDetails);
}));
return jsonMap;
} }
|
public class class_name {
@ReadOperation
public Map<?, ?> getReport(@Nullable final String flowId) {
val jsonMap = new LinkedHashMap<String, Object>();
val map = this.applicationContext.getBeansOfType(FlowDefinitionRegistry.class, false, true);
map.forEach((k, v) -> Arrays.stream(v.getFlowDefinitionIds())
.filter(currentId -> {
if (StringUtils.isNotBlank(flowId)) {
return flowId.equalsIgnoreCase(currentId);
}
return true;
})
.forEach(id -> {
val flowDetails = new LinkedHashMap<String, Object>();
val def = Flow.class.cast(v.getFlowDefinition(id));
flowDetails.put("startState", def.getStartState().getId());
val states = new LinkedHashMap<String, Map>();
Arrays.stream(def.getStateIds()).forEach(st -> {
val state = (State) def.getState(st);
val stateMap = new LinkedHashMap<String, Object>();
if (!state.getAttributes().asMap().isEmpty()) {
stateMap.put("attributes", CollectionUtils.wrap(state.getAttributes()));
}
if (StringUtils.isNotBlank(state.getCaption())) {
stateMap.put("caption", state.getCaption());
}
var acts = StreamSupport.stream(state.getEntryActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("entryActions", acts);
}
if (state instanceof ActionState) {
acts = StreamSupport.stream(ActionState.class.cast(state).getActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("actionList", acts); // depends on control dependency: [if], data = [none]
}
}
if (state instanceof EndState) {
stateMap.put("isEndState", Boolean.TRUE);
}
if (state.isViewState()) {
stateMap.put("isViewState", state.isViewState());
stateMap.put("isRedirect", ((ViewState) state).getRedirect());
acts = StreamSupport.stream(state.getEntryActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("renderActions", ((ViewState) state).getRenderActionList());
}
acts = Arrays.stream(((ViewState) state).getVariables())
.map(value -> value.getName() + " -> " + value.getValueFactory().toString())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("viewVariables", acts);
}
val field = ReflectionUtils.findField(((ViewState) state).getViewFactory().getClass(), "viewId");
if (field != null) {
ReflectionUtils.makeAccessible(field);
val exp = (Expression) ReflectionUtils.getField(field, ((ViewState) state).getViewFactory());
stateMap.put("viewId", StringUtils.defaultIfBlank(exp.getExpressionString(), exp.getValue(null).toString()));
} else {
LOGGER.warn("Field viewId cannot be located on view state [{}]", state);
}
}
if (state instanceof TransitionableState) {
val stDef = TransitionableState.class.cast(state);
acts = StreamSupport.stream(stDef.getExitActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("exitActions", acts); // depends on control dependency: [if], data = [none]
}
acts = Arrays.stream(stDef.getTransitions())
.map(tr -> tr.getId() + " -> " + tr.getTargetStateId())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
stateMap.put("transitions", acts); // depends on control dependency: [if], data = [none]
}
}
states.put(st, stateMap);
});
flowDetails.put("states", states);
flowDetails.put("possibleOutcomes", def.getPossibleOutcomes());
flowDetails.put("stateCount", def.getStateCount());
var acts = StreamSupport.stream(def.getEndActionList().spliterator(), false)
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("endActions", acts);
}
acts = StreamSupport.stream(def.getGlobalTransitionSet().spliterator(), false)
.map(tr -> tr.getId() + " -> " + tr.getTargetStateId() + " @ " + tr.getExecutionCriteria().toString())
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("globalTransitions", acts);
}
acts = Arrays.stream(def.getExceptionHandlerSet().toArray())
.map(Object::toString)
.collect(Collectors.toList());
if (!acts.isEmpty()) {
flowDetails.put("exceptionHandlers", acts);
}
val vars = Arrays.stream(def.getVariables())
.map(FlowVariable::getName)
.collect(Collectors.joining(","));
if (StringUtils.isNotBlank(vars)) {
flowDetails.put("variables", vars);
}
jsonMap.put(id, flowDetails);
}));
return jsonMap;
} }
|
public class class_name {
public EClass getPasswordChanged() {
if (passwordChangedEClass == null) {
passwordChangedEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(LogPackage.eNS_URI)
.getEClassifiers().get(27);
}
return passwordChangedEClass;
} }
|
public class class_name {
public EClass getPasswordChanged() {
if (passwordChangedEClass == null) {
passwordChangedEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(LogPackage.eNS_URI)
.getEClassifiers().get(27);
// depends on control dependency: [if], data = [none]
}
return passwordChangedEClass;
} }
|
public class class_name {
public EClass getBCF() {
if (bcfEClass == null) {
bcfEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(196);
}
return bcfEClass;
} }
|
public class class_name {
public EClass getBCF() {
if (bcfEClass == null) {
bcfEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(196); // depends on control dependency: [if], data = [none]
}
return bcfEClass;
} }
|
public class class_name {
protected void localRelease() {
super.localRelease();
_currentItem = null;
_currentIndex = -1;
_iterator = null;
_defaultText = null;
_renderState = INIT;
_haveKids = false;
_contentBuffer = null;
_padContext = null;
_ignoreNulls = false;
_renderedItems = 0;
if(_containerInPageContext) {
DataAccessProviderStack.removeDataAccessProvider(pageContext);
_containerInPageContext = false;
}
} }
|
public class class_name {
protected void localRelease() {
super.localRelease();
_currentItem = null;
_currentIndex = -1;
_iterator = null;
_defaultText = null;
_renderState = INIT;
_haveKids = false;
_contentBuffer = null;
_padContext = null;
_ignoreNulls = false;
_renderedItems = 0;
if(_containerInPageContext) {
DataAccessProviderStack.removeDataAccessProvider(pageContext); // depends on control dependency: [if], data = [none]
_containerInPageContext = false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void actionUndoChanges() throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
boolean isFolder = false;
String source = getResourceList().get(0);
if (!isMultiOperation()) {
CmsResource resource = getCms().readResource(source, CmsResourceFilter.ALL);
isFolder = resource.isFolder();
}
// get the folders to refresh
List<String> folderList = new ArrayList<String>(1 + getResourceList().size());
folderList.add(CmsResource.getParentFolder(source));
Iterator<String> it = getResourceList().iterator();
while (it.hasNext()) {
String res = it.next();
String target = resourceOriginalPath(getCms(), res);
if ((target != null) && !target.equals(res)) {
CmsResource resource = getCms().readResource(res, CmsResourceFilter.ALL);
if (resource.isFolder()) {
folderList.add(CmsResource.getParentFolder(target));
}
}
}
if (performDialogOperation()) {
// if no exception is caused and "true" is returned move operation was successful
if (isMultiOperation() || isFolder) {
// set request attribute to reload the explorer tree view
getJsp().getRequest().setAttribute(REQUEST_ATTRIBUTE_RELOADTREE, folderList);
}
actionCloseDialog();
} else {
// "false" returned, display "please wait" screen
getJsp().include(FILE_DIALOG_SCREEN_WAIT);
}
} catch (Throwable e) {
// error during deletion, show error dialog
includeErrorpage(this, e);
}
} }
|
public class class_name {
public void actionUndoChanges() throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
boolean isFolder = false;
String source = getResourceList().get(0);
if (!isMultiOperation()) {
CmsResource resource = getCms().readResource(source, CmsResourceFilter.ALL);
isFolder = resource.isFolder(); // depends on control dependency: [if], data = [none]
}
// get the folders to refresh
List<String> folderList = new ArrayList<String>(1 + getResourceList().size());
folderList.add(CmsResource.getParentFolder(source));
Iterator<String> it = getResourceList().iterator();
while (it.hasNext()) {
String res = it.next();
String target = resourceOriginalPath(getCms(), res);
if ((target != null) && !target.equals(res)) {
CmsResource resource = getCms().readResource(res, CmsResourceFilter.ALL);
if (resource.isFolder()) {
folderList.add(CmsResource.getParentFolder(target)); // depends on control dependency: [if], data = [none]
}
}
}
if (performDialogOperation()) {
// if no exception is caused and "true" is returned move operation was successful
if (isMultiOperation() || isFolder) {
// set request attribute to reload the explorer tree view
getJsp().getRequest().setAttribute(REQUEST_ATTRIBUTE_RELOADTREE, folderList); // depends on control dependency: [if], data = [none]
}
actionCloseDialog(); // depends on control dependency: [if], data = [none]
} else {
// "false" returned, display "please wait" screen
getJsp().include(FILE_DIALOG_SCREEN_WAIT); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
// error during deletion, show error dialog
includeErrorpage(this, e);
}
} }
|
public class class_name {
private Set<MasterWorkerInfo> selectInfoByAddress(Set<String> addresses,
Set<MasterWorkerInfo> workerInfoSet, Set<String> workerNames) {
return workerInfoSet.stream().filter(info -> {
String host = info.getWorkerAddress().getHost();
workerNames.add(host);
String ip = null;
try {
ip = NetworkAddressUtils.resolveIpAddress(host);
workerNames.add(ip);
} catch (UnknownHostException e) {
// The host may already be an IP address
}
if (addresses.contains(host)) {
addresses.remove(host);
return true;
}
if (ip != null) {
if (addresses.contains(ip)) {
addresses.remove(ip);
return true;
}
}
return false;
}).collect(Collectors.toSet());
} }
|
public class class_name {
private Set<MasterWorkerInfo> selectInfoByAddress(Set<String> addresses,
Set<MasterWorkerInfo> workerInfoSet, Set<String> workerNames) {
return workerInfoSet.stream().filter(info -> {
String host = info.getWorkerAddress().getHost();
workerNames.add(host);
String ip = null;
try {
ip = NetworkAddressUtils.resolveIpAddress(host); // depends on control dependency: [try], data = [none]
workerNames.add(ip); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
// The host may already be an IP address
} // depends on control dependency: [catch], data = [none]
if (addresses.contains(host)) {
addresses.remove(host); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (ip != null) {
if (addresses.contains(ip)) {
addresses.remove(ip); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
}).collect(Collectors.toSet());
} }
|
public class class_name {
private boolean isDialog(Activity activity, View decorView){
if(decorView == null || !decorView.isShown() || activity == null){
return false;
}
Context viewContext = null;
if(decorView != null){
viewContext = decorView.getContext();
}
if (viewContext instanceof ContextThemeWrapper) {
ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
viewContext = ctw.getBaseContext();
}
Context activityContext = activity;
Context activityBaseContext = activity.getBaseContext();
return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (decorView != activity.getWindow().getDecorView());
} }
|
public class class_name {
private boolean isDialog(Activity activity, View decorView){
if(decorView == null || !decorView.isShown() || activity == null){
return false; // depends on control dependency: [if], data = [none]
}
Context viewContext = null;
if(decorView != null){
viewContext = decorView.getContext(); // depends on control dependency: [if], data = [none]
}
if (viewContext instanceof ContextThemeWrapper) {
ContextThemeWrapper ctw = (ContextThemeWrapper) viewContext;
viewContext = ctw.getBaseContext(); // depends on control dependency: [if], data = [none]
}
Context activityContext = activity;
Context activityBaseContext = activity.getBaseContext();
return (activityContext.equals(viewContext) || activityBaseContext.equals(viewContext)) && (decorView != activity.getWindow().getDecorView());
} }
|
public class class_name {
private void moveGlobalSymbols(Collection<GlobalSymbol> globalSymbols) {
for (GlobalSymbolCycle globalSymbolCycle :
new OrderAndCombineGlobalSymbols(globalSymbols).orderAndCombine()) {
// Symbols whose declarations refer to each other must be grouped together and their
// declaration statements moved together.
globalSymbolCycle.moveDeclarationStatements();
}
} }
|
public class class_name {
private void moveGlobalSymbols(Collection<GlobalSymbol> globalSymbols) {
for (GlobalSymbolCycle globalSymbolCycle :
new OrderAndCombineGlobalSymbols(globalSymbols).orderAndCombine()) {
// Symbols whose declarations refer to each other must be grouped together and their
// declaration statements moved together.
globalSymbolCycle.moveDeclarationStatements(); // depends on control dependency: [for], data = [globalSymbolCycle]
}
} }
|
public class class_name {
public static int fromString (String dirstr)
{
for (int ii = 0; ii < FINE_DIRECTION_COUNT; ii++) {
if (DIR_STRINGS[ii].equals(dirstr)) {
return ii;
}
}
return NONE;
} }
|
public class class_name {
public static int fromString (String dirstr)
{
for (int ii = 0; ii < FINE_DIRECTION_COUNT; ii++) {
if (DIR_STRINGS[ii].equals(dirstr)) {
return ii; // depends on control dependency: [if], data = [none]
}
}
return NONE;
} }
|
public class class_name {
@Override
public void set(long timestampMs, long value) {
long[] bucket = calcBucketOffset(timestampMs);
String redisKey = getName() + ":" + bucket[0];
String redisField = String.valueOf(bucket[1]);
try (Jedis jedis = getJedis()) {
jedis.hset(redisKey, redisField, String.valueOf(value));
if (ttlSeconds > 0) {
jedis.expire(redisKey, ttlSeconds);
}
}
} }
|
public class class_name {
@Override
public void set(long timestampMs, long value) {
long[] bucket = calcBucketOffset(timestampMs);
String redisKey = getName() + ":" + bucket[0];
String redisField = String.valueOf(bucket[1]);
try (Jedis jedis = getJedis()) {
jedis.hset(redisKey, redisField, String.valueOf(value));
if (ttlSeconds > 0) {
jedis.expire(redisKey, ttlSeconds); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean runNext() {
if (!hasQueuedTasks()) {
return false;
}
if (Thread.currentThread().equals(executorThread)) {
Logger.info("ignoring request to execute task - called from executor's own thread");
return false;
}
Runnable task = deferredTasks.poll();
task.run();
return true;
} }
|
public class class_name {
public boolean runNext() {
if (!hasQueuedTasks()) {
return false; // depends on control dependency: [if], data = [none]
}
if (Thread.currentThread().equals(executorThread)) {
Logger.info("ignoring request to execute task - called from executor's own thread"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
Runnable task = deferredTasks.poll();
task.run();
return true;
} }
|
public class class_name {
public void setWholeDay(Boolean isWholeDay) {
if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {
m_model.setWholeDay(isWholeDay);
valueChanged();
}
} }
|
public class class_name {
public void setWholeDay(Boolean isWholeDay) {
if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {
m_model.setWholeDay(isWholeDay);
// depends on control dependency: [if], data = [none]
valueChanged();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final char[][] deepCopy(char[][] toCopy)
{
int toCopyLength = toCopy.length;
char[][] result = new char[toCopyLength][];
for (int i = 0; i < toCopyLength; i++)
{
char[] toElement = toCopy[i];
int toElementLength = toElement.length;
char[] resultElement = new char[toElementLength];
System.arraycopy(toElement, 0, resultElement, 0, toElementLength);
result[i] = resultElement;
}
return result;
} }
|
public class class_name {
public static final char[][] deepCopy(char[][] toCopy)
{
int toCopyLength = toCopy.length;
char[][] result = new char[toCopyLength][];
for (int i = 0; i < toCopyLength; i++)
{
char[] toElement = toCopy[i];
int toElementLength = toElement.length;
char[] resultElement = new char[toElementLength];
System.arraycopy(toElement, 0, resultElement, 0, toElementLength); // depends on control dependency: [for], data = [none]
result[i] = resultElement; // depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
private String[] segment(final String builtText) {
// these are fine because they do not affect offsets
String line = builtText.trim();
line = RuleBasedTokenizer.doubleSpaces.matcher(line).replaceAll(" ");
if (this.isHardParagraph) {
// convert every (spurious) paragraph in newlines and keep them
line = paragraph.matcher(line).replaceAll("\n$1");
} else {
// end of sentence markers, paragraph mark and beginning of link
line = endPunctLinkPara.matcher(line).replaceAll("$1\n$2$3");
line = conventionalPara.matcher(line).replaceAll("$1\n$2$3");
line = endInsideQuotesPara.matcher(line).replaceAll("$1\n$3$4");
line = multiDotsParaStarters.matcher(line).replaceAll("$1\n$2$3");
// remove spurious paragraphs
line = alphaNumParaLowerNum.matcher(line).replaceAll("$1 $3");
line = spuriousParagraph.matcher(line).replaceAll(" $2");
}
// non-period end of sentence markers (?!) followed by sentence starters.
line = noPeriodSpaceEnd.matcher(line).replaceAll("$1\n$2");
// multi-dots followed by sentence starters
line = multiDotsSpaceStarters.matcher(line).replaceAll("$1\n$2");
// end of sentence inside quotes or brackets
line = endInsideQuotesSpace.matcher(line).replaceAll("$1\n$2");
// end of sentence marker, sentence starter punctuation and upper case.
line = punctSpaceUpper.matcher(line).replaceAll("$1\n$2");
// end of sentence markers, maybe space or paragraph mark and beginning of
// link
line = endPunctLinkSpace.matcher(line).replaceAll("$1\n$2");
// special case of multi-punctuation
line = punctSpaceMultiPunct.matcher(line).replaceAll("$1\n$2");
// non breaker segments everything else with some exceptions
final String[] lines = line.split("\n");
final String[] sentences = this.nonBreaker.segmenterExceptions(lines);
return sentences;
} }
|
public class class_name {
private String[] segment(final String builtText) {
// these are fine because they do not affect offsets
String line = builtText.trim();
line = RuleBasedTokenizer.doubleSpaces.matcher(line).replaceAll(" ");
if (this.isHardParagraph) {
// convert every (spurious) paragraph in newlines and keep them
line = paragraph.matcher(line).replaceAll("\n$1"); // depends on control dependency: [if], data = [none]
} else {
// end of sentence markers, paragraph mark and beginning of link
line = endPunctLinkPara.matcher(line).replaceAll("$1\n$2$3"); // depends on control dependency: [if], data = [none]
line = conventionalPara.matcher(line).replaceAll("$1\n$2$3"); // depends on control dependency: [if], data = [none]
line = endInsideQuotesPara.matcher(line).replaceAll("$1\n$3$4"); // depends on control dependency: [if], data = [none]
line = multiDotsParaStarters.matcher(line).replaceAll("$1\n$2$3"); // depends on control dependency: [if], data = [none]
// remove spurious paragraphs
line = alphaNumParaLowerNum.matcher(line).replaceAll("$1 $3"); // depends on control dependency: [if], data = [none]
line = spuriousParagraph.matcher(line).replaceAll(" $2"); // depends on control dependency: [if], data = [none]
}
// non-period end of sentence markers (?!) followed by sentence starters.
line = noPeriodSpaceEnd.matcher(line).replaceAll("$1\n$2");
// multi-dots followed by sentence starters
line = multiDotsSpaceStarters.matcher(line).replaceAll("$1\n$2");
// end of sentence inside quotes or brackets
line = endInsideQuotesSpace.matcher(line).replaceAll("$1\n$2");
// end of sentence marker, sentence starter punctuation and upper case.
line = punctSpaceUpper.matcher(line).replaceAll("$1\n$2");
// end of sentence markers, maybe space or paragraph mark and beginning of
// link
line = endPunctLinkSpace.matcher(line).replaceAll("$1\n$2");
// special case of multi-punctuation
line = punctSpaceMultiPunct.matcher(line).replaceAll("$1\n$2");
// non breaker segments everything else with some exceptions
final String[] lines = line.split("\n");
final String[] sentences = this.nonBreaker.segmenterExceptions(lines);
return sentences;
} }
|
public class class_name {
public static double computeSvf(Point pt, Geometry geoms, double distance, int rayCount, int stepRayLength){
double svf = -1;
if(pt ==null){
return svf;
}
if(geoms == null){
return svf;
}
if(distance<=0){
throw new IllegalArgumentException("The distance value must be greater than 0");
}
if(rayCount < 4 ){
throw new IllegalArgumentException("The number of rays must be greater than or equal to 4");
}
if(stepRayLength<=0){
throw new IllegalArgumentException("The ray length parameter must be greater than 0");
}
RAY_STEP_LENGTH = stepRayLength;
if (geoms.getDimension() > 0) {
GeometryFactory factory = pt.getFactory();
//Convert input geoms to a set of linestring
STRtree sTRtree = new STRtree();
int nbGeoms = geoms.getNumGeometries();
for (int i = 0; i < nbGeoms; i++) {
Geometry subGeom = geoms.getGeometryN(i);
if (subGeom instanceof LineString) {
addSegments(subGeom.getCoordinates(), factory, sTRtree);
} else if (subGeom instanceof Polygon) {
Polygon p = (Polygon) subGeom;
addSegments(p.getExteriorRing().getCoordinates(), factory, sTRtree);
int nbInterior = p.getNumInteriorRing();
for (int j = 0; j < nbInterior; j++) {
addSegments(p.getInteriorRingN(j).getCoordinates(), factory, sTRtree);
}
}
}
Coordinate startCoordinate = pt.getCoordinate();
double startZ = Double.isNaN(startCoordinate.z)?0:startCoordinate.z;
double sumArea = 2*Math.PI;
double elementaryAngle = sumArea / rayCount;
int stepCount = (int) Math.round(distance / RAY_STEP_LENGTH);
double stepLength = distance / stepCount;
//Compute the SVF for each ray according an angle
for (int i = 0; i < rayCount; i+=1) {
//To limit the number of geometries in the query with create a progressive ray
Vector2D vStart = new Vector2D(startCoordinate);
double angleRad = elementaryAngle * i;
Vector2D v = Vector2D.create(Math.cos(angleRad), Math.sin(angleRad));
// This is the translation vector
v = v.multiply(stepLength);
double max = 0;
for (int j = 0; j < stepCount; j++) {
LineSegment stepLine = new LineSegment(vStart.add(v.multiply(j)).toCoordinate(), vStart.add(v.multiply(j + 1)).toCoordinate());
LineString rayStep = stepLine.toGeometry(factory);
List<LineString> interEnv = sTRtree.query(rayStep.getEnvelopeInternal());
if (!interEnv.isEmpty()) {
for (LineString lineGeoms : interEnv) {
Coordinate[] coords = lineGeoms.getCoordinates();
Coordinate coordsStart = coords[0];
Coordinate coordsEnd = coords[1];
if (Math.max(coordsStart.z, coordsEnd.z) > max * j * stepLength){
Geometry ptsIntersect = lineGeoms.intersection(rayStep);
if (ptsIntersect instanceof Point && ptsIntersect!=null) {
double coordWithZ = CoordinateUtils.interpolate(lineGeoms.getCoordinateN(0), lineGeoms.getCoordinateN(1), ptsIntersect.getCoordinate());
double distancePoint = ptsIntersect.distance(pt);
double ratio = (coordWithZ - startZ) / distancePoint;
if (ratio > max) {
max = ratio;
}
}
}
}
}
}
double sinTheta = Math.sin(Math.atan(max));
sumArea -= elementaryAngle * sinTheta * sinTheta;
}
svf = sumArea / (2 * Math.PI);
}
return svf;
} }
|
public class class_name {
public static double computeSvf(Point pt, Geometry geoms, double distance, int rayCount, int stepRayLength){
double svf = -1;
if(pt ==null){
return svf; // depends on control dependency: [if], data = [none]
}
if(geoms == null){
return svf; // depends on control dependency: [if], data = [none]
}
if(distance<=0){
throw new IllegalArgumentException("The distance value must be greater than 0");
}
if(rayCount < 4 ){
throw new IllegalArgumentException("The number of rays must be greater than or equal to 4");
}
if(stepRayLength<=0){
throw new IllegalArgumentException("The ray length parameter must be greater than 0");
}
RAY_STEP_LENGTH = stepRayLength;
if (geoms.getDimension() > 0) {
GeometryFactory factory = pt.getFactory();
//Convert input geoms to a set of linestring
STRtree sTRtree = new STRtree();
int nbGeoms = geoms.getNumGeometries();
for (int i = 0; i < nbGeoms; i++) {
Geometry subGeom = geoms.getGeometryN(i);
if (subGeom instanceof LineString) {
addSegments(subGeom.getCoordinates(), factory, sTRtree); // depends on control dependency: [if], data = [none]
} else if (subGeom instanceof Polygon) {
Polygon p = (Polygon) subGeom;
addSegments(p.getExteriorRing().getCoordinates(), factory, sTRtree); // depends on control dependency: [if], data = [none]
int nbInterior = p.getNumInteriorRing();
for (int j = 0; j < nbInterior; j++) {
addSegments(p.getInteriorRingN(j).getCoordinates(), factory, sTRtree); // depends on control dependency: [for], data = [j]
}
}
}
Coordinate startCoordinate = pt.getCoordinate();
double startZ = Double.isNaN(startCoordinate.z)?0:startCoordinate.z;
double sumArea = 2*Math.PI;
double elementaryAngle = sumArea / rayCount;
int stepCount = (int) Math.round(distance / RAY_STEP_LENGTH);
double stepLength = distance / stepCount;
//Compute the SVF for each ray according an angle
for (int i = 0; i < rayCount; i+=1) {
//To limit the number of geometries in the query with create a progressive ray
Vector2D vStart = new Vector2D(startCoordinate);
double angleRad = elementaryAngle * i;
Vector2D v = Vector2D.create(Math.cos(angleRad), Math.sin(angleRad));
// This is the translation vector
v = v.multiply(stepLength); // depends on control dependency: [for], data = [none]
double max = 0;
for (int j = 0; j < stepCount; j++) {
LineSegment stepLine = new LineSegment(vStart.add(v.multiply(j)).toCoordinate(), vStart.add(v.multiply(j + 1)).toCoordinate());
LineString rayStep = stepLine.toGeometry(factory);
List<LineString> interEnv = sTRtree.query(rayStep.getEnvelopeInternal());
if (!interEnv.isEmpty()) {
for (LineString lineGeoms : interEnv) {
Coordinate[] coords = lineGeoms.getCoordinates();
Coordinate coordsStart = coords[0];
Coordinate coordsEnd = coords[1];
if (Math.max(coordsStart.z, coordsEnd.z) > max * j * stepLength){
Geometry ptsIntersect = lineGeoms.intersection(rayStep);
if (ptsIntersect instanceof Point && ptsIntersect!=null) {
double coordWithZ = CoordinateUtils.interpolate(lineGeoms.getCoordinateN(0), lineGeoms.getCoordinateN(1), ptsIntersect.getCoordinate());
double distancePoint = ptsIntersect.distance(pt);
double ratio = (coordWithZ - startZ) / distancePoint;
if (ratio > max) {
max = ratio; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
double sinTheta = Math.sin(Math.atan(max));
sumArea -= elementaryAngle * sinTheta * sinTheta; // depends on control dependency: [for], data = [none]
}
svf = sumArea / (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
return svf;
} }
|
public class class_name {
private String getStringValue(Collection<CmsCategory> categories) {
CmsObject cms = A_CmsUI.getCmsObject();
String result = "";
for (CmsCategory cat : categories) {
result += cms.getRequestContext().removeSiteRoot(cat.getRootPath()) + ",";
}
if (result.length() > 0) {
result = result.substring(0, result.length() - 1);
}
return result;
} }
|
public class class_name {
private String getStringValue(Collection<CmsCategory> categories) {
CmsObject cms = A_CmsUI.getCmsObject();
String result = "";
for (CmsCategory cat : categories) {
result += cms.getRequestContext().removeSiteRoot(cat.getRootPath()) + ","; // depends on control dependency: [for], data = [cat]
}
if (result.length() > 0) {
result = result.substring(0, result.length() - 1); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static <T extends ImageGray<T>>
T nv21ToGray( byte[] data , int width , int height ,
T output , Class<T> outputType ) {
if( outputType == GrayU8.class ) {
return (T)nv21ToGray(data,width,height,(GrayU8)output);
} else if( outputType == GrayF32.class ) {
return (T)nv21ToGray(data,width,height,(GrayF32)output);
} else {
throw new IllegalArgumentException("Unsupported BoofCV Image Type "+outputType.getSimpleName());
}
} }
|
public class class_name {
public static <T extends ImageGray<T>>
T nv21ToGray( byte[] data , int width , int height ,
T output , Class<T> outputType ) {
if( outputType == GrayU8.class ) {
return (T)nv21ToGray(data,width,height,(GrayU8)output); // depends on control dependency: [if], data = [none]
} else if( outputType == GrayF32.class ) {
return (T)nv21ToGray(data,width,height,(GrayF32)output); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported BoofCV Image Type "+outputType.getSimpleName());
}
} }
|
public class class_name {
public int getValue(int c, int column) {
if (isCompacted || c < 0 || c > MAX_CP || column < 0
|| column >= (columns - 2)) {
return 0;
}
int index = findRow(c);
return v[index + 2 + column];
} }
|
public class class_name {
public int getValue(int c, int column) {
if (isCompacted || c < 0 || c > MAX_CP || column < 0
|| column >= (columns - 2)) {
return 0; // depends on control dependency: [if], data = [none]
}
int index = findRow(c);
return v[index + 2 + column];
} }
|
public class class_name {
public static void normalizeHTMLTree(Document doc)
{
//normalize tables
NodeList tables = doc.getElementsByTagName("table");
for (int i = 0; i < tables.getLength(); i++)
{
Vector<Node> nodes = new Vector<Node>();
recursiveFindBadNodesInTable(tables.item(i), null, nodes);
for (Node n : nodes)
{
moveSubtreeBefore(n, tables.item(i));
}
}
} }
|
public class class_name {
public static void normalizeHTMLTree(Document doc)
{
//normalize tables
NodeList tables = doc.getElementsByTagName("table");
for (int i = 0; i < tables.getLength(); i++)
{
Vector<Node> nodes = new Vector<Node>();
recursiveFindBadNodesInTable(tables.item(i), null, nodes); // depends on control dependency: [for], data = [i]
for (Node n : nodes)
{
moveSubtreeBefore(n, tables.item(i)); // depends on control dependency: [for], data = [n]
}
}
} }
|
public class class_name {
public void addAnnotations(/* @Nullable */ JvmAnnotationTarget target, /* @Nullable */ Iterable<? extends XAnnotation> annotations) {
if(annotations == null || target == null)
return;
for (XAnnotation annotation : annotations) {
addAnnotation(target, annotation);
}
} }
|
public class class_name {
public void addAnnotations(/* @Nullable */ JvmAnnotationTarget target, /* @Nullable */ Iterable<? extends XAnnotation> annotations) {
if(annotations == null || target == null)
return;
for (XAnnotation annotation : annotations) {
addAnnotation(target, annotation); // depends on control dependency: [for], data = [annotation]
}
} }
|
public class class_name {
@SuppressWarnings("null")
// TODO: Too much code, improve this, possibly by breaking it
public static final Object getObject(Object obj, String fieldName)
{
Field embeddedField;
try
{
embeddedField = obj.getClass().getDeclaredField(fieldName);
if (embeddedField != null)
{
if (!embeddedField.isAccessible())
{
embeddedField.setAccessible(true);
}
Object embededObject = embeddedField.get(obj);
if (embededObject == null)
{
Class embeddedObjectClass = embeddedField.getType();
if (Collection.class.isAssignableFrom(embeddedObjectClass))
{
if (embeddedObjectClass.equals(List.class))
{
return new ArrayList();
}
else if (embeddedObjectClass.equals(Set.class))
{
return new HashSet();
}
}
else
{
embededObject = embeddedField.getType().newInstance();
embeddedField.set(obj, embededObject);
}
}
return embededObject;
}
else
{
throw new PropertyAccessException("Embedded object not found: " + fieldName);
}
}
catch (Exception e)
{
throw new PropertyAccessException(e);
}
} }
|
public class class_name {
@SuppressWarnings("null")
// TODO: Too much code, improve this, possibly by breaking it
public static final Object getObject(Object obj, String fieldName)
{
Field embeddedField;
try
{
embeddedField = obj.getClass().getDeclaredField(fieldName);
// depends on control dependency: [try], data = [none]
if (embeddedField != null)
{
if (!embeddedField.isAccessible())
{
embeddedField.setAccessible(true);
// depends on control dependency: [if], data = [none]
}
Object embededObject = embeddedField.get(obj);
if (embededObject == null)
{
Class embeddedObjectClass = embeddedField.getType();
if (Collection.class.isAssignableFrom(embeddedObjectClass))
{
if (embeddedObjectClass.equals(List.class))
{
return new ArrayList();
// depends on control dependency: [if], data = [none]
}
else if (embeddedObjectClass.equals(Set.class))
{
return new HashSet();
// depends on control dependency: [if], data = [none]
}
}
else
{
embededObject = embeddedField.getType().newInstance();
// depends on control dependency: [if], data = [none]
embeddedField.set(obj, embededObject);
// depends on control dependency: [if], data = [none]
}
}
return embededObject;
// depends on control dependency: [if], data = [none]
}
else
{
throw new PropertyAccessException("Embedded object not found: " + fieldName);
}
}
catch (Exception e)
{
throw new PropertyAccessException(e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponse<Object>> runWithServiceResponseAsync(String resourceGroupName, String workflowName, String triggerName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (workflowName == null) {
throw new IllegalArgumentException("Parameter workflowName is required and cannot be null.");
}
if (triggerName == null) {
throw new IllegalArgumentException("Parameter triggerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.run(this.client.subscriptionId(), resourceGroupName, workflowName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Object>>>() {
@Override
public Observable<ServiceResponse<Object>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Object> clientResponse = runDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Object>> runWithServiceResponseAsync(String resourceGroupName, String workflowName, String triggerName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (workflowName == null) {
throw new IllegalArgumentException("Parameter workflowName is required and cannot be null.");
}
if (triggerName == null) {
throw new IllegalArgumentException("Parameter triggerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.run(this.client.subscriptionId(), resourceGroupName, workflowName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Object>>>() {
@Override
public Observable<ServiceResponse<Object>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Object> clientResponse = runDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
private SparseMatrix retainColumns(Set<Integer> indicesToKeep) {
int words = termToIndex.numDimensions();
int cols = indicesToKeep.size();
// Create a mapping from old indices to their new index value.
Map<Integer, Integer> indexMap = new HashMap<Integer, Integer>();
int newIndex = 0;
for (Integer index : indicesToKeep)
indexMap.put(index, newIndex++);
// Create a reduced matrix that will have only the selected columns in
// the final space.
SparseMatrix reduced = new YaleSparseMatrix(
words, indicesToKeep.size());
// Iterate over the sparse values in the matrix for added efficiency.
for (int row = 0; row < words; ++ row) {
SparseDoubleVector sv = cooccurrenceMatrix.getRowVector(row);
for (int col : sv.getNonZeroIndices()) {
double v = cooccurrenceMatrix.get(row, col);
// If the original column was retained, get it's new index
// value and add it to the reduced matrix.
Integer newColIndex = indexMap.get(col);
if (newColIndex != null)
reduced.set(row, newColIndex, v);
// If the transposed row column was retained, get it's new index
// value and add it to the reduced matrix. This turns the col
// value into the row and the new index as the column.
newColIndex = indexMap.get(row + words);
if (newColIndex != null)
reduced.set(col, newColIndex, v);
}
}
return reduced;
} }
|
public class class_name {
private SparseMatrix retainColumns(Set<Integer> indicesToKeep) {
int words = termToIndex.numDimensions();
int cols = indicesToKeep.size();
// Create a mapping from old indices to their new index value.
Map<Integer, Integer> indexMap = new HashMap<Integer, Integer>();
int newIndex = 0;
for (Integer index : indicesToKeep)
indexMap.put(index, newIndex++);
// Create a reduced matrix that will have only the selected columns in
// the final space.
SparseMatrix reduced = new YaleSparseMatrix(
words, indicesToKeep.size());
// Iterate over the sparse values in the matrix for added efficiency.
for (int row = 0; row < words; ++ row) {
SparseDoubleVector sv = cooccurrenceMatrix.getRowVector(row);
for (int col : sv.getNonZeroIndices()) {
double v = cooccurrenceMatrix.get(row, col);
// If the original column was retained, get it's new index
// value and add it to the reduced matrix.
Integer newColIndex = indexMap.get(col);
if (newColIndex != null)
reduced.set(row, newColIndex, v);
// If the transposed row column was retained, get it's new index
// value and add it to the reduced matrix. This turns the col
// value into the row and the new index as the column.
newColIndex = indexMap.get(row + words);
// depends on control dependency: [for], data = [none]
if (newColIndex != null)
reduced.set(col, newColIndex, v);
}
}
return reduced;
} }
|
public class class_name {
@Override
public ReadWriteLockedOffHeapClockCache<K, V> newInstance() {
StorageEngine<? super K, ? super V> storageEngine = storageEngineFactory.newInstance();
try {
if (evictionListener == null) {
return new ReadWriteLockedOffHeapClockCache<>(tableSource, storageEngine, tableSize);
} else {
return new EvictionListeningReadWriteLockedOffHeapClockCache<>(evictionListener, tableSource, storageEngine, tableSize);
}
} catch (RuntimeException e) {
storageEngine.destroy();
throw e;
}
} }
|
public class class_name {
@Override
public ReadWriteLockedOffHeapClockCache<K, V> newInstance() {
StorageEngine<? super K, ? super V> storageEngine = storageEngineFactory.newInstance();
try {
if (evictionListener == null) {
return new ReadWriteLockedOffHeapClockCache<>(tableSource, storageEngine, tableSize); // depends on control dependency: [if], data = [none]
} else {
return new EvictionListeningReadWriteLockedOffHeapClockCache<>(evictionListener, tableSource, storageEngine, tableSize); // depends on control dependency: [if], data = [(evictionListener]
}
} catch (RuntimeException e) {
storageEngine.destroy();
throw e;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private StatementHandler getStatementHandler(Class<? extends StatementHandler> statementHandlerClazz) {
StatementHandler result = null;
Constructor<? extends StatementHandler> constructor = null;
Class<? extends StatementHandler> clazz = statementHandlerClazz;
try {
constructor = clazz.getConstructor(Overrider.class);
result = constructor.newInstance(overrider);
} catch (SecurityException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (NoSuchMethodException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (IllegalArgumentException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (InstantiationException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (IllegalAccessException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (InvocationTargetException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
}
return result;
} }
|
public class class_name {
private StatementHandler getStatementHandler(Class<? extends StatementHandler> statementHandlerClazz) {
StatementHandler result = null;
Constructor<? extends StatementHandler> constructor = null;
Class<? extends StatementHandler> clazz = statementHandlerClazz;
try {
constructor = clazz.getConstructor(Overrider.class); // depends on control dependency: [try], data = [none]
result = constructor.newInstance(overrider); // depends on control dependency: [try], data = [none]
} catch (SecurityException e) {
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none]
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new MjdbcRuntimeException(ERROR_SH_INIT_FAILED, e);
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
private static void setField(Class<?> expectedType, Object value, boolean saveOriginal) throws IllegalStateException {
try {
for (Field field : NamingManager.class.getDeclaredFields()) {
if (expectedType.equals(field.getType())) {
field.setAccessible(true);
if (saveOriginal) {
if (expectedType.equals(InitialContextFactoryBuilder.class)) {
originalICFBuilder = (InitialContextFactoryBuilder) field.get(null);
} else {
originalOFBuilder = (ObjectFactoryBuilder) field.get(null);
}
}
field.set(null, value);
}
}
} catch (Throwable t) {
// Ignore
LOGGER.debug("Error setting field.", t);
throw new IllegalStateException(t);
}
} }
|
public class class_name {
private static void setField(Class<?> expectedType, Object value, boolean saveOriginal) throws IllegalStateException {
try {
for (Field field : NamingManager.class.getDeclaredFields()) {
if (expectedType.equals(field.getType())) {
field.setAccessible(true); // depends on control dependency: [if], data = [none]
if (saveOriginal) {
if (expectedType.equals(InitialContextFactoryBuilder.class)) {
originalICFBuilder = (InitialContextFactoryBuilder) field.get(null); // depends on control dependency: [if], data = [none]
} else {
originalOFBuilder = (ObjectFactoryBuilder) field.get(null); // depends on control dependency: [if], data = [none]
}
}
field.set(null, value); // depends on control dependency: [if], data = [none]
}
}
} catch (Throwable t) {
// Ignore
LOGGER.debug("Error setting field.", t);
throw new IllegalStateException(t);
}
} }
|
public class class_name {
public synchronized static BandwidthClient getInstance() {
if (INSTANCE == null) {
String userId = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_USER_ID);
String apiToken = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_TOKEN);
String apiSecret = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_SECRET);
String apiEndpoint = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_ENDPOINT);
String apiVersion = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_VERSION);
String maxTotal = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_TOTAL_CONNECTIONS);
String defaultMaxPerRoute = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE);
if (userId == null || apiToken == null || apiSecret == null || apiEndpoint == null || apiVersion == null) {
userId = System.getenv().get(BandwidthConstants.BANDWIDTH_USER_ID);
apiToken = System.getenv().get(BandwidthConstants.BANDWIDTH_API_TOKEN);
apiSecret = System.getenv().get(BandwidthConstants.BANDWIDTH_API_SECRET);
apiEndpoint = System.getenv().get(BandwidthConstants.BANDWIDTH_API_ENDPOINT);
apiVersion = System.getenv().get(BandwidthConstants.BANDWIDTH_API_VERSION);
}
if (maxTotal == null) {
maxTotal = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_TOTAL_CONNECTIONS);
}
Integer maxTotalNum=null;
if (maxTotal != null) {
try {
maxTotalNum = Integer.parseInt(maxTotal);
} catch (NumberFormatException ex) {
throw new RuntimeException(String.format("Invalid parameter for MAX_TOTAL_CONNECTIONS %s", maxTotal), ex);
}
}
if (defaultMaxPerRoute == null) {
defaultMaxPerRoute = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE);
}
Integer defaultMaxPerRouteNum=null;
if (defaultMaxPerRoute != null) {
try {
defaultMaxPerRouteNum = Integer.parseInt(defaultMaxPerRoute);
} catch (NumberFormatException ex) {
throw new RuntimeException(String.format("Invalid parameter for MAX_DEFAULT_CONNECTIONS_PER_ROUTE %s", defaultMaxPerRoute), ex);
}
}
INSTANCE = new BandwidthClient(userId, apiToken, apiSecret, apiEndpoint, apiVersion, maxTotalNum, defaultMaxPerRouteNum);
if (userId != null || apiToken != null || apiSecret != null) {
validateCredentials();
}
}
return INSTANCE;
} }
|
public class class_name {
public synchronized static BandwidthClient getInstance() {
if (INSTANCE == null) {
String userId = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_USER_ID);
String apiToken = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_TOKEN);
String apiSecret = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_SECRET);
String apiEndpoint = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_ENDPOINT);
String apiVersion = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_VERSION);
String maxTotal = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_TOTAL_CONNECTIONS);
String defaultMaxPerRoute = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE);
if (userId == null || apiToken == null || apiSecret == null || apiEndpoint == null || apiVersion == null) {
userId = System.getenv().get(BandwidthConstants.BANDWIDTH_USER_ID); // depends on control dependency: [if], data = [none]
apiToken = System.getenv().get(BandwidthConstants.BANDWIDTH_API_TOKEN); // depends on control dependency: [if], data = [none]
apiSecret = System.getenv().get(BandwidthConstants.BANDWIDTH_API_SECRET); // depends on control dependency: [if], data = [none]
apiEndpoint = System.getenv().get(BandwidthConstants.BANDWIDTH_API_ENDPOINT); // depends on control dependency: [if], data = [none]
apiVersion = System.getenv().get(BandwidthConstants.BANDWIDTH_API_VERSION); // depends on control dependency: [if], data = [none]
}
if (maxTotal == null) {
maxTotal = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_TOTAL_CONNECTIONS); // depends on control dependency: [if], data = [none]
}
Integer maxTotalNum=null;
if (maxTotal != null) {
try {
maxTotalNum = Integer.parseInt(maxTotal); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
throw new RuntimeException(String.format("Invalid parameter for MAX_TOTAL_CONNECTIONS %s", maxTotal), ex);
} // depends on control dependency: [catch], data = [none]
}
if (defaultMaxPerRoute == null) {
defaultMaxPerRoute = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE); // depends on control dependency: [if], data = [none]
}
Integer defaultMaxPerRouteNum=null;
if (defaultMaxPerRoute != null) {
try {
defaultMaxPerRouteNum = Integer.parseInt(defaultMaxPerRoute); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
throw new RuntimeException(String.format("Invalid parameter for MAX_DEFAULT_CONNECTIONS_PER_ROUTE %s", defaultMaxPerRoute), ex);
} // depends on control dependency: [catch], data = [none]
}
INSTANCE = new BandwidthClient(userId, apiToken, apiSecret, apiEndpoint, apiVersion, maxTotalNum, defaultMaxPerRouteNum); // depends on control dependency: [if], data = [none]
if (userId != null || apiToken != null || apiSecret != null) {
validateCredentials(); // depends on control dependency: [if], data = [none]
}
}
return INSTANCE;
} }
|
public class class_name {
public static ZonalOffset atLongitude(BigDecimal longitude) {
if (
(longitude.compareTo(DECIMAL_POS_180) > 0)
|| (longitude.compareTo(DECIMAL_NEG_180) < 0)
) {
throw new IllegalArgumentException("Out of range: " + longitude);
}
BigDecimal offset = longitude.multiply(DECIMAL_240);
BigDecimal integral = offset.setScale(0, RoundingMode.DOWN);
BigDecimal delta = offset.subtract(integral);
BigDecimal decimal = delta.setScale(9, RoundingMode.HALF_UP).multiply(MRD);
int total = integral.intValueExact();
int fraction = decimal.intValueExact();
if (fraction == 0) {
return ZonalOffset.ofTotalSeconds(total);
} else if (fraction == 1_000_000_000) {
return ZonalOffset.ofTotalSeconds(total + 1);
} else if (fraction == -1_000_000_000) {
return ZonalOffset.ofTotalSeconds(total - 1);
} else {
return new ZonalOffset(total, fraction);
}
} }
|
public class class_name {
public static ZonalOffset atLongitude(BigDecimal longitude) {
if (
(longitude.compareTo(DECIMAL_POS_180) > 0)
|| (longitude.compareTo(DECIMAL_NEG_180) < 0)
) {
throw new IllegalArgumentException("Out of range: " + longitude);
}
BigDecimal offset = longitude.multiply(DECIMAL_240);
BigDecimal integral = offset.setScale(0, RoundingMode.DOWN);
BigDecimal delta = offset.subtract(integral);
BigDecimal decimal = delta.setScale(9, RoundingMode.HALF_UP).multiply(MRD);
int total = integral.intValueExact();
int fraction = decimal.intValueExact();
if (fraction == 0) {
return ZonalOffset.ofTotalSeconds(total); // depends on control dependency: [if], data = [none]
} else if (fraction == 1_000_000_000) {
return ZonalOffset.ofTotalSeconds(total + 1); // depends on control dependency: [if], data = [none]
} else if (fraction == -1_000_000_000) {
return ZonalOffset.ofTotalSeconds(total - 1); // depends on control dependency: [if], data = [none]
} else {
return new ZonalOffset(total, fraction); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getValue() {
String value = editTextView.getText().toString();
if (TextUtils.isEmpty(editVerifyRegex)) {
return value;
}
return editTextView.verifyValue() ? value : "";
} }
|
public class class_name {
public String getValue() {
String value = editTextView.getText().toString();
if (TextUtils.isEmpty(editVerifyRegex)) {
return value; // depends on control dependency: [if], data = [none]
}
return editTextView.verifyValue() ? value : "";
} }
|
public class class_name {
@Override
public Object getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewSelection(request);
} else {
return getValue();
}
} }
|
public class class_name {
@Override
public Object getRequestValue(final Request request) {
if (isPresent(request)) {
return getNewSelection(request); // depends on control dependency: [if], data = [none]
} else {
return getValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setValue(T value) throws IllegalArgumentException
{
Integer b = attributeClass.lookupInt.get(value);
// Check if the value is not already a memeber of the attribute class.
if (b == null)
{
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
throw new IllegalArgumentException("The value to set, " + value +
", is not already a member of the finalized IdType, " + attributeClass.attributeClassName + ".");
}
else
{
// Add the new value to the attribute class. Delegate to the factory to do this so that strings are
// interned and so on.
IdAttribute newAttribute = attributeClass.createIdAttribute(value);
b = newAttribute.value;
}
}
// Set the new value as the value of this attribute.
this.value = b;
} }
|
public class class_name {
public void setValue(T value) throws IllegalArgumentException
{
Integer b = attributeClass.lookupInt.get(value);
// Check if the value is not already a memeber of the attribute class.
if (b == null)
{
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
throw new IllegalArgumentException("The value to set, " + value +
", is not already a member of the finalized IdType, " + attributeClass.attributeClassName + ".");
}
else
{
// Add the new value to the attribute class. Delegate to the factory to do this so that strings are
// interned and so on.
IdAttribute newAttribute = attributeClass.createIdAttribute(value);
b = newAttribute.value; // depends on control dependency: [if], data = [none]
}
}
// Set the new value as the value of this attribute.
this.value = b;
} }
|
public class class_name {
private static JoseFactory loadSpi(ClassLoader cl) {
if (cl == null) {
return null;
}
// start from the root CL and go back down to the TCCL
JoseFactory instance = loadSpi(cl.getParent());
if (instance == null) {
ServiceLoader<JoseFactory> sl = ServiceLoader.load(JoseFactory.class, cl);
URL u = cl.getResource("/META-INF/services/org.wildfly.swarm.jose.provider.JoseFactory");
log.debugf("loadSpi, cl=%s, u=%s, sl=%s", cl, u, sl);
try {
for (Object spi : sl) {
if (spi instanceof JoseFactory) {
if (instance != null) {
log.warn("Multiple JoseFactory implementations found: "
+ spi.getClass().getName() + " and " + instance.getClass().getName());
break;
} else {
log.debugf("sl=%s, loaded=%s", sl, spi);
instance = (JoseFactory)spi;
}
}
}
} catch (Throwable e) {
log.warn("Failed to locate JoseFactory provider", e);
}
}
return instance;
} }
|
public class class_name {
private static JoseFactory loadSpi(ClassLoader cl) {
if (cl == null) {
return null; // depends on control dependency: [if], data = [none]
}
// start from the root CL and go back down to the TCCL
JoseFactory instance = loadSpi(cl.getParent());
if (instance == null) {
ServiceLoader<JoseFactory> sl = ServiceLoader.load(JoseFactory.class, cl);
URL u = cl.getResource("/META-INF/services/org.wildfly.swarm.jose.provider.JoseFactory");
log.debugf("loadSpi, cl=%s, u=%s, sl=%s", cl, u, sl); // depends on control dependency: [if], data = [none]
try {
for (Object spi : sl) {
if (spi instanceof JoseFactory) {
if (instance != null) {
log.warn("Multiple JoseFactory implementations found: "
+ spi.getClass().getName() + " and " + instance.getClass().getName()); // depends on control dependency: [if], data = [none]
break;
} else {
log.debugf("sl=%s, loaded=%s", sl, spi); // depends on control dependency: [if], data = [none]
instance = (JoseFactory)spi; // depends on control dependency: [if], data = [none]
}
}
}
} catch (Throwable e) {
log.warn("Failed to locate JoseFactory provider", e);
} // depends on control dependency: [catch], data = [none]
}
return instance;
} }
|
public class class_name {
private String compileRealWord(String realWord, CoreDictionary.Attribute attribute)
{
if (attribute.nature.length == 1)
{
Nature nature = attribute.nature[0];
if (nature.startsWith("nr"))
{
wordID = CoreDictionary.NR_WORD_ID;
// this.attribute = CoreDictionary.get(CoreDictionary.NR_WORD_ID);
return Predefine.TAG_PEOPLE;
}
else if (nature.startsWith("ns"))
{
wordID = CoreDictionary.NS_WORD_ID;
// 在地名识别的时候,希望类似"河镇"的词语保持自己的词性,而不是未##地的词性
// this.attribute = CoreDictionary.get(CoreDictionary.NS_WORD_ID);
return Predefine.TAG_PLACE;
}
// case nz:
else if (nature == Nature.nx)
{
wordID = CoreDictionary.NX_WORD_ID;
if (wordID == -1)
wordID = CoreDictionary.X_WORD_ID;
// this.attribute = CoreDictionary.get(wordID);
return Predefine.TAG_PROPER;
}
else if (nature.startsWith("nt") || nature == Nature.nit)
{
wordID = CoreDictionary.NT_WORD_ID;
// this.attribute = CoreDictionary.get(CoreDictionary.NT_WORD_ID);
return Predefine.TAG_GROUP;
}
else if (nature.startsWith('m'))
{
wordID = CoreDictionary.M_WORD_ID;
this.attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID);
return Predefine.TAG_NUMBER;
}
else if (nature.startsWith('x'))
{
wordID = CoreDictionary.X_WORD_ID;
this.attribute = CoreDictionary.get(CoreDictionary.X_WORD_ID);
return Predefine.TAG_CLUSTER;
}
// case xx:
// case w:
// {
// word= Predefine.TAG_OTHER;
// }
// break;
else if (nature == Nature.t)
{
wordID = CoreDictionary.T_WORD_ID;
this.attribute = CoreDictionary.get(CoreDictionary.T_WORD_ID);
return Predefine.TAG_TIME;
}
}
return realWord;
} }
|
public class class_name {
private String compileRealWord(String realWord, CoreDictionary.Attribute attribute)
{
if (attribute.nature.length == 1)
{
Nature nature = attribute.nature[0];
if (nature.startsWith("nr"))
{
wordID = CoreDictionary.NR_WORD_ID; // depends on control dependency: [if], data = [none]
// this.attribute = CoreDictionary.get(CoreDictionary.NR_WORD_ID);
return Predefine.TAG_PEOPLE; // depends on control dependency: [if], data = [none]
}
else if (nature.startsWith("ns"))
{
wordID = CoreDictionary.NS_WORD_ID; // depends on control dependency: [if], data = [none]
// 在地名识别的时候,希望类似"河镇"的词语保持自己的词性,而不是未##地的词性
// this.attribute = CoreDictionary.get(CoreDictionary.NS_WORD_ID);
return Predefine.TAG_PLACE; // depends on control dependency: [if], data = [none]
}
// case nz:
else if (nature == Nature.nx)
{
wordID = CoreDictionary.NX_WORD_ID; // depends on control dependency: [if], data = [none]
if (wordID == -1)
wordID = CoreDictionary.X_WORD_ID;
// this.attribute = CoreDictionary.get(wordID);
return Predefine.TAG_PROPER; // depends on control dependency: [if], data = [none]
}
else if (nature.startsWith("nt") || nature == Nature.nit)
{
wordID = CoreDictionary.NT_WORD_ID; // depends on control dependency: [if], data = [none]
// this.attribute = CoreDictionary.get(CoreDictionary.NT_WORD_ID);
return Predefine.TAG_GROUP; // depends on control dependency: [if], data = [none]
}
else if (nature.startsWith('m'))
{
wordID = CoreDictionary.M_WORD_ID; // depends on control dependency: [if], data = [none]
this.attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID); // depends on control dependency: [if], data = [none]
return Predefine.TAG_NUMBER; // depends on control dependency: [if], data = [none]
}
else if (nature.startsWith('x'))
{
wordID = CoreDictionary.X_WORD_ID; // depends on control dependency: [if], data = [none]
this.attribute = CoreDictionary.get(CoreDictionary.X_WORD_ID); // depends on control dependency: [if], data = [none]
return Predefine.TAG_CLUSTER; // depends on control dependency: [if], data = [none]
}
// case xx:
// case w:
// {
// word= Predefine.TAG_OTHER;
// }
// break;
else if (nature == Nature.t)
{
wordID = CoreDictionary.T_WORD_ID; // depends on control dependency: [if], data = [none]
this.attribute = CoreDictionary.get(CoreDictionary.T_WORD_ID); // depends on control dependency: [if], data = [none]
return Predefine.TAG_TIME; // depends on control dependency: [if], data = [none]
}
}
return realWord;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.