code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public String get() {
synchronized (LOCK) {
if (!initialised) {
// generate the random number
Random rnd = new Random(); // @todo need a different seed, this is now time based and I
// would prefer something different, like an object address
// get the random number, instead of getting an integer and converting that to base64 later,
// we get a string and narrow that down to base64, use the top 6 bits of the characters
// as they are more random than the bottom ones...
rnd.nextBytes(value); // get some random characters
value[3] = BASE64[((value[3] >> 2) & BITS_6)]; // NOSONAR
value[4] = BASE64[((value[4] >> 2) & BITS_6)]; // NOSONAR
value[5] = BASE64[((value[5] >> 2) & BITS_6)]; // NOSONAR
value[6] = BASE64[((value[6] >> 2) & BITS_6)]; // NOSONAR
value[7] = BASE64[((value[7] >> 2) & BITS_6)]; // NOSONAR
// complete the time part in the HIGH value of the token
// this also sets the initial low value
completeToken(rnd);
initialised = true;
}
// fill in LOW value in id
int l = low;
value[0] = BASE64[(l & BITS_6)];
l >>= SHIFT_6;
value[1] = BASE64[(l & BITS_6)];
l >>= SHIFT_6;
value[2] = BASE64[(l & BITS_6)];
String res = new String(value);
// increment LOW
low++;
if (low == LOW_MAX) {
low = 0;
}
if (low == lowLast) {
time = System.currentTimeMillis();
completeToken();
}
return res;
}
} } | public class class_name {
public String get() {
synchronized (LOCK) {
if (!initialised) {
// generate the random number
Random rnd = new Random(); // @todo need a different seed, this is now time based and I
// would prefer something different, like an object address
// get the random number, instead of getting an integer and converting that to base64 later,
// we get a string and narrow that down to base64, use the top 6 bits of the characters
// as they are more random than the bottom ones...
rnd.nextBytes(value); // get some random characters // depends on control dependency: [if], data = [none]
value[3] = BASE64[((value[3] >> 2) & BITS_6)]; // NOSONAR // depends on control dependency: [if], data = [none]
value[4] = BASE64[((value[4] >> 2) & BITS_6)]; // NOSONAR // depends on control dependency: [if], data = [none]
value[5] = BASE64[((value[5] >> 2) & BITS_6)]; // NOSONAR // depends on control dependency: [if], data = [none]
value[6] = BASE64[((value[6] >> 2) & BITS_6)]; // NOSONAR // depends on control dependency: [if], data = [none]
value[7] = BASE64[((value[7] >> 2) & BITS_6)]; // NOSONAR // depends on control dependency: [if], data = [none]
// complete the time part in the HIGH value of the token
// this also sets the initial low value
completeToken(rnd); // depends on control dependency: [if], data = [none]
initialised = true; // depends on control dependency: [if], data = [none]
}
// fill in LOW value in id
int l = low;
value[0] = BASE64[(l & BITS_6)];
l >>= SHIFT_6;
value[1] = BASE64[(l & BITS_6)];
l >>= SHIFT_6;
value[2] = BASE64[(l & BITS_6)];
String res = new String(value);
// increment LOW
low++;
if (low == LOW_MAX) {
low = 0; // depends on control dependency: [if], data = [none]
}
if (low == lowLast) {
time = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
completeToken(); // depends on control dependency: [if], data = [none]
}
return res;
}
} } |
public class class_name {
public LocalisationManager getLocalisationManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLocalisationManager", this);
// Instantiate LocalisationManager to manage localisations and interface to WLM
if (_localisationManager == null)
{
_localisationManager =
new LocalisationManager(this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLocalisationManager", _localisationManager);
return _localisationManager;
} } | public class class_name {
public LocalisationManager getLocalisationManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getLocalisationManager", this);
// Instantiate LocalisationManager to manage localisations and interface to WLM
if (_localisationManager == null)
{
_localisationManager =
new LocalisationManager(this); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getLocalisationManager", _localisationManager);
return _localisationManager;
} } |
public class class_name {
static Method getMethodOptional(
Class<?> type, String methodName, Class<?>... parameterTypes)
{
try
{
return type.getMethod(methodName, parameterTypes);
}
catch (SecurityException e)
{
return null;
}
catch (NoSuchMethodException e)
{
return null;
}
} } | public class class_name {
static Method getMethodOptional(
Class<?> type, String methodName, Class<?>... parameterTypes)
{
try
{
return type.getMethod(methodName, parameterTypes);
// depends on control dependency: [try], data = [none]
}
catch (SecurityException e)
{
return null;
}
// depends on control dependency: [catch], data = [none]
catch (NoSuchMethodException e)
{
return null;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void updateBean(final Object bean) {
this.setBean(bean);
if (this.cd != null && this.cd.isSupplier()) {
final Object newBean = ((Supplier)this.bean).get();
setBean(newBean);
}
} } | public class class_name {
public void updateBean(final Object bean) {
this.setBean(bean);
if (this.cd != null && this.cd.isSupplier()) {
final Object newBean = ((Supplier)this.bean).get();
setBean(newBean); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object invoke(String operationName, final StubStrategy stubStrategy, Object[] params) throws Throwable {
if (operationName.equals("_get_handle")
&& this instanceof javax.ejb.EJBObject) {
if (handle == null) {
handle = new HandleImplIIOP(this);
}
return handle;
} else if (operationName.equals("_get_homeHandle")
&& this instanceof javax.ejb.EJBHome) {
if (handle == null) {
handle = new HomeHandleImplIIOP(this);
}
return handle;
} else {
//FIXME
// all invocations are now made using remote invocation
// local invocations between two different applications cause
// ClassCastException between Stub and Interface
// (two different modules are loading the classes)
// problem was unnoticeable with JacORB because it uses
// remote invocations to all stubs to which interceptors are
// registered and a result all that JacORB always used
// remote invocations
// remote call path
// To check whether this is a local stub or not we must call
// org.omg.CORBA.portable.ObjectImpl._is_local(), and _not_
// javax.rmi.CORBA.Util.isLocal(Stub s), which in Sun's JDK
// always return false.
InputStream in = null;
try {
try {
OutputStream out =
(OutputStream) _request(operationName, true);
stubStrategy.writeParams(out, params);
tracef("sent request: %s", operationName);
in = (InputStream) _invoke(out);
if (stubStrategy.isNonVoid()) {
trace("received reply");
final InputStream finalIn = in;
return doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return stubStrategy.readRetval(finalIn);
}
});
} else {
return null;
}
} catch (final ApplicationException ex) {
trace("got application exception");
in = (InputStream) ex.getInputStream();
final InputStream finalIn1 = in;
throw doPrivileged(new PrivilegedAction<Exception>() {
public Exception run() {
return stubStrategy.readException(ex.getId(), finalIn1);
}
});
} catch (RemarshalException ex) {
trace("got remarshal exception");
return invoke(operationName, stubStrategy, params);
}
} catch (SystemException ex) {
if (EjbLogger.EJB3_INVOCATION_LOGGER.isTraceEnabled()) {
EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex);
}
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
}
} } | public class class_name {
public Object invoke(String operationName, final StubStrategy stubStrategy, Object[] params) throws Throwable {
if (operationName.equals("_get_handle")
&& this instanceof javax.ejb.EJBObject) {
if (handle == null) {
handle = new HandleImplIIOP(this); // depends on control dependency: [if], data = [none]
}
return handle;
} else if (operationName.equals("_get_homeHandle")
&& this instanceof javax.ejb.EJBHome) {
if (handle == null) {
handle = new HomeHandleImplIIOP(this); // depends on control dependency: [if], data = [none]
}
return handle;
} else {
//FIXME
// all invocations are now made using remote invocation
// local invocations between two different applications cause
// ClassCastException between Stub and Interface
// (two different modules are loading the classes)
// problem was unnoticeable with JacORB because it uses
// remote invocations to all stubs to which interceptors are
// registered and a result all that JacORB always used
// remote invocations
// remote call path
// To check whether this is a local stub or not we must call
// org.omg.CORBA.portable.ObjectImpl._is_local(), and _not_
// javax.rmi.CORBA.Util.isLocal(Stub s), which in Sun's JDK
// always return false.
InputStream in = null;
try {
try {
OutputStream out =
(OutputStream) _request(operationName, true);
stubStrategy.writeParams(out, params); // depends on control dependency: [try], data = [none]
tracef("sent request: %s", operationName); // depends on control dependency: [try], data = [none]
in = (InputStream) _invoke(out); // depends on control dependency: [try], data = [none]
if (stubStrategy.isNonVoid()) {
trace("received reply"); // depends on control dependency: [if], data = [none]
final InputStream finalIn = in;
return doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return stubStrategy.readRetval(finalIn);
}
}); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} catch (final ApplicationException ex) {
trace("got application exception");
in = (InputStream) ex.getInputStream();
final InputStream finalIn1 = in;
throw doPrivileged(new PrivilegedAction<Exception>() {
public Exception run() {
return stubStrategy.readException(ex.getId(), finalIn1);
}
});
} catch (RemarshalException ex) { // depends on control dependency: [catch], data = [none]
trace("got remarshal exception");
return invoke(operationName, stubStrategy, params);
} // depends on control dependency: [catch], data = [none]
} catch (SystemException ex) {
if (EjbLogger.EJB3_INVOCATION_LOGGER.isTraceEnabled()) {
EjbLogger.EJB3_INVOCATION_LOGGER.trace("CORBA system exception in IIOP stub", ex); // depends on control dependency: [if], data = [none]
}
throw Util.mapSystemException(ex);
} finally { // depends on control dependency: [catch], data = [none]
_releaseReply(in);
}
}
} } |
public class class_name {
public FileGetFromTaskOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null;
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince);
}
return this;
} } | public class class_name {
public FileGetFromTaskOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null; // depends on control dependency: [if], data = [none]
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); // depends on control dependency: [if], data = [(ifUnmodifiedSince]
}
return this;
} } |
public class class_name {
public static void validateClusterStores(final Cluster cluster,
final List<StoreDefinition> storeDefs) {
// Constructing a StoreRoutingPlan has the (desirable in this
// case) side-effect of verifying that the store definition is congruent
// with the cluster definition. If there are issues, exceptions are
// thrown.
for(StoreDefinition storeDefinition: storeDefs) {
new StoreRoutingPlan(cluster, storeDefinition);
}
return;
} } | public class class_name {
public static void validateClusterStores(final Cluster cluster,
final List<StoreDefinition> storeDefs) {
// Constructing a StoreRoutingPlan has the (desirable in this
// case) side-effect of verifying that the store definition is congruent
// with the cluster definition. If there are issues, exceptions are
// thrown.
for(StoreDefinition storeDefinition: storeDefs) {
new StoreRoutingPlan(cluster, storeDefinition); // depends on control dependency: [for], data = [storeDefinition]
}
return;
} } |
public class class_name {
public T min() {
if (sum == 0)
return null;
int minCount = Integer.MAX_VALUE;
int minIndex = -1;
for (TIntIntIterator it = indexToCount.iterator(); it.hasNext(); ) {
it.advance();
if (it.value() < minCount) {
minIndex = it.key();
minCount = it.value();
}
}
return objectIndices.lookup(minIndex);
} } | public class class_name {
public T min() {
if (sum == 0)
return null;
int minCount = Integer.MAX_VALUE;
int minIndex = -1;
for (TIntIntIterator it = indexToCount.iterator(); it.hasNext(); ) {
it.advance(); // depends on control dependency: [for], data = [it]
if (it.value() < minCount) {
minIndex = it.key(); // depends on control dependency: [if], data = [none]
minCount = it.value(); // depends on control dependency: [if], data = [none]
}
}
return objectIndices.lookup(minIndex);
} } |
public class class_name {
public LoggingEvent rewrite(final LoggingEvent source) {
Object msg = source.getMessage();
if (!(msg instanceof String)) {
Object newMsg = msg;
Map rewriteProps = new HashMap(source.getProperties());
try {
PropertyDescriptor[] props = Introspector.getBeanInfo(
msg.getClass(), Object.class).getPropertyDescriptors();
if (props.length > 0) {
for (int i=0;i<props.length;i++) {
try {
Object propertyValue =
props[i].getReadMethod().invoke(msg,
(Object[]) null);
if ("message".equalsIgnoreCase(props[i].getName())) {
newMsg = propertyValue;
} else {
rewriteProps.put(props[i].getName(), propertyValue);
}
} catch (Exception e) {
LogLog.warn("Unable to evaluate property " +
props[i].getName(), e);
}
}
return new LoggingEvent(
source.getFQNOfLoggerClass(),
source.getLogger() != null ? source.getLogger(): Logger.getLogger(source.getLoggerName()),
source.getTimeStamp(),
source.getLevel(),
newMsg,
source.getThreadName(),
source.getThrowableInformation(),
source.getNDC(),
source.getLocationInformation(),
rewriteProps);
}
} catch (Exception e) {
LogLog.warn("Unable to get property descriptors", e);
}
}
return source;
} } | public class class_name {
public LoggingEvent rewrite(final LoggingEvent source) {
Object msg = source.getMessage();
if (!(msg instanceof String)) {
Object newMsg = msg;
Map rewriteProps = new HashMap(source.getProperties());
try {
PropertyDescriptor[] props = Introspector.getBeanInfo(
msg.getClass(), Object.class).getPropertyDescriptors();
if (props.length > 0) {
for (int i=0;i<props.length;i++) {
try {
Object propertyValue =
props[i].getReadMethod().invoke(msg,
(Object[]) null);
if ("message".equalsIgnoreCase(props[i].getName())) {
newMsg = propertyValue; // depends on control dependency: [if], data = [none]
} else {
rewriteProps.put(props[i].getName(), propertyValue); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LogLog.warn("Unable to evaluate property " +
props[i].getName(), e);
} // depends on control dependency: [catch], data = [none]
}
return new LoggingEvent(
source.getFQNOfLoggerClass(),
source.getLogger() != null ? source.getLogger(): Logger.getLogger(source.getLoggerName()),
source.getTimeStamp(),
source.getLevel(),
newMsg,
source.getThreadName(),
source.getThrowableInformation(),
source.getNDC(),
source.getLocationInformation(),
rewriteProps); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LogLog.warn("Unable to get property descriptors", e);
} // depends on control dependency: [catch], data = [none]
}
return source;
} } |
public class class_name {
public static InternalQName decode(InternalQName name)
{
String decoded = decode(name.getName());
if (decoded.equals(name.getName()))
{
return name;
}
else
{
return new InternalQName(name.getNamespace(), decoded.toString());
}
} } | public class class_name {
public static InternalQName decode(InternalQName name)
{
String decoded = decode(name.getName());
if (decoded.equals(name.getName()))
{
return name;
// depends on control dependency: [if], data = [none]
}
else
{
return new InternalQName(name.getNamespace(), decoded.toString());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Geometry rotate(Geometry geom, double theta) {
if (geom != null) {
Coordinate center = geom.getEnvelopeInternal().centre();
return rotate(geom, theta, center.x, center.y);
} else {
return null;
}
} } | public class class_name {
public static Geometry rotate(Geometry geom, double theta) {
if (geom != null) {
Coordinate center = geom.getEnvelopeInternal().centre();
return rotate(geom, theta, center.x, center.y); // depends on control dependency: [if], data = [(geom]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String[] splitOnTokens(String text, String oneAnySymbolStr, String noneOrMoreSymbolsStr) {
if (!hasWildcards(text, ONE_ANY_SYMBOL, NONE_OR_MORE_SYMBOLS)) {
return new String[] { text };
}
List<String> list = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
boolean escapeMode = false;
final int length = text.length();
for (int i = 0; i < length; i++) {
final char current = text.charAt(i);
switch (current) {
case ESCAPE_CHAR:
if (escapeMode) {
buffer.append(current);
} else {
escapeMode = true;
}
break;
case ONE_ANY_SYMBOL:
if (escapeMode) {
buffer.append(current);
escapeMode = false;
} else {
flushBuffer(buffer, list);
if (!list.isEmpty() && noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
list.set(list.size() - 1, oneAnySymbolStr);
list.add(noneOrMoreSymbolsStr);
} else {
list.add(oneAnySymbolStr);
}
}
break;
case NONE_OR_MORE_SYMBOLS:
if (escapeMode) {
buffer.append(current);
escapeMode = false;
} else {
flushBuffer(buffer, list);
if (list.isEmpty() || !noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
list.add(noneOrMoreSymbolsStr);
}
}
break;
default:
if (escapeMode) {
buffer.append(ESCAPE_CHAR);
escapeMode = false;
}
buffer.append(current);
}
}
if (escapeMode) {
buffer.append(ESCAPE_CHAR);
}
if (buffer.length() != 0) {
list.add(buffer.toString());
}
return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} } | public class class_name {
private static String[] splitOnTokens(String text, String oneAnySymbolStr, String noneOrMoreSymbolsStr) {
if (!hasWildcards(text, ONE_ANY_SYMBOL, NONE_OR_MORE_SYMBOLS)) {
return new String[] { text }; // depends on control dependency: [if], data = [none]
}
List<String> list = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
boolean escapeMode = false;
final int length = text.length();
for (int i = 0; i < length; i++) {
final char current = text.charAt(i);
switch (current) {
case ESCAPE_CHAR:
if (escapeMode) {
buffer.append(current); // depends on control dependency: [if], data = [none]
} else {
escapeMode = true; // depends on control dependency: [if], data = [none]
}
break;
case ONE_ANY_SYMBOL:
if (escapeMode) {
buffer.append(current); // depends on control dependency: [if], data = [none]
escapeMode = false; // depends on control dependency: [if], data = [none]
} else {
flushBuffer(buffer, list); // depends on control dependency: [if], data = [none]
if (!list.isEmpty() && noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
list.set(list.size() - 1, oneAnySymbolStr); // depends on control dependency: [if], data = [none]
list.add(noneOrMoreSymbolsStr); // depends on control dependency: [if], data = [none]
} else {
list.add(oneAnySymbolStr); // depends on control dependency: [if], data = [none]
}
}
break;
case NONE_OR_MORE_SYMBOLS:
if (escapeMode) {
buffer.append(current); // depends on control dependency: [if], data = [none]
escapeMode = false; // depends on control dependency: [if], data = [none]
} else {
flushBuffer(buffer, list); // depends on control dependency: [if], data = [none]
if (list.isEmpty() || !noneOrMoreSymbolsStr.equals(list.get(list.size() - 1))) {
list.add(noneOrMoreSymbolsStr); // depends on control dependency: [if], data = [none]
}
}
break;
default:
if (escapeMode) {
buffer.append(ESCAPE_CHAR); // depends on control dependency: [if], data = [none]
escapeMode = false; // depends on control dependency: [if], data = [none]
}
buffer.append(current);
}
}
if (escapeMode) {
buffer.append(ESCAPE_CHAR); // depends on control dependency: [if], data = [none]
}
if (buffer.length() != 0) {
list.add(buffer.toString()); // depends on control dependency: [if], data = [none]
}
return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} } |
public class class_name {
public EClass getIfcRadiusDimension() {
if (ifcRadiusDimensionEClass == null) {
ifcRadiusDimensionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(419);
}
return ifcRadiusDimensionEClass;
} } | public class class_name {
public EClass getIfcRadiusDimension() {
if (ifcRadiusDimensionEClass == null) {
ifcRadiusDimensionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(419);
// depends on control dependency: [if], data = [none]
}
return ifcRadiusDimensionEClass;
} } |
public class class_name {
public void marshall(ListSentimentDetectionJobsRequest listSentimentDetectionJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (listSentimentDetectionJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getFilter(), FILTER_BINDING);
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListSentimentDetectionJobsRequest listSentimentDetectionJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (listSentimentDetectionJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getFilter(), FILTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listSentimentDetectionJobsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected void registerGlobalWebAppListeners() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.entering(CLASS_NAME, "registerGlobalWebAppListeners");
// Notify PreEventListenerPorviders because the contract is that they
// go first before global listeners
RegisterEventListenerProvider.notifyPreEventListenerProviders(this);
super.registerGlobalWebAppListeners();
// Add the Servlet 3.1 specific code here.
List sIdListeners = WebContainer.getSessionIdListeners(isSystemApp());
try {
for (int i = 0; i < sIdListeners.size(); i++) {
sessionIdListeners.add(i, sIdListeners.get(i));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Added the following HttpSessionIdListeners: " + sessionIdListeners.toString());
}
} catch (Throwable th) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, CLASS_NAME + ".registerGlobalWebAppListeners", "1853", this);
logError("Failed to load global session listener: " + th);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.exiting(CLASS_NAME, "registerGlobalWebAppListeners");
} } | public class class_name {
@Override
protected void registerGlobalWebAppListeners() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.entering(CLASS_NAME, "registerGlobalWebAppListeners");
// Notify PreEventListenerPorviders because the contract is that they
// go first before global listeners
RegisterEventListenerProvider.notifyPreEventListenerProviders(this);
super.registerGlobalWebAppListeners();
// Add the Servlet 3.1 specific code here.
List sIdListeners = WebContainer.getSessionIdListeners(isSystemApp());
try {
for (int i = 0; i < sIdListeners.size(); i++) {
sessionIdListeners.add(i, sIdListeners.get(i)); // depends on control dependency: [for], data = [i]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Added the following HttpSessionIdListeners: " + sessionIdListeners.toString()); // depends on control dependency: [if], data = [none]
}
} catch (Throwable th) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(th, CLASS_NAME + ".registerGlobalWebAppListeners", "1853", this);
logError("Failed to load global session listener: " + th);
} // depends on control dependency: [catch], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.exiting(CLASS_NAME, "registerGlobalWebAppListeners");
} } |
public class class_name {
protected String getParentPropertyName(String propertyName) {
if (!PropertyAccessorUtils.isIndexedProperty(propertyName)) {
return "";
}
else {
return propertyName.substring(0, propertyName.lastIndexOf(PROPERTY_KEY_PREFIX_CHAR));
}
} } | public class class_name {
protected String getParentPropertyName(String propertyName) {
if (!PropertyAccessorUtils.isIndexedProperty(propertyName)) {
return ""; // depends on control dependency: [if], data = [none]
}
else {
return propertyName.substring(0, propertyName.lastIndexOf(PROPERTY_KEY_PREFIX_CHAR)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ClassReader of(byte[] binaryRepresentation) {
if (EXPERIMENTAL) {
byte[] actualVersion = new byte[]{binaryRepresentation[4], binaryRepresentation[5], binaryRepresentation[6], binaryRepresentation[7]};
binaryRepresentation[4] = (byte) (Opcodes.V12 >>> 24);
binaryRepresentation[5] = (byte) (Opcodes.V12 >>> 16);
binaryRepresentation[6] = (byte) (Opcodes.V12 >>> 8);
binaryRepresentation[7] = (byte) Opcodes.V12;
ClassReader classReader = new ClassReader(binaryRepresentation);
System.arraycopy(actualVersion, 0, binaryRepresentation, 4, actualVersion.length);
return classReader;
} else {
return new ClassReader(binaryRepresentation);
}
} } | public class class_name {
public static ClassReader of(byte[] binaryRepresentation) {
if (EXPERIMENTAL) {
byte[] actualVersion = new byte[]{binaryRepresentation[4], binaryRepresentation[5], binaryRepresentation[6], binaryRepresentation[7]};
binaryRepresentation[4] = (byte) (Opcodes.V12 >>> 24); // depends on control dependency: [if], data = [none]
binaryRepresentation[5] = (byte) (Opcodes.V12 >>> 16); // depends on control dependency: [if], data = [none]
binaryRepresentation[6] = (byte) (Opcodes.V12 >>> 8); // depends on control dependency: [if], data = [none]
binaryRepresentation[7] = (byte) Opcodes.V12; // depends on control dependency: [if], data = [none]
ClassReader classReader = new ClassReader(binaryRepresentation);
System.arraycopy(actualVersion, 0, binaryRepresentation, 4, actualVersion.length); // depends on control dependency: [if], data = [none]
return classReader; // depends on control dependency: [if], data = [none]
} else {
return new ClassReader(binaryRepresentation); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Locale getMainLocale(CmsObject cms, CmsResource res) {
CmsLocaleManager localeManager = OpenCms.getLocaleManager();
List<Locale> defaultLocales = null;
// must switch project id in stored Admin context to match current project
String defaultNames = null;
try {
defaultNames = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue();
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
if (defaultNames != null) {
defaultLocales = localeManager.getAvailableLocales(defaultNames);
}
if ((defaultLocales == null) || (defaultLocales.isEmpty())) {
// no default locales could be determined
defaultLocales = localeManager.getDefaultLocales();
}
Locale locale;
// return the first default locale name
if ((defaultLocales != null) && (defaultLocales.size() > 0)) {
locale = defaultLocales.get(0);
} else {
locale = CmsLocaleManager.getDefaultLocale();
}
return locale;
} } | public class class_name {
public static Locale getMainLocale(CmsObject cms, CmsResource res) {
CmsLocaleManager localeManager = OpenCms.getLocaleManager();
List<Locale> defaultLocales = null;
// must switch project id in stored Admin context to match current project
String defaultNames = null;
try {
defaultNames = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_LOCALE, true).getValue(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
if (defaultNames != null) {
defaultLocales = localeManager.getAvailableLocales(defaultNames); // depends on control dependency: [if], data = [(defaultNames]
}
if ((defaultLocales == null) || (defaultLocales.isEmpty())) {
// no default locales could be determined
defaultLocales = localeManager.getDefaultLocales(); // depends on control dependency: [if], data = [none]
}
Locale locale;
// return the first default locale name
if ((defaultLocales != null) && (defaultLocales.size() > 0)) {
locale = defaultLocales.get(0); // depends on control dependency: [if], data = [none]
} else {
locale = CmsLocaleManager.getDefaultLocale(); // depends on control dependency: [if], data = [none]
}
return locale;
} } |
public class class_name {
public KeyManagerConfigurer keyPassword(String key, String password) {
if (keyPasswords == null) {
keyPasswords = new HashMap<>();
}
keyPasswords.put(key, password);
return this;
} } | public class class_name {
public KeyManagerConfigurer keyPassword(String key, String password) {
if (keyPasswords == null) {
keyPasswords = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
keyPasswords.put(key, password);
return this;
} } |
public class class_name {
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
boolean isValid = maxOffset >= -1
&& formats.length > maxOffset
&& offsets.length > maxOffset
&& argumentNumbers.length > maxOffset;
if (isValid) {
int lastOffset = pattern.length() + 1;
for (int i = maxOffset; i >= 0; --i) {
if ((offsets[i] < 0) || (offsets[i] > lastOffset)) {
isValid = false;
break;
} else {
lastOffset = offsets[i];
}
}
}
if (!isValid) {
throw new InvalidObjectException("Could not reconstruct MessageFormat from corrupt stream.");
}
} } | public class class_name {
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
boolean isValid = maxOffset >= -1
&& formats.length > maxOffset
&& offsets.length > maxOffset
&& argumentNumbers.length > maxOffset;
if (isValid) {
int lastOffset = pattern.length() + 1;
for (int i = maxOffset; i >= 0; --i) {
if ((offsets[i] < 0) || (offsets[i] > lastOffset)) {
isValid = false; // depends on control dependency: [if], data = [none]
break;
} else {
lastOffset = offsets[i]; // depends on control dependency: [if], data = [none]
}
}
}
if (!isValid) {
throw new InvalidObjectException("Could not reconstruct MessageFormat from corrupt stream.");
}
} } |
public class class_name {
public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) {
try {
final Props props = new Props(parent);
final File[] files = dir.listFiles();
Arrays.sort(files);
if (files != null) {
for (final File f : files) {
if (f.isFile() && endsWith(f, suffixes)) {
props.putAll(new Props(null, f.getAbsolutePath()));
}
}
}
return props;
} catch (final IOException e) {
throw new RuntimeException("Error loading properties.", e);
}
} } | public class class_name {
public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) {
try {
final Props props = new Props(parent);
final File[] files = dir.listFiles();
Arrays.sort(files); // depends on control dependency: [try], data = [none]
if (files != null) {
for (final File f : files) {
if (f.isFile() && endsWith(f, suffixes)) {
props.putAll(new Props(null, f.getAbsolutePath())); // depends on control dependency: [if], data = [none]
}
}
}
return props; // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
throw new RuntimeException("Error loading properties.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void getActiveFlowsWithExecutorHelper(
final List<Pair<ExecutableFlow, Optional<Executor>>> flows,
final Collection<Pair<ExecutionReference, ExecutableFlow>> collection) {
for (final Pair<ExecutionReference, ExecutableFlow> ref : collection) {
flows.add(new Pair<>(ref.getSecond(), ref
.getFirst().getExecutor()));
}
} } | public class class_name {
private void getActiveFlowsWithExecutorHelper(
final List<Pair<ExecutableFlow, Optional<Executor>>> flows,
final Collection<Pair<ExecutionReference, ExecutableFlow>> collection) {
for (final Pair<ExecutionReference, ExecutableFlow> ref : collection) {
flows.add(new Pair<>(ref.getSecond(), ref
.getFirst().getExecutor())); // depends on control dependency: [for], data = [ref]
}
} } |
public class class_name {
public static String numericOffset(String initial, String offset) {
BigDecimal number;
BigDecimal dOffset;
try {
number = new BigDecimal(initial);
dOffset = new BigDecimal(offset);
} catch (Exception ex) {
return null;
}
return number.add(dOffset).toString();
} } | public class class_name {
public static String numericOffset(String initial, String offset) {
BigDecimal number;
BigDecimal dOffset;
try {
number = new BigDecimal(initial); // depends on control dependency: [try], data = [none]
dOffset = new BigDecimal(offset); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return null;
} // depends on control dependency: [catch], data = [none]
return number.add(dOffset).toString();
} } |
public class class_name {
public void setPoolSize(int poolSize) {
// Assert.isTrue(poolSize > 0, "'poolSize' must be 1 or higher");
this.poolSize = poolSize;
if (this.scheduledExecutor instanceof ScheduledThreadPoolExecutor) {
((ScheduledThreadPoolExecutor) this.scheduledExecutor).setCorePoolSize(poolSize);
}
} } | public class class_name {
public void setPoolSize(int poolSize) {
// Assert.isTrue(poolSize > 0, "'poolSize' must be 1 or higher");
this.poolSize = poolSize;
if (this.scheduledExecutor instanceof ScheduledThreadPoolExecutor) {
((ScheduledThreadPoolExecutor) this.scheduledExecutor).setCorePoolSize(poolSize); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addImport(ImportDescr importDescr) {
for (Dialect dialect : this.map.values()) {
dialect.addImport(importDescr);
}
} } | public class class_name {
public void addImport(ImportDescr importDescr) {
for (Dialect dialect : this.map.values()) {
dialect.addImport(importDescr); // depends on control dependency: [for], data = [dialect]
}
} } |
public class class_name {
private void setCredential(Subject subject, WSPrincipal principal) throws CredentialException {
String securityName = principal.getName();
Hashtable<String, ?> customProperties = getUniqueIdHashtableFromSubject(subject);
if (customProperties == null || customProperties.isEmpty()) {
UserRegistryService urService = userRegistryServiceRef.getService();
if (urService != null) {
String urType = urService.getUserRegistryType();
if ("WIM".equalsIgnoreCase(urType) || "LDAP".equalsIgnoreCase(urType)) {
try {
securityName = urService.getUserRegistry().getUserDisplayName(securityName);
} catch (Exception e) {
//do nothing
}
}
}
}
if (securityName == null || securityName.length() == 0) {
securityName = principal.getName();
}
String accessId = principal.getAccessId();
String customRealm = null;
String realm = null;
String uniqueName = null;
if (customProperties != null) {
customRealm = (String) customProperties.get(AttributeNameConstants.WSCREDENTIAL_REALM);
}
if (customRealm != null) {
realm = customRealm;
String[] parts = accessId.split(realm + "/");
if (parts != null && parts.length == 2)
uniqueName = parts[1];
} else {
realm = AccessIdUtil.getRealm(accessId);
uniqueName = AccessIdUtil.getUniqueId(accessId);
}
if (AccessIdUtil.isServerAccessId(accessId)) {
// Create a server WSCredential
setCredential(null, subject, realm, securityName, uniqueName, null, accessId, null, null);
} else {
CredentialsService cs = credentialsServiceRef.getService();
String unauthenticatedUserid = cs.getUnauthenticatedUserid();
if (securityName != null && unauthenticatedUserid != null &&
securityName.equals(unauthenticatedUserid)) {
// Create an unauthenticated WSCredential
setCredential(unauthenticatedUserid, subject, realm, securityName, uniqueName, null, null, null, null);
} else if (AccessIdUtil.isUserAccessId(accessId)) {
// Create a user WSCredential
createUserWSCredential(subject, securityName, accessId, realm, uniqueName, unauthenticatedUserid);
}
}
} } | public class class_name {
private void setCredential(Subject subject, WSPrincipal principal) throws CredentialException {
String securityName = principal.getName();
Hashtable<String, ?> customProperties = getUniqueIdHashtableFromSubject(subject);
if (customProperties == null || customProperties.isEmpty()) {
UserRegistryService urService = userRegistryServiceRef.getService();
if (urService != null) {
String urType = urService.getUserRegistryType();
if ("WIM".equalsIgnoreCase(urType) || "LDAP".equalsIgnoreCase(urType)) {
try {
securityName = urService.getUserRegistry().getUserDisplayName(securityName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
//do nothing
} // depends on control dependency: [catch], data = [none]
}
}
}
if (securityName == null || securityName.length() == 0) {
securityName = principal.getName();
}
String accessId = principal.getAccessId();
String customRealm = null;
String realm = null;
String uniqueName = null;
if (customProperties != null) {
customRealm = (String) customProperties.get(AttributeNameConstants.WSCREDENTIAL_REALM);
}
if (customRealm != null) {
realm = customRealm;
String[] parts = accessId.split(realm + "/");
if (parts != null && parts.length == 2)
uniqueName = parts[1];
} else {
realm = AccessIdUtil.getRealm(accessId);
uniqueName = AccessIdUtil.getUniqueId(accessId);
}
if (AccessIdUtil.isServerAccessId(accessId)) {
// Create a server WSCredential
setCredential(null, subject, realm, securityName, uniqueName, null, accessId, null, null);
} else {
CredentialsService cs = credentialsServiceRef.getService();
String unauthenticatedUserid = cs.getUnauthenticatedUserid();
if (securityName != null && unauthenticatedUserid != null &&
securityName.equals(unauthenticatedUserid)) {
// Create an unauthenticated WSCredential
setCredential(unauthenticatedUserid, subject, realm, securityName, uniqueName, null, null, null, null);
} else if (AccessIdUtil.isUserAccessId(accessId)) {
// Create a user WSCredential
createUserWSCredential(subject, securityName, accessId, realm, uniqueName, unauthenticatedUserid);
}
}
} } |
public class class_name {
private static void parsePatternTo(DateTimeFormatterBuilder builder, String pattern) {
int length = pattern.length();
int[] indexRef = new int[1];
for (int i=0; i<length; i++) {
indexRef[0] = i;
String token = parseToken(pattern, indexRef);
i = indexRef[0];
int tokenLen = token.length();
if (tokenLen == 0) {
break;
}
char c = token.charAt(0);
switch (c) {
case 'G': // era designator (text)
builder.appendEraText();
break;
case 'C': // century of era (number)
builder.appendCenturyOfEra(tokenLen, tokenLen);
break;
case 'x': // weekyear (number)
case 'y': // year (number)
case 'Y': // year of era (number)
if (tokenLen == 2) {
boolean lenientParse = true;
// Peek ahead to next token.
if (i + 1 < length) {
indexRef[0]++;
if (isNumericToken(parseToken(pattern, indexRef))) {
// If next token is a number, cannot support
// lenient parse, because it will consume digits
// that it should not.
lenientParse = false;
}
indexRef[0]--;
}
// Use pivots which are compatible with SimpleDateFormat.
switch (c) {
case 'x':
builder.appendTwoDigitWeekyear
(new DateTime().getWeekyear() - 30, lenientParse);
break;
case 'y':
case 'Y':
default:
builder.appendTwoDigitYear(new DateTime().getYear() - 30, lenientParse);
break;
}
} else {
// Try to support long year values.
int maxDigits = 9;
// Peek ahead to next token.
if (i + 1 < length) {
indexRef[0]++;
if (isNumericToken(parseToken(pattern, indexRef))) {
// If next token is a number, cannot support long years.
maxDigits = tokenLen;
}
indexRef[0]--;
}
switch (c) {
case 'x':
builder.appendWeekyear(tokenLen, maxDigits);
break;
case 'y':
builder.appendYear(tokenLen, maxDigits);
break;
case 'Y':
builder.appendYearOfEra(tokenLen, maxDigits);
break;
}
}
break;
case 'M': // month of year (text and number)
if (tokenLen >= 3) {
if (tokenLen >= 4) {
builder.appendMonthOfYearText();
} else {
builder.appendMonthOfYearShortText();
}
} else {
builder.appendMonthOfYear(tokenLen);
}
break;
case 'd': // day of month (number)
builder.appendDayOfMonth(tokenLen);
break;
case 'a': // am/pm marker (text)
builder.appendHalfdayOfDayText();
break;
case 'h': // clockhour of halfday (number, 1..12)
builder.appendClockhourOfHalfday(tokenLen);
break;
case 'H': // hour of day (number, 0..23)
builder.appendHourOfDay(tokenLen);
break;
case 'k': // clockhour of day (1..24)
builder.appendClockhourOfDay(tokenLen);
break;
case 'K': // hour of halfday (0..11)
builder.appendHourOfHalfday(tokenLen);
break;
case 'm': // minute of hour (number)
builder.appendMinuteOfHour(tokenLen);
break;
case 's': // second of minute (number)
builder.appendSecondOfMinute(tokenLen);
break;
case 'S': // fraction of second (number)
builder.appendFractionOfSecond(tokenLen, tokenLen);
break;
case 'e': // day of week (number)
builder.appendDayOfWeek(tokenLen);
break;
case 'E': // dayOfWeek (text)
if (tokenLen >= 4) {
builder.appendDayOfWeekText();
} else {
builder.appendDayOfWeekShortText();
}
break;
case 'D': // day of year (number)
builder.appendDayOfYear(tokenLen);
break;
case 'w': // week of weekyear (number)
builder.appendWeekOfWeekyear(tokenLen);
break;
case 'z': // time zone (text)
if (tokenLen >= 4) {
builder.appendTimeZoneName();
} else {
builder.appendTimeZoneShortName(null);
}
break;
case 'Z': // time zone offset
if (tokenLen == 1) {
builder.appendTimeZoneOffset(null, "Z", false, 2, 2);
} else if (tokenLen == 2) {
builder.appendTimeZoneOffset(null, "Z", true, 2, 2);
} else {
builder.appendTimeZoneId();
}
break;
case '\'': // literal text
String sub = token.substring(1);
if (sub.length() == 1) {
builder.appendLiteral(sub.charAt(0));
} else {
// Create copy of sub since otherwise the temporary quoted
// string would still be referenced internally.
builder.appendLiteral(new String(sub));
}
break;
default:
throw new IllegalArgumentException
("Illegal pattern component: " + token);
}
}
} } | public class class_name {
private static void parsePatternTo(DateTimeFormatterBuilder builder, String pattern) {
int length = pattern.length();
int[] indexRef = new int[1];
for (int i=0; i<length; i++) {
indexRef[0] = i; // depends on control dependency: [for], data = [i]
String token = parseToken(pattern, indexRef);
i = indexRef[0]; // depends on control dependency: [for], data = [i]
int tokenLen = token.length();
if (tokenLen == 0) {
break;
}
char c = token.charAt(0);
switch (c) {
case 'G': // era designator (text)
builder.appendEraText();
break;
case 'C': // century of era (number)
builder.appendCenturyOfEra(tokenLen, tokenLen);
break;
case 'x': // weekyear (number)
case 'y': // year (number)
case 'Y': // year of era (number)
if (tokenLen == 2) {
boolean lenientParse = true;
// Peek ahead to next token.
if (i + 1 < length) {
indexRef[0]++; // depends on control dependency: [if], data = [none]
if (isNumericToken(parseToken(pattern, indexRef))) {
// If next token is a number, cannot support
// lenient parse, because it will consume digits
// that it should not.
lenientParse = false; // depends on control dependency: [if], data = [none]
}
indexRef[0]--; // depends on control dependency: [if], data = [none]
}
// Use pivots which are compatible with SimpleDateFormat.
switch (c) {
case 'x':
builder.appendTwoDigitWeekyear
(new DateTime().getWeekyear() - 30, lenientParse);
break;
case 'y':
case 'Y':
default:
builder.appendTwoDigitYear(new DateTime().getYear() - 30, lenientParse);
break;
}
} else {
// Try to support long year values.
int maxDigits = 9;
// Peek ahead to next token.
if (i + 1 < length) {
indexRef[0]++; // depends on control dependency: [if], data = [none]
if (isNumericToken(parseToken(pattern, indexRef))) {
// If next token is a number, cannot support long years.
maxDigits = tokenLen; // depends on control dependency: [if], data = [none]
}
indexRef[0]--; // depends on control dependency: [if], data = [none]
}
switch (c) {
case 'x':
builder.appendWeekyear(tokenLen, maxDigits);
break;
case 'y':
builder.appendYear(tokenLen, maxDigits);
break;
case 'Y':
builder.appendYearOfEra(tokenLen, maxDigits);
break;
}
}
break;
case 'M': // month of year (text and number)
if (tokenLen >= 3) {
if (tokenLen >= 4) {
builder.appendMonthOfYearText(); // depends on control dependency: [if], data = [none]
} else {
builder.appendMonthOfYearShortText(); // depends on control dependency: [if], data = [none]
}
} else {
builder.appendMonthOfYear(tokenLen); // depends on control dependency: [if], data = [(tokenLen]
}
break;
case 'd': // day of month (number)
builder.appendDayOfMonth(tokenLen);
break;
case 'a': // am/pm marker (text)
builder.appendHalfdayOfDayText();
break;
case 'h': // clockhour of halfday (number, 1..12)
builder.appendClockhourOfHalfday(tokenLen);
break;
case 'H': // hour of day (number, 0..23)
builder.appendHourOfDay(tokenLen);
break;
case 'k': // clockhour of day (1..24)
builder.appendClockhourOfDay(tokenLen);
break;
case 'K': // hour of halfday (0..11)
builder.appendHourOfHalfday(tokenLen);
break;
case 'm': // minute of hour (number)
builder.appendMinuteOfHour(tokenLen);
break;
case 's': // second of minute (number)
builder.appendSecondOfMinute(tokenLen);
break;
case 'S': // fraction of second (number)
builder.appendFractionOfSecond(tokenLen, tokenLen);
break;
case 'e': // day of week (number)
builder.appendDayOfWeek(tokenLen);
break;
case 'E': // dayOfWeek (text)
if (tokenLen >= 4) {
builder.appendDayOfWeekText(); // depends on control dependency: [if], data = [none]
} else {
builder.appendDayOfWeekShortText(); // depends on control dependency: [if], data = [none]
}
break;
case 'D': // day of year (number)
builder.appendDayOfYear(tokenLen);
break;
case 'w': // week of weekyear (number)
builder.appendWeekOfWeekyear(tokenLen);
break;
case 'z': // time zone (text)
if (tokenLen >= 4) {
builder.appendTimeZoneName(); // depends on control dependency: [if], data = [none]
} else {
builder.appendTimeZoneShortName(null); // depends on control dependency: [if], data = [none]
}
break;
case 'Z': // time zone offset
if (tokenLen == 1) {
builder.appendTimeZoneOffset(null, "Z", false, 2, 2); // depends on control dependency: [if], data = [none]
} else if (tokenLen == 2) {
builder.appendTimeZoneOffset(null, "Z", true, 2, 2); // depends on control dependency: [if], data = [2)]
} else {
builder.appendTimeZoneId(); // depends on control dependency: [if], data = [none]
}
break;
case '\'': // literal text
String sub = token.substring(1);
if (sub.length() == 1) {
builder.appendLiteral(sub.charAt(0)); // depends on control dependency: [if], data = [none]
} else {
// Create copy of sub since otherwise the temporary quoted
// string would still be referenced internally.
builder.appendLiteral(new String(sub)); // depends on control dependency: [if], data = [none]
}
break;
default:
throw new IllegalArgumentException
("Illegal pattern component: " + token);
}
}
} } |
public class class_name {
public UUID getUUID(FastTrackField type)
{
String value = getString(type);
UUID result = null;
if (value != null && !value.isEmpty() && value.length() >= 36)
{
if (value.startsWith("{"))
{
value = value.substring(1, value.length() - 1);
}
if (value.length() > 16)
{
value = value.substring(0, 36);
}
result = UUID.fromString(value);
}
return result;
} } | public class class_name {
public UUID getUUID(FastTrackField type)
{
String value = getString(type);
UUID result = null;
if (value != null && !value.isEmpty() && value.length() >= 36)
{
if (value.startsWith("{"))
{
value = value.substring(1, value.length() - 1); // depends on control dependency: [if], data = [none]
}
if (value.length() > 16)
{
value = value.substring(0, 36); // depends on control dependency: [if], data = [none]
}
result = UUID.fromString(value); // depends on control dependency: [if], data = [(value]
}
return result;
} } |
public class class_name {
public static JsonObject serialize(Context<?> context) {
if (context instanceof NetworkContext) {
return serialize(NetworkContext.class.cast(context));
} else if (context instanceof ComponentContext) {
return serialize(ComponentContext.class.cast(context));
} else if (context instanceof InstanceContext) {
return serialize(InstanceContext.class.cast(context));
} else if (context instanceof IOContext) {
return serialize(IOContext.class.cast(context));
} else if (context instanceof InputPortContext) {
return serialize(InputPortContext.class.cast(context));
} else if (context instanceof OutputPortContext) {
return serialize(OutputPortContext.class.cast(context));
} else {
throw new UnsupportedOperationException("Cannot serialize " + context.getClass().getCanonicalName() + " type contexts");
}
} } | public class class_name {
public static JsonObject serialize(Context<?> context) {
if (context instanceof NetworkContext) {
return serialize(NetworkContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else if (context instanceof ComponentContext) {
return serialize(ComponentContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else if (context instanceof InstanceContext) {
return serialize(InstanceContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else if (context instanceof IOContext) {
return serialize(IOContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else if (context instanceof InputPortContext) {
return serialize(InputPortContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else if (context instanceof OutputPortContext) {
return serialize(OutputPortContext.class.cast(context)); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException("Cannot serialize " + context.getClass().getCanonicalName() + " type contexts");
}
} } |
public class class_name {
@Override
public CommerceTierPriceEntry fetchByC_LtM_Last(long commercePriceEntryId,
int minQuantity,
OrderByComparator<CommerceTierPriceEntry> orderByComparator) {
int count = countByC_LtM(commercePriceEntryId, minQuantity);
if (count == 0) {
return null;
}
List<CommerceTierPriceEntry> list = findByC_LtM(commercePriceEntryId,
minQuantity, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceTierPriceEntry fetchByC_LtM_Last(long commercePriceEntryId,
int minQuantity,
OrderByComparator<CommerceTierPriceEntry> orderByComparator) {
int count = countByC_LtM(commercePriceEntryId, minQuantity);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommerceTierPriceEntry> list = findByC_LtM(commercePriceEntryId,
minQuantity, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void marshall(ReferenceDataSourceUpdate referenceDataSourceUpdate, ProtocolMarshaller protocolMarshaller) {
if (referenceDataSourceUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(referenceDataSourceUpdate.getReferenceId(), REFERENCEID_BINDING);
protocolMarshaller.marshall(referenceDataSourceUpdate.getTableNameUpdate(), TABLENAMEUPDATE_BINDING);
protocolMarshaller.marshall(referenceDataSourceUpdate.getS3ReferenceDataSourceUpdate(), S3REFERENCEDATASOURCEUPDATE_BINDING);
protocolMarshaller.marshall(referenceDataSourceUpdate.getReferenceSchemaUpdate(), REFERENCESCHEMAUPDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ReferenceDataSourceUpdate referenceDataSourceUpdate, ProtocolMarshaller protocolMarshaller) {
if (referenceDataSourceUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(referenceDataSourceUpdate.getReferenceId(), REFERENCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(referenceDataSourceUpdate.getTableNameUpdate(), TABLENAMEUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(referenceDataSourceUpdate.getS3ReferenceDataSourceUpdate(), S3REFERENCEDATASOURCEUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(referenceDataSourceUpdate.getReferenceSchemaUpdate(), REFERENCESCHEMAUPDATE_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 {
private static Map<String, String> extractChallenge(String authenticateHeader, String authChallengePrefix) {
if (!isValidChallenge(authenticateHeader, authChallengePrefix)) {
return null;
}
authenticateHeader = authenticateHeader.toLowerCase().replace(authChallengePrefix.toLowerCase(), "");
String[] challenges = authenticateHeader.split(", ");
Map<String, String> challengeMap = new HashMap<String, String>();
for (String pair : challenges) {
String[] keyValue = pair.split("=");
challengeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", ""));
}
return challengeMap;
} } | public class class_name {
private static Map<String, String> extractChallenge(String authenticateHeader, String authChallengePrefix) {
if (!isValidChallenge(authenticateHeader, authChallengePrefix)) {
return null; // depends on control dependency: [if], data = [none]
}
authenticateHeader = authenticateHeader.toLowerCase().replace(authChallengePrefix.toLowerCase(), "");
String[] challenges = authenticateHeader.split(", ");
Map<String, String> challengeMap = new HashMap<String, String>();
for (String pair : challenges) {
String[] keyValue = pair.split("=");
challengeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", "")); // depends on control dependency: [for], data = [none]
}
return challengeMap;
} } |
public class class_name {
protected void extractPropertyDescriptor(Field field, Object defaultInstance)
{
DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor();
// is parameter hidden
PropertyHidden parameterHidden = field.getAnnotation(PropertyHidden.class);
if (parameterHidden == null) {
// get parameter id
PropertyId propertyId = field.getAnnotation(PropertyId.class);
desc.setId(propertyId != null ? propertyId.value() : field.getName());
// set parameter type
desc.setPropertyType(field.getGenericType());
// get parameter name
PropertyName parameterName = field.getAnnotation(PropertyName.class);
desc.setName(parameterName != null ? parameterName.value() : desc.getId());
// get parameter description
PropertyDescription parameterDescription = field.getAnnotation(PropertyDescription.class);
desc.setDescription(parameterDescription != null ? parameterDescription.value() : desc.getId());
Map<Class, Annotation> annotations = new HashMap<>();
COMMON_ANNOTATION_CLASSES.forEach(aClass ->
annotations.put(aClass, field.getAnnotation(aClass))
);
setCommonProperties(desc, annotations);
if (defaultInstance != null) {
// get default value
try {
desc.setDefaultValue(field.get(defaultInstance));
} catch (Exception e) {
LOGGER.error(
MessageFormat.format("Failed to get default property value from field {0} in class {1}",
field.getName(), this.beanClass), e);
}
}
desc.setField(field);
this.parameterDescriptorMap.put(desc.getId(), desc);
}
} } | public class class_name {
protected void extractPropertyDescriptor(Field field, Object defaultInstance)
{
DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor();
// is parameter hidden
PropertyHidden parameterHidden = field.getAnnotation(PropertyHidden.class);
if (parameterHidden == null) {
// get parameter id
PropertyId propertyId = field.getAnnotation(PropertyId.class);
desc.setId(propertyId != null ? propertyId.value() : field.getName()); // depends on control dependency: [if], data = [none]
// set parameter type
desc.setPropertyType(field.getGenericType()); // depends on control dependency: [if], data = [none]
// get parameter name
PropertyName parameterName = field.getAnnotation(PropertyName.class);
desc.setName(parameterName != null ? parameterName.value() : desc.getId()); // depends on control dependency: [if], data = [none]
// get parameter description
PropertyDescription parameterDescription = field.getAnnotation(PropertyDescription.class);
desc.setDescription(parameterDescription != null ? parameterDescription.value() : desc.getId()); // depends on control dependency: [if], data = [none]
Map<Class, Annotation> annotations = new HashMap<>();
COMMON_ANNOTATION_CLASSES.forEach(aClass ->
annotations.put(aClass, field.getAnnotation(aClass))
); // depends on control dependency: [if], data = [none]
setCommonProperties(desc, annotations); // depends on control dependency: [if], data = [none]
if (defaultInstance != null) {
// get default value
try {
desc.setDefaultValue(field.get(defaultInstance)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error(
MessageFormat.format("Failed to get default property value from field {0} in class {1}",
field.getName(), this.beanClass), e);
} // depends on control dependency: [catch], data = [none]
}
desc.setField(field); // depends on control dependency: [if], data = [none]
this.parameterDescriptorMap.put(desc.getId(), desc); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void ensureSameWidgetSize(final DecoratedTabPanel panel) {
if (!panel.isAttached()) {
throw new IllegalArgumentException("panel not attached: " + panel);
}
int maxw = 0;
int maxh = 0;
for (final Widget widget : panel) {
final int w = widget.getOffsetWidth();
final int h = widget.getOffsetHeight();
if (w > maxw) {
maxw = w;
}
if (h > maxh) {
maxh = h;
}
}
if (maxw == 0 || maxh == 0) {
throw new IllegalArgumentException("maxw=" + maxw + " maxh=" + maxh);
}
for (final Widget widget : panel) {
setOffsetWidth(widget, maxw);
setOffsetHeight(widget, maxh);
}
} } | public class class_name {
private static void ensureSameWidgetSize(final DecoratedTabPanel panel) {
if (!panel.isAttached()) {
throw new IllegalArgumentException("panel not attached: " + panel);
}
int maxw = 0;
int maxh = 0;
for (final Widget widget : panel) {
final int w = widget.getOffsetWidth();
final int h = widget.getOffsetHeight();
if (w > maxw) {
maxw = w; // depends on control dependency: [if], data = [none]
}
if (h > maxh) {
maxh = h; // depends on control dependency: [if], data = [none]
}
}
if (maxw == 0 || maxh == 0) {
throw new IllegalArgumentException("maxw=" + maxw + " maxh=" + maxh);
}
for (final Widget widget : panel) {
setOffsetWidth(widget, maxw); // depends on control dependency: [for], data = [widget]
setOffsetHeight(widget, maxh); // depends on control dependency: [for], data = [widget]
}
} } |
public class class_name {
public static FunctionLib combineFLDs(FunctionLib[] flds) {
FunctionLib fl = new FunctionLib();
if (ArrayUtil.isEmpty(flds)) return fl;
setAttributes(flds[0], fl);
// add functions
for (int i = 0; i < flds.length; i++) {
copyFunctions(flds[i], fl);
}
return fl;
} } | public class class_name {
public static FunctionLib combineFLDs(FunctionLib[] flds) {
FunctionLib fl = new FunctionLib();
if (ArrayUtil.isEmpty(flds)) return fl;
setAttributes(flds[0], fl);
// add functions
for (int i = 0; i < flds.length; i++) {
copyFunctions(flds[i], fl); // depends on control dependency: [for], data = [i]
}
return fl;
} } |
public class class_name {
public <T extends Throwable> T throwing(Level level, T throwable) {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN, level.level, "throwing", null, throwable);
}
return throwable;
} } | public class class_name {
public <T extends Throwable> T throwing(Level level, T throwable) {
if (instanceofLAL) {
((LocationAwareLogger) logger).log(THROWING_MARKER, FQCN, level.level, "throwing", null, throwable); // depends on control dependency: [if], data = [none]
}
return throwable;
} } |
public class class_name {
private void enhanceCommandArray(IAgentCommand[] startupCommandAry) throws BadCompletedRequestListener {
if (getTraceWriter().getTraceFilterExt() instanceof IncludeAnyOfTheseEventsFilterExt) {
IncludeAnyOfTheseEventsFilterExt myFilter = (IncludeAnyOfTheseEventsFilterExt) getTraceWriter().getTraceFilterExt();
ClassInstrumentationCommand cic = new ClassInstrumentationCommand();
cic.setIncludeClassRegEx(myFilter.getDelimitedListOfAllClasses() );
if ( getCommandArray() == null) {
this.setCommandArray(new IAgentCommand[]{});
}
//Expand by one
IAgentCommand[] tmp = Arrays.copyOf(getCommandArray(), getCommandArray().length+1);
tmp[tmp.length-1] = cic;
this.setCommandArray(tmp);
}
} } | public class class_name {
private void enhanceCommandArray(IAgentCommand[] startupCommandAry) throws BadCompletedRequestListener {
if (getTraceWriter().getTraceFilterExt() instanceof IncludeAnyOfTheseEventsFilterExt) {
IncludeAnyOfTheseEventsFilterExt myFilter = (IncludeAnyOfTheseEventsFilterExt) getTraceWriter().getTraceFilterExt();
ClassInstrumentationCommand cic = new ClassInstrumentationCommand();
cic.setIncludeClassRegEx(myFilter.getDelimitedListOfAllClasses() );
if ( getCommandArray() == null) {
this.setCommandArray(new IAgentCommand[]{}); // depends on control dependency: [if], data = [none]
}
//Expand by one
IAgentCommand[] tmp = Arrays.copyOf(getCommandArray(), getCommandArray().length+1);
tmp[tmp.length-1] = cic;
this.setCommandArray(tmp);
}
} } |
public class class_name {
private void handleSelectTrack(EventModel eventModel, ResourceModel<String> resourceModel) {
Optional<TrackInfo> trackInfo = TrackInfoResource.getTrackInfo(eventModel);
if (!trackInfo.isPresent()) {
musicHelper.playerError(PlayerError.ERROR_ILLEGAL + "command: " + resourceModel.getResource() + "missing resource",
resourceModel.getProvider());
}
selectTrack.accept(trackInfo.get());
} } | public class class_name {
private void handleSelectTrack(EventModel eventModel, ResourceModel<String> resourceModel) {
Optional<TrackInfo> trackInfo = TrackInfoResource.getTrackInfo(eventModel);
if (!trackInfo.isPresent()) {
musicHelper.playerError(PlayerError.ERROR_ILLEGAL + "command: " + resourceModel.getResource() + "missing resource",
resourceModel.getProvider()); // depends on control dependency: [if], data = [none]
}
selectTrack.accept(trackInfo.get());
} } |
public class class_name {
protected String getArgumentTypesAsString() {
if(!getArguments().isEmpty()) {
StringBuilder b = new StringBuilder();
b.append("(");
for(int i=0; i<getArguments().size(); ++i) {
LightweightTypeReference actualType = getActualType(getArguments().get(i));
if(actualType != null)
b.append(actualType.getHumanReadableName());
else
b.append("null");
if(i < getArguments().size()-1)
b.append(",");
}
b.append(")");
return b.toString();
}
return "";
} } | public class class_name {
protected String getArgumentTypesAsString() {
if(!getArguments().isEmpty()) {
StringBuilder b = new StringBuilder();
b.append("("); // depends on control dependency: [if], data = [none]
for(int i=0; i<getArguments().size(); ++i) {
LightweightTypeReference actualType = getActualType(getArguments().get(i));
if(actualType != null)
b.append(actualType.getHumanReadableName());
else
b.append("null");
if(i < getArguments().size()-1)
b.append(",");
}
b.append(")"); // depends on control dependency: [if], data = [none]
return b.toString(); // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
private static List<Element> getLastPartition(List<List<Element>> partitions) {
if (partitions.isEmpty()) {
List<Element> newPartition = new LinkedList<Element>();
partitions.add(newPartition);
return newPartition;
} else {
return partitions.get(partitions.size() - 1);
}
} } | public class class_name {
private static List<Element> getLastPartition(List<List<Element>> partitions) {
if (partitions.isEmpty()) {
List<Element> newPartition = new LinkedList<Element>();
partitions.add(newPartition); // depends on control dependency: [if], data = [none]
return newPartition; // depends on control dependency: [if], data = [none]
} else {
return partitions.get(partitions.size() - 1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override public float getProgress() {
if (length == 0)
return 1;
if (!isBGZF)
return (float)(in.getPosition() - fileStart) / length;
try {
if (in.peek() == -1)
return 1;
} catch (IOException e) {
return 1;
}
// Add 1 to the denominator to make sure that we never report 1 here.
return (float)((bci.getFilePointer() >>> 16) - fileStart) / (length + 1);
} } | public class class_name {
@Override public float getProgress() {
if (length == 0)
return 1;
if (!isBGZF)
return (float)(in.getPosition() - fileStart) / length;
try {
if (in.peek() == -1)
return 1;
} catch (IOException e) {
return 1;
} // depends on control dependency: [catch], data = [none]
// Add 1 to the denominator to make sure that we never report 1 here.
return (float)((bci.getFilePointer() >>> 16) - fileStart) / (length + 1);
} } |
public class class_name {
private void index(Set<PermissionBean> permissions) {
for (PermissionBean permissionBean : permissions) {
PermissionType permissionName = permissionBean.getName();
String orgQualifier = permissionBean.getOrganizationId();
String qualifiedPermission = createQualifiedPermissionKey(permissionName, orgQualifier);
organizations.add(orgQualifier);
qualifiedPermissions.add(qualifiedPermission);
Set<String> orgs = permissionToOrgsMap.get(permissionName);
if (orgs == null) {
orgs = new HashSet<>();
permissionToOrgsMap.put(permissionName, orgs);
}
orgs.add(orgQualifier);
}
} } | public class class_name {
private void index(Set<PermissionBean> permissions) {
for (PermissionBean permissionBean : permissions) {
PermissionType permissionName = permissionBean.getName();
String orgQualifier = permissionBean.getOrganizationId();
String qualifiedPermission = createQualifiedPermissionKey(permissionName, orgQualifier);
organizations.add(orgQualifier); // depends on control dependency: [for], data = [none]
qualifiedPermissions.add(qualifiedPermission); // depends on control dependency: [for], data = [none]
Set<String> orgs = permissionToOrgsMap.get(permissionName);
if (orgs == null) {
orgs = new HashSet<>(); // depends on control dependency: [if], data = [none]
permissionToOrgsMap.put(permissionName, orgs); // depends on control dependency: [if], data = [none]
}
orgs.add(orgQualifier); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void endConnection(SuroConnection connection) {
if (connection != null && shouldChangeConnection(connection)) {
connection.initStat();
connectionPool.put(connection.getServer(), connection);
connection = chooseFromPool();
}
if (connection != null) {
connectionQueue.offer(connection);
}
} } | public class class_name {
public void endConnection(SuroConnection connection) {
if (connection != null && shouldChangeConnection(connection)) {
connection.initStat(); // depends on control dependency: [if], data = [none]
connectionPool.put(connection.getServer(), connection); // depends on control dependency: [if], data = [(connection]
connection = chooseFromPool(); // depends on control dependency: [if], data = [none]
}
if (connection != null) {
connectionQueue.offer(connection); // depends on control dependency: [if], data = [(connection]
}
} } |
public class class_name {
public Cell getCellByName(String cellName) {
Set<String> keys = cells.keySet();
for (String key : keys) {
List<Cell> cellList = cells.get(key);
for (Cell c : cellList) {
if (c.getCellName().equals(cellName)) {
return c;
}
}
}
return null;
} } | public class class_name {
public Cell getCellByName(String cellName) {
Set<String> keys = cells.keySet();
for (String key : keys) {
List<Cell> cellList = cells.get(key);
for (Cell c : cellList) {
if (c.getCellName().equals(cellName)) {
return c; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static String getFullColumnClassName(String className) {
if (className.startsWith("java.")) {
return className;
}
if ("String".equals(className)) {
return "java.lang.String";
} else if ("Int".equals(className)) {
return "java.lang.Integer";
} else if ("Double".equals(className)) {
return "java.lang.Double";
} else if ("Date".equals(className)) {
return "java.util.Date";
} else if ("Long".equals(className)) {
return "java.lang.Long";
} else if ("Float".equals(className)) {
return "java.lang.Float";
} else if ("Boolean".equals(className)) {
return "java.lang.Boolean";
} else {
return "java.lang.Object";
}
} } | public class class_name {
public static String getFullColumnClassName(String className) {
if (className.startsWith("java.")) {
return className; // depends on control dependency: [if], data = [none]
}
if ("String".equals(className)) {
return "java.lang.String"; // depends on control dependency: [if], data = [none]
} else if ("Int".equals(className)) {
return "java.lang.Integer"; // depends on control dependency: [if], data = [none]
} else if ("Double".equals(className)) {
return "java.lang.Double"; // depends on control dependency: [if], data = [none]
} else if ("Date".equals(className)) {
return "java.util.Date"; // depends on control dependency: [if], data = [none]
} else if ("Long".equals(className)) {
return "java.lang.Long"; // depends on control dependency: [if], data = [none]
} else if ("Float".equals(className)) {
return "java.lang.Float"; // depends on control dependency: [if], data = [none]
} else if ("Boolean".equals(className)) {
return "java.lang.Boolean"; // depends on control dependency: [if], data = [none]
} else {
return "java.lang.Object"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void process( List<DMatrixRMaj> homographies ) {
if( assumeZeroSkew ) {
if( homographies.size() < 2 )
throw new IllegalArgumentException("At least two homographies are required. Found "+homographies.size());
} else if( homographies.size() < 3 ) {
throw new IllegalArgumentException("At least three homographies are required. Found "+homographies.size());
}
if( assumeZeroSkew ) {
setupA_NoSkew(homographies);
if( !solverNull.process(A,1,b) )
throw new RuntimeException("SVD failed");
computeParam_ZeroSkew();
} else {
setupA(homographies);
if( !solverNull.process(A,1,b) )
throw new RuntimeException("SVD failed");
computeParam();
}
if(MatrixFeatures_DDRM.hasUncountable(K)) {
throw new RuntimeException("Failed!");
}
} } | public class class_name {
public void process( List<DMatrixRMaj> homographies ) {
if( assumeZeroSkew ) {
if( homographies.size() < 2 )
throw new IllegalArgumentException("At least two homographies are required. Found "+homographies.size());
} else if( homographies.size() < 3 ) {
throw new IllegalArgumentException("At least three homographies are required. Found "+homographies.size());
}
if( assumeZeroSkew ) {
setupA_NoSkew(homographies); // depends on control dependency: [if], data = [none]
if( !solverNull.process(A,1,b) )
throw new RuntimeException("SVD failed");
computeParam_ZeroSkew(); // depends on control dependency: [if], data = [none]
} else {
setupA(homographies); // depends on control dependency: [if], data = [none]
if( !solverNull.process(A,1,b) )
throw new RuntimeException("SVD failed");
computeParam(); // depends on control dependency: [if], data = [none]
}
if(MatrixFeatures_DDRM.hasUncountable(K)) {
throw new RuntimeException("Failed!");
}
} } |
public class class_name {
public String getServer() {
String str = url.getHost();
if( str.length() == 0 ) {
return null;
}
return str;
} } | public class class_name {
public String getServer() {
String str = url.getHost();
if( str.length() == 0 ) {
return null; // depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
public Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>> beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(String resourceGroupName, String networkInterfaceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (networkInterfaceName == null) {
throw new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-04-01";
return service.beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>>>() {
@Override
public Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> clientResponse = beginListEffectiveNetworkSecurityGroupsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>> beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(String resourceGroupName, String networkInterfaceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (networkInterfaceName == null) {
throw new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-04-01";
return service.beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>>>() {
@Override
public Observable<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> clientResponse = beginListEffectiveNetworkSecurityGroupsDelegate(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 <T extends SubSystem> void addSystem(Class<T> systemApi, T system)
{
SubSystem oldSystem
= _systemMap.putIfAbsent(systemApi, system);
if (oldSystem != null) {
throw new IllegalStateException(L.l("duplicate system '{0}' is not allowed because another system with that class is already registered '{1}'",
system, oldSystem));
}
_pendingStart.add(system);
if (_lifecycle.isActive()) {
startSystems();
}
} } | public class class_name {
public <T extends SubSystem> void addSystem(Class<T> systemApi, T system)
{
SubSystem oldSystem
= _systemMap.putIfAbsent(systemApi, system);
if (oldSystem != null) {
throw new IllegalStateException(L.l("duplicate system '{0}' is not allowed because another system with that class is already registered '{1}'",
system, oldSystem));
}
_pendingStart.add(system);
if (_lifecycle.isActive()) {
startSystems(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void displaySplashScreen(BeanFactory beanFactory) {
this.splashScreen = beanFactory.getBean(SplashScreen.class);
logger.debug("Displaying application splash screen...");
try
{
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
ApplicationLauncher.this.splashScreen.splash();
}
});
}
catch (Exception e)
{
throw new RuntimeException("EDT threading issue while showing splash screen", e);
}
} } | public class class_name {
private void displaySplashScreen(BeanFactory beanFactory) {
this.splashScreen = beanFactory.getBean(SplashScreen.class);
logger.debug("Displaying application splash screen...");
try
{
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
ApplicationLauncher.this.splashScreen.splash();
}
}); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
throw new RuntimeException("EDT threading issue while showing splash screen", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isPresentInExternalStore(String id) {
if (_sessions != null) {
return ((BackedHashMap) _sessions).isPresent(id);
}
return false;
} } | public class class_name {
public boolean isPresentInExternalStore(String id) {
if (_sessions != null) {
return ((BackedHashMap) _sessions).isPresent(id); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public TopologyMetric getTopologyMetric(String topologyId) {
long start = System.nanoTime();
try {
TopologyMetric ret = new TopologyMetric();
List<MetricInfo> topologyMetrics = metricCache.getMetricData(topologyId, MetaType.TOPOLOGY);
List<MetricInfo> componentMetrics = metricCache.getMetricData(topologyId, MetaType.COMPONENT);
List<MetricInfo> workerMetrics = metricCache.getMetricData(topologyId, MetaType.WORKER);
MetricInfo dummy = MetricUtils.mkMetricInfo();
if (topologyMetrics.size() > 0) {
// get the last min topology metric
ret.set_topologyMetric(topologyMetrics.get(topologyMetrics.size() - 1));
} else {
ret.set_topologyMetric(dummy);
}
if (componentMetrics.size() > 0) {
ret.set_componentMetric(componentMetrics.get(0));
} else {
ret.set_componentMetric(dummy);
}
if (workerMetrics.size() > 0) {
ret.set_workerMetric(workerMetrics.get(0));
} else {
ret.set_workerMetric(dummy);
}
ret.set_taskMetric(dummy);
ret.set_streamMetric(dummy);
ret.set_nettyMetric(dummy);
return ret;
} finally {
long end = System.nanoTime();
SimpleJStormMetric.updateNimbusHistogram("getTopologyMetric", (end - start) / TimeUtils.NS_PER_US);
}
} } | public class class_name {
public TopologyMetric getTopologyMetric(String topologyId) {
long start = System.nanoTime();
try {
TopologyMetric ret = new TopologyMetric();
List<MetricInfo> topologyMetrics = metricCache.getMetricData(topologyId, MetaType.TOPOLOGY);
List<MetricInfo> componentMetrics = metricCache.getMetricData(topologyId, MetaType.COMPONENT);
List<MetricInfo> workerMetrics = metricCache.getMetricData(topologyId, MetaType.WORKER);
MetricInfo dummy = MetricUtils.mkMetricInfo();
if (topologyMetrics.size() > 0) {
// get the last min topology metric
ret.set_topologyMetric(topologyMetrics.get(topologyMetrics.size() - 1)); // depends on control dependency: [if], data = [(topologyMetrics.size()]
} else {
ret.set_topologyMetric(dummy); // depends on control dependency: [if], data = [none]
}
if (componentMetrics.size() > 0) {
ret.set_componentMetric(componentMetrics.get(0)); // depends on control dependency: [if], data = [0)]
} else {
ret.set_componentMetric(dummy); // depends on control dependency: [if], data = [none]
}
if (workerMetrics.size() > 0) {
ret.set_workerMetric(workerMetrics.get(0)); // depends on control dependency: [if], data = [0)]
} else {
ret.set_workerMetric(dummy); // depends on control dependency: [if], data = [none]
}
ret.set_taskMetric(dummy); // depends on control dependency: [try], data = [none]
ret.set_streamMetric(dummy); // depends on control dependency: [try], data = [none]
ret.set_nettyMetric(dummy); // depends on control dependency: [try], data = [none]
return ret; // depends on control dependency: [try], data = [none]
} finally {
long end = System.nanoTime();
SimpleJStormMetric.updateNimbusHistogram("getTopologyMetric", (end - start) / TimeUtils.NS_PER_US);
}
} } |
public class class_name {
public void flush() throws IOException {
checkClosed();
try {
if (bpos > 0) {
lo.write(buf, 0, bpos);
}
bpos = 0;
} catch (SQLException se) {
throw new IOException(se.toString());
}
} } | public class class_name {
public void flush() throws IOException {
checkClosed();
try {
if (bpos > 0) {
lo.write(buf, 0, bpos); // depends on control dependency: [if], data = [none]
}
bpos = 0;
} catch (SQLException se) {
throw new IOException(se.toString());
}
} } |
public class class_name {
public void saveTaskUpdateForRetry(SingularityTaskHistoryUpdate taskHistoryUpdate) {
String parentPath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId());
if (!isChildNodeCountSafe(parentPath)) {
LOG.warn("Too many queued webhooks for path {}, dropping", parentPath);
return;
}
String updatePath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId(), getTaskHistoryUpdateId(taskHistoryUpdate));
save(updatePath, taskHistoryUpdate, taskHistoryUpdateTranscoder);
} } | public class class_name {
public void saveTaskUpdateForRetry(SingularityTaskHistoryUpdate taskHistoryUpdate) {
String parentPath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId());
if (!isChildNodeCountSafe(parentPath)) {
LOG.warn("Too many queued webhooks for path {}, dropping", parentPath); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String updatePath = ZKPaths.makePath(SNS_TASK_RETRY_ROOT, taskHistoryUpdate.getTaskId().getRequestId(), getTaskHistoryUpdateId(taskHistoryUpdate));
save(updatePath, taskHistoryUpdate, taskHistoryUpdateTranscoder);
} } |
public class class_name {
public boolean isValid() {
if (documentFields.size() == 0) return false;
put(PdfName.FIELDS, documentFields);
if (sigFlags != 0)
put(PdfName.SIGFLAGS, new PdfNumber(sigFlags));
if (calculationOrder.size() > 0)
put(PdfName.CO, calculationOrder);
if (fieldTemplates.isEmpty()) return true;
PdfDictionary dic = new PdfDictionary();
for (Iterator it = fieldTemplates.keySet().iterator(); it.hasNext();) {
PdfTemplate template = (PdfTemplate)it.next();
PdfFormField.mergeResources(dic, (PdfDictionary)template.getResources());
}
put(PdfName.DR, dic);
put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g "));
PdfDictionary fonts = (PdfDictionary)dic.get(PdfName.FONT);
if (fonts != null) {
writer.eliminateFontSubset(fonts);
}
return true;
} } | public class class_name {
public boolean isValid() {
if (documentFields.size() == 0) return false;
put(PdfName.FIELDS, documentFields);
if (sigFlags != 0)
put(PdfName.SIGFLAGS, new PdfNumber(sigFlags));
if (calculationOrder.size() > 0)
put(PdfName.CO, calculationOrder);
if (fieldTemplates.isEmpty()) return true;
PdfDictionary dic = new PdfDictionary();
for (Iterator it = fieldTemplates.keySet().iterator(); it.hasNext();) {
PdfTemplate template = (PdfTemplate)it.next();
PdfFormField.mergeResources(dic, (PdfDictionary)template.getResources()); // depends on control dependency: [for], data = [none]
}
put(PdfName.DR, dic);
put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g "));
PdfDictionary fonts = (PdfDictionary)dic.get(PdfName.FONT);
if (fonts != null) {
writer.eliminateFontSubset(fonts); // depends on control dependency: [if], data = [(fonts]
}
return true;
} } |
public class class_name {
Expr and() {
Expr expr = equalNotEqual();
for (Tok tok=peek(); tok.sym==Sym.AND; tok=peek()) {
move();
expr = new Logic(Sym.AND, expr, equalNotEqual(), location);
}
return expr;
} } | public class class_name {
Expr and() {
Expr expr = equalNotEqual();
for (Tok tok=peek(); tok.sym==Sym.AND; tok=peek()) {
move();
// depends on control dependency: [for], data = [none]
expr = new Logic(Sym.AND, expr, equalNotEqual(), location);
// depends on control dependency: [for], data = [none]
}
return expr;
} } |
public class class_name {
private Object saveMap(FacesContext context, Map<Serializable, Object> map) {
if (map.isEmpty()) {
if (!component.initialStateMarked()) {
// only need to propagate the component's delta status when
// delta tracking has been disabled. We're assuming that
// the VDL will reset the status when the view is reconstructed,
// so no need to save the state if the saved state is the default.
return new Object[] { component.initialStateMarked() };
}
return null;
}
Object[] savedState = new Object[map.size() * 2 + 1];
int i=0;
for(Map.Entry<Serializable, Object> entry : map.entrySet()) {
Object value = entry.getValue();
savedState[i * 2] = entry.getKey();
if (value instanceof Collection
|| value instanceof StateHolder
|| value instanceof Map
|| !(value instanceof Serializable)) {
value = saveAttachedState(context,value);
}
savedState[i * 2 + 1] = value;
i++;
}
if (!component.initialStateMarked()) {
savedState[savedState.length - 1] = component.initialStateMarked();
}
return savedState;
} } | public class class_name {
private Object saveMap(FacesContext context, Map<Serializable, Object> map) {
if (map.isEmpty()) {
if (!component.initialStateMarked()) {
// only need to propagate the component's delta status when
// delta tracking has been disabled. We're assuming that
// the VDL will reset the status when the view is reconstructed,
// so no need to save the state if the saved state is the default.
return new Object[] { component.initialStateMarked() }; // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
Object[] savedState = new Object[map.size() * 2 + 1];
int i=0;
for(Map.Entry<Serializable, Object> entry : map.entrySet()) {
Object value = entry.getValue();
savedState[i * 2] = entry.getKey(); // depends on control dependency: [for], data = [entry]
if (value instanceof Collection
|| value instanceof StateHolder
|| value instanceof Map
|| !(value instanceof Serializable)) {
value = saveAttachedState(context,value); // depends on control dependency: [if], data = [none]
}
savedState[i * 2 + 1] = value; // depends on control dependency: [for], data = [none]
i++; // depends on control dependency: [for], data = [none]
}
if (!component.initialStateMarked()) {
savedState[savedState.length - 1] = component.initialStateMarked(); // depends on control dependency: [if], data = [none]
}
return savedState;
} } |
public class class_name {
public VoltTable sortByAverage(String tableName)
{
List<ProcProfRow> sorted = new ArrayList<ProcProfRow>(m_table);
Collections.sort(sorted, new Comparator<ProcProfRow>() {
@Override
public int compare(ProcProfRow lhs, ProcProfRow rhs) {
return compareByAvg(rhs, lhs); // sort desc
}
});
long sumOfAverage = 0L;
for (ProcProfRow row : sorted) {
sumOfAverage += (row.avg * row.invocations);
}
VoltTable result = TableShorthand.tableFromShorthand(
tableName + "(TIMESTAMP:BIGINT, PROCEDURE:VARCHAR, WEIGHTED_PERC:BIGINT, INVOCATIONS:BIGINT," +
"AVG:BIGINT, MIN:BIGINT, MAX:BIGINT, ABORTS:BIGINT, FAILURES:BIGINT)");
for (ProcProfRow row : sorted ) {
result.addRow(row.timestamp, row.procedure, calculatePercent(row.avg * row.invocations, sumOfAverage),
row.invocations, row.avg, row.min, row.max, row.aborts, row.failures);
}
return result;
} } | public class class_name {
public VoltTable sortByAverage(String tableName)
{
List<ProcProfRow> sorted = new ArrayList<ProcProfRow>(m_table);
Collections.sort(sorted, new Comparator<ProcProfRow>() {
@Override
public int compare(ProcProfRow lhs, ProcProfRow rhs) {
return compareByAvg(rhs, lhs); // sort desc
}
});
long sumOfAverage = 0L;
for (ProcProfRow row : sorted) {
sumOfAverage += (row.avg * row.invocations); // depends on control dependency: [for], data = [row]
}
VoltTable result = TableShorthand.tableFromShorthand(
tableName + "(TIMESTAMP:BIGINT, PROCEDURE:VARCHAR, WEIGHTED_PERC:BIGINT, INVOCATIONS:BIGINT," +
"AVG:BIGINT, MIN:BIGINT, MAX:BIGINT, ABORTS:BIGINT, FAILURES:BIGINT)");
for (ProcProfRow row : sorted ) {
result.addRow(row.timestamp, row.procedure, calculatePercent(row.avg * row.invocations, sumOfAverage),
row.invocations, row.avg, row.min, row.max, row.aborts, row.failures); // depends on control dependency: [for], data = [row]
}
return result;
} } |
public class class_name {
private final void readGlyf(FontFileReader in) throws IOException {
TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("glyf");
if (dirTab == null) {
throw new IOException("glyf table not found, cannot continue");
}
for (int i = 0; i < (numberOfGlyphs - 1); i++) {
if (mtxTab[i].getOffset() != mtxTab[i + 1].getOffset()) {
in.seekSet(dirTab.getOffset() + mtxTab[i].getOffset());
in.skip(2);
final int[] bbox = {
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort()};
mtxTab[i].setBoundingBox(bbox);
} else {
mtxTab[i].setBoundingBox(mtxTab[0].getBoundingBox());
}
}
long n = ((TTFDirTabEntry)dirTabs.get("glyf")).getOffset();
for (int i = 0; i < numberOfGlyphs; i++) {
if ((i + 1) >= mtxTab.length
|| mtxTab[i].getOffset() != mtxTab[i + 1].getOffset()) {
in.seekSet(n + mtxTab[i].getOffset());
in.skip(2);
final int[] bbox = {
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort()};
mtxTab[i].setBoundingBox(bbox);
} else {
/**@todo Verify that this is correct, looks like a copy/paste bug (jm)*/
final int bbox0 = mtxTab[0].getBoundingBox()[0];
final int[] bbox = {bbox0, bbox0, bbox0, bbox0};
mtxTab[i].setBoundingBox(bbox);
/* Original code
mtxTab[i].bbox[0] = mtxTab[0].bbox[0];
mtxTab[i].bbox[1] = mtxTab[0].bbox[0];
mtxTab[i].bbox[2] = mtxTab[0].bbox[0];
mtxTab[i].bbox[3] = mtxTab[0].bbox[0]; */
}
if (log.isTraceEnabled()) {
log.trace(mtxTab[i].toString(this));
}
}
} } | public class class_name {
private final void readGlyf(FontFileReader in) throws IOException {
TTFDirTabEntry dirTab = (TTFDirTabEntry)dirTabs.get("glyf");
if (dirTab == null) {
throw new IOException("glyf table not found, cannot continue");
}
for (int i = 0; i < (numberOfGlyphs - 1); i++) {
if (mtxTab[i].getOffset() != mtxTab[i + 1].getOffset()) {
in.seekSet(dirTab.getOffset() + mtxTab[i].getOffset()); // depends on control dependency: [if], data = [none]
in.skip(2); // depends on control dependency: [if], data = [none]
final int[] bbox = {
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort()};
mtxTab[i].setBoundingBox(bbox); // depends on control dependency: [if], data = [none]
} else {
mtxTab[i].setBoundingBox(mtxTab[0].getBoundingBox()); // depends on control dependency: [if], data = [none]
}
}
long n = ((TTFDirTabEntry)dirTabs.get("glyf")).getOffset();
for (int i = 0; i < numberOfGlyphs; i++) {
if ((i + 1) >= mtxTab.length
|| mtxTab[i].getOffset() != mtxTab[i + 1].getOffset()) {
in.seekSet(n + mtxTab[i].getOffset());
in.skip(2);
final int[] bbox = {
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort(),
in.readTTFShort()};
mtxTab[i].setBoundingBox(bbox);
} else {
/**@todo Verify that this is correct, looks like a copy/paste bug (jm)*/
final int bbox0 = mtxTab[0].getBoundingBox()[0];
final int[] bbox = {bbox0, bbox0, bbox0, bbox0};
mtxTab[i].setBoundingBox(bbox);
/* Original code
mtxTab[i].bbox[0] = mtxTab[0].bbox[0];
mtxTab[i].bbox[1] = mtxTab[0].bbox[0];
mtxTab[i].bbox[2] = mtxTab[0].bbox[0];
mtxTab[i].bbox[3] = mtxTab[0].bbox[0]; */
}
if (log.isTraceEnabled()) {
log.trace(mtxTab[i].toString(this));
}
}
} } |
public class class_name {
public ExplorationStep next() {
if (this.candidates == null) {
return null;
}
while (true) {
int candidate = this.candidates.next();
if (candidate < 0) {
return null;
}
try {
if (this.selectChain == null || this.selectChain.select(candidate, this)) {
TransactionsIterable support = this.dataset.getSupport(candidate);
// System.out.println("extending "+Arrays.toString(this.pattern)+
// " with "+
// candidate+" ("+this.counters.getReverseRenaming()[candidate]+")");
Counters candidateCounts = new Counters(this.counters.minSupport, support.iterator(),
candidate, this.counters.maxFrequent);
int greatest = Integer.MIN_VALUE;
for (int i = 0; i < candidateCounts.closure.length; i++) {
if (candidateCounts.closure[i] > greatest) {
greatest = candidateCounts.closure[i];
}
}
if (greatest > candidate) {
throw new WrongFirstParentException(candidate, greatest);
}
// instanciateDataset may choose to compress renaming - if
// not, at least it's set for now.
candidateCounts.reuseRenaming(this.counters.reverseRenaming);
return new ExplorationStep(this, candidate, candidateCounts, support);
}
} catch (WrongFirstParentException e) {
addFailedFPTest(e.extension, e.firstParent);
}
}
} } | public class class_name {
public ExplorationStep next() {
if (this.candidates == null) {
return null; // depends on control dependency: [if], data = [none]
}
while (true) {
int candidate = this.candidates.next();
if (candidate < 0) {
return null; // depends on control dependency: [if], data = [none]
}
try {
if (this.selectChain == null || this.selectChain.select(candidate, this)) {
TransactionsIterable support = this.dataset.getSupport(candidate);
// System.out.println("extending "+Arrays.toString(this.pattern)+
// " with "+
// candidate+" ("+this.counters.getReverseRenaming()[candidate]+")");
Counters candidateCounts = new Counters(this.counters.minSupport, support.iterator(),
candidate, this.counters.maxFrequent);
int greatest = Integer.MIN_VALUE;
for (int i = 0; i < candidateCounts.closure.length; i++) {
if (candidateCounts.closure[i] > greatest) {
greatest = candidateCounts.closure[i]; // depends on control dependency: [if], data = [none]
}
}
if (greatest > candidate) {
throw new WrongFirstParentException(candidate, greatest);
}
// instanciateDataset may choose to compress renaming - if
// not, at least it's set for now.
candidateCounts.reuseRenaming(this.counters.reverseRenaming); // depends on control dependency: [if], data = [none]
return new ExplorationStep(this, candidate, candidateCounts, support); // depends on control dependency: [if], data = [none]
}
} catch (WrongFirstParentException e) {
addFailedFPTest(e.extension, e.firstParent);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private void addReachableRoles(Set<GrantedAuthority> reachableRoles,
GrantedAuthority authority) {
for (GrantedAuthority testAuthority : reachableRoles) {
String testKey = testAuthority.getAuthority();
if ((testKey != null) && (testKey.equals(authority.getAuthority()))) {
return;
}
}
reachableRoles.add(authority);
} } | public class class_name {
private void addReachableRoles(Set<GrantedAuthority> reachableRoles,
GrantedAuthority authority) {
for (GrantedAuthority testAuthority : reachableRoles) {
String testKey = testAuthority.getAuthority();
if ((testKey != null) && (testKey.equals(authority.getAuthority()))) {
return; // depends on control dependency: [if], data = [none]
}
}
reachableRoles.add(authority);
} } |
public class class_name {
private static Expression transformInlineConstants(final Expression exp) {
if (exp instanceof AnnotationConstantExpression) {
ConstantExpression ce = (ConstantExpression) exp;
if (ce.getValue() instanceof AnnotationNode) {
// replicate a little bit of AnnotationVisitor here
// because we can't wait until later to do this
AnnotationNode an = (AnnotationNode) ce.getValue();
for (Map.Entry<String, Expression> member : an.getMembers().entrySet()) {
member.setValue(transformInlineConstants(member.getValue()));
}
}
} else {
return ExpressionUtils.transformInlineConstants(exp);
}
return exp;
} } | public class class_name {
private static Expression transformInlineConstants(final Expression exp) {
if (exp instanceof AnnotationConstantExpression) {
ConstantExpression ce = (ConstantExpression) exp;
if (ce.getValue() instanceof AnnotationNode) {
// replicate a little bit of AnnotationVisitor here
// because we can't wait until later to do this
AnnotationNode an = (AnnotationNode) ce.getValue();
for (Map.Entry<String, Expression> member : an.getMembers().entrySet()) {
member.setValue(transformInlineConstants(member.getValue())); // depends on control dependency: [for], data = [member]
}
}
} else {
return ExpressionUtils.transformInlineConstants(exp); // depends on control dependency: [if], data = [none]
}
return exp;
} } |
public class class_name {
public IAtomContainer getUnsetAtomsInAtomContainer(IAtom atom, IAtomContainer ac) {
List atoms = ac.getConnectedAtomsList(atom);
IAtomContainer connectedAtoms = atom.getBuilder().newInstance(IAtomContainer.class);
for (int i = 0; i < atoms.size(); i++) {
IAtom curAtom = (IAtom) atoms.get(i);
if (!curAtom.getFlag(CDKConstants.ISPLACED)) {//&& atoms[i].getPoint3d() == null) {
connectedAtoms.addAtom(curAtom);
}
}
return connectedAtoms;
} } | public class class_name {
public IAtomContainer getUnsetAtomsInAtomContainer(IAtom atom, IAtomContainer ac) {
List atoms = ac.getConnectedAtomsList(atom);
IAtomContainer connectedAtoms = atom.getBuilder().newInstance(IAtomContainer.class);
for (int i = 0; i < atoms.size(); i++) {
IAtom curAtom = (IAtom) atoms.get(i);
if (!curAtom.getFlag(CDKConstants.ISPLACED)) {//&& atoms[i].getPoint3d() == null) {
connectedAtoms.addAtom(curAtom); // depends on control dependency: [if], data = [none]
}
}
return connectedAtoms;
} } |
public class class_name {
@Override
public CookieBuilder cookie(String key, String value)
{
CookieBuilderImpl cookieBuilder = new CookieBuilderImpl(key, value);
requestHttp().cookie(cookieBuilder);
if (secure() != null) {
cookieBuilder.secure(true);
}
cookieBuilder.httpOnly(true);
cookieBuilder.path("/");
return cookieBuilder;
} } | public class class_name {
@Override
public CookieBuilder cookie(String key, String value)
{
CookieBuilderImpl cookieBuilder = new CookieBuilderImpl(key, value);
requestHttp().cookie(cookieBuilder);
if (secure() != null) {
cookieBuilder.secure(true); // depends on control dependency: [if], data = [none]
}
cookieBuilder.httpOnly(true);
cookieBuilder.path("/");
return cookieBuilder;
} } |
public class class_name {
private static String prepareMessage(EntityConfig config, TaskRequest req) {
// Assertions...
if (config == null) {
String msg = "Argument 'config' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (req == null) {
String msg = "Argument 'req' cannot be null.";
throw new IllegalArgumentException(msg);
}
StringBuilder rslt = new StringBuilder();
rslt.append(PREAMBLE);
if (req.hasAttribute(Attributes.ORIGIN)) {
rslt.append("\n\t\tOrigin Document: ").append(req.getAttribute(Attributes.ORIGIN));
}
rslt.append("\n\t\tSource: ").append(config.getSource())
.append("\n\t\tEntity Name: ").append(config.getEntryName());
return rslt.toString();
} } | public class class_name {
private static String prepareMessage(EntityConfig config, TaskRequest req) {
// Assertions...
if (config == null) {
String msg = "Argument 'config' cannot be null.";
throw new IllegalArgumentException(msg);
}
if (req == null) {
String msg = "Argument 'req' cannot be null.";
throw new IllegalArgumentException(msg);
}
StringBuilder rslt = new StringBuilder();
rslt.append(PREAMBLE);
if (req.hasAttribute(Attributes.ORIGIN)) {
rslt.append("\n\t\tOrigin Document: ").append(req.getAttribute(Attributes.ORIGIN)); // depends on control dependency: [if], data = [none]
}
rslt.append("\n\t\tSource: ").append(config.getSource())
.append("\n\t\tEntity Name: ").append(config.getEntryName());
return rslt.toString();
} } |
public class class_name {
public static boolean symbolNeedsQuoting(CharSequence symbol,
boolean quoteOperators)
{
int length = symbol.length();
// If the symbol's text matches an Ion keyword or it's an empty symbol, we must quote it.
// Eg, the symbol 'false' and '' must be rendered quoted.
if(length == 0 || isIdentifierKeyword(symbol))
{
return true;
}
char c = symbol.charAt(0);
// Surrogates are neither identifierStart nor operatorPart, so the
// first one we hit will fall through and return true.
// TODO test that
if (!quoteOperators && isOperatorPart(c))
{
for (int ii = 0; ii < length; ii++) {
c = symbol.charAt(ii);
// We don't need to look for escapes since all
// operator characters are ASCII.
if (!isOperatorPart(c)) {
return true;
}
}
return false;
}
else if (isIdentifierStart(c))
{
for (int ii = 0; ii < length; ii++) {
c = symbol.charAt(ii);
if ((c == '\'' || c < 32 || c > 126)
|| !isIdentifierPart(c))
{
return true;
}
}
return false;
}
// quote by default
return true;
} } | public class class_name {
public static boolean symbolNeedsQuoting(CharSequence symbol,
boolean quoteOperators)
{
int length = symbol.length();
// If the symbol's text matches an Ion keyword or it's an empty symbol, we must quote it.
// Eg, the symbol 'false' and '' must be rendered quoted.
if(length == 0 || isIdentifierKeyword(symbol))
{
return true; // depends on control dependency: [if], data = [none]
}
char c = symbol.charAt(0);
// Surrogates are neither identifierStart nor operatorPart, so the
// first one we hit will fall through and return true.
// TODO test that
if (!quoteOperators && isOperatorPart(c))
{
for (int ii = 0; ii < length; ii++) {
c = symbol.charAt(ii); // depends on control dependency: [for], data = [ii]
// We don't need to look for escapes since all
// operator characters are ASCII.
if (!isOperatorPart(c)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
else if (isIdentifierStart(c))
{
for (int ii = 0; ii < length; ii++) {
c = symbol.charAt(ii); // depends on control dependency: [for], data = [ii]
if ((c == '\'' || c < 32 || c > 126)
|| !isIdentifierPart(c))
{
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
// quote by default
return true;
} } |
public class class_name {
public static double getDistanceBetween( IHMConnection connection, Coordinate p1, Coordinate p2, int srid ) throws Exception {
if (srid < 0) {
srid = 4326;
}
GeometryFactory gf = new GeometryFactory();
LineString lineString = gf.createLineString(new Coordinate[]{p1, p2});
String sql = "select GeodesicLength(LineFromText(\"" + lineString.toText() + "\"," + srid + "));";
try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(sql);) {
if (rs.next()) {
double length = rs.getDouble(1);
return length;
}
throw new RuntimeException("Could not calculate distance.");
}
} } | public class class_name {
public static double getDistanceBetween( IHMConnection connection, Coordinate p1, Coordinate p2, int srid ) throws Exception {
if (srid < 0) {
srid = 4326;
}
GeometryFactory gf = new GeometryFactory();
LineString lineString = gf.createLineString(new Coordinate[]{p1, p2});
String sql = "select GeodesicLength(LineFromText(\"" + lineString.toText() + "\"," + srid + "));";
try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(sql);) {
if (rs.next()) {
double length = rs.getDouble(1);
return length; // depends on control dependency: [if], data = [none]
}
throw new RuntimeException("Could not calculate distance.");
}
} } |
public class class_name {
private JButton getBtnOk() {
if (btnOk == null) {
btnOk = new JButton();
btnOk.setText(Constant.messages.getString("all.button.save"));
btnOk.setMinimumSize(new java.awt.Dimension(75,30));
btnOk.setPreferredSize(new java.awt.Dimension(75,30));
btnOk.setMaximumSize(new java.awt.Dimension(100,40));
btnOk.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
historyRef.setNote(getTxtDisplay().getText());
clearAndDispose();
}
});
}
return btnOk;
} } | public class class_name {
private JButton getBtnOk() {
if (btnOk == null) {
btnOk = new JButton();
// depends on control dependency: [if], data = [none]
btnOk.setText(Constant.messages.getString("all.button.save"));
// depends on control dependency: [if], data = [none]
btnOk.setMinimumSize(new java.awt.Dimension(75,30));
// depends on control dependency: [if], data = [none]
btnOk.setPreferredSize(new java.awt.Dimension(75,30));
// depends on control dependency: [if], data = [none]
btnOk.setMaximumSize(new java.awt.Dimension(100,40));
// depends on control dependency: [if], data = [none]
btnOk.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
historyRef.setNote(getTxtDisplay().getText());
clearAndDispose();
}
});
// depends on control dependency: [if], data = [none]
}
return btnOk;
} } |
public class class_name {
private static boolean endsWith(final String s, final String suffix, final boolean ignoreCase) {
if (s == null || suffix == null) {
return s == null && suffix == null;
}
if (suffix.length() > s.length()) {
return false;
}
final int strOffset = s.length() - suffix.length();
return s.toString().regionMatches(ignoreCase, strOffset, suffix.toString(), 0, suffix.length());
} } | public class class_name {
private static boolean endsWith(final String s, final String suffix, final boolean ignoreCase) {
if (s == null || suffix == null) {
return s == null && suffix == null; // depends on control dependency: [if], data = [none]
}
if (suffix.length() > s.length()) {
return false; // depends on control dependency: [if], data = [none]
}
final int strOffset = s.length() - suffix.length();
return s.toString().regionMatches(ignoreCase, strOffset, suffix.toString(), 0, suffix.length());
} } |
public class class_name {
public static int getRecordsYield() {
String s = System.getProperty(RECORDS_YIELD_PROPERTY);
int records = Integer.MAX_VALUE;
if (s != null) {
try {
records = Integer.parseInt(s);
} catch (NumberFormatException ex) {
// records remains Integer.MAX_VALUE
}
}
return records;
} } | public class class_name {
public static int getRecordsYield() {
String s = System.getProperty(RECORDS_YIELD_PROPERTY);
int records = Integer.MAX_VALUE;
if (s != null) {
try {
records = Integer.parseInt(s); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
// records remains Integer.MAX_VALUE
} // depends on control dependency: [catch], data = [none]
}
return records;
} } |
public class class_name {
private FieldStats getStats(XField field) {
FieldStats stats = statMap.get(field);
if (stats == null) {
stats = new FieldStats(field);
statMap.put(field, stats);
}
return stats;
} } | public class class_name {
private FieldStats getStats(XField field) {
FieldStats stats = statMap.get(field);
if (stats == null) {
stats = new FieldStats(field); // depends on control dependency: [if], data = [none]
statMap.put(field, stats); // depends on control dependency: [if], data = [none]
}
return stats;
} } |
public class class_name {
public static String getTwoDay(String sj1, String sj2) {
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day = 0;
try {
Date date = myFormatter.parse(sj1);
Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
return "";
}
return day + "";
} } | public class class_name {
public static String getTwoDay(String sj1, String sj2) {
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day = 0;
try {
Date date = myFormatter.parse(sj1);
Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return "";
} // depends on control dependency: [catch], data = [none]
return day + "";
} } |
public class class_name {
public void setLockingMode( @Nullable final String lockingMode ) {
if ( lockingMode == null && _lockingMode == null
|| lockingMode != null && lockingMode.equals( _lockingMode ) ) {
return;
}
_lockingMode = lockingMode;
if ( _manager.isInitialized() ) {
initNonStickyLockingMode( createMemcachedNodesManager( _memcachedNodes, _failoverNodes ) );
}
} } | public class class_name {
public void setLockingMode( @Nullable final String lockingMode ) {
if ( lockingMode == null && _lockingMode == null
|| lockingMode != null && lockingMode.equals( _lockingMode ) ) {
return; // depends on control dependency: [if], data = [none]
}
_lockingMode = lockingMode;
if ( _manager.isInitialized() ) {
initNonStickyLockingMode( createMemcachedNodesManager( _memcachedNodes, _failoverNodes ) ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getHost() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return hostAndPort;
} else {
return hostAndPort.substring(0, indexOfMaohao);
}
} } | public class class_name {
public String getHost() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return hostAndPort; // depends on control dependency: [if], data = [none]
} else {
return hostAndPort.substring(0, indexOfMaohao); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean checkImmutable(String translatedName, List<String> immutableResources) {
boolean resourceNotImmutable = true;
if (immutableResources.contains(translatedName)) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_RESOURCENAME_IMMUTABLE_1, translatedName));
}
// this resource must not be modified by an import if it already exists
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/");
m_cms.readResource(translatedName);
resourceNotImmutable = false;
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_IMMUTABLE_FLAG_SET_1, translatedName));
}
} catch (CmsException e) {
// resourceNotImmutable will be true
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_ON_TEST_IMMUTABLE_1,
translatedName),
e);
}
} finally {
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return resourceNotImmutable;
} } | public class class_name {
protected boolean checkImmutable(String translatedName, List<String> immutableResources) {
boolean resourceNotImmutable = true;
if (immutableResources.contains(translatedName)) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_RESOURCENAME_IMMUTABLE_1, translatedName)); // depends on control dependency: [if], data = [none]
}
// this resource must not be modified by an import if it already exists
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/"); // depends on control dependency: [try], data = [none]
m_cms.readResource(translatedName); // depends on control dependency: [try], data = [none]
resourceNotImmutable = false; // depends on control dependency: [try], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_IMMUTABLE_FLAG_SET_1, translatedName)); // depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
// resourceNotImmutable will be true
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_ON_TEST_IMMUTABLE_1,
translatedName),
e); // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return resourceNotImmutable;
} } |
public class class_name {
@Override
public IRfSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientRfSession.class)) {
ClientRfSessionDataLocalImpl data = new ClientRfSessionDataLocalImpl();
data.setSessionId(sessionId);
return data;
}
else if (clazz.equals(ServerRfSession.class)) {
ServerRfSessionDataLocalImpl data = new ServerRfSessionDataLocalImpl();
data.setSessionId(sessionId);
return data;
}
throw new IllegalArgumentException(clazz.toString());
} } | public class class_name {
@Override
public IRfSessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientRfSession.class)) {
ClientRfSessionDataLocalImpl data = new ClientRfSessionDataLocalImpl();
data.setSessionId(sessionId);
// depends on control dependency: [if], data = [none]
return data;
// depends on control dependency: [if], data = [none]
}
else if (clazz.equals(ServerRfSession.class)) {
ServerRfSessionDataLocalImpl data = new ServerRfSessionDataLocalImpl();
data.setSessionId(sessionId);
// depends on control dependency: [if], data = [none]
return data;
// depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException(clazz.toString());
} } |
public class class_name {
public static String digitToChinese(Number n) {
if(null == n) {
return "零";
}
return NumberChineseFormater.format(n.doubleValue(), true, true);
} } | public class class_name {
public static String digitToChinese(Number n) {
if(null == n) {
return "零";
// depends on control dependency: [if], data = [none]
}
return NumberChineseFormater.format(n.doubleValue(), true, true);
} } |
public class class_name {
public boolean execute(Campaign campaign) {
boolean campaignResult = true;
currentCampaign = campaign;
campaignStartTimeStamp = new Date();
try {
createReport();
for (CampaignRun run : currentCampaign.getRuns()) {
if (TestEngine.isAbortedByUser()) {
break;
}
currentTestBed = run.getTestbed();
String testSuiteName = currentCampaign.getName() + " - " + currentTestBed.substring(0,
currentTestBed.lastIndexOf('.'));
TestBedConfiguration.setConfigFile(StaticConfiguration.TESTBED_CONFIG_DIRECTORY + "/" + currentTestBed);
currentTestSuite = MetaTestSuite.createMetaTestSuite(testSuiteName, run.getTestsuites());
if (currentTestSuite == null) {
continue;
}
currentTestSuite.addTestReportListener(this);
campaignResult &= TestEngine.execute(
currentTestSuite); // NOSONAR - Potentially dangerous use of non-short-circuit logic
currentTestSuite.removeTestReportListener(this);
currentTestSuite = null;
}
CampaignReportManager.getInstance().stopReport();
} finally {
TestEngine.tearDown();
campaignStartTimeStamp = null;
currentCampaign = null;
}
return campaignResult;
} } | public class class_name {
public boolean execute(Campaign campaign) {
boolean campaignResult = true;
currentCampaign = campaign;
campaignStartTimeStamp = new Date();
try {
createReport(); // depends on control dependency: [try], data = [none]
for (CampaignRun run : currentCampaign.getRuns()) {
if (TestEngine.isAbortedByUser()) {
break;
}
currentTestBed = run.getTestbed(); // depends on control dependency: [for], data = [run]
String testSuiteName = currentCampaign.getName() + " - " + currentTestBed.substring(0,
currentTestBed.lastIndexOf('.'));
TestBedConfiguration.setConfigFile(StaticConfiguration.TESTBED_CONFIG_DIRECTORY + "/" + currentTestBed); // depends on control dependency: [for], data = [none]
currentTestSuite = MetaTestSuite.createMetaTestSuite(testSuiteName, run.getTestsuites()); // depends on control dependency: [for], data = [run]
if (currentTestSuite == null) {
continue;
}
currentTestSuite.addTestReportListener(this); // depends on control dependency: [for], data = [none]
campaignResult &= TestEngine.execute(
currentTestSuite); // NOSONAR - Potentially dangerous use of non-short-circuit logic // depends on control dependency: [for], data = [none]
currentTestSuite.removeTestReportListener(this); // depends on control dependency: [for], data = [none]
currentTestSuite = null; // depends on control dependency: [for], data = [none]
}
CampaignReportManager.getInstance().stopReport(); // depends on control dependency: [try], data = [none]
} finally {
TestEngine.tearDown();
campaignStartTimeStamp = null;
currentCampaign = null;
}
return campaignResult;
} } |
public class class_name {
public static InternalKnowledgeRuntime retrieveKnowledgeRuntime(Object streamContext) {
InternalKnowledgeRuntime kruntime = null;
if ( streamContext instanceof MarshallerWriteContext ) {
MarshallerWriteContext context = (MarshallerWriteContext) streamContext;
kruntime = ((InternalWorkingMemory) context.wm).getKnowledgeRuntime();
}
else if ( streamContext instanceof MarshallerReaderContext ) {
MarshallerReaderContext context = (MarshallerReaderContext) streamContext;
kruntime = ((InternalWorkingMemory) context.wm).getKnowledgeRuntime();
}
else {
throw new UnsupportedOperationException( "Unable to retrieve " + ProcessInstanceManager.class.getSimpleName() + " from "
+ streamContext.getClass().getName() );
}
return kruntime;
} } | public class class_name {
public static InternalKnowledgeRuntime retrieveKnowledgeRuntime(Object streamContext) {
InternalKnowledgeRuntime kruntime = null;
if ( streamContext instanceof MarshallerWriteContext ) {
MarshallerWriteContext context = (MarshallerWriteContext) streamContext;
kruntime = ((InternalWorkingMemory) context.wm).getKnowledgeRuntime(); // depends on control dependency: [if], data = [none]
}
else if ( streamContext instanceof MarshallerReaderContext ) {
MarshallerReaderContext context = (MarshallerReaderContext) streamContext;
kruntime = ((InternalWorkingMemory) context.wm).getKnowledgeRuntime(); // depends on control dependency: [if], data = [none]
}
else {
throw new UnsupportedOperationException( "Unable to retrieve " + ProcessInstanceManager.class.getSimpleName() + " from "
+ streamContext.getClass().getName() );
}
return kruntime;
} } |
public class class_name {
public static Path[] stat2Paths(FileStatus[] stats) {
if (stats == null)
return null;
Path[] ret = new Path[stats.length];
for (int i = 0; i < stats.length; ++i) {
ret[i] = stats[i].getPath();
}
return ret;
} } | public class class_name {
public static Path[] stat2Paths(FileStatus[] stats) {
if (stats == null)
return null;
Path[] ret = new Path[stats.length];
for (int i = 0; i < stats.length; ++i) {
ret[i] = stats[i].getPath(); // depends on control dependency: [for], data = [i]
}
return ret;
} } |
public class class_name {
private void checkIfMessageDuplicated(String msgName, Node msgNode) {
if (messageNames.containsKey(msgName)) {
MessageLocation location = messageNames.get(msgName);
compiler.report(JSError.make(msgNode, MESSAGE_DUPLICATE_KEY,
msgName, location.messageNode.getSourceFileName(),
Integer.toString(location.messageNode.getLineno())));
}
} } | public class class_name {
private void checkIfMessageDuplicated(String msgName, Node msgNode) {
if (messageNames.containsKey(msgName)) {
MessageLocation location = messageNames.get(msgName);
compiler.report(JSError.make(msgNode, MESSAGE_DUPLICATE_KEY,
msgName, location.messageNode.getSourceFileName(),
Integer.toString(location.messageNode.getLineno()))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T> Request<T> add(Request<T> request) {
// Tag the request as belonging to this queue and add it to the set of current requests.
request.setRequestQueue(this);
synchronized (mCurrentRequests) {
mCurrentRequests.add(request);
}
// Process requests in the order they are added.
request.setSequence(getSequenceNumber());
request.addMarker("add-to-queue");
// If the request is uncacheable, skip the cache queue and go straight to the network.
if (!request.shouldCache()) {
mNetworkQueue.add(request);
return request;
}
// Insert request into stage if there's already a request with the same cache key in flight.
synchronized (mWaitingRequests) {
String cacheKey = request.getCacheKey();
if (mWaitingRequests.containsKey(cacheKey)) {
// There is already a request in flight. Queue up.
Queue<Request<?>> stagedRequests = mWaitingRequests.get(cacheKey);
if (stagedRequests == null) {
stagedRequests = new LinkedList<Request<?>>();
}
stagedRequests.add(request);
mWaitingRequests.put(cacheKey, stagedRequests);
if (VolleyLog.DEBUG) {
VolleyLog.v("Request for cacheKey=%s is in flight, putting on hold.", cacheKey);
}
} else {
// Insert 'null' queue for this cacheKey, indicating there is now a request in
// flight.
mWaitingRequests.put(cacheKey, null);
mCacheQueue.add(request);
}
return request;
}
} } | public class class_name {
public <T> Request<T> add(Request<T> request) {
// Tag the request as belonging to this queue and add it to the set of current requests.
request.setRequestQueue(this);
synchronized (mCurrentRequests) {
mCurrentRequests.add(request);
}
// Process requests in the order they are added.
request.setSequence(getSequenceNumber());
request.addMarker("add-to-queue");
// If the request is uncacheable, skip the cache queue and go straight to the network.
if (!request.shouldCache()) {
mNetworkQueue.add(request); // depends on control dependency: [if], data = [none]
return request; // depends on control dependency: [if], data = [none]
}
// Insert request into stage if there's already a request with the same cache key in flight.
synchronized (mWaitingRequests) {
String cacheKey = request.getCacheKey();
if (mWaitingRequests.containsKey(cacheKey)) {
// There is already a request in flight. Queue up.
Queue<Request<?>> stagedRequests = mWaitingRequests.get(cacheKey); // depends on control dependency: [if], data = [none]
if (stagedRequests == null) {
stagedRequests = new LinkedList<Request<?>>(); // depends on control dependency: [if], data = [none]
}
stagedRequests.add(request); // depends on control dependency: [if], data = [none]
mWaitingRequests.put(cacheKey, stagedRequests); // depends on control dependency: [if], data = [none]
if (VolleyLog.DEBUG) {
VolleyLog.v("Request for cacheKey=%s is in flight, putting on hold.", cacheKey); // depends on control dependency: [if], data = [none]
}
} else {
// Insert 'null' queue for this cacheKey, indicating there is now a request in
// flight.
mWaitingRequests.put(cacheKey, null); // depends on control dependency: [if], data = [none]
mCacheQueue.add(request); // depends on control dependency: [if], data = [none]
}
return request;
}
} } |
public class class_name {
public CreateCloudFormationChangeSetRequest withResourceTypes(String... resourceTypes) {
if (this.resourceTypes == null) {
setResourceTypes(new java.util.ArrayList<String>(resourceTypes.length));
}
for (String ele : resourceTypes) {
this.resourceTypes.add(ele);
}
return this;
} } | public class class_name {
public CreateCloudFormationChangeSetRequest withResourceTypes(String... resourceTypes) {
if (this.resourceTypes == null) {
setResourceTypes(new java.util.ArrayList<String>(resourceTypes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : resourceTypes) {
this.resourceTypes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static byte[] copyByteBufToByteArray(ByteBuf input) {
byte[] copy;
int length = input.readableBytes();
if (input.hasArray()) {
byte[] inputBytes = input.array();
int offset = input.arrayOffset() + input.readerIndex();
copy = Arrays.copyOfRange(inputBytes, offset, offset + length);
return copy;
} else {
copy = new byte[length];
input.getBytes(input.readerIndex(), copy);
}
return copy;
} } | public class class_name {
public static byte[] copyByteBufToByteArray(ByteBuf input) {
byte[] copy;
int length = input.readableBytes();
if (input.hasArray()) {
byte[] inputBytes = input.array();
int offset = input.arrayOffset() + input.readerIndex();
copy = Arrays.copyOfRange(inputBytes, offset, offset + length); // depends on control dependency: [if], data = [none]
return copy; // depends on control dependency: [if], data = [none]
} else {
copy = new byte[length]; // depends on control dependency: [if], data = [none]
input.getBytes(input.readerIndex(), copy); // depends on control dependency: [if], data = [none]
}
return copy;
} } |
public class class_name {
public DeviceAttribute[] write_read_attribute(final DeviceProxy deviceProxy,
final DeviceAttribute[] deviceAttributes, final String[] readNames) throws DevFailed {
checkIfTango(deviceProxy, "write_read_attribute");
build_connection(deviceProxy);
// Manage Access control
if (deviceProxy.access == TangoConst.ACCESS_READ) {
// ping the device to throw exception if failed (for reconnection)
ping(deviceProxy);
throwNotAuthorizedException(deviceProxy.devname + ".write_read_attribute()",
"DeviceProxy.write_read_attribute()");
}
// Build an AttributeValue IDL object array
AttributeValue_4[] attributeValues_4 = new AttributeValue_4[0];
AttributeValue_4[] outAttrValues_4 = new AttributeValue_4[0];
AttributeValue_5[] outAttrValues_5 = new AttributeValue_5[0];
if (deviceProxy.device_5 != null || deviceProxy.device_4 != null) {
attributeValues_4 = new AttributeValue_4[deviceAttributes.length];
for (int i=0 ; i<deviceAttributes.length ; i++) {
attributeValues_4[i] = deviceAttributes[i].getAttributeValueObject_4();
}
} else {
Except.throw_connection_failed("TangoApi_READ_ONLY_MODE",
"Cannot execute write_read_attribute(), " + deviceProxy.devname
+ " is not a device_4Impl or above",
"DeviceProxy.write_read_attribute()");
}
boolean done = false;
final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
for (int i = 0; i < retries && !done; i++) {
// write attributes on device server
try {
if (deviceProxy.device_5 != null) {
outAttrValues_5 = deviceProxy.device_5.write_read_attributes_5(
attributeValues_4, readNames,
DevLockManager.getInstance().getClntIdent());
} else
if (deviceProxy.device_4 != null) {
outAttrValues_4 = deviceProxy.device_4.write_read_attributes_4(
attributeValues_4, DevLockManager.getInstance().getClntIdent());
}
done = true;
} catch (final DevFailed e) {
// Except.print_exception(e);
throw e;
} catch (final MultiDevFailed e) {
throw new NamedDevFailedList(e, name(deviceProxy),
"DeviceProxy.write_read_attribute", "MultiDevFailed");
} catch (final Exception e) {
manageExceptionReconnection(deviceProxy, retries, i, e, this.getClass()
+ ".write_read_attribute");
}
} // End of for ( ; ; )
// Build a Device Attribute Object
// Depends on Device_impl version
if (deviceProxy.device_5 != null) {
final DeviceAttribute[] attributes = new DeviceAttribute[outAttrValues_5.length];
for (int i=0 ; i<outAttrValues_5.length; i++) {
attributes[i] = new DeviceAttribute(outAttrValues_5[i]);
}
return attributes;
}
else
if (deviceProxy.device_4 != null) {
final DeviceAttribute[] attributes = new DeviceAttribute[outAttrValues_4.length];
for (int i = 0; i < outAttrValues_4.length; i++) {
attributes[i] = new DeviceAttribute(outAttrValues_4[i]);
}
return attributes;
}
else
return null; // Cannot be possible (write_read did not exist before
} } | public class class_name {
public DeviceAttribute[] write_read_attribute(final DeviceProxy deviceProxy,
final DeviceAttribute[] deviceAttributes, final String[] readNames) throws DevFailed {
checkIfTango(deviceProxy, "write_read_attribute");
build_connection(deviceProxy);
// Manage Access control
if (deviceProxy.access == TangoConst.ACCESS_READ) {
// ping the device to throw exception if failed (for reconnection)
ping(deviceProxy);
throwNotAuthorizedException(deviceProxy.devname + ".write_read_attribute()",
"DeviceProxy.write_read_attribute()");
}
// Build an AttributeValue IDL object array
AttributeValue_4[] attributeValues_4 = new AttributeValue_4[0];
AttributeValue_4[] outAttrValues_4 = new AttributeValue_4[0];
AttributeValue_5[] outAttrValues_5 = new AttributeValue_5[0];
if (deviceProxy.device_5 != null || deviceProxy.device_4 != null) {
attributeValues_4 = new AttributeValue_4[deviceAttributes.length];
for (int i=0 ; i<deviceAttributes.length ; i++) {
attributeValues_4[i] = deviceAttributes[i].getAttributeValueObject_4(); // depends on control dependency: [for], data = [i]
}
} else {
Except.throw_connection_failed("TangoApi_READ_ONLY_MODE",
"Cannot execute write_read_attribute(), " + deviceProxy.devname
+ " is not a device_4Impl or above",
"DeviceProxy.write_read_attribute()");
}
boolean done = false;
final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
for (int i = 0; i < retries && !done; i++) {
// write attributes on device server
try {
if (deviceProxy.device_5 != null) {
outAttrValues_5 = deviceProxy.device_5.write_read_attributes_5(
attributeValues_4, readNames,
DevLockManager.getInstance().getClntIdent());
} else
if (deviceProxy.device_4 != null) {
outAttrValues_4 = deviceProxy.device_4.write_read_attributes_4(
attributeValues_4, DevLockManager.getInstance().getClntIdent());
}
done = true;
} catch (final DevFailed e) {
// Except.print_exception(e);
throw e;
} catch (final MultiDevFailed e) {
throw new NamedDevFailedList(e, name(deviceProxy),
"DeviceProxy.write_read_attribute", "MultiDevFailed");
} catch (final Exception e) {
manageExceptionReconnection(deviceProxy, retries, i, e, this.getClass()
+ ".write_read_attribute");
}
} // End of for ( ; ; )
// Build a Device Attribute Object
// Depends on Device_impl version
if (deviceProxy.device_5 != null) {
final DeviceAttribute[] attributes = new DeviceAttribute[outAttrValues_5.length];
for (int i=0 ; i<outAttrValues_5.length; i++) {
attributes[i] = new DeviceAttribute(outAttrValues_5[i]);
}
return attributes;
}
else
if (deviceProxy.device_4 != null) {
final DeviceAttribute[] attributes = new DeviceAttribute[outAttrValues_4.length];
for (int i = 0; i < outAttrValues_4.length; i++) {
attributes[i] = new DeviceAttribute(outAttrValues_4[i]);
}
return attributes;
}
else
return null; // Cannot be possible (write_read did not exist before
} } |
public class class_name {
@Override
public RandomVariableInterface getValue(final double evaluationTime, final LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
// Ignite asynchronous calculation if possible
ArrayList< Future<RandomVariableInterface> > results = new ArrayList< Future<RandomVariableInterface> >();
for(final AbstractMonteCarloProduct product : products) {
Future<RandomVariableInterface> valueFuture;
try {
valueFuture = executor.submit(
new Callable<RandomVariableInterface>() {
public RandomVariableInterface call() throws CalculationException {
return product.getValue(evaluationTime, model);
}
}
);
}
catch(RejectedExecutionException e) {
valueFuture = new FutureWrapper<RandomVariableInterface>(product.getValue(evaluationTime, model));
}
results.add(valueFuture);
}
// Collect results
RandomVariableInterface values = model.getRandomVariableForConstant(0.0);
try {
for(Future<RandomVariableInterface> valueFuture : results) {
values = values.add(valueFuture.get());
}
} catch (InterruptedException e) {
throw e.getCause() instanceof CalculationException ? (CalculationException)(e.getCause()) : new CalculationException(e.getCause());
} catch (ExecutionException e) {
if(CalculationException.class.isInstance(e.getCause())) {
throw (CalculationException)(e.getCause());
}
else if(RuntimeException.class.isInstance(e.getCause())) {
throw (RuntimeException)(e.getCause());
}
else {
throw new CalculationException(e.getCause());
}
}
// Return values
return values;
} } | public class class_name {
@Override
public RandomVariableInterface getValue(final double evaluationTime, final LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
// Ignite asynchronous calculation if possible
ArrayList< Future<RandomVariableInterface> > results = new ArrayList< Future<RandomVariableInterface> >();
for(final AbstractMonteCarloProduct product : products) {
Future<RandomVariableInterface> valueFuture;
try {
valueFuture = executor.submit(
new Callable<RandomVariableInterface>() {
public RandomVariableInterface call() throws CalculationException {
return product.getValue(evaluationTime, model);
}
}
); // depends on control dependency: [try], data = [none]
}
catch(RejectedExecutionException e) {
valueFuture = new FutureWrapper<RandomVariableInterface>(product.getValue(evaluationTime, model));
} // depends on control dependency: [catch], data = [none]
results.add(valueFuture);
}
// Collect results
RandomVariableInterface values = model.getRandomVariableForConstant(0.0);
try {
for(Future<RandomVariableInterface> valueFuture : results) {
values = values.add(valueFuture.get()); // depends on control dependency: [for], data = [valueFuture]
}
} catch (InterruptedException e) {
throw e.getCause() instanceof CalculationException ? (CalculationException)(e.getCause()) : new CalculationException(e.getCause());
} catch (ExecutionException e) {
if(CalculationException.class.isInstance(e.getCause())) {
throw (CalculationException)(e.getCause());
}
else if(RuntimeException.class.isInstance(e.getCause())) {
throw (RuntimeException)(e.getCause());
}
else {
throw new CalculationException(e.getCause());
}
}
// Return values
return values;
} } |
public class class_name {
private static double scale(MetricDto metric, double value) {
if (metric.getDecimalScale() == null) {
return value;
}
BigDecimal bd = BigDecimal.valueOf(value);
return bd.setScale(metric.getDecimalScale(), RoundingMode.HALF_UP).doubleValue();
} } | public class class_name {
private static double scale(MetricDto metric, double value) {
if (metric.getDecimalScale() == null) {
return value; // depends on control dependency: [if], data = [none]
}
BigDecimal bd = BigDecimal.valueOf(value);
return bd.setScale(metric.getDecimalScale(), RoundingMode.HALF_UP).doubleValue();
} } |
public class class_name {
public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getString(cursor.getColumnIndex(columnName));
} } | public class class_name {
public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null; // depends on control dependency: [if], data = [none]
}
return cursor.getString(cursor.getColumnIndex(columnName));
} } |
public class class_name {
public InputStream getAsStream(final Archive<?> archive) {
final Archive<?> testable = findTestableArchive(archive);
final Collection<Node> values = collectPersistenceXml(testable);
if (values.size() == 1) {
return values.iterator().next().getAsset().openStream();
}
return null;
} } | public class class_name {
public InputStream getAsStream(final Archive<?> archive) {
final Archive<?> testable = findTestableArchive(archive);
final Collection<Node> values = collectPersistenceXml(testable);
if (values.size() == 1) {
return values.iterator().next().getAsset().openStream(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void updateDialogTitle() {
String title;
if ((m_model != null) && (m_model.getGroups().size() > 1)) {
title = Messages.get().key(
Messages.GUI_PUBLISH_DIALOG_TITLE_3,
m_publishDialog.getSelectedWorkflow().getNiceName(),
String.valueOf(m_model.getGroups().size()),
String.valueOf(m_model.getPublishResources().size()));
} else {
title = m_publishDialog.getSelectedWorkflow().getNiceName();
}
m_publishDialog.setCaption(title);
} } | public class class_name {
public void updateDialogTitle() {
String title;
if ((m_model != null) && (m_model.getGroups().size() > 1)) {
title = Messages.get().key(
Messages.GUI_PUBLISH_DIALOG_TITLE_3,
m_publishDialog.getSelectedWorkflow().getNiceName(),
String.valueOf(m_model.getGroups().size()),
String.valueOf(m_model.getPublishResources().size())); // depends on control dependency: [if], data = [none]
} else {
title = m_publishDialog.getSelectedWorkflow().getNiceName(); // depends on control dependency: [if], data = [none]
}
m_publishDialog.setCaption(title);
} } |
public class class_name {
public static boolean allDone(Collection<Future> futures) {
for (Future f : futures) {
if (!f.isDone()) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean allDone(Collection<Future> futures) {
for (Future f : futures) {
if (!f.isDone()) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
public E next()
{
if (fetchSize <= 0 || count > fetchSize || scrollComplete)
{
throw new NoSuchElementException("Nothing to scroll further for:" + m.getEntityClazz());
}
else
{
E objectToReturn = currentObject;
currentObject = null;
return objectToReturn;
}
} } | public class class_name {
@Override
public E next()
{
if (fetchSize <= 0 || count > fetchSize || scrollComplete)
{
throw new NoSuchElementException("Nothing to scroll further for:" + m.getEntityClazz());
}
else
{
E objectToReturn = currentObject;
currentObject = null; // depends on control dependency: [if], data = [none]
return objectToReturn; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public double length() {
if (this.isEmpty()) return 0;
double length = 0;
PathIterator3f pi = getPathIterator(MathConstants.SPLINE_APPROXIMATION_RATIO);
AbstractPathElement3F pathElement = pi.next();
if (pathElement.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
Path3f subPath;
double curx, cury, curz, movx, movy, movz, endx, endy, endz;
curx = movx = pathElement.getToX();
cury = movy = pathElement.getToY();
curz = movz = pathElement.getToZ();
while (pi.hasNext()) {
pathElement = pi.next();
switch (pathElement.type) {
case MOVE_TO:
movx = curx = pathElement.getToX();
movy = cury = pathElement.getToY();
movz = curz = pathElement.getToZ();
break;
case LINE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
endx, endy, endz);
curx = endx;
cury = endy;
curz = endz;
break;
case QUAD_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.quadTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CURVE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.curveTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
pathElement.getCtrlX2(), pathElement.getCtrlY2(), pathElement.getCtrlZ2(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CLOSE:
if (curx != movx || cury != movy || curz != movz) {
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
movx, movy, movz);
}
curx = movx;
cury = movy;
cury = movz;
break;
default:
}
}
return length;
} } | public class class_name {
public double length() {
if (this.isEmpty()) return 0;
double length = 0;
PathIterator3f pi = getPathIterator(MathConstants.SPLINE_APPROXIMATION_RATIO);
AbstractPathElement3F pathElement = pi.next();
if (pathElement.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
Path3f subPath;
double curx, cury, curz, movx, movy, movz, endx, endy, endz;
curx = movx = pathElement.getToX();
cury = movy = pathElement.getToY();
curz = movz = pathElement.getToZ();
while (pi.hasNext()) {
pathElement = pi.next(); // depends on control dependency: [while], data = [none]
switch (pathElement.type) {
case MOVE_TO:
movx = curx = pathElement.getToX();
movy = cury = pathElement.getToY();
movz = curz = pathElement.getToZ();
break;
case LINE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
endx, endy, endz);
curx = endx;
cury = endy;
curz = endz;
break;
case QUAD_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.quadTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CURVE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.curveTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
pathElement.getCtrlX2(), pathElement.getCtrlY2(), pathElement.getCtrlZ2(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CLOSE:
if (curx != movx || cury != movy || curz != movz) {
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
movx, movy, movz); // depends on control dependency: [if], data = [none]
}
curx = movx;
cury = movy;
cury = movz;
break;
default:
}
}
return length;
} } |
public class class_name {
public void marshall(CreateLogStreamRequest createLogStreamRequest, ProtocolMarshaller protocolMarshaller) {
if (createLogStreamRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLogStreamRequest.getLogGroupName(), LOGGROUPNAME_BINDING);
protocolMarshaller.marshall(createLogStreamRequest.getLogStreamName(), LOGSTREAMNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateLogStreamRequest createLogStreamRequest, ProtocolMarshaller protocolMarshaller) {
if (createLogStreamRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLogStreamRequest.getLogGroupName(), LOGGROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLogStreamRequest.getLogStreamName(), LOGSTREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public EClass getIfcAudioVisualAppliance() {
if (ifcAudioVisualApplianceEClass == null) {
ifcAudioVisualApplianceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(29);
}
return ifcAudioVisualApplianceEClass;
} } | public class class_name {
@Override
public EClass getIfcAudioVisualAppliance() {
if (ifcAudioVisualApplianceEClass == null) {
ifcAudioVisualApplianceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(29);
// depends on control dependency: [if], data = [none]
}
return ifcAudioVisualApplianceEClass;
} } |
public class class_name {
public static INDArray toArray(ArrowWritableRecordBatch arrowWritableRecordBatch) {
List<FieldVector> columnVectors = arrowWritableRecordBatch.getList();
Schema schema = arrowWritableRecordBatch.getSchema();
for(int i = 0; i < schema.numColumns(); i++) {
switch(schema.getType(i)) {
case Integer:
break;
case Float:
break;
case Double:
break;
case Long:
break;
case NDArray:
break;
default:
throw new ND4JIllegalArgumentException("Illegal data type found for column " + schema.getName(i) + " of type " + schema.getType(i));
}
}
int rows = arrowWritableRecordBatch.getList().get(0).getValueCount();
if(schema.numColumns() == 1 && schema.getMetaData(0).getColumnType() == ColumnType.NDArray) {
INDArray[] toConcat = new INDArray[rows];
VarBinaryVector valueVectors = (VarBinaryVector) arrowWritableRecordBatch.getList().get(0);
for(int i = 0; i < rows; i++) {
byte[] bytes = valueVectors.get(i);
ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
direct.put(bytes);
INDArray fromTensor = BinarySerde.toArray(direct);
toConcat[i] = fromTensor;
}
return Nd4j.concat(0,toConcat);
}
int cols = schema.numColumns();
INDArray arr = Nd4j.create(rows,cols);
for(int i = 0; i < cols; i++) {
INDArray put = ArrowConverter.convertArrowVector(columnVectors.get(i),schema.getType(i));
switch(arr.data().dataType()) {
case FLOAT:
arr.putColumn(i,Nd4j.create(put.data().asFloat()).reshape(rows,1));
break;
case DOUBLE:
arr.putColumn(i,Nd4j.create(put.data().asDouble()).reshape(rows,1));
break;
}
}
return arr;
} } | public class class_name {
public static INDArray toArray(ArrowWritableRecordBatch arrowWritableRecordBatch) {
List<FieldVector> columnVectors = arrowWritableRecordBatch.getList();
Schema schema = arrowWritableRecordBatch.getSchema();
for(int i = 0; i < schema.numColumns(); i++) {
switch(schema.getType(i)) {
case Integer:
break;
case Float:
break;
case Double:
break;
case Long:
break;
case NDArray:
break;
default:
throw new ND4JIllegalArgumentException("Illegal data type found for column " + schema.getName(i) + " of type " + schema.getType(i));
}
}
int rows = arrowWritableRecordBatch.getList().get(0).getValueCount();
if(schema.numColumns() == 1 && schema.getMetaData(0).getColumnType() == ColumnType.NDArray) {
INDArray[] toConcat = new INDArray[rows];
VarBinaryVector valueVectors = (VarBinaryVector) arrowWritableRecordBatch.getList().get(0);
for(int i = 0; i < rows; i++) {
byte[] bytes = valueVectors.get(i);
ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
direct.put(bytes); // depends on control dependency: [for], data = [none]
INDArray fromTensor = BinarySerde.toArray(direct);
toConcat[i] = fromTensor; // depends on control dependency: [for], data = [i]
}
return Nd4j.concat(0,toConcat); // depends on control dependency: [if], data = [none]
}
int cols = schema.numColumns();
INDArray arr = Nd4j.create(rows,cols);
for(int i = 0; i < cols; i++) {
INDArray put = ArrowConverter.convertArrowVector(columnVectors.get(i),schema.getType(i));
switch(arr.data().dataType()) {
case FLOAT:
arr.putColumn(i,Nd4j.create(put.data().asFloat()).reshape(rows,1)); // depends on control dependency: [for], data = [none]
break;
case DOUBLE:
arr.putColumn(i,Nd4j.create(put.data().asDouble()).reshape(rows,1)); // depends on control dependency: [for], data = [none]
break;
}
}
return arr;
} } |
public class class_name {
public ClassInfo getClassInfo(final String className) {
for (final ClassInfo ci : classInfoSet) {
if (ci.getName().equals(className)) {
return ci;
}
}
return null;
} } | public class class_name {
public ClassInfo getClassInfo(final String className) {
for (final ClassInfo ci : classInfoSet) {
if (ci.getName().equals(className)) {
return ci; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static String reverseDelimited(final String str, final char delimiter) {
if (N.isNullOrEmpty(str)) {
return str;
}
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
final String[] strs = split(str, delimiter);
N.reverse(strs);
return join(strs, delimiter);
} } | public class class_name {
public static String reverseDelimited(final String str, final char delimiter) {
if (N.isNullOrEmpty(str)) {
return str;
// depends on control dependency: [if], data = [none]
}
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
final String[] strs = split(str, delimiter);
N.reverse(strs);
return join(strs, delimiter);
} } |
public class class_name {
public double[] applyRelativeInverse(double[] v) {
if(inv == null) {
updateInverse();
}
return unhomogeneRelativeVector(times(inv, homogeneRelativeVector(v)));
} } | public class class_name {
public double[] applyRelativeInverse(double[] v) {
if(inv == null) {
updateInverse(); // depends on control dependency: [if], data = [none]
}
return unhomogeneRelativeVector(times(inv, homogeneRelativeVector(v)));
} } |
public class class_name {
public static boolean isUsingGenericsOrIsArrayUsingGenerics(ClassNode cn) {
if (cn.isArray()) {
return isUsingGenericsOrIsArrayUsingGenerics(cn.getComponentType());
}
return (cn.isUsingGenerics() && cn.getGenericsTypes() != null);
} } | public class class_name {
public static boolean isUsingGenericsOrIsArrayUsingGenerics(ClassNode cn) {
if (cn.isArray()) {
return isUsingGenericsOrIsArrayUsingGenerics(cn.getComponentType()); // depends on control dependency: [if], data = [none]
}
return (cn.isUsingGenerics() && cn.getGenericsTypes() != null);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.