code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static List<Resource> getChildrenByType(final Resource resource, List<String> typeSet) {
final ArrayList<Resource> children = new ArrayList<>();
if (resource != null) {
for (final Resource child : resource.getChildren()) {
for (String type : typeSet) {
if (isResourceType(child, type)) {
children.add(child);
break;
}
}
}
}
return children;
} }
|
public class class_name {
public static List<Resource> getChildrenByType(final Resource resource, List<String> typeSet) {
final ArrayList<Resource> children = new ArrayList<>();
if (resource != null) {
for (final Resource child : resource.getChildren()) {
for (String type : typeSet) {
if (isResourceType(child, type)) {
children.add(child); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
return children;
} }
|
public class class_name {
@Override
public double getValue(Pin pin) {
// if we are not actively monitoring the ADC input values,
// then interrogate the ADC chip and return the acquired input conversion value
if(monitor == null) {
// do not return, only let parent handle whether this pin is OK
super.getValue(pin);
try {
return getImmediateValue(pin);
} catch (IOException e) {
return INVALID_VALUE;
}
}
else{
// if we are actively monitoring the ADC input values,
// the simply return the last cached input value
return super.getValue(pin);
}
} }
|
public class class_name {
@Override
public double getValue(Pin pin) {
// if we are not actively monitoring the ADC input values,
// then interrogate the ADC chip and return the acquired input conversion value
if(monitor == null) {
// do not return, only let parent handle whether this pin is OK
super.getValue(pin); // depends on control dependency: [if], data = [none]
try {
return getImmediateValue(pin); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return INVALID_VALUE;
} // depends on control dependency: [catch], data = [none]
}
else{
// if we are actively monitoring the ADC input values,
// the simply return the last cached input value
return super.getValue(pin); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void executeOpen(boolean fireEvents) {
m_styleVar.setValue(m_open ? CSS.listTreeItemOpen() : CSS.listTreeItemClosed());
setLeafStyle(false);
m_children.getElement().getStyle().clearDisplay();
if (m_opener.isDown() != m_open) {
m_opener.setDown(m_open);
}
if (fireEvents) {
if (m_open) {
fireOpen();
} else {
fireClose();
}
}
// reset the leaf style according to the child count
setLeafStyle(0 == getChildCount());
} }
|
public class class_name {
protected void executeOpen(boolean fireEvents) {
m_styleVar.setValue(m_open ? CSS.listTreeItemOpen() : CSS.listTreeItemClosed());
setLeafStyle(false);
m_children.getElement().getStyle().clearDisplay();
if (m_opener.isDown() != m_open) {
m_opener.setDown(m_open); // depends on control dependency: [if], data = [m_open)]
}
if (fireEvents) {
if (m_open) {
fireOpen(); // depends on control dependency: [if], data = [none]
} else {
fireClose(); // depends on control dependency: [if], data = [none]
}
}
// reset the leaf style according to the child count
setLeafStyle(0 == getChildCount());
} }
|
public class class_name {
void set(int id, boolean bit)
{
if (bit)
{
_units.set(id / UNIT_SIZE, _units.get(id / UNIT_SIZE)
| 1 << (id % UNIT_SIZE));
}
} }
|
public class class_name {
void set(int id, boolean bit)
{
if (bit)
{
_units.set(id / UNIT_SIZE, _units.get(id / UNIT_SIZE)
| 1 << (id % UNIT_SIZE)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SafeVarargs
public static <T> MutableList<T> mutableVec(T... items) {
MutableList<T> ret = PersistentVector.emptyMutable();
if (items == null) { return ret; }
for (T t : items) {
ret.append(t);
}
return ret;
} }
|
public class class_name {
@SafeVarargs
public static <T> MutableList<T> mutableVec(T... items) {
MutableList<T> ret = PersistentVector.emptyMutable();
if (items == null) { return ret; } // depends on control dependency: [if], data = [none]
for (T t : items) {
ret.append(t); // depends on control dependency: [for], data = [t]
}
return ret;
} }
|
public class class_name {
protected void initWorkplaceMembers(CmsJspActionElement jsp) {
if (jsp != null) {
m_jsp = jsp;
initWorkplaceMembers(m_jsp.getCmsObject(), m_jsp.getRequest().getSession());
}
} }
|
public class class_name {
protected void initWorkplaceMembers(CmsJspActionElement jsp) {
if (jsp != null) {
m_jsp = jsp; // depends on control dependency: [if], data = [none]
initWorkplaceMembers(m_jsp.getCmsObject(), m_jsp.getRequest().getSession()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
static final CompactSketch heapify2to3(final Memory srcMem, final long seed) {
final int memCap = (int) srcMem.getCapacity();
final short seedHash = Util.computeSeedHash(seed);
final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT);
Util.checkSeedHashes(seedHash, memSeedHash);
if (memCap == 8) { //return empty, theta = 1.0
return HeapCompactOrderedSketch
.compact(new long[0], true, seedHash, 0, Long.MAX_VALUE);
}
final int curCount = srcMem.getInt(RETAINED_ENTRIES_INT);
//Note: curCount could be zero and theta < 1.0 and be empty or not-empty.
final int mdLongs = srcMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F; //either 2 or 3
final int reqBytesIn = (curCount + mdLongs) << 3;
validateInputSize(reqBytesIn, memCap);
final long thetaLong = (mdLongs < 3) ? Long.MAX_VALUE : srcMem.getLong(THETA_LONG);
boolean empty = (srcMem.getByte(FLAGS_BYTE) & EMPTY_FLAG_MASK) != 0;
empty = (curCount == 0) && (thetaLong == Long.MAX_VALUE); //force true
final long[] compactOrderedCache = new long[curCount];
srcMem.getLongArray(mdLongs << 3, compactOrderedCache, 0, curCount);
return HeapCompactOrderedSketch
.compact(compactOrderedCache, empty, seedHash, curCount, thetaLong);
} }
|
public class class_name {
static final CompactSketch heapify2to3(final Memory srcMem, final long seed) {
final int memCap = (int) srcMem.getCapacity();
final short seedHash = Util.computeSeedHash(seed);
final short memSeedHash = srcMem.getShort(SEED_HASH_SHORT);
Util.checkSeedHashes(seedHash, memSeedHash);
if (memCap == 8) { //return empty, theta = 1.0
return HeapCompactOrderedSketch
.compact(new long[0], true, seedHash, 0, Long.MAX_VALUE); // depends on control dependency: [if], data = [none]
}
final int curCount = srcMem.getInt(RETAINED_ENTRIES_INT);
//Note: curCount could be zero and theta < 1.0 and be empty or not-empty.
final int mdLongs = srcMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F; //either 2 or 3
final int reqBytesIn = (curCount + mdLongs) << 3;
validateInputSize(reqBytesIn, memCap);
final long thetaLong = (mdLongs < 3) ? Long.MAX_VALUE : srcMem.getLong(THETA_LONG);
boolean empty = (srcMem.getByte(FLAGS_BYTE) & EMPTY_FLAG_MASK) != 0;
empty = (curCount == 0) && (thetaLong == Long.MAX_VALUE); //force true
final long[] compactOrderedCache = new long[curCount];
srcMem.getLongArray(mdLongs << 3, compactOrderedCache, 0, curCount);
return HeapCompactOrderedSketch
.compact(compactOrderedCache, empty, seedHash, curCount, thetaLong);
} }
|
public class class_name {
private static int findStaticWindow(int c)
{
// supposedly faster to count down
//for(int i = 0; i < NUMSTATICWINDOWS; i++) {
for(int i = NUMSTATICWINDOWS - 1; i >= 0; --i) {
if(inStaticWindow(c, i)) {
return i;
}
}
return INVALIDWINDOW;
} }
|
public class class_name {
private static int findStaticWindow(int c)
{
// supposedly faster to count down
//for(int i = 0; i < NUMSTATICWINDOWS; i++) {
for(int i = NUMSTATICWINDOWS - 1; i >= 0; --i) {
if(inStaticWindow(c, i)) {
return i; // depends on control dependency: [if], data = [none]
}
}
return INVALIDWINDOW;
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public static SarlLibraryErrorCode getSARLLibraryVersionOnClasspath(TypeReferences typeReferences, Notifier context,
OutParameter<String> version) {
if (checkSarlVersionClass) {
checkSarlVersionClass = false;
try {
final Object v = SARLVersion.class.getDeclaredField(SARL_VERSION_FIELD_NAME_STR);
if (v == null) {
return SarlLibraryErrorCode.INVALID_SARL_VERSION_BYTECODE;
}
} catch (Throwable e) {
return SarlLibraryErrorCode.INVALID_SARL_VERSION_BYTECODE;
}
}
final JvmType type;
try {
type = typeReferences.findDeclaredType(SARLVersion.class, context);
} catch (Throwable exception) {
return SarlLibraryErrorCode.NO_SARL_VERSION_CLASS;
}
if (type == null) {
return SarlLibraryErrorCode.NO_SARL_VERSION_CLASS;
}
if (!(type instanceof JvmDeclaredType)) {
return SarlLibraryErrorCode.NO_SARL_VERSION_DECLARED_TYPE;
}
final JvmDeclaredType sarlVersionType = (JvmDeclaredType) type;
JvmField versionField = null;
final Iterator<JvmField> iterator = sarlVersionType.getDeclaredFields().iterator();
while (versionField == null && iterator.hasNext()) {
final JvmField field = iterator.next();
if (SARL_VERSION_FIELD_NAME_STR.equals(field.getSimpleName())) {
versionField = field;
}
}
if (versionField == null) {
return SarlLibraryErrorCode.NO_SARL_VERSION_FIELD;
}
final String value = versionField.getConstantValueAsString();
if (Strings.isNullOrEmpty(value)) {
return SarlLibraryErrorCode.NO_SARL_VERSION_VALUE;
}
if (version != null) {
version.set(value);
}
return SarlLibraryErrorCode.SARL_FOUND;
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public static SarlLibraryErrorCode getSARLLibraryVersionOnClasspath(TypeReferences typeReferences, Notifier context,
OutParameter<String> version) {
if (checkSarlVersionClass) {
checkSarlVersionClass = false; // depends on control dependency: [if], data = [none]
try {
final Object v = SARLVersion.class.getDeclaredField(SARL_VERSION_FIELD_NAME_STR);
if (v == null) {
return SarlLibraryErrorCode.INVALID_SARL_VERSION_BYTECODE; // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
return SarlLibraryErrorCode.INVALID_SARL_VERSION_BYTECODE;
} // depends on control dependency: [catch], data = [none]
}
final JvmType type;
try {
type = typeReferences.findDeclaredType(SARLVersion.class, context); // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
return SarlLibraryErrorCode.NO_SARL_VERSION_CLASS;
} // depends on control dependency: [catch], data = [none]
if (type == null) {
return SarlLibraryErrorCode.NO_SARL_VERSION_CLASS; // depends on control dependency: [if], data = [none]
}
if (!(type instanceof JvmDeclaredType)) {
return SarlLibraryErrorCode.NO_SARL_VERSION_DECLARED_TYPE; // depends on control dependency: [if], data = [none]
}
final JvmDeclaredType sarlVersionType = (JvmDeclaredType) type;
JvmField versionField = null;
final Iterator<JvmField> iterator = sarlVersionType.getDeclaredFields().iterator();
while (versionField == null && iterator.hasNext()) {
final JvmField field = iterator.next();
if (SARL_VERSION_FIELD_NAME_STR.equals(field.getSimpleName())) {
versionField = field; // depends on control dependency: [if], data = [none]
}
}
if (versionField == null) {
return SarlLibraryErrorCode.NO_SARL_VERSION_FIELD; // depends on control dependency: [if], data = [none]
}
final String value = versionField.getConstantValueAsString();
if (Strings.isNullOrEmpty(value)) {
return SarlLibraryErrorCode.NO_SARL_VERSION_VALUE; // depends on control dependency: [if], data = [none]
}
if (version != null) {
version.set(value); // depends on control dependency: [if], data = [none]
}
return SarlLibraryErrorCode.SARL_FOUND;
} }
|
public class class_name {
private GraphicalIndicatorCriteria processCriteria(FieldType type)
{
GraphicalIndicatorCriteria criteria = new GraphicalIndicatorCriteria(m_properties);
criteria.setLeftValue(type);
int indicatorType = MPPUtility.getInt(m_data, m_dataOffset);
m_dataOffset += 4;
criteria.setIndicator(indicatorType);
if (m_dataOffset + 4 < m_data.length)
{
int operatorValue = MPPUtility.getInt(m_data, m_dataOffset);
m_dataOffset += 4;
TestOperator operator = (operatorValue == 0 ? TestOperator.IS_ANY_VALUE : TestOperator.getInstance(operatorValue - 0x3E7));
criteria.setOperator(operator);
if (operator != TestOperator.IS_ANY_VALUE)
{
processOperandValue(0, type, criteria);
if (operator == TestOperator.IS_WITHIN || operator == TestOperator.IS_NOT_WITHIN)
{
processOperandValue(1, type, criteria);
}
}
}
return (criteria);
} }
|
public class class_name {
private GraphicalIndicatorCriteria processCriteria(FieldType type)
{
GraphicalIndicatorCriteria criteria = new GraphicalIndicatorCriteria(m_properties);
criteria.setLeftValue(type);
int indicatorType = MPPUtility.getInt(m_data, m_dataOffset);
m_dataOffset += 4;
criteria.setIndicator(indicatorType);
if (m_dataOffset + 4 < m_data.length)
{
int operatorValue = MPPUtility.getInt(m_data, m_dataOffset);
m_dataOffset += 4; // depends on control dependency: [if], data = [none]
TestOperator operator = (operatorValue == 0 ? TestOperator.IS_ANY_VALUE : TestOperator.getInstance(operatorValue - 0x3E7));
criteria.setOperator(operator); // depends on control dependency: [if], data = [none]
if (operator != TestOperator.IS_ANY_VALUE)
{
processOperandValue(0, type, criteria); // depends on control dependency: [if], data = [none]
if (operator == TestOperator.IS_WITHIN || operator == TestOperator.IS_NOT_WITHIN)
{
processOperandValue(1, type, criteria); // depends on control dependency: [if], data = [none]
}
}
}
return (criteria);
} }
|
public class class_name {
public ArrayList<String> tokenize(String exp)
{
ArrayList<String> tokens = new ArrayList<>();
Stack<String> stack = new Stack<>();
for(int i = 0; i < exp.length(); i++)
{
String token = "";
if(isOperator(exp.substring(i, i + 1)) || exp.substring(i, i + 1).equals("$")) {
token = exp.substring(i, i + 1);
while ((!stack.isEmpty() && (isOperator(stack.peek()) || stack.peek().equals("$")))
&& ((isLeftAssociative(token) && getPrecedence(token) <= getPrecedence(stack.peek()))
|| (!isLeftAssociative(token) && getPrecedence(token) < getPrecedence(stack.peek())))) {
tokens.add(stack.pop());
}
stack.push(token);
}
else if(exp.substring(i, i + 1).equals(var)) {
token = var;
tokens.add(token);
}
else if(exp.substring(i, i + 1).equals("(")) {
token = exp.substring(i, i + 1);
stack.push(token);
}
else if(exp.substring(i, i + 1).equals(")")) {
while(!stack.isEmpty() && !stack.peek().equals("(")) {
tokens.add(stack.pop());
}
if(!stack.isEmpty())
stack.pop();
if(!stack.isEmpty() && isFunction(stack.peek())) {
tokens.add(stack.pop());
}
}
else if(exp.substring(i, i + 1).matches("[0-9]+")) {
while(i < exp.length() && exp.substring(i, i + 1).matches("[0-9]+")) {
token += exp.substring(i, i + 1);
i++;
}
tokens.add(token);
i--; // i was left incremented after the while loop
}
else if(exp.substring(i, i + 1).equals(var)) {
tokens.add(token);
}
else {
while(i < exp.length() && exp.substring(i, i + 1).matches("[a-zA-Z]+")) {
token += exp.substring(i, i + 1);
i++;
}
if(token.length() != 0) {
stack.push(token);
}
}
}
while(!stack.isEmpty()) {
tokens.add(stack.pop());
}
System.out.println(tokens);
return tokens;
} }
|
public class class_name {
public ArrayList<String> tokenize(String exp)
{
ArrayList<String> tokens = new ArrayList<>();
Stack<String> stack = new Stack<>();
for(int i = 0; i < exp.length(); i++)
{
String token = "";
if(isOperator(exp.substring(i, i + 1)) || exp.substring(i, i + 1).equals("$")) {
token = exp.substring(i, i + 1); // depends on control dependency: [if], data = [none]
while ((!stack.isEmpty() && (isOperator(stack.peek()) || stack.peek().equals("$")))
&& ((isLeftAssociative(token) && getPrecedence(token) <= getPrecedence(stack.peek()))
|| (!isLeftAssociative(token) && getPrecedence(token) < getPrecedence(stack.peek())))) {
tokens.add(stack.pop()); // depends on control dependency: [while], data = [none]
}
stack.push(token); // depends on control dependency: [if], data = [none]
}
else if(exp.substring(i, i + 1).equals(var)) {
token = var; // depends on control dependency: [if], data = [none]
tokens.add(token); // depends on control dependency: [if], data = [none]
}
else if(exp.substring(i, i + 1).equals("(")) {
token = exp.substring(i, i + 1); // depends on control dependency: [if], data = [none]
stack.push(token); // depends on control dependency: [if], data = [none]
}
else if(exp.substring(i, i + 1).equals(")")) {
while(!stack.isEmpty() && !stack.peek().equals("(")) {
tokens.add(stack.pop()); // depends on control dependency: [while], data = [none]
}
if(!stack.isEmpty())
stack.pop();
if(!stack.isEmpty() && isFunction(stack.peek())) {
tokens.add(stack.pop()); // depends on control dependency: [if], data = [none]
}
}
else if(exp.substring(i, i + 1).matches("[0-9]+")) {
while(i < exp.length() && exp.substring(i, i + 1).matches("[0-9]+")) {
token += exp.substring(i, i + 1); // depends on control dependency: [while], data = [(i]
i++; // depends on control dependency: [while], data = [none]
}
tokens.add(token); // depends on control dependency: [if], data = [none]
i--; // i was left incremented after the while loop // depends on control dependency: [if], data = [none]
}
else if(exp.substring(i, i + 1).equals(var)) {
tokens.add(token); // depends on control dependency: [if], data = [none]
}
else {
while(i < exp.length() && exp.substring(i, i + 1).matches("[a-zA-Z]+")) {
token += exp.substring(i, i + 1); // depends on control dependency: [while], data = [(i]
i++; // depends on control dependency: [while], data = [none]
}
if(token.length() != 0) {
stack.push(token); // depends on control dependency: [if], data = [none]
}
}
}
while(!stack.isEmpty()) {
tokens.add(stack.pop()); // depends on control dependency: [while], data = [none]
}
System.out.println(tokens);
return tokens;
} }
|
public class class_name {
public static boolean validate(@Nullable Subscription current, Subscription next) {
Objects.requireNonNull(next, "Subscription cannot be null");
if (current != null) {
next.cancel();
//reportSubscriptionSet();
return false;
}
return true;
} }
|
public class class_name {
public static boolean validate(@Nullable Subscription current, Subscription next) {
Objects.requireNonNull(next, "Subscription cannot be null");
if (current != null) {
next.cancel(); // depends on control dependency: [if], data = [none]
//reportSubscriptionSet();
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
@View(name = "by_username", map = "function(doc) { if(doc.secretKey) { emit(doc.username, doc) } }")
public CouchDbGoogleAuthenticatorAccount findOneByUsername(final String username) {
val view = createQuery("by_username").key(username).limit(1);
try {
return db.queryView(view, CouchDbGoogleAuthenticatorAccount.class).stream().findFirst().orElse(null);
} catch (final DocumentNotFoundException ignored) {
return null;
}
} }
|
public class class_name {
@View(name = "by_username", map = "function(doc) { if(doc.secretKey) { emit(doc.username, doc) } }")
public CouchDbGoogleAuthenticatorAccount findOneByUsername(final String username) {
val view = createQuery("by_username").key(username).limit(1);
try {
return db.queryView(view, CouchDbGoogleAuthenticatorAccount.class).stream().findFirst().orElse(null); // depends on control dependency: [try], data = [none]
} catch (final DocumentNotFoundException ignored) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void updateSourceValues() {
JDBCConnectionManager man = JDBCConnectionManager.getJDBCConnectionManager();
try {
man.closeConnection();
} catch (SQLException e) {
// do nothing
}
String username = txtDatabaseUsername.getText();
OBDADataSource currentDataSource = obdaModel.getDatasource();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_USERNAME, username);
String password = new String(txtDatabasePassword.getPassword());
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_PASSWORD, password);
String driver = txtJdbcDriver.getSelectedIndex() == 0 ? "" : (String) txtJdbcDriver.getSelectedItem();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_DRIVER, driver);
String url = txtJdbcUrl.getText();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_URL, url);
if (url.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED);
lblConnectionStatus.setText("Warning the URL ends with a white space, this can give rise to connection problems");
} else if (driver.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED);
lblConnectionStatus.setText("Warning the Driver class ends with a white space, this can give rise to connection problems");
} else if (password.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED);
lblConnectionStatus.setText("Warning the password ends with a white space, this can give rise to connection problems");
} else if (username.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED);
lblConnectionStatus.setText("Warning the password ends with a white space, this can give rise to connection problems");
} else {
lblConnectionStatus.setText("");
}
obdaModel.fireSourceParametersUpdated();
} }
|
public class class_name {
private void updateSourceValues() {
JDBCConnectionManager man = JDBCConnectionManager.getJDBCConnectionManager();
try {
man.closeConnection(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// do nothing
} // depends on control dependency: [catch], data = [none]
String username = txtDatabaseUsername.getText();
OBDADataSource currentDataSource = obdaModel.getDatasource();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_USERNAME, username);
String password = new String(txtDatabasePassword.getPassword());
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_PASSWORD, password);
String driver = txtJdbcDriver.getSelectedIndex() == 0 ? "" : (String) txtJdbcDriver.getSelectedItem();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_DRIVER, driver);
String url = txtJdbcUrl.getText();
currentDataSource.setParameter(RDBMSourceParameterConstants.DATABASE_URL, url);
if (url.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED); // depends on control dependency: [if], data = [none]
lblConnectionStatus.setText("Warning the URL ends with a white space, this can give rise to connection problems"); // depends on control dependency: [if], data = [none]
} else if (driver.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED); // depends on control dependency: [if], data = [none]
lblConnectionStatus.setText("Warning the Driver class ends with a white space, this can give rise to connection problems"); // depends on control dependency: [if], data = [none]
} else if (password.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED); // depends on control dependency: [if], data = [none]
lblConnectionStatus.setText("Warning the password ends with a white space, this can give rise to connection problems"); // depends on control dependency: [if], data = [none]
} else if (username.endsWith(" ")) {
lblConnectionStatus.setForeground(Color.RED); // depends on control dependency: [if], data = [none]
lblConnectionStatus.setText("Warning the password ends with a white space, this can give rise to connection problems"); // depends on control dependency: [if], data = [none]
} else {
lblConnectionStatus.setText(""); // depends on control dependency: [if], data = [none]
}
obdaModel.fireSourceParametersUpdated();
} }
|
public class class_name {
@Override
public List<AclEntry> getEntries() {
if (isEmpty()) {
return new ArrayList<>();
}
List<AclEntry> aclEntryList = super.getEntries();
for (AclEntry entry : aclEntryList) {
entry.setDefault(true);
}
return aclEntryList;
} }
|
public class class_name {
@Override
public List<AclEntry> getEntries() {
if (isEmpty()) {
return new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
List<AclEntry> aclEntryList = super.getEntries();
for (AclEntry entry : aclEntryList) {
entry.setDefault(true); // depends on control dependency: [for], data = [entry]
}
return aclEntryList;
} }
|
public class class_name {
private void appendEntity(OutputStream outputStream,
ByteArrayInputStream byteArrayInputStream) {
try {
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
int bytesRead = byteArrayInputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
outputStream.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
private void appendEntity(OutputStream outputStream,
ByteArrayInputStream byteArrayInputStream) {
try {
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
int bytesRead = byteArrayInputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
outputStream.write(buffer, 0, bytesRead); // depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String normalizeCAP(String input,boolean b) {
char[] c = input.toCharArray();
normalise(c);
for (int i = 0; i< c.length; i++) {
if(b){
if(c[i] > 96 && c[i] < 123){
c[i] -= 32;
}
}
else{
if(c[i] > 64 && c[i] < 91){
c[i] += 32;
}
}
}
return new String(c);
} }
|
public class class_name {
public String normalizeCAP(String input,boolean b) {
char[] c = input.toCharArray();
normalise(c);
for (int i = 0; i< c.length; i++) {
if(b){
if(c[i] > 96 && c[i] < 123){
c[i] -= 32; // depends on control dependency: [if], data = [none]
}
}
else{
if(c[i] > 64 && c[i] < 91){
c[i] += 32; // depends on control dependency: [if], data = [none]
}
}
}
return new String(c);
} }
|
public class class_name {
@Override
protected void exportSuccessfulResult(String prefix, MultiResult result) {
super.exportSuccessfulResult(prefix, result);
for (int i = 0; i < tasks.size(); i++) {
AbstractMatcherElement<Result> t = tasks.get(i);
t.exportSuccessfulResult(t.getResultPrefix(), result.getResults().get(i));
t.exportSuccessfulResult(prefix + "." + i, result.getResults().get(i));
}
} }
|
public class class_name {
@Override
protected void exportSuccessfulResult(String prefix, MultiResult result) {
super.exportSuccessfulResult(prefix, result);
for (int i = 0; i < tasks.size(); i++) {
AbstractMatcherElement<Result> t = tasks.get(i);
t.exportSuccessfulResult(t.getResultPrefix(), result.getResults().get(i)); // depends on control dependency: [for], data = [i]
t.exportSuccessfulResult(prefix + "." + i, result.getResults().get(i)); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public static Observable<String> getPathFromUriForImageDocument(final Context context,
final String mediaDocumentId) {
return Observable.fromCallable(new Func0<String>() {
@Override
public String call() {
String pathFound = null;
Cursor cursor = context.getContentResolver()
.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null,
Constants.ID_COLUMN_VALUE + " =?", new String[] { mediaDocumentId }, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
pathFound =
cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA));
}
cursor.close();
logDebug("Path found:" + pathFound);
}
return pathFound;
}
});
} }
|
public class class_name {
public static Observable<String> getPathFromUriForImageDocument(final Context context,
final String mediaDocumentId) {
return Observable.fromCallable(new Func0<String>() {
@Override
public String call() {
String pathFound = null;
Cursor cursor = context.getContentResolver()
.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null,
Constants.ID_COLUMN_VALUE + " =?", new String[] { mediaDocumentId }, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
pathFound =
cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA)); // depends on control dependency: [if], data = [none]
}
cursor.close(); // depends on control dependency: [if], data = [none]
logDebug("Path found:" + pathFound); // depends on control dependency: [if], data = [none]
}
return pathFound;
}
});
} }
|
public class class_name {
public static long[] coordinatesToHilbert(long[] coords, int bitsperdim, int offset) {
final int numdim = coords.length;
final int numbits = numdim * bitsperdim;
final long[] output = BitsUtil.zero(numbits);
int rotation = 0;
long[] refl = BitsUtil.zero(numdim);
for(int i = 0; i < bitsperdim; i++) {
final long[] hist = interleaveBits(coords, i + offset);
// System.err.println(BitsUtil.toString(hist,
// numdim)+" rot:"+rotation+" refl: "+BitsUtil.toString(refl, numdim));
final long[] bits = BitsUtil.copy(hist);
BitsUtil.xorI(bits, refl);
BitsUtil.cycleRightI(bits, rotation, numdim);
final int nextrot = (rotation + BitsUtil.numberOfTrailingZerosSigned(bits) + 2) % numdim;
BitsUtil.invgrayI(bits);
BitsUtil.orI(output, bits, numbits - (i + 1) * numdim);
// System.err.println(BitsUtil.toString(output,
// numbits)+" bits: "+BitsUtil.toString(bits, numdim));
refl = hist;
BitsUtil.flipI(refl, rotation);
if(!BitsUtil.get(bits, 0)) {
BitsUtil.flipI(refl, (nextrot - 1 + numdim) % numdim);
}
rotation = nextrot;
}
return output;
} }
|
public class class_name {
public static long[] coordinatesToHilbert(long[] coords, int bitsperdim, int offset) {
final int numdim = coords.length;
final int numbits = numdim * bitsperdim;
final long[] output = BitsUtil.zero(numbits);
int rotation = 0;
long[] refl = BitsUtil.zero(numdim);
for(int i = 0; i < bitsperdim; i++) {
final long[] hist = interleaveBits(coords, i + offset);
// System.err.println(BitsUtil.toString(hist,
// numdim)+" rot:"+rotation+" refl: "+BitsUtil.toString(refl, numdim));
final long[] bits = BitsUtil.copy(hist);
BitsUtil.xorI(bits, refl); // depends on control dependency: [for], data = [none]
BitsUtil.cycleRightI(bits, rotation, numdim); // depends on control dependency: [for], data = [none]
final int nextrot = (rotation + BitsUtil.numberOfTrailingZerosSigned(bits) + 2) % numdim;
BitsUtil.invgrayI(bits); // depends on control dependency: [for], data = [none]
BitsUtil.orI(output, bits, numbits - (i + 1) * numdim); // depends on control dependency: [for], data = [i]
// System.err.println(BitsUtil.toString(output,
// numbits)+" bits: "+BitsUtil.toString(bits, numdim));
refl = hist; // depends on control dependency: [for], data = [none]
BitsUtil.flipI(refl, rotation); // depends on control dependency: [for], data = [none]
if(!BitsUtil.get(bits, 0)) {
BitsUtil.flipI(refl, (nextrot - 1 + numdim) % numdim); // depends on control dependency: [if], data = [none]
}
rotation = nextrot; // depends on control dependency: [for], data = [none]
}
return output;
} }
|
public class class_name {
Expression XreadValueExpressionPrimary() {
Expression e;
e = XreadSimpleValueExpressionPrimary();
if (e != null) {
return e;
}
if (token.tokenType == Tokens.OPENBRACKET) {
read();
e = XreadValueExpression();
readThis(Tokens.CLOSEBRACKET);
} else {
return null;
}
return e;
} }
|
public class class_name {
Expression XreadValueExpressionPrimary() {
Expression e;
e = XreadSimpleValueExpressionPrimary();
if (e != null) {
return e; // depends on control dependency: [if], data = [none]
}
if (token.tokenType == Tokens.OPENBRACKET) {
read(); // depends on control dependency: [if], data = [none]
e = XreadValueExpression(); // depends on control dependency: [if], data = [none]
readThis(Tokens.CLOSEBRACKET); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
return e;
} }
|
public class class_name {
public void setPatchOperations(java.util.Collection<PatchOperation> patchOperations) {
if (patchOperations == null) {
this.patchOperations = null;
return;
}
this.patchOperations = new java.util.ArrayList<PatchOperation>(patchOperations);
} }
|
public class class_name {
public void setPatchOperations(java.util.Collection<PatchOperation> patchOperations) {
if (patchOperations == null) {
this.patchOperations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.patchOperations = new java.util.ArrayList<PatchOperation>(patchOperations);
} }
|
public class class_name {
public synchronized Layer remove(int index, boolean redraw) {
Layer layer = this.layersList.remove(index);
layer.unassign();
if (redraw) {
this.redrawer.redrawLayers();
}
return layer;
} }
|
public class class_name {
public synchronized Layer remove(int index, boolean redraw) {
Layer layer = this.layersList.remove(index);
layer.unassign();
if (redraw) {
this.redrawer.redrawLayers(); // depends on control dependency: [if], data = [none]
}
return layer;
} }
|
public class class_name {
public static int lowerCaseHashCode(String s) {
int h = 0;
int len = s.length();
for (int i = 0; i < len; i++) {
h = 31*h + toLower(s.charAt(i));
}
return h;
} }
|
public class class_name {
public static int lowerCaseHashCode(String s) {
int h = 0;
int len = s.length();
for (int i = 0; i < len; i++) {
h = 31*h + toLower(s.charAt(i)); // depends on control dependency: [for], data = [i]
}
return h;
} }
|
public class class_name {
public static final DatabaseInformation newDatabaseInformation(
Database db) {
Class c = null;
try {
c = Class.forName("org.hsqldb_voltpatches.dbinfo.DatabaseInformationFull");
} catch (Exception e) {
try {
c = Class.forName("org.hsqldb_voltpatches.dbinfo.DatabaseInformationMain");
} catch (Exception e2) {}
}
try {
Class[] ctorParmTypes = new Class[]{ Database.class };
Object[] ctorParms = new Object[]{ db };
Constructor ctor = c.getDeclaredConstructor(ctorParmTypes);
return (DatabaseInformation) ctor.newInstance(ctorParms);
} catch (Exception e) {
e.printStackTrace();
}
return new DatabaseInformation(db);
} }
|
public class class_name {
public static final DatabaseInformation newDatabaseInformation(
Database db) {
Class c = null;
try {
c = Class.forName("org.hsqldb_voltpatches.dbinfo.DatabaseInformationFull"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
try {
c = Class.forName("org.hsqldb_voltpatches.dbinfo.DatabaseInformationMain"); // depends on control dependency: [try], data = [none]
} catch (Exception e2) {} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
try {
Class[] ctorParmTypes = new Class[]{ Database.class }; // depends on control dependency: [try], data = [none]
Object[] ctorParms = new Object[]{ db };
Constructor ctor = c.getDeclaredConstructor(ctorParmTypes);
return (DatabaseInformation) ctor.newInstance(ctorParms); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return new DatabaseInformation(db);
} }
|
public class class_name {
public static <In extends ImageBase<In>, Out extends ImageBase<Out>, K extends Kernel1D>
void horizontal(K kernel, In input, Out output ) {
switch (input.getImageType().getFamily()) {
case GRAY: {
if (input instanceof GrayF32) {
ConvolveImageNoBorder.horizontal((Kernel1D_F32) kernel, (GrayF32) input, (GrayF32) output);
} else if (input instanceof GrayU8) {
if (GrayI16.class.isAssignableFrom(output.getClass()))
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayU8) input, (GrayI16) output);
else
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayU8) input, (GrayS32) output);
} else if (input instanceof GrayS16) {
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayS16) input, (GrayI16) output);
} else {
throw new IllegalArgumentException("Unknown image type: " + input.getClass().getName());
}
}break;
case INTERLEAVED: {
if (output instanceof InterleavedF32) {
ConvolveImageNoBorder.horizontal((Kernel1D_F32) kernel, (InterleavedF32) input, (InterleavedF32) output);
} else if (input instanceof InterleavedU8) {
if (InterleavedI16.class.isAssignableFrom(output.getClass()))
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedU8) input, (InterleavedI16) output);
else
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedU8) input, (InterleavedS32) output);
} else if (input instanceof InterleavedS16) {
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedS16) input, (InterleavedI16) output);
} else {
throw new IllegalArgumentException("Unknown image type: " + input.getClass().getName());
}
}break;
case PLANAR:{
Planar inp = (Planar)input;
Planar outp = (Planar)output;
for (int i = 0; i < inp.getNumBands(); i++) {
horizontal(kernel, inp.getBand(i), outp.getBand(i));
}
}break;
default: throw new IllegalArgumentException("Unknown image family");
}
} }
|
public class class_name {
public static <In extends ImageBase<In>, Out extends ImageBase<Out>, K extends Kernel1D>
void horizontal(K kernel, In input, Out output ) {
switch (input.getImageType().getFamily()) {
case GRAY: {
if (input instanceof GrayF32) {
ConvolveImageNoBorder.horizontal((Kernel1D_F32) kernel, (GrayF32) input, (GrayF32) output); // depends on control dependency: [if], data = [none]
} else if (input instanceof GrayU8) {
if (GrayI16.class.isAssignableFrom(output.getClass()))
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayU8) input, (GrayI16) output);
else
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayU8) input, (GrayS32) output);
} else if (input instanceof GrayS16) {
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (GrayS16) input, (GrayI16) output); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown image type: " + input.getClass().getName());
}
}break;
case INTERLEAVED: {
if (output instanceof InterleavedF32) {
ConvolveImageNoBorder.horizontal((Kernel1D_F32) kernel, (InterleavedF32) input, (InterleavedF32) output); // depends on control dependency: [if], data = [none]
} else if (input instanceof InterleavedU8) {
if (InterleavedI16.class.isAssignableFrom(output.getClass()))
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedU8) input, (InterleavedI16) output);
else
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedU8) input, (InterleavedS32) output);
} else if (input instanceof InterleavedS16) {
ConvolveImageNoBorder.horizontal((Kernel1D_S32) kernel, (InterleavedS16) input, (InterleavedI16) output); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown image type: " + input.getClass().getName());
}
}break;
case PLANAR:{
Planar inp = (Planar)input;
Planar outp = (Planar)output;
for (int i = 0; i < inp.getNumBands(); i++) {
horizontal(kernel, inp.getBand(i), outp.getBand(i));
}
}break;
default: throw new IllegalArgumentException("Unknown image family");
}
} }
|
public class class_name {
public SAMLEndpointResponse getSAMLAssertion(String usernameOrEmail, String password, String appId, String subdomain, String ipAddress) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_ASSERTION_URL));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
//.setAccessToken(accessToken) // 'Authorization' => 'Bearer xxxx' not accepted
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("username_or_email", usernameOrEmail);
params.put("password", password);
params.put("app_id", appId);
params.put("subdomain", subdomain);
if (ipAddress != null && !ipAddress.isEmpty()) {
params.put("ip_address", ipAddress);
}
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
SAMLEndpointResponse samlEndpointResponse = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage());
if (oAuthResponse.getType().equals("success")) {
if (oAuthResponse.getMessage().equals("Success")) {
samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData());
} else {
MFA mfa = new MFA(oAuthResponse.getData());
samlEndpointResponse.setMFA(mfa);
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return samlEndpointResponse;
} }
|
public class class_name {
public SAMLEndpointResponse getSAMLAssertion(String usernameOrEmail, String password, String appId, String subdomain, String ipAddress) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_ASSERTION_URL));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
//.setAccessToken(accessToken) // 'Authorization' => 'Bearer xxxx' not accepted
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("username_or_email", usernameOrEmail);
params.put("password", password);
params.put("app_id", appId);
params.put("subdomain", subdomain);
if (ipAddress != null && !ipAddress.isEmpty()) {
params.put("ip_address", ipAddress);
}
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
SAMLEndpointResponse samlEndpointResponse = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage());
if (oAuthResponse.getType().equals("success")) {
if (oAuthResponse.getMessage().equals("Success")) {
samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData()); // depends on control dependency: [if], data = [none]
} else {
MFA mfa = new MFA(oAuthResponse.getData());
samlEndpointResponse.setMFA(mfa); // depends on control dependency: [if], data = [none]
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return samlEndpointResponse;
} }
|
public class class_name {
private static Optional<String> roleNotAllowedToBePlayed(Role role, Thing thing) {
TypeImpl<?, ?> currentConcept = (TypeImpl<?, ?>) thing.type();
boolean satisfiesPlays = false;
while (currentConcept != null) {
Map<Role, Boolean> plays = currentConcept.directPlays();
for (Map.Entry<Role, Boolean> playsEntry : plays.entrySet()) {
Role rolePlayed = playsEntry.getKey();
Boolean required = playsEntry.getValue();
if (rolePlayed.label().equals(role.label())) {
satisfiesPlays = true;
// Assert unique relation for this role type
if (required && !CommonUtil.containsOnly(thing.relations(role), 1)) {
return Optional.of(VALIDATION_REQUIRED_RELATION.getMessage(thing.id(), thing.type().label(), role.label(), thing.relations(role).count()));
}
}
}
currentConcept = (TypeImpl) currentConcept.sup();
}
if (satisfiesPlays) {
return Optional.empty();
} else {
return Optional.of(VALIDATION_CASTING.getMessage(thing.type().label(), thing.id(), role.label()));
}
} }
|
public class class_name {
private static Optional<String> roleNotAllowedToBePlayed(Role role, Thing thing) {
TypeImpl<?, ?> currentConcept = (TypeImpl<?, ?>) thing.type();
boolean satisfiesPlays = false;
while (currentConcept != null) {
Map<Role, Boolean> plays = currentConcept.directPlays();
for (Map.Entry<Role, Boolean> playsEntry : plays.entrySet()) {
Role rolePlayed = playsEntry.getKey();
Boolean required = playsEntry.getValue();
if (rolePlayed.label().equals(role.label())) {
satisfiesPlays = true; // depends on control dependency: [if], data = [none]
// Assert unique relation for this role type
if (required && !CommonUtil.containsOnly(thing.relations(role), 1)) {
return Optional.of(VALIDATION_REQUIRED_RELATION.getMessage(thing.id(), thing.type().label(), role.label(), thing.relations(role).count())); // depends on control dependency: [if], data = [none]
}
}
}
currentConcept = (TypeImpl) currentConcept.sup(); // depends on control dependency: [while], data = [none]
}
if (satisfiesPlays) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
} else {
return Optional.of(VALIDATION_CASTING.getMessage(thing.type().label(), thing.id(), role.label())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String convertDate(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
try {
Date creationDate = sdf.parse(date);
sdf = new SimpleDateFormat("\\'yr'yyyy\\'mo'MM\\'dy'dd\\'hr'HH\\'min'mm\\'sec'ss");
return sdf.format(creationDate);
} catch(ParseException pe) {
pe.printStackTrace();
return "";
}
} }
|
public class class_name {
private String convertDate(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
try {
Date creationDate = sdf.parse(date);
sdf = new SimpleDateFormat("\\'yr'yyyy\\'mo'MM\\'dy'dd\\'hr'HH\\'min'mm\\'sec'ss"); // depends on control dependency: [try], data = [none]
return sdf.format(creationDate); // depends on control dependency: [try], data = [none]
} catch(ParseException pe) {
pe.printStackTrace();
return "";
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public List<WebElement> findElements() {
SlowLoadingElementList list = new SlowLoadingElementList(clock, timeOutInSeconds);
try {
return list.get().getElements();
} catch (NoSuchElementError e) {
return new ArrayList<>();
}
} }
|
public class class_name {
@Override
public List<WebElement> findElements() {
SlowLoadingElementList list = new SlowLoadingElementList(clock, timeOutInSeconds);
try {
return list.get().getElements(); // depends on control dependency: [try], data = [none]
} catch (NoSuchElementError e) {
return new ArrayList<>();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static Map<String, Object> getFilteredAndEcodedMap(Map<String, Object> source,
Set<String> filter) {
Map<String, Object> filteredMap = Maps.newHashMap();
for (Entry<String, Object> e : source.entrySet()) {
if (!filter.contains(e.getKey())) {
Object o = e.getValue();
if (o instanceof Map) {
filteredMap.put(e.getKey(),
getFilteredAndEcodedMap((Map<String, Object>) o, filter));
} else {
filteredMap.put(e.getKey(), o);
}
}
}
return filteredMap;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static Map<String, Object> getFilteredAndEcodedMap(Map<String, Object> source,
Set<String> filter) {
Map<String, Object> filteredMap = Maps.newHashMap();
for (Entry<String, Object> e : source.entrySet()) {
if (!filter.contains(e.getKey())) {
Object o = e.getValue();
if (o instanceof Map) {
filteredMap.put(e.getKey(),
getFilteredAndEcodedMap((Map<String, Object>) o, filter)); // depends on control dependency: [if], data = [none]
} else {
filteredMap.put(e.getKey(), o); // depends on control dependency: [if], data = [none]
}
}
}
return filteredMap;
} }
|
public class class_name {
private void convertStoragePathValue(
final Map<String, String> data,
final StorageTree storageTree,
final String name,
final String propValue,
final Map<String, Object> renderingOptions
) throws ConfigurationException
{
//a storage path property
String root = null;
if (null != renderingOptions.get( StringRenderingConstants.STORAGE_PATH_ROOT_KEY)) {
root = renderingOptions.get(StringRenderingConstants.STORAGE_PATH_ROOT_KEY).toString();
}
String filter = null;
if (null != renderingOptions.get(StringRenderingConstants.STORAGE_FILE_META_FILTER_KEY)) {
filter = renderingOptions.get(StringRenderingConstants.STORAGE_FILE_META_FILTER_KEY).toString();
}
boolean clearValue = isValueConversionFailureRemove(renderingOptions);
if (null != root && !PathUtil.hasRoot(propValue, root)) {
if(clearValue) {
data.remove(name);
}
return;
}
try {
Resource<ResourceMeta> resource = storageTree.getResource(propValue);
ResourceMeta contents = resource.getContents();
//test filter
if (filter != null) {
String[] filterComponents = filter.split("=", 2);
if (filterComponents.length == 2) {
String key = filterComponents[0];
String test = filterComponents[1];
Map<String, String> meta = contents.getMeta();
if (meta == null || !test.equals(meta.get(key))) {
if(clearValue) {
data.remove(name);
}
return;
}
}
}
//finally load storage contents into a string
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
contents.writeContent(byteArrayOutputStream);
data.put(name, new String(byteArrayOutputStream.toByteArray()));
} catch (StorageException | IOException e) {
if(clearValue) {
data.remove(name);
return;
}
throw new ConfigurationException("Unable to load configuration key '" +
name + "' value from storage path: " + propValue, e);
}
} }
|
public class class_name {
private void convertStoragePathValue(
final Map<String, String> data,
final StorageTree storageTree,
final String name,
final String propValue,
final Map<String, Object> renderingOptions
) throws ConfigurationException
{
//a storage path property
String root = null;
if (null != renderingOptions.get( StringRenderingConstants.STORAGE_PATH_ROOT_KEY)) {
root = renderingOptions.get(StringRenderingConstants.STORAGE_PATH_ROOT_KEY).toString();
}
String filter = null;
if (null != renderingOptions.get(StringRenderingConstants.STORAGE_FILE_META_FILTER_KEY)) {
filter = renderingOptions.get(StringRenderingConstants.STORAGE_FILE_META_FILTER_KEY).toString();
}
boolean clearValue = isValueConversionFailureRemove(renderingOptions);
if (null != root && !PathUtil.hasRoot(propValue, root)) {
if(clearValue) {
data.remove(name); // depends on control dependency: [if], data = [none]
}
return;
}
try {
Resource<ResourceMeta> resource = storageTree.getResource(propValue);
ResourceMeta contents = resource.getContents();
//test filter
if (filter != null) {
String[] filterComponents = filter.split("=", 2);
if (filterComponents.length == 2) {
String key = filterComponents[0];
String test = filterComponents[1];
Map<String, String> meta = contents.getMeta();
if (meta == null || !test.equals(meta.get(key))) {
if(clearValue) {
data.remove(name); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
}
}
//finally load storage contents into a string
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
contents.writeContent(byteArrayOutputStream);
data.put(name, new String(byteArrayOutputStream.toByteArray()));
} catch (StorageException | IOException e) {
if(clearValue) {
data.remove(name); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
throw new ConfigurationException("Unable to load configuration key '" +
name + "' value from storage path: " + propValue, e);
}
} }
|
public class class_name {
public void marshall(ContainerOverride containerOverride, ProtocolMarshaller protocolMarshaller) {
if (containerOverride == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(containerOverride.getName(), NAME_BINDING);
protocolMarshaller.marshall(containerOverride.getCommand(), COMMAND_BINDING);
protocolMarshaller.marshall(containerOverride.getEnvironment(), ENVIRONMENT_BINDING);
protocolMarshaller.marshall(containerOverride.getCpu(), CPU_BINDING);
protocolMarshaller.marshall(containerOverride.getMemory(), MEMORY_BINDING);
protocolMarshaller.marshall(containerOverride.getMemoryReservation(), MEMORYRESERVATION_BINDING);
protocolMarshaller.marshall(containerOverride.getResourceRequirements(), RESOURCEREQUIREMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ContainerOverride containerOverride, ProtocolMarshaller protocolMarshaller) {
if (containerOverride == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(containerOverride.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getCommand(), COMMAND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getEnvironment(), ENVIRONMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getCpu(), CPU_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getMemory(), MEMORY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getMemoryReservation(), MEMORYRESERVATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(containerOverride.getResourceRequirements(), RESOURCEREQUIREMENTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected Map<String, String> getElementAttributes() {
// Preserve order of attributes
Map<String, String> attrs = new HashMap<>();
if (this.getUrl() != null) {
attrs.put("url", this.getUrl().toString());
}
if (this.getMethod() != null) {
attrs.put("method", this.getMethod().toString());
}
if (this.getReservationSid() != null) {
attrs.put("reservationSid", this.getReservationSid());
}
if (this.getPostWorkActivitySid() != null) {
attrs.put("postWorkActivitySid", this.getPostWorkActivitySid());
}
return attrs;
} }
|
public class class_name {
protected Map<String, String> getElementAttributes() {
// Preserve order of attributes
Map<String, String> attrs = new HashMap<>();
if (this.getUrl() != null) {
attrs.put("url", this.getUrl().toString()); // depends on control dependency: [if], data = [none]
}
if (this.getMethod() != null) {
attrs.put("method", this.getMethod().toString()); // depends on control dependency: [if], data = [none]
}
if (this.getReservationSid() != null) {
attrs.put("reservationSid", this.getReservationSid()); // depends on control dependency: [if], data = [none]
}
if (this.getPostWorkActivitySid() != null) {
attrs.put("postWorkActivitySid", this.getPostWorkActivitySid()); // depends on control dependency: [if], data = [none]
}
return attrs;
} }
|
public class class_name {
public final DRL5Expressions.instanceof_key_return instanceof_key() throws RecognitionException {
DRL5Expressions.instanceof_key_return retval = new DRL5Expressions.instanceof_key_return();
retval.start = input.LT(1);
Token id=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:711:5: ({...}? =>id= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:711:12: {...}? =>id= ID
{
if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF)))) ) {
if (state.backtracking>0) {state.failed=true; return retval;}
throw new FailedPredicateException(input, "instanceof_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))");
}
id=(Token)match(input,ID,FOLLOW_ID_in_instanceof_key4364); if (state.failed) return retval;
if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); }
}
retval.stop = input.LT(-1);
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
public final DRL5Expressions.instanceof_key_return instanceof_key() throws RecognitionException {
DRL5Expressions.instanceof_key_return retval = new DRL5Expressions.instanceof_key_return();
retval.start = input.LT(1);
Token id=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:711:5: ({...}? =>id= ID )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:711:12: {...}? =>id= ID
{
if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF)))) ) {
if (state.backtracking>0) {state.failed=true; return retval;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
throw new FailedPredicateException(input, "instanceof_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.INSTANCEOF))");
}
id=(Token)match(input,ID,FOLLOW_ID_in_instanceof_key4364); if (state.failed) return retval;
if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } // depends on control dependency: [if], data = [none]
}
retval.stop = input.LT(-1);
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
private Element getChildElement(Element parent) {
NodeList list = parent.getChildNodes();
int len = list.getLength();
for (int i = 0; i < len; i++) {
Node node = list.item(i);
if (node instanceof Element) {
return (Element) node;
}
}
return null;
} }
|
public class class_name {
private Element getChildElement(Element parent) {
NodeList list = parent.getChildNodes();
int len = list.getLength();
for (int i = 0; i < len; i++) {
Node node = list.item(i);
if (node instanceof Element) {
return (Element) node; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static <T, R> Stream<R> parallelZipp(final Collection<? extends Iterator<? extends T>> c, final List<? extends T> valuesForNone,
final Function<? super List<? extends T>, R> zipFunction, final int queueSize) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
}
if (c.size() != valuesForNone.size()) {
throw new IllegalArgumentException("The size of 'valuesForNone' must be same as the size of the collection of iterators");
}
final int len = c.size();
final Holder<Throwable> eHolder = new Holder<>();
final MutableBoolean onGoing = MutableBoolean.of(true);
final AtomicInteger[] counters = new AtomicInteger[len];
final BlockingQueue<Object>[] queues = new ArrayBlockingQueue[len];
readToQueue(c, queueSize, DEFAULT_ASYNC_EXECUTOR, counters, queues, eHolder, onGoing);
return of(new QueuedIterator<R>(queueSize) {
Object[] next = null;
@Override
public boolean hasNext() {
if (next == null) {
next = new Object[len];
for (int i = 0; i < len; i++) {
try {
while (next[i] == null && onGoing.value() && (counters[i].get() > 0 || queues[i].size() > 0)) { // (counters[i].get() > 0 || queues[i].size() > 0) is wrong. has to check counter first
next[i] = queues[i].poll(1, TimeUnit.MILLISECONDS);
}
} catch (Exception e) {
setError(eHolder, e, onGoing);
}
if (eHolder.value() != null) {
throwError(eHolder, onGoing);
}
}
}
for (int i = 0; i < len; i++) {
if (next[i] != null) {
return true;
}
}
onGoing.setFalse();
return false;
}
@Override
public R next() {
if (hasNext() == false) {
throw new NoSuchElementException();
}
for (int i = 0; i < len; i++) {
next[i] = next[i] == NONE ? null : (next[i] == null ? valuesForNone.get(i) : next[i]);
}
boolean isOK = false;
try {
R result = zipFunction.apply(Arrays.asList((T[]) next));
next = null;
isOK = true;
return result;
} finally {
// error happened
if (isOK == false) {
onGoing.setFalse();
}
}
}
}).onClose(new Runnable() {
@Override
public void run() {
onGoing.setFalse();
}
});
} }
|
public class class_name {
public static <T, R> Stream<R> parallelZipp(final Collection<? extends Iterator<? extends T>> c, final List<? extends T> valuesForNone,
final Function<? super List<? extends T>, R> zipFunction, final int queueSize) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
// depends on control dependency: [if], data = [none]
}
if (c.size() != valuesForNone.size()) {
throw new IllegalArgumentException("The size of 'valuesForNone' must be same as the size of the collection of iterators");
}
final int len = c.size();
final Holder<Throwable> eHolder = new Holder<>();
final MutableBoolean onGoing = MutableBoolean.of(true);
final AtomicInteger[] counters = new AtomicInteger[len];
final BlockingQueue<Object>[] queues = new ArrayBlockingQueue[len];
readToQueue(c, queueSize, DEFAULT_ASYNC_EXECUTOR, counters, queues, eHolder, onGoing);
return of(new QueuedIterator<R>(queueSize) {
Object[] next = null;
@Override
public boolean hasNext() {
if (next == null) {
next = new Object[len];
// depends on control dependency: [if], data = [none]
for (int i = 0; i < len; i++) {
try {
while (next[i] == null && onGoing.value() && (counters[i].get() > 0 || queues[i].size() > 0)) { // (counters[i].get() > 0 || queues[i].size() > 0) is wrong. has to check counter first
next[i] = queues[i].poll(1, TimeUnit.MILLISECONDS);
// depends on control dependency: [while], data = [none]
}
} catch (Exception e) {
setError(eHolder, e, onGoing);
}
// depends on control dependency: [catch], data = [none]
if (eHolder.value() != null) {
throwError(eHolder, onGoing);
// depends on control dependency: [if], data = [none]
}
}
}
for (int i = 0; i < len; i++) {
if (next[i] != null) {
return true;
// depends on control dependency: [if], data = [none]
}
}
onGoing.setFalse();
return false;
}
@Override
public R next() {
if (hasNext() == false) {
throw new NoSuchElementException();
}
for (int i = 0; i < len; i++) {
next[i] = next[i] == NONE ? null : (next[i] == null ? valuesForNone.get(i) : next[i]);
// depends on control dependency: [for], data = [i]
}
boolean isOK = false;
try {
R result = zipFunction.apply(Arrays.asList((T[]) next));
next = null;
// depends on control dependency: [try], data = [none]
isOK = true;
// depends on control dependency: [try], data = [none]
return result;
// depends on control dependency: [try], data = [none]
} finally {
// error happened
if (isOK == false) {
onGoing.setFalse();
// depends on control dependency: [if], data = [none]
}
}
}
}).onClose(new Runnable() {
@Override
public void run() {
onGoing.setFalse();
}
});
} }
|
public class class_name {
public ServiceCall<AnalysisResults> analyze(AnalyzeOptions analyzeOptions) {
Validator.notNull(analyzeOptions, "analyzeOptions cannot be null");
String[] pathSegments = { "v1/analyze" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("natural-language-understanding", "v1", "analyze");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.add("features", GsonSingleton.getGson().toJsonTree(analyzeOptions.features()));
if (analyzeOptions.text() != null) {
contentJson.addProperty("text", analyzeOptions.text());
}
if (analyzeOptions.html() != null) {
contentJson.addProperty("html", analyzeOptions.html());
}
if (analyzeOptions.url() != null) {
contentJson.addProperty("url", analyzeOptions.url());
}
if (analyzeOptions.clean() != null) {
contentJson.addProperty("clean", analyzeOptions.clean());
}
if (analyzeOptions.xpath() != null) {
contentJson.addProperty("xpath", analyzeOptions.xpath());
}
if (analyzeOptions.fallbackToRaw() != null) {
contentJson.addProperty("fallback_to_raw", analyzeOptions.fallbackToRaw());
}
if (analyzeOptions.returnAnalyzedText() != null) {
contentJson.addProperty("return_analyzed_text", analyzeOptions.returnAnalyzedText());
}
if (analyzeOptions.language() != null) {
contentJson.addProperty("language", analyzeOptions.language());
}
if (analyzeOptions.limitTextCharacters() != null) {
contentJson.addProperty("limit_text_characters", analyzeOptions.limitTextCharacters());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AnalysisResults.class));
} }
|
public class class_name {
public ServiceCall<AnalysisResults> analyze(AnalyzeOptions analyzeOptions) {
Validator.notNull(analyzeOptions, "analyzeOptions cannot be null");
String[] pathSegments = { "v1/analyze" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("natural-language-understanding", "v1", "analyze");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.add("features", GsonSingleton.getGson().toJsonTree(analyzeOptions.features()));
if (analyzeOptions.text() != null) {
contentJson.addProperty("text", analyzeOptions.text()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.html() != null) {
contentJson.addProperty("html", analyzeOptions.html()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.url() != null) {
contentJson.addProperty("url", analyzeOptions.url()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.clean() != null) {
contentJson.addProperty("clean", analyzeOptions.clean()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.xpath() != null) {
contentJson.addProperty("xpath", analyzeOptions.xpath()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.fallbackToRaw() != null) {
contentJson.addProperty("fallback_to_raw", analyzeOptions.fallbackToRaw()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.returnAnalyzedText() != null) {
contentJson.addProperty("return_analyzed_text", analyzeOptions.returnAnalyzedText()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.language() != null) {
contentJson.addProperty("language", analyzeOptions.language()); // depends on control dependency: [if], data = [none]
}
if (analyzeOptions.limitTextCharacters() != null) {
contentJson.addProperty("limit_text_characters", analyzeOptions.limitTextCharacters()); // depends on control dependency: [if], data = [none]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AnalysisResults.class));
} }
|
public class class_name {
protected GpsCoordinatesSource resolveGpsCoordinatesSource() {
if(gpsCoordinatesSource == null) {
Set<GpsCoordinatesSource> sources = getCamelContext().getRegistry().findByType(GpsCoordinatesSource.class);
if(sources.size() == 1) {
GpsCoordinatesSource source = sources.iterator().next();
LOG.info("Found single instance of the GpsCoordinatesSource in the registry. {} will be used.", source);
return source;
} else if(getComponent().getGpsCoordinatesSource() != null){
return getComponent().getGpsCoordinatesSource();
} else {
return new SerialGpsCoordinatesSource();
}
} else {
return gpsCoordinatesSource;
}
} }
|
public class class_name {
protected GpsCoordinatesSource resolveGpsCoordinatesSource() {
if(gpsCoordinatesSource == null) {
Set<GpsCoordinatesSource> sources = getCamelContext().getRegistry().findByType(GpsCoordinatesSource.class);
if(sources.size() == 1) {
GpsCoordinatesSource source = sources.iterator().next();
LOG.info("Found single instance of the GpsCoordinatesSource in the registry. {} will be used.", source); // depends on control dependency: [if], data = [none]
return source; // depends on control dependency: [if], data = [none]
} else if(getComponent().getGpsCoordinatesSource() != null){
return getComponent().getGpsCoordinatesSource(); // depends on control dependency: [if], data = [none]
} else {
return new SerialGpsCoordinatesSource(); // depends on control dependency: [if], data = [none]
}
} else {
return gpsCoordinatesSource; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized static void init(Context context, ThreadPoolExecutor tpe) throws HandlerException {
mContext = context;
executor = tpe;
try {
long startInit = System.currentTimeMillis();
//billy.qi modified at 2017-12-06
//load by plugin first
loadRouterMap();
if (registerByPlugin) {
logger.info(TAG, "Load router map by arouter-auto-register plugin.");
} else {
Set<String> routerMap;
// It will rebuild router map every times when debuggable.
if (ARouter.debuggable() || PackageUtils.isNewVersion(context)) {
logger.info(TAG, "Run with debug mode or new install, rebuild router map.");
// These class was generated by arouter-compiler.
routerMap = ClassUtils.getFileNameByPackageName(mContext, ROUTE_ROOT_PAKCAGE);
if (!routerMap.isEmpty()) {
context.getSharedPreferences(AROUTER_SP_CACHE_KEY, Context.MODE_PRIVATE).edit().putStringSet(AROUTER_SP_KEY_MAP, routerMap).apply();
}
PackageUtils.updateVersion(context); // Save new version name when router map update finishes.
} else {
logger.info(TAG, "Load router map from cache.");
routerMap = new HashSet<>(context.getSharedPreferences(AROUTER_SP_CACHE_KEY, Context.MODE_PRIVATE).getStringSet(AROUTER_SP_KEY_MAP, new HashSet<String>()));
}
logger.info(TAG, "Find router map finished, map size = " + routerMap.size() + ", cost " + (System.currentTimeMillis() - startInit) + " ms.");
startInit = System.currentTimeMillis();
for (String className : routerMap) {
if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_ROOT)) {
// This one of root elements, load root.
((IRouteRoot) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.groupsIndex);
} else if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_INTERCEPTORS)) {
// Load interceptorMeta
((IInterceptorGroup) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.interceptorsIndex);
} else if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_PROVIDERS)) {
// Load providerIndex
((IProviderGroup) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.providersIndex);
}
}
}
logger.info(TAG, "Load root element finished, cost " + (System.currentTimeMillis() - startInit) + " ms.");
if (Warehouse.groupsIndex.size() == 0) {
logger.error(TAG, "No mapping files were found, check your configuration please!");
}
if (ARouter.debuggable()) {
logger.debug(TAG, String.format(Locale.getDefault(), "LogisticsCenter has already been loaded, GroupIndex[%d], InterceptorIndex[%d], ProviderIndex[%d]", Warehouse.groupsIndex.size(), Warehouse.interceptorsIndex.size(), Warehouse.providersIndex.size()));
}
} catch (Exception e) {
throw new HandlerException(TAG + "ARouter init logistics center exception! [" + e.getMessage() + "]");
}
} }
|
public class class_name {
public synchronized static void init(Context context, ThreadPoolExecutor tpe) throws HandlerException {
mContext = context;
executor = tpe;
try {
long startInit = System.currentTimeMillis();
//billy.qi modified at 2017-12-06
//load by plugin first
loadRouterMap();
if (registerByPlugin) {
logger.info(TAG, "Load router map by arouter-auto-register plugin."); // depends on control dependency: [if], data = [none]
} else {
Set<String> routerMap;
// It will rebuild router map every times when debuggable.
if (ARouter.debuggable() || PackageUtils.isNewVersion(context)) {
logger.info(TAG, "Run with debug mode or new install, rebuild router map.");
// These class was generated by arouter-compiler.
routerMap = ClassUtils.getFileNameByPackageName(mContext, ROUTE_ROOT_PAKCAGE); // depends on control dependency: [if], data = [none]
if (!routerMap.isEmpty()) {
context.getSharedPreferences(AROUTER_SP_CACHE_KEY, Context.MODE_PRIVATE).edit().putStringSet(AROUTER_SP_KEY_MAP, routerMap).apply(); // depends on control dependency: [if], data = [none]
}
PackageUtils.updateVersion(context); // Save new version name when router map update finishes. // depends on control dependency: [if], data = [none]
} else {
logger.info(TAG, "Load router map from cache."); // depends on control dependency: [if], data = [none]
routerMap = new HashSet<>(context.getSharedPreferences(AROUTER_SP_CACHE_KEY, Context.MODE_PRIVATE).getStringSet(AROUTER_SP_KEY_MAP, new HashSet<String>())); // depends on control dependency: [if], data = [none]
}
logger.info(TAG, "Find router map finished, map size = " + routerMap.size() + ", cost " + (System.currentTimeMillis() - startInit) + " ms."); // depends on control dependency: [if], data = [none]
startInit = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
for (String className : routerMap) {
if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_ROOT)) {
// This one of root elements, load root.
((IRouteRoot) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.groupsIndex); // depends on control dependency: [if], data = [none]
} else if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_INTERCEPTORS)) {
// Load interceptorMeta
((IInterceptorGroup) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.interceptorsIndex); // depends on control dependency: [if], data = [none]
} else if (className.startsWith(ROUTE_ROOT_PAKCAGE + DOT + SDK_NAME + SEPARATOR + SUFFIX_PROVIDERS)) {
// Load providerIndex
((IProviderGroup) (Class.forName(className).getConstructor().newInstance())).loadInto(Warehouse.providersIndex); // depends on control dependency: [if], data = [none]
}
}
}
logger.info(TAG, "Load root element finished, cost " + (System.currentTimeMillis() - startInit) + " ms.");
if (Warehouse.groupsIndex.size() == 0) {
logger.error(TAG, "No mapping files were found, check your configuration please!"); // depends on control dependency: [if], data = [none]
}
if (ARouter.debuggable()) {
logger.debug(TAG, String.format(Locale.getDefault(), "LogisticsCenter has already been loaded, GroupIndex[%d], InterceptorIndex[%d], ProviderIndex[%d]", Warehouse.groupsIndex.size(), Warehouse.interceptorsIndex.size(), Warehouse.providersIndex.size())); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new HandlerException(TAG + "ARouter init logistics center exception! [" + e.getMessage() + "]");
}
} }
|
public class class_name {
public static <K> K deserialize(byte[] bytes) {
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
@SuppressWarnings("unchecked") final K k = (K) objectInputStream.readObject();
return k;
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public static <K> K deserialize(byte[] bytes) {
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
@SuppressWarnings("unchecked") final K k = (K) objectInputStream.readObject();
return k; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void or(final SearchTerm searchTerm) {
if (this.searchTerm == null) {
this.searchTerm = searchTerm;
return;
}
this.searchTerm = new OrTerm(this.searchTerm, searchTerm);
} }
|
public class class_name {
protected void or(final SearchTerm searchTerm) {
if (this.searchTerm == null) {
this.searchTerm = searchTerm; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.searchTerm = new OrTerm(this.searchTerm, searchTerm);
} }
|
public class class_name {
private void parseModeConfig(final Node node, final ConfigSettings config)
{
String name;
Integer value;
Node nnode;
NodeList list = node.getChildNodes();
int length = list.getLength();
for (int i = 0; i < length; i++) {
nnode = list.item(i);
name = nnode.getNodeName().toUpperCase();
if (name.equals(KEY_VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING)) {
value = Integer.parseInt(nnode.getChildNodes().item(0)
.getNodeValue());
config.setConfigParameter(
ConfigurationKeys.VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING,
value);
}
else if (name.equals(KEY_COUNTER_FULL_REVISION)) {
value = Integer.parseInt(nnode.getChildNodes().item(0)
.getNodeValue());
config.setConfigParameter(
ConfigurationKeys.COUNTER_FULL_REVISION, value);
}
}
} }
|
public class class_name {
private void parseModeConfig(final Node node, final ConfigSettings config)
{
String name;
Integer value;
Node nnode;
NodeList list = node.getChildNodes();
int length = list.getLength();
for (int i = 0; i < length; i++) {
nnode = list.item(i); // depends on control dependency: [for], data = [i]
name = nnode.getNodeName().toUpperCase(); // depends on control dependency: [for], data = [none]
if (name.equals(KEY_VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING)) {
value = Integer.parseInt(nnode.getChildNodes().item(0)
.getNodeValue()); // depends on control dependency: [if], data = [none]
config.setConfigParameter(
ConfigurationKeys.VALUE_MINIMUM_LONGEST_COMMON_SUBSTRING,
value); // depends on control dependency: [if], data = [none]
}
else if (name.equals(KEY_COUNTER_FULL_REVISION)) {
value = Integer.parseInt(nnode.getChildNodes().item(0)
.getNodeValue()); // depends on control dependency: [if], data = [none]
config.setConfigParameter(
ConfigurationKeys.COUNTER_FULL_REVISION, value); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) {
try {
// logout and disconnect
if (ftpClient != null && ftpClient.isConnected()) {
ftpClient.logout();
ftpClient.disconnect();
}
} catch (IOException e) {
// what the hell?!
throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e);
}
} }
|
public class class_name {
public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) {
try {
// logout and disconnect
if (ftpClient != null && ftpClient.isConnected()) {
ftpClient.logout(); // depends on control dependency: [if], data = [none]
ftpClient.disconnect(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
// what the hell?!
throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
static Object coerceTypeImpl(Class<?> type, Object value)
{
if (value != null && value.getClass() == type) {
return value;
}
switch (getJSTypeCode(value)) {
case JSTYPE_NULL:
// raise error if type.isPrimitive()
if (type.isPrimitive()) {
reportConversionError(value, type);
}
return null;
case JSTYPE_UNDEFINED:
if (type == ScriptRuntime.StringClass ||
type == ScriptRuntime.ObjectClass) {
return "undefined";
}
reportConversionError("undefined", type);
break;
case JSTYPE_BOOLEAN:
// Under LC3, only JS Booleans can be coerced into a Boolean value
if (type == Boolean.TYPE ||
type == ScriptRuntime.BooleanClass ||
type == ScriptRuntime.ObjectClass) {
return value;
}
else if (type == ScriptRuntime.StringClass) {
return value.toString();
}
else {
reportConversionError(value, type);
}
break;
case JSTYPE_NUMBER:
if (type == ScriptRuntime.StringClass) {
return ScriptRuntime.toString(value);
}
else if (type == ScriptRuntime.ObjectClass) {
Context context = Context.getCurrentContext();
if(context.hasFeature(Context.FEATURE_INTEGER_WITHOUT_DECIMAL_PLACE)) {
//to process numbers like 2.0 as 2 without decimal place
long roundedValue = Math.round(toDouble(value));
if(roundedValue == toDouble(value)) {
return coerceToNumber(Long.TYPE, value);
}
}
return coerceToNumber(Double.TYPE, value);
}
else if ((type.isPrimitive() && type != Boolean.TYPE) ||
ScriptRuntime.NumberClass.isAssignableFrom(type)) {
return coerceToNumber(type, value);
}
else {
reportConversionError(value, type);
}
break;
case JSTYPE_STRING:
if (type == ScriptRuntime.StringClass || type.isInstance(value)) {
return value.toString();
}
else if (type == Character.TYPE
|| type == ScriptRuntime.CharacterClass)
{
// Special case for converting a single char string to a
// character
// Placed here because it applies *only* to JS strings,
// not other JS objects converted to strings
if (((CharSequence)value).length() == 1) {
return Character.valueOf(((CharSequence)value).charAt(0));
}
return coerceToNumber(type, value);
}
else if ((type.isPrimitive() && type != Boolean.TYPE)
|| ScriptRuntime.NumberClass.isAssignableFrom(type))
{
return coerceToNumber(type, value);
}
else {
reportConversionError(value, type);
}
break;
case JSTYPE_JAVA_CLASS:
if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap();
}
if (type == ScriptRuntime.ClassClass ||
type == ScriptRuntime.ObjectClass) {
return value;
}
else if (type == ScriptRuntime.StringClass) {
return value.toString();
}
else {
reportConversionError(value, type);
}
break;
case JSTYPE_JAVA_OBJECT:
case JSTYPE_JAVA_ARRAY:
if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap();
}
if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
reportConversionError(value, type);
}
return coerceToNumber(type, value);
}
if (type == ScriptRuntime.StringClass) {
return value.toString();
}
if (type.isInstance(value)) {
return value;
}
reportConversionError(value, type);
break;
case JSTYPE_OBJECT:
if (type == ScriptRuntime.StringClass) {
return ScriptRuntime.toString(value);
}
else if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
reportConversionError(value, type);
}
return coerceToNumber(type, value);
}
else if (type.isInstance(value)) {
return value;
}
else if (type == ScriptRuntime.DateClass
&& value instanceof NativeDate)
{
double time = ((NativeDate)value).getJSTimeValue();
// XXX: This will replace NaN by 0
return new Date((long)time);
}
else if (type.isArray() && value instanceof NativeArray) {
// Make a new java array, and coerce the JS array components
// to the target (component) type.
NativeArray array = (NativeArray) value;
long length = array.getLength();
Class<?> arrayType = type.getComponentType();
Object Result = Array.newInstance(arrayType, (int)length);
for (int i = 0 ; i < length ; ++i) {
try {
Array.set(Result, i, coerceTypeImpl(
arrayType, array.get(i, array)));
}
catch (EvaluatorException ee) {
reportConversionError(value, type);
}
}
return Result;
}
else if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap();
if (type.isInstance(value))
return value;
reportConversionError(value, type);
}
else if (type.isInterface() && (value instanceof NativeObject
|| value instanceof NativeFunction)) {
// Try to use function/object as implementation of Java interface.
return createInterfaceAdapter(type, (ScriptableObject) value);
} else {
reportConversionError(value, type);
}
break;
}
return value;
} }
|
public class class_name {
static Object coerceTypeImpl(Class<?> type, Object value)
{
if (value != null && value.getClass() == type) {
return value; // depends on control dependency: [if], data = [none]
}
switch (getJSTypeCode(value)) {
case JSTYPE_NULL:
// raise error if type.isPrimitive()
if (type.isPrimitive()) {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
return null;
case JSTYPE_UNDEFINED:
if (type == ScriptRuntime.StringClass ||
type == ScriptRuntime.ObjectClass) {
return "undefined"; // depends on control dependency: [if], data = [none]
}
reportConversionError("undefined", type);
break;
case JSTYPE_BOOLEAN:
// Under LC3, only JS Booleans can be coerced into a Boolean value
if (type == Boolean.TYPE ||
type == ScriptRuntime.BooleanClass ||
type == ScriptRuntime.ObjectClass) {
return value; // depends on control dependency: [if], data = [none]
}
else if (type == ScriptRuntime.StringClass) {
return value.toString(); // depends on control dependency: [if], data = [none]
}
else {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
break;
case JSTYPE_NUMBER:
if (type == ScriptRuntime.StringClass) {
return ScriptRuntime.toString(value); // depends on control dependency: [if], data = [none]
}
else if (type == ScriptRuntime.ObjectClass) {
Context context = Context.getCurrentContext();
if(context.hasFeature(Context.FEATURE_INTEGER_WITHOUT_DECIMAL_PLACE)) {
//to process numbers like 2.0 as 2 without decimal place
long roundedValue = Math.round(toDouble(value));
if(roundedValue == toDouble(value)) {
return coerceToNumber(Long.TYPE, value); // depends on control dependency: [if], data = [none]
}
}
return coerceToNumber(Double.TYPE, value); // depends on control dependency: [if], data = [none]
}
else if ((type.isPrimitive() && type != Boolean.TYPE) ||
ScriptRuntime.NumberClass.isAssignableFrom(type)) {
return coerceToNumber(type, value); // depends on control dependency: [if], data = [none]
}
else {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
break;
case JSTYPE_STRING:
if (type == ScriptRuntime.StringClass || type.isInstance(value)) {
return value.toString(); // depends on control dependency: [if], data = [none]
}
else if (type == Character.TYPE
|| type == ScriptRuntime.CharacterClass)
{
// Special case for converting a single char string to a
// character
// Placed here because it applies *only* to JS strings,
// not other JS objects converted to strings
if (((CharSequence)value).length() == 1) {
return Character.valueOf(((CharSequence)value).charAt(0)); // depends on control dependency: [if], data = [none]
}
return coerceToNumber(type, value); // depends on control dependency: [if], data = [(type]
}
else if ((type.isPrimitive() && type != Boolean.TYPE)
|| ScriptRuntime.NumberClass.isAssignableFrom(type))
{
return coerceToNumber(type, value); // depends on control dependency: [if], data = [none]
}
else {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
break;
case JSTYPE_JAVA_CLASS:
if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap(); // depends on control dependency: [if], data = [none]
}
if (type == ScriptRuntime.ClassClass ||
type == ScriptRuntime.ObjectClass) {
return value; // depends on control dependency: [if], data = [none]
}
else if (type == ScriptRuntime.StringClass) {
return value.toString(); // depends on control dependency: [if], data = [none]
}
else {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
break;
case JSTYPE_JAVA_OBJECT:
case JSTYPE_JAVA_ARRAY:
if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap(); // depends on control dependency: [if], data = [none]
}
if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
return coerceToNumber(type, value); // depends on control dependency: [if], data = [none]
}
if (type == ScriptRuntime.StringClass) {
return value.toString(); // depends on control dependency: [if], data = [none]
}
if (type.isInstance(value)) {
return value; // depends on control dependency: [if], data = [none]
}
reportConversionError(value, type);
break;
case JSTYPE_OBJECT:
if (type == ScriptRuntime.StringClass) {
return ScriptRuntime.toString(value); // depends on control dependency: [if], data = [none]
}
else if (type.isPrimitive()) {
if (type == Boolean.TYPE) {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
return coerceToNumber(type, value); // depends on control dependency: [if], data = [none]
}
else if (type.isInstance(value)) {
return value; // depends on control dependency: [if], data = [none]
}
else if (type == ScriptRuntime.DateClass
&& value instanceof NativeDate)
{
double time = ((NativeDate)value).getJSTimeValue();
// XXX: This will replace NaN by 0
return new Date((long)time); // depends on control dependency: [if], data = [none]
}
else if (type.isArray() && value instanceof NativeArray) {
// Make a new java array, and coerce the JS array components
// to the target (component) type.
NativeArray array = (NativeArray) value;
long length = array.getLength();
Class<?> arrayType = type.getComponentType();
Object Result = Array.newInstance(arrayType, (int)length);
for (int i = 0 ; i < length ; ++i) {
try {
Array.set(Result, i, coerceTypeImpl(
arrayType, array.get(i, array))); // depends on control dependency: [try], data = [none]
}
catch (EvaluatorException ee) {
reportConversionError(value, type);
} // depends on control dependency: [catch], data = [none]
}
return Result; // depends on control dependency: [if], data = [none]
}
else if (value instanceof Wrapper) {
value = ((Wrapper)value).unwrap(); // depends on control dependency: [if], data = [none]
if (type.isInstance(value))
return value;
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
else if (type.isInterface() && (value instanceof NativeObject
|| value instanceof NativeFunction)) {
// Try to use function/object as implementation of Java interface.
return createInterfaceAdapter(type, (ScriptableObject) value); // depends on control dependency: [if], data = [none]
} else {
reportConversionError(value, type); // depends on control dependency: [if], data = [none]
}
break;
}
return value;
} }
|
public class class_name {
public void setExtractionCacheMaxAge(String extractionCacheMaxAge) {
try {
setExtractionCacheMaxAge(Float.parseFloat(extractionCacheMaxAge));
} catch (NumberFormatException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_PARSE_EXTRACTION_CACHE_AGE_FAILED_2,
extractionCacheMaxAge,
new Float(DEFAULT_EXTRACTION_CACHE_MAX_AGE)),
e);
setExtractionCacheMaxAge(DEFAULT_EXTRACTION_CACHE_MAX_AGE);
}
} }
|
public class class_name {
public void setExtractionCacheMaxAge(String extractionCacheMaxAge) {
try {
setExtractionCacheMaxAge(Float.parseFloat(extractionCacheMaxAge)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_PARSE_EXTRACTION_CACHE_AGE_FAILED_2,
extractionCacheMaxAge,
new Float(DEFAULT_EXTRACTION_CACHE_MAX_AGE)),
e);
setExtractionCacheMaxAge(DEFAULT_EXTRACTION_CACHE_MAX_AGE);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static BundleContext getBundleContext( final Bundle bundle )
{
try
{
// first try to find the getBundleContext method (OSGi spec >= 4.10)
final Method method = Bundle.class.getDeclaredMethod( "getBundleContext" );
if( !method.isAccessible() )
{
method.setAccessible( true );
}
return (BundleContext) method.invoke( bundle );
}
catch( Exception e )
{
// then try to find a field in the bundle that looks like a bundle context
try
{
final Field[] fields = bundle.getClass().getDeclaredFields();
for( Field field : fields )
{
if( BundleContext.class.isAssignableFrom( field.getType() ) )
{
if( !field.isAccessible() )
{
field.setAccessible( true );
}
return (BundleContext) field.get( bundle );
}
}
}
catch( Exception ignore )
{
// ignore
}
}
// well, discovery failed
return null;
} }
|
public class class_name {
public static BundleContext getBundleContext( final Bundle bundle )
{
try
{
// first try to find the getBundleContext method (OSGi spec >= 4.10)
final Method method = Bundle.class.getDeclaredMethod( "getBundleContext" );
if( !method.isAccessible() )
{
method.setAccessible( true ); // depends on control dependency: [if], data = [none]
}
return (BundleContext) method.invoke( bundle ); // depends on control dependency: [try], data = [none]
}
catch( Exception e )
{
// then try to find a field in the bundle that looks like a bundle context
try
{
final Field[] fields = bundle.getClass().getDeclaredFields();
for( Field field : fields )
{
if( BundleContext.class.isAssignableFrom( field.getType() ) )
{
if( !field.isAccessible() )
{
field.setAccessible( true ); // depends on control dependency: [if], data = [none]
}
return (BundleContext) field.get( bundle ); // depends on control dependency: [if], data = [none]
}
}
}
catch( Exception ignore )
{
// ignore
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
// well, discovery failed
return null;
} }
|
public class class_name {
public int[] otherOccurrences(Entity entity){
List<Integer> other = new ArrayList<Integer>();
for (int i = 0; i < doc.size(); i++) {
if (i == entity.startPosition) { continue; }
if (matches(entity, i)) {
other.add(Integer.valueOf(i));
}
}
return toArray(other);
} }
|
public class class_name {
public int[] otherOccurrences(Entity entity){
List<Integer> other = new ArrayList<Integer>();
for (int i = 0; i < doc.size(); i++) {
if (i == entity.startPosition) { continue; }
if (matches(entity, i)) {
other.add(Integer.valueOf(i));
// depends on control dependency: [if], data = [none]
}
}
return toArray(other);
} }
|
public class class_name {
public Object convertStringToObject(Object resource, String className, String versionRange, String string)
{
if ((string == null) || (string.length() == 0))
return null;
Object object = null;
try {
if (resource == null)
{
Object classAccess = this.getClassBundleService(null, className, versionRange, null, 0);
if (classAccess != null)
object = this.convertStringToObject(string);
}
else
{
/*Bundle bundle =*/ this.findBundle(resource, bundleContext, ClassFinderActivator.getPackageName(className, false), versionRange);
object = this.convertStringToObject(string);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return object;
} }
|
public class class_name {
public Object convertStringToObject(Object resource, String className, String versionRange, String string)
{
if ((string == null) || (string.length() == 0))
return null;
Object object = null;
try {
if (resource == null)
{
Object classAccess = this.getClassBundleService(null, className, versionRange, null, 0);
if (classAccess != null)
object = this.convertStringToObject(string);
}
else
{
/*Bundle bundle =*/ this.findBundle(resource, bundleContext, ClassFinderActivator.getPackageName(className, false), versionRange); // depends on control dependency: [if], data = [(resource]
object = this.convertStringToObject(string); // depends on control dependency: [if], data = [none]
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return object;
} }
|
public class class_name {
private SelectionType getSelection(final Annotation[] annotations) {
for (final Annotation annotation : annotations) {
if (annotation instanceof Audit) {
final Audit audit = (Audit) annotation;
return audit.selection();
}
}
return null;
} }
|
public class class_name {
private SelectionType getSelection(final Annotation[] annotations) {
for (final Annotation annotation : annotations) {
if (annotation instanceof Audit) {
final Audit audit = (Audit) annotation;
return audit.selection(); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static void handleRequestError(final Response response) {
if (response.getBody() == null) {
throw new StitchServiceException(
String.format(
Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()),
StitchServiceErrorCode.UNKNOWN);
}
final String body;
try {
body = readAllToString(response.getBody());
} catch (final Exception e) {
throw new StitchServiceException(
String.format(
Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()),
StitchServiceErrorCode.UNKNOWN);
}
final String errorMsg = handleRichError(response, body);
throw new StitchServiceException(errorMsg, StitchServiceErrorCode.UNKNOWN);
} }
|
public class class_name {
public static void handleRequestError(final Response response) {
if (response.getBody() == null) {
throw new StitchServiceException(
String.format(
Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()),
StitchServiceErrorCode.UNKNOWN);
}
final String body;
try {
body = readAllToString(response.getBody()); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw new StitchServiceException(
String.format(
Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()),
StitchServiceErrorCode.UNKNOWN);
} // depends on control dependency: [catch], data = [none]
final String errorMsg = handleRichError(response, body);
throw new StitchServiceException(errorMsg, StitchServiceErrorCode.UNKNOWN);
} }
|
public class class_name {
private static boolean areAttachmentLabelsUnique(List<String> labels) {
Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < labels.size(); i++) {
map.put(labels.get(i), labels.get(i));
}
if (labels.size() == map.size()) {
return true;
} else {
return false;
}
} }
|
public class class_name {
private static boolean areAttachmentLabelsUnique(List<String> labels) {
Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < labels.size(); i++) {
map.put(labels.get(i), labels.get(i));
// depends on control dependency: [for], data = [i]
}
if (labels.size() == map.size()) {
return true;
// depends on control dependency: [if], data = [none]
} else {
return false;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean configure(FeatureContext context) {
if (!context.getConfiguration().isRegistered(TextMessageBodyWriter.class)) {
context.register(TextMessageBodyWriter.class);
}
if (!context.getConfiguration().isRegistered(CaptchaWriterInterceptor.class)) {
context.register(CaptchaWriterInterceptor.class);
}
if (!context.getConfiguration().isRegistered(PathMessageBodyWriter.class)) {
context.register(PathMessageBodyWriter.class);
}
if (!context.getConfiguration().isRegistered(ContentLengthWriterInterceptor.class)) {
context.register(ContentLengthWriterInterceptor.class);
}
if (!context.getConfiguration().isRegistered(StreamingWriterInterceptor.class)) {
context.register(StreamingWriterInterceptor.class);
// streaming process
context.register(BlobStreamingProcess.class);
context.register(BytesStreamingProcess.class);
context.register(ClobStreamingProcess.class);
context.register(FileStreamingProcess.class);
context.register(InputStreamingProcess.class);
context.register(PathStreamingProcess.class);
}
return false;
} }
|
public class class_name {
@Override
public boolean configure(FeatureContext context) {
if (!context.getConfiguration().isRegistered(TextMessageBodyWriter.class)) {
context.register(TextMessageBodyWriter.class); // depends on control dependency: [if], data = [none]
}
if (!context.getConfiguration().isRegistered(CaptchaWriterInterceptor.class)) {
context.register(CaptchaWriterInterceptor.class); // depends on control dependency: [if], data = [none]
}
if (!context.getConfiguration().isRegistered(PathMessageBodyWriter.class)) {
context.register(PathMessageBodyWriter.class); // depends on control dependency: [if], data = [none]
}
if (!context.getConfiguration().isRegistered(ContentLengthWriterInterceptor.class)) {
context.register(ContentLengthWriterInterceptor.class); // depends on control dependency: [if], data = [none]
}
if (!context.getConfiguration().isRegistered(StreamingWriterInterceptor.class)) {
context.register(StreamingWriterInterceptor.class); // depends on control dependency: [if], data = [none]
// streaming process
context.register(BlobStreamingProcess.class); // depends on control dependency: [if], data = [none]
context.register(BytesStreamingProcess.class); // depends on control dependency: [if], data = [none]
context.register(ClobStreamingProcess.class); // depends on control dependency: [if], data = [none]
context.register(FileStreamingProcess.class); // depends on control dependency: [if], data = [none]
context.register(InputStreamingProcess.class); // depends on control dependency: [if], data = [none]
context.register(PathStreamingProcess.class); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@FFDCIgnore({ LookaheadSuccess.class })
private boolean jj_2_6(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_6(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(5, xla); }
} }
|
public class class_name {
@FFDCIgnore({ LookaheadSuccess.class })
private boolean jj_2_6(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_6(); } // depends on control dependency: [try], data = [none]
catch(LookaheadSuccess ls) { return true; } // depends on control dependency: [catch], data = [none]
finally { jj_save(5, xla); }
} }
|
public class class_name {
public void marshall(UnshareDirectoryRequest unshareDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (unshareDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(unshareDirectoryRequest.getDirectoryId(), DIRECTORYID_BINDING);
protocolMarshaller.marshall(unshareDirectoryRequest.getUnshareTarget(), UNSHARETARGET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UnshareDirectoryRequest unshareDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (unshareDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(unshareDirectoryRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(unshareDirectoryRequest.getUnshareTarget(), UNSHARETARGET_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 java.util.List<DirectConnectGateway> getDirectConnectGateways() {
if (directConnectGateways == null) {
directConnectGateways = new com.amazonaws.internal.SdkInternalList<DirectConnectGateway>();
}
return directConnectGateways;
} }
|
public class class_name {
public java.util.List<DirectConnectGateway> getDirectConnectGateways() {
if (directConnectGateways == null) {
directConnectGateways = new com.amazonaws.internal.SdkInternalList<DirectConnectGateway>(); // depends on control dependency: [if], data = [none]
}
return directConnectGateways;
} }
|
public class class_name {
public <T extends Application> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event) {
AnnotatedType<T> annotatedType = event.getAnnotatedType();
if (Application.class.isAssignableFrom(annotatedType.getJavaClass())) {
// Do our magic.
event.setAnnotatedType(new AnnotatedType<T>() {
private final Annotation ADD_SWAGGER_ANNOTATION = () -> AddSwaggerResources.class;
@Override
public Class<T> getJavaClass() {
return annotatedType.getJavaClass();
}
@Override
public Set<AnnotatedConstructor<T>> getConstructors() {
return annotatedType.getConstructors();
}
@Override
public Set<AnnotatedMethod<? super T>> getMethods() {
return annotatedType.getMethods();
}
@Override
public Set<AnnotatedField<? super T>> getFields() {
return annotatedType.getFields();
}
@Override
public Type getBaseType() {
return annotatedType.getBaseType();
}
@Override
public Set<Type> getTypeClosure() {
return annotatedType.getTypeClosure();
}
@SuppressWarnings("unchecked")
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
if (AddSwaggerResources.class.equals(annotationType)) {
return (A) ADD_SWAGGER_ANNOTATION;
}
return annotatedType.getAnnotation(annotationType);
}
@Override
public Set<Annotation> getAnnotations() {
Set<Annotation> annotations = new HashSet<>(annotatedType.getAnnotations());
annotations.add(ADD_SWAGGER_ANNOTATION);
return annotations;
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
return false;
}
});
}
} }
|
public class class_name {
public <T extends Application> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event) {
AnnotatedType<T> annotatedType = event.getAnnotatedType();
if (Application.class.isAssignableFrom(annotatedType.getJavaClass())) {
// Do our magic.
event.setAnnotatedType(new AnnotatedType<T>() {
private final Annotation ADD_SWAGGER_ANNOTATION = () -> AddSwaggerResources.class;
@Override
public Class<T> getJavaClass() {
return annotatedType.getJavaClass();
}
@Override
public Set<AnnotatedConstructor<T>> getConstructors() {
return annotatedType.getConstructors();
}
@Override
public Set<AnnotatedMethod<? super T>> getMethods() {
return annotatedType.getMethods();
}
@Override
public Set<AnnotatedField<? super T>> getFields() {
return annotatedType.getFields();
}
@Override
public Type getBaseType() {
return annotatedType.getBaseType();
}
@Override
public Set<Type> getTypeClosure() {
return annotatedType.getTypeClosure();
}
@SuppressWarnings("unchecked")
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
if (AddSwaggerResources.class.equals(annotationType)) {
return (A) ADD_SWAGGER_ANNOTATION; // depends on control dependency: [if], data = [none]
}
return annotatedType.getAnnotation(annotationType);
}
@Override
public Set<Annotation> getAnnotations() {
Set<Annotation> annotations = new HashSet<>(annotatedType.getAnnotations());
annotations.add(ADD_SWAGGER_ANNOTATION);
return annotations;
}
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
return false;
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean updatePolicy(String name, String newDocument)
throws PolicyStoreException {
String pid = this.getPID(name);
if (!contains(name)) {
throw new PolicyStoreException("Update: policy " + pid
+ " not found");
}
if (datastreamControlGroup.equals("X")) {
// inline, modify by value
try {
this.apiMService
.modifyDatastreamByValue(getContext(),
pid,
FESL_POLICY_DATASTREAM,
null,
null,
null,
null,
new ByteArrayInputStream(newDocument
.getBytes("UTF-8")),
"DISABLED",
null,
"Modifying policy " + pid,
null);
} catch (Exception e) {
throw new PolicyStoreException("Update: error modifying datastream by value for "
+ pid
+ " - "
+ e.getMessage(),
e);
}
} else if (datastreamControlGroup.equals("M")) {
// managed, generate temp location, modify by reference
String dsLocation = null;
try {
ByteArrayInputStream is =
new ByteArrayInputStream(newDocument.getBytes("UTF-8"));
dsLocation = apiMService.putTempStream(getContext(), is);
} catch (Exception e) {
throw new PolicyStoreException("Update: error generating temp datastream location - "
+ e.getMessage(),
e);
}
try {
apiMService.modifyDatastreamByReference(getContext(),
pid,
FESL_POLICY_DATASTREAM,
null,
null,
null,
null,
dsLocation,
"DISABLED",
null,
"Modifying policy "
+ pid,
null);
} catch (ServerException e) {
throw new PolicyStoreException("Update: error modifying datastream by reference for "
+ pid
+ " - "
+ e.getMessage(),
e);
}
} else {
throw new PolicyStoreException("Update: Invalid datastream control group "
+ datastreamControlGroup + " - use M or X");
}
return true;
} }
|
public class class_name {
@Override
public boolean updatePolicy(String name, String newDocument)
throws PolicyStoreException {
String pid = this.getPID(name);
if (!contains(name)) {
throw new PolicyStoreException("Update: policy " + pid
+ " not found");
}
if (datastreamControlGroup.equals("X")) {
// inline, modify by value
try {
this.apiMService
.modifyDatastreamByValue(getContext(),
pid,
FESL_POLICY_DATASTREAM,
null,
null,
null,
null,
new ByteArrayInputStream(newDocument
.getBytes("UTF-8")),
"DISABLED",
null,
"Modifying policy " + pid,
null); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new PolicyStoreException("Update: error modifying datastream by value for "
+ pid
+ " - "
+ e.getMessage(),
e);
} // depends on control dependency: [catch], data = [none]
} else if (datastreamControlGroup.equals("M")) {
// managed, generate temp location, modify by reference
String dsLocation = null;
try {
ByteArrayInputStream is =
new ByteArrayInputStream(newDocument.getBytes("UTF-8"));
dsLocation = apiMService.putTempStream(getContext(), is); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new PolicyStoreException("Update: error generating temp datastream location - "
+ e.getMessage(),
e);
} // depends on control dependency: [catch], data = [none]
try {
apiMService.modifyDatastreamByReference(getContext(),
pid,
FESL_POLICY_DATASTREAM,
null,
null,
null,
null,
dsLocation,
"DISABLED",
null,
"Modifying policy "
+ pid,
null); // depends on control dependency: [try], data = [none]
} catch (ServerException e) {
throw new PolicyStoreException("Update: error modifying datastream by reference for "
+ pid
+ " - "
+ e.getMessage(),
e);
} // depends on control dependency: [catch], data = [none]
} else {
throw new PolicyStoreException("Update: Invalid datastream control group "
+ datastreamControlGroup + " - use M or X");
}
return true;
} }
|
public class class_name {
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException e) {
logger.error("IOException should not have been thrown.", e);
}
} }
|
public class class_name {
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
logger.error("IOException should not have been thrown.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int getNumberOfClasses()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNumberOfClasses");
SibTr.exit(tc, "getNumberOfClasses", Integer.valueOf(numberOfClasses));
}
return numberOfClasses;
} }
|
public class class_name {
public int getNumberOfClasses()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getNumberOfClasses"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getNumberOfClasses", Integer.valueOf(numberOfClasses)); // depends on control dependency: [if], data = [none]
}
return numberOfClasses;
} }
|
public class class_name {
@Override
public JsonElement serialize(CMAEntry src, Type type, JsonSerializationContext context) {
JsonObject fields = new JsonObject();
for (Map.Entry<String, LinkedHashMap<String, Object>> field : src.getFields().entrySet()) {
LinkedHashMap<String, Object> value = field.getValue();
if (value == null) {
continue;
}
String fieldId = field.getKey();
JsonObject jsonField = serializeField(context, field.getValue());
if (jsonField != null) {
fields.add(fieldId, jsonField);
}
}
JsonObject result = new JsonObject();
result.add("fields", fields);
final CMASystem sys = src.getSystem();
if (sys != null) {
result.add("sys", context.serialize(sys));
}
return result;
} }
|
public class class_name {
@Override
public JsonElement serialize(CMAEntry src, Type type, JsonSerializationContext context) {
JsonObject fields = new JsonObject();
for (Map.Entry<String, LinkedHashMap<String, Object>> field : src.getFields().entrySet()) {
LinkedHashMap<String, Object> value = field.getValue();
if (value == null) {
continue;
}
String fieldId = field.getKey();
JsonObject jsonField = serializeField(context, field.getValue());
if (jsonField != null) {
fields.add(fieldId, jsonField); // depends on control dependency: [if], data = [none]
}
}
JsonObject result = new JsonObject();
result.add("fields", fields);
final CMASystem sys = src.getSystem();
if (sys != null) {
result.add("sys", context.serialize(sys)); // depends on control dependency: [if], data = [(sys]
}
return result;
} }
|
public class class_name {
protected Response createResponse(Throwable exception, ValidationErrorUserException error,
Map<String, List<String>> errorsMap) {
LOG.warn("Service failed due to validation failure.", error);
if (exception == error) {
return createResponse(Status.BAD_REQUEST, error, errorsMap);
} else {
return createResponse(Status.BAD_REQUEST, error, exception.getMessage(), errorsMap);
}
} }
|
public class class_name {
protected Response createResponse(Throwable exception, ValidationErrorUserException error,
Map<String, List<String>> errorsMap) {
LOG.warn("Service failed due to validation failure.", error);
if (exception == error) {
return createResponse(Status.BAD_REQUEST, error, errorsMap); // depends on control dependency: [if], data = [none]
} else {
return createResponse(Status.BAD_REQUEST, error, exception.getMessage(), errorsMap); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ResultSetMetaData getMetaData() {
if (metadata == null) {
try {
metadata = resultSet.getMetaData();
} catch (SQLException e) {
throw new FacesException(e);
}
}
return (metadata);
} }
|
public class class_name {
private ResultSetMetaData getMetaData() {
if (metadata == null) {
try {
metadata = resultSet.getMetaData(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new FacesException(e);
} // depends on control dependency: [catch], data = [none]
}
return (metadata);
} }
|
public class class_name {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: java twitter4j.examples.suggestedusers.GetMemberSuggestions [slug]");
System.exit(-1);
}
System.out.println("Showing suggested users in " + args[0] + " category.");
try {
Twitter twitter = new TwitterFactory().getInstance();
ResponseList<User> users = twitter.getMemberSuggestions(args[0]);
for (User user : users) {
if (user.getStatus() != null) {
System.out.println("@" + user.getScreenName() + " - " + user.getStatus().getText());
} else {
// the user is protected
System.out.println("@" + user.getScreenName());
}
}
System.out.println("done.");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get suggested users: " + te.getMessage());
System.exit(-1);
}
} }
|
public class class_name {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: java twitter4j.examples.suggestedusers.GetMemberSuggestions [slug]"); // depends on control dependency: [if], data = [none]
System.exit(-1); // depends on control dependency: [if], data = [1)]
}
System.out.println("Showing suggested users in " + args[0] + " category.");
try {
Twitter twitter = new TwitterFactory().getInstance();
ResponseList<User> users = twitter.getMemberSuggestions(args[0]);
for (User user : users) {
if (user.getStatus() != null) {
System.out.println("@" + user.getScreenName() + " - " + user.getStatus().getText()); // depends on control dependency: [if], data = [none]
} else {
// the user is protected
System.out.println("@" + user.getScreenName()); // depends on control dependency: [if], data = [none]
}
}
System.out.println("done."); // depends on control dependency: [try], data = [none]
System.exit(0); // depends on control dependency: [try], data = [none]
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get suggested users: " + te.getMessage());
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static byte[] asByteArray(String hex) {
byte[] bts = new byte[hex.length() / 2];
for (int i = 0; i < bts.length; i++) {
bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2),
16);
}
return bts;
} }
|
public class class_name {
public static byte[] asByteArray(String hex) {
byte[] bts = new byte[hex.length() / 2];
for (int i = 0; i < bts.length; i++) {
bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2),
16); // depends on control dependency: [for], data = [i]
}
return bts;
} }
|
public class class_name {
public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory)
{
if (mutationProbability.nextEvent(rng))
{
return treeFactory.generateRandomCandidate(rng);
}
else
{
Node newCondition = condition.mutate(rng, mutationProbability, treeFactory);
Node newThen = then.mutate(rng, mutationProbability, treeFactory);
Node newOtherwise = otherwise.mutate(rng, mutationProbability, treeFactory);
if (newCondition != condition || newThen != then || newOtherwise != otherwise)
{
return new IfThenElse(newCondition, newThen, newOtherwise);
}
else
{
// Tree has not changed.
return this;
}
}
} }
|
public class class_name {
public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory)
{
if (mutationProbability.nextEvent(rng))
{
return treeFactory.generateRandomCandidate(rng); // depends on control dependency: [if], data = [none]
}
else
{
Node newCondition = condition.mutate(rng, mutationProbability, treeFactory);
Node newThen = then.mutate(rng, mutationProbability, treeFactory);
Node newOtherwise = otherwise.mutate(rng, mutationProbability, treeFactory);
if (newCondition != condition || newThen != then || newOtherwise != otherwise)
{
return new IfThenElse(newCondition, newThen, newOtherwise); // depends on control dependency: [if], data = [(newCondition]
}
else
{
// Tree has not changed.
return this; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public Connection getConnection(ConnectionRequestContext requestContext) throws SQLException {
do {
int expectingMaxSize = poolAdapter.getMaxPoolSize();
try {
long startNanos = System.nanoTime();
Connection connection = getConnectionFactory().getConnection(requestContext);
long endNanos = System.nanoTime();
long connectionAcquireDurationMillis = TimeUnit.NANOSECONDS.toMillis(endNanos - startNanos);
if (connectionAcquireDurationMillis > timeoutMillis) {
LOGGER.warn("Connection was acquired in {} millis, timeoutMillis is set to {}",
connectionAcquireDurationMillis, timeoutMillis);
int maxPoolSize = poolAdapter.getMaxPoolSize();
if (maxPoolSize < maxOverflowPoolSize) {
if (!incrementPoolSize(expectingMaxSize)) {
LOGGER.warn("Can't acquire connection, pool size has already overflown to its max size.");
}
} else {
LOGGER.info("Pool size has already overflown to its max size of {}", maxPoolSize);
}
}
return connection;
} catch (AcquireTimeoutException e) {
if (!incrementPoolSize(expectingMaxSize)) {
LOGGER.warn("Can't acquire connection due to adaptor timeout, pool size has already overflown to its max size.");
throw e;
}
}
} while (true);
} }
|
public class class_name {
@Override
public Connection getConnection(ConnectionRequestContext requestContext) throws SQLException {
do {
int expectingMaxSize = poolAdapter.getMaxPoolSize();
try {
long startNanos = System.nanoTime();
Connection connection = getConnectionFactory().getConnection(requestContext);
long endNanos = System.nanoTime();
long connectionAcquireDurationMillis = TimeUnit.NANOSECONDS.toMillis(endNanos - startNanos);
if (connectionAcquireDurationMillis > timeoutMillis) {
LOGGER.warn("Connection was acquired in {} millis, timeoutMillis is set to {}",
connectionAcquireDurationMillis, timeoutMillis);
// depends on control dependency: [if], data = [none]
int maxPoolSize = poolAdapter.getMaxPoolSize();
if (maxPoolSize < maxOverflowPoolSize) {
if (!incrementPoolSize(expectingMaxSize)) {
LOGGER.warn("Can't acquire connection, pool size has already overflown to its max size.");
}
} else {
LOGGER.info("Pool size has already overflown to its max size of {}", maxPoolSize);
}
}
return connection;
} catch (AcquireTimeoutException e) {
if (!incrementPoolSize(expectingMaxSize)) {
LOGGER.warn("Can't acquire connection due to adaptor timeout, pool size has already overflown to its max size.");
// depends on control dependency: [if], data = [none]
throw e;
}
}
} while (true);
} }
|
public class class_name {
protected boolean decide() {
assert propagated();
int decision = 0;
while (decision == 0 && !this.decisions.empty()) {
final int lit = this.decisions.top();
this.decisions.pop(lit);
if (val(lit) == 0) { decision = lit; }
}
if (decision == 0) { return false; }
assert decision > 0;
if (this.phases.get(decision) < 0) { decision = -decision; }
this.stats.decisions++;
this.stats.levels += this.level;
assume(decision);
return true;
} }
|
public class class_name {
protected boolean decide() {
assert propagated();
int decision = 0;
while (decision == 0 && !this.decisions.empty()) {
final int lit = this.decisions.top();
this.decisions.pop(lit); // depends on control dependency: [while], data = [none]
if (val(lit) == 0) { decision = lit; } // depends on control dependency: [if], data = [none]
}
if (decision == 0) { return false; } // depends on control dependency: [if], data = [none]
assert decision > 0;
if (this.phases.get(decision) < 0) { decision = -decision; } // depends on control dependency: [if], data = [none]
this.stats.decisions++;
this.stats.levels += this.level;
assume(decision);
return true;
} }
|
public class class_name {
public void marshall(ResponseTimeRootCauseService responseTimeRootCauseService, ProtocolMarshaller protocolMarshaller) {
if (responseTimeRootCauseService == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(responseTimeRootCauseService.getName(), NAME_BINDING);
protocolMarshaller.marshall(responseTimeRootCauseService.getNames(), NAMES_BINDING);
protocolMarshaller.marshall(responseTimeRootCauseService.getType(), TYPE_BINDING);
protocolMarshaller.marshall(responseTimeRootCauseService.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(responseTimeRootCauseService.getEntityPath(), ENTITYPATH_BINDING);
protocolMarshaller.marshall(responseTimeRootCauseService.getInferred(), INFERRED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ResponseTimeRootCauseService responseTimeRootCauseService, ProtocolMarshaller protocolMarshaller) {
if (responseTimeRootCauseService == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(responseTimeRootCauseService.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(responseTimeRootCauseService.getNames(), NAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(responseTimeRootCauseService.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(responseTimeRootCauseService.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(responseTimeRootCauseService.getEntityPath(), ENTITYPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(responseTimeRootCauseService.getInferred(), INFERRED_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 List<ResourceRefType<MessageDrivenBeanType<T>>> getAllResourceRef()
{
List<ResourceRefType<MessageDrivenBeanType<T>>> list = new ArrayList<ResourceRefType<MessageDrivenBeanType<T>>>();
List<Node> nodeList = childNode.get("resource-ref");
for(Node node: nodeList)
{
ResourceRefType<MessageDrivenBeanType<T>> type = new ResourceRefTypeImpl<MessageDrivenBeanType<T>>(this, "resource-ref", childNode, node);
list.add(type);
}
return list;
} }
|
public class class_name {
public List<ResourceRefType<MessageDrivenBeanType<T>>> getAllResourceRef()
{
List<ResourceRefType<MessageDrivenBeanType<T>>> list = new ArrayList<ResourceRefType<MessageDrivenBeanType<T>>>();
List<Node> nodeList = childNode.get("resource-ref");
for(Node node: nodeList)
{
ResourceRefType<MessageDrivenBeanType<T>> type = new ResourceRefTypeImpl<MessageDrivenBeanType<T>>(this, "resource-ref", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
private static void addURL(final List<URI> list, final String uriString) {
try {
try {
val url = new URL(URLDecoder.decode(uriString, StandardCharsets.UTF_8.name()));
list.add(new URI(url.getProtocol(), url.getAuthority(), url.getPath(), url.getQuery(), null));
} catch (final MalformedURLException e) {
list.add(new URI(uriString));
}
} catch (final Exception e) {
LOGGER.warn("[{}] is not a valid distribution point URI.", uriString);
}
} }
|
public class class_name {
private static void addURL(final List<URI> list, final String uriString) {
try {
try {
val url = new URL(URLDecoder.decode(uriString, StandardCharsets.UTF_8.name()));
list.add(new URI(url.getProtocol(), url.getAuthority(), url.getPath(), url.getQuery(), null)); // depends on control dependency: [try], data = [none]
} catch (final MalformedURLException e) {
list.add(new URI(uriString));
} // depends on control dependency: [catch], data = [none]
} catch (final Exception e) {
LOGGER.warn("[{}] is not a valid distribution point URI.", uriString);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void makeNameSpaceDataDir(Collection<File> dataDirs) throws IOException {
for (File data : dataDirs) {
try {
DiskChecker.checkDir(data);
} catch ( IOException e ) {
LOG.warn("Invalid directory in: " + data.getCanonicalPath() + ": "
+ e.getMessage());
}
}
} }
|
public class class_name {
public static void makeNameSpaceDataDir(Collection<File> dataDirs) throws IOException {
for (File data : dataDirs) {
try {
DiskChecker.checkDir(data); // depends on control dependency: [try], data = [none]
} catch ( IOException e ) {
LOG.warn("Invalid directory in: " + data.getCanonicalPath() + ": "
+ e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private void maybeRemoveUnusedTrailingParameters(Node argList, Scope fparamScope) {
Node lastArg;
while ((lastArg = argList.getLastChild()) != null) {
Node lValue = lastArg;
if (lastArg.isDefaultValue()) {
lValue = lastArg.getFirstChild();
if (NodeUtil.mayHaveSideEffects(lastArg.getLastChild(), compiler)) {
break;
}
}
if (lValue.isRest()) {
lValue = lValue.getFirstChild();
}
if (lValue.isDestructuringPattern()) {
if (lValue.hasChildren()) {
// TODO(johnlenz): handle the case where there are no assignments.
break;
} else {
// Remove empty destructuring patterns and their associated object literal assignment
// if it exists and if the right hand side does not have side effects. Note, a
// destructuring pattern with a "leftover" property key as in {a:{}} is not considered
// empty in this case!
NodeUtil.deleteNode(lastArg, compiler);
continue;
}
}
VarInfo varInfo = getVarInfo(getVarForNameNode(lValue, fparamScope));
if (varInfo.isRemovable()) {
NodeUtil.deleteNode(lastArg, compiler);
} else {
break;
}
}
} }
|
public class class_name {
private void maybeRemoveUnusedTrailingParameters(Node argList, Scope fparamScope) {
Node lastArg;
while ((lastArg = argList.getLastChild()) != null) {
Node lValue = lastArg;
if (lastArg.isDefaultValue()) {
lValue = lastArg.getFirstChild(); // depends on control dependency: [if], data = [none]
if (NodeUtil.mayHaveSideEffects(lastArg.getLastChild(), compiler)) {
break;
}
}
if (lValue.isRest()) {
lValue = lValue.getFirstChild(); // depends on control dependency: [if], data = [none]
}
if (lValue.isDestructuringPattern()) {
if (lValue.hasChildren()) {
// TODO(johnlenz): handle the case where there are no assignments.
break;
} else {
// Remove empty destructuring patterns and their associated object literal assignment
// if it exists and if the right hand side does not have side effects. Note, a
// destructuring pattern with a "leftover" property key as in {a:{}} is not considered
// empty in this case!
NodeUtil.deleteNode(lastArg, compiler); // depends on control dependency: [if], data = [none]
continue;
}
}
VarInfo varInfo = getVarInfo(getVarForNameNode(lValue, fparamScope));
if (varInfo.isRemovable()) {
NodeUtil.deleteNode(lastArg, compiler); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
} }
|
public class class_name {
public void addFile(String url) {
int count = windowMenu.getItemCount();
JMenuItem item;
if (count == 4) {
windowMenu.addSeparator();
count++;
}
JMenuItem lastItem = windowMenu.getItem(count -1);
boolean hasMoreWin = false;
int maxWin = 5;
if (lastItem != null &&
lastItem.getText().equals("More Windows...")) {
hasMoreWin = true;
maxWin++;
}
if (!hasMoreWin && count - 4 == 5) {
windowMenu.add(item = new JMenuItem("More Windows...", 'M'));
item.setActionCommand("More Windows...");
item.addActionListener(this);
return;
} else if (count - 4 <= maxWin) {
if (hasMoreWin) {
count--;
windowMenu.remove(lastItem);
}
String shortName = SwingGui.getShortName(url);
windowMenu.add(item = new JMenuItem((char)('0' + (count-4)) + " " + shortName, '0' + (count - 4)));
if (hasMoreWin) {
windowMenu.add(lastItem);
}
} else {
return;
}
item.setActionCommand(url);
item.addActionListener(this);
} }
|
public class class_name {
public void addFile(String url) {
int count = windowMenu.getItemCount();
JMenuItem item;
if (count == 4) {
windowMenu.addSeparator(); // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
JMenuItem lastItem = windowMenu.getItem(count -1);
boolean hasMoreWin = false;
int maxWin = 5;
if (lastItem != null &&
lastItem.getText().equals("More Windows...")) {
hasMoreWin = true; // depends on control dependency: [if], data = [none]
maxWin++; // depends on control dependency: [if], data = [none]
}
if (!hasMoreWin && count - 4 == 5) {
windowMenu.add(item = new JMenuItem("More Windows...", 'M')); // depends on control dependency: [if], data = [none]
item.setActionCommand("More Windows..."); // depends on control dependency: [if], data = [none]
item.addActionListener(this); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (count - 4 <= maxWin) {
if (hasMoreWin) {
count--; // depends on control dependency: [if], data = [none]
windowMenu.remove(lastItem); // depends on control dependency: [if], data = [none]
}
String shortName = SwingGui.getShortName(url);
windowMenu.add(item = new JMenuItem((char)('0' + (count-4)) + " " + shortName, '0' + (count - 4))); // depends on control dependency: [if], data = [(count - 4]
if (hasMoreWin) {
windowMenu.add(lastItem); // depends on control dependency: [if], data = [none]
}
} else {
return; // depends on control dependency: [if], data = [none]
}
item.setActionCommand(url);
item.addActionListener(this);
} }
|
public class class_name {
public HashSet<UserTypeVal> allInitialDataTypes() {
if (allInitialDataTypes == null) {
// Would be cleaner if we could call scala's apply method here, but it isn't part of a HashSet companion
// object -- instead it lives in GenericCompanion, and it's unclear now to get to it from Java.
allInitialDataTypes = new HashSet<>();
allInitialDataTypes = allInitialDataTypes.$plus(UserType.ADMIN);
}
return allInitialDataTypes;
} }
|
public class class_name {
public HashSet<UserTypeVal> allInitialDataTypes() {
if (allInitialDataTypes == null) {
// Would be cleaner if we could call scala's apply method here, but it isn't part of a HashSet companion
// object -- instead it lives in GenericCompanion, and it's unclear now to get to it from Java.
allInitialDataTypes = new HashSet<>();
// depends on control dependency: [if], data = [none]
allInitialDataTypes = allInitialDataTypes.$plus(UserType.ADMIN);
// depends on control dependency: [if], data = [none]
}
return allInitialDataTypes;
} }
|
public class class_name {
@Override
public void onCloseDocument(PdfWriter writer, Document document) {
super.onCloseDocument(writer, document);
if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) {
try {
printTotalPages(template, document.right(), footerBottom);
} catch (VectorPrintException | InstantiationException | IllegalAccessException ex) {
throw new VectorPrintRuntimeException(ex);
}
}
if (failuresHereAfter) {
printFailureHeader(template, 10, document.top() - 10);
}
} }
|
public class class_name {
@Override
public void onCloseDocument(PdfWriter writer, Document document) {
super.onCloseDocument(writer, document);
if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) {
try {
printTotalPages(template, document.right(), footerBottom); // depends on control dependency: [try], data = [none]
} catch (VectorPrintException | InstantiationException | IllegalAccessException ex) {
throw new VectorPrintRuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
}
if (failuresHereAfter) {
printFailureHeader(template, 10, document.top() - 10); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setProvisionedIops(java.util.Collection<Range> provisionedIops) {
if (provisionedIops == null) {
this.provisionedIops = null;
return;
}
this.provisionedIops = new com.amazonaws.internal.SdkInternalList<Range>(provisionedIops);
} }
|
public class class_name {
public void setProvisionedIops(java.util.Collection<Range> provisionedIops) {
if (provisionedIops == null) {
this.provisionedIops = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.provisionedIops = new com.amazonaws.internal.SdkInternalList<Range>(provisionedIops);
} }
|
public class class_name {
public static ReflectedInfo getFieldInfoByEffectiveName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
ReflectedInfo result = null;
for (ReflectedInfo info : infoList) {
if (name.equals(info.getEffectiveName())) {
result = info;
break;
}
}
return result;
} }
|
public class class_name {
public static ReflectedInfo getFieldInfoByEffectiveName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
ReflectedInfo result = null;
for (ReflectedInfo info : infoList) {
if (name.equals(info.getEffectiveName())) {
result = info;
// depends on control dependency: [if], data = [none]
break;
}
}
return result;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <G, ERR, A, I extends Iterable<? extends G>> OrFuture<I, Every<ERR>>
sequence(Iterable<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> input,
Collector<? super G, A, I> collector) {
OrPromise<I, Every<ERR>> promise = promise();
AtomicInteger count = new AtomicInteger(0);
AtomicBoolean finished = new AtomicBoolean(false);
// this is necessary as nothing guarantees the iterable can be iterated multiple times
Queue<OrFuture<? extends G, ? extends Every<? extends ERR>>> copy = new ConcurrentLinkedQueue<>();
java.util.Iterator<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> iterator = input.iterator();
while (iterator.hasNext()) {
count.incrementAndGet();
OrFuture<? extends G, ? extends Every<? extends ERR>> future = iterator.next();
copy.add(future);
if (!iterator.hasNext()) finished.set(true);
future.onComplete(or -> {
if (or.isBad()) {
promise.tryFailure((Every<ERR>) or.getBad());
} else if (count.decrementAndGet() == 0 && finished.get()) {
promise.complete(accumulate(copy, collector));
}
});
}
return promise.future();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <G, ERR, A, I extends Iterable<? extends G>> OrFuture<I, Every<ERR>>
sequence(Iterable<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> input,
Collector<? super G, A, I> collector) {
OrPromise<I, Every<ERR>> promise = promise();
AtomicInteger count = new AtomicInteger(0);
AtomicBoolean finished = new AtomicBoolean(false);
// this is necessary as nothing guarantees the iterable can be iterated multiple times
Queue<OrFuture<? extends G, ? extends Every<? extends ERR>>> copy = new ConcurrentLinkedQueue<>();
java.util.Iterator<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> iterator = input.iterator();
while (iterator.hasNext()) {
count.incrementAndGet(); // depends on control dependency: [while], data = [none]
OrFuture<? extends G, ? extends Every<? extends ERR>> future = iterator.next(); // depends on control dependency: [while], data = [none]
copy.add(future); // depends on control dependency: [while], data = [none]
if (!iterator.hasNext()) finished.set(true);
future.onComplete(or -> {
if (or.isBad()) {
promise.tryFailure((Every<ERR>) or.getBad()); // depends on control dependency: [while], data = [none]
} else if (count.decrementAndGet() == 0 && finished.get()) {
promise.complete(accumulate(copy, collector));
}
});
}
return promise.future();
} }
|
public class class_name {
private Object getPropertyValue(GDLParser.LiteralContext literalContext) {
String text;
if (literalContext.StringLiteral() != null) {
return parseString(literalContext.StringLiteral().getText());
} else if (literalContext.BooleanLiteral() != null) {
return Boolean.parseBoolean(literalContext.BooleanLiteral().getText());
} else if (literalContext.IntegerLiteral() != null) {
text = literalContext.IntegerLiteral().getText().toLowerCase();
if (text.endsWith("l")) {
return Long.parseLong(text.substring(0, text.length() - 1));
}
return Integer.parseInt(text);
} else if (literalContext.FloatingPointLiteral() != null) {
text = literalContext.FloatingPointLiteral().getText().toLowerCase();
if (text.endsWith("f")) {
return Float.parseFloat(text.substring(0, text.length() - 1));
} else if (text.endsWith("d")) {
return Double.parseDouble(text.substring(0, text.length() - 1));
}
return Float.parseFloat(text);
}
return null;
} }
|
public class class_name {
private Object getPropertyValue(GDLParser.LiteralContext literalContext) {
String text;
if (literalContext.StringLiteral() != null) {
return parseString(literalContext.StringLiteral().getText()); // depends on control dependency: [if], data = [(literalContext.StringLiteral()]
} else if (literalContext.BooleanLiteral() != null) {
return Boolean.parseBoolean(literalContext.BooleanLiteral().getText()); // depends on control dependency: [if], data = [(literalContext.BooleanLiteral()]
} else if (literalContext.IntegerLiteral() != null) {
text = literalContext.IntegerLiteral().getText().toLowerCase(); // depends on control dependency: [if], data = [none]
if (text.endsWith("l")) {
return Long.parseLong(text.substring(0, text.length() - 1)); // depends on control dependency: [if], data = [none]
}
return Integer.parseInt(text); // depends on control dependency: [if], data = [none]
} else if (literalContext.FloatingPointLiteral() != null) {
text = literalContext.FloatingPointLiteral().getText().toLowerCase(); // depends on control dependency: [if], data = [none]
if (text.endsWith("f")) {
return Float.parseFloat(text.substring(0, text.length() - 1)); // depends on control dependency: [if], data = [none]
} else if (text.endsWith("d")) {
return Double.parseDouble(text.substring(0, text.length() - 1)); // depends on control dependency: [if], data = [none]
}
return Float.parseFloat(text); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override
protected double[] probabilities(
final Seq<Phenotype<G, C>> population,
final int count
) {
assert population != null : "Population must not be null. ";
assert !population.isEmpty() : "Population is empty.";
assert count > 0 : "Population to select must be greater than zero. ";
final double N = population.size();
final double[] probabilities = new double[population.size()];
final double b = (_c - 1.0)/(pow(_c, N) - 1.0);
for (int i = 0; i < probabilities.length; ++i) {
probabilities[i] = pow(_c, i)*b;
}
return probabilities;
} }
|
public class class_name {
@Override
protected double[] probabilities(
final Seq<Phenotype<G, C>> population,
final int count
) {
assert population != null : "Population must not be null. ";
assert !population.isEmpty() : "Population is empty.";
assert count > 0 : "Population to select must be greater than zero. ";
final double N = population.size();
final double[] probabilities = new double[population.size()];
final double b = (_c - 1.0)/(pow(_c, N) - 1.0);
for (int i = 0; i < probabilities.length; ++i) {
probabilities[i] = pow(_c, i)*b; // depends on control dependency: [for], data = [i]
}
return probabilities;
} }
|
public class class_name {
PointL buildPathPortion(final Projection pProjection,
final PointL pOffset,
final boolean pStorePoints){
final int size = mOriginalPoints.size();
if (size < 2) { // nothing to paint
return pOffset;
}
computeProjected(pProjection);
computeDistances();
final PointL offset;
if (pOffset != null) {
offset = pOffset;
} else {
offset = new PointL();
getBestOffset(pProjection, offset);
}
mSegmentClipper.init();
clipAndStore(pProjection, offset, true, pStorePoints, mSegmentClipper);
mSegmentClipper.end();
mPath.close();
return offset;
} }
|
public class class_name {
PointL buildPathPortion(final Projection pProjection,
final PointL pOffset,
final boolean pStorePoints){
final int size = mOriginalPoints.size();
if (size < 2) { // nothing to paint
return pOffset; // depends on control dependency: [if], data = [none]
}
computeProjected(pProjection);
computeDistances();
final PointL offset;
if (pOffset != null) {
offset = pOffset; // depends on control dependency: [if], data = [none]
} else {
offset = new PointL(); // depends on control dependency: [if], data = [none]
getBestOffset(pProjection, offset); // depends on control dependency: [if], data = [none]
}
mSegmentClipper.init();
clipAndStore(pProjection, offset, true, pStorePoints, mSegmentClipper);
mSegmentClipper.end();
mPath.close();
return offset;
} }
|
public class class_name {
public String read(ByteBuffer buf,DictionaryCache dict){
StringBuilder out=new StringBuilder();
if(pre!=null)out.append(pre);
if(type==VOID)return out.toString();
if(type==NULL){
out.append("null");
return out.toString();
}
if(type==BYTE){
out.append(buf.get());
return out.toString();
}
if(type==SHORT){
out.append(buf.getShort());
return out.toString();
}
if(type==INT){
out.append(buf.getInt());
return out.toString();
}
if(type==LONG){
out.append(buf.getLong());
return out.toString();
}
//if(type==FLOAT){
// out.append(buf.getFloat());
// return out.toString();
//}
if(type==DOUBLE){
out.append(buf.getDouble());
return out.toString();
}
if(type==BOOLEAN){
out.append((buf.get()==0?"false":"true"));
return out.toString();
}
if(type==STRING){
short pos=buf.getShort();
if(pos>-1){
out.append("\"");
out.append(dict.get(pos));
out.append("\"");
}else{
int size=0;
int val=buf.get() & 0xFF;
while(val==255){
size+=val;
val=buf.get() & 0xFF;
}
size+=val;
byte[] data=new byte[size];
buf.get(data);
out.append("\"");
out.append(new String(data,StandardCharsets.UTF_8));
out.append("\"");
}
return out.toString();
}
return null;
} }
|
public class class_name {
public String read(ByteBuffer buf,DictionaryCache dict){
StringBuilder out=new StringBuilder();
if(pre!=null)out.append(pre);
if(type==VOID)return out.toString();
if(type==NULL){
out.append("null"); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==BYTE){
out.append(buf.get()); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==SHORT){
out.append(buf.getShort()); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==INT){
out.append(buf.getInt()); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==LONG){
out.append(buf.getLong()); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
//if(type==FLOAT){
// out.append(buf.getFloat());
// return out.toString();
//}
if(type==DOUBLE){
out.append(buf.getDouble()); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==BOOLEAN){
out.append((buf.get()==0?"false":"true")); // depends on control dependency: [if], data = [none]
return out.toString(); // depends on control dependency: [if], data = [none]
}
if(type==STRING){
short pos=buf.getShort();
if(pos>-1){
out.append("\""); // depends on control dependency: [if], data = [none]
out.append(dict.get(pos)); // depends on control dependency: [if], data = [(pos]
out.append("\""); // depends on control dependency: [if], data = [none]
}else{
int size=0;
int val=buf.get() & 0xFF;
while(val==255){
size+=val; // depends on control dependency: [while], data = [none]
val=buf.get() & 0xFF; // depends on control dependency: [while], data = [none]
}
size+=val; // depends on control dependency: [if], data = [none]
byte[] data=new byte[size];
buf.get(data); // depends on control dependency: [if], data = [none]
out.append("\""); // depends on control dependency: [if], data = [none]
out.append(new String(data,StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
out.append("\""); // depends on control dependency: [if], data = [none]
}
return out.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static void setLocalDirStickyBit(String dir) {
try {
// Support for sticky bit is platform specific. Check if the path starts with "/" and if so,
// assume that the host supports the chmod command.
if (dir.startsWith(AlluxioURI.SEPARATOR)) {
// TODO(peis): This is very slow. Consider removing this.
Runtime.getRuntime().exec("chmod +t " + dir);
}
} catch (IOException e) {
LOG.info("Can not set the sticky bit of the directory: {}", dir, e);
}
} }
|
public class class_name {
public static void setLocalDirStickyBit(String dir) {
try {
// Support for sticky bit is platform specific. Check if the path starts with "/" and if so,
// assume that the host supports the chmod command.
if (dir.startsWith(AlluxioURI.SEPARATOR)) {
// TODO(peis): This is very slow. Consider removing this.
Runtime.getRuntime().exec("chmod +t " + dir); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.info("Can not set the sticky bit of the directory: {}", dir, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void free()
{
this.setCacheMinutes(0); // Turn off the cache
Object[] keys = m_htDBList.keySet().toArray();
for (int i = 0; i < keys.length; i++)
{
Object key = keys[i];
PDatabase pDatabase = (PDatabase)m_htDBList.get(key);
pDatabase.free();
}
m_htDBList.clear();
m_htDBList = null;
} }
|
public class class_name {
public void free()
{
this.setCacheMinutes(0); // Turn off the cache
Object[] keys = m_htDBList.keySet().toArray();
for (int i = 0; i < keys.length; i++)
{
Object key = keys[i];
PDatabase pDatabase = (PDatabase)m_htDBList.get(key);
pDatabase.free(); // depends on control dependency: [for], data = [none]
}
m_htDBList.clear();
m_htDBList = null;
} }
|
public class class_name {
@Override
public Set<BaseResourceIndexedSearchParam> extractSearchParamTokens(ResourceTable theEntity, IBaseResource theResource) {
HashSet<BaseResourceIndexedSearchParam> retVal = new HashSet<BaseResourceIndexedSearchParam>();
String useSystem = null;
if (theResource instanceof CodeSystem) {
CodeSystem cs = (CodeSystem) theResource;
useSystem = cs.getUrl();
}
Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource);
for (RuntimeSearchParam nextSpDef : searchParams) {
if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
List<String> systems = new ArrayList<>();
List<String> codes = new ArrayList<>();
// String needContactPointSystem = null;
// if (nextPath.contains(".where(system='phone')")) {
// nextPath = nextPath.replace(".where(system='phone')", "");
// needContactPointSystem = "phone";
// }
// if (nextPath.contains(".where(system='email')")) {
// nextPath = nextPath.replace(".where(system='email')", "");
// needContactPointSystem = "email";
// }
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null) {
continue;
}
// Patient:language
if (nextObject instanceof PatientCommunicationComponent) {
PatientCommunicationComponent nextValue = (PatientCommunicationComponent) nextObject;
nextObject = nextValue.getLanguage();
}
if (nextObject instanceof Identifier) {
Identifier nextValue = (Identifier) nextObject;
if (nextValue.isEmpty()) {
continue;
}
String system = StringUtils.defaultIfBlank(nextValue.getSystemElement().getValueAsString(), null);
String value = nextValue.getValueElement().getValue();
if (isNotBlank(value)) {
systems.add(system);
codes.add(value);
}
if (isNotBlank(nextValue.getType().getText())) {
addStringParam(theEntity, retVal, nextSpDef, nextValue.getType().getText());
}
} else if (nextObject instanceof ContactPoint) {
ContactPoint nextValue = (ContactPoint) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(nextValue.getSystemElement().getValueAsString());
codes.add(nextValue.getValueElement().getValue());
} else if (nextObject instanceof Enumeration<?>) {
Enumeration<?> obj = (Enumeration<?>) nextObject;
String system = extractSystem(obj);
String code = obj.getValueAsString();
if (isNotBlank(code)) {
systems.add(system);
codes.add(code);
}
} else if (nextObject instanceof IPrimitiveType<?>) {
IPrimitiveType<?> nextValue = (IPrimitiveType<?>) nextObject;
if (nextValue.isEmpty()) {
continue;
}
if ("CodeSystem.concept.code".equals(nextPath)) {
systems.add(useSystem);
} else {
systems.add(null);
}
codes.add(nextValue.getValueAsString());
} else if (nextObject instanceof Coding) {
Coding nextValue = (Coding) nextObject;
extractTokensFromCoding(systems, codes, theEntity, retVal, nextSpDef, nextValue);
} else if (nextObject instanceof CodeableConcept) {
CodeableConcept nextCC = (CodeableConcept) nextObject;
if (!nextCC.getTextElement().isEmpty()) {
addStringParam(theEntity, retVal, nextSpDef, nextCC.getTextElement().getValue());
}
extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef);
} else if (nextObject instanceof CapabilityStatementRestSecurityComponent) {
// Conformance.security search param points to something kind of useless right now - This should probably
// be fixed.
CapabilityStatementRestSecurityComponent sec = (CapabilityStatementRestSecurityComponent) nextObject;
for (CodeableConcept nextCC : sec.getService()) {
extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef);
}
} else if (nextObject instanceof LocationPositionComponent) {
ourLog.warn("Position search not currently supported, not indexing location");
continue;
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
assert systems.size() == codes.size() : "Systems contains " + systems + ", codes contains: " + codes;
Set<Pair<String, String>> haveValues = new HashSet<Pair<String, String>>();
for (int i = 0; i < systems.size(); i++) {
String system = systems.get(i);
String code = codes.get(i);
if (isBlank(system) && isBlank(code)) {
continue;
}
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
system = system.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
code = code.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
Pair<String, String> nextPair = Pair.of(system, code);
if (haveValues.contains(nextPair)) {
continue;
}
haveValues.add(nextPair);
ResourceIndexedSearchParamToken nextEntity;
nextEntity = new ResourceIndexedSearchParamToken(nextSpDef.getName(), system, code);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
return retVal;
} }
|
public class class_name {
@Override
public Set<BaseResourceIndexedSearchParam> extractSearchParamTokens(ResourceTable theEntity, IBaseResource theResource) {
HashSet<BaseResourceIndexedSearchParam> retVal = new HashSet<BaseResourceIndexedSearchParam>();
String useSystem = null;
if (theResource instanceof CodeSystem) {
CodeSystem cs = (CodeSystem) theResource;
useSystem = cs.getUrl(); // depends on control dependency: [if], data = [none]
}
Collection<RuntimeSearchParam> searchParams = getSearchParams(theResource);
for (RuntimeSearchParam nextSpDef : searchParams) {
if (nextSpDef.getParamType() != RestSearchParameterTypeEnum.TOKEN) {
continue;
}
String nextPath = nextSpDef.getPath();
if (isBlank(nextPath)) {
continue;
}
boolean multiType = false;
if (nextPath.endsWith("[x]")) {
multiType = true;
}
List<String> systems = new ArrayList<>();
List<String> codes = new ArrayList<>();
// String needContactPointSystem = null;
// if (nextPath.contains(".where(system='phone')")) {
// nextPath = nextPath.replace(".where(system='phone')", "");
// needContactPointSystem = "phone";
// }
// if (nextPath.contains(".where(system='email')")) {
// nextPath = nextPath.replace(".where(system='email')", "");
// needContactPointSystem = "email";
// }
for (Object nextObject : extractValues(nextPath, theResource)) {
if (nextObject == null) {
continue;
}
// Patient:language
if (nextObject instanceof PatientCommunicationComponent) {
PatientCommunicationComponent nextValue = (PatientCommunicationComponent) nextObject;
nextObject = nextValue.getLanguage();
}
if (nextObject instanceof Identifier) {
Identifier nextValue = (Identifier) nextObject;
if (nextValue.isEmpty()) {
continue;
}
String system = StringUtils.defaultIfBlank(nextValue.getSystemElement().getValueAsString(), null);
String value = nextValue.getValueElement().getValue();
if (isNotBlank(value)) {
systems.add(system);
codes.add(value);
}
if (isNotBlank(nextValue.getType().getText())) {
addStringParam(theEntity, retVal, nextSpDef, nextValue.getType().getText());
}
} else if (nextObject instanceof ContactPoint) {
ContactPoint nextValue = (ContactPoint) nextObject;
if (nextValue.isEmpty()) {
continue;
}
systems.add(nextValue.getSystemElement().getValueAsString());
codes.add(nextValue.getValueElement().getValue());
} else if (nextObject instanceof Enumeration<?>) {
Enumeration<?> obj = (Enumeration<?>) nextObject;
String system = extractSystem(obj);
String code = obj.getValueAsString();
if (isNotBlank(code)) {
systems.add(system);
codes.add(code);
}
} else if (nextObject instanceof IPrimitiveType<?>) {
IPrimitiveType<?> nextValue = (IPrimitiveType<?>) nextObject;
if (nextValue.isEmpty()) {
continue;
}
if ("CodeSystem.concept.code".equals(nextPath)) {
systems.add(useSystem);
} else {
systems.add(null);
}
codes.add(nextValue.getValueAsString());
} else if (nextObject instanceof Coding) {
Coding nextValue = (Coding) nextObject;
extractTokensFromCoding(systems, codes, theEntity, retVal, nextSpDef, nextValue);
} else if (nextObject instanceof CodeableConcept) {
CodeableConcept nextCC = (CodeableConcept) nextObject;
if (!nextCC.getTextElement().isEmpty()) {
addStringParam(theEntity, retVal, nextSpDef, nextCC.getTextElement().getValue());
}
extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef);
} else if (nextObject instanceof CapabilityStatementRestSecurityComponent) {
// Conformance.security search param points to something kind of useless right now - This should probably
// be fixed.
CapabilityStatementRestSecurityComponent sec = (CapabilityStatementRestSecurityComponent) nextObject;
for (CodeableConcept nextCC : sec.getService()) {
extractTokensFromCodeableConcept(systems, codes, nextCC, theEntity, retVal, nextSpDef);
}
} else if (nextObject instanceof LocationPositionComponent) {
ourLog.warn("Position search not currently supported, not indexing location");
continue;
} else {
if (!multiType) {
throw new ConfigurationException("Search param " + nextSpDef.getName() + " is of unexpected datatype: " + nextObject.getClass());
} else {
continue;
}
}
}
assert systems.size() == codes.size() : "Systems contains " + systems + ", codes contains: " + codes;
Set<Pair<String, String>> haveValues = new HashSet<Pair<String, String>>();
for (int i = 0; i < systems.size(); i++) {
String system = systems.get(i);
String code = codes.get(i);
if (isBlank(system) && isBlank(code)) {
continue;
}
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
system = system.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
code = code.substring(0, ResourceIndexedSearchParamToken.MAX_LENGTH);
}
Pair<String, String> nextPair = Pair.of(system, code);
if (haveValues.contains(nextPair)) {
continue;
}
haveValues.add(nextPair);
ResourceIndexedSearchParamToken nextEntity;
nextEntity = new ResourceIndexedSearchParamToken(nextSpDef.getName(), system, code);
nextEntity.setResource(theEntity);
retVal.add(nextEntity);
}
}
return retVal;
} }
|
public class class_name {
public JavadocComment toComment(String indentation) {
for (char c : indentation.toCharArray()) {
if (!Character.isWhitespace(c)) {
throw new IllegalArgumentException("The indentation string should be composed only by whitespace characters");
}
}
StringBuilder sb = new StringBuilder();
sb.append(EOL);
final String text = toText();
if (!text.isEmpty()) {
for (String line : text.split(EOL)) {
sb.append(indentation);
sb.append(" * ");
sb.append(line);
sb.append(EOL);
}
}
sb.append(indentation);
sb.append(" ");
return new JavadocComment(sb.toString());
} }
|
public class class_name {
public JavadocComment toComment(String indentation) {
for (char c : indentation.toCharArray()) {
if (!Character.isWhitespace(c)) {
throw new IllegalArgumentException("The indentation string should be composed only by whitespace characters");
}
}
StringBuilder sb = new StringBuilder();
sb.append(EOL);
final String text = toText();
if (!text.isEmpty()) {
for (String line : text.split(EOL)) {
sb.append(indentation); // depends on control dependency: [for], data = [none]
sb.append(" * "); // depends on control dependency: [for], data = [none]
sb.append(line); // depends on control dependency: [for], data = [line]
sb.append(EOL); // depends on control dependency: [for], data = [none]
}
}
sb.append(indentation);
sb.append(" ");
return new JavadocComment(sb.toString());
} }
|
public class class_name {
public static boolean moduleExists(File pom, String relativePath, String profileId, Log logger) throws IOException, XmlPullParserException {
if (relativePath == null) return false;
Model model = getModelFromPOM(pom, logger);
relativePath = relativePath.replace("\\", "/");
if (profileId != null && !profileId.isEmpty()) {
Profile p = getProfile(model, profileId);
if (p != null) {
return p.getModules().indexOf(relativePath) >= 0;
}
} else {
return model.getModules().indexOf(relativePath) >= 0;
}
return false;
} }
|
public class class_name {
public static boolean moduleExists(File pom, String relativePath, String profileId, Log logger) throws IOException, XmlPullParserException {
if (relativePath == null) return false;
Model model = getModelFromPOM(pom, logger);
relativePath = relativePath.replace("\\", "/");
if (profileId != null && !profileId.isEmpty()) {
Profile p = getProfile(model, profileId);
if (p != null) {
return p.getModules().indexOf(relativePath) >= 0; // depends on control dependency: [if], data = [none]
}
} else {
return model.getModules().indexOf(relativePath) >= 0;
}
return false;
} }
|
public class class_name {
@Override
public void delete(String spaceId, String key, IDeleteCallback callback) {
try {
doDelete(spaceId, key);
if (callback != null) {
callback.onSuccess(spaceId, key);
}
} catch (Throwable t) {
if (callback != null) {
callback.onError(spaceId, key, t);
}
}
} }
|
public class class_name {
@Override
public void delete(String spaceId, String key, IDeleteCallback callback) {
try {
doDelete(spaceId, key); // depends on control dependency: [try], data = [none]
if (callback != null) {
callback.onSuccess(spaceId, key); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
if (callback != null) {
callback.onError(spaceId, key, t); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(InputFormatConfiguration inputFormatConfiguration, ProtocolMarshaller protocolMarshaller) {
if (inputFormatConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inputFormatConfiguration.getDeserializer(), DESERIALIZER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InputFormatConfiguration inputFormatConfiguration, ProtocolMarshaller protocolMarshaller) {
if (inputFormatConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inputFormatConfiguration.getDeserializer(), DESERIALIZER_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 {
static String updateQueryWithArrayParameters(String parsedQuery, List<ArrayParameter> arrayParametersSortedAsc) {
if(arrayParametersSortedAsc.isEmpty()) {
return parsedQuery;
}
StringBuilder sb = new StringBuilder();
Iterator<ArrayParameter> parameterToReplaceIt = arrayParametersSortedAsc.iterator();
ArrayParameter nextParameterToReplace = parameterToReplaceIt.next();
// PreparedStatement index starts at 1
int currentIndex = 1;
for(char c : parsedQuery.toCharArray()) {
if(nextParameterToReplace != null && c == '?') {
if(currentIndex == nextParameterToReplace.parameterIndex) {
sb.append("?");
for(int i = 1; i < nextParameterToReplace.parameterCount; i++) {
sb.append(",?");
}
if(parameterToReplaceIt.hasNext()) {
nextParameterToReplace = parameterToReplaceIt.next();
} else {
nextParameterToReplace = null;
}
} else {
sb.append(c);
}
currentIndex++;
} else {
sb.append(c);
}
}
return sb.toString();
} }
|
public class class_name {
static String updateQueryWithArrayParameters(String parsedQuery, List<ArrayParameter> arrayParametersSortedAsc) {
if(arrayParametersSortedAsc.isEmpty()) {
return parsedQuery; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
Iterator<ArrayParameter> parameterToReplaceIt = arrayParametersSortedAsc.iterator();
ArrayParameter nextParameterToReplace = parameterToReplaceIt.next();
// PreparedStatement index starts at 1
int currentIndex = 1;
for(char c : parsedQuery.toCharArray()) {
if(nextParameterToReplace != null && c == '?') {
if(currentIndex == nextParameterToReplace.parameterIndex) {
sb.append("?"); // depends on control dependency: [if], data = [none]
for(int i = 1; i < nextParameterToReplace.parameterCount; i++) {
sb.append(",?"); // depends on control dependency: [for], data = [none]
}
if(parameterToReplaceIt.hasNext()) {
nextParameterToReplace = parameterToReplaceIt.next(); // depends on control dependency: [if], data = [none]
} else {
nextParameterToReplace = null; // depends on control dependency: [if], data = [none]
}
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
currentIndex++; // depends on control dependency: [if], data = [none]
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
public static double[] solveLinearEquationSVD(double[][] matrixA, double[] b) {
if(isSolverUseApacheCommonsMath) {
Array2DRowRealMatrix matrix = new Array2DRowRealMatrix(matrixA);
// Using SVD - very slow
DecompositionSolver solver = new SingularValueDecomposition(matrix).getSolver();
return solver.solve(new Array2DRowRealMatrix(b)).getColumn(0);
}
else {
return org.jblas.Solve.solve(new org.jblas.DoubleMatrix(matrixA), new org.jblas.DoubleMatrix(b)).data;
// For use of colt:
// cern.colt.matrix.linalg.Algebra linearAlgebra = new cern.colt.matrix.linalg.Algebra();
// return linearAlgebra.solve(new DenseDoubleMatrix2D(A), linearAlgebra.transpose(new DenseDoubleMatrix2D(new double[][] { b }))).viewColumn(0).toArray();
// For use of parallel colt:
// return new cern.colt.matrix.tdouble.algo.decomposition.DenseDoubleLUDecomposition(new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix2D(A)).solve(new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix1D(b)).toArray();
}
} }
|
public class class_name {
public static double[] solveLinearEquationSVD(double[][] matrixA, double[] b) {
if(isSolverUseApacheCommonsMath) {
Array2DRowRealMatrix matrix = new Array2DRowRealMatrix(matrixA);
// Using SVD - very slow
DecompositionSolver solver = new SingularValueDecomposition(matrix).getSolver();
return solver.solve(new Array2DRowRealMatrix(b)).getColumn(0); // depends on control dependency: [if], data = [none]
}
else {
return org.jblas.Solve.solve(new org.jblas.DoubleMatrix(matrixA), new org.jblas.DoubleMatrix(b)).data; // depends on control dependency: [if], data = [none]
// For use of colt:
// cern.colt.matrix.linalg.Algebra linearAlgebra = new cern.colt.matrix.linalg.Algebra();
// return linearAlgebra.solve(new DenseDoubleMatrix2D(A), linearAlgebra.transpose(new DenseDoubleMatrix2D(new double[][] { b }))).viewColumn(0).toArray();
// For use of parallel colt:
// return new cern.colt.matrix.tdouble.algo.decomposition.DenseDoubleLUDecomposition(new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix2D(A)).solve(new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix1D(b)).toArray();
}
} }
|
public class class_name {
@Override
public boolean write(T record) throws IOException {
//check whether we need a new memory segment for the sort index
if (this.currentSortIndexOffset > this.lastIndexEntryOffset) {
if (memoryAvailable()) {
this.currentSortIndexSegment = nextMemorySegment();
this.sortIndex.add(this.currentSortIndexSegment);
this.currentSortIndexOffset = 0;
this.sortIndexBytes += this.segmentSize;
} else {
return false;
}
}
// add the pointer and the normalized key
this.currentSortIndexSegment.putLong(this.currentSortIndexOffset, this.currentDataBufferOffset);
if(this.numKeyBytes != 0) {
this.comparator.putNormalizedKey(record, this.currentSortIndexSegment, this.currentSortIndexOffset + OFFSET_LEN, this.numKeyBytes);
}
// serialize the record into the data buffers
try {
this.serializer.serialize(record, this.recordCollector);
this.currentSortIndexOffset += this.indexEntrySize;
this.currentDataBufferOffset = this.recordCollector.getCurrentOffset();
this.numRecords++;
return true;
} catch (EOFException eofex) {
return false;
}
} }
|
public class class_name {
@Override
public boolean write(T record) throws IOException {
//check whether we need a new memory segment for the sort index
if (this.currentSortIndexOffset > this.lastIndexEntryOffset) {
if (memoryAvailable()) {
this.currentSortIndexSegment = nextMemorySegment(); // depends on control dependency: [if], data = [none]
this.sortIndex.add(this.currentSortIndexSegment); // depends on control dependency: [if], data = [none]
this.currentSortIndexOffset = 0; // depends on control dependency: [if], data = [none]
this.sortIndexBytes += this.segmentSize; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
// add the pointer and the normalized key
this.currentSortIndexSegment.putLong(this.currentSortIndexOffset, this.currentDataBufferOffset);
if(this.numKeyBytes != 0) {
this.comparator.putNormalizedKey(record, this.currentSortIndexSegment, this.currentSortIndexOffset + OFFSET_LEN, this.numKeyBytes);
}
// serialize the record into the data buffers
try {
this.serializer.serialize(record, this.recordCollector);
this.currentSortIndexOffset += this.indexEntrySize;
this.currentDataBufferOffset = this.recordCollector.getCurrentOffset();
this.numRecords++;
return true;
} catch (EOFException eofex) {
return false;
}
} }
|
public class class_name {
public static Element[] getChildren( Element root, String name )
{
if( null == root )
{
return new Element[0];
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
ArrayList<Element> result = new ArrayList<Element>();
for( int i = 0; i < n; i++ )
{
Node item = list.item( i );
if( item instanceof Element )
{
result.add( (Element) item );
}
}
Element[] retval = new Element[result.size()];
result.toArray( retval );
return retval;
} }
|
public class class_name {
public static Element[] getChildren( Element root, String name )
{
if( null == root )
{
return new Element[0]; // depends on control dependency: [if], data = [none]
}
NodeList list = root.getElementsByTagName( name );
int n = list.getLength();
ArrayList<Element> result = new ArrayList<Element>();
for( int i = 0; i < n; i++ )
{
Node item = list.item( i );
if( item instanceof Element )
{
result.add( (Element) item ); // depends on control dependency: [if], data = [none]
}
}
Element[] retval = new Element[result.size()];
result.toArray( retval );
return retval;
} }
|
public class class_name {
public static String encodeFromFile(String filename) throws java.io.IOException {
String encodedData = null;
Base64.InputStream bis = null;
try {
// Set up some useful variables
Path file = Paths.get(filename);
byte[] buffer = new byte[Math.max((int) (Files.size(file) * 1.4 + 1), 40)]; // Need max() for math on small files
// (v2.2.1); Need +1 for a few corner cases
// (v2.3.5)
int length = 0;
int numBytes;
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(Files.newInputStream(file)), Base64.ENCODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) {
length += numBytes;
} // end while
// Save in a variable to return
encodedData = new String(buffer, 0, length, StandardCharsets.US_ASCII);
} // end try
catch (java.io.IOException e) {
throw e; // Catch and release to execute finally{}
} // end catch: java.io.IOException
finally {
try {
bis.close();
} catch (Exception e) {
}
} // end finally
return encodedData;
} }
|
public class class_name {
public static String encodeFromFile(String filename) throws java.io.IOException {
String encodedData = null;
Base64.InputStream bis = null;
try {
// Set up some useful variables
Path file = Paths.get(filename);
byte[] buffer = new byte[Math.max((int) (Files.size(file) * 1.4 + 1), 40)]; // Need max() for math on small files
// (v2.2.1); Need +1 for a few corner cases
// (v2.3.5)
int length = 0;
int numBytes;
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(Files.newInputStream(file)), Base64.ENCODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) {
length += numBytes; // depends on control dependency: [while], data = [none]
} // end while
// Save in a variable to return
encodedData = new String(buffer, 0, length, StandardCharsets.US_ASCII);
} // end try
catch (java.io.IOException e) {
throw e; // Catch and release to execute finally{}
} // end catch: java.io.IOException
finally {
try {
bis.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
} // end finally
return encodedData;
} }
|
public class class_name {
public static long searchMin(long[] longArray) {
if(longArray.length == 0) {
throw new IllegalArgumentException("The array you provided does not have any elements");
}
long min = longArray[0];
for(int i = 1; i < longArray.length; i++) {
if(longArray[i] < min) {
min = longArray[i];
}
}
return min;
} }
|
public class class_name {
public static long searchMin(long[] longArray) {
if(longArray.length == 0) {
throw new IllegalArgumentException("The array you provided does not have any elements");
}
long min = longArray[0];
for(int i = 1; i < longArray.length; i++) {
if(longArray[i] < min) {
min = longArray[i]; // depends on control dependency: [if], data = [none]
}
}
return min;
} }
|
public class class_name {
private UUID generateOrGetSessionIdFromRequest(HttpHeaders headers) {
List<String> values = headers.getAll("io");
if (values.size() == 1) {
try {
return UUID.fromString(values.get(0));
} catch (IllegalArgumentException iaex) {
log.warn("Malformed UUID received for session! io=" + values.get(0));
}
}
for (String cookieHeader : headers.getAll(HttpHeaderNames.COOKIE)) {
Set<Cookie> cookies = ServerCookieDecoder.LAX.decode(cookieHeader);
for (Cookie cookie : cookies) {
if (cookie.name().equals("io")) {
try {
return UUID.fromString(cookie.value());
} catch (IllegalArgumentException iaex) {
log.warn("Malformed UUID received for session! io=" + cookie.value());
}
}
}
}
return UUID.randomUUID();
} }
|
public class class_name {
private UUID generateOrGetSessionIdFromRequest(HttpHeaders headers) {
List<String> values = headers.getAll("io");
if (values.size() == 1) {
try {
return UUID.fromString(values.get(0)); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iaex) {
log.warn("Malformed UUID received for session! io=" + values.get(0));
} // depends on control dependency: [catch], data = [none]
}
for (String cookieHeader : headers.getAll(HttpHeaderNames.COOKIE)) {
Set<Cookie> cookies = ServerCookieDecoder.LAX.decode(cookieHeader);
for (Cookie cookie : cookies) {
if (cookie.name().equals("io")) {
try {
return UUID.fromString(cookie.value()); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iaex) {
log.warn("Malformed UUID received for session! io=" + cookie.value());
} // depends on control dependency: [catch], data = [none]
}
}
}
return UUID.randomUUID();
} }
|
public class class_name {
@Override
public EClass getIfcProcedure() {
if (ifcProcedureEClass == null) {
ifcProcedureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(451);
}
return ifcProcedureEClass;
} }
|
public class class_name {
@Override
public EClass getIfcProcedure() {
if (ifcProcedureEClass == null) {
ifcProcedureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(451);
// depends on control dependency: [if], data = [none]
}
return ifcProcedureEClass;
} }
|
public class class_name {
private static int searchEntry(final List<OMMapBufferEntry> fileEntries, final long iBeginOffset, final int iSize) {
if (fileEntries == null || fileEntries.size() == 0)
return -1;
int high = fileEntries.size() - 1;
if (high < 0)
// NOT FOUND
return -1;
int low = 0;
int mid = -1;
// BINARY SEARCH
OMMapBufferEntry e;
while (low <= high) {
mid = (low + high) >>> 1;
e = fileEntries.get(mid);
if (iBeginOffset >= e.beginOffset && iBeginOffset + iSize <= e.beginOffset + e.size) {
// FOUND: USE IT
OProfiler.getInstance().updateCounter("OMMapManager.reusedPage", 1);
e.counter++;
return mid;
}
if (low == high) {
if (iBeginOffset > e.beginOffset)
// NEXT POSITION
low++;
// NOT FOUND
return (low + 2) * -1;
}
if (iBeginOffset >= e.beginOffset)
low = mid + 1;
else
high = mid;
}
// NOT FOUND
return mid;
} }
|
public class class_name {
private static int searchEntry(final List<OMMapBufferEntry> fileEntries, final long iBeginOffset, final int iSize) {
if (fileEntries == null || fileEntries.size() == 0)
return -1;
int high = fileEntries.size() - 1;
if (high < 0)
// NOT FOUND
return -1;
int low = 0;
int mid = -1;
// BINARY SEARCH
OMMapBufferEntry e;
while (low <= high) {
mid = (low + high) >>> 1;
// depends on control dependency: [while], data = [(low]
e = fileEntries.get(mid);
// depends on control dependency: [while], data = [none]
if (iBeginOffset >= e.beginOffset && iBeginOffset + iSize <= e.beginOffset + e.size) {
// FOUND: USE IT
OProfiler.getInstance().updateCounter("OMMapManager.reusedPage", 1);
// depends on control dependency: [if], data = [none]
e.counter++;
// depends on control dependency: [if], data = [none]
return mid;
// depends on control dependency: [if], data = [none]
}
if (low == high) {
if (iBeginOffset > e.beginOffset)
// NEXT POSITION
low++;
// NOT FOUND
return (low + 2) * -1;
// depends on control dependency: [if], data = [(low]
}
if (iBeginOffset >= e.beginOffset)
low = mid + 1;
else
high = mid;
}
// NOT FOUND
return mid;
} }
|
public class class_name {
public void grantAllPermissions(Grant... grantsVarArg) {
for (Grant gap : grantsVarArg) {
grantPermission(gap.getGrantee(), gap.getPermission());
}
} }
|
public class class_name {
public void grantAllPermissions(Grant... grantsVarArg) {
for (Grant gap : grantsVarArg) {
grantPermission(gap.getGrantee(), gap.getPermission()); // depends on control dependency: [for], data = [gap]
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.