code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private boolean matches(String classname, AccessFlags flags) {
if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) {
return false;
} else if (options.includePattern != null) {
return options.includePattern.matcher(classname.replace('/', '.')).matches();
} else {
return true;
}
} }
|
public class class_name {
private boolean matches(String classname, AccessFlags flags) {
if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) {
return false; // depends on control dependency: [if], data = [none]
} else if (options.includePattern != null) {
return options.includePattern.matcher(classname.replace('/', '.')).matches(); // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Addon getAddon(final AddonView view, final AddonId id)
{
Assert.notNull(view, "AddonView must not be null.");
Assert.notNull(id, "AddonId must not be null.");
return lock.performLocked(LockMode.WRITE, new Callable<Addon>()
{
@Override
public Addon call() throws Exception
{
Addon result = null;
for (Addon addon : getAddons(view))
{
if (id.equals(addon.getId()))
{
result = addon;
break;
}
}
if (result == null)
{
result = stateManager.getAddonForView(view, id);
if (result == null)
result = new AddonImpl(stateManager, id);
Set<Addon> addons = _getAddonsForView(view);
addons.add(result);
}
return result;
}
});
} }
|
public class class_name {
public Addon getAddon(final AddonView view, final AddonId id)
{
Assert.notNull(view, "AddonView must not be null.");
Assert.notNull(id, "AddonId must not be null.");
return lock.performLocked(LockMode.WRITE, new Callable<Addon>()
{
@Override
public Addon call() throws Exception
{
Addon result = null;
for (Addon addon : getAddons(view))
{
if (id.equals(addon.getId()))
{
result = addon; // depends on control dependency: [if], data = [none]
break;
}
}
if (result == null)
{
result = stateManager.getAddonForView(view, id);
if (result == null)
result = new AddonImpl(stateManager, id);
Set<Addon> addons = _getAddonsForView(view);
addons.add(result);
}
return result;
}
});
} }
|
public class class_name {
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) {
logger.debug("{}: with {} concernedElements", methodName, concernedElements.size());
int i = 0;
for (final String element : concernedElements) {
i++;
logger.debug(" element N°{}={}", i, element);
}
} }
|
public class class_name {
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) {
logger.debug("{}: with {} concernedElements", methodName, concernedElements.size());
int i = 0;
for (final String element : concernedElements) {
i++;
// depends on control dependency: [for], data = [none]
logger.debug(" element N°{}={}", i, element);
// depends on control dependency: [for], data = [element]
}
} }
|
public class class_name {
List<String> getModuleClassNames() {
ImmutableList.Builder<String> classNames = ImmutableList.builder();
ModuleSource current = this;
while (current != null) {
String className = current.moduleClassName;
classNames.add(className);
current = current.parent;
}
return classNames.build();
} }
|
public class class_name {
List<String> getModuleClassNames() {
ImmutableList.Builder<String> classNames = ImmutableList.builder();
ModuleSource current = this;
while (current != null) {
String className = current.moduleClassName;
classNames.add(className); // depends on control dependency: [while], data = [none]
current = current.parent; // depends on control dependency: [while], data = [none]
}
return classNames.build();
} }
|
public class class_name {
private HttpMultiMap<V> _set(final Iterable<Map.Entry<String, V>> map) {
clear();
for (Map.Entry<String, V> entry : map) {
add(entry.getKey(), entry.getValue());
}
return this;
} }
|
public class class_name {
private HttpMultiMap<V> _set(final Iterable<Map.Entry<String, V>> map) {
clear();
for (Map.Entry<String, V> entry : map) {
add(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return this;
} }
|
public class class_name {
private static Set<ORecord> mergeSet(Set<ORecord> target, Set<ORecord> source) {
if (source != null) {
if (target == null) {
return source;
} else {
if (target.size() > source.size()) {
target.addAll(source);
return target;
} else {
source.addAll(target);
return source;
}
}
} else {
return target;
}
} }
|
public class class_name {
private static Set<ORecord> mergeSet(Set<ORecord> target, Set<ORecord> source) {
if (source != null) {
if (target == null) {
return source; // depends on control dependency: [if], data = [none]
} else {
if (target.size() > source.size()) {
target.addAll(source); // depends on control dependency: [if], data = [none]
return target; // depends on control dependency: [if], data = [none]
} else {
source.addAll(target); // depends on control dependency: [if], data = [none]
return source; // depends on control dependency: [if], data = [none]
}
}
} else {
return target; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void mouseReleased(MouseEvent e) {
if (!hasFocus) {
return;
}
boolean repaint = tabRowPainter.mouseReleased(e);
if (!repaint) {
repaint = toolbarPainter.mouseReleased(e);
}
} }
|
public class class_name {
public void mouseReleased(MouseEvent e) {
if (!hasFocus) {
return; // depends on control dependency: [if], data = [none]
}
boolean repaint = tabRowPainter.mouseReleased(e);
if (!repaint) {
repaint = toolbarPainter.mouseReleased(e); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void QuickSort2(Vector v, int lo0, int hi0)
{
int lo = lo0;
int hi = hi0;
if ( hi0 > lo0)
{
// Arbitrarily establishing partition element as the midpoint of
// the array.
ElemTemplateElement midNode = (ElemTemplateElement) v.elementAt( ( lo0 + hi0 ) / 2 );
// loop through the array until indices cross
while( lo <= hi )
{
// find the first element that is greater than or equal to
// the partition element starting from the left Index.
while( (lo < hi0) && (((ElemTemplateElement) v.elementAt(lo)).compareTo(midNode) < 0) )
{
++lo;
} // end while
// find an element that is smaller than or equal to
// the partition element starting from the right Index.
while( (hi > lo0) && (((ElemTemplateElement) v.elementAt(hi)).compareTo(midNode) > 0) ) {
--hi;
}
// if the indexes have not crossed, swap
if( lo <= hi )
{
ElemTemplateElement node = (ElemTemplateElement) v.elementAt(lo);
v.setElementAt(v.elementAt(hi), lo);
v.setElementAt(node, hi);
++lo;
--hi;
}
}
// If the right index has not reached the left side of array
// must now sort the left partition.
if( lo0 < hi )
{
QuickSort2( v, lo0, hi );
}
// If the left index has not reached the right side of array
// must now sort the right partition.
if( lo < hi0 )
{
QuickSort2( v, lo, hi0 );
}
}
} }
|
public class class_name {
private void QuickSort2(Vector v, int lo0, int hi0)
{
int lo = lo0;
int hi = hi0;
if ( hi0 > lo0)
{
// Arbitrarily establishing partition element as the midpoint of
// the array.
ElemTemplateElement midNode = (ElemTemplateElement) v.elementAt( ( lo0 + hi0 ) / 2 );
// loop through the array until indices cross
while( lo <= hi )
{
// find the first element that is greater than or equal to
// the partition element starting from the left Index.
while( (lo < hi0) && (((ElemTemplateElement) v.elementAt(lo)).compareTo(midNode) < 0) )
{
++lo; // depends on control dependency: [while], data = [none]
} // end while
// find an element that is smaller than or equal to
// the partition element starting from the right Index.
while( (hi > lo0) && (((ElemTemplateElement) v.elementAt(hi)).compareTo(midNode) > 0) ) {
--hi; // depends on control dependency: [while], data = [none]
}
// if the indexes have not crossed, swap
if( lo <= hi )
{
ElemTemplateElement node = (ElemTemplateElement) v.elementAt(lo);
v.setElementAt(v.elementAt(hi), lo); // depends on control dependency: [if], data = [none]
v.setElementAt(node, hi); // depends on control dependency: [if], data = [none]
++lo; // depends on control dependency: [if], data = [none]
--hi; // depends on control dependency: [if], data = [none]
}
}
// If the right index has not reached the left side of array
// must now sort the left partition.
if( lo0 < hi )
{
QuickSort2( v, lo0, hi ); // depends on control dependency: [if], data = [hi )]
}
// If the left index has not reached the right side of array
// must now sort the right partition.
if( lo < hi0 )
{
QuickSort2( v, lo, hi0 ); // depends on control dependency: [if], data = [hi0 )]
}
}
} }
|
public class class_name {
public void marshall(RegexPatternSetUpdate regexPatternSetUpdate, ProtocolMarshaller protocolMarshaller) {
if (regexPatternSetUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(regexPatternSetUpdate.getAction(), ACTION_BINDING);
protocolMarshaller.marshall(regexPatternSetUpdate.getRegexPatternString(), REGEXPATTERNSTRING_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RegexPatternSetUpdate regexPatternSetUpdate, ProtocolMarshaller protocolMarshaller) {
if (regexPatternSetUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(regexPatternSetUpdate.getAction(), ACTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(regexPatternSetUpdate.getRegexPatternString(), REGEXPATTERNSTRING_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void configure(Type type, Properties params, Dialect dialect) {
if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) {
String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE);
String pk = params.getProperty(PersistentIdentifierGenerator.PK);
if (null != tableName) {
String seqName = Strings.replace(sequencePattern, "{table}", tableName);
seqName = Strings.replace(seqName, "{pk}", pk);
if (seqName.length() > MaxLength) {
logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName);
}
String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME);
if (null != entityName && null != namingStrategy) {
String schema = namingStrategy.getSchema(entityName);
if (null != schema) seqName = schema + "." + seqName;
}
params.setProperty(SEQUENCE_PARAM, seqName);
}
}
super.configure(type, params, dialect);
} }
|
public class class_name {
public void configure(Type type, Properties params, Dialect dialect) {
if (Strings.isEmpty(params.getProperty(SEQUENCE_PARAM))) {
String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE);
String pk = params.getProperty(PersistentIdentifierGenerator.PK);
if (null != tableName) {
String seqName = Strings.replace(sequencePattern, "{table}", tableName);
seqName = Strings.replace(seqName, "{pk}", pk); // depends on control dependency: [if], data = [none]
if (seqName.length() > MaxLength) {
logger.warn("{}'s length >=30, wouldn't be supported in some db!", seqName); // depends on control dependency: [if], data = [none]
}
String entityName = params.getProperty(IdentifierGenerator.ENTITY_NAME);
if (null != entityName && null != namingStrategy) {
String schema = namingStrategy.getSchema(entityName);
if (null != schema) seqName = schema + "." + seqName;
}
params.setProperty(SEQUENCE_PARAM, seqName); // depends on control dependency: [if], data = [none]
}
}
super.configure(type, params, dialect);
} }
|
public class class_name {
public static <T extends Serializable> Observable<T> write(final Observable<T> source,
final File file, final boolean append, final int bufferSize) {
Func0<ObjectOutputStream> resourceFactory = new Func0<ObjectOutputStream>() {
@Override
public ObjectOutputStream call() {
try {
return new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(file, append), bufferSize));
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
Func1<ObjectOutputStream, Observable<? extends T>> observableFactory = new Func1<ObjectOutputStream, Observable<? extends T>>() {
@Override
public Observable<? extends T> call(ObjectOutputStream oos) {
return write(source, oos);
}
};
Action1<ObjectOutputStream> disposeAction = new Action1<ObjectOutputStream>() {
@Override
public void call(ObjectOutputStream oos) {
try {
oos.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
return Observable.using(resourceFactory, observableFactory, disposeAction, true);
} }
|
public class class_name {
public static <T extends Serializable> Observable<T> write(final Observable<T> source,
final File file, final boolean append, final int bufferSize) {
Func0<ObjectOutputStream> resourceFactory = new Func0<ObjectOutputStream>() {
@Override
public ObjectOutputStream call() {
try {
return new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(file, append), bufferSize)); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
};
Func1<ObjectOutputStream, Observable<? extends T>> observableFactory = new Func1<ObjectOutputStream, Observable<? extends T>>() {
@Override
public Observable<? extends T> call(ObjectOutputStream oos) {
return write(source, oos);
}
};
Action1<ObjectOutputStream> disposeAction = new Action1<ObjectOutputStream>() {
@Override
public void call(ObjectOutputStream oos) {
try {
oos.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
};
return Observable.using(resourceFactory, observableFactory, disposeAction, true);
} }
|
public class class_name {
private MethodVisitor visitHttpMethod(MethodVisitor mv, int access, String name, String desc, String signature,
String[] exceptions) {
MethodVisitor httpMv = mv;
/*
* Instrument _jspService method for JSP. Instrument doGet, doPost and
* service methods for servlets.
*/
if ((httpInstrumentJsp && name.equals("_jspService")) || (httpInstrumentServlet
&& (name.equals("doGet") || name.equals("doPost") || name.equals("service")))) {
// Only instrument if method has the correct signature
if (HTTP_REQUEST_METHOD_DESC.equals(desc)) {
httpMv = new ServletCallBackAdapter(className, mv, access, name, desc);
}
}
return httpMv;
} }
|
public class class_name {
private MethodVisitor visitHttpMethod(MethodVisitor mv, int access, String name, String desc, String signature,
String[] exceptions) {
MethodVisitor httpMv = mv;
/*
* Instrument _jspService method for JSP. Instrument doGet, doPost and
* service methods for servlets.
*/
if ((httpInstrumentJsp && name.equals("_jspService")) || (httpInstrumentServlet
&& (name.equals("doGet") || name.equals("doPost") || name.equals("service")))) {
// Only instrument if method has the correct signature
if (HTTP_REQUEST_METHOD_DESC.equals(desc)) {
httpMv = new ServletCallBackAdapter(className, mv, access, name, desc); // depends on control dependency: [if], data = [none]
}
}
return httpMv;
} }
|
public class class_name {
@Override
protected void perform(final Wave wave) {
// The first time we store the list of wave to run into the command field
if (this.index == 0) {
this.waveList = wave.get(JRebirthWaves.CHAINED_WAVES);
this.sourceWave = wave;
}
unqueueWaves();
} }
|
public class class_name {
@Override
protected void perform(final Wave wave) {
// The first time we store the list of wave to run into the command field
if (this.index == 0) {
this.waveList = wave.get(JRebirthWaves.CHAINED_WAVES); // depends on control dependency: [if], data = [none]
this.sourceWave = wave; // depends on control dependency: [if], data = [none]
}
unqueueWaves();
} }
|
public class class_name {
public static int lastIndexOfIgnoreCase(String pString, int pChar, int pPos) {
if ((pString == null)) {
return -1;
}
// Get first char
char lower = Character.toLowerCase((char) pChar);
char upper = Character.toUpperCase((char) pChar);
int indexLower;
int indexUpper;
// Test for char
indexLower = pString.lastIndexOf(lower, pPos);
indexUpper = pString.lastIndexOf(upper, pPos);
if (indexLower < 0) {
/* if (indexUpper < 0)
return -1; // First char not found
else */
return indexUpper;// Only upper
}
else if (indexUpper < 0) {
return indexLower;// Only lower
}
else {
// Both found, select last occurence
return (indexLower > indexUpper)
? indexLower
: indexUpper;
}
} }
|
public class class_name {
public static int lastIndexOfIgnoreCase(String pString, int pChar, int pPos) {
if ((pString == null)) {
return -1;
// depends on control dependency: [if], data = [none]
}
// Get first char
char lower = Character.toLowerCase((char) pChar);
char upper = Character.toUpperCase((char) pChar);
int indexLower;
int indexUpper;
// Test for char
indexLower = pString.lastIndexOf(lower, pPos);
indexUpper = pString.lastIndexOf(upper, pPos);
if (indexLower < 0) {
/* if (indexUpper < 0)
return -1; // First char not found
else */
return indexUpper;// Only upper
// depends on control dependency: [if], data = [none]
}
else if (indexUpper < 0) {
return indexLower;// Only lower
// depends on control dependency: [if], data = [none]
}
else {
// Both found, select last occurence
return (indexLower > indexUpper)
? indexLower
: indexUpper;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
boolean isAssignableKey(Method getter) {
synchronized (autoGeneratedKeyGetterCache) {
if ( !autoGeneratedKeyGetterCache.containsKey(getter) ) {
autoGeneratedKeyGetterCache.put(
getter,
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBAutoGeneratedKey.class)
&& ( ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBHashKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBRangeKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexHashKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexRangeKey.class)));
}
return autoGeneratedKeyGetterCache.get(getter);
}
} }
|
public class class_name {
boolean isAssignableKey(Method getter) {
synchronized (autoGeneratedKeyGetterCache) {
if ( !autoGeneratedKeyGetterCache.containsKey(getter) ) {
autoGeneratedKeyGetterCache.put(
getter,
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBAutoGeneratedKey.class)
&& ( ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBHashKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBRangeKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexHashKey.class) ||
ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexRangeKey.class))); // depends on control dependency: [if], data = [none]
}
return autoGeneratedKeyGetterCache.get(getter);
}
} }
|
public class class_name {
void map(D6Model mModelObj, PreparedStatement preparedStatement, D6Inex includeExcludeColumnNames) throws D6Exception {
log("#map obj=" + mModelObj);
final Set<String> columnNameSet = getAllColumnNames();
// index starts from 1
int parameterIndex = 1;
if (includeExcludeColumnNames != null) {
includeExcludeColumnNames.manipulate(columnNameSet);
}
for (String columnName : columnNameSet) {
final D6ModelClassFieldInfo fieldInfo = getFieldInfo(columnName);
final boolean isAutoIncrement = fieldInfo.isAutoIncrement;
final boolean isNullable = fieldInfo.isNullable;
final Field field = fieldInfo.field;
final String fieldName = field.getName();
final Class<?> type = field.getType();
Object fieldValue = null;
try {
fieldValue = field.get(mModelObj);
} catch (IllegalArgumentException e) {
throw new D6Exception(e);
} catch (IllegalAccessException e) {
throw new D6Exception(e);
}
//
if (fieldValue == null && isNullable == false && isAutoIncrement == false) {
// - In case found the null-value column and increment flag is
// false even though this item is NOT NULL
throw new D6Exception("D6Error the model object field '" + fieldName + "'(column name is " + columnName + ") should not null." + "Because of constraint of table definition.");
}
//
if (isAutoIncrement == false) {
try {
log("#map idx=" + parameterIndex + " " + columnName + "=" + fieldValue + " (" + type + ")");
setValue(parameterIndex, preparedStatement, type, fieldValue);
} catch (Exception e) {
throw new D6Exception(e);
}
parameterIndex++;
}
}// end for (String columnName : columnNameSet) {
} }
|
public class class_name {
void map(D6Model mModelObj, PreparedStatement preparedStatement, D6Inex includeExcludeColumnNames) throws D6Exception {
log("#map obj=" + mModelObj);
final Set<String> columnNameSet = getAllColumnNames();
// index starts from 1
int parameterIndex = 1;
if (includeExcludeColumnNames != null) {
includeExcludeColumnNames.manipulate(columnNameSet);
}
for (String columnName : columnNameSet) {
final D6ModelClassFieldInfo fieldInfo = getFieldInfo(columnName);
final boolean isAutoIncrement = fieldInfo.isAutoIncrement;
final boolean isNullable = fieldInfo.isNullable;
final Field field = fieldInfo.field;
final String fieldName = field.getName();
final Class<?> type = field.getType();
Object fieldValue = null;
try {
fieldValue = field.get(mModelObj);
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new D6Exception(e);
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
throw new D6Exception(e);
}
// depends on control dependency: [catch], data = [none]
//
if (fieldValue == null && isNullable == false && isAutoIncrement == false) {
// - In case found the null-value column and increment flag is
// false even though this item is NOT NULL
throw new D6Exception("D6Error the model object field '" + fieldName + "'(column name is " + columnName + ") should not null." + "Because of constraint of table definition.");
}
//
if (isAutoIncrement == false) {
try {
log("#map idx=" + parameterIndex + " " + columnName + "=" + fieldValue + " (" + type + ")");
setValue(parameterIndex, preparedStatement, type, fieldValue);
} catch (Exception e) {
throw new D6Exception(e);
}
parameterIndex++;
}
}// end for (String columnName : columnNameSet) {
} }
|
public class class_name {
protected <T> T convertIfNecessary(String value, T originalValue) {
if (originalValue == null) {
return (T) value;
}
return TypeConversionUtils.convertIfNecessary(value, (Class<T>) originalValue.getClass());
} }
|
public class class_name {
protected <T> T convertIfNecessary(String value, T originalValue) {
if (originalValue == null) {
return (T) value; // depends on control dependency: [if], data = [none]
}
return TypeConversionUtils.convertIfNecessary(value, (Class<T>) originalValue.getClass());
} }
|
public class class_name {
public void setBeanList(final List beanList) {
RepeaterModel model = getOrCreateComponentModel();
model.setData(beanList);
// Clean up any stale data.
HashSet rowIds = new HashSet(beanList.size());
for (Object bean : beanList) {
rowIds.add(getRowId(bean));
}
cleanupStaleContexts(rowIds);
// Clean up cached component IDs
UIContext uic = UIContextHolder.getCurrent();
if (uic != null && getRepeatRoot() != null) {
clearScratchMaps(this);
}
} }
|
public class class_name {
public void setBeanList(final List beanList) {
RepeaterModel model = getOrCreateComponentModel();
model.setData(beanList);
// Clean up any stale data.
HashSet rowIds = new HashSet(beanList.size());
for (Object bean : beanList) {
rowIds.add(getRowId(bean)); // depends on control dependency: [for], data = [bean]
}
cleanupStaleContexts(rowIds);
// Clean up cached component IDs
UIContext uic = UIContextHolder.getCurrent();
if (uic != null && getRepeatRoot() != null) {
clearScratchMaps(this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(Source source, ProtocolMarshaller protocolMarshaller) {
if (source == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(source.getOwner(), OWNER_BINDING);
protocolMarshaller.marshall(source.getSourceIdentifier(), SOURCEIDENTIFIER_BINDING);
protocolMarshaller.marshall(source.getSourceDetails(), SOURCEDETAILS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Source source, ProtocolMarshaller protocolMarshaller) {
if (source == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(source.getOwner(), OWNER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(source.getSourceIdentifier(), SOURCEIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(source.getSourceDetails(), SOURCEDETAILS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean isNavLevelFolder(CmsObject cms, CmsResource resource) {
if (resource.isFolder()) {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource);
if (CmsResourceTypeFolder.RESOURCE_TYPE_NAME.equals(type.getTypeName())) {
try {
CmsProperty prop = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
false);
return !prop.isNullProperty() && NAVIGATION_LEVEL_FOLDER.equals(prop.getValue());
} catch (CmsException e) {
LOG.debug(e.getMessage(), e);
}
}
}
return false;
} }
|
public class class_name {
public static boolean isNavLevelFolder(CmsObject cms, CmsResource resource) {
if (resource.isFolder()) {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource);
if (CmsResourceTypeFolder.RESOURCE_TYPE_NAME.equals(type.getTypeName())) {
try {
CmsProperty prop = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
false);
return !prop.isNullProperty() && NAVIGATION_LEVEL_FOLDER.equals(prop.getValue()); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.debug(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
return false;
} }
|
public class class_name {
private static boolean checkCriticalValue(double score, int df, boolean is_twoTailed, double aLevel) {
double probability=ContinuousDistributions.studentsCdf(score,df);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2;
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} }
|
public class class_name {
private static boolean checkCriticalValue(double score, int df, boolean is_twoTailed, double aLevel) {
double probability=ContinuousDistributions.studentsCdf(score,df);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2; // depends on control dependency: [if], data = [none]
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true; // depends on control dependency: [if], data = [none]
}
return rejectH0;
} }
|
public class class_name {
private boolean canOptimizeObjectCreate(Node firstParam) {
Node curParam = firstParam;
while (curParam != null) {
if (!isOptimizableKey(curParam)) {
return false;
}
curParam = curParam.getNext();
// Check for an odd number of parameters.
if (curParam == null) {
return false;
}
curParam = curParam.getNext();
}
return true;
} }
|
public class class_name {
private boolean canOptimizeObjectCreate(Node firstParam) {
Node curParam = firstParam;
while (curParam != null) {
if (!isOptimizableKey(curParam)) {
return false; // depends on control dependency: [if], data = [none]
}
curParam = curParam.getNext(); // depends on control dependency: [while], data = [none]
// Check for an odd number of parameters.
if (curParam == null) {
return false; // depends on control dependency: [if], data = [none]
}
curParam = curParam.getNext(); // depends on control dependency: [while], data = [none]
}
return true;
} }
|
public class class_name {
public Element getChildElement(final int index) {
initChildElementNodes();
if ((index < 0) || (index >= childElementNodes.length)) {
return null;
}
return childElementNodes[index];
} }
|
public class class_name {
public Element getChildElement(final int index) {
initChildElementNodes();
if ((index < 0) || (index >= childElementNodes.length)) {
return null; // depends on control dependency: [if], data = [none]
}
return childElementNodes[index];
} }
|
public class class_name {
IConceptSet get(int concept) {
IConceptSet subsumes = set.get(concept);
if (null == subsumes) {
// A Concept always subsumes itself and TOP
subsumes = new SparseConceptSet();
subsumes.add(concept);
subsumes.add(IFactory.TOP_CONCEPT);
set.put(concept, subsumes);
size++;
}
return subsumes;
} }
|
public class class_name {
IConceptSet get(int concept) {
IConceptSet subsumes = set.get(concept);
if (null == subsumes) {
// A Concept always subsumes itself and TOP
subsumes = new SparseConceptSet();
// depends on control dependency: [if], data = [none]
subsumes.add(concept);
// depends on control dependency: [if], data = [none]
subsumes.add(IFactory.TOP_CONCEPT);
// depends on control dependency: [if], data = [none]
set.put(concept, subsumes);
// depends on control dependency: [if], data = [subsumes)]
size++;
// depends on control dependency: [if], data = [none]
}
return subsumes;
} }
|
public class class_name {
public static BufferedImage imgCompressByWH(InputStream srcStream, int width, int height, Float quality,
boolean isForceWh) {
BufferedImage bufferedImage = null;
try {
bufferedImage = ImgCompressUtils.imgCompressByWH(ImageIO.read(srcStream), width, height, quality, isForceWh);
} catch (Exception e) {
throw new RuntimeException(e);
}
return bufferedImage;
} }
|
public class class_name {
public static BufferedImage imgCompressByWH(InputStream srcStream, int width, int height, Float quality,
boolean isForceWh) {
BufferedImage bufferedImage = null;
try {
bufferedImage = ImgCompressUtils.imgCompressByWH(ImageIO.read(srcStream), width, height, quality, isForceWh); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return bufferedImage;
} }
|
public class class_name {
public static String aggregateScript(List<String> scriptNames, ClassLoader scriptLoader)
throws URISyntaxException, IOException {
final StringBuilder aggregatedScript = new StringBuilder();
for (String scriptName : scriptNames) {
String scriptNameWithExtension = format("%s.rpt", scriptName);
Path scriptPath = Paths.get(scriptNameWithExtension);
scriptNameWithExtension = URI.create(scriptNameWithExtension).normalize().getPath();
String script = null;
assert !scriptPath.isAbsolute();
// resolve relative scripts in local file system
if (scriptLoader != null) {
// resolve relative scripts from class loader to support
// separated specification projects that include Robot scripts only
URL resource = scriptLoader.getResource(scriptNameWithExtension);
if (resource != null) {
URI resourceURI = resource.toURI();
if ("file".equals(resourceURI.getScheme())) {
Path resourcePath = Paths.get(resourceURI);
script = readScript(resourcePath);
} else {
try (FileSystem fileSystem = newFileSystem(resourceURI, EMPTY_ENVIRONMENT)) {
Path resourcePath = Paths.get(resourceURI);
script = readScript(resourcePath);
}
}
}
}
if (script == null) {
throw new RuntimeException("Script not found: " + scriptPath);
}
aggregatedScript.append(script);
}
return aggregatedScript.toString();
} }
|
public class class_name {
public static String aggregateScript(List<String> scriptNames, ClassLoader scriptLoader)
throws URISyntaxException, IOException {
final StringBuilder aggregatedScript = new StringBuilder();
for (String scriptName : scriptNames) {
String scriptNameWithExtension = format("%s.rpt", scriptName);
Path scriptPath = Paths.get(scriptNameWithExtension);
scriptNameWithExtension = URI.create(scriptNameWithExtension).normalize().getPath();
String script = null;
assert !scriptPath.isAbsolute();
// resolve relative scripts in local file system
if (scriptLoader != null) {
// resolve relative scripts from class loader to support
// separated specification projects that include Robot scripts only
URL resource = scriptLoader.getResource(scriptNameWithExtension);
if (resource != null) {
URI resourceURI = resource.toURI();
if ("file".equals(resourceURI.getScheme())) {
Path resourcePath = Paths.get(resourceURI);
script = readScript(resourcePath); // depends on control dependency: [if], data = [none]
} else {
try (FileSystem fileSystem = newFileSystem(resourceURI, EMPTY_ENVIRONMENT)) {
Path resourcePath = Paths.get(resourceURI);
script = readScript(resourcePath); // depends on control dependency: [if], data = [none]
}
}
}
}
if (script == null) {
throw new RuntimeException("Script not found: " + scriptPath);
}
aggregatedScript.append(script);
}
return aggregatedScript.toString();
} }
|
public class class_name {
public CmsPair<List<CmsClientSitemapEntry>, List<CmsClientSitemapEntry>> getOpenAndClosedDescendants(String path) {
List<CmsClientSitemapEntry> descendants = m_controller.getLoadedDescendants(path);
List<CmsClientSitemapEntry> openDescendants = new ArrayList<CmsClientSitemapEntry>();
List<CmsClientSitemapEntry> closedDescendants = new ArrayList<CmsClientSitemapEntry>();
for (CmsClientSitemapEntry entry : descendants) {
CmsSitemapTreeItem treeItem = getTreeItem(entry.getSitePath());
List<CmsClientSitemapEntry> listToAddTo = treeItem.isLoaded() ? openDescendants : closedDescendants;
listToAddTo.add(entry);
}
return new CmsPair<List<CmsClientSitemapEntry>, List<CmsClientSitemapEntry>>(
openDescendants,
closedDescendants);
} }
|
public class class_name {
public CmsPair<List<CmsClientSitemapEntry>, List<CmsClientSitemapEntry>> getOpenAndClosedDescendants(String path) {
List<CmsClientSitemapEntry> descendants = m_controller.getLoadedDescendants(path);
List<CmsClientSitemapEntry> openDescendants = new ArrayList<CmsClientSitemapEntry>();
List<CmsClientSitemapEntry> closedDescendants = new ArrayList<CmsClientSitemapEntry>();
for (CmsClientSitemapEntry entry : descendants) {
CmsSitemapTreeItem treeItem = getTreeItem(entry.getSitePath());
List<CmsClientSitemapEntry> listToAddTo = treeItem.isLoaded() ? openDescendants : closedDescendants;
listToAddTo.add(entry); // depends on control dependency: [for], data = [entry]
}
return new CmsPair<List<CmsClientSitemapEntry>, List<CmsClientSitemapEntry>>(
openDescendants,
closedDescendants);
} }
|
public class class_name {
public <TColumn extends UserColumn> void createTable(
UserTable<TColumn> table) {
// Verify the table does not already exist
if (db.tableExists(table.getTableName())) {
throw new GeoPackageException(
"Table already exists and can not be created: "
+ table.getTableName());
}
// Build the create table sql
StringBuilder sql = new StringBuilder();
sql.append("CREATE TABLE ")
.append(CoreSQLUtils.quoteWrap(table.getTableName()))
.append(" (");
// Add each column to the sql
List<? extends UserColumn> columns = table.getColumns();
for (int i = 0; i < columns.size(); i++) {
UserColumn column = columns.get(i);
if (i > 0) {
sql.append(",");
}
sql.append("\n ").append(CoreSQLUtils.quoteWrap(column.getName()))
.append(" ").append(column.getTypeName());
if (column.getMax() != null) {
sql.append("(").append(column.getMax()).append(")");
}
if (column.isNotNull()) {
sql.append(" NOT NULL");
}
if (column.isPrimaryKey()) {
sql.append(" PRIMARY KEY AUTOINCREMENT");
}
}
// Add unique constraints
List<UserUniqueConstraint<TColumn>> uniqueConstraints = table
.getUniqueConstraints();
for (int i = 0; i < uniqueConstraints.size(); i++) {
UserUniqueConstraint<TColumn> uniqueConstraint = uniqueConstraints
.get(i);
sql.append(",\n UNIQUE (");
List<TColumn> uniqueColumns = uniqueConstraint.getColumns();
for (int j = 0; j < uniqueColumns.size(); j++) {
TColumn uniqueColumn = uniqueColumns.get(j);
if (j > 0) {
sql.append(", ");
}
sql.append(uniqueColumn.getName());
}
sql.append(")");
}
sql.append("\n);");
// Create the table
db.execSQL(sql.toString());
} }
|
public class class_name {
public <TColumn extends UserColumn> void createTable(
UserTable<TColumn> table) {
// Verify the table does not already exist
if (db.tableExists(table.getTableName())) {
throw new GeoPackageException(
"Table already exists and can not be created: "
+ table.getTableName());
}
// Build the create table sql
StringBuilder sql = new StringBuilder();
sql.append("CREATE TABLE ")
.append(CoreSQLUtils.quoteWrap(table.getTableName()))
.append(" (");
// Add each column to the sql
List<? extends UserColumn> columns = table.getColumns();
for (int i = 0; i < columns.size(); i++) {
UserColumn column = columns.get(i);
if (i > 0) {
sql.append(","); // depends on control dependency: [if], data = [none]
}
sql.append("\n ").append(CoreSQLUtils.quoteWrap(column.getName()))
.append(" ").append(column.getTypeName()); // depends on control dependency: [for], data = [none]
if (column.getMax() != null) {
sql.append("(").append(column.getMax()).append(")"); // depends on control dependency: [if], data = [(column.getMax()]
}
if (column.isNotNull()) {
sql.append(" NOT NULL"); // depends on control dependency: [if], data = [none]
}
if (column.isPrimaryKey()) {
sql.append(" PRIMARY KEY AUTOINCREMENT"); // depends on control dependency: [if], data = [none]
}
}
// Add unique constraints
List<UserUniqueConstraint<TColumn>> uniqueConstraints = table
.getUniqueConstraints();
for (int i = 0; i < uniqueConstraints.size(); i++) {
UserUniqueConstraint<TColumn> uniqueConstraint = uniqueConstraints
.get(i);
sql.append(",\n UNIQUE (");
List<TColumn> uniqueColumns = uniqueConstraint.getColumns(); // depends on control dependency: [for], data = [none]
for (int j = 0; j < uniqueColumns.size(); j++) {
TColumn uniqueColumn = uniqueColumns.get(j);
if (j > 0) {
sql.append(", "); // depends on control dependency: [if], data = [none]
}
sql.append(uniqueColumn.getName()); // depends on control dependency: [for], data = [none]
}
sql.append(")"); // depends on control dependency: [for], data = [none]
}
sql.append("\n);");
// Create the table
db.execSQL(sql.toString());
} }
|
public class class_name {
@Override
public Digest createDigestSHA1() {
try {
return new BCDigest(MessageDigest.getInstance("SHA1", "ZBC"));
} catch (GeneralSecurityException e) {
AndroidPlatform.getInstance().getLogger().logException(e.getMessage());
return null;
}
} }
|
public class class_name {
@Override
public Digest createDigestSHA1() {
try {
return new BCDigest(MessageDigest.getInstance("SHA1", "ZBC"));
// depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException e) {
AndroidPlatform.getInstance().getLogger().logException(e.getMessage());
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quotient) {
int n = b.intLen / 2; // half the length of b in ints
// step 1: view this as [a1,a2,a3] where each ai is n ints or less; let a12=[a1,a2]
MutableBigInteger a12 = new MutableBigInteger(this);
a12.safeRightShift(32*n);
// step 2: view b as [b1,b2] where each bi is n ints or less
MutableBigInteger b1 = new MutableBigInteger(b);
b1.safeRightShift(n * 32);
BigInteger b2 = b.getLower(n);
MutableBigInteger r;
MutableBigInteger d;
if (compareShifted(b, n) < 0) {
// step 3a: if a1<b1, let quotient=a12/b1 and r=a12%b1
r = a12.divide2n1n(b1, quotient);
// step 4: d=quotient*b2
d = new MutableBigInteger(quotient.toBigInteger().multiply(b2));
} else {
// step 3b: if a1>=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1
quotient.ones(n);
a12.add(b1);
b1.leftShift(32*n);
a12.subtract(b1);
r = a12;
// step 4: d=quotient*b2=(b2 << 32*n) - b2
d = new MutableBigInteger(b2);
d.leftShift(32 * n);
d.subtract(new MutableBigInteger(b2));
}
// step 5: r = r*beta^n + a3 - d (paper says a4)
// However, don't subtract d until after the while loop so r doesn't become negative
r.leftShift(32 * n);
r.addLower(this, n);
// step 6: add b until r>=d
while (r.compare(d) < 0) {
r.add(b);
quotient.subtract(MutableBigInteger.ONE);
}
r.subtract(d);
return r;
} }
|
public class class_name {
private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quotient) {
int n = b.intLen / 2; // half the length of b in ints
// step 1: view this as [a1,a2,a3] where each ai is n ints or less; let a12=[a1,a2]
MutableBigInteger a12 = new MutableBigInteger(this);
a12.safeRightShift(32*n);
// step 2: view b as [b1,b2] where each bi is n ints or less
MutableBigInteger b1 = new MutableBigInteger(b);
b1.safeRightShift(n * 32);
BigInteger b2 = b.getLower(n);
MutableBigInteger r;
MutableBigInteger d;
if (compareShifted(b, n) < 0) {
// step 3a: if a1<b1, let quotient=a12/b1 and r=a12%b1
r = a12.divide2n1n(b1, quotient); // depends on control dependency: [if], data = [none]
// step 4: d=quotient*b2
d = new MutableBigInteger(quotient.toBigInteger().multiply(b2)); // depends on control dependency: [if], data = [none]
} else {
// step 3b: if a1>=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1
quotient.ones(n); // depends on control dependency: [if], data = [none]
a12.add(b1); // depends on control dependency: [if], data = [none]
b1.leftShift(32*n); // depends on control dependency: [if], data = [none]
a12.subtract(b1); // depends on control dependency: [if], data = [none]
r = a12; // depends on control dependency: [if], data = [none]
// step 4: d=quotient*b2=(b2 << 32*n) - b2
d = new MutableBigInteger(b2); // depends on control dependency: [if], data = [none]
d.leftShift(32 * n); // depends on control dependency: [if], data = [none]
d.subtract(new MutableBigInteger(b2)); // depends on control dependency: [if], data = [none]
}
// step 5: r = r*beta^n + a3 - d (paper says a4)
// However, don't subtract d until after the while loop so r doesn't become negative
r.leftShift(32 * n);
r.addLower(this, n);
// step 6: add b until r>=d
while (r.compare(d) < 0) {
r.add(b); // depends on control dependency: [while], data = [none]
quotient.subtract(MutableBigInteger.ONE); // depends on control dependency: [while], data = [none]
}
r.subtract(d);
return r;
} }
|
public class class_name {
@Override
public boolean handleExecutionOutcome(
FlowExecutionOutcome outcome, ActionRequest request, ActionResponse response) {
if (this.redirectOnEnd != null) {
final String redirectPath = request.getContextPath() + this.redirectOnEnd;
try {
response.sendRedirect(redirectPath);
return true;
} catch (IOException e) {
this.logger.warn("Failed to send flow-end redirect to '" + redirectPath + "'");
}
}
return false;
} }
|
public class class_name {
@Override
public boolean handleExecutionOutcome(
FlowExecutionOutcome outcome, ActionRequest request, ActionResponse response) {
if (this.redirectOnEnd != null) {
final String redirectPath = request.getContextPath() + this.redirectOnEnd;
try {
response.sendRedirect(redirectPath); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
this.logger.warn("Failed to send flow-end redirect to '" + redirectPath + "'");
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public static List<Character> parserCharacterList(JsonPullParser parser) throws IOException,
JsonFormatException {
State eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
return null;
}
if (eventType != State.START_ARRAY) {
throw new IllegalStateException("not started brace!");
}
List<Character> list = new ArrayList<Character>();
while (parser.lookAhead() != State.END_ARRAY) {
eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
list.add(null);
} else if (eventType == State.VALUE_STRING) {
String str = parser.getValueString();
if (str.length() != 1) {
throw new IllegalStateException(
"unexpected value. expecte string size is 1. but get=" + str);
}
list.add(str.charAt(0));
} else {
throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
+ eventType.toString());
}
}
parser.getEventType();
return list;
} }
|
public class class_name {
public static List<Character> parserCharacterList(JsonPullParser parser) throws IOException,
JsonFormatException {
State eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
return null;
}
if (eventType != State.START_ARRAY) {
throw new IllegalStateException("not started brace!");
}
List<Character> list = new ArrayList<Character>();
while (parser.lookAhead() != State.END_ARRAY) {
eventType = parser.getEventType();
if (eventType == State.VALUE_NULL) {
list.add(null); // depends on control dependency: [if], data = [none]
} else if (eventType == State.VALUE_STRING) {
String str = parser.getValueString();
if (str.length() != 1) {
throw new IllegalStateException(
"unexpected value. expecte string size is 1. but get=" + str);
}
list.add(str.charAt(0)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
+ eventType.toString());
}
}
parser.getEventType();
return list;
} }
|
public class class_name {
public static boolean isMinValue(Progression model) {
if (model != null) {
return model.getValue() <= model.getMinimum();
}
return true;
} }
|
public class class_name {
public static boolean isMinValue(Progression model) {
if (model != null) {
return model.getValue() <= model.getMinimum(); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private void resolveAmbiguities(final ADTNode<ADTState<I, O>, I, O> nodeToReplace,
final ADTNode<ADTState<I, O>, I, O> newADS,
final ADTState<I, O> state,
final Set<ADTNode<ADTState<I, O>, I, O>> cachedLeaves) {
final Pair<Word<I>, Word<O>> parentTrace = ADTUtil.buildTraceForNode(nodeToReplace);
final Word<I> parentInput = parentTrace.getFirst();
final Word<I> effectiveAccessSequence = state.getAccessSequence().concat(parentInput);
this.oracle.reset();
effectiveAccessSequence.forEach(this.oracle::query);
ADTNode<ADTState<I, O>, I, O> iter = newADS;
while (!ADTUtil.isLeafNode(iter)) {
if (ADTUtil.isResetNode(iter)) {
this.oracle.reset();
state.getAccessSequence().forEach(this.oracle::query);
iter = iter.getChildren().values().iterator().next();
} else {
final O output = this.oracle.query(iter.getSymbol());
final ADTNode<ADTState<I, O>, I, O> succ = iter.getChildren().get(output);
if (succ == null) {
final ADTNode<ADTState<I, O>, I, O> newFinal = new ADTLeafNode<>(iter, state);
iter.getChildren().put(output, newFinal);
return;
}
iter = succ;
}
}
ADTNode<ADTState<I, O>, I, O> oldReference = null, newReference = null;
for (final ADTNode<ADTState<I, O>, I, O> leaf : cachedLeaves) {
final ADTState<I, O> hypState = leaf.getHypothesisState();
if (hypState.equals(iter.getHypothesisState())) {
oldReference = leaf;
} else if (hypState.equals(state)) {
newReference = leaf;
}
if (oldReference != null && newReference != null) {
break;
}
}
final LCAInfo<ADTState<I, O>, I, O> lcaResult = this.adt.findLCA(oldReference, newReference);
final ADTNode<ADTState<I, O>, I, O> lca = lcaResult.adtNode;
final Pair<Word<I>, Word<O>> lcaTrace = ADTUtil.buildTraceForNode(lca);
final Word<I> sepWord = lcaTrace.getFirst().append(lca.getSymbol());
final Word<O> oldOutputTrace = lcaTrace.getSecond().append(lcaResult.firstOutput);
final Word<O> newOutputTrace = lcaTrace.getSecond().append(lcaResult.secondOutput);
final ADTNode<ADTState<I, O>, I, O> oldTrace =
ADTUtil.buildADSFromObservation(sepWord, oldOutputTrace, iter.getHypothesisState());
final ADTNode<ADTState<I, O>, I, O> newTrace = ADTUtil.buildADSFromObservation(sepWord, newOutputTrace, state);
if (!ADTUtil.mergeADS(oldTrace, newTrace)) {
throw new IllegalStateException("Should never happen");
}
final ADTNode<ADTState<I, O>, I, O> reset = new ADTResetNode<>(oldTrace);
final O parentOutput = ADTUtil.getOutputForSuccessor(iter.getParent(), iter);
iter.getParent().getChildren().put(parentOutput, reset);
reset.setParent(iter.getParent());
oldTrace.setParent(reset);
} }
|
public class class_name {
private void resolveAmbiguities(final ADTNode<ADTState<I, O>, I, O> nodeToReplace,
final ADTNode<ADTState<I, O>, I, O> newADS,
final ADTState<I, O> state,
final Set<ADTNode<ADTState<I, O>, I, O>> cachedLeaves) {
final Pair<Word<I>, Word<O>> parentTrace = ADTUtil.buildTraceForNode(nodeToReplace);
final Word<I> parentInput = parentTrace.getFirst();
final Word<I> effectiveAccessSequence = state.getAccessSequence().concat(parentInput);
this.oracle.reset();
effectiveAccessSequence.forEach(this.oracle::query);
ADTNode<ADTState<I, O>, I, O> iter = newADS;
while (!ADTUtil.isLeafNode(iter)) {
if (ADTUtil.isResetNode(iter)) {
this.oracle.reset(); // depends on control dependency: [if], data = [none]
state.getAccessSequence().forEach(this.oracle::query); // depends on control dependency: [if], data = [none]
iter = iter.getChildren().values().iterator().next(); // depends on control dependency: [if], data = [none]
} else {
final O output = this.oracle.query(iter.getSymbol());
final ADTNode<ADTState<I, O>, I, O> succ = iter.getChildren().get(output);
if (succ == null) {
final ADTNode<ADTState<I, O>, I, O> newFinal = new ADTLeafNode<>(iter, state);
iter.getChildren().put(output, newFinal); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
iter = succ; // depends on control dependency: [if], data = [none]
}
}
ADTNode<ADTState<I, O>, I, O> oldReference = null, newReference = null;
for (final ADTNode<ADTState<I, O>, I, O> leaf : cachedLeaves) {
final ADTState<I, O> hypState = leaf.getHypothesisState();
if (hypState.equals(iter.getHypothesisState())) {
oldReference = leaf; // depends on control dependency: [if], data = [none]
} else if (hypState.equals(state)) {
newReference = leaf; // depends on control dependency: [if], data = [none]
}
if (oldReference != null && newReference != null) {
break;
}
}
final LCAInfo<ADTState<I, O>, I, O> lcaResult = this.adt.findLCA(oldReference, newReference);
final ADTNode<ADTState<I, O>, I, O> lca = lcaResult.adtNode;
final Pair<Word<I>, Word<O>> lcaTrace = ADTUtil.buildTraceForNode(lca);
final Word<I> sepWord = lcaTrace.getFirst().append(lca.getSymbol());
final Word<O> oldOutputTrace = lcaTrace.getSecond().append(lcaResult.firstOutput);
final Word<O> newOutputTrace = lcaTrace.getSecond().append(lcaResult.secondOutput);
final ADTNode<ADTState<I, O>, I, O> oldTrace =
ADTUtil.buildADSFromObservation(sepWord, oldOutputTrace, iter.getHypothesisState());
final ADTNode<ADTState<I, O>, I, O> newTrace = ADTUtil.buildADSFromObservation(sepWord, newOutputTrace, state);
if (!ADTUtil.mergeADS(oldTrace, newTrace)) {
throw new IllegalStateException("Should never happen");
}
final ADTNode<ADTState<I, O>, I, O> reset = new ADTResetNode<>(oldTrace);
final O parentOutput = ADTUtil.getOutputForSuccessor(iter.getParent(), iter);
iter.getParent().getChildren().put(parentOutput, reset);
reset.setParent(iter.getParent());
oldTrace.setParent(reset);
} }
|
public class class_name {
public void setWorldClip(Rectangle clip) {
if (clip == null) {
clearWorldClip();
} else {
setWorldClip(clip.getX(), clip.getY(), clip.getWidth(), clip
.getHeight());
}
} }
|
public class class_name {
public void setWorldClip(Rectangle clip) {
if (clip == null) {
clearWorldClip();
// depends on control dependency: [if], data = [none]
} else {
setWorldClip(clip.getX(), clip.getY(), clip.getWidth(), clip
.getHeight());
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Method analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, descriptor.getClassDescriptor());
Method[] methodList = jclass.getMethods();
Method result = null;
// As a side-effect, cache all of the Methods for this JavaClass
for (Method method : methodList) {
MethodDescriptor methodDescriptor = DescriptorFactory.instance().getMethodDescriptor(
descriptor.getSlashedClassName(), method.getName(), method.getSignature(), method.isStatic());
// Put in cache eagerly
analysisCache.eagerlyPutMethodAnalysis(Method.class, methodDescriptor, method);
if (methodDescriptor.equals(descriptor)) {
result = method;
}
}
return result;
} }
|
public class class_name {
@Override
public Method analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, descriptor.getClassDescriptor());
Method[] methodList = jclass.getMethods();
Method result = null;
// As a side-effect, cache all of the Methods for this JavaClass
for (Method method : methodList) {
MethodDescriptor methodDescriptor = DescriptorFactory.instance().getMethodDescriptor(
descriptor.getSlashedClassName(), method.getName(), method.getSignature(), method.isStatic());
// Put in cache eagerly
analysisCache.eagerlyPutMethodAnalysis(Method.class, methodDescriptor, method);
if (methodDescriptor.equals(descriptor)) {
result = method; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public void processExports(AModuleModules m)
{
if (m.getExports() != null)
{
m.getExportdefs().clear();
if (!m.getIsDLModule())
{
m.getExportdefs().addAll(getDefinitions(m.getExports(), m.getDefs()));
} else
{
m.getExportdefs().addAll(getDefinitions(m.getExports()));
}
}
} }
|
public class class_name {
public void processExports(AModuleModules m)
{
if (m.getExports() != null)
{
m.getExportdefs().clear(); // depends on control dependency: [if], data = [none]
if (!m.getIsDLModule())
{
m.getExportdefs().addAll(getDefinitions(m.getExports(), m.getDefs())); // depends on control dependency: [if], data = [none]
} else
{
m.getExportdefs().addAll(getDefinitions(m.getExports())); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Rectangle2D getBoundingBox() {
Dimension glyphDimension = getMetrics().getGlyphDimension(getNotationContext());
if (isStemUp()) {
return new Rectangle2D.Double(
(int)(getBase().getX()),
stemYEnd,
getWidth(),
getStemBeginPosition().getY()-stemYEnd+glyphDimension.getHeight()/2);
}
else {
return new Rectangle2D.Double(
(int)(getBase().getX()),
getStemBeginPosition().getY()-glyphDimension.getHeight()/2,
getWidth(),
stemYEnd-getStemBeginPosition().getY()+1+glyphDimension.getHeight()/2);
}
} }
|
public class class_name {
public Rectangle2D getBoundingBox() {
Dimension glyphDimension = getMetrics().getGlyphDimension(getNotationContext());
if (isStemUp()) {
return new Rectangle2D.Double(
(int)(getBase().getX()),
stemYEnd,
getWidth(),
getStemBeginPosition().getY()-stemYEnd+glyphDimension.getHeight()/2);
// depends on control dependency: [if], data = [none]
}
else {
return new Rectangle2D.Double(
(int)(getBase().getX()),
getStemBeginPosition().getY()-glyphDimension.getHeight()/2,
getWidth(),
stemYEnd-getStemBeginPosition().getY()+1+glyphDimension.getHeight()/2);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private <T> T getTyped(PropertyKey key, AiTextureType type, int index,
Class<T> clazz) {
Property p = getProperty(key.m_key, AiTextureType.toRawValue(type),
index);
if (null == p || null == p.getData()) {
return clazz.cast(m_defaults.get(key));
}
return clazz.cast(p.getData());
} }
|
public class class_name {
private <T> T getTyped(PropertyKey key, AiTextureType type, int index,
Class<T> clazz) {
Property p = getProperty(key.m_key, AiTextureType.toRawValue(type),
index);
if (null == p || null == p.getData()) {
return clazz.cast(m_defaults.get(key)); // depends on control dependency: [if], data = [none]
}
return clazz.cast(p.getData());
} }
|
public class class_name {
protected void computePij(DBIDRange ids, KNNQuery<?> knnq, boolean square, int numberOfNeighbours, double[][] pij, int[][] indices, double initialScale) {
Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.neighborspijmatrix").begin() : null;
final double logPerp = FastMath.log(perplexity);
// Scratch arrays, resizable
DoubleArray dists = new DoubleArray(numberOfNeighbours + 10);
IntegerArray inds = new IntegerArray(numberOfNeighbours + 10);
// Compute nearest-neighbor sparse affinity matrix
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Finding neighbors and optimizing perplexity", ids.size(), LOG) : null;
MeanVariance mv = LOG.isStatistics() ? new MeanVariance() : null;
Mean mid = LOG.isStatistics() ? new Mean() : null;
for(DBIDArrayIter ix = ids.iter(); ix.valid(); ix.advance()) {
dists.clear();
inds.clear();
KNNList neighbours = knnq.getKNNForDBID(ix, numberOfNeighbours + 1);
convertNeighbors(ids, ix, square, neighbours, dists, inds, mid);
double beta = computeSigma(ix.getOffset(), dists, perplexity, logPerp, //
pij[ix.getOffset()] = new double[dists.size()]);
if(mv != null) {
mv.put(beta > 0 ? FastMath.sqrt(.5 / beta) : 0.); // Sigma
}
indices[ix.getOffset()] = inds.toArray();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
if(mid != null) {
LOG.statistics(new DoubleStatistic(getClass() + ".average-original-id", mid.getMean()));
}
// Sum of the sparse affinity matrix:
double sum = 0.;
for(int i = 0; i < pij.length; i++) {
final double[] pij_i = pij[i];
for(int offi = 0; offi < pij_i.length; offi++) {
int j = indices[i][offi];
if(j > i) {
continue; // Exploit symmetry.
}
assert (i != j);
int offj = containsIndex(indices[j], i);
if(offj >= 0) { // Found
sum += FastMath.sqrt(pij_i[offi] * pij[j][offj]);
}
}
}
final double scale = initialScale / (2 * sum);
for(int i = 0; i < pij.length; i++) {
final double[] pij_i = pij[i];
for(int offi = 0; offi < pij_i.length; offi++) {
int j = indices[i][offi];
assert (i != j);
int offj = containsIndex(indices[j], i);
if(offj >= 0) { // Found
assert (indices[j][offj] == i);
// Exploit symmetry:
if(i < j) {
final double val = FastMath.sqrt(pij_i[offi] * pij[j][offj]); // Symmetrize
pij_i[offi] = pij[j][offj] = MathUtil.max(val * scale, MIN_PIJ);
}
}
else { // Not found, so zero.
pij_i[offi] = 0;
}
}
}
if(LOG.isStatistics()) { // timer != null, mv != null
LOG.statistics(timer.end());
LOG.statistics(new DoubleStatistic(NearestNeighborAffinityMatrixBuilder.class.getName() + ".sigma.average", mv.getMean()));
LOG.statistics(new DoubleStatistic(NearestNeighborAffinityMatrixBuilder.class.getName() + ".sigma.stddev", mv.getSampleStddev()));
}
} }
|
public class class_name {
protected void computePij(DBIDRange ids, KNNQuery<?> knnq, boolean square, int numberOfNeighbours, double[][] pij, int[][] indices, double initialScale) {
Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.neighborspijmatrix").begin() : null;
final double logPerp = FastMath.log(perplexity);
// Scratch arrays, resizable
DoubleArray dists = new DoubleArray(numberOfNeighbours + 10);
IntegerArray inds = new IntegerArray(numberOfNeighbours + 10);
// Compute nearest-neighbor sparse affinity matrix
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Finding neighbors and optimizing perplexity", ids.size(), LOG) : null;
MeanVariance mv = LOG.isStatistics() ? new MeanVariance() : null;
Mean mid = LOG.isStatistics() ? new Mean() : null;
for(DBIDArrayIter ix = ids.iter(); ix.valid(); ix.advance()) {
dists.clear();
inds.clear();
KNNList neighbours = knnq.getKNNForDBID(ix, numberOfNeighbours + 1);
convertNeighbors(ids, ix, square, neighbours, dists, inds, mid);
double beta = computeSigma(ix.getOffset(), dists, perplexity, logPerp, //
pij[ix.getOffset()] = new double[dists.size()]);
if(mv != null) {
mv.put(beta > 0 ? FastMath.sqrt(.5 / beta) : 0.); // Sigma
}
indices[ix.getOffset()] = inds.toArray();
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
if(mid != null) {
LOG.statistics(new DoubleStatistic(getClass() + ".average-original-id", mid.getMean()));
}
// Sum of the sparse affinity matrix:
double sum = 0.;
for(int i = 0; i < pij.length; i++) {
final double[] pij_i = pij[i];
for(int offi = 0; offi < pij_i.length; offi++) {
int j = indices[i][offi];
if(j > i) {
continue; // Exploit symmetry.
}
assert (i != j); // depends on control dependency: [for], data = [none]
int offj = containsIndex(indices[j], i);
if(offj >= 0) { // Found
sum += FastMath.sqrt(pij_i[offi] * pij[j][offj]); // depends on control dependency: [if], data = [none]
}
}
}
final double scale = initialScale / (2 * sum);
for(int i = 0; i < pij.length; i++) {
final double[] pij_i = pij[i];
for(int offi = 0; offi < pij_i.length; offi++) {
int j = indices[i][offi];
assert (i != j);
int offj = containsIndex(indices[j], i);
if(offj >= 0) { // Found
assert (indices[j][offj] == i);
// Exploit symmetry:
if(i < j) {
final double val = FastMath.sqrt(pij_i[offi] * pij[j][offj]); // Symmetrize
pij_i[offi] = pij[j][offj] = MathUtil.max(val * scale, MIN_PIJ);
}
}
else { // Not found, so zero.
pij_i[offi] = 0;
}
}
}
if(LOG.isStatistics()) { // timer != null, mv != null
LOG.statistics(timer.end());
LOG.statistics(new DoubleStatistic(NearestNeighborAffinityMatrixBuilder.class.getName() + ".sigma.average", mv.getMean()));
LOG.statistics(new DoubleStatistic(NearestNeighborAffinityMatrixBuilder.class.getName() + ".sigma.stddev", mv.getSampleStddev()));
}
} }
|
public class class_name {
@VisibleForTesting
@Nullable
public Instance getInstance(ResourceID resourceId) {
for (Instance instance : allInstances) {
if (Objects.equals(resourceId, instance.getTaskManagerID())) {
return instance;
}
}
return null;
} }
|
public class class_name {
@VisibleForTesting
@Nullable
public Instance getInstance(ResourceID resourceId) {
for (Instance instance : allInstances) {
if (Objects.equals(resourceId, instance.getTaskManagerID())) {
return instance; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static ExternalSessionKey fromWebDriverRequest(String path) {
int sessionIndex = path.indexOf("/session/");
if (sessionIndex != -1) {
sessionIndex += "/session/".length();
int nextSlash = path.indexOf("/", sessionIndex);
String session;
if (nextSlash != -1) {
session = path.substring(sessionIndex, nextSlash);
} else {
session = path.substring(sessionIndex, path.length());
}
if ("".equals(session)) {
return null;
}
return new ExternalSessionKey(session);
}
return null;
} }
|
public class class_name {
public static ExternalSessionKey fromWebDriverRequest(String path) {
int sessionIndex = path.indexOf("/session/");
if (sessionIndex != -1) {
sessionIndex += "/session/".length(); // depends on control dependency: [if], data = [none]
int nextSlash = path.indexOf("/", sessionIndex);
String session;
if (nextSlash != -1) {
session = path.substring(sessionIndex, nextSlash); // depends on control dependency: [if], data = [none]
} else {
session = path.substring(sessionIndex, path.length()); // depends on control dependency: [if], data = [none]
}
if ("".equals(session)) {
return null; // depends on control dependency: [if], data = [none]
}
return new ExternalSessionKey(session); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override
protected void initialize(boolean reactivate) // d367572
throws RemoteException, InvocationTargetException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "initialize");
}
passivator = container.passivator;
state = PRE_CREATE;
// d367572.1 start
BeanMetaData bmd = home.beanMetaData;
ivSfFailoverClient = bmd.ivSfFailoverClient; //LIDB2018-1
EJSDeployedSupport methodContext = null;
// Activating or Creating a new SFSB?
if (reactivate) {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "Initialize called for a passivated SFSB: " + this); // d367572.7
}
// Indicate the bean is being activated, not created...
// i.e. ejbActivate will be called, not ejbCreate. d159152
setState(ACTIVATING);
} else {
CallbackContextHelper contextHelper = null;
try {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "Initialize called for a new SFSB: " + this); // d367572.7
}
// d515803
if (bmd.ivHasCMExtendedPersistenceContext) {
ivExPcContext = container.getEJBRuntime().getEJBJPAContainer().onCreate(bmd.j2eeName.toString(),
bmd.usesBeanManagedTx,
bmd.ivExPcPuIds,
bmd.ivJpaPuIdSTUnsyncSet);
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Extended PC = " + ivExPcContext);
// Note that the local transaction surrounds injection methods and
// PostConstruct lifecycle callbacks.
contextHelper = new CallbackContextHelper(this); //528073, d578360
contextHelper.begin(CallbackContextHelper.Tx.CompatLTC,
CallbackContextHelper.Contexts.CallbackBean);
// Save the BeanO being created in the method context for
// extended-scoped persistence context management. The ExPc of the
// bean being created may need to be inherited by any SF beans that
// are created during injection. d515803
methodContext = EJSContainer.getMethodContext();
if (methodContext != null)
methodContext.ivCreateBeanO = this;
// F743-21481
// Moved the creation/injection of the interceptor classes after the
// methodContext work done directly above, because the comment on it
// implies this must be done before interceptor classes are injected.
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
createInterceptorsAndInstance(contextHelper);
// Now set the SessionContext and/or do the dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this);
//------------------------------------------------------------------
// Stateful session beans need to have their id's set here so that
// the wrapper is valid if ejbCreate() or PostConstruct calls
// getEJBObject() or getBusinessObject().
// Note: if activating, caller will set the correct id. d451399
//------------------------------------------------------------------
setId(new BeanId(home, EJSContainer.sessionKeyFactory.create(), false));
ivTimeoutElement = new TimeoutElement(beanId, getSessionTimeoutInMilliSeconds()); // F61004.5
// Directly create the wrapper so we can cache bean<->wrapper.
// Stateful beans are created with a unique primary key, so they
// should not exist in the wrapper cache at this point. However,
// a call to getEJBObject, getEJBLocalObject, or getBusinessObject
// would cause the wrapper to be added to the cache, so we do this
// before calling the PostConstruct method. d729903
ivWrapperCommon = container.wrapperManager.createWrapper(this);
//------------------------------------------------------------------
// Now that the SessionContext is set and/or dependencies
// injection has occurred, change state to CREATING state to allow
// additional methods to be called by the ejbCreate or
// PostConstruct interceptor methods (e.g. getEJBObject).
// This ensures CMVC defect 70091 is not reintroduced.
//------------------------------------------------------------------
setState(CREATING); // d367572.4
// Determine the kind of life cycle callback to make if any. Note,
// if CallbackKind is SessionBean, then the generated ejbdeploy wrapper
// for a SFSB 1.x or 2.x bean will make the ejbCreate call and throw
// the correct exception when necessary. Therefore, this code does not
// need to handle that case.
if (imd != null && ivCallbackKind == CallbackKind.InvocationContext) {
boolean globalTx = isLifecycleCallbackGlobalTx(LifecycleInterceptorWrapper.MID_POST_CONSTRUCT);
if (globalTx) {
// Complete the local transaction used for injection.
// Null the field so that if complete() fails it won't
// be called again from the finally block.
CallbackContextHelper injectionContextHelper = contextHelper;
contextHelper = null;
injectionContextHelper.complete(true);
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "completed injection contexts, begin PostConstruct contexts");
// Begin the global transaction for the callback.
contextHelper = new CallbackContextHelper(this);
contextHelper.begin(CallbackContextHelper.Tx.Global,
CallbackContextHelper.Contexts.CallbackBean);
}
// This is a 3.x SFSB that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is at least 1
// PostConstruct interceptor.
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
callLifecycleInterceptors(proxies, LifecycleInterceptorWrapper.MID_POST_CONSTRUCT); // F743-1751
}
}
} // d367572.1 end
finally // d399469
{
//TODO: Jim, This code will need to change to account for
// the possibility of a "sticky" global tran (UserTransaction)
// that may have been started in the Callback methods when
// the BeanO is Bean-Managed.
// Clear the create beano if set above d515803
if (methodContext != null) {
methodContext.ivCreateBeanO = null;
}
// Resume the TX context if it was suspended.
if (contextHelper != null) // d399469
{
contextHelper.complete(true);
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "initialize"); // d367572.7
}
} }
|
public class class_name {
@Override
protected void initialize(boolean reactivate) // d367572
throws RemoteException, InvocationTargetException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "initialize");
}
passivator = container.passivator;
state = PRE_CREATE;
// d367572.1 start
BeanMetaData bmd = home.beanMetaData;
ivSfFailoverClient = bmd.ivSfFailoverClient; //LIDB2018-1
EJSDeployedSupport methodContext = null;
// Activating or Creating a new SFSB?
if (reactivate) {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "Initialize called for a passivated SFSB: " + this); // d367572.7 // depends on control dependency: [if], data = [none]
}
// Indicate the bean is being activated, not created...
// i.e. ejbActivate will be called, not ejbCreate. d159152
setState(ACTIVATING);
} else {
CallbackContextHelper contextHelper = null;
try {
if (isTraceOn && tc.isDebugEnabled()) {
Tr.debug(tc, "Initialize called for a new SFSB: " + this); // d367572.7 // depends on control dependency: [if], data = [none]
}
// d515803
if (bmd.ivHasCMExtendedPersistenceContext) {
ivExPcContext = container.getEJBRuntime().getEJBJPAContainer().onCreate(bmd.j2eeName.toString(),
bmd.usesBeanManagedTx,
bmd.ivExPcPuIds,
bmd.ivJpaPuIdSTUnsyncSet); // depends on control dependency: [if], data = [none]
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Extended PC = " + ivExPcContext);
// Note that the local transaction surrounds injection methods and
// PostConstruct lifecycle callbacks.
contextHelper = new CallbackContextHelper(this); //528073, d578360 // depends on control dependency: [try], data = [none]
contextHelper.begin(CallbackContextHelper.Tx.CompatLTC,
CallbackContextHelper.Contexts.CallbackBean); // depends on control dependency: [try], data = [none]
// Save the BeanO being created in the method context for
// extended-scoped persistence context management. The ExPc of the
// bean being created may need to be inherited by any SF beans that
// are created during injection. d515803
methodContext = EJSContainer.getMethodContext(); // depends on control dependency: [try], data = [none]
if (methodContext != null)
methodContext.ivCreateBeanO = this;
// F743-21481
// Moved the creation/injection of the interceptor classes after the
// methodContext work done directly above, because the comment on it
// implies this must be done before interceptor classes are injected.
InterceptorMetaData imd = bmd.ivInterceptorMetaData;
createInterceptorsAndInstance(contextHelper); // depends on control dependency: [try], data = [none]
// Now set the SessionContext and/or do the dependency injection.
// Note that dependency injection must occur while in PRE_CREATE state.
injectInstance(ivManagedObject, ivEjbInstance, this); // depends on control dependency: [try], data = [none]
//------------------------------------------------------------------
// Stateful session beans need to have their id's set here so that
// the wrapper is valid if ejbCreate() or PostConstruct calls
// getEJBObject() or getBusinessObject().
// Note: if activating, caller will set the correct id. d451399
//------------------------------------------------------------------
setId(new BeanId(home, EJSContainer.sessionKeyFactory.create(), false)); // depends on control dependency: [try], data = [none]
ivTimeoutElement = new TimeoutElement(beanId, getSessionTimeoutInMilliSeconds()); // F61004.5 // depends on control dependency: [try], data = [none]
// Directly create the wrapper so we can cache bean<->wrapper.
// Stateful beans are created with a unique primary key, so they
// should not exist in the wrapper cache at this point. However,
// a call to getEJBObject, getEJBLocalObject, or getBusinessObject
// would cause the wrapper to be added to the cache, so we do this
// before calling the PostConstruct method. d729903
ivWrapperCommon = container.wrapperManager.createWrapper(this); // depends on control dependency: [try], data = [none]
//------------------------------------------------------------------
// Now that the SessionContext is set and/or dependencies
// injection has occurred, change state to CREATING state to allow
// additional methods to be called by the ejbCreate or
// PostConstruct interceptor methods (e.g. getEJBObject).
// This ensures CMVC defect 70091 is not reintroduced.
//------------------------------------------------------------------
setState(CREATING); // d367572.4 // depends on control dependency: [try], data = [none]
// Determine the kind of life cycle callback to make if any. Note,
// if CallbackKind is SessionBean, then the generated ejbdeploy wrapper
// for a SFSB 1.x or 2.x bean will make the ejbCreate call and throw
// the correct exception when necessary. Therefore, this code does not
// need to handle that case.
if (imd != null && ivCallbackKind == CallbackKind.InvocationContext) {
boolean globalTx = isLifecycleCallbackGlobalTx(LifecycleInterceptorWrapper.MID_POST_CONSTRUCT);
if (globalTx) {
// Complete the local transaction used for injection.
// Null the field so that if complete() fails it won't
// be called again from the finally block.
CallbackContextHelper injectionContextHelper = contextHelper;
contextHelper = null; // depends on control dependency: [if], data = [none]
injectionContextHelper.complete(true); // depends on control dependency: [if], data = [none]
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "completed injection contexts, begin PostConstruct contexts");
// Begin the global transaction for the callback.
contextHelper = new CallbackContextHelper(this); // depends on control dependency: [if], data = [none]
contextHelper.begin(CallbackContextHelper.Tx.Global,
CallbackContextHelper.Contexts.CallbackBean); // depends on control dependency: [if], data = [none]
}
// This is a 3.x SFSB that may have one or more PostConstruct interceptors
// methods. Invoke PostContruct interceptors if there is at least 1
// PostConstruct interceptor.
InterceptorProxy[] proxies = imd.ivPostConstructInterceptors;
if (proxies != null) {
callLifecycleInterceptors(proxies, LifecycleInterceptorWrapper.MID_POST_CONSTRUCT); // F743-1751 // depends on control dependency: [if], data = [(proxies]
}
}
} // d367572.1 end
finally // d399469
{
//TODO: Jim, This code will need to change to account for
// the possibility of a "sticky" global tran (UserTransaction)
// that may have been started in the Callback methods when
// the BeanO is Bean-Managed.
// Clear the create beano if set above d515803
if (methodContext != null) {
methodContext.ivCreateBeanO = null; // depends on control dependency: [if], data = [none]
}
// Resume the TX context if it was suspended.
if (contextHelper != null) // d399469
{
contextHelper.complete(true); // depends on control dependency: [if], data = [none]
}
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "initialize"); // d367572.7
}
} }
|
public class class_name {
private byte[] combineHashAndSalt(byte[] hash, byte[] salt) {
if (salt == null) {
return hash;
}
byte[] hashAndSalt = new byte[hash.length + salt.length];
System.arraycopy(hash, 0, hashAndSalt, 0, hash.length);
System.arraycopy(salt, 0, hashAndSalt, hash.length, salt.length);
return hashAndSalt;
} }
|
public class class_name {
private byte[] combineHashAndSalt(byte[] hash, byte[] salt) {
if (salt == null) {
return hash; // depends on control dependency: [if], data = [none]
}
byte[] hashAndSalt = new byte[hash.length + salt.length];
System.arraycopy(hash, 0, hashAndSalt, 0, hash.length);
System.arraycopy(salt, 0, hashAndSalt, hash.length, salt.length);
return hashAndSalt;
} }
|
public class class_name {
public T next() {
if(MapUtil.isEmpty(this.weightMap)) {
return null;
}
final double randomWeight = this.weightMap.lastKey() * random.nextDouble();
final SortedMap<Double, T> tailMap = this.weightMap.tailMap(randomWeight, false);
return this.weightMap.get(tailMap.firstKey());
} }
|
public class class_name {
public T next() {
if(MapUtil.isEmpty(this.weightMap)) {
return null;
// depends on control dependency: [if], data = [none]
}
final double randomWeight = this.weightMap.lastKey() * random.nextDouble();
final SortedMap<Double, T> tailMap = this.weightMap.tailMap(randomWeight, false);
return this.weightMap.get(tailMap.firstKey());
} }
|
public class class_name {
public void marshall(Application application, ProtocolMarshaller protocolMarshaller) {
if (application == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(application.getName(), NAME_BINDING);
protocolMarshaller.marshall(application.getDisplayName(), DISPLAYNAME_BINDING);
protocolMarshaller.marshall(application.getIconURL(), ICONURL_BINDING);
protocolMarshaller.marshall(application.getLaunchPath(), LAUNCHPATH_BINDING);
protocolMarshaller.marshall(application.getLaunchParameters(), LAUNCHPARAMETERS_BINDING);
protocolMarshaller.marshall(application.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(application.getMetadata(), METADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Application application, ProtocolMarshaller protocolMarshaller) {
if (application == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(application.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getDisplayName(), DISPLAYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getIconURL(), ICONURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getLaunchPath(), LAUNCHPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getLaunchParameters(), LAUNCHPARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getEnabled(), ENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(application.getMetadata(), METADATA_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 void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>();
// if is folder and if no versions left
boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/")
&& (readLastVersion(dbc, resource.getStructureId()) == 0);
// if the resource is a folder
if (isFolderAndNoVersionLeft) {
try {
conn = m_sqlManager.getConnection(dbc);
// get all direct subresources
stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES");
stmt.setString(1, resource.getStructureId().toString());
res = stmt.executeQuery();
while (res.next()) {
CmsUUID structureId = new CmsUUID(res.getString(1));
int version = res.getInt(2);
tmpSubResources.put(structureId, Integer.valueOf(version));
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
}
// delete all subresource versions
for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) {
I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue());
deleteEntries(dbc, histResource, 0, -1);
}
} }
|
public class class_name {
protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>();
// if is folder and if no versions left
boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/")
&& (readLastVersion(dbc, resource.getStructureId()) == 0);
// if the resource is a folder
if (isFolderAndNoVersionLeft) {
try {
conn = m_sqlManager.getConnection(dbc); // depends on control dependency: [try], data = [none]
// get all direct subresources
stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES"); // depends on control dependency: [try], data = [none]
stmt.setString(1, resource.getStructureId().toString()); // depends on control dependency: [try], data = [none]
res = stmt.executeQuery(); // depends on control dependency: [try], data = [none]
while (res.next()) {
CmsUUID structureId = new CmsUUID(res.getString(1));
int version = res.getInt(2);
tmpSubResources.put(structureId, Integer.valueOf(version)); // depends on control dependency: [while], data = [none]
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally { // depends on control dependency: [catch], data = [none]
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
}
// delete all subresource versions
for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) {
I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue());
deleteEntries(dbc, histResource, 0, -1);
}
} }
|
public class class_name {
private static int removeWhiteSpace(char[] data) {
if (data == null) {
return 0;
}
// count characters that's not whitespace
int newSize = 0;
int len = data.length;
for (int i = 0; i < len; i++) {
if (!isWhiteSpace(data[i])) {
data[newSize++] = data[i];
}
}
return newSize;
} }
|
public class class_name {
private static int removeWhiteSpace(char[] data) {
if (data == null) {
return 0; // depends on control dependency: [if], data = [none]
}
// count characters that's not whitespace
int newSize = 0;
int len = data.length;
for (int i = 0; i < len; i++) {
if (!isWhiteSpace(data[i])) {
data[newSize++] = data[i]; // depends on control dependency: [if], data = [none]
}
}
return newSize;
} }
|
public class class_name {
public static <T> Set<T> setOf(T... objects) {
if (objects == null || objects.length == 0) {
return Collections.emptySet();
}
return new HashSet<>(Arrays.asList(objects));
} }
|
public class class_name {
public static <T> Set<T> setOf(T... objects) {
if (objects == null || objects.length == 0) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
return new HashSet<>(Arrays.asList(objects));
} }
|
public class class_name {
public static ImageWriter getWriter(String formatName) {
ImageWriter writer = null;
Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(formatName);
if (iter.hasNext()) {
writer = iter.next();
}
if (null == writer) {
// 尝试扩展名获取
iter = ImageIO.getImageWritersBySuffix(formatName);
if (iter.hasNext()) {
writer = iter.next();
}
}
return writer;
} }
|
public class class_name {
public static ImageWriter getWriter(String formatName) {
ImageWriter writer = null;
Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(formatName);
if (iter.hasNext()) {
writer = iter.next();
// depends on control dependency: [if], data = [none]
}
if (null == writer) {
// 尝试扩展名获取
iter = ImageIO.getImageWritersBySuffix(formatName);
// depends on control dependency: [if], data = [none]
if (iter.hasNext()) {
writer = iter.next();
// depends on control dependency: [if], data = [none]
}
}
return writer;
} }
|
public class class_name {
public static <S extends Storable> OpenFilter<S> getOpenFilter(Class<S> type) {
SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type);
synchronized (filterCache) {
Filter<S> filter = filterCache.get(OPEN_KEY);
if (filter == null) {
filter = OpenFilter.getCanonical(type);
filterCache.put(OPEN_KEY, filter);
}
return (OpenFilter<S>) filter;
}
} }
|
public class class_name {
public static <S extends Storable> OpenFilter<S> getOpenFilter(Class<S> type) {
SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type);
synchronized (filterCache) {
Filter<S> filter = filterCache.get(OPEN_KEY);
if (filter == null) {
filter = OpenFilter.getCanonical(type);
// depends on control dependency: [if], data = [none]
filterCache.put(OPEN_KEY, filter);
// depends on control dependency: [if], data = [none]
}
return (OpenFilter<S>) filter;
}
} }
|
public class class_name {
public void put (int key, Object value)
{
int size = _keys.length, start = key % size, iidx = -1;
for (int ii = 0; ii < size; ii++) {
int idx = (ii + start) % size;
if (_keys[idx] == key) {
_values[idx] = value;
return;
} else if (iidx == -1 && _keys[idx] == -1) {
iidx = idx;
}
}
if (iidx != -1) {
_keys[iidx] = key;
_values[iidx] = value;
return;
}
// they booched it!
String errmsg = "You fool! You've filled up your cheap int map! " +
"[keys=" + StringUtil.toString(_keys) +
", values=" + StringUtil.toString(_values) + "]";
throw new RuntimeException(errmsg);
} }
|
public class class_name {
public void put (int key, Object value)
{
int size = _keys.length, start = key % size, iidx = -1;
for (int ii = 0; ii < size; ii++) {
int idx = (ii + start) % size;
if (_keys[idx] == key) {
_values[idx] = value; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (iidx == -1 && _keys[idx] == -1) {
iidx = idx; // depends on control dependency: [if], data = [none]
}
}
if (iidx != -1) {
_keys[iidx] = key; // depends on control dependency: [if], data = [none]
_values[iidx] = value; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// they booched it!
String errmsg = "You fool! You've filled up your cheap int map! " +
"[keys=" + StringUtil.toString(_keys) +
", values=" + StringUtil.toString(_values) + "]";
throw new RuntimeException(errmsg);
} }
|
public class class_name {
Method getSetter(Method getter) {
synchronized (setterCache) {
if ( !setterCache.containsKey(getter) ) {
String fieldName = ReflectionUtils.getFieldNameByGetter(getter, false);
String setterName = "set" + fieldName;
Method setter = null;
try {
setter = getter.getDeclaringClass().getMethod(setterName, getter.getReturnType());
} catch ( NoSuchMethodException e ) {
throw new DynamoDBMappingException("Expected a public, one-argument method called " + setterName
+ " on " + getter.getDeclaringClass(), e);
} catch ( SecurityException e ) {
throw new DynamoDBMappingException("No access to public, one-argument method called " + setterName
+ " on " + getter.getDeclaringClass(), e);
}
setterCache.put(getter, setter);
}
return setterCache.get(getter);
}
} }
|
public class class_name {
Method getSetter(Method getter) {
synchronized (setterCache) {
if ( !setterCache.containsKey(getter) ) {
String fieldName = ReflectionUtils.getFieldNameByGetter(getter, false);
String setterName = "set" + fieldName;
Method setter = null;
try {
setter = getter.getDeclaringClass().getMethod(setterName, getter.getReturnType()); // depends on control dependency: [try], data = [none]
} catch ( NoSuchMethodException e ) {
throw new DynamoDBMappingException("Expected a public, one-argument method called " + setterName
+ " on " + getter.getDeclaringClass(), e);
} catch ( SecurityException e ) { // depends on control dependency: [catch], data = [none]
throw new DynamoDBMappingException("No access to public, one-argument method called " + setterName
+ " on " + getter.getDeclaringClass(), e);
} // depends on control dependency: [catch], data = [none]
setterCache.put(getter, setter); // depends on control dependency: [if], data = [none]
}
return setterCache.get(getter);
}
} }
|
public class class_name {
private List<FieldValidator>
lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties(
List<ValidatorMetaData> validationMetaDataList ) {
List<FieldValidator> validatorsList = new ArrayList<>();
/*
* Look up the crank validators and then apply the properties from the
* validationMetaData to them.
*/
for ( ValidatorMetaData validationMetaData : validationMetaDataList ) {
/* Look up the FieldValidator. */
FieldValidator validator = lookupValidatorInRegistry(
validationMetaData
.getName() );
/*
* Apply the properties from the validationMetaData to the
* validator.
*/
applyValidationMetaDataPropertiesToValidator( validationMetaData,
validator );
validatorsList.add( validator );
}
return validatorsList;
} }
|
public class class_name {
private List<FieldValidator>
lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties(
List<ValidatorMetaData> validationMetaDataList ) {
List<FieldValidator> validatorsList = new ArrayList<>();
/*
* Look up the crank validators and then apply the properties from the
* validationMetaData to them.
*/
for ( ValidatorMetaData validationMetaData : validationMetaDataList ) {
/* Look up the FieldValidator. */
FieldValidator validator = lookupValidatorInRegistry(
validationMetaData
.getName() );
/*
* Apply the properties from the validationMetaData to the
* validator.
*/
applyValidationMetaDataPropertiesToValidator( validationMetaData,
validator ); // depends on control dependency: [for], data = [none]
validatorsList.add( validator ); // depends on control dependency: [for], data = [none]
}
return validatorsList;
} }
|
public class class_name {
private ExecutionMessage createPendingExecutionMessage(Execution nextStepExecution) {
// Take care of worker group
String groupName = nextStepExecution.getGroupName();
if (groupName == null) {
groupName = WorkerNode.DEFAULT_WORKER_GROUPS[0];
}
return new ExecutionMessage(ExecutionMessage.EMPTY_EXEC_STATE_ID,
ExecutionMessage.EMPTY_WORKER,
groupName,
executionMessage.getMsgId(),
ExecStatus.PENDING,
converter.createPayload(nextStepExecution),
0).setWorkerKey(executionMessage.getWorkerKey());
} }
|
public class class_name {
private ExecutionMessage createPendingExecutionMessage(Execution nextStepExecution) {
// Take care of worker group
String groupName = nextStepExecution.getGroupName();
if (groupName == null) {
groupName = WorkerNode.DEFAULT_WORKER_GROUPS[0]; // depends on control dependency: [if], data = [none]
}
return new ExecutionMessage(ExecutionMessage.EMPTY_EXEC_STATE_ID,
ExecutionMessage.EMPTY_WORKER,
groupName,
executionMessage.getMsgId(),
ExecStatus.PENDING,
converter.createPayload(nextStepExecution),
0).setWorkerKey(executionMessage.getWorkerKey());
} }
|
public class class_name {
@Override
public Collection<DependencyInfo> parse(File file) {
BufferedReader br = null;
FileReader fr = null;
Collection<DependencyInfo> dependencyInfos = new LinkedList<>();
try {
fr = new FileReader(file.getAbsoluteFile());
br = new BufferedReader(fr);
String line = null;
Package packageInfo = new Package();
// Create Alpine package - package-version-architecture.apk
while ((line = br.readLine()) != null) {
if (!line.isEmpty()) {
if (packageInfo.getPackageName() == null || packageInfo.getVersion() == null || packageInfo.getArchitecture() == null) {
String[] lineSplit = line.split(Constants.COLON);
String dependencyParameter = lineSplit[1].trim();
switch (lineSplit[0]) {
case PACKAGE:
packageInfo.setPackageName(dependencyParameter);
break;
case VERSION:
packageInfo.setVersion(dependencyParameter);
break;
case ARCHITECTURE:
packageInfo.setArchitecture(dependencyParameter);
break;
default:
break;
}
}
} else {
DependencyInfo dependencyInfo = createDependencyInfo(packageInfo);
packageInfo = new Package();
dependencyInfos.add(dependencyInfo);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
logger.debug("{}", e.getStackTrace());
} finally {
closeStream(br, fr);
}
return dependencyInfos;
} }
|
public class class_name {
@Override
public Collection<DependencyInfo> parse(File file) {
BufferedReader br = null;
FileReader fr = null;
Collection<DependencyInfo> dependencyInfos = new LinkedList<>();
try {
fr = new FileReader(file.getAbsoluteFile()); // depends on control dependency: [try], data = [none]
br = new BufferedReader(fr); // depends on control dependency: [try], data = [none]
String line = null;
Package packageInfo = new Package();
// Create Alpine package - package-version-architecture.apk
while ((line = br.readLine()) != null) {
if (!line.isEmpty()) {
if (packageInfo.getPackageName() == null || packageInfo.getVersion() == null || packageInfo.getArchitecture() == null) {
String[] lineSplit = line.split(Constants.COLON);
String dependencyParameter = lineSplit[1].trim();
switch (lineSplit[0]) {
case PACKAGE:
packageInfo.setPackageName(dependencyParameter); // depends on control dependency: [if], data = [none]
break;
case VERSION:
packageInfo.setVersion(dependencyParameter); // depends on control dependency: [if], data = [none]
break;
case ARCHITECTURE:
packageInfo.setArchitecture(dependencyParameter); // depends on control dependency: [if], data = [none]
break;
default:
break;
}
}
} else { // depends on control dependency: [try], data = [none]
DependencyInfo dependencyInfo = createDependencyInfo(packageInfo);
packageInfo = new Package();
dependencyInfos.add(dependencyInfo);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
logger.debug("{}", e.getStackTrace());
} finally { // depends on control dependency: [catch], data = [none]
closeStream(br, fr);
}
return dependencyInfos;
} }
|
public class class_name {
public java.util.List<MetricAlarm> getMetricAlarms() {
if (metricAlarms == null) {
metricAlarms = new com.amazonaws.internal.SdkInternalList<MetricAlarm>();
}
return metricAlarms;
} }
|
public class class_name {
public java.util.List<MetricAlarm> getMetricAlarms() {
if (metricAlarms == null) {
metricAlarms = new com.amazonaws.internal.SdkInternalList<MetricAlarm>(); // depends on control dependency: [if], data = [none]
}
return metricAlarms;
} }
|
public class class_name {
public void marshall(RegisterUsageRequest registerUsageRequest, ProtocolMarshaller protocolMarshaller) {
if (registerUsageRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerUsageRequest.getProductCode(), PRODUCTCODE_BINDING);
protocolMarshaller.marshall(registerUsageRequest.getPublicKeyVersion(), PUBLICKEYVERSION_BINDING);
protocolMarshaller.marshall(registerUsageRequest.getNonce(), NONCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RegisterUsageRequest registerUsageRequest, ProtocolMarshaller protocolMarshaller) {
if (registerUsageRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(registerUsageRequest.getProductCode(), PRODUCTCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerUsageRequest.getPublicKeyVersion(), PUBLICKEYVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(registerUsageRequest.getNonce(), NONCE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean checkPackageGroups(String groupname, String pkgNameFormList) {
String[] pkgPatterns = pkgNameFormList.split(":");
if (groupList.contains(groupname)) {
initMessages();
messages.warning("doclet.Groupname_already_used", groupname);
return false;
}
groupList.add(groupname);
for (String pkgPattern : pkgPatterns) {
if (pkgPattern.length() == 0) {
initMessages();
messages.warning("doclet.Error_in_grouplist", groupname, pkgNameFormList);
return false;
}
if (pkgPattern.endsWith("*")) {
pkgPattern = pkgPattern.substring(0, pkgPattern.length() - 1);
if (foundGroupFormat(regExpGroupMap, pkgPattern)) {
return false;
}
regExpGroupMap.put(pkgPattern, groupname);
sortedRegExpList.add(pkgPattern);
} else {
if (foundGroupFormat(elementNameGroupMap, pkgPattern)) {
return false;
}
elementNameGroupMap.put(pkgPattern, groupname);
}
}
Collections.sort(sortedRegExpList, new MapKeyComparator());
return true;
} }
|
public class class_name {
public boolean checkPackageGroups(String groupname, String pkgNameFormList) {
String[] pkgPatterns = pkgNameFormList.split(":");
if (groupList.contains(groupname)) {
initMessages(); // depends on control dependency: [if], data = [none]
messages.warning("doclet.Groupname_already_used", groupname); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
groupList.add(groupname);
for (String pkgPattern : pkgPatterns) {
if (pkgPattern.length() == 0) {
initMessages(); // depends on control dependency: [if], data = [none]
messages.warning("doclet.Error_in_grouplist", groupname, pkgNameFormList); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (pkgPattern.endsWith("*")) {
pkgPattern = pkgPattern.substring(0, pkgPattern.length() - 1); // depends on control dependency: [if], data = [none]
if (foundGroupFormat(regExpGroupMap, pkgPattern)) {
return false; // depends on control dependency: [if], data = [none]
}
regExpGroupMap.put(pkgPattern, groupname); // depends on control dependency: [if], data = [none]
sortedRegExpList.add(pkgPattern); // depends on control dependency: [if], data = [none]
} else {
if (foundGroupFormat(elementNameGroupMap, pkgPattern)) {
return false; // depends on control dependency: [if], data = [none]
}
elementNameGroupMap.put(pkgPattern, groupname); // depends on control dependency: [if], data = [none]
}
}
Collections.sort(sortedRegExpList, new MapKeyComparator());
return true;
} }
|
public class class_name {
public final String getIdColumnsString() {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < this.idColumnsNames.length; i++) {
if (i > 0) {
sb.append(",");
}
sb.append(this.idColumnsNames[i]);
}
return sb.toString();
} }
|
public class class_name {
public final String getIdColumnsString() {
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < this.idColumnsNames.length; i++) {
if (i > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
sb.append(this.idColumnsNames[i]); // depends on control dependency: [for], data = [i]
}
return sb.toString();
} }
|
public class class_name {
@Override
protected String initValuesImpl(final FieldCase c) {
double d = 0.0;
String v = source.initValues(c);
if (v != null && v.length() > 0) {
d = 0.0;
try {
Number n = format.parse(v);
d = n.doubleValue();
} catch (ParseException e) {
log.debug("Could not parse string " + v + " to a number; setting value 0.0");
}
}
d *= factor;
return format.format(d);
} }
|
public class class_name {
@Override
protected String initValuesImpl(final FieldCase c) {
double d = 0.0;
String v = source.initValues(c);
if (v != null && v.length() > 0) {
d = 0.0;
// depends on control dependency: [if], data = [none]
try {
Number n = format.parse(v);
d = n.doubleValue();
// depends on control dependency: [try], data = [none]
} catch (ParseException e) {
log.debug("Could not parse string " + v + " to a number; setting value 0.0");
}
// depends on control dependency: [catch], data = [none]
}
d *= factor;
return format.format(d);
} }
|
public class class_name {
@Restricted(DoNotUse.class)
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value, @AncestorInPath ItemGroup<?> container) {
AutoCompletionCandidates candidates = AutoCompletionCandidates.ofJobNames(TopLevelItem.class, value, container);
if (container instanceof DirectlyModifiableTopLevelItemGroup) {
DirectlyModifiableTopLevelItemGroup modifiableContainer = (DirectlyModifiableTopLevelItemGroup) container;
Iterator<String> it = candidates.getValues().iterator();
while (it.hasNext()) {
TopLevelItem item = Jenkins.getInstance().getItem(it.next(), container, TopLevelItem.class);
if (item == null) {
continue; // ?
}
if (!modifiableContainer.canAdd(item)) {
it.remove();
}
}
}
return candidates;
} }
|
public class class_name {
@Restricted(DoNotUse.class)
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value, @AncestorInPath ItemGroup<?> container) {
AutoCompletionCandidates candidates = AutoCompletionCandidates.ofJobNames(TopLevelItem.class, value, container);
if (container instanceof DirectlyModifiableTopLevelItemGroup) {
DirectlyModifiableTopLevelItemGroup modifiableContainer = (DirectlyModifiableTopLevelItemGroup) container;
Iterator<String> it = candidates.getValues().iterator();
while (it.hasNext()) {
TopLevelItem item = Jenkins.getInstance().getItem(it.next(), container, TopLevelItem.class);
if (item == null) {
continue; // ?
}
if (!modifiableContainer.canAdd(item)) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
return candidates;
} }
|
public class class_name {
public void printSummary() {
StringBuilder res = new StringBuilder();
res.append("Num. studies: ").append(variantMetadata.getStudies().size()).append("\n");
int counter, studyCounter = 0;
for (VariantStudyMetadata study: variantMetadata.getStudies()) {
studyCounter++;
res.append("\tStudy #").append(studyCounter).append(": ").append(study.getId()).append("\n");
res.append("\tNum. files: ").append(study.getFiles().size()).append("\n");
counter = 0;
for (VariantFileMetadata file: study.getFiles()) {
counter++;
res.append("\t\tFile #").append(counter).append(": ").append(file.getId());
res.append(" (").append(file.getSampleIds().size()).append(" samples)\n");
}
res.append("\tNum. cohorts: ").append(study.getCohorts().size()).append("\n");
counter = 0;
for (Cohort cohort: study.getCohorts()) {
counter++;
res.append("\t\tCohort #").append(counter).append(": ").append(cohort.getId());
res.append(" (").append(cohort.getSampleIds().size()).append(" samples)\n");
}
}
System.out.println(res.toString());
} }
|
public class class_name {
public void printSummary() {
StringBuilder res = new StringBuilder();
res.append("Num. studies: ").append(variantMetadata.getStudies().size()).append("\n");
int counter, studyCounter = 0;
for (VariantStudyMetadata study: variantMetadata.getStudies()) {
studyCounter++; // depends on control dependency: [for], data = [study]
res.append("\tStudy #").append(studyCounter).append(": ").append(study.getId()).append("\n"); // depends on control dependency: [for], data = [study]
res.append("\tNum. files: ").append(study.getFiles().size()).append("\n");
counter = 0; // depends on control dependency: [for], data = [none]
for (VariantFileMetadata file: study.getFiles()) {
counter++; // depends on control dependency: [for], data = [none]
res.append("\t\tFile #").append(counter).append(": ").append(file.getId()); // depends on control dependency: [for], data = [file]
res.append(" (").append(file.getSampleIds().size()).append(" samples)\n"); // depends on control dependency: [for], data = [file]
}
res.append("\tNum. cohorts: ").append(study.getCohorts().size()).append("\n");
counter = 0; // depends on control dependency: [for], data = [none]
for (Cohort cohort: study.getCohorts()) {
counter++; // depends on control dependency: [for], data = [none]
res.append("\t\tCohort #").append(counter).append(": ").append(cohort.getId()); // depends on control dependency: [for], data = [cohort]
res.append(" (").append(cohort.getSampleIds().size()).append(" samples)\n"); // depends on control dependency: [for], data = [cohort]
}
}
System.out.println(res.toString());
} }
|
public class class_name {
public boolean hasNextBigInteger(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = new BigInteger(s, radix);
} catch (NumberFormatException nfe) {
result = false;
}
}
return result;
} }
|
public class class_name {
public boolean hasNextBigInteger(int radix) {
setRadix(radix);
boolean result = hasNext(integerPattern());
if (result) { // Cache it
try {
String s = (matcher.group(SIMPLE_GROUP_INDEX) == null) ?
processIntegerToken(hasNextResult) :
hasNextResult;
typeCache = new BigInteger(s, radix); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
result = false;
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
public String getUserLastModifiedName(CmsObject cms) {
try {
return CmsPrincipal.readPrincipalIncludingHistory(cms, getUserLastModified()).getName();
} catch (CmsException e) {
return getUserLastModified().toString();
}
} }
|
public class class_name {
public String getUserLastModifiedName(CmsObject cms) {
try {
return CmsPrincipal.readPrincipalIncludingHistory(cms, getUserLastModified()).getName(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
return getUserLastModified().toString();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void stop() {
if (log != null) {
log.info("PETITE stop");
}
if (petiteContainer != null) {
petiteContainer.shutdown();
}
petiteContainer = null;
} }
|
public class class_name {
@Override
public void stop() {
if (log != null) {
log.info("PETITE stop"); // depends on control dependency: [if], data = [none]
}
if (petiteContainer != null) {
petiteContainer.shutdown(); // depends on control dependency: [if], data = [none]
}
petiteContainer = null;
} }
|
public class class_name {
public boolean contains(final Interval<T> i) {
int compareLow, compareUp;
compareLow = this.lowerBound.compareTo(i.lowerBound);
compareUp = this.upperBound.compareTo(i.upperBound);
if (compareLow < 0) {
// check the upper bound
if (compareUp > 0) {
return true;
} else if ((compareUp == 0) &&
(this.upperBoundClosed || !i.upperBoundClosed)) {
return true;
}
} else if (compareLow == 0) {
if (this.lowerBoundClosed || !i.lowerBoundClosed) { // lowerbound satisfied
{
// check upperbound
if (compareUp > 0) {
return true;
} else if ((compareUp == 0) &&
(this.upperBoundClosed || !i.upperBoundClosed)) {
return true;
}
}
}
}
return false;
} }
|
public class class_name {
public boolean contains(final Interval<T> i) {
int compareLow, compareUp;
compareLow = this.lowerBound.compareTo(i.lowerBound);
compareUp = this.upperBound.compareTo(i.upperBound);
if (compareLow < 0) {
// check the upper bound
if (compareUp > 0) {
return true; // depends on control dependency: [if], data = [none]
} else if ((compareUp == 0) &&
(this.upperBoundClosed || !i.upperBoundClosed)) {
return true; // depends on control dependency: [if], data = [none]
}
} else if (compareLow == 0) {
if (this.lowerBoundClosed || !i.lowerBoundClosed) { // lowerbound satisfied
{
// check upperbound
if (compareUp > 0) {
return true; // depends on control dependency: [if], data = [none]
} else if ((compareUp == 0) &&
(this.upperBoundClosed || !i.upperBoundClosed)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
return false;
} }
|
public class class_name {
public char[] toCharArray() {
final char[] b = new char[this.len];
if (this.len > 0) {
System.arraycopy(this.array, 0, b, 0, this.len);
}
return b;
} }
|
public class class_name {
public char[] toCharArray() {
final char[] b = new char[this.len];
if (this.len > 0) {
System.arraycopy(this.array, 0, b, 0, this.len); // depends on control dependency: [if], data = [none]
}
return b;
} }
|
public class class_name {
public void setInputArtifacts(java.util.Collection<Artifact> inputArtifacts) {
if (inputArtifacts == null) {
this.inputArtifacts = null;
return;
}
this.inputArtifacts = new java.util.ArrayList<Artifact>(inputArtifacts);
} }
|
public class class_name {
public void setInputArtifacts(java.util.Collection<Artifact> inputArtifacts) {
if (inputArtifacts == null) {
this.inputArtifacts = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.inputArtifacts = new java.util.ArrayList<Artifact>(inputArtifacts);
} }
|
public class class_name {
protected static void multTransABlockSet_lowerTriag( double[] dataA, double []dataB, double []dataC,
int indexA, int indexB, int indexC,
final int heightA, final int widthA, final int widthC) {
for( int i = 0; i < widthA; i++ ) {
for( int j = 0; j < widthC; j++ ) {
double val = i < heightA ? dataB[i*widthC + j + indexB] : 0;
for( int k = i+1; k < heightA; k++ ) {
val += dataA[k*widthA + i + indexA] * dataB[k*widthC + j + indexB];
}
dataC[ i*widthC + j + indexC ] = val;
}
}
} }
|
public class class_name {
protected static void multTransABlockSet_lowerTriag( double[] dataA, double []dataB, double []dataC,
int indexA, int indexB, int indexC,
final int heightA, final int widthA, final int widthC) {
for( int i = 0; i < widthA; i++ ) {
for( int j = 0; j < widthC; j++ ) {
double val = i < heightA ? dataB[i*widthC + j + indexB] : 0;
for( int k = i+1; k < heightA; k++ ) {
val += dataA[k*widthA + i + indexA] * dataB[k*widthC + j + indexB]; // depends on control dependency: [for], data = [k]
}
dataC[ i*widthC + j + indexC ] = val; // depends on control dependency: [for], data = [j]
}
}
} }
|
public class class_name {
public ODocument status() {
synchronized (listener) {
ODocument status = new ODocument();
status.field("cfg", cfg);
status.field("status", this.status);
String lastBatchLog = "";
if (this.messageHandler != null) {
lastBatchLog = extractBatchLog();
}
status.field("log", lastBatchLog);
if (this.status == Status.FINISHED) {
listener.notifyAll();
}
return status;
}
} }
|
public class class_name {
public ODocument status() {
synchronized (listener) {
ODocument status = new ODocument();
status.field("cfg", cfg);
status.field("status", this.status);
String lastBatchLog = "";
if (this.messageHandler != null) {
lastBatchLog = extractBatchLog(); // depends on control dependency: [if], data = [none]
}
status.field("log", lastBatchLog);
if (this.status == Status.FINISHED) {
listener.notifyAll(); // depends on control dependency: [if], data = [none]
}
return status;
}
} }
|
public class class_name {
public void clearPref() {
try {
((ClcJavaPreferenceStorage) modules.getPreferences()).getPref().clear();
} catch (BackingStoreException e) {
logger.error("Cannot clear preferences", e);
}
} }
|
public class class_name {
public void clearPref() {
try {
((ClcJavaPreferenceStorage) modules.getPreferences()).getPref().clear(); // depends on control dependency: [try], data = [none]
} catch (BackingStoreException e) {
logger.error("Cannot clear preferences", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressWarnings("static-access")
public static void main(String[] args) throws IOException {
Option configDirOpt = OptionBuilder.withArgName("config directory").hasArg().withDescription(
"Specify configuration directory.").create("configDir");
// tempDir option is used by the YARN client.
Option tempDir = OptionBuilder.withArgName("temporary directory (overwrites configured option)")
.hasArg().withDescription(
"Specify temporary directory.").create(ARG_CONF_DIR);
configDirOpt.setRequired(true);
tempDir.setRequired(false);
Options options = new Options();
options.addOption(configDirOpt);
options.addOption(tempDir);
CommandLineParser parser = new GnuParser();
CommandLine line = null;
try {
line = parser.parse(options, args);
} catch (ParseException e) {
System.err.println("CLI Parsing failed. Reason: " + e.getMessage());
System.exit(FAILURE_RETURN_CODE);
}
String configDir = line.getOptionValue(configDirOpt.getOpt(), null);
String tempDirVal = line.getOptionValue(tempDir.getOpt(), null);
// First, try to load global configuration
GlobalConfiguration.loadConfiguration(configDir);
if(tempDirVal != null // the YARN TM runner has set a value for the temp dir
// the configuration does not contain a temp direcory
&& GlobalConfiguration.getString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY, null) == null) {
Configuration c = GlobalConfiguration.getConfiguration();
c.setString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY, tempDirVal);
LOG.info("Setting temporary directory to "+tempDirVal);
GlobalConfiguration.includeConfiguration(c);
}
System.err.println("Configuration "+GlobalConfiguration.getConfiguration());
LOG.info("Current user "+UserGroupInformation.getCurrentUser().getShortUserName());
{
// log the available JVM memory
long maxMemoryMiBytes = Runtime.getRuntime().maxMemory() >>> 20;
LOG.info("Starting TaskManager in a JVM with " + maxMemoryMiBytes + " MiBytes maximum heap size.");
}
// Create a new task manager object
try {
new TaskManager();
} catch (Exception e) {
LOG.fatal("Taskmanager startup failed: " + e.getMessage(), e);
System.exit(FAILURE_RETURN_CODE);
}
// park the main thread to keep the JVM alive (all other threads may be daemon threads)
Object mon = new Object();
synchronized (mon) {
try {
mon.wait();
} catch (InterruptedException ex) {}
}
} }
|
public class class_name {
@SuppressWarnings("static-access")
public static void main(String[] args) throws IOException {
Option configDirOpt = OptionBuilder.withArgName("config directory").hasArg().withDescription(
"Specify configuration directory.").create("configDir");
// tempDir option is used by the YARN client.
Option tempDir = OptionBuilder.withArgName("temporary directory (overwrites configured option)")
.hasArg().withDescription(
"Specify temporary directory.").create(ARG_CONF_DIR);
configDirOpt.setRequired(true);
tempDir.setRequired(false);
Options options = new Options();
options.addOption(configDirOpt);
options.addOption(tempDir);
CommandLineParser parser = new GnuParser();
CommandLine line = null;
try {
line = parser.parse(options, args);
} catch (ParseException e) {
System.err.println("CLI Parsing failed. Reason: " + e.getMessage());
System.exit(FAILURE_RETURN_CODE);
}
String configDir = line.getOptionValue(configDirOpt.getOpt(), null);
String tempDirVal = line.getOptionValue(tempDir.getOpt(), null);
// First, try to load global configuration
GlobalConfiguration.loadConfiguration(configDir);
if(tempDirVal != null // the YARN TM runner has set a value for the temp dir
// the configuration does not contain a temp direcory
&& GlobalConfiguration.getString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY, null) == null) {
Configuration c = GlobalConfiguration.getConfiguration();
c.setString(ConfigConstants.TASK_MANAGER_TMP_DIR_KEY, tempDirVal);
LOG.info("Setting temporary directory to "+tempDirVal);
GlobalConfiguration.includeConfiguration(c);
}
System.err.println("Configuration "+GlobalConfiguration.getConfiguration());
LOG.info("Current user "+UserGroupInformation.getCurrentUser().getShortUserName());
{
// log the available JVM memory
long maxMemoryMiBytes = Runtime.getRuntime().maxMemory() >>> 20;
LOG.info("Starting TaskManager in a JVM with " + maxMemoryMiBytes + " MiBytes maximum heap size.");
}
// Create a new task manager object
try {
new TaskManager();
} catch (Exception e) {
LOG.fatal("Taskmanager startup failed: " + e.getMessage(), e);
System.exit(FAILURE_RETURN_CODE);
}
// park the main thread to keep the JVM alive (all other threads may be daemon threads)
Object mon = new Object();
synchronized (mon) {
try {
mon.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private void initEditorStates() {
m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>();
List<TableProperty> cols = null;
switch (m_bundleType) {
case PROPERTY:
case XML:
if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState());
if (hasMasterMode()) { // the bundle descriptor is editable
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState());
}
} else { // no bundle descriptor given - implies no master mode
cols = new ArrayList<TableProperty>(1);
cols.add(TableProperty.KEY);
cols.add(TableProperty.TRANSLATION);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
}
break;
case DESCRIPTOR:
cols = new ArrayList<TableProperty>(3);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
break;
default:
throw new IllegalArgumentException();
}
} }
|
public class class_name {
private void initEditorStates() {
m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>();
List<TableProperty> cols = null;
switch (m_bundleType) {
case PROPERTY:
case XML:
if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState()); // depends on control dependency: [if], data = [none]
if (hasMasterMode()) { // the bundle descriptor is editable
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState()); // depends on control dependency: [if], data = [none]
}
} else { // no bundle descriptor given - implies no master mode
cols = new ArrayList<TableProperty>(1); // depends on control dependency: [if], data = [none]
cols.add(TableProperty.KEY); // depends on control dependency: [if], data = [none]
cols.add(TableProperty.TRANSLATION); // depends on control dependency: [if], data = [none]
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true)); // depends on control dependency: [if], data = [none]
}
break;
case DESCRIPTOR:
cols = new ArrayList<TableProperty>(3);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
break;
default:
throw new IllegalArgumentException();
}
} }
|
public class class_name {
@Override
public Assignments<E> split(AbstractMTree<?, N, E, ?> tree, N node) {
final int n = node.getNumEntries();
double[][] distanceMatrix = computeDistanceMatrix(tree, node);
double miSumCR = Double.POSITIVE_INFINITY;
boolean leaf = node.isLeaf();
Assignments<E> bestAssignment = null;
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < n; j++) {
Assignments<E> currentAssignments = distributor.distribute(node, i, distanceMatrix[i], j, distanceMatrix[j]);
double maxCR = Math.max(currentAssignments.computeFirstCover(leaf), currentAssignments.computeSecondCover(leaf));
if(maxCR < miSumCR) {
miSumCR = maxCR;
bestAssignment = currentAssignments;
}
}
}
return bestAssignment;
} }
|
public class class_name {
@Override
public Assignments<E> split(AbstractMTree<?, N, E, ?> tree, N node) {
final int n = node.getNumEntries();
double[][] distanceMatrix = computeDistanceMatrix(tree, node);
double miSumCR = Double.POSITIVE_INFINITY;
boolean leaf = node.isLeaf();
Assignments<E> bestAssignment = null;
for(int i = 0; i < n; i++) {
for(int j = i + 1; j < n; j++) {
Assignments<E> currentAssignments = distributor.distribute(node, i, distanceMatrix[i], j, distanceMatrix[j]);
double maxCR = Math.max(currentAssignments.computeFirstCover(leaf), currentAssignments.computeSecondCover(leaf));
if(maxCR < miSumCR) {
miSumCR = maxCR; // depends on control dependency: [if], data = [none]
bestAssignment = currentAssignments; // depends on control dependency: [if], data = [none]
}
}
}
return bestAssignment;
} }
|
public class class_name {
public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
if (classPath == null) {
return null;
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t;
}
}
return null;
} }
|
public class class_name {
public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
if (classPath == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
PanelGrid panelGrid = (PanelGrid) component;
ResponseWriter writer = context.getResponseWriter();
boolean idHasBeenRendered=false;
String responsiveStyle= Responsive.getResponsiveStyleClass(panelGrid, false);
if (null != responsiveStyle) {
writer.startElement("div", panelGrid);
writer.writeAttribute("class", responsiveStyle.trim(), null);
String clientId = panelGrid.getClientId();
writer.writeAttribute("id", clientId, "id");
idHasBeenRendered=true;
}
generateContainerStart(writer, panelGrid, idHasBeenRendered);
beginDisabledFieldset(panelGrid, writer);
int[] columns = getColSpanArray(panelGrid);
String[] columnClasses = getColumnClasses(panelGrid, columns);
String[] rowClasses = getRowClasses(panelGrid);
int row = 0;
int column = 0;
List<UIComponent> children = panelGrid.getChildren();
for (UIComponent child : children) {
if (0 == column) {
generateRowStart(writer, row, rowClasses, panelGrid);
}
generateColumnStart(child, columnClasses[column], writer);
child.encodeAll(context);
generateColumnEnd(writer, columns[column]);
column++;
if (column >= columns.length) {
generateRowEnd(writer, row, rowClasses);
column = 0;
row++;
}
}
if (column != 0) {
generateRowEnd(writer, row, rowClasses);
column = 0;
row++;
}
endDisabledFieldset(panelGrid, writer);
generateContainerEnd(writer);
if (null != responsiveStyle) {
writer.endElement("div");
}
Tooltip.activateTooltips(context, panelGrid);
} }
|
public class class_name {
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
PanelGrid panelGrid = (PanelGrid) component;
ResponseWriter writer = context.getResponseWriter();
boolean idHasBeenRendered=false;
String responsiveStyle= Responsive.getResponsiveStyleClass(panelGrid, false);
if (null != responsiveStyle) {
writer.startElement("div", panelGrid);
writer.writeAttribute("class", responsiveStyle.trim(), null);
String clientId = panelGrid.getClientId();
writer.writeAttribute("id", clientId, "id");
idHasBeenRendered=true;
}
generateContainerStart(writer, panelGrid, idHasBeenRendered);
beginDisabledFieldset(panelGrid, writer);
int[] columns = getColSpanArray(panelGrid);
String[] columnClasses = getColumnClasses(panelGrid, columns);
String[] rowClasses = getRowClasses(panelGrid);
int row = 0;
int column = 0;
List<UIComponent> children = panelGrid.getChildren();
for (UIComponent child : children) {
if (0 == column) {
generateRowStart(writer, row, rowClasses, panelGrid); // depends on control dependency: [if], data = [none]
}
generateColumnStart(child, columnClasses[column], writer);
child.encodeAll(context);
generateColumnEnd(writer, columns[column]);
column++;
if (column >= columns.length) {
generateRowEnd(writer, row, rowClasses); // depends on control dependency: [if], data = [none]
column = 0; // depends on control dependency: [if], data = [none]
row++; // depends on control dependency: [if], data = [none]
}
}
if (column != 0) {
generateRowEnd(writer, row, rowClasses);
column = 0;
row++;
}
endDisabledFieldset(panelGrid, writer);
generateContainerEnd(writer);
if (null != responsiveStyle) {
writer.endElement("div");
}
Tooltip.activateTooltips(context, panelGrid);
} }
|
public class class_name {
public String[][] toWordTagArray()
{
List<Word> wordList = toSimpleWordList();
String[][] pair = new String[2][wordList.size()];
Iterator<Word> iterator = wordList.iterator();
for (int i = 0; i < pair[0].length; i++)
{
Word word = iterator.next();
pair[0][i] = word.value;
pair[1][i] = word.label;
}
return pair;
} }
|
public class class_name {
public String[][] toWordTagArray()
{
List<Word> wordList = toSimpleWordList();
String[][] pair = new String[2][wordList.size()];
Iterator<Word> iterator = wordList.iterator();
for (int i = 0; i < pair[0].length; i++)
{
Word word = iterator.next();
pair[0][i] = word.value; // depends on control dependency: [for], data = [i]
pair[1][i] = word.label; // depends on control dependency: [for], data = [i]
}
return pair;
} }
|
public class class_name {
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> getCertificateIssuersSinglePageAsync(final String vaultBaseUrl) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
final Integer maxresults = null;
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.getCertificateIssuers(maxresults, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<CertificateIssuerItem>>>>() {
@Override
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<CertificateIssuerItem>> result = getCertificateIssuersDelegate(response);
return Observable.just(new ServiceResponse<Page<CertificateIssuerItem>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> getCertificateIssuersSinglePageAsync(final String vaultBaseUrl) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
final Integer maxresults = null;
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.getCertificateIssuers(maxresults, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<CertificateIssuerItem>>>>() {
@Override
public Observable<ServiceResponse<Page<CertificateIssuerItem>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<CertificateIssuerItem>> result = getCertificateIssuersDelegate(response);
return Observable.just(new ServiceResponse<Page<CertificateIssuerItem>>(result.body(), result.response())); // 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 List<Object> compact(List<Object> list) {
if (list == null || list.isEmpty()) {
return null;
}
List<Object> compacted = new ArrayList<Object>();
StringBuilder stringAccumulator = new StringBuilder();
for (Object object : list) {
if (object instanceof FieldWriter) {
// If a field writer is in the stream, then something may have specific writing logic tied to it.
// pass it along same as field extractor
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString()));
stringAccumulator.setLength(0);
}
compacted.add(object);
}
else if (object instanceof FieldExtractor) {
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString()));
stringAccumulator.setLength(0);
}
compacted.add(new FieldWriter((FieldExtractor) object));
}
else {
stringAccumulator.append(object.toString());
}
}
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString()));
}
return compacted;
} }
|
public class class_name {
private List<Object> compact(List<Object> list) {
if (list == null || list.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
List<Object> compacted = new ArrayList<Object>();
StringBuilder stringAccumulator = new StringBuilder();
for (Object object : list) {
if (object instanceof FieldWriter) {
// If a field writer is in the stream, then something may have specific writing logic tied to it.
// pass it along same as field extractor
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString())); // depends on control dependency: [if], data = [none]
stringAccumulator.setLength(0); // depends on control dependency: [if], data = [0)]
}
compacted.add(object); // depends on control dependency: [if], data = [none]
}
else if (object instanceof FieldExtractor) {
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString())); // depends on control dependency: [if], data = [none]
stringAccumulator.setLength(0); // depends on control dependency: [if], data = [0)]
}
compacted.add(new FieldWriter((FieldExtractor) object)); // depends on control dependency: [if], data = [none]
}
else {
stringAccumulator.append(object.toString()); // depends on control dependency: [if], data = [none]
}
}
if (stringAccumulator.length() > 0) {
compacted.add(new BytesArray(stringAccumulator.toString())); // depends on control dependency: [if], data = [none]
}
return compacted;
} }
|
public class class_name {
public static int setBit(int value, int bitNumber, boolean bitValue) {
if (bitValue) {
return setBitOn(value, bitNumber);
} else {
return setBitOff(value, bitNumber);
}
} }
|
public class class_name {
public static int setBit(int value, int bitNumber, boolean bitValue) {
if (bitValue) {
return setBitOn(value, bitNumber); // depends on control dependency: [if], data = [none]
} else {
return setBitOff(value, bitNumber); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Boolean isReply() {
if (getPostId() != null && getParentId() != null) {
return !getPostId().equals(getParentId());
} else {
return null;
}
} }
|
public class class_name {
public Boolean isReply() {
if (getPostId() != null && getParentId() != null) {
return !getPostId().equals(getParentId()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getIfcOrganization() {
if (ifcOrganizationEClass == null) {
ifcOrganizationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(339);
}
return ifcOrganizationEClass;
} }
|
public class class_name {
public EClass getIfcOrganization() {
if (ifcOrganizationEClass == null) {
ifcOrganizationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(339);
// depends on control dependency: [if], data = [none]
}
return ifcOrganizationEClass;
} }
|
public class class_name {
public List<Match<E>> findAll(List<E> tokens) {
List<Match<E>> results = new ArrayList<Match<E>>();
int start = 0;
Match<E> match;
do {
match = this.find(tokens, start);
if (match != null) {
start = match.endIndex();
// match may be empty query string has all optional parts
if (!match.isEmpty()) {
results.add(match);
}
}
} while (match != null);
return results;
} }
|
public class class_name {
public List<Match<E>> findAll(List<E> tokens) {
List<Match<E>> results = new ArrayList<Match<E>>();
int start = 0;
Match<E> match;
do {
match = this.find(tokens, start);
if (match != null) {
start = match.endIndex(); // depends on control dependency: [if], data = [none]
// match may be empty query string has all optional parts
if (!match.isEmpty()) {
results.add(match); // depends on control dependency: [if], data = [none]
}
}
} while (match != null);
return results;
} }
|
public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsRelatedContentCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsRelatedContentCA> aggsLambda) {
RelatedContentCQ cq = new RelatedContentCQ();
if (queryLambda != null) {
queryLambda.callback(cq);
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
RelatedContentCA ca = new RelatedContentCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
} }
|
public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsRelatedContentCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsRelatedContentCA> aggsLambda) {
RelatedContentCQ cq = new RelatedContentCQ();
if (queryLambda != null) {
queryLambda.callback(cq); // depends on control dependency: [if], data = [none]
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder); // depends on control dependency: [if], data = [none]
}
if (aggsLambda != null) {
RelatedContentCA ca = new RelatedContentCA();
aggsLambda.callback(ca); // depends on control dependency: [if], data = [none]
ca.getAggregationBuilderList().forEach(builder::subAggregation); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void buildFile(boolean isMerged) {
// Build station list
List<GempakStation> stations = gemreader.getStations();
Dimension station = new Dimension("station", stations.size(), true);
ncfile.addDimension(null, station);
ncfile.addDimension(null, DIM_LEN8);
ncfile.addDimension(null, DIM_LEN4);
ncfile.addDimension(null, DIM_LEN2);
List<Variable> stationVars = makeStationVars(stations, station);
// loop through and add to ncfile
for (Variable stnVar : stationVars) {
ncfile.addVariable(null, stnVar);
}
// Build variable list (var(station,time))
// time
List<Date> timeList = gemreader.getDates();
int numTimes = timeList.size();
Dimension times = new Dimension(TIME_VAR, numTimes, true);
ncfile.addDimension(null, times);
Array varArray;
Variable timeVar = new Variable(ncfile, null, null, TIME_VAR, DataType.DOUBLE, TIME_VAR);
timeVar.addAttribute(new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
varArray = new ArrayDouble.D1(numTimes);
int i = 0;
for (Date date : timeList) {
((ArrayDouble.D1) varArray).set(i, date.getTime() / 1000.d);
i++;
}
timeVar.setCachedData(varArray, false);
ncfile.addVariable(null, timeVar);
// build the data structure
List<Dimension> stationTime = new ArrayList<>();
stationTime.add(station);
stationTime.add(times);
String structName = (isMerged) ? GempakSoundingFileReader.MERGED : GempakSoundingFileReader.UNMERGED;
structName = structName + "Sounding";
Structure sVar = new Structure(ncfile, null, null, structName);
sVar.setDimensions(stationTime);
sVar.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
List<String> sequenceNames;
if (isMerged) {
sequenceNames = new ArrayList<>();
sequenceNames.add(GempakSoundingFileReader.SNDT);
} else {
sequenceNames = ((GempakSoundingFileReader) gemreader).getUnmergedParts();
}
for (String seqName : sequenceNames) {
Sequence paramData = makeSequence(sVar, seqName, false);
if (paramData == null) {
continue;
}
sVar.addMemberVariable(paramData);
}
sVar.addMemberVariable(makeMissingVariable());
ncfile.addAttribute(null, new Attribute("CF:featureType", CF.FeatureType.timeSeriesProfile.toString()));
ncfile.addVariable(null, sVar);
} }
|
public class class_name {
private void buildFile(boolean isMerged) {
// Build station list
List<GempakStation> stations = gemreader.getStations();
Dimension station = new Dimension("station", stations.size(), true);
ncfile.addDimension(null, station);
ncfile.addDimension(null, DIM_LEN8);
ncfile.addDimension(null, DIM_LEN4);
ncfile.addDimension(null, DIM_LEN2);
List<Variable> stationVars = makeStationVars(stations, station);
// loop through and add to ncfile
for (Variable stnVar : stationVars) {
ncfile.addVariable(null, stnVar);
// depends on control dependency: [for], data = [stnVar]
}
// Build variable list (var(station,time))
// time
List<Date> timeList = gemreader.getDates();
int numTimes = timeList.size();
Dimension times = new Dimension(TIME_VAR, numTimes, true);
ncfile.addDimension(null, times);
Array varArray;
Variable timeVar = new Variable(ncfile, null, null, TIME_VAR, DataType.DOUBLE, TIME_VAR);
timeVar.addAttribute(new Attribute(CDM.UNITS, "seconds since 1970-01-01 00:00:00"));
timeVar.addAttribute(new Attribute("long_name", TIME_VAR));
varArray = new ArrayDouble.D1(numTimes);
int i = 0;
for (Date date : timeList) {
((ArrayDouble.D1) varArray).set(i, date.getTime() / 1000.d);
// depends on control dependency: [for], data = [date]
i++;
// depends on control dependency: [for], data = [none]
}
timeVar.setCachedData(varArray, false);
ncfile.addVariable(null, timeVar);
// build the data structure
List<Dimension> stationTime = new ArrayList<>();
stationTime.add(station);
stationTime.add(times);
String structName = (isMerged) ? GempakSoundingFileReader.MERGED : GempakSoundingFileReader.UNMERGED;
structName = structName + "Sounding";
Structure sVar = new Structure(ncfile, null, null, structName);
sVar.setDimensions(stationTime);
sVar.addAttribute(new Attribute(CF.COORDINATES, "time SLAT SLON SELV"));
List<String> sequenceNames;
if (isMerged) {
sequenceNames = new ArrayList<>();
// depends on control dependency: [if], data = [none]
sequenceNames.add(GempakSoundingFileReader.SNDT);
// depends on control dependency: [if], data = [none]
} else {
sequenceNames = ((GempakSoundingFileReader) gemreader).getUnmergedParts();
// depends on control dependency: [if], data = [none]
}
for (String seqName : sequenceNames) {
Sequence paramData = makeSequence(sVar, seqName, false);
if (paramData == null) {
continue;
}
sVar.addMemberVariable(paramData);
// depends on control dependency: [for], data = [none]
}
sVar.addMemberVariable(makeMissingVariable());
ncfile.addAttribute(null, new Attribute("CF:featureType", CF.FeatureType.timeSeriesProfile.toString()));
ncfile.addVariable(null, sVar);
} }
|
public class class_name {
public T removeLast() {
if ( this.lastNode == null ) {
return null;
}
final T node = this.lastNode;
this.lastNode = node.getPrevious();
node.setPrevious( null );
if ( this.lastNode != null ) {
this.lastNode.setNext( null );
} else {
this.firstNode = null;
}
this.size--;
return node;
} }
|
public class class_name {
public T removeLast() {
if ( this.lastNode == null ) {
return null; // depends on control dependency: [if], data = [none]
}
final T node = this.lastNode;
this.lastNode = node.getPrevious();
node.setPrevious( null );
if ( this.lastNode != null ) {
this.lastNode.setNext( null ); // depends on control dependency: [if], data = [null )]
} else {
this.firstNode = null; // depends on control dependency: [if], data = [none]
}
this.size--;
return node;
} }
|
public class class_name {
public static void addMethodWithBestPosition(Interface interfacz, Method method) {
// import
Set<FullyQualifiedJavaType> importTypes = new TreeSet<>();
// 返回
if (method.getReturnType() != null) {
importTypes.add(method.getReturnType());
importTypes.addAll(method.getReturnType().getTypeArguments());
}
// 参数 比较特殊的是ModelColumn生成的Column
for (Parameter parameter : method.getParameters()) {
boolean flag = true;
for (String annotation : parameter.getAnnotations()) {
if (annotation.startsWith("@Param")) {
importTypes.add(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Param"));
if (annotation.matches(".*selective.*") && parameter.getType().getShortName().equals(ModelColumnPlugin.ENUM_NAME)) {
flag = false;
}
}
}
if (flag) {
importTypes.add(parameter.getType());
importTypes.addAll(parameter.getType().getTypeArguments());
}
}
interfacz.addImportedTypes(importTypes);
addMethodWithBestPosition(method, interfacz.getMethods());
} }
|
public class class_name {
public static void addMethodWithBestPosition(Interface interfacz, Method method) {
// import
Set<FullyQualifiedJavaType> importTypes = new TreeSet<>();
// 返回
if (method.getReturnType() != null) {
importTypes.add(method.getReturnType()); // depends on control dependency: [if], data = [(method.getReturnType()]
importTypes.addAll(method.getReturnType().getTypeArguments()); // depends on control dependency: [if], data = [(method.getReturnType()]
}
// 参数 比较特殊的是ModelColumn生成的Column
for (Parameter parameter : method.getParameters()) {
boolean flag = true;
for (String annotation : parameter.getAnnotations()) {
if (annotation.startsWith("@Param")) {
importTypes.add(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Param"));
if (annotation.matches(".*selective.*") && parameter.getType().getShortName().equals(ModelColumnPlugin.ENUM_NAME)) {
flag = false;
}
}
}
if (flag) { // depends on control dependency: [if], data = [none]
importTypes.add(parameter.getType());
importTypes.addAll(parameter.getType().getTypeArguments());
}
}
interfacz.addImportedTypes(importTypes); // depends on control dependency: [for], data = [none]
addMethodWithBestPosition(method, interfacz.getMethods()); // depends on control dependency: [for], data = [none]
} }
|
public class class_name {
private void assignMinimumTTL(List<? extends DnsAnswer> dnsAnswers, LookupResult.Builder builder) {
if (config.hasOverrideTTL()) {
builder.cacheTTL(config.getCacheTTLOverrideMillis());
} else {
// Deduce minimum TTL on all TXT records. A TTL will always be returned by DNS server.
builder.cacheTTL(dnsAnswers.stream()
.map(DnsAnswer::dnsTTL)
.min(Comparator.comparing(Long::valueOf)).get() * 1000);
}
} }
|
public class class_name {
private void assignMinimumTTL(List<? extends DnsAnswer> dnsAnswers, LookupResult.Builder builder) {
if (config.hasOverrideTTL()) {
builder.cacheTTL(config.getCacheTTLOverrideMillis()); // depends on control dependency: [if], data = [none]
} else {
// Deduce minimum TTL on all TXT records. A TTL will always be returned by DNS server.
builder.cacheTTL(dnsAnswers.stream()
.map(DnsAnswer::dnsTTL)
.min(Comparator.comparing(Long::valueOf)).get() * 1000); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
} }
|
public class class_name {
public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
// depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public ResourceChange withScope(String... scope) {
if (this.scope == null) {
setScope(new java.util.ArrayList<String>(scope.length));
}
for (String ele : scope) {
this.scope.add(ele);
}
return this;
} }
|
public class class_name {
public ResourceChange withScope(String... scope) {
if (this.scope == null) {
setScope(new java.util.ArrayList<String>(scope.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : scope) {
this.scope.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
protected boolean doStop() {
if (null != this.channelFuture) {
this.channelFuture.channel().close();
}
if (this.switches().isOn(GlobalSwitch.SERVER_SYNC_STOP)) {
this.bossGroup.shutdownGracefully().awaitUninterruptibly();
} else {
this.bossGroup.shutdownGracefully();
}
if (this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)
&& null != this.connectionManager) {
this.connectionManager.removeAll();
logger.warn("Close all connections from server side!");
}
logger.warn("Rpc Server stopped!");
return true;
} }
|
public class class_name {
@Override
protected boolean doStop() {
if (null != this.channelFuture) {
this.channelFuture.channel().close(); // depends on control dependency: [if], data = [none]
}
if (this.switches().isOn(GlobalSwitch.SERVER_SYNC_STOP)) {
this.bossGroup.shutdownGracefully().awaitUninterruptibly(); // depends on control dependency: [if], data = [none]
} else {
this.bossGroup.shutdownGracefully(); // depends on control dependency: [if], data = [none]
}
if (this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)
&& null != this.connectionManager) {
this.connectionManager.removeAll(); // depends on control dependency: [if], data = [none]
logger.warn("Close all connections from server side!"); // depends on control dependency: [if], data = [none]
}
logger.warn("Rpc Server stopped!");
return true;
} }
|
public class class_name {
public
int appendLoopOnAppenders(LoggingEvent event) {
int nb = 0;
for (Appender appender : appenderList) {
appender.doAppend(event);
nb++;
}
return nb;
} }
|
public class class_name {
public
int appendLoopOnAppenders(LoggingEvent event) {
int nb = 0;
for (Appender appender : appenderList) {
appender.doAppend(event); // depends on control dependency: [for], data = [appender]
nb++; // depends on control dependency: [for], data = [none]
}
return nb;
} }
|
public class class_name {
@Override
public int doStartTag() throws JspException {
// Sanity check
if (context != null
&& (!context.startsWith("/") || !url.startsWith("/"))) {
throw new JspTagException(
Resources.getMessage("IMPORT_BAD_RELATIVE"));
}
// reset parameter-related state
urlWithParams = null;
params = new ParamSupport.ParamManager();
// check the URL
if (url == null || url.equals("")) {
throw new NullAttributeException("import", "url");
}
// Record whether our URL is absolute or relative
isAbsoluteUrl = UrlUtil.isAbsoluteUrl(url);
try {
// If we need to expose a Reader, we've got to do it right away
if (varReader != null) {
r = acquireReader();
pageContext.setAttribute(varReader, r);
}
} catch (IOException ex) {
throw new JspTagException(ex.toString(), ex);
}
return EVAL_BODY_INCLUDE;
} }
|
public class class_name {
@Override
public int doStartTag() throws JspException {
// Sanity check
if (context != null
&& (!context.startsWith("/") || !url.startsWith("/"))) {
throw new JspTagException(
Resources.getMessage("IMPORT_BAD_RELATIVE"));
}
// reset parameter-related state
urlWithParams = null;
params = new ParamSupport.ParamManager();
// check the URL
if (url == null || url.equals("")) {
throw new NullAttributeException("import", "url");
}
// Record whether our URL is absolute or relative
isAbsoluteUrl = UrlUtil.isAbsoluteUrl(url);
try {
// If we need to expose a Reader, we've got to do it right away
if (varReader != null) {
r = acquireReader(); // depends on control dependency: [if], data = [none]
pageContext.setAttribute(varReader, r); // depends on control dependency: [if], data = [(varReader]
}
} catch (IOException ex) {
throw new JspTagException(ex.toString(), ex);
}
return EVAL_BODY_INCLUDE;
} }
|
public class class_name {
void record(
List</*@Nullable*/ TagValue> tagValues,
double value,
Map<String, AttachmentValue> attachments,
Timestamp timestamp) {
if (!tagValueAggregationMap.containsKey(tagValues)) {
tagValueAggregationMap.put(
tagValues, RecordUtils.createMutableAggregation(aggregation, measure));
}
tagValueAggregationMap.get(tagValues).add(value, attachments, timestamp);
} }
|
public class class_name {
void record(
List</*@Nullable*/ TagValue> tagValues,
double value,
Map<String, AttachmentValue> attachments,
Timestamp timestamp) {
if (!tagValueAggregationMap.containsKey(tagValues)) {
tagValueAggregationMap.put(
tagValues, RecordUtils.createMutableAggregation(aggregation, measure)); // depends on control dependency: [if], data = [none]
}
tagValueAggregationMap.get(tagValues).add(value, attachments, timestamp);
} }
|
public class class_name {
int run(@Nonnull String[] args, @Nonnull final ProcessStream system) {
OptionHandlerRegistry.getRegistry().registerHandler(CliCommand.class, CliCommandOptionHandler.class);
OptionHandlerRegistry.getRegistry().registerHandler(ProcessRuntime.class, new OptionHandlerRegistry.OptionHandlerFactory() {
public OptionHandler<?> getHandler(CmdLineParser parser, OptionDef o, Setter setter) {
return new ProcessRuntimeOptionHandler(parser, o, setter, system);
}
});
CmdLineParser parser = new CmdLineParser(this);
try {
parser.parseArgument(args);
return handler.run(system);
} catch (CmdLineException ex) {
system.err().println(ex.getMessage());
HelpCommand.printUsage(handler, system.err(), ex);
} catch (CommandFailedException ex) {
system.err().println(ex.getMessage());
} catch (RuntimeException ex) {
ex.printStackTrace(system.err());
}
return -1;
} }
|
public class class_name {
int run(@Nonnull String[] args, @Nonnull final ProcessStream system) {
OptionHandlerRegistry.getRegistry().registerHandler(CliCommand.class, CliCommandOptionHandler.class);
OptionHandlerRegistry.getRegistry().registerHandler(ProcessRuntime.class, new OptionHandlerRegistry.OptionHandlerFactory() {
public OptionHandler<?> getHandler(CmdLineParser parser, OptionDef o, Setter setter) {
return new ProcessRuntimeOptionHandler(parser, o, setter, system);
}
});
CmdLineParser parser = new CmdLineParser(this);
try {
parser.parseArgument(args); // depends on control dependency: [try], data = [none]
return handler.run(system); // depends on control dependency: [try], data = [none]
} catch (CmdLineException ex) {
system.err().println(ex.getMessage());
HelpCommand.printUsage(handler, system.err(), ex);
} catch (CommandFailedException ex) { // depends on control dependency: [catch], data = [none]
system.err().println(ex.getMessage());
} catch (RuntimeException ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace(system.err());
} // depends on control dependency: [catch], data = [none]
return -1;
} }
|
public class class_name {
public Revision getNearest(final int revisionCounter)
{
if (first != null) {
ChronoStorageBlock previous = null, current = first;
while (current != null
&& current.getRevisionCounter() <= revisionCounter) {
previous = current;
current = current.getCounterNext();
}
return previous.getRev();
}
return null;
} }
|
public class class_name {
public Revision getNearest(final int revisionCounter)
{
if (first != null) {
ChronoStorageBlock previous = null, current = first;
while (current != null
&& current.getRevisionCounter() <= revisionCounter) {
previous = current; // depends on control dependency: [while], data = [none]
current = current.getCounterNext(); // depends on control dependency: [while], data = [none]
}
return previous.getRev(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
void metaSave(PrintWriter out) {
synchronized (pendingReplications) {
out.println("Metasave: Blocks being replicated: " +
pendingReplications.size());
Iterator<Map.Entry<BlockInfo, PendingBlockInfo>> iter =
pendingReplications.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<BlockInfo, PendingBlockInfo> entry = iter.next();
PendingBlockInfo pendingBlock = entry.getValue();
BlockInfo block = entry.getKey();
out.println(block +
" StartTime: " + new Time(pendingBlock.timeStamp) +
" NumReplicaInProgress: " +
pendingBlock.numReplicasInProgress);
}
}
} }
|
public class class_name {
void metaSave(PrintWriter out) {
synchronized (pendingReplications) {
out.println("Metasave: Blocks being replicated: " +
pendingReplications.size());
Iterator<Map.Entry<BlockInfo, PendingBlockInfo>> iter =
pendingReplications.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<BlockInfo, PendingBlockInfo> entry = iter.next();
PendingBlockInfo pendingBlock = entry.getValue();
BlockInfo block = entry.getKey();
out.println(block +
" StartTime: " + new Time(pendingBlock.timeStamp) +
" NumReplicaInProgress: " +
pendingBlock.numReplicasInProgress); // depends on control dependency: [while], data = [none]
}
}
} }
|
public class class_name {
public LocalDateTime minusWeeks(int weeks) {
if (weeks == 0) {
return this;
}
long instant = getChronology().weeks().subtract(getLocalMillis(), weeks);
return withLocalMillis(instant);
} }
|
public class class_name {
public LocalDateTime minusWeeks(int weeks) {
if (weeks == 0) {
return this; // depends on control dependency: [if], data = [none]
}
long instant = getChronology().weeks().subtract(getLocalMillis(), weeks);
return withLocalMillis(instant);
} }
|
public class class_name {
Format identifyFormat( String pom )
{
for ( String separator : LINE_SEPARATORS )
{
if ( pom.contains( separator ) )
{
return new Format( separator );
}
}
throw new IllegalArgumentException( "The pom.xml has no known line separator." );
} }
|
public class class_name {
Format identifyFormat( String pom )
{
for ( String separator : LINE_SEPARATORS )
{
if ( pom.contains( separator ) )
{
return new Format( separator ); // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException( "The pom.xml has no known line separator." );
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.