code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public com.google.protobuf.ByteString
getJwtAudienceBytes() {
java.lang.Object ref = "";
if (authenticationCase_ == 7) {
ref = authentication_;
}
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
if (authenticationCase_ == 7) {
authentication_ = b;
}
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} } | public class class_name {
public com.google.protobuf.ByteString
getJwtAudienceBytes() {
java.lang.Object ref = "";
if (authenticationCase_ == 7) {
ref = authentication_; // depends on control dependency: [if], data = [none]
}
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
if (authenticationCase_ == 7) {
authentication_ = 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 String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords, String wrapOn) {
if (str == null) {
return null;
}
if (newLineStr == null) {
newLineStr = "\n";
}
if (wrapLength < 1) {
wrapLength = 1;
}
if (StringUtils.isBlank(wrapOn)) {
wrapOn = " ";
}
final RegExp patternToWrapOn = RegExp.compile(wrapOn);
final int inputLineLength = str.length();
int offset = 0;
final StringBuilder wrappedLine = new StringBuilder(inputLineLength + 32);
while (offset < inputLineLength) {
int spaceToWrapAt = -1;
MatchResult matcher = patternToWrapOn.exec(str.substring(offset, Math.min(offset + wrapLength + 1, inputLineLength)));
if (matcher != null && matcher.getGroupCount() > 0) {
final String firstMatch = matcher.getGroup(0);
final int start = StringUtils.indexOf(matcher.getInput(), firstMatch);
if (matcher.getInput().startsWith(firstMatch)) {
final int end = start + StringUtils.length(firstMatch);
offset += end;
continue;
}else {
spaceToWrapAt = start;
}
}
// only last line without leading spaces is left
if(inputLineLength - offset <= wrapLength) {
break;
}
if (matcher != null && matcher.getGroupCount() > 0) {
final String lastMatch = matcher.getGroup(matcher.getGroupCount() - 1);
final int start = StringUtils.lastIndexOf(matcher.getInput(), lastMatch);
spaceToWrapAt = start + offset;
}
if (spaceToWrapAt >= offset) {
// normal case
wrappedLine.append(str, offset, spaceToWrapAt);
wrappedLine.append(newLineStr);
offset = spaceToWrapAt + 1;
} else {
// really long word or URL
if (wrapLongWords) {
// wrap really long word one line at a time
wrappedLine.append(str, offset, wrapLength + offset);
wrappedLine.append(newLineStr);
offset += wrapLength;
} else {
// do not wrap really long word, just extend beyond limit
matcher = patternToWrapOn.exec(str.substring(offset + wrapLength));
if (matcher != null && matcher.getGroupCount() > 0) {
final String firstMatch = matcher.getGroup(0);
final int start = StringUtils.indexOf(matcher.getInput(), firstMatch);
spaceToWrapAt = start + offset + wrapLength;
}
if (spaceToWrapAt >= 0) {
wrappedLine.append(str, offset, spaceToWrapAt);
wrappedLine.append(newLineStr);
offset = spaceToWrapAt + 1;
} else {
wrappedLine.append(str, offset, str.length());
offset = inputLineLength;
}
}
}
}
// Whatever is left in line is short enough to just pass through
wrappedLine.append(str, offset, str.length());
return wrappedLine.toString();
} } | public class class_name {
public static String wrap(final String str, int wrapLength, String newLineStr, final boolean wrapLongWords, String wrapOn) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (newLineStr == null) {
newLineStr = "\n"; // depends on control dependency: [if], data = [none]
}
if (wrapLength < 1) {
wrapLength = 1; // depends on control dependency: [if], data = [none]
}
if (StringUtils.isBlank(wrapOn)) {
wrapOn = " "; // depends on control dependency: [if], data = [none]
}
final RegExp patternToWrapOn = RegExp.compile(wrapOn);
final int inputLineLength = str.length();
int offset = 0;
final StringBuilder wrappedLine = new StringBuilder(inputLineLength + 32);
while (offset < inputLineLength) {
int spaceToWrapAt = -1;
MatchResult matcher = patternToWrapOn.exec(str.substring(offset, Math.min(offset + wrapLength + 1, inputLineLength)));
if (matcher != null && matcher.getGroupCount() > 0) {
final String firstMatch = matcher.getGroup(0);
final int start = StringUtils.indexOf(matcher.getInput(), firstMatch);
if (matcher.getInput().startsWith(firstMatch)) {
final int end = start + StringUtils.length(firstMatch);
offset += end; // depends on control dependency: [if], data = [none]
continue;
}else {
spaceToWrapAt = start; // depends on control dependency: [if], data = [none]
}
}
// only last line without leading spaces is left
if(inputLineLength - offset <= wrapLength) {
break;
}
if (matcher != null && matcher.getGroupCount() > 0) {
final String lastMatch = matcher.getGroup(matcher.getGroupCount() - 1);
final int start = StringUtils.lastIndexOf(matcher.getInput(), lastMatch);
spaceToWrapAt = start + offset; // depends on control dependency: [if], data = [none]
}
if (spaceToWrapAt >= offset) {
// normal case
wrappedLine.append(str, offset, spaceToWrapAt); // depends on control dependency: [if], data = [none]
wrappedLine.append(newLineStr); // depends on control dependency: [if], data = [none]
offset = spaceToWrapAt + 1; // depends on control dependency: [if], data = [none]
} else {
// really long word or URL
if (wrapLongWords) {
// wrap really long word one line at a time
wrappedLine.append(str, offset, wrapLength + offset); // depends on control dependency: [if], data = [none]
wrappedLine.append(newLineStr); // depends on control dependency: [if], data = [none]
offset += wrapLength; // depends on control dependency: [if], data = [none]
} else {
// do not wrap really long word, just extend beyond limit
matcher = patternToWrapOn.exec(str.substring(offset + wrapLength)); // depends on control dependency: [if], data = [none]
if (matcher != null && matcher.getGroupCount() > 0) {
final String firstMatch = matcher.getGroup(0);
final int start = StringUtils.indexOf(matcher.getInput(), firstMatch);
spaceToWrapAt = start + offset + wrapLength; // depends on control dependency: [if], data = [none]
}
if (spaceToWrapAt >= 0) {
wrappedLine.append(str, offset, spaceToWrapAt); // depends on control dependency: [if], data = [none]
wrappedLine.append(newLineStr); // depends on control dependency: [if], data = [none]
offset = spaceToWrapAt + 1; // depends on control dependency: [if], data = [none]
} else {
wrappedLine.append(str, offset, str.length()); // depends on control dependency: [if], data = [none]
offset = inputLineLength; // depends on control dependency: [if], data = [none]
}
}
}
}
// Whatever is left in line is short enough to just pass through
wrappedLine.append(str, offset, str.length());
return wrappedLine.toString();
} } |
public class class_name {
private AuthConfig createStandardAuthConfig(boolean isPush, Map authConfigMap, Settings settings, String user, String registry)
throws MojoExecutionException {
AuthConfig ret;
// Check first for specific configuration based on direction (pull or push), then for a default value
for (LookupMode lookupMode : new LookupMode[] { getLookupMode(isPush), LookupMode.DEFAULT }) {
// System properties docker.username and docker.password always take precedence
ret = getAuthConfigFromSystemProperties(lookupMode);
if (ret != null) {
log.debug("AuthConfig: credentials from system properties");
return ret;
}
// Check for openshift authentication either from the plugin config or from system props
ret = getAuthConfigFromOpenShiftConfig(lookupMode, authConfigMap);
if (ret != null) {
log.debug("AuthConfig: OpenShift credentials");
return ret;
}
// Get configuration from global plugin config
ret = getAuthConfigFromPluginConfiguration(lookupMode, authConfigMap);
if (ret != null) {
log.debug("AuthConfig: credentials from plugin config");
return ret;
}
}
// ===================================================================
// These are lookups based on registry only, so the direction (push or pull) doesn't matter:
// Now lets lookup the registry & user from ~/.m2/setting.xml
ret = getAuthConfigFromSettings(settings, user, registry);
if (ret != null) {
log.debug("AuthConfig: credentials from ~/.m2/setting.xml");
return ret;
}
// check EC2 instance role if registry is ECR
if (EcrExtendedAuth.isAwsRegistry(registry)) {
try {
ret = getAuthConfigFromEC2InstanceRole();
} catch (ConnectTimeoutException ex) {
log.debug("Connection timeout while retrieving instance meta-data, likely not an EC2 instance (%s)",
ex.getMessage());
} catch (IOException ex) {
// don't make that an error since it may fail if not run on an EC2 instance
log.warn("Error while retrieving EC2 instance credentials: %s", ex.getMessage());
}
if (ret != null) {
log.debug("AuthConfig: credentials from EC2 instance role");
return ret;
}
}
// No authentication found
return null;
} } | public class class_name {
private AuthConfig createStandardAuthConfig(boolean isPush, Map authConfigMap, Settings settings, String user, String registry)
throws MojoExecutionException {
AuthConfig ret;
// Check first for specific configuration based on direction (pull or push), then for a default value
for (LookupMode lookupMode : new LookupMode[] { getLookupMode(isPush), LookupMode.DEFAULT }) {
// System properties docker.username and docker.password always take precedence
ret = getAuthConfigFromSystemProperties(lookupMode);
if (ret != null) {
log.debug("AuthConfig: credentials from system properties"); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
// Check for openshift authentication either from the plugin config or from system props
ret = getAuthConfigFromOpenShiftConfig(lookupMode, authConfigMap);
if (ret != null) {
log.debug("AuthConfig: OpenShift credentials"); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
// Get configuration from global plugin config
ret = getAuthConfigFromPluginConfiguration(lookupMode, authConfigMap);
if (ret != null) {
log.debug("AuthConfig: credentials from plugin config"); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
}
// ===================================================================
// These are lookups based on registry only, so the direction (push or pull) doesn't matter:
// Now lets lookup the registry & user from ~/.m2/setting.xml
ret = getAuthConfigFromSettings(settings, user, registry);
if (ret != null) {
log.debug("AuthConfig: credentials from ~/.m2/setting.xml"); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
// check EC2 instance role if registry is ECR
if (EcrExtendedAuth.isAwsRegistry(registry)) {
try {
ret = getAuthConfigFromEC2InstanceRole(); // depends on control dependency: [try], data = [none]
} catch (ConnectTimeoutException ex) {
log.debug("Connection timeout while retrieving instance meta-data, likely not an EC2 instance (%s)",
ex.getMessage());
} catch (IOException ex) { // depends on control dependency: [catch], data = [none]
// don't make that an error since it may fail if not run on an EC2 instance
log.warn("Error while retrieving EC2 instance credentials: %s", ex.getMessage());
} // depends on control dependency: [catch], data = [none]
if (ret != null) {
log.debug("AuthConfig: credentials from EC2 instance role"); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
}
// No authentication found
return null;
} } |
public class class_name {
public static int asInteger(Object value) {
if (value instanceof Number) {
return ((Number) value).intValue();
} else if (value instanceof Numeric) {
return ((Numeric) value).asInteger();
} else if (value instanceof Boolean) {
return ((Boolean) value) ? 1 : 0;
} else if (value instanceof CharSequence) {
try {
return Integer.parseInt(value.toString());
} catch (NumberFormatException nfe) {
throw new IncompatibleValueException(
"Unable to parse string \"" + Strings.escape(value.toString()) +
"\" to an int", nfe);
}
} else if (value instanceof Date) {
// Convert date timestamp to seconds since epoch.
return (int) (((Date) value).getTime() / 1000);
}
throw new IncompatibleValueException("Unable to convert " + value.getClass().getSimpleName() + " to an int");
} } | public class class_name {
public static int asInteger(Object value) {
if (value instanceof Number) {
return ((Number) value).intValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof Numeric) {
return ((Numeric) value).asInteger(); // depends on control dependency: [if], data = [none]
} else if (value instanceof Boolean) {
return ((Boolean) value) ? 1 : 0; // depends on control dependency: [if], data = [none]
} else if (value instanceof CharSequence) {
try {
return Integer.parseInt(value.toString()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
throw new IncompatibleValueException(
"Unable to parse string \"" + Strings.escape(value.toString()) +
"\" to an int", nfe);
} // depends on control dependency: [catch], data = [none]
} else if (value instanceof Date) {
// Convert date timestamp to seconds since epoch.
return (int) (((Date) value).getTime() / 1000); // depends on control dependency: [if], data = [none]
}
throw new IncompatibleValueException("Unable to convert " + value.getClass().getSimpleName() + " to an int");
} } |
public class class_name {
public static List<IndexDefinition> get()
throws EFapsException
{
final List<IndexDefinition> ret = new ArrayList<>();
final QueryBuilder queryBldr = new QueryBuilder(CIAdminIndex.IndexDefinition);
final MultiPrintQuery multi = queryBldr.getPrint();
final SelectBuilder selUUID = SelectBuilder.get().linkto(CIAdminIndex.IndexDefinition.TypeLink)
.attribute(CIAdminDataModel.Type.UUID);
multi.addSelect(selUUID);
multi.execute();
while (multi.next()) {
final UUID uuidTmp = UUID.fromString(multi.getSelect(selUUID));
final Set<Type> types = getChildTypes(Type.get(uuidTmp));
for (final Type type : types) {
final IndexDefinition indexDef = IndexDefinition.get(type.getUUID());
if (!type.isAbstract()) {
ret.add(indexDef);
}
}
}
return ret;
} } | public class class_name {
public static List<IndexDefinition> get()
throws EFapsException
{
final List<IndexDefinition> ret = new ArrayList<>();
final QueryBuilder queryBldr = new QueryBuilder(CIAdminIndex.IndexDefinition);
final MultiPrintQuery multi = queryBldr.getPrint();
final SelectBuilder selUUID = SelectBuilder.get().linkto(CIAdminIndex.IndexDefinition.TypeLink)
.attribute(CIAdminDataModel.Type.UUID);
multi.addSelect(selUUID);
multi.execute();
while (multi.next()) {
final UUID uuidTmp = UUID.fromString(multi.getSelect(selUUID));
final Set<Type> types = getChildTypes(Type.get(uuidTmp));
for (final Type type : types) {
final IndexDefinition indexDef = IndexDefinition.get(type.getUUID());
if (!type.isAbstract()) {
ret.add(indexDef); // depends on control dependency: [if], data = [none]
}
}
}
return ret;
} } |
public class class_name {
public double calculateDistance2(DoubleSolution individual, double[] lambda) {
double distance;
double distanceSum = 0.0;
double[] vecInd = new double[problem.getNumberOfObjectives()];
double[] normalizedObj = new double[problem.getNumberOfObjectives()];
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
distanceSum += individual.getObjective(i);
}
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
normalizedObj[i] = individual.getObjective(i) / distanceSum;
}
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
vecInd[i] = normalizedObj[i] - lambda[i];
}
distance = norm_vector(vecInd);
return distance;
} } | public class class_name {
public double calculateDistance2(DoubleSolution individual, double[] lambda) {
double distance;
double distanceSum = 0.0;
double[] vecInd = new double[problem.getNumberOfObjectives()];
double[] normalizedObj = new double[problem.getNumberOfObjectives()];
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
distanceSum += individual.getObjective(i); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
normalizedObj[i] = individual.getObjective(i) / distanceSum; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
vecInd[i] = normalizedObj[i] - lambda[i]; // depends on control dependency: [for], data = [i]
}
distance = norm_vector(vecInd);
return distance;
} } |
public class class_name {
public final void parse( String[] argv, Locale locale )
throws IllegalOptionValueException, UnknownOptionException {
// It would be best if this method only threw OptionException, but for
// backwards compatibility with old user code we throw the two
// exceptions above instead.
Vector otherArgs = new Vector();
int position = 0;
this.values = new Hashtable(10);
while ( position < argv.length ) {
String curArg = argv[position];
if ( curArg.startsWith("-") ) {
if ( curArg.equals("--") ) { // end of options
position += 1;
break;
}
String valueArg = null;
if ( curArg.startsWith("--") ) { // handle --arg=value
int equalsPos = curArg.indexOf("=");
if ( equalsPos != -1 ) {
valueArg = curArg.substring(equalsPos+1);
curArg = curArg.substring(0,equalsPos);
}
} else if(curArg.length() > 2) { // handle -abcd
for(int i=1; i<curArg.length(); i++) {
Option opt=(Option)this.options.get
("-"+curArg.charAt(i));
if(opt==null) throw new
UnknownSuboptionException(curArg,curArg.charAt(i));
if(opt.wantsValue()) throw new
NotFlagException(curArg,curArg.charAt(i));
addValue(opt, opt.getValue(null,locale));
}
position++;
continue;
}
Option opt = (Option)this.options.get(curArg);
if ( opt == null ) {
throw new UnknownOptionException(curArg);
}
Object value = null;
if ( opt.wantsValue() ) {
if ( valueArg == null ) {
position += 1;
if ( position < argv.length ) {
valueArg = argv[position];
}
}
value = opt.getValue(valueArg, locale);
}
else {
value = opt.getValue(null, locale);
}
addValue(opt, value);
position += 1;
}
else {
otherArgs.addElement(curArg);
position += 1;
}
}
for ( ; position < argv.length; ++position ) {
otherArgs.addElement(argv[position]);
}
this.remainingArgs = new String[otherArgs.size()];
otherArgs.copyInto(remainingArgs);
} } | public class class_name {
public final void parse( String[] argv, Locale locale )
throws IllegalOptionValueException, UnknownOptionException {
// It would be best if this method only threw OptionException, but for
// backwards compatibility with old user code we throw the two
// exceptions above instead.
Vector otherArgs = new Vector();
int position = 0;
this.values = new Hashtable(10);
while ( position < argv.length ) {
String curArg = argv[position];
if ( curArg.startsWith("-") ) {
if ( curArg.equals("--") ) { // end of options
position += 1;
break;
}
String valueArg = null;
if ( curArg.startsWith("--") ) { // handle --arg=value
int equalsPos = curArg.indexOf("=");
if ( equalsPos != -1 ) {
valueArg = curArg.substring(equalsPos+1);
curArg = curArg.substring(0,equalsPos);
}
} else if(curArg.length() > 2) { // handle -abcd
for(int i=1; i<curArg.length(); i++) {
Option opt=(Option)this.options.get
("-"+curArg.charAt(i));
if(opt==null) throw new
UnknownSuboptionException(curArg,curArg.charAt(i));
if(opt.wantsValue()) throw new
NotFlagException(curArg,curArg.charAt(i));
addValue(opt, opt.getValue(null,locale)); // depends on control dependency: [for], data = [none]
}
position++;
continue;
}
Option opt = (Option)this.options.get(curArg);
if ( opt == null ) {
throw new UnknownOptionException(curArg);
}
Object value = null;
if ( opt.wantsValue() ) {
if ( valueArg == null ) {
position += 1;
if ( position < argv.length ) {
valueArg = argv[position]; // depends on control dependency: [if], data = [none]
}
}
value = opt.getValue(valueArg, locale);
}
else {
value = opt.getValue(null, locale);
}
addValue(opt, value);
position += 1;
}
else {
otherArgs.addElement(curArg);
position += 1;
}
}
for ( ; position < argv.length; ++position ) {
otherArgs.addElement(argv[position]);
}
this.remainingArgs = new String[otherArgs.size()];
otherArgs.copyInto(remainingArgs);
} } |
public class class_name {
public void marshall(UpdateSegmentRequest updateSegmentRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSegmentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSegmentRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(updateSegmentRequest.getSegmentId(), SEGMENTID_BINDING);
protocolMarshaller.marshall(updateSegmentRequest.getWriteSegmentRequest(), WRITESEGMENTREQUEST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateSegmentRequest updateSegmentRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSegmentRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSegmentRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSegmentRequest.getSegmentId(), SEGMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSegmentRequest.getWriteSegmentRequest(), WRITESEGMENTREQUEST_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) {
if (items == null || items.isEmpty()) {
return;
}
try {
BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest().
withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
if (result == null) {
return;
}
logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity());
if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) {
Thread.sleep((long) backoff * 1000L);
logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size());
batchWrite(result.getUnprocessedItems(), backoff * 2);
}
} catch (Exception e) {
logger.error(null, e);
throwIfNecessary(e);
}
} } | public class class_name {
protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) {
if (items == null || items.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
try {
BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest().
withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
if (result == null) {
return; // depends on control dependency: [if], data = [none]
}
logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity()); // depends on control dependency: [try], data = [none]
if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) {
Thread.sleep((long) backoff * 1000L); // depends on control dependency: [if], data = [none]
logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size()); // depends on control dependency: [if], data = [none]
batchWrite(result.getUnprocessedItems(), backoff * 2); // depends on control dependency: [if], data = [(result.getUnprocessedItems()]
}
} catch (Exception e) {
logger.error(null, e);
throwIfNecessary(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@FFDCIgnore({IOException.class})
public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
URL url = getResource(resourceName, callingClass);
try {
return (url != null) ? url.openStream() : null;
} catch (IOException e) {
return null;
}
} } | public class class_name {
@FFDCIgnore({IOException.class})
public static InputStream getResourceAsStream(String resourceName, Class<?> callingClass) {
URL url = getResource(resourceName, callingClass);
try {
return (url != null) ? url.openStream() : null; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T> Publisher<T> createEmptyPublisher( Supplier<CompletionStage<Void>> supplier )
{
return Mono.create( sink -> supplier.get().whenComplete( ( ignore, completionError ) -> {
Throwable error = Futures.completionExceptionCause( completionError );
if ( error != null )
{
sink.error( error );
}
else
{
sink.success();
}
} ) );
} } | public class class_name {
public static <T> Publisher<T> createEmptyPublisher( Supplier<CompletionStage<Void>> supplier )
{
return Mono.create( sink -> supplier.get().whenComplete( ( ignore, completionError ) -> {
Throwable error = Futures.completionExceptionCause( completionError );
if ( error != null )
{
sink.error( error ); // depends on control dependency: [if], data = [( error]
}
else
{
sink.success(); // depends on control dependency: [if], data = [none]
}
} ) );
} } |
public class class_name {
private void clearLock() {
Object previousValue = noCacheStoreCache.remove(keyOfLock);
if (previousValue!=null && trace) {
log.tracef("Lock removed for index: %s", indexName);
}
} } | public class class_name {
private void clearLock() {
Object previousValue = noCacheStoreCache.remove(keyOfLock);
if (previousValue!=null && trace) {
log.tracef("Lock removed for index: %s", indexName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Iterator<Cell> slice(ColumnSlice slice, boolean invert, SlicesIterator iter)
{
Composite start = invert ? slice.finish : slice.start;
Composite finish = invert ? slice.start : slice.finish;
int lowerBound = 0, upperBound = size;
if (iter != null)
{
if (invert)
upperBound = iter.previousSliceEnd;
else
lowerBound = iter.previousSliceEnd;
}
if (!start.isEmpty())
{
lowerBound = binarySearch(lowerBound, upperBound, start, internalComparator());
if (lowerBound < 0)
lowerBound = -lowerBound - 1;
}
if (!finish.isEmpty())
{
upperBound = binarySearch(lowerBound, upperBound, finish, internalComparator());
upperBound = upperBound < 0
? -upperBound - 1
: upperBound + 1; // upperBound is exclusive for the iterators
}
// If we're going backwards (wrt our sort order) we store the startIdx and use it as our upper bound next round
if (iter != null)
iter.previousSliceEnd = invert ? lowerBound : upperBound;
return invert
? new BackwardsCellIterator(lowerBound, upperBound)
: new ForwardsCellIterator(lowerBound, upperBound);
} } | public class class_name {
private Iterator<Cell> slice(ColumnSlice slice, boolean invert, SlicesIterator iter)
{
Composite start = invert ? slice.finish : slice.start;
Composite finish = invert ? slice.start : slice.finish;
int lowerBound = 0, upperBound = size;
if (iter != null)
{
if (invert)
upperBound = iter.previousSliceEnd;
else
lowerBound = iter.previousSliceEnd;
}
if (!start.isEmpty())
{
lowerBound = binarySearch(lowerBound, upperBound, start, internalComparator()); // depends on control dependency: [if], data = [none]
if (lowerBound < 0)
lowerBound = -lowerBound - 1;
}
if (!finish.isEmpty())
{
upperBound = binarySearch(lowerBound, upperBound, finish, internalComparator()); // depends on control dependency: [if], data = [none]
upperBound = upperBound < 0
? -upperBound - 1
: upperBound + 1; // upperBound is exclusive for the iterators // depends on control dependency: [if], data = [none]
}
// If we're going backwards (wrt our sort order) we store the startIdx and use it as our upper bound next round
if (iter != null)
iter.previousSliceEnd = invert ? lowerBound : upperBound;
return invert
? new BackwardsCellIterator(lowerBound, upperBound)
: new ForwardsCellIterator(lowerBound, upperBound);
} } |
public class class_name {
public final EObject ruleXShortClosure() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
Token lv_explicitSyntax_4_0=null;
EObject lv_declaredFormalParameters_1_0 = null;
EObject lv_declaredFormalParameters_3_0 = null;
EObject lv_expression_5_0 = null;
enterRule();
try {
// InternalXbase.g:2694:2: ( ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) ) )
// InternalXbase.g:2695:2: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) )
{
// InternalXbase.g:2695:2: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) )
// InternalXbase.g:2696:3: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) )
{
// InternalXbase.g:2696:3: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) )
// InternalXbase.g:2697:4: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) )
{
// InternalXbase.g:2722:4: ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) )
// InternalXbase.g:2723:5: () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) )
{
// InternalXbase.g:2723:5: ()
// InternalXbase.g:2724:6:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXShortClosureAccess().getXClosureAction_0_0_0(),
current);
}
}
// InternalXbase.g:2730:5: ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )?
int alt46=2;
int LA46_0 = input.LA(1);
if ( (LA46_0==RULE_ID||LA46_0==32||LA46_0==49) ) {
alt46=1;
}
switch (alt46) {
case 1 :
// InternalXbase.g:2731:6: ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )*
{
// InternalXbase.g:2731:6: ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2732:7: (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2732:7: (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter )
// InternalXbase.g:2733:8: lv_declaredFormalParameters_1_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getDeclaredFormalParametersJvmFormalParameterParserRuleCall_0_0_1_0_0());
}
pushFollow(FOLLOW_39);
lv_declaredFormalParameters_1_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule());
}
add(
current,
"declaredFormalParameters",
lv_declaredFormalParameters_1_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
// InternalXbase.g:2750:6: (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )*
loop45:
do {
int alt45=2;
int LA45_0 = input.LA(1);
if ( (LA45_0==48) ) {
alt45=1;
}
switch (alt45) {
case 1 :
// InternalXbase.g:2751:7: otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) )
{
otherlv_2=(Token)match(input,48,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXShortClosureAccess().getCommaKeyword_0_0_1_1_0());
}
// InternalXbase.g:2755:7: ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2756:8: (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2756:8: (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter )
// InternalXbase.g:2757:9: lv_declaredFormalParameters_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getDeclaredFormalParametersJvmFormalParameterParserRuleCall_0_0_1_1_1_0());
}
pushFollow(FOLLOW_39);
lv_declaredFormalParameters_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule());
}
add(
current,
"declaredFormalParameters",
lv_declaredFormalParameters_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop45;
}
} while (true);
}
break;
}
// InternalXbase.g:2776:5: ( (lv_explicitSyntax_4_0= '|' ) )
// InternalXbase.g:2777:6: (lv_explicitSyntax_4_0= '|' )
{
// InternalXbase.g:2777:6: (lv_explicitSyntax_4_0= '|' )
// InternalXbase.g:2778:7: lv_explicitSyntax_4_0= '|'
{
lv_explicitSyntax_4_0=(Token)match(input,56,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_explicitSyntax_4_0, grammarAccess.getXShortClosureAccess().getExplicitSyntaxVerticalLineKeyword_0_0_2_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXShortClosureRule());
}
setWithLastConsumed(current, "explicitSyntax", true, "|");
}
}
}
}
}
// InternalXbase.g:2792:3: ( (lv_expression_5_0= ruleXExpression ) )
// InternalXbase.g:2793:4: (lv_expression_5_0= ruleXExpression )
{
// InternalXbase.g:2793:4: (lv_expression_5_0= ruleXExpression )
// InternalXbase.g:2794:5: lv_expression_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getExpressionXExpressionParserRuleCall_1_0());
}
pushFollow(FOLLOW_2);
lv_expression_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule());
}
set(
current,
"expression",
lv_expression_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXShortClosure() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
Token lv_explicitSyntax_4_0=null;
EObject lv_declaredFormalParameters_1_0 = null;
EObject lv_declaredFormalParameters_3_0 = null;
EObject lv_expression_5_0 = null;
enterRule();
try {
// InternalXbase.g:2694:2: ( ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) ) )
// InternalXbase.g:2695:2: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) )
{
// InternalXbase.g:2695:2: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) ) )
// InternalXbase.g:2696:3: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) ) ( (lv_expression_5_0= ruleXExpression ) )
{
// InternalXbase.g:2696:3: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) ) )
// InternalXbase.g:2697:4: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) )
{
// InternalXbase.g:2722:4: ( () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) ) )
// InternalXbase.g:2723:5: () ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )? ( (lv_explicitSyntax_4_0= '|' ) )
{
// InternalXbase.g:2723:5: ()
// InternalXbase.g:2724:6:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXShortClosureAccess().getXClosureAction_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalXbase.g:2730:5: ( ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )* )?
int alt46=2;
int LA46_0 = input.LA(1);
if ( (LA46_0==RULE_ID||LA46_0==32||LA46_0==49) ) {
alt46=1; // depends on control dependency: [if], data = [none]
}
switch (alt46) {
case 1 :
// InternalXbase.g:2731:6: ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) ) (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )*
{
// InternalXbase.g:2731:6: ( (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2732:7: (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2732:7: (lv_declaredFormalParameters_1_0= ruleJvmFormalParameter )
// InternalXbase.g:2733:8: lv_declaredFormalParameters_1_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getDeclaredFormalParametersJvmFormalParameterParserRuleCall_0_0_1_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_39);
lv_declaredFormalParameters_1_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"declaredFormalParameters",
lv_declaredFormalParameters_1_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXbase.g:2750:6: (otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) ) )*
loop45:
do {
int alt45=2;
int LA45_0 = input.LA(1);
if ( (LA45_0==48) ) {
alt45=1; // depends on control dependency: [if], data = [none]
}
switch (alt45) {
case 1 :
// InternalXbase.g:2751:7: otherlv_2= ',' ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) )
{
otherlv_2=(Token)match(input,48,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXShortClosureAccess().getCommaKeyword_0_0_1_1_0()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:2755:7: ( (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter ) )
// InternalXbase.g:2756:8: (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter )
{
// InternalXbase.g:2756:8: (lv_declaredFormalParameters_3_0= ruleJvmFormalParameter )
// InternalXbase.g:2757:9: lv_declaredFormalParameters_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getDeclaredFormalParametersJvmFormalParameterParserRuleCall_0_0_1_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_39);
lv_declaredFormalParameters_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"declaredFormalParameters",
lv_declaredFormalParameters_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop45;
}
} while (true);
}
break;
}
// InternalXbase.g:2776:5: ( (lv_explicitSyntax_4_0= '|' ) )
// InternalXbase.g:2777:6: (lv_explicitSyntax_4_0= '|' )
{
// InternalXbase.g:2777:6: (lv_explicitSyntax_4_0= '|' )
// InternalXbase.g:2778:7: lv_explicitSyntax_4_0= '|'
{
lv_explicitSyntax_4_0=(Token)match(input,56,FOLLOW_4); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_explicitSyntax_4_0, grammarAccess.getXShortClosureAccess().getExplicitSyntaxVerticalLineKeyword_0_0_2_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXShortClosureRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "explicitSyntax", true, "|"); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// InternalXbase.g:2792:3: ( (lv_expression_5_0= ruleXExpression ) )
// InternalXbase.g:2793:4: (lv_expression_5_0= ruleXExpression )
{
// InternalXbase.g:2793:4: (lv_expression_5_0= ruleXExpression )
// InternalXbase.g:2794:5: lv_expression_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXShortClosureAccess().getExpressionXExpressionParserRuleCall_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_expression_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXShortClosureRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"expression",
lv_expression_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
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 void marshall(UpdateProvisionedProductRequest updateProvisionedProductRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProvisionedProductRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProvisionedProductRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisionedProductId(), PROVISIONEDPRODUCTID_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProductId(), PRODUCTID_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getPathId(), PATHID_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningParameters(), PROVISIONINGPARAMETERS_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningPreferences(), PROVISIONINGPREFERENCES_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(updateProvisionedProductRequest.getUpdateToken(), UPDATETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateProvisionedProductRequest updateProvisionedProductRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProvisionedProductRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProvisionedProductRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisionedProductName(), PROVISIONEDPRODUCTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisionedProductId(), PROVISIONEDPRODUCTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProductId(), PRODUCTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getPathId(), PATHID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningParameters(), PROVISIONINGPARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getProvisioningPreferences(), PROVISIONINGPREFERENCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProvisionedProductRequest.getUpdateToken(), UPDATETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String stripContextPath(final String contextPath, String uri)
{
if (!contextPath.equals("/") && uri.startsWith(contextPath))
{
uri = uri.substring(contextPath.length());
}
return uri;
} } | public class class_name {
private String stripContextPath(final String contextPath, String uri)
{
if (!contextPath.equals("/") && uri.startsWith(contextPath))
{
uri = uri.substring(contextPath.length()); // depends on control dependency: [if], data = [none]
}
return uri;
} } |
public class class_name {
public static boolean isInstanceOf(Object o, Type t)
{
if(o == null) {
return false;
}
if(t instanceof Class) {
Class<?> clazz = (Class<?>)t;
if(clazz.isPrimitive()) {
return BOXING_MAP.get(clazz) == o.getClass();
}
return clazz.isInstance(o);
}
return false;
} } | public class class_name {
public static boolean isInstanceOf(Object o, Type t)
{
if(o == null) {
return false;
// depends on control dependency: [if], data = [none]
}
if(t instanceof Class) {
Class<?> clazz = (Class<?>)t;
if(clazz.isPrimitive()) {
return BOXING_MAP.get(clazz) == o.getClass();
}
return clazz.isInstance(o);
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
void expectExtends(Node n, FunctionType subCtor, FunctionType astSuperCtor) {
if (astSuperCtor == null || (!astSuperCtor.isConstructor() && !astSuperCtor.isInterface())) {
// toMaybeFunctionType failed, or we've got a loose type. Let it go for now.
return;
}
if (astSuperCtor.isConstructor() != subCtor.isConstructor()) {
// Don't bother looking if one is a constructor and the other is an interface.
// We'll report an error elsewhere.
return;
}
ObjectType astSuperInstance = astSuperCtor.getInstanceType();
if (subCtor.isConstructor()) {
// There should be exactly one superclass, and it needs to have this constructor.
// Note: if the registered supertype (from the @extends jsdoc) was unresolved,
// then getSuperClassConstructor will be null - make sure not to crash.
FunctionType registeredSuperCtor = subCtor.getSuperClassConstructor();
if (registeredSuperCtor != null) {
ObjectType registeredSuperInstance = registeredSuperCtor.getInstanceType();
if (!astSuperInstance.isEquivalentTo(registeredSuperInstance)) {
mismatch(
n,
"mismatch in declaration of superclass type",
astSuperInstance,
registeredSuperInstance);
}
}
} else if (subCtor.isInterface()) {
// We intentionally skip this check for interfaces because they can extend multiple other
// interfaces.
}
} } | public class class_name {
void expectExtends(Node n, FunctionType subCtor, FunctionType astSuperCtor) {
if (astSuperCtor == null || (!astSuperCtor.isConstructor() && !astSuperCtor.isInterface())) {
// toMaybeFunctionType failed, or we've got a loose type. Let it go for now.
return; // depends on control dependency: [if], data = [none]
}
if (astSuperCtor.isConstructor() != subCtor.isConstructor()) {
// Don't bother looking if one is a constructor and the other is an interface.
// We'll report an error elsewhere.
return; // depends on control dependency: [if], data = [none]
}
ObjectType astSuperInstance = astSuperCtor.getInstanceType();
if (subCtor.isConstructor()) {
// There should be exactly one superclass, and it needs to have this constructor.
// Note: if the registered supertype (from the @extends jsdoc) was unresolved,
// then getSuperClassConstructor will be null - make sure not to crash.
FunctionType registeredSuperCtor = subCtor.getSuperClassConstructor();
if (registeredSuperCtor != null) {
ObjectType registeredSuperInstance = registeredSuperCtor.getInstanceType();
if (!astSuperInstance.isEquivalentTo(registeredSuperInstance)) {
mismatch(
n,
"mismatch in declaration of superclass type",
astSuperInstance,
registeredSuperInstance); // depends on control dependency: [if], data = [none]
}
}
} else if (subCtor.isInterface()) {
// We intentionally skip this check for interfaces because they can extend multiple other
// interfaces.
}
} } |
public class class_name {
@Override
protected void onAfterInitialize()
{
super.onAfterInitialize();
menu = newDesktopMenu(this);
setJMenuBar(menu.getMenubar());
setToolBar(toolbar = newJToolBar());
getContentPane().add(mainComponent = newMainComponent());
Optional<BufferedImage> optionalIcon = getIcon(newIconPath());
if (optionalIcon.isPresent())
{
setIconImage(icon = optionalIcon.get());
}
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice[] gs = ge.getScreenDevices();
setSize(ScreenSizeExtensions.getScreenWidth(gs[0]),
ScreenSizeExtensions.getScreenHeight(gs[0]));
setVisible(true);
// Set default look and feel...
setDefaultLookAndFeel(newLookAndFeels(), this);
} } | public class class_name {
@Override
protected void onAfterInitialize()
{
super.onAfterInitialize();
menu = newDesktopMenu(this);
setJMenuBar(menu.getMenubar());
setToolBar(toolbar = newJToolBar());
getContentPane().add(mainComponent = newMainComponent());
Optional<BufferedImage> optionalIcon = getIcon(newIconPath());
if (optionalIcon.isPresent())
{
setIconImage(icon = optionalIcon.get()); // depends on control dependency: [if], data = [none]
}
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice[] gs = ge.getScreenDevices();
setSize(ScreenSizeExtensions.getScreenWidth(gs[0]),
ScreenSizeExtensions.getScreenHeight(gs[0]));
setVisible(true);
// Set default look and feel...
setDefaultLookAndFeel(newLookAndFeels(), this);
} } |
public class class_name {
public static String getClassLoadingTypeDescription(ClassNode c) {
StringBuilder buf = new StringBuilder();
boolean array = false;
while (true) {
if (c.isArray()) {
buf.append('[');
c = c.getComponentType();
array = true;
} else {
if (ClassHelper.isPrimitiveType(c)) {
buf.append(getTypeDescription(c));
} else {
if (array) buf.append('L');
buf.append(c.getName());
if (array) buf.append(';');
}
return buf.toString();
}
}
} } | public class class_name {
public static String getClassLoadingTypeDescription(ClassNode c) {
StringBuilder buf = new StringBuilder();
boolean array = false;
while (true) {
if (c.isArray()) {
buf.append('['); // depends on control dependency: [if], data = [none]
c = c.getComponentType(); // depends on control dependency: [if], data = [none]
array = true; // depends on control dependency: [if], data = [none]
} else {
if (ClassHelper.isPrimitiveType(c)) {
buf.append(getTypeDescription(c)); // depends on control dependency: [if], data = [none]
} else {
if (array) buf.append('L');
buf.append(c.getName()); // depends on control dependency: [if], data = [none]
if (array) buf.append(';');
}
return buf.toString(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public GVRComponent detachComponent(long type) {
NativeSceneObject.detachComponent(getNative(), type);
synchronized (mComponents) {
GVRComponent component = mComponents.remove(type);
if (component != null) {
component.setOwnerObject(null);
}
return component;
}
} } | public class class_name {
public GVRComponent detachComponent(long type) {
NativeSceneObject.detachComponent(getNative(), type);
synchronized (mComponents) {
GVRComponent component = mComponents.remove(type);
if (component != null) {
component.setOwnerObject(null); // depends on control dependency: [if], data = [null)]
}
return component;
}
} } |
public class class_name {
public void toSource(final CodeBuilder cb,
final int inputSeqNum,
final Node root) {
runInCompilerThread(
() -> {
if (options.printInputDelimiter) {
if ((cb.getLength() > 0) && !cb.endsWith("\n")) {
cb.append("\n"); // Make sure that the label starts on a new line
}
checkState(root.isScript());
String delimiter = options.inputDelimiter;
String inputName = root.getInputId().getIdName();
String sourceName = root.getSourceFileName();
checkState(sourceName != null);
checkState(!sourceName.isEmpty());
delimiter =
delimiter
.replace("%name%", Matcher.quoteReplacement(inputName))
.replace("%num%", String.valueOf(inputSeqNum))
.replace("%n%", "\n");
cb.append(delimiter).append("\n");
}
if (root.getJSDocInfo() != null) {
String license = root.getJSDocInfo().getLicense();
if (license != null && cb.addLicense(license)) {
cb.append("/*\n").append(license).append("*/\n");
}
}
// If there is a valid source map, then indicate to it that the current
// root node's mappings are offset by the given string builder buffer.
if (options.sourceMapOutputPath != null) {
sourceMap.setStartingPosition(cb.getLineIndex(), cb.getColumnIndex());
}
// if LanguageMode is strict, only print 'use strict'
// for the first input file
String code = toSource(root, sourceMap, inputSeqNum == 0);
if (!code.isEmpty()) {
cb.append(code);
// In order to avoid parse ambiguity when files are concatenated
// together, all files should end in a semi-colon. Do a quick
// heuristic check if there's an obvious semi-colon already there.
int length = code.length();
char lastChar = code.charAt(length - 1);
char secondLastChar = length >= 2 ? code.charAt(length - 2) : '\0';
boolean hasSemiColon = lastChar == ';' || (lastChar == '\n' && secondLastChar == ';');
if (!hasSemiColon) {
cb.append(";");
}
}
return null;
});
} } | public class class_name {
public void toSource(final CodeBuilder cb,
final int inputSeqNum,
final Node root) {
runInCompilerThread(
() -> {
if (options.printInputDelimiter) {
if ((cb.getLength() > 0) && !cb.endsWith("\n")) {
cb.append("\n"); // Make sure that the label starts on a new line // depends on control dependency: [if], data = [none]
}
checkState(root.isScript()); // depends on control dependency: [if], data = [none]
String delimiter = options.inputDelimiter;
String inputName = root.getInputId().getIdName();
String sourceName = root.getSourceFileName();
checkState(sourceName != null); // depends on control dependency: [if], data = [none]
checkState(!sourceName.isEmpty()); // depends on control dependency: [if], data = [none]
delimiter =
delimiter
.replace("%name%", Matcher.quoteReplacement(inputName))
.replace("%num%", String.valueOf(inputSeqNum))
.replace("%n%", "\n"); // depends on control dependency: [if], data = [none]
cb.append(delimiter).append("\n"); // depends on control dependency: [if], data = [none]
}
if (root.getJSDocInfo() != null) {
String license = root.getJSDocInfo().getLicense();
if (license != null && cb.addLicense(license)) {
cb.append("/*\n").append(license).append("*/\n"); // depends on control dependency: [if], data = [(license]
}
}
// If there is a valid source map, then indicate to it that the current
// root node's mappings are offset by the given string builder buffer.
if (options.sourceMapOutputPath != null) {
sourceMap.setStartingPosition(cb.getLineIndex(), cb.getColumnIndex()); // depends on control dependency: [if], data = [none]
}
// if LanguageMode is strict, only print 'use strict'
// for the first input file
String code = toSource(root, sourceMap, inputSeqNum == 0);
if (!code.isEmpty()) {
cb.append(code); // depends on control dependency: [if], data = [none]
// In order to avoid parse ambiguity when files are concatenated
// together, all files should end in a semi-colon. Do a quick
// heuristic check if there's an obvious semi-colon already there.
int length = code.length();
char lastChar = code.charAt(length - 1);
char secondLastChar = length >= 2 ? code.charAt(length - 2) : '\0';
boolean hasSemiColon = lastChar == ';' || (lastChar == '\n' && secondLastChar == ';');
if (!hasSemiColon) {
cb.append(";"); // depends on control dependency: [if], data = [none]
}
}
return null;
});
} } |
public class class_name {
public Collection<V> values() {
Collection<V> vs = values;
if (vs == null) {
vs = new LinkedValues();
values = vs;
}
return vs;
} } | public class class_name {
public Collection<V> values() {
Collection<V> vs = values;
if (vs == null) {
vs = new LinkedValues(); // depends on control dependency: [if], data = [none]
values = vs; // depends on control dependency: [if], data = [none]
}
return vs;
} } |
public class class_name {
private static Pair<Double, ClassicCounter<Integer>> readModel(File modelFile, boolean multiclass) {
int modelLineCount = 0;
try {
int numLinesToSkip = multiclass ? 13 : 10;
String stopToken = "#";
BufferedReader in = new BufferedReader(new FileReader(modelFile));
for (int i=0; i < numLinesToSkip; i++) {
in.readLine();
modelLineCount ++;
}
List<Pair<Double, ClassicCounter<Integer>>> supportVectors = new ArrayList<Pair<Double, ClassicCounter<Integer>>>();
// Read Threshold
String thresholdLine = in.readLine();
modelLineCount ++;
String[] pieces = thresholdLine.split("\\s+");
double threshold = Double.parseDouble(pieces[0]);
// Read Support Vectors
while (in.ready()) {
String svLine = in.readLine();
modelLineCount ++;
pieces = svLine.split("\\s+");
// First Element is the alpha_i * y_i
double alpha = Double.parseDouble(pieces[0]);
ClassicCounter<Integer> supportVector = new ClassicCounter<Integer>();
for (int i=1; i < pieces.length; ++i) {
String piece = pieces[i];
if (piece.equals(stopToken)) break;
// Each in featureIndex:num class
String[] indexNum = piece.split(":");
String featureIndex = indexNum[0];
// mihai: we may see "qid" as indexNum[0]. just skip this piece. this is the block id useful only for reranking, which we don't do here.
if(! featureIndex.equals("qid")){
double count = Double.parseDouble(indexNum[1]);
supportVector.incrementCount(Integer.valueOf(featureIndex), count);
}
}
supportVectors.add(new Pair<Double, ClassicCounter<Integer>>(alpha, supportVector));
}
in.close();
return new Pair<Double, ClassicCounter<Integer>>(threshold, getWeights(supportVectors));
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Error reading SVM model (line " + modelLineCount + " in file " + modelFile.getAbsolutePath() + ")");
}
} } | public class class_name {
private static Pair<Double, ClassicCounter<Integer>> readModel(File modelFile, boolean multiclass) {
int modelLineCount = 0;
try {
int numLinesToSkip = multiclass ? 13 : 10;
String stopToken = "#";
BufferedReader in = new BufferedReader(new FileReader(modelFile));
for (int i=0; i < numLinesToSkip; i++) {
in.readLine();
// depends on control dependency: [for], data = [none]
modelLineCount ++;
// depends on control dependency: [for], data = [none]
}
List<Pair<Double, ClassicCounter<Integer>>> supportVectors = new ArrayList<Pair<Double, ClassicCounter<Integer>>>();
// Read Threshold
String thresholdLine = in.readLine();
modelLineCount ++;
String[] pieces = thresholdLine.split("\\s+");
double threshold = Double.parseDouble(pieces[0]);
// Read Support Vectors
while (in.ready()) {
String svLine = in.readLine();
modelLineCount ++;
// depends on control dependency: [while], data = [none]
pieces = svLine.split("\\s+");
// depends on control dependency: [while], data = [none]
// First Element is the alpha_i * y_i
double alpha = Double.parseDouble(pieces[0]);
ClassicCounter<Integer> supportVector = new ClassicCounter<Integer>();
for (int i=1; i < pieces.length; ++i) {
String piece = pieces[i];
if (piece.equals(stopToken)) break;
// Each in featureIndex:num class
String[] indexNum = piece.split(":");
String featureIndex = indexNum[0];
// mihai: we may see "qid" as indexNum[0]. just skip this piece. this is the block id useful only for reranking, which we don't do here.
if(! featureIndex.equals("qid")){
double count = Double.parseDouble(indexNum[1]);
supportVector.incrementCount(Integer.valueOf(featureIndex), count);
// depends on control dependency: [if], data = [none]
}
}
supportVectors.add(new Pair<Double, ClassicCounter<Integer>>(alpha, supportVector));
// depends on control dependency: [while], data = [none]
}
in.close();
return new Pair<Double, ClassicCounter<Integer>>(threshold, getWeights(supportVectors));
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Error reading SVM model (line " + modelLineCount + " in file " + modelFile.getAbsolutePath() + ")");
}
} } |
public class class_name {
private void preComputeCardinalities() {
if (!cumulatedCardinalitiesCacheIsValid) {
int nbBuckets = highLowContainer.size();
// Ensure the cache size is the right one
if (highToCumulatedCardinality == null || highToCumulatedCardinality.length != nbBuckets) {
highToCumulatedCardinality = new int[nbBuckets];
}
// Ensure the cache content is valid
if (highToCumulatedCardinality.length >= 1) {
// As we compute the cumulated cardinalities, the first index is an edge case
highToCumulatedCardinality[0] = highLowContainer.getContainerAtIndex(0).getCardinality();
for (int i = 1; i < highToCumulatedCardinality.length; i++) {
highToCumulatedCardinality[i] = highToCumulatedCardinality[i - 1]
+ highLowContainer.getContainerAtIndex(i).getCardinality();
}
}
cumulatedCardinalitiesCacheIsValid = true;
}
} } | public class class_name {
private void preComputeCardinalities() {
if (!cumulatedCardinalitiesCacheIsValid) {
int nbBuckets = highLowContainer.size();
// Ensure the cache size is the right one
if (highToCumulatedCardinality == null || highToCumulatedCardinality.length != nbBuckets) {
highToCumulatedCardinality = new int[nbBuckets]; // depends on control dependency: [if], data = [none]
}
// Ensure the cache content is valid
if (highToCumulatedCardinality.length >= 1) {
// As we compute the cumulated cardinalities, the first index is an edge case
highToCumulatedCardinality[0] = highLowContainer.getContainerAtIndex(0).getCardinality(); // depends on control dependency: [if], data = [none]
for (int i = 1; i < highToCumulatedCardinality.length; i++) {
highToCumulatedCardinality[i] = highToCumulatedCardinality[i - 1]
+ highLowContainer.getContainerAtIndex(i).getCardinality(); // depends on control dependency: [for], data = [i]
}
}
cumulatedCardinalitiesCacheIsValid = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private QNode reclean() {
/*
* cleanMe is, or at one time was, predecessor of cancelled
* node s that was the tail so could not be unspliced. If s
* is no longer the tail, try to unsplice if necessary and
* make cleanMe slot available. This differs from similar
* code in clean() because we must check that pred still
* points to a cancelled node that must be unspliced -- if
* not, we can (must) clear cleanMe without unsplicing.
* This can loop only due to contention on casNext or
* clearing cleanMe.
*/
QNode pred;
while ((pred = this.cleanMe.get()) != null) {
QNode t = getValidatedTail();
QNode s = pred.next;
if (s != t) {
QNode sn;
if (s == null || s == pred || s.get() != s ||
(sn = s.next) == s || pred.casNext(s, sn)) {
this.cleanMe.compareAndSet(pred, null);
}
} else {
break;
}
}
return pred;
} } | public class class_name {
private QNode reclean() {
/*
* cleanMe is, or at one time was, predecessor of cancelled
* node s that was the tail so could not be unspliced. If s
* is no longer the tail, try to unsplice if necessary and
* make cleanMe slot available. This differs from similar
* code in clean() because we must check that pred still
* points to a cancelled node that must be unspliced -- if
* not, we can (must) clear cleanMe without unsplicing.
* This can loop only due to contention on casNext or
* clearing cleanMe.
*/
QNode pred;
while ((pred = this.cleanMe.get()) != null) {
QNode t = getValidatedTail();
QNode s = pred.next;
if (s != t) {
QNode sn;
if (s == null || s == pred || s.get() != s ||
(sn = s.next) == s || pred.casNext(s, sn)) {
this.cleanMe.compareAndSet(pred, null); // depends on control dependency: [if], data = [none]
}
} else {
break;
}
}
return pred;
} } |
public class class_name {
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) {
Comparable threshold = getThreshold(condition, type);
if (reachThreshold(value, threshold, condition)) {
return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString()));
}
return Optional.empty();
} } | public class class_name {
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) {
Comparable threshold = getThreshold(condition, type);
if (reachThreshold(value, threshold, condition)) {
return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString())); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public void toStandardForm(double[] originalC, double[][] originalG, double[] originalH,
double[][] originalA, double[] originalB, double[] originalLB, double[] originalUB) {
this.F1 = (useSparsity)? DoubleFactory1D.sparse : DoubleFactory1D.dense;
this.F2 = (useSparsity)? DoubleFactory2D.sparse : DoubleFactory2D.dense;
DoubleMatrix1D cVector = F1.make(originalC);
DoubleMatrix2D GMatrix = null;
DoubleMatrix1D hVector = null;
if(originalG!=null){
//GMatrix = (useSparsity)? new SparseDoubleMatrix2D(G) : F2.make(G);
GMatrix = F2.make(originalG);
hVector = F1.make(originalH);
}
DoubleMatrix2D AMatrix = null;
DoubleMatrix1D bVector = null;
if(originalA!=null){
//AMatrix = (useSparsity)? new SparseDoubleMatrix2D(A) : F2.make(A);
AMatrix = F2.make(originalA);
bVector = F1.make(originalB);
}
if(originalLB != null && originalUB !=null){
if(originalLB.length != originalUB.length){
throw new IllegalArgumentException("lower and upper bounds have different lenght");
}
}
DoubleMatrix1D lbVector = (originalLB!=null)? F1.make(originalLB) : null;
DoubleMatrix1D ubVector = (originalUB!=null)? F1.make(originalUB) : null;
toStandardForm(cVector, GMatrix, hVector, AMatrix, bVector, lbVector, ubVector);
} } | public class class_name {
public void toStandardForm(double[] originalC, double[][] originalG, double[] originalH,
double[][] originalA, double[] originalB, double[] originalLB, double[] originalUB) {
this.F1 = (useSparsity)? DoubleFactory1D.sparse : DoubleFactory1D.dense;
this.F2 = (useSparsity)? DoubleFactory2D.sparse : DoubleFactory2D.dense;
DoubleMatrix1D cVector = F1.make(originalC);
DoubleMatrix2D GMatrix = null;
DoubleMatrix1D hVector = null;
if(originalG!=null){
//GMatrix = (useSparsity)? new SparseDoubleMatrix2D(G) : F2.make(G);
GMatrix = F2.make(originalG);
// depends on control dependency: [if], data = [(originalG]
hVector = F1.make(originalH);
// depends on control dependency: [if], data = [none]
}
DoubleMatrix2D AMatrix = null;
DoubleMatrix1D bVector = null;
if(originalA!=null){
//AMatrix = (useSparsity)? new SparseDoubleMatrix2D(A) : F2.make(A);
AMatrix = F2.make(originalA);
// depends on control dependency: [if], data = [(originalA]
bVector = F1.make(originalB);
// depends on control dependency: [if], data = [none]
}
if(originalLB != null && originalUB !=null){
if(originalLB.length != originalUB.length){
throw new IllegalArgumentException("lower and upper bounds have different lenght");
}
}
DoubleMatrix1D lbVector = (originalLB!=null)? F1.make(originalLB) : null;
DoubleMatrix1D ubVector = (originalUB!=null)? F1.make(originalUB) : null;
toStandardForm(cVector, GMatrix, hVector, AMatrix, bVector, lbVector, ubVector);
} } |
public class class_name {
public BusItinerary getBusItinerary(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusItinerary busItinerary : this.itineraries) {
if (uuid.equals(busItinerary.getUUID())) {
return busItinerary;
}
}
return null;
} } | public class class_name {
public BusItinerary getBusItinerary(UUID uuid) {
if (uuid == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (final BusItinerary busItinerary : this.itineraries) {
if (uuid.equals(busItinerary.getUUID())) {
return busItinerary; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
protected Element getTextInput(final Element rssRoot) {
final String elementName = getTextInputLabel();
final Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
if (eChannel != null) {
return eChannel.getChild(elementName, getRSSNamespace());
} else {
return null;
}
} } | public class class_name {
@Override
protected Element getTextInput(final Element rssRoot) {
final String elementName = getTextInputLabel();
final Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
if (eChannel != null) {
return eChannel.getChild(elementName, getRSSNamespace()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <X> String join(Iterable<X> l, String glue) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (X o : l) {
if ( ! first) {
sb.append(glue);
} else {
first = false;
}
sb.append(o);
}
return sb.toString();
} } | public class class_name {
public static <X> String join(Iterable<X> l, String glue) {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (X o : l) {
if ( ! first) {
sb.append(glue);
// depends on control dependency: [if], data = [none]
} else {
first = false;
// depends on control dependency: [if], data = [none]
}
sb.append(o);
// depends on control dependency: [for], data = [o]
}
return sb.toString();
} } |
public class class_name {
protected static void doLog(int connectionId, long elapsedNanos, Category category, String prepared, String sql, String url) {
// give it one more try if not initialized yet
if (logger == null) {
initialize();
if (logger == null) {
return;
}
}
final String format = P6SpyOptions.getActiveInstance().getDateformat();
final String stringNow;
if (format == null) {
stringNow = Long.toString(System.currentTimeMillis());
} else {
stringNow = new SimpleDateFormat(format).format(new java.util.Date()).trim();
}
logger.logSQL(connectionId, stringNow, TimeUnit.NANOSECONDS.toMillis(elapsedNanos), category, prepared, sql, url);
final boolean stackTrace = P6SpyOptions.getActiveInstance().getStackTrace();
if (stackTrace) {
final String stackTraceClass = P6SpyOptions.getActiveInstance().getStackTraceClass();
Exception e = new Exception();
if (stackTraceClass != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String stack = sw.toString();
if (stack.indexOf(stackTraceClass) == -1) {
e = null;
}
}
if (e != null) {
logger.logException(e);
}
}
} } | public class class_name {
protected static void doLog(int connectionId, long elapsedNanos, Category category, String prepared, String sql, String url) {
// give it one more try if not initialized yet
if (logger == null) {
initialize(); // depends on control dependency: [if], data = [none]
if (logger == null) {
return; // depends on control dependency: [if], data = [none]
}
}
final String format = P6SpyOptions.getActiveInstance().getDateformat();
final String stringNow;
if (format == null) {
stringNow = Long.toString(System.currentTimeMillis()); // depends on control dependency: [if], data = [none]
} else {
stringNow = new SimpleDateFormat(format).format(new java.util.Date()).trim(); // depends on control dependency: [if], data = [(format]
}
logger.logSQL(connectionId, stringNow, TimeUnit.NANOSECONDS.toMillis(elapsedNanos), category, prepared, sql, url);
final boolean stackTrace = P6SpyOptions.getActiveInstance().getStackTrace();
if (stackTrace) {
final String stackTraceClass = P6SpyOptions.getActiveInstance().getStackTraceClass();
Exception e = new Exception();
if (stackTraceClass != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw); // depends on control dependency: [if], data = [none]
String stack = sw.toString();
if (stack.indexOf(stackTraceClass) == -1) {
e = null; // depends on control dependency: [if], data = [none]
}
}
if (e != null) {
logger.logException(e); // depends on control dependency: [if], data = [(e]
}
}
} } |
public class class_name {
@Override
public String getFirstValidationGroupFromStack()
{
if (_validationGroupsStack != null && !_validationGroupsStack.isEmpty())
{
return _validationGroupsStack.getFirst(); // top-of-stack
}
return null;
} } | public class class_name {
@Override
public String getFirstValidationGroupFromStack()
{
if (_validationGroupsStack != null && !_validationGroupsStack.isEmpty())
{
return _validationGroupsStack.getFirst(); // top-of-stack // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private MetricValues metricValues(Set<MachineMetric> customSet,
List<MachineMetric> defaults, List<Long> values) {
List<MachineMetric> actualMetrics = defaults;
List<Long> actualValues = values;
if (customSet.size() > 0) {
// custom set of machine metrics specified
actualMetrics = new ArrayList<MachineMetric>();
actualValues = new ArrayList<Long>();
for (int i=0; i < defaults.size(); i++) {
MachineMetric mm = defaults.get(i);
if (customSet.contains(mm)) {
actualMetrics.add(mm);
actualValues.add(values.get(i));
}
}
}
return new MetricValues(actualMetrics, actualValues);
} } | public class class_name {
private MetricValues metricValues(Set<MachineMetric> customSet,
List<MachineMetric> defaults, List<Long> values) {
List<MachineMetric> actualMetrics = defaults;
List<Long> actualValues = values;
if (customSet.size() > 0) {
// custom set of machine metrics specified
actualMetrics = new ArrayList<MachineMetric>(); // depends on control dependency: [if], data = [none]
actualValues = new ArrayList<Long>(); // depends on control dependency: [if], data = [none]
for (int i=0; i < defaults.size(); i++) {
MachineMetric mm = defaults.get(i);
if (customSet.contains(mm)) {
actualMetrics.add(mm); // depends on control dependency: [if], data = [none]
actualValues.add(values.get(i)); // depends on control dependency: [if], data = [none]
}
}
}
return new MetricValues(actualMetrics, actualValues);
} } |
public class class_name {
@Nonnull
// it's reflection, can't avoid unchecked cast
@SuppressWarnings("unchecked")
public static Module classNameToModule(final Parameters parameters, final Class<?> clazz,
Optional<? extends Class<? extends Annotation>> annotation)
throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (Module.class.isAssignableFrom(clazz)) {
return instantiateModule((Class<? extends Module>) clazz, parameters, annotation);
} else {
// to abbreviate the names of modules in param files, if a class name is provided which
// is not a Module, we check if there is an inner-class named Module which is a Module
for (final String fallbackInnerClassName : FALLBACK_INNER_CLASS_NAMES) {
final String fullyQualifiedName = clazz.getName() + "$" + fallbackInnerClassName;
final Class<? extends Module> innerModuleClazz;
try {
innerModuleClazz = (Class<? extends Module>) Class.forName(fullyQualifiedName);
} catch (ClassNotFoundException cnfe) {
// it's okay, we just try the next one
continue;
}
if (Module.class.isAssignableFrom(innerModuleClazz)) {
return instantiateModule(innerModuleClazz, parameters, annotation);
} else {
throw new RuntimeException(clazz.getName() + " is not a module; "
+ fullyQualifiedName + " exists but is not a module");
}
}
// if we got here, we didn't find any module
throw new RuntimeException("Could not find inner class of " + clazz.getName()
+ " matching any of " + FALLBACK_INNER_CLASS_NAMES);
}
} } | public class class_name {
@Nonnull
// it's reflection, can't avoid unchecked cast
@SuppressWarnings("unchecked")
public static Module classNameToModule(final Parameters parameters, final Class<?> clazz,
Optional<? extends Class<? extends Annotation>> annotation)
throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (Module.class.isAssignableFrom(clazz)) {
return instantiateModule((Class<? extends Module>) clazz, parameters, annotation);
} else {
// to abbreviate the names of modules in param files, if a class name is provided which
// is not a Module, we check if there is an inner-class named Module which is a Module
for (final String fallbackInnerClassName : FALLBACK_INNER_CLASS_NAMES) {
final String fullyQualifiedName = clazz.getName() + "$" + fallbackInnerClassName;
final Class<? extends Module> innerModuleClazz;
try {
innerModuleClazz = (Class<? extends Module>) Class.forName(fullyQualifiedName); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException cnfe) {
// it's okay, we just try the next one
continue;
} // depends on control dependency: [catch], data = [none]
if (Module.class.isAssignableFrom(innerModuleClazz)) {
return instantiateModule(innerModuleClazz, parameters, annotation); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException(clazz.getName() + " is not a module; "
+ fullyQualifiedName + " exists but is not a module");
}
}
// if we got here, we didn't find any module
throw new RuntimeException("Could not find inner class of " + clazz.getName()
+ " matching any of " + FALLBACK_INNER_CLASS_NAMES);
}
} } |
public class class_name {
public ObjectNode toJsonNode(ObjectNode object) {
object.put("type", "rich");
if (title != null && !title.equals("")) {
object.put("title", title);
}
if (description != null && !description.equals("")) {
object.put("description", description);
}
if (url != null && !url.equals("")) {
object.put("url", url);
}
if (color != null) {
object.put("color", color.getRGB() & 0xFFFFFF);
}
if (timestamp != null) {
object.put("timestamp", DateTimeFormatter.ISO_INSTANT.format(timestamp));
}
if ((footerText != null && !footerText.equals("")) || (footerIconUrl != null && !footerIconUrl.equals(""))) {
ObjectNode footer = object.putObject("footer");
if (footerText != null && !footerText.equals("")) {
footer.put("text", footerText);
}
if (footerIconUrl != null && !footerIconUrl.equals("")) {
footer.put("icon_url", footerIconUrl);
}
if (footerIconContainer != null) {
footer.put("icon_url", "attachment://" + footerIconContainer.getFileTypeOrName());
}
}
if (imageUrl != null && !imageUrl.equals("")) {
object.putObject("image").put("url", imageUrl);
}
if (imageContainer != null) {
object.putObject("image").put("url", "attachment://" + imageContainer.getFileTypeOrName());
}
if (authorName != null && !authorName.equals("")) {
ObjectNode author = object.putObject("author");
author.put("name", authorName);
if (authorUrl != null && !authorUrl.equals("")) {
author.put("url", authorUrl);
}
if (authorIconUrl != null && !authorIconUrl.equals("")) {
author.put("icon_url", authorIconUrl);
}
if (authorIconContainer != null) {
author.put("icon_url", "attachment://" + authorIconContainer.getFileTypeOrName());
}
}
if (thumbnailUrl != null && !thumbnailUrl.equals("")) {
object.putObject("thumbnail").put("url", thumbnailUrl);
}
if (thumbnailContainer != null) {
object.putObject("thumbnail").put("url", "attachment://" + thumbnailContainer.getFileTypeOrName());
}
if (fields.size() > 0) {
ArrayNode jsonFields = object.putArray("fields");
for (EmbedField field : fields) {
ObjectNode jsonField = jsonFields.addObject();
jsonField.put("name", field.getName());
jsonField.put("value", field.getValue());
jsonField.put("inline", field.isInline());
}
}
return object;
} } | public class class_name {
public ObjectNode toJsonNode(ObjectNode object) {
object.put("type", "rich");
if (title != null && !title.equals("")) {
object.put("title", title); // depends on control dependency: [if], data = [none]
}
if (description != null && !description.equals("")) {
object.put("description", description); // depends on control dependency: [if], data = [none]
}
if (url != null && !url.equals("")) {
object.put("url", url); // depends on control dependency: [if], data = [none]
}
if (color != null) {
object.put("color", color.getRGB() & 0xFFFFFF); // depends on control dependency: [if], data = [none]
}
if (timestamp != null) {
object.put("timestamp", DateTimeFormatter.ISO_INSTANT.format(timestamp)); // depends on control dependency: [if], data = [(timestamp]
}
if ((footerText != null && !footerText.equals("")) || (footerIconUrl != null && !footerIconUrl.equals(""))) {
ObjectNode footer = object.putObject("footer");
if (footerText != null && !footerText.equals("")) {
footer.put("text", footerText); // depends on control dependency: [if], data = [none]
}
if (footerIconUrl != null && !footerIconUrl.equals("")) {
footer.put("icon_url", footerIconUrl); // depends on control dependency: [if], data = [none]
}
if (footerIconContainer != null) {
footer.put("icon_url", "attachment://" + footerIconContainer.getFileTypeOrName());
}
}
if (imageUrl != null && !imageUrl.equals("")) {
object.putObject("image").put("url", imageUrl); // depends on control dependency: [if], data = [none]
}
if (imageContainer != null) {
object.putObject("image").put("url", "attachment://" + imageContainer.getFileTypeOrName());
}
if (authorName != null && !authorName.equals("")) {
ObjectNode author = object.putObject("author");
author.put("name", authorName); // depends on control dependency: [if], data = [none]
if (authorUrl != null && !authorUrl.equals("")) {
author.put("url", authorUrl); // depends on control dependency: [if], data = [none]
}
if (authorIconUrl != null && !authorIconUrl.equals("")) {
author.put("icon_url", authorIconUrl); // depends on control dependency: [if], data = [none]
}
if (authorIconContainer != null) {
author.put("icon_url", "attachment://" + authorIconContainer.getFileTypeOrName());
}
}
if (thumbnailUrl != null && !thumbnailUrl.equals("")) {
object.putObject("thumbnail").put("url", thumbnailUrl); // depends on control dependency: [if], data = [none]
}
if (thumbnailContainer != null) {
object.putObject("thumbnail").put("url", "attachment://" + thumbnailContainer.getFileTypeOrName());
}
if (fields.size() > 0) {
ArrayNode jsonFields = object.putArray("fields"); // depends on control dependency: [if], data = [none]
for (EmbedField field : fields) {
ObjectNode jsonField = jsonFields.addObject();
jsonField.put("name", field.getName()); // depends on control dependency: [for], data = [field]
jsonField.put("value", field.getValue()); // depends on control dependency: [for], data = [field]
jsonField.put("inline", field.isInline()); // depends on control dependency: [for], data = [field]
}
}
return object; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
private boolean relevant(File currentLogFile, GregorianCalendar lastRelevantDate) {
String fileName=currentLogFile.getName();
Pattern p = Pattern.compile(APPENER_DATE_DEFAULT_PATTERN);
Matcher m = p.matcher(fileName);
if(m.find()){
int year=Integer.parseInt(m.group(1));
int month=Integer.parseInt(m.group(2));
int dayOfMonth=Integer.parseInt(m.group(3));
GregorianCalendar fileDate=new GregorianCalendar(year, month, dayOfMonth);
fileDate.add(Calendar.MONTH,-1); //Because of Calendar save the month such that January is 0
return fileDate.compareTo(lastRelevantDate)>0;
}
else{
return false;
}
} } | public class class_name {
private boolean relevant(File currentLogFile, GregorianCalendar lastRelevantDate) {
String fileName=currentLogFile.getName();
Pattern p = Pattern.compile(APPENER_DATE_DEFAULT_PATTERN);
Matcher m = p.matcher(fileName);
if(m.find()){
int year=Integer.parseInt(m.group(1));
int month=Integer.parseInt(m.group(2));
int dayOfMonth=Integer.parseInt(m.group(3));
GregorianCalendar fileDate=new GregorianCalendar(year, month, dayOfMonth);
fileDate.add(Calendar.MONTH,-1); //Because of Calendar save the month such that January is 0 // depends on control dependency: [if], data = [none]
return fileDate.compareTo(lastRelevantDate)>0; // depends on control dependency: [if], data = [none]
}
else{
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setIpv6Addresses(java.util.Collection<ScheduledInstancesIpv6Address> ipv6Addresses) {
if (ipv6Addresses == null) {
this.ipv6Addresses = null;
return;
}
this.ipv6Addresses = new com.amazonaws.internal.SdkInternalList<ScheduledInstancesIpv6Address>(ipv6Addresses);
} } | public class class_name {
public void setIpv6Addresses(java.util.Collection<ScheduledInstancesIpv6Address> ipv6Addresses) {
if (ipv6Addresses == null) {
this.ipv6Addresses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.ipv6Addresses = new com.amazonaws.internal.SdkInternalList<ScheduledInstancesIpv6Address>(ipv6Addresses);
} } |
public class class_name {
public void verify(String pkg, File path, Configuration conf) {
if (!path.isDirectory()) {
throw new IllegalArgumentException(path.getAbsolutePath().concat(" is not a directory."));
}
for (File file : path.listFiles()) {
if (file.isDirectory()) {
verify(combine(pkg, file.getName()), file, conf);
} else {
String fileName = file.getName();
int extensionSeparator = fileName.lastIndexOf('.');
if (extensionSeparator >= 0) {
String extension = fileName.substring(extensionSeparator + 1);
if (extension.equals("class")) {
String className = combine(pkg, fileName.substring(0, extensionSeparator));
try {
byte[] digest = conf.getJobService().getClassDigest(className);
if (digest == null) {
System.out.print("? ");
System.out.println(className);
} else if (!matches(file, digest, conf)) {
System.out.print("* ");
System.out.println(className);
} else if (conf.verbose) {
System.out.print("= ");
System.out.println(className);
}
} catch (FileNotFoundException e) {
throw new UnexpectedException(e);
} catch (IOException e) {
System.out.print("E ");
System.out.println(className);
}
}
}
}
}
} } | public class class_name {
public void verify(String pkg, File path, Configuration conf) {
if (!path.isDirectory()) {
throw new IllegalArgumentException(path.getAbsolutePath().concat(" is not a directory."));
}
for (File file : path.listFiles()) {
if (file.isDirectory()) {
verify(combine(pkg, file.getName()), file, conf); // depends on control dependency: [if], data = [none]
} else {
String fileName = file.getName();
int extensionSeparator = fileName.lastIndexOf('.');
if (extensionSeparator >= 0) {
String extension = fileName.substring(extensionSeparator + 1);
if (extension.equals("class")) {
String className = combine(pkg, fileName.substring(0, extensionSeparator));
try {
byte[] digest = conf.getJobService().getClassDigest(className);
if (digest == null) {
System.out.print("? "); // depends on control dependency: [if], data = [none]
System.out.println(className); // depends on control dependency: [if], data = [none]
} else if (!matches(file, digest, conf)) {
System.out.print("* "); // depends on control dependency: [if], data = [none]
System.out.println(className); // depends on control dependency: [if], data = [none]
} else if (conf.verbose) {
System.out.print("= "); // depends on control dependency: [if], data = [none]
System.out.println(className); // depends on control dependency: [if], data = [none]
}
} catch (FileNotFoundException e) {
throw new UnexpectedException(e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
System.out.print("E ");
System.out.println(className);
} // depends on control dependency: [catch], data = [none]
}
}
}
}
} } |
public class class_name {
public int getTrailingBitCount(boolean network) {
if(network) {
//trailing zeros
return Long.numberOfTrailingZeros(getDivisionValue() | (~0L << getBitCount()));
}
// trailing ones
return Long.numberOfTrailingZeros(~getDivisionValue());
} } | public class class_name {
public int getTrailingBitCount(boolean network) {
if(network) {
//trailing zeros
return Long.numberOfTrailingZeros(getDivisionValue() | (~0L << getBitCount())); // depends on control dependency: [if], data = [none]
}
// trailing ones
return Long.numberOfTrailingZeros(~getDivisionValue());
} } |
public class class_name {
public void processRequest(HttpServletRequest request) throws IOException,
FileUploadException, StorageClientException, AccessDeniedException {
boolean debug = LOGGER.isDebugEnabled();
if (ServletFileUpload.isMultipartContent(request)) {
if (debug) {
LOGGER.debug("Multipart POST ");
}
feedback.add("Multipart Upload");
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iterator = upload.getItemIterator(request);
while (iterator.hasNext()) {
FileItemStream item = iterator.next();
if (debug) {
LOGGER.debug("Got Item {}",item);
}
String name = item.getFieldName();
InputStream stream = item.openStream();
if (item.isFormField()) {
ParameterType pt = ParameterType.typeOfRequestParameter(name);
String propertyName = RequestUtils.propertyName(pt.getPropertyName(name));
RequestUtils.accumulate(stores.get(pt), propertyName, RequestUtils.toValue(name, Streams.asString(stream)));
feedback.add(pt.feedback(propertyName));
} else {
if (streamProcessor != null) {
feedback.addAll(streamProcessor.processStream(name, StorageClientUtils.getObjectName(item.getName()), item.getContentType(), stream, this));
}
}
}
if (debug) {
LOGGER.debug("No More items ");
}
} else {
if (debug) {
LOGGER.debug("Trad Post ");
}
// use traditional unstreamed operations.
@SuppressWarnings("unchecked")
Map<String, String[]> parameters = request.getParameterMap();
if (debug) {
LOGGER.debug("Traditional POST {} ", parameters);
}
Set<Entry<String, String[]>> entries = parameters.entrySet();
for (Entry<String, String[]> param : entries) {
String name = (String) param.getKey();
ParameterType pt = ParameterType.typeOfRequestParameter(name);
String propertyName = RequestUtils.propertyName(pt.getPropertyName(name));
RequestUtils.accumulate(stores.get(pt), propertyName, RequestUtils.toValue(name, param.getValue()));
feedback.add(pt.feedback(propertyName));
}
}
} } | public class class_name {
public void processRequest(HttpServletRequest request) throws IOException,
FileUploadException, StorageClientException, AccessDeniedException {
boolean debug = LOGGER.isDebugEnabled();
if (ServletFileUpload.isMultipartContent(request)) {
if (debug) {
LOGGER.debug("Multipart POST "); // depends on control dependency: [if], data = [none]
}
feedback.add("Multipart Upload");
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iterator = upload.getItemIterator(request);
while (iterator.hasNext()) {
FileItemStream item = iterator.next();
if (debug) {
LOGGER.debug("Got Item {}",item); // depends on control dependency: [if], data = [none]
}
String name = item.getFieldName();
InputStream stream = item.openStream();
if (item.isFormField()) {
ParameterType pt = ParameterType.typeOfRequestParameter(name);
String propertyName = RequestUtils.propertyName(pt.getPropertyName(name));
RequestUtils.accumulate(stores.get(pt), propertyName, RequestUtils.toValue(name, Streams.asString(stream))); // depends on control dependency: [if], data = [none]
feedback.add(pt.feedback(propertyName)); // depends on control dependency: [if], data = [none]
} else {
if (streamProcessor != null) {
feedback.addAll(streamProcessor.processStream(name, StorageClientUtils.getObjectName(item.getName()), item.getContentType(), stream, this)); // depends on control dependency: [if], data = [(streamProcessor]
}
}
}
if (debug) {
LOGGER.debug("No More items "); // depends on control dependency: [if], data = [none]
}
} else {
if (debug) {
LOGGER.debug("Trad Post "); // depends on control dependency: [if], data = [none]
}
// use traditional unstreamed operations.
@SuppressWarnings("unchecked")
Map<String, String[]> parameters = request.getParameterMap();
if (debug) {
LOGGER.debug("Traditional POST {} ", parameters); // depends on control dependency: [if], data = [none]
}
Set<Entry<String, String[]>> entries = parameters.entrySet();
for (Entry<String, String[]> param : entries) {
String name = (String) param.getKey();
ParameterType pt = ParameterType.typeOfRequestParameter(name);
String propertyName = RequestUtils.propertyName(pt.getPropertyName(name));
RequestUtils.accumulate(stores.get(pt), propertyName, RequestUtils.toValue(name, param.getValue())); // depends on control dependency: [for], data = [param]
feedback.add(pt.feedback(propertyName)); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
System.out.println("Showing suggested user categories.");
ResponseList<Category> categories = twitter.getSuggestedUserCategories();
for (Category category : categories) {
System.out.println(category.getName() + ":" + category.getSlug());
}
System.out.println("done.");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get suggested categories: " + te.getMessage());
System.exit(-1);
}
} } | public class class_name {
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
System.out.println("Showing suggested user categories."); // depends on control dependency: [try], data = [none]
ResponseList<Category> categories = twitter.getSuggestedUserCategories();
for (Category category : categories) {
System.out.println(category.getName() + ":" + category.getSlug()); // depends on control dependency: [for], data = [category]
}
System.out.println("done."); // depends on control dependency: [try], data = [none]
System.exit(0); // depends on control dependency: [try], data = [none]
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get suggested categories: " + te.getMessage());
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void execute() {
checkParameters();
if (loadCommandOptions.data != null) {
if (loadCommandOptions.loaderParams.containsKey("mongodb-index-folder")) {
configuration.getDatabases().getMongodb().getOptions().put("mongodb-index-folder",
loadCommandOptions.loaderParams.get("mongodb-index-folder"));
}
// If 'authenticationDatabase' is not passed by argument then we read it from configuration.json
if (loadCommandOptions.loaderParams.containsKey("authenticationDatabase")) {
configuration.getDatabases().getMongodb().getOptions().put("authenticationDatabase",
loadCommandOptions.loaderParams.get("authenticationDatabase"));
}
// loadRunner = new LoadRunner(loader, database, loadCommandOptions.loaderParams, numThreads, configuration);
loadRunner = new LoadRunner(loader, database, numThreads, configuration);
String[] loadOptions;
if (loadCommandOptions.data.equals("all")) {
loadOptions = new String[]{EtlCommons.GENOME_DATA, EtlCommons.GENE_DATA, EtlCommons.CONSERVATION_DATA,
EtlCommons.REGULATION_DATA, EtlCommons.PROTEIN_DATA, EtlCommons.PPI_DATA,
EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA, EtlCommons.VARIATION_DATA,
EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA, EtlCommons.CLINICAL_VARIANTS_DATA,
EtlCommons.REPEATS_DATA, EtlCommons.STRUCTURAL_VARIANTS_DATA, };
} else {
loadOptions = loadCommandOptions.data.split(",");
}
for (int i = 0; i < loadOptions.length; i++) {
String loadOption = loadOptions[i];
try {
switch (loadOption) {
case EtlCommons.GENOME_DATA:
loadIfExists(input.resolve("genome_info.json"), "genome_info");
loadIfExists(input.resolve("genome_sequence.json.gz"), "genome_sequence");
loadIfExists(input.resolve("genomeVersion.json"), METADATA);
loadRunner.index("genome_sequence");
break;
case EtlCommons.GENE_DATA:
loadIfExists(input.resolve("gene.json.gz"), "gene");
loadIfExists(input.resolve("dgidbVersion.json"), METADATA);
loadIfExists(input.resolve("ensemblCoreVersion.json"), METADATA);
loadIfExists(input.resolve("uniprotXrefVersion.json"), METADATA);
loadIfExists(input.resolve("geneExpressionAtlasVersion.json"), METADATA);
loadIfExists(input.resolve("hpoVersion.json"), METADATA);
loadIfExists(input.resolve("disgenetVersion.json"), METADATA);
loadRunner.index("gene");
break;
case EtlCommons.VARIATION_DATA:
loadVariationData();
break;
case EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA:
loadIfExists(input.resolve("cadd.json.gz"), "cadd");
loadIfExists(input.resolve("caddVersion.json"), METADATA);
loadRunner.index("variation_functional_score");
break;
case EtlCommons.CONSERVATION_DATA:
loadConservation();
break;
case EtlCommons.REGULATION_DATA:
loadIfExists(input.resolve("regulatory_region.json.gz"), "regulatory_region");
loadIfExists(input.resolve("ensemblRegulationVersion.json"), METADATA);
loadIfExists(input.resolve("mirbaseVersion.json"), METADATA);
loadIfExists(input.resolve("targetScanVersion.json"), METADATA);
loadIfExists(input.resolve("miRTarBaseVersion.json"), METADATA);
loadRunner.index("regulatory_region");
break;
case EtlCommons.PROTEIN_DATA:
loadIfExists(input.resolve("protein.json.gz"), "protein");
loadIfExists(input.resolve("uniprotVersion.json"), METADATA);
loadIfExists(input.resolve("interproVersion.json"), METADATA);
loadRunner.index("protein");
break;
case EtlCommons.PPI_DATA:
loadIfExists(input.resolve("protein_protein_interaction.json.gz"), "protein_protein_interaction");
loadIfExists(input.resolve("intactVersion.json"), METADATA);
loadRunner.index("protein_protein_interaction");
break;
case EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA:
loadProteinFunctionalPrediction();
break;
case EtlCommons.CLINICAL_VARIANTS_DATA:
loadClinical();
break;
case EtlCommons.REPEATS_DATA:
loadRepeats();
break;
case EtlCommons.STRUCTURAL_VARIANTS_DATA:
loadStructuralVariants();
break;
default:
logger.warn("Not valid 'data'. We should not reach this point");
break;
}
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | ExecutionException
| NoSuchMethodException | InterruptedException | ClassNotFoundException | LoaderException | IOException e) {
e.printStackTrace();
}
}
}
} } | public class class_name {
public void execute() {
checkParameters();
if (loadCommandOptions.data != null) {
if (loadCommandOptions.loaderParams.containsKey("mongodb-index-folder")) {
configuration.getDatabases().getMongodb().getOptions().put("mongodb-index-folder",
loadCommandOptions.loaderParams.get("mongodb-index-folder")); // depends on control dependency: [if], data = [none]
}
// If 'authenticationDatabase' is not passed by argument then we read it from configuration.json
if (loadCommandOptions.loaderParams.containsKey("authenticationDatabase")) {
configuration.getDatabases().getMongodb().getOptions().put("authenticationDatabase",
loadCommandOptions.loaderParams.get("authenticationDatabase")); // depends on control dependency: [if], data = [none]
}
// loadRunner = new LoadRunner(loader, database, loadCommandOptions.loaderParams, numThreads, configuration);
loadRunner = new LoadRunner(loader, database, numThreads, configuration);
String[] loadOptions;
if (loadCommandOptions.data.equals("all")) {
loadOptions = new String[]{EtlCommons.GENOME_DATA, EtlCommons.GENE_DATA, EtlCommons.CONSERVATION_DATA,
EtlCommons.REGULATION_DATA, EtlCommons.PROTEIN_DATA, EtlCommons.PPI_DATA,
EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA, EtlCommons.VARIATION_DATA,
EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA, EtlCommons.CLINICAL_VARIANTS_DATA,
EtlCommons.REPEATS_DATA, EtlCommons.STRUCTURAL_VARIANTS_DATA, }; // depends on control dependency: [if], data = [none]
} else {
loadOptions = loadCommandOptions.data.split(","); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < loadOptions.length; i++) {
String loadOption = loadOptions[i];
try {
switch (loadOption) {
case EtlCommons.GENOME_DATA:
loadIfExists(input.resolve("genome_info.json"), "genome_info");
loadIfExists(input.resolve("genome_sequence.json.gz"), "genome_sequence");
loadIfExists(input.resolve("genomeVersion.json"), METADATA);
loadRunner.index("genome_sequence");
break;
case EtlCommons.GENE_DATA:
loadIfExists(input.resolve("gene.json.gz"), "gene");
loadIfExists(input.resolve("dgidbVersion.json"), METADATA);
loadIfExists(input.resolve("ensemblCoreVersion.json"), METADATA);
loadIfExists(input.resolve("uniprotXrefVersion.json"), METADATA);
loadIfExists(input.resolve("geneExpressionAtlasVersion.json"), METADATA);
loadIfExists(input.resolve("hpoVersion.json"), METADATA);
loadIfExists(input.resolve("disgenetVersion.json"), METADATA);
loadRunner.index("gene");
break;
case EtlCommons.VARIATION_DATA:
loadVariationData();
break;
case EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA:
loadIfExists(input.resolve("cadd.json.gz"), "cadd");
loadIfExists(input.resolve("caddVersion.json"), METADATA);
loadRunner.index("variation_functional_score");
break;
case EtlCommons.CONSERVATION_DATA:
loadConservation();
break;
case EtlCommons.REGULATION_DATA:
loadIfExists(input.resolve("regulatory_region.json.gz"), "regulatory_region");
loadIfExists(input.resolve("ensemblRegulationVersion.json"), METADATA);
loadIfExists(input.resolve("mirbaseVersion.json"), METADATA);
loadIfExists(input.resolve("targetScanVersion.json"), METADATA);
loadIfExists(input.resolve("miRTarBaseVersion.json"), METADATA);
loadRunner.index("regulatory_region");
break;
case EtlCommons.PROTEIN_DATA:
loadIfExists(input.resolve("protein.json.gz"), "protein");
loadIfExists(input.resolve("uniprotVersion.json"), METADATA);
loadIfExists(input.resolve("interproVersion.json"), METADATA);
loadRunner.index("protein");
break;
case EtlCommons.PPI_DATA:
loadIfExists(input.resolve("protein_protein_interaction.json.gz"), "protein_protein_interaction");
loadIfExists(input.resolve("intactVersion.json"), METADATA);
loadRunner.index("protein_protein_interaction");
break;
case EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA:
loadProteinFunctionalPrediction();
break;
case EtlCommons.CLINICAL_VARIANTS_DATA:
loadClinical();
break;
case EtlCommons.REPEATS_DATA:
loadRepeats();
break;
case EtlCommons.STRUCTURAL_VARIANTS_DATA:
loadStructuralVariants();
break;
default:
logger.warn("Not valid 'data'. We should not reach this point");
break;
}
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | ExecutionException
| NoSuchMethodException | InterruptedException | ClassNotFoundException | LoaderException | IOException e) {
e.printStackTrace();
}
}
}
} } |
public class class_name {
protected void connectToJMS(String clientId) throws MessagingException {
// Check to see if already connected
//
if (connected == true) return;
try {
// Get a JMS Connection
//
connection = getConnection();
if(clientId != null) {
connection.setClientID(clientId);
}
connection.start();
connected = true;
logger.debug("connectToJMS - connected");
} catch (JMSException e) {
connected = false;
logger.error("JMSManager.connectToJMS - Exception occurred:");
throw new MessagingException(e.getMessage(), e);
}
} } | public class class_name {
protected void connectToJMS(String clientId) throws MessagingException {
// Check to see if already connected
//
if (connected == true) return;
try {
// Get a JMS Connection
//
connection = getConnection();
if(clientId != null) {
connection.setClientID(clientId); // depends on control dependency: [if], data = [(clientId]
}
connection.start();
connected = true;
logger.debug("connectToJMS - connected");
} catch (JMSException e) {
connected = false;
logger.error("JMSManager.connectToJMS - Exception occurred:");
throw new MessagingException(e.getMessage(), e);
}
} } |
public class class_name {
public static ColorStateList getColorStateList(Resources resources, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return resources.getColorStateList(id, null);
} else {
return resources.getColorStateList(id);
}
} } | public class class_name {
public static ColorStateList getColorStateList(Resources resources, int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return resources.getColorStateList(id, null); // depends on control dependency: [if], data = [none]
} else {
return resources.getColorStateList(id); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Header convert(XBELHeader source) {
if (source == null) return null;
String name = source.getName();
String description = source.getDescription();
String version = source.getVersion();
// Destination type
Header dest = new Header(name, description, version);
if (source.isSetAuthorGroup()) {
List<String> author = source.getAuthorGroup().getAuthor();
dest.setAuthors(author);
}
if (source.isSetLicenseGroup()) {
List<String> license = source.getLicenseGroup().getLicense();
dest.setLicenses(license);
}
String copyright = source.getCopyright();
dest.setCopyright(copyright);
String disclaimer = source.getDisclaimer();
dest.setDisclaimer(disclaimer);
String contactInfo = source.getContactInfo();
dest.setContactInfo(contactInfo);
return dest;
} } | public class class_name {
@Override
public Header convert(XBELHeader source) {
if (source == null) return null;
String name = source.getName();
String description = source.getDescription();
String version = source.getVersion();
// Destination type
Header dest = new Header(name, description, version);
if (source.isSetAuthorGroup()) {
List<String> author = source.getAuthorGroup().getAuthor();
dest.setAuthors(author); // depends on control dependency: [if], data = [none]
}
if (source.isSetLicenseGroup()) {
List<String> license = source.getLicenseGroup().getLicense();
dest.setLicenses(license); // depends on control dependency: [if], data = [none]
}
String copyright = source.getCopyright();
dest.setCopyright(copyright);
String disclaimer = source.getDisclaimer();
dest.setDisclaimer(disclaimer);
String contactInfo = source.getContactInfo();
dest.setContactInfo(contactInfo);
return dest;
} } |
public class class_name {
private void log(int level, String message, Throwable t) {
if (!isLevelEnabled(level)) {
return;
}
StringBuilder buf = new StringBuilder(32);
// Append date-time if so configured
if (CONFIG_PARAMS.showDateTime) {
if (CONFIG_PARAMS.dateFormatter != null) {
buf.append(getFormattedDate());
buf.append(' ');
} else {
buf.append(System.currentTimeMillis() - START_TIME);
buf.append(' ');
}
}
// Append current thread name if so configured
if (CONFIG_PARAMS.showThreadName) {
buf.append('[');
buf.append(Thread.currentThread().getName());
buf.append("] ");
}
if (CONFIG_PARAMS.levelInBrackets)
buf.append('[');
// Append a readable representation of the log level
String levelStr = renderLevel(level);
buf.append(levelStr);
if (CONFIG_PARAMS.levelInBrackets)
buf.append(']');
buf.append(' ');
// Append the name of the log instance if so configured
if (CONFIG_PARAMS.showShortLogName) {
if (shortLogName == null)
shortLogName = computeShortName();
buf.append(String.valueOf(shortLogName)).append(" - ");
} else if (CONFIG_PARAMS.showLogName) {
buf.append(String.valueOf(name)).append(" - ");
}
// Append the message
buf.append(message);
write(buf, t);
} } | public class class_name {
private void log(int level, String message, Throwable t) {
if (!isLevelEnabled(level)) {
return; // depends on control dependency: [if], data = [none]
}
StringBuilder buf = new StringBuilder(32);
// Append date-time if so configured
if (CONFIG_PARAMS.showDateTime) {
if (CONFIG_PARAMS.dateFormatter != null) {
buf.append(getFormattedDate()); // depends on control dependency: [if], data = [none]
buf.append(' '); // depends on control dependency: [if], data = [none]
} else {
buf.append(System.currentTimeMillis() - START_TIME); // depends on control dependency: [if], data = [none]
buf.append(' '); // depends on control dependency: [if], data = [none]
}
}
// Append current thread name if so configured
if (CONFIG_PARAMS.showThreadName) {
buf.append('['); // depends on control dependency: [if], data = [none]
buf.append(Thread.currentThread().getName()); // depends on control dependency: [if], data = [none]
buf.append("] "); // depends on control dependency: [if], data = [none]
}
if (CONFIG_PARAMS.levelInBrackets)
buf.append('[');
// Append a readable representation of the log level
String levelStr = renderLevel(level);
buf.append(levelStr);
if (CONFIG_PARAMS.levelInBrackets)
buf.append(']');
buf.append(' ');
// Append the name of the log instance if so configured
if (CONFIG_PARAMS.showShortLogName) {
if (shortLogName == null)
shortLogName = computeShortName();
buf.append(String.valueOf(shortLogName)).append(" - "); // depends on control dependency: [if], data = [none]
} else if (CONFIG_PARAMS.showLogName) {
buf.append(String.valueOf(name)).append(" - "); // depends on control dependency: [if], data = [none]
}
// Append the message
buf.append(message);
write(buf, t);
} } |
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final String[] components = model.split(this.regexp);
boolean result = true;
for (final String component : components) {
result &= this.other.validate(problems, compName, component);
}
return result;
} } | public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
final String[] components = model.split(this.regexp);
boolean result = true;
for (final String component : components) {
result &= this.other.validate(problems, compName, component); // depends on control dependency: [for], data = [component]
}
return result;
} } |
public class class_name {
@Override
public Object[] getParameters() {
final Object[] result = new Object[data.size()];
for (int i = 0; i < data.size(); i++) {
result[i] = data.getValueAt(i);
}
return result;
} } | public class class_name {
@Override
public Object[] getParameters() {
final Object[] result = new Object[data.size()];
for (int i = 0; i < data.size(); i++) {
result[i] = data.getValueAt(i); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public void marshall(VpcConfigRequest vpcConfigRequest, ProtocolMarshaller protocolMarshaller) {
if (vpcConfigRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(vpcConfigRequest.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(vpcConfigRequest.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);
protocolMarshaller.marshall(vpcConfigRequest.getEndpointPublicAccess(), ENDPOINTPUBLICACCESS_BINDING);
protocolMarshaller.marshall(vpcConfigRequest.getEndpointPrivateAccess(), ENDPOINTPRIVATEACCESS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(VpcConfigRequest vpcConfigRequest, ProtocolMarshaller protocolMarshaller) {
if (vpcConfigRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(vpcConfigRequest.getSubnetIds(), SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(vpcConfigRequest.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(vpcConfigRequest.getEndpointPublicAccess(), ENDPOINTPUBLICACCESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(vpcConfigRequest.getEndpointPrivateAccess(), ENDPOINTPRIVATEACCESS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double getLPNormP(AbstractMaterializeKNNPreprocessor<?> kNN) {
DistanceFunction<?> distanceFunction = kNN.getDistanceQuery().getDistanceFunction();
if(LPNormDistanceFunction.class.isInstance(distanceFunction)) {
return ((LPNormDistanceFunction) distanceFunction).getP();
}
return Double.NaN;
} } | public class class_name {
public static double getLPNormP(AbstractMaterializeKNNPreprocessor<?> kNN) {
DistanceFunction<?> distanceFunction = kNN.getDistanceQuery().getDistanceFunction();
if(LPNormDistanceFunction.class.isInstance(distanceFunction)) {
return ((LPNormDistanceFunction) distanceFunction).getP(); // depends on control dependency: [if], data = [none]
}
return Double.NaN;
} } |
public class class_name {
public static boolean compareSignatures(final Method first, final Method second) {
if (!first.getName().equals(second.getName())) {
return false;
}
return compareParameters(first.getParameterTypes(), second.getParameterTypes());
} } | public class class_name {
public static boolean compareSignatures(final Method first, final Method second) {
if (!first.getName().equals(second.getName())) {
return false; // depends on control dependency: [if], data = [none]
}
return compareParameters(first.getParameterTypes(), second.getParameterTypes());
} } |
public class class_name {
public Field[] getFields(Class clazz, String fieldname) {
Struct fieldMap;
Object o;
synchronized (map) {
o = map.get(clazz);
if (o == null) {
fieldMap = store(clazz);
}
else fieldMap = (Struct) o;
}
o = fieldMap.get(fieldname, null);
if (o == null) return null;
return (Field[]) o;
} } | public class class_name {
public Field[] getFields(Class clazz, String fieldname) {
Struct fieldMap;
Object o;
synchronized (map) {
o = map.get(clazz);
if (o == null) {
fieldMap = store(clazz); // depends on control dependency: [if], data = [none]
}
else fieldMap = (Struct) o;
}
o = fieldMap.get(fieldname, null);
if (o == null) return null;
return (Field[]) o;
} } |
public class class_name {
@SafeVarargs
public final DataStream<T> union(DataStream<T>... streams) {
List<StreamTransformation<T>> unionedTransforms = new ArrayList<>();
unionedTransforms.add(this.transformation);
for (DataStream<T> newStream : streams) {
if (!getType().equals(newStream.getType())) {
throw new IllegalArgumentException("Cannot union streams of different types: "
+ getType() + " and " + newStream.getType());
}
unionedTransforms.add(newStream.getTransformation());
}
return new DataStream<>(this.environment, new UnionTransformation<>(unionedTransforms));
} } | public class class_name {
@SafeVarargs
public final DataStream<T> union(DataStream<T>... streams) {
List<StreamTransformation<T>> unionedTransforms = new ArrayList<>();
unionedTransforms.add(this.transformation);
for (DataStream<T> newStream : streams) {
if (!getType().equals(newStream.getType())) {
throw new IllegalArgumentException("Cannot union streams of different types: "
+ getType() + " and " + newStream.getType());
}
unionedTransforms.add(newStream.getTransformation()); // depends on control dependency: [for], data = [newStream]
}
return new DataStream<>(this.environment, new UnionTransformation<>(unionedTransforms));
} } |
public class class_name {
public static <CL extends ClassUml> void arrangeClassDiagram(List<ClassFull<CL>> classList,
SettingsGraphicUml gp, int algorithmId) {
//1. Find out set of 0-level super-classes, i.e. they has no super-classes.
// All other classes level is settled to 999:
List<ClassFull<CL>> topLevelSuperClasses = new ArrayList<ClassFull<CL>>();
double levelX = 0;
double fakeLevel = -999d;
for(ClassFull<CL> clsRel : classList) {
clsRel.getShape().setIsPrepared(false);
clsRel.getShape().setLevelXOnDiagram(fakeLevel);
clsRel.getShape().setLevelYOnDiagram(fakeLevel);
}
for(ClassFull<CL> clsRel : classList) {
int relationCountAsSuperclass = 0;
for(ClassRelationFull<CL> classRelation : clsRel.getRelationshipsBinary()) {
if(classRelation.getClassRelationship().getEndType() == ERelationshipEndType.END &&
(classRelation.getRelationship().getItsKind() == ERelationshipKind.GENERALIZATION ||
classRelation.getRelationship().getItsKind() == ERelationshipKind.REALIZATION ||
classRelation.getRelationship().getItsKind() == ERelationshipKind.INTERFACE_REALIZATION)) {
relationCountAsSuperclass++;
}
}
if(relationCountAsSuperclass == clsRel.getRelationshipsBinary().size()) {//there is only subclasses
clsRel.getShape().setIsPrepared(true);
clsRel.getShape().setLevelXOnDiagram(levelX++);
clsRel.getShape().setLevelYOnDiagram(0d);
topLevelSuperClasses.add(clsRel);
}
}
//2. For each of 0-level(Y) class go through its sub-classes to last-level sub-class and evaluate count of levels(Y).
// In this phase also conduct level of classes that has no extends|implements relations
Double countLevelY = 1d;
for(ClassFull<CL> clsRel : topLevelSuperClasses) {
countLevelY = Math.max(countLevelY, calculateUmlClassRelationsLevels(clsRel, classList));
}
//correction:
levelX = 0;
setIsPreparedForClasses(classList, false);
for(ClassFull<CL> clsRel : classList) {
boolean isWhereFake = false;
if(clsRel.getShape().getLevelXOnDiagram().equals(fakeLevel)) {
clsRel.getShape().setLevelXOnDiagram(levelX++);
isWhereFake = true;
}
if(clsRel.getShape().getLevelYOnDiagram().equals(fakeLevel)) {
clsRel.getShape().setLevelYOnDiagram(countLevelY);
isWhereFake = true;
}
if(isWhereFake) {
countLevelY = Math.max(countLevelY, calculateUmlClassRelationsLevels(clsRel, classList));
}
}
//3. Sort classes according levelX-levelY, then go through them and set its startPoint:
Collections.sort(classList, new ComparatorClassFullLevel<CL>());
//location parameters:
double[] bottomOfLevelY = new double[countLevelY.intValue()];
double[] rightOfLevelY = new double[countLevelY.intValue()];
double[] countClassOnLevelY = new double[countLevelY.intValue()];
//a: first cycle arrange and remember location parameters
ClassFull<CL> prevCre = null;
double x;
double y;
for(ClassFull<CL> clsRel : classList) {
if(prevCre == null) {
x = y = gp.getMarginDiagram();
}
else {
if(clsRel.getShape().getLevelYOnDiagram().equals(prevCre.getShape().getLevelYOnDiagram())) {
if(!clsRel.getShape().getLevelXOnDiagram().equals(prevCre.getShape().getLevelXOnDiagram())) {
x = prevCre.getShape().getPointStart().getX() + prevCre.getShape().getWidth() + gp.getGapDiagram();
}
else {//e.g. more than two associations
x = prevCre.getShape().getPointStart().getX();
}
}
else {
x = gp.getMarginDiagram();
}
if(prevCre != null && clsRel.getShape().getLevelYOnDiagram().equals(prevCre.getShape().getLevelYOnDiagram())
&& clsRel.getShape().getLevelXOnDiagram().equals(prevCre.getShape().getLevelXOnDiagram())) {//e.g. more than two associations
y = prevCre.getShape().getPointStart().getY() + prevCre.getShape().getHeight() + gp.getGapDiagram()/2;
}
else if(clsRel.getShape().getLevelYOnDiagram().intValue() == 0) {
y = gp.getMarginDiagram();
}
else {
y = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue() - 1] + gp.getGapDiagram();
}
}
clsRel.getShape().getPointStart().setX(x);
clsRel.getShape().getPointStart().setY(y);
evalJointPoints(clsRel);
prevCre = clsRel;
bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] = Math.max
(bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()], y + clsRel.getShape().getHeight());
rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] = Math.max
(rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()], x +clsRel.getShape().getWidth());
countClassOnLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()]++;
}
//b: second cycle adjust position according location parameters
double maxX = 0;
double levelYwithMaxX = 0;
for(int i=0; i<rightOfLevelY.length; i++) {
if(maxX < rightOfLevelY[i]) {
maxX = rightOfLevelY[i];
levelYwithMaxX = i;
}
}
for(ClassFull<CL> clsRel : classList) {
if(clsRel.getShape().getLevelYOnDiagram().intValue() == 0) {
//Adjust y to be in the bottom of first row:
y = clsRel.getShape().getPointStart().getY();
double rowHeight = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] - y;
y = y + rowHeight - clsRel.getShape().getHeight();
clsRel.getShape().getPointStart().setY(y);
}
else if (clsRel.getShape().getLevelYOnDiagram().intValue() != bottomOfLevelY.length - 1) {
//Adjust y to be in the middle of its row:
y = clsRel.getShape().getPointStart().getY();
double rowHeight = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] - y;
y = y + (rowHeight - clsRel.getShape().getHeight()) / 2;
clsRel.getShape().getPointStart().setY(y);
}
if(clsRel.getShape().getLevelYOnDiagram() != levelYwithMaxX) {
//Adjust x to be row center
double lenthToAdjust = (maxX - rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()])/2;
clsRel.getShape().getPointStart().setX(clsRel.getShape().getPointStart().getX() + lenthToAdjust);
}
evalJointPoints(clsRel);
}
//4 Adjust relations joint points:
setIsPreparedForClasses(classList, false);
adjustRelationPointsSideAndToCenter(gp, classList);
setIsPreparedForClasses(classList, false);
for(ClassFull<CL> clsRel : classList) {
readjustRelationPoints(gp, clsRel);
}
setIsPreparedForClasses(classList, false);
} } | public class class_name {
public static <CL extends ClassUml> void arrangeClassDiagram(List<ClassFull<CL>> classList,
SettingsGraphicUml gp, int algorithmId) {
//1. Find out set of 0-level super-classes, i.e. they has no super-classes.
// All other classes level is settled to 999:
List<ClassFull<CL>> topLevelSuperClasses = new ArrayList<ClassFull<CL>>();
double levelX = 0;
double fakeLevel = -999d;
for(ClassFull<CL> clsRel : classList) {
clsRel.getShape().setIsPrepared(false); // depends on control dependency: [for], data = [clsRel]
clsRel.getShape().setLevelXOnDiagram(fakeLevel); // depends on control dependency: [for], data = [clsRel]
clsRel.getShape().setLevelYOnDiagram(fakeLevel); // depends on control dependency: [for], data = [clsRel]
}
for(ClassFull<CL> clsRel : classList) {
int relationCountAsSuperclass = 0;
for(ClassRelationFull<CL> classRelation : clsRel.getRelationshipsBinary()) {
if(classRelation.getClassRelationship().getEndType() == ERelationshipEndType.END &&
(classRelation.getRelationship().getItsKind() == ERelationshipKind.GENERALIZATION ||
classRelation.getRelationship().getItsKind() == ERelationshipKind.REALIZATION ||
classRelation.getRelationship().getItsKind() == ERelationshipKind.INTERFACE_REALIZATION)) {
relationCountAsSuperclass++; // depends on control dependency: [if], data = [none]
}
}
if(relationCountAsSuperclass == clsRel.getRelationshipsBinary().size()) {//there is only subclasses
clsRel.getShape().setIsPrepared(true); // depends on control dependency: [if], data = [none]
clsRel.getShape().setLevelXOnDiagram(levelX++); // depends on control dependency: [if], data = [none]
clsRel.getShape().setLevelYOnDiagram(0d); // depends on control dependency: [if], data = [none]
topLevelSuperClasses.add(clsRel); // depends on control dependency: [if], data = [none]
}
}
//2. For each of 0-level(Y) class go through its sub-classes to last-level sub-class and evaluate count of levels(Y).
// In this phase also conduct level of classes that has no extends|implements relations
Double countLevelY = 1d;
for(ClassFull<CL> clsRel : topLevelSuperClasses) {
countLevelY = Math.max(countLevelY, calculateUmlClassRelationsLevels(clsRel, classList)); // depends on control dependency: [for], data = [clsRel]
}
//correction:
levelX = 0;
setIsPreparedForClasses(classList, false);
for(ClassFull<CL> clsRel : classList) {
boolean isWhereFake = false;
if(clsRel.getShape().getLevelXOnDiagram().equals(fakeLevel)) {
clsRel.getShape().setLevelXOnDiagram(levelX++); // depends on control dependency: [if], data = [none]
isWhereFake = true; // depends on control dependency: [if], data = [none]
}
if(clsRel.getShape().getLevelYOnDiagram().equals(fakeLevel)) {
clsRel.getShape().setLevelYOnDiagram(countLevelY); // depends on control dependency: [if], data = [none]
isWhereFake = true; // depends on control dependency: [if], data = [none]
}
if(isWhereFake) {
countLevelY = Math.max(countLevelY, calculateUmlClassRelationsLevels(clsRel, classList)); // depends on control dependency: [if], data = [none]
}
}
//3. Sort classes according levelX-levelY, then go through them and set its startPoint:
Collections.sort(classList, new ComparatorClassFullLevel<CL>());
//location parameters:
double[] bottomOfLevelY = new double[countLevelY.intValue()];
double[] rightOfLevelY = new double[countLevelY.intValue()];
double[] countClassOnLevelY = new double[countLevelY.intValue()];
//a: first cycle arrange and remember location parameters
ClassFull<CL> prevCre = null;
double x;
double y;
for(ClassFull<CL> clsRel : classList) {
if(prevCre == null) {
x = y = gp.getMarginDiagram(); // depends on control dependency: [if], data = [none]
}
else {
if(clsRel.getShape().getLevelYOnDiagram().equals(prevCre.getShape().getLevelYOnDiagram())) {
if(!clsRel.getShape().getLevelXOnDiagram().equals(prevCre.getShape().getLevelXOnDiagram())) {
x = prevCre.getShape().getPointStart().getX() + prevCre.getShape().getWidth() + gp.getGapDiagram(); // depends on control dependency: [if], data = [none]
}
else {//e.g. more than two associations
x = prevCre.getShape().getPointStart().getX(); // depends on control dependency: [if], data = [none]
}
}
else {
x = gp.getMarginDiagram(); // depends on control dependency: [if], data = [none]
}
if(prevCre != null && clsRel.getShape().getLevelYOnDiagram().equals(prevCre.getShape().getLevelYOnDiagram())
&& clsRel.getShape().getLevelXOnDiagram().equals(prevCre.getShape().getLevelXOnDiagram())) {//e.g. more than two associations
y = prevCre.getShape().getPointStart().getY() + prevCre.getShape().getHeight() + gp.getGapDiagram()/2; // depends on control dependency: [if], data = [none]
}
else if(clsRel.getShape().getLevelYOnDiagram().intValue() == 0) {
y = gp.getMarginDiagram(); // depends on control dependency: [if], data = [none]
}
else {
y = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue() - 1] + gp.getGapDiagram(); // depends on control dependency: [if], data = [none]
}
}
clsRel.getShape().getPointStart().setX(x); // depends on control dependency: [for], data = [clsRel]
clsRel.getShape().getPointStart().setY(y); // depends on control dependency: [for], data = [clsRel]
evalJointPoints(clsRel); // depends on control dependency: [for], data = [clsRel]
prevCre = clsRel; // depends on control dependency: [for], data = [clsRel]
bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] = Math.max
(bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()], y + clsRel.getShape().getHeight()); // depends on control dependency: [for], data = [clsRel]
rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] = Math.max
(rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()], x +clsRel.getShape().getWidth()); // depends on control dependency: [for], data = [clsRel]
countClassOnLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()]++; // depends on control dependency: [for], data = [clsRel]
}
//b: second cycle adjust position according location parameters
double maxX = 0;
double levelYwithMaxX = 0;
for(int i=0; i<rightOfLevelY.length; i++) {
if(maxX < rightOfLevelY[i]) {
maxX = rightOfLevelY[i]; // depends on control dependency: [if], data = [none]
levelYwithMaxX = i; // depends on control dependency: [if], data = [none]
}
}
for(ClassFull<CL> clsRel : classList) {
if(clsRel.getShape().getLevelYOnDiagram().intValue() == 0) {
//Adjust y to be in the bottom of first row:
y = clsRel.getShape().getPointStart().getY(); // depends on control dependency: [if], data = [none]
double rowHeight = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] - y;
y = y + rowHeight - clsRel.getShape().getHeight(); // depends on control dependency: [if], data = [none]
clsRel.getShape().getPointStart().setY(y); // depends on control dependency: [if], data = [none]
}
else if (clsRel.getShape().getLevelYOnDiagram().intValue() != bottomOfLevelY.length - 1) {
//Adjust y to be in the middle of its row:
y = clsRel.getShape().getPointStart().getY(); // depends on control dependency: [if], data = [none]
double rowHeight = bottomOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()] - y;
y = y + (rowHeight - clsRel.getShape().getHeight()) / 2; // depends on control dependency: [if], data = [none]
clsRel.getShape().getPointStart().setY(y); // depends on control dependency: [if], data = [none]
}
if(clsRel.getShape().getLevelYOnDiagram() != levelYwithMaxX) {
//Adjust x to be row center
double lenthToAdjust = (maxX - rightOfLevelY[clsRel.getShape().getLevelYOnDiagram().intValue()])/2;
clsRel.getShape().getPointStart().setX(clsRel.getShape().getPointStart().getX() + lenthToAdjust); // depends on control dependency: [if], data = [none]
}
evalJointPoints(clsRel); // depends on control dependency: [for], data = [clsRel]
}
//4 Adjust relations joint points:
setIsPreparedForClasses(classList, false);
adjustRelationPointsSideAndToCenter(gp, classList);
setIsPreparedForClasses(classList, false);
for(ClassFull<CL> clsRel : classList) {
readjustRelationPoints(gp, clsRel); // depends on control dependency: [for], data = [clsRel]
}
setIsPreparedForClasses(classList, false);
} } |
public class class_name {
public BigMoney minus(BigDecimal amountToSubtract) {
MoneyUtils.checkNotNull(amountToSubtract, "Amount must not be null");
if (amountToSubtract.compareTo(BigDecimal.ZERO) == 0) {
return this;
}
BigDecimal newAmount = amount.subtract(amountToSubtract);
return BigMoney.of(currency, newAmount);
} } | public class class_name {
public BigMoney minus(BigDecimal amountToSubtract) {
MoneyUtils.checkNotNull(amountToSubtract, "Amount must not be null");
if (amountToSubtract.compareTo(BigDecimal.ZERO) == 0) {
return this;
// depends on control dependency: [if], data = [none]
}
BigDecimal newAmount = amount.subtract(amountToSubtract);
return BigMoney.of(currency, newAmount);
} } |
public class class_name {
protected String getFedoraResourceURI(String res) {
// strip off info URI part if present
String strippedRes;
if (res.startsWith(Constants.FEDORA.uri)) {
strippedRes = res.substring(Constants.FEDORA.uri.length());
} else {
strippedRes = res;
}
// split into pid + datastream (if present), validate PID and then recombine datastream back in using URI form of PID
String parts[] = strippedRes.split("/");
PID pid;
try {
pid = new PID(parts[0]);
} catch (MalformedPIDException e1) {
logger.warn("Invalid Fedora resource identifier: {}. PID part of URI is malformed", res);
return null;
}
String resURI;
if (parts.length == 1) {
resURI = pid.toURI();
} else if (parts.length == 2) {
resURI = pid.toURI() + "/" + parts[1]; // add datastream ID back
} else {
logger.warn("Invalid Fedora resource identifier: {}. Should be pid or datastream (URI form optional", res);
return null;
}
return resURI;
} } | public class class_name {
protected String getFedoraResourceURI(String res) {
// strip off info URI part if present
String strippedRes;
if (res.startsWith(Constants.FEDORA.uri)) {
strippedRes = res.substring(Constants.FEDORA.uri.length()); // depends on control dependency: [if], data = [none]
} else {
strippedRes = res; // depends on control dependency: [if], data = [none]
}
// split into pid + datastream (if present), validate PID and then recombine datastream back in using URI form of PID
String parts[] = strippedRes.split("/");
PID pid;
try {
pid = new PID(parts[0]); // depends on control dependency: [try], data = [none]
} catch (MalformedPIDException e1) {
logger.warn("Invalid Fedora resource identifier: {}. PID part of URI is malformed", res);
return null;
} // depends on control dependency: [catch], data = [none]
String resURI;
if (parts.length == 1) {
resURI = pid.toURI(); // depends on control dependency: [if], data = [none]
} else if (parts.length == 2) {
resURI = pid.toURI() + "/" + parts[1]; // add datastream ID back // depends on control dependency: [if], data = [none]
} else {
logger.warn("Invalid Fedora resource identifier: {}. Should be pid or datastream (URI form optional", res); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return resURI;
} } |
public class class_name {
public void setLogPaths(java.util.Collection<String> logPaths) {
if (logPaths == null) {
this.logPaths = null;
return;
}
this.logPaths = new java.util.ArrayList<String>(logPaths);
} } | public class class_name {
public void setLogPaths(java.util.Collection<String> logPaths) {
if (logPaths == null) {
this.logPaths = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.logPaths = new java.util.ArrayList<String>(logPaths);
} } |
public class class_name {
public void setImageAssetDelegate(
@SuppressWarnings("NullableProblems") ImageAssetDelegate assetDelegate) {
this.imageAssetDelegate = assetDelegate;
if (imageAssetManager != null) {
imageAssetManager.setDelegate(assetDelegate);
}
} } | public class class_name {
public void setImageAssetDelegate(
@SuppressWarnings("NullableProblems") ImageAssetDelegate assetDelegate) {
this.imageAssetDelegate = assetDelegate;
if (imageAssetManager != null) {
imageAssetManager.setDelegate(assetDelegate); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void lookupDataSet(final DataSetLookup request,
final DataSetReadyCallback listener) throws Exception {
// Look always into the client data set manager.
if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {
DataSet dataSet = clientDataSetManager.lookupDataSet(request);
listener.callback(dataSet);
}
// If the data set is not in client, then look up remotely (only if the remote access is available).
else if (dataSetLookupServices != null) {
// First of all, get the target data set estimated size.
fetchMetadata(request.getDataSetUUID(),
new DataSetMetadataCallback() {
public void callback(DataSetMetadata metatada) {
// Push the data set to client if and only if the push feature is enabled, the data set is
// pushable & the data set is smaller than the max push size defined.
DataSetDef dsetDef = metatada.getDefinition();
int estimatedSize = metatada.getEstimatedSize() / 1000;
boolean isPushable = dsetDef != null && dsetDef.isPushEnabled() && estimatedSize < dsetDef.getPushMaxSize();
if (pushRemoteDataSetEnabled && isPushable) {
// Check if a push is already in progress.
// (This is necessary in order to avoid repeating multiple push requests over the same data set).
DataSetPushHandler pushHandler = pushRequestMap.get(request.getDataSetUUID());
if (pushHandler == null) {
// Create a push handler.
pushHandler = new DataSetPushHandler(metatada);
// Send the lookup request to the server...
DataSetLookup lookupSourceDataSet = new DataSetLookup(request.getDataSetUUID());
_lookupDataSet(lookupSourceDataSet,
pushHandler);
}
// Register the lookup request into the current handler.
pushHandler.registerLookup(request,
listener);
}
// Lookup the remote data set otherwise.
else {
_lookupDataSet(request,
listener);
}
}
// Data set metadata not found
public void notFound() {
listener.notFound();
}
@Override
public boolean onError(final ClientRuntimeError error) {
return listener.onError(error);
}
});
}
// Data set not found on client.
else {
listener.notFound();
}
} } | public class class_name {
public void lookupDataSet(final DataSetLookup request,
final DataSetReadyCallback listener) throws Exception {
// Look always into the client data set manager.
if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {
DataSet dataSet = clientDataSetManager.lookupDataSet(request);
listener.callback(dataSet);
}
// If the data set is not in client, then look up remotely (only if the remote access is available).
else if (dataSetLookupServices != null) {
// First of all, get the target data set estimated size.
fetchMetadata(request.getDataSetUUID(),
new DataSetMetadataCallback() {
public void callback(DataSetMetadata metatada) {
// Push the data set to client if and only if the push feature is enabled, the data set is
// pushable & the data set is smaller than the max push size defined.
DataSetDef dsetDef = metatada.getDefinition();
int estimatedSize = metatada.getEstimatedSize() / 1000;
boolean isPushable = dsetDef != null && dsetDef.isPushEnabled() && estimatedSize < dsetDef.getPushMaxSize();
if (pushRemoteDataSetEnabled && isPushable) {
// Check if a push is already in progress.
// (This is necessary in order to avoid repeating multiple push requests over the same data set).
DataSetPushHandler pushHandler = pushRequestMap.get(request.getDataSetUUID());
if (pushHandler == null) {
// Create a push handler.
pushHandler = new DataSetPushHandler(metatada); // depends on control dependency: [if], data = [none]
// Send the lookup request to the server...
DataSetLookup lookupSourceDataSet = new DataSetLookup(request.getDataSetUUID());
_lookupDataSet(lookupSourceDataSet,
pushHandler); // depends on control dependency: [if], data = [none]
}
// Register the lookup request into the current handler.
pushHandler.registerLookup(request,
listener); // depends on control dependency: [if], data = [none]
}
// Lookup the remote data set otherwise.
else {
_lookupDataSet(request,
listener); // depends on control dependency: [if], data = [none]
}
}
// Data set metadata not found
public void notFound() {
listener.notFound();
}
@Override
public boolean onError(final ClientRuntimeError error) {
return listener.onError(error);
}
});
}
// Data set not found on client.
else {
listener.notFound();
}
} } |
public class class_name {
public void trim() {
keys = Arrays.copyOf(keys, size);
values = Arrays.copyOf(values, size);
for (MappeableContainer c : values) {
c.trim();
}
} } | public class class_name {
public void trim() {
keys = Arrays.copyOf(keys, size);
values = Arrays.copyOf(values, size);
for (MappeableContainer c : values) {
c.trim(); // depends on control dependency: [for], data = [c]
}
} } |
public class class_name {
public static boolean matches(TieredIdentity.LocalityTier tier,
TieredIdentity.LocalityTier otherTier, boolean resolveIpAddress) {
String otherTierName = otherTier.getTierName();
if (!tier.getTierName().equals(otherTierName)) {
return false;
}
String otherTierValue = otherTier.getValue();
if (tier.getValue() != null && tier.getValue().equals(otherTierValue)) {
return true;
}
// For node tiers, attempt to resolve hostnames to IP addresses, this avoids common
// misconfiguration errors where a worker is using one hostname and the client is using
// another.
if (resolveIpAddress) {
if (Constants.LOCALITY_NODE.equals(tier.getTierName())) {
try {
String tierIpAddress = NetworkAddressUtils.resolveIpAddress(tier.getValue());
String otherTierIpAddress = NetworkAddressUtils.resolveIpAddress(otherTierValue);
if (tierIpAddress != null && tierIpAddress.equals(otherTierIpAddress)) {
return true;
}
} catch (UnknownHostException e) {
return false;
}
}
}
return false;
} } | public class class_name {
public static boolean matches(TieredIdentity.LocalityTier tier,
TieredIdentity.LocalityTier otherTier, boolean resolveIpAddress) {
String otherTierName = otherTier.getTierName();
if (!tier.getTierName().equals(otherTierName)) {
return false; // depends on control dependency: [if], data = [none]
}
String otherTierValue = otherTier.getValue();
if (tier.getValue() != null && tier.getValue().equals(otherTierValue)) {
return true; // depends on control dependency: [if], data = [none]
}
// For node tiers, attempt to resolve hostnames to IP addresses, this avoids common
// misconfiguration errors where a worker is using one hostname and the client is using
// another.
if (resolveIpAddress) {
if (Constants.LOCALITY_NODE.equals(tier.getTierName())) {
try {
String tierIpAddress = NetworkAddressUtils.resolveIpAddress(tier.getValue());
String otherTierIpAddress = NetworkAddressUtils.resolveIpAddress(otherTierValue);
if (tierIpAddress != null && tierIpAddress.equals(otherTierIpAddress)) {
return true; // depends on control dependency: [if], data = [none]
}
} catch (UnknownHostException e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
}
return false;
} } |
public class class_name {
public void start() throws ContextClientCodeException {
synchronized (this.contextStack) {
LOG.log(Level.FINEST, "Instantiating root context.");
this.contextStack.push(this.launchContext.get().getRootContext());
if (this.launchContext.get().getInitialTaskConfiguration().isPresent()) {
LOG.log(Level.FINEST, "Launching the initial Task");
try {
this.contextStack.peek().startTask(this.launchContext.get().getInitialTaskConfiguration().get());
} catch (final TaskClientCodeException e) {
this.handleTaskException(e);
}
}
}
} } | public class class_name {
public void start() throws ContextClientCodeException {
synchronized (this.contextStack) {
LOG.log(Level.FINEST, "Instantiating root context.");
this.contextStack.push(this.launchContext.get().getRootContext());
if (this.launchContext.get().getInitialTaskConfiguration().isPresent()) {
LOG.log(Level.FINEST, "Launching the initial Task"); // depends on control dependency: [if], data = [none]
try {
this.contextStack.peek().startTask(this.launchContext.get().getInitialTaskConfiguration().get()); // depends on control dependency: [try], data = [none]
} catch (final TaskClientCodeException e) {
this.handleTaskException(e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
protected static final int floatToS390IntBits(float ieeeFloat) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "floatToS390IntBits", ieeeFloat);
// Get the bit pattern
int ieeeIntBits = Float.floatToIntBits(ieeeFloat);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "IEEE bit pattern = " + Integer.toString(ieeeIntBits, 16));
// Test the sign bit (0 = positive, 1 = negative)
boolean positive = ((ieeeIntBits & FLOAT_SIGN_MASK) == 0);
// Deal with zero straight away...
if ((ieeeIntBits & 0x7fffffff) == 0) {
// + or - 0.0
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "zero");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "floatToS390IntBits", ieeeIntBits);
return ieeeIntBits;
}
// Extract the exponent
int exponent = ieeeIntBits & FLOAT_EXPONENT_MASK;
// shift right 23 bits to get exponent in least significant byte
exponent = exponent >>> 23;
// subtract the bias to get the true value
exponent = exponent - FLOAT_BIAS;
// Extract the mantissa
int mantissa = ieeeIntBits & FLOAT_MANTISSA_MASK;
// for an exponent greater than -FLOAT_BIAS, add in the implicit bit
if (exponent > (-FLOAT_BIAS)) {
mantissa = mantissa | FLOAT_MANTISSA_MSB_MASK;
}
// Now begin the conversion to S390
int remainder = Math.abs(exponent) % 4;
int quotient = Math.abs(exponent) / 4;
int s390Exponent = quotient;
if ((exponent > 0) && (remainder != 0)) {
s390Exponent = s390Exponent + 1;
}
// put the sign back in
if (exponent < 0) {
s390Exponent = -s390Exponent;
}
// Add the bias
s390Exponent += S390_FLOAT_BIAS;
// Now adjust the mantissa part
int s390Mantissa = mantissa;
if (remainder > 0) {
if (exponent > 0) {
// the next two lines perform the (m.2^(r-4)) part of the conversion
int shift_places = 4 - remainder;
s390Mantissa = s390Mantissa >>> shift_places;
}
else {
// to avoid loss of precision when the exponent is at a minimum,
// we may need to shift the mantissa four places left, and decrease the
// s390Exponent by one before shifting right
if ((exponent == - (FLOAT_BIAS)) && ((s390Mantissa & 0x00f00000) == 0)) {
s390Mantissa = s390Mantissa << 4;
s390Exponent = s390Exponent - 1;
}
// the next two line perform the (m.2^-r) part of the conversion
int shift_places = remainder;
s390Mantissa = s390Mantissa >>> shift_places;
}
}
// An exponent of -FLOAT_BIAS is the smallest that IEEE can do. S390 has
// a wider range, and hence may be able to normalise the mantissa more than
// is possible for IEEE
// Also, since an exponent of -FLOAT_BIAS has no implicit bit set, the mantissa
// starts with a value of 2^-1 at the second bit of the second byte. We thus need
// to shift one place left to move the mantissa to the S390 position
// Follwoing that, we notmalise as follows:
// Each shift left of four bits is equivalent to multiplying by 16,
// so the exponent must be reduced by 1
if (exponent == - (FLOAT_BIAS)) {
s390Mantissa = s390Mantissa << 1;
while ((s390Mantissa != 0) && ((s390Mantissa & 0x00f00000) == 0)) {
s390Mantissa = s390Mantissa << 4;
s390Exponent = s390Exponent - 1;
}
}
// Assemble the s390BitPattern
int s390Float = 0;
int s390ExponentBits = s390Exponent & 0x0000007F; // make sure we only deal with 7 bits
// add the exponent
s390Float = s390ExponentBits << 24; // shift to MSB
// add the sign
if (!positive) {
s390Float = s390Float | FLOAT_SIGN_MASK;
}
// add the mantissa
s390Float = s390Float | s390Mantissa;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "S390 Bit pattern = " + Integer.toString(s390Float, 16));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "floatToS390IntBits", s390Float);
return s390Float;
} } | public class class_name {
protected static final int floatToS390IntBits(float ieeeFloat) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "floatToS390IntBits", ieeeFloat);
// Get the bit pattern
int ieeeIntBits = Float.floatToIntBits(ieeeFloat);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "IEEE bit pattern = " + Integer.toString(ieeeIntBits, 16));
// Test the sign bit (0 = positive, 1 = negative)
boolean positive = ((ieeeIntBits & FLOAT_SIGN_MASK) == 0);
// Deal with zero straight away...
if ((ieeeIntBits & 0x7fffffff) == 0) {
// + or - 0.0
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "zero");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "floatToS390IntBits", ieeeIntBits);
return ieeeIntBits;
}
// Extract the exponent
int exponent = ieeeIntBits & FLOAT_EXPONENT_MASK;
// shift right 23 bits to get exponent in least significant byte
exponent = exponent >>> 23;
// subtract the bias to get the true value
exponent = exponent - FLOAT_BIAS;
// Extract the mantissa
int mantissa = ieeeIntBits & FLOAT_MANTISSA_MASK;
// for an exponent greater than -FLOAT_BIAS, add in the implicit bit
if (exponent > (-FLOAT_BIAS)) {
mantissa = mantissa | FLOAT_MANTISSA_MSB_MASK;
}
// Now begin the conversion to S390
int remainder = Math.abs(exponent) % 4;
int quotient = Math.abs(exponent) / 4;
int s390Exponent = quotient;
if ((exponent > 0) && (remainder != 0)) {
s390Exponent = s390Exponent + 1;
}
// put the sign back in
if (exponent < 0) {
s390Exponent = -s390Exponent;
}
// Add the bias
s390Exponent += S390_FLOAT_BIAS;
// Now adjust the mantissa part
int s390Mantissa = mantissa;
if (remainder > 0) {
if (exponent > 0) {
// the next two lines perform the (m.2^(r-4)) part of the conversion
int shift_places = 4 - remainder;
s390Mantissa = s390Mantissa >>> shift_places; // depends on control dependency: [if], data = [none]
}
else {
// to avoid loss of precision when the exponent is at a minimum,
// we may need to shift the mantissa four places left, and decrease the
// s390Exponent by one before shifting right
if ((exponent == - (FLOAT_BIAS)) && ((s390Mantissa & 0x00f00000) == 0)) {
s390Mantissa = s390Mantissa << 4; // depends on control dependency: [if], data = [none]
s390Exponent = s390Exponent - 1; // depends on control dependency: [if], data = [none]
}
// the next two line perform the (m.2^-r) part of the conversion
int shift_places = remainder;
s390Mantissa = s390Mantissa >>> shift_places; // depends on control dependency: [if], data = [none]
}
}
// An exponent of -FLOAT_BIAS is the smallest that IEEE can do. S390 has
// a wider range, and hence may be able to normalise the mantissa more than
// is possible for IEEE
// Also, since an exponent of -FLOAT_BIAS has no implicit bit set, the mantissa
// starts with a value of 2^-1 at the second bit of the second byte. We thus need
// to shift one place left to move the mantissa to the S390 position
// Follwoing that, we notmalise as follows:
// Each shift left of four bits is equivalent to multiplying by 16,
// so the exponent must be reduced by 1
if (exponent == - (FLOAT_BIAS)) {
s390Mantissa = s390Mantissa << 1;
while ((s390Mantissa != 0) && ((s390Mantissa & 0x00f00000) == 0)) {
s390Mantissa = s390Mantissa << 4; // depends on control dependency: [while], data = [none]
s390Exponent = s390Exponent - 1; // depends on control dependency: [while], data = [none]
}
}
// Assemble the s390BitPattern
int s390Float = 0;
int s390ExponentBits = s390Exponent & 0x0000007F; // make sure we only deal with 7 bits
// add the exponent
s390Float = s390ExponentBits << 24; // shift to MSB
// add the sign
if (!positive) {
s390Float = s390Float | FLOAT_SIGN_MASK;
}
// add the mantissa
s390Float = s390Float | s390Mantissa;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "S390 Bit pattern = " + Integer.toString(s390Float, 16));
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "floatToS390IntBits", s390Float);
return s390Float;
} } |
public class class_name {
public static String replaceFirst(final String text, final String regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text;
}
return text.replaceFirst(regex, replacement);
} } | public class class_name {
public static String replaceFirst(final String text, final String regex, final String replacement) {
if (text == null || regex == null|| replacement == null ) {
return text; // depends on control dependency: [if], data = [none]
}
return text.replaceFirst(regex, replacement);
} } |
public class class_name {
public static BoxEntity createEntityFromJson(final JsonObject json){
JsonValue typeValue = json.get(BoxEntity.FIELD_TYPE);
if (!typeValue.isString()) {
return null;
}
String type = typeValue.asString();
BoxEntityCreator creator = ENTITY_ADDON_MAP.get(type);
BoxEntity entity = null;
if (creator == null){
entity = new BoxEntity();
} else {
entity = creator.createEntity();
}
entity.createFromJson(json);
return entity;
} } | public class class_name {
public static BoxEntity createEntityFromJson(final JsonObject json){
JsonValue typeValue = json.get(BoxEntity.FIELD_TYPE);
if (!typeValue.isString()) {
return null; // depends on control dependency: [if], data = [none]
}
String type = typeValue.asString();
BoxEntityCreator creator = ENTITY_ADDON_MAP.get(type);
BoxEntity entity = null;
if (creator == null){
entity = new BoxEntity(); // depends on control dependency: [if], data = [none]
} else {
entity = creator.createEntity(); // depends on control dependency: [if], data = [none]
}
entity.createFromJson(json);
return entity;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public Vector<Long> readVectorUInt() {
log.debug("readVectorUInt");
int type = readInteger();
if ((type & 1) == 0) {
return (Vector<Long>) getReference(type >> 1);
}
int len = type >> 1;
Vector<Long> array = new Vector<Long>(len);
storeReference(array);
@SuppressWarnings("unused")
int ref2 = readInteger();
for (int j = 0; j < len; ++j) {
long value = (buf.get() & 0xff) << 24L;
value += (buf.get() & 0xff) << 16L;
value += (buf.get() & 0xff) << 8L;
value += (buf.get() & 0xff);
array.add(value);
}
return array;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public Vector<Long> readVectorUInt() {
log.debug("readVectorUInt");
int type = readInteger();
if ((type & 1) == 0) {
return (Vector<Long>) getReference(type >> 1);
// depends on control dependency: [if], data = [none]
}
int len = type >> 1;
Vector<Long> array = new Vector<Long>(len);
storeReference(array);
@SuppressWarnings("unused")
int ref2 = readInteger();
for (int j = 0; j < len; ++j) {
long value = (buf.get() & 0xff) << 24L;
value += (buf.get() & 0xff) << 16L;
// depends on control dependency: [for], data = [none]
value += (buf.get() & 0xff) << 8L;
// depends on control dependency: [for], data = [none]
value += (buf.get() & 0xff);
// depends on control dependency: [for], data = [none]
array.add(value);
// depends on control dependency: [for], data = [none]
}
return array;
} } |
public class class_name {
@Override
protected Type getReturnType(final int mOp1, final int mOp2) throws TTXPathException {
final Type mType1 = Type.getType(mOp1).getPrimitiveBaseType();
final Type mType2 = Type.getType(mOp2).getPrimitiveBaseType();
if (mType1.isNumericType() && mType2.isNumericType()) {
// if both have the same numeric type, return it
if (mType1 == mType2) {
return mType1;
} else if (mType1 == Type.DOUBLE || mType2 == Type.DOUBLE) {
return Type.DOUBLE;
} else if (mType1 == Type.FLOAT || mType2 == Type.FLOAT) {
return Type.FLOAT;
} else {
assert (mType1 == Type.DECIMAL || mType2 == Type.DECIMAL);
return Type.DECIMAL;
}
} else {
switch (mType1) {
case DATE:
if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
return mType1;
}
break;
case TIME:
if (mType2 == Type.DAY_TIME_DURATION) {
return mType1;
}
break;
case DATE_TIME:
if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
return mType1;
}
break;
case YEAR_MONTH_DURATION:
if (mType2 == Type.DATE || mType2 == Type.DATE_TIME || mType2 == Type.YEAR_MONTH_DURATION) {
return mType2;
}
break;
case DAY_TIME_DURATION:
if (mType2 == Type.DATE || mType2 == Type.TIME || mType2 == Type.DATE_TIME
|| mType2 == Type.DAY_TIME_DURATION) {
return mType2;
}
break;
default:
throw EXPathError.XPTY0004.getEncapsulatedException();
}
throw EXPathError.XPTY0004.getEncapsulatedException();
}
} } | public class class_name {
@Override
protected Type getReturnType(final int mOp1, final int mOp2) throws TTXPathException {
final Type mType1 = Type.getType(mOp1).getPrimitiveBaseType();
final Type mType2 = Type.getType(mOp2).getPrimitiveBaseType();
if (mType1.isNumericType() && mType2.isNumericType()) {
// if both have the same numeric type, return it
if (mType1 == mType2) {
return mType1; // depends on control dependency: [if], data = [none]
} else if (mType1 == Type.DOUBLE || mType2 == Type.DOUBLE) {
return Type.DOUBLE; // depends on control dependency: [if], data = [none]
} else if (mType1 == Type.FLOAT || mType2 == Type.FLOAT) {
return Type.FLOAT; // depends on control dependency: [if], data = [none]
} else {
assert (mType1 == Type.DECIMAL || mType2 == Type.DECIMAL); // depends on control dependency: [if], data = [(mType1]
return Type.DECIMAL; // depends on control dependency: [if], data = [none]
}
} else {
switch (mType1) {
case DATE:
if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
return mType1; // depends on control dependency: [if], data = [none]
}
break;
case TIME:
if (mType2 == Type.DAY_TIME_DURATION) {
return mType1; // depends on control dependency: [if], data = [none]
}
break;
case DATE_TIME:
if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
return mType1; // depends on control dependency: [if], data = [none]
}
break;
case YEAR_MONTH_DURATION:
if (mType2 == Type.DATE || mType2 == Type.DATE_TIME || mType2 == Type.YEAR_MONTH_DURATION) {
return mType2; // depends on control dependency: [if], data = [none]
}
break;
case DAY_TIME_DURATION:
if (mType2 == Type.DATE || mType2 == Type.TIME || mType2 == Type.DATE_TIME
|| mType2 == Type.DAY_TIME_DURATION) {
return mType2; // depends on control dependency: [if], data = [none]
}
break;
default:
throw EXPathError.XPTY0004.getEncapsulatedException();
}
throw EXPathError.XPTY0004.getEncapsulatedException();
}
} } |
public class class_name {
@Override
public final void setHasName(final InvItem pHasName) {
this.hasName = pHasName;
if (this.itsId == null) {
this.itsId = new IdI18nInvItem();
}
this.itsId.setHasName(this.hasName);
} } | public class class_name {
@Override
public final void setHasName(final InvItem pHasName) {
this.hasName = pHasName;
if (this.itsId == null) {
this.itsId = new IdI18nInvItem(); // depends on control dependency: [if], data = [none]
}
this.itsId.setHasName(this.hasName);
} } |
public class class_name {
public static TagLib nameSpace(Data data) {
boolean hasTag = false;
int start = data.srcCode.getPos();
TagLib tagLib = null;
// loop over NameSpaces
for (int i = 1; i >= 0; i--) {
for (int ii = 0; ii < data.tlibs[i].length; ii++) {
tagLib = data.tlibs[i][ii];
char[] c = tagLib.getNameSpaceAndSeperatorAsCharArray();
// Loop over char of NameSpace and Sepearator
hasTag = true;
for (int y = 0; y < c.length; y++) {
if (!(data.srcCode.isValidIndex() && c[y] == data.srcCode.getCurrentLower())) {
// hasTag=true;
// } else {
hasTag = false;
data.srcCode.setPos(start);
break;
}
data.srcCode.next();
}
if (hasTag) return tagLib;// break;
}
// if(hasTag) return tagLib;
}
return null;
} } | public class class_name {
public static TagLib nameSpace(Data data) {
boolean hasTag = false;
int start = data.srcCode.getPos();
TagLib tagLib = null;
// loop over NameSpaces
for (int i = 1; i >= 0; i--) {
for (int ii = 0; ii < data.tlibs[i].length; ii++) {
tagLib = data.tlibs[i][ii]; // depends on control dependency: [for], data = [ii]
char[] c = tagLib.getNameSpaceAndSeperatorAsCharArray();
// Loop over char of NameSpace and Sepearator
hasTag = true; // depends on control dependency: [for], data = [none]
for (int y = 0; y < c.length; y++) {
if (!(data.srcCode.isValidIndex() && c[y] == data.srcCode.getCurrentLower())) {
// hasTag=true;
// } else {
hasTag = false; // depends on control dependency: [if], data = [none]
data.srcCode.setPos(start); // depends on control dependency: [if], data = [none]
break;
}
data.srcCode.next(); // depends on control dependency: [for], data = [none]
}
if (hasTag) return tagLib;// break;
}
// if(hasTag) return tagLib;
}
return null;
} } |
public class class_name {
private void restoreKVStateData() throws IOException, RocksDBException {
//for all key-groups in the current state handle...
try (RocksDBWriteBatchWrapper writeBatchWrapper = new RocksDBWriteBatchWrapper(db)) {
for (Tuple2<Integer, Long> keyGroupOffset : currentKeyGroupsStateHandle.getGroupRangeOffsets()) {
int keyGroup = keyGroupOffset.f0;
// Check that restored key groups all belong to the backend
Preconditions.checkState(keyGroupRange.contains(keyGroup),
"The key group must belong to the backend");
long offset = keyGroupOffset.f1;
//not empty key-group?
if (0L != offset) {
currentStateHandleInStream.seek(offset);
try (InputStream compressedKgIn = keygroupStreamCompressionDecorator.decorateWithCompression(currentStateHandleInStream)) {
DataInputViewStreamWrapper compressedKgInputView = new DataInputViewStreamWrapper(compressedKgIn);
//TODO this could be aware of keyGroupPrefixBytes and write only one byte if possible
int kvStateId = compressedKgInputView.readShort();
ColumnFamilyHandle handle = currentStateHandleKVStateColumnFamilies.get(kvStateId);
//insert all k/v pairs into DB
boolean keyGroupHasMoreKeys = true;
while (keyGroupHasMoreKeys) {
byte[] key = BytePrimitiveArraySerializer.INSTANCE.deserialize(compressedKgInputView);
byte[] value = BytePrimitiveArraySerializer.INSTANCE.deserialize(compressedKgInputView);
if (hasMetaDataFollowsFlag(key)) {
//clear the signal bit in the key to make it ready for insertion again
clearMetaDataFollowsFlag(key);
writeBatchWrapper.put(handle, key, value);
//TODO this could be aware of keyGroupPrefixBytes and write only one byte if possible
kvStateId = END_OF_KEY_GROUP_MARK
& compressedKgInputView.readShort();
if (END_OF_KEY_GROUP_MARK == kvStateId) {
keyGroupHasMoreKeys = false;
} else {
handle = currentStateHandleKVStateColumnFamilies.get(kvStateId);
}
} else {
writeBatchWrapper.put(handle, key, value);
}
}
}
}
}
}
} } | public class class_name {
private void restoreKVStateData() throws IOException, RocksDBException {
//for all key-groups in the current state handle...
try (RocksDBWriteBatchWrapper writeBatchWrapper = new RocksDBWriteBatchWrapper(db)) {
for (Tuple2<Integer, Long> keyGroupOffset : currentKeyGroupsStateHandle.getGroupRangeOffsets()) {
int keyGroup = keyGroupOffset.f0;
// Check that restored key groups all belong to the backend
Preconditions.checkState(keyGroupRange.contains(keyGroup),
"The key group must belong to the backend");
long offset = keyGroupOffset.f1;
//not empty key-group?
if (0L != offset) {
currentStateHandleInStream.seek(offset);
try (InputStream compressedKgIn = keygroupStreamCompressionDecorator.decorateWithCompression(currentStateHandleInStream)) {
DataInputViewStreamWrapper compressedKgInputView = new DataInputViewStreamWrapper(compressedKgIn);
//TODO this could be aware of keyGroupPrefixBytes and write only one byte if possible
int kvStateId = compressedKgInputView.readShort();
ColumnFamilyHandle handle = currentStateHandleKVStateColumnFamilies.get(kvStateId);
//insert all k/v pairs into DB
boolean keyGroupHasMoreKeys = true;
while (keyGroupHasMoreKeys) {
byte[] key = BytePrimitiveArraySerializer.INSTANCE.deserialize(compressedKgInputView);
byte[] value = BytePrimitiveArraySerializer.INSTANCE.deserialize(compressedKgInputView);
if (hasMetaDataFollowsFlag(key)) {
//clear the signal bit in the key to make it ready for insertion again
clearMetaDataFollowsFlag(key); // depends on control dependency: [if], data = [none]
writeBatchWrapper.put(handle, key, value); // depends on control dependency: [if], data = [none]
//TODO this could be aware of keyGroupPrefixBytes and write only one byte if possible
kvStateId = END_OF_KEY_GROUP_MARK
& compressedKgInputView.readShort(); // depends on control dependency: [if], data = [none]
if (END_OF_KEY_GROUP_MARK == kvStateId) {
keyGroupHasMoreKeys = false; // depends on control dependency: [if], data = [none]
} else {
handle = currentStateHandleKVStateColumnFamilies.get(kvStateId); // depends on control dependency: [if], data = [kvStateId)]
}
} else {
writeBatchWrapper.put(handle, key, value); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
} } |
public class class_name {
private boolean deleteBatch(List<String> objIDs) {
if (objIDs.size() == 0) {
return false;
}
m_logger.debug("Deleting batch of {} objects from {}", objIDs.size(), m_tableDef.getTableName());
BatchObjectUpdater batchUpdater = new BatchObjectUpdater(m_tableDef);
BatchResult batchResult = batchUpdater.deleteBatch(objIDs);
if (batchResult.isFailed()) {
m_logger.error("Batch query failed: {}", batchResult.getErrorMessage());
return false;
}
return true;
} } | public class class_name {
private boolean deleteBatch(List<String> objIDs) {
if (objIDs.size() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
m_logger.debug("Deleting batch of {} objects from {}", objIDs.size(), m_tableDef.getTableName());
BatchObjectUpdater batchUpdater = new BatchObjectUpdater(m_tableDef);
BatchResult batchResult = batchUpdater.deleteBatch(objIDs);
if (batchResult.isFailed()) {
m_logger.error("Batch query failed: {}", batchResult.getErrorMessage());
return false;
}
return true;
} } |
public class class_name {
public static void forEachSuperClass( Class<?> clazz, ClassAction action ) {
try {
action.act( clazz );
Class<?> superclass = clazz.getSuperclass();
if( superclass != null ) {
forEachSuperClass( superclass, action );
}
} catch( Exception e ) {
throw Throwables.propagate( e );
}
} } | public class class_name {
public static void forEachSuperClass( Class<?> clazz, ClassAction action ) {
try {
action.act( clazz ); // depends on control dependency: [try], data = [none]
Class<?> superclass = clazz.getSuperclass();
if( superclass != null ) {
forEachSuperClass( superclass, action ); // depends on control dependency: [if], data = [( superclass]
}
} catch( Exception e ) {
throw Throwables.propagate( e );
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nullable
public final Router getChildRouter(@NonNull ViewGroup container, @Nullable String tag, boolean createIfNeeded) {
@IdRes final int containerId = container.getId();
ControllerHostedRouter childRouter = null;
for (ControllerHostedRouter router : childRouters) {
if (router.getHostId() == containerId && TextUtils.equals(tag, router.getTag())) {
childRouter = router;
break;
}
}
if (childRouter == null) {
if (createIfNeeded) {
childRouter = new ControllerHostedRouter(container.getId(), tag);
childRouter.setHost(this, container);
childRouters.add(childRouter);
if (isPerformingExitTransition) {
childRouter.setDetachFrozen(true);
}
}
} else if (!childRouter.hasHost()) {
childRouter.setHost(this, container);
childRouter.rebindIfNeeded();
}
return childRouter;
} } | public class class_name {
@Nullable
public final Router getChildRouter(@NonNull ViewGroup container, @Nullable String tag, boolean createIfNeeded) {
@IdRes final int containerId = container.getId();
ControllerHostedRouter childRouter = null;
for (ControllerHostedRouter router : childRouters) {
if (router.getHostId() == containerId && TextUtils.equals(tag, router.getTag())) {
childRouter = router; // depends on control dependency: [if], data = [none]
break;
}
}
if (childRouter == null) {
if (createIfNeeded) {
childRouter = new ControllerHostedRouter(container.getId(), tag); // depends on control dependency: [if], data = [none]
childRouter.setHost(this, container); // depends on control dependency: [if], data = [none]
childRouters.add(childRouter); // depends on control dependency: [if], data = [none]
if (isPerformingExitTransition) {
childRouter.setDetachFrozen(true); // depends on control dependency: [if], data = [none]
}
}
} else if (!childRouter.hasHost()) {
childRouter.setHost(this, container); // depends on control dependency: [if], data = [none]
childRouter.rebindIfNeeded(); // depends on control dependency: [if], data = [none]
}
return childRouter;
} } |
public class class_name {
private void createStyleRelationship(String mappingTableName,
String featureTable, String baseTable, String relatedTable) {
if (!hasStyleRelationship(mappingTableName, baseTable, relatedTable)) {
// Create the extension
getOrCreate(featureTable);
if (baseTable.equals(ContentsId.TABLE_NAME)) {
if (!contentsId.has()) {
contentsId.getOrCreateExtension();
}
}
StyleMappingTable mappingTable = new StyleMappingTable(
mappingTableName);
if (relatedTable.equals(StyleTable.TABLE_NAME)) {
relatedTables.addAttributesRelationship(baseTable,
new StyleTable(), mappingTable);
} else {
relatedTables.addMediaRelationship(baseTable, new IconTable(),
mappingTable);
}
}
} } | public class class_name {
private void createStyleRelationship(String mappingTableName,
String featureTable, String baseTable, String relatedTable) {
if (!hasStyleRelationship(mappingTableName, baseTable, relatedTable)) {
// Create the extension
getOrCreate(featureTable); // depends on control dependency: [if], data = [none]
if (baseTable.equals(ContentsId.TABLE_NAME)) {
if (!contentsId.has()) {
contentsId.getOrCreateExtension(); // depends on control dependency: [if], data = [none]
}
}
StyleMappingTable mappingTable = new StyleMappingTable(
mappingTableName);
if (relatedTable.equals(StyleTable.TABLE_NAME)) {
relatedTables.addAttributesRelationship(baseTable,
new StyleTable(), mappingTable); // depends on control dependency: [if], data = [none]
} else {
relatedTables.addMediaRelationship(baseTable, new IconTable(),
mappingTable); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private URLPatternHolder convertStringToPattern(String line) {
URLPatternHolder holder = new URLPatternHolder();
Pattern compiledPattern;
Perl5Compiler compiler = new Perl5Compiler();
String perl5RegExp = line;
try {
compiledPattern = compiler.compile(perl5RegExp, Perl5Compiler.READ_ONLY_MASK);
holder.setCompiledPattern(compiledPattern);
} catch (MalformedPatternException mpe) {
throw new IllegalArgumentException("Malformed regular expression: " + perl5RegExp);
}
if (logger.isDebugEnabled()) {
logger.debug("Added regular expression: " + compiledPattern.getPattern().toString());
}
return holder;
} } | public class class_name {
private URLPatternHolder convertStringToPattern(String line) {
URLPatternHolder holder = new URLPatternHolder();
Pattern compiledPattern;
Perl5Compiler compiler = new Perl5Compiler();
String perl5RegExp = line;
try {
compiledPattern = compiler.compile(perl5RegExp, Perl5Compiler.READ_ONLY_MASK); // depends on control dependency: [try], data = [none]
holder.setCompiledPattern(compiledPattern); // depends on control dependency: [try], data = [none]
} catch (MalformedPatternException mpe) {
throw new IllegalArgumentException("Malformed regular expression: " + perl5RegExp);
} // depends on control dependency: [catch], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("Added regular expression: " + compiledPattern.getPattern().toString()); // depends on control dependency: [if], data = [none]
}
return holder;
} } |
public class class_name {
public int max() {
int max = Integer.MIN_VALUE;
for (E key : map.keySet()) {
max = Math.max(max, getIntCount(key));
}
return max;
} } | public class class_name {
public int max() {
int max = Integer.MIN_VALUE;
for (E key : map.keySet()) {
max = Math.max(max, getIntCount(key));
// depends on control dependency: [for], data = [key]
}
return max;
} } |
public class class_name {
public void await(T t) throws InterruptedException
{
synchronized (monitor)
{
long waitNanos = evaluateWithWaitTimeNanos(t);
// Loop forever until all conditions pass or the thread is interrupted.
while (waitNanos > 0)
{
// If some conditions failed, then wait for the shortest wait time, or until the thread is woken up by
// a signal, before re-evaluating conditions.
long milliPause = waitNanos / 1000000;
int nanoPause = (int) (waitNanos % 1000000);
monitor.wait(milliPause, nanoPause);
waitNanos = evaluateWithWaitTimeNanos(t);
}
}
} } | public class class_name {
public void await(T t) throws InterruptedException
{
synchronized (monitor)
{
long waitNanos = evaluateWithWaitTimeNanos(t);
// Loop forever until all conditions pass or the thread is interrupted.
while (waitNanos > 0)
{
// If some conditions failed, then wait for the shortest wait time, or until the thread is woken up by
// a signal, before re-evaluating conditions.
long milliPause = waitNanos / 1000000;
int nanoPause = (int) (waitNanos % 1000000);
monitor.wait(milliPause, nanoPause); // depends on control dependency: [while], data = [none]
waitNanos = evaluateWithWaitTimeNanos(t); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
protected void showInitCallError(Set<String> initCalls) {
StringBuffer buffer = new StringBuffer();
buffer.append("init call(s) not found: ");
for (String init : initCalls) {
buffer.append(init);
buffer.append(" ");
}
showError(buffer.toString());
} } | public class class_name {
protected void showInitCallError(Set<String> initCalls) {
StringBuffer buffer = new StringBuffer();
buffer.append("init call(s) not found: ");
for (String init : initCalls) {
buffer.append(init);
// depends on control dependency: [for], data = [init]
buffer.append(" ");
// depends on control dependency: [for], data = [none]
}
showError(buffer.toString());
} } |
public class class_name {
public <EE extends E> Iterator<EE> iterator(Class<EE> type) {
try {
disableSeek();
} catch (IOException exception) {
//
}
return Iterators.filter(new ElementIterator(), type);
} } | public class class_name {
public <EE extends E> Iterator<EE> iterator(Class<EE> type) {
try {
disableSeek(); // depends on control dependency: [try], data = [none]
} catch (IOException exception) {
//
} // depends on control dependency: [catch], data = [none]
return Iterators.filter(new ElementIterator(), type);
} } |
public class class_name {
public synchronized void reloadableScan(String fileName) {
if (!isFirstInit) {
return;
}
if (DisClientConfig.getInstance().ENABLE_DISCONF) {
try {
if (!DisClientConfig.getInstance().getIgnoreDisconfKeySet().contains(fileName)) {
if (scanMgr != null) {
scanMgr.reloadableScan(fileName);
}
if (disconfCoreMgr != null) {
disconfCoreMgr.processFile(fileName);
}
LOGGER.debug("disconf reloadable file: {}", fileName);
}
} catch (Exception e) {
LOGGER.error(e.toString(), e);
}
}
} } | public class class_name {
public synchronized void reloadableScan(String fileName) {
if (!isFirstInit) {
return; // depends on control dependency: [if], data = [none]
}
if (DisClientConfig.getInstance().ENABLE_DISCONF) {
try {
if (!DisClientConfig.getInstance().getIgnoreDisconfKeySet().contains(fileName)) {
if (scanMgr != null) {
scanMgr.reloadableScan(fileName); // depends on control dependency: [if], data = [none]
}
if (disconfCoreMgr != null) {
disconfCoreMgr.processFile(fileName); // depends on control dependency: [if], data = [none]
}
LOGGER.debug("disconf reloadable file: {}", fileName); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOGGER.error(e.toString(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected int transitionWithRoot(int nodePos, char c)
{
int b = base[nodePos];
int p;
p = b + c + 1;
if (b != check[p])
{
if (nodePos == 0) return 0;
return -1;
}
return p;
} } | public class class_name {
protected int transitionWithRoot(int nodePos, char c)
{
int b = base[nodePos];
int p;
p = b + c + 1;
if (b != check[p])
{
if (nodePos == 0) return 0;
return -1; // depends on control dependency: [if], data = [none]
}
return p;
} } |
public class class_name {
@Nonnull
public static EChange renewCurrentSessionScope (final boolean bInvalidateHttpSession)
{
// Get the old session scope
final ISessionWebScope aOldSessionScope = WebScopeManager.getSessionScope (false);
if (aOldSessionScope == null)
{
// No session present, so no need to create a new one
return EChange.UNCHANGED;
}
// OK, we have a session scope to renew
// Save all values from session scopes and from all session application
// scopes
final ICommonsMap <String, IScopeRenewalAware> aSessionScopeValues = aOldSessionScope.getAllScopeRenewalAwareAttributes ();
// Clear the old the session scope
if (bInvalidateHttpSession)
{
// renew the session
LOGGER.info ("Invalidating session " + aOldSessionScope.getID ());
aOldSessionScope.selfDestruct ();
}
else
{
// Do not invalidate the underlying session - only renew the session scope
// itself
ScopeSessionManager.getInstance ().onScopeEnd (aOldSessionScope);
}
// Ensure that we get a new session!
// Here it is OK to create a new session scope explicitly!
final ISessionWebScope aNewSessionScope = WebScopeManager.internalGetSessionScope (true, true);
_restoreScopeAttributes (aNewSessionScope, aSessionScopeValues);
return EChange.CHANGED;
} } | public class class_name {
@Nonnull
public static EChange renewCurrentSessionScope (final boolean bInvalidateHttpSession)
{
// Get the old session scope
final ISessionWebScope aOldSessionScope = WebScopeManager.getSessionScope (false);
if (aOldSessionScope == null)
{
// No session present, so no need to create a new one
return EChange.UNCHANGED; // depends on control dependency: [if], data = [none]
}
// OK, we have a session scope to renew
// Save all values from session scopes and from all session application
// scopes
final ICommonsMap <String, IScopeRenewalAware> aSessionScopeValues = aOldSessionScope.getAllScopeRenewalAwareAttributes ();
// Clear the old the session scope
if (bInvalidateHttpSession)
{
// renew the session
LOGGER.info ("Invalidating session " + aOldSessionScope.getID ()); // depends on control dependency: [if], data = [none]
aOldSessionScope.selfDestruct (); // depends on control dependency: [if], data = [none]
}
else
{
// Do not invalidate the underlying session - only renew the session scope
// itself
ScopeSessionManager.getInstance ().onScopeEnd (aOldSessionScope); // depends on control dependency: [if], data = [none]
}
// Ensure that we get a new session!
// Here it is OK to create a new session scope explicitly!
final ISessionWebScope aNewSessionScope = WebScopeManager.internalGetSessionScope (true, true);
_restoreScopeAttributes (aNewSessionScope, aSessionScopeValues);
return EChange.CHANGED;
} } |
public class class_name {
private void visitMemberDeclarator(AstNode node) {
if (isOverriddenMethod(node)) {
// assume that ancestor method is documented
// and do not count as public API
return;
}
AstNode container = node.getFirstAncestor(
CxxGrammarImpl.templateDeclaration,
CxxGrammarImpl.classSpecifier);
AstNode docNode = node;
List<Token> comments;
if (container == null || container.getType().equals(CxxGrammarImpl.classSpecifier)) {
comments = getBlockDocumentation(docNode);
} else { // template
do {
comments = getBlockDocumentation(container);
if (!comments.isEmpty()) {
break;
}
container = container.getFirstAncestor(CxxGrammarImpl.templateDeclaration);
} while (container != null);
}
// documentation may be inlined
if (comments.isEmpty()) {
comments = getDeclaratorInlineComment(node);
}
// find the identifier to present to concrete visitors
String id = null;
// first look for an operator function id
AstNode idNode = node.getFirstDescendant(CxxGrammarImpl.operatorFunctionId);
if (idNode != null) {
id = getOperatorId(idNode);
} else {
// look for a declarator id
idNode = node.getFirstDescendant(CxxGrammarImpl.declaratorId);
if (idNode != null) {
id = idNode.getTokenValue();
} else {
// look for an identifier (e.g in bitfield declaration)
idNode = node.getFirstDescendant(GenericTokenType.IDENTIFIER);
if (idNode != null) {
id = idNode.getTokenValue();
} else {
LOG.error("Unsupported declarator at {}", node.getTokenLine());
}
}
}
if (idNode != null && id != null) {
visitPublicApi(idNode, id, comments);
}
} } | public class class_name {
private void visitMemberDeclarator(AstNode node) {
if (isOverriddenMethod(node)) {
// assume that ancestor method is documented
// and do not count as public API
return; // depends on control dependency: [if], data = [none]
}
AstNode container = node.getFirstAncestor(
CxxGrammarImpl.templateDeclaration,
CxxGrammarImpl.classSpecifier);
AstNode docNode = node;
List<Token> comments;
if (container == null || container.getType().equals(CxxGrammarImpl.classSpecifier)) {
comments = getBlockDocumentation(docNode); // depends on control dependency: [if], data = [none]
} else { // template
do {
comments = getBlockDocumentation(container);
if (!comments.isEmpty()) {
break;
}
container = container.getFirstAncestor(CxxGrammarImpl.templateDeclaration);
} while (container != null);
}
// documentation may be inlined
if (comments.isEmpty()) {
comments = getDeclaratorInlineComment(node); // depends on control dependency: [if], data = [none]
}
// find the identifier to present to concrete visitors
String id = null;
// first look for an operator function id
AstNode idNode = node.getFirstDescendant(CxxGrammarImpl.operatorFunctionId);
if (idNode != null) {
id = getOperatorId(idNode);
} else {
// look for a declarator id
idNode = node.getFirstDescendant(CxxGrammarImpl.declaratorId);
if (idNode != null) {
id = idNode.getTokenValue();
} else {
// look for an identifier (e.g in bitfield declaration)
idNode = node.getFirstDescendant(GenericTokenType.IDENTIFIER);
if (idNode != null) {
id = idNode.getTokenValue();
} else {
LOG.error("Unsupported declarator at {}", node.getTokenLine());
}
}
}
if (idNode != null && id != null) {
visitPublicApi(idNode, id, comments);
}
} } |
public class class_name {
int makeRef(DiagnosticPosition pos, Type type) {
checkDimension(pos, type);
if (type.isAnnotated()) {
return pool.put((Object)type);
} else {
return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type);
}
} } | public class class_name {
int makeRef(DiagnosticPosition pos, Type type) {
checkDimension(pos, type);
if (type.isAnnotated()) {
return pool.put((Object)type); // depends on control dependency: [if], data = [none]
} else {
return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static boolean resemblesPropertyPattern(String pattern, int pos) {
// Patterns are at least 5 characters long
if ((pos+5) > pattern.length()) {
return false;
}
// Look for an opening [:, [:^, \p, or \P
return pattern.regionMatches(pos, "[:", 0, 2) ||
pattern.regionMatches(true, pos, "\\p", 0, 2) ||
pattern.regionMatches(pos, "\\N", 0, 2);
} } | public class class_name {
private static boolean resemblesPropertyPattern(String pattern, int pos) {
// Patterns are at least 5 characters long
if ((pos+5) > pattern.length()) {
return false; // depends on control dependency: [if], data = [none]
}
// Look for an opening [:, [:^, \p, or \P
return pattern.regionMatches(pos, "[:", 0, 2) ||
pattern.regionMatches(true, pos, "\\p", 0, 2) ||
pattern.regionMatches(pos, "\\N", 0, 2);
} } |
public class class_name {
public synchronized void acceptMastership() {
if (m_onMastership == null) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Mastership Runnable not yet set for table " + getTableName() + " partition " + getPartitionId());
}
return;
}
if (m_mastershipAccepted.get()) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Export table " + getTableName() + " mastership already accepted for partition " + getPartitionId());
}
return;
}
m_es.execute(new Runnable() {
@Override
public void run() {
try {
if (!m_es.isShutdown() || !m_closed) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Export table " + getTableName() + " accepting mastership for partition " + getPartitionId());
}
if (m_mastershipAccepted.compareAndSet(false, true)) {
// Either get enough responses or have received TRANSFER_MASTER event, clear the response sender HSids.
m_queryResponses.clear();
m_onMastership.run();
}
}
} catch (Exception e) {
exportLog.error("Error in accepting mastership", e);
}
}
});
} } | public class class_name {
public synchronized void acceptMastership() {
if (m_onMastership == null) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Mastership Runnable not yet set for table " + getTableName() + " partition " + getPartitionId()); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (m_mastershipAccepted.get()) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Export table " + getTableName() + " mastership already accepted for partition " + getPartitionId()); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
m_es.execute(new Runnable() {
@Override
public void run() {
try {
if (!m_es.isShutdown() || !m_closed) {
if (exportLog.isDebugEnabled()) {
exportLog.debug("Export table " + getTableName() + " accepting mastership for partition " + getPartitionId()); // depends on control dependency: [if], data = [none]
}
if (m_mastershipAccepted.compareAndSet(false, true)) {
// Either get enough responses or have received TRANSFER_MASTER event, clear the response sender HSids.
m_queryResponses.clear(); // depends on control dependency: [if], data = [none]
m_onMastership.run(); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
exportLog.error("Error in accepting mastership", e);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private static String printStatements(Context context, Iterable<JCStatement> statements) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStats(com.sun.tools.javac.util.List.from(statements));
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
}
return writer.toString();
} } | public class class_name {
private static String printStatements(Context context, Iterable<JCStatement> statements) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStats(com.sun.tools.javac.util.List.from(statements)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
} // depends on control dependency: [catch], data = [none]
return writer.toString();
} } |
public class class_name {
protected void validateDate(final List<Diagnostic> diags) {
Date value = getValue();
if (value == null) {
return;
}
Date min = getMinDate();
Date max = getMaxDate();
if (min != null && value.compareTo(min) < 0) {
diags.add(createErrorDiagnostic(
InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL, this, min));
}
if (max != null && value.compareTo(max) > 0) {
diags.add(createErrorDiagnostic(
InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL, this, max));
}
} } | public class class_name {
protected void validateDate(final List<Diagnostic> diags) {
Date value = getValue();
if (value == null) {
return; // depends on control dependency: [if], data = [none]
}
Date min = getMinDate();
Date max = getMaxDate();
if (min != null && value.compareTo(min) < 0) {
diags.add(createErrorDiagnostic(
InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_AFTER_OR_EQUAL, this, min)); // depends on control dependency: [if], data = [none]
}
if (max != null && value.compareTo(max) > 0) {
diags.add(createErrorDiagnostic(
InternalMessages.DEFAULT_VALIDATION_ERROR_DATE_BEFORE_OR_EQUAL, this, max)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public TilePreparationInfo call() {
return this.context.mdcContext(() -> {
try {
final ReferencedEnvelope mapGeoBounds = this.bounds.toReferencedEnvelope(this.paintArea);
final CoordinateReferenceSystem mapProjection = mapGeoBounds.getCoordinateReferenceSystem();
Dimension tileSizeOnScreen = this.tiledLayer.getTileSize();
final double resolution = this.tiledLayer.getResolution();
Coordinate tileSizeInWorld = new Coordinate(tileSizeOnScreen.width * resolution,
tileSizeOnScreen.height * resolution);
// The minX minY of the first (minY, minY) tile
Coordinate gridCoverageOrigin =
this.tiledLayer.getMinGeoCoordinate(mapGeoBounds, tileSizeInWorld);
final String commonUrl = this.tiledLayer.createCommonUrl();
ReferencedEnvelope tileCacheBounds = this.tiledLayer.getTileCacheBounds();
double rowFactor = 1 / (resolution * tileSizeOnScreen.height);
double columnFactor = 1 / (resolution * tileSizeOnScreen.width);
int imageWidth = 0;
int imageHeight = 0;
int xIndex;
int yIndex = (int) Math.floor((mapGeoBounds.getMaxY() - gridCoverageOrigin.y) /
tileSizeInWorld.y) + 1;
double gridCoverageMaxX = gridCoverageOrigin.x;
double gridCoverageMaxY = gridCoverageOrigin.y;
List<SingleTilePreparationInfo> tiles = new ArrayList<>();
for (double geoY = gridCoverageOrigin.y; geoY < mapGeoBounds.getMaxY();
geoY += tileSizeInWorld.y) {
yIndex--;
imageHeight += tileSizeOnScreen.height;
imageWidth = 0;
xIndex = -1;
gridCoverageMaxY = geoY + tileSizeInWorld.y;
for (double geoX = gridCoverageOrigin.x; geoX < mapGeoBounds.getMaxX();
geoX += tileSizeInWorld.x) {
xIndex++;
imageWidth += tileSizeOnScreen.width;
gridCoverageMaxX = geoX + tileSizeInWorld.x;
ReferencedEnvelope tileBounds = new ReferencedEnvelope(
geoX, gridCoverageMaxX, geoY, gridCoverageMaxY, mapProjection);
int row = (int) Math.round((tileCacheBounds.getMaxY() -
tileBounds.getMaxY()) * rowFactor);
int column = (int) Math.round((tileBounds.getMinX() -
tileCacheBounds.getMinX()) * columnFactor);
ClientHttpRequest tileRequest =
this.tiledLayer.getTileRequest(this.httpRequestFactory,
commonUrl, tileBounds,
tileSizeOnScreen, column,
row);
if (isInTileCacheBounds(tileCacheBounds, tileBounds)) {
if (isTileVisible(tileBounds)) {
tileRequest = this.requestCache.register(tileRequest);
tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, tileRequest));
}
} else {
LOGGER.debug("Tile out of bounds: {}", tileRequest);
tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, null));
}
}
}
return new TilePreparationInfo(tiles, imageWidth, imageHeight, gridCoverageOrigin,
gridCoverageMaxX, gridCoverageMaxY, mapProjection);
} catch (Exception e) {
throw ExceptionUtils.getRuntimeException(e);
}
});
} } | public class class_name {
public TilePreparationInfo call() {
return this.context.mdcContext(() -> {
try {
final ReferencedEnvelope mapGeoBounds = this.bounds.toReferencedEnvelope(this.paintArea);
final CoordinateReferenceSystem mapProjection = mapGeoBounds.getCoordinateReferenceSystem();
Dimension tileSizeOnScreen = this.tiledLayer.getTileSize();
final double resolution = this.tiledLayer.getResolution();
Coordinate tileSizeInWorld = new Coordinate(tileSizeOnScreen.width * resolution,
tileSizeOnScreen.height * resolution);
// The minX minY of the first (minY, minY) tile
Coordinate gridCoverageOrigin =
this.tiledLayer.getMinGeoCoordinate(mapGeoBounds, tileSizeInWorld);
final String commonUrl = this.tiledLayer.createCommonUrl();
ReferencedEnvelope tileCacheBounds = this.tiledLayer.getTileCacheBounds();
double rowFactor = 1 / (resolution * tileSizeOnScreen.height);
double columnFactor = 1 / (resolution * tileSizeOnScreen.width);
int imageWidth = 0;
int imageHeight = 0;
int xIndex;
int yIndex = (int) Math.floor((mapGeoBounds.getMaxY() - gridCoverageOrigin.y) /
tileSizeInWorld.y) + 1;
double gridCoverageMaxX = gridCoverageOrigin.x;
double gridCoverageMaxY = gridCoverageOrigin.y;
List<SingleTilePreparationInfo> tiles = new ArrayList<>();
for (double geoY = gridCoverageOrigin.y; geoY < mapGeoBounds.getMaxY();
geoY += tileSizeInWorld.y) {
yIndex--; // depends on control dependency: [for], data = [none]
imageHeight += tileSizeOnScreen.height; // depends on control dependency: [for], data = [none]
imageWidth = 0; // depends on control dependency: [for], data = [none]
xIndex = -1; // depends on control dependency: [for], data = [none]
gridCoverageMaxY = geoY + tileSizeInWorld.y; // depends on control dependency: [for], data = [geoY]
for (double geoX = gridCoverageOrigin.x; geoX < mapGeoBounds.getMaxX();
geoX += tileSizeInWorld.x) {
xIndex++; // depends on control dependency: [for], data = [none]
imageWidth += tileSizeOnScreen.width; // depends on control dependency: [for], data = [none]
gridCoverageMaxX = geoX + tileSizeInWorld.x; // depends on control dependency: [for], data = [geoX]
ReferencedEnvelope tileBounds = new ReferencedEnvelope(
geoX, gridCoverageMaxX, geoY, gridCoverageMaxY, mapProjection);
int row = (int) Math.round((tileCacheBounds.getMaxY() -
tileBounds.getMaxY()) * rowFactor);
int column = (int) Math.round((tileBounds.getMinX() -
tileCacheBounds.getMinX()) * columnFactor);
ClientHttpRequest tileRequest =
this.tiledLayer.getTileRequest(this.httpRequestFactory,
commonUrl, tileBounds,
tileSizeOnScreen, column,
row);
if (isInTileCacheBounds(tileCacheBounds, tileBounds)) {
if (isTileVisible(tileBounds)) {
tileRequest = this.requestCache.register(tileRequest); // depends on control dependency: [if], data = [none]
tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, tileRequest)); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.debug("Tile out of bounds: {}", tileRequest); // depends on control dependency: [if], data = [none]
tiles.add(new SingleTilePreparationInfo(xIndex, yIndex, null)); // depends on control dependency: [if], data = [none]
}
}
}
return new TilePreparationInfo(tiles, imageWidth, imageHeight, gridCoverageOrigin,
gridCoverageMaxX, gridCoverageMaxY, mapProjection); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw ExceptionUtils.getRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
});
} } |
public class class_name {
public void releaseAll(ParticleEmitter emitter) {
if( !particlesByEmitter.isEmpty() )
{
Iterator it= particlesByEmitter.values().iterator();
while( it.hasNext())
{
ParticlePool pool= (ParticlePool)it.next();
for (int i=0;i<pool.particles.length;i++) {
if (pool.particles[i].inUse()) {
if (pool.particles[i].getEmitter() == emitter) {
pool.particles[i].setLife(-1);
release(pool.particles[i]);
}
}
}
}
}
} } | public class class_name {
public void releaseAll(ParticleEmitter emitter) {
if( !particlesByEmitter.isEmpty() )
{
Iterator it= particlesByEmitter.values().iterator();
while( it.hasNext())
{
ParticlePool pool= (ParticlePool)it.next();
for (int i=0;i<pool.particles.length;i++) {
if (pool.particles[i].inUse()) {
if (pool.particles[i].getEmitter() == emitter) {
pool.particles[i].setLife(-1);
// depends on control dependency: [if], data = [none]
release(pool.particles[i]);
// depends on control dependency: [if], data = [none]
}
}
}
}
}
} } |
public class class_name {
public boolean add(final WorkbenchEntry e) {
// The starting point.
int pos = hashCode(e.ipAddress) & mask;
// There's always an unused entry.
while (workbenchEntry[pos] != null) {
if (Arrays.equals(workbenchEntry[pos].ipAddress, e.ipAddress)) return false;
pos = (pos + 1) & mask;
}
workbenchEntry[pos] = e;
if (++size >= maxFill && n < (1 << 30)) rehash(2 * n);
return true;
} } | public class class_name {
public boolean add(final WorkbenchEntry e) {
// The starting point.
int pos = hashCode(e.ipAddress) & mask;
// There's always an unused entry.
while (workbenchEntry[pos] != null) {
if (Arrays.equals(workbenchEntry[pos].ipAddress, e.ipAddress)) return false;
pos = (pos + 1) & mask; // depends on control dependency: [while], data = [none]
}
workbenchEntry[pos] = e;
if (++size >= maxFill && n < (1 << 30)) rehash(2 * n);
return true;
} } |
public class class_name {
private boolean isBlockFinalizedWithLock(int namespaceId, Block b) {
lock.readLock().lock();
try {
return isBlockFinalizedInternal(namespaceId, b, true);
} finally {
lock.readLock().unlock();
}
} } | public class class_name {
private boolean isBlockFinalizedWithLock(int namespaceId, Block b) {
lock.readLock().lock();
try {
return isBlockFinalizedInternal(namespaceId, b, true); // depends on control dependency: [try], data = [none]
} finally {
lock.readLock().unlock();
}
} } |
public class class_name {
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(importEvent);
} } | public class class_name {
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); // depends on control dependency: [if], data = [none]
}
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId); // depends on control dependency: [if], data = [none]
}
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]); // depends on control dependency: [for], data = [i]
}
}
audit(importEvent);
} } |
public class class_name {
private int readSingleValue()
{
if (ivPos < ivString.length() && ivString.charAt(ivPos) == '*')
{
ivPos++;
return ENCODED_WILD_CARD;
}
int begin = scanToken();
String[] namedValues = ivAttr.getNamedValues();
int result = namedValues == null ? -1 : findNamedValue(begin, namedValues, ivAttr.getMin());
if (result == -1)
{
try
{
result = Integer.valueOf(ivString.substring(begin, ivPos));
} catch (NumberFormatException ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "parse failed", ex);
error(ScheduleExpressionParserException.Error.VALUE); // F7437591.codRev, F743-506
}
if (ivAttr == Attribute.DAY_OF_MONTH && result >= -7 && result <= -1)
{
result = ENCODED_NTH_LAST_DAY_OF_MONTH + -result;
}
else if (result < ivAttr.getMin() || result > ivAttr.getMax())
{
error(ScheduleExpressionParserException.Error.VALUE_RANGE); // F743-506
}
}
// The named values for dayOfMonth are "1st", "2nd", etc, and "Last".
// Next, we need to search for a day of the week.
else if (ivAttr == Attribute.DAY_OF_MONTH)
{
// findNamedValue will have added ivAttr.getMin, which we don't want.
int weekOfMonth = result - ivAttr.getMin();
// Since "Last" might not be followed by a day of the week, we need to
// peek at the next atom. Primitively implement this by saving and
// restoring the position in the parse string.
skipWhitespace();
int savedPos = ivPos;
int dayOfWeek = findNamedValue(scanToken(), DAYS_OF_WEEK, 0);
if (dayOfWeek == -1)
{
if (weekOfMonth != LAST_WEEK_OF_MONTH)
{
error(ScheduleExpressionParserException.Error.MISSING_DAY_OF_WEEK); // F743-506
}
// We parsed "Last x" hoping that x would be a day of the week, but
// it wasn't. Restore the position within the parse string.
ivPos = savedPos;
result = ENCODED_NTH_LAST_DAY_OF_MONTH;
}
else
{
result = ENCODED_NTH_DAY_OF_WEEK_IN_MONTH + (weekOfMonth * 7) + dayOfWeek;
}
}
return result;
} } | public class class_name {
private int readSingleValue()
{
if (ivPos < ivString.length() && ivString.charAt(ivPos) == '*')
{
ivPos++; // depends on control dependency: [if], data = [none]
return ENCODED_WILD_CARD; // depends on control dependency: [if], data = [none]
}
int begin = scanToken();
String[] namedValues = ivAttr.getNamedValues();
int result = namedValues == null ? -1 : findNamedValue(begin, namedValues, ivAttr.getMin());
if (result == -1)
{
try
{
result = Integer.valueOf(ivString.substring(begin, ivPos)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "parse failed", ex);
error(ScheduleExpressionParserException.Error.VALUE); // F7437591.codRev, F743-506
} // depends on control dependency: [catch], data = [none]
if (ivAttr == Attribute.DAY_OF_MONTH && result >= -7 && result <= -1)
{
result = ENCODED_NTH_LAST_DAY_OF_MONTH + -result; // depends on control dependency: [if], data = [none]
}
else if (result < ivAttr.getMin() || result > ivAttr.getMax())
{
error(ScheduleExpressionParserException.Error.VALUE_RANGE); // F743-506 // depends on control dependency: [if], data = [none]
}
}
// The named values for dayOfMonth are "1st", "2nd", etc, and "Last".
// Next, we need to search for a day of the week.
else if (ivAttr == Attribute.DAY_OF_MONTH)
{
// findNamedValue will have added ivAttr.getMin, which we don't want.
int weekOfMonth = result - ivAttr.getMin();
// Since "Last" might not be followed by a day of the week, we need to
// peek at the next atom. Primitively implement this by saving and
// restoring the position in the parse string.
skipWhitespace(); // depends on control dependency: [if], data = [none]
int savedPos = ivPos;
int dayOfWeek = findNamedValue(scanToken(), DAYS_OF_WEEK, 0);
if (dayOfWeek == -1)
{
if (weekOfMonth != LAST_WEEK_OF_MONTH)
{
error(ScheduleExpressionParserException.Error.MISSING_DAY_OF_WEEK); // F743-506 // depends on control dependency: [if], data = [none]
}
// We parsed "Last x" hoping that x would be a day of the week, but
// it wasn't. Restore the position within the parse string.
ivPos = savedPos; // depends on control dependency: [if], data = [none]
result = ENCODED_NTH_LAST_DAY_OF_MONTH; // depends on control dependency: [if], data = [none]
}
else
{
result = ENCODED_NTH_DAY_OF_WEEK_IN_MONTH + (weekOfMonth * 7) + dayOfWeek; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public synchronized <T> T getAttachment(final AttachmentKey<T> key) {
if (key == null) {
return null;
}
return key.cast(attachments.get(key));
} } | public class class_name {
public synchronized <T> T getAttachment(final AttachmentKey<T> key) {
if (key == null) {
return null; // depends on control dependency: [if], data = [none]
}
return key.cast(attachments.get(key));
} } |
public class class_name {
protected static String generateSessionKey(
String prefix,
String fileName,
boolean subFolder,
CmsUser user,
List<CmsGroup> groups) {
StringBuffer result = new StringBuffer(256);
result.append(prefix);
result.append(CmsResource.getFolderPath(fileName).hashCode()).append("_");
result.append(subFolder);
if (user != null) {
// add user to session key
result.append("_").append(user.getName().hashCode());
}
if ((groups != null) && !groups.isEmpty()) {
// add group(s) to session key
StringBuffer groupNames = new StringBuffer(128);
for (Iterator<CmsGroup> i = groups.iterator(); i.hasNext();) {
groupNames.append(i.next().getName());
}
result.append("_").append(groupNames.toString().hashCode());
}
return result.toString();
} } | public class class_name {
protected static String generateSessionKey(
String prefix,
String fileName,
boolean subFolder,
CmsUser user,
List<CmsGroup> groups) {
StringBuffer result = new StringBuffer(256);
result.append(prefix);
result.append(CmsResource.getFolderPath(fileName).hashCode()).append("_");
result.append(subFolder);
if (user != null) {
// add user to session key
result.append("_").append(user.getName().hashCode()); // depends on control dependency: [if], data = [(user]
}
if ((groups != null) && !groups.isEmpty()) {
// add group(s) to session key
StringBuffer groupNames = new StringBuffer(128);
for (Iterator<CmsGroup> i = groups.iterator(); i.hasNext();) {
groupNames.append(i.next().getName()); // depends on control dependency: [for], data = [i]
}
result.append("_").append(groupNames.toString().hashCode()); // depends on control dependency: [if], data = [none]
}
return result.toString();
} } |
public class class_name {
@Override
public EClass getIfcValue() {
if (ifcValueEClass == null) {
ifcValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(1172);
}
return ifcValueEClass;
} } | public class class_name {
@Override
public EClass getIfcValue() {
if (ifcValueEClass == null) {
ifcValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(1172);
// depends on control dependency: [if], data = [none]
}
return ifcValueEClass;
} } |
public class class_name {
public synchronized void fire(T event) {
if (occured) throw new IllegalStateException("SingleEvent already fired");
occured = true;
data = event;
if (listeners != null) {
for (Listener<T> listener : listeners)
listener.fire(event);
listeners = null;
}
if (listenersRunnable != null) {
for (Runnable listener : listenersRunnable)
listener.run();
listenersRunnable = null;
}
} } | public class class_name {
public synchronized void fire(T event) {
if (occured) throw new IllegalStateException("SingleEvent already fired");
occured = true;
data = event;
if (listeners != null) {
for (Listener<T> listener : listeners)
listener.fire(event);
listeners = null;
// depends on control dependency: [if], data = [none]
}
if (listenersRunnable != null) {
for (Runnable listener : listenersRunnable)
listener.run();
listenersRunnable = null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public RemoteWebElement getElement() {
/*
* Note: Rationale behind throwing ParentNotFoundException here.
*
* Container's being a parent type is searched using a locator. When the locator is invalid it will be better to
* throw ParentNotFoundException to the user so that it clearly indicates its the container.
*/
List<WebElement> elements = null;
try {
if (getParent() != null) {
elements = getParent().locateChildElements(getLocator());
} else {
// Its a case where there is a stand alone container and no parent
elements = HtmlElementUtils.locateElements(getLocator());
}
} catch (NoSuchElementException n) {
throw new ParentNotFoundException("Could not find any parent with the locator " + getLocator(), n);
}
if (index <= elements.size()) {
return (RemoteWebElement) elements.get(index);
}
throw new NoSuchElementException("Cannot find Element With index :{" + index + "} in Container"
+ this.getClass().getSimpleName());
} } | public class class_name {
@Override
public RemoteWebElement getElement() {
/*
* Note: Rationale behind throwing ParentNotFoundException here.
*
* Container's being a parent type is searched using a locator. When the locator is invalid it will be better to
* throw ParentNotFoundException to the user so that it clearly indicates its the container.
*/
List<WebElement> elements = null;
try {
if (getParent() != null) {
elements = getParent().locateChildElements(getLocator()); // depends on control dependency: [if], data = [none]
} else {
// Its a case where there is a stand alone container and no parent
elements = HtmlElementUtils.locateElements(getLocator()); // depends on control dependency: [if], data = [none]
}
} catch (NoSuchElementException n) {
throw new ParentNotFoundException("Could not find any parent with the locator " + getLocator(), n);
} // depends on control dependency: [catch], data = [none]
if (index <= elements.size()) {
return (RemoteWebElement) elements.get(index); // depends on control dependency: [if], data = [(index]
}
throw new NoSuchElementException("Cannot find Element With index :{" + index + "} in Container"
+ this.getClass().getSimpleName());
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.