code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void init(final long[] key, final long[] tweak) {
final int newNw = key.length;
// only create new arrays if the value of N{w} changes (different key size)
if (nw != newNw) {
nw = newNw;
switch (nw) {
case WORDS_4:
pi = PI4;
rpi = RPI4;
r = R4;
break;
case WORDS_8:
pi = PI8;
rpi = RPI8;
r = R8;
break;
case WORDS_16:
pi = PI16;
rpi = RPI16;
r = R16;
break;
default:
throw new RuntimeException("Invalid threefish key");
}
this.k = new long[nw + 1];
// instantiation of these fields here for performance reasons
vd = new long[nw]; // v is the intermediate value v{d} at round d
ed = new long[nw]; // ed is the value of e{d} at round d
fd = new long[nw]; // fd is the value of f{d} at round d
ksd = new long[nw]; // ksd is the value of k{s} at round d
}
System.arraycopy(key, 0, this.k, 0, key.length);
long knw = EXTENDED_KEY_SCHEDULE_CONST;
for (int i = 0; i < nw; i++) {
knw ^= this.k[i];
}
this.k[nw] = knw;
// set tweak values
t[0] = tweak[0];
t[1] = tweak[1];
t[2] = t[0] ^ t[1];
} } | public class class_name {
public void init(final long[] key, final long[] tweak) {
final int newNw = key.length;
// only create new arrays if the value of N{w} changes (different key size)
if (nw != newNw) {
nw = newNw; // depends on control dependency: [if], data = [none]
switch (nw) {
case WORDS_4:
pi = PI4;
rpi = RPI4;
r = R4;
break;
case WORDS_8:
pi = PI8;
rpi = RPI8;
r = R8;
break;
case WORDS_16:
pi = PI16;
rpi = RPI16;
r = R16;
break;
default:
throw new RuntimeException("Invalid threefish key");
}
this.k = new long[nw + 1]; // depends on control dependency: [if], data = [none]
// instantiation of these fields here for performance reasons
vd = new long[nw]; // v is the intermediate value v{d} at round d // depends on control dependency: [if], data = [none]
ed = new long[nw]; // ed is the value of e{d} at round d // depends on control dependency: [if], data = [none]
fd = new long[nw]; // fd is the value of f{d} at round d // depends on control dependency: [if], data = [none]
ksd = new long[nw]; // ksd is the value of k{s} at round d // depends on control dependency: [if], data = [none]
}
System.arraycopy(key, 0, this.k, 0, key.length);
long knw = EXTENDED_KEY_SCHEDULE_CONST;
for (int i = 0; i < nw; i++) {
knw ^= this.k[i]; // depends on control dependency: [for], data = [i]
}
this.k[nw] = knw;
// set tweak values
t[0] = tweak[0];
t[1] = tweak[1];
t[2] = t[0] ^ t[1];
} } |
public class class_name {
public Msg putShortString(String data)
{
if (data == null) {
return this;
}
ByteBuffer dup = buf.duplicate();
dup.position(writeIndex);
writeIndex += Wire.putShortString(dup, data);
return this;
} } | public class class_name {
public Msg putShortString(String data)
{
if (data == null) {
return this; // depends on control dependency: [if], data = [none]
}
ByteBuffer dup = buf.duplicate();
dup.position(writeIndex);
writeIndex += Wire.putShortString(dup, data);
return this;
} } |
public class class_name {
private static Document getDocument(URL pathToPersistenceXml) throws InvalidConfigurationException
{
InputStream is = null;
Document xmlRootNode = null;
try
{
if (pathToPersistenceXml != null)
{
URLConnection conn = pathToPersistenceXml.openConnection();
conn.setUseCaches(false); // avoid JAR locking on Windows and
// Tomcat.
is = conn.getInputStream();
}
if (is == null)
{
throw new IOException("Failed to obtain InputStream from url: " + pathToPersistenceXml);
}
xmlRootNode = parseDocument(is);
validateDocumentAgainstSchema(xmlRootNode);
}
catch (IOException e)
{
throw new InvalidConfigurationException(e);
}
finally
{
if (is != null)
{
try
{
is.close();
}
catch (IOException ex)
{
log.warn("Input stream could not be closed after parsing persistence.xml, caused by: {}", ex);
}
}
}
return xmlRootNode;
} } | public class class_name {
private static Document getDocument(URL pathToPersistenceXml) throws InvalidConfigurationException
{
InputStream is = null;
Document xmlRootNode = null;
try
{
if (pathToPersistenceXml != null)
{
URLConnection conn = pathToPersistenceXml.openConnection();
conn.setUseCaches(false); // avoid JAR locking on Windows and
// depends on control dependency: [if], data = [none]
// Tomcat.
is = conn.getInputStream();
// depends on control dependency: [if], data = [none]
}
if (is == null)
{
throw new IOException("Failed to obtain InputStream from url: " + pathToPersistenceXml);
}
xmlRootNode = parseDocument(is);
validateDocumentAgainstSchema(xmlRootNode);
}
catch (IOException e)
{
throw new InvalidConfigurationException(e);
}
finally
{
if (is != null)
{
try
{
is.close();
// depends on control dependency: [try], data = [none]
}
catch (IOException ex)
{
log.warn("Input stream could not be closed after parsing persistence.xml, caused by: {}", ex);
}
// depends on control dependency: [catch], data = [none]
}
}
return xmlRootNode;
} } |
public class class_name {
public @Nullable T get() {
Field f = checkNotNull(field);
try {
setAccessible(f, true);
Object value = f.get(target);
return castSafely(value, checkNotNull(fieldType));
} catch (Throwable t) {
String msg = String.format("Failed to get the value of field '%s'", f.getName());
throw new ReflectionError(msg, t);
} finally {
setAccessibleIgnoringExceptions(f, accessible);
}
} } | public class class_name {
public @Nullable T get() {
Field f = checkNotNull(field);
try {
setAccessible(f, true); // depends on control dependency: [try], data = [none]
Object value = f.get(target);
return castSafely(value, checkNotNull(fieldType)); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
String msg = String.format("Failed to get the value of field '%s'", f.getName());
throw new ReflectionError(msg, t);
} finally { // depends on control dependency: [catch], data = [none]
setAccessibleIgnoringExceptions(f, accessible);
}
} } |
public class class_name {
public IpPermission withIpv6Ranges(Ipv6Range... ipv6Ranges) {
if (this.ipv6Ranges == null) {
setIpv6Ranges(new com.amazonaws.internal.SdkInternalList<Ipv6Range>(ipv6Ranges.length));
}
for (Ipv6Range ele : ipv6Ranges) {
this.ipv6Ranges.add(ele);
}
return this;
} } | public class class_name {
public IpPermission withIpv6Ranges(Ipv6Range... ipv6Ranges) {
if (this.ipv6Ranges == null) {
setIpv6Ranges(new com.amazonaws.internal.SdkInternalList<Ipv6Range>(ipv6Ranges.length)); // depends on control dependency: [if], data = [none]
}
for (Ipv6Range ele : ipv6Ranges) {
this.ipv6Ranges.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public final void collect ()
{
if (m_aPerformer == null)
throw new IllegalStateException ("No performer set!");
try
{
// The temporary list that contains all objects to be delivered
final ICommonsList <DATATYPE> aObjectsToPerform = new CommonsArrayList <> ();
boolean bQueueIsStopped = false;
while (true)
{
// Block until the first object is in the queue
Object aCurrentObject = m_aQueue.take ();
if (EqualsHelper.identityEqual (aCurrentObject, STOP_QUEUE_OBJECT))
break;
// add current object
aObjectsToPerform.add (GenericReflection.uncheckedCast (aCurrentObject));
// take all messages that are in the queue and handle them at once.
// Handle at last m_nMaxPerformSize objects
while (aObjectsToPerform.size () < m_nMaxPerformCount && !m_aQueue.isEmpty ())
{
// Explicitly handle the "stop queue message" (using "=="!!!)
aCurrentObject = m_aQueue.take ();
if (EqualsHelper.identityEqual (aCurrentObject, STOP_QUEUE_OBJECT))
{
bQueueIsStopped = true;
break;
}
// add current object
aObjectsToPerform.add (GenericReflection.uncheckedCast (aCurrentObject));
}
_perform (aObjectsToPerform);
// In case we received a stop message while getting the bulk messages
// above -> break the loop manually
// Note: do not include in while-loop above because the conditions may
// not execute in the correct order since "take" is blocking!
if (bQueueIsStopped)
break;
}
// perform any remaining actions
_perform (aObjectsToPerform);
}
catch (final Exception ex)
{
LOGGER.error ("Error taking elements from queue - queue has been interrupted!!!", ex);
}
} } | public class class_name {
public final void collect ()
{
if (m_aPerformer == null)
throw new IllegalStateException ("No performer set!");
try
{
// The temporary list that contains all objects to be delivered
final ICommonsList <DATATYPE> aObjectsToPerform = new CommonsArrayList <> ();
boolean bQueueIsStopped = false;
while (true)
{
// Block until the first object is in the queue
Object aCurrentObject = m_aQueue.take ();
if (EqualsHelper.identityEqual (aCurrentObject, STOP_QUEUE_OBJECT))
break;
// add current object
aObjectsToPerform.add (GenericReflection.uncheckedCast (aCurrentObject)); // depends on control dependency: [while], data = [none]
// take all messages that are in the queue and handle them at once.
// Handle at last m_nMaxPerformSize objects
while (aObjectsToPerform.size () < m_nMaxPerformCount && !m_aQueue.isEmpty ())
{
// Explicitly handle the "stop queue message" (using "=="!!!)
aCurrentObject = m_aQueue.take (); // depends on control dependency: [while], data = [none]
if (EqualsHelper.identityEqual (aCurrentObject, STOP_QUEUE_OBJECT))
{
bQueueIsStopped = true; // depends on control dependency: [if], data = [none]
break;
}
// add current object
aObjectsToPerform.add (GenericReflection.uncheckedCast (aCurrentObject)); // depends on control dependency: [while], data = [none]
}
_perform (aObjectsToPerform); // depends on control dependency: [while], data = [none]
// In case we received a stop message while getting the bulk messages
// above -> break the loop manually
// Note: do not include in while-loop above because the conditions may
// not execute in the correct order since "take" is blocking!
if (bQueueIsStopped)
break;
}
// perform any remaining actions
_perform (aObjectsToPerform); // depends on control dependency: [try], data = [none]
}
catch (final Exception ex)
{
LOGGER.error ("Error taking elements from queue - queue has been interrupted!!!", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(EventDescription eventDescription, ProtocolMarshaller protocolMarshaller) {
if (eventDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(eventDescription.getLatestDescription(), LATESTDESCRIPTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EventDescription eventDescription, ProtocolMarshaller protocolMarshaller) {
if (eventDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(eventDescription.getLatestDescription(), LATESTDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void logAllThreads() {
StringBuilder sb = new StringBuilder("Dumping all threads:\n");
for (Thread t : Thread.getAllStackTraces().keySet()) {
sb.append(formatStackTrace(t));
}
LOG.info(sb.toString());
} } | public class class_name {
public static void logAllThreads() {
StringBuilder sb = new StringBuilder("Dumping all threads:\n");
for (Thread t : Thread.getAllStackTraces().keySet()) {
sb.append(formatStackTrace(t)); // depends on control dependency: [for], data = [t]
}
LOG.info(sb.toString());
} } |
public class class_name {
public static DependencyResolver fromTuples(Object... tuples) {
DependencyResolver result = new DependencyResolver();
if (tuples == null || tuples.length == 0)
return result;
for (int index = 0; index < tuples.length; index += 2) {
if (index + 1 >= tuples.length)
break;
String name = StringConverter.toString(tuples[index]);
Object locator = tuples[index + 1];
result.put(name, locator);
}
return result;
} } | public class class_name {
public static DependencyResolver fromTuples(Object... tuples) {
DependencyResolver result = new DependencyResolver();
if (tuples == null || tuples.length == 0)
return result;
for (int index = 0; index < tuples.length; index += 2) {
if (index + 1 >= tuples.length)
break;
String name = StringConverter.toString(tuples[index]);
Object locator = tuples[index + 1];
result.put(name, locator); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
public static List<String> getTenantNames(TenantService tenantService) throws ProfileException {
List<Tenant> tenants = tenantService.getAllTenants();
List<String> tenantNames = new ArrayList<>(tenants.size());
if (CollectionUtils.isNotEmpty(tenants)) {
for (Tenant tenant : tenants) {
tenantNames.add(tenant.getName());
}
}
return tenantNames;
} } | public class class_name {
public static List<String> getTenantNames(TenantService tenantService) throws ProfileException {
List<Tenant> tenants = tenantService.getAllTenants();
List<String> tenantNames = new ArrayList<>(tenants.size());
if (CollectionUtils.isNotEmpty(tenants)) {
for (Tenant tenant : tenants) {
tenantNames.add(tenant.getName()); // depends on control dependency: [for], data = [tenant]
}
}
return tenantNames;
} } |
public class class_name {
public void setClientVariant(String context, String variant, CmsClientVariantInfo info) {
if (!m_clientVariantInfo.containsKey(context)) {
Map<String, CmsClientVariantInfo> variants = new LinkedHashMap<String, CmsClientVariantInfo>();
m_clientVariantInfo.put(context, variants);
}
m_clientVariantInfo.get(context).put(variant, info);
} } | public class class_name {
public void setClientVariant(String context, String variant, CmsClientVariantInfo info) {
if (!m_clientVariantInfo.containsKey(context)) {
Map<String, CmsClientVariantInfo> variants = new LinkedHashMap<String, CmsClientVariantInfo>();
m_clientVariantInfo.put(context, variants);
// depends on control dependency: [if], data = [none]
}
m_clientVariantInfo.get(context).put(variant, info);
} } |
public class class_name {
public void setTriggers(java.util.Collection<Trigger> triggers) {
if (triggers == null) {
this.triggers = null;
return;
}
this.triggers = new com.amazonaws.internal.SdkInternalList<Trigger>(triggers);
} } | public class class_name {
public void setTriggers(java.util.Collection<Trigger> triggers) {
if (triggers == null) {
this.triggers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.triggers = new com.amazonaws.internal.SdkInternalList<Trigger>(triggers);
} } |
public class class_name {
@Override
public boolean schemaExists() {
PreparedStatement ps = null;
try {
ps = getPreparedStatement(SIMPLE_SELECT_SQL);
ps.executeQuery();
return true;
} catch (SQLException e) {
return false;
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
// Ignore it
}
}
}
} } | public class class_name {
@Override
public boolean schemaExists() {
PreparedStatement ps = null;
try {
ps = getPreparedStatement(SIMPLE_SELECT_SQL); // depends on control dependency: [try], data = [none]
ps.executeQuery(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
return false;
} finally { // depends on control dependency: [catch], data = [none]
if (ps != null) {
try {
ps.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// Ignore it
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void addText(String text) {
try {
writer.append(text);
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
public void addText(String text) {
try {
writer.append(text); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public LiquibaseDataType fromDescription(String dataTypeDefinition, Database database) {
if (dataTypeDefinition == null) {
return null;
}
String dataTypeName = dataTypeDefinition;
// Remove the first occurrence of (anything within parentheses). This will remove the size information from
// most data types, e.g. VARCHAR2(255 CHAR) -> VARCHAR2. We will retrieve that length information again later,
// but for the moment, we are only interested in the "naked" data type name.
if (dataTypeName.matches(".+\\(.*\\).*")) {
dataTypeName = dataTypeName.replaceFirst("\\s*\\(.*\\)", "");
}
// Remove everything { after the first opening curly bracket
// e.g. int{autoIncrement:true}" -> "int"
if (dataTypeName.matches(".+\\{.*")) {
dataTypeName = dataTypeName.replaceFirst("\\s*\\{.*", "");
}
// If the remaining string ends with " identity", then remove the " identity" and remember than we want
// to set the autoIncrement property later.
boolean autoIncrement = false;
if (dataTypeName.toLowerCase(Locale.US).endsWith(" identity")) {
dataTypeName = dataTypeName.toLowerCase(Locale.US).replaceFirst(" identity$", "");
autoIncrement = true;
}
// unquote delimited identifiers
final String[][] quotePairs = new String[][] {
{ "\"", "\"" }, // double quotes
{ "[", "]" }, // square brackets (a la mssql)
{ "`", "`" }, // backticks (a la mysql)
{ "'", "'" } // single quotes
};
for (String[] quotePair : quotePairs) {
String openQuote = quotePair[0];
String closeQuote = quotePair[1];
if (dataTypeName.startsWith(openQuote)) {
int indexOfCloseQuote = dataTypeName.indexOf(closeQuote, openQuote.length());
if ((indexOfCloseQuote != -1) && (dataTypeName.indexOf(closeQuote, indexOfCloseQuote + closeQuote
.length()) == -1)) {
dataTypeName = dataTypeName.substring(openQuote.length(), indexOfCloseQuote) +
dataTypeName.substring(indexOfCloseQuote + closeQuote.length(), dataTypeName.length());
break;
}
}
}
// record additional information that is still attached to the data type name
String additionalInfo = null;
if (dataTypeName.toLowerCase(Locale.US).startsWith("bit varying")
|| dataTypeName.toLowerCase(Locale.US).startsWith("character varying")) {
// not going to do anything. Special case for postgres in our tests,
// need to better support handling these types of differences
} else {
// Heuristic: from what we now have left of the data type name, everything after the first space
// is counted as additional information.
String[] splitTypeName = dataTypeName.trim().split("\\s+", 2);
dataTypeName = splitTypeName[0];
if (splitTypeName.length > 1) {
additionalInfo = splitTypeName[1];
}
}
// try to find matching classes for the data type name in our registry
Collection<Class<? extends LiquibaseDataType>> classes = registry.get(dataTypeName.toLowerCase(Locale.US));
LiquibaseDataType liquibaseDataType = null;
if (classes == null) {
// Map (date/time) INTERVAL types to the UnknownType
if (dataTypeName.toUpperCase(Locale.US).startsWith("INTERVAL")) {
liquibaseDataType = new UnknownType(dataTypeDefinition);
} else {
liquibaseDataType = new UnknownType(dataTypeName);
}
} else {
// Iterate through the list (which is already sorted by priority) until we find a class
// for this dataTypeName that supports the given database.
Iterator<Class<? extends LiquibaseDataType>> iterator = classes.iterator();
do {
try {
liquibaseDataType = iterator.next().getConstructor().newInstance();
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
} while ((database != null) && !liquibaseDataType.supports(database) && iterator.hasNext());
}
if ((database != null) && !liquibaseDataType.supports(database)) {
throw new UnexpectedLiquibaseException("Could not find type for " + liquibaseDataType.toString() +
" for DBMS "+database.getShortName());
}
if (liquibaseDataType == null) {
liquibaseDataType = new UnknownType(dataTypeName);
}
liquibaseDataType.setAdditionalInformation(additionalInfo);
// Does the type string have the form "some_data_type(additional,info,separated,by,commas)"?
// If so, process these as additional data type parameters.
if (dataTypeDefinition.matches(".+\\s*\\(.*")) {
// Cut out the part between the first ()
String paramStrings = dataTypeDefinition.replaceFirst(".*?\\(", "").replaceFirst("\\).*", "");
String[] params = paramStrings.split(",");
for (String param : params) {
param = StringUtil.trimToNull(param);
if (param != null) {
if ((liquibaseDataType instanceof CharType) && !(database instanceof OracleDatabase)) {
// TODO this might lead to wrong snapshot results in Oracle Database, because it assumes
// NLS_LENGTH_SEMANTICS=BYTE. If NLS_LENGTH_SEMANTICS=CHAR, we need to trim " CHAR" instead.
// not sure what else supports it:
param = param.replaceFirst(" BYTE", ""); //only use byte types on oracle,
}
liquibaseDataType.addParameter(param);
}
}
}
// Did the original definition have embedded information in curly braces, e.g.
// "int{autoIncrement:true}"? If so, we will extract and process it now.
if (dataTypeDefinition.matches(".*\\{.*")) {
String paramStrings = dataTypeDefinition.replaceFirst(".*?\\{", "")
.replaceFirst("\\}.*", "");
String[] params = paramStrings.split(",");
for (String param : params) {
param = StringUtil.trimToNull(param);
if (param != null) {
String[] paramAndValue = param.split(":", 2);
// TODO: A run-time exception will occur here if the user writes a property name into the
// data type which does not exist - but what else could we do in this case, except aborting?
ObjectUtil.setProperty(liquibaseDataType, paramAndValue[0], paramAndValue[1]);
}
}
}
if (autoIncrement && (liquibaseDataType instanceof IntType)) {
((IntType) liquibaseDataType).setAutoIncrement(true);
}
if (autoIncrement && (liquibaseDataType instanceof BigIntType)) {
((BigIntType) liquibaseDataType).setAutoIncrement(true);
}
liquibaseDataType.finishInitialization(dataTypeDefinition);
return liquibaseDataType;
} } | public class class_name {
public LiquibaseDataType fromDescription(String dataTypeDefinition, Database database) {
if (dataTypeDefinition == null) {
return null; // depends on control dependency: [if], data = [none]
}
String dataTypeName = dataTypeDefinition;
// Remove the first occurrence of (anything within parentheses). This will remove the size information from
// most data types, e.g. VARCHAR2(255 CHAR) -> VARCHAR2. We will retrieve that length information again later,
// but for the moment, we are only interested in the "naked" data type name.
if (dataTypeName.matches(".+\\(.*\\).*")) {
dataTypeName = dataTypeName.replaceFirst("\\s*\\(.*\\)", ""); // depends on control dependency: [if], data = [none]
}
// Remove everything { after the first opening curly bracket
// e.g. int{autoIncrement:true}" -> "int"
if (dataTypeName.matches(".+\\{.*")) {
dataTypeName = dataTypeName.replaceFirst("\\s*\\{.*", ""); // depends on control dependency: [if], data = [none]
}
// If the remaining string ends with " identity", then remove the " identity" and remember than we want
// to set the autoIncrement property later.
boolean autoIncrement = false;
if (dataTypeName.toLowerCase(Locale.US).endsWith(" identity")) {
dataTypeName = dataTypeName.toLowerCase(Locale.US).replaceFirst(" identity$", ""); // depends on control dependency: [if], data = [none]
autoIncrement = true; // depends on control dependency: [if], data = [none]
}
// unquote delimited identifiers
final String[][] quotePairs = new String[][] {
{ "\"", "\"" }, // double quotes
{ "[", "]" }, // square brackets (a la mssql)
{ "`", "`" }, // backticks (a la mysql)
{ "'", "'" } // single quotes
};
for (String[] quotePair : quotePairs) {
String openQuote = quotePair[0];
String closeQuote = quotePair[1];
if (dataTypeName.startsWith(openQuote)) {
int indexOfCloseQuote = dataTypeName.indexOf(closeQuote, openQuote.length());
if ((indexOfCloseQuote != -1) && (dataTypeName.indexOf(closeQuote, indexOfCloseQuote + closeQuote
.length()) == -1)) {
dataTypeName = dataTypeName.substring(openQuote.length(), indexOfCloseQuote) +
dataTypeName.substring(indexOfCloseQuote + closeQuote.length(), dataTypeName.length()); // depends on control dependency: [if], data = [none]
break;
}
}
}
// record additional information that is still attached to the data type name
String additionalInfo = null;
if (dataTypeName.toLowerCase(Locale.US).startsWith("bit varying")
|| dataTypeName.toLowerCase(Locale.US).startsWith("character varying")) {
// not going to do anything. Special case for postgres in our tests,
// need to better support handling these types of differences
} else {
// Heuristic: from what we now have left of the data type name, everything after the first space
// is counted as additional information.
String[] splitTypeName = dataTypeName.trim().split("\\s+", 2);
dataTypeName = splitTypeName[0]; // depends on control dependency: [if], data = [none]
if (splitTypeName.length > 1) {
additionalInfo = splitTypeName[1]; // depends on control dependency: [if], data = [none]
}
}
// try to find matching classes for the data type name in our registry
Collection<Class<? extends LiquibaseDataType>> classes = registry.get(dataTypeName.toLowerCase(Locale.US));
LiquibaseDataType liquibaseDataType = null;
if (classes == null) {
// Map (date/time) INTERVAL types to the UnknownType
if (dataTypeName.toUpperCase(Locale.US).startsWith("INTERVAL")) {
liquibaseDataType = new UnknownType(dataTypeDefinition); // depends on control dependency: [if], data = [none]
} else {
liquibaseDataType = new UnknownType(dataTypeName); // depends on control dependency: [if], data = [none]
}
} else {
// Iterate through the list (which is already sorted by priority) until we find a class
// for this dataTypeName that supports the given database.
Iterator<Class<? extends LiquibaseDataType>> iterator = classes.iterator(); // depends on control dependency: [if], data = [none]
do {
try {
liquibaseDataType = iterator.next().getConstructor().newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
} // depends on control dependency: [catch], data = [none]
} while ((database != null) && !liquibaseDataType.supports(database) && iterator.hasNext());
}
if ((database != null) && !liquibaseDataType.supports(database)) {
throw new UnexpectedLiquibaseException("Could not find type for " + liquibaseDataType.toString() +
" for DBMS "+database.getShortName());
}
if (liquibaseDataType == null) {
liquibaseDataType = new UnknownType(dataTypeName); // depends on control dependency: [if], data = [none]
}
liquibaseDataType.setAdditionalInformation(additionalInfo);
// Does the type string have the form "some_data_type(additional,info,separated,by,commas)"?
// If so, process these as additional data type parameters.
if (dataTypeDefinition.matches(".+\\s*\\(.*")) {
// Cut out the part between the first ()
String paramStrings = dataTypeDefinition.replaceFirst(".*?\\(", "").replaceFirst("\\).*", "");
String[] params = paramStrings.split(",");
for (String param : params) {
param = StringUtil.trimToNull(param); // depends on control dependency: [for], data = [param]
if (param != null) {
if ((liquibaseDataType instanceof CharType) && !(database instanceof OracleDatabase)) {
// TODO this might lead to wrong snapshot results in Oracle Database, because it assumes
// NLS_LENGTH_SEMANTICS=BYTE. If NLS_LENGTH_SEMANTICS=CHAR, we need to trim " CHAR" instead.
// not sure what else supports it:
param = param.replaceFirst(" BYTE", ""); //only use byte types on oracle, // depends on control dependency: [if], data = [none]
}
liquibaseDataType.addParameter(param); // depends on control dependency: [if], data = [(param]
}
}
}
// Did the original definition have embedded information in curly braces, e.g.
// "int{autoIncrement:true}"? If so, we will extract and process it now.
if (dataTypeDefinition.matches(".*\\{.*")) {
String paramStrings = dataTypeDefinition.replaceFirst(".*?\\{", "")
.replaceFirst("\\}.*", "");
String[] params = paramStrings.split(",");
for (String param : params) {
param = StringUtil.trimToNull(param); // depends on control dependency: [for], data = [param]
if (param != null) {
String[] paramAndValue = param.split(":", 2);
// TODO: A run-time exception will occur here if the user writes a property name into the
// data type which does not exist - but what else could we do in this case, except aborting?
ObjectUtil.setProperty(liquibaseDataType, paramAndValue[0], paramAndValue[1]); // depends on control dependency: [if], data = [none]
}
}
}
if (autoIncrement && (liquibaseDataType instanceof IntType)) {
((IntType) liquibaseDataType).setAutoIncrement(true); // depends on control dependency: [if], data = [none]
}
if (autoIncrement && (liquibaseDataType instanceof BigIntType)) {
((BigIntType) liquibaseDataType).setAutoIncrement(true); // depends on control dependency: [if], data = [none]
}
liquibaseDataType.finishInitialization(dataTypeDefinition);
return liquibaseDataType;
} } |
public class class_name {
void moveouts(State old, State newState) {
Arc a;
assert old != newState;
while ((a = old.outs) != null) {
cparc(a, newState, a.to);
freearc(a);
}
} } | public class class_name {
void moveouts(State old, State newState) {
Arc a;
assert old != newState;
while ((a = old.outs) != null) {
cparc(a, newState, a.to); // depends on control dependency: [while], data = [none]
freearc(a); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private static void getStats(
StatsSnapshot snapshot,
AggregationData data,
View view,
ViewData.AggregationWindowData windowData) {
if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_VIEW || view == RPC_SERVER_SERVER_LATENCY_VIEW) {
snapshot.avgLatencyTotal = ((DistributionData) data).getMean();
} else if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_MINUTE_VIEW
|| view == RPC_SERVER_SERVER_LATENCY_MINUTE_VIEW) {
snapshot.avgLatencyLastMinute = ((AggregationData.MeanData) data).getMean();
} else if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_HOUR_VIEW
|| view == RPC_SERVER_SERVER_LATENCY_HOUR_VIEW) {
snapshot.avgLatencyLastHour = ((AggregationData.MeanData) data).getMean();
} else if (view == RPC_CLIENT_ERROR_COUNT_VIEW || view == RPC_SERVER_ERROR_COUNT_VIEW) {
snapshot.errorsTotal = ((AggregationData.MeanData) data).getCount();
} else if (view == RPC_CLIENT_ERROR_COUNT_MINUTE_VIEW
|| view == RPC_SERVER_ERROR_COUNT_MINUTE_VIEW) {
snapshot.errorsLastMinute = ((AggregationData.MeanData) data).getCount();
} else if (view == RPC_CLIENT_ERROR_COUNT_HOUR_VIEW
|| view == RPC_SERVER_ERROR_COUNT_HOUR_VIEW) {
snapshot.errorsLastHour = ((AggregationData.MeanData) data).getCount();
} else if (view == RPC_CLIENT_REQUEST_BYTES_VIEW || view == RPC_SERVER_REQUEST_BYTES_VIEW) {
DistributionData distributionData = (DistributionData) data;
snapshot.inputRateTotal =
distributionData.getCount()
* distributionData.getMean()
/ BYTES_PER_KB
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData);
} else if (view == RPC_CLIENT_REQUEST_BYTES_MINUTE_VIEW
|| view == RPC_SERVER_REQUEST_BYTES_MINUTE_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.inputRateLastMinute =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_MINUTE;
} else if (view == RPC_CLIENT_REQUEST_BYTES_HOUR_VIEW
|| view == RPC_SERVER_REQUEST_BYTES_HOUR_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.inputRateLastHour =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_HOUR;
} else if (view == RPC_CLIENT_RESPONSE_BYTES_VIEW || view == RPC_SERVER_RESPONSE_BYTES_VIEW) {
DistributionData distributionData = (DistributionData) data;
snapshot.outputRateTotal =
distributionData.getCount()
* distributionData.getMean()
/ BYTES_PER_KB
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData);
} else if (view == RPC_CLIENT_RESPONSE_BYTES_MINUTE_VIEW
|| view == RPC_SERVER_RESPONSE_BYTES_MINUTE_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.outputRateLastMinute =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_MINUTE;
} else if (view == RPC_CLIENT_RESPONSE_BYTES_HOUR_VIEW
|| view == RPC_SERVER_RESPONSE_BYTES_HOUR_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.outputRateLastHour =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_HOUR;
} else if (view == RPC_CLIENT_STARTED_COUNT_MINUTE_VIEW
|| view == RPC_SERVER_STARTED_COUNT_MINUTE_VIEW) {
snapshot.countLastMinute = ((CountData) data).getCount();
snapshot.rpcRateLastMinute = snapshot.countLastMinute / SECONDS_PER_MINUTE;
} else if (view == RPC_CLIENT_STARTED_COUNT_HOUR_VIEW
|| view == RPC_SERVER_STARTED_COUNT_HOUR_VIEW) {
snapshot.countLastHour = ((CountData) data).getCount();
snapshot.rpcRateLastHour = snapshot.countLastHour / SECONDS_PER_HOUR;
} else if (view == RPC_CLIENT_STARTED_COUNT_CUMULATIVE_VIEW
|| view == RPC_SERVER_STARTED_COUNT_CUMULATIVE_VIEW) {
snapshot.countTotal = ((CountData) data).getCount();
snapshot.rpcRateTotal =
snapshot.countTotal
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData);
} // TODO(songya): compute and store latency percentiles.
} } | public class class_name {
private static void getStats(
StatsSnapshot snapshot,
AggregationData data,
View view,
ViewData.AggregationWindowData windowData) {
if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_VIEW || view == RPC_SERVER_SERVER_LATENCY_VIEW) {
snapshot.avgLatencyTotal = ((DistributionData) data).getMean(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_MINUTE_VIEW
|| view == RPC_SERVER_SERVER_LATENCY_MINUTE_VIEW) {
snapshot.avgLatencyLastMinute = ((AggregationData.MeanData) data).getMean(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_ROUNDTRIP_LATENCY_HOUR_VIEW
|| view == RPC_SERVER_SERVER_LATENCY_HOUR_VIEW) {
snapshot.avgLatencyLastHour = ((AggregationData.MeanData) data).getMean(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_ERROR_COUNT_VIEW || view == RPC_SERVER_ERROR_COUNT_VIEW) {
snapshot.errorsTotal = ((AggregationData.MeanData) data).getCount(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_ERROR_COUNT_MINUTE_VIEW
|| view == RPC_SERVER_ERROR_COUNT_MINUTE_VIEW) {
snapshot.errorsLastMinute = ((AggregationData.MeanData) data).getCount(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_ERROR_COUNT_HOUR_VIEW
|| view == RPC_SERVER_ERROR_COUNT_HOUR_VIEW) {
snapshot.errorsLastHour = ((AggregationData.MeanData) data).getCount(); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_REQUEST_BYTES_VIEW || view == RPC_SERVER_REQUEST_BYTES_VIEW) {
DistributionData distributionData = (DistributionData) data;
snapshot.inputRateTotal =
distributionData.getCount()
* distributionData.getMean()
/ BYTES_PER_KB
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_REQUEST_BYTES_MINUTE_VIEW
|| view == RPC_SERVER_REQUEST_BYTES_MINUTE_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.inputRateLastMinute =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_MINUTE; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_REQUEST_BYTES_HOUR_VIEW
|| view == RPC_SERVER_REQUEST_BYTES_HOUR_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.inputRateLastHour =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_HOUR; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_RESPONSE_BYTES_VIEW || view == RPC_SERVER_RESPONSE_BYTES_VIEW) {
DistributionData distributionData = (DistributionData) data;
snapshot.outputRateTotal =
distributionData.getCount()
* distributionData.getMean()
/ BYTES_PER_KB
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData); // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_RESPONSE_BYTES_MINUTE_VIEW
|| view == RPC_SERVER_RESPONSE_BYTES_MINUTE_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.outputRateLastMinute =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_MINUTE; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_RESPONSE_BYTES_HOUR_VIEW
|| view == RPC_SERVER_RESPONSE_BYTES_HOUR_VIEW) {
AggregationData.MeanData meanData = (AggregationData.MeanData) data;
snapshot.outputRateLastHour =
meanData.getMean() * meanData.getCount() / BYTES_PER_KB / SECONDS_PER_HOUR; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_STARTED_COUNT_MINUTE_VIEW
|| view == RPC_SERVER_STARTED_COUNT_MINUTE_VIEW) {
snapshot.countLastMinute = ((CountData) data).getCount(); // depends on control dependency: [if], data = [none]
snapshot.rpcRateLastMinute = snapshot.countLastMinute / SECONDS_PER_MINUTE; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_STARTED_COUNT_HOUR_VIEW
|| view == RPC_SERVER_STARTED_COUNT_HOUR_VIEW) {
snapshot.countLastHour = ((CountData) data).getCount(); // depends on control dependency: [if], data = [none]
snapshot.rpcRateLastHour = snapshot.countLastHour / SECONDS_PER_HOUR; // depends on control dependency: [if], data = [none]
} else if (view == RPC_CLIENT_STARTED_COUNT_CUMULATIVE_VIEW
|| view == RPC_SERVER_STARTED_COUNT_CUMULATIVE_VIEW) {
snapshot.countTotal = ((CountData) data).getCount(); // depends on control dependency: [if], data = [none]
snapshot.rpcRateTotal =
snapshot.countTotal
/ getDurationInSecs((ViewData.AggregationWindowData.CumulativeData) windowData); // depends on control dependency: [if], data = [none]
} // TODO(songya): compute and store latency percentiles.
} } |
public class class_name {
void internalOpenDialog(
final CmsContainerPageElementPanel element,
String editContentId,
final boolean inline,
boolean wasNew) {
if (!m_editorOpened) {
m_editorOpened = true;
m_handler.disableToolbarButtons();
m_handler.deactivateCurrentButton();
m_currentElementId = editContentId;
final String serverId = CmsContainerpageController.getServerId(m_currentElementId);
final Runnable classicEdit = new Runnable() {
public void run() {
CmsEditableData editableData = new CmsEditableData();
editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
editableData.setStructureId(new CmsUUID(serverId));
editableData.setSitePath(element.getSitePath());
editableData.setMainLanguage(m_handler.m_controller.getData().getMainLocale());
CmsContentEditorDialog.get().openEditDialog(
editableData,
false,
null,
new DialogOptions(),
CmsContentEditorHandler.this);
}
};
if (m_handler.m_controller.getData().isUseClassicEditor() || element.isNewEditorDisabled()) {
classicEdit.run();
} else {
String editorLocale = CmsCoreProvider.get().getLocale();
final String mainLocale;
if (m_handler.m_controller.getData().getMainLocale() == null) {
Element htmlEl = CmsDomUtil.querySelector(
"[" + CmsGwtConstants.ATTR_DATA_ID + "*='" + serverId + "']",
element.getElement());
if (htmlEl != null) {
String entityId = htmlEl.getAttribute(CmsGwtConstants.ATTR_DATA_ID);
mainLocale = CmsContentDefinition.getLocaleFromId(entityId);
} else {
mainLocale = null;
}
} else {
mainLocale = m_handler.m_controller.getData().getMainLocale();
}
I_CmsSimpleCallback<Boolean> onClose = new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean hasChangedSettings) {
addClosedEditorHistoryItem();
onClose(element.getSitePath(), new CmsUUID(serverId), false, hasChangedSettings.booleanValue());
}
};
if (inline && CmsContentEditor.hasEditable(element.getElement())) {
addEditingHistoryItem(true);
CmsEditorContext context = getEditorContext();
context.setHtmlContextInfo(getContextInfo(element));
// remove expired style before initializing the editor
element.setReleasedAndNotExpired(true);
// in case of new elements, ignore load time
CmsDebugLog.consoleLog("Opening inline editor for element. Was new: " + wasNew);
long loadTime = wasNew ? Long.MAX_VALUE : m_handler.m_controller.getLoadTime();
CmsContentEditor.getInstance().openInlineEditor(
context,
new CmsUUID(serverId),
editorLocale,
element,
mainLocale,
loadTime,
onClose);
} else {
addEditingHistoryItem(false);
Map<String, String> settingPresets = new HashMap<String, String>();
CmsEditorContext context = getEditorContext();
I_CmsDropContainer dropContainer = element.getParentTarget();
if (dropContainer instanceof CmsContainerPageContainer) {
CmsContainerPageContainer container = (CmsContainerPageContainer)dropContainer;
settingPresets.putAll(container.getSettingPresets());
}
context.setSettingPresets(settingPresets);
boolean allowSettings = m_handler.m_controller.getData().allowSettingsInEditor()
&& !m_handler.m_controller.isEditingDisabled()
&& !serverId.equals(String.valueOf(m_handler.m_controller.getData().getDetailId()));
I_CmsSimpleCallback<Boolean> openEditor = new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean lockedPage) {
CmsContentEditor.getInstance().openFormEditor(
context,
editorLocale,
serverId,
lockedPage.booleanValue() ? getCurrentElementId() : null,
null,
null,
null,
null,
mainLocale,
null,
onClose);
}
};
if (allowSettings) {
if (m_handler.m_controller.getData().getDetailContainerPage() != null) {
CmsCoreProvider.get().lock(
m_handler.m_controller.getData().getDetailContainerPage(),
m_handler.m_controller.getLoadTime(),
openEditor);
} else {
CmsCoreProvider.get().lock(
CmsCoreProvider.get().getStructureId(),
m_handler.m_controller.getLoadTime(),
openEditor);
}
} else {
openEditor.execute(Boolean.FALSE);
}
}
}
} else {
CmsDebugLog.getInstance().printLine("Editor is already being opened.");
}
} } | public class class_name {
void internalOpenDialog(
final CmsContainerPageElementPanel element,
String editContentId,
final boolean inline,
boolean wasNew) {
if (!m_editorOpened) {
m_editorOpened = true; // depends on control dependency: [if], data = [none]
m_handler.disableToolbarButtons(); // depends on control dependency: [if], data = [none]
m_handler.deactivateCurrentButton(); // depends on control dependency: [if], data = [none]
m_currentElementId = editContentId; // depends on control dependency: [if], data = [none]
final String serverId = CmsContainerpageController.getServerId(m_currentElementId);
final Runnable classicEdit = new Runnable() {
public void run() {
CmsEditableData editableData = new CmsEditableData();
editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
editableData.setStructureId(new CmsUUID(serverId));
editableData.setSitePath(element.getSitePath());
editableData.setMainLanguage(m_handler.m_controller.getData().getMainLocale());
CmsContentEditorDialog.get().openEditDialog(
editableData,
false,
null,
new DialogOptions(),
CmsContentEditorHandler.this);
}
};
if (m_handler.m_controller.getData().isUseClassicEditor() || element.isNewEditorDisabled()) {
classicEdit.run(); // depends on control dependency: [if], data = [none]
} else {
String editorLocale = CmsCoreProvider.get().getLocale();
final String mainLocale;
if (m_handler.m_controller.getData().getMainLocale() == null) {
Element htmlEl = CmsDomUtil.querySelector(
"[" + CmsGwtConstants.ATTR_DATA_ID + "*='" + serverId + "']",
element.getElement());
if (htmlEl != null) {
String entityId = htmlEl.getAttribute(CmsGwtConstants.ATTR_DATA_ID);
mainLocale = CmsContentDefinition.getLocaleFromId(entityId); // depends on control dependency: [if], data = [none]
} else {
mainLocale = null; // depends on control dependency: [if], data = [none]
}
} else {
mainLocale = m_handler.m_controller.getData().getMainLocale(); // depends on control dependency: [if], data = [none]
}
I_CmsSimpleCallback<Boolean> onClose = new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean hasChangedSettings) {
addClosedEditorHistoryItem();
onClose(element.getSitePath(), new CmsUUID(serverId), false, hasChangedSettings.booleanValue());
}
};
if (inline && CmsContentEditor.hasEditable(element.getElement())) {
addEditingHistoryItem(true); // depends on control dependency: [if], data = [none]
CmsEditorContext context = getEditorContext();
context.setHtmlContextInfo(getContextInfo(element)); // depends on control dependency: [if], data = [none]
// remove expired style before initializing the editor
element.setReleasedAndNotExpired(true); // depends on control dependency: [if], data = [none]
// in case of new elements, ignore load time
CmsDebugLog.consoleLog("Opening inline editor for element. Was new: " + wasNew); // depends on control dependency: [if], data = [none]
long loadTime = wasNew ? Long.MAX_VALUE : m_handler.m_controller.getLoadTime();
CmsContentEditor.getInstance().openInlineEditor(
context,
new CmsUUID(serverId),
editorLocale,
element,
mainLocale,
loadTime,
onClose); // depends on control dependency: [if], data = [none]
} else {
addEditingHistoryItem(false); // depends on control dependency: [if], data = [none]
Map<String, String> settingPresets = new HashMap<String, String>();
CmsEditorContext context = getEditorContext();
I_CmsDropContainer dropContainer = element.getParentTarget();
if (dropContainer instanceof CmsContainerPageContainer) {
CmsContainerPageContainer container = (CmsContainerPageContainer)dropContainer;
settingPresets.putAll(container.getSettingPresets()); // depends on control dependency: [if], data = [none]
}
context.setSettingPresets(settingPresets); // depends on control dependency: [if], data = [none]
boolean allowSettings = m_handler.m_controller.getData().allowSettingsInEditor()
&& !m_handler.m_controller.isEditingDisabled()
&& !serverId.equals(String.valueOf(m_handler.m_controller.getData().getDetailId()));
I_CmsSimpleCallback<Boolean> openEditor = new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean lockedPage) {
CmsContentEditor.getInstance().openFormEditor(
context,
editorLocale,
serverId,
lockedPage.booleanValue() ? getCurrentElementId() : null,
null,
null,
null,
null,
mainLocale,
null,
onClose);
}
};
if (allowSettings) {
if (m_handler.m_controller.getData().getDetailContainerPage() != null) {
CmsCoreProvider.get().lock(
m_handler.m_controller.getData().getDetailContainerPage(),
m_handler.m_controller.getLoadTime(),
openEditor); // depends on control dependency: [if], data = [none]
} else {
CmsCoreProvider.get().lock(
CmsCoreProvider.get().getStructureId(),
m_handler.m_controller.getLoadTime(),
openEditor); // depends on control dependency: [if], data = [none]
}
} else {
openEditor.execute(Boolean.FALSE); // depends on control dependency: [if], data = [none]
}
}
}
} else {
CmsDebugLog.getInstance().printLine("Editor is already being opened."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void removeByCPDefinitionId(long CPDefinitionId) {
for (CPInstance cpInstance : findByCPDefinitionId(CPDefinitionId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} } | public class class_name {
@Override
public void removeByCPDefinitionId(long CPDefinitionId) {
for (CPInstance cpInstance : findByCPDefinitionId(CPDefinitionId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance); // depends on control dependency: [for], data = [cpInstance]
}
} } |
public class class_name {
private String generateRandomSession() {
final int length = 16;
final SecureRandom r = new SecureRandom();
final StringBuilder sb = new StringBuilder();
while (sb.length() < length) {
sb.append(Integer.toHexString(r.nextInt()));
}
return sb.toString().substring(0, length);
} } | public class class_name {
private String generateRandomSession() {
final int length = 16;
final SecureRandom r = new SecureRandom();
final StringBuilder sb = new StringBuilder();
while (sb.length() < length) {
sb.append(Integer.toHexString(r.nextInt())); // depends on control dependency: [while], data = [none]
}
return sb.toString().substring(0, length);
} } |
public class class_name {
public static void getChars(CharSequence csq, int srcBegin, int srcEnd, char dst[], int dstBegin) {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
((String)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuffer.class) {
((StringBuffer)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csqClass == StringBuilder.class) {
((StringBuilder)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else if (csq instanceof CharArrayAccessible) {
((CharArrayAccessible)csq).getChars(srcBegin, srcEnd, dst, dstBegin);
}
else {
String str = csq.subSequence(srcBegin, srcEnd).toString();
str.getChars(0, str.length(), dst, dstBegin);
}
} } | public class class_name {
public static void getChars(CharSequence csq, int srcBegin, int srcEnd, char dst[], int dstBegin) {
final Class<?> csqClass = csq.getClass();
if (csqClass == String.class) {
((String)csq).getChars(srcBegin, srcEnd, dst, dstBegin); // depends on control dependency: [if], data = [none]
}
else if (csqClass == StringBuffer.class) {
((StringBuffer)csq).getChars(srcBegin, srcEnd, dst, dstBegin); // depends on control dependency: [if], data = [none]
}
else if (csqClass == StringBuilder.class) {
((StringBuilder)csq).getChars(srcBegin, srcEnd, dst, dstBegin); // depends on control dependency: [if], data = [none]
}
else if (csq instanceof CharArrayAccessible) {
((CharArrayAccessible)csq).getChars(srcBegin, srcEnd, dst, dstBegin); // depends on control dependency: [if], data = [none]
}
else {
String str = csq.subSequence(srcBegin, srcEnd).toString();
str.getChars(0, str.length(), dst, dstBegin); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean[] getRegulatoryRegionOverlaps(Variant variant) {
// 0: overlaps any regulatory region type
// 1: overlaps transcription factor binding site
boolean[] overlapsRegulatoryRegion = {false, false};
// Variant type checked in expected order of frequency of occurrence to minimize number of checks
// Most queries will be SNVs - it's worth implementing an special case for them
if (VariantType.SNV.equals(variant.getType())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart());
} else if (VariantType.INDEL.equals(variant.getType()) && StringUtils.isBlank(variant.getReference())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart() - 1, variant.getEnd());
// Short deletions and symbolic variants except breakends
} else if (!VariantType.BREAKEND.equals(variant.getType())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart(), variant.getEnd());
// Breakend "variants" only annotate features overlapping the exact positions
} else {
overlapsRegulatoryRegion = getRegulatoryRegionOverlaps(variant.getChromosome(), Math.max(1, variant.getStart()));
// If already found one overlapping regulatory region there's no need to keep checking
if (overlapsRegulatoryRegion[0]) {
return overlapsRegulatoryRegion;
// Otherwise check the other breakend in case exists
} else {
if (variant.getSv() != null && variant.getSv().getBreakend() != null
&& variant.getSv().getBreakend().getMate() != null) {
return getRegulatoryRegionOverlaps(variant.getSv().getBreakend().getMate().getChromosome(),
Math.max(1, variant.getSv().getBreakend().getMate().getPosition()));
} else {
return overlapsRegulatoryRegion;
}
}
}
// List<RegulatoryFeature> regionList = new ArrayList<>(queryResult.getNumResults());
// for (RegulatoryFeature object : queryResult.getResult()) {
// regionList.add(object);
// }
// return regionList;
} } | public class class_name {
private boolean[] getRegulatoryRegionOverlaps(Variant variant) {
// 0: overlaps any regulatory region type
// 1: overlaps transcription factor binding site
boolean[] overlapsRegulatoryRegion = {false, false};
// Variant type checked in expected order of frequency of occurrence to minimize number of checks
// Most queries will be SNVs - it's worth implementing an special case for them
if (VariantType.SNV.equals(variant.getType())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart()); // depends on control dependency: [if], data = [none]
} else if (VariantType.INDEL.equals(variant.getType()) && StringUtils.isBlank(variant.getReference())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart() - 1, variant.getEnd()); // depends on control dependency: [if], data = [none]
// Short deletions and symbolic variants except breakends
} else if (!VariantType.BREAKEND.equals(variant.getType())) {
return getRegulatoryRegionOverlaps(variant.getChromosome(), variant.getStart(), variant.getEnd()); // depends on control dependency: [if], data = [none]
// Breakend "variants" only annotate features overlapping the exact positions
} else {
overlapsRegulatoryRegion = getRegulatoryRegionOverlaps(variant.getChromosome(), Math.max(1, variant.getStart())); // depends on control dependency: [if], data = [none]
// If already found one overlapping regulatory region there's no need to keep checking
if (overlapsRegulatoryRegion[0]) {
return overlapsRegulatoryRegion; // depends on control dependency: [if], data = [none]
// Otherwise check the other breakend in case exists
} else {
if (variant.getSv() != null && variant.getSv().getBreakend() != null
&& variant.getSv().getBreakend().getMate() != null) {
return getRegulatoryRegionOverlaps(variant.getSv().getBreakend().getMate().getChromosome(),
Math.max(1, variant.getSv().getBreakend().getMate().getPosition())); // depends on control dependency: [if], data = [(variant.getSv()]
} else {
return overlapsRegulatoryRegion; // depends on control dependency: [if], data = [none]
}
}
}
// List<RegulatoryFeature> regionList = new ArrayList<>(queryResult.getNumResults());
// for (RegulatoryFeature object : queryResult.getResult()) {
// regionList.add(object);
// }
// return regionList;
} } |
public class class_name {
protected static List<Repository> createFlattenedRepositories( List<Repository> repositories )
{
if ( repositories != null )
{
List<Repository> flattenedRepositories = new ArrayList<Repository>( repositories.size() );
for ( Repository repo : repositories )
{
// filter inherited repository section from super POM (see MOJO-2042)...
if ( !isCentralRepositoryFromSuperPom( repo ) )
{
flattenedRepositories.add( repo );
}
}
return flattenedRepositories;
}
return repositories;
} } | public class class_name {
protected static List<Repository> createFlattenedRepositories( List<Repository> repositories )
{
if ( repositories != null )
{
List<Repository> flattenedRepositories = new ArrayList<Repository>( repositories.size() );
for ( Repository repo : repositories )
{
// filter inherited repository section from super POM (see MOJO-2042)...
if ( !isCentralRepositoryFromSuperPom( repo ) )
{
flattenedRepositories.add( repo ); // depends on control dependency: [if], data = [none]
}
}
return flattenedRepositories; // depends on control dependency: [if], data = [none]
}
return repositories;
} } |
public class class_name {
public static int ipv4ToInt( final Inet4Address addr )
{
int value = 0;
for( byte chunk : addr.getAddress() )
{
value <<= 8;
value |= chunk & 0xff;
}
return value;
} } | public class class_name {
public static int ipv4ToInt( final Inet4Address addr )
{
int value = 0;
for( byte chunk : addr.getAddress() )
{
value <<= 8; // depends on control dependency: [for], data = [none]
value |= chunk & 0xff; // depends on control dependency: [for], data = [chunk]
}
return value;
} } |
public class class_name {
@Deprecated
protected boolean resolveReplacement(StringBuilder builder, String str, String expr) {
if (environment.containsProperty(expr)) {
builder.append(environment.getProperty(expr, String.class).orElseThrow(() -> new ConfigurationException("Could not resolve placeholder ${" + expr + "} in value: " + str)));
return true;
}
return false;
} } | public class class_name {
@Deprecated
protected boolean resolveReplacement(StringBuilder builder, String str, String expr) {
if (environment.containsProperty(expr)) {
builder.append(environment.getProperty(expr, String.class).orElseThrow(() -> new ConfigurationException("Could not resolve placeholder ${" + expr + "} in value: " + str))); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void setIdentityAttributeOrder(java.util.Collection<String> identityAttributeOrder) {
if (identityAttributeOrder == null) {
this.identityAttributeOrder = null;
return;
}
this.identityAttributeOrder = new java.util.ArrayList<String>(identityAttributeOrder);
} } | public class class_name {
public void setIdentityAttributeOrder(java.util.Collection<String> identityAttributeOrder) {
if (identityAttributeOrder == null) {
this.identityAttributeOrder = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.identityAttributeOrder = new java.util.ArrayList<String>(identityAttributeOrder);
} } |
public class class_name {
public void install(ExistsAction existsAction, boolean rollbackAll, boolean downloadDependencies) throws InstallException {
if (installAssets.isEmpty())
return;
int progress = 50;
int interval1 = installAssets.size() == 0 ? 40 : 40 / installAssets.size();
List<File> filesInstalled = new ArrayList<File>();
ChecksumsManager checksumsManager = new ChecksumsManager();
for (List<InstallAsset> iaList : installAssets) {
int interval2 = iaList.size() == 0 ? interval1 : interval1 / (iaList.size() * 2);
if (!rollbackAll)
filesInstalled = new ArrayList<File>();
Set<String> executableFiles = new HashSet<String>();
Map<String, Set<String>> extattrFilesMap = new HashMap<String, Set<String>>();
for (InstallAsset installAsset : iaList) {
progress += interval2;
try {
download(progress, installAsset);
} catch (InstallException e) {
InstallUtils.delete(filesInstalled);
installAsset.cleanup();
throw e;
}
try {
fireInstallProgressEvent(progress, installAsset);
} catch (CancelException e) {
InstallUtils.delete(filesInstalled);
installAsset.cleanup();
throw e;
}
progress += interval2;
try {
engine.install(installAsset, filesInstalled, getFeaturesToBeInstalled(), existsAction, executableFiles, extattrFilesMap, downloadDependencies,
getResolveDirector().getProxy(),
checksumsManager);
if (installAsset.isFeature() || installAsset.isAddon()) {
ESAAsset esaa = ((ESAAsset) installAsset);
if (esaa.isPublic()) {
log(Level.FINE, installAsset.installedLogMsg());
}
} else {
log(Level.FINE, installAsset.installedLogMsg());
}
} catch (InstallException e) {
log(Level.SEVERE, e.getMessage(), e);
throw e;
} catch (IOException e) {
throw ExceptionUtils.create(e);
} finally {
installAsset.cleanup();
}
}
try {
InstallPlatformUtils.setExecutePermissionAccordingToUmask(executableFiles.toArray(new String[executableFiles.size()]));
} catch (Exception e) {
log(Level.WARNING, e.getMessage());
if (null != e.getCause()) {
log(Level.SEVERE, null, e);
}
log(Level.WARNING, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_UNABLE_TO_SET_EXECUTE_PERMISSIONS", executableFiles.toString()));
}
try {
InstallPlatformUtils.setExtendedAttributes(extattrFilesMap);
} catch (Exception e) {
log(Level.WARNING, e.getMessage());
if (null != e.getCause()) {
log(Level.SEVERE, null, e);
}
for (Map.Entry<String, Set<String>> entry : extattrFilesMap.entrySet()) {
String attr = entry.getKey();
log(Level.WARNING, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_UNABLE_TO_SET_EXT_ATTR", attr, entry.getValue().toString()));
}
}
checkSetScriptsPermission(filesInstalled);
}
checksumsManager.updateChecksums();
} } | public class class_name {
public void install(ExistsAction existsAction, boolean rollbackAll, boolean downloadDependencies) throws InstallException {
if (installAssets.isEmpty())
return;
int progress = 50;
int interval1 = installAssets.size() == 0 ? 40 : 40 / installAssets.size();
List<File> filesInstalled = new ArrayList<File>();
ChecksumsManager checksumsManager = new ChecksumsManager();
for (List<InstallAsset> iaList : installAssets) {
int interval2 = iaList.size() == 0 ? interval1 : interval1 / (iaList.size() * 2);
if (!rollbackAll)
filesInstalled = new ArrayList<File>();
Set<String> executableFiles = new HashSet<String>();
Map<String, Set<String>> extattrFilesMap = new HashMap<String, Set<String>>();
for (InstallAsset installAsset : iaList) {
progress += interval2; // depends on control dependency: [for], data = [none]
try {
download(progress, installAsset); // depends on control dependency: [try], data = [none]
} catch (InstallException e) {
InstallUtils.delete(filesInstalled);
installAsset.cleanup();
throw e;
} // depends on control dependency: [catch], data = [none]
try {
fireInstallProgressEvent(progress, installAsset); // depends on control dependency: [try], data = [none]
} catch (CancelException e) {
InstallUtils.delete(filesInstalled);
installAsset.cleanup();
throw e;
} // depends on control dependency: [catch], data = [none]
progress += interval2; // depends on control dependency: [for], data = [none]
try {
engine.install(installAsset, filesInstalled, getFeaturesToBeInstalled(), existsAction, executableFiles, extattrFilesMap, downloadDependencies,
getResolveDirector().getProxy(),
checksumsManager); // depends on control dependency: [try], data = [none]
if (installAsset.isFeature() || installAsset.isAddon()) {
ESAAsset esaa = ((ESAAsset) installAsset);
if (esaa.isPublic()) {
log(Level.FINE, installAsset.installedLogMsg()); // depends on control dependency: [if], data = [none]
}
} else {
log(Level.FINE, installAsset.installedLogMsg()); // depends on control dependency: [if], data = [none]
}
} catch (InstallException e) {
log(Level.SEVERE, e.getMessage(), e);
throw e;
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw ExceptionUtils.create(e);
} finally { // depends on control dependency: [catch], data = [none]
installAsset.cleanup();
}
}
try {
InstallPlatformUtils.setExecutePermissionAccordingToUmask(executableFiles.toArray(new String[executableFiles.size()])); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log(Level.WARNING, e.getMessage());
if (null != e.getCause()) {
log(Level.SEVERE, null, e); // depends on control dependency: [if], data = [none]
}
log(Level.WARNING, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_UNABLE_TO_SET_EXECUTE_PERMISSIONS", executableFiles.toString()));
} // depends on control dependency: [catch], data = [none]
try {
InstallPlatformUtils.setExtendedAttributes(extattrFilesMap); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log(Level.WARNING, e.getMessage());
if (null != e.getCause()) {
log(Level.SEVERE, null, e); // depends on control dependency: [if], data = [none]
}
for (Map.Entry<String, Set<String>> entry : extattrFilesMap.entrySet()) {
String attr = entry.getKey();
log(Level.WARNING, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_UNABLE_TO_SET_EXT_ATTR", attr, entry.getValue().toString())); // depends on control dependency: [for], data = [entry]
}
} // depends on control dependency: [catch], data = [none]
checkSetScriptsPermission(filesInstalled);
}
checksumsManager.updateChecksums();
} } |
public class class_name {
protected void doPublishEvent(final ApplicationEvent e) {
if (applicationEventPublisher != null) {
LOGGER.trace("Publishing [{}]", e);
this.applicationEventPublisher.publishEvent(e);
}
} } | public class class_name {
protected void doPublishEvent(final ApplicationEvent e) {
if (applicationEventPublisher != null) {
LOGGER.trace("Publishing [{}]", e);
this.applicationEventPublisher.publishEvent(e); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) {
int retryCount = 0;
while (true) {
try {
return callable.call();
} catch (Exception e) {
retryCount++;
if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) {
throw ExceptionUtil.rethrow(e);
}
long waitIntervalMs = backoffIntervalForRetry(retryCount);
LOGGER.warning(
String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...",
retryCount, waitIntervalMs / MS_IN_SECOND));
sleep(waitIntervalMs);
}
}
} } | public class class_name {
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) {
int retryCount = 0;
while (true) {
try {
return callable.call(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
retryCount++;
if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) {
throw ExceptionUtil.rethrow(e);
}
long waitIntervalMs = backoffIntervalForRetry(retryCount);
LOGGER.warning(
String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...",
retryCount, waitIntervalMs / MS_IN_SECOND));
sleep(waitIntervalMs);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public final void put(final String key, final String value) {
final Property prop = find(key);
if (prop == null) {
props.add(new Property(key, null, value));
} else {
prop.setValue(value);
}
} } | public class class_name {
public final void put(final String key, final String value) {
final Property prop = find(key);
if (prop == null) {
props.add(new Property(key, null, value));
// depends on control dependency: [if], data = [none]
} else {
prop.setValue(value);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setSelected( VariableIF v ) {
if (v == null) { return; }
// construct chain of variables
final List<VariableIF> vchain = new ArrayList<>();
vchain.add( v);
VariableIF vp = v;
while (vp.isMemberOfStructure()) {
vp = vp.getParentStructure();
vchain.add( 0, vp); // reverse
}
// construct chain of groups
final List<Group> gchain = new ArrayList<>();
Group gp = vp.getParentGroup();
gchain.add( gp);
while (gp.getParentGroup() != null) {
gp = gp.getParentGroup();
gchain.add( 0, gp); // reverse
}
final List<Object> pathList = new ArrayList<>();
// start at root, work down through the nested groups, if any
GroupNode gnode = (GroupNode) model.getRoot();
pathList.add( gnode);
Group parentGroup = gchain.get(0); // always the root group
for (int i=1; i < gchain.size(); i++) {
parentGroup = gchain.get(i);
gnode = gnode.findNestedGroup( parentGroup);
assert gnode != null;
pathList.add( gnode);
}
vp = vchain.get(0);
VariableNode vnode = gnode.findNestedVariable( vp);
if (vnode == null) { return; } // not found
pathList.add( vnode);
// now work down through the structure members, if any
for (int i=1; i < vchain.size(); i++) {
vp = vchain.get(i);
vnode = vnode.findNestedVariable( vp);
if (vnode == null) { return; } // not found
pathList.add(vnode);
}
// convert to TreePath, and select it
final Object[] paths = pathList.toArray();
final TreePath treePath = new TreePath(paths);
tree.setSelectionPath( treePath);
tree.scrollPathToVisible( treePath);
} } | public class class_name {
public void setSelected( VariableIF v ) {
if (v == null) { return; }
// depends on control dependency: [if], data = [none]
// construct chain of variables
final List<VariableIF> vchain = new ArrayList<>();
vchain.add( v);
VariableIF vp = v;
while (vp.isMemberOfStructure()) {
vp = vp.getParentStructure();
// depends on control dependency: [while], data = [none]
vchain.add( 0, vp); // reverse
// depends on control dependency: [while], data = [none]
}
// construct chain of groups
final List<Group> gchain = new ArrayList<>();
Group gp = vp.getParentGroup();
gchain.add( gp);
while (gp.getParentGroup() != null) {
gp = gp.getParentGroup();
// depends on control dependency: [while], data = [none]
gchain.add( 0, gp); // reverse
// depends on control dependency: [while], data = [none]
}
final List<Object> pathList = new ArrayList<>();
// start at root, work down through the nested groups, if any
GroupNode gnode = (GroupNode) model.getRoot();
pathList.add( gnode);
Group parentGroup = gchain.get(0); // always the root group
for (int i=1; i < gchain.size(); i++) {
parentGroup = gchain.get(i);
// depends on control dependency: [for], data = [i]
gnode = gnode.findNestedGroup( parentGroup);
// depends on control dependency: [for], data = [none]
assert gnode != null;
pathList.add( gnode);
// depends on control dependency: [for], data = [none]
}
vp = vchain.get(0);
VariableNode vnode = gnode.findNestedVariable( vp);
if (vnode == null) { return; } // not found
// depends on control dependency: [if], data = [none]
pathList.add( vnode);
// now work down through the structure members, if any
for (int i=1; i < vchain.size(); i++) {
vp = vchain.get(i);
// depends on control dependency: [for], data = [i]
vnode = vnode.findNestedVariable( vp);
// depends on control dependency: [for], data = [none]
if (vnode == null) { return; } // not found
// depends on control dependency: [if], data = [none]
pathList.add(vnode);
// depends on control dependency: [for], data = [none]
}
// convert to TreePath, and select it
final Object[] paths = pathList.toArray();
final TreePath treePath = new TreePath(paths);
tree.setSelectionPath( treePath);
tree.scrollPathToVisible( treePath);
} } |
public class class_name {
@Override
public EClass getIfcBurner() {
if (ifcBurnerEClass == null) {
ifcBurnerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(66);
}
return ifcBurnerEClass;
} } | public class class_name {
@Override
public EClass getIfcBurner() {
if (ifcBurnerEClass == null) {
ifcBurnerEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(66);
// depends on control dependency: [if], data = [none]
}
return ifcBurnerEClass;
} } |
public class class_name {
protected void buildFieldList(final String field, final List<String> fieldList) {
if(Utils.isEmpty(field)) {
return;
}
if(!fieldList.contains(field)) {
fieldList.add(field);
}
String plainField = String.valueOf(field);
int keyIndex = plainField.lastIndexOf('[');
while(keyIndex >= 0) {
int endKeyIndex = plainField.indexOf(']', keyIndex);
if(endKeyIndex >= 0) {
plainField = plainField.substring(0, keyIndex) + plainField.substring(endKeyIndex + 1);
if(!fieldList.contains(plainField)) {
fieldList.add(plainField);
}
keyIndex = plainField.lastIndexOf('[');
} else {
keyIndex = -1;
}
}
} } | public class class_name {
protected void buildFieldList(final String field, final List<String> fieldList) {
if(Utils.isEmpty(field)) {
return;
// depends on control dependency: [if], data = [none]
}
if(!fieldList.contains(field)) {
fieldList.add(field);
// depends on control dependency: [if], data = [none]
}
String plainField = String.valueOf(field);
int keyIndex = plainField.lastIndexOf('[');
while(keyIndex >= 0) {
int endKeyIndex = plainField.indexOf(']', keyIndex);
if(endKeyIndex >= 0) {
plainField = plainField.substring(0, keyIndex) + plainField.substring(endKeyIndex + 1);
// depends on control dependency: [if], data = [(endKeyIndex]
if(!fieldList.contains(plainField)) {
fieldList.add(plainField);
// depends on control dependency: [if], data = [none]
}
keyIndex = plainField.lastIndexOf('[');
// depends on control dependency: [if], data = [none]
} else {
keyIndex = -1;
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static public Object getByEquality(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
Object targetKey = array[i];
if (targetKey == null)
{
return null;
}
else if (targetKey.equals(key))
{
return array[i + 1];
}
}
}
return null;
} } | public class class_name {
static public Object getByEquality(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
Object targetKey = array[i];
if (targetKey == null)
{
return null; // depends on control dependency: [if], data = [none]
}
else if (targetKey.equals(key))
{
return array[i + 1]; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
@Override
public Builder claimFrom(String jsonOrJwt, String claim) throws InvalidClaimException, InvalidTokenException {
if (JwtUtils.isNullEmpty(claim)) {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_ERR", new Object[] { claim });
throw new InvalidClaimException(err);
}
if (isValidToken(jsonOrJwt)) {
String decoded = jsonOrJwt;
if (JwtUtils.isBase64Encoded(jsonOrJwt)) {
decoded = JwtUtils.decodeFromBase64String(jsonOrJwt);
}
boolean isJson = JwtUtils.isJson(decoded);
if (!isJson) {
String jwtPayload = JwtUtils.getPayload(jsonOrJwt);
decoded = JwtUtils.decodeFromBase64String(jwtPayload);
}
// } else {
// // either decoded payload from jwt or encoded/decoded json string
// if (JwtUtils.isBase64Encoded(jsonOrJwt)) {
// decoded = JwtUtils.decodeFromBase64String(jsonOrJwt);
// }
// }
if (decoded != null) {
Object claimValue = null;
try {
if ((claimValue = JwtUtils.claimFromJsonObject(decoded, claim)) != null) {
claims.put(claim, claimValue);
}
} catch (JoseException e) {
String err = Tr.formatMessage(tc, "JWT_INVALID_TOKEN_ERR");
throw new InvalidTokenException(err);
}
}
}
return this;
} } | public class class_name {
@Override
public Builder claimFrom(String jsonOrJwt, String claim) throws InvalidClaimException, InvalidTokenException {
if (JwtUtils.isNullEmpty(claim)) {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_ERR", new Object[] { claim });
throw new InvalidClaimException(err);
}
if (isValidToken(jsonOrJwt)) {
String decoded = jsonOrJwt;
if (JwtUtils.isBase64Encoded(jsonOrJwt)) {
decoded = JwtUtils.decodeFromBase64String(jsonOrJwt); // depends on control dependency: [if], data = [none]
}
boolean isJson = JwtUtils.isJson(decoded);
if (!isJson) {
String jwtPayload = JwtUtils.getPayload(jsonOrJwt);
decoded = JwtUtils.decodeFromBase64String(jwtPayload); // depends on control dependency: [if], data = [none]
}
// } else {
// // either decoded payload from jwt or encoded/decoded json string
// if (JwtUtils.isBase64Encoded(jsonOrJwt)) {
// decoded = JwtUtils.decodeFromBase64String(jsonOrJwt);
// }
// }
if (decoded != null) {
Object claimValue = null;
try {
if ((claimValue = JwtUtils.claimFromJsonObject(decoded, claim)) != null) {
claims.put(claim, claimValue); // depends on control dependency: [if], data = [none]
}
} catch (JoseException e) {
String err = Tr.formatMessage(tc, "JWT_INVALID_TOKEN_ERR");
throw new InvalidTokenException(err);
} // depends on control dependency: [catch], data = [none]
}
}
return this;
} } |
public class class_name {
private static long periodEnd(long now, long period, QDate cal)
{
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
int month = cal.getMonth();
cal.setLocalTime(0);
cal.setDate(year, month + months, 1);
return cal.getGMTTime();
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
cal.setGMTTime(now);
long year = cal.getYear();
cal.setLocalTime(0);
long newYear = year + (years - year % years);
cal.setDate(newYear, 0, 1);
return cal.getGMTTime();
}
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
} } | public class class_name {
private static long periodEnd(long now, long period, QDate cal)
{
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
cal.setGMTTime(now); // depends on control dependency: [if], data = [none]
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period); // depends on control dependency: [if], data = [(period]
cal.setLocalTime(localTime); // depends on control dependency: [if], data = [none]
return cal.getGMTTime(); // depends on control dependency: [if], data = [none]
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
cal.setGMTTime(now); // depends on control dependency: [if], data = [none]
long year = cal.getYear();
int month = cal.getMonth();
cal.setLocalTime(0); // depends on control dependency: [if], data = [0)]
cal.setDate(year, month + months, 1); // depends on control dependency: [if], data = [none]
return cal.getGMTTime(); // depends on control dependency: [if], data = [none]
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
cal.setGMTTime(now); // depends on control dependency: [if], data = [none]
long year = cal.getYear();
cal.setLocalTime(0); // depends on control dependency: [if], data = [0)]
long newYear = year + (years - year % years);
cal.setDate(newYear, 0, 1); // depends on control dependency: [if], data = [none]
return cal.getGMTTime(); // depends on control dependency: [if], data = [none]
}
cal.setGMTTime(now);
long localTime = cal.getLocalTime();
localTime = localTime + (period - (localTime + 4 * DAY) % period);
cal.setLocalTime(localTime);
return cal.getGMTTime();
} } |
public class class_name {
protected List<VideoProfile> getVideoProfiles() {
List<VideoProfile> profiles = new ArrayList<VideoProfile>();
for (String profileName : getVideoProfileNames()) {
VideoProfile profile = VideoProfile.get(resourceResolver, profileName);
if (profile != null) {
profiles.add(profile);
}
else {
log.warn("DAM video profile with name '{}' does not exist.", profileName);
}
}
return profiles;
} } | public class class_name {
protected List<VideoProfile> getVideoProfiles() {
List<VideoProfile> profiles = new ArrayList<VideoProfile>();
for (String profileName : getVideoProfileNames()) {
VideoProfile profile = VideoProfile.get(resourceResolver, profileName);
if (profile != null) {
profiles.add(profile); // depends on control dependency: [if], data = [(profile]
}
else {
log.warn("DAM video profile with name '{}' does not exist.", profileName); // depends on control dependency: [if], data = [none]
}
}
return profiles;
} } |
public class class_name {
public synchronized void rem_obj_polling(final String[] argin, final boolean with_db_upd)
throws DevFailed {
Util.out4.println("In rem_obj_polling command");
for (final String arg : argin) {
Util.out4.println("Input string = " + arg);
}
// Check that parameters number is correct
if (argin.length != 3) {
Except.throw_exception("API_WrongNumberOfArgs", "Incorrect number of inout arguments",
"DServer.rem_obj_polling");
}
// Find the device
final Util tg = Util.instance();
DeviceImpl dev = null;
try {
dev = tg.get_device_by_name(argin[0]);
} catch (final DevFailed e) {
Except.re_throw_exception(e, "API_DeviceNotFound", "Device " + argin + " not found",
"DServer.rem_obj_polling");
}
// Check that the device is polled
assert dev != null;
if (dev.is_polled() == false) {
Except.throw_exception("API_DeviceNotPolled", "Device " + argin[0] + " is not polled",
"DServer.rem_obj_polling_period");
}
// Find the wanted object in the list of device polled object
final String obj_type = argin[1].toLowerCase();
final String obj_name = argin[2].toLowerCase();
int type = Tango_POLL_CMD;
if (obj_type.equals(Tango_PollCommand)) {
type = Tango_POLL_CMD;
} else if (obj_type.equals(Tango_PollAttribute)) {
type = Tango_POLL_ATTR;
} else {
Except.throw_exception("API_NotSupported",
"Object type " + obj_type + " not supported", "DServer.rem_obj_polling_period");
}
final Vector poll_list = dev.get_poll_obj_list();
for (int i = 0; i < poll_list.size(); i++) {
final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
if (poll_obj.get_type() == type) {
if (poll_obj.get_name().equals(obj_name)) {
poll_list.remove(i);
}
}
}
Util.out4.println("Sending cmd to polling thread");
final TangoMonitor mon = tg.get_poll_monitor();
final PollThCmd shared_cmd = tg.get_poll_shared_cmd();
if (shared_cmd.cmd_pending == true) {
mon.signal();
}
shared_cmd.cmd_pending = true;
shared_cmd.cmd_code = Tango_POLL_REM_OBJ;
shared_cmd.dev = dev;
shared_cmd.name = obj_name;
shared_cmd.type = type;
mon.signal();
Util.out4.println("Cmd sent to polling thread");
// Wait for thread to execute command
boolean interrupted;
while (shared_cmd.cmd_pending == true) {
interrupted = mon.wait_it(Tango_DEFAULT_TIMEOUT);
if (shared_cmd.cmd_pending == true && interrupted == false) {
// Util.out4
System.out.println("TIME OUT");
Except.throw_exception("API_CommandTimedOut", "Polling thread blocked !!!",
"DServer.rem_obj_polling");
}
}
Util.out4.println("Thread cmd normally executed");
// Mark the device as non polled if this was the last polled object
if (poll_list.size() == 0) {
dev.is_polled(false);
}
// Update database property. This means remove object entry in the
// polling
// properties if they exist or add it to the list of device not polled
// for automatic polling defined at command/attribute level.
// Do this if possible and wanted.
if (with_db_upd && Util._UseDb) {
final DbDatum db_info = new DbDatum("polled_attr");
boolean update_needed = false;
if (type == Tango_POLL_CMD) {
db_info.name = "polled_cmd";
final Vector cmd_list = dev.get_polled_cmd();
int i;
for (i = 0; i < cmd_list.size(); i++) {
final String s = (String) cmd_list.elementAt(i);
if (s.equals(obj_name)) {
cmd_list.remove(i);
cmd_list.remove(i);
db_info.insert(stringVect2StringArray(cmd_list));
update_needed = true;
break;
}
i++;
}
if (update_needed == false) {
final Vector non_auto_cmd = dev.get_non_auto_polled_cmd();
for (i = 0; i < non_auto_cmd.size(); i++) {
final String s = (String) non_auto_cmd.elementAt(i);
if (s.equals(obj_name)) {
break;
}
}
if (i == cmd_list.size()) {
non_auto_cmd.add(obj_name);
db_info.name = "non_auto_polled_cmd";
db_info.insert(stringVect2StringArray(non_auto_cmd));
update_needed = true;
}
}
} else {
final Vector attr_list = dev.get_polled_attr();
int i;
for (i = 0; i < attr_list.size(); i++) {
final String s = (String) attr_list.elementAt(i);
if (s.equals(obj_name)) {
attr_list.remove(i);
attr_list.remove(i);
db_info.insert(stringVect2StringArray(attr_list));
update_needed = true;
break;
}
i++;
}
if (update_needed == false) {
final Vector non_auto_attr = dev.get_non_auto_polled_attr();
for (i = 0; i < non_auto_attr.size(); i++) {
final String s = (String) non_auto_attr.elementAt(i);
if (s.equals(obj_name)) {
break;
}
}
if (i == attr_list.size()) {
non_auto_attr.add(obj_name);
db_info.name = "non_auto_polled_cmd";
db_info.insert(stringVect2StringArray(non_auto_attr));
update_needed = true;
}
}
}
if (update_needed == true) {
final DbDatum[] send_data = new DbDatum[1];
send_data[0] = db_info;
dev.get_db_device().put_property(send_data);
Util.out4.println("Polling properties updated");
}
}
} } | public class class_name {
public synchronized void rem_obj_polling(final String[] argin, final boolean with_db_upd)
throws DevFailed {
Util.out4.println("In rem_obj_polling command");
for (final String arg : argin) {
Util.out4.println("Input string = " + arg);
}
// Check that parameters number is correct
if (argin.length != 3) {
Except.throw_exception("API_WrongNumberOfArgs", "Incorrect number of inout arguments",
"DServer.rem_obj_polling");
}
// Find the device
final Util tg = Util.instance();
DeviceImpl dev = null;
try {
dev = tg.get_device_by_name(argin[0]);
} catch (final DevFailed e) {
Except.re_throw_exception(e, "API_DeviceNotFound", "Device " + argin + " not found",
"DServer.rem_obj_polling");
}
// Check that the device is polled
assert dev != null;
if (dev.is_polled() == false) {
Except.throw_exception("API_DeviceNotPolled", "Device " + argin[0] + " is not polled",
"DServer.rem_obj_polling_period");
}
// Find the wanted object in the list of device polled object
final String obj_type = argin[1].toLowerCase();
final String obj_name = argin[2].toLowerCase();
int type = Tango_POLL_CMD;
if (obj_type.equals(Tango_PollCommand)) {
type = Tango_POLL_CMD;
} else if (obj_type.equals(Tango_PollAttribute)) {
type = Tango_POLL_ATTR;
} else {
Except.throw_exception("API_NotSupported",
"Object type " + obj_type + " not supported", "DServer.rem_obj_polling_period");
}
final Vector poll_list = dev.get_poll_obj_list();
for (int i = 0; i < poll_list.size(); i++) {
final PollObj poll_obj = (PollObj) poll_list.elementAt(i);
if (poll_obj.get_type() == type) {
if (poll_obj.get_name().equals(obj_name)) {
poll_list.remove(i); // depends on control dependency: [if], data = [none]
}
}
}
Util.out4.println("Sending cmd to polling thread");
final TangoMonitor mon = tg.get_poll_monitor();
final PollThCmd shared_cmd = tg.get_poll_shared_cmd();
if (shared_cmd.cmd_pending == true) {
mon.signal();
}
shared_cmd.cmd_pending = true;
shared_cmd.cmd_code = Tango_POLL_REM_OBJ;
shared_cmd.dev = dev;
shared_cmd.name = obj_name;
shared_cmd.type = type;
mon.signal();
Util.out4.println("Cmd sent to polling thread");
// Wait for thread to execute command
boolean interrupted;
while (shared_cmd.cmd_pending == true) {
interrupted = mon.wait_it(Tango_DEFAULT_TIMEOUT);
if (shared_cmd.cmd_pending == true && interrupted == false) {
// Util.out4
System.out.println("TIME OUT");
Except.throw_exception("API_CommandTimedOut", "Polling thread blocked !!!",
"DServer.rem_obj_polling");
}
}
Util.out4.println("Thread cmd normally executed");
// Mark the device as non polled if this was the last polled object
if (poll_list.size() == 0) {
dev.is_polled(false);
}
// Update database property. This means remove object entry in the
// polling
// properties if they exist or add it to the list of device not polled
// for automatic polling defined at command/attribute level.
// Do this if possible and wanted.
if (with_db_upd && Util._UseDb) {
final DbDatum db_info = new DbDatum("polled_attr");
boolean update_needed = false;
if (type == Tango_POLL_CMD) {
db_info.name = "polled_cmd";
final Vector cmd_list = dev.get_polled_cmd();
int i;
for (i = 0; i < cmd_list.size(); i++) {
final String s = (String) cmd_list.elementAt(i);
if (s.equals(obj_name)) {
cmd_list.remove(i);
cmd_list.remove(i);
db_info.insert(stringVect2StringArray(cmd_list));
update_needed = true;
break;
}
i++;
}
if (update_needed == false) {
final Vector non_auto_cmd = dev.get_non_auto_polled_cmd();
for (i = 0; i < non_auto_cmd.size(); i++) {
final String s = (String) non_auto_cmd.elementAt(i);
if (s.equals(obj_name)) {
break;
}
}
if (i == cmd_list.size()) {
non_auto_cmd.add(obj_name);
db_info.name = "non_auto_polled_cmd";
db_info.insert(stringVect2StringArray(non_auto_cmd));
update_needed = true;
}
}
} else {
final Vector attr_list = dev.get_polled_attr();
int i;
for (i = 0; i < attr_list.size(); i++) {
final String s = (String) attr_list.elementAt(i);
if (s.equals(obj_name)) {
attr_list.remove(i);
attr_list.remove(i);
db_info.insert(stringVect2StringArray(attr_list));
update_needed = true;
break;
}
i++;
}
if (update_needed == false) {
final Vector non_auto_attr = dev.get_non_auto_polled_attr();
for (i = 0; i < non_auto_attr.size(); i++) {
final String s = (String) non_auto_attr.elementAt(i);
if (s.equals(obj_name)) {
break;
}
}
if (i == attr_list.size()) {
non_auto_attr.add(obj_name);
db_info.name = "non_auto_polled_cmd";
db_info.insert(stringVect2StringArray(non_auto_attr));
update_needed = true;
}
}
}
if (update_needed == true) {
final DbDatum[] send_data = new DbDatum[1];
send_data[0] = db_info;
dev.get_db_device().put_property(send_data);
Util.out4.println("Polling properties updated");
}
}
} } |
public class class_name {
private boolean addHisoricalRecord(HistoricalRecord historicalRecord) {
synchronized (mInstanceLock) {
final boolean added = mHistoricalRecords.add(historicalRecord);
if (added) {
mHistoricalRecordsChanged = true;
pruneExcessiveHistoricalRecordsLocked();
persistHistoricalData();
sortActivities();
}
return added;
}
} } | public class class_name {
private boolean addHisoricalRecord(HistoricalRecord historicalRecord) {
synchronized (mInstanceLock) {
final boolean added = mHistoricalRecords.add(historicalRecord);
if (added) {
mHistoricalRecordsChanged = true; // depends on control dependency: [if], data = [none]
pruneExcessiveHistoricalRecordsLocked(); // depends on control dependency: [if], data = [none]
persistHistoricalData(); // depends on control dependency: [if], data = [none]
sortActivities(); // depends on control dependency: [if], data = [none]
}
return added;
}
} } |
public class class_name {
public static void symmetricIntersection(DBIDs first, DBIDs second, HashSetModifiableDBIDs firstonly, HashSetModifiableDBIDs intersection, HashSetModifiableDBIDs secondonly) {
if(first.size() > second.size()) {
symmetricIntersection(second, first, secondonly, intersection, firstonly);
return;
}
assert (firstonly.size() == 0) : "OUTPUT set should be empty!";
assert (intersection.size() == 0) : "OUTPUT set should be empty!";
assert (secondonly.size() == 0) : "OUTPUT set should be empty!";
// Initialize with second
secondonly.addDBIDs(second);
for(DBIDIter it = first.iter(); it.valid(); it.advance()) {
// Try to remove
(secondonly.remove(it) ? intersection : firstonly).add(it);
}
} } | public class class_name {
public static void symmetricIntersection(DBIDs first, DBIDs second, HashSetModifiableDBIDs firstonly, HashSetModifiableDBIDs intersection, HashSetModifiableDBIDs secondonly) {
if(first.size() > second.size()) {
symmetricIntersection(second, first, secondonly, intersection, firstonly); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
assert (firstonly.size() == 0) : "OUTPUT set should be empty!";
assert (intersection.size() == 0) : "OUTPUT set should be empty!";
assert (secondonly.size() == 0) : "OUTPUT set should be empty!";
// Initialize with second
secondonly.addDBIDs(second);
for(DBIDIter it = first.iter(); it.valid(); it.advance()) {
// Try to remove
(secondonly.remove(it) ? intersection : firstonly).add(it); // depends on control dependency: [for], data = [it]
}
} } |
public class class_name {
static private int getOrcAtomicRowColumnId() {
try {
Field rowField = OrcRecordUpdater.class.getDeclaredField("ROW");
rowField.setAccessible(true);
int rowId = (int) rowField.get(null);
rowField.setAccessible(false);
return rowId;
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Could not obtain OrcRecordUpdater.ROW value.", e);
}
} } | public class class_name {
static private int getOrcAtomicRowColumnId() {
try {
Field rowField = OrcRecordUpdater.class.getDeclaredField("ROW");
rowField.setAccessible(true); // depends on control dependency: [try], data = [none]
int rowId = (int) rowField.get(null);
rowField.setAccessible(false); // depends on control dependency: [try], data = [none]
return rowId; // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Could not obtain OrcRecordUpdater.ROW value.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static final CmsProperty get(String name, List<CmsProperty> list) {
CmsProperty property = null;
name = name.trim();
// choose the fastest method to traverse the list
if (list instanceof RandomAccess) {
for (int i = 0, n = list.size(); i < n; i++) {
property = list.get(i);
if (property.m_name.equals(name)) {
return property;
}
}
} else {
Iterator<CmsProperty> i = list.iterator();
while (i.hasNext()) {
property = i.next();
if (property.m_name.equals(name)) {
return property;
}
}
}
return NULL_PROPERTY;
} } | public class class_name {
public static final CmsProperty get(String name, List<CmsProperty> list) {
CmsProperty property = null;
name = name.trim();
// choose the fastest method to traverse the list
if (list instanceof RandomAccess) {
for (int i = 0, n = list.size(); i < n; i++) {
property = list.get(i); // depends on control dependency: [for], data = [i]
if (property.m_name.equals(name)) {
return property; // depends on control dependency: [if], data = [none]
}
}
} else {
Iterator<CmsProperty> i = list.iterator();
while (i.hasNext()) {
property = i.next(); // depends on control dependency: [while], data = [none]
if (property.m_name.equals(name)) {
return property; // depends on control dependency: [if], data = [none]
}
}
}
return NULL_PROPERTY;
} } |
public class class_name {
public void generateTableTabTypesScript(Map<String,Integer> typeMap,
Set<? extends TableTabTypes> tabTypes, String elementName) {
String sep = "";
StringBuilder vars = new StringBuilder("var ");
vars.append(elementName)
.append(" = {");
for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
vars.append(sep);
sep = ",";
vars.append("\"")
.append(entry.getKey())
.append("\":")
.append(entry.getValue());
}
vars.append("};").append(DocletConstants.NL);
sep = "";
vars.append("var tabs = {");
for (TableTabTypes entry : tabTypes) {
vars.append(sep);
sep = ",";
vars.append(entry.tableTabs().value())
.append(":")
.append("[")
.append("\"")
.append(entry.tableTabs().tabId())
.append("\"")
.append(sep)
.append("\"")
.append(configuration.getText(entry.tableTabs().resourceKey()))
.append("\"]");
}
vars.append("};")
.append(DocletConstants.NL);
addStyles(HtmlStyle.altColor, vars);
addStyles(HtmlStyle.rowColor, vars);
addStyles(HtmlStyle.tableTab, vars);
addStyles(HtmlStyle.activeTableTab, vars);
script.addContent(new RawHtml(vars));
} } | public class class_name {
public void generateTableTabTypesScript(Map<String,Integer> typeMap,
Set<? extends TableTabTypes> tabTypes, String elementName) {
String sep = "";
StringBuilder vars = new StringBuilder("var ");
vars.append(elementName)
.append(" = {");
for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
vars.append(sep); // depends on control dependency: [for], data = [none]
sep = ","; // depends on control dependency: [for], data = [none]
vars.append("\"")
.append(entry.getKey())
.append("\":")
.append(entry.getValue()); // depends on control dependency: [for], data = [none]
}
vars.append("};").append(DocletConstants.NL);
sep = "";
vars.append("var tabs = {");
for (TableTabTypes entry : tabTypes) {
vars.append(sep); // depends on control dependency: [for], data = [none]
sep = ","; // depends on control dependency: [for], data = [none]
vars.append(entry.tableTabs().value())
.append(":")
.append("[")
.append("\"")
.append(entry.tableTabs().tabId())
.append("\"")
.append(sep)
.append("\"")
.append(configuration.getText(entry.tableTabs().resourceKey()))
.append("\"]"); // depends on control dependency: [for], data = [entry]
}
vars.append("};")
.append(DocletConstants.NL);
addStyles(HtmlStyle.altColor, vars);
addStyles(HtmlStyle.rowColor, vars);
addStyles(HtmlStyle.tableTab, vars);
addStyles(HtmlStyle.activeTableTab, vars);
script.addContent(new RawHtml(vars));
} } |
public class class_name {
public static int pitch_ol( /* output: open-loop pitch lag */
float signal[],int signals, /* input : signal to compute pitch */
/* s[-PIT_MAX : l_frame-1] */
int pit_min, /* input : minimum pitch lag */
int pit_max, /* input : maximum pitch lag */
int l_frame /* input : error minimization window */
)
{
FloatPointer max1 = new FloatPointer(), max2 =new FloatPointer(), max3 = new FloatPointer();
int p_max1, p_max2, p_max3;
/*--------------------------------------------------------------------*
* The pitch lag search is divided in three sections. *
* Each section cannot have a pitch multiple. *
* We find a maximum for each section. *
* We compare the maxima of each section by favoring small lag. *
* *
* First section: lag delay = PIT_MAX to 80 *
* Second section: lag delay = 79 to 40 *
* Third section: lag delay = 39 to 20 *
*--------------------------------------------------------------------*/
p_max1 = lag_max(signal, signals, l_frame, pit_max, 80 , max1);
p_max2 = lag_max(signal, signals, l_frame, 79 , 40 , max2);
p_max3 = lag_max(signal, signals, l_frame, 39 , pit_min , max3);
/*--------------------------------------------------------------------*
* Compare the 3 sections maxima, and favor small lag. *
*--------------------------------------------------------------------*/
if ( max1.value * LD8KConstants.THRESHPIT < max2.value ) {
max1.value = max2.value;
p_max1 = p_max2;
}
if ( max1.value * LD8KConstants.THRESHPIT < max3.value ) p_max1 = p_max3;
return (p_max1);
} } | public class class_name {
public static int pitch_ol( /* output: open-loop pitch lag */
float signal[],int signals, /* input : signal to compute pitch */
/* s[-PIT_MAX : l_frame-1] */
int pit_min, /* input : minimum pitch lag */
int pit_max, /* input : maximum pitch lag */
int l_frame /* input : error minimization window */
)
{
FloatPointer max1 = new FloatPointer(), max2 =new FloatPointer(), max3 = new FloatPointer();
int p_max1, p_max2, p_max3;
/*--------------------------------------------------------------------*
* The pitch lag search is divided in three sections. *
* Each section cannot have a pitch multiple. *
* We find a maximum for each section. *
* We compare the maxima of each section by favoring small lag. *
* *
* First section: lag delay = PIT_MAX to 80 *
* Second section: lag delay = 79 to 40 *
* Third section: lag delay = 39 to 20 *
*--------------------------------------------------------------------*/
p_max1 = lag_max(signal, signals, l_frame, pit_max, 80 , max1);
p_max2 = lag_max(signal, signals, l_frame, 79 , 40 , max2);
p_max3 = lag_max(signal, signals, l_frame, 39 , pit_min , max3);
/*--------------------------------------------------------------------*
* Compare the 3 sections maxima, and favor small lag. *
*--------------------------------------------------------------------*/
if ( max1.value * LD8KConstants.THRESHPIT < max2.value ) {
max1.value = max2.value; // depends on control dependency: [if], data = [none]
p_max1 = p_max2; // depends on control dependency: [if], data = [none]
}
if ( max1.value * LD8KConstants.THRESHPIT < max3.value ) p_max1 = p_max3;
return (p_max1);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public Map<String,String> getMap(String name) {
Map<String,String> map = null;
Map<String,Object> groupMap = (Map<String,Object>)get(name, PropType.group);
if (groupMap != null) {
map = new HashMap<>();
for (String groupKey : groupMap.keySet()) {
String value = decryptValue(groupMap.get(groupKey).toString());
map.put(groupKey.substring(name.length() + 1), value);
}
}
return map;
} } | public class class_name {
@SuppressWarnings("unchecked")
public Map<String,String> getMap(String name) {
Map<String,String> map = null;
Map<String,Object> groupMap = (Map<String,Object>)get(name, PropType.group);
if (groupMap != null) {
map = new HashMap<>(); // depends on control dependency: [if], data = [none]
for (String groupKey : groupMap.keySet()) {
String value = decryptValue(groupMap.get(groupKey).toString());
map.put(groupKey.substring(name.length() + 1), value); // depends on control dependency: [for], data = [groupKey]
}
}
return map;
} } |
public class class_name {
public CompletableFuture<Integer> getUserSize() {
if (this.localEngine != null && this.sncpNodeAddresses == null) {
return CompletableFuture.completedFuture(this.localEngine.getLocalUserSize());
}
tryAcquireSemaphore();
CompletableFuture<Integer> rs = this.sncpNodeAddresses.queryKeysStartsWithAsync(SOURCE_SNCP_USERID_PREFIX).thenApply(v -> v.size());
if (semaphore != null) rs.whenComplete((r, e) -> releaseSemaphore());
return rs;
} } | public class class_name {
public CompletableFuture<Integer> getUserSize() {
if (this.localEngine != null && this.sncpNodeAddresses == null) {
return CompletableFuture.completedFuture(this.localEngine.getLocalUserSize());
// depends on control dependency: [if], data = [none]
}
tryAcquireSemaphore();
CompletableFuture<Integer> rs = this.sncpNodeAddresses.queryKeysStartsWithAsync(SOURCE_SNCP_USERID_PREFIX).thenApply(v -> v.size());
if (semaphore != null) rs.whenComplete((r, e) -> releaseSemaphore());
return rs;
} } |
public class class_name {
private DataSource lookupDS(InitialContext ctx, String path) {
try {
return (DataSource) ctx.lookup(path);
} catch (NamingException e) {
return null;
}
} } | public class class_name {
private DataSource lookupDS(InitialContext ctx, String path) {
try {
return (DataSource) ctx.lookup(path); // depends on control dependency: [try], data = [none]
} catch (NamingException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
/** {@inheritDoc} */
public <T extends IChemObject> T read(T object) throws CDKException {
final String[] expected_columns = {"NO.", "ATOM", "X", "Y", "Z"};
StringBuffer eigenvalues = new StringBuffer();
if (object instanceof IAtomContainer) {
IAtomContainer container = (IAtomContainer) object;
try {
String line = input.readLine();
while (line != null) {
if (line.indexOf("**** MAX. NUMBER OF ATOMS ALLOWED") > -1) throw new CDKException(line);
if (line.indexOf("TO CONTINUE CALCULATION SPECIFY \"GEO-OK\"") > -1) throw new CDKException(line);
if ("CARTESIAN COORDINATES".equals(line.trim())) {
IAtomContainer atomcontainer = ((IAtomContainer) object);
input.readLine(); //reads blank line
line = input.readLine();
String[] columns = line.trim().split(" +");
int okCols = 0;
if (columns.length == expected_columns.length)
for (int i = 0; i < expected_columns.length; i++)
okCols += (columns[i].equals(expected_columns[i])) ? 1 : 0;
if (okCols < expected_columns.length) continue;
//if (!" NO. ATOM X Y Z".equals(line)) continue;
input.readLine(); //reads blank line
int atomIndex = 0;
while (!line.trim().isEmpty()) {
line = input.readLine();
StringTokenizer tokenizer = new StringTokenizer(line);
int token = 0;
IAtom atom = null;
double[] point3d = new double[3];
while (tokenizer.hasMoreTokens()) {
String tokenStr = tokenizer.nextToken();
switch (token) {
case 0: {
atomIndex = Integer.parseInt(tokenStr) - 1;
if (atomIndex < atomcontainer.getAtomCount()) {
atom = atomcontainer.getAtom(atomIndex);
} else
atom = null;
break;
}
case 1: {
if ((atom != null) && (!tokenStr.equals(atom.getSymbol()))) atom = null;
break;
}
case 2: {
point3d[0] = Double.parseDouble(tokenStr);
break;
}
case 3: {
point3d[1] = Double.parseDouble(tokenStr);
break;
}
case 4: {
point3d[2] = Double.parseDouble(tokenStr);
if (atom != null) atom.setPoint3d(new Point3d(point3d));
break;
}
}
token++;
if (atom == null) break;
}
if ((atom == null) || ((atomIndex + 1) >= atomcontainer.getAtomCount())) break;
}
} else if (line.indexOf(Mopac7Reader.eigenvalues) >= 0) {
line = input.readLine();
line = input.readLine();
while (!line.trim().equals("")) {
eigenvalues.append(line);
line = input.readLine();
}
container.setProperty(Mopac7Reader.eigenvalues, eigenvalues.toString());
} else
for (int i = 0; i < parameters.length; i++)
if (line.indexOf(parameters[i]) >= 0) {
String value = line.substring(line.lastIndexOf('=') + 1).trim();
/*
* v = v.replaceAll("EV",""); v =
* v.replaceAll("KCAL",""); v =
* v.replaceAll("KJ","");
*/
value = value.replaceAll(Mopac7Reader.units[i], "").trim();
int pos = value.indexOf(' ');
if (pos >= 0) value = value.substring(0, pos - 1);
container.setProperty(parameters[i], value.trim());
break;
}
line = input.readLine();
}
calcHomoLumo(container);
return (T) container;
} catch (IOException exception) {
throw new CDKException(exception.getMessage());
}
} else
return null;
} } | public class class_name {
@Override
/** {@inheritDoc} */
public <T extends IChemObject> T read(T object) throws CDKException {
final String[] expected_columns = {"NO.", "ATOM", "X", "Y", "Z"};
StringBuffer eigenvalues = new StringBuffer();
if (object instanceof IAtomContainer) {
IAtomContainer container = (IAtomContainer) object;
try {
String line = input.readLine();
while (line != null) {
if (line.indexOf("**** MAX. NUMBER OF ATOMS ALLOWED") > -1) throw new CDKException(line);
if (line.indexOf("TO CONTINUE CALCULATION SPECIFY \"GEO-OK\"") > -1) throw new CDKException(line);
if ("CARTESIAN COORDINATES".equals(line.trim())) {
IAtomContainer atomcontainer = ((IAtomContainer) object);
input.readLine(); //reads blank line // depends on control dependency: [if], data = [none]
line = input.readLine(); // depends on control dependency: [if], data = [none]
String[] columns = line.trim().split(" +");
int okCols = 0;
if (columns.length == expected_columns.length)
for (int i = 0; i < expected_columns.length; i++)
okCols += (columns[i].equals(expected_columns[i])) ? 1 : 0;
if (okCols < expected_columns.length) continue;
//if (!" NO. ATOM X Y Z".equals(line)) continue;
input.readLine(); //reads blank line // depends on control dependency: [if], data = [none]
int atomIndex = 0;
while (!line.trim().isEmpty()) {
line = input.readLine(); // depends on control dependency: [while], data = [none]
StringTokenizer tokenizer = new StringTokenizer(line);
int token = 0;
IAtom atom = null;
double[] point3d = new double[3];
while (tokenizer.hasMoreTokens()) {
String tokenStr = tokenizer.nextToken();
switch (token) {
case 0: {
atomIndex = Integer.parseInt(tokenStr) - 1;
if (atomIndex < atomcontainer.getAtomCount()) {
atom = atomcontainer.getAtom(atomIndex); // depends on control dependency: [if], data = [(atomIndex]
} else
atom = null;
break;
}
case 1: {
if ((atom != null) && (!tokenStr.equals(atom.getSymbol()))) atom = null;
break;
}
case 2: {
point3d[0] = Double.parseDouble(tokenStr);
break;
}
case 3: {
point3d[1] = Double.parseDouble(tokenStr);
break;
}
case 4: {
point3d[2] = Double.parseDouble(tokenStr);
if (atom != null) atom.setPoint3d(new Point3d(point3d));
break;
}
}
token++; // depends on control dependency: [while], data = [none]
if (atom == null) break;
}
if ((atom == null) || ((atomIndex + 1) >= atomcontainer.getAtomCount())) break;
}
} else if (line.indexOf(Mopac7Reader.eigenvalues) >= 0) {
line = input.readLine(); // depends on control dependency: [if], data = [none]
line = input.readLine(); // depends on control dependency: [if], data = [none]
while (!line.trim().equals("")) {
eigenvalues.append(line); // depends on control dependency: [while], data = [none]
line = input.readLine(); // depends on control dependency: [while], data = [none]
}
container.setProperty(Mopac7Reader.eigenvalues, eigenvalues.toString()); // depends on control dependency: [if], data = [none]
} else
for (int i = 0; i < parameters.length; i++)
if (line.indexOf(parameters[i]) >= 0) {
String value = line.substring(line.lastIndexOf('=') + 1).trim();
/*
* v = v.replaceAll("EV",""); v =
* v.replaceAll("KCAL",""); v =
* v.replaceAll("KJ","");
*/
value = value.replaceAll(Mopac7Reader.units[i], "").trim(); // depends on control dependency: [if], data = [none]
int pos = value.indexOf(' ');
if (pos >= 0) value = value.substring(0, pos - 1);
container.setProperty(parameters[i], value.trim()); // depends on control dependency: [if], data = [none]
break;
}
line = input.readLine(); // depends on control dependency: [while], data = [none]
}
calcHomoLumo(container); // depends on control dependency: [try], data = [none]
return (T) container; // depends on control dependency: [try], data = [none]
} catch (IOException exception) {
throw new CDKException(exception.getMessage());
} // depends on control dependency: [catch], data = [none]
} else
return null;
} } |
public class class_name {
public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean.");
}
String value = getEnvironmentString(name, null);
if (value == null) {
return defaultValue;
}
else {
return BOOLEAN_PATTERN.matcher(value).matches();
}
} } | public class class_name {
public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean.");
}
String value = getEnvironmentString(name, null);
if (value == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
else {
return BOOLEAN_PATTERN.matcher(value).matches(); // depends on control dependency: [if], data = [(value]
}
} } |
public class class_name {
public synchronized int cleanCache(float maxAge) {
// calculate oldest possible date for the cache files
long expireDate = System.currentTimeMillis() - (long)(maxAge * 60.0f * 60.0f * 1000.0f);
File basedir = new File(m_rfsRepository);
// perform the cache cleanup
int count = 0;
if (basedir.canRead() && basedir.isDirectory()) {
File[] files = basedir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
File f = files[i];
if (f.canWrite()) {
if (f.lastModified() < expireDate) {
try {
f.delete();
count++;
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_EXCERPT_CACHE_DELETE_ERROR_1,
f.getAbsolutePath()),
e);
}
}
}
}
}
}
}
return count;
} } | public class class_name {
public synchronized int cleanCache(float maxAge) {
// calculate oldest possible date for the cache files
long expireDate = System.currentTimeMillis() - (long)(maxAge * 60.0f * 60.0f * 1000.0f);
File basedir = new File(m_rfsRepository);
// perform the cache cleanup
int count = 0;
if (basedir.canRead() && basedir.isDirectory()) {
File[] files = basedir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
File f = files[i];
if (f.canWrite()) {
if (f.lastModified() < expireDate) {
try {
f.delete(); // depends on control dependency: [try], data = [none]
count++; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_EXCERPT_CACHE_DELETE_ERROR_1,
f.getAbsolutePath()),
e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
}
}
}
return count;
} } |
public class class_name {
public MapConfig findMapConfig(String name) {
name = getBaseName(name);
MapConfig config = lookupByPattern(configPatternMatcher, mapConfigs, name);
if (config != null) {
initDefaultMaxSizeForOnHeapMaps(config.getNearCacheConfig());
return config.getAsReadOnly();
}
return getMapConfig("default").getAsReadOnly();
} } | public class class_name {
public MapConfig findMapConfig(String name) {
name = getBaseName(name);
MapConfig config = lookupByPattern(configPatternMatcher, mapConfigs, name);
if (config != null) {
initDefaultMaxSizeForOnHeapMaps(config.getNearCacheConfig()); // depends on control dependency: [if], data = [(config]
return config.getAsReadOnly(); // depends on control dependency: [if], data = [none]
}
return getMapConfig("default").getAsReadOnly();
} } |
public class class_name {
public final boolean collapseGroup(final int groupIndex) {
ExpandableListAdapter adapter = getExpandableListAdapter();
if (adapter != null && isGroupExpanded(groupIndex)) {
expandedGroups.remove(groupIndex);
notifyDataSetChanged();
return true;
}
return false;
} } | public class class_name {
public final boolean collapseGroup(final int groupIndex) {
ExpandableListAdapter adapter = getExpandableListAdapter();
if (adapter != null && isGroupExpanded(groupIndex)) {
expandedGroups.remove(groupIndex); // depends on control dependency: [if], data = [none]
notifyDataSetChanged(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public boolean await(long maxWait, TimeUnit timeUnit) throws Exception
{
boolean hasWait = (timeUnit != null);
long startMs = System.currentTimeMillis();
for (;;)
{
String status = client.command().status(queryId).invoke().get().getStatus();
if (status.equalsIgnoreCase(STATUS_DONE))
{
break;
}
if (!status.equalsIgnoreCase(STATUS_RUNNING) && !status.equalsIgnoreCase(STATUS_WAITING))
{
throw new Exception(String.format("Bad status for query %s: %s", queryId, status));
}
if (hasWait)
{
long elapsedMs = System.currentTimeMillis() - startMs;
if (elapsedMs >= timeUnit.toMillis(maxWait))
{
return false;
}
}
Thread.sleep(pollMs.get());
}
return true;
} } | public class class_name {
public boolean await(long maxWait, TimeUnit timeUnit) throws Exception
{
boolean hasWait = (timeUnit != null);
long startMs = System.currentTimeMillis();
for (;;)
{
String status = client.command().status(queryId).invoke().get().getStatus();
if (status.equalsIgnoreCase(STATUS_DONE))
{
break;
}
if (!status.equalsIgnoreCase(STATUS_RUNNING) && !status.equalsIgnoreCase(STATUS_WAITING))
{
throw new Exception(String.format("Bad status for query %s: %s", queryId, status));
}
if (hasWait)
{
long elapsedMs = System.currentTimeMillis() - startMs;
if (elapsedMs >= timeUnit.toMillis(maxWait))
{
return false; // depends on control dependency: [if], data = [none]
}
}
Thread.sleep(pollMs.get());
}
return true;
} } |
public class class_name {
public void permute(final PermutationProxy proxy) {
checkArgument(numElements() == proxy.length());
final boolean[] seen = new boolean[numElements()];
for (int startIdx = 0; startIdx < seen.length; ++startIdx) {
if (!seen[startIdx]) {
// starting at any element, we can follow the chain of sources
// in a cycle
int curIdx = startIdx;
// we have to save the data in our starting spot
// because it will be overwritten by the time
// we encounter the last element in the cycle, which
// will need them
proxy.shiftIntoTemporaryBufferFrom(startIdx);
while (true) {
seen[curIdx] = true;
final int sourceIdx = sourceOfIndex(curIdx);
if (sourceIdx == startIdx) {
// completed the cycle
proxy.shiftOutOfTemporaryBufferTo(curIdx);
break;
} else {
// shift data from source to cur index
proxy.shift(sourceIdx, curIdx);
curIdx = sourceIdx;
}
}
}
}
} } | public class class_name {
public void permute(final PermutationProxy proxy) {
checkArgument(numElements() == proxy.length());
final boolean[] seen = new boolean[numElements()];
for (int startIdx = 0; startIdx < seen.length; ++startIdx) {
if (!seen[startIdx]) {
// starting at any element, we can follow the chain of sources
// in a cycle
int curIdx = startIdx;
// we have to save the data in our starting spot
// because it will be overwritten by the time
// we encounter the last element in the cycle, which
// will need them
proxy.shiftIntoTemporaryBufferFrom(startIdx); // depends on control dependency: [if], data = [none]
while (true) {
seen[curIdx] = true; // depends on control dependency: [while], data = [none]
final int sourceIdx = sourceOfIndex(curIdx);
if (sourceIdx == startIdx) {
// completed the cycle
proxy.shiftOutOfTemporaryBufferTo(curIdx); // depends on control dependency: [if], data = [none]
break;
} else {
// shift data from source to cur index
proxy.shift(sourceIdx, curIdx); // depends on control dependency: [if], data = [(sourceIdx]
curIdx = sourceIdx; // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public String getPathName()
{
if( pathName_ == null)
{
StringBuilder pathName = new StringBuilder();
IVarDef parent = getParent();
if( parent != null)
{
pathName
.append( parent.getPathName())
.append( '.');
}
String name = getName();
if( name != null)
{
pathName.append( name);
}
pathName_ = pathName.toString();
}
return pathName_;
} } | public class class_name {
public String getPathName()
{
if( pathName_ == null)
{
StringBuilder pathName = new StringBuilder();
IVarDef parent = getParent();
if( parent != null)
{
pathName
.append( parent.getPathName())
.append( '.'); // depends on control dependency: [if], data = [none]
}
String name = getName();
if( name != null)
{
pathName.append( name); // depends on control dependency: [if], data = [( name]
}
pathName_ = pathName.toString(); // depends on control dependency: [if], data = [none]
}
return pathName_;
} } |
public class class_name {
@NotNull
public PaginatedResult<Candidate> listCandidates() {
PaginatedResult<Candidate> result = restAdapter.listCandidates();
for (Candidate candidate : result.getData()) {
candidate.setAdapter(restAdapter);
}
return result;
} } | public class class_name {
@NotNull
public PaginatedResult<Candidate> listCandidates() {
PaginatedResult<Candidate> result = restAdapter.listCandidates();
for (Candidate candidate : result.getData()) {
candidate.setAdapter(restAdapter); // depends on control dependency: [for], data = [candidate]
}
return result;
} } |
public class class_name {
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
} } | public class class_name {
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) {
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
} } |
public class class_name {
public static <T> Supplier<T> memoizeWithRandomExpiration(Supplier<T> delegate, long minDuration, long maxDuration, TimeUnit units) {
if (minDuration == maxDuration) {
// This case resolves to standard expiration
return Suppliers.memoizeWithExpiration(delegate, minDuration, units);
}
return new RandomExpirationSupplier<T>(delegate, minDuration, maxDuration, units);
} } | public class class_name {
public static <T> Supplier<T> memoizeWithRandomExpiration(Supplier<T> delegate, long minDuration, long maxDuration, TimeUnit units) {
if (minDuration == maxDuration) {
// This case resolves to standard expiration
return Suppliers.memoizeWithExpiration(delegate, minDuration, units); // depends on control dependency: [if], data = [none]
}
return new RandomExpirationSupplier<T>(delegate, minDuration, maxDuration, units);
} } |
public class class_name {
@Override
public String getUserFacingMessage() {
final StringBuilder bldr = new StringBuilder();
String rl = getResourceLocation();
String pref = getPrefix();
String val = getValue();
bldr.append("symbol ");
bldr.append(val);
bldr.append(" does not exist in ");
if (hasLength(pref)) {
bldr.append(pref);
} else {
bldr.append(rl);
}
return bldr.toString();
} } | public class class_name {
@Override
public String getUserFacingMessage() {
final StringBuilder bldr = new StringBuilder();
String rl = getResourceLocation();
String pref = getPrefix();
String val = getValue();
bldr.append("symbol ");
bldr.append(val);
bldr.append(" does not exist in ");
if (hasLength(pref)) {
bldr.append(pref); // depends on control dependency: [if], data = [none]
} else {
bldr.append(rl); // depends on control dependency: [if], data = [none]
}
return bldr.toString();
} } |
public class class_name {
public static String reverseDelimited(String str, char separatorChar) {
if (str == null) {
return null;
}
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
String[] strs = split(str, separatorChar);
ArrayUtils.reverse(strs);
return join(strs, separatorChar);
} } | public class class_name {
public static String reverseDelimited(String str, char separatorChar) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
// could implement manually, but simple way is to reuse other,
// probably slower, methods.
String[] strs = split(str, separatorChar);
ArrayUtils.reverse(strs);
return join(strs, separatorChar);
} } |
public class class_name {
static long addCap(long a, long b) {
long res = a + b;
if (res < 0L) {
return Long.MAX_VALUE;
}
return res;
} } | public class class_name {
static long addCap(long a, long b) {
long res = a + b;
if (res < 0L) {
return Long.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
private void analyzeApplication() throws InterruptedException {
int passCount = 0;
Profiler profiler = bugReporter.getProjectStats().getProfiler();
profiler.start(this.getClass());
AnalysisContext.currentXFactory().canonicalizeAll();
try {
boolean multiplePasses = executionPlan.getNumPasses() > 1;
if (executionPlan.getNumPasses() == 0) {
throw new AssertionError("no analysis passes");
}
int[] classesPerPass = new int[executionPlan.getNumPasses()];
classesPerPass[0] = referencedClassSet.size();
for (int i = 0; i < classesPerPass.length; i++) {
classesPerPass[i] = i == 0 ? referencedClassSet.size() : appClassList.size();
}
progressReporter.predictPassCount(classesPerPass);
XFactory factory = AnalysisContext.currentXFactory();
Collection<ClassDescriptor> badClasses = new LinkedList<>();
for (ClassDescriptor desc : referencedClassSet) {
try {
XClass info = Global.getAnalysisCache().getClassAnalysis(XClass.class, desc);
factory.intern(info);
} catch (CheckedAnalysisException e) {
AnalysisContext.logError("Couldn't get class info for " + desc, e);
badClasses.add(desc);
} catch (RuntimeException e) {
AnalysisContext.logError("Couldn't get class info for " + desc, e);
badClasses.add(desc);
}
}
if (!badClasses.isEmpty()) {
referencedClassSet = new LinkedHashSet<>(referencedClassSet);
referencedClassSet.removeAll(badClasses);
}
long startTime = System.currentTimeMillis();
bugReporter.getProjectStats().setReferencedClasses(referencedClassSet.size());
for (Iterator<AnalysisPass> passIterator = executionPlan.passIterator(); passIterator.hasNext();) {
AnalysisPass pass = passIterator.next();
// The first pass is generally a non-reporting pass which
// gathers information about referenced classes.
boolean isNonReportingFirstPass = multiplePasses && passCount == 0;
// Instantiate the detectors
Detector2[] detectorList = pass.instantiateDetector2sInPass(bugReporter);
// If there are multiple passes, then on the first pass,
// we apply detectors to all classes referenced by the
// application classes.
// On subsequent passes, we apply detector only to application
// classes.
Collection<ClassDescriptor> classCollection = (isNonReportingFirstPass) ? referencedClassSet : appClassList;
AnalysisContext.currentXFactory().canonicalizeAll();
if (PROGRESS || LIST_ORDER) {
System.out.printf("%6d : Pass %d: %d classes%n", (System.currentTimeMillis() - startTime)/1000, passCount, classCollection.size());
if (DEBUG) {
XFactory.profile();
}
}
if (!isNonReportingFirstPass) {
OutEdges<ClassDescriptor> outEdges = e -> {
try {
XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, e);
return classNameAndInfo.getCalledClassDescriptors();
} catch (CheckedAnalysisException e2) {
AnalysisContext.logError("error while analyzing " + e.getClassName(), e2);
return Collections.emptyList();
}
};
classCollection = sortByCallGraph(classCollection, outEdges);
}
if (LIST_ORDER) {
System.out.println("Analysis order:");
for (ClassDescriptor c : classCollection) {
System.out.println(" " + c);
}
}
AnalysisContext currentAnalysisContext = AnalysisContext.currentAnalysisContext();
currentAnalysisContext.updateDatabases(passCount);
progressReporter.startAnalysis(classCollection.size());
int count = 0;
Global.getAnalysisCache().purgeAllMethodAnalysis();
Global.getAnalysisCache().purgeClassAnalysis(FBClassReader.class);
for (ClassDescriptor classDescriptor : classCollection) {
long classStartNanoTime = 0;
if (PROGRESS) {
classStartNanoTime = System.nanoTime();
System.out.printf("%6d %d/%d %d/%d %s%n", (System.currentTimeMillis() - startTime)/1000,
passCount, executionPlan.getNumPasses(), count,
classCollection.size(), classDescriptor);
}
count++;
// Check to see if class is excluded by the class screener.
// In general, we do not want to screen classes from the
// first pass, even if they would otherwise be excluded.
if ((SCREEN_FIRST_PASS_CLASSES || !isNonReportingFirstPass)
&& !classScreener.matches(classDescriptor.toResourceName())) {
if (DEBUG) {
System.out.println("*** Excluded by class screener");
}
continue;
}
boolean isHuge = currentAnalysisContext.isTooBig(classDescriptor);
if (isHuge && currentAnalysisContext.isApplicationClass(classDescriptor)) {
bugReporter.reportBug(new BugInstance("SKIPPED_CLASS_TOO_BIG", Priorities.NORMAL_PRIORITY)
.addClass(classDescriptor));
}
currentClassName = ClassName.toDottedClassName(classDescriptor.getClassName());
notifyClassObservers(classDescriptor);
profiler.startContext(currentClassName);
currentAnalysisContext.setClassBeingAnalyzed(classDescriptor);
try {
for (Detector2 detector : detectorList) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
if (isHuge && !FirstPassDetector.class.isAssignableFrom(detector.getClass())) {
continue;
}
if (DEBUG) {
System.out.println("Applying " + detector.getDetectorClassName() + " to " + classDescriptor);
// System.out.println("foo: " +
// NonReportingDetector.class.isAssignableFrom(detector.getClass())
// + ", bar: " + detector.getClass().getName());
}
try {
profiler.start(detector.getClass());
detector.visitClass(classDescriptor);
} catch (ClassFormatException e) {
logRecoverableException(classDescriptor, detector, e);
} catch (MissingClassException e) {
Global.getAnalysisCache().getErrorLogger().reportMissingClass(e.getClassDescriptor());
} catch (CheckedAnalysisException e) {
logRecoverableException(classDescriptor, detector, e);
} catch (RuntimeException e) {
logRecoverableException(classDescriptor, detector, e);
} finally {
profiler.end(detector.getClass());
}
}
} finally {
progressReporter.finishClass();
profiler.endContext(currentClassName);
currentAnalysisContext.clearClassBeingAnalyzed();
if (PROGRESS) {
long usecs = (System.nanoTime() - classStartNanoTime)/1000;
if (usecs > 15000) {
int classSize = currentAnalysisContext.getClassSize(classDescriptor);
long speed = usecs /classSize;
if (speed > 15) {
System.out.printf(" %6d usecs/byte %6d msec %6d bytes %d pass %s%n", speed, usecs/1000, classSize, passCount,
classDescriptor);
}
}
}
}
}
// Call finishPass on each detector
for (Detector2 detector : detectorList) {
detector.finishPass();
}
progressReporter.finishPerClassAnalysis();
passCount++;
}
} finally {
bugReporter.finish();
bugReporter.reportQueuedErrors();
profiler.end(this.getClass());
if (PROGRESS) {
System.out.println("Analysis completed");
}
}
} } | public class class_name {
private void analyzeApplication() throws InterruptedException {
int passCount = 0;
Profiler profiler = bugReporter.getProjectStats().getProfiler();
profiler.start(this.getClass());
AnalysisContext.currentXFactory().canonicalizeAll();
try {
boolean multiplePasses = executionPlan.getNumPasses() > 1;
if (executionPlan.getNumPasses() == 0) {
throw new AssertionError("no analysis passes");
}
int[] classesPerPass = new int[executionPlan.getNumPasses()];
classesPerPass[0] = referencedClassSet.size();
for (int i = 0; i < classesPerPass.length; i++) {
classesPerPass[i] = i == 0 ? referencedClassSet.size() : appClassList.size(); // depends on control dependency: [for], data = [i]
}
progressReporter.predictPassCount(classesPerPass);
XFactory factory = AnalysisContext.currentXFactory();
Collection<ClassDescriptor> badClasses = new LinkedList<>();
for (ClassDescriptor desc : referencedClassSet) {
try {
XClass info = Global.getAnalysisCache().getClassAnalysis(XClass.class, desc);
factory.intern(info); // depends on control dependency: [try], data = [none]
} catch (CheckedAnalysisException e) {
AnalysisContext.logError("Couldn't get class info for " + desc, e);
badClasses.add(desc);
} catch (RuntimeException e) {
AnalysisContext.logError("Couldn't get class info for " + desc, e);
badClasses.add(desc);
} // depends on control dependency: [catch], data = [none]
}
if (!badClasses.isEmpty()) {
referencedClassSet = new LinkedHashSet<>(referencedClassSet); // depends on control dependency: [if], data = [none]
referencedClassSet.removeAll(badClasses); // depends on control dependency: [if], data = [none]
}
long startTime = System.currentTimeMillis();
bugReporter.getProjectStats().setReferencedClasses(referencedClassSet.size());
for (Iterator<AnalysisPass> passIterator = executionPlan.passIterator(); passIterator.hasNext();) {
AnalysisPass pass = passIterator.next();
// The first pass is generally a non-reporting pass which
// gathers information about referenced classes.
boolean isNonReportingFirstPass = multiplePasses && passCount == 0;
// Instantiate the detectors
Detector2[] detectorList = pass.instantiateDetector2sInPass(bugReporter);
// If there are multiple passes, then on the first pass,
// we apply detectors to all classes referenced by the
// application classes.
// On subsequent passes, we apply detector only to application
// classes.
Collection<ClassDescriptor> classCollection = (isNonReportingFirstPass) ? referencedClassSet : appClassList;
AnalysisContext.currentXFactory().canonicalizeAll(); // depends on control dependency: [for], data = [none]
if (PROGRESS || LIST_ORDER) {
System.out.printf("%6d : Pass %d: %d classes%n", (System.currentTimeMillis() - startTime)/1000, passCount, classCollection.size()); // depends on control dependency: [if], data = [none]
if (DEBUG) {
XFactory.profile(); // depends on control dependency: [if], data = [none]
}
}
if (!isNonReportingFirstPass) {
OutEdges<ClassDescriptor> outEdges = e -> {
try {
XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, e);
return classNameAndInfo.getCalledClassDescriptors(); // depends on control dependency: [if], data = [none]
} catch (CheckedAnalysisException e2) { // depends on control dependency: [for], data = [none]
AnalysisContext.logError("error while analyzing " + e.getClassName(), e2);
return Collections.emptyList();
}
};
classCollection = sortByCallGraph(classCollection, outEdges);
}
if (LIST_ORDER) {
System.out.println("Analysis order:");
for (ClassDescriptor c : classCollection) {
System.out.println(" " + c); // depends on control dependency: [for], data = [c]
}
}
AnalysisContext currentAnalysisContext = AnalysisContext.currentAnalysisContext();
currentAnalysisContext.updateDatabases(passCount);
progressReporter.startAnalysis(classCollection.size());
int count = 0;
Global.getAnalysisCache().purgeAllMethodAnalysis();
Global.getAnalysisCache().purgeClassAnalysis(FBClassReader.class);
for (ClassDescriptor classDescriptor : classCollection) {
long classStartNanoTime = 0;
if (PROGRESS) {
classStartNanoTime = System.nanoTime(); // depends on control dependency: [if], data = [none]
System.out.printf("%6d %d/%d %d/%d %s%n", (System.currentTimeMillis() - startTime)/1000,
passCount, executionPlan.getNumPasses(), count,
classCollection.size(), classDescriptor); // depends on control dependency: [if], data = [none]
}
count++;
// Check to see if class is excluded by the class screener.
// In general, we do not want to screen classes from the
// first pass, even if they would otherwise be excluded.
if ((SCREEN_FIRST_PASS_CLASSES || !isNonReportingFirstPass)
&& !classScreener.matches(classDescriptor.toResourceName())) {
if (DEBUG) {
System.out.println("*** Excluded by class screener");
}
continue;
}
boolean isHuge = currentAnalysisContext.isTooBig(classDescriptor);
if (isHuge && currentAnalysisContext.isApplicationClass(classDescriptor)) {
bugReporter.reportBug(new BugInstance("SKIPPED_CLASS_TOO_BIG", Priorities.NORMAL_PRIORITY)
.addClass(classDescriptor)); // depends on control dependency: [if], data = [none]
}
currentClassName = ClassName.toDottedClassName(classDescriptor.getClassName());
notifyClassObservers(classDescriptor);
profiler.startContext(currentClassName);
currentAnalysisContext.setClassBeingAnalyzed(classDescriptor);
try {
for (Detector2 detector : detectorList) {
if (Thread.interrupted()) {
throw new InterruptedException();
}
if (isHuge && !FirstPassDetector.class.isAssignableFrom(detector.getClass())) {
continue;
}
if (DEBUG) {
System.out.println("Applying " + detector.getDetectorClassName() + " to " + classDescriptor); // depends on control dependency: [if], data = [none]
// System.out.println("foo: " +
// NonReportingDetector.class.isAssignableFrom(detector.getClass())
// + ", bar: " + detector.getClass().getName());
}
try {
profiler.start(detector.getClass()); // depends on control dependency: [try], data = [none]
detector.visitClass(classDescriptor); // depends on control dependency: [try], data = [none]
} catch (ClassFormatException e) {
logRecoverableException(classDescriptor, detector, e);
} catch (MissingClassException e) { // depends on control dependency: [catch], data = [none]
Global.getAnalysisCache().getErrorLogger().reportMissingClass(e.getClassDescriptor());
} catch (CheckedAnalysisException e) { // depends on control dependency: [catch], data = [none]
logRecoverableException(classDescriptor, detector, e);
} catch (RuntimeException e) { // depends on control dependency: [catch], data = [none]
logRecoverableException(classDescriptor, detector, e);
} finally { // depends on control dependency: [catch], data = [none]
profiler.end(detector.getClass());
}
}
} finally {
progressReporter.finishClass();
profiler.endContext(currentClassName);
currentAnalysisContext.clearClassBeingAnalyzed();
if (PROGRESS) {
long usecs = (System.nanoTime() - classStartNanoTime)/1000;
if (usecs > 15000) {
int classSize = currentAnalysisContext.getClassSize(classDescriptor);
long speed = usecs /classSize;
if (speed > 15) {
System.out.printf(" %6d usecs/byte %6d msec %6d bytes %d pass %s%n", speed, usecs/1000, classSize, passCount,
classDescriptor); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// Call finishPass on each detector
for (Detector2 detector : detectorList) {
detector.finishPass();
}
progressReporter.finishPerClassAnalysis();
passCount++;
}
} finally {
bugReporter.finish();
bugReporter.reportQueuedErrors();
profiler.end(this.getClass());
if (PROGRESS) {
System.out.println("Analysis completed");
}
}
} } |
public class class_name {
public void select(int row, int col)
{
for (TextGridSelectionListener listener : textGridSelectionListeners)
{
listener.select(new TextGridEvent(this, row, col));
}
} } | public class class_name {
public void select(int row, int col)
{
for (TextGridSelectionListener listener : textGridSelectionListeners)
{
listener.select(new TextGridEvent(this, row, col)); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
private WSCredential getWSCredentialFromSubject(Subject subject) {
if (subject != null) {
java.util.Collection<Object> publicCreds = subject.getPublicCredentials();
if (publicCreds != null && publicCreds.size() > 0) {
java.util.Iterator<Object> publicCredIterator = publicCreds.iterator();
while (publicCredIterator.hasNext()) {
Object cred = publicCredIterator.next();
if (cred instanceof WSCredential) {
return (WSCredential) cred;
}
}
}
}
return null;
} } | public class class_name {
private WSCredential getWSCredentialFromSubject(Subject subject) {
if (subject != null) {
java.util.Collection<Object> publicCreds = subject.getPublicCredentials();
if (publicCreds != null && publicCreds.size() > 0) {
java.util.Iterator<Object> publicCredIterator = publicCreds.iterator();
while (publicCredIterator.hasNext()) {
Object cred = publicCredIterator.next();
if (cred instanceof WSCredential) {
return (WSCredential) cred; // depends on control dependency: [if], data = [none]
}
}
}
}
return null;
} } |
public class class_name {
public int bufferIndexOf(KType e1) {
final int last = tail;
final int bufLen = buffer.length;
for (int i = head; i != last; i = oneRight(i, bufLen)) {
if (Intrinsics.equals(this, e1, buffer[i])) {
return i;
}
}
return -1;
} } | public class class_name {
public int bufferIndexOf(KType e1) {
final int last = tail;
final int bufLen = buffer.length;
for (int i = head; i != last; i = oneRight(i, bufLen)) {
if (Intrinsics.equals(this, e1, buffer[i])) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public void prune(
Collection<ComputationState> matchesToPrune,
Collection<Map<String, List<EventId>>> matchedResult,
SharedBufferAccessor<?> sharedBufferAccessor) throws Exception {
EventId pruningId = getPruningId(matchedResult);
if (pruningId != null) {
List<ComputationState> discardStates = new ArrayList<>();
for (ComputationState computationState : matchesToPrune) {
if (computationState.getStartEventID() != null &&
shouldPrune(computationState.getStartEventID(), pruningId)) {
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry());
discardStates.add(computationState);
}
}
matchesToPrune.removeAll(discardStates);
}
} } | public class class_name {
public void prune(
Collection<ComputationState> matchesToPrune,
Collection<Map<String, List<EventId>>> matchedResult,
SharedBufferAccessor<?> sharedBufferAccessor) throws Exception {
EventId pruningId = getPruningId(matchedResult);
if (pruningId != null) {
List<ComputationState> discardStates = new ArrayList<>();
for (ComputationState computationState : matchesToPrune) {
if (computationState.getStartEventID() != null &&
shouldPrune(computationState.getStartEventID(), pruningId)) {
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry()); // depends on control dependency: [if], data = [none]
discardStates.add(computationState); // depends on control dependency: [if], data = [none]
}
}
matchesToPrune.removeAll(discardStates);
}
} } |
public class class_name {
public com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata
getImageClassificationDetails() {
if (detailsCase_ == 3) {
return (com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata)
details_;
}
return com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata
.getDefaultInstance();
} } | public class class_name {
public com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata
getImageClassificationDetails() {
if (detailsCase_ == 3) {
return (com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata)
details_; // depends on control dependency: [if], data = [none]
}
return com.google.cloud.datalabeling.v1beta1.LabelImageClassificationOperationMetadata
.getDefaultInstance();
} } |
public class class_name {
public static void listToCSV(StringBuffer strOut, List<?> list) {
if (null != list && !list.isEmpty()) { // 如果文本不为空则添加到csv字符串中
for (Object aList : list) {
createCol(strOut, aList);
strOut.append(COMMA);
}
strOut = strOut.deleteCharAt(strOut.length() - 1);
strOut.append(NEWLINE);
}
} } | public class class_name {
public static void listToCSV(StringBuffer strOut, List<?> list) {
if (null != list && !list.isEmpty()) { // 如果文本不为空则添加到csv字符串中
for (Object aList : list) {
createCol(strOut, aList); // depends on control dependency: [for], data = [aList]
strOut.append(COMMA); // depends on control dependency: [for], data = [none]
}
strOut = strOut.deleteCharAt(strOut.length() - 1); // depends on control dependency: [if], data = [none]
strOut.append(NEWLINE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
@RunInto(RunType.JAT)
public void doOpenStage(final Wave wave) {
LOGGER.trace("Open a stage.");
final StageWaveBean swb = getWaveBean(wave);
final String stageKey = swb.stageKey();
if (this.stageMap.containsKey(stageKey) && this.stageMap.get(stageKey) != null) {
// Show the stage
Platform.runLater(() -> this.stageMap.get(stageKey).show());
} else {
final Region rootPane = getRootPane(swb);
final Scene scene = getScene(swb, rootPane);
final Stage stage = getStage(swb, scene);
// Show the stage
this.stageMap.put(stageKey, stage);
Platform.runLater(() -> stage.show());
}
} } | public class class_name {
@Override
@RunInto(RunType.JAT)
public void doOpenStage(final Wave wave) {
LOGGER.trace("Open a stage.");
final StageWaveBean swb = getWaveBean(wave);
final String stageKey = swb.stageKey();
if (this.stageMap.containsKey(stageKey) && this.stageMap.get(stageKey) != null) {
// Show the stage
Platform.runLater(() -> this.stageMap.get(stageKey).show()); // depends on control dependency: [if], data = [none]
} else {
final Region rootPane = getRootPane(swb);
final Scene scene = getScene(swb, rootPane);
final Stage stage = getStage(swb, scene);
// Show the stage
this.stageMap.put(stageKey, stage); // depends on control dependency: [if], data = [none]
Platform.runLater(() -> stage.show()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void rotateGridCCW( Grid g ) {
work.clear();
for (int i = 0; i < g.rows * g.columns; i++) {
work.add(null);
}
for (int row = 0; row < g.rows; row++) {
for (int col = 0; col < g.columns; col++) {
work.set(col*g.rows + row, g.get(g.rows - row - 1,col));
}
}
g.ellipses.clear();
g.ellipses.addAll(work);
int tmp = g.columns;
g.columns = g.rows;
g.rows = tmp;
} } | public class class_name {
void rotateGridCCW( Grid g ) {
work.clear();
for (int i = 0; i < g.rows * g.columns; i++) {
work.add(null); // depends on control dependency: [for], data = [none]
}
for (int row = 0; row < g.rows; row++) {
for (int col = 0; col < g.columns; col++) {
work.set(col*g.rows + row, g.get(g.rows - row - 1,col)); // depends on control dependency: [for], data = [col]
}
}
g.ellipses.clear();
g.ellipses.addAll(work);
int tmp = g.columns;
g.columns = g.rows;
g.rows = tmp;
} } |
public class class_name {
public TemplateParser buildTemplateParser() {
// TODO: handle enable?
List<TemplateImplementation> impls = buildTemplateParserImpls();
if (impls.isEmpty()) {
// if no template parser available => exception
throw new BuildException("No parser available. Either disable template features or register a template engine");
}
if (impls.size() == 1) {
// if no detector defined or only one available parser => do not use
// auto detection
TemplateParser parser = impls.get(0).getParser();
LOG.info("Using single template engine: {}", parser);
return parser;
}
LOG.info("Using auto detection mechanism");
LOG.debug("Auto detection mechanisms: {}", impls);
return new AutoDetectTemplateParser(impls);
} } | public class class_name {
public TemplateParser buildTemplateParser() {
// TODO: handle enable?
List<TemplateImplementation> impls = buildTemplateParserImpls();
if (impls.isEmpty()) {
// if no template parser available => exception
throw new BuildException("No parser available. Either disable template features or register a template engine");
}
if (impls.size() == 1) {
// if no detector defined or only one available parser => do not use
// auto detection
TemplateParser parser = impls.get(0).getParser();
LOG.info("Using single template engine: {}", parser); // depends on control dependency: [if], data = [none]
return parser; // depends on control dependency: [if], data = [none]
}
LOG.info("Using auto detection mechanism");
LOG.debug("Auto detection mechanisms: {}", impls);
return new AutoDetectTemplateParser(impls);
} } |
public class class_name {
static ClosableResolver<AwsEndpoint> compositeQueryResolver(
final ClusterResolver<AwsEndpoint> remoteResolver,
final ClusterResolver<AwsEndpoint> localResolver,
final EurekaClientConfig clientConfig,
final EurekaTransportConfig transportConfig,
final InstanceInfo myInstanceInfo) {
String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
String myZone = InstanceInfo.getZone(availZones, myInstanceInfo);
ClusterResolver<AwsEndpoint> compositeResolver = new ClusterResolver<AwsEndpoint>() {
@Override
public String getRegion() {
return clientConfig.getRegion();
}
@Override
public List<AwsEndpoint> getClusterEndpoints() {
List<AwsEndpoint> result = localResolver.getClusterEndpoints();
if (result.isEmpty()) {
result = remoteResolver.getClusterEndpoints();
}
return result;
}
};
return new AsyncResolver<>(
EurekaClientNames.QUERY,
new ZoneAffinityClusterResolver(compositeResolver, myZone, true),
transportConfig.getAsyncExecutorThreadPoolSize(),
transportConfig.getAsyncResolverRefreshIntervalMs(),
transportConfig.getAsyncResolverWarmUpTimeoutMs()
);
} } | public class class_name {
static ClosableResolver<AwsEndpoint> compositeQueryResolver(
final ClusterResolver<AwsEndpoint> remoteResolver,
final ClusterResolver<AwsEndpoint> localResolver,
final EurekaClientConfig clientConfig,
final EurekaTransportConfig transportConfig,
final InstanceInfo myInstanceInfo) {
String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
String myZone = InstanceInfo.getZone(availZones, myInstanceInfo);
ClusterResolver<AwsEndpoint> compositeResolver = new ClusterResolver<AwsEndpoint>() {
@Override
public String getRegion() {
return clientConfig.getRegion();
}
@Override
public List<AwsEndpoint> getClusterEndpoints() {
List<AwsEndpoint> result = localResolver.getClusterEndpoints();
if (result.isEmpty()) {
result = remoteResolver.getClusterEndpoints(); // depends on control dependency: [if], data = [none]
}
return result;
}
};
return new AsyncResolver<>(
EurekaClientNames.QUERY,
new ZoneAffinityClusterResolver(compositeResolver, myZone, true),
transportConfig.getAsyncExecutorThreadPoolSize(),
transportConfig.getAsyncResolverRefreshIntervalMs(),
transportConfig.getAsyncResolverWarmUpTimeoutMs()
);
} } |
public class class_name {
private ChargingStation getChargingStation(ChargingStationId chargingStationId) {
ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId());
if (chargingStation == null) {
LOG.error("Could not find charging station {}", chargingStationId);
}
return chargingStation;
} } | public class class_name {
private ChargingStation getChargingStation(ChargingStationId chargingStationId) {
ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId.getId());
if (chargingStation == null) {
LOG.error("Could not find charging station {}", chargingStationId); // depends on control dependency: [if], data = [none]
}
return chargingStation;
} } |
public class class_name {
public List<TemplateRole> getSignerRoles() {
List<TemplateRole> masterList = getList(TemplateRole.class, TEMPLATE_SIGNER_ROLES);
if (masterList == null || masterList.size() == 0) {
return masterList;
}
if (masterList.get(0).getOrder() == null) {
return masterList;
}
List<TemplateRole> sortedList = new ArrayList<TemplateRole>(masterList.size());
for (TemplateRole r : masterList) {
sortedList.add(r.getOrder(), r);
}
return sortedList;
} } | public class class_name {
public List<TemplateRole> getSignerRoles() {
List<TemplateRole> masterList = getList(TemplateRole.class, TEMPLATE_SIGNER_ROLES);
if (masterList == null || masterList.size() == 0) {
return masterList; // depends on control dependency: [if], data = [none]
}
if (masterList.get(0).getOrder() == null) {
return masterList; // depends on control dependency: [if], data = [none]
}
List<TemplateRole> sortedList = new ArrayList<TemplateRole>(masterList.size());
for (TemplateRole r : masterList) {
sortedList.add(r.getOrder(), r); // depends on control dependency: [for], data = [r]
}
return sortedList;
} } |
public class class_name {
public void createLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference<S> serviceReference : linkerManagement.getMatchedBinderServiceRef()) {
if (linkerManagement.canBeLinked(declaration, serviceReference)) {
linkerManagement.link(declaration, serviceReference);
}
}
} } | public class class_name {
public void createLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference<S> serviceReference : linkerManagement.getMatchedBinderServiceRef()) {
if (linkerManagement.canBeLinked(declaration, serviceReference)) {
linkerManagement.link(declaration, serviceReference); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void addResult(CmsContentCheckResource testResource) {
List warnings = testResource.getWarnings();
List errors = testResource.getErrors();
// add the warnings if there were any
if ((warnings != null) && (warnings.size() > 0)) {
m_warnings.put(testResource.getResourceName(), warnings);
m_warningResources.add(testResource.getResource());
m_warningCheckResources.add(testResource);
}
// add the errors if there were any
if ((errors != null) && (errors.size() > 0)) {
m_errors.put(testResource.getResourceName(), errors);
m_errorResources.add(testResource.getResource());
m_errorCheckResources.add(testResource);
}
m_allResources.add(testResource.getResource());
m_allCheckResources.add(testResource);
} } | public class class_name {
public void addResult(CmsContentCheckResource testResource) {
List warnings = testResource.getWarnings();
List errors = testResource.getErrors();
// add the warnings if there were any
if ((warnings != null) && (warnings.size() > 0)) {
m_warnings.put(testResource.getResourceName(), warnings); // depends on control dependency: [if], data = [none]
m_warningResources.add(testResource.getResource()); // depends on control dependency: [if], data = [none]
m_warningCheckResources.add(testResource); // depends on control dependency: [if], data = [none]
}
// add the errors if there were any
if ((errors != null) && (errors.size() > 0)) {
m_errors.put(testResource.getResourceName(), errors); // depends on control dependency: [if], data = [none]
m_errorResources.add(testResource.getResource()); // depends on control dependency: [if], data = [none]
m_errorCheckResources.add(testResource); // depends on control dependency: [if], data = [none]
}
m_allResources.add(testResource.getResource());
m_allCheckResources.add(testResource);
} } |
public class class_name {
public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords);
return;
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords));
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords));
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords));
}
System.out.println("]");
}
} } | public class class_name {
public static void dumpTexCoords(AiMesh mesh, int coords) {
if (!mesh.hasTexCoords(coords)) {
System.out.println("mesh has no texture coordinate set " + coords); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < mesh.getNumVertices(); i++) {
int numComponents = mesh.getNumUVComponents(coords);
System.out.print("[" + mesh.getTexCoordU(i, coords)); // depends on control dependency: [for], data = [i]
if (numComponents > 1) {
System.out.print(", " + mesh.getTexCoordV(i, coords)); // depends on control dependency: [if], data = [none]
}
if (numComponents > 2) {
System.out.print(", " + mesh.getTexCoordW(i, coords)); // depends on control dependency: [if], data = [none]
}
System.out.println("]"); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static String getTitle(final String namePattern, final String methodName,
final Object instance, final Object... parameters) {
final String finalPattern = namePattern
.replaceAll("\\{method}", methodName)
.replaceAll("\\{this}", String.valueOf(instance));
final int paramsCount = parameters == null ? 0 : parameters.length;
final Object[] results = new Object[paramsCount];
for (int i = 0; i < paramsCount; i++) {
results[i] = arrayToString(parameters[i]);
}
return MessageFormat.format(finalPattern, results);
} } | public class class_name {
public static String getTitle(final String namePattern, final String methodName,
final Object instance, final Object... parameters) {
final String finalPattern = namePattern
.replaceAll("\\{method}", methodName)
.replaceAll("\\{this}", String.valueOf(instance));
final int paramsCount = parameters == null ? 0 : parameters.length;
final Object[] results = new Object[paramsCount];
for (int i = 0; i < paramsCount; i++) {
results[i] = arrayToString(parameters[i]); // depends on control dependency: [for], data = [i]
}
return MessageFormat.format(finalPattern, results);
} } |
public class class_name {
@Override
public void write(RtpPacket packet, RTPFormat format) {
// checking format
if (format == null) {
if (logger.isTraceEnabled()) {
logger.trace("No format specified. Packet dropped!");
}
return;
}
boolean locked = false;
try {
locked = this.lock.tryLock() || this.lock.tryLock(5, TimeUnit.MILLISECONDS);
if (locked) {
safeWrite(packet, format);
}
} catch (InterruptedException e) {
if (logger.isTraceEnabled()) {
logger.trace("Could not aquire write lock for jitter buffer. Dropped packet.");
}
} finally {
if (locked) {
this.lock.unlock();
}
}
} } | public class class_name {
@Override
public void write(RtpPacket packet, RTPFormat format) {
// checking format
if (format == null) {
if (logger.isTraceEnabled()) {
logger.trace("No format specified. Packet dropped!"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
boolean locked = false;
try {
locked = this.lock.tryLock() || this.lock.tryLock(5, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
if (locked) {
safeWrite(packet, format); // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
if (logger.isTraceEnabled()) {
logger.trace("Could not aquire write lock for jitter buffer. Dropped packet."); // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
if (locked) {
this.lock.unlock(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void setDecimal(int ordinal, Decimal value, int precision) {
assertIndexIsValid(ordinal);
if (precision <= Decimal.MAX_LONG_DIGITS()) {
// compact format
if (value == null) {
setNullAt(ordinal);
} else {
setLong(ordinal, value.toUnscaledLong());
}
} else {
// fixed length
long cursor = getLong(ordinal) >>> 32;
assert cursor > 0 : "invalid cursor " + cursor;
// zero-out the bytes
Platform.putLong(baseObject, baseOffset + cursor, 0L);
Platform.putLong(baseObject, baseOffset + cursor + 8, 0L);
if (value == null) {
setNullAt(ordinal);
// keep the offset for future update
Platform.putLong(baseObject, getFieldOffset(ordinal), cursor << 32);
} else {
final BigInteger integer = value.toJavaBigDecimal().unscaledValue();
byte[] bytes = integer.toByteArray();
assert(bytes.length <= 16);
// Write the bytes to the variable length portion.
Platform.copyMemory(
bytes, Platform.BYTE_ARRAY_OFFSET, baseObject, baseOffset + cursor, bytes.length);
setLong(ordinal, (cursor << 32) | ((long) bytes.length));
}
}
} } | public class class_name {
@Override
public void setDecimal(int ordinal, Decimal value, int precision) {
assertIndexIsValid(ordinal);
if (precision <= Decimal.MAX_LONG_DIGITS()) {
// compact format
if (value == null) {
setNullAt(ordinal); // depends on control dependency: [if], data = [none]
} else {
setLong(ordinal, value.toUnscaledLong()); // depends on control dependency: [if], data = [none]
}
} else {
// fixed length
long cursor = getLong(ordinal) >>> 32;
assert cursor > 0 : "invalid cursor " + cursor; // depends on control dependency: [if], data = [none]
// zero-out the bytes
Platform.putLong(baseObject, baseOffset + cursor, 0L); // depends on control dependency: [if], data = [none]
Platform.putLong(baseObject, baseOffset + cursor + 8, 0L); // depends on control dependency: [if], data = [none]
if (value == null) {
setNullAt(ordinal); // depends on control dependency: [if], data = [none]
// keep the offset for future update
Platform.putLong(baseObject, getFieldOffset(ordinal), cursor << 32); // depends on control dependency: [if], data = [none]
} else {
final BigInteger integer = value.toJavaBigDecimal().unscaledValue();
byte[] bytes = integer.toByteArray();
assert(bytes.length <= 16); // depends on control dependency: [if], data = [none]
// Write the bytes to the variable length portion.
Platform.copyMemory(
bytes, Platform.BYTE_ARRAY_OFFSET, baseObject, baseOffset + cursor, bytes.length); // depends on control dependency: [if], data = [none]
setLong(ordinal, (cursor << 32) | ((long) bytes.length)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static ResolvedType replaceIfMoreSpecific(ResolvedType replacement, ResolvedType defaultValue) {
ResolvedType toReturn = defaultIfAbsent(replacement, defaultValue);
if (isObject(replacement) && isNotObject(defaultValue)) {
return defaultValue;
}
return toReturn;
} } | public class class_name {
public static ResolvedType replaceIfMoreSpecific(ResolvedType replacement, ResolvedType defaultValue) {
ResolvedType toReturn = defaultIfAbsent(replacement, defaultValue);
if (isObject(replacement) && isNotObject(defaultValue)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return toReturn;
} } |
public class class_name {
public void addFieldRecursive(String type, String objectField, Map<String, HollowSchema> schemas) {
addField(type, objectField);
HollowObjectSchema schema = (HollowObjectSchema)schemas.get(type);
if(schema.getFieldType(objectField) == FieldType.REFERENCE) {
addTypeRecursive(schema.getReferencedType(objectField), schemas);
}
} } | public class class_name {
public void addFieldRecursive(String type, String objectField, Map<String, HollowSchema> schemas) {
addField(type, objectField);
HollowObjectSchema schema = (HollowObjectSchema)schemas.get(type);
if(schema.getFieldType(objectField) == FieldType.REFERENCE) {
addTypeRecursive(schema.getReferencedType(objectField), schemas); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void distributedProcess(ResponseBuilder rb,
ComponentFields mtasFields) {
if (mtasFields.doList) {
// compute total from shards
HashMap<String, HashMap<String, Integer>> listShardTotals = new HashMap<>();
for (ShardRequest sreq : rb.finished) {
if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
&& sreq.params.getBool(PARAM_MTAS_LIST, false)) {
for (ShardResponse response : sreq.responses) {
NamedList<Object> result = response.getSolrResponse().getResponse();
try {
ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) result
.findRecursive("mtas", NAME);
if (data != null) {
for (NamedList<Object> dataItem : data) {
Object key = dataItem.get("key");
Object total = dataItem.get("total");
if ((key != null) && (key instanceof String)
&& (total != null) && (total instanceof Integer)) {
if (!listShardTotals.containsKey(key)) {
listShardTotals.put((String) key,
new HashMap<String, Integer>());
}
HashMap<String, Integer> listShardTotal = listShardTotals
.get(key);
listShardTotal.put(response.getShard(), (Integer) total);
}
}
}
} catch (ClassCastException e) {
log.debug(e);
}
}
}
}
// compute shard requests
HashMap<String, ModifiableSolrParams> shardRequests = new HashMap<>();
int requestId = 0;
for (String field : mtasFields.list.keySet()) {
for (ComponentList list : mtasFields.list.get(field).listList) {
requestId++;
if (listShardTotals.containsKey(list.key) && (list.number > 0)) {
Integer start = list.start;
Integer number = list.number;
HashMap<String, Integer> totals = listShardTotals.get(list.key);
for (int i = 0; i < rb.shards.length; i++) {
if (number < 0) {
break;
}
int subTotal = totals.get(rb.shards[i]);
// System.out.println(i + " : " + rb.shards[i] + " : "
// + totals.get(rb.shards[i]) + " - " + start + " " + number);
if ((start >= 0) && (start < subTotal)) {
ModifiableSolrParams params;
if (!shardRequests.containsKey(rb.shards[i])) {
shardRequests.put(rb.shards[i], new ModifiableSolrParams());
}
params = shardRequests.get(rb.shards[i]);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_FIELD, list.field);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VALUE, list.queryValue);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_TYPE, list.queryType);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_PREFIX, list.queryPrefix);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_IGNORE, list.queryIgnore);
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH,
list.queryMaximumIgnoreLength);
int subRequestId = 0;
for (String name : list.queryVariables.keySet()) {
if (list.queryVariables.get(name) == null
|| list.queryVariables.get(name).length == 0) {
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME,
name);
subRequestId++;
} else {
for (String value : list.queryVariables.get(name)) {
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME, name);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE,
value);
subRequestId++;
}
}
}
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_KEY, list.key);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_PREFIX, list.prefix);
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_START, Integer.toString(start));
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_NUMBER,
Integer.toString(Math.min(number, (subTotal - start))));
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_LEFT, Integer.toString(list.left));
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_RIGHT, Integer.toString(list.right));
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_OUTPUT, list.output);
number -= (subTotal - start);
start = 0;
} else {
start -= subTotal;
}
}
}
}
}
for (Entry<String, ModifiableSolrParams> entry : shardRequests
.entrySet()) {
ShardRequest sreq = new ShardRequest();
sreq.shards = new String[] { entry.getKey() };
sreq.purpose = ShardRequest.PURPOSE_PRIVATE;
sreq.params = new ModifiableSolrParams();
sreq.params.add(CommonParams.FQ, rb.req.getParams().getParams(CommonParams.FQ));
sreq.params.add(CommonParams.Q, rb.req.getParams().getParams(CommonParams.Q));
sreq.params.add(CommonParams.CACHE, rb.req.getParams().getParams(CommonParams.CACHE));
sreq.params.add(CommonParams.ROWS, "0");
sreq.params.add(MtasSolrSearchComponent.PARAM_MTAS, rb.req
.getOriginalParams().getParams(MtasSolrSearchComponent.PARAM_MTAS));
sreq.params.add(PARAM_MTAS_LIST,
rb.req.getOriginalParams().getParams(PARAM_MTAS_LIST));
sreq.params.add(entry.getValue());
rb.addRequest(searchComponent, sreq);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void distributedProcess(ResponseBuilder rb,
ComponentFields mtasFields) {
if (mtasFields.doList) {
// compute total from shards
HashMap<String, HashMap<String, Integer>> listShardTotals = new HashMap<>();
for (ShardRequest sreq : rb.finished) {
if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
&& sreq.params.getBool(PARAM_MTAS_LIST, false)) {
for (ShardResponse response : sreq.responses) {
NamedList<Object> result = response.getSolrResponse().getResponse();
try {
ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) result
.findRecursive("mtas", NAME);
if (data != null) {
for (NamedList<Object> dataItem : data) {
Object key = dataItem.get("key");
Object total = dataItem.get("total");
if ((key != null) && (key instanceof String)
&& (total != null) && (total instanceof Integer)) {
if (!listShardTotals.containsKey(key)) {
listShardTotals.put((String) key,
new HashMap<String, Integer>()); // depends on control dependency: [if], data = [none]
}
HashMap<String, Integer> listShardTotal = listShardTotals
.get(key);
listShardTotal.put(response.getShard(), (Integer) total); // depends on control dependency: [if], data = [none]
}
}
}
} catch (ClassCastException e) {
log.debug(e);
} // depends on control dependency: [catch], data = [none]
}
}
}
// compute shard requests
HashMap<String, ModifiableSolrParams> shardRequests = new HashMap<>();
int requestId = 0;
for (String field : mtasFields.list.keySet()) {
for (ComponentList list : mtasFields.list.get(field).listList) {
requestId++; // depends on control dependency: [for], data = [none]
if (listShardTotals.containsKey(list.key) && (list.number > 0)) {
Integer start = list.start;
Integer number = list.number;
HashMap<String, Integer> totals = listShardTotals.get(list.key);
for (int i = 0; i < rb.shards.length; i++) {
if (number < 0) {
break;
}
int subTotal = totals.get(rb.shards[i]);
// System.out.println(i + " : " + rb.shards[i] + " : "
// + totals.get(rb.shards[i]) + " - " + start + " " + number);
if ((start >= 0) && (start < subTotal)) {
ModifiableSolrParams params;
if (!shardRequests.containsKey(rb.shards[i])) {
shardRequests.put(rb.shards[i], new ModifiableSolrParams()); // depends on control dependency: [if], data = [none]
}
params = shardRequests.get(rb.shards[i]); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_FIELD, list.field); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VALUE, list.queryValue); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_TYPE, list.queryType); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_PREFIX, list.queryPrefix); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_IGNORE, list.queryIgnore); // depends on control dependency: [if], data = [none]
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH,
list.queryMaximumIgnoreLength); // depends on control dependency: [if], data = [none]
int subRequestId = 0;
for (String name : list.queryVariables.keySet()) {
if (list.queryVariables.get(name) == null
|| list.queryVariables.get(name).length == 0) {
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME,
name); // depends on control dependency: [if], data = [none]
subRequestId++; // depends on control dependency: [if], data = [none]
} else {
for (String value : list.queryVariables.get(name)) {
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME, name); // depends on control dependency: [for], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_QUERY_VARIABLE + "." + subRequestId
+ "." + SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE,
value); // depends on control dependency: [for], data = [none]
subRequestId++; // depends on control dependency: [for], data = [none]
}
}
}
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_KEY, list.key); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_PREFIX, list.prefix); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_START, Integer.toString(start)); // depends on control dependency: [if], data = [none]
params.add(
PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_NUMBER,
Integer.toString(Math.min(number, (subTotal - start)))); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_LEFT, Integer.toString(list.left)); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_RIGHT, Integer.toString(list.right)); // depends on control dependency: [if], data = [none]
params.add(PARAM_MTAS_LIST + "." + requestId + "."
+ NAME_MTAS_LIST_OUTPUT, list.output); // depends on control dependency: [if], data = [none]
number -= (subTotal - start); // depends on control dependency: [if], data = [none]
start = 0; // depends on control dependency: [if], data = [none]
} else {
start -= subTotal; // depends on control dependency: [if], data = [none]
}
}
}
}
}
for (Entry<String, ModifiableSolrParams> entry : shardRequests
.entrySet()) {
ShardRequest sreq = new ShardRequest();
sreq.shards = new String[] { entry.getKey() }; // depends on control dependency: [for], data = [entry]
sreq.purpose = ShardRequest.PURPOSE_PRIVATE; // depends on control dependency: [for], data = [none]
sreq.params = new ModifiableSolrParams(); // depends on control dependency: [for], data = [none]
sreq.params.add(CommonParams.FQ, rb.req.getParams().getParams(CommonParams.FQ)); // depends on control dependency: [for], data = [none]
sreq.params.add(CommonParams.Q, rb.req.getParams().getParams(CommonParams.Q)); // depends on control dependency: [for], data = [none]
sreq.params.add(CommonParams.CACHE, rb.req.getParams().getParams(CommonParams.CACHE)); // depends on control dependency: [for], data = [none]
sreq.params.add(CommonParams.ROWS, "0"); // depends on control dependency: [for], data = [none]
sreq.params.add(MtasSolrSearchComponent.PARAM_MTAS, rb.req
.getOriginalParams().getParams(MtasSolrSearchComponent.PARAM_MTAS)); // depends on control dependency: [for], data = [none]
sreq.params.add(PARAM_MTAS_LIST,
rb.req.getOriginalParams().getParams(PARAM_MTAS_LIST)); // depends on control dependency: [for], data = [none]
sreq.params.add(entry.getValue()); // depends on control dependency: [for], data = [entry]
rb.addRequest(searchComponent, sreq); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void marshall(AutoScalingTargetTrackingScalingPolicyConfigurationDescription autoScalingTargetTrackingScalingPolicyConfigurationDescription,
ProtocolMarshaller protocolMarshaller) {
if (autoScalingTargetTrackingScalingPolicyConfigurationDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getDisableScaleIn(), DISABLESCALEIN_BINDING);
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getScaleInCooldown(), SCALEINCOOLDOWN_BINDING);
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getScaleOutCooldown(), SCALEOUTCOOLDOWN_BINDING);
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getTargetValue(), TARGETVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AutoScalingTargetTrackingScalingPolicyConfigurationDescription autoScalingTargetTrackingScalingPolicyConfigurationDescription,
ProtocolMarshaller protocolMarshaller) {
if (autoScalingTargetTrackingScalingPolicyConfigurationDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getDisableScaleIn(), DISABLESCALEIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getScaleInCooldown(), SCALEINCOOLDOWN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getScaleOutCooldown(), SCALEOUTCOOLDOWN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(autoScalingTargetTrackingScalingPolicyConfigurationDescription.getTargetValue(), TARGETVALUE_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 mapVarNodeToCliques(OpenBitSet[] nodeToCliques, int id, OpenBitSet clique) {
for ( int i = clique.nextSetBit(0); i >= 0; i = clique.nextSetBit( i + 1 ) ) {
OpenBitSet cliques = nodeToCliques[i];
if ( cliques == null ) {
cliques = new OpenBitSet();
nodeToCliques[i] = cliques;
}
cliques.set(id);
}
} } | public class class_name {
public void mapVarNodeToCliques(OpenBitSet[] nodeToCliques, int id, OpenBitSet clique) {
for ( int i = clique.nextSetBit(0); i >= 0; i = clique.nextSetBit( i + 1 ) ) {
OpenBitSet cliques = nodeToCliques[i];
if ( cliques == null ) {
cliques = new OpenBitSet(); // depends on control dependency: [if], data = [none]
nodeToCliques[i] = cliques; // depends on control dependency: [if], data = [none]
}
cliques.set(id); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static <T, R> boolean contains(Collection<T> data, R what, Function<T, R> function) {
if (data == null) return false;
for (T o : data) {
if (Utils.equal(function.apply(o), what)) {
return true;
}
}
return false;
} } | public class class_name {
public static <T, R> boolean contains(Collection<T> data, R what, Function<T, R> function) {
if (data == null) return false;
for (T o : data) {
if (Utils.equal(function.apply(o), what)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static void registerJStormSignalHandler() {
if (!OSInfo.isLinux()) {
LOG.info("Skip register signal for current OS");
return;
}
JStormSignalHandler instance = JStormSignalHandler.getInstance();
int[] signals = {
1, //SIGHUP
2, //SIGINT
//3, //Signal already used by VM or OS: SIGQUIT
//4, //Signal already used by VM or OS: SIGILL
5, //SIGTRAP
6, //SIGABRT
7, // SIGBUS
//8, //Signal already used by VM or OS: SIGFPE
//10, //Signal already used by VM or OS: SIGUSR1
//11, Signal already used by VM or OS: SIGSEGV
12, //SIGUSER2
14, //SIGALM
16, //SIGSTKFLT
};
for (int signal : signals) {
instance.registerSignal(signal, null, true);
}
} } | public class class_name {
public static void registerJStormSignalHandler() {
if (!OSInfo.isLinux()) {
LOG.info("Skip register signal for current OS"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
JStormSignalHandler instance = JStormSignalHandler.getInstance();
int[] signals = {
1, //SIGHUP
2, //SIGINT
//3, //Signal already used by VM or OS: SIGQUIT
//4, //Signal already used by VM or OS: SIGILL
5, //SIGTRAP
6, //SIGABRT
7, // SIGBUS
//8, //Signal already used by VM or OS: SIGFPE
//10, //Signal already used by VM or OS: SIGUSR1
//11, Signal already used by VM or OS: SIGSEGV
12, //SIGUSER2
14, //SIGALM
16, //SIGSTKFLT
};
for (int signal : signals) {
instance.registerSignal(signal, null, true); // depends on control dependency: [for], data = [signal]
}
} } |
public class class_name {
public static ColumnIO getArrayElementColumn(ColumnIO columnIO)
{
while (columnIO instanceof GroupColumnIO && !columnIO.getType().isRepetition(REPEATED)) {
columnIO = ((GroupColumnIO) columnIO).getChild(0);
}
/* If array has a standard 3-level structure with middle level repeated group with a single field:
* optional group my_list (LIST) {
* repeated group element {
* required binary str (UTF8);
* };
* }
*/
if (columnIO instanceof GroupColumnIO &&
columnIO.getType().getOriginalType() == null &&
((GroupColumnIO) columnIO).getChildrenCount() == 1 &&
!columnIO.getName().equals("array") &&
!columnIO.getName().equals(columnIO.getParent().getName() + "_tuple")) {
return ((GroupColumnIO) columnIO).getChild(0);
}
/* Backward-compatibility support for 2-level arrays where a repeated field is not a group:
* optional group my_list (LIST) {
* repeated int32 element;
* }
*/
return columnIO;
} } | public class class_name {
public static ColumnIO getArrayElementColumn(ColumnIO columnIO)
{
while (columnIO instanceof GroupColumnIO && !columnIO.getType().isRepetition(REPEATED)) {
columnIO = ((GroupColumnIO) columnIO).getChild(0); // depends on control dependency: [while], data = [none]
}
/* If array has a standard 3-level structure with middle level repeated group with a single field:
* optional group my_list (LIST) {
* repeated group element {
* required binary str (UTF8);
* };
* }
*/
if (columnIO instanceof GroupColumnIO &&
columnIO.getType().getOriginalType() == null &&
((GroupColumnIO) columnIO).getChildrenCount() == 1 &&
!columnIO.getName().equals("array") &&
!columnIO.getName().equals(columnIO.getParent().getName() + "_tuple")) {
return ((GroupColumnIO) columnIO).getChild(0); // depends on control dependency: [if], data = [none]
}
/* Backward-compatibility support for 2-level arrays where a repeated field is not a group:
* optional group my_list (LIST) {
* repeated int32 element;
* }
*/
return columnIO;
} } |
public class class_name {
protected void resetValue(Attribute attribute) {
String initValue = "";
if (m_initialImageAttributes.containsKey(attribute.name())) {
initValue = m_initialImageAttributes.getString(attribute.name());
}
if (m_fields.containsKey(attribute)) {
m_fields.get(attribute).setFormValueAsString(initValue);
}
} } | public class class_name {
protected void resetValue(Attribute attribute) {
String initValue = "";
if (m_initialImageAttributes.containsKey(attribute.name())) {
initValue = m_initialImageAttributes.getString(attribute.name()); // depends on control dependency: [if], data = [none]
}
if (m_fields.containsKey(attribute)) {
m_fields.get(attribute).setFormValueAsString(initValue); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void resizeBuckets (int newsize)
{
Record<V>[] oldbuckets = _buckets;
_buckets = createBuckets(newsize);
// we shuffle the records around without allocating new ones
int index = oldbuckets.length;
while (index-- > 0) {
Record<V> oldrec = oldbuckets[index];
while (oldrec != null) {
Record<V> newrec = oldrec;
oldrec = oldrec.next;
// always put the newrec at the start of a chain
int newdex = keyToIndex(newrec.key);
newrec.next = _buckets[newdex];
_buckets[newdex] = newrec;
}
}
} } | public class class_name {
protected void resizeBuckets (int newsize)
{
Record<V>[] oldbuckets = _buckets;
_buckets = createBuckets(newsize);
// we shuffle the records around without allocating new ones
int index = oldbuckets.length;
while (index-- > 0) {
Record<V> oldrec = oldbuckets[index];
while (oldrec != null) {
Record<V> newrec = oldrec;
oldrec = oldrec.next; // depends on control dependency: [while], data = [none]
// always put the newrec at the start of a chain
int newdex = keyToIndex(newrec.key);
newrec.next = _buckets[newdex]; // depends on control dependency: [while], data = [none]
_buckets[newdex] = newrec; // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
private boolean constructorHasMatchingParams(
TypeLiteral<?> type, Constructor<?> constructor, List<Key<?>> paramList, Errors errors)
throws ErrorsException {
List<TypeLiteral<?>> params = type.getParameterTypes(constructor);
Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
int p = 0;
List<Key<?>> constructorKeys = Lists.newArrayList();
for (TypeLiteral<?> param : params) {
Key<?> paramKey = Annotations.getKey(param, constructor, paramAnnotations[p++], errors);
constructorKeys.add(paramKey);
}
// Require that every key exist in the constructor to match up exactly.
for (Key<?> key : paramList) {
// If it didn't exist in the constructor set, we can't use it.
if (!constructorKeys.remove(key)) {
return false;
}
}
// If any keys remain and their annotation is Assisted, we can't use it.
for (Key<?> key : constructorKeys) {
if (key.getAnnotationType() == Assisted.class) {
return false;
}
}
// All @Assisted params match up to the method's parameters.
return true;
} } | public class class_name {
private boolean constructorHasMatchingParams(
TypeLiteral<?> type, Constructor<?> constructor, List<Key<?>> paramList, Errors errors)
throws ErrorsException {
List<TypeLiteral<?>> params = type.getParameterTypes(constructor);
Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
int p = 0;
List<Key<?>> constructorKeys = Lists.newArrayList();
for (TypeLiteral<?> param : params) {
Key<?> paramKey = Annotations.getKey(param, constructor, paramAnnotations[p++], errors);
constructorKeys.add(paramKey);
}
// Require that every key exist in the constructor to match up exactly.
for (Key<?> key : paramList) {
// If it didn't exist in the constructor set, we can't use it.
if (!constructorKeys.remove(key)) {
return false; // depends on control dependency: [if], data = [none]
}
}
// If any keys remain and their annotation is Assisted, we can't use it.
for (Key<?> key : constructorKeys) {
if (key.getAnnotationType() == Assisted.class) {
return false; // depends on control dependency: [if], data = [none]
}
}
// All @Assisted params match up to the method's parameters.
return true;
} } |
public class class_name {
public ReportRequest[] clear() {
if (cache == null) {
return NO_REQUESTS;
}
synchronized (cache) {
ReportRequest[] res = generatedFlushRequests(cache.asMap().values());
cache.invalidateAll();
out.clear();
return res;
}
} } | public class class_name {
public ReportRequest[] clear() {
if (cache == null) {
return NO_REQUESTS; // depends on control dependency: [if], data = [none]
}
synchronized (cache) {
ReportRequest[] res = generatedFlushRequests(cache.asMap().values());
cache.invalidateAll();
out.clear();
return res;
}
} } |
public class class_name {
private static void reverseRange(Object[] a, int lo, int hi) {
hi--;
while (lo < hi) {
Object t = a[lo];
a[lo++] = a[hi];
a[hi--] = t;
}
} } | public class class_name {
private static void reverseRange(Object[] a, int lo, int hi) {
hi--;
while (lo < hi) {
Object t = a[lo];
a[lo++] = a[hi]; // depends on control dependency: [while], data = [none]
a[hi--] = t; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
@Override
public void activate(ComponentContext context,
Map<String, Object> properties, ConfigurationAdmin configAdmin) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "activate", new Object[] { context, properties,
configAdmin });
}
try {
// set ME state to starting
_state = ME_STATE.STARTING.toString();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(this, tc, "Starting the JMS server.");
}
// initilize config object
initialize(context, properties, configAdmin);
_jsMainImpl = new JsMainImpl(context.getBundleContext());
_jsMainImpl.initialize(jsMEConfig);
_jsMainImpl.start();
// If its here it means all the components have started hence set
// the state to STARTED
_state = ME_STATE.STARTED.toString();
SibTr.info(tc, "ME_STARTED_SIAS0108");
} catch (InvalidFileStoreConfigurationException ifs) {
// since there is exception in starting ME the state is set to
// STOPPED
_state = ME_STATE.STOPPED.toString();
SibTr.error(tc, "ME_STOPPED_SIAS0109");
SibTr.exception(tc, ifs);
FFDCFilter.processException(ifs,
"com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
"132", this);
} catch (Exception e) {
// since there is exception in starting ME the state is set to
// STOPPED
_state = ME_STATE.STOPPED.toString();
SibTr.error(tc, "ME_STOPPED_SIAS0109");
SibTr.exception(tc, e);
FFDCFilter.processException(e,
"com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
"139", this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, "activate");
}
} } | public class class_name {
@Override
public void activate(ComponentContext context,
Map<String, Object> properties, ConfigurationAdmin configAdmin) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, "activate", new Object[] { context, properties,
configAdmin }); // depends on control dependency: [if], data = [none]
}
try {
// set ME state to starting
_state = ME_STATE.STARTING.toString(); // depends on control dependency: [try], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(this, tc, "Starting the JMS server."); // depends on control dependency: [if], data = [none]
}
// initilize config object
initialize(context, properties, configAdmin); // depends on control dependency: [try], data = [none]
_jsMainImpl = new JsMainImpl(context.getBundleContext()); // depends on control dependency: [try], data = [none]
_jsMainImpl.initialize(jsMEConfig); // depends on control dependency: [try], data = [none]
_jsMainImpl.start(); // depends on control dependency: [try], data = [none]
// If its here it means all the components have started hence set
// the state to STARTED
_state = ME_STATE.STARTED.toString(); // depends on control dependency: [try], data = [none]
SibTr.info(tc, "ME_STARTED_SIAS0108"); // depends on control dependency: [try], data = [none]
} catch (InvalidFileStoreConfigurationException ifs) {
// since there is exception in starting ME the state is set to
// STOPPED
_state = ME_STATE.STOPPED.toString();
SibTr.error(tc, "ME_STOPPED_SIAS0109");
SibTr.exception(tc, ifs);
FFDCFilter.processException(ifs,
"com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
"132", this);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
// since there is exception in starting ME the state is set to
// STOPPED
_state = ME_STATE.STOPPED.toString();
SibTr.error(tc, "ME_STOPPED_SIAS0109");
SibTr.exception(tc, e);
FFDCFilter.processException(e,
"com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
"139", this);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, "activate"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public JsMessage getMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMessage");
// We hold a reference to the root JsMessage so that an individual subscription
// can choose to release its reference to it withour wiping it out for all the
// others.
// Try to get hold of the reference without using a lock, if that works then great...
JsMessage localMsg = jsMsg;
// Otherwise we need to lock it down and retrieve the message from the root message
// (who may need to restore it from the MsgStore)
if (localMsg == null)
{
synchronized (this)
{
jsMsg = getMessageItem().getMessage();
localMsg = jsMsg;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessage", localMsg);
return localMsg;
} } | public class class_name {
@Override
public JsMessage getMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getMessage");
// We hold a reference to the root JsMessage so that an individual subscription
// can choose to release its reference to it withour wiping it out for all the
// others.
// Try to get hold of the reference without using a lock, if that works then great...
JsMessage localMsg = jsMsg;
// Otherwise we need to lock it down and retrieve the message from the root message
// (who may need to restore it from the MsgStore)
if (localMsg == null)
{
synchronized (this) // depends on control dependency: [if], data = [none]
{
jsMsg = getMessageItem().getMessage();
localMsg = jsMsg;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getMessage", localMsg);
return localMsg;
} } |
public class class_name {
protected final String createJpqlStreamSelect(final StreamId streamId) {
if (streamId.isProjection()) {
throw new IllegalArgumentException("Projections do not have a stream table : " + streamId);
}
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
// NoParamsStream
params.add(new KeyValue("streamName", streamId.getName()));
}
final StringBuilder sb = new StringBuilder("SELECT t FROM " + streamEntityName(streamId) + " t");
sb.append(" WHERE ");
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
if (i > 0) {
sb.append(" AND ");
}
sb.append("t." + param.getKey() + "=:" + param.getKey());
}
return sb.toString();
} } | public class class_name {
protected final String createJpqlStreamSelect(final StreamId streamId) {
if (streamId.isProjection()) {
throw new IllegalArgumentException("Projections do not have a stream table : " + streamId);
}
final List<KeyValue> params = new ArrayList<>(streamId.getParameters());
if (params.size() == 0) {
// NoParamsStream
params.add(new KeyValue("streamName", streamId.getName()));
// depends on control dependency: [if], data = [none]
}
final StringBuilder sb = new StringBuilder("SELECT t FROM " + streamEntityName(streamId) + " t");
sb.append(" WHERE ");
for (int i = 0; i < params.size(); i++) {
final KeyValue param = params.get(i);
if (i > 0) {
sb.append(" AND ");
// depends on control dependency: [if], data = [none]
}
sb.append("t." + param.getKey() + "=:" + param.getKey());
// depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
@Override
public void setZIndex(float zIndex) {
if (polyline != null) {
polyline.setZIndex(zIndex);
}
for (Marker marker : markers) {
marker.setZIndex(zIndex);
}
} } | public class class_name {
@Override
public void setZIndex(float zIndex) {
if (polyline != null) {
polyline.setZIndex(zIndex); // depends on control dependency: [if], data = [none]
}
for (Marker marker : markers) {
marker.setZIndex(zIndex); // depends on control dependency: [for], data = [marker]
}
} } |
public class class_name {
@Override
public EClass getIfcValve() {
if (ifcValveEClass == null) {
ifcValveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(747);
}
return ifcValveEClass;
} } | public class class_name {
@Override
public EClass getIfcValve() {
if (ifcValveEClass == null) {
ifcValveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(747);
// depends on control dependency: [if], data = [none]
}
return ifcValveEClass;
} } |
public class class_name {
protected void setSkipKey(int line, int col, String reason) {
if (key == null) {
key = new DocumentURIWithSourceInfo("", srcId, subId, line, col);
} else {
key.setUri("");
key.setSrcId(srcId);
key.setSubId(subId);
key.setColNumber(col);
key.setLineNumber(line);
}
key.setSkipReason(reason);
if (LOG.isTraceEnabled()) {
LOG.trace("Set key: " + key);
}
} } | public class class_name {
protected void setSkipKey(int line, int col, String reason) {
if (key == null) {
key = new DocumentURIWithSourceInfo("", srcId, subId, line, col); // depends on control dependency: [if], data = [none]
} else {
key.setUri(""); // depends on control dependency: [if], data = [none]
key.setSrcId(srcId); // depends on control dependency: [if], data = [none]
key.setSubId(subId); // depends on control dependency: [if], data = [none]
key.setColNumber(col); // depends on control dependency: [if], data = [none]
key.setLineNumber(line); // depends on control dependency: [if], data = [none]
}
key.setSkipReason(reason);
if (LOG.isTraceEnabled()) {
LOG.trace("Set key: " + key); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static JavaClasspathTab getClasspathTab(ILaunchConfigurationDialog dialog) {
JavaClasspathTab tab = null;
if (dialog instanceof LaunchConfigurationsDialog) {
final LaunchConfigurationTabGroupViewer tabViewer = ((LaunchConfigurationsDialog) dialog).getTabViewer();
if (tabViewer != null) {
final Object input = tabViewer.getInput();
if (input instanceof ILaunchConfiguration) {
final ILaunchConfiguration configuration = (ILaunchConfiguration) input;
if (JavaRuntime.isModularConfiguration(configuration)) {
tab = new JavaDependenciesTab();
}
}
}
}
if (tab == null) {
tab = new JavaClasspathTab();
}
return tab;
} } | public class class_name {
protected static JavaClasspathTab getClasspathTab(ILaunchConfigurationDialog dialog) {
JavaClasspathTab tab = null;
if (dialog instanceof LaunchConfigurationsDialog) {
final LaunchConfigurationTabGroupViewer tabViewer = ((LaunchConfigurationsDialog) dialog).getTabViewer();
if (tabViewer != null) {
final Object input = tabViewer.getInput();
if (input instanceof ILaunchConfiguration) {
final ILaunchConfiguration configuration = (ILaunchConfiguration) input;
if (JavaRuntime.isModularConfiguration(configuration)) {
tab = new JavaDependenciesTab(); // depends on control dependency: [if], data = [none]
}
}
}
}
if (tab == null) {
tab = new JavaClasspathTab(); // depends on control dependency: [if], data = [none]
}
return tab;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.