code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static String encodeString(final String string) {
String encodedString = null;
try {
encodedString = encodeString(string, "UTF-8");
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
}
return encodedString;
} } | public class class_name {
public static String encodeString(final String string) {
String encodedString = null;
try {
encodedString = encodeString(string, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
} // depends on control dependency: [catch], data = [none]
return encodedString;
} } |
public class class_name {
public void setReservedInstanceValueSet(java.util.Collection<ReservedInstanceReservationValue> reservedInstanceValueSet) {
if (reservedInstanceValueSet == null) {
this.reservedInstanceValueSet = null;
return;
}
this.reservedInstanceValueSet = new com.amazonaws.internal.SdkInternalList<ReservedInstanceReservationValue>(reservedInstanceValueSet);
} } | public class class_name {
public void setReservedInstanceValueSet(java.util.Collection<ReservedInstanceReservationValue> reservedInstanceValueSet) {
if (reservedInstanceValueSet == null) {
this.reservedInstanceValueSet = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.reservedInstanceValueSet = new com.amazonaws.internal.SdkInternalList<ReservedInstanceReservationValue>(reservedInstanceValueSet);
} } |
public class class_name {
public static DictionaryMaker combineWhenNotInclude(String[] pathArray)
{
DictionaryMaker dictionaryMaker = new DictionaryMaker();
logger.info("正在处理主词典" + pathArray[0]);
dictionaryMaker.addAll(DictionaryMaker.loadAsItemList(pathArray[0]));
for (int i = 1; i < pathArray.length; ++i)
{
logger.info("正在处理副词典" + pathArray[i] + ",并且过滤已有词典");
dictionaryMaker.addAllNotCombine(DictionaryMaker.normalizeFrequency(DictionaryMaker.loadAsItemList(pathArray[i])));
}
return dictionaryMaker;
} } | public class class_name {
public static DictionaryMaker combineWhenNotInclude(String[] pathArray)
{
DictionaryMaker dictionaryMaker = new DictionaryMaker();
logger.info("正在处理主词典" + pathArray[0]);
dictionaryMaker.addAll(DictionaryMaker.loadAsItemList(pathArray[0]));
for (int i = 1; i < pathArray.length; ++i)
{
logger.info("正在处理副词典" + pathArray[i] + ",并且过滤已有词典"); // depends on control dependency: [for], data = [i]
dictionaryMaker.addAllNotCombine(DictionaryMaker.normalizeFrequency(DictionaryMaker.loadAsItemList(pathArray[i]))); // depends on control dependency: [for], data = [i]
}
return dictionaryMaker;
} } |
public class class_name {
private void addResponseHeaderParameters(InternalRequest request, ResponseHeaderOverrides responseHeaders) {
if (responseHeaders != null) {
if (responseHeaders.getCacheControl() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CACHE_CONTROL,
responseHeaders.getCacheControl());
}
if (responseHeaders.getContentDisposition() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_DISPOSITION,
responseHeaders.getContentDisposition());
}
if (responseHeaders.getContentEncoding() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_ENCODING,
responseHeaders.getContentEncoding());
}
if (responseHeaders.getContentLanguage() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_LANGUAGE,
responseHeaders.getContentLanguage());
}
if (responseHeaders.getContentType() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_TYPE,
responseHeaders.getContentType());
}
if (responseHeaders.getExpires() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_EXPIRES, responseHeaders.getExpires());
}
}
} } | public class class_name {
private void addResponseHeaderParameters(InternalRequest request, ResponseHeaderOverrides responseHeaders) {
if (responseHeaders != null) {
if (responseHeaders.getCacheControl() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CACHE_CONTROL,
responseHeaders.getCacheControl()); // depends on control dependency: [if], data = [none]
}
if (responseHeaders.getContentDisposition() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_DISPOSITION,
responseHeaders.getContentDisposition()); // depends on control dependency: [if], data = [none]
}
if (responseHeaders.getContentEncoding() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_ENCODING,
responseHeaders.getContentEncoding()); // depends on control dependency: [if], data = [none]
}
if (responseHeaders.getContentLanguage() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_LANGUAGE,
responseHeaders.getContentLanguage()); // depends on control dependency: [if], data = [none]
}
if (responseHeaders.getContentType() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_CONTENT_TYPE,
responseHeaders.getContentType()); // depends on control dependency: [if], data = [none]
}
if (responseHeaders.getExpires() != null) {
request.addParameter(ResponseHeaderOverrides.RESPONSE_HEADER_EXPIRES, responseHeaders.getExpires()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void set(long index) throws IOException {
long pos = index >> 3;
try {
lock().acquireUpgradableLock();
int value = mFile.read(pos);
int newValue;
if (value <= 0) {
newValue = (0x00000080 >> (index & 7));
}
else {
newValue = value | (0x00000080 >> (index & 7));
}
if (newValue != value) {
mFile.write(pos, newValue);
}
}
catch (InterruptedException e) {
throw new InterruptedIOException();
}
finally {
lock().releaseLock();
}
} } | public class class_name {
public void set(long index) throws IOException {
long pos = index >> 3;
try {
lock().acquireUpgradableLock();
int value = mFile.read(pos);
int newValue;
if (value <= 0) {
newValue = (0x00000080 >> (index & 7)); // depends on control dependency: [if], data = [none]
}
else {
newValue = value | (0x00000080 >> (index & 7)); // depends on control dependency: [if], data = [none]
}
if (newValue != value) {
mFile.write(pos, newValue); // depends on control dependency: [if], data = [none]
}
}
catch (InterruptedException e) {
throw new InterruptedIOException();
}
finally {
lock().releaseLock();
}
} } |
public class class_name {
public void setLowerCaseFirst(boolean lowerfirst) {
checkNotFrozen();
if (lowerfirst == isLowerCaseFirst()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(lowerfirst ? CollationSettings.CASE_FIRST : 0);
setFastLatinOptions(ownedSettings);
} } | public class class_name {
public void setLowerCaseFirst(boolean lowerfirst) {
checkNotFrozen();
if (lowerfirst == isLowerCaseFirst()) { return; } // depends on control dependency: [if], data = [none]
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(lowerfirst ? CollationSettings.CASE_FIRST : 0);
setFastLatinOptions(ownedSettings);
} } |
public class class_name {
protected void prepareDialogPage(DialogPage page) {
page.addPropertyChangeListener(childChangeHandler);
JComponent c = page.getControl();
GuiStandardUtils.attachDialogBorder(c);
Dimension size = c.getPreferredSize();
if (size.width > largestPageWidth) {
largestPageWidth = size.width;
}
if (size.height > largestPageHeight) {
largestPageHeight = size.height;
}
} } | public class class_name {
protected void prepareDialogPage(DialogPage page) {
page.addPropertyChangeListener(childChangeHandler);
JComponent c = page.getControl();
GuiStandardUtils.attachDialogBorder(c);
Dimension size = c.getPreferredSize();
if (size.width > largestPageWidth) {
largestPageWidth = size.width; // depends on control dependency: [if], data = [none]
}
if (size.height > largestPageHeight) {
largestPageHeight = size.height; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void transition(Member.Type type) {
switch (type) {
case ACTIVE:
if (!(state instanceof ActiveState)) {
transition(CopycatServer.State.FOLLOWER);
}
break;
case PASSIVE:
if (this.state.type() != CopycatServer.State.PASSIVE) {
transition(CopycatServer.State.PASSIVE);
}
break;
case RESERVE:
if (this.state.type() != CopycatServer.State.RESERVE) {
transition(CopycatServer.State.RESERVE);
}
break;
default:
if (this.state.type() != CopycatServer.State.INACTIVE) {
transition(CopycatServer.State.INACTIVE);
}
break;
}
} } | public class class_name {
protected void transition(Member.Type type) {
switch (type) {
case ACTIVE:
if (!(state instanceof ActiveState)) {
transition(CopycatServer.State.FOLLOWER); // depends on control dependency: [if], data = [none]
}
break;
case PASSIVE:
if (this.state.type() != CopycatServer.State.PASSIVE) {
transition(CopycatServer.State.PASSIVE); // depends on control dependency: [if], data = [CopycatServer.State.PASSIVE)]
}
break;
case RESERVE:
if (this.state.type() != CopycatServer.State.RESERVE) {
transition(CopycatServer.State.RESERVE); // depends on control dependency: [if], data = [CopycatServer.State.RESERVE)]
}
break;
default:
if (this.state.type() != CopycatServer.State.INACTIVE) {
transition(CopycatServer.State.INACTIVE); // depends on control dependency: [if], data = [CopycatServer.State.INACTIVE)]
}
break;
}
} } |
public class class_name {
public Manifest findByPath(String path) {
for (Manifest manifest : this) {
String mpath = ((ManifestEx) manifest).path;
if (path.startsWith(mpath)) {
return manifest;
}
}
return null;
} } | public class class_name {
public Manifest findByPath(String path) {
for (Manifest manifest : this) {
String mpath = ((ManifestEx) manifest).path;
if (path.startsWith(mpath)) {
return manifest; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public Type[] getAudioFileTypes(AudioInputStream stream) {
AudioFileFormat.Type[] filetypes = getAudioFileTypes();
// make sure we can write this stream
AudioFormat format = stream.getFormat();
if(AudioStreamEncoder.getDataFormatSupport(format) == AudioStreamEncoder.SUPPORTED ) {
return filetypes;
}
return new AudioFileFormat.Type[0];
} } | public class class_name {
@Override
public Type[] getAudioFileTypes(AudioInputStream stream) {
AudioFileFormat.Type[] filetypes = getAudioFileTypes();
// make sure we can write this stream
AudioFormat format = stream.getFormat();
if(AudioStreamEncoder.getDataFormatSupport(format) == AudioStreamEncoder.SUPPORTED ) {
return filetypes; // depends on control dependency: [if], data = [none]
}
return new AudioFileFormat.Type[0];
} } |
public class class_name {
public StatsImpl getStats(int[] dataIds, boolean recursive) {
if (dataIds == null)
return getStats(recursive);
if (instance == null)
return null;
SpdData[] dataList = instance.listData(dataIds);
ModuleItem[] items = children();
ArrayList dataMembers = null; // return data members
ArrayList colMembers = null; // return subcollection members
// convert from Spd to Wpd and set dataMembers
if (dataList != null) {
dataMembers = new ArrayList(dataList.length);
for (int i = 0; i < dataList.length; i++) {
dataMembers.add(dataList[i].getStatistic());
}
}
// getStats from children
if (recursive && (items != null)) {
colMembers = new ArrayList(items.length);
for (int i = 0; i < items.length; i++) {
colMembers.add(items[i].getStats(dataIds, recursive));
}
}
// return Stats - individual instance will return different XXXStats instance
// Note: construct dataMembers in ModuleItem and pass it to instance
// because getStats will be overwritten by subclasses
// and we don't want to duplicate the same code.
return instance.getStats(dataMembers, colMembers);
} } | public class class_name {
public StatsImpl getStats(int[] dataIds, boolean recursive) {
if (dataIds == null)
return getStats(recursive);
if (instance == null)
return null;
SpdData[] dataList = instance.listData(dataIds);
ModuleItem[] items = children();
ArrayList dataMembers = null; // return data members
ArrayList colMembers = null; // return subcollection members
// convert from Spd to Wpd and set dataMembers
if (dataList != null) {
dataMembers = new ArrayList(dataList.length); // depends on control dependency: [if], data = [(dataList]
for (int i = 0; i < dataList.length; i++) {
dataMembers.add(dataList[i].getStatistic()); // depends on control dependency: [for], data = [i]
}
}
// getStats from children
if (recursive && (items != null)) {
colMembers = new ArrayList(items.length); // depends on control dependency: [if], data = [none]
for (int i = 0; i < items.length; i++) {
colMembers.add(items[i].getStats(dataIds, recursive)); // depends on control dependency: [for], data = [i]
}
}
// return Stats - individual instance will return different XXXStats instance
// Note: construct dataMembers in ModuleItem and pass it to instance
// because getStats will be overwritten by subclasses
// and we don't want to duplicate the same code.
return instance.getStats(dataMembers, colMembers);
} } |
public class class_name {
public static MethodNode addDelegateStaticMethod(Expression delegate, ClassNode classNode, MethodNode delegateMethod, AnnotationNode markerAnnotation, Map<String, ClassNode> genericsPlaceholders, boolean noNullCheck) {
Parameter[] parameterTypes = delegateMethod.getParameters();
String declaredMethodName = delegateMethod.getName();
if (METHOD_MISSING_METHOD_NAME.equals(declaredMethodName)) {
declaredMethodName = STATIC_METHOD_MISSING_METHOD_NAME;
}
if (classNode.hasDeclaredMethod(declaredMethodName, copyParameters(parameterTypes, genericsPlaceholders))) {
return null;
}
BlockStatement methodBody = new BlockStatement();
ArgumentListExpression arguments = createArgumentListFromParameters(parameterTypes, false, genericsPlaceholders);
MethodCallExpression methodCallExpression = new MethodCallExpression(
delegate, delegateMethod.getName(), arguments);
methodCallExpression.setMethodTarget(delegateMethod);
if(!noNullCheck && !(delegate instanceof ClassExpression)) {
ThrowStatement missingMethodException = createMissingMethodThrowable(classNode, delegateMethod);
VariableExpression apiVar = addApiVariableDeclaration(delegate, delegateMethod, methodBody);
IfStatement ifStatement = createIfElseStatementForApiMethodCall(methodCallExpression, apiVar, missingMethodException);
methodBody.addStatement(ifStatement);
} else {
methodBody.addStatement(new ExpressionStatement(methodCallExpression));
}
ClassNode returnType = replaceGenericsPlaceholders(delegateMethod.getReturnType(), genericsPlaceholders);
MethodNode methodNode = new MethodNode(declaredMethodName, Modifier.PUBLIC | Modifier.STATIC, returnType,
copyParameters(parameterTypes, genericsPlaceholders), GrailsArtefactClassInjector.EMPTY_CLASS_ARRAY,
methodBody);
copyAnnotations(delegateMethod, methodNode);
if (shouldAddMarkerAnnotation(markerAnnotation, methodNode)) {
methodNode.addAnnotation(markerAnnotation);
}
classNode.addMethod(methodNode);
return methodNode;
} } | public class class_name {
public static MethodNode addDelegateStaticMethod(Expression delegate, ClassNode classNode, MethodNode delegateMethod, AnnotationNode markerAnnotation, Map<String, ClassNode> genericsPlaceholders, boolean noNullCheck) {
Parameter[] parameterTypes = delegateMethod.getParameters();
String declaredMethodName = delegateMethod.getName();
if (METHOD_MISSING_METHOD_NAME.equals(declaredMethodName)) {
declaredMethodName = STATIC_METHOD_MISSING_METHOD_NAME; // depends on control dependency: [if], data = [none]
}
if (classNode.hasDeclaredMethod(declaredMethodName, copyParameters(parameterTypes, genericsPlaceholders))) {
return null; // depends on control dependency: [if], data = [none]
}
BlockStatement methodBody = new BlockStatement();
ArgumentListExpression arguments = createArgumentListFromParameters(parameterTypes, false, genericsPlaceholders);
MethodCallExpression methodCallExpression = new MethodCallExpression(
delegate, delegateMethod.getName(), arguments);
methodCallExpression.setMethodTarget(delegateMethod);
if(!noNullCheck && !(delegate instanceof ClassExpression)) {
ThrowStatement missingMethodException = createMissingMethodThrowable(classNode, delegateMethod);
VariableExpression apiVar = addApiVariableDeclaration(delegate, delegateMethod, methodBody);
IfStatement ifStatement = createIfElseStatementForApiMethodCall(methodCallExpression, apiVar, missingMethodException);
methodBody.addStatement(ifStatement); // depends on control dependency: [if], data = [none]
} else {
methodBody.addStatement(new ExpressionStatement(methodCallExpression)); // depends on control dependency: [if], data = [none]
}
ClassNode returnType = replaceGenericsPlaceholders(delegateMethod.getReturnType(), genericsPlaceholders);
MethodNode methodNode = new MethodNode(declaredMethodName, Modifier.PUBLIC | Modifier.STATIC, returnType,
copyParameters(parameterTypes, genericsPlaceholders), GrailsArtefactClassInjector.EMPTY_CLASS_ARRAY,
methodBody);
copyAnnotations(delegateMethod, methodNode);
if (shouldAddMarkerAnnotation(markerAnnotation, methodNode)) {
methodNode.addAnnotation(markerAnnotation); // depends on control dependency: [if], data = [none]
}
classNode.addMethod(methodNode);
return methodNode;
} } |
public class class_name {
public static String maxLengthString(String... strings) {
String res = "";
for (String string : strings) {
if (string.length() > res.length()) {
res = string;
}
}
return res;
} } | public class class_name {
public static String maxLengthString(String... strings) {
String res = "";
for (String string : strings) {
if (string.length() > res.length()) {
res = string; // depends on control dependency: [if], data = [none]
}
}
return res;
} } |
public class class_name {
protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
if (_refreshPeriod == NO_CACHE_DELAY)
{
return true;
}
// if set to -1, never reload
if (_refreshPeriod == INFINITE_DELAY)
{
return false;
}
long target = facelet.getCreateTime() + _refreshPeriod;
if (System.currentTimeMillis() > target)
{
// Should check for file modification
URLConnection conn = null;
try
{
conn = facelet.getSource().openConnection();
long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
return lastModified == 0 || lastModified > target;
}
catch (IOException e)
{
throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
}
finally
{
// finally close input stream when finished, if fails just continue.
if (conn != null)
{
try
{
InputStream is = conn.getInputStream();
if (is != null)
{
is.close();
}
}
catch (IOException e)
{
// Ignore
}
}
}
}
return false;
} } | public class class_name {
protected boolean needsToBeRefreshed(DefaultFacelet facelet)
{
// if set to 0, constantly reload-- nocache
if (_refreshPeriod == NO_CACHE_DELAY)
{
return true; // depends on control dependency: [if], data = [none]
}
// if set to -1, never reload
if (_refreshPeriod == INFINITE_DELAY)
{
return false; // depends on control dependency: [if], data = [none]
}
long target = facelet.getCreateTime() + _refreshPeriod;
if (System.currentTimeMillis() > target)
{
// Should check for file modification
URLConnection conn = null;
try
{
conn = facelet.getSource().openConnection(); // depends on control dependency: [try], data = [none]
long lastModified = ResourceLoaderUtils.getResourceLastModified(conn);
return lastModified == 0 || lastModified > target; // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(), e);
} // depends on control dependency: [catch], data = [none]
finally
{
// finally close input stream when finished, if fails just continue.
if (conn != null)
{
try
{
InputStream is = conn.getInputStream();
if (is != null)
{
is.close(); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
// Ignore
} // depends on control dependency: [catch], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static AccessorProvider getAllAccessorsProvider(
final Elements elements,
final Types types,
final TypeElement originatingType) {
class CollectedOrdering extends Ordering<Element> {
class Intratype {
final String inType;
final Ordering<String> ordering;
final int rank;
Intratype(String inType, int rank, List<String> accessors) {
this.inType = inType;
this.rank = rank;
this.ordering = Ordering.explicit(accessors);
}
@Override
public String toString() {
return "(<=> " + inType + ", " + rank + ", " + ordering + ")";
}
}
final Map<String, Intratype> accessorOrderings = new LinkedHashMap<>();
final Set<TypeElement> linearizedTypes = new LinkedHashSet<>();
final ArrayListMultimap<String, TypeElement> accessorMapping = ArrayListMultimap.create();
CollectedOrdering() {
traverse(originatingType);
collectAccessors();
}
void traverse(@Nullable TypeElement element) {
if (element == null || isJavaLangObject(element)) {
return;
}
for (TypeMirror implementedInterface : element.getInterfaces()) {
traverse(toElement(implementedInterface));
}
if (element.getKind().isClass()) {
// collectEnclosing(element);
traverse(toElement(element.getSuperclass()));
}
// we add this after so we start with the deepest
linearizedTypes.add(element);
}
@Nullable
TypeElement toElement(TypeMirror type) {
if (type.getKind() == TypeKind.DECLARED) {
return (TypeElement) ((DeclaredType) type).asElement();
}
return null;
}
void collectAccessors() {
int i = 0;
for (TypeElement type : linearizedTypes) {
List<String> accessorsInType =
FluentIterable.from(SourceOrdering.getEnclosedElements(type))
.filter(IsParameterlessNonstaticNonobject.PREDICATE)
.transform(ToSimpleName.FUNCTION)
.toList();
String typeTag = type.getSimpleName().toString();
Intratype intratype = new Intratype(typeTag, i++, accessorsInType);
for (String name : accessorsInType) {
// we override accessors by the ones redeclared in later types
accessorMapping.put(name, type);
accessorOrderings.put(name, intratype);
}
}
}
@Override
public int compare(Element left, Element right) {
String leftKey = ToSimpleName.FUNCTION.apply(left);
String rightKey = ToSimpleName.FUNCTION.apply(right);
Intratype leftIntratype = accessorOrderings.get(leftKey);
Intratype rightIntratype = accessorOrderings.get(rightKey);
return leftIntratype == rightIntratype
? leftIntratype.ordering.compare(leftKey, rightKey)
: Integer.compare(leftIntratype.rank, rightIntratype.rank);
}
}
final CollectedOrdering ordering = new CollectedOrdering();
final ImmutableList<ExecutableElement> sortedList =
ordering.immutableSortedCopy(
disambiguateMethods(ElementFilter.methodsIn(
elements.getAllMembers(originatingType))));
return new AccessorProvider() {
ImmutableListMultimap<String, TypeElement> accessorMapping =
ImmutableListMultimap.copyOf(ordering.accessorMapping);
@Override
public ImmutableListMultimap<String, TypeElement> accessorMapping() {
return accessorMapping;
}
@Override
public ImmutableList<ExecutableElement> get() {
return sortedList;
}
};
} } | public class class_name {
public static AccessorProvider getAllAccessorsProvider(
final Elements elements,
final Types types,
final TypeElement originatingType) {
class CollectedOrdering extends Ordering<Element> {
class Intratype {
final String inType;
final Ordering<String> ordering;
final int rank;
Intratype(String inType, int rank, List<String> accessors) {
this.inType = inType;
this.rank = rank;
this.ordering = Ordering.explicit(accessors);
}
@Override
public String toString() {
return "(<=> " + inType + ", " + rank + ", " + ordering + ")";
}
}
final Map<String, Intratype> accessorOrderings = new LinkedHashMap<>();
final Set<TypeElement> linearizedTypes = new LinkedHashSet<>();
final ArrayListMultimap<String, TypeElement> accessorMapping = ArrayListMultimap.create();
CollectedOrdering() {
traverse(originatingType);
collectAccessors();
}
void traverse(@Nullable TypeElement element) {
if (element == null || isJavaLangObject(element)) {
return; // depends on control dependency: [if], data = [none]
}
for (TypeMirror implementedInterface : element.getInterfaces()) {
traverse(toElement(implementedInterface)); // depends on control dependency: [for], data = [implementedInterface]
}
if (element.getKind().isClass()) {
// collectEnclosing(element);
traverse(toElement(element.getSuperclass())); // depends on control dependency: [if], data = [none]
}
// we add this after so we start with the deepest
linearizedTypes.add(element);
}
@Nullable
TypeElement toElement(TypeMirror type) {
if (type.getKind() == TypeKind.DECLARED) {
return (TypeElement) ((DeclaredType) type).asElement(); // depends on control dependency: [if], data = [none]
}
return null;
}
void collectAccessors() {
int i = 0;
for (TypeElement type : linearizedTypes) {
List<String> accessorsInType =
FluentIterable.from(SourceOrdering.getEnclosedElements(type))
.filter(IsParameterlessNonstaticNonobject.PREDICATE)
.transform(ToSimpleName.FUNCTION)
.toList();
String typeTag = type.getSimpleName().toString();
Intratype intratype = new Intratype(typeTag, i++, accessorsInType);
for (String name : accessorsInType) {
// we override accessors by the ones redeclared in later types
accessorMapping.put(name, type); // depends on control dependency: [for], data = [name]
accessorOrderings.put(name, intratype); // depends on control dependency: [for], data = [name]
}
}
}
@Override
public int compare(Element left, Element right) {
String leftKey = ToSimpleName.FUNCTION.apply(left);
String rightKey = ToSimpleName.FUNCTION.apply(right);
Intratype leftIntratype = accessorOrderings.get(leftKey);
Intratype rightIntratype = accessorOrderings.get(rightKey);
return leftIntratype == rightIntratype
? leftIntratype.ordering.compare(leftKey, rightKey)
: Integer.compare(leftIntratype.rank, rightIntratype.rank);
}
}
final CollectedOrdering ordering = new CollectedOrdering();
final ImmutableList<ExecutableElement> sortedList =
ordering.immutableSortedCopy(
disambiguateMethods(ElementFilter.methodsIn(
elements.getAllMembers(originatingType))));
return new AccessorProvider() {
ImmutableListMultimap<String, TypeElement> accessorMapping =
ImmutableListMultimap.copyOf(ordering.accessorMapping);
@Override
public ImmutableListMultimap<String, TypeElement> accessorMapping() {
return accessorMapping;
}
@Override
public ImmutableList<ExecutableElement> get() {
return sortedList;
}
};
} } |
public class class_name {
protected static JMenuItem createItem (String name, Integer mnem, KeyStroke accel)
{
JMenuItem item = new JMenuItem(name);
if (mnem != null) {
item.setMnemonic(mnem.intValue());
}
if (accel != null) {
item.setAccelerator(accel);
}
return item;
} } | public class class_name {
protected static JMenuItem createItem (String name, Integer mnem, KeyStroke accel)
{
JMenuItem item = new JMenuItem(name);
if (mnem != null) {
item.setMnemonic(mnem.intValue()); // depends on control dependency: [if], data = [(mnem]
}
if (accel != null) {
item.setAccelerator(accel); // depends on control dependency: [if], data = [(accel]
}
return item;
} } |
public class class_name {
public void endElement(String namespaceURI, String localName, String name)
throws org.xml.sax.SAXException
{
if (m_inEntityRef)
return;
// namespaces declared at the current depth are no longer valid
// so get rid of them
m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null);
try
{
final java.io.Writer writer = m_writer;
if (m_elemContext.m_startTagOpen)
{
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
processAttributes(m_writer, nAttrs);
// clear attributes object for re-use with next element
m_attributes.clear();
}
if (m_spaceBeforeClose)
writer.write(" />");
else
writer.write("/>");
/* don't need to pop cdataSectionState because
* this element ended so quickly that we didn't get
* to push the state.
*/
}
else
{
if (m_cdataTagOpen)
closeCDATA();
if (shouldIndent())
indent(m_elemContext.m_currentElemDepth - 1);
writer.write('<');
writer.write('/');
writer.write(name);
writer.write('>');
}
}
catch (IOException e)
{
throw new SAXException(e);
}
if (!m_elemContext.m_startTagOpen && m_doIndent)
{
m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
}
m_isprevtext = false;
// fire off the end element event
if (m_tracer != null)
super.fireEndElem(name);
m_elemContext = m_elemContext.m_prev;
} } | public class class_name {
public void endElement(String namespaceURI, String localName, String name)
throws org.xml.sax.SAXException
{
if (m_inEntityRef)
return;
// namespaces declared at the current depth are no longer valid
// so get rid of them
m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null);
try
{
final java.io.Writer writer = m_writer;
if (m_elemContext.m_startTagOpen)
{
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
processAttributes(m_writer, nAttrs); // depends on control dependency: [if], data = [none]
// clear attributes object for re-use with next element
m_attributes.clear(); // depends on control dependency: [if], data = [none]
}
if (m_spaceBeforeClose)
writer.write(" />");
else
writer.write("/>");
/* don't need to pop cdataSectionState because
* this element ended so quickly that we didn't get
* to push the state.
*/
}
else
{
if (m_cdataTagOpen)
closeCDATA();
if (shouldIndent())
indent(m_elemContext.m_currentElemDepth - 1);
writer.write('<'); // depends on control dependency: [if], data = [none]
writer.write('/'); // depends on control dependency: [if], data = [none]
writer.write(name); // depends on control dependency: [if], data = [none]
writer.write('>'); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
throw new SAXException(e);
}
if (!m_elemContext.m_startTagOpen && m_doIndent)
{
m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
}
m_isprevtext = false;
// fire off the end element event
if (m_tracer != null)
super.fireEndElem(name);
m_elemContext = m_elemContext.m_prev;
} } |
public class class_name {
@Override
public Double getDoubleOrDie(String key) {
Double value = getDouble(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} } | public class class_name {
@Override
public Double getDoubleOrDie(String key) {
Double value = getDouble(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void processOneMetric(List<String> resultStrings, Server server, Result result, Object value, String addTagName,
String addTagValue) {
String metricName = this.metricNameStrategy.formatName(result);
//
// Skip any non-numeric values since OpenTSDB only supports numeric metrics.
//
if (isNumeric(value)) {
StringBuilder resultString = new StringBuilder();
formatResultString(resultString, metricName, result.getEpoch() / 1000L, value);
addTags(resultString, server);
if (addTagName != null) {
addTag(resultString, addTagName, addTagValue);
}
if (!typeNames.isEmpty()) {
this.addTypeNamesTags(resultString, result);
}
resultStrings.add(resultString.toString());
} else {
log.debug("Skipping non-numeric value for metric {}; value={}", metricName, value);
}
} } | public class class_name {
protected void processOneMetric(List<String> resultStrings, Server server, Result result, Object value, String addTagName,
String addTagValue) {
String metricName = this.metricNameStrategy.formatName(result);
//
// Skip any non-numeric values since OpenTSDB only supports numeric metrics.
//
if (isNumeric(value)) {
StringBuilder resultString = new StringBuilder();
formatResultString(resultString, metricName, result.getEpoch() / 1000L, value); // depends on control dependency: [if], data = [none]
addTags(resultString, server); // depends on control dependency: [if], data = [none]
if (addTagName != null) {
addTag(resultString, addTagName, addTagValue); // depends on control dependency: [if], data = [none]
}
if (!typeNames.isEmpty()) {
this.addTypeNamesTags(resultString, result); // depends on control dependency: [if], data = [none]
}
resultStrings.add(resultString.toString()); // depends on control dependency: [if], data = [none]
} else {
log.debug("Skipping non-numeric value for metric {}; value={}", metricName, value); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setPipelineExecutionSummaries(java.util.Collection<PipelineExecutionSummary> pipelineExecutionSummaries) {
if (pipelineExecutionSummaries == null) {
this.pipelineExecutionSummaries = null;
return;
}
this.pipelineExecutionSummaries = new java.util.ArrayList<PipelineExecutionSummary>(pipelineExecutionSummaries);
} } | public class class_name {
public void setPipelineExecutionSummaries(java.util.Collection<PipelineExecutionSummary> pipelineExecutionSummaries) {
if (pipelineExecutionSummaries == null) {
this.pipelineExecutionSummaries = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.pipelineExecutionSummaries = new java.util.ArrayList<PipelineExecutionSummary>(pipelineExecutionSummaries);
} } |
public class class_name {
public void visit(boolean depthFirst, Consumer<? super XElement> action) {
Deque<XElement> queue = new LinkedList<>();
queue.add(this);
while (!queue.isEmpty()) {
XElement x = queue.removeFirst();
action.accept(x);
if (depthFirst) {
ListIterator<XElement> li = x.children.listIterator(x.children.size());
while (li.hasPrevious()) {
queue.addFirst(li.previous());
}
} else {
for (XElement c : x.children) {
queue.addLast(c);
}
}
}
} } | public class class_name {
public void visit(boolean depthFirst, Consumer<? super XElement> action) {
Deque<XElement> queue = new LinkedList<>();
queue.add(this);
while (!queue.isEmpty()) {
XElement x = queue.removeFirst();
action.accept(x); // depends on control dependency: [while], data = [none]
if (depthFirst) {
ListIterator<XElement> li = x.children.listIterator(x.children.size());
while (li.hasPrevious()) {
queue.addFirst(li.previous()); // depends on control dependency: [while], data = [none]
}
} else {
for (XElement c : x.children) {
queue.addLast(c); // depends on control dependency: [for], data = [c]
}
}
}
} } |
public class class_name {
public static String implode(String[] inputArr, String delimiter) {
String implodedStr = "";
implodedStr += inputArr[0];
for (int i = 1; i < inputArr.length; i++) {
implodedStr += delimiter;
implodedStr += inputArr[i];
}
return implodedStr;
} } | public class class_name {
public static String implode(String[] inputArr, String delimiter) {
String implodedStr = "";
implodedStr += inputArr[0];
for (int i = 1; i < inputArr.length; i++) {
implodedStr += delimiter; // depends on control dependency: [for], data = [none]
implodedStr += inputArr[i]; // depends on control dependency: [for], data = [i]
}
return implodedStr;
} } |
public class class_name {
public final void setTongue(final String tongue) {
if (tongue != null && tongue.length() > 0) {
if (tongue.length() > 2) {
this.tongue = tongue.substring(0, 2);
} else {
this.tongue = tongue;
}
}
} } | public class class_name {
public final void setTongue(final String tongue) {
if (tongue != null && tongue.length() > 0) {
if (tongue.length() > 2) {
this.tongue = tongue.substring(0, 2); // depends on control dependency: [if], data = [2)]
} else {
this.tongue = tongue; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public synchronized void stop() {
if (!running) {
return;
}
LOGGER.info("stopping raft agent");
raftAlgorithm.stop();
raftNetworkClient.stop();
serverBossPool.shutdown();
clientBossPool.shutdown();
workerPool.shutdown();
sharedWorkerPool.shutdown();
sharedWorkerPool.destroy();
ioExecutorService.shutdownNow();
nonIoExecutorService.shutdownNow();
timer.stop();
snapshotStore.teardown();
jdbcLog.teardown();
jdbcStore.teardown();
running = false;
initialized = false;
} } | public class class_name {
public synchronized void stop() {
if (!running) {
return; // depends on control dependency: [if], data = [none]
}
LOGGER.info("stopping raft agent");
raftAlgorithm.stop();
raftNetworkClient.stop();
serverBossPool.shutdown();
clientBossPool.shutdown();
workerPool.shutdown();
sharedWorkerPool.shutdown();
sharedWorkerPool.destroy();
ioExecutorService.shutdownNow();
nonIoExecutorService.shutdownNow();
timer.stop();
snapshotStore.teardown();
jdbcLog.teardown();
jdbcStore.teardown();
running = false;
initialized = false;
} } |
public class class_name {
protected boolean addWork(final ForkJoinContext<?> context) {
requireNotStopped(this);
final boolean result = workQueue.addWaitingWork(context);
if (result) {
addWorkerIfNeeded();
}
return result;
} } | public class class_name {
protected boolean addWork(final ForkJoinContext<?> context) {
requireNotStopped(this);
final boolean result = workQueue.addWaitingWork(context);
if (result) {
addWorkerIfNeeded(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private Map<String, List<DBObject>> onPersist(Map<String, List<DBObject>> collections, Object entity, Object id,
EntityMetadata metadata, List<RelationHolder> relationHolders, boolean isUpdate)
{
persistenceUnit = metadata.getPersistenceUnit();
Map<String, DBObject> documents = handler.getDocumentFromEntity(metadata, entity, relationHolders,
kunderaMetadata);
if (isUpdate)
{
for (String documentName : documents.keySet())
{
BasicDBObject query = new BasicDBObject();
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
metadata.getPersistenceUnit());
if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType()))
{
MongoDBUtils.populateCompoundKey(query, metadata, metaModel, id);
}
else
{
query.put("_id", MongoDBUtils.populateValue(id, id.getClass()));
}
DBCollection dbCollection = mongoDb.getCollection(documentName);
KunderaCoreUtils.printQuery("Persist collection:" + documentName, showQuery);
dbCollection.save(documents.get(documentName), getWriteConcern());
}
}
else
{
for (String documentName : documents.keySet())
{
// a db collection can have multiple records..
// and we can have a collection of records as well.
List<DBObject> dbStatements = null;
if (collections.containsKey(documentName))
{
dbStatements = collections.get(documentName);
dbStatements.add(documents.get(documentName));
}
else
{
dbStatements = new ArrayList<DBObject>();
dbStatements.add(documents.get(documentName));
collections.put(documentName, dbStatements);
}
}
}
return collections;
} } | public class class_name {
private Map<String, List<DBObject>> onPersist(Map<String, List<DBObject>> collections, Object entity, Object id,
EntityMetadata metadata, List<RelationHolder> relationHolders, boolean isUpdate)
{
persistenceUnit = metadata.getPersistenceUnit();
Map<String, DBObject> documents = handler.getDocumentFromEntity(metadata, entity, relationHolders,
kunderaMetadata);
if (isUpdate)
{
for (String documentName : documents.keySet())
{
BasicDBObject query = new BasicDBObject();
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
metadata.getPersistenceUnit());
if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType()))
{
MongoDBUtils.populateCompoundKey(query, metadata, metaModel, id); // depends on control dependency: [if], data = [none]
}
else
{
query.put("_id", MongoDBUtils.populateValue(id, id.getClass())); // depends on control dependency: [if], data = [none]
}
DBCollection dbCollection = mongoDb.getCollection(documentName);
KunderaCoreUtils.printQuery("Persist collection:" + documentName, showQuery); // depends on control dependency: [for], data = [documentName]
dbCollection.save(documents.get(documentName), getWriteConcern()); // depends on control dependency: [for], data = [documentName]
}
}
else
{
for (String documentName : documents.keySet())
{
// a db collection can have multiple records..
// and we can have a collection of records as well.
List<DBObject> dbStatements = null;
if (collections.containsKey(documentName))
{
dbStatements = collections.get(documentName); // depends on control dependency: [if], data = [none]
dbStatements.add(documents.get(documentName)); // depends on control dependency: [if], data = [none]
}
else
{
dbStatements = new ArrayList<DBObject>(); // depends on control dependency: [if], data = [none]
dbStatements.add(documents.get(documentName)); // depends on control dependency: [if], data = [none]
collections.put(documentName, dbStatements); // depends on control dependency: [if], data = [none]
}
}
}
return collections;
} } |
public class class_name {
@Override
public AllocationPoint allocateMemory(DataBuffer buffer, AllocationShape requiredMemory, AllocationStatus location,
boolean initialize) {
AllocationPoint point = new AllocationPoint();
useTracker.set(System.currentTimeMillis());
// we use these longs as tracking codes for memory tracking
Long allocId = objectsTracker.getAndIncrement();
//point.attachBuffer(buffer);
point.setObjectId(allocId);
point.setShape(requiredMemory);
/*
if (buffer instanceof CudaIntDataBuffer) {
buffer.setConstant(true);
point.setConstant(true);
}
*/
/*int numBuckets = configuration.getNumberOfGcThreads();
int bucketId = RandomUtils.nextInt(0, numBuckets);
GarbageBufferReference reference =
new GarbageBufferReference((BaseDataBuffer) buffer, queueMap.get(bucketId), point);*/
//point.attachReference(reference);
point.setDeviceId(-1);
if (buffer.isAttached()) {
long reqMem = AllocationUtils.getRequiredMemory(requiredMemory);
//log.info("Allocating {} bytes from attached memory...", reqMem);
// workaround for init order
getMemoryHandler().getCudaContext();
point.setDeviceId(Nd4j.getAffinityManager().getDeviceForCurrentThread());
val workspace = (CudaWorkspace) Nd4j.getMemoryManager().getCurrentWorkspace();
val pair = new PointersPair();
val ptrDev = workspace.alloc(reqMem, MemoryKind.DEVICE, requiredMemory.getDataType(), initialize);
//val addr = ptrDev.address();
//log.info("Allocated device pointer: {}; Divider: {}; ReqMem: {}; ReqMem divider: {};", addr, addr % 8, reqMem, reqMem % 8);
val ptrHost = workspace.alloc(reqMem, MemoryKind.HOST, requiredMemory.getDataType(), initialize);
pair.setHostPointer(ptrHost);
if (ptrDev != null) {
pair.setDevicePointer(ptrDev);
point.setAllocationStatus(AllocationStatus.DEVICE);
} else {
pair.setDevicePointer(ptrHost);
point.setAllocationStatus(AllocationStatus.HOST);
}
point.setAttached(true);
point.setPointers(pair);
} else {
// we stay naive on PointersPair, we just don't know on this level, which pointers are set. MemoryHandler will be used for that
PointersPair pair = memoryHandler.alloc(location, point, requiredMemory, initialize);
point.setPointers(pair);
}
allocationsMap.put(allocId, point);
//point.tickHostRead();
point.tickDeviceWrite();
return point;
} } | public class class_name {
@Override
public AllocationPoint allocateMemory(DataBuffer buffer, AllocationShape requiredMemory, AllocationStatus location,
boolean initialize) {
AllocationPoint point = new AllocationPoint();
useTracker.set(System.currentTimeMillis());
// we use these longs as tracking codes for memory tracking
Long allocId = objectsTracker.getAndIncrement();
//point.attachBuffer(buffer);
point.setObjectId(allocId);
point.setShape(requiredMemory);
/*
if (buffer instanceof CudaIntDataBuffer) {
buffer.setConstant(true);
point.setConstant(true);
}
*/
/*int numBuckets = configuration.getNumberOfGcThreads();
int bucketId = RandomUtils.nextInt(0, numBuckets);
GarbageBufferReference reference =
new GarbageBufferReference((BaseDataBuffer) buffer, queueMap.get(bucketId), point);*/
//point.attachReference(reference);
point.setDeviceId(-1);
if (buffer.isAttached()) {
long reqMem = AllocationUtils.getRequiredMemory(requiredMemory);
//log.info("Allocating {} bytes from attached memory...", reqMem);
// workaround for init order
getMemoryHandler().getCudaContext(); // depends on control dependency: [if], data = [none]
point.setDeviceId(Nd4j.getAffinityManager().getDeviceForCurrentThread()); // depends on control dependency: [if], data = [none]
val workspace = (CudaWorkspace) Nd4j.getMemoryManager().getCurrentWorkspace();
val pair = new PointersPair();
val ptrDev = workspace.alloc(reqMem, MemoryKind.DEVICE, requiredMemory.getDataType(), initialize);
//val addr = ptrDev.address();
//log.info("Allocated device pointer: {}; Divider: {}; ReqMem: {}; ReqMem divider: {};", addr, addr % 8, reqMem, reqMem % 8);
val ptrHost = workspace.alloc(reqMem, MemoryKind.HOST, requiredMemory.getDataType(), initialize);
pair.setHostPointer(ptrHost); // depends on control dependency: [if], data = [none]
if (ptrDev != null) {
pair.setDevicePointer(ptrDev); // depends on control dependency: [if], data = [(ptrDev]
point.setAllocationStatus(AllocationStatus.DEVICE); // depends on control dependency: [if], data = [none]
} else {
pair.setDevicePointer(ptrHost); // depends on control dependency: [if], data = [none]
point.setAllocationStatus(AllocationStatus.HOST); // depends on control dependency: [if], data = [none]
}
point.setAttached(true); // depends on control dependency: [if], data = [none]
point.setPointers(pair); // depends on control dependency: [if], data = [none]
} else {
// we stay naive on PointersPair, we just don't know on this level, which pointers are set. MemoryHandler will be used for that
PointersPair pair = memoryHandler.alloc(location, point, requiredMemory, initialize);
point.setPointers(pair); // depends on control dependency: [if], data = [none]
}
allocationsMap.put(allocId, point);
//point.tickHostRead();
point.tickDeviceWrite();
return point;
} } |
public class class_name {
public void marshall(ModifyHsmRequest modifyHsmRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyHsmRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyHsmRequest.getHsmArn(), HSMARN_BINDING);
protocolMarshaller.marshall(modifyHsmRequest.getSubnetId(), SUBNETID_BINDING);
protocolMarshaller.marshall(modifyHsmRequest.getEniIp(), ENIIP_BINDING);
protocolMarshaller.marshall(modifyHsmRequest.getIamRoleArn(), IAMROLEARN_BINDING);
protocolMarshaller.marshall(modifyHsmRequest.getExternalId(), EXTERNALID_BINDING);
protocolMarshaller.marshall(modifyHsmRequest.getSyslogIp(), SYSLOGIP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ModifyHsmRequest modifyHsmRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyHsmRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyHsmRequest.getHsmArn(), HSMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyHsmRequest.getSubnetId(), SUBNETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyHsmRequest.getEniIp(), ENIIP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyHsmRequest.getIamRoleArn(), IAMROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyHsmRequest.getExternalId(), EXTERNALID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyHsmRequest.getSyslogIp(), SYSLOGIP_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double[] createBoundingBox(double[] coordinates) {
int maxActualCoords = Math.min(coordinates.length,3);// ignore potential M values, so 4 dimension (X Y Z M) becomes X Y Z
double[] result = new double[maxActualCoords * 2];
for (int i = 0; i < maxActualCoords; i++) {
result[i] = coordinates[i];
result[maxActualCoords + i] = coordinates[i];
}
return result;
} } | public class class_name {
public static double[] createBoundingBox(double[] coordinates) {
int maxActualCoords = Math.min(coordinates.length,3);// ignore potential M values, so 4 dimension (X Y Z M) becomes X Y Z
double[] result = new double[maxActualCoords * 2];
for (int i = 0; i < maxActualCoords; i++) {
result[i] = coordinates[i]; // depends on control dependency: [for], data = [i]
result[maxActualCoords + i] = coordinates[i]; // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@Override
public PropertyResolver build() {
if (resolver != null) {
return resolver;
}
Converter converter = buildConverter();
List<PropertyResolver> delegates = buildProperties(converter);
return new FirstExistingPropertiesResolver(delegates);
} } | public class class_name {
@Override
public PropertyResolver build() {
if (resolver != null) {
return resolver; // depends on control dependency: [if], data = [none]
}
Converter converter = buildConverter();
List<PropertyResolver> delegates = buildProperties(converter);
return new FirstExistingPropertiesResolver(delegates);
} } |
public class class_name {
public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> listCertificatesNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listCertificatesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<AppServiceCertificateResourceInner>> result = listCertificatesNextDelegate(response);
return Observable.just(new ServiceResponse<Page<AppServiceCertificateResourceInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> listCertificatesNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listCertificatesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<AppServiceCertificateResourceInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<AppServiceCertificateResourceInner>> result = listCertificatesNextDelegate(response);
return Observable.just(new ServiceResponse<Page<AppServiceCertificateResourceInner>>(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 {
public static String parseErrorMessage(String errorMessage) {
StringBuilder response = new StringBuilder();
Pattern pattern = Pattern.compile(".*?/series/(\\d*?)/default/(\\d*?)/(\\d*?)/.*?");
Matcher matcher = pattern.matcher(errorMessage);
// See if the error message matches the pattern and therefore we can decode it
if (matcher.find() && matcher.groupCount() == ERROR_MSG_GROUP_COUNT) {
int seriesId = Integer.parseInt(matcher.group(ERROR_MSG_SERIES));
int seasonId = Integer.parseInt(matcher.group(ERROR_MSG_SEASON));
int episodeId = Integer.parseInt(matcher.group(ERROR_MSG_EPISODE));
response.append("Series Id: ").append(seriesId);
response.append(", Season: ").append(seasonId);
response.append(", Episode: ").append(episodeId);
response.append(": ");
if (episodeId == 0) {
// We should probably try an scrape season 0/episode 1
response.append("Episode seems to be a misnamed pilot episode.");
} else if (episodeId > MAX_EPISODE) {
response.append("Episode number seems to be too large.");
} else if (seasonId == 0 && episodeId > 1) {
response.append("This special episode does not exist.");
} else if (errorMessage.toLowerCase().contains(ERROR_NOT_ALLOWED_IN_PROLOG)) {
response.append(ERROR_RETRIEVE_EPISODE_INFO);
} else {
response.append("Unknown episode error: ").append(errorMessage);
}
} else // Don't recognise the error format, so just return it
{
if (errorMessage.toLowerCase().contains(ERROR_NOT_ALLOWED_IN_PROLOG)) {
response.append(ERROR_RETRIEVE_EPISODE_INFO);
} else {
response.append("Episode error: ").append(errorMessage);
}
}
return response.toString();
} } | public class class_name {
public static String parseErrorMessage(String errorMessage) {
StringBuilder response = new StringBuilder();
Pattern pattern = Pattern.compile(".*?/series/(\\d*?)/default/(\\d*?)/(\\d*?)/.*?");
Matcher matcher = pattern.matcher(errorMessage);
// See if the error message matches the pattern and therefore we can decode it
if (matcher.find() && matcher.groupCount() == ERROR_MSG_GROUP_COUNT) {
int seriesId = Integer.parseInt(matcher.group(ERROR_MSG_SERIES));
int seasonId = Integer.parseInt(matcher.group(ERROR_MSG_SEASON));
int episodeId = Integer.parseInt(matcher.group(ERROR_MSG_EPISODE));
response.append("Series Id: ").append(seriesId); // depends on control dependency: [if], data = [none]
response.append(", Season: ").append(seasonId); // depends on control dependency: [if], data = [none]
response.append(", Episode: ").append(episodeId); // depends on control dependency: [if], data = [none]
response.append(": "); // depends on control dependency: [if], data = [none]
if (episodeId == 0) {
// We should probably try an scrape season 0/episode 1
response.append("Episode seems to be a misnamed pilot episode."); // depends on control dependency: [if], data = [none]
} else if (episodeId > MAX_EPISODE) {
response.append("Episode number seems to be too large."); // depends on control dependency: [if], data = [none]
} else if (seasonId == 0 && episodeId > 1) {
response.append("This special episode does not exist."); // depends on control dependency: [if], data = [none]
} else if (errorMessage.toLowerCase().contains(ERROR_NOT_ALLOWED_IN_PROLOG)) {
response.append(ERROR_RETRIEVE_EPISODE_INFO); // depends on control dependency: [if], data = [none]
} else {
response.append("Unknown episode error: ").append(errorMessage); // depends on control dependency: [if], data = [none]
}
} else // Don't recognise the error format, so just return it
{
if (errorMessage.toLowerCase().contains(ERROR_NOT_ALLOWED_IN_PROLOG)) {
response.append(ERROR_RETRIEVE_EPISODE_INFO); // depends on control dependency: [if], data = [none]
} else {
response.append("Episode error: ").append(errorMessage); // depends on control dependency: [if], data = [none]
}
}
return response.toString();
} } |
public class class_name {
public T extractFromPayload(String path, String variable) {
if (JsonPathMessageValidationContext.isJsonPathExpression(path)) {
getJsonPathVariableExtractor().getJsonPathExpressions().put(path, variable);
} else {
getXpathVariableExtractor().getXpathExpressions().put(path, variable);
}
return self;
} } | public class class_name {
public T extractFromPayload(String path, String variable) {
if (JsonPathMessageValidationContext.isJsonPathExpression(path)) {
getJsonPathVariableExtractor().getJsonPathExpressions().put(path, variable); // depends on control dependency: [if], data = [none]
} else {
getXpathVariableExtractor().getXpathExpressions().put(path, variable); // depends on control dependency: [if], data = [none]
}
return self;
} } |
public class class_name {
public void addText(Phrase phrase) {
if (phrase == null || composite)
return;
addWaitingPhrase();
if (bidiLine == null) {
waitPhrase = phrase;
return;
}
for (Iterator j = phrase.getChunks().iterator(); j.hasNext();) {
bidiLine.addChunk(new PdfChunk((Chunk)j.next(), null));
}
} } | public class class_name {
public void addText(Phrase phrase) {
if (phrase == null || composite)
return;
addWaitingPhrase();
if (bidiLine == null) {
waitPhrase = phrase; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (Iterator j = phrase.getChunks().iterator(); j.hasNext();) {
bidiLine.addChunk(new PdfChunk((Chunk)j.next(), null)); // depends on control dependency: [for], data = [j]
}
} } |
public class class_name {
public synchronized void remove(Runnable runnable) {
Iterator<ScheduledRunnable> iterator = runnables.iterator();
while (iterator.hasNext()) {
if (iterator.next().runnable == runnable) {
iterator.remove();
}
}
} } | public class class_name {
public synchronized void remove(Runnable runnable) {
Iterator<ScheduledRunnable> iterator = runnables.iterator();
while (iterator.hasNext()) {
if (iterator.next().runnable == runnable) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <E> Comparator<E> toComparator(final Counter<E> counter, final boolean ascending, final boolean useMagnitude) {
return new Comparator<E>() {
public int compare(E o1, E o2) {
if (ascending) {
if (useMagnitude) {
return Double.compare(Math.abs(counter.getCount(o1)), Math.abs(counter.getCount(o2)));
} else {
return Double.compare(counter.getCount(o1), counter.getCount(o2));
}
} else {
// Descending
if (useMagnitude) {
return Double.compare(Math.abs(counter.getCount(o2)), Math.abs(counter.getCount(o1)));
} else {
return Double.compare(counter.getCount(o2), counter.getCount(o1));
}
}
}
};
} } | public class class_name {
public static <E> Comparator<E> toComparator(final Counter<E> counter, final boolean ascending, final boolean useMagnitude) {
return new Comparator<E>() {
public int compare(E o1, E o2) {
if (ascending) {
if (useMagnitude) {
return Double.compare(Math.abs(counter.getCount(o1)), Math.abs(counter.getCount(o2)));
// depends on control dependency: [if], data = [none]
} else {
return Double.compare(counter.getCount(o1), counter.getCount(o2));
// depends on control dependency: [if], data = [none]
}
} else {
// Descending
if (useMagnitude) {
return Double.compare(Math.abs(counter.getCount(o2)), Math.abs(counter.getCount(o1)));
// depends on control dependency: [if], data = [none]
} else {
return Double.compare(counter.getCount(o2), counter.getCount(o1));
// depends on control dependency: [if], data = [none]
}
}
}
};
} } |
public class class_name {
private List<CmsRole> getRolesList(VerticalLayout parent, boolean importCase) {
List<CmsRole> res = new ArrayList<CmsRole>();
CmsEditableGroup editableGroup = importCase ? m_importRolesGroup : m_exportRolesGroup;
for (I_CmsEditableGroupRow row : editableGroup.getRows()) {
res.add(((ComboBox<CmsRole>)row.getComponent()).getValue());
}
return res;
} } | public class class_name {
private List<CmsRole> getRolesList(VerticalLayout parent, boolean importCase) {
List<CmsRole> res = new ArrayList<CmsRole>();
CmsEditableGroup editableGroup = importCase ? m_importRolesGroup : m_exportRolesGroup;
for (I_CmsEditableGroupRow row : editableGroup.getRows()) {
res.add(((ComboBox<CmsRole>)row.getComponent()).getValue()); // depends on control dependency: [for], data = [row]
}
return res;
} } |
public class class_name {
private String resolveName() {
if (this.readMethod != null) {
int index = this.readMethod.getName().indexOf("get");
if (index != -1) {
index += 3;
}
else {
index = this.readMethod.getName().indexOf("is");
if (index == -1) {
throw new IllegalArgumentException("Not a getter method");
}
index += 2;
}
return StringUtils.uncapitalize(this.readMethod.getName().substring(index));
}
else {
int index = this.writeMethod.getName().indexOf("set") + 3;
if (index == -1) {
throw new IllegalArgumentException("Not a setter method");
}
return StringUtils.uncapitalize(this.writeMethod.getName().substring(index));
}
} } | public class class_name {
private String resolveName() {
if (this.readMethod != null) {
int index = this.readMethod.getName().indexOf("get");
if (index != -1) {
index += 3; // depends on control dependency: [if], data = [none]
}
else {
index = this.readMethod.getName().indexOf("is"); // depends on control dependency: [if], data = [none]
if (index == -1) {
throw new IllegalArgumentException("Not a getter method");
}
index += 2; // depends on control dependency: [if], data = [none]
}
return StringUtils.uncapitalize(this.readMethod.getName().substring(index)); // depends on control dependency: [if], data = [(this.readMethod]
}
else {
int index = this.writeMethod.getName().indexOf("set") + 3;
if (index == -1) {
throw new IllegalArgumentException("Not a setter method");
}
return StringUtils.uncapitalize(this.writeMethod.getName().substring(index)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public double render(Graphics2D g) {
Color previousColor = g.getColor();
setColor(g, ScoreElements.TABLATURE_LINES);
number.setText("MM");
double mWidth = number.getWidth();
double numberOfStrings = m_tablature.getNumberOfString();
for (int i = 1; i <= numberOfStrings; i++) {
//String name
double y = getTextY(i);
number.setText(m_tablature.getStringNote(i).getName());
number.setBase(new Point2D.Double(getBase().getX()+mWidth/2, y));
number.setTextVerticalAlign(TextVerticalAlign.BOTTOM);
number.setTextJustification(TextJustification.CENTER);
number.render(g);
// line
y = getLineY(i);
g.drawLine((int)(getBase().getX()+mWidth),
(int)y,
(int)(getBase().getX()+width),
(int)y);
}
g.setColor(previousColor);
return getWidth();
} } | public class class_name {
public double render(Graphics2D g) {
Color previousColor = g.getColor();
setColor(g, ScoreElements.TABLATURE_LINES);
number.setText("MM");
double mWidth = number.getWidth();
double numberOfStrings = m_tablature.getNumberOfString();
for (int i = 1; i <= numberOfStrings; i++) {
//String name
double y = getTextY(i);
number.setText(m_tablature.getStringNote(i).getName());
// depends on control dependency: [for], data = [i]
number.setBase(new Point2D.Double(getBase().getX()+mWidth/2, y));
// depends on control dependency: [for], data = [none]
number.setTextVerticalAlign(TextVerticalAlign.BOTTOM);
// depends on control dependency: [for], data = [none]
number.setTextJustification(TextJustification.CENTER);
// depends on control dependency: [for], data = [none]
number.render(g);
// depends on control dependency: [for], data = [none]
// line
y = getLineY(i);
// depends on control dependency: [for], data = [i]
g.drawLine((int)(getBase().getX()+mWidth),
(int)y,
(int)(getBase().getX()+width),
(int)y);
// depends on control dependency: [for], data = [none]
}
g.setColor(previousColor);
return getWidth();
} } |
public class class_name {
public static String getScheme(String uriString) {
try {
return (new URI(uriString)).getScheme();
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getScheme();
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} } | public class class_name {
public static String getScheme(String uriString) {
try {
return (new URI(uriString)).getScheme(); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getScheme(); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean detectLogFromBugsnag(Throwable throwable) {
// Check all places that LOGGER is called with an exception in the Bugsnag library
for (StackTraceElement element : throwable.getStackTrace()) {
for (String excludedClass : EXCLUDED_CLASSES) {
if (element.getClassName().startsWith(excludedClass)) {
return true;
}
}
}
return false;
} } | public class class_name {
private boolean detectLogFromBugsnag(Throwable throwable) {
// Check all places that LOGGER is called with an exception in the Bugsnag library
for (StackTraceElement element : throwable.getStackTrace()) {
for (String excludedClass : EXCLUDED_CLASSES) {
if (element.getClassName().startsWith(excludedClass)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
protected boolean seekToRow(long currentRow) throws IOException {
boolean seeked = false;
// If this holds it means we checked if the row is null, and it was not,
// and when we skipRows we don't want to skip this row.
if (currentRow != previousPresentRow) {
nextIsNull(currentRow);
}
if (valuePresent) {
if (currentRow != previousRow + 1) {
numNonNulls--;
long rowInStripe = currentRow - rowBaseInStripe - 1;
int rowIndexEntry = computeRowIndexEntry(currentRow);
// if previous == rowIndexEntry * rowIndexStride - 1 even though they are in different
// index strides seeking will only leaves us where we are.
if ((previousRow != rowIndexEntry * rowIndexStride - 1 &&
rowIndexEntry != computeRowIndexEntry(previousRow)) || currentRow < previousRow) {
if (present == null) {
previousRowIndexEntry = rowIndexEntry;
numNonNulls = countNonNulls(rowInStripe - (rowIndexEntry * rowIndexStride));
}
seek(rowIndexEntry, currentRow <= previousRow);
skipRows(numNonNulls);
} else {
if (present == null) {
// If present is null, it means there are no nulls in this column
// so the number of nonNulls is the number of rows being skipped
numNonNulls = currentRow - previousRow - 1;
}
skipRows(numNonNulls);
}
seeked = true;
}
numNonNulls = 0;
previousRow = currentRow;
}
return seeked;
} } | public class class_name {
protected boolean seekToRow(long currentRow) throws IOException {
boolean seeked = false;
// If this holds it means we checked if the row is null, and it was not,
// and when we skipRows we don't want to skip this row.
if (currentRow != previousPresentRow) {
nextIsNull(currentRow);
}
if (valuePresent) {
if (currentRow != previousRow + 1) {
numNonNulls--; // depends on control dependency: [if], data = [none]
long rowInStripe = currentRow - rowBaseInStripe - 1;
int rowIndexEntry = computeRowIndexEntry(currentRow);
// if previous == rowIndexEntry * rowIndexStride - 1 even though they are in different
// index strides seeking will only leaves us where we are.
if ((previousRow != rowIndexEntry * rowIndexStride - 1 &&
rowIndexEntry != computeRowIndexEntry(previousRow)) || currentRow < previousRow) {
if (present == null) {
previousRowIndexEntry = rowIndexEntry; // depends on control dependency: [if], data = [none]
numNonNulls = countNonNulls(rowInStripe - (rowIndexEntry * rowIndexStride)); // depends on control dependency: [if], data = [none]
}
seek(rowIndexEntry, currentRow <= previousRow); // depends on control dependency: [if], data = [none]
skipRows(numNonNulls); // depends on control dependency: [if], data = [none]
} else {
if (present == null) {
// If present is null, it means there are no nulls in this column
// so the number of nonNulls is the number of rows being skipped
numNonNulls = currentRow - previousRow - 1; // depends on control dependency: [if], data = [none]
}
skipRows(numNonNulls); // depends on control dependency: [if], data = [none]
}
seeked = true; // depends on control dependency: [if], data = [none]
}
numNonNulls = 0;
previousRow = currentRow;
}
return seeked;
} } |
public class class_name {
public int setString(String strValue, boolean bDisplayOption, int iMoveMode)
{
NumberField numberField = (NumberField)this.getField();
if ((strValue == null) || (strValue.length() == 0))
return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display
Number tempBinary = null;
try {
tempBinary = (Number)numberField.stringToBinary(strValue);
} catch (Exception ex) {
Task task = numberField.getRecord().getRecordOwner().getTask();
return task.setLastError(ex.getMessage());
}
double dValue = tempBinary.doubleValue();
if (dValue != 0)
dValue = dValue / 100;
return this.setValue(dValue, bDisplayOption, iMoveMode);
} } | public class class_name {
public int setString(String strValue, boolean bDisplayOption, int iMoveMode)
{
NumberField numberField = (NumberField)this.getField();
if ((strValue == null) || (strValue.length() == 0))
return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display
Number tempBinary = null;
try {
tempBinary = (Number)numberField.stringToBinary(strValue); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Task task = numberField.getRecord().getRecordOwner().getTask();
return task.setLastError(ex.getMessage());
} // depends on control dependency: [catch], data = [none]
double dValue = tempBinary.doubleValue();
if (dValue != 0)
dValue = dValue / 100;
return this.setValue(dValue, bDisplayOption, iMoveMode);
} } |
public class class_name {
@Override
public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL)
throws XMLStreamException
{
if (mDTDHandler != null) {
/* 24-Nov-2006, TSa: Note: SAX expects system identifiers to
* be fully resolved when reported...
*/
if (systemId != null && systemId.indexOf(':') < 0) {
try {
systemId = URLUtil.urlFromSystemId(systemId, baseURL).toExternalForm();
} catch (IOException ioe) {
throw new WstxIOException(ioe);
}
}
try {
mDTDHandler.notationDecl(name, publicId, systemId);
} catch (SAXException sex) {
throw new WrappedSaxException(sex);
}
}
} } | public class class_name {
@Override
public void dtdNotationDecl(String name, String publicId, String systemId, URL baseURL)
throws XMLStreamException
{
if (mDTDHandler != null) {
/* 24-Nov-2006, TSa: Note: SAX expects system identifiers to
* be fully resolved when reported...
*/
if (systemId != null && systemId.indexOf(':') < 0) {
try {
systemId = URLUtil.urlFromSystemId(systemId, baseURL).toExternalForm(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw new WstxIOException(ioe);
} // depends on control dependency: [catch], data = [none]
}
try {
mDTDHandler.notationDecl(name, publicId, systemId);
} catch (SAXException sex) {
throw new WrappedSaxException(sex);
}
}
} } |
public class class_name {
@Nullable
public static Bitmap createDrawableBitmap(@NonNull Drawable drawable) {
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
if (width <= 0 || height <= 0) {
return null;
}
float scale = Math.min(1f, ((float)MAX_IMAGE_SIZE) / (width * height));
if (drawable instanceof BitmapDrawable && scale == 1f) {
// return same bitmap if scale down not needed
return ((BitmapDrawable) drawable).getBitmap();
}
int bitmapWidth = (int) (width * scale);
int bitmapHeight = (int) (height * scale);
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Rect existingBounds = drawable.getBounds();
int left = existingBounds.left;
int top = existingBounds.top;
int right = existingBounds.right;
int bottom = existingBounds.bottom;
drawable.setBounds(0, 0, bitmapWidth, bitmapHeight);
drawable.draw(canvas);
drawable.setBounds(left, top, right, bottom);
return bitmap;
} } | public class class_name {
@Nullable
public static Bitmap createDrawableBitmap(@NonNull Drawable drawable) {
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
if (width <= 0 || height <= 0) {
return null; // depends on control dependency: [if], data = [none]
}
float scale = Math.min(1f, ((float)MAX_IMAGE_SIZE) / (width * height));
if (drawable instanceof BitmapDrawable && scale == 1f) {
// return same bitmap if scale down not needed
return ((BitmapDrawable) drawable).getBitmap(); // depends on control dependency: [if], data = [none]
}
int bitmapWidth = (int) (width * scale);
int bitmapHeight = (int) (height * scale);
Bitmap bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Rect existingBounds = drawable.getBounds();
int left = existingBounds.left;
int top = existingBounds.top;
int right = existingBounds.right;
int bottom = existingBounds.bottom;
drawable.setBounds(0, 0, bitmapWidth, bitmapHeight);
drawable.draw(canvas);
drawable.setBounds(left, top, right, bottom);
return bitmap;
} } |
public class class_name {
@Override
public final void beforeRun() {
try {
onMigrationStart();
verifyNodeStarted();
verifyMaster();
verifyMigrationParticipant();
verifyClusterState();
applyCompletedMigrations();
verifyPartitionStateVersion();
} catch (Exception e) {
onMigrationComplete();
throw e;
}
} } | public class class_name {
@Override
public final void beforeRun() {
try {
onMigrationStart(); // depends on control dependency: [try], data = [none]
verifyNodeStarted(); // depends on control dependency: [try], data = [none]
verifyMaster(); // depends on control dependency: [try], data = [none]
verifyMigrationParticipant(); // depends on control dependency: [try], data = [none]
verifyClusterState(); // depends on control dependency: [try], data = [none]
applyCompletedMigrations(); // depends on control dependency: [try], data = [none]
verifyPartitionStateVersion(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
onMigrationComplete();
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int[][] toInt(double[][] array) {
int[][] n = new int[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (int) array[i][j];
}
}
return n;
} } | public class class_name {
public static int[][] toInt(double[][] array) {
int[][] n = new int[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (int) array[i][j]; // depends on control dependency: [for], data = [j]
}
}
return n;
} } |
public class class_name {
public static void writeCSVColumns(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
double[] xData = series.getXData();
double[] yData = series.getYData();
double[] errorBarData = series.getExtraValues();
for (int i = 0; i < xData.length; i++) {
StringBuilder sb = new StringBuilder();
sb.append(xData[i]).append(",");
sb.append(yData[i]).append(",");
if (errorBarData != null) {
sb.append(errorBarData[i]).append(",");
}
sb.setLength(sb.length() - 1);
sb.append(System.getProperty("line.separator"));
// String csv = xDataPoint + "," + yDataPoint + errorBarValue == null ? "" : ("," +
// errorBarValue) + System.getProperty("line.separator");
// String csv = + yDataPoint + System.getProperty("line.separator");
out.write(sb.toString());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
// NOP
}
}
}
} } | public class class_name {
public static void writeCSVColumns(XYSeries series, String path2Dir) {
File newFile = new File(path2Dir + series.getName() + ".csv");
Writer out = null;
try {
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
double[] xData = series.getXData();
double[] yData = series.getYData();
double[] errorBarData = series.getExtraValues();
for (int i = 0; i < xData.length; i++) {
StringBuilder sb = new StringBuilder();
sb.append(xData[i]).append(",");
sb.append(yData[i]).append(",");
if (errorBarData != null) {
sb.append(errorBarData[i]).append(","); // depends on control dependency: [if], data = [(errorBarData]
}
sb.setLength(sb.length() - 1);
sb.append(System.getProperty("line.separator"));
// String csv = xDataPoint + "," + yDataPoint + errorBarValue == null ? "" : ("," +
// errorBarValue) + System.getProperty("line.separator");
// String csv = + yDataPoint + System.getProperty("line.separator");
out.write(sb.toString());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
// NOP
}
}
}
} } |
public class class_name {
public static FlinkJoinType getFlinkJoinType(Join join) {
if (join instanceof SemiJoin) {
// TODO supports ANTI
return FlinkJoinType.SEMI;
} else {
return toFlinkJoinType(join.getJoinType());
}
} } | public class class_name {
public static FlinkJoinType getFlinkJoinType(Join join) {
if (join instanceof SemiJoin) {
// TODO supports ANTI
return FlinkJoinType.SEMI; // depends on control dependency: [if], data = [none]
} else {
return toFlinkJoinType(join.getJoinType()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void uploadFileItems(final List<FileItem> fileItems, final Map<String, String[]> parameters,
final Map<String, FileItem[]> files) {
for (FileItem item : fileItems) {
String name = item.getFieldName();
boolean formField = item.isFormField();
if (LOG.isDebugEnabled()) {
LOG.debug(
"Uploading form " + (formField ? "field" : "attachment") + " \"" + name + "\"");
}
if (formField) {
String value;
try {
// Without specifying UTF-8, apache commons DiskFileItem defaults to ISO-8859-1.
value = item.getString("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new SystemException("Encoding error on formField item", e);
}
RequestUtil.addParameter(parameters, name, value);
} else {
// Form attachment
RequestUtil.addFileItem(files, name, item);
String value = item.getName();
RequestUtil.addParameter(parameters, name, value);
}
}
} } | public class class_name {
public static void uploadFileItems(final List<FileItem> fileItems, final Map<String, String[]> parameters,
final Map<String, FileItem[]> files) {
for (FileItem item : fileItems) {
String name = item.getFieldName();
boolean formField = item.isFormField();
if (LOG.isDebugEnabled()) {
LOG.debug(
"Uploading form " + (formField ? "field" : "attachment") + " \"" + name + "\""); // depends on control dependency: [if], data = [none]
}
if (formField) {
String value;
try {
// Without specifying UTF-8, apache commons DiskFileItem defaults to ISO-8859-1.
value = item.getString("UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new SystemException("Encoding error on formField item", e);
} // depends on control dependency: [catch], data = [none]
RequestUtil.addParameter(parameters, name, value); // depends on control dependency: [if], data = [none]
} else {
// Form attachment
RequestUtil.addFileItem(files, name, item); // depends on control dependency: [if], data = [none]
String value = item.getName();
RequestUtil.addParameter(parameters, name, value); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(CancelArchivalRequest cancelArchivalRequest, ProtocolMarshaller protocolMarshaller) {
if (cancelArchivalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelArchivalRequest.getGatewayARN(), GATEWAYARN_BINDING);
protocolMarshaller.marshall(cancelArchivalRequest.getTapeARN(), TAPEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CancelArchivalRequest cancelArchivalRequest, ProtocolMarshaller protocolMarshaller) {
if (cancelArchivalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelArchivalRequest.getGatewayARN(), GATEWAYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancelArchivalRequest.getTapeARN(), TAPEARN_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 String resolveTable(final String tableRef, final DbEntityDescriptor ded) {
String tableAlias = templateData.getTableAlias(tableRef);
if (tableAlias != null) {
return tableAlias;
}
return ded.getTableNameForQuery();
} } | public class class_name {
protected String resolveTable(final String tableRef, final DbEntityDescriptor ded) {
String tableAlias = templateData.getTableAlias(tableRef);
if (tableAlias != null) {
return tableAlias; // depends on control dependency: [if], data = [none]
}
return ded.getTableNameForQuery();
} } |
public class class_name {
public static void deprecated(Class<?> clazz, String methodOrPropName, String version) {
if (LOG_DEPRECATED) {
deprecated("Property or method [" + methodOrPropName + "] of class [" + clazz.getName() +
"] is deprecated in [" + version +
"] and will be removed in future releases");
}
} } | public class class_name {
public static void deprecated(Class<?> clazz, String methodOrPropName, String version) {
if (LOG_DEPRECATED) {
deprecated("Property or method [" + methodOrPropName + "] of class [" + clazz.getName() +
"] is deprecated in [" + version +
"] and will be removed in future releases"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
int[] impliedElements(int anc, int desc) {
// <style> and <script> are allowed anywhere.
if (desc == SCRIPT_TAG || desc == STYLE_TAG) {
return ZERO_INTS;
}
// It's dangerous to allow free <li> tags because of the way an <li>
// implies a </li> if there is an <li> on the parse stack without a
// LIST_SCOPE element in the middle.
// Since we don't control the context in which sanitized HTML is embedded,
// we can't assume that there isn't a containing <li> tag before parsing
// starts, so we make sure we never produce an <li> or <td> without a
// corresponding LIST or TABLE scope element on the stack.
// <select> is not a scope for <option> elements, but we do that too for
// symmetry and as an extra degree of safety against future spec changes.
FreeWrapper wrapper = desc != TEXT_NODE && desc < FREE_WRAPPERS.length
? FREE_WRAPPERS[desc] : null;
if (wrapper != null) {
if (anc < wrapper.allowedContainers.length
&& !wrapper.allowedContainers[anc]) {
return wrapper.implied;
}
}
if (desc != TEXT_NODE) {
int[] implied = impliedElements.getElementIndexList(anc, desc);
// This handles the table case at least
if (implied.length != 0) { return implied; }
}
// If we require above that all <li>s appear in a <ul> or <ol> then
// for symmetry, we require here that all content of a <ul> or <ol> appear
// nested in a <li>.
// This does not have the same security implications as the above, but is
// symmetric.
int[] oneImplied = null;
if (anc == OL_TAG || anc == UL_TAG) {
oneImplied = LI_TAG_ARR;
} else if (anc == SELECT_TAG) {
oneImplied = OPTION_TAG_ARR;
}
if (oneImplied != null) {
if (desc != oneImplied[0]) {
return LI_TAG_ARR;
}
}
// TODO: why are we dropping OPTION_AG_ARR?
return ZERO_INTS;
} } | public class class_name {
int[] impliedElements(int anc, int desc) {
// <style> and <script> are allowed anywhere.
if (desc == SCRIPT_TAG || desc == STYLE_TAG) {
return ZERO_INTS; // depends on control dependency: [if], data = [none]
}
// It's dangerous to allow free <li> tags because of the way an <li>
// implies a </li> if there is an <li> on the parse stack without a
// LIST_SCOPE element in the middle.
// Since we don't control the context in which sanitized HTML is embedded,
// we can't assume that there isn't a containing <li> tag before parsing
// starts, so we make sure we never produce an <li> or <td> without a
// corresponding LIST or TABLE scope element on the stack.
// <select> is not a scope for <option> elements, but we do that too for
// symmetry and as an extra degree of safety against future spec changes.
FreeWrapper wrapper = desc != TEXT_NODE && desc < FREE_WRAPPERS.length
? FREE_WRAPPERS[desc] : null;
if (wrapper != null) {
if (anc < wrapper.allowedContainers.length
&& !wrapper.allowedContainers[anc]) {
return wrapper.implied; // depends on control dependency: [if], data = [none]
}
}
if (desc != TEXT_NODE) {
int[] implied = impliedElements.getElementIndexList(anc, desc);
// This handles the table case at least
if (implied.length != 0) { return implied; } // depends on control dependency: [if], data = [none]
}
// If we require above that all <li>s appear in a <ul> or <ol> then
// for symmetry, we require here that all content of a <ul> or <ol> appear
// nested in a <li>.
// This does not have the same security implications as the above, but is
// symmetric.
int[] oneImplied = null;
if (anc == OL_TAG || anc == UL_TAG) {
oneImplied = LI_TAG_ARR; // depends on control dependency: [if], data = [none]
} else if (anc == SELECT_TAG) {
oneImplied = OPTION_TAG_ARR; // depends on control dependency: [if], data = [none]
}
if (oneImplied != null) {
if (desc != oneImplied[0]) {
return LI_TAG_ARR; // depends on control dependency: [if], data = [none]
}
}
// TODO: why are we dropping OPTION_AG_ARR?
return ZERO_INTS;
} } |
public class class_name {
private static void receiveParameterNames(final KlassInfo declaringklass) {
if (declaringklass.getType().getClassLoader() == null) {
// We can not find parameter name for class which is in JDK
return;
}
ClassReader cr = null;
try {
InputStream stream = ClassLoaderUtils.getClassAsStream(declaringklass.getType());
cr = new ClassReader(stream);
} catch (IOException e) {
throw new RuntimeException(e);
}
cr.accept(new ClassVisitor(Opcodes.ASM5) {
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
final MethodInfo method = searchMethod(declaringklass, name, desc);
if (method == null) {
return super.visitMethod(access, name, desc, signature, exceptions);
}
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
return new MethodVisitor(Opcodes.ASM5, mv) {
List<ParameterInfo> parameters = method.getParameters();
boolean isStatic = method.isStatic();
@Override
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
int offset = isStatic ? index : index - 1;
if (offset >= 0 && offset < parameters.size()) {
parameters.get(offset).name = name;
}
super.visitLocalVariable(name, desc, signature, start, end, index);
}
int visitParameterIndex = 0; // JDK8 parameter name 是按照循序存储的,这里需要一个计数器
@Override
public void visitParameter(String name, int access) {
parameters.get(visitParameterIndex++).name = name;
super.visitParameter(name, access);
}
};
}
private MethodInfo searchMethod(KlassInfo declaringklass, String name, String desc) {
if ("<cinit>".equals(name)) return null;
if ("<init>".equals(name)) return null;
jetbrick.asm.Type[] argumentTypes = jetbrick.asm.Type.getArgumentTypes(desc);
for (MethodInfo method : declaringklass.getDeclaredMethods()) {
if (method.getName().equals(name) && argumentTypes.length == method.getParameterCount()) {
Class<?>[] types = method.getParameterTypes();
boolean matched = true;
for (int i = 0; i < argumentTypes.length; i++) {
if (!jetbrick.asm.Type.getType(types[i]).equals(argumentTypes[i])) {
matched = false;
break;
}
}
if (matched) {
return method;
}
}
}
return null;
}
}, ClassReader.SKIP_FRAMES);
} } | public class class_name {
private static void receiveParameterNames(final KlassInfo declaringklass) {
if (declaringklass.getType().getClassLoader() == null) {
// We can not find parameter name for class which is in JDK
return; // depends on control dependency: [if], data = [none]
}
ClassReader cr = null;
try {
InputStream stream = ClassLoaderUtils.getClassAsStream(declaringklass.getType());
cr = new ClassReader(stream); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
cr.accept(new ClassVisitor(Opcodes.ASM5) {
@Override
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
final MethodInfo method = searchMethod(declaringklass, name, desc);
if (method == null) {
return super.visitMethod(access, name, desc, signature, exceptions); // depends on control dependency: [if], data = [none]
}
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
return new MethodVisitor(Opcodes.ASM5, mv) {
List<ParameterInfo> parameters = method.getParameters();
boolean isStatic = method.isStatic();
@Override
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
int offset = isStatic ? index : index - 1;
if (offset >= 0 && offset < parameters.size()) {
parameters.get(offset).name = name; // depends on control dependency: [if], data = [(offset]
}
super.visitLocalVariable(name, desc, signature, start, end, index);
}
int visitParameterIndex = 0; // JDK8 parameter name 是按照循序存储的,这里需要一个计数器
@Override
public void visitParameter(String name, int access) {
parameters.get(visitParameterIndex++).name = name;
super.visitParameter(name, access);
}
};
}
private MethodInfo searchMethod(KlassInfo declaringklass, String name, String desc) {
if ("<cinit>".equals(name)) return null;
if ("<init>".equals(name)) return null;
jetbrick.asm.Type[] argumentTypes = jetbrick.asm.Type.getArgumentTypes(desc);
for (MethodInfo method : declaringklass.getDeclaredMethods()) {
if (method.getName().equals(name) && argumentTypes.length == method.getParameterCount()) {
Class<?>[] types = method.getParameterTypes();
boolean matched = true;
for (int i = 0; i < argumentTypes.length; i++) {
if (!jetbrick.asm.Type.getType(types[i]).equals(argumentTypes[i])) {
matched = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (matched) {
return method; // depends on control dependency: [if], data = [none]
}
}
}
return null;
}
}, ClassReader.SKIP_FRAMES);
} } |
public class class_name {
public static <T extends ImageGray<T>, G extends GradientValue>
SparseImageGradient<T,G> createPrewitt( Class<T> imageType , ImageBorder<T> border )
{
if( imageType == GrayF32.class) {
return (SparseImageGradient)new GradientSparsePrewitt_F32((ImageBorder_F32)border);
} else if( imageType == GrayU8.class ){
return (SparseImageGradient)new GradientSparsePrewitt_U8((ImageBorder_S32)border);
} else {
throw new IllegalArgumentException("Unsupported image type "+imageType.getSimpleName());
}
} } | public class class_name {
public static <T extends ImageGray<T>, G extends GradientValue>
SparseImageGradient<T,G> createPrewitt( Class<T> imageType , ImageBorder<T> border )
{
if( imageType == GrayF32.class) {
return (SparseImageGradient)new GradientSparsePrewitt_F32((ImageBorder_F32)border); // depends on control dependency: [if], data = [none]
} else if( imageType == GrayU8.class ){
return (SparseImageGradient)new GradientSparsePrewitt_U8((ImageBorder_S32)border); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported image type "+imageType.getSimpleName());
}
} } |
public class class_name {
@Nonnull
@ReturnsMutableCopy
public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN)
{
ValueEnforcer.notNull (sIBAN, "IBANString");
final String sRealIBAN = IBANManager.unifyIBAN (sIBAN);
if (sRealIBAN.length () != m_nExpectedLength)
throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " +
m_nExpectedLength +
" but found " +
sRealIBAN.length ());
final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ());
int nIndex = 0;
for (final IBANElement aElement : m_aElements)
{
final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ());
ret.add (new IBANElementValue (aElement, sIBANPart));
nIndex += aElement.getLength ();
}
return ret;
} } | public class class_name {
@Nonnull
@ReturnsMutableCopy
public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN)
{
ValueEnforcer.notNull (sIBAN, "IBANString");
final String sRealIBAN = IBANManager.unifyIBAN (sIBAN);
if (sRealIBAN.length () != m_nExpectedLength)
throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " +
m_nExpectedLength +
" but found " +
sRealIBAN.length ());
final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ());
int nIndex = 0;
for (final IBANElement aElement : m_aElements)
{
final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ());
ret.add (new IBANElementValue (aElement, sIBANPart)); // depends on control dependency: [for], data = [aElement]
nIndex += aElement.getLength (); // depends on control dependency: [for], data = [aElement]
}
return ret;
} } |
public class class_name {
protected String parseOptionalStringValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
return value.getStringValue(null);
}
} } | public class class_name {
protected String parseOptionalStringValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return value.getStringValue(null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
public static int compare(Date startDate, Date endDate, long targetDate)
{
int result = 0;
if (targetDate < startDate.getTime())
{
result = -1;
}
else
{
if (targetDate > endDate.getTime())
{
result = 1;
}
}
return (result);
} } | public class class_name {
public static int compare(Date startDate, Date endDate, long targetDate)
{
int result = 0;
if (targetDate < startDate.getTime())
{
result = -1; // depends on control dependency: [if], data = [none]
}
else
{
if (targetDate > endDate.getTime())
{
result = 1; // depends on control dependency: [if], data = [none]
}
}
return (result);
} } |
public class class_name {
protected boolean isSOFnMarker(int marker) {
if (marker <= 0xC3 && marker >= 0xC0) {
return true;
}
if (marker <= 0xCB && marker >= 0xC5) {
return true;
}
if (marker <= 0xCF && marker >= 0xCD) {
return true;
}
return false;
} } | public class class_name {
protected boolean isSOFnMarker(int marker) {
if (marker <= 0xC3 && marker >= 0xC0) {
return true;
// depends on control dependency: [if], data = [none]
}
if (marker <= 0xCB && marker >= 0xC5) {
return true;
// depends on control dependency: [if], data = [none]
}
if (marker <= 0xCF && marker >= 0xCD) {
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public final <T extends GraphObject> T getGraphObjectAs(Class<T> graphObjectClass) {
if (graphObject == null) {
return null;
}
if (graphObjectClass == null) {
throw new NullPointerException("Must pass in a valid interface that extends GraphObject");
}
return graphObject.cast(graphObjectClass);
} } | public class class_name {
public final <T extends GraphObject> T getGraphObjectAs(Class<T> graphObjectClass) {
if (graphObject == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (graphObjectClass == null) {
throw new NullPointerException("Must pass in a valid interface that extends GraphObject");
}
return graphObject.cast(graphObjectClass);
} } |
public class class_name {
public Content getPackageHeader(String heading) {
String pkgName = packageDoc.name();
Content bodyTree = getBody(true, getWindowTitle(pkgName));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
addAnnotationInfo(packageDoc, annotationContent);
div.addContent(annotationContent);
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, packageLabel);
tHeading.addContent(getSpace());
Content packageHead = new StringContent(heading);
tHeading.addContent(packageHead);
div.addContent(tHeading);
addDeprecationInfo(div);
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
docSummaryDiv.addStyle(HtmlStyle.docSummary);
addSummaryComment(packageDoc, docSummaryDiv);
div.addContent(docSummaryDiv);
Content space = getSpace();
Content descLink = getHyperLink(getDocLink(
SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
}
bodyTree.addContent(div);
return bodyTree;
} } | public class class_name {
public Content getPackageHeader(String heading) {
String pkgName = packageDoc.name();
Content bodyTree = getBody(true, getWindowTitle(pkgName));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
addAnnotationInfo(packageDoc, annotationContent);
div.addContent(annotationContent);
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, packageLabel);
tHeading.addContent(getSpace());
Content packageHead = new StringContent(heading);
tHeading.addContent(packageHead);
div.addContent(tHeading);
addDeprecationInfo(div);
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
docSummaryDiv.addStyle(HtmlStyle.docSummary); // depends on control dependency: [if], data = [none]
addSummaryComment(packageDoc, docSummaryDiv); // depends on control dependency: [if], data = [none]
div.addContent(docSummaryDiv); // depends on control dependency: [if], data = [none]
Content space = getSpace();
Content descLink = getHyperLink(getDocLink(
SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara); // depends on control dependency: [if], data = [none]
}
bodyTree.addContent(div);
return bodyTree;
} } |
public class class_name {
public void setTargetGroupARNs(java.util.Collection<String> targetGroupARNs) {
if (targetGroupARNs == null) {
this.targetGroupARNs = null;
return;
}
this.targetGroupARNs = new com.amazonaws.internal.SdkInternalList<String>(targetGroupARNs);
} } | public class class_name {
public void setTargetGroupARNs(java.util.Collection<String> targetGroupARNs) {
if (targetGroupARNs == null) {
this.targetGroupARNs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.targetGroupARNs = new com.amazonaws.internal.SdkInternalList<String>(targetGroupARNs);
} } |
public class class_name {
public static void addCronJobForInterval(ExecutableJobQueue executableJobQueue,
CronJobQueue cronJobQueue,
int scheduleIntervalMinute,
final JobPo finalJobPo,
Date lastGenerateTime) {
JobPo jobPo = JobUtils.copy(finalJobPo);
String cronExpression = jobPo.getCronExpression();
long endTime = DateUtils.addMinute(lastGenerateTime, scheduleIntervalMinute).getTime();
Date timeAfter = lastGenerateTime;
boolean stop = false;
while (!stop) {
Date nextTriggerTime = CronExpressionUtils.getNextTriggerTime(cronExpression, timeAfter);
if (nextTriggerTime == null) {
stop = true;
} else {
if (nextTriggerTime.getTime() <= endTime) {
// 添加任务
jobPo.setTriggerTime(nextTriggerTime.getTime());
jobPo.setJobId(JobUtils.generateJobId());
jobPo.setTaskId(finalJobPo.getTaskId() + "_" + DateUtils.format(nextTriggerTime, "MMdd-HHmmss"));
jobPo.setInternalExtParam(Constants.ONCE, Boolean.TRUE.toString());
try {
jobPo.setInternalExtParam(Constants.EXE_SEQ_ID, JobUtils.generateExeSeqId(jobPo));
executableJobQueue.add(jobPo);
} catch (DupEntryException e) {
LOGGER.warn("Cron Job[taskId={}, taskTrackerNodeGroup={}] Already Exist in ExecutableJobQueue",
jobPo.getTaskId(), jobPo.getTaskTrackerNodeGroup());
}
} else {
stop = true;
}
}
timeAfter = nextTriggerTime;
}
cronJobQueue.updateLastGenerateTriggerTime(finalJobPo.getJobId(), endTime);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Add CronJob {} to {}", jobPo, DateUtils.formatYMD_HMS(new Date(endTime)));
}
} } | public class class_name {
public static void addCronJobForInterval(ExecutableJobQueue executableJobQueue,
CronJobQueue cronJobQueue,
int scheduleIntervalMinute,
final JobPo finalJobPo,
Date lastGenerateTime) {
JobPo jobPo = JobUtils.copy(finalJobPo);
String cronExpression = jobPo.getCronExpression();
long endTime = DateUtils.addMinute(lastGenerateTime, scheduleIntervalMinute).getTime();
Date timeAfter = lastGenerateTime;
boolean stop = false;
while (!stop) {
Date nextTriggerTime = CronExpressionUtils.getNextTriggerTime(cronExpression, timeAfter);
if (nextTriggerTime == null) {
stop = true; // depends on control dependency: [if], data = [none]
} else {
if (nextTriggerTime.getTime() <= endTime) {
// 添加任务
jobPo.setTriggerTime(nextTriggerTime.getTime()); // depends on control dependency: [if], data = [(nextTriggerTime.getTime()]
jobPo.setJobId(JobUtils.generateJobId()); // depends on control dependency: [if], data = [none]
jobPo.setTaskId(finalJobPo.getTaskId() + "_" + DateUtils.format(nextTriggerTime, "MMdd-HHmmss")); // depends on control dependency: [if], data = [none]
jobPo.setInternalExtParam(Constants.ONCE, Boolean.TRUE.toString()); // depends on control dependency: [if], data = [none]
try {
jobPo.setInternalExtParam(Constants.EXE_SEQ_ID, JobUtils.generateExeSeqId(jobPo)); // depends on control dependency: [try], data = [none]
executableJobQueue.add(jobPo); // depends on control dependency: [try], data = [none]
} catch (DupEntryException e) {
LOGGER.warn("Cron Job[taskId={}, taskTrackerNodeGroup={}] Already Exist in ExecutableJobQueue",
jobPo.getTaskId(), jobPo.getTaskTrackerNodeGroup());
} // depends on control dependency: [catch], data = [none]
} else {
stop = true; // depends on control dependency: [if], data = [none]
}
}
timeAfter = nextTriggerTime; // depends on control dependency: [while], data = [none]
}
cronJobQueue.updateLastGenerateTriggerTime(finalJobPo.getJobId(), endTime);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Add CronJob {} to {}", jobPo, DateUtils.formatYMD_HMS(new Date(endTime))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FacesConfigApplicationType<T> navigationHandler(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("navigation-handler").text(name);
}
}
return this;
} } | public class class_name {
public FacesConfigApplicationType<T> navigationHandler(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("navigation-handler").text(name); // depends on control dependency: [for], data = [name]
}
}
return this;
} } |
public class class_name {
public long getMinSharePreemptionTimeout(String pool) {
if (minSharePreemptionTimeouts.containsKey(pool)) {
return minSharePreemptionTimeouts.get(pool);
} else {
return defaultMinSharePreemptionTimeout;
}
} } | public class class_name {
public long getMinSharePreemptionTimeout(String pool) {
if (minSharePreemptionTimeouts.containsKey(pool)) {
return minSharePreemptionTimeouts.get(pool); // depends on control dependency: [if], data = [none]
} else {
return defaultMinSharePreemptionTimeout; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Duration getDuration(Config config, String path) {
try {
return config.getDuration(path);
} catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) {
if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
} } | public class class_name {
public static Duration getDuration(Config config, String path) {
try {
return config.getDuration(path); // depends on control dependency: [try], data = [none]
} catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) {
if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) {
LOGGER.warn(e.getMessage(), e); // depends on control dependency: [if], data = [none]
}
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static IAtomContainerSet getAllReactants(IReaction reaction) {
IAtomContainerSet moleculeSet = reaction.getBuilder().newInstance(IAtomContainerSet.class);
IAtomContainerSet reactants = reaction.getReactants();
for (int i = 0; i < reactants.getAtomContainerCount(); i++) {
moleculeSet.addAtomContainer(reactants.getAtomContainer(i));
}
return moleculeSet;
} } | public class class_name {
public static IAtomContainerSet getAllReactants(IReaction reaction) {
IAtomContainerSet moleculeSet = reaction.getBuilder().newInstance(IAtomContainerSet.class);
IAtomContainerSet reactants = reaction.getReactants();
for (int i = 0; i < reactants.getAtomContainerCount(); i++) {
moleculeSet.addAtomContainer(reactants.getAtomContainer(i)); // depends on control dependency: [for], data = [i]
}
return moleculeSet;
} } |
public class class_name {
public void updateGroupPermission(int iGroupID)
{
if (m_recUserPermission == null)
m_recUserPermission = new UserPermission(this.getOwner().findRecordOwner());
Record m_recUserGroup = ((ReferenceField)m_recUserPermission.getField(UserPermission.USER_GROUP_ID)).getReferenceRecord();
m_recUserGroup.setOpenMode(m_recUserGroup.getOpenMode() & ~DBConstants.OPEN_READ_ONLY); // Read and write
if (m_recUserPermission.getListener(SubFileFilter.class) == null)
m_recUserPermission.addListener(new SubFileFilter(m_recUserGroup));
try {
m_recUserGroup.addNew();
m_recUserGroup.getCounterField().setValue(iGroupID);
if (m_recUserGroup.seek(null))
{
m_recUserGroup.edit();
StringBuffer sb = new StringBuffer();
m_recUserPermission.close();
while (m_recUserPermission.hasNext())
{
m_recUserPermission.next();
Record recUserResource = ((ReferenceField)m_recUserPermission.getField(UserPermission.USER_RESOURCE_ID)).getReference();
String strResource = recUserResource.getField(UserResource.RESOURCE_CLASS).toString();
StringTokenizer tokenizer = new StringTokenizer(strResource, "\n\t ,");
while (tokenizer.hasMoreTokens())
{
String strClass = tokenizer.nextToken();
int startThin = strClass.indexOf(Constants.THIN_SUBPACKAGE, 0);
if (startThin != -1) // Remove the ".thin" reference
strClass = strClass.substring(0, startThin) + strClass.substring(startThin + Constants.THIN_SUBPACKAGE.length());
if (strClass.length() > 0)
{
sb.append(strClass).append('\t');
sb.append(m_recUserPermission.getField(UserPermission.ACCESS_LEVEL).toString()).append('\t');
sb.append(m_recUserPermission.getField(UserPermission.LOGIN_LEVEL).toString()).append("\t\n");
}
}
}
m_recUserGroup.getField(UserGroup.ACCESS_MAP).setString(sb.toString());
m_recUserGroup.set();
}
} catch (DBException e) {
e.printStackTrace();
}
} } | public class class_name {
public void updateGroupPermission(int iGroupID)
{
if (m_recUserPermission == null)
m_recUserPermission = new UserPermission(this.getOwner().findRecordOwner());
Record m_recUserGroup = ((ReferenceField)m_recUserPermission.getField(UserPermission.USER_GROUP_ID)).getReferenceRecord();
m_recUserGroup.setOpenMode(m_recUserGroup.getOpenMode() & ~DBConstants.OPEN_READ_ONLY); // Read and write
if (m_recUserPermission.getListener(SubFileFilter.class) == null)
m_recUserPermission.addListener(new SubFileFilter(m_recUserGroup));
try {
m_recUserGroup.addNew(); // depends on control dependency: [try], data = [none]
m_recUserGroup.getCounterField().setValue(iGroupID); // depends on control dependency: [try], data = [none]
if (m_recUserGroup.seek(null))
{
m_recUserGroup.edit(); // depends on control dependency: [if], data = [none]
StringBuffer sb = new StringBuffer();
m_recUserPermission.close(); // depends on control dependency: [if], data = [none]
while (m_recUserPermission.hasNext())
{
m_recUserPermission.next(); // depends on control dependency: [while], data = [none]
Record recUserResource = ((ReferenceField)m_recUserPermission.getField(UserPermission.USER_RESOURCE_ID)).getReference();
String strResource = recUserResource.getField(UserResource.RESOURCE_CLASS).toString();
StringTokenizer tokenizer = new StringTokenizer(strResource, "\n\t ,");
while (tokenizer.hasMoreTokens())
{
String strClass = tokenizer.nextToken();
int startThin = strClass.indexOf(Constants.THIN_SUBPACKAGE, 0);
if (startThin != -1) // Remove the ".thin" reference
strClass = strClass.substring(0, startThin) + strClass.substring(startThin + Constants.THIN_SUBPACKAGE.length());
if (strClass.length() > 0)
{
sb.append(strClass).append('\t'); // depends on control dependency: [if], data = [none]
sb.append(m_recUserPermission.getField(UserPermission.ACCESS_LEVEL).toString()).append('\t'); // depends on control dependency: [if], data = [none]
sb.append(m_recUserPermission.getField(UserPermission.LOGIN_LEVEL).toString()).append("\t\n"); // depends on control dependency: [if], data = [none]
}
}
}
m_recUserGroup.getField(UserGroup.ACCESS_MAP).setString(sb.toString()); // depends on control dependency: [if], data = [none]
m_recUserGroup.set(); // depends on control dependency: [if], data = [none]
}
} catch (DBException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Pure
public static int getSelectionColor() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("SELECTION_COLOR", null); //$NON-NLS-1$
if (str != null) {
try {
return Integer.valueOf(str);
} catch (Throwable exception) {
//
}
}
}
return DEFAULT_SELECTION_COLOR;
} } | public class class_name {
@Pure
public static int getSelectionColor() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("SELECTION_COLOR", null); //$NON-NLS-1$
if (str != null) {
try {
return Integer.valueOf(str); // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
//
} // depends on control dependency: [catch], data = [none]
}
}
return DEFAULT_SELECTION_COLOR;
} } |
public class class_name {
private static String extractPassword(String password, ClientAuthScheme scheme) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(ClientAuthScheme.getDigestScheme(scheme));
} catch (final NoSuchAlgorithmException e) {
hostLog.l7dlog(Level.FATAL, LogKeys.compiler_VoltCompiler_NoSuchAlgorithm.name(), e);
System.exit(-1);
}
final byte passwordHash[] = md.digest(password.getBytes(Charsets.UTF_8));
return Encoder.hexEncode(passwordHash);
} } | public class class_name {
private static String extractPassword(String password, ClientAuthScheme scheme) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(ClientAuthScheme.getDigestScheme(scheme)); // depends on control dependency: [try], data = [none]
} catch (final NoSuchAlgorithmException e) {
hostLog.l7dlog(Level.FATAL, LogKeys.compiler_VoltCompiler_NoSuchAlgorithm.name(), e);
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
final byte passwordHash[] = md.digest(password.getBytes(Charsets.UTF_8));
return Encoder.hexEncode(passwordHash);
} } |
public class class_name {
public DescribeParametersRequest withFilters(ParametersFilter... filters) {
if (this.filters == null) {
setFilters(new com.amazonaws.internal.SdkInternalList<ParametersFilter>(filters.length));
}
for (ParametersFilter ele : filters) {
this.filters.add(ele);
}
return this;
} } | public class class_name {
public DescribeParametersRequest withFilters(ParametersFilter... filters) {
if (this.filters == null) {
setFilters(new com.amazonaws.internal.SdkInternalList<ParametersFilter>(filters.length)); // depends on control dependency: [if], data = [none]
}
for (ParametersFilter ele : filters) {
this.filters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public synchronized void addSingletonInitialization(EJSHome home) {
if (ivStopping) {
throw new EJBStoppedException(home.getJ2EEName().toString());
}
if (ivSingletonInitializations == null) {
ivSingletonInitializations = new LinkedHashSet<EJSHome>();
}
ivSingletonInitializations.add(home);
} } | public class class_name {
public synchronized void addSingletonInitialization(EJSHome home) {
if (ivStopping) {
throw new EJBStoppedException(home.getJ2EEName().toString());
}
if (ivSingletonInitializations == null) {
ivSingletonInitializations = new LinkedHashSet<EJSHome>(); // depends on control dependency: [if], data = [none]
}
ivSingletonInitializations.add(home);
} } |
public class class_name {
public InetAddress getRemoteAddress() {
final Channel channel;
try {
channel = strategy.getChannel();
} catch (IOException e) {
return null;
}
final Connection connection = channel.getConnection();
final InetSocketAddress peerAddress = connection.getPeerAddress(InetSocketAddress.class);
return peerAddress == null ? null : peerAddress.getAddress();
} } | public class class_name {
public InetAddress getRemoteAddress() {
final Channel channel;
try {
channel = strategy.getChannel(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return null;
} // depends on control dependency: [catch], data = [none]
final Connection connection = channel.getConnection();
final InetSocketAddress peerAddress = connection.getPeerAddress(InetSocketAddress.class);
return peerAddress == null ? null : peerAddress.getAddress();
} } |
public class class_name {
public void setExportTaskIds(java.util.Collection<String> exportTaskIds) {
if (exportTaskIds == null) {
this.exportTaskIds = null;
return;
}
this.exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>(exportTaskIds);
} } | public class class_name {
public void setExportTaskIds(java.util.Collection<String> exportTaskIds) {
if (exportTaskIds == null) {
this.exportTaskIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>(exportTaskIds);
} } |
public class class_name {
private Map<Integer, Object> getFilter(List<PivotField> fields, List<Object> values) {
// long start = System.currentTimeMillis();
Map<Integer, Object> filter = new HashMap<Integer, Object>();
for (int i = 0; i < values.size(); i++) {
int fieldIndex = fields.get(i).getIndex();
// System.out.println(fieldIndex);
filter.put(fieldIndex, values.get(i));
}
// long stop = System.currentTimeMillis();
// System.out.println("getFilter in " + (stop - start));
return filter;
} } | public class class_name {
private Map<Integer, Object> getFilter(List<PivotField> fields, List<Object> values) {
// long start = System.currentTimeMillis();
Map<Integer, Object> filter = new HashMap<Integer, Object>();
for (int i = 0; i < values.size(); i++) {
int fieldIndex = fields.get(i).getIndex();
// System.out.println(fieldIndex);
filter.put(fieldIndex, values.get(i)); // depends on control dependency: [for], data = [i]
}
// long stop = System.currentTimeMillis();
// System.out.println("getFilter in " + (stop - start));
return filter;
} } |
public class class_name {
@Override
public DateCalculator<LocalDate> moveByDays(final int days) {
setCurrentIncrement(days);
setCurrentBusinessDate(getCurrentBusinessDate().plusDays(days));
if (getHolidayHandler() != null) {
setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this));
}
return this;
} } | public class class_name {
@Override
public DateCalculator<LocalDate> moveByDays(final int days) {
setCurrentIncrement(days);
setCurrentBusinessDate(getCurrentBusinessDate().plusDays(days));
if (getHolidayHandler() != null) {
setCurrentBusinessDate(getHolidayHandler().moveCurrentDate(this));
// depends on control dependency: [if], data = [(getHolidayHandler()]
}
return this;
} } |
public class class_name {
public void handleReceiverError()
{
try {
if (connected) {
close(true);
}
} catch (WebSocketException wse) {
if (Log.isLoggable(TAG, DEBUG))
Log.d(TAG, "Exception closing web socket", wse);
}
} } | public class class_name {
public void handleReceiverError()
{
try {
if (connected) {
close(true); // depends on control dependency: [if], data = [none]
}
} catch (WebSocketException wse) {
if (Log.isLoggable(TAG, DEBUG))
Log.d(TAG, "Exception closing web socket", wse);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void destroyProxy(ProxyDestroyParams params) {
if (params.getProxyFile() == null) {
params.setProxyFile(VOMSProxyPathBuilder.buildProxyPath());
}
File file = new File(params.getProxyFile());
if (!file.exists()) {
listener.notifyProxyNotFound();
System.exit(1);
}
if (params.isDryRun()) {
listener.warnProxyToRemove(params.getProxyFile());
System.exit(0);
}
file.delete();
} } | public class class_name {
@Override
public void destroyProxy(ProxyDestroyParams params) {
if (params.getProxyFile() == null) {
params.setProxyFile(VOMSProxyPathBuilder.buildProxyPath()); // depends on control dependency: [if], data = [none]
}
File file = new File(params.getProxyFile());
if (!file.exists()) {
listener.notifyProxyNotFound(); // depends on control dependency: [if], data = [none]
System.exit(1); // depends on control dependency: [if], data = [none]
}
if (params.isDryRun()) {
listener.warnProxyToRemove(params.getProxyFile()); // depends on control dependency: [if], data = [none]
System.exit(0); // depends on control dependency: [if], data = [none]
}
file.delete();
} } |
public class class_name {
public static String getMethodDescriptor(final Method m) {
Class<?>[] parameters = m.getParameterTypes();
StringBuilder sb = new StringBuilder();
sb.append('(');
for (int i = 0; i < parameters.length; ++i) {
getDescriptor(sb, parameters[i]);
}
sb.append(')');
getDescriptor(sb, m.getReturnType());
return sb.toString();
} } | public class class_name {
public static String getMethodDescriptor(final Method m) {
Class<?>[] parameters = m.getParameterTypes();
StringBuilder sb = new StringBuilder();
sb.append('(');
for (int i = 0; i < parameters.length; ++i) {
getDescriptor(sb, parameters[i]); // depends on control dependency: [for], data = [i]
}
sb.append(')');
getDescriptor(sb, m.getReturnType());
return sb.toString();
} } |
public class class_name {
@Override
public <K, V> MapAttribute<X, K, V> getDeclaredMap(String paramName, Class<K> keyClazz, Class<V> valueClazz)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName);
if (onCheckMapAttribute(declaredAttrib, valueClazz))
{
if (valueClazz != null && valueClazz.equals(((MapAttribute<X, K, V>) declaredAttrib).getKeyJavaType()))
{
return (MapAttribute<X, K, V>) declaredAttrib;
}
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed MapAttribute type, for name:"
+ paramName + " , value type:" + valueClazz + "key tpye:" + keyClazz);
} } | public class class_name {
@Override
public <K, V> MapAttribute<X, K, V> getDeclaredMap(String paramName, Class<K> keyClazz, Class<V> valueClazz)
{
PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName);
if (onCheckMapAttribute(declaredAttrib, valueClazz))
{
if (valueClazz != null && valueClazz.equals(((MapAttribute<X, K, V>) declaredAttrib).getKeyJavaType()))
{
return (MapAttribute<X, K, V>) declaredAttrib; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException(
"attribute of the given name and type is not present in the managed MapAttribute type, for name:"
+ paramName + " , value type:" + valueClazz + "key tpye:" + keyClazz);
} } |
public class class_name {
private void createSingleHeader(HeaderKeys key, byte[] value, int offset, int length) {
HeaderElement elem = findHeader(key);
if (null != elem) {
// delete all secondary instances first
if (null != elem.nextInstance) {
HeaderElement temp = elem.nextInstance;
while (null != temp) {
temp.remove();
temp = temp.nextInstance;
}
}
if (HeaderStorage.NOTSET != this.headerChangeLimit) {
// parse buffer reuse is enabled, see if we can use existing obj
if (length <= elem.getValueLength()) {
this.headerChangeCount++;
elem.setByteArrayValue(value, offset, length);
} else {
elem.remove();
elem = null;
}
} else {
// parse buffer reuse is disabled
elem.setByteArrayValue(value, offset, length);
}
}
if (null == elem) {
// either it didn't exist or we chose not to re-use the object
elem = getElement(key);
elem.setByteArrayValue(value, offset, length);
addHeader(elem, FILTER_NO);
} else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Replacing header " + key.getName() + " [" + elem.getDebugValue() + "]");
}
} } | public class class_name {
private void createSingleHeader(HeaderKeys key, byte[] value, int offset, int length) {
HeaderElement elem = findHeader(key);
if (null != elem) {
// delete all secondary instances first
if (null != elem.nextInstance) {
HeaderElement temp = elem.nextInstance;
while (null != temp) {
temp.remove(); // depends on control dependency: [while], data = [none]
temp = temp.nextInstance; // depends on control dependency: [while], data = [none]
}
}
if (HeaderStorage.NOTSET != this.headerChangeLimit) {
// parse buffer reuse is enabled, see if we can use existing obj
if (length <= elem.getValueLength()) {
this.headerChangeCount++; // depends on control dependency: [if], data = [none]
elem.setByteArrayValue(value, offset, length); // depends on control dependency: [if], data = [none]
} else {
elem.remove(); // depends on control dependency: [if], data = [none]
elem = null; // depends on control dependency: [if], data = [none]
}
} else {
// parse buffer reuse is disabled
elem.setByteArrayValue(value, offset, length); // depends on control dependency: [if], data = [none]
}
}
if (null == elem) {
// either it didn't exist or we chose not to re-use the object
elem = getElement(key); // depends on control dependency: [if], data = [none]
elem.setByteArrayValue(value, offset, length); // depends on control dependency: [if], data = [none]
addHeader(elem, FILTER_NO); // depends on control dependency: [if], data = [none]
} else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Replacing header " + key.getName() + " [" + elem.getDebugValue() + "]"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void readPkValuesFrom(ResultSetAndStatement rs_stmt, Map row)
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
ClassDescriptor cld;
if (ojbClass != null)
{
cld = m_cld.getRepository().getDescriptorFor(ojbClass);
}
else
{
cld = m_cld;
}
FieldDescriptor[] pkFields = cld.getPkFields();
readValuesFrom(rs_stmt, row, pkFields);
} } | public class class_name {
public void readPkValuesFrom(ResultSetAndStatement rs_stmt, Map row)
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
ClassDescriptor cld;
if (ojbClass != null)
{
cld = m_cld.getRepository().getDescriptorFor(ojbClass);
// depends on control dependency: [if], data = [(ojbClass]
}
else
{
cld = m_cld;
// depends on control dependency: [if], data = [none]
}
FieldDescriptor[] pkFields = cld.getPkFields();
readValuesFrom(rs_stmt, row, pkFields);
} } |
public class class_name {
public static GrayU8 invert(GrayU8 input , GrayU8 output)
{
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryImageOps_MT.invert(input, output);
} else {
ImplBinaryImageOps.invert(input, output);
}
return output;
} } | public class class_name {
public static GrayU8 invert(GrayU8 input , GrayU8 output)
{
output = InputSanityCheck.checkDeclare(input, output);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplBinaryImageOps_MT.invert(input, output); // depends on control dependency: [if], data = [none]
} else {
ImplBinaryImageOps.invert(input, output); // depends on control dependency: [if], data = [none]
}
return output;
} } |
public class class_name {
@Override
public Collection<Block> getByResourceId(String resourceId) {
ensureSorted();
// prepare resourceId for binary search
resourceIds[size] = resourceId;
resourceIdsIndex[size] = size;
int index = DataUtils.binarySearch(byResourceId);
List<Block> result = new ArrayList<>();
int realIndex = resourceIdsIndex[index];
while (index < size && FastStringComparator.INSTANCE.compare(resourceIds[realIndex], resourceId) == 0) {
result.add(getBlock(realIndex, resourceId));
index++;
realIndex = resourceIdsIndex[index];
}
return result;
} } | public class class_name {
@Override
public Collection<Block> getByResourceId(String resourceId) {
ensureSorted();
// prepare resourceId for binary search
resourceIds[size] = resourceId;
resourceIdsIndex[size] = size;
int index = DataUtils.binarySearch(byResourceId);
List<Block> result = new ArrayList<>();
int realIndex = resourceIdsIndex[index];
while (index < size && FastStringComparator.INSTANCE.compare(resourceIds[realIndex], resourceId) == 0) {
result.add(getBlock(realIndex, resourceId)); // depends on control dependency: [while], data = [none]
index++; // depends on control dependency: [while], data = [none]
realIndex = resourceIdsIndex[index]; // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
@Pure
public QuadTreeZone zoneOf(N child) {
if (child == this.nNorthWest) {
return QuadTreeZone.NORTH_WEST;
}
if (child == this.nNorthEast) {
return QuadTreeZone.NORTH_EAST;
}
if (child == this.nSouthWest) {
return QuadTreeZone.SOUTH_WEST;
}
if (child == this.nSouthEast) {
return QuadTreeZone.SOUTH_EAST;
}
return null;
} } | public class class_name {
@Pure
public QuadTreeZone zoneOf(N child) {
if (child == this.nNorthWest) {
return QuadTreeZone.NORTH_WEST; // depends on control dependency: [if], data = [none]
}
if (child == this.nNorthEast) {
return QuadTreeZone.NORTH_EAST; // depends on control dependency: [if], data = [none]
}
if (child == this.nSouthWest) {
return QuadTreeZone.SOUTH_WEST; // depends on control dependency: [if], data = [none]
}
if (child == this.nSouthEast) {
return QuadTreeZone.SOUTH_EAST; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
static String validateObjectName(String objectName, boolean allowEmptyObjectName) {
logger.atFine().log("validateObjectName('%s', %s)", objectName, allowEmptyObjectName);
if (isNullOrEmpty(objectName) || objectName.equals(PATH_DELIMITER)) {
if (allowEmptyObjectName) {
objectName = "";
} else {
throw new IllegalArgumentException(
"Google Cloud Storage path must include non-empty object name.");
}
}
// We want objectName to look like a traditional file system path,
// therefore, disallow objectName with consecutive '/' chars.
for (int i = 0; i < (objectName.length() - 1); i++) {
if (objectName.charAt(i) == '/' && objectName.charAt(i + 1) == '/') {
throw new IllegalArgumentException(
String.format(
"Google Cloud Storage path must not have consecutive '/' characters, got '%s'",
objectName));
}
}
// Remove leading '/' if it exists.
if (objectName.startsWith(PATH_DELIMITER)) {
objectName = objectName.substring(1);
}
logger.atFine().log("validateObjectName -> '%s'", objectName);
return objectName;
} } | public class class_name {
static String validateObjectName(String objectName, boolean allowEmptyObjectName) {
logger.atFine().log("validateObjectName('%s', %s)", objectName, allowEmptyObjectName);
if (isNullOrEmpty(objectName) || objectName.equals(PATH_DELIMITER)) {
if (allowEmptyObjectName) {
objectName = ""; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
"Google Cloud Storage path must include non-empty object name.");
}
}
// We want objectName to look like a traditional file system path,
// therefore, disallow objectName with consecutive '/' chars.
for (int i = 0; i < (objectName.length() - 1); i++) {
if (objectName.charAt(i) == '/' && objectName.charAt(i + 1) == '/') {
throw new IllegalArgumentException(
String.format(
"Google Cloud Storage path must not have consecutive '/' characters, got '%s'",
objectName));
}
}
// Remove leading '/' if it exists.
if (objectName.startsWith(PATH_DELIMITER)) {
objectName = objectName.substring(1);
}
logger.atFine().log("validateObjectName -> '%s'", objectName);
return objectName; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
private void initialize(CatalogContext catalogContext, List<Pair<Integer, Integer>> localPartitionsToSites,
boolean isRejoin) {
try {
CatalogMap<Connector> connectors = CatalogUtil.getConnectors(catalogContext);
if (exportLog.isDebugEnabled()) {
exportLog.debug("initialize for " + connectors.size() + " connectors.");
CatalogUtil.dumpConnectors(exportLog, connectors);
}
if (!CatalogUtil.hasExportedTables(connectors)) {
return;
}
if (exportLog.isDebugEnabled()) {
exportLog.debug("Creating processor " + m_loaderClass);
}
ExportDataProcessor newProcessor = getNewProcessorWithProcessConfigSet(m_processorConfig);
m_processor.set(newProcessor);
File exportOverflowDirectory = new File(VoltDB.instance().getExportOverflowPath());
ExportGeneration generation = new ExportGeneration(exportOverflowDirectory, m_messenger);
generation.initialize(m_hostId, catalogContext,
connectors, newProcessor, localPartitionsToSites, exportOverflowDirectory);
m_generation.set(generation);
newProcessor.setExportGeneration(generation);
newProcessor.readyForData();
}
catch (final ClassNotFoundException e) {
exportLog.l7dlog( Level.ERROR, LogKeys.export_ExportManager_NoLoaderExtensions.name(), e);
throw new RuntimeException(e);
}
catch (final Exception e) {
exportLog.error("Initialize failed with:", e);
throw new RuntimeException(e);
}
} } | public class class_name {
private void initialize(CatalogContext catalogContext, List<Pair<Integer, Integer>> localPartitionsToSites,
boolean isRejoin) {
try {
CatalogMap<Connector> connectors = CatalogUtil.getConnectors(catalogContext);
if (exportLog.isDebugEnabled()) {
exportLog.debug("initialize for " + connectors.size() + " connectors."); // depends on control dependency: [if], data = [none]
CatalogUtil.dumpConnectors(exportLog, connectors); // depends on control dependency: [if], data = [none]
}
if (!CatalogUtil.hasExportedTables(connectors)) {
return; // depends on control dependency: [if], data = [none]
}
if (exportLog.isDebugEnabled()) {
exportLog.debug("Creating processor " + m_loaderClass); // depends on control dependency: [if], data = [none]
}
ExportDataProcessor newProcessor = getNewProcessorWithProcessConfigSet(m_processorConfig);
m_processor.set(newProcessor); // depends on control dependency: [try], data = [none]
File exportOverflowDirectory = new File(VoltDB.instance().getExportOverflowPath());
ExportGeneration generation = new ExportGeneration(exportOverflowDirectory, m_messenger);
generation.initialize(m_hostId, catalogContext,
connectors, newProcessor, localPartitionsToSites, exportOverflowDirectory); // depends on control dependency: [try], data = [none]
m_generation.set(generation); // depends on control dependency: [try], data = [none]
newProcessor.setExportGeneration(generation); // depends on control dependency: [try], data = [none]
newProcessor.readyForData(); // depends on control dependency: [try], data = [none]
}
catch (final ClassNotFoundException e) {
exportLog.l7dlog( Level.ERROR, LogKeys.export_ExportManager_NoLoaderExtensions.name(), e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
catch (final Exception e) {
exportLog.error("Initialize failed with:", e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
Expr map() {
if (peek().sym != Sym.LBRACE) {
return array();
}
LinkedHashMap<Object, Expr> mapEntry = new LinkedHashMap<Object, Expr>();
Map map = new Map(mapEntry);
move();
if (peek().sym == Sym.RBRACE) {
move();
return map;
}
buildMapEntry(mapEntry);
while (peek().sym == Sym.COMMA) {
move();
buildMapEntry(mapEntry);
}
match(Sym.RBRACE);
return map;
} } | public class class_name {
Expr map() {
if (peek().sym != Sym.LBRACE) {
return array();
// depends on control dependency: [if], data = [none]
}
LinkedHashMap<Object, Expr> mapEntry = new LinkedHashMap<Object, Expr>();
Map map = new Map(mapEntry);
move();
if (peek().sym == Sym.RBRACE) {
move();
// depends on control dependency: [if], data = [none]
return map;
// depends on control dependency: [if], data = [none]
}
buildMapEntry(mapEntry);
while (peek().sym == Sym.COMMA) {
move();
// depends on control dependency: [while], data = [none]
buildMapEntry(mapEntry);
// depends on control dependency: [while], data = [none]
}
match(Sym.RBRACE);
return map;
} } |
public class class_name {
protected <OTHER, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter,
SetAttribute<ENTITY, OTHER> reference,
SingularAttribute<OTHER, X> valueField) {
if (filter.getEquals() != null) {
return equalsSetSpecification(reference, valueField, filter.getEquals());
} else if (filter.getSpecified() != null) {
return byFieldSpecified(reference, filter.getSpecified());
}
return null;
} } | public class class_name {
protected <OTHER, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter,
SetAttribute<ENTITY, OTHER> reference,
SingularAttribute<OTHER, X> valueField) {
if (filter.getEquals() != null) {
return equalsSetSpecification(reference, valueField, filter.getEquals()); // depends on control dependency: [if], data = [none]
} else if (filter.getSpecified() != null) {
return byFieldSpecified(reference, filter.getSpecified()); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static boolean doGraphAnalysis(Connection connection,
String inputTable,
String orientation,
String weight)
throws SQLException, InvocationTargetException, NoSuchMethodException,
InstantiationException, IllegalAccessException {
final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable);
final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_CENT_SUFFIX);
final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_CENT_SUFFIX);
try {
createTables(connection, nodesName, edgesName);
final KeyedGraph graph =
doAnalysisAndReturnGraph(connection, inputTable, orientation, weight);
final boolean previousAutoCommit = connection.getAutoCommit();
connection.setAutoCommit(false);
storeNodeCentrality(connection, nodesName, graph);
storeEdgeCentrality(connection, edgesName, graph);
connection.setAutoCommit(previousAutoCommit);
} catch (SQLException e) {
LOGGER.error("Problem creating centrality tables.");
final Statement statement = connection.createStatement();
try {
statement.execute("DROP TABLE IF EXISTS " + nodesName);
statement.execute("DROP TABLE IF EXISTS " + edgesName);
} finally {
statement.close();
}
return false;
}
return true;
} } | public class class_name {
public static boolean doGraphAnalysis(Connection connection,
String inputTable,
String orientation,
String weight)
throws SQLException, InvocationTargetException, NoSuchMethodException,
InstantiationException, IllegalAccessException {
final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable);
final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_CENT_SUFFIX);
final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_CENT_SUFFIX);
try {
createTables(connection, nodesName, edgesName);
final KeyedGraph graph =
doAnalysisAndReturnGraph(connection, inputTable, orientation, weight);
final boolean previousAutoCommit = connection.getAutoCommit();
connection.setAutoCommit(false);
storeNodeCentrality(connection, nodesName, graph);
storeEdgeCentrality(connection, edgesName, graph);
connection.setAutoCommit(previousAutoCommit);
} catch (SQLException e) {
LOGGER.error("Problem creating centrality tables.");
final Statement statement = connection.createStatement();
try {
statement.execute("DROP TABLE IF EXISTS " + nodesName); // depends on control dependency: [try], data = [none]
statement.execute("DROP TABLE IF EXISTS " + edgesName); // depends on control dependency: [try], data = [none]
} finally {
statement.close();
}
return false;
}
return true;
} } |
public class class_name {
protected APIParameter parseCustomizedReturn(MethodDoc methodDoc) {
Tag[] tags = methodDoc.tags(WRReturnTaglet.NAME);
APIParameter result = null;
if (tags.length > 0) {
result = WRReturnTaglet.parse(tags[0].text());
}
return result;
} } | public class class_name {
protected APIParameter parseCustomizedReturn(MethodDoc methodDoc) {
Tag[] tags = methodDoc.tags(WRReturnTaglet.NAME);
APIParameter result = null;
if (tags.length > 0) {
result = WRReturnTaglet.parse(tags[0].text()); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private JPanel getPanelMisc() {
if (panelMisc == null) {
panelMisc = new JPanel();
panelMisc.setLayout(new GridBagLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
panelMisc.setSize(114, 132);
}
displayLabel = new JLabel(Constant.messages.getString("view.options.label.display"));
brkPanelViewLabel = new JLabel(Constant.messages.getString("view.options.label.brkPanelView"));
advancedViewLabel = new JLabel(Constant.messages.getString("view.options.label.advancedview"));
wmUiHandlingLabel = new JLabel(Constant.messages.getString("view.options.label.wmuihandler"));
askOnExitLabel = new JLabel(Constant.messages.getString("view.options.label.askonexit"));
showMainToolbarLabel = new JLabel(Constant.messages.getString("view.options.label.showMainToolbar"));
processImagesLabel = new JLabel(Constant.messages.getString("view.options.label.processImages"));
showTabNamesLabel = new JLabel(Constant.messages.getString("view.options.label.showTabNames"));
outputTabTimeStampLabel = new JLabel(Constant.messages.getString("options.display.timestamp.format.outputtabtimestamps.label"));
largeRequestLabel = new JLabel(Constant.messages.getString("view.options.label.largeRequestSize"));
largeResponseLabel = new JLabel(Constant.messages.getString("view.options.label.largeResponseSize"));
lookAndFeelLabel = new JLabel(Constant.messages.getString("view.options.label.lookandfeel"));
outputTabTimeStampExampleLabel = new JLabel(TimeStampUtils.currentDefaultFormattedTimeStamp());
showSplashScreenLabel = new JLabel(Constant.messages.getString("view.options.label.showSplashScreen"));
int row = 0;
displayLabel.setLabelFor(getDisplaySelect());
panelMisc.add(displayLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getDisplaySelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
JLabel responsePanelPositionLabel = new JLabel(Constant.messages.getString("view.options.label.responsepanelpos"));
panelMisc.add(responsePanelPositionLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getResponsePanelPositionComboBox(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
brkPanelViewLabel.setLabelFor(getBrkPanelViewSelect());
panelMisc.add(brkPanelViewLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getBrkPanelViewSelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
largeRequestLabel.setLabelFor(getLargeRequestSize());
panelMisc.add(largeRequestLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLargeRequestSize(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
largeResponseLabel.setLabelFor(getLargeResponseSize());
panelMisc.add(largeResponseLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLargeResponseSize(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
advancedViewLabel.setLabelFor(getChkAdvancedView());
panelMisc.add(advancedViewLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkAdvancedView(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
wmUiHandlingLabel.setLabelFor(getChkWmUiHandling());
panelMisc.add(wmUiHandlingLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkWmUiHandling(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
askOnExitLabel.setLabelFor(getChkAskOnExit());
panelMisc.add(askOnExitLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkAskOnExit(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
showMainToolbarLabel.setLabelFor(getChkShowMainToolbar());
panelMisc.add(showMainToolbarLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkShowMainToolbar(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
processImagesLabel.setLabelFor(getChkProcessImages());
panelMisc.add(processImagesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkProcessImages(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
Insets insets = new Insets(2, 2, 2, 2);
String labelText = Constant.messages.getString("view.options.label.showlocalconnectrequests");
JLabel showConnectRequestLabel = new JLabel(labelText);
showConnectRequestLabel.setLabelFor(getShowLocalConnectRequestsCheckbox());
panelMisc.add(showConnectRequestLabel, LayoutHelper.getGBC(0, row, 1, 1.0D, insets));
panelMisc.add(getShowLocalConnectRequestsCheckbox(), LayoutHelper.getGBC(1, row, 1, 1.0D, insets));
row++;
showTabNamesLabel.setLabelFor(getShowTabNames());
panelMisc.add(showTabNamesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getShowTabNames(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
showSplashScreenLabel.setLabelFor(getShowSplashScreen());
panelMisc.add(showSplashScreenLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getShowSplashScreen(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
outputTabTimeStampLabel.setLabelFor(getChkOutputTabTimeStamps());
panelMisc.add(outputTabTimeStampLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkOutputTabTimeStamps(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
outputTabTimeStampExampleLabel.setLabelFor(getTimeStampsFormatSelect());
panelMisc.add(getTimeStampsFormatSelect(),
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(outputTabTimeStampExampleLabel,
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
for (FontUtils.FontType fontType: FontUtils.FontType.values()) {
row++;
JPanel fontsPanel = new JPanel();
fontsPanel.setLayout(new GridBagLayout());
fontsPanel.setBorder(
BorderFactory.createTitledBorder(
null,
fontTypeLabels.get(fontType),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
FontUtils.getFont(FontUtils.Size.standard),
Color.black));
panelMisc.add(
fontsPanel,
LayoutHelper.getGBC(0, row, 2, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontNameLabel = new JLabel(Constant.messages.getString("view.options.label.fontName"));
fontNameLabel.setLabelFor(getFontName(fontType));
fontsPanel.add(fontNameLabel,
LayoutHelper.getGBC(0, 1, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontName(fontType),
LayoutHelper.getGBC(1, 1, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontSizeLabel = new JLabel(Constant.messages.getString("view.options.label.fontSize"));
fontSizeLabel.setLabelFor(getFontSize(fontType));
fontsPanel.add(fontSizeLabel,
LayoutHelper.getGBC(0, 2, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontSize(fontType),
LayoutHelper.getGBC(1, 2, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontExampleLabel = new JLabel(Constant.messages.getString("view.options.label.fontExample"));
fontExampleLabel.setLabelFor(getFontExampleLabel(fontType));
fontsPanel.add(fontExampleLabel,
LayoutHelper.getGBC(0, 3, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontExampleLabel(fontType),
LayoutHelper.getGBC(1, 3, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
}
row++;
JLabel scaleImagesLabel = new JLabel(Constant.messages.getString("view.options.label.scaleImages"));
scaleImagesLabel.setLabelFor(getScaleImages());
panelMisc.add(scaleImagesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getScaleImages(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
lookAndFeelLabel.setLabelFor(getLookAndFeelSelect());
panelMisc.add(lookAndFeelLabel,
LayoutHelper.getGBC(0, row, 1,1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLookAndFeelSelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D,new java.awt.Insets(2,2,2,2)));
row++;
panelMisc.add(new JLabel(""),
LayoutHelper.getGBC(0, row, 1, 1.0D, 1.0D));
}
return panelMisc;
} } | public class class_name {
private JPanel getPanelMisc() {
if (panelMisc == null) {
panelMisc = new JPanel();
panelMisc.setLayout(new GridBagLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
panelMisc.setSize(114, 132);
// depends on control dependency: [if], data = [none]
}
displayLabel = new JLabel(Constant.messages.getString("view.options.label.display"));
brkPanelViewLabel = new JLabel(Constant.messages.getString("view.options.label.brkPanelView"));
advancedViewLabel = new JLabel(Constant.messages.getString("view.options.label.advancedview"));
wmUiHandlingLabel = new JLabel(Constant.messages.getString("view.options.label.wmuihandler"));
askOnExitLabel = new JLabel(Constant.messages.getString("view.options.label.askonexit"));
showMainToolbarLabel = new JLabel(Constant.messages.getString("view.options.label.showMainToolbar"));
processImagesLabel = new JLabel(Constant.messages.getString("view.options.label.processImages"));
showTabNamesLabel = new JLabel(Constant.messages.getString("view.options.label.showTabNames"));
outputTabTimeStampLabel = new JLabel(Constant.messages.getString("options.display.timestamp.format.outputtabtimestamps.label"));
largeRequestLabel = new JLabel(Constant.messages.getString("view.options.label.largeRequestSize"));
largeResponseLabel = new JLabel(Constant.messages.getString("view.options.label.largeResponseSize"));
lookAndFeelLabel = new JLabel(Constant.messages.getString("view.options.label.lookandfeel"));
outputTabTimeStampExampleLabel = new JLabel(TimeStampUtils.currentDefaultFormattedTimeStamp());
showSplashScreenLabel = new JLabel(Constant.messages.getString("view.options.label.showSplashScreen"));
int row = 0;
displayLabel.setLabelFor(getDisplaySelect());
panelMisc.add(displayLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getDisplaySelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
JLabel responsePanelPositionLabel = new JLabel(Constant.messages.getString("view.options.label.responsepanelpos"));
panelMisc.add(responsePanelPositionLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getResponsePanelPositionComboBox(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
brkPanelViewLabel.setLabelFor(getBrkPanelViewSelect());
panelMisc.add(brkPanelViewLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getBrkPanelViewSelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
largeRequestLabel.setLabelFor(getLargeRequestSize());
panelMisc.add(largeRequestLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLargeRequestSize(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
largeResponseLabel.setLabelFor(getLargeResponseSize());
panelMisc.add(largeResponseLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLargeResponseSize(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
advancedViewLabel.setLabelFor(getChkAdvancedView());
panelMisc.add(advancedViewLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkAdvancedView(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
wmUiHandlingLabel.setLabelFor(getChkWmUiHandling());
panelMisc.add(wmUiHandlingLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkWmUiHandling(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
askOnExitLabel.setLabelFor(getChkAskOnExit());
panelMisc.add(askOnExitLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkAskOnExit(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
showMainToolbarLabel.setLabelFor(getChkShowMainToolbar());
panelMisc.add(showMainToolbarLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkShowMainToolbar(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
processImagesLabel.setLabelFor(getChkProcessImages());
panelMisc.add(processImagesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkProcessImages(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
Insets insets = new Insets(2, 2, 2, 2);
String labelText = Constant.messages.getString("view.options.label.showlocalconnectrequests");
JLabel showConnectRequestLabel = new JLabel(labelText);
showConnectRequestLabel.setLabelFor(getShowLocalConnectRequestsCheckbox());
panelMisc.add(showConnectRequestLabel, LayoutHelper.getGBC(0, row, 1, 1.0D, insets));
panelMisc.add(getShowLocalConnectRequestsCheckbox(), LayoutHelper.getGBC(1, row, 1, 1.0D, insets));
row++;
showTabNamesLabel.setLabelFor(getShowTabNames());
panelMisc.add(showTabNamesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getShowTabNames(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
showSplashScreenLabel.setLabelFor(getShowSplashScreen());
panelMisc.add(showSplashScreenLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getShowSplashScreen(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
outputTabTimeStampLabel.setLabelFor(getChkOutputTabTimeStamps());
panelMisc.add(outputTabTimeStampLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getChkOutputTabTimeStamps(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
outputTabTimeStampExampleLabel.setLabelFor(getTimeStampsFormatSelect());
panelMisc.add(getTimeStampsFormatSelect(),
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(outputTabTimeStampExampleLabel,
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
for (FontUtils.FontType fontType: FontUtils.FontType.values()) {
row++;
JPanel fontsPanel = new JPanel();
fontsPanel.setLayout(new GridBagLayout());
fontsPanel.setBorder(
BorderFactory.createTitledBorder(
null,
fontTypeLabels.get(fontType),
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
FontUtils.getFont(FontUtils.Size.standard),
Color.black));
panelMisc.add(
fontsPanel,
LayoutHelper.getGBC(0, row, 2, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontNameLabel = new JLabel(Constant.messages.getString("view.options.label.fontName"));
fontNameLabel.setLabelFor(getFontName(fontType));
fontsPanel.add(fontNameLabel,
LayoutHelper.getGBC(0, 1, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontName(fontType),
LayoutHelper.getGBC(1, 1, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontSizeLabel = new JLabel(Constant.messages.getString("view.options.label.fontSize"));
fontSizeLabel.setLabelFor(getFontSize(fontType));
fontsPanel.add(fontSizeLabel,
LayoutHelper.getGBC(0, 2, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontSize(fontType),
LayoutHelper.getGBC(1, 2, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
JLabel fontExampleLabel = new JLabel(Constant.messages.getString("view.options.label.fontExample"));
fontExampleLabel.setLabelFor(getFontExampleLabel(fontType));
fontsPanel.add(fontExampleLabel,
LayoutHelper.getGBC(0, 3, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
fontsPanel.add(getFontExampleLabel(fontType),
LayoutHelper.getGBC(1, 3, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
}
row++;
JLabel scaleImagesLabel = new JLabel(Constant.messages.getString("view.options.label.scaleImages"));
scaleImagesLabel.setLabelFor(getScaleImages());
panelMisc.add(scaleImagesLabel,
LayoutHelper.getGBC(0, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getScaleImages(),
LayoutHelper.getGBC(1, row, 1, 1.0D, new java.awt.Insets(2,2,2,2)));
row++;
lookAndFeelLabel.setLabelFor(getLookAndFeelSelect());
panelMisc.add(lookAndFeelLabel,
LayoutHelper.getGBC(0, row, 1,1.0D, new java.awt.Insets(2,2,2,2)));
panelMisc.add(getLookAndFeelSelect(),
LayoutHelper.getGBC(1, row, 1, 1.0D,new java.awt.Insets(2,2,2,2)));
row++;
panelMisc.add(new JLabel(""),
LayoutHelper.getGBC(0, row, 1, 1.0D, 1.0D));
}
return panelMisc;
} } |
public class class_name {
@JsonIgnore
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
final List<GrantedAuthority> authorities = new ArrayList<>();
for (final UserRoleName role : roles) {
authorities.add(createAuthority(role));
}
return authorities;
} } | public class class_name {
@JsonIgnore
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
final List<GrantedAuthority> authorities = new ArrayList<>();
for (final UserRoleName role : roles) {
authorities.add(createAuthority(role)); // depends on control dependency: [for], data = [role]
}
return authorities;
} } |
public class class_name {
public Table getTable(){
final Table table = new Table("Name", "Long Name", "URL", "Comment");
// Create row(s) per dependency
for(final License license: licenses){
table.addRow(license.getName(), license.getLongName(), license.getUrl(), license.getComments());
}
return table;
} } | public class class_name {
public Table getTable(){
final Table table = new Table("Name", "Long Name", "URL", "Comment");
// Create row(s) per dependency
for(final License license: licenses){
table.addRow(license.getName(), license.getLongName(), license.getUrl(), license.getComments()); // depends on control dependency: [for], data = [license]
}
return table;
} } |
public class class_name {
public final Table getSystemTable(Session session, String name) {
Table t;
int tableIndex;
// must come first...many methods depend on this being set properly
this.session = session;
if (!isSystemTable(name)) {
return null;
}
tableIndex = getSysTableID(name);
t = sysTables[tableIndex];
// fredt - any system table that is not supported will be null here
if (t == null) {
return t;
}
// At the time of opening the database, no content is needed
// at present. However, table structure is required at this
// point to allow processing logged View defn's against system
// tables. Returning tables without content speeds the database
// open phase under such cases.
if (!withContent) {
return t;
}
if (isDirty) {
cacheClear();
}
HsqlName oldUser = sysTableSessions[tableIndex];
boolean tableValid = oldUser != null;
// user has changed and table is user-dependent
if (session.getGrantee().getName() != oldUser
&& sysTableSessionDependent[tableIndex]) {
tableValid = false;
}
if (nonCachedTablesSet.contains(name)) {
tableValid = false;
}
// any valid cached table will be returned here
if (tableValid) {
return t;
}
// fredt - clear the contents of table and set new User
t.clearAllData(session);
sysTableSessions[tableIndex] = session.getGrantee().getName();
// match and if found, generate.
t = generateTable(tableIndex);
// t will be null at this point if the implementation
// does not support the particular table.
//
// send back what we found or generated
return t;
} } | public class class_name {
public final Table getSystemTable(Session session, String name) {
Table t;
int tableIndex;
// must come first...many methods depend on this being set properly
this.session = session;
if (!isSystemTable(name)) {
return null; // depends on control dependency: [if], data = [none]
}
tableIndex = getSysTableID(name);
t = sysTables[tableIndex];
// fredt - any system table that is not supported will be null here
if (t == null) {
return t; // depends on control dependency: [if], data = [none]
}
// At the time of opening the database, no content is needed
// at present. However, table structure is required at this
// point to allow processing logged View defn's against system
// tables. Returning tables without content speeds the database
// open phase under such cases.
if (!withContent) {
return t; // depends on control dependency: [if], data = [none]
}
if (isDirty) {
cacheClear(); // depends on control dependency: [if], data = [none]
}
HsqlName oldUser = sysTableSessions[tableIndex];
boolean tableValid = oldUser != null;
// user has changed and table is user-dependent
if (session.getGrantee().getName() != oldUser
&& sysTableSessionDependent[tableIndex]) {
tableValid = false; // depends on control dependency: [if], data = [none]
}
if (nonCachedTablesSet.contains(name)) {
tableValid = false; // depends on control dependency: [if], data = [none]
}
// any valid cached table will be returned here
if (tableValid) {
return t; // depends on control dependency: [if], data = [none]
}
// fredt - clear the contents of table and set new User
t.clearAllData(session);
sysTableSessions[tableIndex] = session.getGrantee().getName();
// match and if found, generate.
t = generateTable(tableIndex);
// t will be null at this point if the implementation
// does not support the particular table.
//
// send back what we found or generated
return t;
} } |
public class class_name {
public Layer getLayer(String layerId) {
org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayer(layerId);
if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) {
return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer);
}
return new LayerImpl(layer);
} } | public class class_name {
public Layer getLayer(String layerId) {
org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayer(layerId);
if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) {
return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer); // depends on control dependency: [if], data = [none]
}
return new LayerImpl(layer);
} } |
public class class_name {
public void marshall(DiskSnapshotInfo diskSnapshotInfo, ProtocolMarshaller protocolMarshaller) {
if (diskSnapshotInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(diskSnapshotInfo.getSizeInGb(), SIZEINGB_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DiskSnapshotInfo diskSnapshotInfo, ProtocolMarshaller protocolMarshaller) {
if (diskSnapshotInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(diskSnapshotInfo.getSizeInGb(), SIZEINGB_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean hasChain(String authId) {
int modelnr = 0;
List<Chain> chains = getChains(modelnr);
for (Chain c : chains) {
// we check here with equals because we might want to distinguish between upper and lower case chains!
if (c.getId().equals(authId)) {
return true;
}
}
return false;
} } | public class class_name {
@Override
public boolean hasChain(String authId) {
int modelnr = 0;
List<Chain> chains = getChains(modelnr);
for (Chain c : chains) {
// we check here with equals because we might want to distinguish between upper and lower case chains!
if (c.getId().equals(authId)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public String text() {
final StringBuilder accum = StringUtil.borrowBuilder();
NodeTraversor.traverse(new NodeVisitor() {
public void head(Node node, int depth) {
if (node instanceof TextNode) {
TextNode textNode = (TextNode) node;
appendNormalisedText(accum, textNode);
} else if (node instanceof Element) {
Element element = (Element) node;
if (accum.length() > 0 &&
(element.isBlock() || element.tag.getName().equals("br")) &&
!TextNode.lastCharIsWhitespace(accum))
accum.append(' ');
}
}
public void tail(Node node, int depth) {
// make sure there is a space between block tags and immediately following text nodes <div>One</div>Two should be "One Two".
if (node instanceof Element) {
Element element = (Element) node;
if (element.isBlock() && (node.nextSibling() instanceof TextNode) && !TextNode.lastCharIsWhitespace(accum))
accum.append(' ');
}
}
}, this);
return StringUtil.releaseBuilder(accum).trim();
} } | public class class_name {
public String text() {
final StringBuilder accum = StringUtil.borrowBuilder();
NodeTraversor.traverse(new NodeVisitor() {
public void head(Node node, int depth) {
if (node instanceof TextNode) {
TextNode textNode = (TextNode) node;
appendNormalisedText(accum, textNode); // depends on control dependency: [if], data = [none]
} else if (node instanceof Element) {
Element element = (Element) node;
if (accum.length() > 0 &&
(element.isBlock() || element.tag.getName().equals("br")) &&
!TextNode.lastCharIsWhitespace(accum))
accum.append(' ');
}
}
public void tail(Node node, int depth) {
// make sure there is a space between block tags and immediately following text nodes <div>One</div>Two should be "One Two".
if (node instanceof Element) {
Element element = (Element) node;
if (element.isBlock() && (node.nextSibling() instanceof TextNode) && !TextNode.lastCharIsWhitespace(accum))
accum.append(' ');
}
}
}, this);
return StringUtil.releaseBuilder(accum).trim();
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.