code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public <T> T findByDn(Name dn, final Class<T> clazz) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Reading Entry at - %s$1", dn));
}
// Make sure the class is OK before doing the lookup
String[] attributes = odm.manageClass(clazz);
T result = lookup(dn, attributes, new ContextMapper<T>() {
@Override
public T mapFromContext(Object ctx) throws javax.naming.NamingException {
return odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
}
});
if (result == null) {
throw new OdmException(String.format("Entry %1$s does not have the required objectclasses ", dn));
}
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Found entry - %s$1", result));
}
return result;
} }
|
public class class_name {
@Override
public <T> T findByDn(Name dn, final Class<T> clazz) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Reading Entry at - %s$1", dn)); // depends on control dependency: [if], data = [none]
}
// Make sure the class is OK before doing the lookup
String[] attributes = odm.manageClass(clazz);
T result = lookup(dn, attributes, new ContextMapper<T>() {
@Override
public T mapFromContext(Object ctx) throws javax.naming.NamingException {
return odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
}
});
if (result == null) {
throw new OdmException(String.format("Entry %1$s does not have the required objectclasses ", dn));
}
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Found entry - %s$1", result));
}
return result;
} }
|
public class class_name {
public List<Decorators<Beans<T>>> getAllDecorators()
{
List<Decorators<Beans<T>>> list = new ArrayList<Decorators<Beans<T>>>();
List<Node> nodeList = childNode.get("decorators");
for(Node node: nodeList)
{
Decorators<Beans<T>> type = new DecoratorsImpl<Beans<T>>(this, "decorators", childNode, node);
list.add(type);
}
return list;
} }
|
public class class_name {
public List<Decorators<Beans<T>>> getAllDecorators()
{
List<Decorators<Beans<T>>> list = new ArrayList<Decorators<Beans<T>>>();
List<Node> nodeList = childNode.get("decorators");
for(Node node: nodeList)
{
Decorators<Beans<T>> type = new DecoratorsImpl<Beans<T>>(this, "decorators", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
public ProjectionPoint latLonToProj(LatLonPoint latLon,
ProjectionPointImpl result) {
double toX, toY;
double fromLat = latLon.getLatitude();
double fromLon = latLon.getLongitude();
double lon = Math.toRadians(fromLon);
double lat = Math.toRadians(fromLat);
double dlon = lon - lon0;
double b = Math.cos(lat) * Math.sin(dlon);
if ((Math.abs(Math.abs(b) - 1.0)) < TOLERANCE) { // infinite projection
toX = Double.POSITIVE_INFINITY;
toY = Double.POSITIVE_INFINITY;
} else {
toX = scale * SpecialMathFunction.atanh(b);
toY = scale * (Math.atan2(Math.tan(lat), Math.cos(dlon)) - lat0);
}
result.setLocation(toX + falseEasting, toY + falseNorthing);
return result;
} }
|
public class class_name {
public ProjectionPoint latLonToProj(LatLonPoint latLon,
ProjectionPointImpl result) {
double toX, toY;
double fromLat = latLon.getLatitude();
double fromLon = latLon.getLongitude();
double lon = Math.toRadians(fromLon);
double lat = Math.toRadians(fromLat);
double dlon = lon - lon0;
double b = Math.cos(lat) * Math.sin(dlon);
if ((Math.abs(Math.abs(b) - 1.0)) < TOLERANCE) { // infinite projection
toX = Double.POSITIVE_INFINITY;
// depends on control dependency: [if], data = [none]
toY = Double.POSITIVE_INFINITY;
// depends on control dependency: [if], data = [none]
} else {
toX = scale * SpecialMathFunction.atanh(b);
// depends on control dependency: [if], data = [none]
toY = scale * (Math.atan2(Math.tan(lat), Math.cos(dlon)) - lat0);
// depends on control dependency: [if], data = [none]
}
result.setLocation(toX + falseEasting, toY + falseNorthing);
return result;
} }
|
public class class_name {
public ExtendedSwidProcessor setAbstract(final String... abstractList) {
if (abstractList.length > 0) {
for (String _abstract : abstractList) {
AbstractComplexType act = new AbstractComplexType();
act.setValue(_abstract);
swidTag.getAbstract().add(act);
}
}
return this;
} }
|
public class class_name {
public ExtendedSwidProcessor setAbstract(final String... abstractList) {
if (abstractList.length > 0) {
for (String _abstract : abstractList) {
AbstractComplexType act = new AbstractComplexType();
act.setValue(_abstract); // depends on control dependency: [for], data = [_abstract]
swidTag.getAbstract().add(act); // depends on control dependency: [for], data = [none]
}
}
return this;
} }
|
public class class_name {
public static String expand(final char a, final char b) {
final StringBuilder out = new StringBuilder();
if (a < b) {
char c = a;
while (c <= b) {
out.append(c);
c = (char) (c + 1);
}
} else if (a > b) {
char c = a;
while (c >= b) {
out.append(c);
c = (char)(c - 1);
}
}
return out.toString();
} }
|
public class class_name {
public static String expand(final char a, final char b) {
final StringBuilder out = new StringBuilder();
if (a < b) {
char c = a;
while (c <= b) {
out.append(c); // depends on control dependency: [while], data = [(c]
c = (char) (c + 1); // depends on control dependency: [while], data = [(c]
}
} else if (a > b) {
char c = a;
while (c >= b) {
out.append(c); // depends on control dependency: [while], data = [(c]
c = (char)(c - 1); // depends on control dependency: [while], data = [(c]
}
}
return out.toString();
} }
|
public class class_name {
@Override
public EClass getIfcElectricMotorType() {
if (ifcElectricMotorTypeEClass == null) {
ifcElectricMotorTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(218);
}
return ifcElectricMotorTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcElectricMotorType() {
if (ifcElectricMotorTypeEClass == null) {
ifcElectricMotorTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(218);
// depends on control dependency: [if], data = [none]
}
return ifcElectricMotorTypeEClass;
} }
|
public class class_name {
public void insertStopRegexes(String... regexes) {
for (String regex : regexes) {
try {
regexList.add(Pattern.compile(regex));
} catch (Exception e) {
e.printStackTrace();
LOG.error("regex err : " + regex, e);
}
}
} }
|
public class class_name {
public void insertStopRegexes(String... regexes) {
for (String regex : regexes) {
try {
regexList.add(Pattern.compile(regex)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
LOG.error("regex err : " + regex, e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public int convertInternalToExternal(Object recordOwner)
{
if (this.getConvertToNative() == null)
{
BaseMessageHeader trxMessageHeader = this.getMessage().getMessageHeader();
String strMessageClass = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_MARSHALLER_CLASS);
String strPackage = (String)trxMessageHeader.get(TrxMessageHeader.BASE_PACKAGE);
strMessageClass = ClassServiceUtility.getFullClassName(strPackage, strMessageClass);
return ((RecordOwner)recordOwner).getTask().setLastError("Converter does not exist: " + strMessageClass);
}
Object root = this.getConvertToNative().convertInternalToMarshallableObject((RecordOwner)recordOwner);
if (root != null)
{
this.setRawData(root);
return DBConstants.NORMAL_RETURN; // Success
}
return super.convertInternalToExternal(recordOwner);
} }
|
public class class_name {
public int convertInternalToExternal(Object recordOwner)
{
if (this.getConvertToNative() == null)
{
BaseMessageHeader trxMessageHeader = this.getMessage().getMessageHeader();
String strMessageClass = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_MARSHALLER_CLASS);
String strPackage = (String)trxMessageHeader.get(TrxMessageHeader.BASE_PACKAGE);
strMessageClass = ClassServiceUtility.getFullClassName(strPackage, strMessageClass); // depends on control dependency: [if], data = [none]
return ((RecordOwner)recordOwner).getTask().setLastError("Converter does not exist: " + strMessageClass); // depends on control dependency: [if], data = [none]
}
Object root = this.getConvertToNative().convertInternalToMarshallableObject((RecordOwner)recordOwner);
if (root != null)
{
this.setRawData(root); // depends on control dependency: [if], data = [(root]
return DBConstants.NORMAL_RETURN; // Success // depends on control dependency: [if], data = [none]
}
return super.convertInternalToExternal(recordOwner);
} }
|
public class class_name {
@Override
public double getDaycountFraction(LocalDate startDate, LocalDate endDate) {
if(startDate.isAfter(endDate)) {
return -getDaycountFraction(endDate,startDate);
}
/*
* Find the "fractionalPeriodEnd", i.e. subtract whole years from endDate.
*/
LocalDate fractionalPeriodEnd = endDate.plusYears(startDate.getYear() - endDate.getYear());
// preserving 'end-of-month' if endDate is 28/Feb of non-leap-year or 29/Feb of non-leap-year.
if (endDate.getDayOfMonth() == endDate.lengthOfMonth()) {
fractionalPeriodEnd = fractionalPeriodEnd.withDayOfMonth(fractionalPeriodEnd.lengthOfMonth());
}
if (fractionalPeriodEnd.isBefore(startDate)) {
fractionalPeriodEnd.plusYears(1);
// preserving 'end-of-month' if endDate is 28/Feb of non-leap-year or 29/Feb of non-leap-year, again after changing the years.
if (endDate.getDayOfMonth() == endDate.lengthOfMonth()) {
fractionalPeriodEnd = fractionalPeriodEnd.withDayOfMonth(fractionalPeriodEnd.lengthOfMonth());
}
}
double daycountFraction = endDate.getYear() - fractionalPeriodEnd.getYear();
double fractionPeriodDenominator = 365.0;
if(fractionalPeriodEnd.isLeapYear()) {
LocalDate feb29th = LocalDate.of(fractionalPeriodEnd.getYear(), Month.FEBRUARY, 29);
if(startDate.compareTo(feb29th) <= 0 && fractionalPeriodEnd.compareTo(feb29th) > 0) {
fractionPeriodDenominator = 366.0;
}
}
else if(startDate.isLeapYear()) {
LocalDate feb29th = LocalDate.of(startDate.getYear(), Month.FEBRUARY, 29);
if(startDate.compareTo(feb29th) <= 0 && fractionalPeriodEnd.compareTo(feb29th) > 0) {
fractionPeriodDenominator = 366.0;
}
}
daycountFraction += getDaycount(startDate, fractionalPeriodEnd) / fractionPeriodDenominator;
return daycountFraction;
} }
|
public class class_name {
@Override
public double getDaycountFraction(LocalDate startDate, LocalDate endDate) {
if(startDate.isAfter(endDate)) {
return -getDaycountFraction(endDate,startDate); // depends on control dependency: [if], data = [none]
}
/*
* Find the "fractionalPeriodEnd", i.e. subtract whole years from endDate.
*/
LocalDate fractionalPeriodEnd = endDate.plusYears(startDate.getYear() - endDate.getYear());
// preserving 'end-of-month' if endDate is 28/Feb of non-leap-year or 29/Feb of non-leap-year.
if (endDate.getDayOfMonth() == endDate.lengthOfMonth()) {
fractionalPeriodEnd = fractionalPeriodEnd.withDayOfMonth(fractionalPeriodEnd.lengthOfMonth()); // depends on control dependency: [if], data = [none]
}
if (fractionalPeriodEnd.isBefore(startDate)) {
fractionalPeriodEnd.plusYears(1); // depends on control dependency: [if], data = [none]
// preserving 'end-of-month' if endDate is 28/Feb of non-leap-year or 29/Feb of non-leap-year, again after changing the years.
if (endDate.getDayOfMonth() == endDate.lengthOfMonth()) {
fractionalPeriodEnd = fractionalPeriodEnd.withDayOfMonth(fractionalPeriodEnd.lengthOfMonth()); // depends on control dependency: [if], data = [none]
}
}
double daycountFraction = endDate.getYear() - fractionalPeriodEnd.getYear();
double fractionPeriodDenominator = 365.0;
if(fractionalPeriodEnd.isLeapYear()) {
LocalDate feb29th = LocalDate.of(fractionalPeriodEnd.getYear(), Month.FEBRUARY, 29);
if(startDate.compareTo(feb29th) <= 0 && fractionalPeriodEnd.compareTo(feb29th) > 0) {
fractionPeriodDenominator = 366.0; // depends on control dependency: [if], data = [none]
}
}
else if(startDate.isLeapYear()) {
LocalDate feb29th = LocalDate.of(startDate.getYear(), Month.FEBRUARY, 29);
if(startDate.compareTo(feb29th) <= 0 && fractionalPeriodEnd.compareTo(feb29th) > 0) {
fractionPeriodDenominator = 366.0; // depends on control dependency: [if], data = [none]
}
}
daycountFraction += getDaycount(startDate, fractionalPeriodEnd) / fractionPeriodDenominator;
return daycountFraction;
} }
|
public class class_name {
public static String[] sortData(final File csvData, final String encoding)
throws FileNotFoundException, IOException
{
final List<String> fn = new ArrayList<>();
try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(csvData, encoding,
false))
{
// the line.
String line = null;
int index, last;
// read all lines from the file
do
{
line = reader.readLine();
// if null break the loop
if (line == null)
{
break;
}
// initialize the last
last = 0;
// get the index from the comma
index = line.indexOf(',');
while (index != -1)
{
// get the next firstname and remove the whitespaces.
final String firstname = line.substring(last, index).trim();
// added to the list
fn.add(firstname);
// set last to the next position
last = index + 1;
// get the next index from the comma in the line
index = line.indexOf(',', last);
}
}
while (true);
}
catch (final IOException e)
{
throw e;
}
// convert the list to a String array.
final String data[] = fn.toArray(new String[fn.size()]);
// and sort the array.
Arrays.sort(data);
return data;
} }
|
public class class_name {
public static String[] sortData(final File csvData, final String encoding)
throws FileNotFoundException, IOException
{
final List<String> fn = new ArrayList<>();
try (BufferedReader reader = (BufferedReader)StreamExtensions.getReader(csvData, encoding,
false))
{
// the line.
String line = null;
int index, last;
// read all lines from the file
do
{
line = reader.readLine();
// if null break the loop
if (line == null)
{
break;
}
// initialize the last
last = 0;
// get the index from the comma
index = line.indexOf(',');
while (index != -1)
{
// get the next firstname and remove the whitespaces.
final String firstname = line.substring(last, index).trim();
// added to the list
fn.add(firstname); // depends on control dependency: [while], data = [none]
// set last to the next position
last = index + 1; // depends on control dependency: [while], data = [none]
// get the next index from the comma in the line
index = line.indexOf(',', last); // depends on control dependency: [while], data = [none]
}
}
while (true);
}
catch (final IOException e)
{
throw e;
}
// convert the list to a String array.
final String data[] = fn.toArray(new String[fn.size()]);
// and sort the array.
Arrays.sort(data);
return data;
} }
|
public class class_name {
private static InputMapping<Object> createInputMapping( Object value ){
if( value instanceof String ){
String text = (String)value;
if( ElUtil.hasBrackets( text ) ){
return new ExpressionLanguageMapping<Object>( text );
}
}
return ConstantMapping.of( value );
} }
|
public class class_name {
private static InputMapping<Object> createInputMapping( Object value ){
if( value instanceof String ){
String text = (String)value;
if( ElUtil.hasBrackets( text ) ){
return new ExpressionLanguageMapping<Object>( text ); // depends on control dependency: [if], data = [none]
}
}
return ConstantMapping.of( value );
} }
|
public class class_name {
public void stop()
{
Principal user=null;
try
{
// Handle run as
if (_runAs!=null && _realm!=null)
user=_realm.pushRole(null,_runAs);
if (_servlet!=null)
_servlet.destroy();
_servlet=null;
while (_servlets!=null && _servlets.size()>0)
{
Servlet s = (Servlet)_servlets.pop();
s.destroy();
}
_config=null;
}
finally
{
super.stop();
// pop run-as role
if (_runAs!=null && _realm!=null && user!=null)
_realm.popRole(user);
}
} }
|
public class class_name {
public void stop()
{
Principal user=null;
try
{
// Handle run as
if (_runAs!=null && _realm!=null)
user=_realm.pushRole(null,_runAs);
if (_servlet!=null)
_servlet.destroy();
_servlet=null; // depends on control dependency: [try], data = [none]
while (_servlets!=null && _servlets.size()>0)
{
Servlet s = (Servlet)_servlets.pop();
s.destroy(); // depends on control dependency: [while], data = [none]
}
_config=null; // depends on control dependency: [try], data = [none]
}
finally
{
super.stop();
// pop run-as role
if (_runAs!=null && _realm!=null && user!=null)
_realm.popRole(user);
}
} }
|
public class class_name {
void trackFailure(@Nullable IOException e) {
assert (!Thread.holdsLock(connectionPool));
synchronized (connectionPool) {
if (e instanceof StreamResetException) {
ErrorCode errorCode = ((StreamResetException) e).errorCode;
if (errorCode == ErrorCode.REFUSED_STREAM) {
// Retry REFUSED_STREAM errors once on the same connection.
refusedStreamCount++;
if (refusedStreamCount > 1) {
noNewExchanges = true;
routeFailureCount++;
}
} else if (errorCode != ErrorCode.CANCEL) {
// Keep the connection for CANCEL errors. Everything else wants a fresh connection.
noNewExchanges = true;
routeFailureCount++;
}
} else if (!isMultiplexed() || e instanceof ConnectionShutdownException) {
noNewExchanges = true;
// If this route hasn't completed a call, avoid it for new connections.
if (successCount == 0) {
if (e != null) {
connectionPool.connectFailed(route, e);
}
routeFailureCount++;
}
}
}
} }
|
public class class_name {
void trackFailure(@Nullable IOException e) {
assert (!Thread.holdsLock(connectionPool));
synchronized (connectionPool) {
if (e instanceof StreamResetException) {
ErrorCode errorCode = ((StreamResetException) e).errorCode;
if (errorCode == ErrorCode.REFUSED_STREAM) {
// Retry REFUSED_STREAM errors once on the same connection.
refusedStreamCount++; // depends on control dependency: [if], data = [none]
if (refusedStreamCount > 1) {
noNewExchanges = true; // depends on control dependency: [if], data = [none]
routeFailureCount++; // depends on control dependency: [if], data = [none]
}
} else if (errorCode != ErrorCode.CANCEL) {
// Keep the connection for CANCEL errors. Everything else wants a fresh connection.
noNewExchanges = true; // depends on control dependency: [if], data = [none]
routeFailureCount++; // depends on control dependency: [if], data = [none]
}
} else if (!isMultiplexed() || e instanceof ConnectionShutdownException) {
noNewExchanges = true; // depends on control dependency: [if], data = [none]
// If this route hasn't completed a call, avoid it for new connections.
if (successCount == 0) {
if (e != null) {
connectionPool.connectFailed(route, e); // depends on control dependency: [if], data = [none]
}
routeFailureCount++; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public void marshall(DetectSentimentRequest detectSentimentRequest, ProtocolMarshaller protocolMarshaller) {
if (detectSentimentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detectSentimentRequest.getText(), TEXT_BINDING);
protocolMarshaller.marshall(detectSentimentRequest.getLanguageCode(), LANGUAGECODE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DetectSentimentRequest detectSentimentRequest, ProtocolMarshaller protocolMarshaller) {
if (detectSentimentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detectSentimentRequest.getText(), TEXT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detectSentimentRequest.getLanguageCode(), LANGUAGECODE_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 void
JS_dtostr(StringBuilder buffer, int mode, int precision, double d)
{
int decPt; /* Position of decimal point relative to first digit returned by JS_dtoa */
boolean[] sign = new boolean[1]; /* true if the sign bit was set in d */
int nDigits; /* Number of significand digits returned by JS_dtoa */
// JS_ASSERT(bufferSize >= (size_t)(mode <= DTOSTR_STANDARD_EXPONENTIAL ? DTOSTR_STANDARD_BUFFER_SIZE :
// DTOSTR_VARIABLE_BUFFER_SIZE(precision)));
if (mode == DTOSTR_FIXED && (d >= 1e21 || d <= -1e21))
mode = DTOSTR_STANDARD; /* Change mode here rather than below because the buffer may not be large enough to hold a large integer. */
decPt = JS_dtoa(d, dtoaModes[mode], mode >= DTOSTR_FIXED, precision, sign, buffer);
nDigits = buffer.length();
/* If Infinity, -Infinity, or NaN, return the string regardless of the mode. */
if (decPt != 9999) {
boolean exponentialNotation = false;
int minNDigits = 0; /* Minimum number of significand digits required by mode and precision */
int p;
switch (mode) {
case DTOSTR_STANDARD:
if (decPt < -5 || decPt > 21)
exponentialNotation = true;
else
minNDigits = decPt;
break;
case DTOSTR_FIXED:
if (precision >= 0)
minNDigits = decPt + precision;
else
minNDigits = decPt;
break;
case DTOSTR_EXPONENTIAL:
// JS_ASSERT(precision > 0);
minNDigits = precision;
/* fallthru */
case DTOSTR_STANDARD_EXPONENTIAL:
exponentialNotation = true;
break;
case DTOSTR_PRECISION:
// JS_ASSERT(precision > 0);
minNDigits = precision;
if (decPt < -5 || decPt > precision)
exponentialNotation = true;
break;
}
/* If the number has fewer than minNDigits, pad it with zeros at the end */
if (nDigits < minNDigits) {
p = minNDigits;
nDigits = minNDigits;
do {
buffer.append('0');
} while (buffer.length() != p);
}
if (exponentialNotation) {
/* Insert a decimal point if more than one significand digit */
if (nDigits != 1) {
buffer.insert(1, '.');
}
buffer.append('e');
if ((decPt - 1) >= 0)
buffer.append('+');
buffer.append(decPt - 1);
// JS_snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1);
} else if (decPt != nDigits) {
/* Some kind of a fraction in fixed notation */
// JS_ASSERT(decPt <= nDigits);
if (decPt > 0) {
/* dd...dd . dd...dd */
buffer.insert(decPt, '.');
} else {
/* 0 . 00...00dd...dd */
for (int i = 0; i < 1 - decPt; i++)
buffer.insert(0, '0');
buffer.insert(1, '.');
}
}
}
/* If negative and neither -0.0 nor NaN, output a leading '-'. */
if (sign[0] &&
!(word0(d) == Sign_bit && word1(d) == 0) &&
!((word0(d) & Exp_mask) == Exp_mask &&
((word1(d) != 0) || ((word0(d) & Frac_mask) != 0)))) {
buffer.insert(0, '-');
}
} }
|
public class class_name {
static void
JS_dtostr(StringBuilder buffer, int mode, int precision, double d)
{
int decPt; /* Position of decimal point relative to first digit returned by JS_dtoa */
boolean[] sign = new boolean[1]; /* true if the sign bit was set in d */
int nDigits; /* Number of significand digits returned by JS_dtoa */
// JS_ASSERT(bufferSize >= (size_t)(mode <= DTOSTR_STANDARD_EXPONENTIAL ? DTOSTR_STANDARD_BUFFER_SIZE :
// DTOSTR_VARIABLE_BUFFER_SIZE(precision)));
if (mode == DTOSTR_FIXED && (d >= 1e21 || d <= -1e21))
mode = DTOSTR_STANDARD; /* Change mode here rather than below because the buffer may not be large enough to hold a large integer. */
decPt = JS_dtoa(d, dtoaModes[mode], mode >= DTOSTR_FIXED, precision, sign, buffer);
nDigits = buffer.length();
/* If Infinity, -Infinity, or NaN, return the string regardless of the mode. */
if (decPt != 9999) {
boolean exponentialNotation = false;
int minNDigits = 0; /* Minimum number of significand digits required by mode and precision */
int p;
switch (mode) {
case DTOSTR_STANDARD:
if (decPt < -5 || decPt > 21)
exponentialNotation = true;
else
minNDigits = decPt;
break;
case DTOSTR_FIXED:
if (precision >= 0)
minNDigits = decPt + precision;
else
minNDigits = decPt;
break;
case DTOSTR_EXPONENTIAL:
// JS_ASSERT(precision > 0);
minNDigits = precision;
/* fallthru */
case DTOSTR_STANDARD_EXPONENTIAL:
exponentialNotation = true;
break;
case DTOSTR_PRECISION:
// JS_ASSERT(precision > 0);
minNDigits = precision;
if (decPt < -5 || decPt > precision)
exponentialNotation = true;
break;
}
/* If the number has fewer than minNDigits, pad it with zeros at the end */
if (nDigits < minNDigits) {
p = minNDigits; // depends on control dependency: [if], data = [none]
nDigits = minNDigits; // depends on control dependency: [if], data = [none]
do {
buffer.append('0');
} while (buffer.length() != p);
}
if (exponentialNotation) {
/* Insert a decimal point if more than one significand digit */
if (nDigits != 1) {
buffer.insert(1, '.'); // depends on control dependency: [if], data = [none]
}
buffer.append('e'); // depends on control dependency: [if], data = [none]
if ((decPt - 1) >= 0)
buffer.append('+');
buffer.append(decPt - 1); // depends on control dependency: [if], data = [none]
// JS_snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1);
} else if (decPt != nDigits) {
/* Some kind of a fraction in fixed notation */
// JS_ASSERT(decPt <= nDigits);
if (decPt > 0) {
/* dd...dd . dd...dd */
buffer.insert(decPt, '.'); // depends on control dependency: [if], data = [(decPt]
} else {
/* 0 . 00...00dd...dd */
for (int i = 0; i < 1 - decPt; i++)
buffer.insert(0, '0');
buffer.insert(1, '.'); // depends on control dependency: [if], data = [none]
}
}
}
/* If negative and neither -0.0 nor NaN, output a leading '-'. */
if (sign[0] &&
!(word0(d) == Sign_bit && word1(d) == 0) &&
!((word0(d) & Exp_mask) == Exp_mask &&
((word1(d) != 0) || ((word0(d) & Frac_mask) != 0)))) {
buffer.insert(0, '-'); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setDeclaringType(JvmDeclaredType newDeclaringType)
{
if (newDeclaringType != eInternalContainer() || (eContainerFeatureID() != TypesPackage.JVM_MEMBER__DECLARING_TYPE && newDeclaringType != null))
{
if (EcoreUtil.isAncestor(this, newDeclaringType))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newDeclaringType != null)
msgs = ((InternalEObject)newDeclaringType).eInverseAdd(this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, JvmDeclaredType.class, msgs);
msgs = basicSetDeclaringType(newDeclaringType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_MEMBER__DECLARING_TYPE, newDeclaringType, newDeclaringType));
} }
|
public class class_name {
public void setDeclaringType(JvmDeclaredType newDeclaringType)
{
if (newDeclaringType != eInternalContainer() || (eContainerFeatureID() != TypesPackage.JVM_MEMBER__DECLARING_TYPE && newDeclaringType != null))
{
if (EcoreUtil.isAncestor(this, newDeclaringType))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newDeclaringType != null)
msgs = ((InternalEObject)newDeclaringType).eInverseAdd(this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, JvmDeclaredType.class, msgs);
msgs = basicSetDeclaringType(newDeclaringType, msgs); // depends on control dependency: [if], data = [(newDeclaringType]
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_MEMBER__DECLARING_TYPE, newDeclaringType, newDeclaringType));
} }
|
public class class_name {
public java.util.List<Trail> getTrailList() {
if (trailList == null) {
trailList = new com.amazonaws.internal.SdkInternalList<Trail>();
}
return trailList;
} }
|
public class class_name {
public java.util.List<Trail> getTrailList() {
if (trailList == null) {
trailList = new com.amazonaws.internal.SdkInternalList<Trail>(); // depends on control dependency: [if], data = [none]
}
return trailList;
} }
|
public class class_name {
@Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException();
}
CachedValue<K, V> entry = map.get(key);
if (entry == null) {
return false;
}
if (isValueExpired(entry)) {
if (map.remove(key, entry)) {
onValueRemove(entry);
return false;
}
return containsKey(key);
}
return true;
} }
|
public class class_name {
@Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException();
}
CachedValue<K, V> entry = map.get(key);
if (entry == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (isValueExpired(entry)) {
if (map.remove(key, entry)) {
onValueRemove(entry); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return containsKey(key); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private void computeSpan( List<AssociatedPair> points ) {
Q.reshape(points.size(), 9);
int index = 0;
for( int i = 0; i < points.size(); i++ ) {
AssociatedPair p = points.get(i);
Point2D_F64 a = p.p2;
Point2D_F64 b = p.p1;
// The points are assumed to be in homogeneous coordinates. This means z = 1
Q.data[index++] = a.x*b.x;
Q.data[index++] = a.x*b.y;
Q.data[index++] = a.x;
Q.data[index++] = a.y*b.x;
Q.data[index++] = a.y*b.y;
Q.data[index++] = a.y;
Q.data[index++] = b.x;
Q.data[index++] = b.y;
Q.data[index++] = 1;
}
if( !solverNull.process(Q,4,nullspace) )
throw new RuntimeException("Nullspace solver should never fail, probably bad input");
// extract the span of solutions for E from the null space
for( int i = 0; i < 9; i++ ) {
X[i] = nullspace.unsafe_get(i,0);
Y[i] = nullspace.unsafe_get(i,1);
Z[i] = nullspace.unsafe_get(i,2);
W[i] = nullspace.unsafe_get(i,3);
}
} }
|
public class class_name {
private void computeSpan( List<AssociatedPair> points ) {
Q.reshape(points.size(), 9);
int index = 0;
for( int i = 0; i < points.size(); i++ ) {
AssociatedPair p = points.get(i);
Point2D_F64 a = p.p2;
Point2D_F64 b = p.p1;
// The points are assumed to be in homogeneous coordinates. This means z = 1
Q.data[index++] = a.x*b.x; // depends on control dependency: [for], data = [none]
Q.data[index++] = a.x*b.y; // depends on control dependency: [for], data = [none]
Q.data[index++] = a.x; // depends on control dependency: [for], data = [none]
Q.data[index++] = a.y*b.x; // depends on control dependency: [for], data = [none]
Q.data[index++] = a.y*b.y; // depends on control dependency: [for], data = [none]
Q.data[index++] = a.y; // depends on control dependency: [for], data = [none]
Q.data[index++] = b.x; // depends on control dependency: [for], data = [none]
Q.data[index++] = b.y; // depends on control dependency: [for], data = [none]
Q.data[index++] = 1; // depends on control dependency: [for], data = [none]
}
if( !solverNull.process(Q,4,nullspace) )
throw new RuntimeException("Nullspace solver should never fail, probably bad input");
// extract the span of solutions for E from the null space
for( int i = 0; i < 9; i++ ) {
X[i] = nullspace.unsafe_get(i,0); // depends on control dependency: [for], data = [i]
Y[i] = nullspace.unsafe_get(i,1); // depends on control dependency: [for], data = [i]
Z[i] = nullspace.unsafe_get(i,2); // depends on control dependency: [for], data = [i]
W[i] = nullspace.unsafe_get(i,3); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
@Override
public void addNextProcessor(ChainedResourceBundlePostProcessor nextProcessor) {
if (!isVariantPostProcessor) {
isVariantPostProcessor = nextProcessor.isVariantPostProcessor();
}
if (this.nextProcessor == null) {
this.nextProcessor = nextProcessor;
} else {
this.nextProcessor.addNextProcessor(nextProcessor);
}
} }
|
public class class_name {
@Override
public void addNextProcessor(ChainedResourceBundlePostProcessor nextProcessor) {
if (!isVariantPostProcessor) {
isVariantPostProcessor = nextProcessor.isVariantPostProcessor(); // depends on control dependency: [if], data = [none]
}
if (this.nextProcessor == null) {
this.nextProcessor = nextProcessor; // depends on control dependency: [if], data = [none]
} else {
this.nextProcessor.addNextProcessor(nextProcessor); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void injectServices(SlingBean component) throws IllegalAccessException {
final Field[] declaredFields;
if (fieldCache.containsKey(component.getClass())) {
declaredFields = fieldCache.get(component.getClass());
} else {
declaredFields = component.getClass().getDeclaredFields();
fieldCache.put(component.getClass(), declaredFields);
}
for (Field field : declaredFields) {
if (field.isAnnotationPresent(Inject.class)) {
if (!field.isAccessible()) {
field.setAccessible(true);
}
if (null == field.get(component)) { // if not initialized already by Sling-Models
String filter = null;
if (field.isAnnotationPresent(Named.class)) {
Named name = field.getAnnotation(Named.class);
filter = "(service.pid=" + name.value() + ")";
}
Class<?> typeOfField = field.getType();
Object o = retrieveFirstServiceOfType(typeOfField, filter);
field.set(component, o);
}
}
}
} }
|
public class class_name {
protected void injectServices(SlingBean component) throws IllegalAccessException {
final Field[] declaredFields;
if (fieldCache.containsKey(component.getClass())) {
declaredFields = fieldCache.get(component.getClass());
} else {
declaredFields = component.getClass().getDeclaredFields();
fieldCache.put(component.getClass(), declaredFields);
}
for (Field field : declaredFields) {
if (field.isAnnotationPresent(Inject.class)) {
if (!field.isAccessible()) {
field.setAccessible(true);
// depends on control dependency: [if], data = [none]
}
if (null == field.get(component)) { // if not initialized already by Sling-Models
String filter = null;
if (field.isAnnotationPresent(Named.class)) {
Named name = field.getAnnotation(Named.class);
filter = "(service.pid=" + name.value() + ")";
}
Class<?> typeOfField = field.getType();
// depends on control dependency: [if], data = [none]
Object o = retrieveFirstServiceOfType(typeOfField, filter);
field.set(component, o);
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
// Don't optimize "." or single step variable paths.
// Both of these cases could use some further optimization by themselves.
if(path instanceof SelfIteratorNoPredicate)
{
return true;
}
else if(path instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)path;
AxesWalker aw = wi.getFirstWalker();
if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
{
FilterExprWalker few = (FilterExprWalker)aw;
Expression exp = few.getInnerExpression();
if(exp instanceof Variable)
return true;
}
}
if (isAbsolute(path) && (null != m_absPaths))
{
if(DEBUG)
validateNewAddition(m_absPaths, owner, path);
m_absPaths.addElement(owner);
}
else if (m_isSameContext && (null != m_paths))
{
if(DEBUG)
validateNewAddition(m_paths, owner, path);
m_paths.addElement(owner);
}
return true;
} }
|
public class class_name {
public boolean visitLocationPath(ExpressionOwner owner, LocPathIterator path)
{
// Don't optimize "." or single step variable paths.
// Both of these cases could use some further optimization by themselves.
if(path instanceof SelfIteratorNoPredicate)
{
return true; // depends on control dependency: [if], data = [none]
}
else if(path instanceof WalkingIterator)
{
WalkingIterator wi = (WalkingIterator)path;
AxesWalker aw = wi.getFirstWalker();
if((aw instanceof FilterExprWalker) && (null == aw.getNextWalker()))
{
FilterExprWalker few = (FilterExprWalker)aw;
Expression exp = few.getInnerExpression();
if(exp instanceof Variable)
return true;
}
}
if (isAbsolute(path) && (null != m_absPaths))
{
if(DEBUG)
validateNewAddition(m_absPaths, owner, path);
m_absPaths.addElement(owner); // depends on control dependency: [if], data = [none]
}
else if (m_isSameContext && (null != m_paths))
{
if(DEBUG)
validateNewAddition(m_paths, owner, path);
m_paths.addElement(owner); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'notifications' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_notification);
// Add 'data and sync' preferences, and a corresponding header.
fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_data_sync);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_data_sync);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list"));
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
} }
|
public class class_name {
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return; // depends on control dependency: [if], data = [none]
}
// In the simplified UI, fragments are not used at all and we instead
// use the older PreferenceActivity APIs.
// Add 'general' preferences.
addPreferencesFromResource(R.xml.pref_general);
// Add 'notifications' preferences, and a corresponding header.
PreferenceCategory fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_notifications);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_notification);
// Add 'data and sync' preferences, and a corresponding header.
fakeHeader = new PreferenceCategory(this);
fakeHeader.setTitle(R.string.pref_header_data_sync);
getPreferenceScreen().addPreference(fakeHeader);
addPreferencesFromResource(R.xml.pref_data_sync);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
// their values. When their values change, their summaries are updated
// to reflect the new value, per the Android Design guidelines.
bindPreferenceSummaryToValue(findPreference("example_text"));
bindPreferenceSummaryToValue(findPreference("example_list"));
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
} }
|
public class class_name {
public final Mono<T> singleOrEmpty() {
if (this instanceof Callable) {
@SuppressWarnings("unchecked")
Callable<T> thiz = (Callable<T>)this;
return convertToMono(thiz);
}
return Mono.onAssembly(new MonoSingle<>(this, null, true));
} }
|
public class class_name {
public final Mono<T> singleOrEmpty() {
if (this instanceof Callable) {
@SuppressWarnings("unchecked")
Callable<T> thiz = (Callable<T>)this;
return convertToMono(thiz); // depends on control dependency: [if], data = [none]
}
return Mono.onAssembly(new MonoSingle<>(this, null, true));
} }
|
public class class_name {
protected int interpretLs(LineParser lp, MessageMgr mm){
String directory = lp.getArgs();
IOFileFilter fileFilter = new WildcardFileFilter(new String[]{
"*.ssc"
});
DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter);
if(dl.getLoadErrors().hasErrors()){
mm.report(dl.getLoadErrors());
return 1;
}
FileSourceList fsl = dl.load();
if(dl.getLoadErrors().hasErrors()){
mm.report(dl.getLoadErrors());
return 1;
}
for(FileSource fs : fsl.getSource()){
//TODO need to adapt to new source return
mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName()));
}
return 0;
} }
|
public class class_name {
protected int interpretLs(LineParser lp, MessageMgr mm){
String directory = lp.getArgs();
IOFileFilter fileFilter = new WildcardFileFilter(new String[]{
"*.ssc"
});
DirectoryLoader dl = new CommonsDirectoryWalker(directory, DirectoryFileFilter.INSTANCE, fileFilter);
if(dl.getLoadErrors().hasErrors()){
mm.report(dl.getLoadErrors()); // depends on control dependency: [if], data = [none]
return 1; // depends on control dependency: [if], data = [none]
}
FileSourceList fsl = dl.load();
if(dl.getLoadErrors().hasErrors()){
mm.report(dl.getLoadErrors()); // depends on control dependency: [if], data = [none]
return 1; // depends on control dependency: [if], data = [none]
}
for(FileSource fs : fsl.getSource()){
//TODO need to adapt to new source return
mm.report(MessageMgr.createInfoMessage("script file - dir <{}> file <{}>", directory, fs.getBaseFileName())); // depends on control dependency: [for], data = [fs]
}
return 0;
} }
|
public class class_name {
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd)
{
double dist = Double.MAX_VALUE;
Instance nearestNeighbour = null;
for(Instance candidateNN : neighbourhood2)
{
// If inst is in neighbourhood2 and an identical instance is found, then it is no longer required to
// look for inst and the inNbhd flag can be set to FALSE.
if(inNbhd && (distance(inst, candidateNN) == 0))
{
inNbhd = false;
}
else
{
if(distance(inst, candidateNN) < dist)
{
nearestNeighbour = candidateNN.copy();
dist = distance(inst, candidateNN);
}
}
}
return nearestNeighbour;
} }
|
public class class_name {
private Instance getNearestNeighbour(Instance inst, List<Instance> neighbourhood2, boolean inNbhd)
{
double dist = Double.MAX_VALUE;
Instance nearestNeighbour = null;
for(Instance candidateNN : neighbourhood2)
{
// If inst is in neighbourhood2 and an identical instance is found, then it is no longer required to
// look for inst and the inNbhd flag can be set to FALSE.
if(inNbhd && (distance(inst, candidateNN) == 0))
{
inNbhd = false; // depends on control dependency: [if], data = [none]
}
else
{
if(distance(inst, candidateNN) < dist)
{
nearestNeighbour = candidateNN.copy(); // depends on control dependency: [if], data = [none]
dist = distance(inst, candidateNN); // depends on control dependency: [if], data = [none]
}
}
}
return nearestNeighbour;
} }
|
public class class_name {
public void getColumnHeading(TableCandidate tc) {
int headings = tc.getHeadingLineNumber();
String[][] cells = tc.getCells();
String columnHeadings = "";
for (int i=0; i<=headings; i++) {
int j = cells[i].length;
for (int k=0; k<j; k++) {
cells[i][k] = tc.replaceAllSpecialChracters(cells[i][k]);
columnHeadings = columnHeadings + cells[i][k] + "; ";
}
columnHeadings = columnHeadings + "\n";
}
tc.setColumnHeadings(columnHeadings);
} }
|
public class class_name {
public void getColumnHeading(TableCandidate tc) {
int headings = tc.getHeadingLineNumber();
String[][] cells = tc.getCells();
String columnHeadings = "";
for (int i=0; i<=headings; i++) {
int j = cells[i].length;
for (int k=0; k<j; k++) {
cells[i][k] = tc.replaceAllSpecialChracters(cells[i][k]);
// depends on control dependency: [for], data = [k]
columnHeadings = columnHeadings + cells[i][k] + "; ";
// depends on control dependency: [for], data = [k]
}
columnHeadings = columnHeadings + "\n";
// depends on control dependency: [for], data = [none]
}
tc.setColumnHeadings(columnHeadings);
} }
|
public class class_name {
public long[] getSitesForPartitionsAsArray(int[] partitions) {
ArrayList<Long> all_sites = new ArrayList<Long>();
for (int p : partitions) {
List<Long> sites = getSitesForPartition(p);
for (long site : sites)
{
all_sites.add(site);
}
}
return longListToArray(all_sites);
} }
|
public class class_name {
public long[] getSitesForPartitionsAsArray(int[] partitions) {
ArrayList<Long> all_sites = new ArrayList<Long>();
for (int p : partitions) {
List<Long> sites = getSitesForPartition(p);
for (long site : sites)
{
all_sites.add(site); // depends on control dependency: [for], data = [site]
}
}
return longListToArray(all_sites);
} }
|
public class class_name {
@Nullable
public static ExecutorService getTtlExecutorService(@Nullable ExecutorService executorService) {
if (TtlAgent.isTtlAgentLoaded() || executorService == null || executorService instanceof TtlEnhanced) {
return executorService;
}
return new ExecutorServiceTtlWrapper(executorService);
} }
|
public class class_name {
@Nullable
public static ExecutorService getTtlExecutorService(@Nullable ExecutorService executorService) {
if (TtlAgent.isTtlAgentLoaded() || executorService == null || executorService instanceof TtlEnhanced) {
return executorService; // depends on control dependency: [if], data = [none]
}
return new ExecutorServiceTtlWrapper(executorService);
} }
|
public class class_name {
public static VersionNumber parseVersion(@Nonnull final String version) {
Check.notNull(version, "version");
VersionNumber result = new VersionNumber(new ArrayList<String>(0), version);
final Matcher matcher = VERSIONSTRING.matcher(version);
if (matcher.find()) {
final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\."));
final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher
.group(EXTENSION_INDEX));
result = new VersionNumber(groups, extension);
}
return result;
} }
|
public class class_name {
public static VersionNumber parseVersion(@Nonnull final String version) {
Check.notNull(version, "version");
VersionNumber result = new VersionNumber(new ArrayList<String>(0), version);
final Matcher matcher = VERSIONSTRING.matcher(version);
if (matcher.find()) {
final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\."));
final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher
.group(EXTENSION_INDEX));
result = new VersionNumber(groups, extension); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public com.google.protobuf.ByteString
getLeaderMasterAddressBytes() {
java.lang.Object ref = leaderMasterAddress_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
leaderMasterAddress_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} }
|
public class class_name {
public com.google.protobuf.ByteString
getLeaderMasterAddressBytes() {
java.lang.Object ref = leaderMasterAddress_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
leaderMasterAddress_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Map<String, String> populatePersistenceUnitProperties(PropertyReader reader)
{
String dbType = reader.getProperty(EthConstants.DATABASE_TYPE);
String host = reader.getProperty(EthConstants.DATABASE_HOST);
String port = reader.getProperty(EthConstants.DATABASE_PORT);
String dbName = reader.getProperty(EthConstants.DATABASE_NAME);
propertyNullCheck(dbType, host, port, dbName);
String username = reader.getProperty(EthConstants.DATABASE_USERNAME);
String pswd = reader.getProperty(EthConstants.DATABASE_PASSWORD);
Map<String, String> props = new HashMap<>();
props.put(EthConstants.KUNDERA_CLIENT_LOOKUP_CLASS, getKunderaClientToLookupClass(dbType));
props.put(EthConstants.KUNDERA_NODES, host);
props.put(EthConstants.KUNDERA_PORT, port);
props.put(EthConstants.KUNDERA_KEYSPACE, dbName);
props.put(EthConstants.KUNDERA_DIALECT, dbType);
if (username != null && !username.isEmpty() && pswd != null)
{
props.put(EthConstants.KUNDERA_USERNAME, username);
props.put(EthConstants.KUNDERA_PASSWORD, pswd);
}
if (dbType.equalsIgnoreCase(CASSANDRA))
{
props.put(CQL_VERSION, _3_0_0);
}
boolean schemaAutoGen = Boolean.parseBoolean(reader.getProperty(EthConstants.SCHEMA_AUTO_GENERATE));
boolean schemaDropExisting = Boolean.parseBoolean(reader.getProperty(EthConstants.SCHEMA_DROP_EXISTING));
if (schemaAutoGen)
{
if (schemaDropExisting)
{
props.put(EthConstants.KUNDERA_DDL_AUTO_PREPARE, "create");
}
else
{
props.put(EthConstants.KUNDERA_DDL_AUTO_PREPARE, "update");
}
}
LOGGER.info("Kundera properties : " + props);
return props;
} }
|
public class class_name {
public static Map<String, String> populatePersistenceUnitProperties(PropertyReader reader)
{
String dbType = reader.getProperty(EthConstants.DATABASE_TYPE);
String host = reader.getProperty(EthConstants.DATABASE_HOST);
String port = reader.getProperty(EthConstants.DATABASE_PORT);
String dbName = reader.getProperty(EthConstants.DATABASE_NAME);
propertyNullCheck(dbType, host, port, dbName);
String username = reader.getProperty(EthConstants.DATABASE_USERNAME);
String pswd = reader.getProperty(EthConstants.DATABASE_PASSWORD);
Map<String, String> props = new HashMap<>();
props.put(EthConstants.KUNDERA_CLIENT_LOOKUP_CLASS, getKunderaClientToLookupClass(dbType));
props.put(EthConstants.KUNDERA_NODES, host);
props.put(EthConstants.KUNDERA_PORT, port);
props.put(EthConstants.KUNDERA_KEYSPACE, dbName);
props.put(EthConstants.KUNDERA_DIALECT, dbType);
if (username != null && !username.isEmpty() && pswd != null)
{
props.put(EthConstants.KUNDERA_USERNAME, username); // depends on control dependency: [if], data = [none]
props.put(EthConstants.KUNDERA_PASSWORD, pswd); // depends on control dependency: [if], data = [none]
}
if (dbType.equalsIgnoreCase(CASSANDRA))
{
props.put(CQL_VERSION, _3_0_0); // depends on control dependency: [if], data = [none]
}
boolean schemaAutoGen = Boolean.parseBoolean(reader.getProperty(EthConstants.SCHEMA_AUTO_GENERATE));
boolean schemaDropExisting = Boolean.parseBoolean(reader.getProperty(EthConstants.SCHEMA_DROP_EXISTING));
if (schemaAutoGen)
{
if (schemaDropExisting)
{
props.put(EthConstants.KUNDERA_DDL_AUTO_PREPARE, "create"); // depends on control dependency: [if], data = [none]
}
else
{
props.put(EthConstants.KUNDERA_DDL_AUTO_PREPARE, "update"); // depends on control dependency: [if], data = [none]
}
}
LOGGER.info("Kundera properties : " + props);
return props;
} }
|
public class class_name {
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) {
if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) {
return;
}
ChargingStation chargingStation = repository.findOne(chargingStationId.getId());
if (chargingStation != null) {
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId.getId())) {
evse.setAvailability(availability);
break;
}
}
repository.createOrUpdate(chargingStation);
}
} }
|
public class class_name {
private void updateComponentAvailability(ChargingStationId chargingStationId, ComponentId componentId, ChargingStationComponent component, Availability availability) {
if (!component.equals(ChargingStationComponent.EVSE) || !(componentId instanceof EvseId)) {
return; // depends on control dependency: [if], data = [none]
}
ChargingStation chargingStation = repository.findOne(chargingStationId.getId());
if (chargingStation != null) {
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId.getId())) {
evse.setAvailability(availability); // depends on control dependency: [if], data = [none]
break;
}
}
repository.createOrUpdate(chargingStation); // depends on control dependency: [if], data = [(chargingStation]
}
} }
|
public class class_name {
public void setJavaScriptEnabled(boolean javaScriptEnabled)
{
this.javaScriptEnabled = javaScriptEnabled;
// and now also store this information inside a cookie!
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null)
{
Object r = facesContext.getExternalContext().getResponse();
if (r instanceof HttpServletResponse)
{
Cookie cookie = new Cookie(COOKIE_NAME_NOSCRIPT_ENABLED, "" + javaScriptEnabled);
cookie.setPath("/"); // for all the server
HttpServletResponse response = (HttpServletResponse) r;
response.addCookie(cookie);
}
}
} }
|
public class class_name {
public void setJavaScriptEnabled(boolean javaScriptEnabled)
{
this.javaScriptEnabled = javaScriptEnabled;
// and now also store this information inside a cookie!
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null)
{
Object r = facesContext.getExternalContext().getResponse();
if (r instanceof HttpServletResponse)
{
Cookie cookie = new Cookie(COOKIE_NAME_NOSCRIPT_ENABLED, "" + javaScriptEnabled);
cookie.setPath("/"); // for all the server // depends on control dependency: [if], data = [none]
HttpServletResponse response = (HttpServletResponse) r;
response.addCookie(cookie); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public File getDatabaseFile(String filename) {
File dbFile = null;
if (filename != null && filename.trim().length() > 0) {
dbFile = new File(filename);
}
if (dbFile == null || dbFile.isDirectory()) {
dbFile = new File(new AndroidContextUtil().getDatabasePath("logback.db"));
}
return dbFile;
} }
|
public class class_name {
public File getDatabaseFile(String filename) {
File dbFile = null;
if (filename != null && filename.trim().length() > 0) {
dbFile = new File(filename); // depends on control dependency: [if], data = [(filename]
}
if (dbFile == null || dbFile.isDirectory()) {
dbFile = new File(new AndroidContextUtil().getDatabasePath("logback.db"));
}
return dbFile; // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public void setHealthCheckObservations(java.util.Collection<HealthCheckObservation> healthCheckObservations) {
if (healthCheckObservations == null) {
this.healthCheckObservations = null;
return;
}
this.healthCheckObservations = new com.amazonaws.internal.SdkInternalList<HealthCheckObservation>(healthCheckObservations);
} }
|
public class class_name {
public void setHealthCheckObservations(java.util.Collection<HealthCheckObservation> healthCheckObservations) {
if (healthCheckObservations == null) {
this.healthCheckObservations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.healthCheckObservations = new com.amazonaws.internal.SdkInternalList<HealthCheckObservation>(healthCheckObservations);
} }
|
public class class_name {
public static void magnitude( ImageInterleaved transform , GrayF magnitude ) {
if( transform instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.magnitude((InterleavedF32) transform, (GrayF32) magnitude);
} else if( transform instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.magnitude((InterleavedF64) transform, (GrayF64) magnitude);
} else {
throw new IllegalArgumentException("Unknown image type");
}
} }
|
public class class_name {
public static void magnitude( ImageInterleaved transform , GrayF magnitude ) {
if( transform instanceof InterleavedF32 ) {
DiscreteFourierTransformOps.magnitude((InterleavedF32) transform, (GrayF32) magnitude); // depends on control dependency: [if], data = [none]
} else if( transform instanceof InterleavedF64 ) {
DiscreteFourierTransformOps.magnitude((InterleavedF64) transform, (GrayF64) magnitude); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown image type");
}
} }
|
public class class_name {
static <FieldDescriptorType extends
FieldSet.FieldDescriptorLite<FieldDescriptorType>>
SmallSortedMap<FieldDescriptorType, Object> newFieldMap(int arraySize) {
return new SmallSortedMap<FieldDescriptorType, Object>(arraySize) {
@Override
@SuppressWarnings("unchecked")
public void makeImmutable() {
if (!isImmutable()) {
for (int i = 0; i < getNumArrayEntries(); i++) {
final Map.Entry<FieldDescriptorType, Object> entry =
getArrayEntryAt(i);
if (entry.getKey().isRepeated()) {
final List value = (List) entry.getValue();
entry.setValue(Collections.unmodifiableList(value));
}
}
for (Map.Entry<FieldDescriptorType, Object> entry :
getOverflowEntries()) {
if (entry.getKey().isRepeated()) {
final List value = (List) entry.getValue();
entry.setValue(Collections.unmodifiableList(value));
}
}
}
super.makeImmutable();
}
};
} }
|
public class class_name {
static <FieldDescriptorType extends
FieldSet.FieldDescriptorLite<FieldDescriptorType>>
SmallSortedMap<FieldDescriptorType, Object> newFieldMap(int arraySize) {
return new SmallSortedMap<FieldDescriptorType, Object>(arraySize) {
@Override
@SuppressWarnings("unchecked")
public void makeImmutable() {
if (!isImmutable()) {
for (int i = 0; i < getNumArrayEntries(); i++) {
final Map.Entry<FieldDescriptorType, Object> entry =
getArrayEntryAt(i);
if (entry.getKey().isRepeated()) {
final List value = (List) entry.getValue();
entry.setValue(Collections.unmodifiableList(value)); // depends on control dependency: [if], data = [none]
}
}
for (Map.Entry<FieldDescriptorType, Object> entry :
getOverflowEntries()) {
if (entry.getKey().isRepeated()) {
final List value = (List) entry.getValue();
entry.setValue(Collections.unmodifiableList(value)); // depends on control dependency: [if], data = [none]
}
}
}
super.makeImmutable();
}
};
} }
|
public class class_name {
@Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute maximum number of adds
int curMaxAdds = maxAdditions(addCandidates, solution);
// return null if no additions are possible
if(curMaxAdds == 0){
return null;
}
// pick number of additions (in [1, curMaxAdds])
int numAdds = rnd.nextInt(curMaxAdds) + 1;
// pick random IDs to add to selection
Set<Integer> add = SetUtilities.getRandomSubset(addCandidates, numAdds, rnd);
// create and return move
return new GeneralSubsetMove(add, Collections.emptySet());
} }
|
public class class_name {
@Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute maximum number of adds
int curMaxAdds = maxAdditions(addCandidates, solution);
// return null if no additions are possible
if(curMaxAdds == 0){
return null; // depends on control dependency: [if], data = [none]
}
// pick number of additions (in [1, curMaxAdds])
int numAdds = rnd.nextInt(curMaxAdds) + 1;
// pick random IDs to add to selection
Set<Integer> add = SetUtilities.getRandomSubset(addCandidates, numAdds, rnd);
// create and return move
return new GeneralSubsetMove(add, Collections.emptySet());
} }
|
public class class_name {
private String createFragment(final Value resource) {
if (resource instanceof URI) {
String frag = ((URI) resource).getLocalName();
return RESERVED_FRAGMENTS.contains(frag) ? frag + "_" : frag;
} else {
return resource.stringValue();
}
} }
|
public class class_name {
private String createFragment(final Value resource) {
if (resource instanceof URI) {
String frag = ((URI) resource).getLocalName();
return RESERVED_FRAGMENTS.contains(frag) ? frag + "_" : frag; // depends on control dependency: [if], data = [none]
} else {
return resource.stringValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public String getParameter(String name) {
if (this.charset.equalsIgnoreCase(this.originCharset)) {
return super.getParameter(name);
}
String value = super.getParameter(name);
if (value == null) {
return null;
}
try {
value = new String(value.getBytes(this.originCharset), this.charset);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return value;
} }
|
public class class_name {
@Override
public String getParameter(String name) {
if (this.charset.equalsIgnoreCase(this.originCharset)) {
return super.getParameter(name); // depends on control dependency: [if], data = [none]
}
String value = super.getParameter(name);
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
value = new String(value.getBytes(this.originCharset), this.charset); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return value;
} }
|
public class class_name {
public static String deepToString(final Object obj) {
if (obj == null) {
return NULL_STRING;
}
if (obj.getClass().isArray()) {
return typeOf(obj.getClass()).deepToString(obj);
}
return obj.toString();
} }
|
public class class_name {
public static String deepToString(final Object obj) {
if (obj == null) {
return NULL_STRING;
// depends on control dependency: [if], data = [none]
}
if (obj.getClass().isArray()) {
return typeOf(obj.getClass()).deepToString(obj);
// depends on control dependency: [if], data = [none]
}
return obj.toString();
} }
|
public class class_name {
public static ZoneId of(String zoneId) {
Jdk8Methods.requireNonNull(zoneId, "zoneId");
if (zoneId.equals("Z")) {
return ZoneOffset.UTC;
}
if (zoneId.length() == 1) {
throw new DateTimeException("Invalid zone: " + zoneId);
}
if (zoneId.startsWith("+") || zoneId.startsWith("-")) {
return ZoneOffset.of(zoneId);
}
if (zoneId.equals("UTC") || zoneId.equals("GMT") || zoneId.equals("UT")) {
return new ZoneRegion(zoneId, ZoneOffset.UTC.getRules());
}
if (zoneId.startsWith("UTC+") || zoneId.startsWith("GMT+") ||
zoneId.startsWith("UTC-") || zoneId.startsWith("GMT-")) {
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules());
}
return new ZoneRegion(zoneId.substring(0, 3) + offset.getId(), offset.getRules());
}
if (zoneId.startsWith("UT+") || zoneId.startsWith("UT-")) {
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules());
}
return new ZoneRegion("UT" + offset.getId(), offset.getRules());
}
return ZoneRegion.ofId(zoneId, true);
} }
|
public class class_name {
public static ZoneId of(String zoneId) {
Jdk8Methods.requireNonNull(zoneId, "zoneId");
if (zoneId.equals("Z")) {
return ZoneOffset.UTC; // depends on control dependency: [if], data = [none]
}
if (zoneId.length() == 1) {
throw new DateTimeException("Invalid zone: " + zoneId);
}
if (zoneId.startsWith("+") || zoneId.startsWith("-")) {
return ZoneOffset.of(zoneId); // depends on control dependency: [if], data = [none]
}
if (zoneId.equals("UTC") || zoneId.equals("GMT") || zoneId.equals("UT")) {
return new ZoneRegion(zoneId, ZoneOffset.UTC.getRules()); // depends on control dependency: [if], data = [none]
}
if (zoneId.startsWith("UTC+") || zoneId.startsWith("GMT+") ||
zoneId.startsWith("UTC-") || zoneId.startsWith("GMT-")) {
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules()); // depends on control dependency: [if], data = [none]
}
return new ZoneRegion(zoneId.substring(0, 3) + offset.getId(), offset.getRules()); // depends on control dependency: [if], data = [none]
}
if (zoneId.startsWith("UT+") || zoneId.startsWith("UT-")) {
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules()); // depends on control dependency: [if], data = [none]
}
return new ZoneRegion("UT" + offset.getId(), offset.getRules()); // depends on control dependency: [if], data = [none]
}
return ZoneRegion.ofId(zoneId, true);
} }
|
public class class_name {
public int getIdForNamespace(String uri)
{
int index = m_values.indexOf(uri);
if (index < 0)
{
m_values.addElement(uri);
return m_valueIndex++;
}
else
return index;
} }
|
public class class_name {
public int getIdForNamespace(String uri)
{
int index = m_values.indexOf(uri);
if (index < 0)
{
m_values.addElement(uri); // depends on control dependency: [if], data = [none]
return m_valueIndex++; // depends on control dependency: [if], data = [none]
}
else
return index;
} }
|
public class class_name {
public boolean shutdownService(String serviceClass, Object service)
{
if (service == null)
return false;
if (bundleContext == null)
return false;
String filter = null;
if (serviceClass == null)
if (!(service instanceof String))
serviceClass = service.getClass().getName();
if (service instanceof String)
filter = ClassServiceUtility.addToFilter("", BundleConstants.SERVICE_PID, (String)service);
ServiceReference[] refs;
try {
refs = bundleContext.getServiceReferences(serviceClass, filter);
if ((refs == null) || (refs.length == 0))
return false;
for (ServiceReference reference : refs)
{
if ((bundleContext.getService(reference) == service) || (service instanceof String))
{
if (refs.length == 1)
{ // Last/only one, shut down the service
// Lame code
String dependentBaseBundleClassName = service.getClass().getName();
String packageName = ClassFinderActivator.getPackageName(dependentBaseBundleClassName, false);
if (service instanceof String)
packageName = (String)service;
Bundle bundle = this.findBundle(null, bundleContext, packageName, null);
if (bundle != null)
if ((bundle.getState() & Bundle.ACTIVE) != 0)
{
try {
bundle.stop();
} catch (BundleException e) {
e.printStackTrace();
}
}
return true;
}
}
}
} catch (InvalidSyntaxException e1) {
e1.printStackTrace();
}
return false; // Not found?
} }
|
public class class_name {
public boolean shutdownService(String serviceClass, Object service)
{
if (service == null)
return false;
if (bundleContext == null)
return false;
String filter = null;
if (serviceClass == null)
if (!(service instanceof String))
serviceClass = service.getClass().getName();
if (service instanceof String)
filter = ClassServiceUtility.addToFilter("", BundleConstants.SERVICE_PID, (String)service);
ServiceReference[] refs;
try {
refs = bundleContext.getServiceReferences(serviceClass, filter); // depends on control dependency: [try], data = [none]
if ((refs == null) || (refs.length == 0))
return false;
for (ServiceReference reference : refs)
{
if ((bundleContext.getService(reference) == service) || (service instanceof String))
{
if (refs.length == 1)
{ // Last/only one, shut down the service
// Lame code
String dependentBaseBundleClassName = service.getClass().getName();
String packageName = ClassFinderActivator.getPackageName(dependentBaseBundleClassName, false);
if (service instanceof String)
packageName = (String)service;
Bundle bundle = this.findBundle(null, bundleContext, packageName, null);
if (bundle != null)
if ((bundle.getState() & Bundle.ACTIVE) != 0)
{
try {
bundle.stop(); // depends on control dependency: [try], data = [none]
} catch (BundleException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
}
} catch (InvalidSyntaxException e1) {
e1.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return false; // Not found?
} }
|
public class class_name {
public @CheckForNull
TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation() {
boolean firstPartialResult = true;
TypeQualifierAnnotation effective = null;
for (PartialResult partialResult : partialResultList) {
if (firstPartialResult) {
effective = partialResult.getTypeQualifierAnnotation();
firstPartialResult = false;
} else {
effective = combine(effective, partialResult.getTypeQualifierAnnotation());
}
}
return effective;
} }
|
public class class_name {
public @CheckForNull
TypeQualifierAnnotation getEffectiveTypeQualifierAnnotation() {
boolean firstPartialResult = true;
TypeQualifierAnnotation effective = null;
for (PartialResult partialResult : partialResultList) {
if (firstPartialResult) {
effective = partialResult.getTypeQualifierAnnotation(); // depends on control dependency: [if], data = [none]
firstPartialResult = false; // depends on control dependency: [if], data = [none]
} else {
effective = combine(effective, partialResult.getTypeQualifierAnnotation()); // depends on control dependency: [if], data = [none]
}
}
return effective;
} }
|
public class class_name {
protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes));
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes));
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} }
|
public class class_name {
protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes)); // depends on control dependency: [if], data = [none]
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes)); // depends on control dependency: [if], data = [none]
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} }
|
public class class_name {
public static String[] getTokens(String str, String delim, boolean trim){
StringTokenizer stok = new StringTokenizer(str, delim);
String tokens[] = new String[stok.countTokens()];
for(int i=0; i<tokens.length; i++){
tokens[i] = stok.nextToken();
if(trim)
tokens[i] = tokens[i].trim();
}
return tokens;
} }
|
public class class_name {
public static String[] getTokens(String str, String delim, boolean trim){
StringTokenizer stok = new StringTokenizer(str, delim);
String tokens[] = new String[stok.countTokens()];
for(int i=0; i<tokens.length; i++){
tokens[i] = stok.nextToken(); // depends on control dependency: [for], data = [i]
if(trim)
tokens[i] = tokens[i].trim();
}
return tokens;
} }
|
public class class_name {
public T removeGeoPackage(String name) {
T removed = null;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.remove(name);
if (properties != null) {
removed = properties.getGeoPackage();
}
return removed;
} }
|
public class class_name {
public T removeGeoPackage(String name) {
T removed = null;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.remove(name);
if (properties != null) {
removed = properties.getGeoPackage(); // depends on control dependency: [if], data = [none]
}
return removed;
} }
|
public class class_name {
@Nullable
private HashMap<Integer, VertCoordType> readFnmocTable3(String path) {
try (InputStream is = GribResourceReader.getInputStream(path)) {
SAXBuilder builder = new SAXBuilder();
org.jdom2.Document doc = builder.build(is);
Element root = doc.getRootElement();
HashMap<Integer, VertCoordType> result = new HashMap<>(200);
Element fnmocTable = root.getChild("fnmocTable");
List<Element> params = fnmocTable.getChildren("entry");
for (Element elem1 : params) {
int code = Integer.parseInt(elem1.getChildText("grib1Id"));
if (code < 129) continue;
String desc = elem1.getChildText("description");
String abbrev = elem1.getChildText("name");
String units = elem1.getChildText("units");
if (units == null) units = (code == 219) ? "Pa" : "";
String datum = elem1.getChildText("datum");
boolean isLayer = elem1.getChild("isLayer") != null;
boolean isPositiveUp = elem1.getChild("isPositiveUp") != null;
VertCoordType lt = new VertCoordType(code, desc, abbrev, units, datum, isPositiveUp, isLayer);
result.put(code, lt);
}
return result; // all at once - thread safe
} catch (IOException | JDOMException e) {
logger.error("Cant read FnmocTable3 = " + path, e);
return null;
}
} }
|
public class class_name {
@Nullable
private HashMap<Integer, VertCoordType> readFnmocTable3(String path) {
try (InputStream is = GribResourceReader.getInputStream(path)) {
SAXBuilder builder = new SAXBuilder();
org.jdom2.Document doc = builder.build(is);
Element root = doc.getRootElement();
HashMap<Integer, VertCoordType> result = new HashMap<>(200);
Element fnmocTable = root.getChild("fnmocTable");
List<Element> params = fnmocTable.getChildren("entry");
for (Element elem1 : params) {
int code = Integer.parseInt(elem1.getChildText("grib1Id"));
if (code < 129) continue;
String desc = elem1.getChildText("description");
String abbrev = elem1.getChildText("name");
String units = elem1.getChildText("units");
if (units == null) units = (code == 219) ? "Pa" : "";
String datum = elem1.getChildText("datum");
boolean isLayer = elem1.getChild("isLayer") != null;
boolean isPositiveUp = elem1.getChild("isPositiveUp") != null;
VertCoordType lt = new VertCoordType(code, desc, abbrev, units, datum, isPositiveUp, isLayer);
result.put(code, lt);
// depends on control dependency: [for], data = [none]
}
return result; // all at once - thread safe
} catch (IOException | JDOMException e) {
logger.error("Cant read FnmocTable3 = " + path, e);
return null;
}
} }
|
public class class_name {
public int getDataFrameSize(DataFrame dataFrame)
{
long l = dataFrame != null ? dataFrame.count() : 0;
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE)
{
logger.error(l + " cannot be cast to int without changing its value.");
return 0;
}
return (int) l;
} }
|
public class class_name {
public int getDataFrameSize(DataFrame dataFrame)
{
long l = dataFrame != null ? dataFrame.count() : 0;
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE)
{
logger.error(l + " cannot be cast to int without changing its value."); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
return (int) l;
} }
|
public class class_name {
@Override
public int syncUp() {
// Copy entire entry from neighboring DS node
int count = 0;
for (int i = 0; ((i < serverConfig.getRegistrySyncRetries()) && (count == 0)); i++) {
if (i > 0) {
try {
Thread.sleep(serverConfig.getRegistrySyncRetryWaitMs());
} catch (InterruptedException e) {
logger.warn("Interrupted during registry transfer..");
break;
}
}
Applications apps = eurekaClient.getApplications();
for (Application app : apps.getRegisteredApplications()) {
for (InstanceInfo instance : app.getInstances()) {
try {
if (isRegisterable(instance)) {
register(instance, instance.getLeaseInfo().getDurationInSecs(), true);
count++;
}
} catch (Throwable t) {
logger.error("During DS init copy", t);
}
}
}
}
return count;
} }
|
public class class_name {
@Override
public int syncUp() {
// Copy entire entry from neighboring DS node
int count = 0;
for (int i = 0; ((i < serverConfig.getRegistrySyncRetries()) && (count == 0)); i++) {
if (i > 0) {
try {
Thread.sleep(serverConfig.getRegistrySyncRetryWaitMs()); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
logger.warn("Interrupted during registry transfer..");
break;
} // depends on control dependency: [catch], data = [none]
}
Applications apps = eurekaClient.getApplications();
for (Application app : apps.getRegisteredApplications()) {
for (InstanceInfo instance : app.getInstances()) {
try {
if (isRegisterable(instance)) {
register(instance, instance.getLeaseInfo().getDurationInSecs(), true); // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
logger.error("During DS init copy", t);
} // depends on control dependency: [catch], data = [none]
}
}
}
return count;
} }
|
public class class_name {
public void invokeRequest (ClientObject caller, byte[] serializedAction,
InvocationService.ResultListener listener)
{
NodeRequest request = null;
try {
ObjectInputStream oin =
new ObjectInputStream(new ByteArrayInputStream(serializedAction));
request = (NodeRequest)oin.readObject();
_injector.injectMembers(request);
request.invoke(listener);
} catch (Exception e) {
log.warning("Failed to execute node request",
"from", (caller == null) ? "self" : caller.who(),
"request", request, "serializedSize", serializedAction.length, e);
listener.requestFailed("Failed to execute node request");
}
} }
|
public class class_name {
public void invokeRequest (ClientObject caller, byte[] serializedAction,
InvocationService.ResultListener listener)
{
NodeRequest request = null;
try {
ObjectInputStream oin =
new ObjectInputStream(new ByteArrayInputStream(serializedAction));
request = (NodeRequest)oin.readObject(); // depends on control dependency: [try], data = [none]
_injector.injectMembers(request); // depends on control dependency: [try], data = [none]
request.invoke(listener); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warning("Failed to execute node request",
"from", (caller == null) ? "self" : caller.who(),
"request", request, "serializedSize", serializedAction.length, e);
listener.requestFailed("Failed to execute node request");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void load(Path path) throws IOException {
FileUtils.checkPath(path);
logger.debug("Loading variant metadata from '{}'", path.toAbsolutePath().toString());
variantMetadata = mapper.readValue(path.toFile(), VariantMetadata.class);
// We need to add Individual info fields to their sample annotations to allow more complex queries
for (VariantStudyMetadata variantStudyMetadata: variantMetadata.getStudies()) {
if (variantStudyMetadata.getIndividuals() != null) {
for (org.opencb.biodata.models.metadata.Individual individual : variantStudyMetadata.getIndividuals()) {
for (Sample sample : individual.getSamples()) {
sample.getAnnotations().put(INDIVIDUAL_ID, individual.getId());
sample.getAnnotations().put(INDIVIDUAL_FAMILY, individual.getFamily());
sample.getAnnotations().put(INDIVIDUAL_FATHER, individual.getFather());
sample.getAnnotations().put(INDIVIDUAL_MOTHER, individual.getMother());
sample.getAnnotations().put(INDIVIDUAL_SEX, individual.getSex());
sample.getAnnotations().put(INDIVIDUAL_PHENOTYPE, individual.getPhenotype());
}
}
}
}
} }
|
public class class_name {
public void load(Path path) throws IOException {
FileUtils.checkPath(path);
logger.debug("Loading variant metadata from '{}'", path.toAbsolutePath().toString());
variantMetadata = mapper.readValue(path.toFile(), VariantMetadata.class);
// We need to add Individual info fields to their sample annotations to allow more complex queries
for (VariantStudyMetadata variantStudyMetadata: variantMetadata.getStudies()) {
if (variantStudyMetadata.getIndividuals() != null) {
for (org.opencb.biodata.models.metadata.Individual individual : variantStudyMetadata.getIndividuals()) {
for (Sample sample : individual.getSamples()) {
sample.getAnnotations().put(INDIVIDUAL_ID, individual.getId()); // depends on control dependency: [for], data = [sample]
sample.getAnnotations().put(INDIVIDUAL_FAMILY, individual.getFamily()); // depends on control dependency: [for], data = [sample]
sample.getAnnotations().put(INDIVIDUAL_FATHER, individual.getFather()); // depends on control dependency: [for], data = [sample]
sample.getAnnotations().put(INDIVIDUAL_MOTHER, individual.getMother()); // depends on control dependency: [for], data = [sample]
sample.getAnnotations().put(INDIVIDUAL_SEX, individual.getSex()); // depends on control dependency: [for], data = [sample]
sample.getAnnotations().put(INDIVIDUAL_PHENOTYPE, individual.getPhenotype()); // depends on control dependency: [for], data = [sample]
}
}
}
}
} }
|
public class class_name {
protected Credentials configureCredentials(AuthConfiguration auth) {
if (null != auth.getCredentialType() && auth.getCredentialType().equalsIgnoreCase(AuthConfiguration.NT_CREDS)) {
return new NTCredentials(auth.getUsername(), auth.getPassword(), auth.getHostname(), auth.getDomain());
} else {
return new UsernamePasswordCredentials(auth.getUsername(), auth.getPassword());
}
} }
|
public class class_name {
protected Credentials configureCredentials(AuthConfiguration auth) {
if (null != auth.getCredentialType() && auth.getCredentialType().equalsIgnoreCase(AuthConfiguration.NT_CREDS)) {
return new NTCredentials(auth.getUsername(), auth.getPassword(), auth.getHostname(), auth.getDomain()); // depends on control dependency: [if], data = [none]
} else {
return new UsernamePasswordCredentials(auth.getUsername(), auth.getPassword()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Geometry execute(Geometry geometry) {
if (geometry == null) {
return null;
}
if (geometry instanceof LinearRing) {
if (coordIndex <= 0) {
coordIndex = 0;
} else if (coordIndex > geometry.getNumPoints() - 2) {
coordIndex = geometry.getNumPoints() - 2;
}
Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
for (int i = 0; i < coordinates.length; i++) {
Coordinate coordinate = geometry.getCoordinates()[i];
if (i == coordIndex) {
coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY);
} else if (i == geometry.getNumPoints() - 1) {
coordinates[i] = coordinates[0];
} else {
coordinates[i] = coordinate;
}
}
return geometry.getGeometryFactory().createLinearRing(coordinates);
} else if (geometry instanceof LineString) {
if (coordIndex <= 0) {
coordIndex = 0;
} else if (coordIndex > geometry.getNumPoints() - 1) {
coordIndex = geometry.getNumPoints() - 1;
}
Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
for (int i = 0; i < coordinates.length; i++) {
Coordinate coordinate = geometry.getCoordinates()[i];
if (i == coordIndex) {
coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY);
} else {
coordinates[i] = geometry.getCoordinates()[i];
}
}
return geometry.getGeometryFactory().createLineString(coordinates);
}
return null;
} }
|
public class class_name {
public Geometry execute(Geometry geometry) {
if (geometry == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (geometry instanceof LinearRing) {
if (coordIndex <= 0) {
coordIndex = 0; // depends on control dependency: [if], data = [none]
} else if (coordIndex > geometry.getNumPoints() - 2) {
coordIndex = geometry.getNumPoints() - 2; // depends on control dependency: [if], data = [none]
}
Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
for (int i = 0; i < coordinates.length; i++) {
Coordinate coordinate = geometry.getCoordinates()[i];
if (i == coordIndex) {
coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY); // depends on control dependency: [if], data = [none]
} else if (i == geometry.getNumPoints() - 1) {
coordinates[i] = coordinates[0]; // depends on control dependency: [if], data = [none]
} else {
coordinates[i] = coordinate; // depends on control dependency: [if], data = [none]
}
}
return geometry.getGeometryFactory().createLinearRing(coordinates); // depends on control dependency: [if], data = [none]
} else if (geometry instanceof LineString) {
if (coordIndex <= 0) {
coordIndex = 0; // depends on control dependency: [if], data = [none]
} else if (coordIndex > geometry.getNumPoints() - 1) {
coordIndex = geometry.getNumPoints() - 1; // depends on control dependency: [if], data = [none]
}
Coordinate[] coordinates = new Coordinate[geometry.getNumPoints()];
for (int i = 0; i < coordinates.length; i++) {
Coordinate coordinate = geometry.getCoordinates()[i];
if (i == coordIndex) {
coordinates[i] = new Coordinate(coordinate.getX() + translateX, coordinate.getY() + translateY); // depends on control dependency: [if], data = [none]
} else {
coordinates[i] = geometry.getCoordinates()[i]; // depends on control dependency: [if], data = [none]
}
}
return geometry.getGeometryFactory().createLineString(coordinates); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override
public String themePath(String theTheme) {
StringBuilder src = dots(new StringBuilder());
if(theTheme==null||theTheme.length()==0) {
src.append(theme);
if(theme.length()>0)src.append('/');
} else {
src.append(theTheme);
src.append('/');
}
return src.toString();
} }
|
public class class_name {
@Override
public String themePath(String theTheme) {
StringBuilder src = dots(new StringBuilder());
if(theTheme==null||theTheme.length()==0) {
src.append(theme); // depends on control dependency: [if], data = [none]
if(theme.length()>0)src.append('/');
} else {
src.append(theTheme); // depends on control dependency: [if], data = [(theTheme]
src.append('/'); // depends on control dependency: [if], data = [none]
}
return src.toString();
} }
|
public class class_name {
@Override
protected void initializeDefaults() {
String err = "A BEL Framework system configuration must be present";
if (configurationFile != null) {
err += " (using " + configurationFile + ")";
}
throw new BELRuntimeException(err, MISSING_SYSTEM_CONFIGURATION);
} }
|
public class class_name {
@Override
protected void initializeDefaults() {
String err = "A BEL Framework system configuration must be present";
if (configurationFile != null) {
err += " (using " + configurationFile + ")"; // depends on control dependency: [if], data = [none]
}
throw new BELRuntimeException(err, MISSING_SYSTEM_CONFIGURATION);
} }
|
public class class_name {
public static void join(final Thread thread) {
try {
thread.join();
} catch (InterruptedException inex) {
Thread.currentThread().interrupt();
}
} }
|
public class class_name {
public static void join(final Thread thread) {
try {
thread.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException inex) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String getAccessKeyAsString() {
char accessKey = getComponentModel().accessKey;
if (Character.isLetterOrDigit(accessKey)) {
return String.valueOf(accessKey);
}
return null;
} }
|
public class class_name {
public String getAccessKeyAsString() {
char accessKey = getComponentModel().accessKey;
if (Character.isLetterOrDigit(accessKey)) {
return String.valueOf(accessKey); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static TimeZone toTimeZone(String strTimezone, TimeZone defaultValue) {
if (strTimezone == null) return defaultValue;
String strTimezoneTrimmed = StringUtil.replace(strTimezone.trim().toLowerCase(), " ", "", false);
TimeZone tz = getTimeZoneFromIDS(strTimezoneTrimmed);
if (tz != null) return tz;
// parse GMT followd by a number
float gmtOffset = Float.NaN;
if (strTimezoneTrimmed.startsWith("gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("etc/gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("etc/utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN);
if (!Float.isNaN(gmtOffset)) {
strTimezoneTrimmed = "etc/gmt" + (gmtOffset >= 0 ? "+" : "") + Caster.toString(gmtOffset);
tz = getTimeZoneFromIDS(strTimezoneTrimmed);
if (tz != null) return tz;
}
// display name in all variations
if (!StringUtil.isEmpty(strTimezoneTrimmed)) {
tz = dn.get(strTimezoneTrimmed);
if (tz != null) return tz;
Iterator<Object> it = IDS.values().iterator();
Object o;
while (it.hasNext()) {
o = it.next();
if (o instanceof TimeZone) {
tz = (TimeZone) o;
if (strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.SHORT, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.SHORT, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.LONG, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.LONG, Locale.US))) {
dn.put(strTimezoneTrimmed, tz);
return tz;
}
}
}
}
return defaultValue;
} }
|
public class class_name {
public static TimeZone toTimeZone(String strTimezone, TimeZone defaultValue) {
if (strTimezone == null) return defaultValue;
String strTimezoneTrimmed = StringUtil.replace(strTimezone.trim().toLowerCase(), " ", "", false);
TimeZone tz = getTimeZoneFromIDS(strTimezoneTrimmed);
if (tz != null) return tz;
// parse GMT followd by a number
float gmtOffset = Float.NaN;
if (strTimezoneTrimmed.startsWith("gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("etc/gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN);
else if (strTimezoneTrimmed.startsWith("etc/utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN);
if (!Float.isNaN(gmtOffset)) {
strTimezoneTrimmed = "etc/gmt" + (gmtOffset >= 0 ? "+" : "") + Caster.toString(gmtOffset); // depends on control dependency: [if], data = [none]
tz = getTimeZoneFromIDS(strTimezoneTrimmed); // depends on control dependency: [if], data = [none]
if (tz != null) return tz;
}
// display name in all variations
if (!StringUtil.isEmpty(strTimezoneTrimmed)) {
tz = dn.get(strTimezoneTrimmed); // depends on control dependency: [if], data = [none]
if (tz != null) return tz;
Iterator<Object> it = IDS.values().iterator();
Object o;
while (it.hasNext()) {
o = it.next(); // depends on control dependency: [while], data = [none]
if (o instanceof TimeZone) {
tz = (TimeZone) o; // depends on control dependency: [if], data = [none]
if (strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.SHORT, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.SHORT, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.LONG, Locale.US))
|| strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.LONG, Locale.US))) {
dn.put(strTimezoneTrimmed, tz); // depends on control dependency: [if], data = [none]
return tz; // depends on control dependency: [if], data = [none]
}
}
}
}
return defaultValue;
} }
|
public class class_name {
@Override
public void close() {
try {
if ( content != null ) content.close();
} catch (XMLStreamException e) {
logger.error("Failed to close underlying XMLStreamReader",e);
throw new MarkLogicIOException(e);
// whether that failed or not, attempt to close underlying InputStream
} finally {
if ( contentSource != null ) {
try {
contentSource.close();
} catch (IOException e) {
logger.error("Failed to close underlying InputStream",e);
throw new MarkLogicIOException(e);
}
}
}
} }
|
public class class_name {
@Override
public void close() {
try {
if ( content != null ) content.close();
} catch (XMLStreamException e) {
logger.error("Failed to close underlying XMLStreamReader",e);
throw new MarkLogicIOException(e);
// whether that failed or not, attempt to close underlying InputStream
} finally { // depends on control dependency: [catch], data = [none]
if ( contentSource != null ) {
try {
contentSource.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Failed to close underlying InputStream",e);
throw new MarkLogicIOException(e);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
private void notifyReadySendListeners(BlockingQueue<Pair<SendListener, Conversation>> readySendCallbacks) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyReadySendListeners", readySendCallbacks);
try {
for (Pair<SendListener, Conversation> callback : readySendCallbacks) {
callback.left.dataSent(callback.right);
}
} catch (Throwable t) {
FFDCFilter.processException
(t, "com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback", JFapChannelConstants.CONNWRITECOMPCALLBACK_COMPLETE_01, connection.getDiagnostics(true));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "exception invoking send listener data sent");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, t);
connection.invalidate(true, t, "send listener threw exception"); // D224570
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyReadySendListeners");
} }
|
public class class_name {
private void notifyReadySendListeners(BlockingQueue<Pair<SendListener, Conversation>> readySendCallbacks) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyReadySendListeners", readySendCallbacks);
try {
for (Pair<SendListener, Conversation> callback : readySendCallbacks) {
callback.left.dataSent(callback.right); // depends on control dependency: [for], data = [callback]
}
} catch (Throwable t) {
FFDCFilter.processException
(t, "com.ibm.ws.sib.jfapchannel.impl.ConnectionWriteCompletedCallback", JFapChannelConstants.CONNWRITECOMPCALLBACK_COMPLETE_01, connection.getDiagnostics(true));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "exception invoking send listener data sent");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, t);
connection.invalidate(true, t, "send listener threw exception"); // D224570
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyReadySendListeners");
} }
|
public class class_name {
public void calculateEndPoints(double start, double stop) {
Point p1 = points.get(0);
if (p1.getX().doubleValue() != start) {
points.add(0, new Point(start, p1.getY()));
}
int end = points.size();
Point p2 = points.get(end - 1);
if (p2.getY().doubleValue() != stop) {
points.add(end, new Point(stop, p2.getY()));
}
} }
|
public class class_name {
public void calculateEndPoints(double start, double stop) {
Point p1 = points.get(0);
if (p1.getX().doubleValue() != start) {
points.add(0, new Point(start, p1.getY())); // depends on control dependency: [if], data = [none]
}
int end = points.size();
Point p2 = points.get(end - 1);
if (p2.getY().doubleValue() != stop) {
points.add(end, new Point(stop, p2.getY())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public JSONObject getTaskInfo(int id, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("id", id);
if (options != null) {
request.addBody(options);
}
request.setUri(KnowledgeGraphicConsts.TASK_INFO);
postOperation(request);
return requestServer(request);
} }
|
public class class_name {
public JSONObject getTaskInfo(int id, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("id", id);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(KnowledgeGraphicConsts.TASK_INFO);
postOperation(request);
return requestServer(request);
} }
|
public class class_name {
private void appendDesc(StringBuilder sb)
{
String srcId;
if (mSystemId != null) {
sb.append("[row,col,system-id]: ");
srcId = mSystemId;
} else if (mPublicId != null) {
sb.append("[row,col,public-id]: ");
srcId = mPublicId;
} else {
sb.append("[row,col {unknown-source}]: ");
srcId = null;
}
sb.append('[');
sb.append(mRow);
sb.append(',');
sb.append(mCol);
// Uncomment for testing, to see the char offset:
//sb.append(" #").append(mCharOffset);
//sb.append("{").append(System.identityHashCode(this)).append("}");
if (srcId != null) {
sb.append(',');
sb.append('"');
sb.append(srcId);
sb.append('"');
}
sb.append(']');
if (mContext != null) {
StringUtil.appendLF(sb);
sb.append(" from ");
mContext.appendDesc(sb);
}
} }
|
public class class_name {
private void appendDesc(StringBuilder sb)
{
String srcId;
if (mSystemId != null) {
sb.append("[row,col,system-id]: "); // depends on control dependency: [if], data = [none]
srcId = mSystemId; // depends on control dependency: [if], data = [none]
} else if (mPublicId != null) {
sb.append("[row,col,public-id]: "); // depends on control dependency: [if], data = [none]
srcId = mPublicId; // depends on control dependency: [if], data = [none]
} else {
sb.append("[row,col {unknown-source}]: "); // depends on control dependency: [if], data = [none]
srcId = null; // depends on control dependency: [if], data = [none]
}
sb.append('[');
sb.append(mRow);
sb.append(',');
sb.append(mCol);
// Uncomment for testing, to see the char offset:
//sb.append(" #").append(mCharOffset);
//sb.append("{").append(System.identityHashCode(this)).append("}");
if (srcId != null) {
sb.append(','); // depends on control dependency: [if], data = [none]
sb.append('"'); // depends on control dependency: [if], data = [none]
sb.append(srcId); // depends on control dependency: [if], data = [(srcId]
sb.append('"'); // depends on control dependency: [if], data = [none]
}
sb.append(']');
if (mContext != null) {
StringUtil.appendLF(sb); // depends on control dependency: [if], data = [none]
sb.append(" from "); // depends on control dependency: [if], data = [none]
mContext.appendDesc(sb); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static final int writeDiff(int diff, byte buffer[], int offset)
{
if (diff >= SLOPE_REACH_NEG_1_) {
if (diff <= SLOPE_REACH_POS_1_) {
buffer[offset ++] = (byte)(SLOPE_MIDDLE_ + diff);
}
else if (diff <= SLOPE_REACH_POS_2_) {
buffer[offset ++] = (byte)(SLOPE_START_POS_2_
+ (diff / SLOPE_TAIL_COUNT_));
buffer[offset ++] = (byte)(SLOPE_MIN_ +
(diff % SLOPE_TAIL_COUNT_));
}
else if (diff <= SLOPE_REACH_POS_3_) {
buffer[offset + 2] = (byte)(SLOPE_MIN_
+ (diff % SLOPE_TAIL_COUNT_));
diff /= SLOPE_TAIL_COUNT_;
buffer[offset + 1] = (byte)(SLOPE_MIN_
+ (diff % SLOPE_TAIL_COUNT_));
buffer[offset] = (byte)(SLOPE_START_POS_3_
+ (diff / SLOPE_TAIL_COUNT_));
offset += 3;
}
else {
buffer[offset + 3] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_);
diff /= SLOPE_TAIL_COUNT_;
buffer[offset + 2] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_);
diff /= SLOPE_TAIL_COUNT_;
buffer[offset + 1] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_);
buffer[offset] = (byte)SLOPE_MAX_;
offset += 4;
}
}
else {
long division = getNegDivMod(diff, SLOPE_TAIL_COUNT_);
int modulo = (int)division;
if (diff >= SLOPE_REACH_NEG_2_) {
diff = (int)(division >> 32);
buffer[offset ++] = (byte)(SLOPE_START_NEG_2_ + diff);
buffer[offset ++] = (byte)(SLOPE_MIN_ + modulo);
}
else if (diff >= SLOPE_REACH_NEG_3_) {
buffer[offset + 2] = (byte)(SLOPE_MIN_ + modulo);
diff = (int)(division >> 32);
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_);
modulo = (int)division;
diff = (int)(division >> 32);
buffer[offset + 1] = (byte)(SLOPE_MIN_ + modulo);
buffer[offset] = (byte)(SLOPE_START_NEG_3_ + diff);
offset += 3;
}
else {
buffer[offset + 3] = (byte)(SLOPE_MIN_ + modulo);
diff = (int)(division >> 32);
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_);
modulo = (int)division;
diff = (int)(division >> 32);
buffer[offset + 2] = (byte)(SLOPE_MIN_ + modulo);
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_);
modulo = (int)division;
buffer[offset + 1] = (byte)(SLOPE_MIN_ + modulo);
buffer[offset] = SLOPE_MIN_;
offset += 4;
}
}
return offset;
} }
|
public class class_name {
private static final int writeDiff(int diff, byte buffer[], int offset)
{
if (diff >= SLOPE_REACH_NEG_1_) {
if (diff <= SLOPE_REACH_POS_1_) {
buffer[offset ++] = (byte)(SLOPE_MIDDLE_ + diff); // depends on control dependency: [if], data = [none]
}
else if (diff <= SLOPE_REACH_POS_2_) {
buffer[offset ++] = (byte)(SLOPE_START_POS_2_
+ (diff / SLOPE_TAIL_COUNT_)); // depends on control dependency: [if], data = [none]
buffer[offset ++] = (byte)(SLOPE_MIN_ +
(diff % SLOPE_TAIL_COUNT_)); // depends on control dependency: [if], data = [none]
}
else if (diff <= SLOPE_REACH_POS_3_) {
buffer[offset + 2] = (byte)(SLOPE_MIN_
+ (diff % SLOPE_TAIL_COUNT_)); // depends on control dependency: [if], data = [none]
diff /= SLOPE_TAIL_COUNT_; // depends on control dependency: [if], data = [none]
buffer[offset + 1] = (byte)(SLOPE_MIN_
+ (diff % SLOPE_TAIL_COUNT_)); // depends on control dependency: [if], data = [none]
buffer[offset] = (byte)(SLOPE_START_POS_3_
+ (diff / SLOPE_TAIL_COUNT_)); // depends on control dependency: [if], data = [none]
offset += 3; // depends on control dependency: [if], data = [none]
}
else {
buffer[offset + 3] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [none]
diff /= SLOPE_TAIL_COUNT_; // depends on control dependency: [if], data = [none]
buffer[offset + 2] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [none]
diff /= SLOPE_TAIL_COUNT_; // depends on control dependency: [if], data = [none]
buffer[offset + 1] = (byte)(SLOPE_MIN_
+ diff % SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [none]
buffer[offset] = (byte)SLOPE_MAX_; // depends on control dependency: [if], data = [none]
offset += 4; // depends on control dependency: [if], data = [none]
}
}
else {
long division = getNegDivMod(diff, SLOPE_TAIL_COUNT_);
int modulo = (int)division;
if (diff >= SLOPE_REACH_NEG_2_) {
diff = (int)(division >> 32); // depends on control dependency: [if], data = [none]
buffer[offset ++] = (byte)(SLOPE_START_NEG_2_ + diff); // depends on control dependency: [if], data = [none]
buffer[offset ++] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
}
else if (diff >= SLOPE_REACH_NEG_3_) {
buffer[offset + 2] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
diff = (int)(division >> 32); // depends on control dependency: [if], data = [none]
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [(diff]
modulo = (int)division; // depends on control dependency: [if], data = [none]
diff = (int)(division >> 32); // depends on control dependency: [if], data = [none]
buffer[offset + 1] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
buffer[offset] = (byte)(SLOPE_START_NEG_3_ + diff); // depends on control dependency: [if], data = [none]
offset += 3; // depends on control dependency: [if], data = [none]
}
else {
buffer[offset + 3] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
diff = (int)(division >> 32); // depends on control dependency: [if], data = [none]
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [(diff]
modulo = (int)division; // depends on control dependency: [if], data = [none]
diff = (int)(division >> 32); // depends on control dependency: [if], data = [none]
buffer[offset + 2] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
division = getNegDivMod(diff, SLOPE_TAIL_COUNT_); // depends on control dependency: [if], data = [(diff]
modulo = (int)division; // depends on control dependency: [if], data = [none]
buffer[offset + 1] = (byte)(SLOPE_MIN_ + modulo); // depends on control dependency: [if], data = [none]
buffer[offset] = SLOPE_MIN_; // depends on control dependency: [if], data = [none]
offset += 4; // depends on control dependency: [if], data = [none]
}
}
return offset;
} }
|
public class class_name {
public GetMaintenanceWindowExecutionResult withTaskIds(String... taskIds) {
if (this.taskIds == null) {
setTaskIds(new com.amazonaws.internal.SdkInternalList<String>(taskIds.length));
}
for (String ele : taskIds) {
this.taskIds.add(ele);
}
return this;
} }
|
public class class_name {
public GetMaintenanceWindowExecutionResult withTaskIds(String... taskIds) {
if (this.taskIds == null) {
setTaskIds(new com.amazonaws.internal.SdkInternalList<String>(taskIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : taskIds) {
this.taskIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public List<String> getNamespace(Class<?> clazz) {
List<String> namespace;
if (clazz.getEnclosingClass() == null) {
namespace = getNamespaceMapping(clazz);
} else {
Class<?> enclosing = clazz;
Deque<Class<?>> stack = new ArrayDeque<Class<?>>();
while (enclosing.getEnclosingClass() != null) {
stack.add(enclosing);
enclosing = enclosing.getEnclosingClass();
}
namespace = getNamespace(enclosing);
while (!stack.isEmpty()) {
namespace.add(getCppName(stack.pollLast()));
}
}
List<String> escapedNamespace = newArrayList();
for (String name : namespace) {
escapedNamespace.add(escapeName(name));
}
escapedNamespace.set(escapedNamespace.size() - 1, getCppName(clazz));
return escapedNamespace;
} }
|
public class class_name {
public List<String> getNamespace(Class<?> clazz) {
List<String> namespace;
if (clazz.getEnclosingClass() == null) {
namespace = getNamespaceMapping(clazz); // depends on control dependency: [if], data = [none]
} else {
Class<?> enclosing = clazz;
Deque<Class<?>> stack = new ArrayDeque<Class<?>>();
while (enclosing.getEnclosingClass() != null) {
stack.add(enclosing); // depends on control dependency: [while], data = [none]
enclosing = enclosing.getEnclosingClass(); // depends on control dependency: [while], data = [none]
}
namespace = getNamespace(enclosing); // depends on control dependency: [if], data = [none]
while (!stack.isEmpty()) {
namespace.add(getCppName(stack.pollLast())); // depends on control dependency: [while], data = [none]
}
}
List<String> escapedNamespace = newArrayList();
for (String name : namespace) {
escapedNamespace.add(escapeName(name)); // depends on control dependency: [for], data = [name]
}
escapedNamespace.set(escapedNamespace.size() - 1, getCppName(clazz));
return escapedNamespace;
} }
|
public class class_name {
public static boolean isEmptyAll(String... args) {
for (String arg : args) {
if (!isEmpty(arg)) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean isEmptyAll(String... args) {
for (String arg : args) {
if (!isEmpty(arg)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public static Collection getEmbeddedCollectionInstance(Field embeddedCollectionField)
{
Collection embeddedCollection = null;
Class embeddedCollectionFieldClass = embeddedCollectionField.getType();
if (embeddedCollection == null || embeddedCollection.isEmpty())
{
if (embeddedCollectionFieldClass.equals(List.class))
{
embeddedCollection = new ArrayList<Object>();
}
else if (embeddedCollectionFieldClass.equals(Set.class))
{
embeddedCollection = new HashSet<Object>();
}
else
{
throw new InvalidEntityDefinitionException("Field " + embeddedCollectionField.getName()
+ " must be either instance of List or Set");
}
}
return embeddedCollection;
} }
|
public class class_name {
public static Collection getEmbeddedCollectionInstance(Field embeddedCollectionField)
{
Collection embeddedCollection = null;
Class embeddedCollectionFieldClass = embeddedCollectionField.getType();
if (embeddedCollection == null || embeddedCollection.isEmpty())
{
if (embeddedCollectionFieldClass.equals(List.class))
{
embeddedCollection = new ArrayList<Object>();
// depends on control dependency: [if], data = [none]
}
else if (embeddedCollectionFieldClass.equals(Set.class))
{
embeddedCollection = new HashSet<Object>();
// depends on control dependency: [if], data = [none]
}
else
{
throw new InvalidEntityDefinitionException("Field " + embeddedCollectionField.getName()
+ " must be either instance of List or Set");
}
}
return embeddedCollection;
} }
|
public class class_name {
public static Network createDefaultNetwork(Model mo, int bw) {
Network net = new Network();
Switch mainSwitch = net.newSwitch(); // Main non-blocking switch
for (Node n : mo.getMapping().getAllNodes()) {
net.connect(bw, mainSwitch, n); // Connect all nodes with 1Gbit/s links
}
// Remove the current Network view if exists
if (get(mo) != null) {
mo.detach(get(mo));
}
mo.attach(net);
return net;
} }
|
public class class_name {
public static Network createDefaultNetwork(Model mo, int bw) {
Network net = new Network();
Switch mainSwitch = net.newSwitch(); // Main non-blocking switch
for (Node n : mo.getMapping().getAllNodes()) {
net.connect(bw, mainSwitch, n); // Connect all nodes with 1Gbit/s links // depends on control dependency: [for], data = [n]
}
// Remove the current Network view if exists
if (get(mo) != null) {
mo.detach(get(mo)); // depends on control dependency: [if], data = [(get(mo)]
}
mo.attach(net);
return net;
} }
|
public class class_name {
public void marshall(DisableRadiusRequest disableRadiusRequest, ProtocolMarshaller protocolMarshaller) {
if (disableRadiusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disableRadiusRequest.getDirectoryId(), DIRECTORYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DisableRadiusRequest disableRadiusRequest, ProtocolMarshaller protocolMarshaller) {
if (disableRadiusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disableRadiusRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public Object get(Symbol key, Scriptable start)
{
Slot slot = slotMap.query(key, 0);
if (slot == null) {
return Scriptable.NOT_FOUND;
}
return slot.getValue(start);
} }
|
public class class_name {
@Override
public Object get(Symbol key, Scriptable start)
{
Slot slot = slotMap.query(key, 0);
if (slot == null) {
return Scriptable.NOT_FOUND; // depends on control dependency: [if], data = [none]
}
return slot.getValue(start);
} }
|
public class class_name {
public static Reflect on(@NonNull Constructor constructor, boolean allowPrivilegedAccess, Object... args) throws ReflectionException {
boolean accessible = constructor.isAccessible();
try {
if (!accessible && allowPrivilegedAccess) {
constructor.setAccessible(true);
}
if (args != null) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
for (int i = 0; i < args.length; i++) {
args[i] = convertValueType(args[i], parameterTypes[i]);
}
}
Object object = constructor.newInstance(args);
return new Reflect(object, object.getClass(), allowPrivilegedAccess);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new ReflectionException(e);
} finally {
if (!accessible && allowPrivilegedAccess) {
constructor.setAccessible(false);
}
}
} }
|
public class class_name {
public static Reflect on(@NonNull Constructor constructor, boolean allowPrivilegedAccess, Object... args) throws ReflectionException {
boolean accessible = constructor.isAccessible();
try {
if (!accessible && allowPrivilegedAccess) {
constructor.setAccessible(true); // depends on control dependency: [if], data = [none]
}
if (args != null) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
for (int i = 0; i < args.length; i++) {
args[i] = convertValueType(args[i], parameterTypes[i]); // depends on control dependency: [for], data = [i]
}
}
Object object = constructor.newInstance(args);
return new Reflect(object, object.getClass(), allowPrivilegedAccess); // depends on control dependency: [try], data = [none]
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new ReflectionException(e);
} finally { // depends on control dependency: [catch], data = [none]
if (!accessible && allowPrivilegedAccess) {
constructor.setAccessible(false); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static int[] getMaxImgSize(int h, int w) {
int[] size = {h, w};
int max = Config.MAX_IMG_SIZE_PX;
if (w == h) {
size[0] = Math.min(h, max);
size[1] = Math.min(w, max);
} else if (Math.max(h, w) > max) {
int ratio = (100 * max) / Math.max(h, w);
if (h > w) {
size[0] = max;
size[1] = (w * ratio) / 100;
} else {
size[0] = (h * ratio) / 100;
size[1] = max;
}
}
return size;
} }
|
public class class_name {
public static int[] getMaxImgSize(int h, int w) {
int[] size = {h, w};
int max = Config.MAX_IMG_SIZE_PX;
if (w == h) {
size[0] = Math.min(h, max); // depends on control dependency: [if], data = [none]
size[1] = Math.min(w, max); // depends on control dependency: [if], data = [(w]
} else if (Math.max(h, w) > max) {
int ratio = (100 * max) / Math.max(h, w);
if (h > w) {
size[0] = max; // depends on control dependency: [if], data = [none]
size[1] = (w * ratio) / 100; // depends on control dependency: [if], data = [none]
} else {
size[0] = (h * ratio) / 100; // depends on control dependency: [if], data = [(h]
size[1] = max; // depends on control dependency: [if], data = [none]
}
}
return size;
} }
|
public class class_name {
protected static <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
if (type == ResourceHandle.class) {
return type.cast(new ResourceHandle(resource));
}
log.info("Unable to adapt resource on {} to type {}", resource.getPath(), type.getName());
return null;
} }
|
public class class_name {
protected static <AdapterType> AdapterType getAdapter(Resource resource, Class<AdapterType> type) {
if (type == ResourceHandle.class) {
return type.cast(new ResourceHandle(resource)); // depends on control dependency: [if], data = [none]
}
log.info("Unable to adapt resource on {} to type {}", resource.getPath(), type.getName());
return null;
} }
|
public class class_name {
public I_CmsWidget getWidgetObject() {
if (getWidget() == null) {
if (m_params == null) {
return new CmsInputWidget();
} else {
return new CmsInputWidget(m_params);
}
}
try {
if (m_params == null) {
return (I_CmsWidget)Class.forName(getWidget()).newInstance();
}
Class<?> clazz = Class.forName(getWidget());
Constructor<?> ctor = clazz.getConstructor(new Class[] {String.class});
return (I_CmsWidget)ctor.newInstance(new Object[] {m_params});
} catch (Exception e) {
return new CmsInputWidget();
}
} }
|
public class class_name {
public I_CmsWidget getWidgetObject() {
if (getWidget() == null) {
if (m_params == null) {
return new CmsInputWidget(); // depends on control dependency: [if], data = [none]
} else {
return new CmsInputWidget(m_params); // depends on control dependency: [if], data = [(m_params]
}
}
try {
if (m_params == null) {
return (I_CmsWidget)Class.forName(getWidget()).newInstance(); // depends on control dependency: [if], data = [none]
}
Class<?> clazz = Class.forName(getWidget());
Constructor<?> ctor = clazz.getConstructor(new Class[] {String.class}); // depends on control dependency: [try], data = [none]
return (I_CmsWidget)ctor.newInstance(new Object[] {m_params}); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return new CmsInputWidget();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Slf4jStream of(Class<?> klass, String name) {
if (name == null) {
return of(klass);
} else {
return of(LoggerFactory.getLogger(klass.getName() + "." + name));
}
} }
|
public class class_name {
public static Slf4jStream of(Class<?> klass, String name) {
if (name == null) {
return of(klass); // depends on control dependency: [if], data = [none]
} else {
return of(LoggerFactory.getLogger(klass.getName() + "." + name)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public AuthenticationStatus forward(String path) {
try {
RequestDispatcher requestDispatcher = request.getRequestDispatcher(path);
requestDispatcher.forward(request, response);
} catch (Exception e) {
// TODO: Add serviceability message
}
return AuthenticationStatus.SEND_CONTINUE;
} }
|
public class class_name {
@Override
public AuthenticationStatus forward(String path) {
try {
RequestDispatcher requestDispatcher = request.getRequestDispatcher(path);
requestDispatcher.forward(request, response); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// TODO: Add serviceability message
} // depends on control dependency: [catch], data = [none]
return AuthenticationStatus.SEND_CONTINUE;
} }
|
public class class_name {
public void reportDataOrNoMoreData(
TableRuntimeContext tableRuntimeContext,
int recordCount,
int batchSize,
boolean resultSetEndReached,
AtomicBoolean tableFinished,
AtomicBoolean schemaFinished,
List<String> schemaFinishedTables
) {
final TableContext sourceContext = tableRuntimeContext.getSourceTableContext();
// When we see a table with data, we mark isNoMoreDataEventGeneratedAlready to false
// so we can generate event again if we don't see data from all tables.
if(recordCount > 0) {
isNoMoreDataEventGeneratedAlready = false;
tablesWithNoMoreData.remove(tableRuntimeContext.getSourceTableContext());
remainingSchemasToTableContexts.put(sourceContext.getSchema(), sourceContext);
completedSchemasToTableContexts.remove(sourceContext.getSchema(), sourceContext);
}
// we need to account for the activeRuntimeContexts here
// if there are still other active contexts in process, then this should do "nothing"
// if there are not other contexts, we need to figure out what the highest offset completed by the last batch was
final boolean noMoreData = recordCount == 0 || resultSetEndReached;
if (noMoreData) {
tableRuntimeContext.setMarkedNoMoreData(true);
}
if (recordCount > 0) {
maxPartitionWithDataPerTable.put(sourceContext, tableRuntimeContext.getPartitionSequence());
}
boolean tableExhausted = removePartitionIfNeeded(tableRuntimeContext);
if (noMoreData) {
if (tableExhausted) {
synchronized (this) {
if (LOG.isDebugEnabled()) {
LOG.debug(
"Table {} exhausted",
sourceContext.getQualifiedName()
);
}
final boolean newlyFinished = tablesWithNoMoreData.add(sourceContext);
if (newlyFinished && tableFinished != null) {
tableFinished.set(true);
}
final boolean remainingSchemaChanged = remainingSchemasToTableContexts.remove(sourceContext.getSchema(), sourceContext);
completedSchemasToTableContexts.put(sourceContext.getSchema(), sourceContext);
if (remainingSchemaChanged && remainingSchemasToTableContexts.get(sourceContext.getSchema()).isEmpty() && schemaFinished != null) {
schemaFinished.set(true);
if (schemaFinishedTables != null) {
completedSchemasToTableContexts.get(sourceContext.getSchema()).forEach(
t -> schemaFinishedTables.add(t.getTableName())
);
}
}
}
}
}
if (LOG.isTraceEnabled()) {
LOG.trace(
"Just released table {}; Number of Tables With No More Data {}",
tableRuntimeContext.getDescription(),
tablesWithNoMoreData.size()
);
}
} }
|
public class class_name {
public void reportDataOrNoMoreData(
TableRuntimeContext tableRuntimeContext,
int recordCount,
int batchSize,
boolean resultSetEndReached,
AtomicBoolean tableFinished,
AtomicBoolean schemaFinished,
List<String> schemaFinishedTables
) {
final TableContext sourceContext = tableRuntimeContext.getSourceTableContext();
// When we see a table with data, we mark isNoMoreDataEventGeneratedAlready to false
// so we can generate event again if we don't see data from all tables.
if(recordCount > 0) {
isNoMoreDataEventGeneratedAlready = false; // depends on control dependency: [if], data = [none]
tablesWithNoMoreData.remove(tableRuntimeContext.getSourceTableContext()); // depends on control dependency: [if], data = [none]
remainingSchemasToTableContexts.put(sourceContext.getSchema(), sourceContext); // depends on control dependency: [if], data = [none]
completedSchemasToTableContexts.remove(sourceContext.getSchema(), sourceContext); // depends on control dependency: [if], data = [none]
}
// we need to account for the activeRuntimeContexts here
// if there are still other active contexts in process, then this should do "nothing"
// if there are not other contexts, we need to figure out what the highest offset completed by the last batch was
final boolean noMoreData = recordCount == 0 || resultSetEndReached;
if (noMoreData) {
tableRuntimeContext.setMarkedNoMoreData(true); // depends on control dependency: [if], data = [none]
}
if (recordCount > 0) {
maxPartitionWithDataPerTable.put(sourceContext, tableRuntimeContext.getPartitionSequence()); // depends on control dependency: [if], data = [none]
}
boolean tableExhausted = removePartitionIfNeeded(tableRuntimeContext);
if (noMoreData) {
if (tableExhausted) {
synchronized (this) { // depends on control dependency: [if], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug(
"Table {} exhausted",
sourceContext.getQualifiedName()
); // depends on control dependency: [if], data = [none]
}
final boolean newlyFinished = tablesWithNoMoreData.add(sourceContext);
if (newlyFinished && tableFinished != null) {
tableFinished.set(true); // depends on control dependency: [if], data = [none]
}
final boolean remainingSchemaChanged = remainingSchemasToTableContexts.remove(sourceContext.getSchema(), sourceContext);
completedSchemasToTableContexts.put(sourceContext.getSchema(), sourceContext);
if (remainingSchemaChanged && remainingSchemasToTableContexts.get(sourceContext.getSchema()).isEmpty() && schemaFinished != null) {
schemaFinished.set(true); // depends on control dependency: [if], data = [none]
if (schemaFinishedTables != null) {
completedSchemasToTableContexts.get(sourceContext.getSchema()).forEach(
t -> schemaFinishedTables.add(t.getTableName())
); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (LOG.isTraceEnabled()) {
LOG.trace(
"Just released table {}; Number of Tables With No More Data {}",
tableRuntimeContext.getDescription(),
tablesWithNoMoreData.size()
);
}
} }
|
public class class_name {
@Override
public EClass getIfcSpace() {
if (ifcSpaceEClass == null) {
ifcSpaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(610);
}
return ifcSpaceEClass;
} }
|
public class class_name {
@Override
public EClass getIfcSpace() {
if (ifcSpaceEClass == null) {
ifcSpaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(610);
// depends on control dependency: [if], data = [none]
}
return ifcSpaceEClass;
} }
|
public class class_name {
public static int ceToJD(long year, int month, int day, int jdEpochOffset) {
// Julian<->Ethiopic algorithms from:
// "Calendars in Ethiopia", Berhanu Beyene, Manfred Kudlek, International Conference
// of Ethiopian Studies XV, Hamburg, 2003
// handle month > 12, < 0 (e.g. from add/set)
if ( month >= 0 ) {
year += month/13;
month %= 13;
} else {
++month;
year += month/13 - 1;
month = month%13 + 12;
}
return (int) (
jdEpochOffset // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ floorDivide(year, 4) // extra day of leap year
+ 30 * month // number of days from months (months are 0-based)
+ day - 1 // number of days for present month (1 based)
);
} }
|
public class class_name {
public static int ceToJD(long year, int month, int day, int jdEpochOffset) {
// Julian<->Ethiopic algorithms from:
// "Calendars in Ethiopia", Berhanu Beyene, Manfred Kudlek, International Conference
// of Ethiopian Studies XV, Hamburg, 2003
// handle month > 12, < 0 (e.g. from add/set)
if ( month >= 0 ) {
year += month/13; // depends on control dependency: [if], data = [none]
month %= 13; // depends on control dependency: [if], data = [none]
} else {
++month; // depends on control dependency: [if], data = [none]
year += month/13 - 1; // depends on control dependency: [if], data = [none]
month = month%13 + 12; // depends on control dependency: [if], data = [none]
}
return (int) (
jdEpochOffset // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ floorDivide(year, 4) // extra day of leap year
+ 30 * month // number of days from months (months are 0-based)
+ day - 1 // number of days for present month (1 based)
);
} }
|
public class class_name {
private boolean findJavaSourceFiles(String[] args) {
String prev = "";
for (String s : args) {
if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) {
return true;
}
prev = s;
}
return false;
} }
|
public class class_name {
private boolean findJavaSourceFiles(String[] args) {
String prev = "";
for (String s : args) {
if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) {
return true; // depends on control dependency: [if], data = [none]
}
prev = s; // depends on control dependency: [for], data = [s]
}
return false;
} }
|
public class class_name {
public static void moveSubRootContents(File fromSubRoot, File toSubRoot) throws IOException {
assert(fromSubRoot.exists() && fromSubRoot.isDirectory());
assert(toSubRoot.exists() && toSubRoot.isDirectory());
for (File file : fromSubRoot.listFiles()) {
File fInOtherSubroot = new File(toSubRoot, file.getName());
if (file.isDirectory()) {
if (!fInOtherSubroot.exists()) {
if (!fInOtherSubroot.mkdir()) {
throw new IOException("Can't create directory " + fInOtherSubroot);
}
}
moveSubRootContents(file, fInOtherSubroot);
}
else {
if (fInOtherSubroot.exists()) {
throw new IOException(fInOtherSubroot + " already exists");
}
if (!fInOtherSubroot.createNewFile()) {
throw new IOException();
}
FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream(fInOtherSubroot);
FileChannel inputChannel = fis.getChannel();
FileChannel outputChannel = fos.getChannel();
BBContainer bufC = DBBPool.allocateDirect(8192);
ByteBuffer buf = bufC.b();
try {
while (inputChannel.read(buf) != -1) {
buf.flip();
outputChannel.write(buf);
buf.clear();
}
}
finally {
// These calls to close() also close the channels.
fis.close();
fos.close();
bufC.discard();
}
}
}
} }
|
public class class_name {
public static void moveSubRootContents(File fromSubRoot, File toSubRoot) throws IOException {
assert(fromSubRoot.exists() && fromSubRoot.isDirectory());
assert(toSubRoot.exists() && toSubRoot.isDirectory());
for (File file : fromSubRoot.listFiles()) {
File fInOtherSubroot = new File(toSubRoot, file.getName());
if (file.isDirectory()) {
if (!fInOtherSubroot.exists()) {
if (!fInOtherSubroot.mkdir()) {
throw new IOException("Can't create directory " + fInOtherSubroot);
}
}
moveSubRootContents(file, fInOtherSubroot);
}
else {
if (fInOtherSubroot.exists()) {
throw new IOException(fInOtherSubroot + " already exists");
}
if (!fInOtherSubroot.createNewFile()) {
throw new IOException();
}
FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream(fInOtherSubroot);
FileChannel inputChannel = fis.getChannel();
FileChannel outputChannel = fos.getChannel();
BBContainer bufC = DBBPool.allocateDirect(8192);
ByteBuffer buf = bufC.b();
try {
while (inputChannel.read(buf) != -1) {
buf.flip(); // depends on control dependency: [while], data = [none]
outputChannel.write(buf); // depends on control dependency: [while], data = [none]
buf.clear(); // depends on control dependency: [while], data = [none]
}
}
finally {
// These calls to close() also close the channels.
fis.close();
fos.close();
bufC.discard();
}
}
}
} }
|
public class class_name {
public boolean saveNGramToTxt(String path)
{
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
bw.write(entry.getKey() + " " + entry.getValue());
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
logger.warning("在保存NGram词典到" + path + "时发生异常" + e);
return false;
}
return true;
} }
|
public class class_name {
public boolean saveNGramToTxt(String path)
{
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
bw.write(entry.getKey() + " " + entry.getValue()); // depends on control dependency: [for], data = [entry]
bw.newLine(); // depends on control dependency: [for], data = [none]
}
bw.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.warning("在保存NGram词典到" + path + "时发生异常" + e);
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
public static String getDescription(TypeDeclaration type) {
if (type == null || type.description() == null) {
return null;
} else {
return type.description().value();
}
} }
|
public class class_name {
public static String getDescription(TypeDeclaration type) {
if (type == null || type.description() == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return type.description().value(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public E get() {
if (originalElements.isEmpty()) {
return null;
}
if (!priorityElements.isEmpty()) {
return priorityElements.remove(0);
}
if (currentElements.size() <= originalElements.size()) {
currentElements.addAll(originalElements);
}
int index = random.getInt(currentElements.size() - 1);
return currentElements.remove(index);
} }
|
public class class_name {
@Override
public E get() {
if (originalElements.isEmpty()) {
return null;
// depends on control dependency: [if], data = [none]
}
if (!priorityElements.isEmpty()) {
return priorityElements.remove(0);
// depends on control dependency: [if], data = [none]
}
if (currentElements.size() <= originalElements.size()) {
currentElements.addAll(originalElements);
// depends on control dependency: [if], data = [none]
}
int index = random.getInt(currentElements.size() - 1);
return currentElements.remove(index);
} }
|
public class class_name {
public final EObject ruleJvmParameterizedTypeReference() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_5=null;
Token otherlv_7=null;
Token otherlv_9=null;
Token otherlv_11=null;
Token otherlv_13=null;
EObject lv_arguments_2_0 = null;
EObject lv_arguments_4_0 = null;
EObject lv_arguments_10_0 = null;
EObject lv_arguments_12_0 = null;
enterRule();
try {
// InternalPureXbase.g:6105:2: ( ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? ) )
// InternalPureXbase.g:6106:2: ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? )
{
// InternalPureXbase.g:6106:2: ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? )
// InternalPureXbase.g:6107:3: ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )?
{
// InternalPureXbase.g:6107:3: ( ( ruleQualifiedName ) )
// InternalPureXbase.g:6108:4: ( ruleQualifiedName )
{
// InternalPureXbase.g:6108:4: ( ruleQualifiedName )
// InternalPureXbase.g:6109:5: ruleQualifiedName
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getTypeJvmTypeCrossReference_0_0());
}
pushFollow(FOLLOW_72);
ruleQualifiedName();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:6123:3: ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )?
int alt114=2;
alt114 = dfa114.predict(input);
switch (alt114) {
case 1 :
// InternalPureXbase.g:6124:4: ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )*
{
// InternalPureXbase.g:6124:4: ( ( '<' )=>otherlv_1= '<' )
// InternalPureXbase.g:6125:5: ( '<' )=>otherlv_1= '<'
{
otherlv_1=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getJvmParameterizedTypeReferenceAccess().getLessThanSignKeyword_1_0());
}
}
// InternalPureXbase.g:6131:4: ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6132:5: (lv_arguments_2_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6132:5: (lv_arguments_2_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6133:6: lv_arguments_2_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_1_0());
}
pushFollow(FOLLOW_35);
lv_arguments_2_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
add(
current,
"arguments",
lv_arguments_2_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:6150:4: (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )*
loop110:
do {
int alt110=2;
int LA110_0 = input.LA(1);
if ( (LA110_0==57) ) {
alt110=1;
}
switch (alt110) {
case 1 :
// InternalPureXbase.g:6151:5: otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) )
{
otherlv_3=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getJvmParameterizedTypeReferenceAccess().getCommaKeyword_1_2_0());
}
// InternalPureXbase.g:6155:5: ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6156:6: (lv_arguments_4_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6156:6: (lv_arguments_4_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6157:7: lv_arguments_4_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_2_1_0());
}
pushFollow(FOLLOW_35);
lv_arguments_4_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
add(
current,
"arguments",
lv_arguments_4_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop110;
}
} while (true);
otherlv_5=(Token)match(input,29,FOLLOW_68); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getJvmParameterizedTypeReferenceAccess().getGreaterThanSignKeyword_1_3());
}
// InternalPureXbase.g:6179:4: ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )*
loop113:
do {
int alt113=2;
int LA113_0 = input.LA(1);
if ( (LA113_0==54) ) {
int LA113_2 = input.LA(2);
if ( (LA113_2==RULE_ID) ) {
int LA113_3 = input.LA(3);
if ( (synpred51_InternalPureXbase()) ) {
alt113=1;
}
}
}
switch (alt113) {
case 1 :
// InternalPureXbase.g:6180:5: ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )?
{
// InternalPureXbase.g:6180:5: ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) )
// InternalPureXbase.g:6181:6: ( ( () '.' ) )=> ( () otherlv_7= '.' )
{
// InternalPureXbase.g:6187:6: ( () otherlv_7= '.' )
// InternalPureXbase.g:6188:7: () otherlv_7= '.'
{
// InternalPureXbase.g:6188:7: ()
// InternalPureXbase.g:6189:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0(),
current);
}
}
otherlv_7=(Token)match(input,54,FOLLOW_12); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_7, grammarAccess.getJvmParameterizedTypeReferenceAccess().getFullStopKeyword_1_4_0_0_1());
}
}
}
// InternalPureXbase.g:6201:5: ( ( ruleValidID ) )
// InternalPureXbase.g:6202:6: ( ruleValidID )
{
// InternalPureXbase.g:6202:6: ( ruleValidID )
// InternalPureXbase.g:6203:7: ruleValidID
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getTypeJvmTypeCrossReference_1_4_1_0());
}
pushFollow(FOLLOW_73);
ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:6217:5: ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )?
int alt112=2;
alt112 = dfa112.predict(input);
switch (alt112) {
case 1 :
// InternalPureXbase.g:6218:6: ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>'
{
// InternalPureXbase.g:6218:6: ( ( '<' )=>otherlv_9= '<' )
// InternalPureXbase.g:6219:7: ( '<' )=>otherlv_9= '<'
{
otherlv_9=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_9, grammarAccess.getJvmParameterizedTypeReferenceAccess().getLessThanSignKeyword_1_4_2_0());
}
}
// InternalPureXbase.g:6225:6: ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6226:7: (lv_arguments_10_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6226:7: (lv_arguments_10_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6227:8: lv_arguments_10_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_4_2_1_0());
}
pushFollow(FOLLOW_35);
lv_arguments_10_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
add(
current,
"arguments",
lv_arguments_10_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:6244:6: (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )*
loop111:
do {
int alt111=2;
int LA111_0 = input.LA(1);
if ( (LA111_0==57) ) {
alt111=1;
}
switch (alt111) {
case 1 :
// InternalPureXbase.g:6245:7: otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) )
{
otherlv_11=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_11, grammarAccess.getJvmParameterizedTypeReferenceAccess().getCommaKeyword_1_4_2_2_0());
}
// InternalPureXbase.g:6249:7: ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6250:8: (lv_arguments_12_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6250:8: (lv_arguments_12_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6251:9: lv_arguments_12_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_4_2_2_1_0());
}
pushFollow(FOLLOW_35);
lv_arguments_12_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule());
}
add(
current,
"arguments",
lv_arguments_12_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop111;
}
} while (true);
otherlv_13=(Token)match(input,29,FOLLOW_68); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getJvmParameterizedTypeReferenceAccess().getGreaterThanSignKeyword_1_4_2_3());
}
}
break;
}
}
break;
default :
break loop113;
}
} while (true);
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleJvmParameterizedTypeReference() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_5=null;
Token otherlv_7=null;
Token otherlv_9=null;
Token otherlv_11=null;
Token otherlv_13=null;
EObject lv_arguments_2_0 = null;
EObject lv_arguments_4_0 = null;
EObject lv_arguments_10_0 = null;
EObject lv_arguments_12_0 = null;
enterRule();
try {
// InternalPureXbase.g:6105:2: ( ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? ) )
// InternalPureXbase.g:6106:2: ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? )
{
// InternalPureXbase.g:6106:2: ( ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )? )
// InternalPureXbase.g:6107:3: ( ( ruleQualifiedName ) ) ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )?
{
// InternalPureXbase.g:6107:3: ( ( ruleQualifiedName ) )
// InternalPureXbase.g:6108:4: ( ruleQualifiedName )
{
// InternalPureXbase.g:6108:4: ( ruleQualifiedName )
// InternalPureXbase.g:6109:5: ruleQualifiedName
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getTypeJvmTypeCrossReference_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_72);
ruleQualifiedName();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:6123:3: ( ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )* )?
int alt114=2;
alt114 = dfa114.predict(input);
switch (alt114) {
case 1 :
// InternalPureXbase.g:6124:4: ( ( '<' )=>otherlv_1= '<' ) ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )*
{
// InternalPureXbase.g:6124:4: ( ( '<' )=>otherlv_1= '<' )
// InternalPureXbase.g:6125:5: ( '<' )=>otherlv_1= '<'
{
otherlv_1=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getJvmParameterizedTypeReferenceAccess().getLessThanSignKeyword_1_0()); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:6131:4: ( (lv_arguments_2_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6132:5: (lv_arguments_2_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6132:5: (lv_arguments_2_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6133:6: lv_arguments_2_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_arguments_2_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"arguments",
lv_arguments_2_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:6150:4: (otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) ) )*
loop110:
do {
int alt110=2;
int LA110_0 = input.LA(1);
if ( (LA110_0==57) ) {
alt110=1; // depends on control dependency: [if], data = [none]
}
switch (alt110) {
case 1 :
// InternalPureXbase.g:6151:5: otherlv_3= ',' ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) )
{
otherlv_3=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getJvmParameterizedTypeReferenceAccess().getCommaKeyword_1_2_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:6155:5: ( (lv_arguments_4_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6156:6: (lv_arguments_4_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6156:6: (lv_arguments_4_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6157:7: lv_arguments_4_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_arguments_4_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"arguments",
lv_arguments_4_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop110;
}
} while (true);
otherlv_5=(Token)match(input,29,FOLLOW_68); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getJvmParameterizedTypeReferenceAccess().getGreaterThanSignKeyword_1_3()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:6179:4: ( ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )? )*
loop113:
do {
int alt113=2;
int LA113_0 = input.LA(1);
if ( (LA113_0==54) ) {
int LA113_2 = input.LA(2);
if ( (LA113_2==RULE_ID) ) {
int LA113_3 = input.LA(3);
if ( (synpred51_InternalPureXbase()) ) {
alt113=1; // depends on control dependency: [if], data = [none]
}
}
}
switch (alt113) {
case 1 :
// InternalPureXbase.g:6180:5: ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) ) ( ( ruleValidID ) ) ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )?
{
// InternalPureXbase.g:6180:5: ( ( ( () '.' ) )=> ( () otherlv_7= '.' ) )
// InternalPureXbase.g:6181:6: ( ( () '.' ) )=> ( () otherlv_7= '.' )
{
// InternalPureXbase.g:6187:6: ( () otherlv_7= '.' )
// InternalPureXbase.g:6188:7: () otherlv_7= '.'
{
// InternalPureXbase.g:6188:7: ()
// InternalPureXbase.g:6189:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_7=(Token)match(input,54,FOLLOW_12); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_7, grammarAccess.getJvmParameterizedTypeReferenceAccess().getFullStopKeyword_1_4_0_0_1()); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:6201:5: ( ( ruleValidID ) )
// InternalPureXbase.g:6202:6: ( ruleValidID )
{
// InternalPureXbase.g:6202:6: ( ruleValidID )
// InternalPureXbase.g:6203:7: ruleValidID
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getTypeJvmTypeCrossReference_1_4_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_73);
ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:6217:5: ( ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>' )?
int alt112=2;
alt112 = dfa112.predict(input);
switch (alt112) {
case 1 :
// InternalPureXbase.g:6218:6: ( ( '<' )=>otherlv_9= '<' ) ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) ) (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )* otherlv_13= '>'
{
// InternalPureXbase.g:6218:6: ( ( '<' )=>otherlv_9= '<' )
// InternalPureXbase.g:6219:7: ( '<' )=>otherlv_9= '<'
{
otherlv_9=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_9, grammarAccess.getJvmParameterizedTypeReferenceAccess().getLessThanSignKeyword_1_4_2_0()); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:6225:6: ( (lv_arguments_10_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6226:7: (lv_arguments_10_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6226:7: (lv_arguments_10_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6227:8: lv_arguments_10_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_4_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_arguments_10_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"arguments",
lv_arguments_10_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:6244:6: (otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) ) )*
loop111:
do {
int alt111=2;
int LA111_0 = input.LA(1);
if ( (LA111_0==57) ) {
alt111=1; // depends on control dependency: [if], data = [none]
}
switch (alt111) {
case 1 :
// InternalPureXbase.g:6245:7: otherlv_11= ',' ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) )
{
otherlv_11=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_11, grammarAccess.getJvmParameterizedTypeReferenceAccess().getCommaKeyword_1_4_2_2_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:6249:7: ( (lv_arguments_12_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:6250:8: (lv_arguments_12_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:6250:8: (lv_arguments_12_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:6251:9: lv_arguments_12_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmParameterizedTypeReferenceAccess().getArgumentsJvmArgumentTypeReferenceParserRuleCall_1_4_2_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_arguments_12_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmParameterizedTypeReferenceRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"arguments",
lv_arguments_12_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop111;
}
} while (true);
otherlv_13=(Token)match(input,29,FOLLOW_68); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getJvmParameterizedTypeReferenceAccess().getGreaterThanSignKeyword_1_4_2_3()); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
break;
default :
break loop113;
}
} while (true);
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public static void printWarn(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).warn(stackTrace(e));
}
else
getLog(Debugger.class).warn(message);
} }
|
public class class_name {
public static void printWarn(Object message)
{
if (message instanceof Throwable)
{
Throwable e = (Throwable) message;
getLog(Debugger.class).warn(stackTrace(e));
// depends on control dependency: [if], data = [none]
}
else
getLog(Debugger.class).warn(message);
} }
|
public class class_name {
public Set<String> leafRevisionIds() {
Set<String> res = new HashSet<String>();
for(DocumentRevisionNode obj : leafs()) {
res.add(obj.getData().getRevision());
}
return res;
} }
|
public class class_name {
public Set<String> leafRevisionIds() {
Set<String> res = new HashSet<String>();
for(DocumentRevisionNode obj : leafs()) {
res.add(obj.getData().getRevision()); // depends on control dependency: [for], data = [obj]
}
return res;
} }
|
public class class_name {
public void marshall(TopicRule topicRule, ProtocolMarshaller protocolMarshaller) {
if (topicRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(topicRule.getRuleName(), RULENAME_BINDING);
protocolMarshaller.marshall(topicRule.getSql(), SQL_BINDING);
protocolMarshaller.marshall(topicRule.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(topicRule.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(topicRule.getActions(), ACTIONS_BINDING);
protocolMarshaller.marshall(topicRule.getRuleDisabled(), RULEDISABLED_BINDING);
protocolMarshaller.marshall(topicRule.getAwsIotSqlVersion(), AWSIOTSQLVERSION_BINDING);
protocolMarshaller.marshall(topicRule.getErrorAction(), ERRORACTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TopicRule topicRule, ProtocolMarshaller protocolMarshaller) {
if (topicRule == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(topicRule.getRuleName(), RULENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getSql(), SQL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getActions(), ACTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getRuleDisabled(), RULEDISABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getAwsIotSqlVersion(), AWSIOTSQLVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(topicRule.getErrorAction(), ERRORACTION_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 long estimate(OClass oClass, long threshold, OCommandContext ctx) {
long count = oClass.count();
if (count > 1) {
count = count / 2;
}
if (count < threshold) {
return count;
}
long indexesCount = 0l;
List<OAndBlock> flattenedConditions = flatten();
Set<OIndex<?>> indexes = oClass.getIndexes();
for (OAndBlock condition : flattenedConditions) {
List<OBinaryCondition> indexedFunctConditions = condition
.getIndexedFunctionConditions(oClass, (ODatabaseDocumentInternal) ctx.getDatabase());
long conditionEstimation = Long.MAX_VALUE;
if (indexedFunctConditions != null) {
for (OBinaryCondition cond : indexedFunctConditions) {
OFromClause from = new OFromClause(-1);
OFromItem item = new OFromItem(-1);
from.item = item;
from.item.setIdentifier(new OIdentifier(oClass.getName()));
long newCount = cond.estimateIndexed(from, ctx);
if (newCount < conditionEstimation) {
conditionEstimation = newCount;
}
}
} else {
Map<String, Object> conditions = getEqualityOperations(condition, ctx);
for (OIndex index : indexes) {
if (index.getType().equals(OClass.INDEX_TYPE.FULLTEXT.name()) || index.getType()
.equals(OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX.name())) {
continue;
}
List<String> indexedFields = index.getDefinition().getFields();
int nMatchingKeys = 0;
for (String indexedField : indexedFields) {
if (conditions.containsKey(indexedField)) {
nMatchingKeys++;
} else {
break;
}
}
if (nMatchingKeys > 0) {
long newCount = estimateFromIndex(index, conditions, nMatchingKeys);
if (newCount < conditionEstimation) {
conditionEstimation = newCount;
}
}
}
}
if (conditionEstimation > count) {
return count;
}
indexesCount += conditionEstimation;
}
return Math.min(indexesCount, count);
} }
|
public class class_name {
public long estimate(OClass oClass, long threshold, OCommandContext ctx) {
long count = oClass.count();
if (count > 1) {
count = count / 2; // depends on control dependency: [if], data = [none]
}
if (count < threshold) {
return count; // depends on control dependency: [if], data = [none]
}
long indexesCount = 0l;
List<OAndBlock> flattenedConditions = flatten();
Set<OIndex<?>> indexes = oClass.getIndexes();
for (OAndBlock condition : flattenedConditions) {
List<OBinaryCondition> indexedFunctConditions = condition
.getIndexedFunctionConditions(oClass, (ODatabaseDocumentInternal) ctx.getDatabase());
long conditionEstimation = Long.MAX_VALUE;
if (indexedFunctConditions != null) {
for (OBinaryCondition cond : indexedFunctConditions) {
OFromClause from = new OFromClause(-1);
OFromItem item = new OFromItem(-1);
from.item = item; // depends on control dependency: [for], data = [none]
from.item.setIdentifier(new OIdentifier(oClass.getName())); // depends on control dependency: [for], data = [none]
long newCount = cond.estimateIndexed(from, ctx);
if (newCount < conditionEstimation) {
conditionEstimation = newCount; // depends on control dependency: [if], data = [none]
}
}
} else {
Map<String, Object> conditions = getEqualityOperations(condition, ctx);
for (OIndex index : indexes) {
if (index.getType().equals(OClass.INDEX_TYPE.FULLTEXT.name()) || index.getType()
.equals(OClass.INDEX_TYPE.FULLTEXT_HASH_INDEX.name())) {
continue;
}
List<String> indexedFields = index.getDefinition().getFields();
int nMatchingKeys = 0;
for (String indexedField : indexedFields) {
if (conditions.containsKey(indexedField)) {
nMatchingKeys++; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
if (nMatchingKeys > 0) {
long newCount = estimateFromIndex(index, conditions, nMatchingKeys);
if (newCount < conditionEstimation) {
conditionEstimation = newCount; // depends on control dependency: [if], data = [none]
}
}
}
}
if (conditionEstimation > count) {
return count; // depends on control dependency: [if], data = [none]
}
indexesCount += conditionEstimation; // depends on control dependency: [for], data = [condition]
}
return Math.min(indexesCount, count);
} }
|
public class class_name {
public void cloneAndRestoreView(FacesContext context, UIViewRoot newView,
ViewEntry entry, ViewStructureMetadata metadata)
{
UIViewRoot oldView = entry.getViewRoot();
// retrieveViewRootInitialState(context, oldView)
Object viewState = metadata.getViewRootState();
Object newViewState;
UIComponent metadataFacet = newView.getFacet(UIViewRoot.METADATA_FACET_NAME);
if (viewState == null)
{
// (Optional, it should be always metadata)
oldView.clearInitialState();
viewState = oldView.saveState(context);
}
Map<String, Object> viewScopeMap = newView.getViewMap(false);
if (viewScopeMap != null && !viewScopeMap.isEmpty())
{
newViewState = newView.saveState(context);
}
else
{
newViewState = null;
}
boolean oldProcessingEvents = context.isProcessingEvents();
context.setProcessingEvents(false);
try
{
if (oldView.getFacetCount() > 0)
{
List<String> facetKeys = new ArrayList<String>();
facetKeys.addAll(oldView.getFacets().keySet());
for (String facetKey : facetKeys)
{
//context.setProcessingEvents(false);
if (metadataFacet != null && UIViewRoot.METADATA_FACET_NAME.equals(facetKey) &&
!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
{
// Metadata facet is special, it is created when ViewHandler.createView(...) is
// called, so it shouldn't be taken from the oldView, otherwise the state
// will be lost. Instead reuse it and discard the one in oldView.
// But on restore view phase, use the old one, because the new one does not
// have initial state marked.
newView.getFacets().put(facetKey, metadataFacet);
}
else
{
UIComponent facet = oldView.getFacets().remove(facetKey);
//context.setProcessingEvents(true);
newView.getFacets().put(facetKey, facet);
}
}
}
if (oldView.getChildCount() > 0)
{
for (Iterator<UIComponent> it = oldView.getChildren().iterator(); it.hasNext();)
{
//context.setProcessingEvents(false);
UIComponent c = it.next();
it.remove();
//context.setProcessingEvents(true);
newView.getChildren().add(c);
}
}
// Restore the newView as saved just before markInitialState() call
newView.restoreState(context, viewState);
newView.markInitialState();
if (!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
{
// Restore bindings like in restore view phase, because in this case,
// bindings needs to be set (Application.createComponent is not called!).
restoreViewSupport.processComponentBinding(context, newView);
// Restore view scope map if necessary
if (viewScopeMap != null && !viewScopeMap.isEmpty())
{
Map<String, Object> newViewScopeMap = newView.getViewMap(false);
if (newViewScopeMap == null)
{
newView.restoreViewScopeState(context, newViewState);
}
else
{
// Should theoretically not happen, because when a pooled static view
// is saved, the view scope map is skipped, otherwise it could be a
// leak. Anyway, we let this code here that overrides the values from
// the original map.
for (Map.Entry<String, Object> entry2 : viewScopeMap.entrySet())
{
newViewScopeMap.put(entry2.getKey(), entry2.getValue());
}
}
}
}
// Update request view metadata to ensure resource list is restored as when the
// view was built on the first time. This ensures correct calculation of added
// resources by dynamic behavior.
RequestViewContext rcv = RequestViewContext.getCurrentInstance(context, newView, false);
if (rcv != null)
{
rcv.setRequestViewMetadata(metadata.getRequestViewMetadata().cloneInstance());
}
else
{
RequestViewContext.setCurrentInstance(context, newView,
RequestViewContext.newInstance(metadata.getRequestViewMetadata().cloneInstance()));
}
}
finally
{
context.setProcessingEvents(oldProcessingEvents);
}
} }
|
public class class_name {
public void cloneAndRestoreView(FacesContext context, UIViewRoot newView,
ViewEntry entry, ViewStructureMetadata metadata)
{
UIViewRoot oldView = entry.getViewRoot();
// retrieveViewRootInitialState(context, oldView)
Object viewState = metadata.getViewRootState();
Object newViewState;
UIComponent metadataFacet = newView.getFacet(UIViewRoot.METADATA_FACET_NAME);
if (viewState == null)
{
// (Optional, it should be always metadata)
oldView.clearInitialState(); // depends on control dependency: [if], data = [none]
viewState = oldView.saveState(context); // depends on control dependency: [if], data = [none]
}
Map<String, Object> viewScopeMap = newView.getViewMap(false);
if (viewScopeMap != null && !viewScopeMap.isEmpty())
{
newViewState = newView.saveState(context); // depends on control dependency: [if], data = [none]
}
else
{
newViewState = null; // depends on control dependency: [if], data = [none]
}
boolean oldProcessingEvents = context.isProcessingEvents();
context.setProcessingEvents(false);
try
{
if (oldView.getFacetCount() > 0)
{
List<String> facetKeys = new ArrayList<String>();
facetKeys.addAll(oldView.getFacets().keySet()); // depends on control dependency: [if], data = [none]
for (String facetKey : facetKeys)
{
//context.setProcessingEvents(false);
if (metadataFacet != null && UIViewRoot.METADATA_FACET_NAME.equals(facetKey) &&
!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
{
// Metadata facet is special, it is created when ViewHandler.createView(...) is
// called, so it shouldn't be taken from the oldView, otherwise the state
// will be lost. Instead reuse it and discard the one in oldView.
// But on restore view phase, use the old one, because the new one does not
// have initial state marked.
newView.getFacets().put(facetKey, metadataFacet); // depends on control dependency: [if], data = [none]
}
else
{
UIComponent facet = oldView.getFacets().remove(facetKey);
//context.setProcessingEvents(true);
newView.getFacets().put(facetKey, facet); // depends on control dependency: [if], data = [none]
}
}
}
if (oldView.getChildCount() > 0)
{
for (Iterator<UIComponent> it = oldView.getChildren().iterator(); it.hasNext();)
{
//context.setProcessingEvents(false);
UIComponent c = it.next();
it.remove(); // depends on control dependency: [for], data = [it]
//context.setProcessingEvents(true);
newView.getChildren().add(c); // depends on control dependency: [for], data = [none]
}
}
// Restore the newView as saved just before markInitialState() call
newView.restoreState(context, viewState); // depends on control dependency: [try], data = [none]
newView.markInitialState(); // depends on control dependency: [try], data = [none]
if (!PhaseId.RESTORE_VIEW.equals(context.getCurrentPhaseId()))
{
// Restore bindings like in restore view phase, because in this case,
// bindings needs to be set (Application.createComponent is not called!).
restoreViewSupport.processComponentBinding(context, newView); // depends on control dependency: [if], data = [none]
// Restore view scope map if necessary
if (viewScopeMap != null && !viewScopeMap.isEmpty())
{
Map<String, Object> newViewScopeMap = newView.getViewMap(false);
if (newViewScopeMap == null)
{
newView.restoreViewScopeState(context, newViewState); // depends on control dependency: [if], data = [none]
}
else
{
// Should theoretically not happen, because when a pooled static view
// is saved, the view scope map is skipped, otherwise it could be a
// leak. Anyway, we let this code here that overrides the values from
// the original map.
for (Map.Entry<String, Object> entry2 : viewScopeMap.entrySet())
{
newViewScopeMap.put(entry2.getKey(), entry2.getValue()); // depends on control dependency: [for], data = [entry2]
}
}
}
}
// Update request view metadata to ensure resource list is restored as when the
// view was built on the first time. This ensures correct calculation of added
// resources by dynamic behavior.
RequestViewContext rcv = RequestViewContext.getCurrentInstance(context, newView, false);
if (rcv != null)
{
rcv.setRequestViewMetadata(metadata.getRequestViewMetadata().cloneInstance()); // depends on control dependency: [if], data = [none]
}
else
{
RequestViewContext.setCurrentInstance(context, newView,
RequestViewContext.newInstance(metadata.getRequestViewMetadata().cloneInstance())); // depends on control dependency: [if], data = [none]
}
}
finally
{
context.setProcessingEvents(oldProcessingEvents);
}
} }
|
public class class_name {
public View getActivityContentView() {
try {
return ((Activity) mainActionView.getContext()).getWindow().getDecorView().findViewById(android.R.id.content);
}
catch(ClassCastException e) {
throw new ClassCastException("Please provide an Activity context for this FloatingActionMenu.");
}
} }
|
public class class_name {
public View getActivityContentView() {
try {
return ((Activity) mainActionView.getContext()).getWindow().getDecorView().findViewById(android.R.id.content); // depends on control dependency: [try], data = [none]
}
catch(ClassCastException e) {
throw new ClassCastException("Please provide an Activity context for this FloatingActionMenu.");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void _delActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__delActionPerformed
int[] i = _oList.getSelectedRows();
String[] o = new String[i.length];
for (int j = 0; j < i.length; j++) {
o[j] = (String) _oList.getValueAt(i[j], 0);
}
if (R != null) {
try {
R.rm(o);
} catch (Rsession.RException ex) {
ex.printStackTrace();
}
}
update();
} }
|
public class class_name {
private void _delActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__delActionPerformed
int[] i = _oList.getSelectedRows();
String[] o = new String[i.length];
for (int j = 0; j < i.length; j++) {
o[j] = (String) _oList.getValueAt(i[j], 0); // depends on control dependency: [for], data = [j]
}
if (R != null) {
try {
R.rm(o); // depends on control dependency: [try], data = [none]
} catch (Rsession.RException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
update();
} }
|
public class class_name {
private FileUpload prepareFileUpload(@NonNull String encoding) {
FileUpload actualFileUpload = mFileUpload;
if (!encoding.equalsIgnoreCase(mFileUpload.getHeaderEncoding())) {
actualFileUpload = new FileUpload(mFileItemFactory);
actualFileUpload.setSizeMax(mFileUpload.getSizeMax());
actualFileUpload.setFileSizeMax(mFileUpload.getFileSizeMax());
actualFileUpload.setHeaderEncoding(encoding);
}
return actualFileUpload;
} }
|
public class class_name {
private FileUpload prepareFileUpload(@NonNull String encoding) {
FileUpload actualFileUpload = mFileUpload;
if (!encoding.equalsIgnoreCase(mFileUpload.getHeaderEncoding())) {
actualFileUpload = new FileUpload(mFileItemFactory); // depends on control dependency: [if], data = [none]
actualFileUpload.setSizeMax(mFileUpload.getSizeMax()); // depends on control dependency: [if], data = [none]
actualFileUpload.setFileSizeMax(mFileUpload.getFileSizeMax()); // depends on control dependency: [if], data = [none]
actualFileUpload.setHeaderEncoding(encoding); // depends on control dependency: [if], data = [none]
}
return actualFileUpload;
} }
|
public class class_name {
@InterfaceAudience.Private
public void pullRemoteRevision(final RevisionInternal rev) {
Log.d(TAG, "%s: pullRemoteRevision with rev: %s", this, rev);
++httpConnectionCount;
// Construct a query. We want the revision history, and the bodies of attachments that have
// been added since the latest revisions we have locally.
// See: http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document
StringBuilder path = new StringBuilder(encodeDocumentId(rev.getDocID()));
path.append("?rev=").append(URIUtils.encode(rev.getRevID()));
path.append("&revs=true");
// TODO: CBL Java does not have implementation of _settings yet. Till then, attachments always true
boolean attachments = true;
if (attachments)
path.append("&attachments=true");
// Include atts_since with a list of possible ancestor revisions of rev. If getting attachments,
// this allows the server to skip the bodies of attachments that have not changed since the
// local ancestor. The server can also trim the revision history it returns, to not extend past
// the local ancestor (not implemented yet in SG but will be soon.)
AtomicBoolean haveBodies = new AtomicBoolean(false);
List<String> possibleAncestors = null;
possibleAncestors = db.getPossibleAncestorRevisionIDs(rev,
PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, attachments ? haveBodies : null, true);
if (possibleAncestors != null) {
path.append(haveBodies.get() ? "&atts_since=" : "&revs_from=");
path.append(joinQuotedEscaped(possibleAncestors));
} else {
int maxRevTreeDepth = getLocalDatabase().getMaxRevTreeDepth();
if (rev.getGeneration() > maxRevTreeDepth) {
path.append("&revs_limit=");
path.append(maxRevTreeDepth);
}
}
//create a final version of this variable for the log statement inside
//FIXME find a way to avoid this
final String pathInside = path.toString();
CustomFuture future = sendAsyncMultipartDownloaderRequest("GET", pathInside,
null, db, new RemoteRequestCompletion() {
@Override
public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
if (e != null) {
Log.w(TAG, "Error pulling remote revision: %s", e, this);
if (Utils.isDocumentError(e)) {
// Revision is missing or not accessible:
revisionFailed(rev, e);
} else {
// Request failed:
setError(e);
}
} else {
Map<String, Object> properties = (Map<String, Object>) result;
long size = 0;
if (httpResponse != null && httpResponse.body() != null)
size = httpResponse.body().contentLength();
PulledRevision gotRev = new PulledRevision(properties, size);
gotRev.setSequence(rev.getSequence());
Log.d(TAG, "%s: pullRemoteRevision add rev: %s to batcher: %s",
PullerInternal.this, gotRev, downloadsToInsert);
// NOTE: should not/not necessary to call Body.compact()
// new PulledRevision(Map<string, Object>) creates Body instance only
// with `object`. Serializing object to json causes two unnecessary
// JSON serializations.
if (gotRev.getBody() != null)
queuedMemorySize.addAndGet(gotRev.getBody().getSize());
// Add to batcher ... eventually it will be fed to -insertRevisions:.
downloadsToInsert.queueObject(gotRev);
// if queue memory size is more than maximum, force flush the queue.
if (queuedMemorySize.get() > MAX_QUEUE_MEMORY_SIZE) {
Log.d(TAG, "Flushing queued memory size at: " + queuedMemorySize);
downloadsToInsert.flushAllAndWait();
}
}
// Note that we've finished this task:
--httpConnectionCount;
// Start another task if there are still revisions waiting to be pulled:
pullRemoteRevisions();
}
});
future.setQueue(pendingFutures);
pendingFutures.add(future);
} }
|
public class class_name {
@InterfaceAudience.Private
public void pullRemoteRevision(final RevisionInternal rev) {
Log.d(TAG, "%s: pullRemoteRevision with rev: %s", this, rev);
++httpConnectionCount;
// Construct a query. We want the revision history, and the bodies of attachments that have
// been added since the latest revisions we have locally.
// See: http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document
StringBuilder path = new StringBuilder(encodeDocumentId(rev.getDocID()));
path.append("?rev=").append(URIUtils.encode(rev.getRevID()));
path.append("&revs=true");
// TODO: CBL Java does not have implementation of _settings yet. Till then, attachments always true
boolean attachments = true;
if (attachments)
path.append("&attachments=true");
// Include atts_since with a list of possible ancestor revisions of rev. If getting attachments,
// this allows the server to skip the bodies of attachments that have not changed since the
// local ancestor. The server can also trim the revision history it returns, to not extend past
// the local ancestor (not implemented yet in SG but will be soon.)
AtomicBoolean haveBodies = new AtomicBoolean(false);
List<String> possibleAncestors = null;
possibleAncestors = db.getPossibleAncestorRevisionIDs(rev,
PullerInternal.MAX_NUMBER_OF_ATTS_SINCE, attachments ? haveBodies : null, true);
if (possibleAncestors != null) {
path.append(haveBodies.get() ? "&atts_since=" : "&revs_from="); // depends on control dependency: [if], data = [none]
path.append(joinQuotedEscaped(possibleAncestors)); // depends on control dependency: [if], data = [(possibleAncestors]
} else {
int maxRevTreeDepth = getLocalDatabase().getMaxRevTreeDepth();
if (rev.getGeneration() > maxRevTreeDepth) {
path.append("&revs_limit="); // depends on control dependency: [if], data = [none]
path.append(maxRevTreeDepth); // depends on control dependency: [if], data = [maxRevTreeDepth)]
}
}
//create a final version of this variable for the log statement inside
//FIXME find a way to avoid this
final String pathInside = path.toString();
CustomFuture future = sendAsyncMultipartDownloaderRequest("GET", pathInside,
null, db, new RemoteRequestCompletion() {
@Override
public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
if (e != null) {
Log.w(TAG, "Error pulling remote revision: %s", e, this); // depends on control dependency: [if], data = [none]
if (Utils.isDocumentError(e)) {
// Revision is missing or not accessible:
revisionFailed(rev, e); // depends on control dependency: [if], data = [none]
} else {
// Request failed:
setError(e); // depends on control dependency: [if], data = [none]
}
} else {
Map<String, Object> properties = (Map<String, Object>) result;
long size = 0;
if (httpResponse != null && httpResponse.body() != null)
size = httpResponse.body().contentLength();
PulledRevision gotRev = new PulledRevision(properties, size);
gotRev.setSequence(rev.getSequence()); // depends on control dependency: [if], data = [none]
Log.d(TAG, "%s: pullRemoteRevision add rev: %s to batcher: %s",
PullerInternal.this, gotRev, downloadsToInsert); // depends on control dependency: [if], data = [none]
// NOTE: should not/not necessary to call Body.compact()
// new PulledRevision(Map<string, Object>) creates Body instance only
// with `object`. Serializing object to json causes two unnecessary
// JSON serializations.
if (gotRev.getBody() != null)
queuedMemorySize.addAndGet(gotRev.getBody().getSize());
// Add to batcher ... eventually it will be fed to -insertRevisions:.
downloadsToInsert.queueObject(gotRev); // depends on control dependency: [if], data = [none]
// if queue memory size is more than maximum, force flush the queue.
if (queuedMemorySize.get() > MAX_QUEUE_MEMORY_SIZE) {
Log.d(TAG, "Flushing queued memory size at: " + queuedMemorySize); // depends on control dependency: [if], data = [none]
downloadsToInsert.flushAllAndWait(); // depends on control dependency: [if], data = [none]
}
}
// Note that we've finished this task:
--httpConnectionCount;
// Start another task if there are still revisions waiting to be pulled:
pullRemoteRevisions();
}
});
future.setQueue(pendingFutures);
pendingFutures.add(future);
} }
|
public class class_name {
public final void run() throws IOException, InterruptedException {
InputStreamReader isr = new InputStreamReader(this.is, this.charset);
BufferedReader br = new BufferedReader(isr);
this.line = null;
this.lineNumber = 0;
try {
do {
if (this.exit) {
return;
}
if(Thread.currentThread().isInterrupted()){
throw new InterruptedException();
}
this.nextLine = br.readLine();
try {
if (this.line != null) {
processLine(this.line);
if (this.exit) {
return;
}
}
} catch (Exception e) {
onExceptionFound(e);
} finally {
this.lineNumber++;
this.line = this.nextLine;
}
} while (this.line != null);
} finally {
onFinish();
}
} }
|
public class class_name {
public final void run() throws IOException, InterruptedException {
InputStreamReader isr = new InputStreamReader(this.is, this.charset);
BufferedReader br = new BufferedReader(isr);
this.line = null;
this.lineNumber = 0;
try {
do {
if (this.exit) {
return; // depends on control dependency: [if], data = [none]
}
if(Thread.currentThread().isInterrupted()){
throw new InterruptedException();
}
this.nextLine = br.readLine();
try {
if (this.line != null) {
processLine(this.line); // depends on control dependency: [if], data = [(this.line]
if (this.exit) {
return; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
onExceptionFound(e);
} finally { // depends on control dependency: [catch], data = [none]
this.lineNumber++;
this.line = this.nextLine;
}
} while (this.line != null);
} finally {
onFinish();
}
} }
|
public class class_name {
public static String compose (String key, Object... args)
{
StringBuilder buf = new StringBuilder();
buf.append(key);
buf.append('|');
for (int i = 0; i < args.length; i++) {
if (i > 0) {
buf.append('|');
}
// escape the string while adding to the buffer
String arg = (args[i] == null) ? "" : String.valueOf(args[i]);
int alength = arg.length();
for (int p = 0; p < alength; p++) {
char ch = arg.charAt(p);
if (ch == '|') {
buf.append("\\!");
} else if (ch == '\\') {
buf.append("\\\\");
} else {
buf.append(ch);
}
}
}
return buf.toString();
} }
|
public class class_name {
public static String compose (String key, Object... args)
{
StringBuilder buf = new StringBuilder();
buf.append(key);
buf.append('|');
for (int i = 0; i < args.length; i++) {
if (i > 0) {
buf.append('|'); // depends on control dependency: [if], data = [none]
}
// escape the string while adding to the buffer
String arg = (args[i] == null) ? "" : String.valueOf(args[i]);
int alength = arg.length();
for (int p = 0; p < alength; p++) {
char ch = arg.charAt(p);
if (ch == '|') {
buf.append("\\!"); // depends on control dependency: [if], data = [none]
} else if (ch == '\\') {
buf.append("\\\\"); // depends on control dependency: [if], data = [none]
} else {
buf.append(ch); // depends on control dependency: [if], data = [(ch]
}
}
}
return buf.toString();
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.