code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static JSONObject loadJSONAsset(Context context, final String asset) {
if (asset == null) {
return new JSONObject();
}
return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));
} } | public class class_name {
public static JSONObject loadJSONAsset(Context context, final String asset) {
if (asset == null) {
return new JSONObject(); // depends on control dependency: [if], data = [none]
}
return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));
} } |
public class class_name {
private CmsSearchWorkplaceBean getSearchParams() {
if ((m_searchParams == null) && (getSettings().getDialogObject() instanceof Map<?, ?>)) {
Map<?, ?> dialogObject = (Map<?, ?>)getSettings().getDialogObject();
if (dialogObject.get(CmsSearchDialog.class.getName()) instanceof CmsSearchWorkplaceBean) {
m_searchParams = (CmsSearchWorkplaceBean)dialogObject.get(CmsSearchDialog.class.getName());
}
}
return m_searchParams;
} } | public class class_name {
private CmsSearchWorkplaceBean getSearchParams() {
if ((m_searchParams == null) && (getSettings().getDialogObject() instanceof Map<?, ?>)) {
Map<?, ?> dialogObject = (Map<?, ?>)getSettings().getDialogObject(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
if (dialogObject.get(CmsSearchDialog.class.getName()) instanceof CmsSearchWorkplaceBean) {
m_searchParams = (CmsSearchWorkplaceBean)dialogObject.get(CmsSearchDialog.class.getName()); // depends on control dependency: [if], data = [none]
}
}
return m_searchParams;
} } |
public class class_name {
private final void handleStartElem(char c)
throws XMLStreamException
{
mTokenState = TOKEN_FULL_COALESCED;
boolean empty;
if (mCfgNsEnabled) {
String str = parseLocalName(c);
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_EOF_EXP_NAME);
if (c == ':') { // Ok, got namespace and local name
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_EOF_EXP_NAME);
mElementStack.push(str, parseLocalName(c));
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_IN_ELEMENT);
} else {
mElementStack.push(null, str);
// c is fine as
}
/* Enough about element name itself; let's then parse attributes
* and namespace declarations. Split into another method for clarity,
* and so that maybe JIT has easier time to optimize it separately.
*/
/* 04-Jul-2005, TSa: But hold up: we can easily check for a fairly
* common case of no attributes showing up, and us getting the
* closing '>' right away. Let's do that, since it can save
* a call to a rather long method.
*/
empty = (c == '>') ? false : handleNsAttrs(c);
} else { // Namespace handling not enabled:
mElementStack.push(null, parseFullName(c));
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_IN_ELEMENT);
empty = (c == '>') ? false : handleNonNsAttrs(c);
}
if (!empty) {
++mCurrDepth; // needed to match nesting with entity expansion
}
mStEmptyElem = empty;
/* 27-Feb-2009, TSa: [WSTX-191]: We used to validate virtual
* end element here for empty elements, but it really should
* occur later on when actually returning that end element.
*/
int vld = mElementStack.resolveAndValidateElement();
mVldContent = vld;
mValidateText = (vld == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT);
} } | public class class_name {
private final void handleStartElem(char c)
throws XMLStreamException
{
mTokenState = TOKEN_FULL_COALESCED;
boolean empty;
if (mCfgNsEnabled) {
String str = parseLocalName(c);
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_EOF_EXP_NAME);
if (c == ':') { // Ok, got namespace and local name
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_EOF_EXP_NAME); // depends on control dependency: [if], data = [none]
mElementStack.push(str, parseLocalName(c)); // depends on control dependency: [if], data = [(c]
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_IN_ELEMENT); // depends on control dependency: [if], data = [none]
} else {
mElementStack.push(null, str); // depends on control dependency: [if], data = [none]
// c is fine as
}
/* Enough about element name itself; let's then parse attributes
* and namespace declarations. Split into another method for clarity,
* and so that maybe JIT has easier time to optimize it separately.
*/
/* 04-Jul-2005, TSa: But hold up: we can easily check for a fairly
* common case of no attributes showing up, and us getting the
* closing '>' right away. Let's do that, since it can save
* a call to a rather long method.
*/
empty = (c == '>') ? false : handleNsAttrs(c);
} else { // Namespace handling not enabled:
mElementStack.push(null, parseFullName(c));
c = (mInputPtr < mInputEnd) ?
mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_IN_ELEMENT);
empty = (c == '>') ? false : handleNonNsAttrs(c);
}
if (!empty) {
++mCurrDepth; // needed to match nesting with entity expansion
}
mStEmptyElem = empty;
/* 27-Feb-2009, TSa: [WSTX-191]: We used to validate virtual
* end element here for empty elements, but it really should
* occur later on when actually returning that end element.
*/
int vld = mElementStack.resolveAndValidateElement();
mVldContent = vld;
mValidateText = (vld == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT);
} } |
public class class_name {
private Object getBeanFromBox(BeanBox box, boolean required, Set<Object> history) {// NOSONAR
// NOSONAR System.out.println(" Box=> box=" + box + " history=" + history);
BeanBoxException.assureNotNull(box, "Fail to build instance for a null beanBox");
Object bean = null;
if (box.isSingleton()) { // Check if singleton in cache
bean = singletonCache.get(box);
if (bean != null)
return bean;
}
if (box.isPureValue()) // if constant?
return box.getTarget();
if (box.getTarget() != null) {// if target?
if (EMPTY.class != box.getTarget())
return getBean(box.getTarget(), box.isRequired(), history);
if (box.getType() != null)
return getBean(box.getType(), box.isRequired(), history);
else
return notfoundOrException(box.getTarget(), box.isRequired());
}
boolean aopFound = false;// is AOP?
if (box.getAopRules() != null || box.getMethodAops() != null)
aopFound = true;
else if (this.getAopRules() != null && box.getBeanClass() != null)
for (Object[] aops : this.getAopRules()) // global AOP
if (BeanBoxUtils.nameMatch((String) aops[1], box.getBeanClass().getName())) {
aopFound = true;
break;
}
if (aopFound)
bean = AopUtils.createProxyBean(box.getBeanClass(), box, this);
else if (box.getCreateMethod() != null) // if have create method?
try {
Method m = box.getCreateMethod();
if (m.getParameterTypes().length == 1) {
bean = m.invoke(box, new Caller(this, required, history, null));
} else if (m.getParameterTypes().length == 0)
bean = m.invoke(box);
else
BeanBoxException.throwEX("Create method can only have 0 or 1 parameter");
BeanBoxException.assureNotNull(bean, "Create method created a null object.");
} catch (Exception e) {
return BeanBoxException.throwEX(e);
}
else if (box.getConstructor() != null) { // has constructor?
if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) {
Object[] initargs = param2RealObjects(this, history, box.getConstructorParams());
try {
bean = box.getConstructor().newInstance(initargs);
} catch (Exception e) {
return BeanBoxException.throwEX(e);
}
} else // 0 param constructor
try {
bean = box.getConstructor().newInstance();
} catch (Exception e) {
return BeanBoxException.throwEX(e);
}
} else if (box.getBeanClass() != null) { // is normal bean
if (EMPTY.class == box.getBeanClass())
return notfoundOrException(EMPTY.class, required);
try {
bean = box.getBeanClass().newInstance();
} catch (Exception e) {
BeanBoxException.throwEX("Failed to call 0 parameter constructor of: " + box.getBeanClass(), e);
}
} else
return notfoundOrException(null, required); // return null or throw EX
// Now Bean is ready
// Cache bean or proxy bean right now for circular dependency use
if (box.isSingleton()) {
Object id = box.getSingletonId();
if (id != null)
singletonCache.put(box, bean);
} // NOW BEAN IS CREATED
if (box.getConfigMethod() != null) {// ====config method of this BeanBox
try {
Method m = box.getConfigMethod();
if (m.getParameterTypes().length == 2)
m.invoke(box, bean, new Caller(this, required, history, bean));
else if (m.getParameterTypes().length == 1)
m.invoke(box, bean);
else
BeanBoxException.throwEX("Config method can only have 1 or 2 parameters");
} catch (Exception e) {
return BeanBoxException.throwEX(e);
}
}
if (box.getPostConstruct() != null) // PostConstructor
ReflectionUtils.invokeMethod(box.getPostConstruct(), bean);
if (box.getFieldInjects() != null) // Fields inject
for (Entry<Field, BeanBox> entry : box.getFieldInjects().entrySet()) {
Field f = entry.getKey();
BeanBox b = entry.getValue();
Object fieldValue = this.getBeanFromBox(b, false, history);
if (EMPTY.class == fieldValue) {
if (b.isRequired())
BeanBoxException.throwEX("Not found required value for field: " + f.getName() + " in "
+ f.getDeclaringClass().getName());
} else {
if (fieldValue != null && fieldValue instanceof String)
fieldValue = this.valueTranslator.translate((String) fieldValue, b.getType());
ReflectionUtils.setField(f, bean, fieldValue);
}
}
if (box.getMethodInjects() != null) { // Methods inject
for (Entry<Method, BeanBox[]> methods : box.getMethodInjects().entrySet()) {
Method m = methods.getKey();
BeanBox[] paramBoxs = methods.getValue();
if (paramBoxs != null && paramBoxs.length > 0) {
Object[] methodParams = param2RealObjects(this, history, paramBoxs);
ReflectionUtils.invokeMethod(m, bean, methodParams);
} else // method has no parameter
ReflectionUtils.invokeMethod(m, bean);
}
}
return bean;
} } | public class class_name {
private Object getBeanFromBox(BeanBox box, boolean required, Set<Object> history) {// NOSONAR
// NOSONAR System.out.println(" Box=> box=" + box + " history=" + history);
BeanBoxException.assureNotNull(box, "Fail to build instance for a null beanBox");
Object bean = null;
if (box.isSingleton()) { // Check if singleton in cache
bean = singletonCache.get(box); // depends on control dependency: [if], data = [none]
if (bean != null)
return bean;
}
if (box.isPureValue()) // if constant?
return box.getTarget();
if (box.getTarget() != null) {// if target?
if (EMPTY.class != box.getTarget())
return getBean(box.getTarget(), box.isRequired(), history);
if (box.getType() != null)
return getBean(box.getType(), box.isRequired(), history);
else
return notfoundOrException(box.getTarget(), box.isRequired());
}
boolean aopFound = false;// is AOP?
if (box.getAopRules() != null || box.getMethodAops() != null)
aopFound = true;
else if (this.getAopRules() != null && box.getBeanClass() != null)
for (Object[] aops : this.getAopRules()) // global AOP
if (BeanBoxUtils.nameMatch((String) aops[1], box.getBeanClass().getName())) {
aopFound = true; // depends on control dependency: [if], data = [none]
break;
}
if (aopFound)
bean = AopUtils.createProxyBean(box.getBeanClass(), box, this);
else if (box.getCreateMethod() != null) // if have create method?
try {
Method m = box.getCreateMethod();
if (m.getParameterTypes().length == 1) {
bean = m.invoke(box, new Caller(this, required, history, null)); // depends on control dependency: [if], data = [none]
} else if (m.getParameterTypes().length == 0)
bean = m.invoke(box);
else
BeanBoxException.throwEX("Create method can only have 0 or 1 parameter");
BeanBoxException.assureNotNull(bean, "Create method created a null object."); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return BeanBoxException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
else if (box.getConstructor() != null) { // has constructor?
if (box.getConstructorParams() != null && box.getConstructorParams().length > 0) {
Object[] initargs = param2RealObjects(this, history, box.getConstructorParams());
try {
bean = box.getConstructor().newInstance(initargs); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return BeanBoxException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
} else // 0 param constructor
try {
bean = box.getConstructor().newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return BeanBoxException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
} else if (box.getBeanClass() != null) { // is normal bean
if (EMPTY.class == box.getBeanClass())
return notfoundOrException(EMPTY.class, required);
try {
bean = box.getBeanClass().newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
BeanBoxException.throwEX("Failed to call 0 parameter constructor of: " + box.getBeanClass(), e);
} // depends on control dependency: [catch], data = [none]
} else
return notfoundOrException(null, required); // return null or throw EX
// Now Bean is ready
// Cache bean or proxy bean right now for circular dependency use
if (box.isSingleton()) {
Object id = box.getSingletonId();
if (id != null)
singletonCache.put(box, bean);
} // NOW BEAN IS CREATED
if (box.getConfigMethod() != null) {// ====config method of this BeanBox
try {
Method m = box.getConfigMethod();
if (m.getParameterTypes().length == 2)
m.invoke(box, bean, new Caller(this, required, history, bean));
else if (m.getParameterTypes().length == 1)
m.invoke(box, bean);
else
BeanBoxException.throwEX("Config method can only have 1 or 2 parameters");
} catch (Exception e) {
return BeanBoxException.throwEX(e);
} // depends on control dependency: [catch], data = [none]
}
if (box.getPostConstruct() != null) // PostConstructor
ReflectionUtils.invokeMethod(box.getPostConstruct(), bean);
if (box.getFieldInjects() != null) // Fields inject
for (Entry<Field, BeanBox> entry : box.getFieldInjects().entrySet()) {
Field f = entry.getKey();
BeanBox b = entry.getValue();
Object fieldValue = this.getBeanFromBox(b, false, history);
if (EMPTY.class == fieldValue) {
if (b.isRequired())
BeanBoxException.throwEX("Not found required value for field: " + f.getName() + " in "
+ f.getDeclaringClass().getName());
} else {
if (fieldValue != null && fieldValue instanceof String)
fieldValue = this.valueTranslator.translate((String) fieldValue, b.getType());
ReflectionUtils.setField(f, bean, fieldValue); // depends on control dependency: [if], data = [fieldValue)]
}
}
if (box.getMethodInjects() != null) { // Methods inject
for (Entry<Method, BeanBox[]> methods : box.getMethodInjects().entrySet()) {
Method m = methods.getKey();
BeanBox[] paramBoxs = methods.getValue();
if (paramBoxs != null && paramBoxs.length > 0) {
Object[] methodParams = param2RealObjects(this, history, paramBoxs);
ReflectionUtils.invokeMethod(m, bean, methodParams); // depends on control dependency: [if], data = [none]
} else // method has no parameter
ReflectionUtils.invokeMethod(m, bean);
}
}
return bean;
} } |
public class class_name {
public static int[] sampleOOBRows(int nrows, float rate, Random sampler, int[] oob) {
int oobcnt = 0; // Number of oob rows
Arrays.fill(oob, 0);
for(int row = 0; row < nrows; row++) {
if (sampler.nextFloat() >= rate) { // it is out-of-bag row
oob[1+oobcnt++] = row;
if (1+oobcnt>=oob.length) oob = Arrays.copyOf(oob, Math.round(1.2f*nrows+0.5f)+2);
}
}
oob[0] = oobcnt;
return oob;
} } | public class class_name {
public static int[] sampleOOBRows(int nrows, float rate, Random sampler, int[] oob) {
int oobcnt = 0; // Number of oob rows
Arrays.fill(oob, 0);
for(int row = 0; row < nrows; row++) {
if (sampler.nextFloat() >= rate) { // it is out-of-bag row
oob[1+oobcnt++] = row; // depends on control dependency: [if], data = [none]
if (1+oobcnt>=oob.length) oob = Arrays.copyOf(oob, Math.round(1.2f*nrows+0.5f)+2);
}
}
oob[0] = oobcnt;
return oob;
} } |
public class class_name {
protected void updatePropertyFile() {
final String methodName = "updatePropertyFile()";
final File f = new File(htodPropertyFileName);
final CacheOnDisk cod = this;
traceDebug(methodName, "cacheName=" + this.cacheName);
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
FileOutputStream fos = null;
Properties htodProp = new Properties();
try {
fos = new FileOutputStream(f);
htodProp.put(HTOD_VERSION, HTOD_VERSION_NUM);
htodProp.put(DISABLE_DEPENDENCY_ID, Boolean.toString(disableDependencyId));
htodProp.put(DISABLE_TEMPLATE_SUPPORT, Boolean.toString(disableTemplatesSupport));
long cacheSizeInBytes = 0;
int fieldCheck = 0;
if (cod.enableCacheSizeInBytes) {
if (cod.currentCacheSizeInBytes < cod.htod.minDiskCacheSizeInBytes) {
cod.currentCacheSizeInBytes = cod.htod.minDiskCacheSizeInBytes;
}
cacheSizeInBytes = cod.currentCacheSizeInBytes;
htodProp.put(CACHE_SIZE_IN_BYTES, Long.toString(cacheSizeInBytes));
String s = String.valueOf(cacheSizeInBytes);
byte[] b = s.getBytes("UTF-8");
fieldCheck = 0;
for (int i = 0; i < b.length; i++) {
fieldCheck += (int) b[i];
}
fieldCheck = fieldCheck * 3;
htodProp.put(FIELD_CHECK, String.valueOf(fieldCheck));
htodProp.put(DATA_GB, String.valueOf(cod.diskCacheSizeInfo.currentDataGB));
htodProp.put(DEPID_GB, String.valueOf(cod.diskCacheSizeInfo.currentDependencyIdGB));
htodProp.put(TEMPLATE_GB, String.valueOf(cod.diskCacheSizeInfo.currentTemplateGB));
traceDebug(methodName, "cacheName=" + cod.cacheName + " disableDependencyId=" + disableDependencyId
+ " disableTemplatesSupport=" + disableTemplatesSupport + " cacheSizeInBytes=" + cacheSizeInBytes + " fieldCheck="
+ fieldCheck + " dataGB=" + cod.diskCacheSizeInfo.currentDataGB + " dependencyIdGB="
+ cod.diskCacheSizeInfo.currentDependencyIdGB + " templateGB=" + cod.diskCacheSizeInfo.currentTemplateGB);
} else {
traceDebug(methodName, "cacheName=" + cod.cacheName + " disableDependencyId=" + disableDependencyId
+ " disableTemplatesSupport=" + disableTemplatesSupport);
}
htodProp.store(fos, "HTOD properties - Do not modify the properties");
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updatePropertyFile", "651", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updatePropertyFile", "859", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
return null;
}
});
} } | public class class_name {
protected void updatePropertyFile() {
final String methodName = "updatePropertyFile()";
final File f = new File(htodPropertyFileName);
final CacheOnDisk cod = this;
traceDebug(methodName, "cacheName=" + this.cacheName);
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
FileOutputStream fos = null;
Properties htodProp = new Properties();
try {
fos = new FileOutputStream(f); // depends on control dependency: [try], data = [none]
htodProp.put(HTOD_VERSION, HTOD_VERSION_NUM); // depends on control dependency: [try], data = [none]
htodProp.put(DISABLE_DEPENDENCY_ID, Boolean.toString(disableDependencyId)); // depends on control dependency: [try], data = [none]
htodProp.put(DISABLE_TEMPLATE_SUPPORT, Boolean.toString(disableTemplatesSupport)); // depends on control dependency: [try], data = [none]
long cacheSizeInBytes = 0;
int fieldCheck = 0;
if (cod.enableCacheSizeInBytes) {
if (cod.currentCacheSizeInBytes < cod.htod.minDiskCacheSizeInBytes) {
cod.currentCacheSizeInBytes = cod.htod.minDiskCacheSizeInBytes; // depends on control dependency: [if], data = [none]
}
cacheSizeInBytes = cod.currentCacheSizeInBytes; // depends on control dependency: [if], data = [none]
htodProp.put(CACHE_SIZE_IN_BYTES, Long.toString(cacheSizeInBytes)); // depends on control dependency: [if], data = [none]
String s = String.valueOf(cacheSizeInBytes);
byte[] b = s.getBytes("UTF-8");
fieldCheck = 0; // depends on control dependency: [if], data = [none]
for (int i = 0; i < b.length; i++) {
fieldCheck += (int) b[i]; // depends on control dependency: [for], data = [i]
}
fieldCheck = fieldCheck * 3; // depends on control dependency: [if], data = [none]
htodProp.put(FIELD_CHECK, String.valueOf(fieldCheck)); // depends on control dependency: [if], data = [none]
htodProp.put(DATA_GB, String.valueOf(cod.diskCacheSizeInfo.currentDataGB)); // depends on control dependency: [if], data = [none]
htodProp.put(DEPID_GB, String.valueOf(cod.diskCacheSizeInfo.currentDependencyIdGB)); // depends on control dependency: [if], data = [none]
htodProp.put(TEMPLATE_GB, String.valueOf(cod.diskCacheSizeInfo.currentTemplateGB)); // depends on control dependency: [if], data = [none]
traceDebug(methodName, "cacheName=" + cod.cacheName + " disableDependencyId=" + disableDependencyId
+ " disableTemplatesSupport=" + disableTemplatesSupport + " cacheSizeInBytes=" + cacheSizeInBytes + " fieldCheck="
+ fieldCheck + " dataGB=" + cod.diskCacheSizeInfo.currentDataGB + " dependencyIdGB="
+ cod.diskCacheSizeInfo.currentDependencyIdGB + " templateGB=" + cod.diskCacheSizeInfo.currentTemplateGB); // depends on control dependency: [if], data = [none]
} else {
traceDebug(methodName, "cacheName=" + cod.cacheName + " disableDependencyId=" + disableDependencyId
+ " disableTemplatesSupport=" + disableTemplatesSupport); // depends on control dependency: [if], data = [none]
}
htodProp.store(fos, "HTOD properties - Do not modify the properties"); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updatePropertyFile", "651", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} finally { // depends on control dependency: [catch], data = [none]
try {
if (fos != null) {
fos.close(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updatePropertyFile", "859", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} // depends on control dependency: [catch], data = [none]
}
return null;
}
});
} } |
public class class_name {
public static void closeRocksObjects(RocksObject... rocksObjList) {
if (rocksObjList != null) {
for (RocksObject obj : rocksObjList) {
try {
if (obj != null) {
obj.close();
}
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
}
} } | public class class_name {
public static void closeRocksObjects(RocksObject... rocksObjList) {
if (rocksObjList != null) {
for (RocksObject obj : rocksObjList) {
try {
if (obj != null) {
obj.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void setNetworkInterfacePermissionIds(java.util.Collection<String> networkInterfacePermissionIds) {
if (networkInterfacePermissionIds == null) {
this.networkInterfacePermissionIds = null;
return;
}
this.networkInterfacePermissionIds = new com.amazonaws.internal.SdkInternalList<String>(networkInterfacePermissionIds);
} } | public class class_name {
public void setNetworkInterfacePermissionIds(java.util.Collection<String> networkInterfacePermissionIds) {
if (networkInterfacePermissionIds == null) {
this.networkInterfacePermissionIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.networkInterfacePermissionIds = new com.amazonaws.internal.SdkInternalList<String>(networkInterfacePermissionIds);
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>> beginCreateOrReplaceWithServiceResponseAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (streamingJob == null) {
throw new IllegalArgumentException("Parameter streamingJob is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(streamingJob);
return service.beginCreateOrReplace(this.client.subscriptionId(), resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> clientResponse = beginCreateOrReplaceDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>> beginCreateOrReplaceWithServiceResponseAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (streamingJob == null) {
throw new IllegalArgumentException("Parameter streamingJob is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(streamingJob);
return service.beginCreateOrReplace(this.client.subscriptionId(), resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> clientResponse = beginCreateOrReplaceDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public static Long hexToLongObject(@Nullable String str, Long defaultValue) {
if (StringUtils.isEmpty(str)) {
return defaultValue;
}
try {
return Long.decode(str);
} catch (final NumberFormatException nfe) {
return defaultValue;
}
} } | public class class_name {
public static Long hexToLongObject(@Nullable String str, Long defaultValue) {
if (StringUtils.isEmpty(str)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
try {
return Long.decode(str); // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException nfe) {
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int lastIndexOf(final CharSequence seq, final int searchChar) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND;
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, seq.length());
} } | public class class_name {
public static int lastIndexOf(final CharSequence seq, final int searchChar) {
if (isEmpty(seq)) {
return INDEX_NOT_FOUND; // depends on control dependency: [if], data = [none]
}
return CharSequenceUtils.lastIndexOf(seq, searchChar, seq.length());
} } |
public class class_name {
public void flip() {
int fromIndex=0, toIndex=size();
if (fromIndex == toIndex)
return;
int startWordIndex = wordIndex(fromIndex);
int endWordIndex = wordIndex(toIndex);
long firstWordMask = WORD_MASK << fromIndex;
long lastWordMask = WORD_MASK >>> -toIndex;
if (startWordIndex == endWordIndex) {
// Case 1: One word
words[startWordIndex] ^= (firstWordMask & lastWordMask);
} else {
// Case 2: Multiple words
// Handle first word
words[startWordIndex] ^= firstWordMask;
// Handle intermediate words, if any
for (int i = startWordIndex+1; i < endWordIndex; i++)
words[i] ^= WORD_MASK;
// Handle last word
words[endWordIndex] ^= lastWordMask;
}
} } | public class class_name {
public void flip() {
int fromIndex=0, toIndex=size();
if (fromIndex == toIndex)
return;
int startWordIndex = wordIndex(fromIndex);
int endWordIndex = wordIndex(toIndex);
long firstWordMask = WORD_MASK << fromIndex;
long lastWordMask = WORD_MASK >>> -toIndex;
if (startWordIndex == endWordIndex) {
// Case 1: One word
words[startWordIndex] ^= (firstWordMask & lastWordMask); // depends on control dependency: [if], data = [none]
} else {
// Case 2: Multiple words
// Handle first word
words[startWordIndex] ^= firstWordMask; // depends on control dependency: [if], data = [none]
// Handle intermediate words, if any
for (int i = startWordIndex+1; i < endWordIndex; i++)
words[i] ^= WORD_MASK;
// Handle last word
words[endWordIndex] ^= lastWordMask; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private FormatString[] parse(String s) {
ArrayList<FormatString> al = new ArrayList<>();
for (int i = 0, len = s.length(); i < len; ) {
int nextPercent = s.indexOf('%', i);
if (s.charAt(i) != '%') {
// This is plain-text part, find the maximal plain-text
// sequence and store it.
int plainTextStart = i;
int plainTextEnd = (nextPercent == -1) ? len: nextPercent;
al.add(new FixedString(s.substring(plainTextStart,
plainTextEnd)));
i = plainTextEnd;
} else {
// We have a format specifier
FormatSpecifierParser fsp = new FormatSpecifierParser(s, i + 1);
al.add(fsp.getFormatSpecifier());
i = fsp.getEndIdx();
}
}
return al.toArray(new FormatString[al.size()]);
} } | public class class_name {
private FormatString[] parse(String s) {
ArrayList<FormatString> al = new ArrayList<>();
for (int i = 0, len = s.length(); i < len; ) {
int nextPercent = s.indexOf('%', i);
if (s.charAt(i) != '%') {
// This is plain-text part, find the maximal plain-text
// sequence and store it.
int plainTextStart = i;
int plainTextEnd = (nextPercent == -1) ? len: nextPercent;
al.add(new FixedString(s.substring(plainTextStart,
plainTextEnd))); // depends on control dependency: [if], data = [none]
i = plainTextEnd; // depends on control dependency: [if], data = [none]
} else {
// We have a format specifier
FormatSpecifierParser fsp = new FormatSpecifierParser(s, i + 1);
al.add(fsp.getFormatSpecifier()); // depends on control dependency: [if], data = [none]
i = fsp.getEndIdx(); // depends on control dependency: [if], data = [none]
}
}
return al.toArray(new FormatString[al.size()]);
} } |
public class class_name {
public void updateUtf8(String string) {
if (string != null) {
byte[] bytes;
try {
bytes = string.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
update(bytes, 0, bytes.length);
}
} } | public class class_name {
public void updateUtf8(String string) {
if (string != null) {
byte[] bytes;
try {
bytes = string.getBytes("UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
update(bytes, 0, bytes.length); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static org.opencms.db.generic.CmsSqlManager getInstance(String classname) {
org.opencms.db.generic.CmsSqlManager sqlManager;
try {
Object objectInstance = Class.forName(classname).newInstance();
sqlManager = (org.opencms.db.generic.CmsSqlManager)objectInstance;
} catch (Throwable t) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_SQL_MANAGER_INIT_FAILED_1, classname), t);
sqlManager = null;
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_SQL_MANAGER_1, classname));
}
return sqlManager;
} } | public class class_name {
public static org.opencms.db.generic.CmsSqlManager getInstance(String classname) {
org.opencms.db.generic.CmsSqlManager sqlManager;
try {
Object objectInstance = Class.forName(classname).newInstance();
sqlManager = (org.opencms.db.generic.CmsSqlManager)objectInstance; // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_SQL_MANAGER_INIT_FAILED_1, classname), t);
sqlManager = null;
} // depends on control dependency: [catch], data = [none]
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_SQL_MANAGER_1, classname)); // depends on control dependency: [if], data = [none]
}
return sqlManager;
} } |
public class class_name {
private void appendSuffix(char[] suffix,
int len,
char[] container) {
int startIndex = fastPathData.lastFreeIndex;
// If suffix to append is only 1 char long, just assigns this char.
// If suffix is less or equal 4, we use a dedicated algorithm that
// has shown to run faster than System.arraycopy.
// If more than 4, we use System.arraycopy.
if (len == 1)
container[startIndex] = suffix[0];
else if (len <= 4) {
int dstLower = startIndex;
int dstUpper = dstLower + len - 1;
int srcUpper = len - 1;
container[dstLower] = suffix[0];
container[dstUpper] = suffix[srcUpper];
if (len > 2)
container[++dstLower] = suffix[1];
if (len == 4)
container[--dstUpper] = suffix[2];
} else
System.arraycopy(suffix, 0, container, startIndex, len);
fastPathData.lastFreeIndex += len;
} } | public class class_name {
private void appendSuffix(char[] suffix,
int len,
char[] container) {
int startIndex = fastPathData.lastFreeIndex;
// If suffix to append is only 1 char long, just assigns this char.
// If suffix is less or equal 4, we use a dedicated algorithm that
// has shown to run faster than System.arraycopy.
// If more than 4, we use System.arraycopy.
if (len == 1)
container[startIndex] = suffix[0];
else if (len <= 4) {
int dstLower = startIndex;
int dstUpper = dstLower + len - 1;
int srcUpper = len - 1;
container[dstLower] = suffix[0]; // depends on control dependency: [if], data = [none]
container[dstUpper] = suffix[srcUpper]; // depends on control dependency: [if], data = [none]
if (len > 2)
container[++dstLower] = suffix[1];
if (len == 4)
container[--dstUpper] = suffix[2];
} else
System.arraycopy(suffix, 0, container, startIndex, len);
fastPathData.lastFreeIndex += len;
} } |
public class class_name {
public static void successCancellation(final JpaAction action, final ActionRepository actionRepository,
final TargetRepository targetRepository) {
// set action inactive
action.setActive(false);
action.setStatus(Status.CANCELED);
final JpaTarget target = (JpaTarget) action.getTarget();
final List<Action> nextActiveActions = actionRepository.findByTargetAndActiveOrderByIdAsc(target, true).stream()
.filter(a -> !a.getId().equals(action.getId())).collect(Collectors.toList());
if (nextActiveActions.isEmpty()) {
target.setAssignedDistributionSet(target.getInstalledDistributionSet());
target.setUpdateStatus(TargetUpdateStatus.IN_SYNC);
} else {
target.setAssignedDistributionSet(nextActiveActions.get(0).getDistributionSet());
}
targetRepository.save(target);
} } | public class class_name {
public static void successCancellation(final JpaAction action, final ActionRepository actionRepository,
final TargetRepository targetRepository) {
// set action inactive
action.setActive(false);
action.setStatus(Status.CANCELED);
final JpaTarget target = (JpaTarget) action.getTarget();
final List<Action> nextActiveActions = actionRepository.findByTargetAndActiveOrderByIdAsc(target, true).stream()
.filter(a -> !a.getId().equals(action.getId())).collect(Collectors.toList());
if (nextActiveActions.isEmpty()) {
target.setAssignedDistributionSet(target.getInstalledDistributionSet()); // depends on control dependency: [if], data = [none]
target.setUpdateStatus(TargetUpdateStatus.IN_SYNC); // depends on control dependency: [if], data = [none]
} else {
target.setAssignedDistributionSet(nextActiveActions.get(0).getDistributionSet()); // depends on control dependency: [if], data = [none]
}
targetRepository.save(target);
} } |
public class class_name {
public void marshall(WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (workflowExecutionCompletedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(workflowExecutionCompletedEventAttributes.getResult(), RESULT_BINDING);
protocolMarshaller.marshall(workflowExecutionCompletedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (workflowExecutionCompletedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(workflowExecutionCompletedEventAttributes.getResult(), RESULT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(workflowExecutionCompletedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public com.google.privacy.dlp.v2.BigQueryKeyOrBuilder getBigQueryKeyOrBuilder() {
if (typeCase_ == 3) {
return (com.google.privacy.dlp.v2.BigQueryKey) type_;
}
return com.google.privacy.dlp.v2.BigQueryKey.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.BigQueryKeyOrBuilder getBigQueryKeyOrBuilder() {
if (typeCase_ == 3) {
return (com.google.privacy.dlp.v2.BigQueryKey) type_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.BigQueryKey.getDefaultInstance();
} } |
public class class_name {
public static String compileToStringMinMaxArguments(
CharSequence pattern, StringBuilder sb, int min, int max) {
// Return some precompiled common two-argument patterns.
if (min <= 2 && 2 <= max) {
for (String[] pair : COMMON_PATTERNS) {
if (pair[0].contentEquals(pattern)) {
assert pair[1].charAt(0) == 2;
return pair[1];
}
}
}
// Parse consistent with MessagePattern, but
// - support only simple numbered arguments
// - build a simple binary structure into the result string
int patternLength = pattern.length();
sb.ensureCapacity(patternLength);
// Reserve the first char for the number of arguments.
sb.setLength(1);
int textLength = 0;
int maxArg = -1;
boolean inQuote = false;
for (int i = 0; i < patternLength;) {
char c = pattern.charAt(i++);
if (c == '\'') {
if (i < patternLength && (c = pattern.charAt(i)) == '\'') {
// double apostrophe, skip the second one
++i;
} else if (inQuote) {
// skip the quote-ending apostrophe
inQuote = false;
continue;
} else if (c == '{' || c == '}') {
// Skip the quote-starting apostrophe, find the end of the quoted literal text.
++i;
inQuote = true;
} else {
// The apostrophe is part of literal text.
c = '\'';
}
} else if (!inQuote && c == '{') {
if (textLength > 0) {
sb.setCharAt(sb.length() - textLength - 1, (char)(ARG_NUM_LIMIT + textLength));
textLength = 0;
}
int argNumber;
if ((i + 1) < patternLength &&
0 <= (argNumber = pattern.charAt(i) - '0') && argNumber <= 9 &&
pattern.charAt(i + 1) == '}') {
i += 2;
} else {
// Multi-digit argument number (no leading zero) or syntax error.
// MessagePattern permits PatternProps.skipWhiteSpace(pattern, index)
// around the number, but this class does not.
int argStart = i - 1;
argNumber = -1;
if (i < patternLength && '1' <= (c = pattern.charAt(i++)) && c <= '9') {
argNumber = c - '0';
while (i < patternLength && '0' <= (c = pattern.charAt(i++)) && c <= '9') {
argNumber = argNumber * 10 + (c - '0');
if (argNumber >= ARG_NUM_LIMIT) {
break;
}
}
}
if (argNumber < 0 || c != '}') {
throw new IllegalArgumentException(
"Argument syntax error in pattern \"" + pattern +
"\" at index " + argStart +
": " + pattern.subSequence(argStart, i));
}
}
if (argNumber > maxArg) {
maxArg = argNumber;
}
sb.append((char)argNumber);
continue;
} // else: c is part of literal text
// Append c and track the literal-text segment length.
if (textLength == 0) {
// Reserve a char for the length of a new text segment, preset the maximum length.
sb.append(SEGMENT_LENGTH_ARGUMENT_CHAR);
}
sb.append(c);
if (++textLength == MAX_SEGMENT_LENGTH) {
textLength = 0;
}
}
if (textLength > 0) {
sb.setCharAt(sb.length() - textLength - 1, (char)(ARG_NUM_LIMIT + textLength));
}
int argCount = maxArg + 1;
if (argCount < min) {
throw new IllegalArgumentException(
"Fewer than minimum " + min + " arguments in pattern \"" + pattern + "\"");
}
if (argCount > max) {
throw new IllegalArgumentException(
"More than maximum " + max + " arguments in pattern \"" + pattern + "\"");
}
sb.setCharAt(0, (char)argCount);
return sb.toString();
} } | public class class_name {
public static String compileToStringMinMaxArguments(
CharSequence pattern, StringBuilder sb, int min, int max) {
// Return some precompiled common two-argument patterns.
if (min <= 2 && 2 <= max) {
for (String[] pair : COMMON_PATTERNS) {
if (pair[0].contentEquals(pattern)) {
assert pair[1].charAt(0) == 2; // depends on control dependency: [if], data = [none]
return pair[1]; // depends on control dependency: [if], data = [none]
}
}
}
// Parse consistent with MessagePattern, but
// - support only simple numbered arguments
// - build a simple binary structure into the result string
int patternLength = pattern.length();
sb.ensureCapacity(patternLength);
// Reserve the first char for the number of arguments.
sb.setLength(1);
int textLength = 0;
int maxArg = -1;
boolean inQuote = false;
for (int i = 0; i < patternLength;) {
char c = pattern.charAt(i++);
if (c == '\'') {
if (i < patternLength && (c = pattern.charAt(i)) == '\'') {
// double apostrophe, skip the second one
++i; // depends on control dependency: [if], data = [none]
} else if (inQuote) {
// skip the quote-ending apostrophe
inQuote = false; // depends on control dependency: [if], data = [none]
continue;
} else if (c == '{' || c == '}') {
// Skip the quote-starting apostrophe, find the end of the quoted literal text.
++i; // depends on control dependency: [if], data = [none]
inQuote = true; // depends on control dependency: [if], data = [none]
} else {
// The apostrophe is part of literal text.
c = '\''; // depends on control dependency: [if], data = [none]
}
} else if (!inQuote && c == '{') {
if (textLength > 0) {
sb.setCharAt(sb.length() - textLength - 1, (char)(ARG_NUM_LIMIT + textLength)); // depends on control dependency: [if], data = [none]
textLength = 0; // depends on control dependency: [if], data = [none]
}
int argNumber;
if ((i + 1) < patternLength &&
0 <= (argNumber = pattern.charAt(i) - '0') && argNumber <= 9 &&
pattern.charAt(i + 1) == '}') {
i += 2; // depends on control dependency: [if], data = [none]
} else {
// Multi-digit argument number (no leading zero) or syntax error.
// MessagePattern permits PatternProps.skipWhiteSpace(pattern, index)
// around the number, but this class does not.
int argStart = i - 1;
argNumber = -1; // depends on control dependency: [if], data = [none]
if (i < patternLength && '1' <= (c = pattern.charAt(i++)) && c <= '9') {
argNumber = c - '0'; // depends on control dependency: [if], data = [none]
while (i < patternLength && '0' <= (c = pattern.charAt(i++)) && c <= '9') {
argNumber = argNumber * 10 + (c - '0'); // depends on control dependency: [while], data = [none]
if (argNumber >= ARG_NUM_LIMIT) {
break;
}
}
}
if (argNumber < 0 || c != '}') {
throw new IllegalArgumentException(
"Argument syntax error in pattern \"" + pattern +
"\" at index " + argStart +
": " + pattern.subSequence(argStart, i));
}
}
if (argNumber > maxArg) {
maxArg = argNumber; // depends on control dependency: [if], data = [none]
}
sb.append((char)argNumber); // depends on control dependency: [if], data = [none]
continue;
} // else: c is part of literal text
// Append c and track the literal-text segment length.
if (textLength == 0) {
// Reserve a char for the length of a new text segment, preset the maximum length.
sb.append(SEGMENT_LENGTH_ARGUMENT_CHAR); // depends on control dependency: [if], data = [none]
}
sb.append(c); // depends on control dependency: [for], data = [none]
if (++textLength == MAX_SEGMENT_LENGTH) {
textLength = 0; // depends on control dependency: [if], data = [none]
}
}
if (textLength > 0) {
sb.setCharAt(sb.length() - textLength - 1, (char)(ARG_NUM_LIMIT + textLength)); // depends on control dependency: [if], data = [none]
}
int argCount = maxArg + 1;
if (argCount < min) {
throw new IllegalArgumentException(
"Fewer than minimum " + min + " arguments in pattern \"" + pattern + "\"");
}
if (argCount > max) {
throw new IllegalArgumentException(
"More than maximum " + max + " arguments in pattern \"" + pattern + "\"");
}
sb.setCharAt(0, (char)argCount);
return sb.toString();
} } |
public class class_name {
public void order() {
final OrderComparator comparator = new OrderComparator();
for (Class<? extends FeatureInstaller> installer : installerTypes) {
if (Ordered.class.isAssignableFrom(installer)) {
final List<Class<?>> extensions = this.extensions.get(installer);
if (extensions == null || extensions.size() <= 1) {
continue;
}
extensions.sort(comparator);
}
}
} } | public class class_name {
public void order() {
final OrderComparator comparator = new OrderComparator();
for (Class<? extends FeatureInstaller> installer : installerTypes) {
if (Ordered.class.isAssignableFrom(installer)) {
final List<Class<?>> extensions = this.extensions.get(installer); // depends on control dependency: [if], data = [none]
if (extensions == null || extensions.size() <= 1) {
continue;
}
extensions.sort(comparator); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static JPAPuId[] getExtendedContextPuIds(Collection<InjectionBinding<?>> injectionBindings,
String ejbName,
Set<String> persistenceRefNames,
List<Object> bindingList)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getExtendedContextPuIds : " +
((injectionBindings != null)
? ("<" + injectionBindings.size() + "> :" + injectionBindings)
: "No Injection Bindings"));
JPAPuId[] rtnValue = NoPuIds;
if (injectionBindings != null && injectionBindings.size() > 0)
{
// Build a set of extended persistence contexts for the 'bindings'.
// A set is used to eliminate duplicate JPAPuIds.
HashSet<JPAPuId> extendedPuIds = new HashSet<JPAPuId>();
for (InjectionBinding<?> binding : injectionBindings)
{
if (binding instanceof JPAPCtxtInjectionBinding)
{
JPAPCtxtInjectionBinding pcBinding = (JPAPCtxtInjectionBinding) binding;
if (pcBinding.containsComponent(ejbName)) // F743-30682
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "extended persistence-context-ref name=" + pcBinding.getJndiName() +
" contains component=" + ejbName);
if (pcBinding.isExtendedType())
{
// The unitName in the user-define PersistenceContext annotation may not be
// defined, update the puId with a valid and unique persistence unit name.
JPAPuId puId = pcBinding.ivPuId;
String puName = puId.getPuName();
if (puName == null || puName.length() == 0)
{
//F743-16027 - using JPAAccessor to get JPAComponent, rather than using cached (possibly stale) static reference
JPAPUnitInfo puInfo = ((AbstractJPAComponent) JPAAccessor.getJPAComponent()).findPersistenceUnitInfo(puId); // F743-18776
if (puInfo != null)
{
puId.setPuName(puInfo.getPersistenceUnitName());
}
}
extendedPuIds.add(puId);
if (bindingList != null) {
bindingList.add(pcBinding);
}
}
if (persistenceRefNames != null) // F743-30682
{
persistenceRefNames.add(pcBinding.getJndiName());
}
}
}
}
if (extendedPuIds.size() > 0)
{
rtnValue = extendedPuIds.toArray(new JPAPuId[extendedPuIds.size()]);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getExtendedContextPuIds : " + rtnValue.length);
return rtnValue;
} } | public class class_name {
static JPAPuId[] getExtendedContextPuIds(Collection<InjectionBinding<?>> injectionBindings,
String ejbName,
Set<String> persistenceRefNames,
List<Object> bindingList)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getExtendedContextPuIds : " +
((injectionBindings != null)
? ("<" + injectionBindings.size() + "> :" + injectionBindings)
: "No Injection Bindings"));
JPAPuId[] rtnValue = NoPuIds;
if (injectionBindings != null && injectionBindings.size() > 0)
{
// Build a set of extended persistence contexts for the 'bindings'.
// A set is used to eliminate duplicate JPAPuIds.
HashSet<JPAPuId> extendedPuIds = new HashSet<JPAPuId>();
for (InjectionBinding<?> binding : injectionBindings)
{
if (binding instanceof JPAPCtxtInjectionBinding)
{
JPAPCtxtInjectionBinding pcBinding = (JPAPCtxtInjectionBinding) binding;
if (pcBinding.containsComponent(ejbName)) // F743-30682
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "extended persistence-context-ref name=" + pcBinding.getJndiName() +
" contains component=" + ejbName);
if (pcBinding.isExtendedType())
{
// The unitName in the user-define PersistenceContext annotation may not be
// defined, update the puId with a valid and unique persistence unit name.
JPAPuId puId = pcBinding.ivPuId;
String puName = puId.getPuName();
if (puName == null || puName.length() == 0)
{
//F743-16027 - using JPAAccessor to get JPAComponent, rather than using cached (possibly stale) static reference
JPAPUnitInfo puInfo = ((AbstractJPAComponent) JPAAccessor.getJPAComponent()).findPersistenceUnitInfo(puId); // F743-18776
if (puInfo != null)
{
puId.setPuName(puInfo.getPersistenceUnitName()); // depends on control dependency: [if], data = [(puInfo]
}
}
extendedPuIds.add(puId); // depends on control dependency: [if], data = [none]
if (bindingList != null) {
bindingList.add(pcBinding); // depends on control dependency: [if], data = [none]
}
}
if (persistenceRefNames != null) // F743-30682
{
persistenceRefNames.add(pcBinding.getJndiName()); // depends on control dependency: [if], data = [none]
}
}
}
}
if (extendedPuIds.size() > 0)
{
rtnValue = extendedPuIds.toArray(new JPAPuId[extendedPuIds.size()]);
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getExtendedContextPuIds : " + rtnValue.length);
return rtnValue;
} } |
public class class_name {
private int lineBeginningFor(int pos) {
if (sourceChars == null) {
return -1;
}
if (pos <= 0) {
return 0;
}
char[] buf = sourceChars;
if (pos >= buf.length) {
pos = buf.length - 1;
}
while (--pos >= 0) {
char c = buf[pos];
if (ScriptRuntime.isJSLineTerminator(c)) {
return pos + 1; // want position after the newline
}
}
return 0;
} } | public class class_name {
private int lineBeginningFor(int pos) {
if (sourceChars == null) {
return -1; // depends on control dependency: [if], data = [none]
}
if (pos <= 0) {
return 0; // depends on control dependency: [if], data = [none]
}
char[] buf = sourceChars;
if (pos >= buf.length) {
pos = buf.length - 1; // depends on control dependency: [if], data = [none]
}
while (--pos >= 0) {
char c = buf[pos];
if (ScriptRuntime.isJSLineTerminator(c)) {
return pos + 1; // want position after the newline // depends on control dependency: [if], data = [none]
}
}
return 0;
} } |
public class class_name {
public static void useSequentialIds() {
if (!sequential) {
// get string that changes every 10 minutes
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
df.setTimeZone(tz);
String date = df.format(new Date()).substring(0, 11);
// run an md5 hash of the string, no reason this needs to be secure
byte[] digest;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
digest = md.digest(date.getBytes("UTF-8"));
}
catch (Exception e) {
throw new RuntimeException("Could not create hash of date for the sequential counter", e);
}
// create integer from first 4 bytes of md5 hash
int x;
x = ((int)digest[0] & 0xFF);
x |= ((int)digest[1] & 0xFF) << 8;
x |= ((int)digest[2] & 0xFF) << 16;
x |= ((int)digest[3] & 0xFF) << 24;
COUNTER.set(x);
}
sequential = true;
} } | public class class_name {
public static void useSequentialIds() {
if (!sequential) {
// get string that changes every 10 minutes
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
df.setTimeZone(tz); // depends on control dependency: [if], data = [none]
String date = df.format(new Date()).substring(0, 11);
// run an md5 hash of the string, no reason this needs to be secure
byte[] digest;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
digest = md.digest(date.getBytes("UTF-8")); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new RuntimeException("Could not create hash of date for the sequential counter", e);
} // depends on control dependency: [catch], data = [none]
// create integer from first 4 bytes of md5 hash
int x;
x = ((int)digest[0] & 0xFF); // depends on control dependency: [if], data = [none]
x |= ((int)digest[1] & 0xFF) << 8; // depends on control dependency: [if], data = [none]
x |= ((int)digest[2] & 0xFF) << 16; // depends on control dependency: [if], data = [none]
x |= ((int)digest[3] & 0xFF) << 24; // depends on control dependency: [if], data = [none]
COUNTER.set(x); // depends on control dependency: [if], data = [none]
}
sequential = true;
} } |
public class class_name {
protected void removeListeners() {
Editable text = getText();
if (text != null) {
TokenSpanWatcher[] spanWatchers = text.getSpans(0, text.length(), TokenSpanWatcher.class);
for (TokenSpanWatcher watcher : spanWatchers) {
text.removeSpan(watcher);
}
removeTextChangedListener(textWatcher);
}
} } | public class class_name {
protected void removeListeners() {
Editable text = getText();
if (text != null) {
TokenSpanWatcher[] spanWatchers = text.getSpans(0, text.length(), TokenSpanWatcher.class);
for (TokenSpanWatcher watcher : spanWatchers) {
text.removeSpan(watcher); // depends on control dependency: [for], data = [watcher]
}
removeTextChangedListener(textWatcher); // depends on control dependency: [if], data = [(text]
}
} } |
public class class_name {
private void setSorts(List<Order> orderBys) {
for (Order order : orderBys) {
if (order.getNestedPath() != null) {
request.addSort(SortBuilders.fieldSort(order.getName()).order(SortOrder.valueOf(order.getType())).setNestedSort(new NestedSortBuilder(order.getNestedPath())));
} else if (order.getName().contains("script(")) { //zhongshu-comment 该分支是我后来加的,用于兼容order by case when那种情况
String scriptStr = order.getName().substring("script(".length(), order.getName().length() - 1);
Script script = new Script(scriptStr);
ScriptSortBuilder scriptSortBuilder = SortBuilders.scriptSort(script, order.getScriptSortType());
scriptSortBuilder = scriptSortBuilder.order(SortOrder.valueOf(order.getType()));
request.addSort(scriptSortBuilder);
} else {
request.addSort(
order.getName(),
SortOrder.valueOf(order.getType()));
}
}
} } | public class class_name {
private void setSorts(List<Order> orderBys) {
for (Order order : orderBys) {
if (order.getNestedPath() != null) {
request.addSort(SortBuilders.fieldSort(order.getName()).order(SortOrder.valueOf(order.getType())).setNestedSort(new NestedSortBuilder(order.getNestedPath()))); // depends on control dependency: [if], data = [(order.getNestedPath()]
} else if (order.getName().contains("script(")) { //zhongshu-comment 该分支是我后来加的,用于兼容order by case when那种情况
String scriptStr = order.getName().substring("script(".length(), order.getName().length() - 1);
Script script = new Script(scriptStr);
ScriptSortBuilder scriptSortBuilder = SortBuilders.scriptSort(script, order.getScriptSortType());
scriptSortBuilder = scriptSortBuilder.order(SortOrder.valueOf(order.getType())); // depends on control dependency: [if], data = [none]
request.addSort(scriptSortBuilder); // depends on control dependency: [if], data = [none]
} else {
request.addSort(
order.getName(),
SortOrder.valueOf(order.getType())); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static ImageMetaData decodeDimensionsAndColorSpace(InputStream is) {
Preconditions.checkNotNull(is);
ByteBuffer byteBuffer = DECODE_BUFFERS.acquire();
if (byteBuffer == null) {
byteBuffer = ByteBuffer.allocate(DECODE_BUFFER_SIZE);
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
try {
options.inTempStorage = byteBuffer.array();
BitmapFactory.decodeStream(is, null, options);
ColorSpace colorSpace = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
colorSpace = options.outColorSpace;
}
return new ImageMetaData(options.outWidth, options.outHeight, colorSpace);
} finally {
DECODE_BUFFERS.release(byteBuffer);
}
} } | public class class_name {
public static ImageMetaData decodeDimensionsAndColorSpace(InputStream is) {
Preconditions.checkNotNull(is);
ByteBuffer byteBuffer = DECODE_BUFFERS.acquire();
if (byteBuffer == null) {
byteBuffer = ByteBuffer.allocate(DECODE_BUFFER_SIZE); // depends on control dependency: [if], data = [none]
}
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
try {
options.inTempStorage = byteBuffer.array(); // depends on control dependency: [try], data = [none]
BitmapFactory.decodeStream(is, null, options); // depends on control dependency: [try], data = [none]
ColorSpace colorSpace = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
colorSpace = options.outColorSpace; // depends on control dependency: [if], data = [none]
}
return new ImageMetaData(options.outWidth, options.outHeight, colorSpace); // depends on control dependency: [try], data = [none]
} finally {
DECODE_BUFFERS.release(byteBuffer);
}
} } |
public class class_name {
@Override
public CPTaxCategory remove(Serializable primaryKey)
throws NoSuchCPTaxCategoryException {
Session session = null;
try {
session = openSession();
CPTaxCategory cpTaxCategory = (CPTaxCategory)session.get(CPTaxCategoryImpl.class,
primaryKey);
if (cpTaxCategory == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchCPTaxCategoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpTaxCategory);
}
catch (NoSuchCPTaxCategoryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CPTaxCategory remove(Serializable primaryKey)
throws NoSuchCPTaxCategoryException {
Session session = null;
try {
session = openSession();
CPTaxCategory cpTaxCategory = (CPTaxCategory)session.get(CPTaxCategoryImpl.class,
primaryKey);
if (cpTaxCategory == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchCPTaxCategoryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpTaxCategory);
}
catch (NoSuchCPTaxCategoryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
private static boolean isScrollable(AccessibilityNodeInfoCompat node) {
if (node.isScrollable()) {
return true;
}
return supportsAnyAction(node,
AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD,
AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
} } | public class class_name {
private static boolean isScrollable(AccessibilityNodeInfoCompat node) {
if (node.isScrollable()) {
return true; // depends on control dependency: [if], data = [none]
}
return supportsAnyAction(node,
AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD,
AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
} } |
public class class_name {
private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED;
final String id = this.jobId;
final Optional<byte[]> data = jobStatusProto.hasException() ?
Optional.of(jobStatusProto.getException().toByteArray()) :
Optional.<byte[]>empty();
final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data);
final String message;
if (cause.isPresent() && cause.get().getMessage() != null) {
message = cause.get().getMessage();
} else {
message = "No Message sent by the Job in exception " + cause.get();
LOG.log(Level.WARNING, message, cause.get());
}
final Optional<String> description = Optional.of(message);
final FailedJob failedJob = new FailedJob(id, message, description, cause, data);
this.failedJobEventHandler.onNext(failedJob);
} } | public class class_name {
private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED;
final String id = this.jobId;
final Optional<byte[]> data = jobStatusProto.hasException() ?
Optional.of(jobStatusProto.getException().toByteArray()) :
Optional.<byte[]>empty();
final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data);
final String message;
if (cause.isPresent() && cause.get().getMessage() != null) {
message = cause.get().getMessage(); // depends on control dependency: [if], data = [none]
} else {
message = "No Message sent by the Job in exception " + cause.get(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
LOG.log(Level.WARNING, message, cause.get()); // depends on control dependency: [if], data = [none]
}
final Optional<String> description = Optional.of(message);
final FailedJob failedJob = new FailedJob(id, message, description, cause, data);
this.failedJobEventHandler.onNext(failedJob);
} } |
public class class_name {
public JsonObject remove(String name) {
if (name == null) {
throw new NullPointerException(NAME_IS_NULL);
}
int index = indexOf(name);
if (index != -1) {
table.remove(index);
names.remove(index);
values.remove(index);
}
return this;
} } | public class class_name {
public JsonObject remove(String name) {
if (name == null) {
throw new NullPointerException(NAME_IS_NULL);
}
int index = indexOf(name);
if (index != -1) {
table.remove(index); // depends on control dependency: [if], data = [(index]
names.remove(index); // depends on control dependency: [if], data = [(index]
values.remove(index); // depends on control dependency: [if], data = [(index]
}
return this;
} } |
public class class_name {
@Override
public synchronized void addListener(JobCatalogListener jobListener) {
Preconditions.checkNotNull(jobListener);
this.listeners.addListener(jobListener);
if (state() == State.RUNNING) {
Iterator<JobSpec> jobSpecItr = getJobSpecsWithTimeUpdate();
while (jobSpecItr.hasNext()) {
JobSpec jobSpec = jobSpecItr.next();
if (jobSpec != null) {
JobCatalogListener.AddJobCallback addJobCallback = new JobCatalogListener.AddJobCallback(jobSpec);
this.listeners.callbackOneListener(addJobCallback, jobListener);
}
}
}
} } | public class class_name {
@Override
public synchronized void addListener(JobCatalogListener jobListener) {
Preconditions.checkNotNull(jobListener);
this.listeners.addListener(jobListener);
if (state() == State.RUNNING) {
Iterator<JobSpec> jobSpecItr = getJobSpecsWithTimeUpdate();
while (jobSpecItr.hasNext()) {
JobSpec jobSpec = jobSpecItr.next();
if (jobSpec != null) {
JobCatalogListener.AddJobCallback addJobCallback = new JobCatalogListener.AddJobCallback(jobSpec);
this.listeners.callbackOneListener(addJobCallback, jobListener); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void setKeyOrder(boolean bKeyOrder)
{
super.setKeyOrder(bKeyOrder);
boolean bForceUniqueKey = true;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false);
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
keyField.setKeyOrder(bKeyOrder);
}
} } | public class class_name {
public void setKeyOrder(boolean bKeyOrder)
{
super.setKeyOrder(bKeyOrder);
boolean bForceUniqueKey = true;
int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false);
for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
keyField.setKeyOrder(bKeyOrder); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static List<Representation> parseRepresentations(JsonObject jsonObject) {
List<Representation> representations = new ArrayList<Representation>();
for (JsonValue representationJson : jsonObject.get("entries").asArray()) {
Representation representation = new Representation(representationJson.asObject());
representations.add(representation);
}
return representations;
} } | public class class_name {
public static List<Representation> parseRepresentations(JsonObject jsonObject) {
List<Representation> representations = new ArrayList<Representation>();
for (JsonValue representationJson : jsonObject.get("entries").asArray()) {
Representation representation = new Representation(representationJson.asObject());
representations.add(representation); // depends on control dependency: [for], data = [none]
}
return representations;
} } |
public class class_name {
public List<Scan.PrecursorMz> getPrecursorMz() {
if (precursorMz == null) {
precursorMz = new ArrayList<Scan.PrecursorMz>();
}
return this.precursorMz;
} } | public class class_name {
public List<Scan.PrecursorMz> getPrecursorMz() {
if (precursorMz == null) {
precursorMz = new ArrayList<Scan.PrecursorMz>(); // depends on control dependency: [if], data = [none]
}
return this.precursorMz;
} } |
public class class_name {
public static List<DeltaError> applyDelta(Object source, List<Delta> commands, final ID idFetcher, DeltaProcessor deltaProcessor, boolean ... failFast)
{
// Index all objects in source graph
final Map srcMap = new HashMap();
Traverser.traverse(source, new Traverser.Visitor()
{
public void process(Object o)
{
if (isIdObject(o, idFetcher))
{
srcMap.put(idFetcher.getId(o), o);
}
}
});
List<DeltaError> errors = new ArrayList<>();
boolean failQuick = failFast != null && failFast.length == 1 && failFast[0];
for (Delta delta : commands)
{
if (failQuick && errors.size() == 1)
{
return errors;
}
Object srcValue = srcMap.get(delta.id);
if (srcValue == null)
{
errors.add(new DeltaError(delta.cmd + " failed, source object not found, obj id: " + delta.id, delta));
continue;
}
Map<String, Field> fields = ReflectionUtils.getDeepDeclaredFieldMap(srcValue.getClass());
Field field = fields.get(delta.fieldName);
if (field == null && OBJECT_ORPHAN != delta.cmd)
{
errors.add(new DeltaError(delta.cmd + " failed, field name missing: " + delta.fieldName + ", obj id: " + delta.id, delta));
continue;
}
// if (LOG.isDebugEnabled())
// {
// LOG.debug(delta.toString());
// }
try
{
switch (delta.cmd)
{
case ARRAY_SET_ELEMENT:
deltaProcessor.processArraySetElement(srcValue, field, delta);
break;
case ARRAY_RESIZE:
deltaProcessor.processArrayResize(srcValue, field, delta);
break;
case OBJECT_ASSIGN_FIELD:
deltaProcessor.processObjectAssignField(srcValue, field, delta);
break;
case OBJECT_ORPHAN:
deltaProcessor.processObjectOrphan(srcValue, field, delta);
break;
case OBJECT_FIELD_TYPE_CHANGED:
deltaProcessor.processObjectTypeChanged(srcValue, field, delta);
break;
case SET_ADD:
deltaProcessor.processSetAdd(srcValue, field, delta);
break;
case SET_REMOVE:
deltaProcessor.processSetRemove(srcValue, field, delta);
break;
case MAP_PUT:
deltaProcessor.processMapPut(srcValue, field, delta);
break;
case MAP_REMOVE:
deltaProcessor.processMapRemove(srcValue, field, delta);
break;
case LIST_RESIZE:
deltaProcessor.processListResize(srcValue, field, delta);
break;
case LIST_SET_ELEMENT:
deltaProcessor.processListSetElement(srcValue, field, delta);
break;
default:
errors.add(new DeltaError("Unknown command: " + delta.cmd, delta));
break;
}
}
catch(Exception e)
{
StringBuilder str = new StringBuilder();
Throwable t = e;
do
{
str.append(t.getMessage());
t = t.getCause();
if (t != null)
{
str.append(", caused by: ");
}
} while (t != null);
errors.add(new DeltaError(str.toString(), delta));
}
}
return errors;
} } | public class class_name {
public static List<DeltaError> applyDelta(Object source, List<Delta> commands, final ID idFetcher, DeltaProcessor deltaProcessor, boolean ... failFast)
{
// Index all objects in source graph
final Map srcMap = new HashMap();
Traverser.traverse(source, new Traverser.Visitor()
{
public void process(Object o)
{
if (isIdObject(o, idFetcher))
{
srcMap.put(idFetcher.getId(o), o); // depends on control dependency: [if], data = [none]
}
}
});
List<DeltaError> errors = new ArrayList<>();
boolean failQuick = failFast != null && failFast.length == 1 && failFast[0];
for (Delta delta : commands)
{
if (failQuick && errors.size() == 1)
{
return errors; // depends on control dependency: [if], data = [none]
}
Object srcValue = srcMap.get(delta.id);
if (srcValue == null)
{
errors.add(new DeltaError(delta.cmd + " failed, source object not found, obj id: " + delta.id, delta)); // depends on control dependency: [if], data = [none]
continue;
}
Map<String, Field> fields = ReflectionUtils.getDeepDeclaredFieldMap(srcValue.getClass());
Field field = fields.get(delta.fieldName);
if (field == null && OBJECT_ORPHAN != delta.cmd)
{
errors.add(new DeltaError(delta.cmd + " failed, field name missing: " + delta.fieldName + ", obj id: " + delta.id, delta)); // depends on control dependency: [if], data = [none]
continue;
}
// if (LOG.isDebugEnabled())
// {
// LOG.debug(delta.toString());
// }
try
{
switch (delta.cmd)
{
case ARRAY_SET_ELEMENT:
deltaProcessor.processArraySetElement(srcValue, field, delta);
break;
case ARRAY_RESIZE:
deltaProcessor.processArrayResize(srcValue, field, delta);
break;
case OBJECT_ASSIGN_FIELD:
deltaProcessor.processObjectAssignField(srcValue, field, delta);
break;
case OBJECT_ORPHAN:
deltaProcessor.processObjectOrphan(srcValue, field, delta);
break;
case OBJECT_FIELD_TYPE_CHANGED:
deltaProcessor.processObjectTypeChanged(srcValue, field, delta);
break;
case SET_ADD:
deltaProcessor.processSetAdd(srcValue, field, delta);
break;
case SET_REMOVE:
deltaProcessor.processSetRemove(srcValue, field, delta);
break;
case MAP_PUT:
deltaProcessor.processMapPut(srcValue, field, delta);
break;
case MAP_REMOVE:
deltaProcessor.processMapRemove(srcValue, field, delta);
break;
case LIST_RESIZE:
deltaProcessor.processListResize(srcValue, field, delta);
break;
case LIST_SET_ELEMENT:
deltaProcessor.processListSetElement(srcValue, field, delta);
break;
default:
errors.add(new DeltaError("Unknown command: " + delta.cmd, delta));
break;
}
}
catch(Exception e)
{
StringBuilder str = new StringBuilder();
Throwable t = e;
do
{
str.append(t.getMessage());
t = t.getCause();
if (t != null)
{
str.append(", caused by: ");
}
} while (t != null);
errors.add(new DeltaError(str.toString(), delta));
}
}
return errors;
} } |
public class class_name {
public ComputeNodeGetRemoteDesktopHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public ComputeNodeGetRemoteDesktopHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
private void handleMulti(@NonNull String[] permissionNames) {
List<String> permissions = declinedPermissionsAsList(context, permissionNames);
if (permissions.isEmpty()) {
permissionCallback.onPermissionGranted(permissionNames);
return;
}
boolean hasAlertWindowPermission = permissions.contains(Manifest.permission.SYSTEM_ALERT_WINDOW);
if (hasAlertWindowPermission) {
int index = permissions.indexOf(Manifest.permission.SYSTEM_ALERT_WINDOW);
permissions.remove(index);
}
ActivityCompat.requestPermissions(context, permissions.toArray(new String[permissions.size()]), REQUEST_PERMISSIONS);
} } | public class class_name {
private void handleMulti(@NonNull String[] permissionNames) {
List<String> permissions = declinedPermissionsAsList(context, permissionNames);
if (permissions.isEmpty()) {
permissionCallback.onPermissionGranted(permissionNames); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
boolean hasAlertWindowPermission = permissions.contains(Manifest.permission.SYSTEM_ALERT_WINDOW);
if (hasAlertWindowPermission) {
int index = permissions.indexOf(Manifest.permission.SYSTEM_ALERT_WINDOW);
permissions.remove(index); // depends on control dependency: [if], data = [none]
}
ActivityCompat.requestPermissions(context, permissions.toArray(new String[permissions.size()]), REQUEST_PERMISSIONS);
} } |
public class class_name {
public static <T> CloseableIterator<T> fromIterator(Iterator<T> iterator) {
requireNonNull(iterator);
if (iterator instanceof CloseableIterator) return (CloseableIterator<T>) iterator;
return new CloseableIterator<T>() {
@Override
public void close() {
if (iterator instanceof AutoCloseable) {
try {
((AutoCloseable) iterator).close();
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
return iterator.next();
}
@Override
public void remove() {
iterator.remove();
}
};
} } | public class class_name {
public static <T> CloseableIterator<T> fromIterator(Iterator<T> iterator) {
requireNonNull(iterator);
if (iterator instanceof CloseableIterator) return (CloseableIterator<T>) iterator;
return new CloseableIterator<T>() {
@Override
public void close() {
if (iterator instanceof AutoCloseable) {
try {
((AutoCloseable) iterator).close(); // depends on control dependency: [try], data = [none]
} catch (RuntimeException re) {
throw re;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
}
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
return iterator.next();
}
@Override
public void remove() {
iterator.remove();
}
};
} } |
public class class_name {
public static String wrapText(final String inString, final String newline, final int wrapColumn) {
if (inString == null) {
return null;
}
final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true);
final StringBuilder builder = new StringBuilder();
while (lineTokenizer.hasMoreTokens()) {
try {
String nextLine = lineTokenizer.nextToken();
if (nextLine.length() > wrapColumn) {
// This line is long enough to be wrapped.
nextLine = wrapLine(nextLine, newline, wrapColumn);
}
builder.append(nextLine);
} catch (final NoSuchElementException nsee) {
// thrown by nextToken(), but I don't know why it would
break;
}
}
return builder.toString();
} } | public class class_name {
public static String wrapText(final String inString, final String newline, final int wrapColumn) {
if (inString == null) {
return null;
// depends on control dependency: [if], data = [none]
}
final StringTokenizer lineTokenizer = new StringTokenizer(inString, newline, true);
final StringBuilder builder = new StringBuilder();
while (lineTokenizer.hasMoreTokens()) {
try {
String nextLine = lineTokenizer.nextToken();
if (nextLine.length() > wrapColumn) {
// This line is long enough to be wrapped.
nextLine = wrapLine(nextLine, newline, wrapColumn);
// depends on control dependency: [if], data = [wrapColumn)]
}
builder.append(nextLine);
// depends on control dependency: [try], data = [none]
} catch (final NoSuchElementException nsee) {
// thrown by nextToken(), but I don't know why it would
break;
}
// depends on control dependency: [catch], data = [none]
}
return builder.toString();
} } |
public class class_name {
private byte[][] toByteArrays(final byte[] keyspace, final byte[] uid, final byte[] serviceCode, final byte[][] key) {
final byte[][] allArgs = new byte[key.length + 3][];
int index = 0;
allArgs[index++] = keyspace;
allArgs[index++] = uid;
allArgs[index++] = serviceCode;
for (int i = 0; i < key.length; i++) {
allArgs[index++] = key[i];
}
return allArgs;
} } | public class class_name {
private byte[][] toByteArrays(final byte[] keyspace, final byte[] uid, final byte[] serviceCode, final byte[][] key) {
final byte[][] allArgs = new byte[key.length + 3][];
int index = 0;
allArgs[index++] = keyspace;
allArgs[index++] = uid;
allArgs[index++] = serviceCode;
for (int i = 0; i < key.length; i++) {
allArgs[index++] = key[i]; // depends on control dependency: [for], data = [i]
}
return allArgs;
} } |
public class class_name {
public PhaseIdType[] getDefaultPhases(String viewId) {
PhaseIdType[] defaultPhases = null;
RestrictAtPhase restrictAtPhase = viewConfigStore.getAnnotationData(viewId, RestrictAtPhase.class);
if (restrictAtPhase != null) {
defaultPhases = restrictAtPhase.value();
}
if (defaultPhases == null) {
defaultPhases = RestrictAtPhaseDefault.DEFAULT_PHASES;
}
return defaultPhases;
} } | public class class_name {
public PhaseIdType[] getDefaultPhases(String viewId) {
PhaseIdType[] defaultPhases = null;
RestrictAtPhase restrictAtPhase = viewConfigStore.getAnnotationData(viewId, RestrictAtPhase.class);
if (restrictAtPhase != null) {
defaultPhases = restrictAtPhase.value(); // depends on control dependency: [if], data = [none]
}
if (defaultPhases == null) {
defaultPhases = RestrictAtPhaseDefault.DEFAULT_PHASES; // depends on control dependency: [if], data = [none]
}
return defaultPhases;
} } |
public class class_name {
public static String[] getDataTypesId()
{
Set<String> dataTypeIds = new HashSet<String>();
for(Datatype datatype : miriam.getDatatype()) {
dataTypeIds.add(datatype.getId());
}
return dataTypeIds.toArray(new String[] {});
} } | public class class_name {
public static String[] getDataTypesId()
{
Set<String> dataTypeIds = new HashSet<String>();
for(Datatype datatype : miriam.getDatatype()) {
dataTypeIds.add(datatype.getId()); // depends on control dependency: [for], data = [datatype]
}
return dataTypeIds.toArray(new String[] {});
} } |
public class class_name {
public static CurrencyFunction currency(Field field, @Nullable String currencyCode) {
Assert.notNull(field, "Field for currency function must not be 'null'.");
CurrencyFunction function = new CurrencyFunction(field);
if (StringUtils.hasText(currencyCode)) {
function.addArgument(currencyCode);
}
return function;
} } | public class class_name {
public static CurrencyFunction currency(Field field, @Nullable String currencyCode) {
Assert.notNull(field, "Field for currency function must not be 'null'.");
CurrencyFunction function = new CurrencyFunction(field);
if (StringUtils.hasText(currencyCode)) {
function.addArgument(currencyCode); // depends on control dependency: [if], data = [none]
}
return function;
} } |
public class class_name {
private static void balbak(DenseMatrix V, double[] scale) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V.mul(i, j, scale[i]);
}
}
} } | public class class_name {
private static void balbak(DenseMatrix V, double[] scale) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V.mul(i, j, scale[i]); // depends on control dependency: [for], data = [j]
}
}
} } |
public class class_name {
public EClass getIfcRelConnectsWithRealizingElements() {
if (ifcRelConnectsWithRealizingElementsEClass == null) {
ifcRelConnectsWithRealizingElementsEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(465);
}
return ifcRelConnectsWithRealizingElementsEClass;
} } | public class class_name {
public EClass getIfcRelConnectsWithRealizingElements() {
if (ifcRelConnectsWithRealizingElementsEClass == null) {
ifcRelConnectsWithRealizingElementsEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(465);
// depends on control dependency: [if], data = [none]
}
return ifcRelConnectsWithRealizingElementsEClass;
} } |
public class class_name {
@Trivial
private boolean deleteAll(File rootFile) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Delete [ " + rootFile.getAbsolutePath() + " ]");
}
if ( FileUtils.fileIsFile(rootFile) ) {
boolean didDelete = FileUtils.fileDelete(rootFile);
if ( !didDelete ) {
Tr.error(tc, "Could not delete file [ " + rootFile.getAbsolutePath() + " ]");
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted");
}
}
return didDelete;
} else {
boolean didDeleteAll = true;
int deleteCount = 0;
File childFiles[] = FileUtils.listFiles(rootFile);
int childCount;
if ( childFiles != null ) {
childCount = childFiles.length;
for ( File childFile : childFiles ) {
// Keep iterating even if one of the deletes fails.
// Delete as much as possible.
if ( !deleteAll(childFile) ) {
didDeleteAll = false;
} else {
deleteCount++;
}
}
} else {
childCount = 0;
deleteCount = 0;
}
if ( didDeleteAll ) {
didDeleteAll = FileUtils.fileDelete(rootFile);
}
if ( !didDeleteAll ) {
Tr.error(tc, "Could not delete directory [ " + rootFile.getAbsolutePath() + " ]");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted [ " + Integer.valueOf(deleteCount) + " ]" +
" of [ " + Integer.valueOf(childCount) + " ]");
}
return didDeleteAll;
}
} } | public class class_name {
@Trivial
private boolean deleteAll(File rootFile) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Delete [ " + rootFile.getAbsolutePath() + " ]"); // depends on control dependency: [if], data = [none]
}
if ( FileUtils.fileIsFile(rootFile) ) {
boolean didDelete = FileUtils.fileDelete(rootFile);
if ( !didDelete ) {
Tr.error(tc, "Could not delete file [ " + rootFile.getAbsolutePath() + " ]"); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted"); // depends on control dependency: [if], data = [none]
}
}
return didDelete; // depends on control dependency: [if], data = [none]
} else {
boolean didDeleteAll = true;
int deleteCount = 0;
File childFiles[] = FileUtils.listFiles(rootFile);
int childCount;
if ( childFiles != null ) {
childCount = childFiles.length; // depends on control dependency: [if], data = [none]
for ( File childFile : childFiles ) {
// Keep iterating even if one of the deletes fails.
// Delete as much as possible.
if ( !deleteAll(childFile) ) {
didDeleteAll = false; // depends on control dependency: [if], data = [none]
} else {
deleteCount++; // depends on control dependency: [if], data = [none]
}
}
} else {
childCount = 0; // depends on control dependency: [if], data = [none]
deleteCount = 0; // depends on control dependency: [if], data = [none]
}
if ( didDeleteAll ) {
didDeleteAll = FileUtils.fileDelete(rootFile); // depends on control dependency: [if], data = [none]
}
if ( !didDeleteAll ) {
Tr.error(tc, "Could not delete directory [ " + rootFile.getAbsolutePath() + " ]"); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
Tr.debug(tc, "Deleted [ " + Integer.valueOf(deleteCount) + " ]" +
" of [ " + Integer.valueOf(childCount) + " ]"); // depends on control dependency: [if], data = [none]
}
return didDeleteAll; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean check100Continue() {
// if the request wasn't expecting the 100 continue, just return now
if (!getRequest().isExpect100Continue()) {
return true;
}
// if the channel stopped while we parsed this Expect request, we want
// to send an error to close the connection and avoid the body transfer
// PK12235, check for a full stop only
if (this.myLink.getChannel().isStopped()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Channel stopped, sending error instead of 100-continue");
}
try {
sendError(StatusCodes.UNAVAILABLE.getHttpError());
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".check100Continue", "1206");
}
return false;
}
// if we're running on the SR for z/OS, never send the 100-continue
// response no matter what the request says
if (getHttpConfig().isServantRegion()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "100 continue not sent on SR");
}
return true;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Request contains [Expect: 100-continue]");
}
if (getHttpConfig().getDebugLog().isEnabled(DebugLog.Level.DEBUG)) {
getHttpConfig().getDebugLog().log(DebugLog.Level.DEBUG, HttpMessages.MSG_CONN_EXPECT100, this);
}
// send the 100 Continue response synchronously since it should not
// take that long to dump a single buffer out
HttpResponseMessageImpl msg = getResponseImpl();
msg.setStatusCode(StatusCodes.CONTINUE);
msg.setContentLength(0);
VirtualConnection vc = sendHeaders(msg, Http100ContWriteCallback.getRef());
if (null == vc) {
// writing async
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Async write of 100 continue still going");
}
return false;
}
// reset the values on the response message
resetMsgSentState();
msg.setStatusCode(StatusCodes.OK);
// 366388
msg.removeHeader(HttpHeaderKeys.HDR_CONTENT_LENGTH);
return true;
} } | public class class_name {
protected boolean check100Continue() {
// if the request wasn't expecting the 100 continue, just return now
if (!getRequest().isExpect100Continue()) {
return true; // depends on control dependency: [if], data = [none]
}
// if the channel stopped while we parsed this Expect request, we want
// to send an error to close the connection and avoid the body transfer
// PK12235, check for a full stop only
if (this.myLink.getChannel().isStopped()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Channel stopped, sending error instead of 100-continue"); // depends on control dependency: [if], data = [none]
}
try {
sendError(StatusCodes.UNAVAILABLE.getHttpError()); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
FFDCFilter.processException(t, CLASS_NAME + ".check100Continue", "1206");
} // depends on control dependency: [catch], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// if we're running on the SR for z/OS, never send the 100-continue
// response no matter what the request says
if (getHttpConfig().isServantRegion()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "100 continue not sent on SR"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Request contains [Expect: 100-continue]"); // depends on control dependency: [if], data = [none]
}
if (getHttpConfig().getDebugLog().isEnabled(DebugLog.Level.DEBUG)) {
getHttpConfig().getDebugLog().log(DebugLog.Level.DEBUG, HttpMessages.MSG_CONN_EXPECT100, this); // depends on control dependency: [if], data = [none]
}
// send the 100 Continue response synchronously since it should not
// take that long to dump a single buffer out
HttpResponseMessageImpl msg = getResponseImpl();
msg.setStatusCode(StatusCodes.CONTINUE);
msg.setContentLength(0);
VirtualConnection vc = sendHeaders(msg, Http100ContWriteCallback.getRef());
if (null == vc) {
// writing async
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Async write of 100 continue still going"); // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
// reset the values on the response message
resetMsgSentState();
msg.setStatusCode(StatusCodes.OK);
// 366388
msg.removeHeader(HttpHeaderKeys.HDR_CONTENT_LENGTH);
return true;
} } |
public class class_name {
public void marshall(ModifyEventSubscriptionRequest modifyEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyEventSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING);
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSnsTopicArn(), SNSTOPICARN_BINDING);
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getEventCategories(), EVENTCATEGORIES_BINDING);
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getEnabled(), ENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ModifyEventSubscriptionRequest modifyEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyEventSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSnsTopicArn(), SNSTOPICARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getSourceType(), SOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getEventCategories(), EVENTCATEGORIES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyEventSubscriptionRequest.getEnabled(), ENABLED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public synchronized OServerAdmin createDatabase(final String iDatabaseType, String iStorageMode) throws IOException {
storage.checkConnection();
try {
if (storage.getName() == null || storage.getName().length() <= 0) {
OLogManager.instance().error(this, "Cannot create unnamed remote storage. Check your syntax", OStorageException.class);
} else {
if (iStorageMode == null)
iStorageMode = "csv";
final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE);
try {
network.writeString(storage.getName());
if (network.getSrvProtocolVersion() >= 8)
network.writeString(iDatabaseType);
network.writeString(iStorageMode);
} finally {
storage.endRequest(network);
}
storage.getResponse(network);
}
} catch (Exception e) {
OLogManager.instance().error(this, "Cannot create the remote storage: " + storage.getName(), e, OStorageException.class);
storage.close(true);
}
return this;
} } | public class class_name {
public synchronized OServerAdmin createDatabase(final String iDatabaseType, String iStorageMode) throws IOException {
storage.checkConnection();
try {
if (storage.getName() == null || storage.getName().length() <= 0) {
OLogManager.instance().error(this, "Cannot create unnamed remote storage. Check your syntax", OStorageException.class);
// depends on control dependency: [if], data = [none]
} else {
if (iStorageMode == null)
iStorageMode = "csv";
final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE);
try {
network.writeString(storage.getName());
// depends on control dependency: [try], data = [none]
if (network.getSrvProtocolVersion() >= 8)
network.writeString(iDatabaseType);
network.writeString(iStorageMode);
// depends on control dependency: [try], data = [none]
} finally {
storage.endRequest(network);
}
storage.getResponse(network);
// depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
OLogManager.instance().error(this, "Cannot create the remote storage: " + storage.getName(), e, OStorageException.class);
storage.close(true);
}
// depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
public void registerAll(Iterable<? extends CompositeStateHandle> stateHandles) {
if (stateHandles == null) {
return;
}
synchronized (registeredStates) {
for (CompositeStateHandle stateHandle : stateHandles) {
stateHandle.registerSharedStates(this);
}
}
} } | public class class_name {
public void registerAll(Iterable<? extends CompositeStateHandle> stateHandles) {
if (stateHandles == null) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (registeredStates) {
for (CompositeStateHandle stateHandle : stateHandles) {
stateHandle.registerSharedStates(this); // depends on control dependency: [for], data = [stateHandle]
}
}
} } |
public class class_name {
protected HttpResponse doRequestWithAuthorization(HttpClient httpclient,
RequestBuilder requestBuilder,
Map<String, Object> params,
AuthenticationType type) {
// no authorization
if (type == null || type == AuthenticationType.NONE) {
HttpUriRequest request = requestBuilder.build();
try {
return httpclient.execute(request);
} catch (Exception e) {
throw new RuntimeException("Could not execute request [" + request.getMethod() + "] " + request.getURI(),
e);
}
}
// user/password
String u = (String) params.get(PARAM_USERNAME);
String p = (String) params.get(PARAM_PASSWORD);
if (u == null || p == null) {
u = this.username;
p = this.password;
}
if (u == null) {
throw new IllegalArgumentException("Could not find username");
}
if (p == null) {
throw new IllegalArgumentException("Could not find password");
}
if (type == AuthenticationType.BASIC) {
// basic auth
URI requestUri = requestBuilder.getUri();
HttpHost targetHost = new HttpHost(requestUri.getHost(),
requestUri.getPort(),
requestUri.getScheme());
// Create AuthCache instance and add it: so that HttpClient thinks that it has already queried (as per the HTTP spec)
// - generate BASIC scheme object and add it to the local auth cache
AuthCache authCache = new BasicAuthCache();
BasicScheme basicAuth = new BasicScheme();
authCache.put(targetHost,
basicAuth);
// - add AuthCache to the execution context:
HttpClientContext clientContext = HttpClientContext.create();
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
// specify host and port, since that is safer/more secure
new AuthScope(requestUri.getHost(),
requestUri.getPort(),
AuthScope.ANY_REALM),
new UsernamePasswordCredentials(u,
p)
);
clientContext.setCredentialsProvider(credsProvider);
clientContext.setAuthCache(authCache);
// - execute request
HttpUriRequest request = requestBuilder.build();
try {
return httpclient.execute(targetHost,
request,
clientContext);
} catch (Exception e) {
throw new RuntimeException("Could not execute request with preemptive authentication [" + request.getMethod() + "] " + request.getURI(),
e);
}
} else if (type == AuthenticationType.FORM_BASED) {
// form auth
// 1. do initial request to trigger authentication
HttpUriRequest request = requestBuilder.build();
int statusCode = -1;
try {
HttpResponse initialResponse = httpclient.execute(request);
statusCode = initialResponse.getStatusLine().getStatusCode();
} catch (IOException e) {
throw new RuntimeException("Could not execute request for form-based authentication",
e);
} finally {
// weird, but this is the method that releases resources, including the connection
request.abort();
}
// 1b. form authentication requests should have a status of 401
// See: www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
if (statusCode != HttpStatus.SC_UNAUTHORIZED) {
logger.error("Expected form authentication request with status {} but status on response is {}: proceeding anyways",
HttpStatus.SC_UNAUTHORIZED,
statusCode);
}
// 2. do POST form request to authentiate
String authUrlStr = (String) params.get(PARAM_AUTHURL);
if (authUrlStr == null) {
authUrlStr = authUrl;
}
if (authUrlStr == null) {
throw new IllegalArgumentException("Could not find authentication url");
}
HttpPost authMethod = new HttpPost(authUrlStr);
List<NameValuePair> formParams = new ArrayList<NameValuePair>(2);
formParams.add(new BasicNameValuePair("j_username",
u));
formParams.add(new BasicNameValuePair("j_password",
p));
UrlEncodedFormEntity formEntity;
try {
formEntity = new UrlEncodedFormEntity(formParams);
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("Could not encode authentication parameters into request body",
uee);
}
authMethod.setEntity(formEntity);
try {
httpclient.execute(authMethod);
} catch (IOException e) {
throw new RuntimeException("Could not initialize form-based authentication",
e);
} finally {
authMethod.releaseConnection();
}
// 3. rebuild request and execute
request = requestBuilder.build();
try {
return httpclient.execute(request);
} catch (Exception e) {
throw new RuntimeException("Could not execute request [" + request.getMethod() + "] " + request.getURI(),
e);
}
} else {
throw new RuntimeException("Unknown AuthenticationType " + type);
}
} } | public class class_name {
protected HttpResponse doRequestWithAuthorization(HttpClient httpclient,
RequestBuilder requestBuilder,
Map<String, Object> params,
AuthenticationType type) {
// no authorization
if (type == null || type == AuthenticationType.NONE) {
HttpUriRequest request = requestBuilder.build();
try {
return httpclient.execute(request); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Could not execute request [" + request.getMethod() + "] " + request.getURI(),
e);
} // depends on control dependency: [catch], data = [none]
}
// user/password
String u = (String) params.get(PARAM_USERNAME);
String p = (String) params.get(PARAM_PASSWORD);
if (u == null || p == null) {
u = this.username; // depends on control dependency: [if], data = [none]
p = this.password; // depends on control dependency: [if], data = [none]
}
if (u == null) {
throw new IllegalArgumentException("Could not find username");
}
if (p == null) {
throw new IllegalArgumentException("Could not find password");
}
if (type == AuthenticationType.BASIC) {
// basic auth
URI requestUri = requestBuilder.getUri();
HttpHost targetHost = new HttpHost(requestUri.getHost(),
requestUri.getPort(),
requestUri.getScheme());
// Create AuthCache instance and add it: so that HttpClient thinks that it has already queried (as per the HTTP spec)
// - generate BASIC scheme object and add it to the local auth cache
AuthCache authCache = new BasicAuthCache();
BasicScheme basicAuth = new BasicScheme();
authCache.put(targetHost,
basicAuth); // depends on control dependency: [if], data = [none]
// - add AuthCache to the execution context:
HttpClientContext clientContext = HttpClientContext.create();
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
// specify host and port, since that is safer/more secure
new AuthScope(requestUri.getHost(),
requestUri.getPort(),
AuthScope.ANY_REALM),
new UsernamePasswordCredentials(u,
p)
); // depends on control dependency: [if], data = [none]
clientContext.setCredentialsProvider(credsProvider); // depends on control dependency: [if], data = [none]
clientContext.setAuthCache(authCache); // depends on control dependency: [if], data = [none]
// - execute request
HttpUriRequest request = requestBuilder.build();
try {
return httpclient.execute(targetHost,
request,
clientContext); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Could not execute request with preemptive authentication [" + request.getMethod() + "] " + request.getURI(),
e);
} // depends on control dependency: [catch], data = [none]
} else if (type == AuthenticationType.FORM_BASED) {
// form auth
// 1. do initial request to trigger authentication
HttpUriRequest request = requestBuilder.build();
int statusCode = -1;
try {
HttpResponse initialResponse = httpclient.execute(request);
statusCode = initialResponse.getStatusLine().getStatusCode(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Could not execute request for form-based authentication",
e);
} finally { // depends on control dependency: [catch], data = [none]
// weird, but this is the method that releases resources, including the connection
request.abort();
}
// 1b. form authentication requests should have a status of 401
// See: www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
if (statusCode != HttpStatus.SC_UNAUTHORIZED) {
logger.error("Expected form authentication request with status {} but status on response is {}: proceeding anyways",
HttpStatus.SC_UNAUTHORIZED,
statusCode); // depends on control dependency: [if], data = [none]
}
// 2. do POST form request to authentiate
String authUrlStr = (String) params.get(PARAM_AUTHURL);
if (authUrlStr == null) {
authUrlStr = authUrl; // depends on control dependency: [if], data = [none]
}
if (authUrlStr == null) {
throw new IllegalArgumentException("Could not find authentication url");
}
HttpPost authMethod = new HttpPost(authUrlStr);
List<NameValuePair> formParams = new ArrayList<NameValuePair>(2);
formParams.add(new BasicNameValuePair("j_username",
u)); // depends on control dependency: [if], data = [none]
formParams.add(new BasicNameValuePair("j_password",
p)); // depends on control dependency: [if], data = [none]
UrlEncodedFormEntity formEntity;
try {
formEntity = new UrlEncodedFormEntity(formParams); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("Could not encode authentication parameters into request body",
uee);
} // depends on control dependency: [catch], data = [none]
authMethod.setEntity(formEntity); // depends on control dependency: [if], data = [none]
try {
httpclient.execute(authMethod); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Could not initialize form-based authentication",
e);
} finally { // depends on control dependency: [catch], data = [none]
authMethod.releaseConnection();
}
// 3. rebuild request and execute
request = requestBuilder.build(); // depends on control dependency: [if], data = [none]
try {
return httpclient.execute(request); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Could not execute request [" + request.getMethod() + "] " + request.getURI(),
e);
} // depends on control dependency: [catch], data = [none]
} else {
throw new RuntimeException("Unknown AuthenticationType " + type);
}
} } |
public class class_name {
public static <T, D, A> Collector<T, ?, Map<Boolean, D>> partitioningBy(Predicate<? super T> predicate,
Collector<? super T, A, D> downstream) {
Predicate<A> finished = finished(downstream);
if (finished != null) {
BiConsumer<A, ? super T> accumulator = downstream.accumulator();
return BooleanMap.partialCollector(downstream).asCancellable((map, t) -> accumulator.accept(predicate.test(
t) ? map.trueValue : map.falseValue, t), map -> finished.test(map.trueValue) && finished.test(
map.falseValue));
}
return Collectors.partitioningBy(predicate, downstream);
} } | public class class_name {
public static <T, D, A> Collector<T, ?, Map<Boolean, D>> partitioningBy(Predicate<? super T> predicate,
Collector<? super T, A, D> downstream) {
Predicate<A> finished = finished(downstream);
if (finished != null) {
BiConsumer<A, ? super T> accumulator = downstream.accumulator();
return BooleanMap.partialCollector(downstream).asCancellable((map, t) -> accumulator.accept(predicate.test(
t) ? map.trueValue : map.falseValue, t), map -> finished.test(map.trueValue) && finished.test(
map.falseValue));
// depends on control dependency: [if], data = [none]
}
return Collectors.partitioningBy(predicate, downstream);
} } |
public class class_name {
@Override
public SourcePosition map( SourcePosition p ) throws IOException
{
SourcePosition result = null;
File generatedFile = p.getFile();
if ( generatedFile != null && generatedFile.isFile() )
{
String[] generatedFileLines = readFileAsString( generatedFile ).split( "\n" );
if ( generatedFileLines[0].startsWith( Play2RoutesGeneratedSource.SOURCE_PREFIX ) // play 2.2.x - 2.3.x
|| Arrays.asList( generatedFileLines ).contains( GENERATOR_LINE ) ) // play 2.4.x +
{
Play2RoutesGeneratedSource generatedSource = new Play2RoutesGeneratedSource( generatedFileLines );
String sourceFileName = generatedSource.getSourceFileName();
if ( sourceFileName != null )
{
File sourceFile = new File( sourceFileName );
if ( sourceFile.isFile() )
{
int sourceLine = generatedSource.mapLine( p.getLine() );
String[] sourceFileLines = readFileAsString( sourceFile ).split( "\n" );
if ( sourceFileLines.length >= sourceLine )
{
String sourceLineContent = sourceFileLines[sourceLine - 1];
if ( sourceLineContent.endsWith( "\r" ) ) // remove trailing CR (on Windows)
{
sourceLineContent = sourceLineContent.substring( 0, sourceLineContent.length() - 1 );
}
result = new Play2RoutesSourcePosition( sourceLine, sourceLineContent, sourceFile );
}
}
}
}
}
return result;
} } | public class class_name {
@Override
public SourcePosition map( SourcePosition p ) throws IOException
{
SourcePosition result = null;
File generatedFile = p.getFile();
if ( generatedFile != null && generatedFile.isFile() )
{
String[] generatedFileLines = readFileAsString( generatedFile ).split( "\n" );
if ( generatedFileLines[0].startsWith( Play2RoutesGeneratedSource.SOURCE_PREFIX ) // play 2.2.x - 2.3.x
|| Arrays.asList( generatedFileLines ).contains( GENERATOR_LINE ) ) // play 2.4.x +
{
Play2RoutesGeneratedSource generatedSource = new Play2RoutesGeneratedSource( generatedFileLines );
String sourceFileName = generatedSource.getSourceFileName();
if ( sourceFileName != null )
{
File sourceFile = new File( sourceFileName );
if ( sourceFile.isFile() )
{
int sourceLine = generatedSource.mapLine( p.getLine() );
String[] sourceFileLines = readFileAsString( sourceFile ).split( "\n" );
if ( sourceFileLines.length >= sourceLine )
{
String sourceLineContent = sourceFileLines[sourceLine - 1];
if ( sourceLineContent.endsWith( "\r" ) ) // remove trailing CR (on Windows)
{
sourceLineContent = sourceLineContent.substring( 0, sourceLineContent.length() - 1 ); // depends on control dependency: [if], data = [none]
}
result = new Play2RoutesSourcePosition( sourceLine, sourceLineContent, sourceFile ); // depends on control dependency: [if], data = [none]
}
}
}
}
}
return result;
} } |
public class class_name {
public int findRegion(int idx) {
for (int i = 0; i < populationSize; i++) {
if (subregionIdx[i][idx] == 1) {
return i;
}
}
return -1;
} } | public class class_name {
public int findRegion(int idx) {
for (int i = 0; i < populationSize; i++) {
if (subregionIdx[i][idx] == 1) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
private void attachEvents(Action a, JSONObject in) throws JSONConverterException {
if (in.containsKey(HOOK_LABEL)) {
JSONObject hooks = (JSONObject) in.get(HOOK_LABEL);
for (Map.Entry<String, Object> e : hooks.entrySet()) {
String k = e.getKey();
try {
Action.Hook h = Action.Hook.valueOf(k.toUpperCase());
for (Object o : (JSONArray) e.getValue()) {
a.addEvent(h, eventFromJSON((JSONObject) o));
}
} catch (IllegalArgumentException ex) {
throw new JSONConverterException("Unsupported hook type '" + k + "'", ex);
}
}
}
} } | public class class_name {
private void attachEvents(Action a, JSONObject in) throws JSONConverterException {
if (in.containsKey(HOOK_LABEL)) {
JSONObject hooks = (JSONObject) in.get(HOOK_LABEL);
for (Map.Entry<String, Object> e : hooks.entrySet()) {
String k = e.getKey();
try {
Action.Hook h = Action.Hook.valueOf(k.toUpperCase());
for (Object o : (JSONArray) e.getValue()) {
a.addEvent(h, eventFromJSON((JSONObject) o)); // depends on control dependency: [for], data = [o]
}
} catch (IllegalArgumentException ex) {
throw new JSONConverterException("Unsupported hook type '" + k + "'", ex);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public static String findEscapedSpaceWordCloseToEnd(String text) {
int index;
String originalText = text;
while ((index = text.lastIndexOf(SPACE)) > -1) {
if (index > 0 && text.charAt(index - 1) == BACK_SLASH) {
text = text.substring(0, index - 1);
}
else
return originalText.substring(index + 1);
}
return originalText;
} } | public class class_name {
public static String findEscapedSpaceWordCloseToEnd(String text) {
int index;
String originalText = text;
while ((index = text.lastIndexOf(SPACE)) > -1) {
if (index > 0 && text.charAt(index - 1) == BACK_SLASH) {
text = text.substring(0, index - 1); // depends on control dependency: [if], data = [none]
}
else
return originalText.substring(index + 1);
}
return originalText;
} } |
public class class_name {
public static double[] getMinMax(IAtomContainer container) {
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
for (int i = 0; i < container.getAtomCount(); i++) {
IAtom atom = container.getAtom(i);
if (atom.getPoint2d() != null) {
if (atom.getPoint2d().x > maxX) {
maxX = atom.getPoint2d().x;
}
if (atom.getPoint2d().x < minX) {
minX = atom.getPoint2d().x;
}
if (atom.getPoint2d().y > maxY) {
maxY = atom.getPoint2d().y;
}
if (atom.getPoint2d().y < minY) {
minY = atom.getPoint2d().y;
}
}
}
double[] minmax = new double[4];
minmax[0] = minX;
minmax[1] = minY;
minmax[2] = maxX;
minmax[3] = maxY;
return minmax;
} } | public class class_name {
public static double[] getMinMax(IAtomContainer container) {
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
for (int i = 0; i < container.getAtomCount(); i++) {
IAtom atom = container.getAtom(i);
if (atom.getPoint2d() != null) {
if (atom.getPoint2d().x > maxX) {
maxX = atom.getPoint2d().x; // depends on control dependency: [if], data = [none]
}
if (atom.getPoint2d().x < minX) {
minX = atom.getPoint2d().x; // depends on control dependency: [if], data = [none]
}
if (atom.getPoint2d().y > maxY) {
maxY = atom.getPoint2d().y; // depends on control dependency: [if], data = [none]
}
if (atom.getPoint2d().y < minY) {
minY = atom.getPoint2d().y; // depends on control dependency: [if], data = [none]
}
}
}
double[] minmax = new double[4];
minmax[0] = minX;
minmax[1] = minY;
minmax[2] = maxX;
minmax[3] = maxY;
return minmax;
} } |
public class class_name {
public IAsyncFuture write(ByteBuffer[] bufs, long timeout,
boolean forceQueue, long bytesRequested, VirtualConnection vci,
boolean asyncIO) {
if (timeout < 0) {
throw new IllegalArgumentException();
}
IAsyncFuture future = write(bufs, forceQueue, bytesRequested,
vci, asyncIO);
// don't lock the getCompletedSemaphore here, wait till later
if (future != null && !future.isCompleted() && timeout > 0) {
createTimeout(future, timeout, false);
}
return future;
} } | public class class_name {
public IAsyncFuture write(ByteBuffer[] bufs, long timeout,
boolean forceQueue, long bytesRequested, VirtualConnection vci,
boolean asyncIO) {
if (timeout < 0) {
throw new IllegalArgumentException();
}
IAsyncFuture future = write(bufs, forceQueue, bytesRequested,
vci, asyncIO);
// don't lock the getCompletedSemaphore here, wait till later
if (future != null && !future.isCompleted() && timeout > 0) {
createTimeout(future, timeout, false); // depends on control dependency: [if], data = [(future]
}
return future;
} } |
public class class_name {
BusItineraryHalt addBusHalt(UUID id, String name, BusItineraryHaltType type, int insertToIndex) {
String haltName = name;
if (haltName == null || "".equals(haltName)) { //$NON-NLS-1$
haltName = BusItineraryHalt.getFirstFreeBushaltName(this);
assert haltName != null && !"".equals(haltName); //$NON-NLS-1$
}
final BusItineraryHalt halt;
if (id == null) {
halt = new BusItineraryHalt(this, haltName, type);
} else {
halt = new BusItineraryHalt(id, this, haltName, type);
}
if (addBusHalt(halt, insertToIndex)) {
return halt;
}
return null;
} } | public class class_name {
BusItineraryHalt addBusHalt(UUID id, String name, BusItineraryHaltType type, int insertToIndex) {
String haltName = name;
if (haltName == null || "".equals(haltName)) { //$NON-NLS-1$
haltName = BusItineraryHalt.getFirstFreeBushaltName(this); // depends on control dependency: [if], data = [none]
assert haltName != null && !"".equals(haltName); //$NON-NLS-1$ // depends on control dependency: [if], data = [(haltName]
}
final BusItineraryHalt halt;
if (id == null) {
halt = new BusItineraryHalt(this, haltName, type); // depends on control dependency: [if], data = [none]
} else {
halt = new BusItineraryHalt(id, this, haltName, type); // depends on control dependency: [if], data = [(id]
}
if (addBusHalt(halt, insertToIndex)) {
return halt; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static String getPathForResource(final String resourcePath) {
URL path = ResourceUtil.class.getResource(resourcePath);
if (path == null) {
path = ResourceUtil.class.getResource("/");
File tmpFile = new File(path.getPath(), resourcePath);
return tmpFile.getPath();
}
return path.getPath();
} } | public class class_name {
public static String getPathForResource(final String resourcePath) {
URL path = ResourceUtil.class.getResource(resourcePath);
if (path == null) {
path = ResourceUtil.class.getResource("/"); // depends on control dependency: [if], data = [none]
File tmpFile = new File(path.getPath(), resourcePath);
return tmpFile.getPath(); // depends on control dependency: [if], data = [none]
}
return path.getPath();
} } |
public class class_name {
public Observable<ServiceResponse<SyncAgentKeyPropertiesInner>> generateKeyWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (syncAgentName == null) {
throw new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.generateKey(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SyncAgentKeyPropertiesInner>>>() {
@Override
public Observable<ServiceResponse<SyncAgentKeyPropertiesInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<SyncAgentKeyPropertiesInner> clientResponse = generateKeyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<SyncAgentKeyPropertiesInner>> generateKeyWithServiceResponseAsync(String resourceGroupName, String serverName, String syncAgentName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (syncAgentName == null) {
throw new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.generateKey(resourceGroupName, serverName, syncAgentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<SyncAgentKeyPropertiesInner>>>() {
@Override
public Observable<ServiceResponse<SyncAgentKeyPropertiesInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<SyncAgentKeyPropertiesInner> clientResponse = generateKeyDelegate(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 {
protected void addPackageInfo(PackageInfo packageInfo) {
if (packageInfo != null) {
packageInfoMap.put(packageInfo.getInternalPackageName(), packageInfo);
}
} } | public class class_name {
protected void addPackageInfo(PackageInfo packageInfo) {
if (packageInfo != null) {
packageInfoMap.put(packageInfo.getInternalPackageName(), packageInfo); // depends on control dependency: [if], data = [(packageInfo]
}
} } |
public class class_name {
protected boolean isLikelyAValidConstraintBound(JvmTypeReference constraintBound) {
if (constraintBound == null)
return true;
if (constraintBound instanceof JvmSpecializedTypeReference) {
JvmTypeReference equivalent = (JvmTypeReference) constraintBound.eGet(TypesPackage.Literals.JVM_SPECIALIZED_TYPE_REFERENCE__EQUIVALENT, false);
if (equivalent != null) {
return isLikelyAValidConstraintBound(equivalent);
}
return true;
}
boolean invalid = (constraintBound.getType() instanceof JvmPrimitiveType
|| (constraintBound.getType() instanceof JvmVoid && !constraintBound.getType().eIsProxy()));
return !invalid;
} } | public class class_name {
protected boolean isLikelyAValidConstraintBound(JvmTypeReference constraintBound) {
if (constraintBound == null)
return true;
if (constraintBound instanceof JvmSpecializedTypeReference) {
JvmTypeReference equivalent = (JvmTypeReference) constraintBound.eGet(TypesPackage.Literals.JVM_SPECIALIZED_TYPE_REFERENCE__EQUIVALENT, false);
if (equivalent != null) {
return isLikelyAValidConstraintBound(equivalent); // depends on control dependency: [if], data = [(equivalent]
}
return true; // depends on control dependency: [if], data = [none]
}
boolean invalid = (constraintBound.getType() instanceof JvmPrimitiveType
|| (constraintBound.getType() instanceof JvmVoid && !constraintBound.getType().eIsProxy()));
return !invalid;
} } |
public class class_name {
@SuppressWarnings("all")
protected static boolean writeArrayType(Output out, Object arrType) {
log.trace("writeArrayType");
if (arrType instanceof Collection) {
out.writeArray((Collection<Object>) arrType);
} else if (arrType instanceof Iterator) {
writeIterator(out, (Iterator<Object>) arrType);
} else if (arrType.getClass().isArray() && arrType.getClass().getComponentType().isPrimitive()) {
out.writeArray(arrType);
} else if (arrType instanceof Object[]) {
out.writeArray((Object[]) arrType);
} else {
return false;
}
return true;
} } | public class class_name {
@SuppressWarnings("all")
protected static boolean writeArrayType(Output out, Object arrType) {
log.trace("writeArrayType");
if (arrType instanceof Collection) {
out.writeArray((Collection<Object>) arrType); // depends on control dependency: [if], data = [none]
} else if (arrType instanceof Iterator) {
writeIterator(out, (Iterator<Object>) arrType); // depends on control dependency: [if], data = [none]
} else if (arrType.getClass().isArray() && arrType.getClass().getComponentType().isPrimitive()) {
out.writeArray(arrType); // depends on control dependency: [if], data = [none]
} else if (arrType instanceof Object[]) {
out.writeArray((Object[]) arrType); // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void marshall(DeleteFacetRequest deleteFacetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteFacetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteFacetRequest.getSchemaArn(), SCHEMAARN_BINDING);
protocolMarshaller.marshall(deleteFacetRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteFacetRequest deleteFacetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteFacetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteFacetRequest.getSchemaArn(), SCHEMAARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteFacetRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void printDebug(final Properties pProperties, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
if (pProperties == null) {
pPrintStream.println(PROPERTIES_IS_NULL_ERROR_MESSAGE);
return;
} else if (pProperties.isEmpty()) {
pPrintStream.println(PROPERTIES_IS_EMPTY_ERROR_MESSAGE);
return;
}
for (Enumeration e = pProperties.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
pPrintStream.println(key + ": " + pProperties.getProperty(key));
}
} } | public class class_name {
public static void printDebug(final Properties pProperties, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
if (pProperties == null) {
pPrintStream.println(PROPERTIES_IS_NULL_ERROR_MESSAGE);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
} else if (pProperties.isEmpty()) {
pPrintStream.println(PROPERTIES_IS_EMPTY_ERROR_MESSAGE);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
for (Enumeration e = pProperties.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
pPrintStream.println(key + ": " + pProperties.getProperty(key));
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public boolean hasExtension(String elementName, String namespace) {
if (elementName == null) {
return hasExtension(namespace);
}
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.containsKey(key);
}
} } | public class class_name {
public boolean hasExtension(String elementName, String namespace) {
if (elementName == null) {
return hasExtension(namespace); // depends on control dependency: [if], data = [none]
}
String key = XmppStringUtils.generateKey(elementName, namespace);
synchronized (packetExtensions) {
return packetExtensions.containsKey(key);
}
} } |
public class class_name {
@Override
int guessPayloadLength() {
int length = 0;
byte[] payload = getDataFromPayload();
if (payload != null) {
length = payload.length + 24;
}
return length;
} } | public class class_name {
@Override
int guessPayloadLength() {
int length = 0;
byte[] payload = getDataFromPayload();
if (payload != null) {
length = payload.length + 24; // depends on control dependency: [if], data = [none]
}
return length;
} } |
public class class_name {
protected void updateBucketAndReturn(final String id, final RateLimiterBucket bucket,
final RateLimitResponse rlr, final long version, final String bucketId,
final RateBucketPeriod period, final long limit, final long increment,
final IAsyncResultHandler<RateLimitResponse> handler) {
Index.Builder builder = new Index.Builder(bucket).refresh(false).index(getIndexName());
if (version>0) {
builder.setParameter(Parameters.VERSION, String.valueOf(version));
}
Index index = builder.setParameter(Parameters.OP_TYPE, "index") //$NON-NLS-1$
.type("rateBucket").id(id).build(); //$NON-NLS-1$
try {
getClient().execute(index);
handler.handle(AsyncResultImpl.create(rlr));
} catch (Throwable e) {
// FIXME need to fix this now that we've switched to jest!
// if (ESUtils.rootCause(e) instanceof VersionConflictEngineException) {
// // If we got a version conflict, then it means some other request
// // managed to update the ES document since we retrieved it. Therefore
// // everything we've done is out of date, so we should do it all
// // over again.
// accept(bucketId, period, limit, increment, handler);
// } else {
handler.handle(AsyncResultImpl.<RateLimitResponse>create(e));
// }
}
} } | public class class_name {
protected void updateBucketAndReturn(final String id, final RateLimiterBucket bucket,
final RateLimitResponse rlr, final long version, final String bucketId,
final RateBucketPeriod period, final long limit, final long increment,
final IAsyncResultHandler<RateLimitResponse> handler) {
Index.Builder builder = new Index.Builder(bucket).refresh(false).index(getIndexName());
if (version>0) {
builder.setParameter(Parameters.VERSION, String.valueOf(version)); // depends on control dependency: [if], data = [(version]
}
Index index = builder.setParameter(Parameters.OP_TYPE, "index") //$NON-NLS-1$
.type("rateBucket").id(id).build(); //$NON-NLS-1$
try {
getClient().execute(index); // depends on control dependency: [try], data = [none]
handler.handle(AsyncResultImpl.create(rlr)); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
// FIXME need to fix this now that we've switched to jest!
// if (ESUtils.rootCause(e) instanceof VersionConflictEngineException) {
// // If we got a version conflict, then it means some other request
// // managed to update the ES document since we retrieved it. Therefore
// // everything we've done is out of date, so we should do it all
// // over again.
// accept(bucketId, period, limit, increment, handler);
// } else {
handler.handle(AsyncResultImpl.<RateLimitResponse>create(e));
// }
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void message(String message, Throwable e) {
if(message == null && e != null) {
message = e.getMessage();
}
logExpensive(Level.INFO, message, e);
} } | public class class_name {
public static void message(String message, Throwable e) {
if(message == null && e != null) {
message = e.getMessage(); // depends on control dependency: [if], data = [none]
}
logExpensive(Level.INFO, message, e);
} } |
public class class_name {
public static boolean isJsp21(ServletContext context)
{
//if running on GAE, treat like it is JSP 2.0
if(isRunningOnGoogleAppEngine(context))
{
return false;
}
try
{
// simply check if the class JspApplicationContext is available
Class.forName("javax.servlet.jsp.JspApplicationContext");
return true;
}
catch (ClassNotFoundException ex)
{
// expected exception in a JSP 2.0 (or less) environment
}
return false;
} } | public class class_name {
public static boolean isJsp21(ServletContext context)
{
//if running on GAE, treat like it is JSP 2.0
if(isRunningOnGoogleAppEngine(context))
{
return false; // depends on control dependency: [if], data = [none]
}
try
{
// simply check if the class JspApplicationContext is available
Class.forName("javax.servlet.jsp.JspApplicationContext");
return true; // depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException ex)
{
// expected exception in a JSP 2.0 (or less) environment
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
private void updateMaxMin(IntervalRBTreeNode<T> n, IntervalRBTreeNode<T> c) {
if (c != null) {
if (n.max < c.max) {
n.max = c.max;
}
if (n.min > c.min) {
n.min = c.min;
}
}
} } | public class class_name {
private void updateMaxMin(IntervalRBTreeNode<T> n, IntervalRBTreeNode<T> c) {
if (c != null) {
if (n.max < c.max) {
n.max = c.max; // depends on control dependency: [if], data = [none]
}
if (n.min > c.min) {
n.min = c.min; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void loadPartitioningIntoModel( final Model pModel )
{
String lSql = "" + //
" select table_name, " + //
" owner, " + //
" partitioning_type, " + //
" subpartitioning_type, " + //
" interval," + //
" ref_ptn_constraint_name," + //
" def_tablespace_name," + //
" def_compression," + //
" def_compress_for" + //
" from " + getDataDictionaryView( "part_tables" ) + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider() )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
final String lTablename = pResultSet.getString( "table_name" );
final String lOwner = pResultSet.getString( "owner" );
if( !isIgnoredTable( lTablename, lOwner ) )
{
// Read compression type, works only for one compression type for all
// partitions
handleCompression( pResultSet.getString( "def_compression" ), pResultSet.getString( "def_compress_for" ), new CompressionHandler()
{
public void setCompression( CompressType pCompressType, CompressForType pCompressForType )
{
Table lTable = findTable( pModel, lTablename, lOwner );
lTable.setCompression( pCompressType );
lTable.setCompressionFor( pCompressForType );
}
} );
if( pResultSet.getString( "partitioning_type" ).equals( "HASH" ) ) // and
// cur_part_tables.subpartitioning_type
// =
// 'NONE'
{
final HashPartitions lHashPartitions = new HashPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lHashPartitions );
lHashPartitions.setColumn( loadPartitionColumns( lTablename ).get( 0 ) );
String lSql = "" + //
" select partition_name," + //
" tablespace_name" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
HashPartition lHashPartition = new HashPartitionImpl();
lHashPartition.setName( pResultSet.getString( "partition_name" ) );
lHashPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lHashPartitions.getPartitionList().add( lHashPartition );
}
}.execute();
}
if( pResultSet.getString( "partitioning_type" ).equals( "LIST" ) )
{
final ListPartitions lListPartitions = new ListPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lListPartitions );
lListPartitions.setTableSubPart( load_tablesubpart( pResultSet.getString( "table_name" ), pResultSet.getString( "subpartitioning_type" ) ) );
lListPartitions.setColumn( loadPartitionColumns( lTablename ).get( 0 ) );
String lSql = "" + //
" select partition_name," + //
" tablespace_name," + //
" high_value" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
String lHighValue = pResultSet.getString( "high_value" );
ListPartition lListPartition = new ListPartitionImpl();
lListPartition.setName( pResultSet.getString( "partition_name" ) );
lListPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lListPartition.getValue().addAll( getOrigListpartValuelist( lHighValue ) );
lListPartitions.getPartitionList().add( lListPartition );
}
}.execute();
if( lListPartitions.getTableSubPart() != null )
{
for( ListPartition lListPartition : lListPartitions.getPartitionList() )
{
ListSubPart lListSubPart = new ListSubPartImpl();
lListSubPart.setName( lListPartition.getName() );
lListSubPart.getValue().addAll( lListPartition.getValue() );
lListSubPart.getSubPartList().addAll( loadSubpartlist( lTablename, lListPartition.getName(), pResultSet.getString( "subpartitioning_type" ) ) );
lListPartitions.getSubPartitionList().add( lListSubPart );
}
lListPartitions.getPartitionList().clear();
}
}
if( pResultSet.getString( "partitioning_type" ).equals( "RANGE" ) )
{
final RangePartitions lRangePartitions = new RangePartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lRangePartitions );
lRangePartitions.setIntervalExpression( pResultSet.getString( "interval" ) );
lRangePartitions.setTableSubPart( load_tablesubpart( pResultSet.getString( "table_name" ), pResultSet.getString( "subpartitioning_type" ) ) );
lRangePartitions.getColumns().addAll( loadPartitionColumns( lTablename ) );
String lSql = "" + //
" select partition_name," + //
" tablespace_name," + //
" high_value" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
String lHighValue = pResultSet.getString( "high_value" );
RangePartition lRangePartition = new RangePartitionImpl();
lRangePartition.setName( pResultSet.getString( "partition_name" ) );
lRangePartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lRangePartition.getValue().addAll( getOrigRangepartValuelist( lHighValue ) );
lRangePartitions.getPartitionList().add( lRangePartition );
}
}.execute();
if( lRangePartitions.getTableSubPart() != null )
{
for( RangePartition lRangePartition : lRangePartitions.getPartitionList() )
{
RangeSubPart lRangeSubPart = new RangeSubPartImpl();
lRangeSubPart.setName( lRangePartition.getName() );
lRangeSubPart.getValue().addAll( lRangePartition.getValue() );
lRangeSubPart.getSubPartList().addAll( loadSubpartlist( lTablename, lRangePartition.getName(), pResultSet.getString( "subpartitioning_type" ) ) );
lRangePartitions.getSubPartitionList().add( lRangeSubPart );
}
lRangePartitions.getPartitionList().clear();
}
}
if( pResultSet.getString( "partitioning_type" ).equals( "REFERENCE" ) )
{
final RefPartitions lRefPartitions = new RefPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lRefPartitions );
lRefPartitions.setFkName( pResultSet.getString( "ref_ptn_constraint_name" ) );
String lSql = "" + //
" select partition_name," + //
" tablespace_name" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
RefPartition lRefPartition = new RefPartitionImpl();
lRefPartition.setName( pResultSet.getString( "partition_name" ) );
lRefPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lRefPartitions.getPartitionList().add( lRefPartition );
}
}.execute();
}
}
}
}.execute();
} } | public class class_name {
private void loadPartitioningIntoModel( final Model pModel )
{
String lSql = "" + //
" select table_name, " + //
" owner, " + //
" partitioning_type, " + //
" subpartitioning_type, " + //
" interval," + //
" ref_ptn_constraint_name," + //
" def_tablespace_name," + //
" def_compression," + //
" def_compress_for" + //
" from " + getDataDictionaryView( "part_tables" ) + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider() )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
final String lTablename = pResultSet.getString( "table_name" );
final String lOwner = pResultSet.getString( "owner" );
if( !isIgnoredTable( lTablename, lOwner ) )
{
// Read compression type, works only for one compression type for all
// partitions
handleCompression( pResultSet.getString( "def_compression" ), pResultSet.getString( "def_compress_for" ), new CompressionHandler()
{
public void setCompression( CompressType pCompressType, CompressForType pCompressForType )
{
Table lTable = findTable( pModel, lTablename, lOwner );
lTable.setCompression( pCompressType );
lTable.setCompressionFor( pCompressForType );
}
} );
if( pResultSet.getString( "partitioning_type" ).equals( "HASH" ) ) // and
// cur_part_tables.subpartitioning_type
// =
// 'NONE'
{
final HashPartitions lHashPartitions = new HashPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lHashPartitions ); // depends on control dependency: [if], data = [none]
lHashPartitions.setColumn( loadPartitionColumns( lTablename ).get( 0 ) ); // depends on control dependency: [if], data = [none]
String lSql = "" + //
" select partition_name," + //
" tablespace_name" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
HashPartition lHashPartition = new HashPartitionImpl();
lHashPartition.setName( pResultSet.getString( "partition_name" ) );
lHashPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lHashPartitions.getPartitionList().add( lHashPartition );
}
}.execute(); // depends on control dependency: [if], data = [none]
}
if( pResultSet.getString( "partitioning_type" ).equals( "LIST" ) )
{
final ListPartitions lListPartitions = new ListPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lListPartitions ); // depends on control dependency: [if], data = [none]
lListPartitions.setTableSubPart( load_tablesubpart( pResultSet.getString( "table_name" ), pResultSet.getString( "subpartitioning_type" ) ) ); // depends on control dependency: [if], data = [none]
lListPartitions.setColumn( loadPartitionColumns( lTablename ).get( 0 ) ); // depends on control dependency: [if], data = [none]
String lSql = "" + //
" select partition_name," + //
" tablespace_name," + //
" high_value" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
String lHighValue = pResultSet.getString( "high_value" );
ListPartition lListPartition = new ListPartitionImpl();
lListPartition.setName( pResultSet.getString( "partition_name" ) );
lListPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lListPartition.getValue().addAll( getOrigListpartValuelist( lHighValue ) );
lListPartitions.getPartitionList().add( lListPartition );
}
}.execute(); // depends on control dependency: [if], data = [none]
if( lListPartitions.getTableSubPart() != null )
{
for( ListPartition lListPartition : lListPartitions.getPartitionList() )
{
ListSubPart lListSubPart = new ListSubPartImpl();
lListSubPart.setName( lListPartition.getName() ); // depends on control dependency: [for], data = [lListPartition]
lListSubPart.getValue().addAll( lListPartition.getValue() ); // depends on control dependency: [for], data = [lListPartition]
lListSubPart.getSubPartList().addAll( loadSubpartlist( lTablename, lListPartition.getName(), pResultSet.getString( "subpartitioning_type" ) ) ); // depends on control dependency: [for], data = [lListPartition]
lListPartitions.getSubPartitionList().add( lListSubPart ); // depends on control dependency: [for], data = [lListPartition]
}
lListPartitions.getPartitionList().clear(); // depends on control dependency: [if], data = [none]
}
}
if( pResultSet.getString( "partitioning_type" ).equals( "RANGE" ) )
{
final RangePartitions lRangePartitions = new RangePartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lRangePartitions ); // depends on control dependency: [if], data = [none]
lRangePartitions.setIntervalExpression( pResultSet.getString( "interval" ) ); // depends on control dependency: [if], data = [none]
lRangePartitions.setTableSubPart( load_tablesubpart( pResultSet.getString( "table_name" ), pResultSet.getString( "subpartitioning_type" ) ) ); // depends on control dependency: [if], data = [none]
lRangePartitions.getColumns().addAll( loadPartitionColumns( lTablename ) ); // depends on control dependency: [if], data = [none]
String lSql = "" + //
" select partition_name," + //
" tablespace_name," + //
" high_value" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
String lHighValue = pResultSet.getString( "high_value" );
RangePartition lRangePartition = new RangePartitionImpl();
lRangePartition.setName( pResultSet.getString( "partition_name" ) );
lRangePartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lRangePartition.getValue().addAll( getOrigRangepartValuelist( lHighValue ) );
lRangePartitions.getPartitionList().add( lRangePartition );
}
}.execute(); // depends on control dependency: [if], data = [none]
if( lRangePartitions.getTableSubPart() != null )
{
for( RangePartition lRangePartition : lRangePartitions.getPartitionList() )
{
RangeSubPart lRangeSubPart = new RangeSubPartImpl();
lRangeSubPart.setName( lRangePartition.getName() ); // depends on control dependency: [for], data = [lRangePartition]
lRangeSubPart.getValue().addAll( lRangePartition.getValue() ); // depends on control dependency: [for], data = [lRangePartition]
lRangeSubPart.getSubPartList().addAll( loadSubpartlist( lTablename, lRangePartition.getName(), pResultSet.getString( "subpartitioning_type" ) ) ); // depends on control dependency: [for], data = [lRangePartition]
lRangePartitions.getSubPartitionList().add( lRangeSubPart ); // depends on control dependency: [for], data = [lRangePartition]
}
lRangePartitions.getPartitionList().clear(); // depends on control dependency: [if], data = [none]
}
}
if( pResultSet.getString( "partitioning_type" ).equals( "REFERENCE" ) )
{
final RefPartitions lRefPartitions = new RefPartitionsImpl();
setPartitioningForTable( pModel, lTablename, lOwner, lRefPartitions ); // depends on control dependency: [if], data = [none]
lRefPartitions.setFkName( pResultSet.getString( "ref_ptn_constraint_name" ) ); // depends on control dependency: [if], data = [none]
String lSql = "" + //
" select partition_name," + //
" tablespace_name" + //
" from " + getDataDictionaryView( "tab_partitions" ) + //
" where table_name = ?" + //
" order by partition_position" + //
"";
new WrapperIteratorResultSet( lSql, getCallableStatementProvider(), Collections.singletonList( lTablename ) )
{
@Override
protected void useResultSetRow( ResultSet pResultSet ) throws SQLException
{
RefPartition lRefPartition = new RefPartitionImpl();
lRefPartition.setName( pResultSet.getString( "partition_name" ) );
lRefPartition.setTablespace( pResultSet.getString( "tablespace_name" ) );
lRefPartitions.getPartitionList().add( lRefPartition );
}
}.execute(); // depends on control dependency: [if], data = [none]
}
}
}
}.execute();
} } |
public class class_name {
public void marshall(Mpeg2Settings mpeg2Settings, ProtocolMarshaller protocolMarshaller) {
if (mpeg2Settings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mpeg2Settings.getAdaptiveQuantization(), ADAPTIVEQUANTIZATION_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getBitrate(), BITRATE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getCodecLevel(), CODECLEVEL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getCodecProfile(), CODECPROFILE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getDynamicSubGop(), DYNAMICSUBGOP_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getFramerateControl(), FRAMERATECONTROL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getFramerateConversionAlgorithm(), FRAMERATECONVERSIONALGORITHM_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getFramerateDenominator(), FRAMERATEDENOMINATOR_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getFramerateNumerator(), FRAMERATENUMERATOR_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getGopClosedCadence(), GOPCLOSEDCADENCE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getGopSize(), GOPSIZE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getGopSizeUnits(), GOPSIZEUNITS_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getHrdBufferInitialFillPercentage(), HRDBUFFERINITIALFILLPERCENTAGE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getHrdBufferSize(), HRDBUFFERSIZE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getInterlaceMode(), INTERLACEMODE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getIntraDcPrecision(), INTRADCPRECISION_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getMaxBitrate(), MAXBITRATE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getMinIInterval(), MINIINTERVAL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getNumberBFramesBetweenReferenceFrames(), NUMBERBFRAMESBETWEENREFERENCEFRAMES_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getParControl(), PARCONTROL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getParDenominator(), PARDENOMINATOR_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getParNumerator(), PARNUMERATOR_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getQualityTuningLevel(), QUALITYTUNINGLEVEL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getRateControlMode(), RATECONTROLMODE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getSceneChangeDetect(), SCENECHANGEDETECT_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getSlowPal(), SLOWPAL_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getSoftness(), SOFTNESS_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getSpatialAdaptiveQuantization(), SPATIALADAPTIVEQUANTIZATION_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getSyntax(), SYNTAX_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getTelecine(), TELECINE_BINDING);
protocolMarshaller.marshall(mpeg2Settings.getTemporalAdaptiveQuantization(), TEMPORALADAPTIVEQUANTIZATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Mpeg2Settings mpeg2Settings, ProtocolMarshaller protocolMarshaller) {
if (mpeg2Settings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mpeg2Settings.getAdaptiveQuantization(), ADAPTIVEQUANTIZATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getBitrate(), BITRATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getCodecLevel(), CODECLEVEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getCodecProfile(), CODECPROFILE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getDynamicSubGop(), DYNAMICSUBGOP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getFramerateControl(), FRAMERATECONTROL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getFramerateConversionAlgorithm(), FRAMERATECONVERSIONALGORITHM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getFramerateDenominator(), FRAMERATEDENOMINATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getFramerateNumerator(), FRAMERATENUMERATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getGopClosedCadence(), GOPCLOSEDCADENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getGopSize(), GOPSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getGopSizeUnits(), GOPSIZEUNITS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getHrdBufferInitialFillPercentage(), HRDBUFFERINITIALFILLPERCENTAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getHrdBufferSize(), HRDBUFFERSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getInterlaceMode(), INTERLACEMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getIntraDcPrecision(), INTRADCPRECISION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getMaxBitrate(), MAXBITRATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getMinIInterval(), MINIINTERVAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getNumberBFramesBetweenReferenceFrames(), NUMBERBFRAMESBETWEENREFERENCEFRAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getParControl(), PARCONTROL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getParDenominator(), PARDENOMINATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getParNumerator(), PARNUMERATOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getQualityTuningLevel(), QUALITYTUNINGLEVEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getRateControlMode(), RATECONTROLMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getSceneChangeDetect(), SCENECHANGEDETECT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getSlowPal(), SLOWPAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getSoftness(), SOFTNESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getSpatialAdaptiveQuantization(), SPATIALADAPTIVEQUANTIZATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getSyntax(), SYNTAX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getTelecine(), TELECINE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mpeg2Settings.getTemporalAdaptiveQuantization(), TEMPORALADAPTIVEQUANTIZATION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected List<ManagedModule> createAndStartModules() {
final List<ManagedModule> managedModuleInstances = new ArrayList<>();
// create and start each managed module
for(final Class<? extends ManagedModule> module:managedModules) {
final ManagedModule mm = injector.getInstance(module);
managedModuleInstances.add(mm);
mm.start();
}
return managedModuleInstances;
} } | public class class_name {
protected List<ManagedModule> createAndStartModules() {
final List<ManagedModule> managedModuleInstances = new ArrayList<>();
// create and start each managed module
for(final Class<? extends ManagedModule> module:managedModules) {
final ManagedModule mm = injector.getInstance(module);
managedModuleInstances.add(mm); // depends on control dependency: [for], data = [none]
mm.start(); // depends on control dependency: [for], data = [none]
}
return managedModuleInstances;
} } |
public class class_name {
public static <T, R> List<R> processList(Class<R> clazz, List<T> src, BiConsumer<R, T> biConsumer) {
if (!Lists.iterable(src)) {
log.warn("the src argument must be not null, return empty list. ");
return Lists.newArrayList();
}
return src.stream().map(e -> process(clazz, e, biConsumer)).collect(Collectors.toList());
} } | public class class_name {
public static <T, R> List<R> processList(Class<R> clazz, List<T> src, BiConsumer<R, T> biConsumer) {
if (!Lists.iterable(src)) {
log.warn("the src argument must be not null, return empty list. "); // depends on control dependency: [if], data = [none]
return Lists.newArrayList(); // depends on control dependency: [if], data = [none]
}
return src.stream().map(e -> process(clazz, e, biConsumer)).collect(Collectors.toList());
} } |
public class class_name {
public int combine(TFDictionary dictionary, int limit, boolean add)
{
int preSize = trie.size();
for (Map.Entry<String, TermFrequency> entry : dictionary.trie.entrySet())
{
TermFrequency termFrequency = trie.get(entry.getKey());
if (termFrequency == null)
{
trie.put(entry.getKey(), new TermFrequency(entry.getKey(), Math.min(limit, entry.getValue().getValue())));
}
else
{
if (add)
{
termFrequency.setValue(termFrequency.getValue() + Math.min(limit, entry.getValue().getValue()));
}
}
}
return trie.size() - preSize;
} } | public class class_name {
public int combine(TFDictionary dictionary, int limit, boolean add)
{
int preSize = trie.size();
for (Map.Entry<String, TermFrequency> entry : dictionary.trie.entrySet())
{
TermFrequency termFrequency = trie.get(entry.getKey());
if (termFrequency == null)
{
trie.put(entry.getKey(), new TermFrequency(entry.getKey(), Math.min(limit, entry.getValue().getValue()))); // depends on control dependency: [if], data = [none]
}
else
{
if (add)
{
termFrequency.setValue(termFrequency.getValue() + Math.min(limit, entry.getValue().getValue())); // depends on control dependency: [if], data = [none]
}
}
}
return trie.size() - preSize;
} } |
public class class_name {
private static String[] splitValueAndUnit(String encodedValueAndUnit) {
String[] result = new String[2];
int len = encodedValueAndUnit.length();
int firstLetterIndex = len;
while (firstLetterIndex > 0
&& Character.isLetter(encodedValueAndUnit.charAt(firstLetterIndex - 1))) {
firstLetterIndex--;
}
result[0] = encodedValueAndUnit.substring(0, firstLetterIndex);
result[1] = encodedValueAndUnit.substring(firstLetterIndex);
return result;
} } | public class class_name {
private static String[] splitValueAndUnit(String encodedValueAndUnit) {
String[] result = new String[2];
int len = encodedValueAndUnit.length();
int firstLetterIndex = len;
while (firstLetterIndex > 0
&& Character.isLetter(encodedValueAndUnit.charAt(firstLetterIndex - 1))) {
firstLetterIndex--; // depends on control dependency: [while], data = [none]
}
result[0] = encodedValueAndUnit.substring(0, firstLetterIndex);
result[1] = encodedValueAndUnit.substring(firstLetterIndex);
return result;
} } |
public class class_name {
public int insertOutput(byte[] str, int strP, int strLen, byte[] strEncoding) {
byte[] insertEncoding = encodingToInsertOutput();
byte[] insertBuf = null;
started = true;
if (strLen == 0) return 0;
final byte[] insertStr;
final int insertP;
final int insertLen;
if (caseInsensitiveEquals(insertEncoding, strEncoding)) {
insertStr = str;
insertP = 0;
insertLen = strLen;
} else {
Ptr insertLenP = new Ptr();
insertBuf = new byte[4096]; // FIXME: wasteful
insertStr = allocateConvertedString(strEncoding, insertEncoding, str, strP, strLen, insertBuf, insertLenP);
insertLen = insertLenP.p;
insertP = insertStr == str ? strP : 0;
if (insertStr == null) return -1;
}
int need = insertLen;
final int lastTranscodingIndex = numTranscoders - 1;
final Transcoding transcoding;
Buffer buf;
if (numTranscoders == 0) {
transcoding = null;
buf = inBuf;
} else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) {
transcoding = elements[lastTranscodingIndex].transcoding;
need += transcoding.readAgainLength;
if (need < insertLen) return -1;
if (lastTranscodingIndex == 0) {
buf = inBuf;
} else {
buf = elements[lastTranscodingIndex - 1];
}
} else {
transcoding = elements[lastTranscodingIndex].transcoding;
buf = elements[lastTranscodingIndex];
}
if (buf == null) {
buf = new Buffer();
buf.allocate(need);
} else if (buf.bytes == null) {
buf.allocate(need);
} else if ((buf.bufEnd - buf.dataEnd) < need) {
// try to compact buffer by moving data portion back to bufStart
System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart);
buf.dataEnd = buf.bufStart + (buf.dataEnd - buf.dataStart);
buf.dataStart = buf.bufStart;
if ((buf.bufEnd - buf.dataEnd) < need) {
// still not enough room; use a separate buffer
int s = (buf.dataEnd - buf.bufStart) + need;
if (s < need) return -1;
Buffer buf2 = buf = new Buffer();
buf2.allocate(s);
System.arraycopy(buf.bytes, buf.bufStart, buf2.bytes, 0, s); // ??
buf2.dataStart = 0;
buf2.dataEnd = buf.dataEnd - buf.bufStart;
}
}
System.arraycopy(insertStr, insertP, buf.bytes, buf.dataEnd, insertLen);
buf.dataEnd += insertLen;
if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) {
System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf.bytes, buf.dataEnd, transcoding.readAgainLength);
buf.dataEnd += transcoding.readAgainLength;
transcoding.readAgainLength = 0;
}
return 0;
} } | public class class_name {
public int insertOutput(byte[] str, int strP, int strLen, byte[] strEncoding) {
byte[] insertEncoding = encodingToInsertOutput();
byte[] insertBuf = null;
started = true;
if (strLen == 0) return 0;
final byte[] insertStr;
final int insertP;
final int insertLen;
if (caseInsensitiveEquals(insertEncoding, strEncoding)) {
insertStr = str;
// depends on control dependency: [if], data = [none]
insertP = 0;
// depends on control dependency: [if], data = [none]
insertLen = strLen;
// depends on control dependency: [if], data = [none]
} else {
Ptr insertLenP = new Ptr();
insertBuf = new byte[4096]; // FIXME: wasteful
// depends on control dependency: [if], data = [none]
insertStr = allocateConvertedString(strEncoding, insertEncoding, str, strP, strLen, insertBuf, insertLenP);
// depends on control dependency: [if], data = [none]
insertLen = insertLenP.p;
// depends on control dependency: [if], data = [none]
insertP = insertStr == str ? strP : 0;
// depends on control dependency: [if], data = [none]
if (insertStr == null) return -1;
}
int need = insertLen;
final int lastTranscodingIndex = numTranscoders - 1;
final Transcoding transcoding;
Buffer buf;
if (numTranscoders == 0) {
transcoding = null;
// depends on control dependency: [if], data = [none]
buf = inBuf;
// depends on control dependency: [if], data = [none]
} else if (elements[lastTranscodingIndex].transcoding.transcoder.compatibility.isEncoder()) {
transcoding = elements[lastTranscodingIndex].transcoding;
// depends on control dependency: [if], data = [none]
need += transcoding.readAgainLength;
// depends on control dependency: [if], data = [none]
if (need < insertLen) return -1;
if (lastTranscodingIndex == 0) {
buf = inBuf;
// depends on control dependency: [if], data = [none]
} else {
buf = elements[lastTranscodingIndex - 1];
// depends on control dependency: [if], data = [none]
}
} else {
transcoding = elements[lastTranscodingIndex].transcoding;
// depends on control dependency: [if], data = [none]
buf = elements[lastTranscodingIndex];
// depends on control dependency: [if], data = [none]
}
if (buf == null) {
buf = new Buffer();
// depends on control dependency: [if], data = [none]
buf.allocate(need);
// depends on control dependency: [if], data = [none]
} else if (buf.bytes == null) {
buf.allocate(need);
// depends on control dependency: [if], data = [none]
} else if ((buf.bufEnd - buf.dataEnd) < need) {
// try to compact buffer by moving data portion back to bufStart
System.arraycopy(buf.bytes, buf.dataStart, buf.bytes, buf.bufStart, buf.dataEnd - buf.dataStart);
// depends on control dependency: [if], data = [none]
buf.dataEnd = buf.bufStart + (buf.dataEnd - buf.dataStart);
// depends on control dependency: [if], data = [none]
buf.dataStart = buf.bufStart;
// depends on control dependency: [if], data = [none]
if ((buf.bufEnd - buf.dataEnd) < need) {
// still not enough room; use a separate buffer
int s = (buf.dataEnd - buf.bufStart) + need;
if (s < need) return -1;
Buffer buf2 = buf = new Buffer();
buf2.allocate(s);
// depends on control dependency: [if], data = [none]
System.arraycopy(buf.bytes, buf.bufStart, buf2.bytes, 0, s); // ??
// depends on control dependency: [if], data = [none]
buf2.dataStart = 0;
// depends on control dependency: [if], data = [none]
buf2.dataEnd = buf.dataEnd - buf.bufStart;
// depends on control dependency: [if], data = [none]
}
}
System.arraycopy(insertStr, insertP, buf.bytes, buf.dataEnd, insertLen);
buf.dataEnd += insertLen;
if (transcoding != null && transcoding.transcoder.compatibility.isEncoder()) {
System.arraycopy(transcoding.readBuf, transcoding.recognizedLength, buf.bytes, buf.dataEnd, transcoding.readAgainLength);
// depends on control dependency: [if], data = [(transcoding]
buf.dataEnd += transcoding.readAgainLength;
// depends on control dependency: [if], data = [none]
transcoding.readAgainLength = 0;
// depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T get(Class<T> clazz, Object... params) {
T obj = (T) pool.get(clazz);
if (null == obj) {
synchronized (Singleton.class) {
obj = (T) pool.get(clazz);
if (null == obj) {
obj = ReflectUtil.newInstance(clazz, params);
pool.put(clazz, obj);
}
}
}
return obj;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T get(Class<T> clazz, Object... params) {
T obj = (T) pool.get(clazz);
if (null == obj) {
synchronized (Singleton.class) {
// depends on control dependency: [if], data = [none]
obj = (T) pool.get(clazz);
if (null == obj) {
obj = ReflectUtil.newInstance(clazz, params);
// depends on control dependency: [if], data = [none]
pool.put(clazz, obj);
// depends on control dependency: [if], data = [obj)]
}
}
}
return obj;
} } |
public class class_name {
@Override
protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) {
if (obj instanceof Wrapper) {
Object unwrapped = ((Wrapper) obj).unwrap();
Iterator<?> iterator = null;
if (unwrapped instanceof Iterator)
iterator = (Iterator<?>) unwrapped;
if (unwrapped instanceof Iterable)
iterator = ((Iterable<?>)unwrapped).iterator();
return iterator;
}
return null;
} } | public class class_name {
@Override
protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) {
if (obj instanceof Wrapper) {
Object unwrapped = ((Wrapper) obj).unwrap();
Iterator<?> iterator = null;
if (unwrapped instanceof Iterator)
iterator = (Iterator<?>) unwrapped;
if (unwrapped instanceof Iterable)
iterator = ((Iterable<?>)unwrapped).iterator();
return iterator; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Unit(NM)
public static double radius(Location... location)
{
Location center = center(location);
double max = 0;
for (Location loc : location)
{
Distance distance = distance(loc, center);
double miles = distance.getMiles();
if (miles > max)
{
max = miles;
}
}
return max;
} } | public class class_name {
@Unit(NM)
public static double radius(Location... location)
{
Location center = center(location);
double max = 0;
for (Location loc : location)
{
Distance distance = distance(loc, center);
double miles = distance.getMiles();
if (miles > max)
{
max = miles;
// depends on control dependency: [if], data = [none]
}
}
return max;
} } |
public class class_name {
private void handle(final RemotingContext ctx, final Object msg) {
try {
if (msg instanceof List) {
final Runnable handleTask = new Runnable() {
@Override
public void run() {
if (logger.isDebugEnabled()) {
logger.debug("Batch message! size={}", ((List<?>) msg).size());
}
for (final Object m : (List<?>) msg) {
RpcCommandHandler.this.process(ctx, m);
}
}
};
if (RpcConfigManager.dispatch_msg_list_in_default_executor()) {
// If msg is list ,then the batch submission to biz threadpool can save io thread.
// See com.alipay.remoting.decoder.ProtocolDecoder
processorManager.getDefaultExecutor().execute(handleTask);
} else {
handleTask.run();
}
} else {
process(ctx, msg);
}
} catch (final Throwable t) {
processException(ctx, msg, t);
}
} } | public class class_name {
private void handle(final RemotingContext ctx, final Object msg) {
try {
if (msg instanceof List) {
final Runnable handleTask = new Runnable() {
@Override
public void run() {
if (logger.isDebugEnabled()) {
logger.debug("Batch message! size={}", ((List<?>) msg).size()); // depends on control dependency: [if], data = [none]
}
for (final Object m : (List<?>) msg) {
RpcCommandHandler.this.process(ctx, m); // depends on control dependency: [for], data = [m]
}
}
};
if (RpcConfigManager.dispatch_msg_list_in_default_executor()) {
// If msg is list ,then the batch submission to biz threadpool can save io thread.
// See com.alipay.remoting.decoder.ProtocolDecoder
processorManager.getDefaultExecutor().execute(handleTask); // depends on control dependency: [if], data = [none]
} else {
handleTask.run(); // depends on control dependency: [if], data = [none]
}
} else {
process(ctx, msg); // depends on control dependency: [if], data = [none]
}
} catch (final Throwable t) {
processException(ctx, msg, t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected List<CmsResource> getTopFolders(List<CmsResource> folders) {
List<String> folderPaths = new ArrayList<String>();
List<CmsResource> topFolders = new ArrayList<CmsResource>();
Map<String, CmsResource> foldersByPath = new HashMap<String, CmsResource>();
for (CmsResource folder : folders) {
folderPaths.add(folder.getRootPath());
foldersByPath.put(folder.getRootPath(), folder);
}
Collections.sort(folderPaths);
Set<String> topFolderPaths = new HashSet<String>(folderPaths);
for (int i = 0; i < folderPaths.size(); i++) {
for (int j = i + 1; j < folderPaths.size(); j++) {
if (folderPaths.get(j).startsWith((folderPaths.get(i)))) {
topFolderPaths.remove(folderPaths.get(j));
} else {
break;
}
}
}
for (String path : topFolderPaths) {
topFolders.add(foldersByPath.get(path));
}
return topFolders;
} } | public class class_name {
protected List<CmsResource> getTopFolders(List<CmsResource> folders) {
List<String> folderPaths = new ArrayList<String>();
List<CmsResource> topFolders = new ArrayList<CmsResource>();
Map<String, CmsResource> foldersByPath = new HashMap<String, CmsResource>();
for (CmsResource folder : folders) {
folderPaths.add(folder.getRootPath()); // depends on control dependency: [for], data = [folder]
foldersByPath.put(folder.getRootPath(), folder); // depends on control dependency: [for], data = [folder]
}
Collections.sort(folderPaths);
Set<String> topFolderPaths = new HashSet<String>(folderPaths);
for (int i = 0; i < folderPaths.size(); i++) {
for (int j = i + 1; j < folderPaths.size(); j++) {
if (folderPaths.get(j).startsWith((folderPaths.get(i)))) {
topFolderPaths.remove(folderPaths.get(j)); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
}
for (String path : topFolderPaths) {
topFolders.add(foldersByPath.get(path)); // depends on control dependency: [for], data = [path]
}
return topFolders;
} } |
public class class_name {
public void accept(InteractionUnitVisitor visitor)
{
visitor.startVisit(this);
for (InteractionUnit child : children)
{
child.accept(visitor);
}
visitor.endVisit(this);
} } | public class class_name {
public void accept(InteractionUnitVisitor visitor)
{
visitor.startVisit(this);
for (InteractionUnit child : children)
{
child.accept(visitor); // depends on control dependency: [for], data = [child]
}
visitor.endVisit(this);
} } |
public class class_name {
private void generatePermutationsQueryVariables(
ArrayList<HashMap<String, String[]>> result, Set<String> keys,
HashMap<String, String[]> queryVariables) {
if (keys != null && !keys.isEmpty()) {
Set<String> newKeys = new HashSet<>();
Iterator<String> it = keys.iterator();
String key = it.next();
String[] value = queryVariables.get(key);
if (result.isEmpty()) {
HashMap<String, String[]> newItem;
if (value == null || value.length == 0) {
newItem = new HashMap<>();
newItem.put(key, value);
result.add(newItem);
} else {
for (int j = 0; j < value.length; j++) {
newItem = new HashMap<>();
newItem.put(key, new String[] { value[j] });
result.add(newItem);
}
}
} else {
ArrayList<HashMap<String, String[]>> newResult = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
HashMap<String, String[]> newItem;
if (value == null || value.length == 0) {
newItem = (HashMap<String, String[]>) result.get(i).clone();
newItem.put(key, value);
newResult.add(newItem);
} else {
for (int j = 0; j < value.length; j++) {
newItem = (HashMap<String, String[]>) result.get(i).clone();
newItem.put(key, new String[] { value[j] });
newResult.add(newItem);
}
}
}
result.clear();
result.addAll(newResult);
}
while (it.hasNext()) {
newKeys.add(it.next());
}
generatePermutationsQueryVariables(result, newKeys, queryVariables);
}
} } | public class class_name {
private void generatePermutationsQueryVariables(
ArrayList<HashMap<String, String[]>> result, Set<String> keys,
HashMap<String, String[]> queryVariables) {
if (keys != null && !keys.isEmpty()) {
Set<String> newKeys = new HashSet<>();
Iterator<String> it = keys.iterator();
String key = it.next();
String[] value = queryVariables.get(key);
if (result.isEmpty()) {
HashMap<String, String[]> newItem;
if (value == null || value.length == 0) {
newItem = new HashMap<>(); // depends on control dependency: [if], data = [none]
newItem.put(key, value); // depends on control dependency: [if], data = [none]
result.add(newItem); // depends on control dependency: [if], data = [none]
} else {
for (int j = 0; j < value.length; j++) {
newItem = new HashMap<>(); // depends on control dependency: [for], data = [none]
newItem.put(key, new String[] { value[j] }); // depends on control dependency: [for], data = [j]
result.add(newItem); // depends on control dependency: [for], data = [none]
}
}
} else {
ArrayList<HashMap<String, String[]>> newResult = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
HashMap<String, String[]> newItem;
if (value == null || value.length == 0) {
newItem = (HashMap<String, String[]>) result.get(i).clone(); // depends on control dependency: [if], data = [none]
newItem.put(key, value); // depends on control dependency: [if], data = [none]
newResult.add(newItem); // depends on control dependency: [if], data = [none]
} else {
for (int j = 0; j < value.length; j++) {
newItem = (HashMap<String, String[]>) result.get(i).clone(); // depends on control dependency: [for], data = [none]
newItem.put(key, new String[] { value[j] }); // depends on control dependency: [for], data = [j]
newResult.add(newItem); // depends on control dependency: [for], data = [none]
}
}
}
result.clear(); // depends on control dependency: [if], data = [none]
result.addAll(newResult); // depends on control dependency: [if], data = [none]
}
while (it.hasNext()) {
newKeys.add(it.next()); // depends on control dependency: [while], data = [none]
}
generatePermutationsQueryVariables(result, newKeys, queryVariables); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void detachPaymentMethod(
@NonNull String paymentMethodId,
@Nullable PaymentMethodRetrievalListener listener) {
Map<String, Object> arguments = new HashMap<>();
arguments.put(KEY_PAYMENT_METHOD, paymentMethodId);
final String operationId = UUID.randomUUID().toString();
if (listener != null) {
mPaymentMethodRetrievalListeners.put(operationId, listener);
}
mEphemeralKeyManager
.retrieveEphemeralKey(operationId, ACTION_DETACH_PAYMENT_METHOD, arguments);
} } | public class class_name {
public void detachPaymentMethod(
@NonNull String paymentMethodId,
@Nullable PaymentMethodRetrievalListener listener) {
Map<String, Object> arguments = new HashMap<>();
arguments.put(KEY_PAYMENT_METHOD, paymentMethodId);
final String operationId = UUID.randomUUID().toString();
if (listener != null) {
mPaymentMethodRetrievalListeners.put(operationId, listener); // depends on control dependency: [if], data = [none]
}
mEphemeralKeyManager
.retrieveEphemeralKey(operationId, ACTION_DETACH_PAYMENT_METHOD, arguments);
} } |
public class class_name {
public static Duration fromMillis(long milliseconds) {
Duration.Builder builder = builder();
if (milliseconds < 0) {
builder.prior(true);
milliseconds *= -1;
}
int seconds = (int) (milliseconds / 1000);
Integer weeks = seconds / (60 * 60 * 24 * 7);
if (weeks > 0) {
builder.weeks(weeks);
}
seconds %= 60 * 60 * 24 * 7;
Integer days = seconds / (60 * 60 * 24);
if (days > 0) {
builder.days(days);
}
seconds %= 60 * 60 * 24;
Integer hours = seconds / (60 * 60);
if (hours > 0) {
builder.hours(hours);
}
seconds %= 60 * 60;
Integer minutes = seconds / (60);
if (minutes > 0) {
builder.minutes(minutes);
}
seconds %= 60;
if (seconds > 0) {
builder.seconds(seconds);
}
return builder.build();
} } | public class class_name {
public static Duration fromMillis(long milliseconds) {
Duration.Builder builder = builder();
if (milliseconds < 0) {
builder.prior(true); // depends on control dependency: [if], data = [none]
milliseconds *= -1; // depends on control dependency: [if], data = [none]
}
int seconds = (int) (milliseconds / 1000);
Integer weeks = seconds / (60 * 60 * 24 * 7);
if (weeks > 0) {
builder.weeks(weeks); // depends on control dependency: [if], data = [(weeks]
}
seconds %= 60 * 60 * 24 * 7;
Integer days = seconds / (60 * 60 * 24);
if (days > 0) {
builder.days(days); // depends on control dependency: [if], data = [(days]
}
seconds %= 60 * 60 * 24;
Integer hours = seconds / (60 * 60);
if (hours > 0) {
builder.hours(hours); // depends on control dependency: [if], data = [(hours]
}
seconds %= 60 * 60;
Integer minutes = seconds / (60);
if (minutes > 0) {
builder.minutes(minutes); // depends on control dependency: [if], data = [(minutes]
}
seconds %= 60;
if (seconds > 0) {
builder.seconds(seconds); // depends on control dependency: [if], data = [(seconds]
}
return builder.build();
} } |
public class class_name {
private List<Group> getGroups() throws Exception {
List<Group> groups = new ArrayList<Group>();
List<Group> sourceGroups = PathOverrideService.getInstance().findAllGroups();
// loop through the groups
for (Group sourceGroup : sourceGroups) {
Group group = new Group();
// add all methods
ArrayList<Method> methods = new ArrayList<Method>();
for (Method sourceMethod : EditService.getInstance().getMethodsFromGroupId(sourceGroup.getId(), null)) {
Method method = new Method();
method.setClassName(sourceMethod.getClassName());
method.setMethodName(sourceMethod.getMethodName());
methods.add(method);
}
group.setMethods(methods);
group.setName(sourceGroup.getName());
groups.add(group);
}
return groups;
} } | public class class_name {
private List<Group> getGroups() throws Exception {
List<Group> groups = new ArrayList<Group>();
List<Group> sourceGroups = PathOverrideService.getInstance().findAllGroups();
// loop through the groups
for (Group sourceGroup : sourceGroups) {
Group group = new Group();
// add all methods
ArrayList<Method> methods = new ArrayList<Method>();
for (Method sourceMethod : EditService.getInstance().getMethodsFromGroupId(sourceGroup.getId(), null)) {
Method method = new Method();
method.setClassName(sourceMethod.getClassName()); // depends on control dependency: [for], data = [sourceMethod]
method.setMethodName(sourceMethod.getMethodName()); // depends on control dependency: [for], data = [sourceMethod]
methods.add(method); // depends on control dependency: [for], data = [none]
}
group.setMethods(methods);
group.setName(sourceGroup.getName());
groups.add(group);
}
return groups;
} } |
public class class_name {
private boolean updateObjectSameShard(DBObject dbObj, Map<String, String> currScalarMap) {
boolean bUpdated = false;
checkForNewShard(dbObj);
checkNewlySharded(dbObj, currScalarMap);
for (String fieldName : dbObj.getUpdatedFieldNames()) {
FieldUpdater fieldUpdater = FieldUpdater.createFieldUpdater(this, dbObj, fieldName);
bUpdated |= fieldUpdater.updateValuesForField(currScalarMap.get(fieldName));
}
return bUpdated;
} } | public class class_name {
private boolean updateObjectSameShard(DBObject dbObj, Map<String, String> currScalarMap) {
boolean bUpdated = false;
checkForNewShard(dbObj);
checkNewlySharded(dbObj, currScalarMap);
for (String fieldName : dbObj.getUpdatedFieldNames()) {
FieldUpdater fieldUpdater = FieldUpdater.createFieldUpdater(this, dbObj, fieldName);
bUpdated |= fieldUpdater.updateValuesForField(currScalarMap.get(fieldName));
// depends on control dependency: [for], data = [fieldName]
}
return bUpdated;
} } |
public class class_name {
public File partsFirstFile(final File home, final long max, final String filenameReg, final String contentTypeReg) throws IOException {
if (!isMultipart()) return null;
File tmpfile = null;
boolean has = false;
for (MultiPart part : parts()) {
if (has) continue; //不遍历完后面getParameter可能获取不到值
has = true;
if (filenameReg != null && !filenameReg.isEmpty() && !part.getFilename().matches(filenameReg)) continue;
if (contentTypeReg != null && !contentTypeReg.isEmpty() && !part.getContentType().matches(contentTypeReg)) continue;
File file = new File(home, "tmp/redkale-" + System.nanoTime() + "_" + part.getFilename());
File parent = file.getParentFile();
if (!parent.isDirectory()) parent.mkdirs();
boolean rs = part.save(max < 1 ? Long.MAX_VALUE : max, file);
if (!rs) {
file.delete();
parent.delete();
} else {
tmpfile = file;
}
}
return tmpfile;
} } | public class class_name {
public File partsFirstFile(final File home, final long max, final String filenameReg, final String contentTypeReg) throws IOException {
if (!isMultipart()) return null;
File tmpfile = null;
boolean has = false;
for (MultiPart part : parts()) {
if (has) continue; //不遍历完后面getParameter可能获取不到值
has = true;
if (filenameReg != null && !filenameReg.isEmpty() && !part.getFilename().matches(filenameReg)) continue;
if (contentTypeReg != null && !contentTypeReg.isEmpty() && !part.getContentType().matches(contentTypeReg)) continue;
File file = new File(home, "tmp/redkale-" + System.nanoTime() + "_" + part.getFilename());
File parent = file.getParentFile();
if (!parent.isDirectory()) parent.mkdirs();
boolean rs = part.save(max < 1 ? Long.MAX_VALUE : max, file);
if (!rs) {
file.delete();
// depends on control dependency: [if], data = [none]
parent.delete();
// depends on control dependency: [if], data = [none]
} else {
tmpfile = file;
// depends on control dependency: [if], data = [none]
}
}
return tmpfile;
} } |
public class class_name {
@Override
public CommerceShippingFixedOption remove(Serializable primaryKey)
throws NoSuchShippingFixedOptionException {
Session session = null;
try {
session = openSession();
CommerceShippingFixedOption commerceShippingFixedOption = (CommerceShippingFixedOption)session.get(CommerceShippingFixedOptionImpl.class,
primaryKey);
if (commerceShippingFixedOption == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchShippingFixedOptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceShippingFixedOption);
}
catch (NoSuchShippingFixedOptionException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommerceShippingFixedOption remove(Serializable primaryKey)
throws NoSuchShippingFixedOptionException {
Session session = null;
try {
session = openSession();
CommerceShippingFixedOption commerceShippingFixedOption = (CommerceShippingFixedOption)session.get(CommerceShippingFixedOptionImpl.class,
primaryKey);
if (commerceShippingFixedOption == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchShippingFixedOptionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceShippingFixedOption);
}
catch (NoSuchShippingFixedOptionException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
public boolean removeSubscribeListener(SubscribeListener subscribeListener) {
boolean removed = subscribeListeners.remove(subscribeListener);
if (removed && subscribeListeners.isEmpty()) {
setSubscriptionMode(previousSubscriptionMode);
}
return removed;
} } | public class class_name {
public boolean removeSubscribeListener(SubscribeListener subscribeListener) {
boolean removed = subscribeListeners.remove(subscribeListener);
if (removed && subscribeListeners.isEmpty()) {
setSubscriptionMode(previousSubscriptionMode); // depends on control dependency: [if], data = [none]
}
return removed;
} } |
public class class_name {
public DoubleWritable getValueDoubleWritable(String label) {
HadoopObject o = getHadoopObject(VALUE, label, ObjectUtil.DOUBLE, "Double");
if (o == null) {
return null;
}
return (DoubleWritable) o.getObject();
} } | public class class_name {
public DoubleWritable getValueDoubleWritable(String label) {
HadoopObject o = getHadoopObject(VALUE, label, ObjectUtil.DOUBLE, "Double");
if (o == null) {
return null; // depends on control dependency: [if], data = [none]
}
return (DoubleWritable) o.getObject();
} } |
public class class_name {
private void mergePackage( InternalKnowledgePackage pkg,
InternalKnowledgePackage newPkg ) {
// Merge imports
final Map<String, ImportDeclaration> imports = pkg.getImports();
imports.putAll(newPkg.getImports());
// Merge static imports
for (String staticImport : newPkg.getStaticImports()) {
pkg.addStaticImport(staticImport);
}
String lastIdent = null;
String lastType = null;
try {
// merge globals
if (newPkg.getGlobals() != null && newPkg.getGlobals() != Collections.EMPTY_MAP) {
Map<String, String> globals = pkg.getGlobals();
// Add globals
for (final Map.Entry<String, String> entry : newPkg.getGlobals().entrySet()) {
final String identifier = entry.getKey();
final String type = entry.getValue();
lastIdent = identifier;
lastType = type;
if (globals.containsKey( identifier ) && !globals.get( identifier ).equals( type )) {
throw new RuntimeException(pkg.getName() + " cannot be integrated");
} else {
pkg.addGlobal( identifier,
this.rootClassLoader.loadClass( type ) );
// this isn't a package merge, it's adding to the rulebase, but I've put it here for convienience
addGlobal(identifier,
this.rootClassLoader.loadClass(type));
}
}
}
} catch (ClassNotFoundException e) {
throw new RuntimeException( "Unable to resolve class '" + lastType +
"' for global '" + lastIdent + "'" );
}
// merge entry point declarations
if (newPkg.getEntryPointIds() != null) {
for (String ep : newPkg.getEntryPointIds()) {
pkg.addEntryPointId( ep );
}
}
// merge the type declarations
if (newPkg.getTypeDeclarations() != null) {
// add type declarations
for (TypeDeclaration type : newPkg.getTypeDeclarations().values()) {
// @TODO should we allow overrides? only if the class is not in use.
if (!pkg.getTypeDeclarations().containsKey( type.getTypeName() )) {
// add to package list of type declarations
pkg.addTypeDeclaration( type );
}
}
}
// merge window declarations
if ( newPkg.getWindowDeclarations() != null ) {
// add window declarations
for ( WindowDeclaration window : newPkg.getWindowDeclarations().values() ) {
if ( !pkg.getWindowDeclarations().containsKey( window.getName() ) ||
pkg.getWindowDeclarations().get( window.getName() ).equals( window ) ) {
pkg.addWindowDeclaration( window );
} else {
throw new RuntimeException( "Unable to merge two conflicting window declarations for window named: "+window.getName() );
}
}
}
//Merge rules into the RuleBase package
//as this is needed for individual rule removal later on
List<RuleImpl> rulesToBeRemoved = new ArrayList<RuleImpl>();
for (Rule newRule : newPkg.getRules()) {
// remove the rule if it already exists
RuleImpl oldRule = pkg.getRule(newRule.getName());
if (oldRule != null) {
rulesToBeRemoved.add(oldRule);
}
}
if (!rulesToBeRemoved.isEmpty()) {
removeRules( rulesToBeRemoved );
}
for (Rule newRule : newPkg.getRules()) {
pkg.addRule((RuleImpl)newRule);
}
//Merge The Rule Flows
if (newPkg.getRuleFlows() != null) {
for (Process flow : newPkg.getRuleFlows().values()) {
pkg.addProcess(flow);
}
}
if ( ! newPkg.getResourceTypePackages().isEmpty() ) {
KieWeavers weavers = ServiceRegistry.getInstance().get(KieWeavers.class);
for ( ResourceTypePackage rtkKpg : newPkg.getResourceTypePackages().values() ) {
weavers.merge( this, pkg, rtkKpg );
}
}
} } | public class class_name {
private void mergePackage( InternalKnowledgePackage pkg,
InternalKnowledgePackage newPkg ) {
// Merge imports
final Map<String, ImportDeclaration> imports = pkg.getImports();
imports.putAll(newPkg.getImports());
// Merge static imports
for (String staticImport : newPkg.getStaticImports()) {
pkg.addStaticImport(staticImport); // depends on control dependency: [for], data = [staticImport]
}
String lastIdent = null;
String lastType = null;
try {
// merge globals
if (newPkg.getGlobals() != null && newPkg.getGlobals() != Collections.EMPTY_MAP) {
Map<String, String> globals = pkg.getGlobals();
// Add globals
for (final Map.Entry<String, String> entry : newPkg.getGlobals().entrySet()) {
final String identifier = entry.getKey();
final String type = entry.getValue();
lastIdent = identifier; // depends on control dependency: [for], data = [none]
lastType = type; // depends on control dependency: [for], data = [none]
if (globals.containsKey( identifier ) && !globals.get( identifier ).equals( type )) {
throw new RuntimeException(pkg.getName() + " cannot be integrated");
} else {
pkg.addGlobal( identifier,
this.rootClassLoader.loadClass( type ) ); // depends on control dependency: [if], data = [none]
// this isn't a package merge, it's adding to the rulebase, but I've put it here for convienience
addGlobal(identifier,
this.rootClassLoader.loadClass(type)); // depends on control dependency: [if], data = [none]
}
}
}
} catch (ClassNotFoundException e) {
throw new RuntimeException( "Unable to resolve class '" + lastType +
"' for global '" + lastIdent + "'" );
} // depends on control dependency: [catch], data = [none]
// merge entry point declarations
if (newPkg.getEntryPointIds() != null) {
for (String ep : newPkg.getEntryPointIds()) {
pkg.addEntryPointId( ep ); // depends on control dependency: [for], data = [ep]
}
}
// merge the type declarations
if (newPkg.getTypeDeclarations() != null) {
// add type declarations
for (TypeDeclaration type : newPkg.getTypeDeclarations().values()) {
// @TODO should we allow overrides? only if the class is not in use.
if (!pkg.getTypeDeclarations().containsKey( type.getTypeName() )) {
// add to package list of type declarations
pkg.addTypeDeclaration( type ); // depends on control dependency: [if], data = [none]
}
}
}
// merge window declarations
if ( newPkg.getWindowDeclarations() != null ) {
// add window declarations
for ( WindowDeclaration window : newPkg.getWindowDeclarations().values() ) {
if ( !pkg.getWindowDeclarations().containsKey( window.getName() ) ||
pkg.getWindowDeclarations().get( window.getName() ).equals( window ) ) {
pkg.addWindowDeclaration( window ); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException( "Unable to merge two conflicting window declarations for window named: "+window.getName() );
}
}
}
//Merge rules into the RuleBase package
//as this is needed for individual rule removal later on
List<RuleImpl> rulesToBeRemoved = new ArrayList<RuleImpl>();
for (Rule newRule : newPkg.getRules()) {
// remove the rule if it already exists
RuleImpl oldRule = pkg.getRule(newRule.getName());
if (oldRule != null) {
rulesToBeRemoved.add(oldRule); // depends on control dependency: [if], data = [(oldRule]
}
}
if (!rulesToBeRemoved.isEmpty()) {
removeRules( rulesToBeRemoved ); // depends on control dependency: [if], data = [none]
}
for (Rule newRule : newPkg.getRules()) {
pkg.addRule((RuleImpl)newRule); // depends on control dependency: [for], data = [newRule]
}
//Merge The Rule Flows
if (newPkg.getRuleFlows() != null) {
for (Process flow : newPkg.getRuleFlows().values()) {
pkg.addProcess(flow); // depends on control dependency: [for], data = [flow]
}
}
if ( ! newPkg.getResourceTypePackages().isEmpty() ) {
KieWeavers weavers = ServiceRegistry.getInstance().get(KieWeavers.class);
for ( ResourceTypePackage rtkKpg : newPkg.getResourceTypePackages().values() ) {
weavers.merge( this, pkg, rtkKpg ); // depends on control dependency: [for], data = [rtkKpg]
}
}
} } |
public class class_name {
public void setContent(java.util.Collection<java.util.Map<String, String>> content) {
if (content == null) {
this.content = null;
return;
}
this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content);
} } | public class class_name {
public void setContent(java.util.Collection<java.util.Map<String, String>> content) {
if (content == null) {
this.content = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content);
} } |
public class class_name {
@Override
public double call(FunctionCall call, double arg) {
// set all the parameters
JexlContext context = new MapContext();
call.parameterNames().forEach(parameterName ->
context.set(parameterName, call.getParameter(parameterName).doubleValue()));
// set the argument value
context.set(call.getFunction().getArgumentName(), arg);
// find the appropriate range first
Expression funcBody = null;
for (Range r : ranges) {
boolean fromMatch;
boolean toMatch;
Double fromValue = 0.0;
if (r.haveFromExpr()) {
fromValue = (Double) r.getFromExpr().evaluate(context);
fromMatch = arg >= fromValue;
} else {
fromMatch = true;
}
Double toValue = 0.0;
if (r.haveToExpr()) {
toValue = (Double) r.getToExpr().evaluate(context);
toMatch = arg <= toValue;
} else {
toMatch = fromMatch;
}
if (fromMatch && toMatch) {
String from = r.getFromExpr() == null ? "<" : r.getFromExpr().getExpression();
String to = r.getToExpr() == null ? ">" : r.getToExpr().getExpression();
System.out.print("match " + from + "->" + fromValue + " .. " + to + "->" + toValue + " for " + arg);
funcBody = r.getFuncBody();
break;
}
}
// now evaluate the function body
if (funcBody == null) {
throw new FuzzerException(call.getFunction().getName() + ": no range found for " + arg);
}
Object result = funcBody.evaluate(context);
System.out.println(" "+funcBody.getExpression()+" -> "+result);
if (result instanceof Number) {
return ((Number) result).doubleValue();
} else {
throw new FuzzerException(getName() + ": unable to evaluate to number '" + funcBody.getExpression() + "'");
}
} } | public class class_name {
@Override
public double call(FunctionCall call, double arg) {
// set all the parameters
JexlContext context = new MapContext();
call.parameterNames().forEach(parameterName ->
context.set(parameterName, call.getParameter(parameterName).doubleValue()));
// set the argument value
context.set(call.getFunction().getArgumentName(), arg);
// find the appropriate range first
Expression funcBody = null;
for (Range r : ranges) {
boolean fromMatch;
boolean toMatch;
Double fromValue = 0.0;
if (r.haveFromExpr()) {
fromValue = (Double) r.getFromExpr().evaluate(context); // depends on control dependency: [if], data = [none]
fromMatch = arg >= fromValue; // depends on control dependency: [if], data = [none]
} else {
fromMatch = true; // depends on control dependency: [if], data = [none]
}
Double toValue = 0.0;
if (r.haveToExpr()) {
toValue = (Double) r.getToExpr().evaluate(context); // depends on control dependency: [if], data = [none]
toMatch = arg <= toValue; // depends on control dependency: [if], data = [none]
} else {
toMatch = fromMatch; // depends on control dependency: [if], data = [none]
}
if (fromMatch && toMatch) {
String from = r.getFromExpr() == null ? "<" : r.getFromExpr().getExpression();
String to = r.getToExpr() == null ? ">" : r.getToExpr().getExpression();
System.out.print("match " + from + "->" + fromValue + " .. " + to + "->" + toValue + " for " + arg); // depends on control dependency: [if], data = [none]
funcBody = r.getFuncBody(); // depends on control dependency: [if], data = [none]
break;
}
}
// now evaluate the function body
if (funcBody == null) {
throw new FuzzerException(call.getFunction().getName() + ": no range found for " + arg);
}
Object result = funcBody.evaluate(context);
System.out.println(" "+funcBody.getExpression()+" -> "+result);
if (result instanceof Number) {
return ((Number) result).doubleValue(); // depends on control dependency: [if], data = [none]
} else {
throw new FuzzerException(getName() + ": unable to evaluate to number '" + funcBody.getExpression() + "'");
}
} } |
public class class_name {
@Override
public void onPause() {
super.onPause();
if(ProfileService.getInstance(getActivity().getApplicationContext()).isActive(this, Profile.NETWORK)
&& PermissionUtils.isGranted(this, Manifest.permission.ACCESS_NETWORK_STATE)) {
getActivity().unregisterReceiver(networkStateReceiver);
}
} } | public class class_name {
@Override
public void onPause() {
super.onPause();
if(ProfileService.getInstance(getActivity().getApplicationContext()).isActive(this, Profile.NETWORK)
&& PermissionUtils.isGranted(this, Manifest.permission.ACCESS_NETWORK_STATE)) {
getActivity().unregisterReceiver(networkStateReceiver); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void removeFromInUse(Object buffer) {
if (inUseTable != null) {
if (null == buffer) {
throw new NullPointerException();
}
inUseTable.remove(buffer);
}
} } | public class class_name {
public void removeFromInUse(Object buffer) {
if (inUseTable != null) {
if (null == buffer) {
throw new NullPointerException();
}
inUseTable.remove(buffer); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.