code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public synchronized void run()
{
if (!start())
return;
try
{
inRunnableMode = true;
while (!stopRequired)
wait();
}
catch (InterruptedException e)
{
log.error("Server was interrupted.");
}
shutdown();
} }
|
public class class_name {
@Override
public synchronized void run()
{
if (!start())
return;
try
{
inRunnableMode = true; // depends on control dependency: [try], data = [none]
while (!stopRequired)
wait();
}
catch (InterruptedException e)
{
log.error("Server was interrupted.");
} // depends on control dependency: [catch], data = [none]
shutdown();
} }
|
public class class_name {
public void setKnobVisible(final boolean VISIBLE) {
if (null == knobVisible) {
_knobVisible = VISIBLE;
fireUpdateEvent(VISIBILITY_EVENT);
} else {
knobVisible.set(VISIBLE);
}
} }
|
public class class_name {
public void setKnobVisible(final boolean VISIBLE) {
if (null == knobVisible) {
_knobVisible = VISIBLE; // depends on control dependency: [if], data = [none]
fireUpdateEvent(VISIBILITY_EVENT); // depends on control dependency: [if], data = [none]
} else {
knobVisible.set(VISIBLE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void debugSummaryMessage(TraceComponent callersTrace, Connection connection, ConversationImpl conversation, String remark, int requestNumber)
{
if(tc.isDebugEnabled() || callersTrace.isDebugEnabled() || SIBMessageTraceJfap.tcjfs.isDebugEnabled())
{
final StringBuffer sb = new StringBuffer("{JFAPSUMMARY}");
/*
* Generate String for filtering.
* This is of the form:
* [client ip address:client port:server ip address:server port:conversation id:request number]
*/
sb.append("[");
if(connection != null)
{
sb.append(connection.getEyeCatcher());
}
sb.append(":");
if(conversation != null)
{
sb.append(conversation.getId());
}
sb.append(":");
sb.append(requestNumber);
sb.append("] ");
if(connection != null)
{
sb.append(Integer.toHexString(System.identityHashCode(connection)));
sb.append("[");
sb.append(connection.description);
sb.append(", closeDeferred=");
sb.append(connection.isCloseDeferred());
sb.append(", invalidateDeferred=");
sb.append(connection.isInvalidateDeferred());
sb.append("]:");
}
else
{
sb.append("null[]:");
}
if(conversation != null)
{
sb.append(Integer.toHexString(System.identityHashCode(conversation)));
sb.append("[");
sb.append(conversation.description);
sb.append("] ");
}
else
{
sb.append("null[] ");
}
if(remark != null)
{
sb.append(remark);
}
else
{
sb.append("null");
}
if(SIBMessageTraceJfap.tcjfs.isDebugEnabled())
{
SibTr.debug(SIBMessageTraceJfap.tcjfs, sb.toString());
}
else if(tc.isDebugEnabled())
{
SibTr.debug(tc, sb.toString());
}
else if(callersTrace.isDebugEnabled())
{
SibTr.debug(callersTrace, sb.toString());
}
}
} }
|
public class class_name {
public static void debugSummaryMessage(TraceComponent callersTrace, Connection connection, ConversationImpl conversation, String remark, int requestNumber)
{
if(tc.isDebugEnabled() || callersTrace.isDebugEnabled() || SIBMessageTraceJfap.tcjfs.isDebugEnabled())
{
final StringBuffer sb = new StringBuffer("{JFAPSUMMARY}");
/*
* Generate String for filtering.
* This is of the form:
* [client ip address:client port:server ip address:server port:conversation id:request number]
*/
sb.append("["); // depends on control dependency: [if], data = [none]
if(connection != null)
{
sb.append(connection.getEyeCatcher()); // depends on control dependency: [if], data = [(connection]
}
sb.append(":"); // depends on control dependency: [if], data = [none]
if(conversation != null)
{
sb.append(conversation.getId()); // depends on control dependency: [if], data = [(conversation]
}
sb.append(":"); // depends on control dependency: [if], data = [none]
sb.append(requestNumber); // depends on control dependency: [if], data = [none]
sb.append("] "); // depends on control dependency: [if], data = [none]
if(connection != null)
{
sb.append(Integer.toHexString(System.identityHashCode(connection))); // depends on control dependency: [if], data = [(connection]
sb.append("["); // depends on control dependency: [if], data = [none]
sb.append(connection.description); // depends on control dependency: [if], data = [(connection]
sb.append(", closeDeferred="); // depends on control dependency: [if], data = [none]
sb.append(connection.isCloseDeferred()); // depends on control dependency: [if], data = [(connection]
sb.append(", invalidateDeferred="); // depends on control dependency: [if], data = [none]
sb.append(connection.isInvalidateDeferred()); // depends on control dependency: [if], data = [(connection]
sb.append("]:"); // depends on control dependency: [if], data = [none]
}
else
{
sb.append("null[]:"); // depends on control dependency: [if], data = [none]
}
if(conversation != null)
{
sb.append(Integer.toHexString(System.identityHashCode(conversation))); // depends on control dependency: [if], data = [(conversation]
sb.append("["); // depends on control dependency: [if], data = [none]
sb.append(conversation.description); // depends on control dependency: [if], data = [(conversation]
sb.append("] "); // depends on control dependency: [if], data = [none]
}
else
{
sb.append("null[] "); // depends on control dependency: [if], data = [none]
}
if(remark != null)
{
sb.append(remark); // depends on control dependency: [if], data = [(remark]
}
else
{
sb.append("null"); // depends on control dependency: [if], data = [none]
}
if(SIBMessageTraceJfap.tcjfs.isDebugEnabled())
{
SibTr.debug(SIBMessageTraceJfap.tcjfs, sb.toString()); // depends on control dependency: [if], data = [none]
}
else if(tc.isDebugEnabled())
{
SibTr.debug(tc, sb.toString()); // depends on control dependency: [if], data = [none]
}
else if(callersTrace.isDebugEnabled())
{
SibTr.debug(callersTrace, sb.toString()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private boolean validateTemplateURI(URI flowURI) {
if (!this.sysConfig.hasPath(ServiceConfigKeys.TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY)) {
log.error("Missing config " + ServiceConfigKeys.TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY);
return false;
}
if (!flowURI.getScheme().equals(FS_SCHEME)) {
log.error(
"Expected scheme " + FS_SCHEME + " got unsupported scheme " + flowURI.getScheme());
return false;
}
return true;
} }
|
public class class_name {
private boolean validateTemplateURI(URI flowURI) {
if (!this.sysConfig.hasPath(ServiceConfigKeys.TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY)) {
log.error("Missing config " + ServiceConfigKeys.TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (!flowURI.getScheme().equals(FS_SCHEME)) {
log.error(
"Expected scheme " + FS_SCHEME + " got unsupported scheme " + flowURI.getScheme()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public static boolean writeTextFile(String _fileName, String _fileContent, Charset _charset, boolean _append) {
if (StringUtil.isBlank(_fileName)) {
return false;
}
String allText = "";
if (_append) {
File file = new File(_fileName);
if (file.exists()) {
allText = readFileToString(file) + guessLineTerminatorOfFile(_fileName);
}
}
allText += _fileContent;
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(new FileOutputStream(_fileName), _charset);
writer.write(allText);
} catch (IOException _ex) {
LOGGER.error("Could not write file to '" + _fileName + "'", _ex);
return false;
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException _ex) {
LOGGER.error("Error while closing file '" + _fileName + "'", _ex);
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean writeTextFile(String _fileName, String _fileContent, Charset _charset, boolean _append) {
if (StringUtil.isBlank(_fileName)) {
return false; // depends on control dependency: [if], data = [none]
}
String allText = "";
if (_append) {
File file = new File(_fileName);
if (file.exists()) {
allText = readFileToString(file) + guessLineTerminatorOfFile(_fileName); // depends on control dependency: [if], data = [none]
}
}
allText += _fileContent;
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(new FileOutputStream(_fileName), _charset); // depends on control dependency: [try], data = [none]
writer.write(allText); // depends on control dependency: [try], data = [none]
} catch (IOException _ex) {
LOGGER.error("Could not write file to '" + _fileName + "'", _ex);
return false;
} finally { // depends on control dependency: [catch], data = [none]
try {
if (writer != null) {
writer.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException _ex) {
LOGGER.error("Error while closing file '" + _fileName + "'", _ex);
return false;
} // depends on control dependency: [catch], data = [none]
}
return true;
} }
|
public class class_name {
protected String selectSubprotocol(String requestedSubprotocols) {
if (requestedSubprotocols == null || subprotocols.length == 0) {
return null;
}
String[] requestedSubprotocolArray = requestedSubprotocols.split(",");
for (String p: requestedSubprotocolArray) {
String requestedSubprotocol = p.trim();
for (String supportedSubprotocol: subprotocols) {
if (SUB_PROTOCOL_WILDCARD.equals(supportedSubprotocol)
|| requestedSubprotocol.equals(supportedSubprotocol)) {
selectedSubprotocol = requestedSubprotocol;
return requestedSubprotocol;
}
}
}
// No match found
return null;
} }
|
public class class_name {
protected String selectSubprotocol(String requestedSubprotocols) {
if (requestedSubprotocols == null || subprotocols.length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
String[] requestedSubprotocolArray = requestedSubprotocols.split(",");
for (String p: requestedSubprotocolArray) {
String requestedSubprotocol = p.trim();
for (String supportedSubprotocol: subprotocols) {
if (SUB_PROTOCOL_WILDCARD.equals(supportedSubprotocol)
|| requestedSubprotocol.equals(supportedSubprotocol)) {
selectedSubprotocol = requestedSubprotocol; // depends on control dependency: [if], data = [none]
return requestedSubprotocol; // depends on control dependency: [if], data = [none]
}
}
}
// No match found
return null;
} }
|
public class class_name {
public File getGeneratedCssFile(String path) {
String rootDir = tempDir + JawrConstant.CSS_SMARTSPRITES_TMP_DIR;
String fPath = null;
if (jawrConfig.isWorkingDirectoryInWebApp()) {
fPath = jawrConfig.getContext().getRealPath(rootDir + getCssPath(path));
} else {
fPath = rootDir + getCssPath(path);
}
return new File(fPath);
} }
|
public class class_name {
public File getGeneratedCssFile(String path) {
String rootDir = tempDir + JawrConstant.CSS_SMARTSPRITES_TMP_DIR;
String fPath = null;
if (jawrConfig.isWorkingDirectoryInWebApp()) {
fPath = jawrConfig.getContext().getRealPath(rootDir + getCssPath(path)); // depends on control dependency: [if], data = [none]
} else {
fPath = rootDir + getCssPath(path); // depends on control dependency: [if], data = [none]
}
return new File(fPath);
} }
|
public class class_name {
public int setValue(double dValue, boolean bDisplayOption, int iMoveMode)
{
Class<?> classData = this.getDataClass();
if (classData != Object.class)
{
Object objData = null;
if (classData == Short.class)
objData = new Short((short)dValue);
else if (classData == Integer.class)
objData = new Integer((int)dValue);
else if (classData == Float.class)
objData = new Float((float)dValue);
else if (classData == Double.class)
objData = new Double(dValue);
else if (classData == java.util.Date.class)
objData = new Date((long)dValue);
else if (classData == Boolean.class)
objData = new Boolean(dValue == 0 ? false : true);
else if (classData == String.class)
objData = new Double(dValue).toString();
return this.setData(objData, bDisplayOption, iMoveMode);
}
return super.setValue(dValue, bDisplayOption, iMoveMode);
} }
|
public class class_name {
public int setValue(double dValue, boolean bDisplayOption, int iMoveMode)
{
Class<?> classData = this.getDataClass();
if (classData != Object.class)
{
Object objData = null;
if (classData == Short.class)
objData = new Short((short)dValue);
else if (classData == Integer.class)
objData = new Integer((int)dValue);
else if (classData == Float.class)
objData = new Float((float)dValue);
else if (classData == Double.class)
objData = new Double(dValue);
else if (classData == java.util.Date.class)
objData = new Date((long)dValue);
else if (classData == Boolean.class)
objData = new Boolean(dValue == 0 ? false : true);
else if (classData == String.class)
objData = new Double(dValue).toString();
return this.setData(objData, bDisplayOption, iMoveMode); // depends on control dependency: [if], data = [none]
}
return super.setValue(dValue, bDisplayOption, iMoveMode);
} }
|
public class class_name {
public com.google.cloud.datalabeling.v1beta1.GcsSource getGcsSource() {
if (sourceCase_ == 2) {
return (com.google.cloud.datalabeling.v1beta1.GcsSource) source_;
}
return com.google.cloud.datalabeling.v1beta1.GcsSource.getDefaultInstance();
} }
|
public class class_name {
public com.google.cloud.datalabeling.v1beta1.GcsSource getGcsSource() {
if (sourceCase_ == 2) {
return (com.google.cloud.datalabeling.v1beta1.GcsSource) source_; // depends on control dependency: [if], data = [none]
}
return com.google.cloud.datalabeling.v1beta1.GcsSource.getDefaultInstance();
} }
|
public class class_name {
public void runUncachedQuery() throws TimeoutException, InterruptedException {
// [START bigquery_query_no_cache]
// BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
String query = "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(query)
// Disable the query cache to force live query evaluation.
.setUseQueryCache(false)
.build();
// Print the results.
for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
for (FieldValue val : row) {
System.out.printf("%s,", val.toString());
}
System.out.printf("\n");
}
// [END bigquery_query_no_cache]
} }
|
public class class_name {
public void runUncachedQuery() throws TimeoutException, InterruptedException {
// [START bigquery_query_no_cache]
// BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
String query = "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
QueryJobConfiguration queryConfig =
QueryJobConfiguration.newBuilder(query)
// Disable the query cache to force live query evaluation.
.setUseQueryCache(false)
.build();
// Print the results.
for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
for (FieldValue val : row) {
System.out.printf("%s,", val.toString()); // depends on control dependency: [for], data = [val]
}
System.out.printf("\n");
}
// [END bigquery_query_no_cache]
} }
|
public class class_name {
public void setCustomAmiList(java.util.Collection<CustomAmi> customAmiList) {
if (customAmiList == null) {
this.customAmiList = null;
return;
}
this.customAmiList = new com.amazonaws.internal.SdkInternalList<CustomAmi>(customAmiList);
} }
|
public class class_name {
public void setCustomAmiList(java.util.Collection<CustomAmi> customAmiList) {
if (customAmiList == null) {
this.customAmiList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.customAmiList = new com.amazonaws.internal.SdkInternalList<CustomAmi>(customAmiList);
} }
|
public class class_name {
private void handle(ExecuteContext context, SQLExceptionTranslator translator,
SQLException exception) {
DataAccessException translated = translate(context, translator, exception);
if (exception.getNextException() == null) {
context.exception(translated);
}
else {
logger.error("Execution of SQL statement failed.", translated);
}
} }
|
public class class_name {
private void handle(ExecuteContext context, SQLExceptionTranslator translator,
SQLException exception) {
DataAccessException translated = translate(context, translator, exception);
if (exception.getNextException() == null) {
context.exception(translated); // depends on control dependency: [if], data = [none]
}
else {
logger.error("Execution of SQL statement failed.", translated); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays) {
if (way == null) {
LOGGER.warning("way is null");
return null;
}
if (way.isForcePolygonLine()) {
// may build a single line string if inner ways are empty
return buildMultiLineString(way, innerWays);
}
if (way.getShape() != TDWay.LINE || innerWays != null && innerWays.size() > 0) {
// Have to be careful here about polygons and lines again, the problem with
// polygons is that a certain direction is forced, so we do not want to reverse
// closed lines that are not meant to be polygons
// may contain holes if inner ways are not empty
Polygon polygon = buildPolygon(way, innerWays);
if (polygon.isValid()) {
return polygon;
}
return repairInvalidPolygon(polygon);
}
// not a closed line
return buildLineString(way);
} }
|
public class class_name {
public static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays) {
if (way == null) {
LOGGER.warning("way is null"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (way.isForcePolygonLine()) {
// may build a single line string if inner ways are empty
return buildMultiLineString(way, innerWays); // depends on control dependency: [if], data = [none]
}
if (way.getShape() != TDWay.LINE || innerWays != null && innerWays.size() > 0) {
// Have to be careful here about polygons and lines again, the problem with
// polygons is that a certain direction is forced, so we do not want to reverse
// closed lines that are not meant to be polygons
// may contain holes if inner ways are not empty
Polygon polygon = buildPolygon(way, innerWays);
if (polygon.isValid()) {
return polygon; // depends on control dependency: [if], data = [none]
}
return repairInvalidPolygon(polygon); // depends on control dependency: [if], data = [none]
}
// not a closed line
return buildLineString(way);
} }
|
public class class_name {
public final ByteBuffer encode(CharBuffer buffer) {
try {
return newEncoder()
.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE).encode(
buffer);
} catch (CharacterCodingException ex) {
throw new Error(ex.getMessage(), ex);
}
} }
|
public class class_name {
public final ByteBuffer encode(CharBuffer buffer) {
try {
return newEncoder()
.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE).encode(
buffer); // depends on control dependency: [try], data = [none]
} catch (CharacterCodingException ex) {
throw new Error(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Pure
public static DBaseFileAttributeProvider getContainer(URL dbaseFile, int recordNumber) {
final DBaseFileAttributePool pool = getPool(dbaseFile);
if (pool != null) {
final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber);
if (accessor != null) {
return new DBaseFileAttributeProvider(accessor);
}
}
return null;
} }
|
public class class_name {
@Pure
public static DBaseFileAttributeProvider getContainer(URL dbaseFile, int recordNumber) {
final DBaseFileAttributePool pool = getPool(dbaseFile);
if (pool != null) {
final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber);
if (accessor != null) {
return new DBaseFileAttributeProvider(accessor); // depends on control dependency: [if], data = [(accessor]
}
}
return null;
} }
|
public class class_name {
private static void shutdown(ExecutorService executorService) {
executorService.shutdown();
try {
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
executorService.shutdownNow();
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
System.err.println("Thread pool did not terminate");
}
}
} catch (InterruptedException ie) {
executorService.shutdownNow();
Thread.currentThread().interrupt();
}
} }
|
public class class_name {
private static void shutdown(ExecutorService executorService) {
executorService.shutdown();
try {
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
executorService.shutdownNow(); // depends on control dependency: [if], data = [none]
if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
System.err.println("Thread pool did not terminate"); // depends on control dependency: [if], data = [none]
}
}
} catch (InterruptedException ie) {
executorService.shutdownNow();
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcRelConnects() {
if (ifcRelConnectsEClass == null) {
ifcRelConnectsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(533);
}
return ifcRelConnectsEClass;
} }
|
public class class_name {
@Override
public EClass getIfcRelConnects() {
if (ifcRelConnectsEClass == null) {
ifcRelConnectsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(533);
// depends on control dependency: [if], data = [none]
}
return ifcRelConnectsEClass;
} }
|
public class class_name {
protected void collectGroups(Group group, Set<String> groupSet) {
Enumeration<? extends Principal> members = group.members();
while (members.hasMoreElements()) {
Principal member = members.nextElement();
String name = member.getName();
boolean added = groupSet.add(name);
if (added && (member instanceof Group)) {
collectGroups((Group) member, groupSet);
}
}
} }
|
public class class_name {
protected void collectGroups(Group group, Set<String> groupSet) {
Enumeration<? extends Principal> members = group.members();
while (members.hasMoreElements()) {
Principal member = members.nextElement();
String name = member.getName();
boolean added = groupSet.add(name);
if (added && (member instanceof Group)) {
collectGroups((Group) member, groupSet); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public List sortByDateTime(Collection<? extends T> collection, final Field field,
final boolean asc) {
if (collection == null) {
return null;
}
List list = new ArrayList();
list.addAll(collection);
Collections.sort(list, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
Object object = invokeMethod(o1, field);
Object object2 = invokeMethod(o2, field);
if (object == null || object2 == null) {
return 0;
}
int value = 0;
if (object instanceof Date) {
Date v1 = (Date) object;
Date v2 = (Date) object2;
if (v1.getTime() < v2.getTime()) {
value = -1;
} else if (v1.getTime() > v2.getTime()) {
value = 1;
}
if (!asc) {
value = -value;
}
}
return value;
}
});
return list;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public List sortByDateTime(Collection<? extends T> collection, final Field field,
final boolean asc) {
if (collection == null) {
return null; // depends on control dependency: [if], data = [none]
}
List list = new ArrayList();
list.addAll(collection);
Collections.sort(list, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
Object object = invokeMethod(o1, field);
Object object2 = invokeMethod(o2, field);
if (object == null || object2 == null) {
return 0; // depends on control dependency: [if], data = [none]
}
int value = 0;
if (object instanceof Date) {
Date v1 = (Date) object;
Date v2 = (Date) object2;
if (v1.getTime() < v2.getTime()) {
value = -1; // depends on control dependency: [if], data = [none]
} else if (v1.getTime() > v2.getTime()) {
value = 1; // depends on control dependency: [if], data = [none]
}
if (!asc) {
value = -value; // depends on control dependency: [if], data = [none]
}
}
return value;
}
});
return list;
} }
|
public class class_name {
private static Method asAccessibleMethod(ReloadableType methodDeclaringTypeReloadableType, Method method,
Object target,
boolean makeAccessibleCopy) throws IllegalAccessException {
if (methodDeclaringTypeReloadableType != null && isDeleted(methodDeclaringTypeReloadableType, method)) {
throw Exceptions.noSuchMethodError(method);
}
if (method.isAccessible()) {
//More expensive check not required / copy not required
}
else {
Class<?> clazz = method.getDeclaringClass();
int mods = method.getModifiers();
int classmods;
// ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(clazz);
if (methodDeclaringTypeReloadableType == null || !methodDeclaringTypeReloadableType.hasBeenReloaded()) {
classmods = clazz.getModifiers();
}
else {
//Note: the "super bit" may be set in class modifiers but we should block it out, it
//shouldn't be shown to users of the reflection API.
classmods = methodDeclaringTypeReloadableType.getLatestTypeDescriptor().getModifiers()
& ~Opcodes.ACC_SUPER;
}
if (Modifier.isPublic(mods & classmods/*jlClassGetModifiers(clazz)*/)) {
//More expensive check not required / copy not required
}
else {
//More expensive check required
Class<?> callerClass = getCallerClass();
JVM.ensureMemberAccess(callerClass, clazz, target, mods);
if (makeAccessibleCopy) {
method = JVM.copyMethod(method); // copy: we must not change accessible flag on original method!
method.setAccessible(true);
}
}
}
return makeAccessibleCopy ? method : null;
} }
|
public class class_name {
private static Method asAccessibleMethod(ReloadableType methodDeclaringTypeReloadableType, Method method,
Object target,
boolean makeAccessibleCopy) throws IllegalAccessException {
if (methodDeclaringTypeReloadableType != null && isDeleted(methodDeclaringTypeReloadableType, method)) {
throw Exceptions.noSuchMethodError(method);
}
if (method.isAccessible()) {
//More expensive check not required / copy not required
}
else {
Class<?> clazz = method.getDeclaringClass();
int mods = method.getModifiers();
int classmods;
// ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(clazz);
if (methodDeclaringTypeReloadableType == null || !methodDeclaringTypeReloadableType.hasBeenReloaded()) {
classmods = clazz.getModifiers();
}
else {
//Note: the "super bit" may be set in class modifiers but we should block it out, it
//shouldn't be shown to users of the reflection API.
classmods = methodDeclaringTypeReloadableType.getLatestTypeDescriptor().getModifiers()
& ~Opcodes.ACC_SUPER;
}
if (Modifier.isPublic(mods & classmods/*jlClassGetModifiers(clazz)*/)) {
//More expensive check not required / copy not required
}
else {
//More expensive check required
Class<?> callerClass = getCallerClass();
JVM.ensureMemberAccess(callerClass, clazz, target, mods);
if (makeAccessibleCopy) {
method = JVM.copyMethod(method); // copy: we must not change accessible flag on original method! // depends on control dependency: [if], data = [none]
method.setAccessible(true); // depends on control dependency: [if], data = [none]
}
}
}
return makeAccessibleCopy ? method : null;
} }
|
public class class_name {
public void postRunnable (Runnable unit)
{
if (!_running) {
log.warning("Posting runnable to inactive object manager", "unit", unit,
new Exception());
}
// just append it to the queue
_evqueue.append(unit);
} }
|
public class class_name {
public void postRunnable (Runnable unit)
{
if (!_running) {
log.warning("Posting runnable to inactive object manager", "unit", unit,
new Exception()); // depends on control dependency: [if], data = [none]
}
// just append it to the queue
_evqueue.append(unit);
} }
|
public class class_name {
public ShareDetails withShareErrors(ShareError... shareErrors) {
if (this.shareErrors == null) {
setShareErrors(new java.util.ArrayList<ShareError>(shareErrors.length));
}
for (ShareError ele : shareErrors) {
this.shareErrors.add(ele);
}
return this;
} }
|
public class class_name {
public ShareDetails withShareErrors(ShareError... shareErrors) {
if (this.shareErrors == null) {
setShareErrors(new java.util.ArrayList<ShareError>(shareErrors.length)); // depends on control dependency: [if], data = [none]
}
for (ShareError ele : shareErrors) {
this.shareErrors.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public boolean pickLowestCost(Space target, NavPath path) {
if (target == this) {
return true;
}
if (links.size() == 0) {
return false;
}
Link bestLink = null;
for (int i=0;i<getLinkCount();i++) {
Link link = getLink(i);
if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) {
bestLink = link;
}
}
path.push(bestLink);
return bestLink.getTarget().pickLowestCost(target, path);
} }
|
public class class_name {
public boolean pickLowestCost(Space target, NavPath path) {
if (target == this) {
return true; // depends on control dependency: [if], data = [none]
}
if (links.size() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
Link bestLink = null;
for (int i=0;i<getLinkCount();i++) {
Link link = getLink(i);
if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) {
bestLink = link; // depends on control dependency: [if], data = [none]
}
}
path.push(bestLink);
return bestLink.getTarget().pickLowestCost(target, path);
} }
|
public class class_name {
@SuppressWarnings( {"unchecked"})
public void registerAnnotations(final Class<? extends Annotation>[] annotations) {
this.annotations = annotations;
this.annotationParsers = new AnnotationParser[annotations.length];
for (int i = 0; i < annotations.length; i++) {
annotationParsers[i] = TransactionAnnotationValues.parserFor(annotations[i]);
}
} }
|
public class class_name {
@SuppressWarnings( {"unchecked"})
public void registerAnnotations(final Class<? extends Annotation>[] annotations) {
this.annotations = annotations;
this.annotationParsers = new AnnotationParser[annotations.length];
for (int i = 0; i < annotations.length; i++) {
annotationParsers[i] = TransactionAnnotationValues.parserFor(annotations[i]); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
HashMap<Serializable,BigInteger> buildCheckSumMap(Region<Serializable,Object> region)
{
if(region.getAttributes().getDataPolicy().withPartitioning())
{
region = PartitionRegionHelper.getLocalData(region);
}
Set<Serializable> keySet = region.keySet();
if(keySet == null || keySet.isEmpty())
return null;
HashMap<Serializable,BigInteger> regionCheckSumMap = new HashMap<Serializable,BigInteger>(keySet.size());
Object object = null;
Object tmp = null;
for (Map.Entry<Serializable,Object> entry :region.entrySet())
{
object = entry.getValue();
if(PdxInstance.class.isAssignableFrom(object.getClass()))
{
tmp = ((PdxInstance)object).getObject();
if(Serializable.class.isAssignableFrom(tmp.getClass()))
{
object = tmp;
}
//else use PdxInstance.hashCode
}
if(!(PdxInstance.class.isAssignableFrom(object.getClass())))
{
regionCheckSumMap.put(entry.getKey(), MD.checksum(object));
}
else
{
regionCheckSumMap.put(entry.getKey(), BigInteger.valueOf(object.hashCode()));
}
}
return regionCheckSumMap;
} }
|
public class class_name {
HashMap<Serializable,BigInteger> buildCheckSumMap(Region<Serializable,Object> region)
{
if(region.getAttributes().getDataPolicy().withPartitioning())
{
region = PartitionRegionHelper.getLocalData(region); // depends on control dependency: [if], data = [none]
}
Set<Serializable> keySet = region.keySet();
if(keySet == null || keySet.isEmpty())
return null;
HashMap<Serializable,BigInteger> regionCheckSumMap = new HashMap<Serializable,BigInteger>(keySet.size());
Object object = null;
Object tmp = null;
for (Map.Entry<Serializable,Object> entry :region.entrySet())
{
object = entry.getValue(); // depends on control dependency: [for], data = [entry]
if(PdxInstance.class.isAssignableFrom(object.getClass()))
{
tmp = ((PdxInstance)object).getObject(); // depends on control dependency: [if], data = [none]
if(Serializable.class.isAssignableFrom(tmp.getClass()))
{
object = tmp; // depends on control dependency: [if], data = [none]
}
//else use PdxInstance.hashCode
}
if(!(PdxInstance.class.isAssignableFrom(object.getClass())))
{
regionCheckSumMap.put(entry.getKey(), MD.checksum(object)); // depends on control dependency: [if], data = [none]
}
else
{
regionCheckSumMap.put(entry.getKey(), BigInteger.valueOf(object.hashCode())); // depends on control dependency: [if], data = [none]
}
}
return regionCheckSumMap;
} }
|
public class class_name {
protected static String prependMetadata (String message, JSONObject metadata) {
try {
if (null != metadata) {
String clazz = "";
String method = "";
String file = "";
String line = "";
if (metadata.has ("$class")) {
clazz = metadata.getString ("$class");
clazz = clazz.substring (clazz.lastIndexOf ('.') + 1, clazz.length ());
}
if (metadata.has ("$method")) {
method = metadata.getString ("$method");
}
if (metadata.has ("$file")) {
file = metadata.getString ("$file");
}
if (metadata.has ("$line")) {
line = metadata.getString ("$line");
}
if (!(clazz + method + file + line).equals ("")) {
// we got something...
message = clazz + "." + method + " in " + file + ":" + line + " :: " + message;
}
}
} catch (Exception e) {
// ignore... it's best effort anyway
}
return message;
} }
|
public class class_name {
protected static String prependMetadata (String message, JSONObject metadata) {
try {
if (null != metadata) {
String clazz = "";
String method = "";
String file = "";
String line = "";
if (metadata.has ("$class")) {
clazz = metadata.getString ("$class"); // depends on control dependency: [if], data = [none]
clazz = clazz.substring (clazz.lastIndexOf ('.') + 1, clazz.length ()); // depends on control dependency: [if], data = [none]
}
if (metadata.has ("$method")) {
method = metadata.getString ("$method"); // depends on control dependency: [if], data = [none]
}
if (metadata.has ("$file")) {
file = metadata.getString ("$file"); // depends on control dependency: [if], data = [none]
}
if (metadata.has ("$line")) {
line = metadata.getString ("$line"); // depends on control dependency: [if], data = [none]
}
if (!(clazz + method + file + line).equals ("")) {
// we got something...
message = clazz + "." + method + " in " + file + ":" + line + " :: " + message; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
// ignore... it's best effort anyway
} // depends on control dependency: [catch], data = [none]
return message;
} }
|
public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsClickLogCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsClickLogCA> aggsLambda) {
ClickLogCQ cq = new ClickLogCQ();
if (queryLambda != null) {
queryLambda.callback(cq);
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
ClickLogCA ca = new ClickLogCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
} }
|
public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsClickLogCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsClickLogCA> aggsLambda) {
ClickLogCQ cq = new ClickLogCQ();
if (queryLambda != null) {
queryLambda.callback(cq); // depends on control dependency: [if], data = [none]
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder); // depends on control dependency: [if], data = [none]
}
if (aggsLambda != null) {
ClickLogCA ca = new ClickLogCA();
aggsLambda.callback(ca); // depends on control dependency: [if], data = [none]
ca.getAggregationBuilderList().forEach(builder::subAggregation); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public S unmarshal(T str) {
try {
return unmarshal.newInstance(str);
} catch (IllegalAccessException ex) {
throw new IllegalStateException("Constructor is not accessible");
} catch (InstantiationException ex) {
throw new IllegalStateException("Constructor is not valid");
} catch (InvocationTargetException ex) {
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new BindingException(ex.getMessage(), ex.getCause());
}
} }
|
public class class_name {
@Override
public S unmarshal(T str) {
try {
return unmarshal.newInstance(str);
// depends on control dependency: [try], data = [none]
} catch (IllegalAccessException ex) {
throw new IllegalStateException("Constructor is not accessible");
} catch (InstantiationException ex) {
// depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Constructor is not valid");
} catch (InvocationTargetException ex) {
// depends on control dependency: [catch], data = [none]
if (ex.getCause() instanceof RuntimeException) {
throw (RuntimeException) ex.getCause();
}
throw new BindingException(ex.getMessage(), ex.getCause());
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void read_env() {
String env;
try {
if ((env = System.getProperty("TANGO_HOST")) == null) {
if ((env = System.getenv("TANGO_HOST")) == null) {
Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
"Property \"TANGO_HOST\" not exported", "TangoDs.Util.read_env()");
}
}
assert env != null;
if (env.indexOf(":") < 0) {
Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
"Unknown \"TANGO_HOST\" property " + env, "TangoDs.Util.read_env()");
}
final String[] array = ApiUtil.parseTangoHost(env);
db_host = array[0];
} catch (final DevFailed e) {
Except.print_exception(e);
System.exit(-1);
}
} }
|
public class class_name {
private void read_env() {
String env;
try {
if ((env = System.getProperty("TANGO_HOST")) == null) {
if ((env = System.getenv("TANGO_HOST")) == null) {
Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
"Property \"TANGO_HOST\" not exported", "TangoDs.Util.read_env()"); // depends on control dependency: [if], data = [none]
}
}
assert env != null;
if (env.indexOf(":") < 0) {
Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
"Unknown \"TANGO_HOST\" property " + env, "TangoDs.Util.read_env()"); // depends on control dependency: [if], data = [none]
}
final String[] array = ApiUtil.parseTangoHost(env);
db_host = array[0]; // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
Except.print_exception(e);
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean remove(Object o) {
int i = indexOf(o);
if (i == -1)
return false;
else {
removeAt(i);
return true;
}
} }
|
public class class_name {
public boolean remove(Object o) {
int i = indexOf(o);
if (i == -1)
return false;
else {
removeAt(i); // depends on control dependency: [if], data = [(i]
return true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addValue(int... value) {
/* no-op if disabled */
if (!enabled.get())
return;
for (int v : value) {
getCurrentBucket().data.addValue(v);
}
} }
|
public class class_name {
public void addValue(int... value) {
/* no-op if disabled */
if (!enabled.get())
return;
for (int v : value) {
getCurrentBucket().data.addValue(v); // depends on control dependency: [for], data = [v]
}
} }
|
public class class_name {
public static HorizontalPanel newRow (HasAlignment.VerticalAlignmentConstant valign,
String styleName, Widget... contents)
{
HorizontalPanel row = new HorizontalPanel();
row.setVerticalAlignment(valign);
if (styleName != null) {
row.setStyleName(styleName);
}
for (Widget widget : contents) {
if (widget != null) {
if (row.getWidgetCount() > 0) {
row.add(newShim(5, 5));
}
row.add(widget);
}
}
return row;
} }
|
public class class_name {
public static HorizontalPanel newRow (HasAlignment.VerticalAlignmentConstant valign,
String styleName, Widget... contents)
{
HorizontalPanel row = new HorizontalPanel();
row.setVerticalAlignment(valign);
if (styleName != null) {
row.setStyleName(styleName); // depends on control dependency: [if], data = [(styleName]
}
for (Widget widget : contents) {
if (widget != null) {
if (row.getWidgetCount() > 0) {
row.add(newShim(5, 5)); // depends on control dependency: [if], data = [none]
}
row.add(widget); // depends on control dependency: [if], data = [(widget]
}
}
return row;
} }
|
public class class_name {
public ArrayList<String> getProteinAliases() throws XPathExpressionException {
ArrayList<String> aliasList = new ArrayList<String>();
if (uniprotDoc == null) {
return aliasList;
}
Element uniprotElement = uniprotDoc.getDocumentElement();
Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry");
Element proteinElement = XMLHelper.selectSingleElement(entryElement, "protein");
// An alternativeName can contain multiple fullNames and multiple shortNames, so we are careful to catch them all
ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName");
for (Element element : keyWordElementList) {
Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName");
aliasList.add(fullNameElement.getTextContent());
ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName");
for(Element shortNameElement : shortNameElements) {
if(null != shortNameElement) {
String shortName = shortNameElement.getTextContent();
if(null != shortName && !shortName.trim().isEmpty()) {
aliasList.add(shortName);
}
}
}
}
// recommendedName seems to allow only one fullName, to be on the safe side, we double check for multiple shortNames for the recommendedName
keyWordElementList = XMLHelper.selectElements(proteinElement, "recommendedName");
for (Element element : keyWordElementList) {
Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName");
aliasList.add(fullNameElement.getTextContent());
ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName");
for(Element shortNameElement : shortNameElements) {
if(null != shortNameElement) {
String shortName = shortNameElement.getTextContent();
if(null != shortName && !shortName.trim().isEmpty()) {
aliasList.add(shortName);
}
}
}
}
Element cdAntigen = XMLHelper.selectSingleElement(proteinElement, "cdAntigenName");
if(null != cdAntigen) {
String cdAntigenName = cdAntigen.getTextContent();
if(null != cdAntigenName && !cdAntigenName.trim().isEmpty()) {
aliasList.add(cdAntigenName);
}
}
return aliasList;
} }
|
public class class_name {
public ArrayList<String> getProteinAliases() throws XPathExpressionException {
ArrayList<String> aliasList = new ArrayList<String>();
if (uniprotDoc == null) {
return aliasList;
}
Element uniprotElement = uniprotDoc.getDocumentElement();
Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry");
Element proteinElement = XMLHelper.selectSingleElement(entryElement, "protein");
// An alternativeName can contain multiple fullNames and multiple shortNames, so we are careful to catch them all
ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName");
for (Element element : keyWordElementList) {
Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName");
aliasList.add(fullNameElement.getTextContent());
ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName");
for(Element shortNameElement : shortNameElements) {
if(null != shortNameElement) {
String shortName = shortNameElement.getTextContent();
if(null != shortName && !shortName.trim().isEmpty()) {
aliasList.add(shortName); // depends on control dependency: [if], data = [none]
}
}
}
}
// recommendedName seems to allow only one fullName, to be on the safe side, we double check for multiple shortNames for the recommendedName
keyWordElementList = XMLHelper.selectElements(proteinElement, "recommendedName");
for (Element element : keyWordElementList) {
Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName");
aliasList.add(fullNameElement.getTextContent());
ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName");
for(Element shortNameElement : shortNameElements) {
if(null != shortNameElement) {
String shortName = shortNameElement.getTextContent();
if(null != shortName && !shortName.trim().isEmpty()) {
aliasList.add(shortName); // depends on control dependency: [if], data = [none]
}
}
}
}
Element cdAntigen = XMLHelper.selectSingleElement(proteinElement, "cdAntigenName");
if(null != cdAntigen) {
String cdAntigenName = cdAntigen.getTextContent();
if(null != cdAntigenName && !cdAntigenName.trim().isEmpty()) {
aliasList.add(cdAntigenName); // depends on control dependency: [if], data = [none]
}
}
return aliasList;
} }
|
public class class_name {
public static PlotCanvas plot(String[] rowLabels, String[] columnLabels, double[][] z, Color[] palette) {
if (z.length != rowLabels.length || z[0].length != columnLabels.length) {
throw new IllegalArgumentException("Data size and label size don't match.");
}
double[] lowerBound = {0, 0};
double[] upperBound = {z[0].length, z.length};
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound, false);
canvas.add(new Heatmap(rowLabels, columnLabels, z, palette));
canvas.getAxis(0).setFrameVisible(false);
canvas.getAxis(0).setGridVisible(false);
canvas.getAxis(0).setRotation(-Math.PI / 2);
canvas.getAxis(1).setFrameVisible(false);
canvas.getAxis(1).setGridVisible(false);
double[] locations = new double[rowLabels.length];
for (int i = 0; i < rowLabels.length; i++) {
locations[i] = z.length - i - 0.5;
}
canvas.getAxis(1).addLabel(rowLabels, locations);
locations = new double[columnLabels.length];
for (int i = 0; i < columnLabels.length; i++) {
locations[i] = i + 0.5;
}
canvas.getAxis(0).addLabel(columnLabels, locations);
return canvas;
} }
|
public class class_name {
public static PlotCanvas plot(String[] rowLabels, String[] columnLabels, double[][] z, Color[] palette) {
if (z.length != rowLabels.length || z[0].length != columnLabels.length) {
throw new IllegalArgumentException("Data size and label size don't match.");
}
double[] lowerBound = {0, 0};
double[] upperBound = {z[0].length, z.length};
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound, false);
canvas.add(new Heatmap(rowLabels, columnLabels, z, palette));
canvas.getAxis(0).setFrameVisible(false);
canvas.getAxis(0).setGridVisible(false);
canvas.getAxis(0).setRotation(-Math.PI / 2);
canvas.getAxis(1).setFrameVisible(false);
canvas.getAxis(1).setGridVisible(false);
double[] locations = new double[rowLabels.length];
for (int i = 0; i < rowLabels.length; i++) {
locations[i] = z.length - i - 0.5; // depends on control dependency: [for], data = [i]
}
canvas.getAxis(1).addLabel(rowLabels, locations);
locations = new double[columnLabels.length];
for (int i = 0; i < columnLabels.length; i++) {
locations[i] = i + 0.5; // depends on control dependency: [for], data = [i]
}
canvas.getAxis(0).addLabel(columnLabels, locations);
return canvas;
} }
|
public class class_name {
public String getAsText()
{
if (throwable != null)
return throwable.toString();
if (result != null)
{
try
{
if (editor != null)
{
editor.setValue(result);
return editor.getAsText();
}
else
{
return result.toString();
}
}
catch (Exception e)
{
return "String representation of " + name + "unavailable";
}
}
return null;
} }
|
public class class_name {
public String getAsText()
{
if (throwable != null)
return throwable.toString();
if (result != null)
{
try
{
if (editor != null)
{
editor.setValue(result); // depends on control dependency: [if], data = [none]
return editor.getAsText(); // depends on control dependency: [if], data = [none]
}
else
{
return result.toString(); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
return "String representation of " + name + "unavailable";
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public DescribeFindingsResult withFindings(Finding... findings) {
if (this.findings == null) {
setFindings(new java.util.ArrayList<Finding>(findings.length));
}
for (Finding ele : findings) {
this.findings.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeFindingsResult withFindings(Finding... findings) {
if (this.findings == null) {
setFindings(new java.util.ArrayList<Finding>(findings.length)); // depends on control dependency: [if], data = [none]
}
for (Finding ele : findings) {
this.findings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public EventDefinitionReferenceType<PortletType<T>> getOrCreateSupportedPublishingEvent()
{
List<Node> nodeList = childNode.get("supported-publishing-event");
if (nodeList != null && nodeList.size() > 0)
{
return new EventDefinitionReferenceTypeImpl<PortletType<T>>(this, "supported-publishing-event", childNode, nodeList.get(0));
}
return createSupportedPublishingEvent();
} }
|
public class class_name {
public EventDefinitionReferenceType<PortletType<T>> getOrCreateSupportedPublishingEvent()
{
List<Node> nodeList = childNode.get("supported-publishing-event");
if (nodeList != null && nodeList.size() > 0)
{
return new EventDefinitionReferenceTypeImpl<PortletType<T>>(this, "supported-publishing-event", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createSupportedPublishingEvent();
} }
|
public class class_name {
private static String buildProviderUrl(List<String> urls, String baseDn) {
Assert.notNull(baseDn, "The Base DN for the LDAP server must not be null.");
Assert.notEmpty(urls, "At least one LDAP server URL must be provided.");
String trimmedBaseDn = baseDn.trim();
StringBuilder providerUrl = new StringBuilder();
for (String serverUrl : urls) {
String trimmedUrl = serverUrl.trim();
if ("".equals(trimmedUrl)) {
continue;
}
providerUrl.append(trimmedUrl);
if (!trimmedUrl.endsWith("/")) {
providerUrl.append("/");
}
providerUrl.append(trimmedBaseDn);
providerUrl.append(" ");
}
return providerUrl.toString();
} }
|
public class class_name {
private static String buildProviderUrl(List<String> urls, String baseDn) {
Assert.notNull(baseDn, "The Base DN for the LDAP server must not be null.");
Assert.notEmpty(urls, "At least one LDAP server URL must be provided.");
String trimmedBaseDn = baseDn.trim();
StringBuilder providerUrl = new StringBuilder();
for (String serverUrl : urls) {
String trimmedUrl = serverUrl.trim();
if ("".equals(trimmedUrl)) {
continue;
}
providerUrl.append(trimmedUrl); // depends on control dependency: [for], data = [none]
if (!trimmedUrl.endsWith("/")) {
providerUrl.append("/"); // depends on control dependency: [if], data = [none]
}
providerUrl.append(trimmedBaseDn); // depends on control dependency: [for], data = [none]
providerUrl.append(" "); // depends on control dependency: [for], data = [none]
}
return providerUrl.toString();
} }
|
public class class_name {
public V get(K key) throws E {
clean();
ValueRef<K, V> valueRef = mValues.get(key);
V value;
if (valueRef == null || (value = valueRef.get()) == null) {
try {
value = create(key);
} catch (Exception e) {
// Workaround compiler bug.
org.cojen.util.ThrowUnchecked.fire(e);
return null;
}
valueRef = new ValueRef<K, V>(value, mValueRefQueue, key);
while (true) {
ValueRef<K, V> existingRef = mValues.putIfAbsent(key, valueRef);
if (existingRef == null) {
// Newly created value is now the official value.
break;
}
V existing = existingRef.get();
if (existing != null) {
// Someone else just created value before us. Use that
// instead and chuck the new value object.
value = existing;
valueRef.clear();
break;
}
// Reference just got cleared. Try again. Explicitly remove it
// to prevent an infinite loop. Note that the two argument
// remove method is called to ensure that what is being removed
// is not a new value.
mValues.remove(((ValueRef<K, V>) existingRef).mKey, existingRef);
}
}
return value;
} }
|
public class class_name {
public V get(K key) throws E {
clean();
ValueRef<K, V> valueRef = mValues.get(key);
V value;
if (valueRef == null || (value = valueRef.get()) == null) {
try {
value = create(key);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Workaround compiler bug.
org.cojen.util.ThrowUnchecked.fire(e);
return null;
}
// depends on control dependency: [catch], data = [none]
valueRef = new ValueRef<K, V>(value, mValueRefQueue, key);
while (true) {
ValueRef<K, V> existingRef = mValues.putIfAbsent(key, valueRef);
if (existingRef == null) {
// Newly created value is now the official value.
break;
}
V existing = existingRef.get();
if (existing != null) {
// Someone else just created value before us. Use that
// instead and chuck the new value object.
value = existing;
// depends on control dependency: [if], data = [none]
valueRef.clear();
// depends on control dependency: [if], data = [none]
break;
}
// Reference just got cleared. Try again. Explicitly remove it
// to prevent an infinite loop. Note that the two argument
// remove method is called to ensure that what is being removed
// is not a new value.
mValues.remove(((ValueRef<K, V>) existingRef).mKey, existingRef);
// depends on control dependency: [while], data = [none]
}
}
return value;
} }
|
public class class_name {
public AnnotationVisitor visitInsnAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
if (mv != null) {
return mv.visitInsnAnnotation(typeRef, typePath, desc, visible);
}
return null;
} }
|
public class class_name {
public AnnotationVisitor visitInsnAnnotation(int typeRef,
TypePath typePath, String desc, boolean visible) {
if (mv != null) {
return mv.visitInsnAnnotation(typeRef, typePath, desc, visible); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) {
checkInit();
LOG.debug("Registering TaskManager {} under {} at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID());
// we identify task managers by their instance id
if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) {
reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport);
} else {
// first register the TaskManager
ArrayList<SlotID> reportedSlots = new ArrayList<>();
for (SlotStatus slotStatus : initialSlotReport) {
reportedSlots.add(slotStatus.getSlotID());
}
TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration(
taskExecutorConnection,
reportedSlots);
taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration);
// next register the new slots
for (SlotStatus slotStatus : initialSlotReport) {
registerSlot(
slotStatus.getSlotID(),
slotStatus.getAllocationID(),
slotStatus.getJobID(),
slotStatus.getResourceProfile(),
taskExecutorConnection);
}
}
} }
|
public class class_name {
public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) {
checkInit();
LOG.debug("Registering TaskManager {} under {} at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID());
// we identify task managers by their instance id
if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) {
reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport); // depends on control dependency: [if], data = [none]
} else {
// first register the TaskManager
ArrayList<SlotID> reportedSlots = new ArrayList<>();
for (SlotStatus slotStatus : initialSlotReport) {
reportedSlots.add(slotStatus.getSlotID()); // depends on control dependency: [for], data = [slotStatus]
}
TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration(
taskExecutorConnection,
reportedSlots);
taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration); // depends on control dependency: [if], data = [none]
// next register the new slots
for (SlotStatus slotStatus : initialSlotReport) {
registerSlot(
slotStatus.getSlotID(),
slotStatus.getAllocationID(),
slotStatus.getJobID(),
slotStatus.getResourceProfile(),
taskExecutorConnection); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public Iterator<String> getSpaces() {
log.debug("getSpaces()");
List<String> spaces = new ArrayList<>();
List<Bucket> buckets = listAllBuckets();
for (Bucket bucket : buckets) {
String bucketName = bucket.getName();
if (isSpace(bucketName)) {
spaces.add(getSpaceId(bucketName));
}
}
// sort after the bucket prefix has been stripped off
Collections.sort(spaces);
return spaces.iterator();
} }
|
public class class_name {
public Iterator<String> getSpaces() {
log.debug("getSpaces()");
List<String> spaces = new ArrayList<>();
List<Bucket> buckets = listAllBuckets();
for (Bucket bucket : buckets) {
String bucketName = bucket.getName();
if (isSpace(bucketName)) {
spaces.add(getSpaceId(bucketName)); // depends on control dependency: [if], data = [none]
}
}
// sort after the bucket prefix has been stripped off
Collections.sort(spaces);
return spaces.iterator();
} }
|
public class class_name {
public void marshall(UserSettings userSettings, ProtocolMarshaller protocolMarshaller) {
if (userSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userSettings.getTelephony(), TELEPHONY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UserSettings userSettings, ProtocolMarshaller protocolMarshaller) {
if (userSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userSettings.getTelephony(), TELEPHONY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void close()
{
assert (fd != null);
try {
fd.close();
socket.eventClosed(endpoint, fd);
}
catch (IOException e) {
socket.eventCloseFailed(endpoint, ZError.exccode(e));
}
fd = null;
} }
|
public class class_name {
private void close()
{
assert (fd != null);
try {
fd.close(); // depends on control dependency: [try], data = [none]
socket.eventClosed(endpoint, fd); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
socket.eventCloseFailed(endpoint, ZError.exccode(e));
} // depends on control dependency: [catch], data = [none]
fd = null;
} }
|
public class class_name {
public void marshall(EnableDomainTransferLockRequest enableDomainTransferLockRequest, ProtocolMarshaller protocolMarshaller) {
if (enableDomainTransferLockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(enableDomainTransferLockRequest.getDomainName(), DOMAINNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(EnableDomainTransferLockRequest enableDomainTransferLockRequest, ProtocolMarshaller protocolMarshaller) {
if (enableDomainTransferLockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(enableDomainTransferLockRequest.getDomainName(), DOMAINNAME_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 {
@Nonnull
public String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Creating new session id with orig id '" + sessionId + "' and memcached id '" + memcachedId + "'." );
}
if ( memcachedId == null ) {
return sessionId;
}
final int idx = sessionId.indexOf( '.' );
if ( idx < 0 ) {
return sessionId + "-" + memcachedId;
} else {
return sessionId.substring( 0, idx ) + "-" + memcachedId + sessionId.substring( idx );
}
} }
|
public class class_name {
@Nonnull
public String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Creating new session id with orig id '" + sessionId + "' and memcached id '" + memcachedId + "'." ); // depends on control dependency: [if], data = [none]
}
if ( memcachedId == null ) {
return sessionId; // depends on control dependency: [if], data = [none]
}
final int idx = sessionId.indexOf( '.' );
if ( idx < 0 ) {
return sessionId + "-" + memcachedId; // depends on control dependency: [if], data = [none]
} else {
return sessionId.substring( 0, idx ) + "-" + memcachedId + sessionId.substring( idx ); // depends on control dependency: [if], data = [( idx]
}
} }
|
public class class_name {
private File getFileFromPath(final String path) {
File result = (path != null) ? new File(path) : null;
// AS7-1752 see if a non-existent relative path exists relative to the home dir
if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
File relative = new File(homeDir, path);
if (relative.exists()) {
result = relative;
}
}
return result;
} }
|
public class class_name {
private File getFileFromPath(final String path) {
File result = (path != null) ? new File(path) : null;
// AS7-1752 see if a non-existent relative path exists relative to the home dir
if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
File relative = new File(homeDir, path);
if (relative.exists()) {
result = relative; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
if (foundMethodBinding == null) {
continue; // not a bound method
}
if (foundMethodBinding instanceof ConformanceMethodBinding) {
myServerConformanceMethod = null;
continue;
}
String resourceName = foundMethodBinding.getResourceName();
if (!resourceNames.contains(resourceName)) {
resourceNames.add(resourceName);
}
}
} }
|
public class class_name {
private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
if (foundMethodBinding == null) {
continue; // not a bound method
}
if (foundMethodBinding instanceof ConformanceMethodBinding) {
myServerConformanceMethod = null; // depends on control dependency: [if], data = [none]
continue;
}
String resourceName = foundMethodBinding.getResourceName();
if (!resourceNames.contains(resourceName)) {
resourceNames.add(resourceName); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static final String digitsAndPlusOnly(MatcherCompat matcher) {
StringBuilder buffer = new StringBuilder();
String matchingRegion = matcher.group();
for (int i = 0, size = matchingRegion.length(); i < size; i++) {
char character = matchingRegion.charAt(i);
if (character == '+' || Character.isDigit(character)) {
buffer.append(character);
}
}
return buffer.toString();
} }
|
public class class_name {
public static final String digitsAndPlusOnly(MatcherCompat matcher) {
StringBuilder buffer = new StringBuilder();
String matchingRegion = matcher.group();
for (int i = 0, size = matchingRegion.length(); i < size; i++) {
char character = matchingRegion.charAt(i);
if (character == '+' || Character.isDigit(character)) {
buffer.append(character); // depends on control dependency: [if], data = [(character]
}
}
return buffer.toString();
} }
|
public class class_name {
@Pure
public int indexOf(BusItineraryHalt bushalt) {
if (bushalt == null) {
return -1;
}
if (bushalt.isValidPrimitive()) {
return ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, bushalt);
}
int idx = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, bushalt);
if (idx >= 0) {
idx += this.validHalts.size();
}
return idx;
} }
|
public class class_name {
@Pure
public int indexOf(BusItineraryHalt bushalt) {
if (bushalt == null) {
return -1; // depends on control dependency: [if], data = [none]
}
if (bushalt.isValidPrimitive()) {
return ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, bushalt); // depends on control dependency: [if], data = [none]
}
int idx = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, bushalt);
if (idx >= 0) {
idx += this.validHalts.size(); // depends on control dependency: [if], data = [none]
}
return idx;
} }
|
public class class_name {
final void connectionErrorOccurred(final Exception exception, boolean callJCAListener) {
final String methodName = "connectionErrorOccurred";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] {exception, Boolean.valueOf(callJCAListener)});
}
/*
* Only send the event if the server isn't shutting down anyway
*/
if (!SibRaEngineComponent.isServerStopping()) {
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
// Copy list to protect against concurrent modification by listener
final List copy;
synchronized (_eventListeners) {
copy = new ArrayList(_eventListeners);
}
// We will probably want to look into some how figuring out that the listener
// that we have is the JCA one and not some other one that is registered as we
// want to call those ones regardless of the flag. Today we only expect JCA listeners
// to be registered
if (callJCAListener)
{
for (final Iterator iterator = copy.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof ConnectionEventListener) {
((ConnectionEventListener) object)
.connectionErrorOccurred(event);
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} }
|
public class class_name {
final void connectionErrorOccurred(final Exception exception, boolean callJCAListener) {
final String methodName = "connectionErrorOccurred";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] {exception, Boolean.valueOf(callJCAListener)}); // depends on control dependency: [if], data = [none]
}
/*
* Only send the event if the server isn't shutting down anyway
*/
if (!SibRaEngineComponent.isServerStopping()) {
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.CONNECTION_ERROR_OCCURRED, exception);
// Copy list to protect against concurrent modification by listener
final List copy;
synchronized (_eventListeners) { // depends on control dependency: [if], data = [none]
copy = new ArrayList(_eventListeners);
}
// We will probably want to look into some how figuring out that the listener
// that we have is the JCA one and not some other one that is registered as we
// want to call those ones regardless of the flag. Today we only expect JCA listeners
// to be registered
if (callJCAListener)
{
for (final Iterator iterator = copy.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
if (object instanceof ConnectionEventListener) {
((ConnectionEventListener) object)
.connectionErrorOccurred(event); // depends on control dependency: [if], data = [none]
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static ArrayList<String> getSpeechRecognitionResults(int requestCode, int resultCode, Intent data) {
ArrayList<String> matches = null;
if (requestCode == 0 && resultCode == -1) {
matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
StringBuilder sb = new StringBuilder();
for (String match : matches) {
sb.append(match + ", ");
}
}
return matches;
} }
|
public class class_name {
public static ArrayList<String> getSpeechRecognitionResults(int requestCode, int resultCode, Intent data) {
ArrayList<String> matches = null;
if (requestCode == 0 && resultCode == -1) {
matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
// depends on control dependency: [if], data = [none]
StringBuilder sb = new StringBuilder();
for (String match : matches) {
sb.append(match + ", ");
// depends on control dependency: [for], data = [match]
}
}
return matches;
} }
|
public class class_name {
@Nonnull
public SourceLineAnnotation getPrimarySourceLineAnnotation() {
// Highest priority: return the first top level source line annotation
for (BugAnnotation annotation : annotationList) {
if (annotation instanceof SourceLineAnnotation
&& SourceLineAnnotation.DEFAULT_ROLE.equals(annotation.getDescription())
&& !((SourceLineAnnotation) annotation).isUnknown()) {
return (SourceLineAnnotation) annotation;
}
}
for (BugAnnotation annotation : annotationList) {
if (annotation instanceof SourceLineAnnotation && !((SourceLineAnnotation) annotation).isUnknown()) {
return (SourceLineAnnotation) annotation;
}
}
// Next: Try primary method, primary field, primary class
SourceLineAnnotation srcLine;
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryMethod())) != null) {
return srcLine;
}
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryField())) != null) {
return srcLine;
}
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryClass())) != null) {
return srcLine;
}
// Last resort: throw exception
throw new IllegalStateException("BugInstance for " + getType()
+ " must contain at least one class, method, or field annotation");
} }
|
public class class_name {
@Nonnull
public SourceLineAnnotation getPrimarySourceLineAnnotation() {
// Highest priority: return the first top level source line annotation
for (BugAnnotation annotation : annotationList) {
if (annotation instanceof SourceLineAnnotation
&& SourceLineAnnotation.DEFAULT_ROLE.equals(annotation.getDescription())
&& !((SourceLineAnnotation) annotation).isUnknown()) {
return (SourceLineAnnotation) annotation; // depends on control dependency: [if], data = [none]
}
}
for (BugAnnotation annotation : annotationList) {
if (annotation instanceof SourceLineAnnotation && !((SourceLineAnnotation) annotation).isUnknown()) {
return (SourceLineAnnotation) annotation; // depends on control dependency: [if], data = [none]
}
}
// Next: Try primary method, primary field, primary class
SourceLineAnnotation srcLine;
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryMethod())) != null) {
return srcLine; // depends on control dependency: [if], data = [none]
}
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryField())) != null) {
return srcLine; // depends on control dependency: [if], data = [none]
}
if ((srcLine = inspectPackageMemberSourceLines(getPrimaryClass())) != null) {
return srcLine; // depends on control dependency: [if], data = [none]
}
// Last resort: throw exception
throw new IllegalStateException("BugInstance for " + getType()
+ " must contain at least one class, method, or field annotation");
} }
|
public class class_name {
public static IClasspathEntry newLibraryEntry(Bundle bundle, IPath precomputedBundlePath, BundleURLMappings javadocURLs) {
assert bundle != null;
final IPath bundlePath;
if (precomputedBundlePath == null) {
bundlePath = BundleUtil.getBundlePath(bundle);
} else {
bundlePath = precomputedBundlePath;
}
final IPath sourceBundlePath = BundleUtil.getSourceBundlePath(bundle, bundlePath);
final IPath javadocPath = BundleUtil.getJavadocBundlePath(bundle, bundlePath);
final IClasspathAttribute[] extraAttributes;
if (javadocPath == null) {
if (javadocURLs != null) {
final String url = javadocURLs.getURLForBundle(bundle);
if (!Strings.isNullOrEmpty(url)) {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
url);
extraAttributes = new IClasspathAttribute[] {attr};
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
}
} else {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
javadocPath.makeAbsolute().toOSString());
extraAttributes = new IClasspathAttribute[] {attr};
}
return JavaCore.newLibraryEntry(
bundlePath,
sourceBundlePath,
null,
null,
extraAttributes,
false);
} }
|
public class class_name {
public static IClasspathEntry newLibraryEntry(Bundle bundle, IPath precomputedBundlePath, BundleURLMappings javadocURLs) {
assert bundle != null;
final IPath bundlePath;
if (precomputedBundlePath == null) {
bundlePath = BundleUtil.getBundlePath(bundle); // depends on control dependency: [if], data = [none]
} else {
bundlePath = precomputedBundlePath; // depends on control dependency: [if], data = [none]
}
final IPath sourceBundlePath = BundleUtil.getSourceBundlePath(bundle, bundlePath);
final IPath javadocPath = BundleUtil.getJavadocBundlePath(bundle, bundlePath);
final IClasspathAttribute[] extraAttributes;
if (javadocPath == null) {
if (javadocURLs != null) {
final String url = javadocURLs.getURLForBundle(bundle);
if (!Strings.isNullOrEmpty(url)) {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
url);
extraAttributes = new IClasspathAttribute[] {attr}; // depends on control dependency: [if], data = [none]
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; // depends on control dependency: [if], data = [none]
}
} else {
extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES; // depends on control dependency: [if], data = [none]
}
} else {
final IClasspathAttribute attr = JavaCore.newClasspathAttribute(
IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
javadocPath.makeAbsolute().toOSString());
extraAttributes = new IClasspathAttribute[] {attr}; // depends on control dependency: [if], data = [none]
}
return JavaCore.newLibraryEntry(
bundlePath,
sourceBundlePath,
null,
null,
extraAttributes,
false);
} }
|
public class class_name {
@Override
public INDArray computeGradient(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {
labels = labels.castTo(preOutput.dataType()); //No-op if already correct dtype
long nSamples = labels.size(0);
INDArray output = activationFn.getActivation(preOutput.dup(), false);
MixtureDensityComponents mdc = extractComponents(output);
INDArray gradient = Nd4j.zeros(nSamples, preOutput.columns());
INDArray labelsMinusMu = labelsMinusMu(labels, mdc.mu);
INDArray labelsMinusMuSquared = labelsMinusMu.mul(labelsMinusMu).sum(2);
// This computes pi_i, see Bishop equation (30).
// See http://www.plsyard.com/dealing-overflow-and-underflow-in-softmax-function/
// this post for why we calculate the pi_i in this way.
// With the exponential function here, we have to be very careful
// about overflow/underflow considerations even with
// fairly intermediate values. Subtracting the max
// here helps to ensure over/underflow does not happen here.
// This isn't exactly a softmax because there's an 'alpha' coefficient
// here, but the technique works, nonetheless.
INDArray variance = mdc.sigma.mul(mdc.sigma);
INDArray minustwovariance = variance.mul(2).negi();
INDArray normalPart = mdc.alpha.div(Transforms.pow(mdc.sigma.mul(SQRT_TWO_PI), mLabelWidth));
INDArray exponent = labelsMinusMuSquared.div(minustwovariance);
INDArray exponentMax = exponent.max(1);
exponent.subiColumnVector(exponentMax);
INDArray pi = Transforms.exp(exponent).muli(normalPart);
INDArray piDivisor = pi.sum(true,1);
pi.diviColumnVector(piDivisor);
// See Bishop equation (35)
//INDArray dLdZAlpha = Nd4j.zeros(nSamples, nLabelsPerSample, mMixturesPerLabel); //mdc.alpha.sub(pi);
INDArray dLdZAlpha = mdc.alpha.sub(pi);
// See Bishop equation (38)
INDArray dLdZSigma = (labelsMinusMuSquared.div(variance).subi(mLabelWidth)).muli(-1).muli(pi);
// See Bishop equation (39)
// This turned out to be way less efficient than
// the simple 'for' loop here.
//INDArray dLdZMu = pi
// .div(variance)
// .reshape(nSamples, mMixtures, 1)
// .repeat(2, mLabelWidth)
// .muli(labelsMinusMu)
// .negi()
// .reshape(nSamples, mMixtures * mLabelWidth);
INDArray dLdZMu = Nd4j.create(nSamples, mMixtures, mLabelWidth);
for (int k = 0; k < mLabelWidth; k++) {
dLdZMu.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(k)},
labelsMinusMu.get(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.point(k)}).muli(pi).divi(variance).negi());
}
dLdZMu = dLdZMu.reshape(nSamples, mMixtures * mLabelWidth);
// Place components of gradient into gradient holder.
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.interval(0, mMixtures)}, dLdZAlpha);
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.interval(mMixtures, mMixtures * 2)},
dLdZSigma);
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(),
NDArrayIndex.interval(mMixtures * 2, (mLabelWidth + 2) * mMixtures)}, dLdZMu);
INDArray gradients = activationFn.backprop(preOutput, gradient).getFirst();
if (mask != null) {
LossUtil.applyMask(gradients, mask);
}
return gradients;
} }
|
public class class_name {
@Override
public INDArray computeGradient(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {
labels = labels.castTo(preOutput.dataType()); //No-op if already correct dtype
long nSamples = labels.size(0);
INDArray output = activationFn.getActivation(preOutput.dup(), false);
MixtureDensityComponents mdc = extractComponents(output);
INDArray gradient = Nd4j.zeros(nSamples, preOutput.columns());
INDArray labelsMinusMu = labelsMinusMu(labels, mdc.mu);
INDArray labelsMinusMuSquared = labelsMinusMu.mul(labelsMinusMu).sum(2);
// This computes pi_i, see Bishop equation (30).
// See http://www.plsyard.com/dealing-overflow-and-underflow-in-softmax-function/
// this post for why we calculate the pi_i in this way.
// With the exponential function here, we have to be very careful
// about overflow/underflow considerations even with
// fairly intermediate values. Subtracting the max
// here helps to ensure over/underflow does not happen here.
// This isn't exactly a softmax because there's an 'alpha' coefficient
// here, but the technique works, nonetheless.
INDArray variance = mdc.sigma.mul(mdc.sigma);
INDArray minustwovariance = variance.mul(2).negi();
INDArray normalPart = mdc.alpha.div(Transforms.pow(mdc.sigma.mul(SQRT_TWO_PI), mLabelWidth));
INDArray exponent = labelsMinusMuSquared.div(minustwovariance);
INDArray exponentMax = exponent.max(1);
exponent.subiColumnVector(exponentMax);
INDArray pi = Transforms.exp(exponent).muli(normalPart);
INDArray piDivisor = pi.sum(true,1);
pi.diviColumnVector(piDivisor);
// See Bishop equation (35)
//INDArray dLdZAlpha = Nd4j.zeros(nSamples, nLabelsPerSample, mMixturesPerLabel); //mdc.alpha.sub(pi);
INDArray dLdZAlpha = mdc.alpha.sub(pi);
// See Bishop equation (38)
INDArray dLdZSigma = (labelsMinusMuSquared.div(variance).subi(mLabelWidth)).muli(-1).muli(pi);
// See Bishop equation (39)
// This turned out to be way less efficient than
// the simple 'for' loop here.
//INDArray dLdZMu = pi
// .div(variance)
// .reshape(nSamples, mMixtures, 1)
// .repeat(2, mLabelWidth)
// .muli(labelsMinusMu)
// .negi()
// .reshape(nSamples, mMixtures * mLabelWidth);
INDArray dLdZMu = Nd4j.create(nSamples, mMixtures, mLabelWidth);
for (int k = 0; k < mLabelWidth; k++) {
dLdZMu.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(k)},
labelsMinusMu.get(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.point(k)}).muli(pi).divi(variance).negi()); // depends on control dependency: [for], data = [none]
}
dLdZMu = dLdZMu.reshape(nSamples, mMixtures * mLabelWidth);
// Place components of gradient into gradient holder.
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.interval(0, mMixtures)}, dLdZAlpha);
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.interval(mMixtures, mMixtures * 2)},
dLdZSigma);
gradient.put(new INDArrayIndex[] {NDArrayIndex.all(),
NDArrayIndex.interval(mMixtures * 2, (mLabelWidth + 2) * mMixtures)}, dLdZMu);
INDArray gradients = activationFn.backprop(preOutput, gradient).getFirst();
if (mask != null) {
LossUtil.applyMask(gradients, mask); // depends on control dependency: [if], data = [none]
}
return gradients;
} }
|
public class class_name {
public <T1,T2> Collection<T2> map
(final Collection<? extends T1> collection,
final F1<T1,T2> f)
{
final Collection<T2> result = new LinkedList<T2> ();
for (final T1 object : collection)
{
result.add (f.run (object));
}
return result;
} }
|
public class class_name {
public <T1,T2> Collection<T2> map
(final Collection<? extends T1> collection,
final F1<T1,T2> f)
{
final Collection<T2> result = new LinkedList<T2> ();
for (final T1 object : collection)
{
result.add (f.run (object)); // depends on control dependency: [for], data = [object]
}
return result;
} }
|
public class class_name {
private static boolean samePattern(String value1, String value2) {
if (value1.length() == 0) {
return value2.length() == 0;
}
if (value1.charAt(0) == '{') {
return value2.length() > 0 && value2.charAt(0) == '{';
}
return value1.equals(value2);
} }
|
public class class_name {
private static boolean samePattern(String value1, String value2) {
if (value1.length() == 0) {
return value2.length() == 0; // depends on control dependency: [if], data = [none]
}
if (value1.charAt(0) == '{') {
return value2.length() > 0 && value2.charAt(0) == '{'; // depends on control dependency: [if], data = [none]
}
return value1.equals(value2);
} }
|
public class class_name {
public static List extractToList(final Collection collection, final String propertyName) {
List list = new ArrayList(collection.size());
try {
for (Object obj : collection) {
list.add(PropertyUtils.getProperty(obj, propertyName));
}
} catch (ReflectiveOperationException e) {
throw new ReflectionRuntimeException(e);
}
return list;
} }
|
public class class_name {
public static List extractToList(final Collection collection, final String propertyName) {
List list = new ArrayList(collection.size());
try {
for (Object obj : collection) {
list.add(PropertyUtils.getProperty(obj, propertyName)); // depends on control dependency: [for], data = [obj]
}
} catch (ReflectiveOperationException e) {
throw new ReflectionRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return list;
} }
|
public class class_name {
public boolean recordLends(JSTypeExpression name) {
if (!hasAnyTypeRelatedTags()) {
currentInfo.setLendsName(name);
populated = true;
return true;
} else {
return false;
}
} }
|
public class class_name {
public boolean recordLends(JSTypeExpression name) {
if (!hasAnyTypeRelatedTags()) {
currentInfo.setLendsName(name); // depends on control dependency: [if], data = [none]
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <T> void assertThat(String reason, T actual, Matcher<? super T> matcher) {
if (!matcher.matches(actual)) {
Description description = new StringDescription();
description.appendText(reason)
.appendText("\nExpected: ")
.appendDescriptionOf(matcher)
.appendText("\n but: ");
matcher.describeMismatch(actual, description);
throw new LazyAssertionError(description.toString());
}
} }
|
public class class_name {
public static <T> void assertThat(String reason, T actual, Matcher<? super T> matcher) {
if (!matcher.matches(actual)) {
Description description = new StringDescription();
description.appendText(reason)
.appendText("\nExpected: ")
.appendDescriptionOf(matcher)
.appendText("\n but: "); // depends on control dependency: [if], data = [none]
matcher.describeMismatch(actual, description); // depends on control dependency: [if], data = [none]
throw new LazyAssertionError(description.toString());
}
} }
|
public class class_name {
@Override
public synchronized void close() {
Set<IXADataRecorder> recoveredXADataRecorders = this.getRecoveredXADataRecorders();
for (IXADataRecorder dataRecorder : recoveredXADataRecorders) {
dataRecorder.disqualify();
}
} }
|
public class class_name {
@Override
public synchronized void close() {
Set<IXADataRecorder> recoveredXADataRecorders = this.getRecoveredXADataRecorders();
for (IXADataRecorder dataRecorder : recoveredXADataRecorders) {
dataRecorder.disqualify(); // depends on control dependency: [for], data = [dataRecorder]
}
} }
|
public class class_name {
public void attach() {
mLock.lock();
try {
if (mTxnMgr.setLocalScope(this, mDetached)) {
mDetached = false;
} else if (!mDetached) {
throw new IllegalStateException("Transaction scope is not detached");
} else {
throw new IllegalStateException
("Current thread has a different transaction already attached");
}
} finally {
mLock.unlock();
}
} }
|
public class class_name {
public void attach() {
mLock.lock();
try {
if (mTxnMgr.setLocalScope(this, mDetached)) {
mDetached = false;
// depends on control dependency: [if], data = [none]
} else if (!mDetached) {
throw new IllegalStateException("Transaction scope is not detached");
} else {
throw new IllegalStateException
("Current thread has a different transaction already attached");
}
} finally {
mLock.unlock();
}
} }
|
public class class_name {
@Override
public CQVariables getVariables(Bindings bindings) {
CQVariablesImpl variables = new CQVariablesImpl();
// Add all of the sling bindings
SlingHttpServletRequest request = (SlingHttpServletRequest) bindings
.get("request");
variables.putAll(bindings);
// Add all of the CQ stuff
Resource resource = request.getResource();
ResourceResolver resolver = request.getResourceResolver();
XSSAPI xssAPI = xssApi.getRequestSpecificAPI(request);
ComponentContext componentContext = WCMUtils
.getComponentContext(request);
EditContext editContext = componentContext != null ? componentContext
.getEditContext() : null;
ValueMap properties = ResourceUtil.getValueMap(resource);
PageManager pageManager = (PageManager) resolver
.adaptTo(PageManager.class);
ValueMap pageProperties = null;
Page currentPage = null;
Page resourcePage = null;
if (pageManager != null) {
resourcePage = pageManager.getContainingPage(resource);
currentPage = componentContext != null ? componentContext.getPage()
: null;
if (currentPage == null) {
currentPage = resourcePage;
}
if (currentPage == null) {
pageProperties = null;
} else {
pageProperties = new HierarchyNodeInheritanceValueMap(
currentPage.getContentResource());
}
}
com.day.cq.wcm.api.components.Component component = WCMUtils
.getComponent(resource);
Designer designer = (Designer) request.getResourceResolver().adaptTo(
Designer.class);
if (designer != null) {
Design currentDesign;
if (currentPage == null) {
currentDesign = null;
} else {
String currentDesignKey = REQ_ATTR_PREFIX
+ currentPage.getPath();
Object cachedCurrentDesign = request
.getAttribute(currentDesignKey);
if (cachedCurrentDesign != null) {
currentDesign = (Design) cachedCurrentDesign;
} else {
currentDesign = designer.getDesign(currentPage);
request.setAttribute(currentDesignKey, currentDesign);
}
}
Design resourceDesign;
if (resourcePage == null) {
resourceDesign = null;
} else {
String resourceDesignkey = REQ_ATTR_PREFIX
+ resourcePage.getPath();
Object cachedresourceDesign = request
.getAttribute(resourceDesignkey);
if (cachedresourceDesign != null) {
resourceDesign = (Design) cachedresourceDesign;
} else {
resourceDesign = designer.getDesign(resourcePage);
request.setAttribute(resourceDesignkey, resourceDesign);
}
}
Style currentStyle = currentDesign != null
&& componentContext != null ? currentDesign
.getStyle(componentContext.getCell()) : null;
variables.put(CQVariables.DESIGNER, designer);
variables.put(CQVariables.CURRENT_DESIGN, currentDesign);
variables.put(CQVariables.RESOURCE_DESIGN, resourceDesign);
variables.put(CQVariables.CURRENT_STYLE, currentStyle);
}
variables.put(CQVariables.XSS_API, xssAPI);
variables.put(CQVariables.COMPONENT_CONTEXT, componentContext);
variables.put(CQVariables.EDIT_CONTEXT, editContext);
variables.put(CQVariables.PROPERTIES, properties);
variables.put(CQVariables.PAGE_MANAGER, pageManager);
variables.put(CQVariables.CURRENT_PAGE, currentPage);
variables.put(CQVariables.RESOURCE_PAGE, resourcePage);
variables.put(CQVariables.PAGE_PROPERTIES, pageProperties);
variables.put(CQVariables.COMPONENT, component);
variables.put(CQVariables.SESSION, resource.getResourceResolver()
.adaptTo(Session.class));
return variables;
} }
|
public class class_name {
@Override
public CQVariables getVariables(Bindings bindings) {
CQVariablesImpl variables = new CQVariablesImpl();
// Add all of the sling bindings
SlingHttpServletRequest request = (SlingHttpServletRequest) bindings
.get("request");
variables.putAll(bindings);
// Add all of the CQ stuff
Resource resource = request.getResource();
ResourceResolver resolver = request.getResourceResolver();
XSSAPI xssAPI = xssApi.getRequestSpecificAPI(request);
ComponentContext componentContext = WCMUtils
.getComponentContext(request);
EditContext editContext = componentContext != null ? componentContext
.getEditContext() : null;
ValueMap properties = ResourceUtil.getValueMap(resource);
PageManager pageManager = (PageManager) resolver
.adaptTo(PageManager.class);
ValueMap pageProperties = null;
Page currentPage = null;
Page resourcePage = null;
if (pageManager != null) {
resourcePage = pageManager.getContainingPage(resource); // depends on control dependency: [if], data = [none]
currentPage = componentContext != null ? componentContext.getPage()
: null; // depends on control dependency: [if], data = [none]
if (currentPage == null) {
currentPage = resourcePage; // depends on control dependency: [if], data = [none]
}
if (currentPage == null) {
pageProperties = null; // depends on control dependency: [if], data = [none]
} else {
pageProperties = new HierarchyNodeInheritanceValueMap(
currentPage.getContentResource()); // depends on control dependency: [if], data = [none]
}
}
com.day.cq.wcm.api.components.Component component = WCMUtils
.getComponent(resource);
Designer designer = (Designer) request.getResourceResolver().adaptTo(
Designer.class);
if (designer != null) {
Design currentDesign;
if (currentPage == null) {
currentDesign = null; // depends on control dependency: [if], data = [none]
} else {
String currentDesignKey = REQ_ATTR_PREFIX
+ currentPage.getPath();
Object cachedCurrentDesign = request
.getAttribute(currentDesignKey);
if (cachedCurrentDesign != null) {
currentDesign = (Design) cachedCurrentDesign; // depends on control dependency: [if], data = [none]
} else {
currentDesign = designer.getDesign(currentPage); // depends on control dependency: [if], data = [none]
request.setAttribute(currentDesignKey, currentDesign); // depends on control dependency: [if], data = [none]
}
}
Design resourceDesign;
if (resourcePage == null) {
resourceDesign = null; // depends on control dependency: [if], data = [none]
} else {
String resourceDesignkey = REQ_ATTR_PREFIX
+ resourcePage.getPath();
Object cachedresourceDesign = request
.getAttribute(resourceDesignkey);
if (cachedresourceDesign != null) {
resourceDesign = (Design) cachedresourceDesign; // depends on control dependency: [if], data = [none]
} else {
resourceDesign = designer.getDesign(resourcePage); // depends on control dependency: [if], data = [none]
request.setAttribute(resourceDesignkey, resourceDesign); // depends on control dependency: [if], data = [none]
}
}
Style currentStyle = currentDesign != null
&& componentContext != null ? currentDesign
.getStyle(componentContext.getCell()) : null;
variables.put(CQVariables.DESIGNER, designer); // depends on control dependency: [if], data = [none]
variables.put(CQVariables.CURRENT_DESIGN, currentDesign); // depends on control dependency: [if], data = [none]
variables.put(CQVariables.RESOURCE_DESIGN, resourceDesign); // depends on control dependency: [if], data = [none]
variables.put(CQVariables.CURRENT_STYLE, currentStyle); // depends on control dependency: [if], data = [none]
}
variables.put(CQVariables.XSS_API, xssAPI);
variables.put(CQVariables.COMPONENT_CONTEXT, componentContext);
variables.put(CQVariables.EDIT_CONTEXT, editContext);
variables.put(CQVariables.PROPERTIES, properties);
variables.put(CQVariables.PAGE_MANAGER, pageManager);
variables.put(CQVariables.CURRENT_PAGE, currentPage);
variables.put(CQVariables.RESOURCE_PAGE, resourcePage);
variables.put(CQVariables.PAGE_PROPERTIES, pageProperties);
variables.put(CQVariables.COMPONENT, component);
variables.put(CQVariables.SESSION, resource.getResourceResolver()
.adaptTo(Session.class));
return variables;
} }
|
public class class_name {
public String[] getContext(Object o) {
String s = (String)o;
int prevIndex = -1;
int index = s.indexOf(' ');
List cuts = new ArrayList();
while (index != -1) {
cuts.add(s.substring(prevIndex+1, index));
prevIndex = index;
index = s.indexOf(' ', ++index);
}
cuts.add(s.substring(prevIndex+1, s.length()));
return (String[])cuts.toArray(new String[cuts.size()]);
} }
|
public class class_name {
public String[] getContext(Object o) {
String s = (String)o;
int prevIndex = -1;
int index = s.indexOf(' ');
List cuts = new ArrayList();
while (index != -1) {
cuts.add(s.substring(prevIndex+1, index)); // depends on control dependency: [while], data = [none]
prevIndex = index; // depends on control dependency: [while], data = [none]
index = s.indexOf(' ', ++index); // depends on control dependency: [while], data = [none]
}
cuts.add(s.substring(prevIndex+1, s.length()));
return (String[])cuts.toArray(new String[cuts.size()]);
} }
|
public class class_name {
public static final void sortAfps(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
{
List<AFP> afpSet = afpChain.getAfpSet();
if ( debug)
System.err.println("entering sortAfps");
int pro1Len = ca1.length;
int pro2Len = ca2.length;
afpChain.setAfpIndex( new int[pro1Len][pro2Len]); //the index of (i,j) pair in AFP list, otherwise -1
afpChain.setAfpAftIndex( new int[pro1Len][pro2Len]); //the index of AFP (i,j*) nearest to (i,j), j*<j. if a AFP exits for (i,j), it equals to afpIndex
afpChain.setAfpBefIndex( new int[pro1Len][pro2Len]); //the index of AFP (i,j*) nearest to (i,j), j*>j. if a AFP exits for (i,j), it equals to afpIndex
int[][] afpIndex = afpChain.getAfpIndex();
int[][] afpAftIndex = afpChain.getAfpAftIndex();
int[][] afpBefIndex = afpChain.getAfpBefIndex();
for(int i = 0; i < pro1Len; i ++) {
for(int j = 0; j < pro2Len; j ++) {
afpIndex[i][j] = afpAftIndex[i][j] = afpBefIndex[i][j] = -1;
}
}
//index the AFP for easy extraction of compatible AFPs
int afpNum = afpSet.size();
int b0 = 0;
for(int a = 0; a < afpNum; a ++) {
if(a == afpNum - 1 || afpSet.get(a).getP1() != afpSet.get(a+1).getP1()) {
int i = afpSet.get(a).getP1();
for(int b = b0; b <= a; b ++) {
int j = afpSet.get(b).getP2();
afpIndex[i][j]=b ;
afpBefIndex[i][j]=b;
afpAftIndex[i][j]=b;
if(afpSet.get(b).getP1() != i) {
System.err.println(String.format("Warning: wrong afp index %d %d\n", i, afpSet.get(b).getP1()));
return;
}
}
for(int k = 1; k < pro2Len; k ++) {
if( afpBefIndex[i][k] == -1){
afpBefIndex[i][k] = afpBefIndex[i][k-1];
}
}
for(int k = pro2Len - 2; k >= 0; k --) {
if(afpAftIndex[i][k] == -1) {
afpAftIndex[i][k] = afpAftIndex[i][k+1];
}
}
b0 = a + 1;
}
}
if ( debug)
System.err.println("done sortAfps");
} }
|
public class class_name {
public static final void sortAfps(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
{
List<AFP> afpSet = afpChain.getAfpSet();
if ( debug)
System.err.println("entering sortAfps");
int pro1Len = ca1.length;
int pro2Len = ca2.length;
afpChain.setAfpIndex( new int[pro1Len][pro2Len]); //the index of (i,j) pair in AFP list, otherwise -1
afpChain.setAfpAftIndex( new int[pro1Len][pro2Len]); //the index of AFP (i,j*) nearest to (i,j), j*<j. if a AFP exits for (i,j), it equals to afpIndex
afpChain.setAfpBefIndex( new int[pro1Len][pro2Len]); //the index of AFP (i,j*) nearest to (i,j), j*>j. if a AFP exits for (i,j), it equals to afpIndex
int[][] afpIndex = afpChain.getAfpIndex();
int[][] afpAftIndex = afpChain.getAfpAftIndex();
int[][] afpBefIndex = afpChain.getAfpBefIndex();
for(int i = 0; i < pro1Len; i ++) {
for(int j = 0; j < pro2Len; j ++) {
afpIndex[i][j] = afpAftIndex[i][j] = afpBefIndex[i][j] = -1; // depends on control dependency: [for], data = [j]
}
}
//index the AFP for easy extraction of compatible AFPs
int afpNum = afpSet.size();
int b0 = 0;
for(int a = 0; a < afpNum; a ++) {
if(a == afpNum - 1 || afpSet.get(a).getP1() != afpSet.get(a+1).getP1()) {
int i = afpSet.get(a).getP1();
for(int b = b0; b <= a; b ++) {
int j = afpSet.get(b).getP2();
afpIndex[i][j]=b ; // depends on control dependency: [for], data = [b]
afpBefIndex[i][j]=b; // depends on control dependency: [for], data = [b]
afpAftIndex[i][j]=b; // depends on control dependency: [for], data = [b]
if(afpSet.get(b).getP1() != i) {
System.err.println(String.format("Warning: wrong afp index %d %d\n", i, afpSet.get(b).getP1())); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
for(int k = 1; k < pro2Len; k ++) {
if( afpBefIndex[i][k] == -1){
afpBefIndex[i][k] = afpBefIndex[i][k-1]; // depends on control dependency: [if], data = [none]
}
}
for(int k = pro2Len - 2; k >= 0; k --) {
if(afpAftIndex[i][k] == -1) {
afpAftIndex[i][k] = afpAftIndex[i][k+1]; // depends on control dependency: [if], data = [none]
}
}
b0 = a + 1; // depends on control dependency: [if], data = [none]
}
}
if ( debug)
System.err.println("done sortAfps");
} }
|
public class class_name {
public void marshall(DeleteIPSetRequest deleteIPSetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIPSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIPSetRequest.getIPSetId(), IPSETID_BINDING);
protocolMarshaller.marshall(deleteIPSetRequest.getChangeToken(), CHANGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteIPSetRequest deleteIPSetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIPSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIPSetRequest.getIPSetId(), IPSETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteIPSetRequest.getChangeToken(), CHANGETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void _addSubtreeClientId(String clientId)
{
// Loop over the client id and find the substring corresponding to
// each ancestor NamingContainer client id. For each ancestor
// NamingContainer, add an entry into the map for the full client
// id.
final char separator = getFacesContext().getNamingContainerSeparatorChar();
int length = clientId.length();
for (int i = 0; i < length; i++)
{
if (clientId.charAt(i) == separator)
{
// We found an ancestor NamingContainer client id - add
// an entry to the map.
String namingContainerClientId = clientId.substring(0, i);
// Check to see whether we've already ids under this
// NamingContainer client id. If not, create the
// Collection for this NamingContainer client id and
// stash it away in our map
Collection<String> c = _subtreeClientIds.get(namingContainerClientId);
if (c == null)
{
// TODO: smarter initial size?
c = new ArrayList<String>();
_subtreeClientIds.put(namingContainerClientId, c);
}
// Stash away the client id
c.add(clientId);
}
}
} }
|
public class class_name {
private void _addSubtreeClientId(String clientId)
{
// Loop over the client id and find the substring corresponding to
// each ancestor NamingContainer client id. For each ancestor
// NamingContainer, add an entry into the map for the full client
// id.
final char separator = getFacesContext().getNamingContainerSeparatorChar();
int length = clientId.length();
for (int i = 0; i < length; i++)
{
if (clientId.charAt(i) == separator)
{
// We found an ancestor NamingContainer client id - add
// an entry to the map.
String namingContainerClientId = clientId.substring(0, i);
// Check to see whether we've already ids under this
// NamingContainer client id. If not, create the
// Collection for this NamingContainer client id and
// stash it away in our map
Collection<String> c = _subtreeClientIds.get(namingContainerClientId);
if (c == null)
{
// TODO: smarter initial size?
c = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
_subtreeClientIds.put(namingContainerClientId, c); // depends on control dependency: [if], data = [none]
}
// Stash away the client id
c.add(clientId); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void marshall(DeleteResolverRequest deleteResolverRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResolverRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResolverRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(deleteResolverRequest.getTypeName(), TYPENAME_BINDING);
protocolMarshaller.marshall(deleteResolverRequest.getFieldName(), FIELDNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteResolverRequest deleteResolverRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResolverRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResolverRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteResolverRequest.getTypeName(), TYPENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteResolverRequest.getFieldName(), FIELDNAME_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 final Pair<String, Double> predictBest(String[] context)
{
List<Pair<String, Double>> resultList = predict(context);
double bestP = -1.0;
Pair<String, Double> bestPair = null;
for (Pair<String, Double> pair : resultList)
{
if (pair.getSecond() > bestP)
{
bestP = pair.getSecond();
bestPair = pair;
}
}
return bestPair;
} }
|
public class class_name {
public final Pair<String, Double> predictBest(String[] context)
{
List<Pair<String, Double>> resultList = predict(context);
double bestP = -1.0;
Pair<String, Double> bestPair = null;
for (Pair<String, Double> pair : resultList)
{
if (pair.getSecond() > bestP)
{
bestP = pair.getSecond(); // depends on control dependency: [if], data = [none]
bestPair = pair; // depends on control dependency: [if], data = [none]
}
}
return bestPair;
} }
|
public class class_name {
public float remove(int idx) {
float ret = -1f;
int p = Arrays.binarySearch(index,0,length, idx);
if (p >= 0) {
System.arraycopy(data, p+1, data, p, length-p-1);
System.arraycopy(index, p+1, index, p, length-p-1);
length--;
}else{
System.err.println("error");
}
return ret;
} }
|
public class class_name {
public float remove(int idx) {
float ret = -1f;
int p = Arrays.binarySearch(index,0,length, idx);
if (p >= 0) {
System.arraycopy(data, p+1, data, p, length-p-1); // depends on control dependency: [if], data = [none]
System.arraycopy(index, p+1, index, p, length-p-1); // depends on control dependency: [if], data = [none]
length--; // depends on control dependency: [if], data = [none]
}else{
System.err.println("error"); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
public synchronized void forceNodeShutdown() {
LOGGER.entering();
// stop the node recycle thread
stopNodeRecycleThread();
// verify the servlet is supported on the node
if (!canForceShutdown) {
// allow this proxy to keep going
disableMaxSessions();
scheduledShutdown = false;
LOGGER.exiting();
return;
}
// clean up the test slots
for (TestSlot slot : getTestSlots()) {
if (slot.getSession() != null) {
totalSessionsCompleted++;
proxyLogger.info("Timing out session #" + totalSessionsCompleted + " (" + slot.getSession().toString()
+ ")");
getRegistry().forceRelease(slot, SessionTerminationReason.TIMEOUT);
}
}
// call the node servlet
List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair(NodeForceRestartServlet.TOKEN_PARAMETER,
NodeForceRestartServlet.CONFIGURED_TOKEN_VALUE));
HttpResponse response = sendToNodeServlet(NodeForceRestartServlet.class, nvps);
if (response == null) {
proxyLogger.warning("Node " + getId() + " failed to shutdown and returned a null response.");
// stop the polling thread, mark this proxy as down, force this proxy to re-register
teardown("it failed to shutdown and must re-register");
LOGGER.exiting();
return;
}
final int responseStatusCode = response.getStatusLine().getStatusCode();
if (responseStatusCode != HttpStatus.SC_OK) {
proxyLogger.warning("Node " + getId() + " did not shutdown and returned HTTP " + responseStatusCode);
// stop the polling thread, mark this proxy as down, force this proxy to re-register
teardown("it failed to shutdown and must re-register");
LOGGER.exiting();
return;
}
// stop the polling thread, mark this proxy as down
teardown("it is shutdown");
proxyLogger.info("Node " + getId() + " shutdown successfully.");
LOGGER.exiting();
} }
|
public class class_name {
public synchronized void forceNodeShutdown() {
LOGGER.entering();
// stop the node recycle thread
stopNodeRecycleThread();
// verify the servlet is supported on the node
if (!canForceShutdown) {
// allow this proxy to keep going
disableMaxSessions(); // depends on control dependency: [if], data = [none]
scheduledShutdown = false; // depends on control dependency: [if], data = [none]
LOGGER.exiting(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// clean up the test slots
for (TestSlot slot : getTestSlots()) {
if (slot.getSession() != null) {
totalSessionsCompleted++; // depends on control dependency: [if], data = [none]
proxyLogger.info("Timing out session #" + totalSessionsCompleted + " (" + slot.getSession().toString()
+ ")");
getRegistry().forceRelease(slot, SessionTerminationReason.TIMEOUT); // depends on control dependency: [if], data = [none]
}
}
// call the node servlet
List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair(NodeForceRestartServlet.TOKEN_PARAMETER,
NodeForceRestartServlet.CONFIGURED_TOKEN_VALUE));
HttpResponse response = sendToNodeServlet(NodeForceRestartServlet.class, nvps);
if (response == null) {
proxyLogger.warning("Node " + getId() + " failed to shutdown and returned a null response."); // depends on control dependency: [if], data = [none]
// stop the polling thread, mark this proxy as down, force this proxy to re-register
teardown("it failed to shutdown and must re-register"); // depends on control dependency: [if], data = [none]
LOGGER.exiting(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final int responseStatusCode = response.getStatusLine().getStatusCode();
if (responseStatusCode != HttpStatus.SC_OK) {
proxyLogger.warning("Node " + getId() + " did not shutdown and returned HTTP " + responseStatusCode); // depends on control dependency: [if], data = [none]
// stop the polling thread, mark this proxy as down, force this proxy to re-register
teardown("it failed to shutdown and must re-register"); // depends on control dependency: [if], data = [none]
LOGGER.exiting(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// stop the polling thread, mark this proxy as down
teardown("it is shutdown");
proxyLogger.info("Node " + getId() + " shutdown successfully.");
LOGGER.exiting();
} }
|
public class class_name {
public void nextProtocols(String ...protocols)
{
if (protocols == null || protocols.length == 0) {
_nextProtocols = null;
return;
}
StringBuilder sb = new StringBuilder();
for (String protocol : protocols) {
if (protocol == null || "".equals(protocol)) {
continue;
}
sb.append((char) protocol.length());
sb.append(protocol);
}
_nextProtocols = sb.toString();
} }
|
public class class_name {
public void nextProtocols(String ...protocols)
{
if (protocols == null || protocols.length == 0) {
_nextProtocols = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for (String protocol : protocols) {
if (protocol == null || "".equals(protocol)) {
continue;
}
sb.append((char) protocol.length()); // depends on control dependency: [for], data = [protocol]
sb.append(protocol); // depends on control dependency: [for], data = [protocol]
}
_nextProtocols = sb.toString();
} }
|
public class class_name {
private void stringScan(Bytes bytes) {
int mask = IJC | NFP | (validateUTF8 ? NUC : 0);
long pos = bytes.readPosition();
long limit = bytes.readLimit();
while (pos < limit && ((CHAR_LOOKUP_TABLE[bytes.readUnsignedByte(pos)] & mask) == 0)) {
pos++;
}
bytes.readPosition(pos);
} }
|
public class class_name {
private void stringScan(Bytes bytes) {
int mask = IJC | NFP | (validateUTF8 ? NUC : 0);
long pos = bytes.readPosition();
long limit = bytes.readLimit();
while (pos < limit && ((CHAR_LOOKUP_TABLE[bytes.readUnsignedByte(pos)] & mask) == 0)) {
pos++; // depends on control dependency: [while], data = [none]
}
bytes.readPosition(pos);
} }
|
public class class_name {
@Override
public boolean replaceTrigger(final TriggerKey triggerKey, final OperableTrigger newTrigger) throws JobPersistenceException {
return doWithLock(new LockCallback<Boolean>() {
@Override
public Boolean doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
return storage.replaceTrigger(triggerKey, newTrigger, jedis);
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(e.getMessage(), e);
}
}
}, "Could not remove trigger.");
} }
|
public class class_name {
@Override
public boolean replaceTrigger(final TriggerKey triggerKey, final OperableTrigger newTrigger) throws JobPersistenceException {
return doWithLock(new LockCallback<Boolean>() {
@Override
public Boolean doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
return storage.replaceTrigger(triggerKey, newTrigger, jedis); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new JobPersistenceException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}, "Could not remove trigger.");
} }
|
public class class_name {
public List<ProviderInfo> route(SofaRequest request, List<ProviderInfo> providerInfos) {
for (Router router : routers) {
providerInfos = router.route(request, providerInfos);
}
return providerInfos;
} }
|
public class class_name {
public List<ProviderInfo> route(SofaRequest request, List<ProviderInfo> providerInfos) {
for (Router router : routers) {
providerInfos = router.route(request, providerInfos); // depends on control dependency: [for], data = [router]
}
return providerInfos;
} }
|
public class class_name {
private static void checkViolations(List<String> givenViolations,
List<String> expectedValidationViolations) {
/*
* check if number of expected violations matches the given violations
*/
Assert.assertEquals(
String.format(
"number of expected validation violations (%s) does not match the number of given violations (%s)",
StringUtils.join(expectedValidationViolations,
LIST_DELIMITER), StringUtils.join(
givenViolations, LIST_DELIMITER)),
expectedValidationViolations.size(), givenViolations.size());
/*
* check if the set of given violations matches the expected violations
*/
boolean listsAreCongruent = true;
List<String> givenButNotExpected = new ArrayList<String>();
for (String givenViolation : givenViolations) {
if (!expectedValidationViolations.contains(givenViolation)) {
listsAreCongruent = false;
givenButNotExpected.add(givenViolation);
}
}
Assert.assertTrue(
String.format(
"the violations (%s) where given but not expected: all given violations (%s), all expected violations (%s)",
StringUtils.join(givenButNotExpected, LIST_DELIMITER),
StringUtils.join(givenViolations, LIST_DELIMITER),
StringUtils.join(expectedValidationViolations,
LIST_DELIMITER)), listsAreCongruent);
} }
|
public class class_name {
private static void checkViolations(List<String> givenViolations,
List<String> expectedValidationViolations) {
/*
* check if number of expected violations matches the given violations
*/
Assert.assertEquals(
String.format(
"number of expected validation violations (%s) does not match the number of given violations (%s)",
StringUtils.join(expectedValidationViolations,
LIST_DELIMITER), StringUtils.join(
givenViolations, LIST_DELIMITER)),
expectedValidationViolations.size(), givenViolations.size());
/*
* check if the set of given violations matches the expected violations
*/
boolean listsAreCongruent = true;
List<String> givenButNotExpected = new ArrayList<String>();
for (String givenViolation : givenViolations) {
if (!expectedValidationViolations.contains(givenViolation)) {
listsAreCongruent = false; // depends on control dependency: [if], data = [none]
givenButNotExpected.add(givenViolation); // depends on control dependency: [if], data = [none]
}
}
Assert.assertTrue(
String.format(
"the violations (%s) where given but not expected: all given violations (%s), all expected violations (%s)",
StringUtils.join(givenButNotExpected, LIST_DELIMITER),
StringUtils.join(givenViolations, LIST_DELIMITER),
StringUtils.join(expectedValidationViolations,
LIST_DELIMITER)), listsAreCongruent);
} }
|
public class class_name {
protected void createRipple(double x, double y) {
if(!isRipplerDisabled()) {
rippler.setGeneratorCenterX(x);
rippler.setGeneratorCenterY(y);
rippler.createRipple();
}
} }
|
public class class_name {
protected void createRipple(double x, double y) {
if(!isRipplerDisabled()) {
rippler.setGeneratorCenterX(x); // depends on control dependency: [if], data = [none]
rippler.setGeneratorCenterY(y); // depends on control dependency: [if], data = [none]
rippler.createRipple(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public User createUser(User userParam)
{
if(userParam != null && this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket);
}
return new User(this.putJson(
userParam, WS.Path.User.Version1.userCreate()));
} }
|
public class class_name {
public User createUser(User userParam)
{
if(userParam != null && this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
return new User(this.putJson(
userParam, WS.Path.User.Version1.userCreate()));
} }
|
public class class_name {
public static UIComponent findBsfComponent(UIComponent parent, String targetLib) {
if (targetLib.equalsIgnoreCase((String) parent.getAttributes().get("library"))) {
return parent;
}
Iterator<UIComponent> kids = parent.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent found = findBsfComponent(kids.next(), targetLib);
if (found != null) {
return found;
}
}
return null;
} }
|
public class class_name {
public static UIComponent findBsfComponent(UIComponent parent, String targetLib) {
if (targetLib.equalsIgnoreCase((String) parent.getAttributes().get("library"))) {
return parent; // depends on control dependency: [if], data = [none]
}
Iterator<UIComponent> kids = parent.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent found = findBsfComponent(kids.next(), targetLib);
if (found != null) {
return found; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public String handleBooleanAnnotation(String annotation, Boolean value, String message, String validate) {
if (!Boolean.TRUE.equals(value))
return "";
// if validate contains annotation, do nothing
if (validate != null && validate.toLowerCase().matches(".*@" + annotation.toLowerCase() + ".*"))
return "";
String result = " @" + annotation;
// set message if not set
if (message != null) {
result += "(" + (message.toLowerCase().matches(".*message.*") ? "" : "message=") + message + ")";
}
return result + " ";
} }
|
public class class_name {
public String handleBooleanAnnotation(String annotation, Boolean value, String message, String validate) {
if (!Boolean.TRUE.equals(value))
return "";
// if validate contains annotation, do nothing
if (validate != null && validate.toLowerCase().matches(".*@" + annotation.toLowerCase() + ".*"))
return "";
String result = " @" + annotation;
// set message if not set
if (message != null) {
result += "(" + (message.toLowerCase().matches(".*message.*") ? "" : "message=") + message + ")"; // depends on control dependency: [if], data = [(message]
}
return result + " ";
} }
|
public class class_name {
private double neigh_value(double x_cur, double x_min, double x_max, double r) {
double ranval, zvalue, new_value;
double work3, work2 = 0, work1 = 0;
double x_range = x_max - x_min;
// ------------ generate a standard normal random variate (zvalue) -------------------
// perturb current value with normal random variable
// CALL DRNNOA(1,zvalue) // generates a standard normal random deviate
// ISML Stat Library 2 routine - Acceptance/rejection
// Below returns a standard Gaussian random number based upon Numerical recipes gasdev and
// Marsagalia-Bray Algorithm
work3 = 2.0;
while (work3 >= 1.0 || work3 == 0.0) {
ranval = rand.nextDouble();
work1 = 2.0 * ranval - 1.0;
ranval = rand.nextDouble();
work2 = 2.0 * ranval - 1.0;
work3 = work1 * work1 + work2 * work2;
}
// was dlog() !!!
work3 = Math.pow((-2.0 * Math.log(work3)) / work3, 0.5); // natural log
// pick one of two deviates at random (don't worry about trying to use both):
ranval = rand.nextDouble();
if (ranval < 0.5) {
zvalue = work1 * work3;
} else {
zvalue = work2 * work3;
}
// ------------ done standard normal random variate generation -----------------
// calculate new decision variable value:
new_value = x_cur + zvalue * r * x_range;
// check new value is within DV bounds. If not, bounds are reflecting.
if (new_value < x_min) {
new_value = x_min + (x_min - new_value);
if (new_value > x_max) {
// if reflection goes past x_max { value should be x_min since
// without reflection the approach goes way past lower bound.
// This keeps x close to lower bound when x_cur is close to lower bound
// Practically speaking, this should never happen with r values <0.3
new_value = x_min;
}
} else if (new_value > x_max) {
new_value = x_max - (new_value - x_max);
if (new_value < x_min) {
// if reflection goes past x_min { value should be x_max for same reasons as above
new_value = x_max;
}
}
return new_value;
} }
|
public class class_name {
private double neigh_value(double x_cur, double x_min, double x_max, double r) {
double ranval, zvalue, new_value;
double work3, work2 = 0, work1 = 0;
double x_range = x_max - x_min;
// ------------ generate a standard normal random variate (zvalue) -------------------
// perturb current value with normal random variable
// CALL DRNNOA(1,zvalue) // generates a standard normal random deviate
// ISML Stat Library 2 routine - Acceptance/rejection
// Below returns a standard Gaussian random number based upon Numerical recipes gasdev and
// Marsagalia-Bray Algorithm
work3 = 2.0;
while (work3 >= 1.0 || work3 == 0.0) {
ranval = rand.nextDouble(); // depends on control dependency: [while], data = [none]
work1 = 2.0 * ranval - 1.0; // depends on control dependency: [while], data = [none]
ranval = rand.nextDouble(); // depends on control dependency: [while], data = [none]
work2 = 2.0 * ranval - 1.0; // depends on control dependency: [while], data = [none]
work3 = work1 * work1 + work2 * work2; // depends on control dependency: [while], data = [none]
}
// was dlog() !!!
work3 = Math.pow((-2.0 * Math.log(work3)) / work3, 0.5); // natural log
// pick one of two deviates at random (don't worry about trying to use both):
ranval = rand.nextDouble();
if (ranval < 0.5) {
zvalue = work1 * work3; // depends on control dependency: [if], data = [none]
} else {
zvalue = work2 * work3; // depends on control dependency: [if], data = [none]
}
// ------------ done standard normal random variate generation -----------------
// calculate new decision variable value:
new_value = x_cur + zvalue * r * x_range;
// check new value is within DV bounds. If not, bounds are reflecting.
if (new_value < x_min) {
new_value = x_min + (x_min - new_value); // depends on control dependency: [if], data = [none]
if (new_value > x_max) {
// if reflection goes past x_max { value should be x_min since
// without reflection the approach goes way past lower bound.
// This keeps x close to lower bound when x_cur is close to lower bound
// Practically speaking, this should never happen with r values <0.3
new_value = x_min; // depends on control dependency: [if], data = [none]
}
} else if (new_value > x_max) {
new_value = x_max - (new_value - x_max); // depends on control dependency: [if], data = [(new_value]
if (new_value < x_min) {
// if reflection goes past x_min { value should be x_max for same reasons as above
new_value = x_max; // depends on control dependency: [if], data = [none]
}
}
return new_value;
} }
|
public class class_name {
public void sendError(final int sc) {
try {
response.sendError(sc);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends error status code [" + sc + "] failed: " + e.getMessage());
}
} }
|
public class class_name {
public void sendError(final int sc) {
try {
response.sendError(sc); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sends error status code [" + sc + "] failed: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EEnum getIfcElementCompositionEnum() {
if (ifcElementCompositionEnumEEnum == null) {
ifcElementCompositionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(981);
}
return ifcElementCompositionEnumEEnum;
} }
|
public class class_name {
@Override
public EEnum getIfcElementCompositionEnum() {
if (ifcElementCompositionEnumEEnum == null) {
ifcElementCompositionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(981);
// depends on control dependency: [if], data = [none]
}
return ifcElementCompositionEnumEEnum;
} }
|
public class class_name {
private void setRect(double minLat, double minLng, double maxLat, double maxLng)
{
if (!(minLat < maxLat))
{
throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng))
{
if (minLng > 0 && minLng < 180 && maxLng < 0)
{
rects = new Rectangle2D[] {
// split into two rects e.g. 176.8793 to 180 and -180 to
// -175.0104
new Rectangle2D.Double(minLng, minLat, 180 - minLng, maxLat - minLat),
new Rectangle2D.Double(-180, minLat, maxLng + 180, maxLat - minLat) };
}
else
{
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) };
throw new IllegalArgumentException("GeoBounds is not valid - minLng must be less that maxLng or "
+ "minLng must be greater than 0 and maxLng must be less than 0.");
}
}
else
{
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) };
}
} }
|
public class class_name {
private void setRect(double minLat, double minLng, double maxLat, double maxLng)
{
if (!(minLat < maxLat))
{
throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng))
{
if (minLng > 0 && minLng < 180 && maxLng < 0)
{
rects = new Rectangle2D[] {
// split into two rects e.g. 176.8793 to 180 and -180 to
// -175.0104
new Rectangle2D.Double(minLng, minLat, 180 - minLng, maxLat - minLat),
new Rectangle2D.Double(-180, minLat, maxLng + 180, maxLat - minLat) }; // depends on control dependency: [if], data = [none]
}
else
{
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; // depends on control dependency: [if], data = [(minLng]
throw new IllegalArgumentException("GeoBounds is not valid - minLng must be less that maxLng or "
+ "minLng must be greater than 0 and maxLng must be less than 0.");
}
}
else
{
rects = new Rectangle2D[] { new Rectangle2D.Double(minLng, minLat, maxLng - minLng, maxLat - minLat) }; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) {
ImmutableMember remoteMember = members.getLeft();
ImmutableMember localMember = members.getRight();
LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember);
// If the probe indicates a term greater than the local term, update the local term, increment and respond.
if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) {
this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1);
if (config.isBroadcastDisputes()) {
broadcast(this.localMember.copy());
}
}
// If the probe indicates this member is suspect, increment the local term and respond.
else if (localMember.state() == State.SUSPECT) {
this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1);
if (config.isBroadcastDisputes()) {
broadcast(this.localMember.copy());
}
}
// Update the state of the probing member.
updateState(remoteMember);
return this.localMember.copy();
} }
|
public class class_name {
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) {
ImmutableMember remoteMember = members.getLeft();
ImmutableMember localMember = members.getRight();
LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember);
// If the probe indicates a term greater than the local term, update the local term, increment and respond.
if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) {
this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1); // depends on control dependency: [if], data = [(localMember.incarnationNumber()]
if (config.isBroadcastDisputes()) {
broadcast(this.localMember.copy()); // depends on control dependency: [if], data = [none]
}
}
// If the probe indicates this member is suspect, increment the local term and respond.
else if (localMember.state() == State.SUSPECT) {
this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1); // depends on control dependency: [if], data = [none]
if (config.isBroadcastDisputes()) {
broadcast(this.localMember.copy()); // depends on control dependency: [if], data = [none]
}
}
// Update the state of the probing member.
updateState(remoteMember);
return this.localMember.copy();
} }
|
public class class_name {
public java.util.List<FpgaImage> getFpgaImages() {
if (fpgaImages == null) {
fpgaImages = new com.amazonaws.internal.SdkInternalList<FpgaImage>();
}
return fpgaImages;
} }
|
public class class_name {
public java.util.List<FpgaImage> getFpgaImages() {
if (fpgaImages == null) {
fpgaImages = new com.amazonaws.internal.SdkInternalList<FpgaImage>(); // depends on control dependency: [if], data = [none]
}
return fpgaImages;
} }
|
public class class_name {
@Override
public void accept(ClassWriterOutputVisitor visitor) throws IOException {
proxyBeanDefinitionWriter.accept(visitor);
try (OutputStream out = visitor.visitClass(proxyFullName)) {
out.write(classWriter.toByteArray());
for (ExecutableMethodWriter method : proxiedMethods) {
method.accept(visitor);
}
}
} }
|
public class class_name {
@Override
public void accept(ClassWriterOutputVisitor visitor) throws IOException {
proxyBeanDefinitionWriter.accept(visitor);
try (OutputStream out = visitor.visitClass(proxyFullName)) {
out.write(classWriter.toByteArray());
for (ExecutableMethodWriter method : proxiedMethods) {
method.accept(visitor); // depends on control dependency: [for], data = [method]
}
}
} }
|
public class class_name {
@Override
public GraphicsConfiguration getDeviceConfiguration() {
if (this.deviceConfiguration == null) {
this.deviceConfiguration = new SVGGraphicsConfiguration(this.width,
this.height);
}
return this.deviceConfiguration;
} }
|
public class class_name {
@Override
public GraphicsConfiguration getDeviceConfiguration() {
if (this.deviceConfiguration == null) {
this.deviceConfiguration = new SVGGraphicsConfiguration(this.width,
this.height); // depends on control dependency: [if], data = [none]
}
return this.deviceConfiguration;
} }
|
public class class_name {
@Override
public boolean hasNext() {
// first all items of the second operand are stored in the set.
while (mOp2.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
mDupSet.add(getNode().getDataKey());
}
while (mOp1.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
// return true, if node is not already in the set, which means, that
// it is
// not also an item of the result set of the second operand
// sequence.
if (mDupSet.add(getNode().getDataKey())) {
return true;
}
}
return false;
} }
|
public class class_name {
@Override
public boolean hasNext() {
// first all items of the second operand are stored in the set.
while (mOp2.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
mDupSet.add(getNode().getDataKey()); // depends on control dependency: [while], data = [none]
}
while (mOp1.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
// return true, if node is not already in the set, which means, that
// it is
// not also an item of the result set of the second operand
// sequence.
if (mDupSet.add(getNode().getDataKey())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Nullable
private static String concat(@Nullable String[] values, @NonNull String delimeter) {
if (values == null || values.length == 0) {
return null;
}
final StringBuilder str = new StringBuilder();
for (String val : values) {
str.append(val).append(delimeter);
}
str.delete(str.length() - delimeter.length(), str.length());
return str.toString();
} }
|
public class class_name {
@Nullable
private static String concat(@Nullable String[] values, @NonNull String delimeter) {
if (values == null || values.length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
final StringBuilder str = new StringBuilder();
for (String val : values) {
str.append(val).append(delimeter); // depends on control dependency: [for], data = [val]
}
str.delete(str.length() - delimeter.length(), str.length());
return str.toString();
} }
|
public class class_name {
public void marshall(EbsVolume ebsVolume, ProtocolMarshaller protocolMarshaller) {
if (ebsVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ebsVolume.getDevice(), DEVICE_BINDING);
protocolMarshaller.marshall(ebsVolume.getVolumeId(), VOLUMEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(EbsVolume ebsVolume, ProtocolMarshaller protocolMarshaller) {
if (ebsVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ebsVolume.getDevice(), DEVICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ebsVolume.getVolumeId(), VOLUMEID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void decompose( DMatrixRMaj A ) {
Equation eq = new Equation();
this.QR = A.copy();
int N = Math.min(A.numCols,A.numRows);
gammas = new double[ A.numCols ];
for( int i = 0; i < N; i++ ) {
// update temporary variables
eq.alias(QR.numRows-i,"Ni",QR,"QR",i,"i");
// Place the column that should be zeroed into v
eq.process("v=QR(i:,i)");
eq.process("maxV=max(abs(v))");
// Note that v is lazily created above. Need direct access to it, which is done below.
DMatrixRMaj v = eq.lookupDDRM("v");
double maxV = eq.lookupDouble("maxV");
if( maxV > 0 && v.getNumElements() > 1 ) {
// normalize to reduce overflow issues
eq.process("v=v/maxV");
// compute the magnitude of the vector
double tau = NormOps_DDRM.normF(v);
if( v.get(0) < 0 )
tau *= -1.0;
eq.alias(tau,"tau");
eq.process("u_0 = v(0,0)+tau");
eq.process("gamma = u_0/tau");
eq.process("v=v/u_0");
eq.process("v(0,0)=1");
eq.process("QR(i:,i:) = (eye(Ni) - gamma*v*v')*QR(i:,i:)");
eq.process("QR(i:,i) = v");
eq.process("QR(i,i) = -1*tau*maxV");
// save gamma for recomputing Q later on
gammas[i] = eq.lookupDouble("gamma");
}
}
} }
|
public class class_name {
public void decompose( DMatrixRMaj A ) {
Equation eq = new Equation();
this.QR = A.copy();
int N = Math.min(A.numCols,A.numRows);
gammas = new double[ A.numCols ];
for( int i = 0; i < N; i++ ) {
// update temporary variables
eq.alias(QR.numRows-i,"Ni",QR,"QR",i,"i"); // depends on control dependency: [for], data = [i]
// Place the column that should be zeroed into v
eq.process("v=QR(i:,i)"); // depends on control dependency: [for], data = [i]
eq.process("maxV=max(abs(v))"); // depends on control dependency: [for], data = [none]
// Note that v is lazily created above. Need direct access to it, which is done below.
DMatrixRMaj v = eq.lookupDDRM("v");
double maxV = eq.lookupDouble("maxV");
if( maxV > 0 && v.getNumElements() > 1 ) {
// normalize to reduce overflow issues
eq.process("v=v/maxV"); // depends on control dependency: [if], data = [none]
// compute the magnitude of the vector
double tau = NormOps_DDRM.normF(v);
if( v.get(0) < 0 )
tau *= -1.0;
eq.alias(tau,"tau"); // depends on control dependency: [if], data = [none]
eq.process("u_0 = v(0,0)+tau"); // depends on control dependency: [if], data = [none]
eq.process("gamma = u_0/tau"); // depends on control dependency: [if], data = [none]
eq.process("v=v/u_0"); // depends on control dependency: [if], data = [none]
eq.process("v(0,0)=1"); // depends on control dependency: [if], data = [none]
eq.process("QR(i:,i:) = (eye(Ni) - gamma*v*v')*QR(i:,i:)"); // depends on control dependency: [if], data = [none]
eq.process("QR(i:,i) = v"); // depends on control dependency: [if], data = [none]
eq.process("QR(i,i) = -1*tau*maxV"); // depends on control dependency: [if], data = [none]
// save gamma for recomputing Q later on
gammas[i] = eq.lookupDouble("gamma"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static int indexOf(short[] array, short value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (value == array[i]) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} }
|
public class class_name {
public static int indexOf(short[] array, short value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (value == array[i]) {
return i;
// depends on control dependency: [if], data = [none]
}
}
}
return INDEX_NOT_FOUND;
} }
|
public class class_name {
@Benchmark boolean isSpace(int reps) {
boolean dummy = false;
if (overload == Overload.CHAR) {
for (int i = 0; i < reps; ++i) {
for (int ch = 0; ch < 65536; ++ch) {
dummy ^= ((char) ch == ' ');
}
}
} else {
for (int i = 0; i < reps; ++i) {
for (int ch = 0; ch < 65536; ++ch) {
dummy ^= (ch == ' ');
}
}
}
return dummy;
} }
|
public class class_name {
@Benchmark boolean isSpace(int reps) {
boolean dummy = false;
if (overload == Overload.CHAR) {
for (int i = 0; i < reps; ++i) {
for (int ch = 0; ch < 65536; ++ch) {
dummy ^= ((char) ch == ' '); // depends on control dependency: [for], data = [ch]
}
}
} else {
for (int i = 0; i < reps; ++i) {
for (int ch = 0; ch < 65536; ++ch) {
dummy ^= (ch == ' '); // depends on control dependency: [for], data = [ch]
}
}
}
return dummy;
} }
|
public class class_name {
public GenericMatchInfo findBestMatch(String text, int start, EnumSet<GenericNameType> genericTypes) {
if (text == null || text.length() == 0 || start < 0 || start >= text.length()) {
throw new IllegalArgumentException("bad input text or range");
}
GenericMatchInfo bestMatch = null;
// Find matches in the TimeZoneNames first
Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes);
if (tznamesMatches != null) {
MatchInfo longestMatch = null;
for (MatchInfo match : tznamesMatches) {
if (longestMatch == null || match.matchLength() > longestMatch.matchLength()) {
longestMatch = match;
}
}
if (longestMatch != null) {
bestMatch = createGenericMatchInfo(longestMatch);
if (bestMatch.matchLength() == (text.length() - start)) {
// Full match
//return bestMatch;
// TODO Some time zone uses a same name for the long standard name
// and the location name. When the match is a long standard name,
// then we need to check if the name is same with the location name.
// This is probably a data error or a design bug.
// if (bestMatch.nameType != GenericNameType.LONG || bestMatch.timeType != TimeType.STANDARD) {
// return bestMatch;
// }
// TODO The deprecation of commonlyUsed flag introduced the name
// conflict not only for long standard names, but short standard names too.
// These short names (found in zh_Hant) should be gone once we clean
// up CLDR time zone display name data. Once the short name conflict
// problem (with location name) is resolved, we should change the condition
// below back to the original one above. -Yoshito (2011-09-14)
if (bestMatch.timeType != TimeType.STANDARD) {
return bestMatch;
}
}
}
}
// Find matches in the local trie
Collection<GenericMatchInfo> localMatches = findLocal(text, start, genericTypes);
if (localMatches != null) {
for (GenericMatchInfo match : localMatches) {
// TODO See the above TODO. We use match.matchLength() >= bestMatch.matcheLength()
// for the reason described above.
//if (bestMatch == null || match.matchLength() > bestMatch.matchLength()) {
if (bestMatch == null || match.matchLength() >= bestMatch.matchLength()) {
bestMatch = match;
}
}
}
return bestMatch;
} }
|
public class class_name {
public GenericMatchInfo findBestMatch(String text, int start, EnumSet<GenericNameType> genericTypes) {
if (text == null || text.length() == 0 || start < 0 || start >= text.length()) {
throw new IllegalArgumentException("bad input text or range");
}
GenericMatchInfo bestMatch = null;
// Find matches in the TimeZoneNames first
Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes);
if (tznamesMatches != null) {
MatchInfo longestMatch = null;
for (MatchInfo match : tznamesMatches) {
if (longestMatch == null || match.matchLength() > longestMatch.matchLength()) {
longestMatch = match; // depends on control dependency: [if], data = [none]
}
}
if (longestMatch != null) {
bestMatch = createGenericMatchInfo(longestMatch); // depends on control dependency: [if], data = [(longestMatch]
if (bestMatch.matchLength() == (text.length() - start)) {
// Full match
//return bestMatch;
// TODO Some time zone uses a same name for the long standard name
// and the location name. When the match is a long standard name,
// then we need to check if the name is same with the location name.
// This is probably a data error or a design bug.
// if (bestMatch.nameType != GenericNameType.LONG || bestMatch.timeType != TimeType.STANDARD) {
// return bestMatch;
// }
// TODO The deprecation of commonlyUsed flag introduced the name
// conflict not only for long standard names, but short standard names too.
// These short names (found in zh_Hant) should be gone once we clean
// up CLDR time zone display name data. Once the short name conflict
// problem (with location name) is resolved, we should change the condition
// below back to the original one above. -Yoshito (2011-09-14)
if (bestMatch.timeType != TimeType.STANDARD) {
return bestMatch; // depends on control dependency: [if], data = [none]
}
}
}
}
// Find matches in the local trie
Collection<GenericMatchInfo> localMatches = findLocal(text, start, genericTypes);
if (localMatches != null) {
for (GenericMatchInfo match : localMatches) {
// TODO See the above TODO. We use match.matchLength() >= bestMatch.matcheLength()
// for the reason described above.
//if (bestMatch == null || match.matchLength() > bestMatch.matchLength()) {
if (bestMatch == null || match.matchLength() >= bestMatch.matchLength()) {
bestMatch = match; // depends on control dependency: [if], data = [none]
}
}
}
return bestMatch;
} }
|
public class class_name {
public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
} }
|
public class class_name {
public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer()); // depends on control dependency: [if], data = [none]
}
m_hiDpiImages.put(factor, image);
} }
|
public class class_name {
public void register(Collector m) {
List<String> names = collectorNames(m);
synchronized (collectorsToNames) {
for (String name : names) {
if (namesToCollectors.containsKey(name)) {
throw new IllegalArgumentException("Collector already registered that provides name: " + name);
}
}
for (String name : names) {
namesToCollectors.put(name, m);
}
collectorsToNames.put(m, names);
}
} }
|
public class class_name {
public void register(Collector m) {
List<String> names = collectorNames(m);
synchronized (collectorsToNames) {
for (String name : names) {
if (namesToCollectors.containsKey(name)) {
throw new IllegalArgumentException("Collector already registered that provides name: " + name);
}
}
for (String name : names) {
namesToCollectors.put(name, m); // depends on control dependency: [for], data = [name]
}
collectorsToNames.put(m, names);
}
} }
|
public class class_name {
public RangeResponseResult getResponseResult(final long resourceContentLength, String ifRange, Date lastModified, String eTag) {
if(ranges.isEmpty()) {
return null;
}
long start = getStart(0);
long end = getEnd(0);
long rangeLength;
if(ifRange != null && !ifRange.isEmpty()) {
if(ifRange.charAt(0) == '"') {
//entity tag
if(eTag != null && !eTag.equals(ifRange)) {
return null;
}
} else {
Date ifDate = DateUtils.parseDate(ifRange);
if(ifDate != null && lastModified != null && ifDate.getTime() < lastModified.getTime()) {
return null;
}
}
}
if(start == -1 ) {
//suffix range
if(end < 0){
//ignore the range request
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE);
}
start = Math.max(resourceContentLength - end, 0);
end = resourceContentLength - 1;
rangeLength = resourceContentLength - start;
} else if(end == -1) {
//prefix range
long toWrite = resourceContentLength - start;
if(toWrite >= 0) {
rangeLength = toWrite;
} else {
//ignore the range request
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE);
}
end = resourceContentLength - 1;
} else {
end = Math.min(end, resourceContentLength - 1);
if(start >= resourceContentLength || start > end) {
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE);
}
rangeLength = end - start + 1;
}
return new RangeResponseResult(start, end, rangeLength, "bytes " + start + "-" + end + "/" + resourceContentLength, StatusCodes.PARTIAL_CONTENT);
} }
|
public class class_name {
public RangeResponseResult getResponseResult(final long resourceContentLength, String ifRange, Date lastModified, String eTag) {
if(ranges.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
long start = getStart(0);
long end = getEnd(0);
long rangeLength;
if(ifRange != null && !ifRange.isEmpty()) {
if(ifRange.charAt(0) == '"') {
//entity tag
if(eTag != null && !eTag.equals(ifRange)) {
return null; // depends on control dependency: [if], data = [none]
}
} else {
Date ifDate = DateUtils.parseDate(ifRange);
if(ifDate != null && lastModified != null && ifDate.getTime() < lastModified.getTime()) {
return null; // depends on control dependency: [if], data = [none]
}
}
}
if(start == -1 ) {
//suffix range
if(end < 0){
//ignore the range request
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE); // depends on control dependency: [if], data = [none]
}
start = Math.max(resourceContentLength - end, 0); // depends on control dependency: [if], data = [none]
end = resourceContentLength - 1; // depends on control dependency: [if], data = [none]
rangeLength = resourceContentLength - start; // depends on control dependency: [if], data = [none]
} else if(end == -1) {
//prefix range
long toWrite = resourceContentLength - start;
if(toWrite >= 0) {
rangeLength = toWrite; // depends on control dependency: [if], data = [none]
} else {
//ignore the range request
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE); // depends on control dependency: [if], data = [none]
}
end = resourceContentLength - 1; // depends on control dependency: [if], data = [none]
} else {
end = Math.min(end, resourceContentLength - 1); // depends on control dependency: [if], data = [(end]
if(start >= resourceContentLength || start > end) {
return new RangeResponseResult(0, 0, 0, "bytes */" + resourceContentLength, StatusCodes.REQUEST_RANGE_NOT_SATISFIABLE); // depends on control dependency: [if], data = [none]
}
rangeLength = end - start + 1; // depends on control dependency: [if], data = [none]
}
return new RangeResponseResult(start, end, rangeLength, "bytes " + start + "-" + end + "/" + resourceContentLength, StatusCodes.PARTIAL_CONTENT);
} }
|
public class class_name {
public ReturnCode stop() {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopping"), serverName));
// Use initialized bootstrap configuration to find the server lock file.
ServerLock serverLock = ServerLock.createTestLock(bootProps);
// we can not pre-test the server: on some platforms, the server lock file
// can be deleted, which means waiting to see if it is there leads to
// an abandoned server.
ReturnCode stopRc = ReturnCode.STOP_ACTION;
// The lock file may have been (erroneously) deleted: this can happen on linux
boolean lockExists = serverLock.lockFileExists();
if (lockExists) {
// If the lock exists, check quickly to see if the process is holding it.
if (serverLock.testServerRunning()) {
// we need to tell the server to stop...
ServerCommandClient scc = new ServerCommandClient(bootProps);
if (scc.isValid()) {
stopRc = scc.stopServer(launchArgs.getOption("force") != null);
} else {
// we can't communicate to the server...
stopRc = ReturnCode.ERROR_SERVER_STOP;
}
} else {
// nope: lock not held, we're already stopped
stopRc = ReturnCode.REDUNDANT_ACTION_STATUS;
}
} else {
// no lock file: we assume the server is not running, we have nothing to do.
stopRc = ReturnCode.REDUNDANT_ACTION_STATUS;
}
// If the lock file existed before we attempted to stop the server,
// wait until we can obtain the server lock file (because the server process has stopped)
if (stopRc == ReturnCode.OK && lockExists) {
stopRc = serverLock.waitForStop();
}
if (stopRc == ReturnCode.OK) {
String pid = getPID();
if (pid != null) {
stopRc = waitForProcessStop(pid);
}
}
if (stopRc == ReturnCode.OK) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopped"), serverName));
} else if (stopRc == ReturnCode.REDUNDANT_ACTION_STATUS) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverNotRunning"), serverName));
} else if (stopRc == ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.serverStopCommandPortDisabled"), serverName));
} else {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopException"), serverName));
}
return stopRc;
} }
|
public class class_name {
public ReturnCode stop() {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopping"), serverName));
// Use initialized bootstrap configuration to find the server lock file.
ServerLock serverLock = ServerLock.createTestLock(bootProps);
// we can not pre-test the server: on some platforms, the server lock file
// can be deleted, which means waiting to see if it is there leads to
// an abandoned server.
ReturnCode stopRc = ReturnCode.STOP_ACTION;
// The lock file may have been (erroneously) deleted: this can happen on linux
boolean lockExists = serverLock.lockFileExists();
if (lockExists) {
// If the lock exists, check quickly to see if the process is holding it.
if (serverLock.testServerRunning()) {
// we need to tell the server to stop...
ServerCommandClient scc = new ServerCommandClient(bootProps);
if (scc.isValid()) {
stopRc = scc.stopServer(launchArgs.getOption("force") != null); // depends on control dependency: [if], data = [none]
} else {
// we can't communicate to the server...
stopRc = ReturnCode.ERROR_SERVER_STOP; // depends on control dependency: [if], data = [none]
}
} else {
// nope: lock not held, we're already stopped
stopRc = ReturnCode.REDUNDANT_ACTION_STATUS; // depends on control dependency: [if], data = [none]
}
} else {
// no lock file: we assume the server is not running, we have nothing to do.
stopRc = ReturnCode.REDUNDANT_ACTION_STATUS; // depends on control dependency: [if], data = [none]
}
// If the lock file existed before we attempted to stop the server,
// wait until we can obtain the server lock file (because the server process has stopped)
if (stopRc == ReturnCode.OK && lockExists) {
stopRc = serverLock.waitForStop(); // depends on control dependency: [if], data = [none]
}
if (stopRc == ReturnCode.OK) {
String pid = getPID();
if (pid != null) {
stopRc = waitForProcessStop(pid); // depends on control dependency: [if], data = [(pid]
}
}
if (stopRc == ReturnCode.OK) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopped"), serverName)); // depends on control dependency: [if], data = [none]
} else if (stopRc == ReturnCode.REDUNDANT_ACTION_STATUS) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverNotRunning"), serverName)); // depends on control dependency: [if], data = [none]
} else if (stopRc == ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.serverStopCommandPortDisabled"), serverName)); // depends on control dependency: [if], data = [none]
} else {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStopException"), serverName)); // depends on control dependency: [if], data = [none]
}
return stopRc;
} }
|
public class class_name {
public AwsSecurityFindingFilters withRelatedFindingsId(StringFilter... relatedFindingsId) {
if (this.relatedFindingsId == null) {
setRelatedFindingsId(new java.util.ArrayList<StringFilter>(relatedFindingsId.length));
}
for (StringFilter ele : relatedFindingsId) {
this.relatedFindingsId.add(ele);
}
return this;
} }
|
public class class_name {
public AwsSecurityFindingFilters withRelatedFindingsId(StringFilter... relatedFindingsId) {
if (this.relatedFindingsId == null) {
setRelatedFindingsId(new java.util.ArrayList<StringFilter>(relatedFindingsId.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : relatedFindingsId) {
this.relatedFindingsId.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.