code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static void setInvocationHandlerStatic(Object proxy, InvocationHandler handler) {
try {
final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD);
AccessController.doPrivileged(new SetAccessiblePrivilege(field));
field.set(proxy, handler);
} catch (NoSuchFieldException e) {
throw new RuntimeException("Could not find invocation handler on generated proxy", e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static void setInvocationHandlerStatic(Object proxy, InvocationHandler handler) {
try {
final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD);
AccessController.doPrivileged(new SetAccessiblePrivilege(field)); // depends on control dependency: [try], data = [none]
field.set(proxy, handler); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
throw new RuntimeException("Could not find invocation handler on generated proxy", e);
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int intLogBase2v3(int value)
{
int result = 0;
if ((value & LOG2_V3_BRANCH_VALUES[4]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[4];
result |= LOG2_V3_SHIFT_VALUES[4];
}
if ((value & LOG2_V3_BRANCH_VALUES[3]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[3];
result |= LOG2_V3_SHIFT_VALUES[3];
}
if ((value & LOG2_V3_BRANCH_VALUES[2]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[2];
result |= LOG2_V3_SHIFT_VALUES[2];
}
if ((value & LOG2_V3_BRANCH_VALUES[1]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[1];
result |= LOG2_V3_SHIFT_VALUES[1];
}
if ((value & LOG2_V3_BRANCH_VALUES[0]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[0];
result |= LOG2_V3_SHIFT_VALUES[0];
}
return result;
} } | public class class_name {
public static int intLogBase2v3(int value)
{
int result = 0;
if ((value & LOG2_V3_BRANCH_VALUES[4]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[4]; // depends on control dependency: [if], data = [none]
result |= LOG2_V3_SHIFT_VALUES[4]; // depends on control dependency: [if], data = [none]
}
if ((value & LOG2_V3_BRANCH_VALUES[3]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[3]; // depends on control dependency: [if], data = [none]
result |= LOG2_V3_SHIFT_VALUES[3]; // depends on control dependency: [if], data = [none]
}
if ((value & LOG2_V3_BRANCH_VALUES[2]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[2]; // depends on control dependency: [if], data = [none]
result |= LOG2_V3_SHIFT_VALUES[2]; // depends on control dependency: [if], data = [none]
}
if ((value & LOG2_V3_BRANCH_VALUES[1]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[1]; // depends on control dependency: [if], data = [none]
result |= LOG2_V3_SHIFT_VALUES[1]; // depends on control dependency: [if], data = [none]
}
if ((value & LOG2_V3_BRANCH_VALUES[0]) > 0)
{
value >>= LOG2_V3_SHIFT_VALUES[0]; // depends on control dependency: [if], data = [none]
result |= LOG2_V3_SHIFT_VALUES[0]; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static boolean isCompatIPv4Address(Inet6Address ip) {
if (!ip.isIPv4CompatibleAddress()) {
return false;
}
byte[] bytes = ip.getAddress();
if ((bytes[12] == 0)
&& (bytes[13] == 0)
&& (bytes[14] == 0)
&& ((bytes[15] == 0) || (bytes[15] == 1))) {
return false;
}
return true;
} } | public class class_name {
public static boolean isCompatIPv4Address(Inet6Address ip) {
if (!ip.isIPv4CompatibleAddress()) {
return false; // depends on control dependency: [if], data = [none]
}
byte[] bytes = ip.getAddress();
if ((bytes[12] == 0)
&& (bytes[13] == 0)
&& (bytes[14] == 0)
&& ((bytes[15] == 0) || (bytes[15] == 1))) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public Enumeration tableKeys() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "tableKeys", appNameForLogging);
}
Set keys = (_sessions != null) ? _sessions.keySet() : (new HashMap(1)).keySet();
final Iterator iter = keys.iterator();
return new Enumeration() {
@Override
public boolean hasMoreElements() {
return iter.hasNext();
}
@Override
public Object nextElement() {
return iter.next();
}
};
} } | public class class_name {
public Enumeration tableKeys() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "tableKeys", appNameForLogging); // depends on control dependency: [if], data = [none]
}
Set keys = (_sessions != null) ? _sessions.keySet() : (new HashMap(1)).keySet();
final Iterator iter = keys.iterator();
return new Enumeration() {
@Override
public boolean hasMoreElements() {
return iter.hasNext();
}
@Override
public Object nextElement() {
return iter.next();
}
};
} } |
public class class_name {
void setInterval(String interval) {
final int i = CmsSerialDateUtil.toIntWithDefault(interval, -1);
if (m_model.getInterval() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setInterval(i);
onValueChange();
}
});
}
} } | public class class_name {
void setInterval(String interval) {
final int i = CmsSerialDateUtil.toIntWithDefault(interval, -1);
if (m_model.getInterval() != i) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setInterval(i);
onValueChange();
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void scanJarFile(final File file) {
final ZipFile zipFile;
try {
zipFile = new ZipFile(file);
} catch (IOException ioex) {
if (!ignoreException) {
throw new FindFileException("Invalid zip: " + file.getName(), ioex);
}
return;
}
final Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()) {
final ZipEntry zipEntry = (ZipEntry) entries.nextElement();
final String zipEntryName = zipEntry.getName();
try {
if (StringUtil.endsWithIgnoreCase(zipEntryName, CLASS_FILE_EXT)) {
final String entryName = prepareEntryName(zipEntryName, true);
final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
try {
scanEntry(classPathEntry);
} finally {
classPathEntry.closeInputStream();
}
} else if (includeResources) {
final String entryName = prepareEntryName(zipEntryName, false);
final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
try {
scanEntry(classPathEntry);
} finally {
classPathEntry.closeInputStream();
}
}
} catch (RuntimeException rex) {
if (!ignoreException) {
ZipUtil.close(zipFile);
throw rex;
}
}
}
ZipUtil.close(zipFile);
} } | public class class_name {
protected void scanJarFile(final File file) {
final ZipFile zipFile;
try {
zipFile = new ZipFile(file); // depends on control dependency: [try], data = [none]
} catch (IOException ioex) {
if (!ignoreException) {
throw new FindFileException("Invalid zip: " + file.getName(), ioex);
}
return;
} // depends on control dependency: [catch], data = [none]
final Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()) {
final ZipEntry zipEntry = (ZipEntry) entries.nextElement();
final String zipEntryName = zipEntry.getName();
try {
if (StringUtil.endsWithIgnoreCase(zipEntryName, CLASS_FILE_EXT)) {
final String entryName = prepareEntryName(zipEntryName, true);
final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
try {
scanEntry(classPathEntry); // depends on control dependency: [try], data = [none]
} finally {
classPathEntry.closeInputStream();
}
} else if (includeResources) {
final String entryName = prepareEntryName(zipEntryName, false);
final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
try {
scanEntry(classPathEntry); // depends on control dependency: [try], data = [none]
} finally {
classPathEntry.closeInputStream();
}
}
} catch (RuntimeException rex) {
if (!ignoreException) {
ZipUtil.close(zipFile); // depends on control dependency: [if], data = [none]
throw rex;
}
} // depends on control dependency: [catch], data = [none]
}
ZipUtil.close(zipFile);
} } |
public class class_name {
public boolean tryEnter(Object obj) {
if (entered.containsKey(obj)) {
return false;
} else {
entered.put(obj, null);
return true;
}
} } | public class class_name {
public boolean tryEnter(Object obj) {
if (entered.containsKey(obj)) {
return false; // depends on control dependency: [if], data = [none]
} else {
entered.put(obj, null); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void main(String[] args) {
for (int round = 1; round <= 5; round++) {
Map<Long, Integer> deltaMsCount = new TreeMap<>();
Map<Long, Integer> deltaNsCount = new TreeMap<>();
System.out.println("\nRound: " + round);
long msChanges = 0;
long nsChanges = 0;
long initMs = System.currentTimeMillis();
long initNs = System.nanoTime();
long ms = initMs;
long ns = initNs;
for (int i = 0; i < LOOP; i++) {
long newMs = System.currentTimeMillis();
long newNs = System.nanoTime();
if (newMs != ms) {
long delta = newMs - ms;
Integer count = deltaMsCount.get(delta);
if (count == null) {
count = 0;
}
deltaMsCount.put(delta, ++count);
msChanges++;
}
if (newNs != ns) {
long delta = newNs - ns;
Integer count = deltaNsCount.get(delta);
if (count == null) {
count = 0;
}
deltaNsCount.put(delta, ++count);
nsChanges++;
}
ms = newMs;
ns = newNs;
}
System.out.println("msChanges: " + msChanges + " during " + (System.currentTimeMillis() - initMs) + " ms");
System.out.println("deltaMsCount = " + deltaMsCount);
System.out.println("nsChanges: " + nsChanges + " during " + (System.nanoTime() - initNs) + " ns");
System.out.println("deltaNsCount = " + deltaNsCount);
// now something else...
long msCount = 0;
initMs = System.currentTimeMillis();
while (true) {
long newMs = System.currentTimeMillis();
msCount++;
if (newMs - initMs >= MS_RUN) {
break;
}
}
System.out.println("currentTimeMillis msCount = " + msCount);
long nsCount = 0;
initMs = System.nanoTime() / 1000000;
while (true) {
long newMs = System.nanoTime() / 1000000;
nsCount++;
if (newMs - initMs >= MS_RUN) {
break;
}
}
System.out.println("nanoTime msCount = " + nsCount);
System.out.println("Ratio ms/ns: " + msCount / (double) nsCount);
}
for (int round = 1; round <= LOOP; round++) {
long ns1 = System.nanoTime();
long ns2 = System.nanoTime();
long ns3 = System.nanoTime();
long ns4 = System.nanoTime();
long ns5 = System.nanoTime();
if (round % (LOOP / 5) == 0) {
System.out.println("\nns1 = " + ns1);
System.out.println("ns2 = " + ns2 + " (diff: " + (ns2 - ns1) + ")");
System.out.println("ns3 = " + ns3 + " (diff: " + (ns3 - ns2) + ")");
System.out.println("ns4 = " + ns4 + " (diff: " + (ns4 - ns3) + ")");
System.out.println("ns5 = " + ns5 + " (diff: " + (ns5 - ns4) + ")");
}
}
System.out.println();
// last thing - we will count how many nanoTimes in a row will have the same value
for (int round = 1; round <= LOOP; round++) {
long val = System.nanoTime();
int count = 1;
while (val == System.nanoTime()) {
count++;
}
if (round % (LOOP / 5) == 0) {
System.out.println("Change after " + count + " calls");
}
}
} } | public class class_name {
public static void main(String[] args) {
for (int round = 1; round <= 5; round++) {
Map<Long, Integer> deltaMsCount = new TreeMap<>();
Map<Long, Integer> deltaNsCount = new TreeMap<>();
System.out.println("\nRound: " + round); // depends on control dependency: [for], data = [round]
long msChanges = 0;
long nsChanges = 0;
long initMs = System.currentTimeMillis();
long initNs = System.nanoTime();
long ms = initMs;
long ns = initNs;
for (int i = 0; i < LOOP; i++) {
long newMs = System.currentTimeMillis();
long newNs = System.nanoTime();
if (newMs != ms) {
long delta = newMs - ms;
Integer count = deltaMsCount.get(delta);
if (count == null) {
count = 0; // depends on control dependency: [if], data = [none]
}
deltaMsCount.put(delta, ++count); // depends on control dependency: [if], data = [none]
msChanges++; // depends on control dependency: [if], data = [none]
}
if (newNs != ns) {
long delta = newNs - ns;
Integer count = deltaNsCount.get(delta);
if (count == null) {
count = 0; // depends on control dependency: [if], data = [none]
}
deltaNsCount.put(delta, ++count); // depends on control dependency: [if], data = [none]
nsChanges++; // depends on control dependency: [if], data = [none]
}
ms = newMs; // depends on control dependency: [for], data = [none]
ns = newNs; // depends on control dependency: [for], data = [none]
}
System.out.println("msChanges: " + msChanges + " during " + (System.currentTimeMillis() - initMs) + " ms"); // depends on control dependency: [for], data = [none]
System.out.println("deltaMsCount = " + deltaMsCount); // depends on control dependency: [for], data = [none]
System.out.println("nsChanges: " + nsChanges + " during " + (System.nanoTime() - initNs) + " ns"); // depends on control dependency: [for], data = [none]
System.out.println("deltaNsCount = " + deltaNsCount); // depends on control dependency: [for], data = [none]
// now something else...
long msCount = 0;
initMs = System.currentTimeMillis(); // depends on control dependency: [for], data = [none]
while (true) {
long newMs = System.currentTimeMillis();
msCount++; // depends on control dependency: [while], data = [none]
if (newMs - initMs >= MS_RUN) {
break;
}
}
System.out.println("currentTimeMillis msCount = " + msCount); // depends on control dependency: [for], data = [none]
long nsCount = 0;
initMs = System.nanoTime() / 1000000; // depends on control dependency: [for], data = [none]
while (true) {
long newMs = System.nanoTime() / 1000000;
nsCount++; // depends on control dependency: [while], data = [none]
if (newMs - initMs >= MS_RUN) {
break;
}
}
System.out.println("nanoTime msCount = " + nsCount); // depends on control dependency: [for], data = [none]
System.out.println("Ratio ms/ns: " + msCount / (double) nsCount); // depends on control dependency: [for], data = [none]
}
for (int round = 1; round <= LOOP; round++) {
long ns1 = System.nanoTime();
long ns2 = System.nanoTime();
long ns3 = System.nanoTime();
long ns4 = System.nanoTime();
long ns5 = System.nanoTime();
if (round % (LOOP / 5) == 0) {
System.out.println("\nns1 = " + ns1);
System.out.println("ns2 = " + ns2 + " (diff: " + (ns2 - ns1) + ")");
System.out.println("ns3 = " + ns3 + " (diff: " + (ns3 - ns2) + ")");
System.out.println("ns4 = " + ns4 + " (diff: " + (ns4 - ns3) + ")");
System.out.println("ns5 = " + ns5 + " (diff: " + (ns5 - ns4) + ")");
}
}
System.out.println();
// last thing - we will count how many nanoTimes in a row will have the same value
for (int round = 1; round <= LOOP; round++) {
long val = System.nanoTime();
int count = 1;
while (val == System.nanoTime()) {
count++;
}
if (round % (LOOP / 5) == 0) {
System.out.println("Change after " + count + " calls");
}
}
} } |
public class class_name {
private boolean isRenditionMatchExtension(MediaFormat mediaFormat) {
for (String extension : mediaFormat.getExtensions()) {
if (FileExtension.isImage(extension)) {
return true;
}
}
return false;
} } | public class class_name {
private boolean isRenditionMatchExtension(MediaFormat mediaFormat) {
for (String extension : mediaFormat.getExtensions()) {
if (FileExtension.isImage(extension)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public UpdateUserRequest withGroups(String... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList<String>(groups.length));
}
for (String ele : groups) {
this.groups.add(ele);
}
return this;
} } | public class class_name {
public UpdateUserRequest withGroups(String... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList<String>(groups.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : groups) {
this.groups.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public List<ICommandBehavior> getDynamicCommands() {
final List<ICommandBehavior> result = new ArrayList<ICommandBehavior>();
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
result.add(cmdImpl.getBehavior());
}
return result;
} } | public class class_name {
public List<ICommandBehavior> getDynamicCommands() {
final List<ICommandBehavior> result = new ArrayList<ICommandBehavior>();
for (final CommandImpl cmdImpl : dynamicCommands.values()) {
result.add(cmdImpl.getBehavior()); // depends on control dependency: [for], data = [cmdImpl]
}
return result;
} } |
public class class_name {
public static Matcher<MethodTree> hasAnnotationOnAnyOverriddenMethod(
final String annotationClass) {
return new Matcher<MethodTree>() {
@Override
public boolean matches(MethodTree tree, VisitorState state) {
MethodSymbol methodSym = ASTHelpers.getSymbol(tree);
if (methodSym == null) {
return false;
}
if (ASTHelpers.hasAnnotation(methodSym, annotationClass, state)) {
return true;
}
for (MethodSymbol method : ASTHelpers.findSuperMethods(methodSym, state.getTypes())) {
if (ASTHelpers.hasAnnotation(method, annotationClass, state)) {
return true;
}
}
return false;
}
};
} } | public class class_name {
public static Matcher<MethodTree> hasAnnotationOnAnyOverriddenMethod(
final String annotationClass) {
return new Matcher<MethodTree>() {
@Override
public boolean matches(MethodTree tree, VisitorState state) {
MethodSymbol methodSym = ASTHelpers.getSymbol(tree);
if (methodSym == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (ASTHelpers.hasAnnotation(methodSym, annotationClass, state)) {
return true; // depends on control dependency: [if], data = [none]
}
for (MethodSymbol method : ASTHelpers.findSuperMethods(methodSym, state.getTypes())) {
if (ASTHelpers.hasAnnotation(method, annotationClass, state)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
}
};
} } |
public class class_name {
public boolean isPotentialGroupHead() {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_primaryResource.getRootPath());
if (site == null) {
return false;
}
Locale mainLocale = site.getMainTranslationLocale(null);
if (mainLocale == null) {
return false;
}
Locale primaryLocale = getMainLocale();
return mainLocale.equals(primaryLocale);
} } | public class class_name {
public boolean isPotentialGroupHead() {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(m_primaryResource.getRootPath());
if (site == null) {
return false; // depends on control dependency: [if], data = [none]
}
Locale mainLocale = site.getMainTranslationLocale(null);
if (mainLocale == null) {
return false; // depends on control dependency: [if], data = [none]
}
Locale primaryLocale = getMainLocale();
return mainLocale.equals(primaryLocale);
} } |
public class class_name {
private static Account authenticate(String userName, String storedPassword, String clientDigest, String nOnce, String nc,
String cnonce, String method, String uri, String qop, String realmName, String md5a2, Deployment deployment,
boolean storedPasswordIsA1Hash) {
CallbackHandlerPolicyContextHandler.setCallbackHandler(new DigestCallbackHandler(userName, nOnce, nc, cnonce, qop,
realmName, md5a2));
String serverDigest = "";
if (storedPasswordIsA1Hash) {
// storedPassword is HA1 in this case
serverDigest = MessageDigestResponseAlgorithm.calculateResponse(md5Helper.getAlgorithm(), storedPassword, nOnce,
nc, cnonce, method, uri, "", qop);
} else {
serverDigest = MessageDigestResponseAlgorithm.calculateResponse(md5Helper.getAlgorithm(), userName, realmName,
storedPassword, nOnce, nc, cnonce, method, uri, "", qop);
}
if (serverDigest.equals(clientDigest)) {
// lest's reauth with stored password (to force successful authentication) to make wildfly to create Account and
// Principal for us
// this is because wildfly bug: https://issues.jboss.org/browse/WFLY-3659
final IdentityManager identityManager = deployment.getDeploymentInfo().getIdentityManager();
PasswordCredential credential = new PasswordCredential(storedPassword.toCharArray());
Account account = identityManager.verify(userName, credential);
return account;
}
return null;
} } | public class class_name {
private static Account authenticate(String userName, String storedPassword, String clientDigest, String nOnce, String nc,
String cnonce, String method, String uri, String qop, String realmName, String md5a2, Deployment deployment,
boolean storedPasswordIsA1Hash) {
CallbackHandlerPolicyContextHandler.setCallbackHandler(new DigestCallbackHandler(userName, nOnce, nc, cnonce, qop,
realmName, md5a2));
String serverDigest = "";
if (storedPasswordIsA1Hash) {
// storedPassword is HA1 in this case
serverDigest = MessageDigestResponseAlgorithm.calculateResponse(md5Helper.getAlgorithm(), storedPassword, nOnce,
nc, cnonce, method, uri, "", qop); // depends on control dependency: [if], data = [none]
} else {
serverDigest = MessageDigestResponseAlgorithm.calculateResponse(md5Helper.getAlgorithm(), userName, realmName,
storedPassword, nOnce, nc, cnonce, method, uri, "", qop); // depends on control dependency: [if], data = [none]
}
if (serverDigest.equals(clientDigest)) {
// lest's reauth with stored password (to force successful authentication) to make wildfly to create Account and
// Principal for us
// this is because wildfly bug: https://issues.jboss.org/browse/WFLY-3659
final IdentityManager identityManager = deployment.getDeploymentInfo().getIdentityManager();
PasswordCredential credential = new PasswordCredential(storedPassword.toCharArray());
Account account = identityManager.verify(userName, credential);
return account; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void setText (String text) {
if (content instanceof VisLabel) {
((VisLabel) content).setText(text);
} else {
setContent(new VisLabel(text));
}
pack();
} } | public class class_name {
public void setText (String text) {
if (content instanceof VisLabel) {
((VisLabel) content).setText(text); // depends on control dependency: [if], data = [none]
} else {
setContent(new VisLabel(text)); // depends on control dependency: [if], data = [none]
}
pack();
} } |
public class class_name {
public void setPlaybackState(int state) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetPlayStateMethod.invoke(mActualRemoteControlClient, state);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} } | public class class_name {
public void setPlaybackState(int state) {
if (sHasRemoteControlAPIs) {
try {
sRCCSetPlayStateMethod.invoke(mActualRemoteControlClient, state); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
void findMinElementIndexInRows(int leftmost[] )
{
Arrays.fill(leftmost,0,m,-1);
// leftmost[i] = min(find(A(i,:)))
for (int k = n-1; k >= 0; k--) {
int idx0 = A.col_idx[k];
int idx1 = A.col_idx[k+1];
for( int p = idx0; p < idx1; p++ ) {
leftmost[A.nz_rows[p]] = k;
}
}
} } | public class class_name {
void findMinElementIndexInRows(int leftmost[] )
{
Arrays.fill(leftmost,0,m,-1);
// leftmost[i] = min(find(A(i,:)))
for (int k = n-1; k >= 0; k--) {
int idx0 = A.col_idx[k];
int idx1 = A.col_idx[k+1];
for( int p = idx0; p < idx1; p++ ) {
leftmost[A.nz_rows[p]] = k; // depends on control dependency: [for], data = [p]
}
}
} } |
public class class_name {
private boolean addIncomingInvokeId(Long invokeId) {
synchronized (this.incomingInvokeList) {
if (this.incomingInvokeList.contains(invokeId))
return false;
else {
this.incomingInvokeList.add(invokeId);
return true;
}
}
} } | public class class_name {
private boolean addIncomingInvokeId(Long invokeId) {
synchronized (this.incomingInvokeList) {
if (this.incomingInvokeList.contains(invokeId))
return false;
else {
this.incomingInvokeList.add(invokeId); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected CmsPair<String, List<I_CmsPreparedStatementParameter>> prepareVisitConditions(
CmsVisitEntryFilter filter) {
List<I_CmsPreparedStatementParameter> params = new ArrayList<I_CmsPreparedStatementParameter>();
StringBuffer conditions = new StringBuffer();
// user id filter
if (filter.getUserId() != null) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION);
} else {
conditions.append(BEGIN_INCLUDE_CONDITION);
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_USER_ID"));
params.add(new CmsPreparedStatementStringParameter(filter.getUserId().toString()));
conditions.append(END_CONDITION);
}
// resource id filter
if (filter.getStructureId() != null) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION);
} else {
conditions.append(BEGIN_INCLUDE_CONDITION);
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_STRUCTURE_ID"));
params.add(new CmsPreparedStatementStringParameter(filter.getStructureId().toString()));
conditions.append(END_CONDITION);
}
// date from filter
if (filter.getDateFrom() != CmsResource.DATE_RELEASED_DEFAULT) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION);
} else {
conditions.append(BEGIN_INCLUDE_CONDITION);
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_FROM"));
params.add(new CmsPreparedStatementLongParameter(filter.getDateFrom()));
conditions.append(END_CONDITION);
}
// date to filter
if (filter.getDateTo() != CmsResource.DATE_RELEASED_DEFAULT) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION);
} else {
conditions.append(BEGIN_INCLUDE_CONDITION);
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_TO"));
params.add(new CmsPreparedStatementLongParameter(filter.getDateTo()));
conditions.append(END_CONDITION);
}
return CmsPair.create(conditions.toString(), params);
} } | public class class_name {
protected CmsPair<String, List<I_CmsPreparedStatementParameter>> prepareVisitConditions(
CmsVisitEntryFilter filter) {
List<I_CmsPreparedStatementParameter> params = new ArrayList<I_CmsPreparedStatementParameter>();
StringBuffer conditions = new StringBuffer();
// user id filter
if (filter.getUserId() != null) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION); // depends on control dependency: [if], data = [none]
} else {
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_USER_ID")); // depends on control dependency: [if], data = [none]
params.add(new CmsPreparedStatementStringParameter(filter.getUserId().toString())); // depends on control dependency: [if], data = [(filter.getUserId()]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
}
// resource id filter
if (filter.getStructureId() != null) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION); // depends on control dependency: [if], data = [none]
} else {
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_STRUCTURE_ID")); // depends on control dependency: [if], data = [none]
params.add(new CmsPreparedStatementStringParameter(filter.getStructureId().toString())); // depends on control dependency: [if], data = [(filter.getStructureId()]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
}
// date from filter
if (filter.getDateFrom() != CmsResource.DATE_RELEASED_DEFAULT) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION); // depends on control dependency: [if], data = [none]
} else {
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_FROM")); // depends on control dependency: [if], data = [none]
params.add(new CmsPreparedStatementLongParameter(filter.getDateFrom())); // depends on control dependency: [if], data = [(filter.getDateFrom()]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
}
// date to filter
if (filter.getDateTo() != CmsResource.DATE_RELEASED_DEFAULT) {
if (conditions.length() == 0) {
conditions.append(BEGIN_CONDITION); // depends on control dependency: [if], data = [none]
} else {
conditions.append(BEGIN_INCLUDE_CONDITION); // depends on control dependency: [if], data = [none]
}
conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_TO")); // depends on control dependency: [if], data = [none]
params.add(new CmsPreparedStatementLongParameter(filter.getDateTo())); // depends on control dependency: [if], data = [(filter.getDateTo()]
conditions.append(END_CONDITION); // depends on control dependency: [if], data = [none]
}
return CmsPair.create(conditions.toString(), params);
} } |
public class class_name {
@Override
public void run() {
try {
this.delegate.run();
} catch (UndeclaredThrowableException ex) {
this.errorHandler.handleError(ex.getUndeclaredThrowable());
} catch (Throwable ex) {
this.errorHandler.handleError(ex);
}
} } | public class class_name {
@Override
public void run() {
try {
this.delegate.run(); // depends on control dependency: [try], data = [none]
} catch (UndeclaredThrowableException ex) {
this.errorHandler.handleError(ex.getUndeclaredThrowable());
} catch (Throwable ex) { // depends on control dependency: [catch], data = [none]
this.errorHandler.handleError(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@PostConstruct
public void runSetup() throws SetupException {
HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot());
try {
LOG.info("Trying to acquire lock for running setup.");
lock.acquire();
LOG.info("Acquired lock for running setup.");
handleSetupInProgress(configuration, zookeeperProperties);
for (SetupStep step : setupSteps) {
LOG.info("Running setup step: {}", step);
step.run();
}
clearSetupInProgress(zookeeperProperties);
} catch (SetupException se) {
LOG.error("Got setup exception while trying to setup", se);
throw se;
} catch (Throwable e) {
LOG.error("Error running setup steps", e);
throw new SetupException("Error running setup steps", e);
} finally {
releaseLock(lock);
curatorFactory.close();
}
} } | public class class_name {
@PostConstruct
public void runSetup() throws SetupException {
HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration);
InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot());
try {
LOG.info("Trying to acquire lock for running setup.");
lock.acquire();
LOG.info("Acquired lock for running setup.");
handleSetupInProgress(configuration, zookeeperProperties);
for (SetupStep step : setupSteps) {
LOG.info("Running setup step: {}", step); // depends on control dependency: [for], data = [step]
step.run(); // depends on control dependency: [for], data = [step]
}
clearSetupInProgress(zookeeperProperties);
} catch (SetupException se) {
LOG.error("Got setup exception while trying to setup", se);
throw se;
} catch (Throwable e) {
LOG.error("Error running setup steps", e);
throw new SetupException("Error running setup steps", e);
} finally {
releaseLock(lock);
curatorFactory.close();
}
} } |
public class class_name {
public StaticFactor addStaticConditionalFactor(int[] antecedents, int consequent,
int[] antecedentDimensions, int consequentDimension,
BiFunction<int[], Integer, Double> conditionalProbaility) {
// Create variables for the global factor
int[] allDimensions = new int[antecedentDimensions.length + 1];
System.arraycopy(antecedentDimensions, 0, allDimensions, 0, antecedentDimensions.length);
allDimensions[allDimensions.length - 1] = consequentDimension;
int[] allNeighbors = new int[antecedents.length + 1];
System.arraycopy(antecedents, 0, allNeighbors, 0, antecedents.length);
allNeighbors[allNeighbors.length - 1] = consequent;
NDArrayDoubles totalFactor = new NDArrayDoubles(allDimensions);
// Compute each conditional table
NDArrayDoubles antecedentOnly = new NDArrayDoubles(antecedentDimensions);
for (int[] assignment : antecedentOnly) {
double localPartitionFunction = 0.0;
for (int consequentValue = 0; consequentValue < consequentDimension; ++consequentValue) {
localPartitionFunction += conditionalProbaility.apply(assignment, consequentValue);
}
for (int consequentValue = 0; consequentValue < consequentDimension; ++consequentValue) {
int[] totalAssignment = new int[assignment.length + 1];
System.arraycopy(assignment, 0, totalAssignment, 0, assignment.length);
totalAssignment[totalAssignment.length - 1] = consequentValue;
totalFactor.setAssignmentValue(totalAssignment, Math.log(conditionalProbaility.apply(assignment, consequentValue)) - Math.log(localPartitionFunction));
}
}
// Create the joint factor
return addStaticFactor(totalFactor, allNeighbors);
} } | public class class_name {
public StaticFactor addStaticConditionalFactor(int[] antecedents, int consequent,
int[] antecedentDimensions, int consequentDimension,
BiFunction<int[], Integer, Double> conditionalProbaility) {
// Create variables for the global factor
int[] allDimensions = new int[antecedentDimensions.length + 1];
System.arraycopy(antecedentDimensions, 0, allDimensions, 0, antecedentDimensions.length);
allDimensions[allDimensions.length - 1] = consequentDimension;
int[] allNeighbors = new int[antecedents.length + 1];
System.arraycopy(antecedents, 0, allNeighbors, 0, antecedents.length);
allNeighbors[allNeighbors.length - 1] = consequent;
NDArrayDoubles totalFactor = new NDArrayDoubles(allDimensions);
// Compute each conditional table
NDArrayDoubles antecedentOnly = new NDArrayDoubles(antecedentDimensions);
for (int[] assignment : antecedentOnly) {
double localPartitionFunction = 0.0;
for (int consequentValue = 0; consequentValue < consequentDimension; ++consequentValue) {
localPartitionFunction += conditionalProbaility.apply(assignment, consequentValue); // depends on control dependency: [for], data = [consequentValue]
}
for (int consequentValue = 0; consequentValue < consequentDimension; ++consequentValue) {
int[] totalAssignment = new int[assignment.length + 1];
System.arraycopy(assignment, 0, totalAssignment, 0, assignment.length); // depends on control dependency: [for], data = [none]
totalAssignment[totalAssignment.length - 1] = consequentValue; // depends on control dependency: [for], data = [consequentValue]
totalFactor.setAssignmentValue(totalAssignment, Math.log(conditionalProbaility.apply(assignment, consequentValue)) - Math.log(localPartitionFunction)); // depends on control dependency: [for], data = [consequentValue]
}
}
// Create the joint factor
return addStaticFactor(totalFactor, allNeighbors);
} } |
public class class_name {
public XExpression getExpression(/* @Nullable */ JvmMember member) {
if(member != null) {
return logicalContainerProvider.getAssociatedExpression(member);
}
return null;
} } | public class class_name {
public XExpression getExpression(/* @Nullable */ JvmMember member) {
if(member != null) {
return logicalContainerProvider.getAssociatedExpression(member); // depends on control dependency: [if], data = [(member]
}
return null;
} } |
public class class_name {
private final boolean readCDataPrimary(char c)
throws XMLStreamException
{
mWsStatus = (c <= CHAR_SPACE) ? ALL_WS_UNKNOWN : ALL_WS_NO;
int ptr = mInputPtr;
int inputLen = mInputEnd;
char[] inputBuf = mInputBuffer;
int start = ptr-1;
while (true) {
if (c < CHAR_SPACE) {
if (c == '\n') {
markLF(ptr);
} else if (c == '\r') {
if (ptr >= inputLen) { // can't peek?
--ptr;
break;
}
if (mNormalizeLFs) { // can we do in-place Mac replacement?
if (inputBuf[ptr] == '\n') { // nope, 2 char lf
--ptr;
break;
}
inputBuf[ptr-1] = '\n'; // yup
} else {
// No LF normalization... can we just skip it?
if (inputBuf[ptr] == '\n') {
++ptr;
}
}
markLF(ptr);
} else if (c != '\t') {
throwInvalidSpace(c);
}
} else if (c == ']') {
// Ok; need to get one or more ']'s, then '>'
if ((ptr + 1) >= inputLen) { // not enough room? need to push it back
--ptr;
break;
}
// Needs to be followed by another ']'...
if (inputBuf[ptr] == ']') {
++ptr;
inner_loop:
while (true) {
if (ptr >= inputLen) {
/* Need to push back last 2 right brackets; it may
* be end marker divided by input buffer boundary
*/
ptr -= 2;
break inner_loop;
}
c = inputBuf[ptr++];
if (c == '>') { // Ok, got it!
mInputPtr = ptr;
ptr -= (start+3);
mTextBuffer.resetWithShared(inputBuf, start, ptr);
mTokenState = TOKEN_FULL_SINGLE;
return true;
}
if (c != ']') {
// Need to re-check this char (may be linefeed)
--ptr;
break inner_loop;
}
// Fall through to next round
}
}
}
if (ptr >= inputLen) { // end-of-buffer?
break;
}
c = inputBuf[ptr++];
}
mInputPtr = ptr;
/* If we end up here, we either ran out of input, or hit something
* which would leave 'holes' in buffer... fine, let's return then;
* we can still update shared buffer copy: would be too early to
* make a copy since caller may not even be interested in the
* stuff.
*/
int len = ptr - start;
mTextBuffer.resetWithShared(inputBuf, start, len);
if (mCfgCoalesceText ||
(mTextBuffer.size() < mShortestTextSegment)) {
mTokenState = TOKEN_STARTED;
} else {
mTokenState = TOKEN_PARTIAL_SINGLE;
}
return false;
} } | public class class_name {
private final boolean readCDataPrimary(char c)
throws XMLStreamException
{
mWsStatus = (c <= CHAR_SPACE) ? ALL_WS_UNKNOWN : ALL_WS_NO;
int ptr = mInputPtr;
int inputLen = mInputEnd;
char[] inputBuf = mInputBuffer;
int start = ptr-1;
while (true) {
if (c < CHAR_SPACE) {
if (c == '\n') {
markLF(ptr); // depends on control dependency: [if], data = [none]
} else if (c == '\r') {
if (ptr >= inputLen) { // can't peek?
--ptr; // depends on control dependency: [if], data = [none]
break;
}
if (mNormalizeLFs) { // can we do in-place Mac replacement?
if (inputBuf[ptr] == '\n') { // nope, 2 char lf
--ptr; // depends on control dependency: [if], data = [none]
break;
}
inputBuf[ptr-1] = '\n'; // yup // depends on control dependency: [if], data = [none]
} else {
// No LF normalization... can we just skip it?
if (inputBuf[ptr] == '\n') {
++ptr; // depends on control dependency: [if], data = [none]
}
}
markLF(ptr); // depends on control dependency: [if], data = [none]
} else if (c != '\t') {
throwInvalidSpace(c); // depends on control dependency: [if], data = [(c]
}
} else if (c == ']') {
// Ok; need to get one or more ']'s, then '>'
if ((ptr + 1) >= inputLen) { // not enough room? need to push it back
--ptr; // depends on control dependency: [if], data = [none]
break;
}
// Needs to be followed by another ']'...
if (inputBuf[ptr] == ']') {
++ptr; // depends on control dependency: [if], data = [none]
inner_loop:
while (true) {
if (ptr >= inputLen) {
/* Need to push back last 2 right brackets; it may
* be end marker divided by input buffer boundary
*/
ptr -= 2; // depends on control dependency: [if], data = [none]
break inner_loop;
}
c = inputBuf[ptr++]; // depends on control dependency: [while], data = [none]
if (c == '>') { // Ok, got it!
mInputPtr = ptr; // depends on control dependency: [if], data = [none]
ptr -= (start+3); // depends on control dependency: [if], data = [none]
mTextBuffer.resetWithShared(inputBuf, start, ptr); // depends on control dependency: [if], data = [none]
mTokenState = TOKEN_FULL_SINGLE; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (c != ']') {
// Need to re-check this char (may be linefeed)
--ptr; // depends on control dependency: [if], data = [none]
break inner_loop;
}
// Fall through to next round
}
}
}
if (ptr >= inputLen) { // end-of-buffer?
break;
}
c = inputBuf[ptr++];
}
mInputPtr = ptr;
/* If we end up here, we either ran out of input, or hit something
* which would leave 'holes' in buffer... fine, let's return then;
* we can still update shared buffer copy: would be too early to
* make a copy since caller may not even be interested in the
* stuff.
*/
int len = ptr - start;
mTextBuffer.resetWithShared(inputBuf, start, len);
if (mCfgCoalesceText ||
(mTextBuffer.size() < mShortestTextSegment)) {
mTokenState = TOKEN_STARTED;
} else {
mTokenState = TOKEN_PARTIAL_SINGLE;
}
return false;
} } |
public class class_name {
public Observable<ServiceResponse<PolicyAssignmentInner>> createByIdWithServiceResponseAsync(String policyAssignmentId, PolicyAssignmentInner parameters) {
if (policyAssignmentId == null) {
throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(parameters);
return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PolicyAssignmentInner>>>() {
@Override
public Observable<ServiceResponse<PolicyAssignmentInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PolicyAssignmentInner> clientResponse = createByIdDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<PolicyAssignmentInner>> createByIdWithServiceResponseAsync(String policyAssignmentId, PolicyAssignmentInner parameters) {
if (policyAssignmentId == null) {
throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(parameters);
return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PolicyAssignmentInner>>>() {
@Override
public Observable<ServiceResponse<PolicyAssignmentInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PolicyAssignmentInner> clientResponse = createByIdDelegate(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 <K> Map<K, String> getMulti(Serializer<K> keySerializer, K... keys) {
MultigetSliceQuery<K, String,String> q = createMultigetSliceQuery(keyspace, keySerializer, serializer, serializer);
q.setColumnFamily(CF_NAME);
q.setKeys(keys);
q.setColumnNames(COLUMN_NAME);
QueryResult<Rows<K, String,String>> r = q.execute();
Rows<K, String,String> rows = r.get();
Map<K, String> ret = new HashMap<K, String>(keys.length);
for (K k: keys) {
HColumn<String,String> c = rows.getByKey(k).getColumnSlice().getColumnByName(COLUMN_NAME);
if (c != null && c.getValue() != null) {
ret.put(k, c.getValue());
}
}
return ret;
} } | public class class_name {
public <K> Map<K, String> getMulti(Serializer<K> keySerializer, K... keys) {
MultigetSliceQuery<K, String,String> q = createMultigetSliceQuery(keyspace, keySerializer, serializer, serializer);
q.setColumnFamily(CF_NAME);
q.setKeys(keys);
q.setColumnNames(COLUMN_NAME);
QueryResult<Rows<K, String,String>> r = q.execute();
Rows<K, String,String> rows = r.get();
Map<K, String> ret = new HashMap<K, String>(keys.length);
for (K k: keys) {
HColumn<String,String> c = rows.getByKey(k).getColumnSlice().getColumnByName(COLUMN_NAME);
if (c != null && c.getValue() != null) {
ret.put(k, c.getValue()); // depends on control dependency: [if], data = [none]
}
}
return ret;
} } |
public class class_name {
@Override
public void handleRequest(final Request request) {
assertConfigured();
//
// Service the request for each row.
//
List beanList = getBeanList();
HashSet rowIds = new HashSet(beanList.size());
WComponent row = getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
rowIds.add(getRowId(rowData));
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = getRowContext(rowData, i);
try {
UIContextHolder.pushContext(rowContext);
row.serviceRequest(request);
} finally {
UIContextHolder.popContext();
}
}
cleanupStaleContexts(rowIds);
} } | public class class_name {
@Override
public void handleRequest(final Request request) {
assertConfigured();
//
// Service the request for each row.
//
List beanList = getBeanList();
HashSet rowIds = new HashSet(beanList.size());
WComponent row = getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
rowIds.add(getRowId(rowData)); // depends on control dependency: [for], data = [none]
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = getRowContext(rowData, i);
try {
UIContextHolder.pushContext(rowContext); // depends on control dependency: [try], data = [none]
row.serviceRequest(request); // depends on control dependency: [try], data = [none]
} finally {
UIContextHolder.popContext();
}
}
cleanupStaleContexts(rowIds);
} } |
public class class_name {
@SuppressWarnings("nullness") // static method, so null first arg is OK: oi.factory
private @NonNull Object getRefArg(OptionInfo oi, String argName, String argValue)
throws ArgException {
Object val;
try {
if (oi.constructor != null) {
val = oi.constructor.newInstance(new Object[] {argValue});
} else if (oi.baseType.isEnum()) {
@SuppressWarnings({"unchecked", "rawtypes"})
Object tmpVal = getEnumValue((Class<Enum>) oi.baseType, argValue);
val = tmpVal;
} else {
if (oi.factory == null) {
throw new Error("No constructor or factory for argument " + argName);
}
if (oi.factoryArg2 == null) {
val = oi.factory.invoke(null, argValue);
} else {
val = oi.factory.invoke(null, argValue, oi.factoryArg2);
}
}
} catch (Exception e) {
throw new ArgException("Invalid argument (%s) for argument %s", argValue, argName);
}
return val;
} } | public class class_name {
@SuppressWarnings("nullness") // static method, so null first arg is OK: oi.factory
private @NonNull Object getRefArg(OptionInfo oi, String argName, String argValue)
throws ArgException {
Object val;
try {
if (oi.constructor != null) {
val = oi.constructor.newInstance(new Object[] {argValue}); // depends on control dependency: [if], data = [none]
} else if (oi.baseType.isEnum()) {
@SuppressWarnings({"unchecked", "rawtypes"})
Object tmpVal = getEnumValue((Class<Enum>) oi.baseType, argValue);
val = tmpVal; // depends on control dependency: [if], data = [none]
} else {
if (oi.factory == null) {
throw new Error("No constructor or factory for argument " + argName);
}
if (oi.factoryArg2 == null) {
val = oi.factory.invoke(null, argValue); // depends on control dependency: [if], data = [none]
} else {
val = oi.factory.invoke(null, argValue, oi.factoryArg2); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
throw new ArgException("Invalid argument (%s) for argument %s", argValue, argName);
}
return val;
} } |
public class class_name {
@Override
public Map<String, Object> getChildren(Boolean includeInheritedFields)
{
Map<String, Object> fields = new HashMap<String, Object>();
if (includeInheritedFields)
{
fields.putAll(super.getChildren(includeInheritedFields));
}
fields.put("location", this.location);
fields.put("type", this.type);
return fields;
} } | public class class_name {
@Override
public Map<String, Object> getChildren(Boolean includeInheritedFields)
{
Map<String, Object> fields = new HashMap<String, Object>();
if (includeInheritedFields)
{
fields.putAll(super.getChildren(includeInheritedFields)); // depends on control dependency: [if], data = [(includeInheritedFields)]
}
fields.put("location", this.location);
fields.put("type", this.type);
return fields;
} } |
public class class_name {
static synchronized DocFileFactory getFactory(Configuration configuration) {
DocFileFactory f = factories.get(configuration);
if (f == null) {
JavaFileManager fm = configuration.getFileManager();
if (fm instanceof StandardJavaFileManager) {
f = new StandardDocFileFactory(configuration);
} else {
throw new IllegalStateException();
}
factories.put(configuration, f);
}
return f;
} } | public class class_name {
static synchronized DocFileFactory getFactory(Configuration configuration) {
DocFileFactory f = factories.get(configuration);
if (f == null) {
JavaFileManager fm = configuration.getFileManager();
if (fm instanceof StandardJavaFileManager) {
f = new StandardDocFileFactory(configuration); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException();
}
factories.put(configuration, f); // depends on control dependency: [if], data = [none]
}
return f;
} } |
public class class_name {
@Override
public void initUpstream()
{
NucleicAcid nuc = tempReac.getTemplate();
if (nuc != null)
addToUpstream(nuc, getGraph());
for (Control cont : tempReac.getControlledOf())
{
addToUpstream(cont, graph);
}
} } | public class class_name {
@Override
public void initUpstream()
{
NucleicAcid nuc = tempReac.getTemplate();
if (nuc != null)
addToUpstream(nuc, getGraph());
for (Control cont : tempReac.getControlledOf())
{
addToUpstream(cont, graph);
// depends on control dependency: [for], data = [cont]
}
} } |
public class class_name {
public void setUseSystemsLocaleForFormat(boolean useSystemsLocale) {
if (useSystemsLocaleForFormat != useSystemsLocale) {
useSystemsLocaleForFormat = useSystemsLocale;
getConfig().setProperty(USE_SYSTEMS_LOCALE_FOR_FORMAT_KEY, useSystemsLocaleForFormat);
}
} } | public class class_name {
public void setUseSystemsLocaleForFormat(boolean useSystemsLocale) {
if (useSystemsLocaleForFormat != useSystemsLocale) {
useSystemsLocaleForFormat = useSystemsLocale;
// depends on control dependency: [if], data = [none]
getConfig().setProperty(USE_SYSTEMS_LOCALE_FOR_FORMAT_KEY, useSystemsLocaleForFormat);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
String getTemplateOfParameterizedType(ParameterizedType parameterizedType, IJsonMarshaller jsonMarshaller) {
Class cls = (Class) parameterizedType.getRawType();
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
String res;
if (Iterable.class.isAssignableFrom(cls)) {
res = getTemplateOfIterable(actualTypeArguments, jsonMarshaller);
} else if (Map.class.isAssignableFrom(cls)) {
res = getTemplateOfMap(actualTypeArguments, jsonMarshaller);
} else {
res = cls.getSimpleName().toLowerCase(Locale.ENGLISH);
}
return res;
} } | public class class_name {
String getTemplateOfParameterizedType(ParameterizedType parameterizedType, IJsonMarshaller jsonMarshaller) {
Class cls = (Class) parameterizedType.getRawType();
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
String res;
if (Iterable.class.isAssignableFrom(cls)) {
res = getTemplateOfIterable(actualTypeArguments, jsonMarshaller);
// depends on control dependency: [if], data = [none]
} else if (Map.class.isAssignableFrom(cls)) {
res = getTemplateOfMap(actualTypeArguments, jsonMarshaller);
// depends on control dependency: [if], data = [none]
} else {
res = cls.getSimpleName().toLowerCase(Locale.ENGLISH);
// depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
@Override
protected void paintComponent(Graphics g) {
if (!isInitialized()) {
return;
}
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate coordinate system related to insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw an Arc2d object that will visualize the range of measured values
if (isRangeOfMeasuredValuesVisible()) {
G2.setPaint(getModel().getRangeOfMeasuredValuesPaint());
if (getGaugeType() == GaugeType.TYPE3 || getGaugeType() == GaugeType.TYPE4) {
final Area area = new Area(getModel().getRadialShapeOfMeasuredValues());
area.subtract(new Area(LCD));
G2.fill(area);
} else {
G2.fill(getModel().getRadialShapeOfMeasuredValues());
}
}
// Draw LED if enabled
if (isLedVisible()) {
G2.drawImage(getCurrentLedImage(), (int) (getGaugeBounds().width * getLedPosition().getX()), (int) (getGaugeBounds().height * getLedPosition().getY()), null);
}
// Draw user LED if enabled
if (isUserLedVisible()) {
G2.drawImage(getCurrentUserLedImage(), (int) (getGaugeBounds().width * getUserLedPosition().getX()), (int) (getGaugeBounds().height * getUserLedPosition().getY()), null);
}
// Draw LCD display
if (isLcdVisible()) {
if (getLcdColor() == LcdColor.CUSTOM) {
G2.setColor(getCustomLcdForeground());
} else {
G2.setColor(getLcdColor().TEXT_COLOR);
}
G2.setFont(getLcdUnitFont());
if (isLcdTextVisible()) {
final double UNIT_STRING_WIDTH;
if (isLcdUnitStringVisible()) {
unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT);
UNIT_BOUNDARY.setFrame(unitLayout.getBounds());
G2.drawString(getLcdUnitString(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03), (int) (LCD.getY() + LCD.getHeight() * 0.76));
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth();
} else {
UNIT_STRING_WIDTH = 0;
}
G2.setFont(getLcdValueFont());
switch (getModel().getNumberSystem()) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toOctalString((int) getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(formatLcdValue(getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76));
break;
}
}
// Draw lcd info string
if (!getLcdInfoString().isEmpty()) {
G2.setFont(getLcdInfoFont());
infoLayout = new TextLayout(getLcdInfoString(), G2.getFont(), RENDER_CONTEXT);
INFO_BOUNDARY.setFrame(infoLayout.getBounds());
G2.drawString(getLcdInfoString(), LCD.getBounds().x + 5, LCD.getBounds().y + (int) INFO_BOUNDARY.getHeight() + 5);
}
// Draw lcd threshold indicator
if (getLcdNumberSystem() == NumberSystem.DEC && isLcdThresholdVisible() && getLcdValue() >= getLcdThreshold()) {
G2.drawImage(lcdThresholdImage, (int) (LCD.getX() + LCD.getHeight() * 0.0568181818), (int) (LCD.getY() + LCD.getHeight() - lcdThresholdImage.getHeight() - LCD.getHeight() * 0.0568181818), null);
}
}
// Draw the active leds in dependence on the current value
final AffineTransform OLD_TRANSFORM = G2.getTransform();
final double ACTIVE_LED_ANGLE;
if (!isLogScale()) {
ACTIVE_LED_ANGLE = getAngleForValue(getValue());
} else {
ACTIVE_LED_ANGLE = Math.toDegrees(UTIL.logOfBase(BASE, getValue() - getMinValue()) * getLogAngleStep());
}
if (!getModel().isSingleLedBargraphEnabled()) {
for (double angle = 0; Double.compare(angle, ACTIVE_LED_ANGLE) <= 0; angle += 5.0) {
G2.rotate(Math.toRadians(angle + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
// If sections visible, color the bargraph with the given section colors
G2.setPaint(ledGradient);
if (isSectionsVisible()) {
// Use defined bargraphColor in areas where no section is defined
for (Section section : getSections()) {
if (Double.compare(angle, sectionAngles.get(section).getX()) >= 0 && angle < sectionAngles.get(section).getY()) {
G2.setPaint(sectionGradients.get(section));
break;
}
}
} else {
G2.setPaint(ledGradient);
}
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
} else { // Draw only one led instead of all active leds
final double ANGLE = Math.toRadians(((getValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle());
G2.rotate(ANGLE, CENTER.getX(), CENTER.getY());
if (isSectionsVisible()) {
for (Section section : getSections()) {
if (Double.compare(ANGLE, sectionAngles.get(section).getX()) >= 0 && ANGLE < sectionAngles.get(section).getY()) {
G2.setPaint(sectionGradients.get(section));
break;
}
}
} else {
G2.setPaint(ledGradient);
}
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
// Draw peak value if enabled
if (isPeakValueEnabled() && isPeakValueVisible()) {
G2.rotate(Math.toRadians(((getPeakValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle() + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
// Draw the foreground
if (isForegroundVisible()) {
G2.drawImage(fImage, 0, 0, null);
}
// Draw glow indicator
if (isGlowVisible()) {
if (isGlowing()) {
G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getGlowAlpha()));
G2.drawImage(glowImageOn, 0, 0, null);
G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
} else
{
G2.drawImage(glowImageOff, 0, 0, null);
}
}
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null);
}
G2.dispose();
} } | public class class_name {
@Override
protected void paintComponent(Graphics g) {
if (!isInitialized()) {
return; // depends on control dependency: [if], data = [none]
}
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate coordinate system related to insets
G2.translate(getFramelessOffset().getX(), getFramelessOffset().getY());
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw an Arc2d object that will visualize the range of measured values
if (isRangeOfMeasuredValuesVisible()) {
G2.setPaint(getModel().getRangeOfMeasuredValuesPaint()); // depends on control dependency: [if], data = [none]
if (getGaugeType() == GaugeType.TYPE3 || getGaugeType() == GaugeType.TYPE4) {
final Area area = new Area(getModel().getRadialShapeOfMeasuredValues());
area.subtract(new Area(LCD)); // depends on control dependency: [if], data = [none]
G2.fill(area); // depends on control dependency: [if], data = [none]
} else {
G2.fill(getModel().getRadialShapeOfMeasuredValues()); // depends on control dependency: [if], data = [none]
}
}
// Draw LED if enabled
if (isLedVisible()) {
G2.drawImage(getCurrentLedImage(), (int) (getGaugeBounds().width * getLedPosition().getX()), (int) (getGaugeBounds().height * getLedPosition().getY()), null); // depends on control dependency: [if], data = [none]
}
// Draw user LED if enabled
if (isUserLedVisible()) {
G2.drawImage(getCurrentUserLedImage(), (int) (getGaugeBounds().width * getUserLedPosition().getX()), (int) (getGaugeBounds().height * getUserLedPosition().getY()), null); // depends on control dependency: [if], data = [none]
}
// Draw LCD display
if (isLcdVisible()) {
if (getLcdColor() == LcdColor.CUSTOM) {
G2.setColor(getCustomLcdForeground()); // depends on control dependency: [if], data = [none]
} else {
G2.setColor(getLcdColor().TEXT_COLOR); // depends on control dependency: [if], data = [(getLcdColor()]
}
G2.setFont(getLcdUnitFont()); // depends on control dependency: [if], data = [none]
if (isLcdTextVisible()) {
final double UNIT_STRING_WIDTH;
if (isLcdUnitStringVisible()) {
unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
UNIT_BOUNDARY.setFrame(unitLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(getLcdUnitString(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03), (int) (LCD.getY() + LCD.getHeight() * 0.76)); // depends on control dependency: [if], data = [none]
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth(); // depends on control dependency: [if], data = [none]
} else {
UNIT_STRING_WIDTH = 0; // depends on control dependency: [if], data = [none]
}
G2.setFont(getLcdValueFont()); // depends on control dependency: [if], data = [none]
switch (getModel().getNumberSystem()) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76)); // depends on control dependency: [if], data = [none]
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(Integer.toOctalString((int) getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76)); // depends on control dependency: [if], data = [none]
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(formatLcdValue(getLcdValue()), (int) (LCD.getX() + (LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (int) (LCD.getY() + LCD.getHeight() * 0.76)); // depends on control dependency: [if], data = [none]
break;
}
}
// Draw lcd info string
if (!getLcdInfoString().isEmpty()) {
G2.setFont(getLcdInfoFont()); // depends on control dependency: [if], data = [none]
infoLayout = new TextLayout(getLcdInfoString(), G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
INFO_BOUNDARY.setFrame(infoLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(getLcdInfoString(), LCD.getBounds().x + 5, LCD.getBounds().y + (int) INFO_BOUNDARY.getHeight() + 5); // depends on control dependency: [if], data = [none]
}
// Draw lcd threshold indicator
if (getLcdNumberSystem() == NumberSystem.DEC && isLcdThresholdVisible() && getLcdValue() >= getLcdThreshold()) {
G2.drawImage(lcdThresholdImage, (int) (LCD.getX() + LCD.getHeight() * 0.0568181818), (int) (LCD.getY() + LCD.getHeight() - lcdThresholdImage.getHeight() - LCD.getHeight() * 0.0568181818), null); // depends on control dependency: [if], data = [none]
}
}
// Draw the active leds in dependence on the current value
final AffineTransform OLD_TRANSFORM = G2.getTransform();
final double ACTIVE_LED_ANGLE;
if (!isLogScale()) {
ACTIVE_LED_ANGLE = getAngleForValue(getValue());
} else {
ACTIVE_LED_ANGLE = Math.toDegrees(UTIL.logOfBase(BASE, getValue() - getMinValue()) * getLogAngleStep());
}
if (!getModel().isSingleLedBargraphEnabled()) {
for (double angle = 0; Double.compare(angle, ACTIVE_LED_ANGLE) <= 0; angle += 5.0) {
G2.rotate(Math.toRadians(angle + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
// If sections visible, color the bargraph with the given section colors
G2.setPaint(ledGradient);
if (isSectionsVisible()) {
// Use defined bargraphColor in areas where no section is defined
for (Section section : getSections()) {
if (Double.compare(angle, sectionAngles.get(section).getX()) >= 0 && angle < sectionAngles.get(section).getY()) {
G2.setPaint(sectionGradients.get(section));
break;
}
}
} else {
G2.setPaint(ledGradient);
}
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
} else { // Draw only one led instead of all active leds
final double ANGLE = Math.toRadians(((getValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle());
G2.rotate(ANGLE, CENTER.getX(), CENTER.getY());
if (isSectionsVisible()) {
for (Section section : getSections()) {
if (Double.compare(ANGLE, sectionAngles.get(section).getX()) >= 0 && ANGLE < sectionAngles.get(section).getY()) {
G2.setPaint(sectionGradients.get(section));
break;
}
}
} else {
G2.setPaint(ledGradient);
}
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
// Draw peak value if enabled
if (isPeakValueEnabled() && isPeakValueVisible()) {
G2.rotate(Math.toRadians(((getPeakValue() - getMinValue()) / (getMaxValue() - getMinValue())) * getModel().getApexAngle() + getModel().getBargraphOffset()), CENTER.getX(), CENTER.getY());
G2.fill(led);
G2.setTransform(OLD_TRANSFORM);
}
// Draw the foreground
if (isForegroundVisible()) {
G2.drawImage(fImage, 0, 0, null);
}
// Draw glow indicator
if (isGlowVisible()) {
if (isGlowing()) {
G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getGlowAlpha()));
G2.drawImage(glowImageOn, 0, 0, null);
G2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
} else
{
G2.drawImage(glowImageOff, 0, 0, null);
}
}
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null);
}
G2.dispose();
} } |
public class class_name {
public void notifyAddOnUninstalled(final AddOn addOn) {
if (EventQueue.isDispatchThread()) {
installedAddOnsModel.removeAddOn(addOn);
if (latestInfo != null) {
AddOn availableAddOn = latestInfo.getAddOn(addOn.getId());
if (availableAddOn != null) {
uninstalledAddOnsModel.addAddOn(latestInfo.getAddOn(addOn.getId()));
}
}
} else {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
notifyAddOnUninstalled(addOn);
}
});
}
} } | public class class_name {
public void notifyAddOnUninstalled(final AddOn addOn) {
if (EventQueue.isDispatchThread()) {
installedAddOnsModel.removeAddOn(addOn);
// depends on control dependency: [if], data = [none]
if (latestInfo != null) {
AddOn availableAddOn = latestInfo.getAddOn(addOn.getId());
if (availableAddOn != null) {
uninstalledAddOnsModel.addAddOn(latestInfo.getAddOn(addOn.getId()));
// depends on control dependency: [if], data = [none]
}
}
} else {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
notifyAddOnUninstalled(addOn);
}
});
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String notAllNullParameterCheck(String parameterName, Set<EntityColumn> columnSet) {
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"notAllNullParameterCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notAllNullParameterCheck(");
sql.append(parameterName).append(", '");
StringBuilder fields = new StringBuilder();
for (EntityColumn column : columnSet) {
if (fields.length() > 0) {
fields.append(",");
}
fields.append(column.getProperty());
}
sql.append(fields);
sql.append("')\"/>");
return sql.toString();
} } | public class class_name {
public static String notAllNullParameterCheck(String parameterName, Set<EntityColumn> columnSet) {
StringBuilder sql = new StringBuilder();
sql.append("<bind name=\"notAllNullParameterCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notAllNullParameterCheck(");
sql.append(parameterName).append(", '");
StringBuilder fields = new StringBuilder();
for (EntityColumn column : columnSet) {
if (fields.length() > 0) {
fields.append(","); // depends on control dependency: [if], data = [none]
}
fields.append(column.getProperty()); // depends on control dependency: [for], data = [column]
}
sql.append(fields);
sql.append("')\"/>");
return sql.toString();
} } |
public class class_name {
public static base_responses update(nitro_service client, snmptrap resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmptrap updateresources[] = new snmptrap[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmptrap();
updateresources[i].trapclass = resources[i].trapclass;
updateresources[i].trapdestination = resources[i].trapdestination;
updateresources[i].destport = resources[i].destport;
updateresources[i].version = resources[i].version;
updateresources[i].communityname = resources[i].communityname;
updateresources[i].srcip = resources[i].srcip;
updateresources[i].severity = resources[i].severity;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, snmptrap resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmptrap updateresources[] = new snmptrap[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmptrap(); // depends on control dependency: [for], data = [i]
updateresources[i].trapclass = resources[i].trapclass; // depends on control dependency: [for], data = [i]
updateresources[i].trapdestination = resources[i].trapdestination; // depends on control dependency: [for], data = [i]
updateresources[i].destport = resources[i].destport; // depends on control dependency: [for], data = [i]
updateresources[i].version = resources[i].version; // depends on control dependency: [for], data = [i]
updateresources[i].communityname = resources[i].communityname; // depends on control dependency: [for], data = [i]
updateresources[i].srcip = resources[i].srcip; // depends on control dependency: [for], data = [i]
updateresources[i].severity = resources[i].severity; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
public JvmType getAnnotationType()
{
if (annotationType != null && annotationType.eIsProxy())
{
InternalEObject oldAnnotationType = (InternalEObject)annotationType;
annotationType = (JvmType)eResolveProxy(oldAnnotationType);
if (annotationType != oldAnnotationType)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE, oldAnnotationType, annotationType));
}
}
return annotationType;
} } | public class class_name {
public JvmType getAnnotationType()
{
if (annotationType != null && annotationType.eIsProxy())
{
InternalEObject oldAnnotationType = (InternalEObject)annotationType;
annotationType = (JvmType)eResolveProxy(oldAnnotationType); // depends on control dependency: [if], data = [none]
if (annotationType != oldAnnotationType)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, XAnnotationsPackage.XANNOTATION__ANNOTATION_TYPE, oldAnnotationType, annotationType));
}
}
return annotationType;
} } |
public class class_name {
@Override
public EClass getIfcVector() {
if (ifcVectorEClass == null) {
ifcVectorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(749);
}
return ifcVectorEClass;
} } | public class class_name {
@Override
public EClass getIfcVector() {
if (ifcVectorEClass == null) {
ifcVectorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(749);
// depends on control dependency: [if], data = [none]
}
return ifcVectorEClass;
} } |
public class class_name {
private DatatypeStreamingValidator streamingValidatorFor(String uri,
String localName, Attributes atts) {
if ("http://www.w3.org/1999/xhtml".equals(uri)) {
if ("time".equals(localName)) {
if (atts.getIndex("", "datetime") < 0) {
return TimeDatetime.THE_INSTANCE.createStreamingValidator(null);
}
}
if ("script".equals(localName)) {
if (atts.getIndex("", "src") < 0) {
return Script.THE_INSTANCE.createStreamingValidator(null);
} else {
return ScriptDocumentation.THE_INSTANCE.createStreamingValidator(null);
}
} else if ("style".equals(localName)
|| "textarea".equals(localName)
|| "title".equals(localName)) {
return CdoCdcPair.THE_INSTANCE.createStreamingValidator(null);
}
}
return null;
} } | public class class_name {
private DatatypeStreamingValidator streamingValidatorFor(String uri,
String localName, Attributes atts) {
if ("http://www.w3.org/1999/xhtml".equals(uri)) {
if ("time".equals(localName)) {
if (atts.getIndex("", "datetime") < 0) {
return TimeDatetime.THE_INSTANCE.createStreamingValidator(null); // depends on control dependency: [if], data = [none]
}
}
if ("script".equals(localName)) {
if (atts.getIndex("", "src") < 0) {
return Script.THE_INSTANCE.createStreamingValidator(null); // depends on control dependency: [if], data = [none]
} else {
return ScriptDocumentation.THE_INSTANCE.createStreamingValidator(null); // depends on control dependency: [if], data = [none]
}
} else if ("style".equals(localName)
|| "textarea".equals(localName)
|| "title".equals(localName)) {
return CdoCdcPair.THE_INSTANCE.createStreamingValidator(null); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private static DateFormat get(int dateStyle, int timeStyle, ULocale loc, Calendar cal) {
if((timeStyle != DateFormat.NONE && (timeStyle & RELATIVE)>0) ||
(dateStyle != DateFormat.NONE && (dateStyle & RELATIVE)>0)) {
RelativeDateFormat r = new RelativeDateFormat(timeStyle, dateStyle /* offset? */, loc, cal);
return r;
}
if (timeStyle < DateFormat.NONE || timeStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal time style " + timeStyle);
}
if (dateStyle < DateFormat.NONE || dateStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal date style " + dateStyle);
}
if (cal == null) {
cal = Calendar.getInstance(loc);
}
try {
DateFormat result = cal.getDateTimeFormat(dateStyle, timeStyle, loc);
result.setLocale(cal.getLocale(ULocale.VALID_LOCALE),
cal.getLocale(ULocale.ACTUAL_LOCALE));
return result;
} catch (MissingResourceException e) {
///CLOVER:OFF
// coverage requires separate run with no data, so skip
return new SimpleDateFormat("M/d/yy h:mm a");
///CLOVER:ON
}
} } | public class class_name {
private static DateFormat get(int dateStyle, int timeStyle, ULocale loc, Calendar cal) {
if((timeStyle != DateFormat.NONE && (timeStyle & RELATIVE)>0) ||
(dateStyle != DateFormat.NONE && (dateStyle & RELATIVE)>0)) {
RelativeDateFormat r = new RelativeDateFormat(timeStyle, dateStyle /* offset? */, loc, cal);
return r; // depends on control dependency: [if], data = [none]
}
if (timeStyle < DateFormat.NONE || timeStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal time style " + timeStyle);
}
if (dateStyle < DateFormat.NONE || dateStyle > DateFormat.SHORT) {
throw new IllegalArgumentException("Illegal date style " + dateStyle);
}
if (cal == null) {
cal = Calendar.getInstance(loc); // depends on control dependency: [if], data = [none]
}
try {
DateFormat result = cal.getDateTimeFormat(dateStyle, timeStyle, loc);
result.setLocale(cal.getLocale(ULocale.VALID_LOCALE),
cal.getLocale(ULocale.ACTUAL_LOCALE)); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
///CLOVER:OFF
// coverage requires separate run with no data, so skip
return new SimpleDateFormat("M/d/yy h:mm a");
///CLOVER:ON
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Consumer wrapVoidMethod(Method method) {
return c -> {
try {
method.invoke(this, c);
} catch (InvocationTargetException e) {
throw new CommandException(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
};
} } | public class class_name {
private Consumer wrapVoidMethod(Method method) {
return c -> {
try {
method.invoke(this, c); // depends on control dependency: [try], data = [none]
} catch (InvocationTargetException e) {
throw new CommandException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new AssertionError(e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
private UIForm getForm(UIComponent component) {
while (component != null) {
if (component instanceof UIForm) {
break;
}
component = component.getParent();
}
return (UIForm) component;
} } | public class class_name {
private UIForm getForm(UIComponent component) {
while (component != null) {
if (component instanceof UIForm) {
break;
}
component = component.getParent(); // depends on control dependency: [while], data = [none]
}
return (UIForm) component;
} } |
public class class_name {
public AddPermissionRequest withActions(String... actions) {
if (this.actions == null) {
setActions(new com.amazonaws.internal.SdkInternalList<String>(actions.length));
}
for (String ele : actions) {
this.actions.add(ele);
}
return this;
} } | public class class_name {
public AddPermissionRequest withActions(String... actions) {
if (this.actions == null) {
setActions(new com.amazonaws.internal.SdkInternalList<String>(actions.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : actions) {
this.actions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@CheckForSigned
public static long getContentLength (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
if (false)
{
// Missing support > 2GB!!!
return aHttpRequest.getContentLength ();
}
final String sContentLength = aHttpRequest.getHeader (CHttpHeader.CONTENT_LENGTH);
return StringParser.parseLong (sContentLength, -1L);
} } | public class class_name {
@CheckForSigned
public static long getContentLength (@Nonnull final HttpServletRequest aHttpRequest)
{
ValueEnforcer.notNull (aHttpRequest, "HttpRequest");
if (false)
{
// Missing support > 2GB!!!
return aHttpRequest.getContentLength (); // depends on control dependency: [if], data = [none]
}
final String sContentLength = aHttpRequest.getHeader (CHttpHeader.CONTENT_LENGTH);
return StringParser.parseLong (sContentLength, -1L);
} } |
public class class_name {
private void calculateMean() {
for (Tuple t : trainingData) {
int index = model.labelIndexer.getIndex(t.label);
count[index]++;
model.meanVectors[index] = VectorUtils.addition(model.meanVectors[index], t.vector.getVector());
// VectorUtils.zip(model.meanVectors[index], t.vector.getVector(), (x, y) -> x + y); // Performance
}
for (int i = 0; i < model.meanVectors.length; i++) {
// Get each label and normalize
double[] meanVector = model.meanVectors[i]; // feat(label)
VectorUtils.scale(meanVector, 1.0 / count[i]);
model.meanVectors[i] = meanVector;
}
for (int i = 0; i < model.meanVectors.length; i++) {
for (int j = 0; j < model.meanVectors[i].length; j++) {
if (model.meanVectors[i][j] == 0) {
LOG.warn("mean is 0 for label " + model.labelIndexer.labelIndexer.inverse().get(i) + " at dimension " + j);
model.meanVectors[i][j] = Double.MIN_VALUE;
}
}
}
} } | public class class_name {
private void calculateMean() {
for (Tuple t : trainingData) {
int index = model.labelIndexer.getIndex(t.label);
count[index]++; // depends on control dependency: [for], data = [t]
model.meanVectors[index] = VectorUtils.addition(model.meanVectors[index], t.vector.getVector()); // depends on control dependency: [for], data = [t]
// VectorUtils.zip(model.meanVectors[index], t.vector.getVector(), (x, y) -> x + y); // Performance
}
for (int i = 0; i < model.meanVectors.length; i++) {
// Get each label and normalize
double[] meanVector = model.meanVectors[i]; // feat(label)
VectorUtils.scale(meanVector, 1.0 / count[i]); // depends on control dependency: [for], data = [i]
model.meanVectors[i] = meanVector; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < model.meanVectors.length; i++) {
for (int j = 0; j < model.meanVectors[i].length; j++) {
if (model.meanVectors[i][j] == 0) {
LOG.warn("mean is 0 for label " + model.labelIndexer.labelIndexer.inverse().get(i) + " at dimension " + j); // depends on control dependency: [if], data = [none]
model.meanVectors[i][j] = Double.MIN_VALUE; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void marshall(DvbSubDestinationSettings dvbSubDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (dvbSubDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dvbSubDestinationSettings.getAlignment(), ALIGNMENT_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontColor(), FONTCOLOR_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontScript(), FONTSCRIPT_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontSize(), FONTSIZE_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getXPosition(), XPOSITION_BINDING);
protocolMarshaller.marshall(dvbSubDestinationSettings.getYPosition(), YPOSITION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DvbSubDestinationSettings dvbSubDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (dvbSubDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dvbSubDestinationSettings.getAlignment(), ALIGNMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontColor(), FONTCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontScript(), FONTSCRIPT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getFontSize(), FONTSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getXPosition(), XPOSITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(dvbSubDestinationSettings.getYPosition(), YPOSITION_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 PortMapping createPortMapping(RunImageConfiguration runConfig, Properties properties) {
try {
return new PortMapping(runConfig.getPorts(), properties);
} catch (IllegalArgumentException exp) {
throw new IllegalArgumentException("Cannot parse port mapping", exp);
}
} } | public class class_name {
public PortMapping createPortMapping(RunImageConfiguration runConfig, Properties properties) {
try {
return new PortMapping(runConfig.getPorts(), properties); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException exp) {
throw new IllegalArgumentException("Cannot parse port mapping", exp);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Set<TsBeanModel> writeBeanAndParentsFieldSpecs(
Writer writer, Settings settings, TsModel model, Set<TsBeanModel> emittedSoFar, TsBeanModel bean) {
if (emittedSoFar.contains(bean)) {
return new HashSet<>();
}
final TsBeanModel parentBean = getBeanModelByType(model, bean.getParent());
final Set<TsBeanModel> emittedBeans = parentBean != null
? writeBeanAndParentsFieldSpecs(writer, settings, model, emittedSoFar, parentBean)
: new HashSet<TsBeanModel>();
final String parentClassName = parentBean != null
? getBeanModelClassName(parentBean) + "Fields"
: "Fields";
writer.writeIndentedLine("");
writer.writeIndentedLine(
"class " + getBeanModelClassName(bean) + "Fields extends " + parentClassName + " {");
writer.writeIndentedLine(
settings.indentString + "constructor(parent?: Fields, name?: string) { super(parent, name); }");
for (TsPropertyModel property : bean.getProperties()) {
writeBeanProperty(writer, settings, model, bean, property);
}
writer.writeIndentedLine("}");
emittedBeans.add(bean);
return emittedBeans;
} } | public class class_name {
private static Set<TsBeanModel> writeBeanAndParentsFieldSpecs(
Writer writer, Settings settings, TsModel model, Set<TsBeanModel> emittedSoFar, TsBeanModel bean) {
if (emittedSoFar.contains(bean)) {
return new HashSet<>(); // depends on control dependency: [if], data = [none]
}
final TsBeanModel parentBean = getBeanModelByType(model, bean.getParent());
final Set<TsBeanModel> emittedBeans = parentBean != null
? writeBeanAndParentsFieldSpecs(writer, settings, model, emittedSoFar, parentBean)
: new HashSet<TsBeanModel>();
final String parentClassName = parentBean != null
? getBeanModelClassName(parentBean) + "Fields"
: "Fields";
writer.writeIndentedLine("");
writer.writeIndentedLine(
"class " + getBeanModelClassName(bean) + "Fields extends " + parentClassName + " {");
writer.writeIndentedLine(
settings.indentString + "constructor(parent?: Fields, name?: string) { super(parent, name); }");
for (TsPropertyModel property : bean.getProperties()) {
writeBeanProperty(writer, settings, model, bean, property);
}
writer.writeIndentedLine("}");
emittedBeans.add(bean);
return emittedBeans;
} } |
public class class_name {
protected void bindStringColumnConstraints(Column column, PersistentProperty constrainedProperty) {
final org.grails.datastore.mapping.config.Property mappedForm = constrainedProperty.getMapping().getMappedForm();
Number columnLength = mappedForm.getMaxSize();
List<?> inListValues = mappedForm.getInList();
if (columnLength != null) {
column.setLength(columnLength.intValue());
} else if (inListValues != null) {
column.setLength(getMaxSize(inListValues));
}
} } | public class class_name {
protected void bindStringColumnConstraints(Column column, PersistentProperty constrainedProperty) {
final org.grails.datastore.mapping.config.Property mappedForm = constrainedProperty.getMapping().getMappedForm();
Number columnLength = mappedForm.getMaxSize();
List<?> inListValues = mappedForm.getInList();
if (columnLength != null) {
column.setLength(columnLength.intValue()); // depends on control dependency: [if], data = [(columnLength]
} else if (inListValues != null) {
column.setLength(getMaxSize(inListValues)); // depends on control dependency: [if], data = [(inListValues]
}
} } |
public class class_name {
private Map<MetricQuery, List<Metric>> getSubQueryMetrics(List<MetricQuery> queries) {
Map<MetricQuery, Future<List<Metric>>> queryFutureMap = new HashMap<>();
for (MetricQuery query : queries) {
String requestBody = fromEntity(query);
String requestUrl = query.getMetricQueryContext().getReadEndPoint() + "/api/query";
queryFutureMap.put(query, _executorService.submit(new QueryWorker(requestUrl, query.getMetricQueryContext().getReadEndPoint(), requestBody)));
}
Map<MetricQuery, List<Metric>> subQueryMetricsMap = new HashMap<>();
for (Entry<MetricQuery, Future<List<Metric>>> entry : queryFutureMap.entrySet()) {
List<Metric> metrics = new ArrayList<>();
List<Metric> m = null;
try {
m = entry.getValue().get();
} catch (InterruptedException | ExecutionException e) {
_logger.warn("Failed to get metrics from TSDB. Reason: " + e.getMessage());
try {
String readBackupEndPoint = _readBackupEndPointsMap.get(entry.getKey().getMetricQueryContext().getReadEndPoint());
if (!readBackupEndPoint.isEmpty()) {
_logger.warn("Trying to read from Backup endpoint");
m = new QueryWorker(readBackupEndPoint + "/api/query", readBackupEndPoint, fromEntity(entry.getKey())).call();
}
} catch (Exception ex) {
_logger.warn("Failed to get metrics from Backup TSDB. Reason: " + ex.getMessage());
continue;
}
}
if (m != null) {
for (Metric metric : m) {
if (metric != null) {
metric.setQuery(entry.getKey());
metrics.add(metric);
}
}
}
subQueryMetricsMap.put(entry.getKey(), metrics);
}
return subQueryMetricsMap;
} } | public class class_name {
private Map<MetricQuery, List<Metric>> getSubQueryMetrics(List<MetricQuery> queries) {
Map<MetricQuery, Future<List<Metric>>> queryFutureMap = new HashMap<>();
for (MetricQuery query : queries) {
String requestBody = fromEntity(query);
String requestUrl = query.getMetricQueryContext().getReadEndPoint() + "/api/query";
queryFutureMap.put(query, _executorService.submit(new QueryWorker(requestUrl, query.getMetricQueryContext().getReadEndPoint(), requestBody))); // depends on control dependency: [for], data = [query]
}
Map<MetricQuery, List<Metric>> subQueryMetricsMap = new HashMap<>();
for (Entry<MetricQuery, Future<List<Metric>>> entry : queryFutureMap.entrySet()) {
List<Metric> metrics = new ArrayList<>();
List<Metric> m = null;
try {
m = entry.getValue().get(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException | ExecutionException e) {
_logger.warn("Failed to get metrics from TSDB. Reason: " + e.getMessage());
try {
String readBackupEndPoint = _readBackupEndPointsMap.get(entry.getKey().getMetricQueryContext().getReadEndPoint());
if (!readBackupEndPoint.isEmpty()) {
_logger.warn("Trying to read from Backup endpoint"); // depends on control dependency: [if], data = [none]
m = new QueryWorker(readBackupEndPoint + "/api/query", readBackupEndPoint, fromEntity(entry.getKey())).call(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
_logger.warn("Failed to get metrics from Backup TSDB. Reason: " + ex.getMessage());
continue;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
if (m != null) {
for (Metric metric : m) {
if (metric != null) {
metric.setQuery(entry.getKey()); // depends on control dependency: [if], data = [none]
metrics.add(metric); // depends on control dependency: [if], data = [(metric]
}
}
}
subQueryMetricsMap.put(entry.getKey(), metrics); // depends on control dependency: [for], data = [entry]
}
return subQueryMetricsMap;
} } |
public class class_name {
public static Level toLevel(final String name, final Level defaultLevel) {
if (name == null) {
return defaultLevel;
}
final Level level = LEVELS.get(toUpperCase(name));
return level == null ? defaultLevel : level;
} } | public class class_name {
public static Level toLevel(final String name, final Level defaultLevel) {
if (name == null) {
return defaultLevel; // depends on control dependency: [if], data = [none]
}
final Level level = LEVELS.get(toUpperCase(name));
return level == null ? defaultLevel : level;
} } |
public class class_name {
public static InputStream toInputStream(SOAPMessage msg){
if(msg==null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
msg.writeTo(os);
} catch (Exception e) {
throw S1SystemError.wrap(e);
}
return new ByteArrayInputStream(os.toByteArray());
} } | public class class_name {
public static InputStream toInputStream(SOAPMessage msg){
if(msg==null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
msg.writeTo(os); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw S1SystemError.wrap(e);
} // depends on control dependency: [catch], data = [none]
return new ByteArrayInputStream(os.toByteArray());
} } |
public class class_name {
public Observable<ServiceResponse<List<UsageInner>>> listByLocationWithServiceResponseAsync(String location) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (location == null) {
throw new IllegalArgumentException("Parameter location is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByLocation(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<List<UsageInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<UsageInner>> result = listByLocationDelegate(response);
List<UsageInner> items = null;
if (result.body() != null) {
items = result.body().items();
}
ServiceResponse<List<UsageInner>> clientResponse = new ServiceResponse<List<UsageInner>>(items, result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<List<UsageInner>>> listByLocationWithServiceResponseAsync(String location) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (location == null) {
throw new IllegalArgumentException("Parameter location is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByLocation(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<List<UsageInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<UsageInner>> result = listByLocationDelegate(response);
List<UsageInner> items = null;
if (result.body() != null) {
items = result.body().items(); // depends on control dependency: [if], data = [none]
}
ServiceResponse<List<UsageInner>> clientResponse = new ServiceResponse<List<UsageInner>>(items, result.response());
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private static void setServiceEnabled(final XMPPConnection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(DataPacketExtension.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Bytestream.NAMESPACE);
}
for (String namespace : namespaces) {
if (isEnabled) {
manager.addFeature(namespace);
} else {
manager.removeFeature(namespace);
}
}
} } | public class class_name {
private static void setServiceEnabled(final XMPPConnection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(DataPacketExtension.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Bytestream.NAMESPACE); // depends on control dependency: [if], data = [none]
}
for (String namespace : namespaces) {
if (isEnabled) {
manager.addFeature(namespace); // depends on control dependency: [if], data = [none]
} else {
manager.removeFeature(namespace); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void addNewConnective() {
String factType = getExpressionLeftSide().getPreviousGenericType();
if ( factType == null ) {
factType = getExpressionLeftSide().getGenericType();
}
String fieldName = getExpressionLeftSide().getFieldName();
String fieldType = getExpressionLeftSide().getGenericType();
if ( this.getConnectives() == null ) {
this.setConnectives( new ConnectiveConstraint[]{ new ConnectiveConstraint( factType,
fieldName,
fieldType ) } );
} else {
final ConnectiveConstraint[] newList = new ConnectiveConstraint[ this.getConnectives().length + 1 ];
for ( int i = 0; i < this.getConnectives().length; i++ ) {
newList[ i ] = this.getConnectives()[ i ];
}
newList[ this.getConnectives().length ] = new ConnectiveConstraint( factType,
fieldName,
fieldType );
this.setConnectives( newList );
}
} } | public class class_name {
@Override
public void addNewConnective() {
String factType = getExpressionLeftSide().getPreviousGenericType();
if ( factType == null ) {
factType = getExpressionLeftSide().getGenericType(); // depends on control dependency: [if], data = [none]
}
String fieldName = getExpressionLeftSide().getFieldName();
String fieldType = getExpressionLeftSide().getGenericType();
if ( this.getConnectives() == null ) {
this.setConnectives( new ConnectiveConstraint[]{ new ConnectiveConstraint( factType,
fieldName,
fieldType ) } ); // depends on control dependency: [if], data = [none]
} else {
final ConnectiveConstraint[] newList = new ConnectiveConstraint[ this.getConnectives().length + 1 ];
for ( int i = 0; i < this.getConnectives().length; i++ ) {
newList[ i ] = this.getConnectives()[ i ]; // depends on control dependency: [for], data = [i]
}
newList[ this.getConnectives().length ] = new ConnectiveConstraint( factType,
fieldName,
fieldType ); // depends on control dependency: [if], data = [none]
this.setConnectives( newList ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public RedisCache init() {
super.init();
/*
* Parse custom property: redis-host-and-port
*/
String hostAndPort = getCacheProperty(CACHE_PROP_REDIS_HOST_AND_PORT);
if (!StringUtils.isBlank(hostAndPort)) {
this.redisHostAndPort = hostAndPort;
}
if (getJedisConnector() == null) {
try {
JedisConnector jedisConnector = new JedisConnector();
jedisConnector.setRedisHostsAndPorts(redisHostAndPort).init();
setJedisConnector(jedisConnector, true);
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
return this;
} } | public class class_name {
@Override
public RedisCache init() {
super.init();
/*
* Parse custom property: redis-host-and-port
*/
String hostAndPort = getCacheProperty(CACHE_PROP_REDIS_HOST_AND_PORT);
if (!StringUtils.isBlank(hostAndPort)) {
this.redisHostAndPort = hostAndPort; // depends on control dependency: [if], data = [none]
}
if (getJedisConnector() == null) {
try {
JedisConnector jedisConnector = new JedisConnector();
jedisConnector.setRedisHostsAndPorts(redisHostAndPort).init(); // depends on control dependency: [try], data = [none]
setJedisConnector(jedisConnector, true); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return this;
} } |
public class class_name {
public T next() {
if( loop ) {
if( forwards ) {
if( index >= fileNames.size() ) {
index = fileNames.size()-1;
forwards = false;
}
} else {
if( index < 0 ) {
index = 0;
forwards = true;
}
}
}
if( forwards )
imageGUI = UtilImageIO.loadImage(fileNames.get(index++));
else
imageGUI = UtilImageIO.loadImage(fileNames.get(index--));
if( imageGUI == null )
return null;
image = type.createImage(imageGUI.getWidth(),imageGUI.getHeight());
ConvertBufferedImage.convertFrom(imageGUI, image,true);
// no changes needed so return the original
if (scalefactor == 1)
return image;
// scale down the image
int width = image.getWidth() / scalefactor;
int height = image.getHeight() / scalefactor;
if (scaled == null || scaled.getWidth() != width || scaled.getHeight() != height) {
scaled = new BufferedImage(width, height, imageGUI.getType());
}
Graphics2D g2 = scaled.createGraphics();
AffineTransform affine = new AffineTransform();
affine.setToScale(1.0 / scalefactor, 1.0 / scalefactor);
g2.drawImage(imageGUI, affine, null);
imageGUI = scaled;
return image;
} } | public class class_name {
public T next() {
if( loop ) {
if( forwards ) {
if( index >= fileNames.size() ) {
index = fileNames.size()-1; // depends on control dependency: [if], data = [none]
forwards = false; // depends on control dependency: [if], data = [none]
}
} else {
if( index < 0 ) {
index = 0; // depends on control dependency: [if], data = [none]
forwards = true; // depends on control dependency: [if], data = [none]
}
}
}
if( forwards )
imageGUI = UtilImageIO.loadImage(fileNames.get(index++));
else
imageGUI = UtilImageIO.loadImage(fileNames.get(index--));
if( imageGUI == null )
return null;
image = type.createImage(imageGUI.getWidth(),imageGUI.getHeight());
ConvertBufferedImage.convertFrom(imageGUI, image,true);
// no changes needed so return the original
if (scalefactor == 1)
return image;
// scale down the image
int width = image.getWidth() / scalefactor;
int height = image.getHeight() / scalefactor;
if (scaled == null || scaled.getWidth() != width || scaled.getHeight() != height) {
scaled = new BufferedImage(width, height, imageGUI.getType()); // depends on control dependency: [if], data = [none]
}
Graphics2D g2 = scaled.createGraphics();
AffineTransform affine = new AffineTransform();
affine.setToScale(1.0 / scalefactor, 1.0 / scalefactor);
g2.drawImage(imageGUI, affine, null);
imageGUI = scaled;
return image;
} } |
public class class_name {
public Boolean getFinalMasterTransStatus() {
if(finalMasterTransStatus == null){
//check by logs first
finalMasterTransStatus = checkTransStatusByLogs();
//then check by API
if(finalMasterTransStatus == null){
finalMasterTransStatus = transStatusChecker.checkTransactionStatus(getLogCollection().getAppId(),getLogCollection().getBusCode(), getLogCollection().getTrxId());
}
}
return finalMasterTransStatus;
} } | public class class_name {
public Boolean getFinalMasterTransStatus() {
if(finalMasterTransStatus == null){
//check by logs first
finalMasterTransStatus = checkTransStatusByLogs();
// depends on control dependency: [if], data = [none]
//then check by API
if(finalMasterTransStatus == null){
finalMasterTransStatus = transStatusChecker.checkTransactionStatus(getLogCollection().getAppId(),getLogCollection().getBusCode(), getLogCollection().getTrxId());
// depends on control dependency: [if], data = [none]
}
}
return finalMasterTransStatus;
} } |
public class class_name {
public synchronized static void init(final NewExtensionListener _listener)
{
PeerMonitor.listener = _listener;
if (PeerMonitor.self == null)
{
PeerMonitor.self = new PeerMonitor();
}
else if (_listener != null)
{
logger.error("Call to PeerMonitor.init, but it's already initialized. Listener will not be set");
}
} } | public class class_name {
public synchronized static void init(final NewExtensionListener _listener)
{
PeerMonitor.listener = _listener;
if (PeerMonitor.self == null)
{
PeerMonitor.self = new PeerMonitor();
// depends on control dependency: [if], data = [none]
}
else if (_listener != null)
{
logger.error("Call to PeerMonitor.init, but it's already initialized. Listener will not be set");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final void addRemoteRepository(String id, String type, String url) {
if (this.repositoryIds.add(id) ) {
getRemoteRepositories().add(new RemoteRepository(id, type, url));
}
} } | public class class_name {
public final void addRemoteRepository(String id, String type, String url) {
if (this.repositoryIds.add(id) ) {
getRemoteRepositories().add(new RemoteRepository(id, type, url)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static List<Point> decodeStepPoints(DirectionsRoute directionsRoute, List<Point> currentPoints,
int legIndex, int stepIndex) {
List<RouteLeg> legs = directionsRoute.legs();
if (hasInvalidLegs(legs)) {
return currentPoints;
}
List<LegStep> steps = legs.get(legIndex).steps();
if (hasInvalidSteps(steps)) {
return currentPoints;
}
boolean invalidStepIndex = stepIndex < 0 || stepIndex > steps.size() - 1;
if (invalidStepIndex) {
return currentPoints;
}
LegStep step = steps.get(stepIndex);
if (step == null) {
return currentPoints;
}
String stepGeometry = step.geometry();
if (stepGeometry != null) {
return PolylineUtils.decode(stepGeometry, PRECISION_6);
}
return currentPoints;
} } | public class class_name {
static List<Point> decodeStepPoints(DirectionsRoute directionsRoute, List<Point> currentPoints,
int legIndex, int stepIndex) {
List<RouteLeg> legs = directionsRoute.legs();
if (hasInvalidLegs(legs)) {
return currentPoints; // depends on control dependency: [if], data = [none]
}
List<LegStep> steps = legs.get(legIndex).steps();
if (hasInvalidSteps(steps)) {
return currentPoints; // depends on control dependency: [if], data = [none]
}
boolean invalidStepIndex = stepIndex < 0 || stepIndex > steps.size() - 1;
if (invalidStepIndex) {
return currentPoints; // depends on control dependency: [if], data = [none]
}
LegStep step = steps.get(stepIndex);
if (step == null) {
return currentPoints; // depends on control dependency: [if], data = [none]
}
String stepGeometry = step.geometry();
if (stepGeometry != null) {
return PolylineUtils.decode(stepGeometry, PRECISION_6); // depends on control dependency: [if], data = [(stepGeometry]
}
return currentPoints;
} } |
public class class_name {
static byte[] ip2ByteArray(String ip) {
boolean ipv6Expected = false;
if (ip.charAt(0) == '[') {
// This is supposed to be an IPv6 literal
if (ip.length() > 2 && ip.charAt(ip.length() - 1) == ']') {
ip = ip.substring(1, ip.length() - 1);
ipv6Expected = true;
} else {
// This was supposed to be a IPv6 address, but it's not!
throw new IllegalArgumentException(ip + ": invalid IPv6 address");
}
}
if (Character.digit(ip.charAt(0), 16) != -1 || (ip.charAt(0) == ':')) {
// see if it is IPv4 address
byte[] address = IPAddressUtil.textToNumericFormatV4(ip);
if (address != null) return address;
// see if it is IPv6 address
// Check if a numeric or string zone id is present
address = IPAddressUtil.textToNumericFormatV6(ip);
if (address != null) return address;
if (ipv6Expected) {
throw new IllegalArgumentException(ip + ": invalid IPv6 address");
} else {
throw new IllegalArgumentException(ip + ": invalid IP address");
}
} else {
throw new IllegalArgumentException(ip + ": invalid IP address");
}
} } | public class class_name {
static byte[] ip2ByteArray(String ip) {
boolean ipv6Expected = false;
if (ip.charAt(0) == '[') {
// This is supposed to be an IPv6 literal
if (ip.length() > 2 && ip.charAt(ip.length() - 1) == ']') {
ip = ip.substring(1, ip.length() - 1); // depends on control dependency: [if], data = [none]
ipv6Expected = true; // depends on control dependency: [if], data = [none]
} else {
// This was supposed to be a IPv6 address, but it's not!
throw new IllegalArgumentException(ip + ": invalid IPv6 address");
}
}
if (Character.digit(ip.charAt(0), 16) != -1 || (ip.charAt(0) == ':')) {
// see if it is IPv4 address
byte[] address = IPAddressUtil.textToNumericFormatV4(ip);
if (address != null) return address;
// see if it is IPv6 address
// Check if a numeric or string zone id is present
address = IPAddressUtil.textToNumericFormatV6(ip); // depends on control dependency: [if], data = [none]
if (address != null) return address;
if (ipv6Expected) {
throw new IllegalArgumentException(ip + ": invalid IPv6 address");
} else {
throw new IllegalArgumentException(ip + ": invalid IP address");
}
} else {
throw new IllegalArgumentException(ip + ": invalid IP address");
}
} } |
public class class_name {
static Set<String> getJavaDefaultTypes() {
if (javaDefaultTypes == null) {
javaDefaultTypes = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
"AbstractMethodError",
"Appendable",
"ArithmeticException",
"ArrayIndexOutOfBoundsException",
"ArrayStoreException",
"AssertionError",
"AutoCloseable",
"Boolean",
"BootstrapMethodError",
"Byte",
"Character",
"CharSequence",
"Class",
"ClassCastException",
"ClassCircularityError",
"ClassFormatError",
"ClassLoader",
"ClassNotFoundException",
"ClassValue",
"Cloneable",
"CloneNotSupportedException",
"Comparable",
"Compiler",
"Deprecated",
"Double",
"Enum",
"EnumConstantNotPresentException",
"Error",
"Exception",
"ExceptionInInitializerError",
"Float",
"FunctionalInterface",
"IllegalAccessError",
"IllegalAccessException",
"IllegalArgumentException",
"IllegalCallerException",
"IllegalMonitorStateException",
"IllegalStateException",
"IllegalThreadStateException",
"IncompatibleClassChangeError",
"IndexOutOfBoundsException",
"InheritableThreadLocal",
"InstantiationError",
"InstantiationException",
"Integer",
"InternalError",
"InterruptedException",
"Iterable",
"LayerInstantiationException",
"LinkageError",
"Long",
"Math",
"Module",
"ModuleLayer",
"NegativeArraySizeException",
"NoClassDefFoundError",
"NoSuchFieldError",
"NoSuchFieldException",
"NoSuchMethodError",
"NoSuchMethodException",
"NullPointerException",
"Number",
"NumberFormatException",
"Object",
"OutOfMemoryError",
"Override",
"Package",
"Process",
"ProcessBuilder",
"ProcessHandle",
"Readable",
"ReflectiveOperationException",
"Runnable",
"Runtime",
"RuntimeException",
"RuntimePermission",
"SafeVarargs",
"SecurityException",
"SecurityManager",
"Short",
"StackOverflowError",
"StackTraceElement",
"StackWalker",
"StrictMath",
"String",
"StringBuffer",
"StringBuilder",
"StringIndexOutOfBoundsException",
"SuppressWarnings",
"System",
"Thread",
"ThreadDeath",
"ThreadGroup",
"ThreadLocal",
"Throwable",
"TypeNotPresentException",
"UnknownError",
"UnsatisfiedLinkError",
"UnsupportedClassVersionError",
"UnsupportedOperationException",
"VerifyError",
"VirtualMachineError",
"Void",
"boolean",
"byte",
"char",
"double",
"float",
"int",
"long",
"short",
"void")));
}
return javaDefaultTypes;
} } | public class class_name {
static Set<String> getJavaDefaultTypes() {
if (javaDefaultTypes == null) {
javaDefaultTypes = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
"AbstractMethodError",
"Appendable",
"ArithmeticException",
"ArrayIndexOutOfBoundsException",
"ArrayStoreException",
"AssertionError",
"AutoCloseable",
"Boolean",
"BootstrapMethodError",
"Byte",
"Character",
"CharSequence",
"Class",
"ClassCastException",
"ClassCircularityError",
"ClassFormatError",
"ClassLoader",
"ClassNotFoundException",
"ClassValue",
"Cloneable",
"CloneNotSupportedException",
"Comparable",
"Compiler",
"Deprecated",
"Double",
"Enum",
"EnumConstantNotPresentException",
"Error",
"Exception",
"ExceptionInInitializerError",
"Float",
"FunctionalInterface",
"IllegalAccessError",
"IllegalAccessException",
"IllegalArgumentException",
"IllegalCallerException",
"IllegalMonitorStateException",
"IllegalStateException",
"IllegalThreadStateException",
"IncompatibleClassChangeError",
"IndexOutOfBoundsException",
"InheritableThreadLocal",
"InstantiationError",
"InstantiationException",
"Integer",
"InternalError",
"InterruptedException",
"Iterable",
"LayerInstantiationException",
"LinkageError",
"Long",
"Math",
"Module",
"ModuleLayer",
"NegativeArraySizeException",
"NoClassDefFoundError",
"NoSuchFieldError",
"NoSuchFieldException",
"NoSuchMethodError",
"NoSuchMethodException",
"NullPointerException",
"Number",
"NumberFormatException",
"Object",
"OutOfMemoryError",
"Override",
"Package",
"Process",
"ProcessBuilder",
"ProcessHandle",
"Readable",
"ReflectiveOperationException",
"Runnable",
"Runtime",
"RuntimeException",
"RuntimePermission",
"SafeVarargs",
"SecurityException",
"SecurityManager",
"Short",
"StackOverflowError",
"StackTraceElement",
"StackWalker",
"StrictMath",
"String",
"StringBuffer",
"StringBuilder",
"StringIndexOutOfBoundsException",
"SuppressWarnings",
"System",
"Thread",
"ThreadDeath",
"ThreadGroup",
"ThreadLocal",
"Throwable",
"TypeNotPresentException",
"UnknownError",
"UnsatisfiedLinkError",
"UnsupportedClassVersionError",
"UnsupportedOperationException",
"VerifyError",
"VirtualMachineError",
"Void",
"boolean",
"byte",
"char",
"double",
"float",
"int",
"long",
"short",
"void"))); // depends on control dependency: [if], data = [none]
}
return javaDefaultTypes;
} } |
public class class_name {
protected void exportSuccessfulResult(String prefix, R result) {
if (prefix == null) {
return;
}
setPropertyIfNoNull(prefix, "input", result.getInput());
if (!result.isSuccessful()) {
return;
}
setPropertyIfNoNull(prefix, "input", result.getInput());
setPropertyIfNoNull(prefix, "before", result.getBefore());
setPropertyIfNoNull(prefix, "group", result.group());
setPropertyIfNoNull(prefix, "success", "true");
for (int i = 1; i <= result.groupCount(); i++) {
setPropertyIfNoNull(prefix, "group." + i, result.group(i));
}
} } | public class class_name {
protected void exportSuccessfulResult(String prefix, R result) {
if (prefix == null) {
return; // depends on control dependency: [if], data = [none]
}
setPropertyIfNoNull(prefix, "input", result.getInput());
if (!result.isSuccessful()) {
return; // depends on control dependency: [if], data = [none]
}
setPropertyIfNoNull(prefix, "input", result.getInput());
setPropertyIfNoNull(prefix, "before", result.getBefore());
setPropertyIfNoNull(prefix, "group", result.group());
setPropertyIfNoNull(prefix, "success", "true");
for (int i = 1; i <= result.groupCount(); i++) {
setPropertyIfNoNull(prefix, "group." + i, result.group(i)); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private String[] contextParameterNames(Method method) {
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
String[] names = new String[parameterAnnotations.length];
for (int i = 0; i < parameterAnnotations.length; i++) {
for (Annotation annotation : parameterAnnotations[i]) {
names[i] = contextName(annotation);
}
}
return names;
} } | public class class_name {
private String[] contextParameterNames(Method method) {
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
String[] names = new String[parameterAnnotations.length];
for (int i = 0; i < parameterAnnotations.length; i++) {
for (Annotation annotation : parameterAnnotations[i]) {
names[i] = contextName(annotation); // depends on control dependency: [for], data = [annotation]
}
}
return names;
} } |
public class class_name {
public String getUrl() {
StringBuilder url = new StringBuilder(100);
url.append("jdbc:postgresql://");
url.append(serverName);
if (portNumber != 0) {
url.append(":").append(portNumber);
}
url.append("/").append(URLCoder.encode(databaseName));
StringBuilder query = new StringBuilder(100);
for (PGProperty property : PGProperty.values()) {
if (property.isPresent(properties)) {
if (query.length() != 0) {
query.append("&");
}
query.append(property.getName());
query.append("=");
query.append(URLCoder.encode(property.get(properties)));
}
}
if (query.length() > 0) {
url.append("?");
url.append(query);
}
return url.toString();
} } | public class class_name {
public String getUrl() {
StringBuilder url = new StringBuilder(100);
url.append("jdbc:postgresql://");
url.append(serverName);
if (portNumber != 0) {
url.append(":").append(portNumber); // depends on control dependency: [if], data = [(portNumber]
}
url.append("/").append(URLCoder.encode(databaseName));
StringBuilder query = new StringBuilder(100);
for (PGProperty property : PGProperty.values()) {
if (property.isPresent(properties)) {
if (query.length() != 0) {
query.append("&"); // depends on control dependency: [if], data = [none]
}
query.append(property.getName()); // depends on control dependency: [if], data = [none]
query.append("="); // depends on control dependency: [if], data = [none]
query.append(URLCoder.encode(property.get(properties))); // depends on control dependency: [if], data = [none]
}
}
if (query.length() > 0) {
url.append("?"); // depends on control dependency: [if], data = [none]
url.append(query); // depends on control dependency: [if], data = [none]
}
return url.toString();
} } |
public class class_name {
public String
printFlags() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 16; i++)
if (validFlag(i) && getFlag(i)) {
sb.append(Flags.string(i));
sb.append(" ");
}
return sb.toString();
} } | public class class_name {
public String
printFlags() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 16; i++)
if (validFlag(i) && getFlag(i)) {
sb.append(Flags.string(i)); // depends on control dependency: [if], data = [none]
sb.append(" "); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} } |
public class class_name {
public List<String> getProcessList(String queueName)
{
// このメソッドを呼び出す前に、
// this#initProcessLists()を利用してprocessListsを初期しておくこと。
if (this.processLists == null)
{
return null;
}
return getProcessLists().get(queueName);
} } | public class class_name {
public List<String> getProcessList(String queueName)
{
// このメソッドを呼び出す前に、
// this#initProcessLists()を利用してprocessListsを初期しておくこと。
if (this.processLists == null)
{
return null; // depends on control dependency: [if], data = [none]
}
return getProcessLists().get(queueName);
} } |
public class class_name {
@RequirePOST
public JSONArray doPrevalidateConfig(StaplerRequest req) throws IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
JSONArray response = new JSONArray();
for (Map.Entry<String,VersionNumber> p : parseRequestedPlugins(req.getInputStream()).entrySet()) {
PluginWrapper pw = getPlugin(p.getKey());
JSONObject j = new JSONObject()
.accumulate("name", p.getKey())
.accumulate("version", p.getValue().toString());
if (pw == null) { // install new
response.add(j.accumulate("mode", "missing"));
} else if (pw.isOlderThan(p.getValue())) { // upgrade
response.add(j.accumulate("mode", "old"));
} // else already good
}
return response;
} } | public class class_name {
@RequirePOST
public JSONArray doPrevalidateConfig(StaplerRequest req) throws IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
JSONArray response = new JSONArray();
for (Map.Entry<String,VersionNumber> p : parseRequestedPlugins(req.getInputStream()).entrySet()) {
PluginWrapper pw = getPlugin(p.getKey());
JSONObject j = new JSONObject()
.accumulate("name", p.getKey())
.accumulate("version", p.getValue().toString());
if (pw == null) { // install new
response.add(j.accumulate("mode", "missing")); // depends on control dependency: [if], data = [none]
} else if (pw.isOlderThan(p.getValue())) { // upgrade
response.add(j.accumulate("mode", "old")); // depends on control dependency: [if], data = [none]
} // else already good
}
return response;
} } |
public class class_name {
public void endStage() {
if (this.currentStage != null) {
long time = System.currentTimeMillis() - this.currentStageStart;
this.timings.add(new Stage(this.currentStage, time));
if (reportAsMetrics && submitter.getMetricContext().isPresent()) {
String timerName = submitter.getNamespace() + "." + name + "." + this.currentStage;
submitter.getMetricContext().get().timer(timerName).update(time, TimeUnit.MILLISECONDS);
}
}
this.currentStage = null;
} } | public class class_name {
public void endStage() {
if (this.currentStage != null) {
long time = System.currentTimeMillis() - this.currentStageStart;
this.timings.add(new Stage(this.currentStage, time)); // depends on control dependency: [if], data = [(this.currentStage]
if (reportAsMetrics && submitter.getMetricContext().isPresent()) {
String timerName = submitter.getNamespace() + "." + name + "." + this.currentStage;
submitter.getMetricContext().get().timer(timerName).update(time, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
}
}
this.currentStage = null;
} } |
public class class_name {
private DescribeVolumesResponseType describeVolumes(final String token, final int pMaxResults) {
DescribeVolumesResponseType ret = new DescribeVolumesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
Set<String> idsInThisPageIfToken = null;
if (null != token && token.length() > 0) {
// should retrieve next page using token
idsInThisPageIfToken = token2RemainingDescribedVolumeIDs.get(token);
if (null == idsInThisPageIfToken) {
// mock real AWS' 400 error message in case of invalid token
throw new BadEc2RequestException("DescribeVolumes",
"AWS Error Code: InvalidParameterValue, AWS Error Message: Unable to parse pagination token");
}
}
/**
* The calculated maxResults used in pagination.
*/
int maxResults = pMaxResults;
if (maxResults < 1) {
maxResults = MAX_RESULTS_DEFAULT;
}
List<String> idsToDescribe = null;
if (null != token && token.length() > 0) {
idsToDescribe = new ArrayList<String>(
token2RemainingDescribedVolumeIDs.remove(token));
} else {
// will return all instance IDs if the param 'instanceIDs' is empty here
idsToDescribe = mockVolumeController.listVolumeIDs();
}
if (idsToDescribe.size() > maxResults) {
// generate next token (for next page of results) and put the remaining IDs to the map for later use
String newToken = generateToken();
// deduct the current page instances from the total remaining and put the rest into map again, with new
// token as key
token2RemainingDescribedVolumeIDs.put(newToken,
new TreeSet<String>(idsToDescribe.subList(maxResults, idsToDescribe.size())));
// set idsToDescribe as the top maxResults instance IDs
idsToDescribe = new ArrayList<String>(idsToDescribe.subList(0, maxResults));
// put the new token into response
ret.setNextToken(newToken);
}
DescribeVolumesSetResponseType volumesSet = new DescribeVolumesSetResponseType();
int recordCount = 1;
for (Iterator<MockVolume> mockVolume = mockVolumeController.describeVolumes()
.iterator(); mockVolume.hasNext();) {
MockVolume item = mockVolume.next();
if (isVolumeIdExists(idsToDescribe, item.getVolumeId())) {
DescribeVolumesSetItemResponseType volumesSetItem = new DescribeVolumesSetItemResponseType();
volumesSetItem.setVolumeId(item.getVolumeId());
volumesSetItem.setVolumeType(item.getVolumeType());
volumesSetItem.setSize(item.getSize());
volumesSetItem.setAvailabilityZone(item.getAvailabilityZone());
volumesSetItem.setStatus(MOCK_VOLUME_STATUS);
AttachmentSetResponseType attachmentSet = new AttachmentSetResponseType();
AttachmentSetItemResponseType attachmentSetItem = new AttachmentSetItemResponseType();
attachmentSetItem.setVolumeId(item.getVolumeId());
attachmentSetItem.setInstanceId(MOCK_INSTANCE_ID);
attachmentSetItem.setDevice("/dev/sdh");
attachmentSetItem.setStatus("attached");
attachmentSet.getItem().add(attachmentSetItem);
volumesSetItem.setAttachmentSet(attachmentSet);
volumesSet.getItem().add(volumesSetItem);
recordCount++;
}
if (recordCount > maxResults) {
break;
}
}
ret.setVolumeSet(volumesSet);
return ret;
} } | public class class_name {
private DescribeVolumesResponseType describeVolumes(final String token, final int pMaxResults) {
DescribeVolumesResponseType ret = new DescribeVolumesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
Set<String> idsInThisPageIfToken = null;
if (null != token && token.length() > 0) {
// should retrieve next page using token
idsInThisPageIfToken = token2RemainingDescribedVolumeIDs.get(token); // depends on control dependency: [if], data = [none]
if (null == idsInThisPageIfToken) {
// mock real AWS' 400 error message in case of invalid token
throw new BadEc2RequestException("DescribeVolumes",
"AWS Error Code: InvalidParameterValue, AWS Error Message: Unable to parse pagination token");
}
}
/**
* The calculated maxResults used in pagination.
*/
int maxResults = pMaxResults;
if (maxResults < 1) {
maxResults = MAX_RESULTS_DEFAULT; // depends on control dependency: [if], data = [none]
}
List<String> idsToDescribe = null;
if (null != token && token.length() > 0) {
idsToDescribe = new ArrayList<String>(
token2RemainingDescribedVolumeIDs.remove(token)); // depends on control dependency: [if], data = [none]
} else {
// will return all instance IDs if the param 'instanceIDs' is empty here
idsToDescribe = mockVolumeController.listVolumeIDs(); // depends on control dependency: [if], data = [none]
}
if (idsToDescribe.size() > maxResults) {
// generate next token (for next page of results) and put the remaining IDs to the map for later use
String newToken = generateToken();
// deduct the current page instances from the total remaining and put the rest into map again, with new
// token as key
token2RemainingDescribedVolumeIDs.put(newToken,
new TreeSet<String>(idsToDescribe.subList(maxResults, idsToDescribe.size()))); // depends on control dependency: [if], data = [none]
// set idsToDescribe as the top maxResults instance IDs
idsToDescribe = new ArrayList<String>(idsToDescribe.subList(0, maxResults)); // depends on control dependency: [if], data = [maxResults)]
// put the new token into response
ret.setNextToken(newToken); // depends on control dependency: [if], data = [none]
}
DescribeVolumesSetResponseType volumesSet = new DescribeVolumesSetResponseType();
int recordCount = 1;
for (Iterator<MockVolume> mockVolume = mockVolumeController.describeVolumes()
.iterator(); mockVolume.hasNext();) {
MockVolume item = mockVolume.next();
if (isVolumeIdExists(idsToDescribe, item.getVolumeId())) {
DescribeVolumesSetItemResponseType volumesSetItem = new DescribeVolumesSetItemResponseType();
volumesSetItem.setVolumeId(item.getVolumeId()); // depends on control dependency: [if], data = [none]
volumesSetItem.setVolumeType(item.getVolumeType()); // depends on control dependency: [if], data = [none]
volumesSetItem.setSize(item.getSize()); // depends on control dependency: [if], data = [none]
volumesSetItem.setAvailabilityZone(item.getAvailabilityZone()); // depends on control dependency: [if], data = [none]
volumesSetItem.setStatus(MOCK_VOLUME_STATUS); // depends on control dependency: [if], data = [none]
AttachmentSetResponseType attachmentSet = new AttachmentSetResponseType();
AttachmentSetItemResponseType attachmentSetItem = new AttachmentSetItemResponseType();
attachmentSetItem.setVolumeId(item.getVolumeId()); // depends on control dependency: [if], data = [none]
attachmentSetItem.setInstanceId(MOCK_INSTANCE_ID); // depends on control dependency: [if], data = [none]
attachmentSetItem.setDevice("/dev/sdh"); // depends on control dependency: [if], data = [none]
attachmentSetItem.setStatus("attached"); // depends on control dependency: [if], data = [none]
attachmentSet.getItem().add(attachmentSetItem); // depends on control dependency: [if], data = [none]
volumesSetItem.setAttachmentSet(attachmentSet); // depends on control dependency: [if], data = [none]
volumesSet.getItem().add(volumesSetItem); // depends on control dependency: [if], data = [none]
recordCount++; // depends on control dependency: [if], data = [none]
}
if (recordCount > maxResults) {
break;
}
}
ret.setVolumeSet(volumesSet);
return ret;
} } |
public class class_name {
@Override
public String toJSON() {
try {
JSONObject o = new JSONObject();
o.put(KEY_TYPE, mType);
o.put(KEY_TITLE, mTitle);
o.put(KEY_MESSAGE, mMessage);
return o.toString();
} catch (JSONException e) {
Log.e(TAG, "Error marshalling:", e);
return "";
}
} } | public class class_name {
@Override
public String toJSON() {
try {
JSONObject o = new JSONObject();
o.put(KEY_TYPE, mType); // depends on control dependency: [try], data = [none]
o.put(KEY_TITLE, mTitle); // depends on control dependency: [try], data = [none]
o.put(KEY_MESSAGE, mMessage); // depends on control dependency: [try], data = [none]
return o.toString(); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
Log.e(TAG, "Error marshalling:", e);
return "";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void init(ContextConfig config) {
this.config = config;
PropertyMap properties = config.getProperties();
String edenSpace = properties.getString("EdenSpace");
if (edenSpace != null) {
this.setEdenMemoryPool(edenSpace);
}
String survivorSpace = properties.getString("SurvivorSpace");
if (survivorSpace != null) {
this.setSurvivorMemoryPool(survivorSpace);
}
String tenuredGen = properties.getString("TenuredGen");
if (tenuredGen != null) {
this.setTenuredMemoryPool(tenuredGen);
}
String permGen = properties.getString("PermGen");
if (permGen != null) {
this.setPermGenMemoryPool(permGen);
}
String youngCollector = properties.getString("YoungCollector");
if (youngCollector != null) {
this.setYoungCollector(youngCollector);
}
String tenuredCollector = properties.getString("TenuredCollector");
if (tenuredCollector != null) {
this.setTenuredCollector(tenuredCollector);
}
// enable contention
getThreadMXBean().setThreadCpuTimeEnabled(true);
getThreadMXBean().setThreadContentionMonitoringEnabled(true);
// load the settings if possible
loadJMXSettings();
} } | public class class_name {
public void init(ContextConfig config) {
this.config = config;
PropertyMap properties = config.getProperties();
String edenSpace = properties.getString("EdenSpace");
if (edenSpace != null) {
this.setEdenMemoryPool(edenSpace);
// depends on control dependency: [if], data = [(edenSpace]
}
String survivorSpace = properties.getString("SurvivorSpace");
if (survivorSpace != null) {
this.setSurvivorMemoryPool(survivorSpace);
// depends on control dependency: [if], data = [(survivorSpace]
}
String tenuredGen = properties.getString("TenuredGen");
if (tenuredGen != null) {
this.setTenuredMemoryPool(tenuredGen);
// depends on control dependency: [if], data = [(tenuredGen]
}
String permGen = properties.getString("PermGen");
if (permGen != null) {
this.setPermGenMemoryPool(permGen);
// depends on control dependency: [if], data = [(permGen]
}
String youngCollector = properties.getString("YoungCollector");
if (youngCollector != null) {
this.setYoungCollector(youngCollector);
// depends on control dependency: [if], data = [(youngCollector]
}
String tenuredCollector = properties.getString("TenuredCollector");
if (tenuredCollector != null) {
this.setTenuredCollector(tenuredCollector);
// depends on control dependency: [if], data = [(tenuredCollector]
}
// enable contention
getThreadMXBean().setThreadCpuTimeEnabled(true);
getThreadMXBean().setThreadContentionMonitoringEnabled(true);
// load the settings if possible
loadJMXSettings();
} } |
public class class_name {
private void init(final String title, final int initialWidth, final int initialHeight,
final Component component)
{
if (title != null)
{
setTitle(title);
}
setInitialWidth(initialWidth);
setInitialHeight(initialHeight);
setContent(component);
} } | public class class_name {
private void init(final String title, final int initialWidth, final int initialHeight,
final Component component)
{
if (title != null)
{
setTitle(title);
// depends on control dependency: [if], data = [(title]
}
setInitialWidth(initialWidth);
setInitialHeight(initialHeight);
setContent(component);
} } |
public class class_name {
public java.lang.String getFullName() {
java.lang.Object ref = fullName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
fullName_ = s;
return s;
}
} } | public class class_name {
public java.lang.String getFullName() {
java.lang.Object ref = fullName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
fullName_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setTraceIds(java.util.Collection<String> traceIds) {
if (traceIds == null) {
this.traceIds = null;
return;
}
this.traceIds = new java.util.ArrayList<String>(traceIds);
} } | public class class_name {
public void setTraceIds(java.util.Collection<String> traceIds) {
if (traceIds == null) {
this.traceIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.traceIds = new java.util.ArrayList<String>(traceIds);
} } |
public class class_name {
private void initEntityMetadata(Entity entity) {
String kind = entity.kind();
if (kind.trim().length() == 0) {
kind = entityClass.getSimpleName();
}
entityMetadata = new EntityMetadata(entityClass, kind);
} } | public class class_name {
private void initEntityMetadata(Entity entity) {
String kind = entity.kind();
if (kind.trim().length() == 0) {
kind = entityClass.getSimpleName(); // depends on control dependency: [if], data = [none]
}
entityMetadata = new EntityMetadata(entityClass, kind);
} } |
public class class_name {
private void onAttemptComplete(Throwable t) {
try {
if (circuitBreaker != null) {
if (t instanceof CircuitBreakerOpenException) {
metricRecorder.incrementCircuitBreakerCallsCircuitOpenCount();
} else if (circuitBreaker.isFailure(null, t)) {
metricRecorder.incrementCircuitBreakerCallsFailureCount();
} else {
metricRecorder.incrementCircuitBreakerCallsSuccessCount();
}
}
if (t instanceof TimeoutException) {
metricRecorder.incrementTimeoutTrueCount();
} else {
metricRecorder.incrementTimeoutFalseCount();
}
} catch (RuntimeException e) {
// Unchecked exceptions thrown here can be swallowed by Failsafe
// This catch ensures we at least get an FFDC
throw e;
}
} } | public class class_name {
private void onAttemptComplete(Throwable t) {
try {
if (circuitBreaker != null) {
if (t instanceof CircuitBreakerOpenException) {
metricRecorder.incrementCircuitBreakerCallsCircuitOpenCount(); // depends on control dependency: [if], data = [none]
} else if (circuitBreaker.isFailure(null, t)) {
metricRecorder.incrementCircuitBreakerCallsFailureCount(); // depends on control dependency: [if], data = [none]
} else {
metricRecorder.incrementCircuitBreakerCallsSuccessCount(); // depends on control dependency: [if], data = [none]
}
}
if (t instanceof TimeoutException) {
metricRecorder.incrementTimeoutTrueCount(); // depends on control dependency: [if], data = [none]
} else {
metricRecorder.incrementTimeoutFalseCount(); // depends on control dependency: [if], data = [none]
}
} catch (RuntimeException e) {
// Unchecked exceptions thrown here can be swallowed by Failsafe
// This catch ensures we at least get an FFDC
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final DSLMapParser.pattern_return pattern() throws RecognitionException {
DSLMapParser.pattern_return retval = new DSLMapParser.pattern_return();
retval.start = input.LT(1);
Object root_0 = null;
Token DOT28=null;
Token MISC29=null;
Token LEFT_CURLY30=null;
Token RIGHT_CURLY32=null;
Token LEFT_SQUARE33=null;
Token RIGHT_SQUARE35=null;
ParserRuleReturnScope literal27 =null;
ParserRuleReturnScope literal31 =null;
ParserRuleReturnScope pattern34 =null;
Object DOT28_tree=null;
Object MISC29_tree=null;
Object LEFT_CURLY30_tree=null;
Object RIGHT_CURLY32_tree=null;
Object LEFT_SQUARE33_tree=null;
Object RIGHT_SQUARE35_tree=null;
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:9: ( ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+ )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:11: ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
{
root_0 = (Object)adaptor.nil();
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:11: ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
int cnt16=0;
loop16:
while (true) {
int alt16=6;
switch ( input.LA(1) ) {
case RIGHT_SQUARE:
{
int LA16_2 = input.LA(2);
if ( (synpred24_DSLMap()) ) {
alt16=1;
}
}
break;
case LEFT_SQUARE:
{
int LA16_3 = input.LA(2);
if ( (synpred24_DSLMap()) ) {
alt16=1;
}
else if ( (synpred28_DSLMap()) ) {
alt16=5;
}
}
break;
case DOT:
{
alt16=2;
}
break;
case MISC:
{
alt16=3;
}
break;
case LEFT_CURLY:
{
alt16=4;
}
break;
case COLON:
case LITERAL:
{
alt16=1;
}
break;
}
switch (alt16) {
case 1 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:13: literal
{
pushFollow(FOLLOW_literal_in_pattern1290);
literal27=literal();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, literal27.getTree());
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:221:13: DOT
{
DOT28=(Token)match(input,DOT,FOLLOW_DOT_in_pattern1304); if (state.failed) return retval;
if ( state.backtracking==0 ) {
DOT28_tree = (Object)adaptor.create(DOT28);
adaptor.addChild(root_0, DOT28_tree);
}
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:222:13: MISC
{
MISC29=(Token)match(input,MISC,FOLLOW_MISC_in_pattern1318); if (state.failed) return retval;
if ( state.backtracking==0 ) {
MISC29_tree = (Object)adaptor.create(MISC29);
adaptor.addChild(root_0, MISC29_tree);
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:223:13: LEFT_CURLY literal RIGHT_CURLY
{
LEFT_CURLY30=(Token)match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_pattern1332); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFT_CURLY30_tree = (Object)adaptor.create(LEFT_CURLY30);
adaptor.addChild(root_0, LEFT_CURLY30_tree);
}
pushFollow(FOLLOW_literal_in_pattern1334);
literal31=literal();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, literal31.getTree());
RIGHT_CURLY32=(Token)match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_pattern1336); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHT_CURLY32_tree = (Object)adaptor.create(RIGHT_CURLY32);
adaptor.addChild(root_0, RIGHT_CURLY32_tree);
}
}
break;
case 5 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:224:13: LEFT_SQUARE pattern RIGHT_SQUARE
{
LEFT_SQUARE33=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_pattern1350); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFT_SQUARE33_tree = (Object)adaptor.create(LEFT_SQUARE33);
adaptor.addChild(root_0, LEFT_SQUARE33_tree);
}
pushFollow(FOLLOW_pattern_in_pattern1352);
pattern34=pattern();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, pattern34.getTree());
RIGHT_SQUARE35=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_pattern1354); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHT_SQUARE35_tree = (Object)adaptor.create(RIGHT_SQUARE35);
adaptor.addChild(root_0, RIGHT_SQUARE35_tree);
}
}
break;
default :
if ( cnt16 >= 1 ) break loop16;
if (state.backtracking>0) {state.failed=true; return retval;}
EarlyExitException eee = new EarlyExitException(16, input);
throw eee;
}
cnt16++;
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} } | public class class_name {
public final DSLMapParser.pattern_return pattern() throws RecognitionException {
DSLMapParser.pattern_return retval = new DSLMapParser.pattern_return();
retval.start = input.LT(1);
Object root_0 = null;
Token DOT28=null;
Token MISC29=null;
Token LEFT_CURLY30=null;
Token RIGHT_CURLY32=null;
Token LEFT_SQUARE33=null;
Token RIGHT_SQUARE35=null;
ParserRuleReturnScope literal27 =null;
ParserRuleReturnScope literal31 =null;
ParserRuleReturnScope pattern34 =null;
Object DOT28_tree=null;
Object MISC29_tree=null;
Object LEFT_CURLY30_tree=null;
Object RIGHT_CURLY32_tree=null;
Object LEFT_SQUARE33_tree=null;
Object RIGHT_SQUARE35_tree=null;
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:9: ( ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+ )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:11: ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
{
root_0 = (Object)adaptor.nil();
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:11: ( literal | DOT | MISC | LEFT_CURLY literal RIGHT_CURLY | LEFT_SQUARE pattern RIGHT_SQUARE )+
int cnt16=0;
loop16:
while (true) {
int alt16=6;
switch ( input.LA(1) ) {
case RIGHT_SQUARE:
{
int LA16_2 = input.LA(2);
if ( (synpred24_DSLMap()) ) {
alt16=1; // depends on control dependency: [if], data = [none]
}
}
break;
case LEFT_SQUARE:
{
int LA16_3 = input.LA(2);
if ( (synpred24_DSLMap()) ) {
alt16=1; // depends on control dependency: [if], data = [none]
}
else if ( (synpred28_DSLMap()) ) {
alt16=5; // depends on control dependency: [if], data = [none]
}
}
break;
case DOT:
{
alt16=2;
}
break;
case MISC:
{
alt16=3;
}
break;
case LEFT_CURLY:
{
alt16=4;
}
break;
case COLON:
case LITERAL:
{
alt16=1;
}
break;
}
switch (alt16) {
case 1 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:220:13: literal
{
pushFollow(FOLLOW_literal_in_pattern1290);
literal27=literal();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, literal27.getTree());
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:221:13: DOT
{
DOT28=(Token)match(input,DOT,FOLLOW_DOT_in_pattern1304); if (state.failed) return retval;
if ( state.backtracking==0 ) {
DOT28_tree = (Object)adaptor.create(DOT28);
adaptor.addChild(root_0, DOT28_tree);
}
}
break;
case 3 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:222:13: MISC
{
MISC29=(Token)match(input,MISC,FOLLOW_MISC_in_pattern1318); if (state.failed) return retval;
if ( state.backtracking==0 ) {
MISC29_tree = (Object)adaptor.create(MISC29);
adaptor.addChild(root_0, MISC29_tree);
}
}
break;
case 4 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:223:13: LEFT_CURLY literal RIGHT_CURLY
{
LEFT_CURLY30=(Token)match(input,LEFT_CURLY,FOLLOW_LEFT_CURLY_in_pattern1332); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFT_CURLY30_tree = (Object)adaptor.create(LEFT_CURLY30);
adaptor.addChild(root_0, LEFT_CURLY30_tree);
}
pushFollow(FOLLOW_literal_in_pattern1334);
literal31=literal();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, literal31.getTree());
RIGHT_CURLY32=(Token)match(input,RIGHT_CURLY,FOLLOW_RIGHT_CURLY_in_pattern1336); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHT_CURLY32_tree = (Object)adaptor.create(RIGHT_CURLY32);
adaptor.addChild(root_0, RIGHT_CURLY32_tree);
}
}
break;
case 5 :
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:224:13: LEFT_SQUARE pattern RIGHT_SQUARE
{
LEFT_SQUARE33=(Token)match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_pattern1350); if (state.failed) return retval;
if ( state.backtracking==0 ) {
LEFT_SQUARE33_tree = (Object)adaptor.create(LEFT_SQUARE33);
adaptor.addChild(root_0, LEFT_SQUARE33_tree);
}
pushFollow(FOLLOW_pattern_in_pattern1352);
pattern34=pattern();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, pattern34.getTree());
RIGHT_SQUARE35=(Token)match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_pattern1354); if (state.failed) return retval;
if ( state.backtracking==0 ) {
RIGHT_SQUARE35_tree = (Object)adaptor.create(RIGHT_SQUARE35);
adaptor.addChild(root_0, RIGHT_SQUARE35_tree);
}
}
break;
default :
if ( cnt16 >= 1 ) break loop16;
if (state.backtracking>0) {state.failed=true; return retval;}
EarlyExitException eee = new EarlyExitException(16, input);
throw eee;
}
cnt16++;
}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} } |
public class class_name {
@PostConstruct
public void init() {
ArrayList<Node> children = new ArrayList<>();
for (int i = 0; i < 20; i++) {
StackPane child = new StackPane();
double width = Math.random() * 100 + 100;
child.setPrefWidth(width);
double height = Math.random() * 100 + 100;
child.setPrefHeight(height);
JFXDepthManager.setDepth(child, 1);
children.add(child);
// create content
StackPane header = new StackPane();
String headerColor = getDefaultColor(i % 12);
header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor);
VBox.setVgrow(header, Priority.ALWAYS);
StackPane body = new StackPane();
body.setMinHeight(Math.random() * 20 + 50);
VBox content = new VBox();
content.getChildren().addAll(header, body);
body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);");
// create button
JFXButton button = new JFXButton("");
button.setButtonType(ButtonType.RAISED);
button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12)));
button.setPrefSize(40, 40);
button.setRipplerFill(Color.valueOf(headerColor));
button.setScaleX(0);
button.setScaleY(0);
SVGGlyph glyph = new SVGGlyph(-1,
"test",
"M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 "
+ "0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 "
+ "0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 "
+ "528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143"
+ " 11.429 0 20.571 6.286z",
Color.WHITE);
glyph.setSize(20, 20);
button.setGraphic(glyph);
button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
return header.getBoundsInParent().getHeight() - button.getHeight() / 2;
}, header.boundsInParentProperty(), button.heightProperty()));
StackPane.setMargin(button, new Insets(0, 12, 0, 0));
StackPane.setAlignment(button, Pos.TOP_RIGHT);
Timeline animation = new Timeline(new KeyFrame(Duration.millis(240),
new KeyValue(button.scaleXProperty(),
1,
EASE_BOTH),
new KeyValue(button.scaleYProperty(),
1,
EASE_BOTH)));
animation.setDelay(Duration.millis(100 * i + 1000));
animation.play();
child.getChildren().addAll(content, button);
}
masonryPane.getChildren().addAll(children);
Platform.runLater(() -> scrollPane.requestLayout());
JFXScrollPane.smoothScrolling(scrollPane);
} } | public class class_name {
@PostConstruct
public void init() {
ArrayList<Node> children = new ArrayList<>();
for (int i = 0; i < 20; i++) {
StackPane child = new StackPane();
double width = Math.random() * 100 + 100;
child.setPrefWidth(width); // depends on control dependency: [for], data = [none]
double height = Math.random() * 100 + 100;
child.setPrefHeight(height); // depends on control dependency: [for], data = [none]
JFXDepthManager.setDepth(child, 1); // depends on control dependency: [for], data = [none]
children.add(child); // depends on control dependency: [for], data = [none]
// create content
StackPane header = new StackPane();
String headerColor = getDefaultColor(i % 12);
header.setStyle("-fx-background-radius: 5 5 0 0; -fx-background-color: " + headerColor); // depends on control dependency: [for], data = [none]
VBox.setVgrow(header, Priority.ALWAYS); // depends on control dependency: [for], data = [none]
StackPane body = new StackPane();
body.setMinHeight(Math.random() * 20 + 50); // depends on control dependency: [for], data = [none]
VBox content = new VBox();
content.getChildren().addAll(header, body); // depends on control dependency: [for], data = [none]
body.setStyle("-fx-background-radius: 0 0 5 5; -fx-background-color: rgb(255,255,255,0.87);"); // depends on control dependency: [for], data = [none]
// create button
JFXButton button = new JFXButton("");
button.setButtonType(ButtonType.RAISED); // depends on control dependency: [for], data = [none]
button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12))); // depends on control dependency: [for], data = [none]
button.setPrefSize(40, 40); // depends on control dependency: [for], data = [none]
button.setRipplerFill(Color.valueOf(headerColor)); // depends on control dependency: [for], data = [none]
button.setScaleX(0); // depends on control dependency: [for], data = [none]
button.setScaleY(0); // depends on control dependency: [for], data = [none]
SVGGlyph glyph = new SVGGlyph(-1,
"test",
"M1008 6.286q18.857 13.714 15.429 36.571l-146.286 877.714q-2.857 16.571-18.286 25.714-8 4.571-17.714 4.571-6.286 "
+ "0-13.714-2.857l-258.857-105.714-138.286 168.571q-10.286 13.143-28 13.143-7.429 "
+ "0-12.571-2.286-10.857-4-17.429-13.429t-6.571-20.857v-199.429l493.714-605.143-610.857 "
+ "528.571-225.714-92.571q-21.143-8-22.857-31.429-1.143-22.857 18.286-33.714l950.857-548.571q8.571-5.143 18.286-5.143"
+ " 11.429 0 20.571 6.286z",
Color.WHITE);
glyph.setSize(20, 20); // depends on control dependency: [for], data = [none]
button.setGraphic(glyph); // depends on control dependency: [for], data = [none]
button.translateYProperty().bind(Bindings.createDoubleBinding(() -> {
return header.getBoundsInParent().getHeight() - button.getHeight() / 2; // depends on control dependency: [for], data = [none]
}, header.boundsInParentProperty(), button.heightProperty()));
StackPane.setMargin(button, new Insets(0, 12, 0, 0));
StackPane.setAlignment(button, Pos.TOP_RIGHT);
Timeline animation = new Timeline(new KeyFrame(Duration.millis(240),
new KeyValue(button.scaleXProperty(),
1,
EASE_BOTH),
new KeyValue(button.scaleYProperty(),
1,
EASE_BOTH)));
animation.setDelay(Duration.millis(100 * i + 1000));
animation.play();
child.getChildren().addAll(content, button);
}
masonryPane.getChildren().addAll(children);
Platform.runLater(() -> scrollPane.requestLayout());
JFXScrollPane.smoothScrolling(scrollPane);
} } |
public class class_name {
public boolean isValid() {
boolean valid = markers.isEmpty() || markers.size() >= 3;
if (valid) {
for (PolygonHoleMarkers hole : holes) {
valid = hole.isValid();
if (!valid) {
break;
}
}
}
return valid;
} } | public class class_name {
public boolean isValid() {
boolean valid = markers.isEmpty() || markers.size() >= 3;
if (valid) {
for (PolygonHoleMarkers hole : holes) {
valid = hole.isValid(); // depends on control dependency: [for], data = [hole]
if (!valid) {
break;
}
}
}
return valid;
} } |
public class class_name {
public final synchronized void addVetoableChangeListener(
VetoableChangeListener listener) {
if (listener == null) {
return;
}
if (vetoSupport == null) {
vetoSupport = new VetoableChangeSupport(this);
}
vetoSupport.addVetoableChangeListener(listener);
} } | public class class_name {
public final synchronized void addVetoableChangeListener(
VetoableChangeListener listener) {
if (listener == null) {
return; // depends on control dependency: [if], data = [none]
}
if (vetoSupport == null) {
vetoSupport = new VetoableChangeSupport(this); // depends on control dependency: [if], data = [none]
}
vetoSupport.addVetoableChangeListener(listener);
} } |
public class class_name {
public static <T> ArrayList<T> distinct(Collection<T> collection) {
if (isEmpty(collection)) {
return new ArrayList<>();
} else if (collection instanceof Set) {
return new ArrayList<>(collection);
} else {
return new ArrayList<>(new LinkedHashSet<>(collection));
}
} } | public class class_name {
public static <T> ArrayList<T> distinct(Collection<T> collection) {
if (isEmpty(collection)) {
return new ArrayList<>();
// depends on control dependency: [if], data = [none]
} else if (collection instanceof Set) {
return new ArrayList<>(collection);
// depends on control dependency: [if], data = [none]
} else {
return new ArrayList<>(new LinkedHashSet<>(collection));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static DMatrixSparseCSC convert(DMatrixSparseTriplet src , DMatrixSparseCSC dst , int hist[] ) {
if( dst == null )
dst = new DMatrixSparseCSC(src.numRows, src.numCols , src.nz_length);
else
dst.reshape(src.numRows, src.numCols, src.nz_length);
if( hist == null )
hist = new int[ src.numCols ];
else if( hist.length >= src.numCols )
Arrays.fill(hist,0,src.numCols, 0);
else
throw new IllegalArgumentException("Length of hist must be at least numCols");
// compute the number of elements in each columns
for (int i = 0; i < src.nz_length; i++) {
hist[src.nz_rowcol.data[i*2+1]]++;
}
// define col_idx
dst.histogramToStructure(hist);
System.arraycopy(dst.col_idx,0,hist,0,dst.numCols);
// now write the row indexes and the values
for (int i = 0; i < src.nz_length; i++) {
int row = src.nz_rowcol.data[i*2];
int col = src.nz_rowcol.data[i*2+1];
double value = src.nz_value.data[i];
int index = hist[col]++;
dst.nz_rows[index] = row;
dst.nz_values[index] = value;
}
dst.indicesSorted = false;
return dst;
} } | public class class_name {
public static DMatrixSparseCSC convert(DMatrixSparseTriplet src , DMatrixSparseCSC dst , int hist[] ) {
if( dst == null )
dst = new DMatrixSparseCSC(src.numRows, src.numCols , src.nz_length);
else
dst.reshape(src.numRows, src.numCols, src.nz_length);
if( hist == null )
hist = new int[ src.numCols ];
else if( hist.length >= src.numCols )
Arrays.fill(hist,0,src.numCols, 0);
else
throw new IllegalArgumentException("Length of hist must be at least numCols");
// compute the number of elements in each columns
for (int i = 0; i < src.nz_length; i++) {
hist[src.nz_rowcol.data[i*2+1]]++; // depends on control dependency: [for], data = [i]
}
// define col_idx
dst.histogramToStructure(hist);
System.arraycopy(dst.col_idx,0,hist,0,dst.numCols);
// now write the row indexes and the values
for (int i = 0; i < src.nz_length; i++) {
int row = src.nz_rowcol.data[i*2];
int col = src.nz_rowcol.data[i*2+1];
double value = src.nz_value.data[i];
int index = hist[col]++;
dst.nz_rows[index] = row; // depends on control dependency: [for], data = [none]
dst.nz_values[index] = value; // depends on control dependency: [for], data = [none]
}
dst.indicesSorted = false;
return dst;
} } |
public class class_name {
private void calculateMaxViewport() {
tempMaximumViewport.set(0, MAX_WIDTH_HEIGHT, MAX_WIDTH_HEIGHT, 0);
maxSum = 0.0f;
for (SliceValue sliceValue : dataProvider.getPieChartData().getValues()) {
maxSum += Math.abs(sliceValue.getValue());
}
} } | public class class_name {
private void calculateMaxViewport() {
tempMaximumViewport.set(0, MAX_WIDTH_HEIGHT, MAX_WIDTH_HEIGHT, 0);
maxSum = 0.0f;
for (SliceValue sliceValue : dataProvider.getPieChartData().getValues()) {
maxSum += Math.abs(sliceValue.getValue()); // depends on control dependency: [for], data = [sliceValue]
}
} } |
public class class_name {
public CertificateDetail withDomainValidationOptions(DomainValidation... domainValidationOptions) {
if (this.domainValidationOptions == null) {
setDomainValidationOptions(new java.util.ArrayList<DomainValidation>(domainValidationOptions.length));
}
for (DomainValidation ele : domainValidationOptions) {
this.domainValidationOptions.add(ele);
}
return this;
} } | public class class_name {
public CertificateDetail withDomainValidationOptions(DomainValidation... domainValidationOptions) {
if (this.domainValidationOptions == null) {
setDomainValidationOptions(new java.util.ArrayList<DomainValidation>(domainValidationOptions.length)); // depends on control dependency: [if], data = [none]
}
for (DomainValidation ele : domainValidationOptions) {
this.domainValidationOptions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) { // almost copied from super
String path = response.getRoutingPath();
final boolean redirectTo = response.isRedirectTo();
if (path.indexOf(":") < 0) {
if (!path.startsWith("/")) {
path = buildActionPath(getActionDef().getComponentName()) + path;
}
if (!redirectTo && isHtmlForward(path)) {
path = filterHtmlPath(path);
}
}
return newNextJourney(journeyProvider, path, redirectTo, response.isAsIs(), response.getViewObject());
} } | public class class_name {
public NextJourney createNextJourney(PlannedJourneyProvider journeyProvider, HtmlResponse response) { // almost copied from super
String path = response.getRoutingPath();
final boolean redirectTo = response.isRedirectTo();
if (path.indexOf(":") < 0) {
if (!path.startsWith("/")) {
path = buildActionPath(getActionDef().getComponentName()) + path; // depends on control dependency: [if], data = [none]
}
if (!redirectTo && isHtmlForward(path)) {
path = filterHtmlPath(path); // depends on control dependency: [if], data = [none]
}
}
return newNextJourney(journeyProvider, path, redirectTo, response.isAsIs(), response.getViewObject());
} } |
public class class_name {
private void setupValue(Object target, Keyframe kf) {
//if (mProperty != null) {
// kf.setValue(mProperty.get(target));
//}
try {
if (mGetter == null) {
Class targetClass = target.getClass();
setupGetter(targetClass);
}
kf.setValue(mGetter.invoke(target));
} catch (InvocationTargetException e) {
Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
Log.e("PropertyValuesHolder", e.toString());
}
} } | public class class_name {
private void setupValue(Object target, Keyframe kf) {
//if (mProperty != null) {
// kf.setValue(mProperty.get(target));
//}
try {
if (mGetter == null) {
Class targetClass = target.getClass();
setupGetter(targetClass); // depends on control dependency: [if], data = [none]
}
kf.setValue(mGetter.invoke(target)); // depends on control dependency: [try], data = [none]
} catch (InvocationTargetException e) {
Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
Log.e("PropertyValuesHolder", e.toString());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double squaredLoss(double[] x, double[] y, double w_0, double w_1) {
double sum = 0;
for (int j = 0; j < x.length; j++) {
sum += Math.pow((y[j] - (w_1 * x[j] + w_0)), 2);
}
return sum;
} } | public class class_name {
public static double squaredLoss(double[] x, double[] y, double w_0, double w_1) {
double sum = 0;
for (int j = 0; j < x.length; j++) {
sum += Math.pow((y[j] - (w_1 * x[j] + w_0)), 2); // depends on control dependency: [for], data = [j]
}
return sum;
} } |
public class class_name {
public File getLocalFile(URL remoteUri)
{
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
}
if (path != null)
{
sb.append(path);
}
if (query != null)
{
sb.append('?');
sb.append(query);
}
String name;
final int maxLen = 250;
if (sb.length() < maxLen)
{
name = sb.toString();
}
else
{
name = sb.substring(0, maxLen);
}
name = name.replace('?', '$');
name = name.replace('*', '$');
name = name.replace(':', '$');
name = name.replace('<', '$');
name = name.replace('>', '$');
name = name.replace('"', '$');
File f = new File(cacheDir, name);
return f;
} } | public class class_name {
public File getLocalFile(URL remoteUri)
{
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
// depends on control dependency: [if], data = [(host]
}
if (path != null)
{
sb.append(path);
// depends on control dependency: [if], data = [(path]
}
if (query != null)
{
sb.append('?');
// depends on control dependency: [if], data = [none]
sb.append(query);
// depends on control dependency: [if], data = [(query]
}
String name;
final int maxLen = 250;
if (sb.length() < maxLen)
{
name = sb.toString();
// depends on control dependency: [if], data = [none]
}
else
{
name = sb.substring(0, maxLen);
// depends on control dependency: [if], data = [maxLen)]
}
name = name.replace('?', '$');
name = name.replace('*', '$');
name = name.replace(':', '$');
name = name.replace('<', '$');
name = name.replace('>', '$');
name = name.replace('"', '$');
File f = new File(cacheDir, name);
return f;
} } |
public class class_name {
@Override
public AnnotationVisitor visitArray(String name) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Name [ {1} ]",
getHashText(), name));
}
final AnnotationValueImpl arrayValue = new AnnotationValueImpl();
storeAnnotationValue(name, arrayValue);
return new InfoVisitor_Annotation(infoStore) {
@Override
protected void storeAnnotationValue(String name, AnnotationValueImpl newAnnotationValue) {
arrayValue.addArrayValue(newAnnotationValue);
}
};
} } | public class class_name {
@Override
public AnnotationVisitor visitArray(String name) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Name [ {1} ]",
getHashText(), name)); // depends on control dependency: [if], data = [none]
}
final AnnotationValueImpl arrayValue = new AnnotationValueImpl();
storeAnnotationValue(name, arrayValue);
return new InfoVisitor_Annotation(infoStore) {
@Override
protected void storeAnnotationValue(String name, AnnotationValueImpl newAnnotationValue) {
arrayValue.addArrayValue(newAnnotationValue);
}
};
} } |
public class class_name {
public long read(long pos, Iterable<ByteBuffer> bufs) {
if (pos >= size()) {
return -1;
}
long start = pos;
for (ByteBuffer buf : bufs) {
int read = read(pos, buf);
if (read == -1) {
break;
} else {
pos += read;
}
}
return pos - start;
} } | public class class_name {
public long read(long pos, Iterable<ByteBuffer> bufs) {
if (pos >= size()) {
return -1; // depends on control dependency: [if], data = [none]
}
long start = pos;
for (ByteBuffer buf : bufs) {
int read = read(pos, buf);
if (read == -1) {
break;
} else {
pos += read; // depends on control dependency: [if], data = [none]
}
}
return pos - start;
} } |
public class class_name {
public void setDirectories(java.util.Collection<WorkspaceDirectory> directories) {
if (directories == null) {
this.directories = null;
return;
}
this.directories = new com.amazonaws.internal.SdkInternalList<WorkspaceDirectory>(directories);
} } | public class class_name {
public void setDirectories(java.util.Collection<WorkspaceDirectory> directories) {
if (directories == null) {
this.directories = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.directories = new com.amazonaws.internal.SdkInternalList<WorkspaceDirectory>(directories);
} } |
public class class_name {
public UriComponentsBuilder uri(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.scheme = uri.getScheme();
if (uri.isOpaque()) {
this.ssp = uri.getRawSchemeSpecificPart();
resetHierarchicalComponents();
}
else {
if (uri.getRawUserInfo() != null) {
this.userInfo = uri.getRawUserInfo();
}
if (uri.getHost() != null) {
this.host = uri.getHost();
}
if (uri.getPort() != -1) {
this.port = String.valueOf(uri.getPort());
}
if (StringUtils.hasLength(uri.getRawPath())) {
this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
}
if (StringUtils.hasLength(uri.getRawQuery())) {
this.queryParams.clear();
query(uri.getRawQuery());
}
resetSchemeSpecificPart();
}
if (uri.getRawFragment() != null) {
this.fragment = uri.getRawFragment();
}
return this;
} } | public class class_name {
public UriComponentsBuilder uri(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.scheme = uri.getScheme();
if (uri.isOpaque()) {
this.ssp = uri.getRawSchemeSpecificPart(); // depends on control dependency: [if], data = [none]
resetHierarchicalComponents(); // depends on control dependency: [if], data = [none]
}
else {
if (uri.getRawUserInfo() != null) {
this.userInfo = uri.getRawUserInfo(); // depends on control dependency: [if], data = [none]
}
if (uri.getHost() != null) {
this.host = uri.getHost(); // depends on control dependency: [if], data = [none]
}
if (uri.getPort() != -1) {
this.port = String.valueOf(uri.getPort()); // depends on control dependency: [if], data = [(uri.getPort()]
}
if (StringUtils.hasLength(uri.getRawPath())) {
this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath()); // depends on control dependency: [if], data = [none]
}
if (StringUtils.hasLength(uri.getRawQuery())) {
this.queryParams.clear(); // depends on control dependency: [if], data = [none]
query(uri.getRawQuery()); // depends on control dependency: [if], data = [none]
}
resetSchemeSpecificPart(); // depends on control dependency: [if], data = [none]
}
if (uri.getRawFragment() != null) {
this.fragment = uri.getRawFragment(); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private void requirePending() {
if (pending != null) {
return;
}
long exclusionComparable = Long.MIN_VALUE;
while (nInclusionsRemaining != 0 && !queue.isEmpty()) {
//find a candidate that is not excluded
HeapElement inclusion = null;
do {
HeapElement candidate = queue.poll();
if (candidate.inclusion) {
if (exclusionComparable != candidate.comparable()) {
inclusion = candidate;
break;
}
} else {
exclusionComparable = candidate.comparable();
}
reattach(candidate);
if (nInclusionsRemaining == 0) {
return;
}
} while (!queue.isEmpty());
if (inclusion == null) {
return;
}
long inclusionComparable = inclusion.comparable();
/*
* Check for any following exclusions and for duplicates. We could
* change the sort order so that exclusions always preceded
* inclusions, but that would be less efficient and would make the
* ordering different than the comparable value.
*/
boolean excluded = exclusionComparable == inclusionComparable;
while (!queue.isEmpty() && queue.peek().comparable() == inclusionComparable) {
HeapElement match = queue.poll();
excluded |= !match.inclusion;
reattach(match);
if (nInclusionsRemaining == 0) {
return;
}
}
if (!excluded) {
pending = inclusion;
return;
}
reattach(inclusion);
}
} } | public class class_name {
private void requirePending() {
if (pending != null) {
return; // depends on control dependency: [if], data = [none]
}
long exclusionComparable = Long.MIN_VALUE;
while (nInclusionsRemaining != 0 && !queue.isEmpty()) {
//find a candidate that is not excluded
HeapElement inclusion = null;
do {
HeapElement candidate = queue.poll();
if (candidate.inclusion) {
if (exclusionComparable != candidate.comparable()) {
inclusion = candidate; // depends on control dependency: [if], data = [none]
break;
}
} else {
exclusionComparable = candidate.comparable(); // depends on control dependency: [if], data = [none]
}
reattach(candidate);
if (nInclusionsRemaining == 0) {
return; // depends on control dependency: [if], data = [none]
}
} while (!queue.isEmpty());
if (inclusion == null) {
return; // depends on control dependency: [if], data = [none]
}
long inclusionComparable = inclusion.comparable();
/*
* Check for any following exclusions and for duplicates. We could
* change the sort order so that exclusions always preceded
* inclusions, but that would be less efficient and would make the
* ordering different than the comparable value.
*/
boolean excluded = exclusionComparable == inclusionComparable;
while (!queue.isEmpty() && queue.peek().comparable() == inclusionComparable) {
HeapElement match = queue.poll();
excluded |= !match.inclusion; // depends on control dependency: [while], data = [none]
reattach(match); // depends on control dependency: [while], data = [none]
if (nInclusionsRemaining == 0) {
return; // depends on control dependency: [if], data = [none]
}
}
if (!excluded) {
pending = inclusion; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
reattach(inclusion); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private Throwable loadLib(String _lib) {
try {
System.load(_lib);
return null;
} catch (Throwable _ex) {
return _ex;
}
} } | public class class_name {
private Throwable loadLib(String _lib) {
try {
System.load(_lib); // depends on control dependency: [try], data = [none]
return null; // depends on control dependency: [try], data = [none]
} catch (Throwable _ex) {
return _ex;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String toRegexForFixedDate(Date date) {
StringBuilder buf = new StringBuilder();
Converter<Object> p = headTokenConverter;
while (p != null) {
if (p instanceof LiteralConverter) {
buf.append(p.convert(null));
} else if (p instanceof IntegerTokenConverter) {
buf.append(FileFinder.regexEscapePath("(\\d+)"));
} else if (p instanceof DateTokenConverter) {
DateTokenConverter<Object> dtc = (DateTokenConverter<Object>) p;
if (dtc.isPrimary()) {
buf.append(p.convert(date));
} else {
buf.append(FileFinder.regexEscapePath(dtc.toRegex()));
}
}
p = p.getNext();
}
return buf.toString();
} } | public class class_name {
public String toRegexForFixedDate(Date date) {
StringBuilder buf = new StringBuilder();
Converter<Object> p = headTokenConverter;
while (p != null) {
if (p instanceof LiteralConverter) {
buf.append(p.convert(null)); // depends on control dependency: [if], data = [none]
} else if (p instanceof IntegerTokenConverter) {
buf.append(FileFinder.regexEscapePath("(\\d+)")); // depends on control dependency: [if], data = [none]
} else if (p instanceof DateTokenConverter) {
DateTokenConverter<Object> dtc = (DateTokenConverter<Object>) p;
if (dtc.isPrimary()) {
buf.append(p.convert(date)); // depends on control dependency: [if], data = [none]
} else {
buf.append(FileFinder.regexEscapePath(dtc.toRegex())); // depends on control dependency: [if], data = [none]
}
}
p = p.getNext(); // depends on control dependency: [while], data = [none]
}
return buf.toString();
} } |
public class class_name {
public synchronized static boolean hasSudo()
{
if (!sudoTested)
{
String[] cmdArr = new String[]{"which", "sudo"};
List<String> cmd = new ArrayList<String>(cmdArr.length);
Collections.addAll(cmd, cmdArr);
ProcessBuilder whichsudo = new ProcessBuilder(cmd);
try
{
Process p = whichsudo.start();
try
{
Execed e = new Execed(cmd, p, false);
// Let it run
int returnCode = e.waitForExit(new Deadline(3, TimeUnit.SECONDS));
sudoSupported = (returnCode == 0);
sudoTested = true;
}
finally
{
p.destroy();
}
}
catch (Throwable t)
{
sudoSupported = false;
sudoTested = true;
}
}
return sudoSupported;
} } | public class class_name {
public synchronized static boolean hasSudo()
{
if (!sudoTested)
{
String[] cmdArr = new String[]{"which", "sudo"};
List<String> cmd = new ArrayList<String>(cmdArr.length);
Collections.addAll(cmd, cmdArr); // depends on control dependency: [if], data = [none]
ProcessBuilder whichsudo = new ProcessBuilder(cmd);
try
{
Process p = whichsudo.start();
try
{
Execed e = new Execed(cmd, p, false);
// Let it run
int returnCode = e.waitForExit(new Deadline(3, TimeUnit.SECONDS));
sudoSupported = (returnCode == 0); // depends on control dependency: [try], data = [none]
sudoTested = true; // depends on control dependency: [try], data = [none]
}
finally
{
p.destroy();
}
}
catch (Throwable t)
{
sudoSupported = false;
sudoTested = true;
} // depends on control dependency: [catch], data = [none]
}
return sudoSupported;
} } |
public class class_name {
public final void destroy() throws JMException {
synchronized (mBeanHandles) {
List<JMException> exceptions = new ArrayList<JMException>();
List<MBeanHandle> unregistered = new ArrayList<MBeanHandle>();
for (MBeanHandle handle : mBeanHandles) {
try {
unregistered.add(handle);
handle.server.unregisterMBean(handle.objectName);
} catch (InstanceNotFoundException e) {
exceptions.add(e);
} catch (MBeanRegistrationException e) {
exceptions.add(e);
}
}
// Remove all successfully unregistered handles
mBeanHandles.removeAll(unregistered);
// Throw error if any exception occured during unregistration
if (exceptions.size() == 1) {
throw exceptions.get(0);
} else if (exceptions.size() > 1) {
StringBuilder ret = new StringBuilder();
for (JMException e : exceptions) {
ret.append(e.getMessage()).append(", ");
}
throw new JMException(ret.substring(0, ret.length() - 2));
}
}
// Unregister any notification listener
mBeanServerManager.destroy();
} } | public class class_name {
public final void destroy() throws JMException {
synchronized (mBeanHandles) {
List<JMException> exceptions = new ArrayList<JMException>();
List<MBeanHandle> unregistered = new ArrayList<MBeanHandle>();
for (MBeanHandle handle : mBeanHandles) {
try {
unregistered.add(handle); // depends on control dependency: [try], data = [none]
handle.server.unregisterMBean(handle.objectName); // depends on control dependency: [try], data = [none]
} catch (InstanceNotFoundException e) {
exceptions.add(e);
} catch (MBeanRegistrationException e) { // depends on control dependency: [catch], data = [none]
exceptions.add(e);
} // depends on control dependency: [catch], data = [none]
}
// Remove all successfully unregistered handles
mBeanHandles.removeAll(unregistered);
// Throw error if any exception occured during unregistration
if (exceptions.size() == 1) {
throw exceptions.get(0);
} else if (exceptions.size() > 1) {
StringBuilder ret = new StringBuilder();
for (JMException e : exceptions) {
ret.append(e.getMessage()).append(", "); // depends on control dependency: [for], data = [e]
}
throw new JMException(ret.substring(0, ret.length() - 2));
}
}
// Unregister any notification listener
mBeanServerManager.destroy();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.