code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private void reschedule() {
// set up a daily roll
Calendar cal = Calendar.getInstance();
long today = cal.getTimeInMillis();
// adjust to somewhere after midnight of the next day
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.add(Calendar.DATE, 1);
long tomorrow = cal.getTimeInMillis();
if (executorService != null) {
future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS);
}
} } | public class class_name {
private void reschedule() {
// set up a daily roll
Calendar cal = Calendar.getInstance();
long today = cal.getTimeInMillis();
// adjust to somewhere after midnight of the next day
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.add(Calendar.DATE, 1);
long tomorrow = cal.getTimeInMillis();
if (executorService != null) {
future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ChangeMessageVisibilityBatchResult withSuccessful(ChangeMessageVisibilityBatchResultEntry... successful) {
if (this.successful == null) {
setSuccessful(new com.amazonaws.internal.SdkInternalList<ChangeMessageVisibilityBatchResultEntry>(successful.length));
}
for (ChangeMessageVisibilityBatchResultEntry ele : successful) {
this.successful.add(ele);
}
return this;
} } | public class class_name {
public ChangeMessageVisibilityBatchResult withSuccessful(ChangeMessageVisibilityBatchResultEntry... successful) {
if (this.successful == null) {
setSuccessful(new com.amazonaws.internal.SdkInternalList<ChangeMessageVisibilityBatchResultEntry>(successful.length)); // depends on control dependency: [if], data = [none]
}
for (ChangeMessageVisibilityBatchResultEntry ele : successful) {
this.successful.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private static String createRowTemplate(List<Integer> maxColumnSizes) {
List<String> columnFormatSpecifiers = Lists.newArrayList();
for (int maxColumnSize : maxColumnSizes) {
columnFormatSpecifiers.add("%-" + maxColumnSize + "s");
}
return new StringBuilder("| ")
.append(Joiner.on(" | ").join(columnFormatSpecifiers))
.append(" |\n")
.toString();
} } | public class class_name {
private static String createRowTemplate(List<Integer> maxColumnSizes) {
List<String> columnFormatSpecifiers = Lists.newArrayList();
for (int maxColumnSize : maxColumnSizes) {
columnFormatSpecifiers.add("%-" + maxColumnSize + "s"); // depends on control dependency: [for], data = [maxColumnSize]
}
return new StringBuilder("| ")
.append(Joiner.on(" | ").join(columnFormatSpecifiers))
.append(" |\n")
.toString();
} } |
public class class_name {
@SuppressWarnings("unchecked")
static <K,V> Map<K,V> asMap(Object value, PDescriptor keyType, PDescriptor itemType) throws ProvidenceConfigException {
if (value instanceof Map) {
boolean sorted = value instanceof TreeMap ||
value instanceof ImmutableSortedMap;
Map<K,V> out = sorted ? new TreeMap<>() : new LinkedHashMap<>();
for (Map.Entry item : ((Map<?,?>) value).entrySet()) {
out.put((K) asType(keyType, item.getKey()),
(V) asType(itemType, item.getValue()));
}
return out;
}
throw new ProvidenceConfigException(
"Unable to convert " + value.getClass().getSimpleName() + " to a collection");
} } | public class class_name {
@SuppressWarnings("unchecked")
static <K,V> Map<K,V> asMap(Object value, PDescriptor keyType, PDescriptor itemType) throws ProvidenceConfigException {
if (value instanceof Map) {
boolean sorted = value instanceof TreeMap ||
value instanceof ImmutableSortedMap;
Map<K,V> out = sorted ? new TreeMap<>() : new LinkedHashMap<>();
for (Map.Entry item : ((Map<?,?>) value).entrySet()) {
out.put((K) asType(keyType, item.getKey()),
(V) asType(itemType, item.getValue())); // depends on control dependency: [for], data = [item]
}
return out;
}
throw new ProvidenceConfigException(
"Unable to convert " + value.getClass().getSimpleName() + " to a collection");
} } |
public class class_name {
private Document loadXML(URL url, boolean useNamespace) {
InputStream stream = null;
try {
stream = url.openConnection().getInputStream();
InputSource source = new InputSource(stream);
return useNamespace ? loadXMLNS(source) : loadXML(source);
} catch (Exception e) {
throw new DomException(e);
} finally {
close(stream);
}
} } | public class class_name {
private Document loadXML(URL url, boolean useNamespace) {
InputStream stream = null;
try {
stream = url.openConnection().getInputStream();
// depends on control dependency: [try], data = [none]
InputSource source = new InputSource(stream);
return useNamespace ? loadXMLNS(source) : loadXML(source);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new DomException(e);
} finally {
// depends on control dependency: [catch], data = [none]
close(stream);
}
} } |
public class class_name {
public static long incTwoBytePrimaryByOffset(long basePrimary, boolean isCompressible,
int offset) {
// Extract the second byte, minus the minimum byte value,
// plus the offset, modulo the number of usable byte values, plus the minimum.
// Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary.
long primary;
if(isCompressible) {
offset += ((int)(basePrimary >> 16) & 0xff) - 4;
primary = ((offset % 251) + 4) << 16;
offset /= 251;
} else {
offset += ((int)(basePrimary >> 16) & 0xff) - 2;
primary = ((offset % 254) + 2) << 16;
offset /= 254;
}
// First byte, assume no further overflow.
return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24));
} } | public class class_name {
public static long incTwoBytePrimaryByOffset(long basePrimary, boolean isCompressible,
int offset) {
// Extract the second byte, minus the minimum byte value,
// plus the offset, modulo the number of usable byte values, plus the minimum.
// Reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary.
long primary;
if(isCompressible) {
offset += ((int)(basePrimary >> 16) & 0xff) - 4; // depends on control dependency: [if], data = [none]
primary = ((offset % 251) + 4) << 16; // depends on control dependency: [if], data = [none]
offset /= 251; // depends on control dependency: [if], data = [none]
} else {
offset += ((int)(basePrimary >> 16) & 0xff) - 2; // depends on control dependency: [if], data = [none]
primary = ((offset % 254) + 2) << 16; // depends on control dependency: [if], data = [none]
offset /= 254; // depends on control dependency: [if], data = [none]
}
// First byte, assume no further overflow.
return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24));
} } |
public class class_name {
private Attribute checkContext(URI type, URI id, URI issuer,
URI category, int designatorType) {
if (!STRING_ATTRIBUTE_TYPE_URI.equals(type)) return null;
String [] values = null;
switch(designatorType){
case AttributeDesignator.SUBJECT_TARGET:
values = context.getSubjectValues(id.toString());
break;
case AttributeDesignator.RESOURCE_TARGET:
values = context.getResourceValues(id);
break;
case AttributeDesignator.ACTION_TARGET:
values = context.getActionValues(id);
break;
case AttributeDesignator.ENVIRONMENT_TARGET:
values = context.getEnvironmentValues(id);
break;
}
if (values == null || values.length == 0) return null;
String iString = (issuer == null) ? null : issuer.toString();
String tString = type.toString();
if (values.length == 1) {
AttributeValue val = stringToValue(values[0], tString);
return (val == null) ? null :
new SingletonAttribute(id, iString, getCurrentDateTime(), val);
} else {
ArrayList<AttributeValue> valCollection = new ArrayList<AttributeValue>(values.length);
for (int i=0;i<values.length;i++) {
AttributeValue val = stringToValue(values[i], tString);
if (val != null) valCollection.add(val);
}
return new BasicAttribute(id, type, iString, getCurrentDateTime(), valCollection);
}
} } | public class class_name {
private Attribute checkContext(URI type, URI id, URI issuer,
URI category, int designatorType) {
if (!STRING_ATTRIBUTE_TYPE_URI.equals(type)) return null;
String [] values = null;
switch(designatorType){
case AttributeDesignator.SUBJECT_TARGET:
values = context.getSubjectValues(id.toString());
break;
case AttributeDesignator.RESOURCE_TARGET:
values = context.getResourceValues(id);
break;
case AttributeDesignator.ACTION_TARGET:
values = context.getActionValues(id);
break;
case AttributeDesignator.ENVIRONMENT_TARGET:
values = context.getEnvironmentValues(id);
break;
}
if (values == null || values.length == 0) return null;
String iString = (issuer == null) ? null : issuer.toString();
String tString = type.toString();
if (values.length == 1) {
AttributeValue val = stringToValue(values[0], tString);
return (val == null) ? null :
new SingletonAttribute(id, iString, getCurrentDateTime(), val); // depends on control dependency: [if], data = [none]
} else {
ArrayList<AttributeValue> valCollection = new ArrayList<AttributeValue>(values.length);
for (int i=0;i<values.length;i++) {
AttributeValue val = stringToValue(values[i], tString);
if (val != null) valCollection.add(val);
}
return new BasicAttribute(id, type, iString, getCurrentDateTime(), valCollection); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static StreamingOutput buildDOMResponse(final List<String> availableResources) {
try {
final Document document = createSurroundingXMLResp();
final Element resElement = createResultElement(document);
final List<Element> resources = createCollectionElement(availableResources, document);
for (final Element resource : resources) {
resElement.appendChild(resource);
}
document.appendChild(resElement);
return createStream(document);
} catch (final ParserConfigurationException exc) {
throw new JaxRxException(exc);
}
} } | public class class_name {
public static StreamingOutput buildDOMResponse(final List<String> availableResources) {
try {
final Document document = createSurroundingXMLResp();
final Element resElement = createResultElement(document);
final List<Element> resources = createCollectionElement(availableResources, document);
for (final Element resource : resources) {
resElement.appendChild(resource); // depends on control dependency: [for], data = [resource]
}
document.appendChild(resElement); // depends on control dependency: [try], data = [none]
return createStream(document); // depends on control dependency: [try], data = [none]
} catch (final ParserConfigurationException exc) {
throw new JaxRxException(exc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static synchronized DotGit getInstance(File path) {
DotGit dotGit;
// TODO (rs2705): make sure that path is valid
/*
* We want to make sure we're dealing with the canonical path here, since there are multiple
* ways to refer to the same dir with different strings.
*/
String canonicalPath = "";
try {
canonicalPath = path.getCanonicalPath();
} catch (Exception e) {
/*
* TODO (rs2705): Figure out which exception to throw here, and throw it - or should we simply
* let it propogate up as-is?
*/
// Temporary placeholder
return null;
}
if (!(INSTANCES.containsKey(canonicalPath))) {
dotGit = new DotGit(path, canonicalPath);
INSTANCES.put(canonicalPath, dotGit);
} else {
dotGit = INSTANCES.get(canonicalPath);
}
return dotGit;
} } | public class class_name {
public static synchronized DotGit getInstance(File path) {
DotGit dotGit;
// TODO (rs2705): make sure that path is valid
/*
* We want to make sure we're dealing with the canonical path here, since there are multiple
* ways to refer to the same dir with different strings.
*/
String canonicalPath = "";
try {
canonicalPath = path.getCanonicalPath(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
/*
* TODO (rs2705): Figure out which exception to throw here, and throw it - or should we simply
* let it propogate up as-is?
*/
// Temporary placeholder
return null;
} // depends on control dependency: [catch], data = [none]
if (!(INSTANCES.containsKey(canonicalPath))) {
dotGit = new DotGit(path, canonicalPath); // depends on control dependency: [if], data = [none]
INSTANCES.put(canonicalPath, dotGit); // depends on control dependency: [if], data = [none]
} else {
dotGit = INSTANCES.get(canonicalPath); // depends on control dependency: [if], data = [none]
}
return dotGit;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Number> T isNumber( String value, Class<T> adaptee ) {
if (value == null) {
return null;
}
if (adaptee == null) {
adaptee = (Class<T>) Double.class;
}
if (adaptee.isAssignableFrom(Double.class)) {
try {
Double parsed = Double.parseDouble(value);
return adaptee.cast(parsed);
} catch (Exception e) {
return null;
}
} else if (adaptee.isAssignableFrom(Float.class)) {
try {
Float parsed = Float.parseFloat(value);
return adaptee.cast(parsed);
} catch (Exception e) {
return null;
}
} else if (adaptee.isAssignableFrom(Integer.class)) {
try {
Integer parsed = Integer.parseInt(value);
return adaptee.cast(parsed);
} catch (Exception e) {
try {
// try also double and convert by truncating
Integer parsed = (int) Double.parseDouble(value);
return adaptee.cast(parsed);
} catch (Exception ex) {
return null;
}
}
} else {
throw new IllegalArgumentException();
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T extends Number> T isNumber( String value, Class<T> adaptee ) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (adaptee == null) {
adaptee = (Class<T>) Double.class; // depends on control dependency: [if], data = [none]
}
if (adaptee.isAssignableFrom(Double.class)) {
try {
Double parsed = Double.parseDouble(value);
return adaptee.cast(parsed); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} else if (adaptee.isAssignableFrom(Float.class)) {
try {
Float parsed = Float.parseFloat(value);
return adaptee.cast(parsed); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} else if (adaptee.isAssignableFrom(Integer.class)) {
try {
Integer parsed = Integer.parseInt(value);
return adaptee.cast(parsed); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
try {
// try also double and convert by truncating
Integer parsed = (int) Double.parseDouble(value);
return adaptee.cast(parsed); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} else {
throw new IllegalArgumentException();
}
} } |
public class class_name {
protected LookAndFeels setDefaultLookAndFeel(@NonNull LookAndFeels lookAndFeels,
Component component)
{
try
{
LookAndFeels.setLookAndFeel(lookAndFeels, component);
setCurrentLookAndFeels(lookAndFeels);
}
catch (final ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e)
{
String title = e.getLocalizedMessage();
String htmlMessage = "<html><body width='650'>" + "<h2>" + title + "</h2>" + "<p>"
+ e.getMessage();
JOptionPane.showMessageDialog(this, htmlMessage, title, JOptionPane.ERROR_MESSAGE);
log.log(Level.SEVERE, e.getMessage(), e);
}
return lookAndFeels;
} } | public class class_name {
protected LookAndFeels setDefaultLookAndFeel(@NonNull LookAndFeels lookAndFeels,
Component component)
{
try
{
LookAndFeels.setLookAndFeel(lookAndFeels, component); // depends on control dependency: [try], data = [none]
setCurrentLookAndFeels(lookAndFeels); // depends on control dependency: [try], data = [none]
}
catch (final ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e)
{
String title = e.getLocalizedMessage();
String htmlMessage = "<html><body width='650'>" + "<h2>" + title + "</h2>" + "<p>"
+ e.getMessage();
JOptionPane.showMessageDialog(this, htmlMessage, title, JOptionPane.ERROR_MESSAGE);
log.log(Level.SEVERE, e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return lookAndFeels;
} } |
public class class_name {
public SchemaRepositoryModelBuilder addSchema(String id, String location) {
SchemaModel schema = new SchemaModel();
schema.setId(id);
schema.setLocation(location);
if (model.getSchemas() == null) {
model.setSchemas(new SchemaRepositoryModel.Schemas());
}
model.getSchemas().getSchemas().add(schema);
return this;
} } | public class class_name {
public SchemaRepositoryModelBuilder addSchema(String id, String location) {
SchemaModel schema = new SchemaModel();
schema.setId(id);
schema.setLocation(location);
if (model.getSchemas() == null) {
model.setSchemas(new SchemaRepositoryModel.Schemas()); // depends on control dependency: [if], data = [none]
}
model.getSchemas().getSchemas().add(schema);
return this;
} } |
public class class_name {
private void handleResponse(ByteBuf response, ChannelHandlerContext context) {
NettyConnection connection = getConnection(context.channel());
if (connection != null) {
connection.handleResponse(response);
}
} } | public class class_name {
private void handleResponse(ByteBuf response, ChannelHandlerContext context) {
NettyConnection connection = getConnection(context.channel());
if (connection != null) {
connection.handleResponse(response); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean isSinglePrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false;
}
return containsSinglePrefixBlock(networkPrefixLength);
} } | public class class_name {
@Override
public boolean isSinglePrefixBlock() {
Integer networkPrefixLength = getNetworkPrefixLength();
if(networkPrefixLength == null) {
return false; // depends on control dependency: [if], data = [none]
}
return containsSinglePrefixBlock(networkPrefixLength);
} } |
public class class_name {
public void dumpState() {
executorService.execute(new Runnable() {
@Override
public void run() {
lockSendRequestsToService.lock();
try {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("[SpiceManager : ");
stringBuilder.append("Requests to be launched : \n");
dumpMap(stringBuilder, mapRequestToLaunchToRequestListener);
stringBuilder.append("Pending requests : \n");
dumpMap(stringBuilder, mapPendingRequestToRequestListener);
stringBuilder.append(']');
waitForServiceToBeBound();
if (spiceService == null) {
return;
}
spiceService.dumpState();
} catch (final InterruptedException e) {
Ln.e(e, "Interrupted while waiting for acquiring service.");
} finally {
lockSendRequestsToService.unlock();
}
}
});
} } | public class class_name {
public void dumpState() {
executorService.execute(new Runnable() {
@Override
public void run() {
lockSendRequestsToService.lock();
try {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("[SpiceManager : "); // depends on control dependency: [try], data = [none]
stringBuilder.append("Requests to be launched : \n"); // depends on control dependency: [try], data = [none]
dumpMap(stringBuilder, mapRequestToLaunchToRequestListener); // depends on control dependency: [try], data = [none]
stringBuilder.append("Pending requests : \n"); // depends on control dependency: [try], data = [none]
dumpMap(stringBuilder, mapPendingRequestToRequestListener); // depends on control dependency: [try], data = [none]
stringBuilder.append(']'); // depends on control dependency: [try], data = [none]
waitForServiceToBeBound(); // depends on control dependency: [try], data = [none]
if (spiceService == null) {
return; // depends on control dependency: [if], data = [none]
}
spiceService.dumpState(); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
Ln.e(e, "Interrupted while waiting for acquiring service.");
} finally { // depends on control dependency: [catch], data = [none]
lockSendRequestsToService.unlock();
}
}
});
} } |
public class class_name {
private IPath getAbsoluteLocation(IPath location) {
if (location.isAbsolute())
return location;
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
if (location.segmentCount() >= 2 && !"..".equals(location.segment(0))) { //$NON-NLS-1$
IFile file= root.getFile(location);
IPath absolutePath= file.getLocation();
if (absolutePath != null) {
return absolutePath;
}
}
// The path does not exist in the workspace (e.g. because there's no such project).
// Fallback is to just append the path to the workspace root.
return root.getLocation().append(location);
} } | public class class_name {
private IPath getAbsoluteLocation(IPath location) {
if (location.isAbsolute())
return location;
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
if (location.segmentCount() >= 2 && !"..".equals(location.segment(0))) { //$NON-NLS-1$
IFile file= root.getFile(location);
IPath absolutePath= file.getLocation();
if (absolutePath != null) {
return absolutePath; // depends on control dependency: [if], data = [none]
}
}
// The path does not exist in the workspace (e.g. because there's no such project).
// Fallback is to just append the path to the workspace root.
return root.getLocation().append(location);
} } |
public class class_name {
public static String byteBufferToString(ByteBuffer buf) {
StringBuilder sb = new StringBuilder();
for (int k = 0; k < buf.limit() / 4; k++) {
if (k != 0) {
sb.append(" ");
}
sb.append(buf.getInt());
}
return sb.toString();
} } | public class class_name {
public static String byteBufferToString(ByteBuffer buf) {
StringBuilder sb = new StringBuilder();
for (int k = 0; k < buf.limit() / 4; k++) {
if (k != 0) {
sb.append(" "); // depends on control dependency: [if], data = [none]
}
sb.append(buf.getInt()); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
private static void validateRegex(String regex) {
if (regex == null) {
throw new IllegalArgumentException("The regular expression must not be null.");
}
String trimmedRegex = regex.trim();
if (!trimmedRegex.isEmpty()) {
Pattern.compile(trimmedRegex, Pattern.CASE_INSENSITIVE);
}
} } | public class class_name {
private static void validateRegex(String regex) {
if (regex == null) {
throw new IllegalArgumentException("The regular expression must not be null.");
}
String trimmedRegex = regex.trim();
if (!trimmedRegex.isEmpty()) {
Pattern.compile(trimmedRegex, Pattern.CASE_INSENSITIVE);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setCacheSecurityGroupNames(java.util.Collection<String> cacheSecurityGroupNames) {
if (cacheSecurityGroupNames == null) {
this.cacheSecurityGroupNames = null;
return;
}
this.cacheSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(cacheSecurityGroupNames);
} } | public class class_name {
public void setCacheSecurityGroupNames(java.util.Collection<String> cacheSecurityGroupNames) {
if (cacheSecurityGroupNames == null) {
this.cacheSecurityGroupNames = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.cacheSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(cacheSecurityGroupNames);
} } |
public class class_name {
@VisibleForTesting
static String escape(String text) {
// unwrap double quotes
if (text.length() > 1 && text.charAt(0) == '"' && text.charAt(text.length() - 1) == '"') {
text = text.substring(1, text.length() - 1);
}
int i = 0;
int length = text.length();
StringBuilder result = new StringBuilder(text.length());
while (true) {
int j = text.indexOf('\\', i);
if (j == -1) {
result.append(removeUnescapedDoubleQuotes(text.substring(i)));
break;
}
result.append(removeUnescapedDoubleQuotes(text.substring(i, j)));
if (j == length - 1) {
// dangling backslash
break;
}
boolean isUnicodeEscape = false;
char escapeCode = text.charAt(j + 1);
switch (escapeCode) {
case '\'':
case '"':
case '\\':
case '?':
case '@':
case '#':
result.append(escapeCode);
break;
case 'n':
result.append('\n');
break;
case 't':
result.append('\t');
break;
case 'u':
isUnicodeEscape = true;
break;
default:
Logger.strict("Unsupported string resource escape code '%s'", escapeCode);
}
if (!isUnicodeEscape) {
i = j + 2;
} else {
j += 2;
if (length - j < CODE_POINT_LENGTH) {
throw new IllegalArgumentException("Too short code point: \\u" + text.substring(j));
}
String codePoint = text.substring(j, j + CODE_POINT_LENGTH);
result.append(extractCodePoint(codePoint));
i = j + CODE_POINT_LENGTH;
}
}
return result.toString();
} } | public class class_name {
@VisibleForTesting
static String escape(String text) {
// unwrap double quotes
if (text.length() > 1 && text.charAt(0) == '"' && text.charAt(text.length() - 1) == '"') {
text = text.substring(1, text.length() - 1); // depends on control dependency: [if], data = [none]
}
int i = 0;
int length = text.length();
StringBuilder result = new StringBuilder(text.length());
while (true) {
int j = text.indexOf('\\', i);
if (j == -1) {
result.append(removeUnescapedDoubleQuotes(text.substring(i))); // depends on control dependency: [if], data = [none]
break;
}
result.append(removeUnescapedDoubleQuotes(text.substring(i, j))); // depends on control dependency: [while], data = [none]
if (j == length - 1) {
// dangling backslash
break;
}
boolean isUnicodeEscape = false;
char escapeCode = text.charAt(j + 1);
switch (escapeCode) {
case '\'':
case '"':
case '\\':
case '?':
case '@':
case '#':
result.append(escapeCode);
break;
case 'n':
result.append('\n');
break;
case 't':
result.append('\t');
break;
case 'u':
isUnicodeEscape = true;
break;
default:
Logger.strict("Unsupported string resource escape code '%s'", escapeCode);
}
if (!isUnicodeEscape) {
i = j + 2; // depends on control dependency: [if], data = [none]
} else {
j += 2; // depends on control dependency: [if], data = [none]
if (length - j < CODE_POINT_LENGTH) {
throw new IllegalArgumentException("Too short code point: \\u" + text.substring(j));
}
String codePoint = text.substring(j, j + CODE_POINT_LENGTH);
result.append(extractCodePoint(codePoint)); // depends on control dependency: [if], data = [none]
i = j + CODE_POINT_LENGTH; // depends on control dependency: [if], data = [none]
}
}
return result.toString();
} } |
public class class_name {
public String buildDialogForm() {
StringBuffer result = new StringBuffer(16384);
List<CmsResource> resources = getResources();
//Compute the height:
int amountOfInputFields = 4 * resources.size();
int height = amountOfInputFields * 25;
// add padding for each resource grouping:
height += resources.size() * 30;
// add padding for whole dialog box:
height += 80;
// limit maximum height:
height = Math.min(height, 600);
Iterator<CmsResource> i = resources.iterator();
result.append("<div style=\"height: ").append(height).append("px; padding: 4px; overflow: auto;\">");
CmsResource res;
while (i.hasNext()) {
res = i.next();
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(res);
// read the default properties for the given file type:
CmsExplorerTypeSettings settings = getSettingsForType(type.getTypeName());
List<String> editProperties = settings.getProperties();
if (editProperties.size() > 0) {
String iconPath = getSkinUri() + CmsWorkplace.RES_PATH_FILETYPES + settings.getIcon();
String imageName = res.getName();
String propertySuffix = "" + imageName.hashCode();
result.append(dialogBlockStart("<img src=\"" + iconPath + "\"/> " + imageName));
result.append("<table border=\"0\">\n");
Iterator<String> itProperties = editProperties.iterator();
String property;
while (itProperties.hasNext()) {
property = itProperties.next();
result.append("<tr>\n");
result.append("<td> </td>\n");
// build title property input row
String title = "";
try {
title = getCms().readPropertyObject(res, property, false).getValue();
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale()));
}
}
result.append("<td style=\"white-space: nowrap;\" unselectable=\"on\" width=\"15%\">");
result.append(property).append(": ");
result.append("</td>\n");
result.append("<td class=\"maxwidth\">");
result.append("<input type=\"text\" class=\"maxwidth\" name=\"");
result.append(property);
result.append(propertySuffix);
result.append("\" value=\"");
if (CmsStringUtil.isNotEmpty(title)) {
result.append(CmsEncoder.escapeXml(title));
}
result.append("\"");
result.append(">");
result.append("</td>\n</tr>\n");
}
result.append("</table>\n");
result.append(dialogBlockEnd());
}
if (i.hasNext()) {
// append spacer if another entry follows
result.append(dialogSpacer());
}
}
result.append("</div>");
return result.toString();
} } | public class class_name {
public String buildDialogForm() {
StringBuffer result = new StringBuffer(16384);
List<CmsResource> resources = getResources();
//Compute the height:
int amountOfInputFields = 4 * resources.size();
int height = amountOfInputFields * 25;
// add padding for each resource grouping:
height += resources.size() * 30;
// add padding for whole dialog box:
height += 80;
// limit maximum height:
height = Math.min(height, 600);
Iterator<CmsResource> i = resources.iterator();
result.append("<div style=\"height: ").append(height).append("px; padding: 4px; overflow: auto;\">");
CmsResource res;
while (i.hasNext()) {
res = i.next(); // depends on control dependency: [while], data = [none]
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(res);
// read the default properties for the given file type:
CmsExplorerTypeSettings settings = getSettingsForType(type.getTypeName());
List<String> editProperties = settings.getProperties();
if (editProperties.size() > 0) {
String iconPath = getSkinUri() + CmsWorkplace.RES_PATH_FILETYPES + settings.getIcon();
String imageName = res.getName();
String propertySuffix = "" + imageName.hashCode();
result.append(dialogBlockStart("<img src=\"" + iconPath + "\"/> " + imageName)); // depends on control dependency: [if], data = [none]
result.append("<table border=\"0\">\n"); // depends on control dependency: [if], data = [none]
Iterator<String> itProperties = editProperties.iterator();
String property;
while (itProperties.hasNext()) {
property = itProperties.next(); // depends on control dependency: [while], data = [none]
result.append("<tr>\n"); // depends on control dependency: [while], data = [none]
result.append("<td> </td>\n"); // depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none]
// build title property input row
String title = "";
try {
title = getCms().readPropertyObject(res, property, false).getValue(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale())); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
result.append("<td style=\"white-space: nowrap;\" unselectable=\"on\" width=\"15%\">"); // depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none]
result.append(property).append(": "); // depends on control dependency: [while], data = [none]
result.append("</td>\n"); // depends on control dependency: [while], data = [none]
result.append("<td class=\"maxwidth\">"); // depends on control dependency: [while], data = [none]
result.append("<input type=\"text\" class=\"maxwidth\" name=\""); // depends on control dependency: [while], data = [none]
result.append(property); // depends on control dependency: [while], data = [none]
result.append(propertySuffix); // depends on control dependency: [while], data = [none]
result.append("\" value=\""); // depends on control dependency: [while], data = [none]
if (CmsStringUtil.isNotEmpty(title)) {
result.append(CmsEncoder.escapeXml(title)); // depends on control dependency: [if], data = [none]
}
result.append("\""); // depends on control dependency: [while], data = [none]
result.append(">"); // depends on control dependency: [while], data = [none]
result.append("</td>\n</tr>\n"); // depends on control dependency: [while], data = [none]
}
result.append("</table>\n"); // depends on control dependency: [if], data = [none]
result.append(dialogBlockEnd()); // depends on control dependency: [if], data = [none]
}
if (i.hasNext()) {
// append spacer if another entry follows
result.append(dialogSpacer()); // depends on control dependency: [if], data = [none]
}
}
result.append("</div>");
return result.toString();
} } |
public class class_name {
private final byte[][] decode(byte[] encodedPrivateKey) {
byte[][] decodedKey = new byte[8][];
if (encodedPrivateKey.length > (PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH + PRIME_Q_LENGTH)) {
// it is potentially the new encoding mechanism based on R3.5 [with CRT key information added for Domino]
// determine the length of the CRT key by looking at the first four bytes
byte[] lengthBytes = new byte[PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH];
for (int i = 0; i < PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH; i++) {
lengthBytes[i] = encodedPrivateKey[i];
}
privateExponentLength = toInt(lengthBytes);
decodedKey[PRIVATE_EXPONENT] = new byte[privateExponentLength];
decodedKey[PUBLIC_EXPONENT] = new byte[PUBLIC_EXPONENT_LENGTH];
decodedKey[PRIME_P] = new byte[PRIME_P_LENGTH];
decodedKey[PRIME_Q] = new byte[PRIME_Q_LENGTH];
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH, decodedKey[PRIVATE_EXPONENT], 0, privateExponentLength);
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength, decodedKey[PUBLIC_EXPONENT], 0, PUBLIC_EXPONENT_LENGTH);
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength + PUBLIC_EXPONENT_LENGTH, decodedKey[PRIME_P], 0, PRIME_P_LENGTH);
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength + PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH, decodedKey[PRIME_Q], 0,
PRIME_Q_LENGTH);
} else {
// it is a R3.02 key [without CRT key information]
decodedKey[PUBLIC_EXPONENT] = new byte[PUBLIC_EXPONENT_LENGTH];
decodedKey[PRIME_P] = new byte[PRIME_P_LENGTH];
decodedKey[PRIME_Q] = new byte[PRIME_Q_LENGTH];
System.arraycopy(encodedPrivateKey, 0, decodedKey[PUBLIC_EXPONENT], 0, PUBLIC_EXPONENT_LENGTH);
System.arraycopy(encodedPrivateKey, PUBLIC_EXPONENT_LENGTH, decodedKey[PRIME_P], 0, PRIME_P_LENGTH);
System.arraycopy(encodedPrivateKey, PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH, decodedKey[PRIME_Q], 0, PRIME_Q_LENGTH);
}
return decodedKey;
} } | public class class_name {
private final byte[][] decode(byte[] encodedPrivateKey) {
byte[][] decodedKey = new byte[8][];
if (encodedPrivateKey.length > (PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH + PRIME_Q_LENGTH)) {
// it is potentially the new encoding mechanism based on R3.5 [with CRT key information added for Domino]
// determine the length of the CRT key by looking at the first four bytes
byte[] lengthBytes = new byte[PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH];
for (int i = 0; i < PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH; i++) {
lengthBytes[i] = encodedPrivateKey[i]; // depends on control dependency: [for], data = [i]
}
privateExponentLength = toInt(lengthBytes); // depends on control dependency: [if], data = [none]
decodedKey[PRIVATE_EXPONENT] = new byte[privateExponentLength]; // depends on control dependency: [if], data = [none]
decodedKey[PUBLIC_EXPONENT] = new byte[PUBLIC_EXPONENT_LENGTH]; // depends on control dependency: [if], data = [none]
decodedKey[PRIME_P] = new byte[PRIME_P_LENGTH]; // depends on control dependency: [if], data = [none]
decodedKey[PRIME_Q] = new byte[PRIME_Q_LENGTH]; // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH, decodedKey[PRIVATE_EXPONENT], 0, privateExponentLength); // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength, decodedKey[PUBLIC_EXPONENT], 0, PUBLIC_EXPONENT_LENGTH); // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength + PUBLIC_EXPONENT_LENGTH, decodedKey[PRIME_P], 0, PRIME_P_LENGTH); // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PRIVATE_EXPONENT_LENGTH_FIELD_LENGTH + privateExponentLength + PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH, decodedKey[PRIME_Q], 0,
PRIME_Q_LENGTH); // depends on control dependency: [if], data = [none]
} else {
// it is a R3.02 key [without CRT key information]
decodedKey[PUBLIC_EXPONENT] = new byte[PUBLIC_EXPONENT_LENGTH]; // depends on control dependency: [if], data = [none]
decodedKey[PRIME_P] = new byte[PRIME_P_LENGTH]; // depends on control dependency: [if], data = [none]
decodedKey[PRIME_Q] = new byte[PRIME_Q_LENGTH]; // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, 0, decodedKey[PUBLIC_EXPONENT], 0, PUBLIC_EXPONENT_LENGTH); // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PUBLIC_EXPONENT_LENGTH, decodedKey[PRIME_P], 0, PRIME_P_LENGTH); // depends on control dependency: [if], data = [none]
System.arraycopy(encodedPrivateKey, PUBLIC_EXPONENT_LENGTH + PRIME_P_LENGTH, decodedKey[PRIME_Q], 0, PRIME_Q_LENGTH); // depends on control dependency: [if], data = [none]
}
return decodedKey;
} } |
public class class_name {
@VisibleForTesting
protected ProctorResult determineBucketsInternal(final Identifiers identifiers, final Map<String, Object> context, final Map<String, Integer> forcedGroups) {
final Proctor proctor = proctorSource.get();
if (proctor == null) {
final Map<String, TestBucket> buckets = getDefaultBucketValues();
final Map<String, Integer> versions = Maps.newHashMap();
for (final String testName : buckets.keySet()) {
versions.put(testName, Integer.valueOf(-1));
}
return new ProctorResult(Audit.EMPTY_VERSION,
buckets,
Collections.<String, Allocation>emptyMap(),
Collections.<String, ConsumableTestDefinition>emptyMap()
);
}
final ProctorResult result = proctor.determineTestGroups(identifiers, context, forcedGroups);
return result;
} } | public class class_name {
@VisibleForTesting
protected ProctorResult determineBucketsInternal(final Identifiers identifiers, final Map<String, Object> context, final Map<String, Integer> forcedGroups) {
final Proctor proctor = proctorSource.get();
if (proctor == null) {
final Map<String, TestBucket> buckets = getDefaultBucketValues();
final Map<String, Integer> versions = Maps.newHashMap();
for (final String testName : buckets.keySet()) {
versions.put(testName, Integer.valueOf(-1)); // depends on control dependency: [for], data = [testName]
}
return new ProctorResult(Audit.EMPTY_VERSION,
buckets,
Collections.<String, Allocation>emptyMap(),
Collections.<String, ConsumableTestDefinition>emptyMap()
); // depends on control dependency: [if], data = [none]
}
final ProctorResult result = proctor.determineTestGroups(identifiers, context, forcedGroups);
return result;
} } |
public class class_name {
private static double crank(double[] w) {
int n = w.length;
double s = 0.0;
int j = 1;
while (j < n) {
if (w[j] != w[j - 1]) {
w[j - 1] = j;
++j;
} else {
int jt = j + 1;
while (jt <= n && w[jt - 1] == w[j - 1]) {
jt++;
}
double rank = 0.5 * (j + jt - 1);
for (int ji = j; ji <= (jt - 1); ji++) {
w[ji - 1] = rank;
}
double t = jt - j;
s += (t * t * t - t);
j = jt;
}
}
if (j == n) {
w[n - 1] = n;
}
return s;
} } | public class class_name {
private static double crank(double[] w) {
int n = w.length;
double s = 0.0;
int j = 1;
while (j < n) {
if (w[j] != w[j - 1]) {
w[j - 1] = j; // depends on control dependency: [if], data = [none]
++j; // depends on control dependency: [if], data = [none]
} else {
int jt = j + 1;
while (jt <= n && w[jt - 1] == w[j - 1]) {
jt++; // depends on control dependency: [while], data = [none]
}
double rank = 0.5 * (j + jt - 1);
for (int ji = j; ji <= (jt - 1); ji++) {
w[ji - 1] = rank; // depends on control dependency: [for], data = [ji]
}
double t = jt - j;
s += (t * t * t - t); // depends on control dependency: [if], data = [none]
j = jt; // depends on control dependency: [if], data = [none]
}
}
if (j == n) {
w[n - 1] = n; // depends on control dependency: [if], data = [none]
}
return s;
} } |
public class class_name {
public String getFunctionName(ExecutableElement method) {
String name = ElementUtil.getSelector(method);
if (name == null) {
name = getRenamedMethodName(method);
}
if (name != null) {
return name.replaceAll(":", "_");
} else {
return addParamNames(method, getMethodName(method), '_');
}
} } | public class class_name {
public String getFunctionName(ExecutableElement method) {
String name = ElementUtil.getSelector(method);
if (name == null) {
name = getRenamedMethodName(method); // depends on control dependency: [if], data = [none]
}
if (name != null) {
return name.replaceAll(":", "_"); // depends on control dependency: [if], data = [none]
} else {
return addParamNames(method, getMethodName(method), '_'); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void store(String gavc,
String action,
String commentText,
DbCredential credential,
String entityType) {
DbComment comment = new DbComment();
comment.setEntityId(gavc);
comment.setEntityType(entityType);
comment.setDbCommentedBy(credential.getUser());
comment.setAction(action);
if(!commentText.isEmpty()) {
comment.setDbCommentText(commentText);
}
comment.setDbCreatedDateTime(new Date());
repositoryHandler.store(comment);
} } | public class class_name {
public void store(String gavc,
String action,
String commentText,
DbCredential credential,
String entityType) {
DbComment comment = new DbComment();
comment.setEntityId(gavc);
comment.setEntityType(entityType);
comment.setDbCommentedBy(credential.getUser());
comment.setAction(action);
if(!commentText.isEmpty()) {
comment.setDbCommentText(commentText); // depends on control dependency: [if], data = [none]
}
comment.setDbCreatedDateTime(new Date());
repositoryHandler.store(comment);
} } |
public class class_name {
public String[] resolveParamNames(final Method actionClassMethod) {
MethodParameter[] methodParameters = Paramo.resolveParameters(actionClassMethod);
String[] names = new String[methodParameters.length];
for (int i = 0; i < methodParameters.length; i++) {
names[i] = methodParameters[i].getName();
}
return names;
} } | public class class_name {
public String[] resolveParamNames(final Method actionClassMethod) {
MethodParameter[] methodParameters = Paramo.resolveParameters(actionClassMethod);
String[] names = new String[methodParameters.length];
for (int i = 0; i < methodParameters.length; i++) {
names[i] = methodParameters[i].getName(); // depends on control dependency: [for], data = [i]
}
return names;
} } |
public class class_name {
public static byte[] decode(final byte[] compressed) throws IOException {
ByteArrayInputStream byteIn = new ByteArrayInputStream(compressed);
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
GZIPInputStream gzIn = null;
try {
gzIn = new GZIPInputStream(byteIn);
int read;
byte[] buffer = new byte[BUFFER_SIZE];
do {
read = gzIn.read(buffer);
if (read > 0) {
byteOut.write(buffer, 0, read);
}
} while (read >= 0);
return byteOut.toByteArray();
} finally {
gzIn.close();
byteOut.close();
}
} } | public class class_name {
public static byte[] decode(final byte[] compressed) throws IOException {
ByteArrayInputStream byteIn = new ByteArrayInputStream(compressed);
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
GZIPInputStream gzIn = null;
try {
gzIn = new GZIPInputStream(byteIn);
int read;
byte[] buffer = new byte[BUFFER_SIZE];
do {
read = gzIn.read(buffer);
if (read > 0) {
byteOut.write(buffer, 0, read); // depends on control dependency: [if], data = [none]
}
} while (read >= 0);
return byteOut.toByteArray();
} finally {
gzIn.close();
byteOut.close();
}
} } |
public class class_name {
public EClass getObjectOriginIdentifier() {
if (objectOriginIdentifierEClass == null) {
objectOriginIdentifierEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(514);
}
return objectOriginIdentifierEClass;
} } | public class class_name {
public EClass getObjectOriginIdentifier() {
if (objectOriginIdentifierEClass == null) {
objectOriginIdentifierEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(514); // depends on control dependency: [if], data = [none]
}
return objectOriginIdentifierEClass;
} } |
public class class_name {
protected FromHostPrimitiveResult < T > fromHostInternal(Class < T > javaClass,
CobolContext cobolContext, byte[] hostData, int start) {
int end = start + getBytesLen();
StringBuffer sb = new StringBuffer();
int[] nibbles = new int[2];
for (int i = start + (signLeading ? 1 : 0); i < end
- (signLeading ? 0 : 1); i++) {
setNibbles(nibbles, hostData[i]);
char digit1 = getDigit(nibbles[1]);
if (digit1 == '\0') {
return new FromHostPrimitiveResult < T >(
"Second nibble is not a digit", hostData, start, i, getBytesLen());
}
sb.append(digit1);
}
int signPos = signLeading ? start : end - 1;
if (signSeparate) {
int separateSign = hostData[signPos] & 0xFF;
if (separateSign == cobolContext.getHostMinusSign()) {
sb.insert(0, "-");
} else if (separateSign != cobolContext.getHostPlusSign()) {
return new FromHostPrimitiveResult < T >("Found character "
+ Integer.toHexString(separateSign)
+ " where a sign was expected",
hostData, start, signPos, getBytesLen());
}
} else {
setNibbles(nibbles, hostData[signPos]);
char digit1 = getDigit(nibbles[1]);
if (digit1 == '\0') {
return new FromHostPrimitiveResult < T >(
"Second nibble is not a digit", hostData, start, signPos, getBytesLen());
}
sb.append(digit1);
if (isSigned()
&& nibbles[0] == cobolContext.getNegativeSignNibbleValue()) {
sb.insert(0, "-");
}
}
if (getFractionDigits() > 0) {
sb.insert(sb.length() - getFractionDigits(), JAVA_DECIMAL_POINT);
}
try {
T value = valueOf(javaClass, sb.toString());
return new FromHostPrimitiveResult < T >(value);
} catch (NumberFormatException e) {
return new FromHostPrimitiveResult < T >("Host " + getMaxBytesLen()
+ " bytes numeric converts to '" + sb.toString()
+ "' which is not a valid " + javaClass.getName(),
hostData, start, getBytesLen());
}
} } | public class class_name {
protected FromHostPrimitiveResult < T > fromHostInternal(Class < T > javaClass,
CobolContext cobolContext, byte[] hostData, int start) {
int end = start + getBytesLen();
StringBuffer sb = new StringBuffer();
int[] nibbles = new int[2];
for (int i = start + (signLeading ? 1 : 0); i < end
- (signLeading ? 0 : 1); i++) {
setNibbles(nibbles, hostData[i]); // depends on control dependency: [for], data = [i]
char digit1 = getDigit(nibbles[1]);
if (digit1 == '\0') {
return new FromHostPrimitiveResult < T >(
"Second nibble is not a digit", hostData, start, i, getBytesLen()); // depends on control dependency: [if], data = [none]
}
sb.append(digit1); // depends on control dependency: [for], data = [none]
}
int signPos = signLeading ? start : end - 1;
if (signSeparate) {
int separateSign = hostData[signPos] & 0xFF;
if (separateSign == cobolContext.getHostMinusSign()) {
sb.insert(0, "-"); // depends on control dependency: [if], data = [none]
} else if (separateSign != cobolContext.getHostPlusSign()) {
return new FromHostPrimitiveResult < T >("Found character "
+ Integer.toHexString(separateSign)
+ " where a sign was expected",
hostData, start, signPos, getBytesLen()); // depends on control dependency: [if], data = [none]
}
} else {
setNibbles(nibbles, hostData[signPos]); // depends on control dependency: [if], data = [none]
char digit1 = getDigit(nibbles[1]);
if (digit1 == '\0') {
return new FromHostPrimitiveResult < T >(
"Second nibble is not a digit", hostData, start, signPos, getBytesLen()); // depends on control dependency: [if], data = [none]
}
sb.append(digit1); // depends on control dependency: [if], data = [none]
if (isSigned()
&& nibbles[0] == cobolContext.getNegativeSignNibbleValue()) {
sb.insert(0, "-"); // depends on control dependency: [if], data = [none]
}
}
if (getFractionDigits() > 0) {
sb.insert(sb.length() - getFractionDigits(), JAVA_DECIMAL_POINT); // depends on control dependency: [if], data = [none]
}
try {
T value = valueOf(javaClass, sb.toString());
return new FromHostPrimitiveResult < T >(value); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return new FromHostPrimitiveResult < T >("Host " + getMaxBytesLen()
+ " bytes numeric converts to '" + sb.toString()
+ "' which is not a valid " + javaClass.getName(),
hostData, start, getBytesLen());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public int print(
ChronoDisplay formattable,
Appendable buffer,
AttributeQuery attributes,
Set<ElementPosition> positions, // optional
boolean quickPath
) throws IOException {
BigDecimal value = toDecimal(formattable.get(this.element));
BigDecimal min = toDecimal(formattable.getMinimum(this.element));
BigDecimal max = toDecimal(formattable.getMaximum(this.element));
if (value.compareTo(max) > 0) {
value = max;
}
BigDecimal fraction =
value.subtract(min).divide(
max.subtract(min).add(BigDecimal.ONE),
9,
RoundingMode.FLOOR);
fraction = (
(fraction.compareTo(BigDecimal.ZERO) == 0)
? BigDecimal.ZERO
: fraction.stripTrailingZeros()
);
char zeroChar = (
quickPath
? this.zeroDigit
: attributes.get(Attributes.ZERO_DIGIT, Character.valueOf('0')).charValue());
int start = -1;
int printed = 0;
if (buffer instanceof CharSequence) {
start = ((CharSequence) buffer).length();
}
if (fraction.scale() == 0) {
// scale ist 0, wenn value das Minimum ist
if (this.minDigits > 0) {
if (this.hasDecimalSeparator()) {
this.decimalSeparator.print(
formattable,
buffer,
attributes,
positions,
quickPath);
printed++;
}
for (int i = 0; i < this.minDigits; i++) {
buffer.append(zeroChar);
}
printed += this.minDigits;
}
} else {
if (this.hasDecimalSeparator()) {
this.decimalSeparator.print(
formattable,
buffer,
attributes,
positions,
quickPath);
printed++;
}
int outputScale =
Math.min(
Math.max(fraction.scale(), this.minDigits),
this.maxDigits);
fraction = fraction.setScale(outputScale, RoundingMode.FLOOR);
String digits = fraction.toPlainString();
int diff = zeroChar - '0';
for (int i = 2, n = digits.length(); i < n; i++) {
char c = (char) (digits.charAt(i) + diff);
buffer.append(c);
printed++;
}
}
if (
(start != -1)
&& (printed > 1)
&& (positions != null)
) {
positions.add( // Zählung ohne Dezimaltrennzeichen
new ElementPosition(this.element, start + 1, start + printed));
}
return printed;
} } | public class class_name {
@Override
public int print(
ChronoDisplay formattable,
Appendable buffer,
AttributeQuery attributes,
Set<ElementPosition> positions, // optional
boolean quickPath
) throws IOException {
BigDecimal value = toDecimal(formattable.get(this.element));
BigDecimal min = toDecimal(formattable.getMinimum(this.element));
BigDecimal max = toDecimal(formattable.getMaximum(this.element));
if (value.compareTo(max) > 0) {
value = max;
}
BigDecimal fraction =
value.subtract(min).divide(
max.subtract(min).add(BigDecimal.ONE),
9,
RoundingMode.FLOOR);
fraction = (
(fraction.compareTo(BigDecimal.ZERO) == 0)
? BigDecimal.ZERO
: fraction.stripTrailingZeros()
);
char zeroChar = (
quickPath
? this.zeroDigit
: attributes.get(Attributes.ZERO_DIGIT, Character.valueOf('0')).charValue());
int start = -1;
int printed = 0;
if (buffer instanceof CharSequence) {
start = ((CharSequence) buffer).length();
}
if (fraction.scale() == 0) {
// scale ist 0, wenn value das Minimum ist
if (this.minDigits > 0) {
if (this.hasDecimalSeparator()) {
this.decimalSeparator.print(
formattable,
buffer,
attributes,
positions,
quickPath); // depends on control dependency: [if], data = [none]
printed++; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < this.minDigits; i++) {
buffer.append(zeroChar); // depends on control dependency: [for], data = [none]
}
printed += this.minDigits;
}
} else {
if (this.hasDecimalSeparator()) {
this.decimalSeparator.print(
formattable,
buffer,
attributes,
positions,
quickPath);
printed++;
}
int outputScale =
Math.min(
Math.max(fraction.scale(), this.minDigits),
this.maxDigits);
fraction = fraction.setScale(outputScale, RoundingMode.FLOOR);
String digits = fraction.toPlainString();
int diff = zeroChar - '0';
for (int i = 2, n = digits.length(); i < n; i++) {
char c = (char) (digits.charAt(i) + diff);
buffer.append(c);
printed++;
}
}
if (
(start != -1)
&& (printed > 1)
&& (positions != null)
) {
positions.add( // Zählung ohne Dezimaltrennzeichen
new ElementPosition(this.element, start + 1, start + printed));
}
return printed;
} } |
public class class_name {
private static void validateGeneration(int generation) {
if (generation == CONTEXT_DEPTH_WARN_THRESH) {
log.log(
Level.SEVERE,
"Context ancestry chain length is abnormally long. "
+ "This suggests an error in application code. "
+ "Length exceeded: " + CONTEXT_DEPTH_WARN_THRESH,
new Exception());
}
} } | public class class_name {
private static void validateGeneration(int generation) {
if (generation == CONTEXT_DEPTH_WARN_THRESH) {
log.log(
Level.SEVERE,
"Context ancestry chain length is abnormally long. "
+ "This suggests an error in application code. "
+ "Length exceeded: " + CONTEXT_DEPTH_WARN_THRESH,
new Exception()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EClass getBFG() {
if (bfgEClass == null) {
bfgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(205);
}
return bfgEClass;
} } | public class class_name {
public EClass getBFG() {
if (bfgEClass == null) {
bfgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(205); // depends on control dependency: [if], data = [none]
}
return bfgEClass;
} } |
public class class_name {
public void setErrorCode(String errorCode) {
if (errorCode != null) {
NullArgumentException.validateNotEmpty(errorCode, "Error code");
}
this.errorCode = errorCode;
} } | public class class_name {
public void setErrorCode(String errorCode) {
if (errorCode != null) {
NullArgumentException.validateNotEmpty(errorCode, "Error code"); // depends on control dependency: [if], data = [(errorCode]
}
this.errorCode = errorCode;
} } |
public class class_name {
private void loadData() {
if (parent.getSerialDataContext().getDataContext() == null) {
// no data objects available.
return;
}
if (parent.isAdvancedContext()) {
parent.getSerialDataContext().getDataContext().put("tiecells", new HashMap<String, TieCell>());
}
for (SheetConfiguration sheetConfig : parent.getSheetConfigMap().values()) {
List<RowsMapping> currentRowsMappingList = null;
ConfigBuildRef configBuildRef = new ConfigBuildRef(parent.getWbWrapper(),
parent.getWb().getSheet(sheetConfig.getSheetName()), parent.getExpEngine(), parent.getCellHelper(),
sheetConfig.getCachedCells(), parent.getCellAttributesMap(), sheetConfig.getFinalCommentMap());
int length = sheetConfig.getFormCommand().buildAt(null, configBuildRef,
sheetConfig.getFormCommand().getTopRow(), parent.getSerialDataContext().getDataContext(),
currentRowsMappingList);
sheetConfig.setShiftMap(configBuildRef.getShiftMap());
sheetConfig.setCollectionObjNameMap(configBuildRef.getCollectionObjNameMap());
sheetConfig.setCommandIndexMap(configBuildRef.getCommandIndexMap());
sheetConfig.setWatchList(configBuildRef.getWatchList());
sheetConfig.setBodyAllowAddRows(configBuildRef.isBodyAllowAdd());
sheetConfig.getBodyCellRange().setBottomRow(sheetConfig.getFormCommand().getTopRow() + length - 1);
sheetConfig.setBodyPopulated(true);
}
parent.getCellHelper().reCalc();
} } | public class class_name {
private void loadData() {
if (parent.getSerialDataContext().getDataContext() == null) {
// no data objects available.
return;
// depends on control dependency: [if], data = [none]
}
if (parent.isAdvancedContext()) {
parent.getSerialDataContext().getDataContext().put("tiecells", new HashMap<String, TieCell>());
// depends on control dependency: [if], data = [none]
}
for (SheetConfiguration sheetConfig : parent.getSheetConfigMap().values()) {
List<RowsMapping> currentRowsMappingList = null;
ConfigBuildRef configBuildRef = new ConfigBuildRef(parent.getWbWrapper(),
parent.getWb().getSheet(sheetConfig.getSheetName()), parent.getExpEngine(), parent.getCellHelper(),
sheetConfig.getCachedCells(), parent.getCellAttributesMap(), sheetConfig.getFinalCommentMap());
int length = sheetConfig.getFormCommand().buildAt(null, configBuildRef,
sheetConfig.getFormCommand().getTopRow(), parent.getSerialDataContext().getDataContext(),
currentRowsMappingList);
sheetConfig.setShiftMap(configBuildRef.getShiftMap());
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.setCollectionObjNameMap(configBuildRef.getCollectionObjNameMap());
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.setCommandIndexMap(configBuildRef.getCommandIndexMap());
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.setWatchList(configBuildRef.getWatchList());
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.setBodyAllowAddRows(configBuildRef.isBodyAllowAdd());
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.getBodyCellRange().setBottomRow(sheetConfig.getFormCommand().getTopRow() + length - 1);
// depends on control dependency: [for], data = [sheetConfig]
sheetConfig.setBodyPopulated(true);
// depends on control dependency: [for], data = [sheetConfig]
}
parent.getCellHelper().reCalc();
} } |
public class class_name {
private void newScreenSize(Rectangle b) {
boolean sameSize = (b.width == myBounds.width) && (b.height == myBounds.height);
if (debugBounds) System.out.println( "NavigatedPanel newScreenSize old= "+myBounds);
if (sameSize && (b.x == myBounds.x) && (b.y == myBounds.y))
return;
myBounds.setBounds(b);
if (sameSize)
return;
if (debugBounds) System.out.println( " newBounds = " +b);
// create new buffer the size of the window
//if (bImage != null)
// bImage.dispose();
if ((b.width > 0) && (b.height > 0)) {
bImage = new BufferedImage(b.width, b.height, BufferedImage.TYPE_INT_RGB); // why RGB ?
} else { // why not device dependent?
bImage = null;
}
navigate.setScreenSize(b.width, b.height);
} } | public class class_name {
private void newScreenSize(Rectangle b) {
boolean sameSize = (b.width == myBounds.width) && (b.height == myBounds.height);
if (debugBounds) System.out.println( "NavigatedPanel newScreenSize old= "+myBounds);
if (sameSize && (b.x == myBounds.x) && (b.y == myBounds.y))
return;
myBounds.setBounds(b);
if (sameSize)
return;
if (debugBounds) System.out.println( " newBounds = " +b);
// create new buffer the size of the window
//if (bImage != null)
// bImage.dispose();
if ((b.width > 0) && (b.height > 0)) {
bImage = new BufferedImage(b.width, b.height, BufferedImage.TYPE_INT_RGB); // why RGB ? // depends on control dependency: [if], data = [none]
} else { // why not device dependent?
bImage = null; // depends on control dependency: [if], data = [none]
}
navigate.setScreenSize(b.width, b.height);
} } |
public class class_name {
private Map<CPGroupId, Collection<Tuple2<Long, Long>>> getSessionsToExpire() {
Map<CPGroupId, Collection<Tuple2<Long, Long>>> expired = new HashMap<CPGroupId, Collection<Tuple2<Long, Long>>>();
for (RaftSessionRegistry registry : registries.values()) {
Collection<Tuple2<Long, Long>> e = registry.getSessionsToExpire();
if (!e.isEmpty()) {
expired.put(registry.groupId(), e);
}
}
return expired;
} } | public class class_name {
private Map<CPGroupId, Collection<Tuple2<Long, Long>>> getSessionsToExpire() {
Map<CPGroupId, Collection<Tuple2<Long, Long>>> expired = new HashMap<CPGroupId, Collection<Tuple2<Long, Long>>>();
for (RaftSessionRegistry registry : registries.values()) {
Collection<Tuple2<Long, Long>> e = registry.getSessionsToExpire();
if (!e.isEmpty()) {
expired.put(registry.groupId(), e); // depends on control dependency: [if], data = [none]
}
}
return expired;
} } |
public class class_name {
public float predictSingle(FVec feat, boolean output_margin, int ntree_limit) {
float pred = predictSingleRaw(feat, ntree_limit);
if (!output_margin) {
pred = obj.predTransform(pred);
}
return pred;
} } | public class class_name {
public float predictSingle(FVec feat, boolean output_margin, int ntree_limit) {
float pred = predictSingleRaw(feat, ntree_limit);
if (!output_margin) {
pred = obj.predTransform(pred); // depends on control dependency: [if], data = [none]
}
return pred;
} } |
public class class_name {
public void marshall(GetPipelineExecutionRequest getPipelineExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (getPipelineExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getPipelineExecutionRequest.getPipelineName(), PIPELINENAME_BINDING);
protocolMarshaller.marshall(getPipelineExecutionRequest.getPipelineExecutionId(), PIPELINEEXECUTIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetPipelineExecutionRequest getPipelineExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (getPipelineExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getPipelineExecutionRequest.getPipelineName(), PIPELINENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getPipelineExecutionRequest.getPipelineExecutionId(), PIPELINEEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setGalleryDefaultScope(String galleryDefaultScope) {
m_galleryDefaultScope = galleryDefaultScope;
try {
CmsGallerySearchScope.valueOf(galleryDefaultScope);
} catch (Throwable t) {
LOG.warn(t.getLocalizedMessage(), t);
}
} } | public class class_name {
public void setGalleryDefaultScope(String galleryDefaultScope) {
m_galleryDefaultScope = galleryDefaultScope;
try {
CmsGallerySearchScope.valueOf(galleryDefaultScope); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOG.warn(t.getLocalizedMessage(), t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double[] colMeans (RealMatrix matrix) {
// Get the col sums:
double[] retval = EMatrixUtils.colSums(matrix);
// Iterate over return value and divide by the length:
for (int i = 0; i < retval.length; i++) {
retval[i] = retval[i] / matrix.getRowDimension();
}
// Done, return col means:
return retval;
} } | public class class_name {
public static double[] colMeans (RealMatrix matrix) {
// Get the col sums:
double[] retval = EMatrixUtils.colSums(matrix);
// Iterate over return value and divide by the length:
for (int i = 0; i < retval.length; i++) {
retval[i] = retval[i] / matrix.getRowDimension(); // depends on control dependency: [for], data = [i]
}
// Done, return col means:
return retval;
} } |
public class class_name {
public static int
value(String s, boolean numberok) {
int val = types.getValue(s);
if (val == -1 && numberok) {
val = types.getValue("TYPE" + s);
}
return val;
} } | public class class_name {
public static int
value(String s, boolean numberok) {
int val = types.getValue(s);
if (val == -1 && numberok) {
val = types.getValue("TYPE" + s); // depends on control dependency: [if], data = [none]
}
return val;
} } |
public class class_name {
protected void unregister() {
if (providerConfig.isRegister()) {
List<RegistryConfig> registryConfigs = providerConfig.getRegistry();
if (registryConfigs != null) {
for (RegistryConfig registryConfig : registryConfigs) {
Registry registry = RegistryFactory.getRegistry(registryConfig);
try {
registry.unRegister(providerConfig);
} catch (Exception e) {
String appName = providerConfig.getAppName();
if (LOGGER.isWarnEnabled(appName)) {
LOGGER.warnWithApp(appName, "Catch exception when unRegister from registry: " +
registryConfig.getId()
+ ", but you can ignore if it's called by JVM shutdown hook", e);
}
}
}
}
}
} } | public class class_name {
protected void unregister() {
if (providerConfig.isRegister()) {
List<RegistryConfig> registryConfigs = providerConfig.getRegistry();
if (registryConfigs != null) {
for (RegistryConfig registryConfig : registryConfigs) {
Registry registry = RegistryFactory.getRegistry(registryConfig);
try {
registry.unRegister(providerConfig); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
String appName = providerConfig.getAppName();
if (LOGGER.isWarnEnabled(appName)) {
LOGGER.warnWithApp(appName, "Catch exception when unRegister from registry: " +
registryConfig.getId()
+ ", but you can ignore if it's called by JVM shutdown hook", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
}
} } |
public class class_name {
@Override
public CommerceSubscriptionEntry remove(Serializable primaryKey)
throws NoSuchSubscriptionEntryException {
Session session = null;
try {
session = openSession();
CommerceSubscriptionEntry commerceSubscriptionEntry = (CommerceSubscriptionEntry)session.get(CommerceSubscriptionEntryImpl.class,
primaryKey);
if (commerceSubscriptionEntry == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchSubscriptionEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceSubscriptionEntry);
}
catch (NoSuchSubscriptionEntryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommerceSubscriptionEntry remove(Serializable primaryKey)
throws NoSuchSubscriptionEntryException {
Session session = null;
try {
session = openSession();
CommerceSubscriptionEntry commerceSubscriptionEntry = (CommerceSubscriptionEntry)session.get(CommerceSubscriptionEntryImpl.class,
primaryKey);
if (commerceSubscriptionEntry == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchSubscriptionEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceSubscriptionEntry);
}
catch (NoSuchSubscriptionEntryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
public boolean check() throws Exception {
try (PDDocument document = PDDocument.load(in)) {
PDDocumentCatalog catalog = document.getDocumentCatalog();
PDFPageable pageable = new PDFPageable(document);
PageFormat firstPage = pageable.getPageFormat(0);
encrypted = document.isEncrypted();
pageCount = document.getNumberOfPages();
orientation = ORIENTATION_STRINGS[firstPage.getOrientation()];
version = String.valueOf(document.getDocument().getVersion());
String catalogVersion = catalog.getVersion();
if (catalogVersion != null && !catalogVersion.isEmpty()) {
// According to specs version saved here should be determining instead
// the version in header. It is barely used, though.
version = catalogVersion;
}
if (!encrypted) {
PDDocumentInformation metadata = document.getDocumentInformation();
author = metadata.getAuthor();
creationDate = metadata.getCreationDate();
creator = metadata.getCreator();
keywords = metadata.getKeywords();
modificationDate = metadata.getModificationDate();
producer = metadata.getProducer();
subject = metadata.getSubject();
title = metadata.getTitle();
}
// extract all attached files from all pages
int pageNumber = 0;
for (Object page : catalog.getPages()) {
pageNumber += 1;
PdfPageMetadata pageMetadata = new PdfPageMetadata();
pageMetadata.setPageNumber(pageNumber);
for (PDAnnotation annotation : ((PDPage) page).getAnnotations()) {
if (annotation instanceof PDAnnotationFileAttachment) {
PdfAttachmentMetadata attachmentMetadata = new PdfAttachmentMetadata();
PDAnnotationFileAttachment fann = (PDAnnotationFileAttachment) annotation;
PDComplexFileSpecification fileSpec = (PDComplexFileSpecification) fann.getFile();
PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
attachmentMetadata.setSubject(fann.getSubject());
attachmentMetadata.setName(fileSpec.getFilename());
attachmentMetadata.setCreationDate(embeddedFile.getCreationDate());
attachmentMetadata.setModificationDate(embeddedFile.getModDate());
attachmentMetadata.setMimeType(embeddedFile.getSubtype());
attachmentMetadata.setData(embeddedFile.toByteArray());
pageMetadata.addAttachment(attachmentMetadata);
}
}
pages.add(pageMetadata);
}
return true;
}
} } | public class class_name {
public boolean check() throws Exception {
try (PDDocument document = PDDocument.load(in)) {
PDDocumentCatalog catalog = document.getDocumentCatalog();
PDFPageable pageable = new PDFPageable(document);
PageFormat firstPage = pageable.getPageFormat(0);
encrypted = document.isEncrypted();
pageCount = document.getNumberOfPages();
orientation = ORIENTATION_STRINGS[firstPage.getOrientation()];
version = String.valueOf(document.getDocument().getVersion());
String catalogVersion = catalog.getVersion();
if (catalogVersion != null && !catalogVersion.isEmpty()) {
// According to specs version saved here should be determining instead
// the version in header. It is barely used, though.
version = catalogVersion;
}
if (!encrypted) {
PDDocumentInformation metadata = document.getDocumentInformation();
author = metadata.getAuthor();
creationDate = metadata.getCreationDate();
creator = metadata.getCreator();
keywords = metadata.getKeywords();
modificationDate = metadata.getModificationDate();
producer = metadata.getProducer();
subject = metadata.getSubject();
title = metadata.getTitle();
}
// extract all attached files from all pages
int pageNumber = 0;
for (Object page : catalog.getPages()) {
pageNumber += 1;
PdfPageMetadata pageMetadata = new PdfPageMetadata();
pageMetadata.setPageNumber(pageNumber);
for (PDAnnotation annotation : ((PDPage) page).getAnnotations()) {
if (annotation instanceof PDAnnotationFileAttachment) {
PdfAttachmentMetadata attachmentMetadata = new PdfAttachmentMetadata();
PDAnnotationFileAttachment fann = (PDAnnotationFileAttachment) annotation;
PDComplexFileSpecification fileSpec = (PDComplexFileSpecification) fann.getFile();
PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
attachmentMetadata.setSubject(fann.getSubject()); // depends on control dependency: [if], data = [none]
attachmentMetadata.setName(fileSpec.getFilename()); // depends on control dependency: [if], data = [none]
attachmentMetadata.setCreationDate(embeddedFile.getCreationDate()); // depends on control dependency: [if], data = [none]
attachmentMetadata.setModificationDate(embeddedFile.getModDate()); // depends on control dependency: [if], data = [none]
attachmentMetadata.setMimeType(embeddedFile.getSubtype()); // depends on control dependency: [if], data = [none]
attachmentMetadata.setData(embeddedFile.toByteArray()); // depends on control dependency: [if], data = [none]
pageMetadata.addAttachment(attachmentMetadata); // depends on control dependency: [if], data = [none]
}
}
pages.add(pageMetadata);
}
return true;
}
} } |
public class class_name {
public void simulateGattConnectionChange(int status, int newState) {
for (BluetoothGatt bluetoothGatt : bluetoothGatts) {
ShadowBluetoothGatt shadowBluetoothGatt = Shadow.extract(bluetoothGatt);
BluetoothGattCallback gattCallback = shadowBluetoothGatt.getGattCallback();
gattCallback.onConnectionStateChange(bluetoothGatt, status, newState);
}
} } | public class class_name {
public void simulateGattConnectionChange(int status, int newState) {
for (BluetoothGatt bluetoothGatt : bluetoothGatts) {
ShadowBluetoothGatt shadowBluetoothGatt = Shadow.extract(bluetoothGatt);
BluetoothGattCallback gattCallback = shadowBluetoothGatt.getGattCallback();
gattCallback.onConnectionStateChange(bluetoothGatt, status, newState); // depends on control dependency: [for], data = [bluetoothGatt]
}
} } |
public class class_name {
protected void log(SessionId sessionId, String commandName, Object toLog, When when) {
if (!logger.isLoggable(level)) {
return;
}
String text = String.valueOf(toLog);
if (commandName.equals(DriverCommand.EXECUTE_SCRIPT)
|| commandName.equals(DriverCommand.EXECUTE_ASYNC_SCRIPT)) {
if (text.length() > 100 && Boolean.getBoolean("webdriver.remote.shorten_log_messages")) {
text = text.substring(0, 100) + "...";
}
}
switch(when) {
case BEFORE:
logger.log(level, "Executing: " + commandName + " " + text);
break;
case AFTER:
logger.log(level, "Executed: " + text);
break;
case EXCEPTION:
logger.log(level, "Exception: " + text);
break;
default:
logger.log(level, text);
break;
}
} } | public class class_name {
protected void log(SessionId sessionId, String commandName, Object toLog, When when) {
if (!logger.isLoggable(level)) {
return; // depends on control dependency: [if], data = [none]
}
String text = String.valueOf(toLog);
if (commandName.equals(DriverCommand.EXECUTE_SCRIPT)
|| commandName.equals(DriverCommand.EXECUTE_ASYNC_SCRIPT)) {
if (text.length() > 100 && Boolean.getBoolean("webdriver.remote.shorten_log_messages")) {
text = text.substring(0, 100) + "...";
}
}
switch(when) {
case BEFORE:
logger.log(level, "Executing: " + commandName + " " + text);
break;
case AFTER:
logger.log(level, "Executed: " + text);
break;
case EXCEPTION:
logger.log(level, "Exception: " + text);
break;
default:
logger.log(level, text);
break;
}
} } |
public class class_name {
protected boolean isExist(String rootPackageName, String lastClassName) {
final Resources[] checkerArray = getExistCheckerArray(rootPackageName);
for (int i = 0; i < checkerArray.length; ++i) {
if (checkerArray[i].isExistClass(lastClassName)) {
return true;
}
}
return false;
} } | public class class_name {
protected boolean isExist(String rootPackageName, String lastClassName) {
final Resources[] checkerArray = getExistCheckerArray(rootPackageName);
for (int i = 0; i < checkerArray.length; ++i) {
if (checkerArray[i].isExistClass(lastClassName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private void restoreRequestAttributesAfterInclude(Invocation inv) {
logger.debug("Restoring snapshot of request attributes after include");
HttpServletRequest request = inv.getRequest();
@SuppressWarnings("unchecked")
Map<String, Object> attributesSnapshot = (Map<String, Object>) inv
.getAttribute("$$paoding-rose.attributesBeforeInclude");
// Need to copy into separate Collection here, to avoid side effects
// on the Enumeration when removing attributes.
Set<String> attrsToCheck = new HashSet<String>();
Enumeration<?> attrNames = request.getAttributeNames();
while (attrNames.hasMoreElements()) {
String attrName = (String) attrNames.nextElement();
attrsToCheck.add(attrName);
}
// Iterate over the attributes to check, restoring the original value
// or removing the attribute, respectively, if appropriate.
for (String attrName : attrsToCheck) {
Object attrValue = attributesSnapshot.get(attrName);
if (attrValue != null) {
if (logger.isDebugEnabled()) {
logger.debug("Restoring original value of attribute [" + attrName
+ "] after include");
}
request.setAttribute(attrName, attrValue);
} else {
if (logger.isDebugEnabled()) {
logger.debug("Removing attribute [" + attrName + "] after include");
}
request.removeAttribute(attrName);
}
}
} } | public class class_name {
private void restoreRequestAttributesAfterInclude(Invocation inv) {
logger.debug("Restoring snapshot of request attributes after include");
HttpServletRequest request = inv.getRequest();
@SuppressWarnings("unchecked")
Map<String, Object> attributesSnapshot = (Map<String, Object>) inv
.getAttribute("$$paoding-rose.attributesBeforeInclude");
// Need to copy into separate Collection here, to avoid side effects
// on the Enumeration when removing attributes.
Set<String> attrsToCheck = new HashSet<String>();
Enumeration<?> attrNames = request.getAttributeNames();
while (attrNames.hasMoreElements()) {
String attrName = (String) attrNames.nextElement();
attrsToCheck.add(attrName); // depends on control dependency: [while], data = [none]
}
// Iterate over the attributes to check, restoring the original value
// or removing the attribute, respectively, if appropriate.
for (String attrName : attrsToCheck) {
Object attrValue = attributesSnapshot.get(attrName);
if (attrValue != null) {
if (logger.isDebugEnabled()) {
logger.debug("Restoring original value of attribute [" + attrName
+ "] after include"); // depends on control dependency: [if], data = [none]
}
request.setAttribute(attrName, attrValue); // depends on control dependency: [if], data = [none]
} else {
if (logger.isDebugEnabled()) {
logger.debug("Removing attribute [" + attrName + "] after include"); // depends on control dependency: [if], data = [none]
}
request.removeAttribute(attrName); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(DescribeServicesRequest describeServicesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeServicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeServicesRequest.getServiceCode(), SERVICECODE_BINDING);
protocolMarshaller.marshall(describeServicesRequest.getFormatVersion(), FORMATVERSION_BINDING);
protocolMarshaller.marshall(describeServicesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(describeServicesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeServicesRequest describeServicesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeServicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeServicesRequest.getServiceCode(), SERVICECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeServicesRequest.getFormatVersion(), FORMATVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeServicesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeServicesRequest.getMaxResults(), MAXRESULTS_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 Result isValidWindows1252(byte[] buf) {
for (byte b : buf) {
if (!VALID_WINDOWS_1252[b + 128]) {
return Result.INVALID;
}
}
try {
return new Result(Validation.MAYBE, Charset.forName("Windows-1252"));
} catch (UnsupportedCharsetException e) {
return Result.INVALID;
}
} } | public class class_name {
public Result isValidWindows1252(byte[] buf) {
for (byte b : buf) {
if (!VALID_WINDOWS_1252[b + 128]) {
return Result.INVALID; // depends on control dependency: [if], data = [none]
}
}
try {
return new Result(Validation.MAYBE, Charset.forName("Windows-1252")); // depends on control dependency: [try], data = [none]
} catch (UnsupportedCharsetException e) {
return Result.INVALID;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public HyperParameterAlgorithmSpecification withMetricDefinitions(MetricDefinition... metricDefinitions) {
if (this.metricDefinitions == null) {
setMetricDefinitions(new java.util.ArrayList<MetricDefinition>(metricDefinitions.length));
}
for (MetricDefinition ele : metricDefinitions) {
this.metricDefinitions.add(ele);
}
return this;
} } | public class class_name {
public HyperParameterAlgorithmSpecification withMetricDefinitions(MetricDefinition... metricDefinitions) {
if (this.metricDefinitions == null) {
setMetricDefinitions(new java.util.ArrayList<MetricDefinition>(metricDefinitions.length)); // depends on control dependency: [if], data = [none]
}
for (MetricDefinition ele : metricDefinitions) {
this.metricDefinitions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void collectDbStats(ArrayList<DbStats> dbStatsList) {
synchronized (mLock) {
if (mAvailablePrimaryConnection != null) {
mAvailablePrimaryConnection.collectDbStats(dbStatsList);
}
for (SQLiteConnection connection : mAvailableNonPrimaryConnections) {
connection.collectDbStats(dbStatsList);
}
for (SQLiteConnection connection : mAcquiredConnections.keySet()) {
connection.collectDbStatsUnsafe(dbStatsList);
}
}
} } | public class class_name {
public void collectDbStats(ArrayList<DbStats> dbStatsList) {
synchronized (mLock) {
if (mAvailablePrimaryConnection != null) {
mAvailablePrimaryConnection.collectDbStats(dbStatsList); // depends on control dependency: [if], data = [none]
}
for (SQLiteConnection connection : mAvailableNonPrimaryConnections) {
connection.collectDbStats(dbStatsList); // depends on control dependency: [for], data = [connection]
}
for (SQLiteConnection connection : mAcquiredConnections.keySet()) {
connection.collectDbStatsUnsafe(dbStatsList); // depends on control dependency: [for], data = [connection]
}
}
} } |
public class class_name {
private static int listDFSPaths()
{
Date alpha = new Date();
int inodeCount = 0;
String basePath = new String(TEST_BASE_DIR) + "/" + hostName_ + "_" + processName_;
Queue<String> pending = new LinkedList<String>();
pending.add(basePath);
while (!pending.isEmpty()) {
String parent = pending.remove();
try {
long startTime = System.nanoTime();
FileStatus[] children = dfsClient_.listPaths(parent);
timingListPaths_.add(new Double((System.nanoTime() - startTime)/(1E9)));
if (children == null || children.length == 0) {
continue;
}
for (int i = 0; i < children.length; i++) {
String localName = children[i].getPath().getName();
if (localName.equals(".") || localName.equals("..")) {
continue;
}
inodeCount ++;
if (inodeCount % COUNT_INCR == 0) {
System.out.printf("Readdir paths so far: %d\n", inodeCount);
}
if (children[i].isDir()) {
pending.add(parent + "/" + localName);
} else {
files_.put(parent + "/" + localName, null);
}
}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
Date zigma = new Date();
System.out.printf("Client: Directory walk done over %d inodes in %d msec\n",
inodeCount, timeDiffMilliSec(alpha, zigma));
return 0;
} } | public class class_name {
private static int listDFSPaths()
{
Date alpha = new Date();
int inodeCount = 0;
String basePath = new String(TEST_BASE_DIR) + "/" + hostName_ + "_" + processName_;
Queue<String> pending = new LinkedList<String>();
pending.add(basePath);
while (!pending.isEmpty()) {
String parent = pending.remove();
try {
long startTime = System.nanoTime();
FileStatus[] children = dfsClient_.listPaths(parent);
timingListPaths_.add(new Double((System.nanoTime() - startTime)/(1E9))); // depends on control dependency: [try], data = [none]
if (children == null || children.length == 0) {
continue;
}
for (int i = 0; i < children.length; i++) {
String localName = children[i].getPath().getName();
if (localName.equals(".") || localName.equals("..")) {
continue;
}
inodeCount ++; // depends on control dependency: [for], data = [none]
if (inodeCount % COUNT_INCR == 0) {
System.out.printf("Readdir paths so far: %d\n", inodeCount); // depends on control dependency: [if], data = [none]
}
if (children[i].isDir()) {
pending.add(parent + "/" + localName); // depends on control dependency: [if], data = [none]
} else {
files_.put(parent + "/" + localName, null); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
e.printStackTrace();
return -1;
} // depends on control dependency: [catch], data = [none]
}
Date zigma = new Date();
System.out.printf("Client: Directory walk done over %d inodes in %d msec\n",
inodeCount, timeDiffMilliSec(alpha, zigma));
return 0;
} } |
public class class_name {
private void init(final Locale locale) {
Class<?> c;
try {
c = Class.forName("com.ibm.icu.text.Collator");
} catch (final Exception e) {
c = Collator.class;
}
try {
final Method m = c.getDeclaredMethod("getInstance",
Locale.class);
collatorInstance = m.invoke(null, locale);
compareMethod = c.getDeclaredMethod("compare", Object.class, Object.class);
} catch (final Exception e) {
throw new RuntimeException("Failed to initialize collator: " + e.getMessage(), e);
}
} } | public class class_name {
private void init(final Locale locale) {
Class<?> c;
try {
c = Class.forName("com.ibm.icu.text.Collator"); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
c = Collator.class;
} // depends on control dependency: [catch], data = [none]
try {
final Method m = c.getDeclaredMethod("getInstance",
Locale.class);
collatorInstance = m.invoke(null, locale); // depends on control dependency: [try], data = [none]
compareMethod = c.getDeclaredMethod("compare", Object.class, Object.class); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw new RuntimeException("Failed to initialize collator: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setPanelsVisible(boolean visible) {
if (layout == Layout.FULL) {
getTabbedFull().setPanelsVisible(visible);
} else {
getTabbedSelect().setPanelsVisible(visible);
getTabbedWork().setPanelsVisible(visible);
getTabbedStatus().setPanelsVisible(visible);
}
} } | public class class_name {
public void setPanelsVisible(boolean visible) {
if (layout == Layout.FULL) {
getTabbedFull().setPanelsVisible(visible);
// depends on control dependency: [if], data = [none]
} else {
getTabbedSelect().setPanelsVisible(visible);
// depends on control dependency: [if], data = [none]
getTabbedWork().setPanelsVisible(visible);
// depends on control dependency: [if], data = [none]
getTabbedStatus().setPanelsVisible(visible);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DescribeDBClusterSnapshotsResult withDBClusterSnapshots(DBClusterSnapshot... dBClusterSnapshots) {
if (this.dBClusterSnapshots == null) {
setDBClusterSnapshots(new com.amazonaws.internal.SdkInternalList<DBClusterSnapshot>(dBClusterSnapshots.length));
}
for (DBClusterSnapshot ele : dBClusterSnapshots) {
this.dBClusterSnapshots.add(ele);
}
return this;
} } | public class class_name {
public DescribeDBClusterSnapshotsResult withDBClusterSnapshots(DBClusterSnapshot... dBClusterSnapshots) {
if (this.dBClusterSnapshots == null) {
setDBClusterSnapshots(new com.amazonaws.internal.SdkInternalList<DBClusterSnapshot>(dBClusterSnapshots.length)); // depends on control dependency: [if], data = [none]
}
for (DBClusterSnapshot ele : dBClusterSnapshots) {
this.dBClusterSnapshots.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static int searchDescending(double[] doubleArray, double value) {
int start = 0;
int end = doubleArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == doubleArray[middle]) {
return middle;
}
if(value > doubleArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} } | public class class_name {
public static int searchDescending(double[] doubleArray, double value) {
int start = 0;
int end = doubleArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1; // depends on control dependency: [while], data = [(start]
if(value == doubleArray[middle]) {
return middle; // depends on control dependency: [if], data = [none]
}
if(value > doubleArray[middle]) {
end = middle - 1 ; // depends on control dependency: [if], data = [none]
}
else {
start = middle + 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
protected static int getBytesPerPixel(Bitmap.Config config) {
if (config == Bitmap.Config.ARGB_8888) {
return 4;
} else if (config == Bitmap.Config.RGB_565) {
return 2;
} else if (config == Bitmap.Config.ARGB_4444) {
return 2;
} else if (config == Bitmap.Config.ALPHA_8) {
return 1;
}
return 1;
} } | public class class_name {
protected static int getBytesPerPixel(Bitmap.Config config) {
if (config == Bitmap.Config.ARGB_8888) {
return 4; // depends on control dependency: [if], data = [none]
} else if (config == Bitmap.Config.RGB_565) {
return 2; // depends on control dependency: [if], data = [none]
} else if (config == Bitmap.Config.ARGB_4444) {
return 2; // depends on control dependency: [if], data = [none]
} else if (config == Bitmap.Config.ALPHA_8) {
return 1; // depends on control dependency: [if], data = [none]
}
return 1;
} } |
public class class_name {
@Override
public Object instantiateItem(ViewGroup container, int position) {
int itemViewType = getItemViewType(position);
RecyclerView.ViewHolder holder = mRecycledViewPool.getRecycledView(itemViewType);
if (holder == null) {
holder = mAdapter.createViewHolder(container, itemViewType);
}
onBindViewHolder((VH) holder, position);
//itemViews' layoutParam will be reused when there are more than one nested ViewPager in one page,
//so the attributes of layoutParam such as widthFactor and position will also be reused,
//while these attributes should be reset to default value during reused.
//Considering ViewPager.LayoutParams has a few inner attributes which could not be modify outside, we provide a new instance here
container.addView(holder.itemView, new ViewPager.LayoutParams());
return holder;
} } | public class class_name {
@Override
public Object instantiateItem(ViewGroup container, int position) {
int itemViewType = getItemViewType(position);
RecyclerView.ViewHolder holder = mRecycledViewPool.getRecycledView(itemViewType);
if (holder == null) {
holder = mAdapter.createViewHolder(container, itemViewType); // depends on control dependency: [if], data = [none]
}
onBindViewHolder((VH) holder, position);
//itemViews' layoutParam will be reused when there are more than one nested ViewPager in one page,
//so the attributes of layoutParam such as widthFactor and position will also be reused,
//while these attributes should be reset to default value during reused.
//Considering ViewPager.LayoutParams has a few inner attributes which could not be modify outside, we provide a new instance here
container.addView(holder.itemView, new ViewPager.LayoutParams());
return holder;
} } |
public class class_name {
@Override
public Long serialize(Date value) {
if (value != null) {
return value.getTime();
}
return null;
} } | public class class_name {
@Override
public Long serialize(Date value) {
if (value != null) {
return value.getTime(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public <T> String tableCreateStatement(Type<T> type, TableCreationMode mode) {
String tableName = type.getName();
QueryBuilder qb = createQueryBuilder();
qb.keyword(CREATE);
if (type.getTableCreateAttributes() != null) {
for (String attribute : type.getTableCreateAttributes()) {
qb.append(attribute, true);
}
}
qb.keyword(TABLE);
if (mode == TableCreationMode.CREATE_NOT_EXISTS) {
qb.keyword(IF, NOT, EXISTS);
}
qb.tableName(tableName);
qb.openParenthesis();
int index = 0;
// columns to define first
Predicate<Attribute> filter = new Predicate<Attribute>() {
@Override
public boolean test(Attribute value) {
if (value.isVersion() &&
!platform.versionColumnDefinition().createColumn()) {
return false;
}
if (platform.supportsInlineForeignKeyReference()) {
return !value.isForeignKey() && !value.isAssociation();
} else {
return value.isForeignKey() || !value.isAssociation();
}
}
};
Set<Attribute<T, ?>> attributes = type.getAttributes();
for (Attribute attribute : attributes) {
if (filter.test(attribute)) {
if (index > 0) {
qb.comma();
}
createColumn(qb, attribute);
index++;
}
}
// foreign keys
for (Attribute attribute : attributes) {
if (attribute.isForeignKey()) {
if (index > 0) {
qb.comma();
}
createForeignKeyColumn(qb, attribute, true, false);
index++;
}
}
// composite primary key
if(type.getKeyAttributes().size() > 1) {
if (index > 0) {
qb.comma();
}
qb.keyword(PRIMARY, KEY);
qb.openParenthesis();
qb.commaSeparated(type.getKeyAttributes(),
new QueryBuilder.Appender<Attribute<T, ?>>() {
@Override
public void append(QueryBuilder qb, Attribute<T, ?> value) {
qb.attribute(value);
}
});
qb.closeParenthesis();
}
qb.closeParenthesis();
return qb.toString();
} } | public class class_name {
public <T> String tableCreateStatement(Type<T> type, TableCreationMode mode) {
String tableName = type.getName();
QueryBuilder qb = createQueryBuilder();
qb.keyword(CREATE);
if (type.getTableCreateAttributes() != null) {
for (String attribute : type.getTableCreateAttributes()) {
qb.append(attribute, true); // depends on control dependency: [for], data = [attribute]
}
}
qb.keyword(TABLE);
if (mode == TableCreationMode.CREATE_NOT_EXISTS) {
qb.keyword(IF, NOT, EXISTS); // depends on control dependency: [if], data = [none]
}
qb.tableName(tableName);
qb.openParenthesis();
int index = 0;
// columns to define first
Predicate<Attribute> filter = new Predicate<Attribute>() {
@Override
public boolean test(Attribute value) {
if (value.isVersion() &&
!platform.versionColumnDefinition().createColumn()) {
return false; // depends on control dependency: [if], data = [none]
}
if (platform.supportsInlineForeignKeyReference()) {
return !value.isForeignKey() && !value.isAssociation(); // depends on control dependency: [if], data = [none]
} else {
return value.isForeignKey() || !value.isAssociation(); // depends on control dependency: [if], data = [none]
}
}
};
Set<Attribute<T, ?>> attributes = type.getAttributes();
for (Attribute attribute : attributes) {
if (filter.test(attribute)) {
if (index > 0) {
qb.comma(); // depends on control dependency: [if], data = [none]
}
createColumn(qb, attribute); // depends on control dependency: [if], data = [none]
index++; // depends on control dependency: [if], data = [none]
}
}
// foreign keys
for (Attribute attribute : attributes) {
if (attribute.isForeignKey()) {
if (index > 0) {
qb.comma(); // depends on control dependency: [if], data = [none]
}
createForeignKeyColumn(qb, attribute, true, false); // depends on control dependency: [if], data = [none]
index++; // depends on control dependency: [if], data = [none]
}
}
// composite primary key
if(type.getKeyAttributes().size() > 1) {
if (index > 0) {
qb.comma(); // depends on control dependency: [if], data = [none]
}
qb.keyword(PRIMARY, KEY); // depends on control dependency: [if], data = [none]
qb.openParenthesis(); // depends on control dependency: [if], data = [none]
qb.commaSeparated(type.getKeyAttributes(),
new QueryBuilder.Appender<Attribute<T, ?>>() {
@Override
public void append(QueryBuilder qb, Attribute<T, ?> value) {
qb.attribute(value);
}
});
qb.closeParenthesis();
}
qb.closeParenthesis();
return qb.toString(); // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public Observable<ServiceResponse<QueryResults>> executeWithServiceResponseAsync(String appId, QueryBody body) {
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (body == null) {
throw new IllegalArgumentException("Parameter body is required and cannot be null.");
}
Validator.validate(body);
return service.execute(appId, body, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<QueryResults>>>() {
@Override
public Observable<ServiceResponse<QueryResults>> call(Response<ResponseBody> response) {
try {
ServiceResponse<QueryResults> clientResponse = executeDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<QueryResults>> executeWithServiceResponseAsync(String appId, QueryBody body) {
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (body == null) {
throw new IllegalArgumentException("Parameter body is required and cannot be null.");
}
Validator.validate(body);
return service.execute(appId, body, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<QueryResults>>>() {
@Override
public Observable<ServiceResponse<QueryResults>> call(Response<ResponseBody> response) {
try {
ServiceResponse<QueryResults> clientResponse = executeDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public static GVRMesh createCurvedMesh(GVRContext gvrContext, int width, int height, float centralAngle, float radius)
{
GVRMesh mesh = new GVRMesh(gvrContext);
final float MAX_DEGREES_PER_SUBDIVISION = 10f;
float ratio = (float)width/(float)height;
int subdivisions = (int) Math.ceil(centralAngle / MAX_DEGREES_PER_SUBDIVISION);
float degreesPerSubdivision = centralAngle/subdivisions;
// Scale the number of subdivisions with the central angle size
// Let each subdivision represent a constant number of degrees on the arc
double startDegree = -centralAngle/2.0;
float h = (float) (radius * Math.toRadians(centralAngle))/ratio;
float yTop = h/2;
float yBottom = -yTop;
float[] vertices = new float[(subdivisions+1)*6];
float[] normals = new float[(subdivisions+1)*6];
float[] texCoords= new float[(subdivisions+1)*4];
char[] triangles = new char[subdivisions*6];
/*
* The following diagram illustrates the construction method
* Let s be the number of subdivisions, then we create s pairs of vertices
* like so
*
* {0} {2} {4} ... {2s-1}
* |y+
* {1} {3} {5} ... {2s} |___x+
* z+/
*/
for(int i = 0; i <= subdivisions; i++)
{
double angle = Math.toRadians(-90+startDegree + degreesPerSubdivision*i);
double cos = Math.cos(angle);
double sin = Math.sin(angle);
float x = (float) (radius * cos);
float z = (float) ((radius * sin) + radius);
vertices[6*i] = x;
vertices[6*i + 1] = yTop;
vertices[6*i + 2] = z;
normals[6*i] = (float)-cos;
normals[6*i + 1] = 0.0f;
normals[6*i + 2] = (float)-sin;
texCoords[4*i] = (float)i/subdivisions;
texCoords[4*i + 1] = 0.0f;
vertices[6*i + 3] = x;
vertices[6*i + 4] = yBottom;
vertices[6*i + 5] = z;
normals[6*i + 3] = (float)-cos;
normals[6*i + 4] = 0.0f;
normals[6*i + 5] = (float)-sin;
texCoords[4*i + 2] = (float)i/subdivisions;
texCoords[4*i + 3] = 1.0f;
}
/*
* Referring to the diagram above, we create two triangles
* for each pair of consecutive pairs of vertices
* (e.g. we create two triangles with {0, 1} and {2, 3}
* and two triangles with {2, 3} and {4, 5})
*
* {0}--{2}--{4}-...-{2s-1}
* | \ | \ | | |y+
* {1}--{3}--{5}-...-{2s} |___x+
* z+/
*/
for (int i = 0; i < subdivisions; i++)
{
triangles[6*i] = (char)(2*(i+1)+1);
triangles[6*i+1] = (char) (2*(i));
triangles[6*i+2] = (char) (2*(i)+1);
triangles[6*i+3] = (char) (2*(i+1)+1);
triangles[6*i+4] = (char) (2*(i+1));
triangles[6*i+5] = (char) (2*(i));
}
mesh.setVertices(vertices);
mesh.setNormals(normals);
mesh.setTexCoords(texCoords);
mesh.setIndices(triangles);
return mesh;
} } | public class class_name {
public static GVRMesh createCurvedMesh(GVRContext gvrContext, int width, int height, float centralAngle, float radius)
{
GVRMesh mesh = new GVRMesh(gvrContext);
final float MAX_DEGREES_PER_SUBDIVISION = 10f;
float ratio = (float)width/(float)height;
int subdivisions = (int) Math.ceil(centralAngle / MAX_DEGREES_PER_SUBDIVISION);
float degreesPerSubdivision = centralAngle/subdivisions;
// Scale the number of subdivisions with the central angle size
// Let each subdivision represent a constant number of degrees on the arc
double startDegree = -centralAngle/2.0;
float h = (float) (radius * Math.toRadians(centralAngle))/ratio;
float yTop = h/2;
float yBottom = -yTop;
float[] vertices = new float[(subdivisions+1)*6];
float[] normals = new float[(subdivisions+1)*6];
float[] texCoords= new float[(subdivisions+1)*4];
char[] triangles = new char[subdivisions*6];
/*
* The following diagram illustrates the construction method
* Let s be the number of subdivisions, then we create s pairs of vertices
* like so
*
* {0} {2} {4} ... {2s-1}
* |y+
* {1} {3} {5} ... {2s} |___x+
* z+/
*/
for(int i = 0; i <= subdivisions; i++)
{
double angle = Math.toRadians(-90+startDegree + degreesPerSubdivision*i);
double cos = Math.cos(angle);
double sin = Math.sin(angle);
float x = (float) (radius * cos);
float z = (float) ((radius * sin) + radius);
vertices[6*i] = x; // depends on control dependency: [for], data = [i]
vertices[6*i + 1] = yTop; // depends on control dependency: [for], data = [i]
vertices[6*i + 2] = z; // depends on control dependency: [for], data = [i]
normals[6*i] = (float)-cos; // depends on control dependency: [for], data = [i]
normals[6*i + 1] = 0.0f; // depends on control dependency: [for], data = [i]
normals[6*i + 2] = (float)-sin; // depends on control dependency: [for], data = [i]
texCoords[4*i] = (float)i/subdivisions; // depends on control dependency: [for], data = [i]
texCoords[4*i + 1] = 0.0f; // depends on control dependency: [for], data = [i]
vertices[6*i + 3] = x; // depends on control dependency: [for], data = [i]
vertices[6*i + 4] = yBottom; // depends on control dependency: [for], data = [i]
vertices[6*i + 5] = z; // depends on control dependency: [for], data = [i]
normals[6*i + 3] = (float)-cos; // depends on control dependency: [for], data = [i]
normals[6*i + 4] = 0.0f; // depends on control dependency: [for], data = [i]
normals[6*i + 5] = (float)-sin; // depends on control dependency: [for], data = [i]
texCoords[4*i + 2] = (float)i/subdivisions; // depends on control dependency: [for], data = [i]
texCoords[4*i + 3] = 1.0f; // depends on control dependency: [for], data = [i]
}
/*
* Referring to the diagram above, we create two triangles
* for each pair of consecutive pairs of vertices
* (e.g. we create two triangles with {0, 1} and {2, 3}
* and two triangles with {2, 3} and {4, 5})
*
* {0}--{2}--{4}-...-{2s-1}
* | \ | \ | | |y+
* {1}--{3}--{5}-...-{2s} |___x+
* z+/
*/
for (int i = 0; i < subdivisions; i++)
{
triangles[6*i] = (char)(2*(i+1)+1); // depends on control dependency: [for], data = [i]
triangles[6*i+1] = (char) (2*(i)); // depends on control dependency: [for], data = [i]
triangles[6*i+2] = (char) (2*(i)+1); // depends on control dependency: [for], data = [i]
triangles[6*i+3] = (char) (2*(i+1)+1); // depends on control dependency: [for], data = [i]
triangles[6*i+4] = (char) (2*(i+1)); // depends on control dependency: [for], data = [i]
triangles[6*i+5] = (char) (2*(i)); // depends on control dependency: [for], data = [i]
}
mesh.setVertices(vertices);
mesh.setNormals(normals);
mesh.setTexCoords(texCoords);
mesh.setIndices(triangles);
return mesh;
} } |
public class class_name {
protected long getAbsolutePosition(final long[] iFilePosition) {
long position = 0;
for (int i = 0; i < iFilePosition[0]; ++i) {
position += fileMaxSize;
}
return position + iFilePosition[1];
} } | public class class_name {
protected long getAbsolutePosition(final long[] iFilePosition) {
long position = 0;
for (int i = 0; i < iFilePosition[0]; ++i) {
position += fileMaxSize;
// depends on control dependency: [for], data = [none]
}
return position + iFilePosition[1];
} } |
public class class_name {
private Properties addSeveralSpecialProperties() {
String timeStamp = new MavenBuildTimestamp(new Date(), timestampFormat).formattedTimestamp();
Properties additionalProperties = new Properties();
additionalProperties.put("mdpagegenerator.timestamp", timeStamp);
if (project.getBasedir() != null) {
additionalProperties.put("project.baseUri", project.getBasedir().getAbsoluteFile().toURI().toString());
}
return additionalProperties;
} } | public class class_name {
private Properties addSeveralSpecialProperties() {
String timeStamp = new MavenBuildTimestamp(new Date(), timestampFormat).formattedTimestamp();
Properties additionalProperties = new Properties();
additionalProperties.put("mdpagegenerator.timestamp", timeStamp);
if (project.getBasedir() != null) {
additionalProperties.put("project.baseUri", project.getBasedir().getAbsoluteFile().toURI().toString()); // depends on control dependency: [if], data = [none]
}
return additionalProperties;
} } |
public class class_name {
public void setSpanCount(int spanCount) {
if (spanCount == mSpanCount) {
return;
}
if (spanCount < 1) {
throw new IllegalArgumentException("Span count should be at least 1. Provided "
+ spanCount);
}
mSpanCount = spanCount;
mSpanSizeLookup.invalidateSpanIndexCache();
ensureSpanCount();
} } | public class class_name {
public void setSpanCount(int spanCount) {
if (spanCount == mSpanCount) {
return; // depends on control dependency: [if], data = [none]
}
if (spanCount < 1) {
throw new IllegalArgumentException("Span count should be at least 1. Provided "
+ spanCount);
}
mSpanCount = spanCount;
mSpanSizeLookup.invalidateSpanIndexCache();
ensureSpanCount();
} } |
public class class_name {
public static Integer getContentSpecID(final String contentSpecString) {
final Matcher matcher = CS_ID_PATTERN.matcher(contentSpecString);
if (matcher.find()) {
return Integer.parseInt(matcher.group("ID"));
}
return null;
} } | public class class_name {
public static Integer getContentSpecID(final String contentSpecString) {
final Matcher matcher = CS_ID_PATTERN.matcher(contentSpecString);
if (matcher.find()) {
return Integer.parseInt(matcher.group("ID")); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public void close() {
if (posTimeMap != null) {
posTimeMap.clear();
}
try {
fis.close();
fileChannel.close();
} catch (IOException e) {
log.error("Exception on close", e);
}
} } | public class class_name {
@Override
public void close() {
if (posTimeMap != null) {
posTimeMap.clear();
// depends on control dependency: [if], data = [none]
}
try {
fis.close();
// depends on control dependency: [try], data = [none]
fileChannel.close();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.error("Exception on close", e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public FeatureState copy() {
FeatureState copy = new FeatureState(feature);
copy.setEnabled(this.enabled);
copy.setStrategyId(this.strategyId);
for (Entry<String, String> entry : this.parameters.entrySet()) {
copy.setParameter(entry.getKey(), entry.getValue());
}
return copy;
} } | public class class_name {
public FeatureState copy() {
FeatureState copy = new FeatureState(feature);
copy.setEnabled(this.enabled);
copy.setStrategyId(this.strategyId);
for (Entry<String, String> entry : this.parameters.entrySet()) {
copy.setParameter(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return copy;
} } |
public class class_name {
protected <C extends CrudResponse, T extends CreateEntity> C handleInsertEntity(T entity) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityInsert(BullhornEntityInfo
.getTypesRestEntityName(entity.getClass()));
String url = restUrlFactory.assembleEntityUrlForInsert();
CrudResponse response;
try {
String jsonString = restJsonConverter.convertEntityToJsonString(entity);
response = this.performCustomRequest(url, jsonString, CreateResponse.class, uriVariables, HttpMethod.PUT, null);
} catch (HttpStatusCodeException error) {
response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new CreateResponse(), error, entity.getId());
}
return (C) response;
} } | public class class_name {
protected <C extends CrudResponse, T extends CreateEntity> C handleInsertEntity(T entity) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityInsert(BullhornEntityInfo
.getTypesRestEntityName(entity.getClass()));
String url = restUrlFactory.assembleEntityUrlForInsert();
CrudResponse response;
try {
String jsonString = restJsonConverter.convertEntityToJsonString(entity);
response = this.performCustomRequest(url, jsonString, CreateResponse.class, uriVariables, HttpMethod.PUT, null); // depends on control dependency: [try], data = [none]
} catch (HttpStatusCodeException error) {
response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new CreateResponse(), error, entity.getId());
} // depends on control dependency: [catch], data = [none]
return (C) response;
} } |
public class class_name {
protected int indexOf(String text, String... values) {
int answer = -1;
for (String value : values) {
int idx = text.indexOf(value);
if (idx >= 0) {
if (answer < 0 || idx < answer) {
answer = idx;
}
}
}
return answer;
} } | public class class_name {
protected int indexOf(String text, String... values) {
int answer = -1;
for (String value : values) {
int idx = text.indexOf(value);
if (idx >= 0) {
if (answer < 0 || idx < answer) {
answer = idx; // depends on control dependency: [if], data = [none]
}
}
}
return answer;
} } |
public class class_name {
@Nonnull
public static String getExpandedMessage (@Nonnull final String sMsg)
{
final char cCheck = sMsg.length () == 8 ? sMsg.charAt (7) : '\u0000';
final String sUpce = sMsg.substring (0, 0 + 7);
final byte nNumberSystem = _extractNumberSystem (sUpce);
if (nNumberSystem != 0 && nNumberSystem != 1)
throw new IllegalArgumentException ("Invalid UPC-E message: " + sMsg);
final StringBuilder aSB = new StringBuilder ();
aSB.append (Byte.toString (nNumberSystem));
final byte nMode = StringParser.parseByte (sUpce.substring (6, 6 + 1), (byte) -1);
if (nMode >= 0 && nMode <= 2)
{
aSB.append (sUpce.substring (1, 1 + 2));
aSB.append (Byte.toString (nMode));
aSB.append ("0000");
aSB.append (sUpce.substring (3, 3 + 3));
}
else
if (nMode == 3)
{
aSB.append (sUpce.substring (1, 1 + 3));
aSB.append ("00000");
aSB.append (sUpce.substring (4, 4 + 2));
}
else
if (nMode == 4)
{
aSB.append (sUpce.substring (1, 1 + 4));
aSB.append ("00000");
aSB.append (sUpce.substring (5, 5 + 1));
}
else
if (nMode >= 5 && nMode <= 9)
{
aSB.append (sUpce.substring (1, 1 + 5));
aSB.append ("0000");
aSB.append (Byte.toString (nMode));
}
else
{
// Shouldn't happen
throw new IllegalArgumentException ("Internal error");
}
final String sUpcaFinished = aSB.toString ();
final char cExpectedCheck = calcChecksumChar (sUpcaFinished, sUpcaFinished.length ());
if (cCheck != '\u0000' && cCheck != cExpectedCheck)
throw new IllegalArgumentException ("Invalid checksum. Expected " + cExpectedCheck + " but was " + cCheck);
return sUpcaFinished + cExpectedCheck;
} } | public class class_name {
@Nonnull
public static String getExpandedMessage (@Nonnull final String sMsg)
{
final char cCheck = sMsg.length () == 8 ? sMsg.charAt (7) : '\u0000';
final String sUpce = sMsg.substring (0, 0 + 7);
final byte nNumberSystem = _extractNumberSystem (sUpce);
if (nNumberSystem != 0 && nNumberSystem != 1)
throw new IllegalArgumentException ("Invalid UPC-E message: " + sMsg);
final StringBuilder aSB = new StringBuilder ();
aSB.append (Byte.toString (nNumberSystem));
final byte nMode = StringParser.parseByte (sUpce.substring (6, 6 + 1), (byte) -1);
if (nMode >= 0 && nMode <= 2)
{
aSB.append (sUpce.substring (1, 1 + 2)); // depends on control dependency: [if], data = [none]
aSB.append (Byte.toString (nMode)); // depends on control dependency: [if], data = [(nMode]
aSB.append ("0000"); // depends on control dependency: [if], data = [none]
aSB.append (sUpce.substring (3, 3 + 3)); // depends on control dependency: [if], data = [none]
}
else
if (nMode == 3)
{
aSB.append (sUpce.substring (1, 1 + 3)); // depends on control dependency: [if], data = [3)]
aSB.append ("00000"); // depends on control dependency: [if], data = [none]
aSB.append (sUpce.substring (4, 4 + 2)); // depends on control dependency: [if], data = [none]
}
else
if (nMode == 4)
{
aSB.append (sUpce.substring (1, 1 + 4)); // depends on control dependency: [if], data = [4)]
aSB.append ("00000"); // depends on control dependency: [if], data = [none]
aSB.append (sUpce.substring (5, 5 + 1)); // depends on control dependency: [if], data = [none]
}
else
if (nMode >= 5 && nMode <= 9)
{
aSB.append (sUpce.substring (1, 1 + 5)); // depends on control dependency: [if], data = [none]
aSB.append ("0000"); // depends on control dependency: [if], data = [none]
aSB.append (Byte.toString (nMode)); // depends on control dependency: [if], data = [(nMode]
}
else
{
// Shouldn't happen
throw new IllegalArgumentException ("Internal error");
}
final String sUpcaFinished = aSB.toString ();
final char cExpectedCheck = calcChecksumChar (sUpcaFinished, sUpcaFinished.length ());
if (cCheck != '\u0000' && cCheck != cExpectedCheck)
throw new IllegalArgumentException ("Invalid checksum. Expected " + cExpectedCheck + " but was " + cCheck);
return sUpcaFinished + cExpectedCheck;
} } |
public class class_name {
private void visitCallContainingSpread(Node spreadParent) {
checkArgument(spreadParent.isCall());
Node callee = spreadParent.getFirstChild();
// Check if the callee has side effects before removing it from the AST (since some NodeUtil
// methods assume the node they are passed has a non-null parent).
boolean calleeMayHaveSideEffects = NodeUtil.mayHaveSideEffects(callee, compiler);
// Must remove callee before extracting argument groups.
spreadParent.removeChild(callee);
final Node joinedGroups;
if (spreadParent.hasOneChild() && isSpreadOfArguments(spreadParent.getOnlyChild())) {
// Check for special case of `foo(...arguments)` and pass `arguments` directly to
// `foo.apply(null, arguments)`. We want to avoid calling $jscomp.arrayFromIterable(arguments)
// for this case, because it can have side effects, which prevents code removal.
//
// TODO(b/74074478): Generalize this to avoid ever calling $jscomp.arrayFromIterable() for
// `arguments`.
joinedGroups = spreadParent.removeFirstChild().removeFirstChild();
} else {
List<Node> groups = extractSpreadGroups(spreadParent);
checkState(!groups.isEmpty());
if (groups.size() == 1) {
// A single group can just be passed to `apply()` as-is
// It could be `arguments`, an array literal, or $jscomp.arrayFromIterable(someExpression).
joinedGroups = groups.remove(0);
} else {
// If the first group is an array literal, we can just use that for concatenation,
// otherwise use an empty array literal.
//
// TODO(nickreid): Stop distringuishing between array literals and variables when this pass
// is moved after type-checking.
Node baseArrayLit = groups.get(0).isArrayLit() ? groups.remove(0) : arrayLitWithJSType();
Node concat = IR.getprop(baseArrayLit, IR.string("concat")).setJSType(concatFnType);
joinedGroups = IR.call(concat, groups.toArray(new Node[0])).setJSType(arrayType);
}
joinedGroups.setJSType(arrayType);
}
final Node callToApply;
if (calleeMayHaveSideEffects && callee.isGetProp()) {
JSType receiverType = callee.getFirstChild().getJSType(); // Type of `foo()`.
// foo().method(...[a, b, c])
// must convert to
// var freshVar;
// (freshVar = foo()).method.apply(freshVar, [a, b, c])
Node freshVar =
IR.name(FRESH_SPREAD_VAR + compiler.getUniqueNameIdSupplier().get())
.setJSType(receiverType);
Node freshVarDeclaration = IR.var(freshVar.cloneTree());
Node statementContainingSpread = NodeUtil.getEnclosingStatement(spreadParent);
freshVarDeclaration.useSourceInfoIfMissingFromForTree(statementContainingSpread);
statementContainingSpread
.getParent()
.addChildBefore(freshVarDeclaration, statementContainingSpread);
callee.addChildToFront(
IR.assign(freshVar.cloneTree(), callee.removeFirstChild()).setJSType(receiverType));
callToApply =
IR.call(getpropInferringJSType(callee, "apply"), freshVar.cloneTree(), joinedGroups);
} else {
// foo.method(...[a, b, c]) -> foo.method.apply(foo, [a, b, c])
// foo['method'](...[a, b, c]) -> foo['method'].apply(foo, [a, b, c])
// or
// foo(...[a, b, c]) -> foo.apply(null, [a, b, c])
Node context =
(callee.isGetProp() || callee.isGetElem())
? callee.getFirstChild().cloneTree()
: nullWithJSType();
callToApply = IR.call(getpropInferringJSType(callee, "apply"), context, joinedGroups);
}
callToApply.setJSType(spreadParent.getJSType());
callToApply.useSourceInfoIfMissingFromForTree(spreadParent);
spreadParent.replaceWith(callToApply);
compiler.reportChangeToEnclosingScope(callToApply);
} } | public class class_name {
private void visitCallContainingSpread(Node spreadParent) {
checkArgument(spreadParent.isCall());
Node callee = spreadParent.getFirstChild();
// Check if the callee has side effects before removing it from the AST (since some NodeUtil
// methods assume the node they are passed has a non-null parent).
boolean calleeMayHaveSideEffects = NodeUtil.mayHaveSideEffects(callee, compiler);
// Must remove callee before extracting argument groups.
spreadParent.removeChild(callee);
final Node joinedGroups;
if (spreadParent.hasOneChild() && isSpreadOfArguments(spreadParent.getOnlyChild())) {
// Check for special case of `foo(...arguments)` and pass `arguments` directly to
// `foo.apply(null, arguments)`. We want to avoid calling $jscomp.arrayFromIterable(arguments)
// for this case, because it can have side effects, which prevents code removal.
//
// TODO(b/74074478): Generalize this to avoid ever calling $jscomp.arrayFromIterable() for
// `arguments`.
joinedGroups = spreadParent.removeFirstChild().removeFirstChild(); // depends on control dependency: [if], data = [none]
} else {
List<Node> groups = extractSpreadGroups(spreadParent);
checkState(!groups.isEmpty()); // depends on control dependency: [if], data = [none]
if (groups.size() == 1) {
// A single group can just be passed to `apply()` as-is
// It could be `arguments`, an array literal, or $jscomp.arrayFromIterable(someExpression).
joinedGroups = groups.remove(0); // depends on control dependency: [if], data = [none]
} else {
// If the first group is an array literal, we can just use that for concatenation,
// otherwise use an empty array literal.
//
// TODO(nickreid): Stop distringuishing between array literals and variables when this pass
// is moved after type-checking.
Node baseArrayLit = groups.get(0).isArrayLit() ? groups.remove(0) : arrayLitWithJSType();
Node concat = IR.getprop(baseArrayLit, IR.string("concat")).setJSType(concatFnType);
joinedGroups = IR.call(concat, groups.toArray(new Node[0])).setJSType(arrayType); // depends on control dependency: [if], data = [none]
}
joinedGroups.setJSType(arrayType); // depends on control dependency: [if], data = [none]
}
final Node callToApply;
if (calleeMayHaveSideEffects && callee.isGetProp()) {
JSType receiverType = callee.getFirstChild().getJSType(); // Type of `foo()`.
// foo().method(...[a, b, c])
// must convert to
// var freshVar;
// (freshVar = foo()).method.apply(freshVar, [a, b, c])
Node freshVar =
IR.name(FRESH_SPREAD_VAR + compiler.getUniqueNameIdSupplier().get())
.setJSType(receiverType);
Node freshVarDeclaration = IR.var(freshVar.cloneTree());
Node statementContainingSpread = NodeUtil.getEnclosingStatement(spreadParent);
freshVarDeclaration.useSourceInfoIfMissingFromForTree(statementContainingSpread); // depends on control dependency: [if], data = [none]
statementContainingSpread
.getParent()
.addChildBefore(freshVarDeclaration, statementContainingSpread); // depends on control dependency: [if], data = [none]
callee.addChildToFront(
IR.assign(freshVar.cloneTree(), callee.removeFirstChild()).setJSType(receiverType)); // depends on control dependency: [if], data = [none]
callToApply =
IR.call(getpropInferringJSType(callee, "apply"), freshVar.cloneTree(), joinedGroups); // depends on control dependency: [if], data = [none]
} else {
// foo.method(...[a, b, c]) -> foo.method.apply(foo, [a, b, c])
// foo['method'](...[a, b, c]) -> foo['method'].apply(foo, [a, b, c])
// or
// foo(...[a, b, c]) -> foo.apply(null, [a, b, c])
Node context =
(callee.isGetProp() || callee.isGetElem())
? callee.getFirstChild().cloneTree()
: nullWithJSType();
callToApply = IR.call(getpropInferringJSType(callee, "apply"), context, joinedGroups); // depends on control dependency: [if], data = [none]
}
callToApply.setJSType(spreadParent.getJSType());
callToApply.useSourceInfoIfMissingFromForTree(spreadParent);
spreadParent.replaceWith(callToApply);
compiler.reportChangeToEnclosingScope(callToApply);
} } |
public class class_name {
public Observable<ServiceResponse<Page<BillingMeterInner>>> listBillingMetersNextSinglePageAsync(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.listBillingMetersNext(nextUrl, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<BillingMeterInner>>>>() {
@Override
public Observable<ServiceResponse<Page<BillingMeterInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<BillingMeterInner>> result = listBillingMetersNextDelegate(response);
return Observable.just(new ServiceResponse<Page<BillingMeterInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<BillingMeterInner>>> listBillingMetersNextSinglePageAsync(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.listBillingMetersNext(nextUrl, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<BillingMeterInner>>>>() {
@Override
public Observable<ServiceResponse<Page<BillingMeterInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<BillingMeterInner>> result = listBillingMetersNextDelegate(response);
return Observable.just(new ServiceResponse<Page<BillingMeterInner>>(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 void undo() {
if (isListChange()) {
LOGGER.trace("Undoing list change: " + oldList.get().toString());
setting.valueProperty().setValue(oldList.get());
} else {
setting.valueProperty().setValue(oldValue.get());
}
} } | public class class_name {
public void undo() {
if (isListChange()) {
LOGGER.trace("Undoing list change: " + oldList.get().toString()); // depends on control dependency: [if], data = [none]
setting.valueProperty().setValue(oldList.get()); // depends on control dependency: [if], data = [none]
} else {
setting.valueProperty().setValue(oldValue.get()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EEnum getIfcDoorPanelOperationEnum() {
if (ifcDoorPanelOperationEnumEEnum == null) {
ifcDoorPanelOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(965);
}
return ifcDoorPanelOperationEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcDoorPanelOperationEnum() {
if (ifcDoorPanelOperationEnumEEnum == null) {
ifcDoorPanelOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(965);
// depends on control dependency: [if], data = [none]
}
return ifcDoorPanelOperationEnumEEnum;
} } |
public class class_name {
public void marshall(ExponentialRolloutRate exponentialRolloutRate, ProtocolMarshaller protocolMarshaller) {
if (exponentialRolloutRate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(exponentialRolloutRate.getBaseRatePerMinute(), BASERATEPERMINUTE_BINDING);
protocolMarshaller.marshall(exponentialRolloutRate.getIncrementFactor(), INCREMENTFACTOR_BINDING);
protocolMarshaller.marshall(exponentialRolloutRate.getRateIncreaseCriteria(), RATEINCREASECRITERIA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ExponentialRolloutRate exponentialRolloutRate, ProtocolMarshaller protocolMarshaller) {
if (exponentialRolloutRate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(exponentialRolloutRate.getBaseRatePerMinute(), BASERATEPERMINUTE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(exponentialRolloutRate.getIncrementFactor(), INCREMENTFACTOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(exponentialRolloutRate.getRateIncreaseCriteria(), RATEINCREASECRITERIA_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 DataObjectModel view(String... properties)
{
DataObjectModel view = clone();
view.propertyList = new ArrayList<String>();
for (String property : properties)
{
view.propertyList.add(property);
}
return view;
} } | public class class_name {
public DataObjectModel view(String... properties)
{
DataObjectModel view = clone();
view.propertyList = new ArrayList<String>();
for (String property : properties)
{
view.propertyList.add(property);
// depends on control dependency: [for], data = [property]
}
return view;
} } |
public class class_name {
private void calculateError(){
int totalErrorCount = 0;
int totalRedundancy = 0;
int trueCoverage = 0;
int totalCoverage = 0;
int numNoise = 0;
double errorNoise = 0;
double errorNoiseMax = 0;
double errorMissed = 0;
double errorMissedMax = 0;
double errorMisplaced = 0;
double errorMisplacedMax = 0;
double totalError = 0.0;
double totalErrorMax = 0.0;
/** mainly iterate over all points and find the right error value for the point.
* within the same run calculate various other stuff like coverage etc...
*/
for (int p = 0; p < numPoints; p++) {
CMMPoint cmdp = gtAnalysis.getPoint(p);
double weight = cmdp.weight();
//noise counter
if(cmdp.isNoise()){
numNoise++;
//this is always 1
errorNoiseMax+=cmdp.connectivity*weight;
}
else{
errorMissedMax+=cmdp.connectivity*weight;
errorMisplacedMax+=cmdp.connectivity*weight;
}
//sum up maxError as the individual errors are the quality weighted between 0-1
totalErrorMax+=cmdp.connectivity*weight;
double err = 0;
int coverage = 0;
//check every FCluster
for (int c = 0; c < numFClusters; c++) {
//contained in cluster c?
if(pointInclusionProbFC[p][c] >= pointInclusionProbThreshold){
coverage++;
if(!cmdp.isNoise()){
//PLACED CORRECTLY
if(matchMap[c] == cmdp.workclass()){
}
//MISPLACED
else{
double errvalue = misplacedError(cmdp, c);
if(errvalue > err)
err = errvalue;
}
}
else{
//NOISE
double errvalue = noiseError(cmdp, c);
if(errvalue > err) err = errvalue;
}
}
}
//not in any cluster
if(coverage == 0){
//MISSED
if(!cmdp.isNoise()){
err = missedError(cmdp,true);
errorMissed+= weight*err;
}
//NOISE
else{
}
}
else{
if(!cmdp.isNoise()){
errorMisplaced+= err*weight;
}
else{
errorNoise+= err*weight;
}
}
/* processing of other evaluation values */
totalError+= err*weight;
if(err!=0)totalErrorCount++;
if(coverage>0) totalCoverage++; //points covered by clustering (incl. noise)
if(coverage>0 && !cmdp.isNoise()) trueCoverage++; //points covered by clustering, don't count noise
if(coverage>1) totalRedundancy++; //include noise
cmdp.p.setMeasureValue("CMM",err);
cmdp.p.setMeasureValue("Redundancy", coverage);
}
addValue("CMM", (totalErrorMax!=0)?1-totalError/totalErrorMax:1);
addValue("CMM Missed", (errorMissedMax!=0)?1-errorMissed/errorMissedMax:1);
addValue("CMM Misplaced", (errorMisplacedMax!=0)?1-errorMisplaced/errorMisplacedMax:1);
addValue("CMM Noise", (errorNoiseMax!=0)?1-errorNoise/errorNoiseMax:1);
addValue("CMM Basic", 1-((double)totalErrorCount/(double)numPoints));
if(debug){
System.out.println("-------------");
}
} } | public class class_name {
private void calculateError(){
int totalErrorCount = 0;
int totalRedundancy = 0;
int trueCoverage = 0;
int totalCoverage = 0;
int numNoise = 0;
double errorNoise = 0;
double errorNoiseMax = 0;
double errorMissed = 0;
double errorMissedMax = 0;
double errorMisplaced = 0;
double errorMisplacedMax = 0;
double totalError = 0.0;
double totalErrorMax = 0.0;
/** mainly iterate over all points and find the right error value for the point.
* within the same run calculate various other stuff like coverage etc...
*/
for (int p = 0; p < numPoints; p++) {
CMMPoint cmdp = gtAnalysis.getPoint(p);
double weight = cmdp.weight();
//noise counter
if(cmdp.isNoise()){
numNoise++; // depends on control dependency: [if], data = [none]
//this is always 1
errorNoiseMax+=cmdp.connectivity*weight; // depends on control dependency: [if], data = [none]
}
else{
errorMissedMax+=cmdp.connectivity*weight; // depends on control dependency: [if], data = [none]
errorMisplacedMax+=cmdp.connectivity*weight; // depends on control dependency: [if], data = [none]
}
//sum up maxError as the individual errors are the quality weighted between 0-1
totalErrorMax+=cmdp.connectivity*weight; // depends on control dependency: [for], data = [none]
double err = 0;
int coverage = 0;
//check every FCluster
for (int c = 0; c < numFClusters; c++) {
//contained in cluster c?
if(pointInclusionProbFC[p][c] >= pointInclusionProbThreshold){
coverage++; // depends on control dependency: [if], data = [none]
if(!cmdp.isNoise()){
//PLACED CORRECTLY
if(matchMap[c] == cmdp.workclass()){
}
//MISPLACED
else{
double errvalue = misplacedError(cmdp, c);
if(errvalue > err)
err = errvalue;
}
}
else{
//NOISE
double errvalue = noiseError(cmdp, c);
if(errvalue > err) err = errvalue;
}
}
}
//not in any cluster
if(coverage == 0){
//MISSED
if(!cmdp.isNoise()){
err = missedError(cmdp,true); // depends on control dependency: [if], data = [none]
errorMissed+= weight*err; // depends on control dependency: [if], data = [none]
}
//NOISE
else{
}
}
else{
if(!cmdp.isNoise()){
errorMisplaced+= err*weight; // depends on control dependency: [if], data = [none]
}
else{
errorNoise+= err*weight; // depends on control dependency: [if], data = [none]
}
}
/* processing of other evaluation values */
totalError+= err*weight; // depends on control dependency: [for], data = [none]
if(err!=0)totalErrorCount++;
if(coverage>0) totalCoverage++; //points covered by clustering (incl. noise)
if(coverage>0 && !cmdp.isNoise()) trueCoverage++; //points covered by clustering, don't count noise
if(coverage>1) totalRedundancy++; //include noise
cmdp.p.setMeasureValue("CMM",err); // depends on control dependency: [for], data = [p]
cmdp.p.setMeasureValue("Redundancy", coverage); // depends on control dependency: [for], data = [p]
}
addValue("CMM", (totalErrorMax!=0)?1-totalError/totalErrorMax:1);
addValue("CMM Missed", (errorMissedMax!=0)?1-errorMissed/errorMissedMax:1);
addValue("CMM Misplaced", (errorMisplacedMax!=0)?1-errorMisplaced/errorMisplacedMax:1);
addValue("CMM Noise", (errorNoiseMax!=0)?1-errorNoise/errorNoiseMax:1);
addValue("CMM Basic", 1-((double)totalErrorCount/(double)numPoints));
if(debug){
System.out.println("-------------"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final String input() throws RecognitionException {
String value = null;
String unquoted_string3 =null;
String quoted_string4 =null;
try {
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:87:3: ( unquoted_string | quoted_string )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==STRING) ) {
alt6=1;
}
else if ( ((LA6_0 >= STRING_WITH_QUOTE && LA6_0 <= STRING_WITH_QUOTE_DOUBLE)) ) {
alt6=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:87:5: unquoted_string
{
pushFollow(FOLLOW_unquoted_string_in_input238);
unquoted_string3=unquoted_string();
state._fsp--;
value = unquoted_string3;
}
break;
case 2 :
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:88:5: quoted_string
{
pushFollow(FOLLOW_quoted_string_in_input246);
quoted_string4=quoted_string();
state._fsp--;
value = quoted_string4;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return value;
} } | public class class_name {
public final String input() throws RecognitionException {
String value = null;
String unquoted_string3 =null;
String quoted_string4 =null;
try {
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:87:3: ( unquoted_string | quoted_string )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==STRING) ) {
alt6=1; // depends on control dependency: [if], data = [none]
}
else if ( ((LA6_0 >= STRING_WITH_QUOTE && LA6_0 <= STRING_WITH_QUOTE_DOUBLE)) ) {
alt6=2; // depends on control dependency: [if], data = [none]
}
else {
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:87:5: unquoted_string
{
pushFollow(FOLLOW_unquoted_string_in_input238);
unquoted_string3=unquoted_string();
state._fsp--;
value = unquoted_string3;
}
break;
case 2 :
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:88:5: quoted_string
{
pushFollow(FOLLOW_quoted_string_in_input246);
quoted_string4=quoted_string();
state._fsp--;
value = quoted_string4;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return value;
} } |
public class class_name {
private static void callback(long handle, String docID, long sequence) {
final C4DocumentObserver obs = REVERSE_LOOKUP_TABLE.get(handle);
if (obs != null && obs.listener != null) { obs.listener.callback(obs, docID, sequence, obs.context); }
} } | public class class_name {
private static void callback(long handle, String docID, long sequence) {
final C4DocumentObserver obs = REVERSE_LOOKUP_TABLE.get(handle);
if (obs != null && obs.listener != null) { obs.listener.callback(obs, docID, sequence, obs.context); } // depends on control dependency: [if], data = [(obs]
} } |
public class class_name {
@Override
protected void initialize() {
super.initialize();
ClientLayerTreeInfo ltwli = (ClientLayerTreeInfo) mapWidget.getMapModel().getMapInfo()
.getWidgetInfo(ClientLayerTreeInfo.IDENTIFIER);
setIconSize(ltwli == null ? GltLayout.layerTreeIconSize : ltwli.getIconSize());
for (Layer<?> layer : mapModel.getLayers()) {
registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() {
public void onLabelChange(LayerLabeledEvent event) {
GWT.log("Legend: onLabelChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon();
}
}
}
public void onVisibleChange(LayerShownEvent event) {
GWT.log("Legend: onVisibleChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon();
}
}
}
}));
registrations.add(layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() {
public void onLayerStyleChange(LayerStyleChangeEvent event) {
GWT.log("Legend: onLayerStyleChange()");
Layer<?> layer = event.getLayer();
if (layer instanceof VectorLayer) {
for (LayerTreeLegendItemNode node : legendIcons.get(layer)) {
node.updateStyle((VectorLayer) layer);
}
}
}
}));
if (layer instanceof VectorLayer) {
VectorLayer vl = (VectorLayer) layer;
registrations.add(vl.addLayerFilteredHandler(new LayerFilteredHandler() {
public void onFilterChange(LayerFilteredEvent event) {
GWT.log("Legend: onLayerFilterChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel())
&& node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon();
}
}
}
}));
}
}
} } | public class class_name {
@Override
protected void initialize() {
super.initialize();
ClientLayerTreeInfo ltwli = (ClientLayerTreeInfo) mapWidget.getMapModel().getMapInfo()
.getWidgetInfo(ClientLayerTreeInfo.IDENTIFIER);
setIconSize(ltwli == null ? GltLayout.layerTreeIconSize : ltwli.getIconSize());
for (Layer<?> layer : mapModel.getLayers()) {
registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() {
public void onLabelChange(LayerLabeledEvent event) {
GWT.log("Legend: onLabelChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon(); // depends on control dependency: [if], data = [none]
}
}
}
public void onVisibleChange(LayerShownEvent event) {
GWT.log("Legend: onVisibleChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel()) && node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon(); // depends on control dependency: [if], data = [none]
}
}
}
})); // depends on control dependency: [for], data = [none]
registrations.add(layer.addLayerStyleChangedHandler(new LayerStyleChangedHandler() {
public void onLayerStyleChange(LayerStyleChangeEvent event) {
GWT.log("Legend: onLayerStyleChange()");
Layer<?> layer = event.getLayer();
if (layer instanceof VectorLayer) {
for (LayerTreeLegendItemNode node : legendIcons.get(layer)) {
node.updateStyle((VectorLayer) layer); // depends on control dependency: [for], data = [node]
}
}
}
})); // depends on control dependency: [for], data = [none]
if (layer instanceof VectorLayer) {
VectorLayer vl = (VectorLayer) layer;
registrations.add(vl.addLayerFilteredHandler(new LayerFilteredHandler() {
public void onFilterChange(LayerFilteredEvent event) {
GWT.log("Legend: onLayerFilterChange() - " + event.getLayer().getLabel());
// find the node & update the icon
for (TreeNode node : tree.getAllNodes()) {
if (node.getName().equals(event.getLayer().getLabel())
&& node instanceof LayerTreeTreeNode) {
((LayerTreeTreeNode) node).updateIcon(); // depends on control dependency: [if], data = [none]
}
}
}
})); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static boolean isFile(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isRegularFile(path, options);
} } | public class class_name {
public static boolean isFile(Path path, boolean isFollowLinks) {
if (null == path) {
return false;
// depends on control dependency: [if], data = [none]
}
final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
return Files.isRegularFile(path, options);
} } |
public class class_name {
public void marshall(ProviderDescription providerDescription, ProtocolMarshaller protocolMarshaller) {
if (providerDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(providerDescription.getProviderName(), PROVIDERNAME_BINDING);
protocolMarshaller.marshall(providerDescription.getProviderType(), PROVIDERTYPE_BINDING);
protocolMarshaller.marshall(providerDescription.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(providerDescription.getCreationDate(), CREATIONDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ProviderDescription providerDescription, ProtocolMarshaller protocolMarshaller) {
if (providerDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(providerDescription.getProviderName(), PROVIDERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(providerDescription.getProviderType(), PROVIDERTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(providerDescription.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(providerDescription.getCreationDate(), CREATIONDATE_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 String convertToLevel3(final String biopaxData) {
String toReturn = "";
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream is = new ByteArrayInputStream(biopaxData.getBytes());
SimpleIOHandler io = new SimpleIOHandler();
io.mergeDuplicates(true);
Model model = io.convertFromOWL(is);
if (model.getLevel() != BioPAXLevel.L3) {
log.info("Converting to BioPAX Level3... " + model.getXmlBase());
model = (new LevelUpgrader()).filter(model);
if (model != null) {
io.setFactory(model.getLevel().getDefaultFactory());
io.convertToOWL(model, os);
toReturn = os.toString();
}
} else {
toReturn = biopaxData;
}
} catch(Exception e) {
throw new RuntimeException(
"Cannot convert to BioPAX Level3", e);
}
return toReturn;
} } | public class class_name {
public static String convertToLevel3(final String biopaxData) {
String toReturn = "";
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
InputStream is = new ByteArrayInputStream(biopaxData.getBytes());
SimpleIOHandler io = new SimpleIOHandler();
io.mergeDuplicates(true); // depends on control dependency: [try], data = [none]
Model model = io.convertFromOWL(is);
if (model.getLevel() != BioPAXLevel.L3) {
log.info("Converting to BioPAX Level3... " + model.getXmlBase()); // depends on control dependency: [if], data = [none]
model = (new LevelUpgrader()).filter(model); // depends on control dependency: [if], data = [none]
if (model != null) {
io.setFactory(model.getLevel().getDefaultFactory()); // depends on control dependency: [if], data = [(model]
io.convertToOWL(model, os); // depends on control dependency: [if], data = [(model]
toReturn = os.toString(); // depends on control dependency: [if], data = [none]
}
} else {
toReturn = biopaxData; // depends on control dependency: [if], data = [none]
}
} catch(Exception e) {
throw new RuntimeException(
"Cannot convert to BioPAX Level3", e);
} // depends on control dependency: [catch], data = [none]
return toReturn;
} } |
public class class_name {
protected void endTransaction(final Transaction tx) {
ContextTransactionManager tm = ContextTransactionManager.getInstance();
try {
if (! tx.equals(tm.getTransaction())) {
throw EjbLogger.ROOT_LOGGER.wrongTxOnThread(tx, tm.getTransaction());
}
final int txStatus = tx.getStatus();
if (txStatus == Status.STATUS_ACTIVE) {
// Commit tx
// This will happen if
// a) everything goes well
// b) app. exception was thrown
tm.commit();
} else if (txStatus == Status.STATUS_MARKED_ROLLBACK) {
tm.rollback();
} else if (txStatus == Status.STATUS_ROLLEDBACK || txStatus == Status.STATUS_ROLLING_BACK) {
// handle reaper canceled (rolled back) tx case (see WFLY-1346)
// clear current tx state and throw RollbackException (EJBTransactionRolledbackException)
tm.rollback();
throw EjbLogger.ROOT_LOGGER.transactionAlreadyRolledBack(tx);
} else if (txStatus == Status.STATUS_UNKNOWN) {
// STATUS_UNKNOWN isn't expected to be reached here but if it does, we need to clear current thread tx.
// It is possible that calling tm.commit() could succeed but we call tm.rollback, since this is an unexpected
// tx state that are are handling.
tm.rollback();
// if the tm.rollback doesn't fail, we throw an EJBException to reflect the unexpected tx state.
throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus));
} else {
// logically, all of the following (unexpected) tx states are handled here:
// Status.STATUS_PREPARED
// Status.STATUS_PREPARING
// Status.STATUS_COMMITTING
// Status.STATUS_NO_TRANSACTION
// Status.STATUS_COMMITTED
tm.suspend(); // clear current tx state and throw EJBException
throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus));
}
} catch (RollbackException e) {
throw new EJBTransactionRolledbackException(e.toString(), e);
} catch (HeuristicMixedException | SystemException | HeuristicRollbackException e) {
throw new EJBException(e);
}
} } | public class class_name {
protected void endTransaction(final Transaction tx) {
ContextTransactionManager tm = ContextTransactionManager.getInstance();
try {
if (! tx.equals(tm.getTransaction())) {
throw EjbLogger.ROOT_LOGGER.wrongTxOnThread(tx, tm.getTransaction());
}
final int txStatus = tx.getStatus();
if (txStatus == Status.STATUS_ACTIVE) {
// Commit tx
// This will happen if
// a) everything goes well
// b) app. exception was thrown
tm.commit(); // depends on control dependency: [if], data = [none]
} else if (txStatus == Status.STATUS_MARKED_ROLLBACK) {
tm.rollback(); // depends on control dependency: [if], data = [none]
} else if (txStatus == Status.STATUS_ROLLEDBACK || txStatus == Status.STATUS_ROLLING_BACK) {
// handle reaper canceled (rolled back) tx case (see WFLY-1346)
// clear current tx state and throw RollbackException (EJBTransactionRolledbackException)
tm.rollback(); // depends on control dependency: [if], data = [none]
throw EjbLogger.ROOT_LOGGER.transactionAlreadyRolledBack(tx);
} else if (txStatus == Status.STATUS_UNKNOWN) {
// STATUS_UNKNOWN isn't expected to be reached here but if it does, we need to clear current thread tx.
// It is possible that calling tm.commit() could succeed but we call tm.rollback, since this is an unexpected
// tx state that are are handling.
tm.rollback(); // depends on control dependency: [if], data = [none]
// if the tm.rollback doesn't fail, we throw an EJBException to reflect the unexpected tx state.
throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus));
} else {
// logically, all of the following (unexpected) tx states are handled here:
// Status.STATUS_PREPARED
// Status.STATUS_PREPARING
// Status.STATUS_COMMITTING
// Status.STATUS_NO_TRANSACTION
// Status.STATUS_COMMITTED
tm.suspend(); // clear current tx state and throw EJBException // depends on control dependency: [if], data = [none]
throw EjbLogger.ROOT_LOGGER.transactionInUnexpectedState(tx, statusAsString(txStatus));
}
} catch (RollbackException e) {
throw new EJBTransactionRolledbackException(e.toString(), e);
} catch (HeuristicMixedException | SystemException | HeuristicRollbackException e) { // depends on control dependency: [catch], data = [none]
throw new EJBException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(GetBundlesRequest getBundlesRequest, ProtocolMarshaller protocolMarshaller) {
if (getBundlesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBundlesRequest.getIncludeInactive(), INCLUDEINACTIVE_BINDING);
protocolMarshaller.marshall(getBundlesRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetBundlesRequest getBundlesRequest, ProtocolMarshaller protocolMarshaller) {
if (getBundlesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBundlesRequest.getIncludeInactive(), INCLUDEINACTIVE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getBundlesRequest.getPageToken(), PAGETOKEN_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 ExchangeAttribute parse(final String valueString) {
final List<ExchangeAttribute> attributes = new ArrayList<>();
int pos = 0;
int state = 0; //0 = literal, 1 = %, 2 = %{, 3 = $, 4 = ${
for (int i = 0; i < valueString.length(); ++i) {
char c = valueString.charAt(i);
switch (state) {
case 0: {
if (c == '%' || c == '$') {
if (pos != i) {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i))));
pos = i;
}
if (c == '%') {
state = 1;
} else {
state = 3;
}
}
break;
}
case 1: {
if (c == '{') {
state = 2;
} else if (c == '%') {
//literal percent
attributes.add(wrap(new ConstantExchangeAttribute("%")));
pos = i + 1;
state = 0;
} else {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1))));
pos = i + 1;
state = 0;
}
break;
}
case 2: {
if (c == '}') {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1))));
pos = i + 1;
state = 0;
}
break;
}
case 3: {
if (c == '{') {
state = 4;
} else if (c == '$') {
//literal dollars
attributes.add(wrap(new ConstantExchangeAttribute("$")));
pos = i + 1;
state = 0;
} else {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1))));
pos = i + 1;
state = 0;
}
break;
}
case 4: {
if (c == '}') {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1))));
pos = i + 1;
state = 0;
}
break;
}
}
}
switch (state) {
case 0:
case 1:
case 3:{
if(pos != valueString.length()) {
attributes.add(wrap(parseSingleToken(valueString.substring(pos))));
}
break;
}
case 2:
case 4: {
throw UndertowMessages.MESSAGES.mismatchedBraces(valueString);
}
}
if(attributes.size() == 1) {
return attributes.get(0);
}
return new CompositeExchangeAttribute(attributes.toArray(new ExchangeAttribute[attributes.size()]));
} } | public class class_name {
public ExchangeAttribute parse(final String valueString) {
final List<ExchangeAttribute> attributes = new ArrayList<>();
int pos = 0;
int state = 0; //0 = literal, 1 = %, 2 = %{, 3 = $, 4 = ${
for (int i = 0; i < valueString.length(); ++i) {
char c = valueString.charAt(i);
switch (state) {
case 0: {
if (c == '%' || c == '$') {
if (pos != i) {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i)))); // depends on control dependency: [if], data = [(pos]
pos = i; // depends on control dependency: [if], data = [none]
}
if (c == '%') {
state = 1; // depends on control dependency: [if], data = [none]
} else {
state = 3; // depends on control dependency: [if], data = [none]
}
}
break;
}
case 1: {
if (c == '{') {
state = 2; // depends on control dependency: [if], data = [none]
} else if (c == '%') {
//literal percent
attributes.add(wrap(new ConstantExchangeAttribute("%"))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
} else {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
}
break;
}
case 2: {
if (c == '}') {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
}
break;
}
case 3: {
if (c == '{') {
state = 4; // depends on control dependency: [if], data = [none]
} else if (c == '$') {
//literal dollars
attributes.add(wrap(new ConstantExchangeAttribute("$"))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
} else {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
}
break;
}
case 4: {
if (c == '}') {
attributes.add(wrap(parseSingleToken(valueString.substring(pos, i + 1)))); // depends on control dependency: [if], data = [none]
pos = i + 1; // depends on control dependency: [if], data = [none]
state = 0; // depends on control dependency: [if], data = [none]
}
break;
}
}
}
switch (state) {
case 0:
case 1:
case 3:{
if(pos != valueString.length()) {
attributes.add(wrap(parseSingleToken(valueString.substring(pos)))); // depends on control dependency: [if], data = [(pos]
}
break;
}
case 2:
case 4: {
throw UndertowMessages.MESSAGES.mismatchedBraces(valueString);
}
}
if(attributes.size() == 1) {
return attributes.get(0); // depends on control dependency: [if], data = [none]
}
return new CompositeExchangeAttribute(attributes.toArray(new ExchangeAttribute[attributes.size()]));
} } |
public class class_name {
public java.util.List<VpcCidrBlockAssociation> getCidrBlockAssociationSet() {
if (cidrBlockAssociationSet == null) {
cidrBlockAssociationSet = new com.amazonaws.internal.SdkInternalList<VpcCidrBlockAssociation>();
}
return cidrBlockAssociationSet;
} } | public class class_name {
public java.util.List<VpcCidrBlockAssociation> getCidrBlockAssociationSet() {
if (cidrBlockAssociationSet == null) {
cidrBlockAssociationSet = new com.amazonaws.internal.SdkInternalList<VpcCidrBlockAssociation>(); // depends on control dependency: [if], data = [none]
}
return cidrBlockAssociationSet;
} } |
public class class_name {
public void requestAfterExplanation(@NonNull String permissionName) {
if (isPermissionDeclined(permissionName)) {
ActivityCompat.requestPermissions(context, new String[]{permissionName}, REQUEST_PERMISSIONS);
} else {
permissionCallback.onPermissionPreGranted(permissionName);
}
} } | public class class_name {
public void requestAfterExplanation(@NonNull String permissionName) {
if (isPermissionDeclined(permissionName)) {
ActivityCompat.requestPermissions(context, new String[]{permissionName}, REQUEST_PERMISSIONS); // depends on control dependency: [if], data = [none]
} else {
permissionCallback.onPermissionPreGranted(permissionName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID"));
calendar.setName(row.getString("NAME"));
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY"));
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY"));
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY"));
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY"));
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY"));
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY"));
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY"));
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day);
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent);
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID"));
m_eventManager.fireCalendarReadEvent(child);
}
} } | public class class_name {
private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID")); // depends on control dependency: [for], data = [row]
calendar.setName(row.getString("NAME")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY")); // depends on control dependency: [for], data = [row]
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY")); // depends on control dependency: [for], data = [row]
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day); // depends on control dependency: [if], data = [none]
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent); // depends on control dependency: [if], data = [none]
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID")); // depends on control dependency: [for], data = [row]
m_eventManager.fireCalendarReadEvent(child); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override
protected NodePropBundle loadBundle(NodeId id) throws ItemStateException {
try {
ResultSet rs =
conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
try {
if (rs != null && rs.next()) {
return readBundle(id, rs, 1);
} else {
return null;
}
} finally {
if (rs != null) {
rs.close();
}
}
} catch (SQLException e) {
String msg = "failed to read bundle (stacktrace on DEBUG log level): " + id + ": " + e;
log.error(msg);
log.debug("failed to read bundle: " + id, e);
throw new ItemStateException(msg, e);
}
} } | public class class_name {
@Override
protected NodePropBundle loadBundle(NodeId id) throws ItemStateException {
try {
ResultSet rs =
conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
try {
if (rs != null && rs.next()) {
return readBundle(id, rs, 1); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} finally {
if (rs != null) {
rs.close(); // depends on control dependency: [if], data = [none]
}
}
} catch (SQLException e) {
String msg = "failed to read bundle (stacktrace on DEBUG log level): " + id + ": " + e;
log.error(msg);
log.debug("failed to read bundle: " + id, e);
throw new ItemStateException(msg, e);
}
} } |
public class class_name {
public static String filterNormalizeMediaUri(String value) {
if (EscapingConventions.FilterNormalizeMediaUri.INSTANCE
.getValueFilter()
.matcher(value)
.find()) {
return EscapingConventions.FilterNormalizeMediaUri.INSTANCE.escape(value);
}
logger.log(Level.WARNING, "|filterNormalizeMediaUri received bad value ''{0}''", value);
return EscapingConventions.FilterNormalizeMediaUri.INSTANCE.getInnocuousOutput();
} } | public class class_name {
public static String filterNormalizeMediaUri(String value) {
if (EscapingConventions.FilterNormalizeMediaUri.INSTANCE
.getValueFilter()
.matcher(value)
.find()) {
return EscapingConventions.FilterNormalizeMediaUri.INSTANCE.escape(value); // depends on control dependency: [if], data = [none]
}
logger.log(Level.WARNING, "|filterNormalizeMediaUri received bad value ''{0}''", value);
return EscapingConventions.FilterNormalizeMediaUri.INSTANCE.getInnocuousOutput();
} } |
public class class_name {
public double get(long i) {
if (i < 0 || i >= idxAfterLast) {
return missingEntries;
}
return elements[SafeCast.safeLongToInt(i)];
} } | public class class_name {
public double get(long i) {
if (i < 0 || i >= idxAfterLast) {
return missingEntries; // depends on control dependency: [if], data = [none]
}
return elements[SafeCast.safeLongToInt(i)];
} } |
public class class_name {
Motion selectCoordinateBase(View view ) {
double bestScore = 0;
Motion best = null;
if( verbose != null )
verbose.println("selectCoordinateBase");
for (int i = 0; i < view.connections.size(); i++) {
Motion e = view.connections.get(i);
double s = e.scoreTriangulation();
if( verbose != null )
verbose.printf(" [%2d] score = %s\n",i,s);
if( s > bestScore ) {
bestScore = s;
best = e;
}
}
return best;
} } | public class class_name {
Motion selectCoordinateBase(View view ) {
double bestScore = 0;
Motion best = null;
if( verbose != null )
verbose.println("selectCoordinateBase");
for (int i = 0; i < view.connections.size(); i++) {
Motion e = view.connections.get(i);
double s = e.scoreTriangulation();
if( verbose != null )
verbose.printf(" [%2d] score = %s\n",i,s);
if( s > bestScore ) {
bestScore = s; // depends on control dependency: [if], data = [none]
best = e; // depends on control dependency: [if], data = [none]
}
}
return best;
} } |
public class class_name {
public void marshall(ProblemDetail problemDetail, ProtocolMarshaller protocolMarshaller) {
if (problemDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(problemDetail.getArn(), ARN_BINDING);
protocolMarshaller.marshall(problemDetail.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ProblemDetail problemDetail, ProtocolMarshaller protocolMarshaller) {
if (problemDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(problemDetail.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problemDetail.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void clearCaches() {
try {
FSTInputStream.cachedBuffer.set(null);
while (!cacheLock.compareAndSet(false, true)) {
// empty
}
cachedObjects.clear();
} finally {
cacheLock.set( false );
}
} } | public class class_name {
public void clearCaches() {
try {
FSTInputStream.cachedBuffer.set(null); // depends on control dependency: [try], data = [none]
while (!cacheLock.compareAndSet(false, true)) {
// empty
}
cachedObjects.clear(); // depends on control dependency: [try], data = [none]
} finally {
cacheLock.set( false );
}
} } |
public class class_name {
private void applySettings() {
// reset the container.
container.reset();
// create the new collapsible.
WText component1 = new WText("Here is some text that is collapsible via ajax.");
WCollapsible collapsible1 = new WCollapsible(component1, "Collapsible",
(CollapsibleMode) rbCollapsibleSelect.getSelected());
collapsible1.setCollapsed(cbCollapsed.isSelected());
collapsible1.setVisible(cbVisible.isSelected());
if (collapsible1.getMode() == CollapsibleMode.DYNAMIC) {
component1.setText(component1.getText() + "\u00a0Generated on " + new Date());
}
if (drpHeadingLevels.getSelected() != null) {
collapsible1.setHeadingLevel((HeadingLevel) drpHeadingLevels.getSelected());
}
// add the new collapsible to the container.
container.add(collapsible1);
} } | public class class_name {
private void applySettings() {
// reset the container.
container.reset();
// create the new collapsible.
WText component1 = new WText("Here is some text that is collapsible via ajax.");
WCollapsible collapsible1 = new WCollapsible(component1, "Collapsible",
(CollapsibleMode) rbCollapsibleSelect.getSelected());
collapsible1.setCollapsed(cbCollapsed.isSelected());
collapsible1.setVisible(cbVisible.isSelected());
if (collapsible1.getMode() == CollapsibleMode.DYNAMIC) {
component1.setText(component1.getText() + "\u00a0Generated on " + new Date()); // depends on control dependency: [if], data = [none]
}
if (drpHeadingLevels.getSelected() != null) {
collapsible1.setHeadingLevel((HeadingLevel) drpHeadingLevels.getSelected()); // depends on control dependency: [if], data = [none]
}
// add the new collapsible to the container.
container.add(collapsible1);
} } |
public class class_name {
@Override
protected void doPerform() {
WebElement source = isSourceDocumentRoot() ? null : getFirstElement();
if (offset != null) {
Point offsetPoint = offset.offset(getSize());
getActions().moveToElement(source, offsetPoint.x(), offsetPoint.y()).perform();
} else {
getActions().moveToElement(source).perform();
}
} } | public class class_name {
@Override
protected void doPerform() {
WebElement source = isSourceDocumentRoot() ? null : getFirstElement();
if (offset != null) {
Point offsetPoint = offset.offset(getSize());
getActions().moveToElement(source, offsetPoint.x(), offsetPoint.y()).perform(); // depends on control dependency: [if], data = [none]
} else {
getActions().moveToElement(source).perform(); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.