code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public boolean isValid(TagData us) {
if (!Util.isSpecified(us, ITEMS)) {
if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) {
return false;
}
}
return true;
} } | public class class_name {
@Override
public boolean isValid(TagData us) {
if (!Util.isSpecified(us, ITEMS)) {
if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) {
lock.lock();
try {
if(queuing)
return addToQueue(msg, credits);
if(decrement(credits))
return true; // enough credits, message will be sent
queuing=true; // not enough credits, start queuing
return addToQueue(msg, credits);
}
finally {
lock.unlock();
}
} } | public class class_name {
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) {
lock.lock();
try {
if(queuing)
return addToQueue(msg, credits);
if(decrement(credits))
return true; // enough credits, message will be sent
queuing=true; // not enough credits, start queuing // depends on control dependency: [try], data = [none]
return addToQueue(msg, credits); // depends on control dependency: [try], data = [none]
}
finally {
lock.unlock();
}
} } |
public class class_name {
@Override
public UserProfile convert(File file)
{
if(file == null)
return null;
try
{
String text = IO.readFile(file);
if(text == null || text.length() == 0)
return null;
return converter.convert(text);
}
catch (IOException e)
{
throw new SystemException("Unable to convert file:"+
file.getAbsolutePath()+" to user profile ERROR:"+e.getMessage(),e);
}
} } | public class class_name {
@Override
public UserProfile convert(File file)
{
if(file == null)
return null;
try
{
String text = IO.readFile(file);
if(text == null || text.length() == 0)
return null;
return converter.convert(text); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
throw new SystemException("Unable to convert file:"+
file.getAbsolutePath()+" to user profile ERROR:"+e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} } | public class class_name {
private void handleSelfLink(EntityBuilder builder, String resolvedUri) {
if (StringUtils.isBlank(resolvedUri)) {
return;
// depends on control dependency: [if], data = [none]
}
Link link = LinkBuilder.newInstance().setRelationship(Link.RELATIONSHIP_SELF).setHref(resolvedUri).build();
builder.addLink(link);
} } |
public class class_name {
public String readUTF8EncodedString(int stringLength) {
if (stringLength > 0 && this.bufferPosition + stringLength <= this.bufferData.length) {
this.bufferPosition += stringLength;
try {
return new String(this.bufferData, this.bufferPosition - stringLength, stringLength, CHARSET_UTF8);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
}
LOGGER.warning("invalid string length: " + stringLength);
return null;
} } | public class class_name {
public String readUTF8EncodedString(int stringLength) {
if (stringLength > 0 && this.bufferPosition + stringLength <= this.bufferData.length) {
this.bufferPosition += stringLength; // depends on control dependency: [if], data = [none]
try {
return new String(this.bufferData, this.bufferPosition - stringLength, stringLength, CHARSET_UTF8); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
}
LOGGER.warning("invalid string length: " + stringLength);
return null;
} } |
public class class_name {
@Override
protected List<Sudoku> mate(Sudoku parent1,
Sudoku parent2,
int numberOfCrossoverPoints,
Random rng)
{
Sudoku.Cell[][] offspring1 = new Sudoku.Cell[Sudoku.SIZE][];
Sudoku.Cell[][] offspring2 = new Sudoku.Cell[Sudoku.SIZE][];
for (int i = 0; i < Sudoku.SIZE; i++)
{
offspring1[i] = parent1.getRow(i);
offspring2[i] = parent2.getRow(i);
}
// Apply as many cross-overs as required.
Sudoku.Cell[][] temp = new Sudoku.Cell[Sudoku.SIZE][];
for (int i = 0; i < numberOfCrossoverPoints; i++)
{
// Cross-over index is always greater than zero and less than
// the length of the parent so that we always pick a point that
// will result in a meaningful cross-over.
int crossoverIndex = (1 + rng.nextInt(Sudoku.SIZE - 1));
System.arraycopy(offspring1, 0, temp, 0, crossoverIndex);
System.arraycopy(offspring2, 0, offspring1, 0, crossoverIndex);
System.arraycopy(temp, 0, offspring2, 0, crossoverIndex);
}
List<Sudoku> result = new ArrayList<Sudoku>(2);
result.add(new Sudoku(offspring1));
result.add(new Sudoku(offspring2));
return result;
} } | public class class_name {
@Override
protected List<Sudoku> mate(Sudoku parent1,
Sudoku parent2,
int numberOfCrossoverPoints,
Random rng)
{
Sudoku.Cell[][] offspring1 = new Sudoku.Cell[Sudoku.SIZE][];
Sudoku.Cell[][] offspring2 = new Sudoku.Cell[Sudoku.SIZE][];
for (int i = 0; i < Sudoku.SIZE; i++)
{
offspring1[i] = parent1.getRow(i); // depends on control dependency: [for], data = [i]
offspring2[i] = parent2.getRow(i); // depends on control dependency: [for], data = [i]
}
// Apply as many cross-overs as required.
Sudoku.Cell[][] temp = new Sudoku.Cell[Sudoku.SIZE][];
for (int i = 0; i < numberOfCrossoverPoints; i++)
{
// Cross-over index is always greater than zero and less than
// the length of the parent so that we always pick a point that
// will result in a meaningful cross-over.
int crossoverIndex = (1 + rng.nextInt(Sudoku.SIZE - 1));
System.arraycopy(offspring1, 0, temp, 0, crossoverIndex); // depends on control dependency: [for], data = [none]
System.arraycopy(offspring2, 0, offspring1, 0, crossoverIndex); // depends on control dependency: [for], data = [none]
System.arraycopy(temp, 0, offspring2, 0, crossoverIndex); // depends on control dependency: [for], data = [none]
}
List<Sudoku> result = new ArrayList<Sudoku>(2);
result.add(new Sudoku(offspring1));
result.add(new Sudoku(offspring2));
return result;
} } |
public class class_name {
@Override public S fillFromImpl(B builder) {
// DO NOT, because it can already be running: builder.init(false); // check params
this.algo = builder._parms.algoName().toLowerCase();
this.algo_full_name = builder._parms.fullName();
this.supervised = builder.isSupervised();
this.can_build = builder.can_build();
this.visibility = builder.builderVisibility();
job = builder._job == null ? null : new JobV3(builder._job);
// In general, you can ask about a builder in-progress, and the error
// message list can be growing - so you have to be prepared to read it
// racily. Common for Grid searches exploring with broken parameter
// choices.
final ModelBuilder.ValidationMessage[] msgs = builder._messages; // Racily growing; read only once
if( msgs != null ) {
this.messages = new ValidationMessageV3[msgs.length];
int i = 0;
for (ModelBuilder.ValidationMessage vm : msgs) {
if( vm != null ) this.messages[i++] = new ValidationMessageV3().fillFromImpl(vm); // TODO: version // Note: does default field_name mapping
}
// default fieldname hacks
ValidationMessageV3.mapValidationMessageFieldNames(this.messages, new String[]{"_train", "_valid"}, new
String[]{"training_frame", "validation_frame"});
}
this.error_count = builder.error_count();
parameters = createParametersSchema();
parameters.fillFromImpl(builder._parms);
parameters.model_id = builder.dest() == null ? null : new KeyV3.ModelKeyV3(builder.dest());
return (S)this;
} } | public class class_name {
@Override public S fillFromImpl(B builder) {
// DO NOT, because it can already be running: builder.init(false); // check params
this.algo = builder._parms.algoName().toLowerCase();
this.algo_full_name = builder._parms.fullName();
this.supervised = builder.isSupervised();
this.can_build = builder.can_build();
this.visibility = builder.builderVisibility();
job = builder._job == null ? null : new JobV3(builder._job);
// In general, you can ask about a builder in-progress, and the error
// message list can be growing - so you have to be prepared to read it
// racily. Common for Grid searches exploring with broken parameter
// choices.
final ModelBuilder.ValidationMessage[] msgs = builder._messages; // Racily growing; read only once
if( msgs != null ) {
this.messages = new ValidationMessageV3[msgs.length]; // depends on control dependency: [if], data = [none]
int i = 0;
for (ModelBuilder.ValidationMessage vm : msgs) {
if( vm != null ) this.messages[i++] = new ValidationMessageV3().fillFromImpl(vm); // TODO: version // Note: does default field_name mapping
}
// default fieldname hacks
ValidationMessageV3.mapValidationMessageFieldNames(this.messages, new String[]{"_train", "_valid"}, new
String[]{"training_frame", "validation_frame"}); // depends on control dependency: [if], data = [none]
}
this.error_count = builder.error_count();
parameters = createParametersSchema();
parameters.fillFromImpl(builder._parms);
parameters.model_id = builder.dest() == null ? null : new KeyV3.ModelKeyV3(builder.dest());
return (S)this;
} } |
public class class_name {
private void reloadModelWithNewValue(final Long newValue) {
final long newValueAsPrimitive = newValue == null ? getModelUpdatePeriod() : newValue;
for (final PropertyChangeListener listener : modelUpdatePeriodListeners) {
final PropertyChangeEvent event = new PropertyChangeEvent(this, "model", getModelUpdatePeriod(),
newValueAsPrimitive);
listener.propertyChange(event);
}
} } | public class class_name {
private void reloadModelWithNewValue(final Long newValue) {
final long newValueAsPrimitive = newValue == null ? getModelUpdatePeriod() : newValue;
for (final PropertyChangeListener listener : modelUpdatePeriodListeners) {
final PropertyChangeEvent event = new PropertyChangeEvent(this, "model", getModelUpdatePeriod(),
newValueAsPrimitive);
listener.propertyChange(event); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
public ListSigningProfilesResult withProfiles(SigningProfile... profiles) {
if (this.profiles == null) {
setProfiles(new java.util.ArrayList<SigningProfile>(profiles.length));
}
for (SigningProfile ele : profiles) {
this.profiles.add(ele);
}
return this;
} } | public class class_name {
public ListSigningProfilesResult withProfiles(SigningProfile... profiles) {
if (this.profiles == null) {
setProfiles(new java.util.ArrayList<SigningProfile>(profiles.length)); // depends on control dependency: [if], data = [none]
}
for (SigningProfile ele : profiles) {
this.profiles.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void print() {
Iterator<String> iter = getKeys();
while (iter.hasNext()) {
String key = iter.next();
log.info(key + " = " + getRawString(key));
}
} } | public class class_name {
public void print() {
Iterator<String> iter = getKeys();
while (iter.hasNext()) {
String key = iter.next();
log.info(key + " = " + getRawString(key)); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public Cassandra.Client getCassandra() {
if ( !isOpen() ) {
throw new IllegalStateException("getCassandra called on client that was not open. You should not have gotten here.");
}
if ( cassandraClient == null ) {
cassandraClient = new Cassandra.Client(new TBinaryProtocol(transport));
}
return cassandraClient;
} } | public class class_name {
public Cassandra.Client getCassandra() {
if ( !isOpen() ) {
throw new IllegalStateException("getCassandra called on client that was not open. You should not have gotten here.");
}
if ( cassandraClient == null ) {
cassandraClient = new Cassandra.Client(new TBinaryProtocol(transport)); // depends on control dependency: [if], data = [none]
}
return cassandraClient;
} } |
public class class_name {
@Override
public void populateSwapRequest(
ExternalContext externalContext, AttributeSwapRequest attributeSwapRequest) {
final Principal currentUser = externalContext.getCurrentUser();
final String uid = currentUser.getName();
final IPersonAttributes person = this.portalRootPersonAttributeDao.getPerson(uid);
final Map<String, Attribute> currentAttributes =
attributeSwapRequest.getCurrentAttributes();
currentAttributes.clear();
final Set<String> swappableAttributes = this.getSwappableAttributes(externalContext);
for (final String attribute : swappableAttributes) {
final Object value = person.getAttributeValue(attribute);
if (value != null) {
currentAttributes.put(attribute, new Attribute(String.valueOf(value)));
}
}
} } | public class class_name {
@Override
public void populateSwapRequest(
ExternalContext externalContext, AttributeSwapRequest attributeSwapRequest) {
final Principal currentUser = externalContext.getCurrentUser();
final String uid = currentUser.getName();
final IPersonAttributes person = this.portalRootPersonAttributeDao.getPerson(uid);
final Map<String, Attribute> currentAttributes =
attributeSwapRequest.getCurrentAttributes();
currentAttributes.clear();
final Set<String> swappableAttributes = this.getSwappableAttributes(externalContext);
for (final String attribute : swappableAttributes) {
final Object value = person.getAttributeValue(attribute);
if (value != null) {
currentAttributes.put(attribute, new Attribute(String.valueOf(value))); // depends on control dependency: [if], data = [(value]
}
}
} } |
public class class_name {
private String extractArguments( RepositoryOptionImpl[] repositoriesOptions,
ExcludeDefaultRepositoriesOption[] excludeDefaultRepositoriesOptions )
{
final StringBuilder argument = new StringBuilder();
final boolean excludeDefaultRepositories = excludeDefaultRepositoriesOptions.length > 0;
if( repositoriesOptions.length > 0 || excludeDefaultRepositories )
{
argument.append( "--repositories=" );
if( !excludeDefaultRepositories )
{
argument.append( "+" );
}
for( int i = 0; i < repositoriesOptions.length; i++ )
{
argument.append( repositoriesOptions[ i ].getRepository() );
if( i + 1 < repositoriesOptions.length )
{
argument.append( "," );
}
}
}
return argument.toString();
} } | public class class_name {
private String extractArguments( RepositoryOptionImpl[] repositoriesOptions,
ExcludeDefaultRepositoriesOption[] excludeDefaultRepositoriesOptions )
{
final StringBuilder argument = new StringBuilder();
final boolean excludeDefaultRepositories = excludeDefaultRepositoriesOptions.length > 0;
if( repositoriesOptions.length > 0 || excludeDefaultRepositories )
{
argument.append( "--repositories=" ); // depends on control dependency: [if], data = [none]
if( !excludeDefaultRepositories )
{
argument.append( "+" ); // depends on control dependency: [if], data = [none]
}
for( int i = 0; i < repositoriesOptions.length; i++ )
{
argument.append( repositoriesOptions[ i ].getRepository() ); // depends on control dependency: [for], data = [i]
if( i + 1 < repositoriesOptions.length )
{
argument.append( "," ); // depends on control dependency: [if], data = [none]
}
}
}
return argument.toString();
} } |
public class class_name {
public void marshall(CreateTagsRequest createTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (createTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createTagsRequest.getConfigurationIds(), CONFIGURATIONIDS_BINDING);
protocolMarshaller.marshall(createTagsRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateTagsRequest createTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (createTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createTagsRequest.getConfigurationIds(), CONFIGURATIONIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createTagsRequest.getTags(), TAGS_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 ListIterable<Expression> getSelectExpressionOrder(KunderaQuery query)
{
if (!KunderaQueryUtils.isSelectStatement(query.getJpqlExpression()))
{
return null;
}
Expression selectExpression = ((SelectClause) (query.getSelectStatement()).getSelectClause())
.getSelectExpression();
List<Expression> list;
if (!(selectExpression instanceof CollectionExpression))
{
list = new LinkedList<Expression>();
list.add(selectExpression);
return new SnapshotCloneListIterable<Expression>(list);
}
else
{
return selectExpression.children();
}
} } | public class class_name {
public ListIterable<Expression> getSelectExpressionOrder(KunderaQuery query)
{
if (!KunderaQueryUtils.isSelectStatement(query.getJpqlExpression()))
{
return null; // depends on control dependency: [if], data = [none]
}
Expression selectExpression = ((SelectClause) (query.getSelectStatement()).getSelectClause())
.getSelectExpression();
List<Expression> list;
if (!(selectExpression instanceof CollectionExpression))
{
list = new LinkedList<Expression>(); // depends on control dependency: [if], data = [none]
list.add(selectExpression); // depends on control dependency: [if], data = [none]
return new SnapshotCloneListIterable<Expression>(list); // depends on control dependency: [if], data = [none]
}
else
{
return selectExpression.children(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected int getCenterChild(CacheDataSet cache) {
if (cache.count() == 0)
return -1;
int id = cache.getId(0);
switch (getGravityInternal()) {
case TOP:
case LEFT:
case FRONT:
case FILL:
break;
case BOTTOM:
case RIGHT:
case BACK:
id = cache.getId(cache.count() - 1);
break;
case CENTER:
int i = cache.count() / 2;
while (i < cache.count() && i >= 0) {
id = cache.getId(i);
if (cache.getStartDataOffset(id) <= 0) {
if (cache.getEndDataOffset(id) >= 0) {
break;
} else {
i++;
}
} else {
i--;
}
}
break;
default:
break;
}
Log.d(LAYOUT, TAG, "getCenterChild = %d ", id);
return id;
} } | public class class_name {
protected int getCenterChild(CacheDataSet cache) {
if (cache.count() == 0)
return -1;
int id = cache.getId(0);
switch (getGravityInternal()) {
case TOP:
case LEFT:
case FRONT:
case FILL:
break;
case BOTTOM:
case RIGHT:
case BACK:
id = cache.getId(cache.count() - 1);
break;
case CENTER:
int i = cache.count() / 2;
while (i < cache.count() && i >= 0) {
id = cache.getId(i); // depends on control dependency: [while], data = [none]
if (cache.getStartDataOffset(id) <= 0) {
if (cache.getEndDataOffset(id) >= 0) {
break;
} else {
i++; // depends on control dependency: [if], data = [none]
}
} else {
i--; // depends on control dependency: [if], data = [none]
}
}
break;
default:
break;
}
Log.d(LAYOUT, TAG, "getCenterChild = %d ", id);
return id;
} } |
public class class_name {
@Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false;
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
} } | public class class_name {
@Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false; // depends on control dependency: [if], data = [none]
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
} } |
public class class_name {
@Override
public EClass getIfcCartesianTransformationOperator2D() {
if (ifcCartesianTransformationOperator2DEClass == null) {
ifcCartesianTransformationOperator2DEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(82);
}
return ifcCartesianTransformationOperator2DEClass;
} } | public class class_name {
@Override
public EClass getIfcCartesianTransformationOperator2D() {
if (ifcCartesianTransformationOperator2DEClass == null) {
ifcCartesianTransformationOperator2DEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(82);
// depends on control dependency: [if], data = [none]
}
return ifcCartesianTransformationOperator2DEClass;
} } |
public class class_name {
public static Set<Class> gatherAllBridgeTypes(Set<Class> set, Class leaf) {
set.add(leaf);
for (Class c : leaf.getInterfaces()) {
gatherAllBridgeTypes(set, c);
}
if ((leaf = leaf.getSuperclass()) != null) {
gatherAllBridgeTypes(set, leaf);
}
return set;
} } | public class class_name {
public static Set<Class> gatherAllBridgeTypes(Set<Class> set, Class leaf) {
set.add(leaf);
for (Class c : leaf.getInterfaces()) {
gatherAllBridgeTypes(set, c);
// depends on control dependency: [for], data = [c]
}
if ((leaf = leaf.getSuperclass()) != null) {
gatherAllBridgeTypes(set, leaf);
// depends on control dependency: [if], data = [none]
}
return set;
} } |
public class class_name {
public String[] getClassnames() {
final Attributes attributes = getMainAttributes();
if (null == attributes) {
return null;
}
final String value = attributes.getValue(RUNDECK_PLUGIN_CLASSNAMES);
if (null == value) {
return null;
}
return value.split(",");
} } | public class class_name {
public String[] getClassnames() {
final Attributes attributes = getMainAttributes();
if (null == attributes) {
return null; // depends on control dependency: [if], data = [none]
}
final String value = attributes.getValue(RUNDECK_PLUGIN_CLASSNAMES);
if (null == value) {
return null; // depends on control dependency: [if], data = [none]
}
return value.split(",");
} } |
public class class_name {
public static String formatParagraph(final String src, final int len, final boolean breakOnWhitespace) {
StringBuilder str = new StringBuilder();
int total = src.length();
int from = 0;
while (from < total) {
int to = from + len;
if (to >= total) {
to = total;
} else if (breakOnWhitespace) {
int ndx = StringUtil.lastIndexOfWhitespace(src, to - 1, from);
if (ndx != -1) {
to = ndx + 1;
}
}
int cutFrom = StringUtil.indexOfNonWhitespace(src, from, to);
if (cutFrom != -1) {
int cutTo = StringUtil.lastIndexOfNonWhitespace(src, to - 1, from) + 1;
str.append(src, cutFrom, cutTo);
}
str.append('\n');
from = to;
}
return str.toString();
} } | public class class_name {
public static String formatParagraph(final String src, final int len, final boolean breakOnWhitespace) {
StringBuilder str = new StringBuilder();
int total = src.length();
int from = 0;
while (from < total) {
int to = from + len;
if (to >= total) {
to = total; // depends on control dependency: [if], data = [none]
} else if (breakOnWhitespace) {
int ndx = StringUtil.lastIndexOfWhitespace(src, to - 1, from);
if (ndx != -1) {
to = ndx + 1; // depends on control dependency: [if], data = [none]
}
}
int cutFrom = StringUtil.indexOfNonWhitespace(src, from, to);
if (cutFrom != -1) {
int cutTo = StringUtil.lastIndexOfNonWhitespace(src, to - 1, from) + 1;
str.append(src, cutFrom, cutTo); // depends on control dependency: [if], data = [none]
}
str.append('\n'); // depends on control dependency: [while], data = [none]
from = to; // depends on control dependency: [while], data = [none]
}
return str.toString();
} } |
public class class_name {
public boolean sendMsgByName(String name, String msg) {
Account account = api.getAccountByName(name);
if (null == account) {
log.warn("找不到用户: {}", name);
return false;
}
return this.api.sendText(account.getUserName(), msg);
} } | public class class_name {
public boolean sendMsgByName(String name, String msg) {
Account account = api.getAccountByName(name);
if (null == account) {
log.warn("找不到用户: {}", name); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return this.api.sendText(account.getUserName(), msg);
} } |
public class class_name {
void onSubFolderChange(Boolean value) {
List<I_CmsHistoryResource> historyResources;
try {
CmsObject cms = m_dialogContext.getCms();
historyResources = cms.readDeletedResources(cms.getSitePath(m_resource), value.booleanValue());
initDeletedResources(cms, historyResources);
} catch (CmsException e) {
m_dialogContext.error(e);
}
} } | public class class_name {
void onSubFolderChange(Boolean value) {
List<I_CmsHistoryResource> historyResources;
try {
CmsObject cms = m_dialogContext.getCms();
historyResources = cms.readDeletedResources(cms.getSitePath(m_resource), value.booleanValue()); // depends on control dependency: [try], data = [none]
initDeletedResources(cms, historyResources); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
m_dialogContext.error(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int getBootstrapMaxThreads() {
// Base the bootstrap thread on proc count if not specified
int cpuCount = ProcessorInfo.availableProcessors();
int defaultThreads = cpuCount * 2;
String maxThreads = WildFlySecurityManager.getPropertyPrivileged(BOOTSTRAP_MAX_THREADS, null);
if (maxThreads != null && maxThreads.length() > 0) {
try {
int max = Integer.decode(maxThreads);
defaultThreads = Math.max(max, 1);
} catch(NumberFormatException ex) {
ServerLogger.ROOT_LOGGER.failedToParseCommandLineInteger(BOOTSTRAP_MAX_THREADS, maxThreads);
}
}
return defaultThreads;
} } | public class class_name {
public static int getBootstrapMaxThreads() {
// Base the bootstrap thread on proc count if not specified
int cpuCount = ProcessorInfo.availableProcessors();
int defaultThreads = cpuCount * 2;
String maxThreads = WildFlySecurityManager.getPropertyPrivileged(BOOTSTRAP_MAX_THREADS, null);
if (maxThreads != null && maxThreads.length() > 0) {
try {
int max = Integer.decode(maxThreads);
defaultThreads = Math.max(max, 1); // depends on control dependency: [try], data = [none]
} catch(NumberFormatException ex) {
ServerLogger.ROOT_LOGGER.failedToParseCommandLineInteger(BOOTSTRAP_MAX_THREADS, maxThreads);
} // depends on control dependency: [catch], data = [none]
}
return defaultThreads;
} } |
public class class_name {
private Object doChainedInvocation(URI uri,
MultivaluedMap<String, String> headers,
OperationResourceInfo ori,
Object[] methodParams,
Object body,
int bodyIndex,
Exchange exchange,
Map<String, Object> invocationContext) throws Throwable {
//CHECKSTYLE:ON
Bus configuredBus = getConfiguration().getBus();
Bus origBus = BusFactory.getAndSetThreadDefaultBus(configuredBus);
ClassLoaderHolder origLoader = null;
try {
ClassLoader loader = configuredBus.getExtension(ClassLoader.class);
if (loader != null) {
origLoader = ClassLoaderUtils.setThreadContextClassloader(loader);
}
Message outMessage = createMessage(body, ori, headers, uri,
exchange, invocationContext, true);
if (bodyIndex != -1) {
outMessage.put(Type.class, ori.getMethodToInvoke().getGenericParameterTypes()[bodyIndex]);
}
outMessage.getExchange().setOneWay(ori.isOneway());
setSupportOnewayResponseProperty(outMessage);
outMessage.setContent(OperationResourceInfo.class, ori);
setPlainOperationNameProperty(outMessage, ori.getMethodToInvoke().getName());
outMessage.getExchange().put(Method.class, ori.getMethodToInvoke());
outMessage.put(Annotation.class.getName(),
getMethodAnnotations(ori.getAnnotatedMethod(), bodyIndex));
outMessage.getExchange().put(Message.SERVICE_OBJECT, proxy);
if (methodParams != null) {
outMessage.put(List.class, Arrays.asList(methodParams));
}
if (body != null) {
outMessage.put(PROXY_METHOD_PARAM_BODY_INDEX, bodyIndex);
}
outMessage.getInterceptorChain().add(bodyWriter);
Map<String, Object> reqContext = getRequestContext(outMessage);
reqContext.put(OperationResourceInfo.class.getName(), ori);
reqContext.put(PROXY_METHOD_PARAM_BODY_INDEX, bodyIndex);
// execute chain
InvocationCallback<Object> asyncCallback = checkAsyncCallback(ori, reqContext, outMessage);
if (asyncCallback != null) {
return doInvokeAsync(ori, outMessage, asyncCallback);
}
doRunInterceptorChain(outMessage);
Object[] results = preProcessResult(outMessage);
if (results != null && results.length == 1) {
return results[0];
}
try {
return handleResponse(outMessage, ori.getClassResourceInfo().getServiceClass());
} finally {
completeExchange(outMessage.getExchange(), true);
}
} finally {
if (origLoader != null) {
origLoader.reset();
}
if (origBus != configuredBus) {
BusFactory.setThreadDefaultBus(origBus);
}
}
} } | public class class_name {
private Object doChainedInvocation(URI uri,
MultivaluedMap<String, String> headers,
OperationResourceInfo ori,
Object[] methodParams,
Object body,
int bodyIndex,
Exchange exchange,
Map<String, Object> invocationContext) throws Throwable {
//CHECKSTYLE:ON
Bus configuredBus = getConfiguration().getBus();
Bus origBus = BusFactory.getAndSetThreadDefaultBus(configuredBus);
ClassLoaderHolder origLoader = null;
try {
ClassLoader loader = configuredBus.getExtension(ClassLoader.class);
if (loader != null) {
origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); // depends on control dependency: [if], data = [(loader]
}
Message outMessage = createMessage(body, ori, headers, uri,
exchange, invocationContext, true);
if (bodyIndex != -1) {
outMessage.put(Type.class, ori.getMethodToInvoke().getGenericParameterTypes()[bodyIndex]); // depends on control dependency: [if], data = [none]
}
outMessage.getExchange().setOneWay(ori.isOneway());
setSupportOnewayResponseProperty(outMessage);
outMessage.setContent(OperationResourceInfo.class, ori);
setPlainOperationNameProperty(outMessage, ori.getMethodToInvoke().getName());
outMessage.getExchange().put(Method.class, ori.getMethodToInvoke());
outMessage.put(Annotation.class.getName(),
getMethodAnnotations(ori.getAnnotatedMethod(), bodyIndex));
outMessage.getExchange().put(Message.SERVICE_OBJECT, proxy);
if (methodParams != null) {
outMessage.put(List.class, Arrays.asList(methodParams)); // depends on control dependency: [if], data = [(methodParams]
}
if (body != null) {
outMessage.put(PROXY_METHOD_PARAM_BODY_INDEX, bodyIndex); // depends on control dependency: [if], data = [none]
}
outMessage.getInterceptorChain().add(bodyWriter);
Map<String, Object> reqContext = getRequestContext(outMessage);
reqContext.put(OperationResourceInfo.class.getName(), ori);
reqContext.put(PROXY_METHOD_PARAM_BODY_INDEX, bodyIndex);
// execute chain
InvocationCallback<Object> asyncCallback = checkAsyncCallback(ori, reqContext, outMessage);
if (asyncCallback != null) {
return doInvokeAsync(ori, outMessage, asyncCallback); // depends on control dependency: [if], data = [none]
}
doRunInterceptorChain(outMessage);
Object[] results = preProcessResult(outMessage);
if (results != null && results.length == 1) {
return results[0]; // depends on control dependency: [if], data = [none]
}
try {
return handleResponse(outMessage, ori.getClassResourceInfo().getServiceClass()); // depends on control dependency: [try], data = [none]
} finally {
completeExchange(outMessage.getExchange(), true);
}
} finally {
if (origLoader != null) {
origLoader.reset(); // depends on control dependency: [if], data = [none]
}
if (origBus != configuredBus) {
BusFactory.setThreadDefaultBus(origBus); // depends on control dependency: [if], data = [(origBus]
}
}
} } |
public class class_name {
public final void updateAAD(byte[] src, int offset, int len) {
checkCipherState();
// Input sanity check
if ((src == null) || (offset < 0) || (len < 0)
|| ((len + offset) > src.length)) {
throw new IllegalArgumentException("Bad arguments");
}
updateProviderIfNeeded();
if (len == 0) {
return;
}
spi.engineUpdateAAD(src, offset, len);
} } | public class class_name {
public final void updateAAD(byte[] src, int offset, int len) {
checkCipherState();
// Input sanity check
if ((src == null) || (offset < 0) || (len < 0)
|| ((len + offset) > src.length)) {
throw new IllegalArgumentException("Bad arguments");
}
updateProviderIfNeeded();
if (len == 0) {
return; // depends on control dependency: [if], data = [none]
}
spi.engineUpdateAAD(src, offset, len);
} } |
public class class_name {
public List<SQLProperty> getForeignKeysToEntity(SQLiteEntity entity, String fieldName) {
List<SQLProperty> result = new ArrayList<>();
if (StringUtils.hasText(fieldName)) {
for (SQLProperty item : this.collection) {
if (item.isForeignKey() && entity.getName().equals(item.foreignParentClassName)
&& item.getName().equals(fieldName)) {
result.add(item);
}
}
} else {
for (SQLProperty item : this.collection) {
if (item.isForeignKey() && entity.getName().equals(item.foreignParentClassName)) {
result.add(item);
}
}
}
return result;
} } | public class class_name {
public List<SQLProperty> getForeignKeysToEntity(SQLiteEntity entity, String fieldName) {
List<SQLProperty> result = new ArrayList<>();
if (StringUtils.hasText(fieldName)) {
for (SQLProperty item : this.collection) {
if (item.isForeignKey() && entity.getName().equals(item.foreignParentClassName)
&& item.getName().equals(fieldName)) {
result.add(item); // depends on control dependency: [if], data = [none]
}
}
} else {
for (SQLProperty item : this.collection) {
if (item.isForeignKey() && entity.getName().equals(item.foreignParentClassName)) {
result.add(item); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public Path getPathInHar(Path path) {
Path harPath = new Path(path.toUri().getPath());
if (archivePath.compareTo(harPath) == 0)
return new Path(Path.SEPARATOR);
Path tmp = new Path(harPath.getName());
Path parent = harPath.getParent();
while (!(parent.compareTo(archivePath) == 0)) {
if (parent.toString().equals(Path.SEPARATOR)) {
tmp = null;
break;
}
tmp = new Path(parent.getName(), tmp);
parent = parent.getParent();
}
if (tmp != null)
tmp = new Path(Path.SEPARATOR, tmp);
return tmp;
} } | public class class_name {
public Path getPathInHar(Path path) {
Path harPath = new Path(path.toUri().getPath());
if (archivePath.compareTo(harPath) == 0)
return new Path(Path.SEPARATOR);
Path tmp = new Path(harPath.getName());
Path parent = harPath.getParent();
while (!(parent.compareTo(archivePath) == 0)) {
if (parent.toString().equals(Path.SEPARATOR)) {
tmp = null; // depends on control dependency: [if], data = [none]
break;
}
tmp = new Path(parent.getName(), tmp); // depends on control dependency: [while], data = [none]
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
}
if (tmp != null)
tmp = new Path(Path.SEPARATOR, tmp);
return tmp;
} } |
public class class_name {
private static String translateSchema(String schemaLocation) {
if (OpenCms.getRepositoryManager() != null) {
return OpenCms.getResourceManager().getXsdTranslator().translateResource(schemaLocation);
}
return schemaLocation;
} } | public class class_name {
private static String translateSchema(String schemaLocation) {
if (OpenCms.getRepositoryManager() != null) {
return OpenCms.getResourceManager().getXsdTranslator().translateResource(schemaLocation); // depends on control dependency: [if], data = [none]
}
return schemaLocation;
} } |
public class class_name {
public synchronized void start() {
// ggf. laufenden Thread beenden
stop();
this.thread = new Thread("Flicker Update-Thread") {
public void run() {
// Wir fangen beim ersten Halbbyte an.
halfbyteid = 0;
// Die Clock, die immer hin und her kippt. Wir beginnen bei 1.
// Sonst wuerde das allererste Zeichen nur einmal uebertragen
// werden, was bewirkt, dass der Code erst einmal komplett
// durchlaufen muesste, bevor wir einen kompletten gesendet haetten
clock = 1;
try {
// Die Endlos-Schleife mit der Uebertragung
while (true) {
int[] bits = bitarray.get(halfbyteid);
bits[0] = clock;
paint(bits[0] == 1, bits[1] == 1, bits[2] == 1, bits[3] == 1, bits[4] == 1);
clock--;
if (clock < 0) {
clock = 1;
// Jedes Zeichen muss doppelt uebertragen werden. Einmal mit clock 0
// und einmal mit clock 1.
halfbyteid++;
if (halfbyteid >= bitarray.size()) {
halfbyteid = 0;
// Wir sind einmal mit dem Code komplett durch
iterations++;
done(iterations);
}
}
// Warten
// Wir errechnen die Wartezeit in jedem Durchlauf.
// Dann kann die Frequenz auch waehrend des Blinkens geaendert werden.
long sleep = 1000L / freq;
sleep(sleep);
}
} catch (InterruptedException e) {
// Ende der Anzeige
}
}
};
thread.start();
} } | public class class_name {
public synchronized void start() {
// ggf. laufenden Thread beenden
stop();
this.thread = new Thread("Flicker Update-Thread") {
public void run() {
// Wir fangen beim ersten Halbbyte an.
halfbyteid = 0;
// Die Clock, die immer hin und her kippt. Wir beginnen bei 1.
// Sonst wuerde das allererste Zeichen nur einmal uebertragen
// werden, was bewirkt, dass der Code erst einmal komplett
// durchlaufen muesste, bevor wir einen kompletten gesendet haetten
clock = 1;
try {
// Die Endlos-Schleife mit der Uebertragung
while (true) {
int[] bits = bitarray.get(halfbyteid);
bits[0] = clock; // depends on control dependency: [while], data = [none]
paint(bits[0] == 1, bits[1] == 1, bits[2] == 1, bits[3] == 1, bits[4] == 1); // depends on control dependency: [while], data = [none]
clock--; // depends on control dependency: [while], data = [none]
if (clock < 0) {
clock = 1; // depends on control dependency: [if], data = [none]
// Jedes Zeichen muss doppelt uebertragen werden. Einmal mit clock 0
// und einmal mit clock 1.
halfbyteid++; // depends on control dependency: [if], data = [none]
if (halfbyteid >= bitarray.size()) {
halfbyteid = 0; // depends on control dependency: [if], data = [none]
// Wir sind einmal mit dem Code komplett durch
iterations++; // depends on control dependency: [if], data = [none]
done(iterations); // depends on control dependency: [if], data = [none]
}
}
// Warten
// Wir errechnen die Wartezeit in jedem Durchlauf.
// Dann kann die Frequenz auch waehrend des Blinkens geaendert werden.
long sleep = 1000L / freq;
sleep(sleep); // depends on control dependency: [while], data = [none]
}
} catch (InterruptedException e) {
// Ende der Anzeige
} // depends on control dependency: [catch], data = [none]
}
};
thread.start();
} } |
public class class_name {
private List<String> fixSpaceInURL(List<String> values, int requiredSize) {
// Do validity check. 3rd from last is a date of 14 numeric
// characters. The 4th from last is IP, all before the IP
// should be concatenated together with a '%20' joiner.
// In the below, '4' is 4th field from end which has the IP.
if (!(values.size() > requiredSize) || values.size() < 4) {
return values;
}
// Test 3rd field is valid date.
if (!isDate((String) values.get(values.size() - 3))) {
return values;
}
// Test 4th field is valid IP.
if (!isLegitimateIPValue((String) values.get(values.size() - 4))) {
return values;
}
List<String> newValues = new ArrayList<String>(requiredSize);
StringBuffer url = new StringBuffer();
for (int i = 0; i < (values.size() - 4); i++) {
if (i > 0) {
url.append("%20");
}
url.append(values.get(i));
}
newValues.add(url.toString());
for (int i = values.size() - 4; i < values.size(); i++) {
newValues.add(values.get(i));
}
return newValues;
} } | public class class_name {
private List<String> fixSpaceInURL(List<String> values, int requiredSize) {
// Do validity check. 3rd from last is a date of 14 numeric
// characters. The 4th from last is IP, all before the IP
// should be concatenated together with a '%20' joiner.
// In the below, '4' is 4th field from end which has the IP.
if (!(values.size() > requiredSize) || values.size() < 4) {
return values; // depends on control dependency: [if], data = [none]
}
// Test 3rd field is valid date.
if (!isDate((String) values.get(values.size() - 3))) {
return values; // depends on control dependency: [if], data = [none]
}
// Test 4th field is valid IP.
if (!isLegitimateIPValue((String) values.get(values.size() - 4))) {
return values; // depends on control dependency: [if], data = [none]
}
List<String> newValues = new ArrayList<String>(requiredSize);
StringBuffer url = new StringBuffer();
for (int i = 0; i < (values.size() - 4); i++) {
if (i > 0) {
url.append("%20"); // depends on control dependency: [if], data = [none]
}
url.append(values.get(i)); // depends on control dependency: [for], data = [i]
}
newValues.add(url.toString());
for (int i = values.size() - 4; i < values.size(); i++) {
newValues.add(values.get(i)); // depends on control dependency: [for], data = [i]
}
return newValues;
} } |
public class class_name {
public void addExplorerTypeSetting(CmsExplorerTypeSettings settings) {
m_explorerTypeSettingsFromXml.add(settings);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_ADD_TYPE_SETTING_1, settings.getName()));
}
if (m_explorerTypeSettings != null) {
// reset the list of all explorer type settings, but not during startup
initExplorerTypeSettings();
}
} } | public class class_name {
public void addExplorerTypeSetting(CmsExplorerTypeSettings settings) {
m_explorerTypeSettingsFromXml.add(settings);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_ADD_TYPE_SETTING_1, settings.getName())); // depends on control dependency: [if], data = [none]
}
if (m_explorerTypeSettings != null) {
// reset the list of all explorer type settings, but not during startup
initExplorerTypeSettings(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setConfigurationSets(java.util.Collection<String> configurationSets) {
if (configurationSets == null) {
this.configurationSets = null;
return;
}
this.configurationSets = new java.util.ArrayList<String>(configurationSets);
} } | public class class_name {
public void setConfigurationSets(java.util.Collection<String> configurationSets) {
if (configurationSets == null) {
this.configurationSets = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.configurationSets = new java.util.ArrayList<String>(configurationSets);
} } |
public class class_name {
private void versionDependencyError(String message, String actual, String minimum) {
if (isSnapshot(actual) || isSnapshot(minimum)) {
LOGGER.log(WARNING, "Suppressing dependency error in {0} v{1}: {2}", new Object[] {getLongName(), getVersion(), message});
} else {
dependencyErrors.put(message, false);
}
} } | public class class_name {
private void versionDependencyError(String message, String actual, String minimum) {
if (isSnapshot(actual) || isSnapshot(minimum)) {
LOGGER.log(WARNING, "Suppressing dependency error in {0} v{1}: {2}", new Object[] {getLongName(), getVersion(), message}); // depends on control dependency: [if], data = [none]
} else {
dependencyErrors.put(message, false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void doDelayedPostConstruct(Object obj) {
// after injection then PostConstruct annotated methods on the host object needs to be invoked.
// in WAS7 no RuntimeException is thrown at all, set THROW_POSTCONSTRUCT_EXCEPTION=false to reverse back to V7
Throwable t = wrapper.invokeAnnotTypeOnObjectAndHierarchy(obj, ANNOT_TYPE.POST_CONSTRUCT);
if (null != t && WCCustomProperties.THROW_POSTCONSTRUCT_EXCEPTION){ //PM63754
// log exception - and process InjectionExceptions so the error will be returned to the client as an error.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "doDelayedPostConstruct", "Exception caught during post construct processing: " + t);
}
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} else {
throw new RuntimeException(t);
}
}
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.exiting(CLASS_NAME, "doDelayedPostConstruct", t);
}
} } | public class class_name {
public void doDelayedPostConstruct(Object obj) {
// after injection then PostConstruct annotated methods on the host object needs to be invoked.
// in WAS7 no RuntimeException is thrown at all, set THROW_POSTCONSTRUCT_EXCEPTION=false to reverse back to V7
Throwable t = wrapper.invokeAnnotTypeOnObjectAndHierarchy(obj, ANNOT_TYPE.POST_CONSTRUCT);
if (null != t && WCCustomProperties.THROW_POSTCONSTRUCT_EXCEPTION){ //PM63754
// log exception - and process InjectionExceptions so the error will be returned to the client as an error.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "doDelayedPostConstruct", "Exception caught during post construct processing: " + t); // depends on control dependency: [if], data = [none]
}
if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} else {
throw new RuntimeException(t);
}
}
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.exiting(CLASS_NAME, "doDelayedPostConstruct", t); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public CompoundCurve toCompoundCurveFromOptions(
MultiPolylineOptions multiPolylineOptions, boolean hasZ,
boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (PolylineOptions polyline : multiPolylineOptions
.getPolylineOptions()) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString);
}
return compoundCurve;
} } | public class class_name {
public CompoundCurve toCompoundCurveFromOptions(
MultiPolylineOptions multiPolylineOptions, boolean hasZ,
boolean hasM) {
CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM);
for (PolylineOptions polyline : multiPolylineOptions
.getPolylineOptions()) {
LineString lineString = toLineString(polyline);
compoundCurve.addLineString(lineString); // depends on control dependency: [for], data = [none]
}
return compoundCurve;
} } |
public class class_name {
public BeanId find(BeanId beanId)
{
BeanId[] buckets = this.ivBuckets;
BeanId element = buckets[(beanId.hashValue & 0x7FFFFFFF) % buckets.length];
if (element == null ||
!element.equals(beanId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
Tr.debug(tc, "BeanId not found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
element = beanId;
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds;
++ivCacheHits;
Tr.debug(tc, "BeanId found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds);
}
}
return element;
} } | public class class_name {
public BeanId find(BeanId beanId)
{
BeanId[] buckets = this.ivBuckets;
BeanId element = buckets[(beanId.hashValue & 0x7FFFFFFF) % buckets.length];
if (element == null ||
!element.equals(beanId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds; // depends on control dependency: [if], data = [none]
Tr.debug(tc, "BeanId not found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds); // depends on control dependency: [if], data = [none]
}
element = beanId; // depends on control dependency: [if], data = [none]
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
++ivCacheFinds; // depends on control dependency: [if], data = [none]
++ivCacheHits; // depends on control dependency: [if], data = [none]
Tr.debug(tc, "BeanId found in BeanId Cache : " +
ivCacheHits + " / " + ivCacheFinds); // depends on control dependency: [if], data = [none]
}
}
return element;
} } |
public class class_name {
public ExecS_CliParser addAllOptions(ApplicationOption<?>[] options){
if(options!=null){
for(ApplicationOption<?> option : options){
this.addOption(option);
}
}
return this;
} } | public class class_name {
public ExecS_CliParser addAllOptions(ApplicationOption<?>[] options){
if(options!=null){
for(ApplicationOption<?> option : options){
this.addOption(option);
// depends on control dependency: [for], data = [option]
}
}
return this;
} } |
public class class_name {
private List<Data> loadAndGet(List<Data> keys) {
try {
Map entries = mapDataStore.loadAll(keys);
return getKeyValueSequence(entries);
} catch (Throwable t) {
logger.warning("Could not load keys from map store", t);
throw ExceptionUtil.rethrow(t);
}
} } | public class class_name {
private List<Data> loadAndGet(List<Data> keys) {
try {
Map entries = mapDataStore.loadAll(keys);
return getKeyValueSequence(entries); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
logger.warning("Could not load keys from map store", t);
throw ExceptionUtil.rethrow(t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String queryAttribute(String property) {
try {
Object oldValue = null;
if (property.charAt(0) == RpcConstants.HIDE_KEY_PREFIX) {
// 方法级配置 例如.echoStr.timeout
String methodAndP = property.substring(1);
int index = methodAndP.indexOf(RpcConstants.HIDE_KEY_PREFIX);
if (index <= 0) {
throw ExceptionUtils.buildRuntime(property, "", "Unknown query attribute key!");
}
String methodName = methodAndP.substring(0, index);
String methodProperty = methodAndP.substring(index + 1);
MethodConfig methodConfig = getMethodConfig(methodName);
if (methodConfig != null) {
Method getMethod = ReflectUtils.getPropertyGetterMethod(MethodConfig.class, methodProperty);
Class propertyClazz = getMethod.getReturnType(); // 旧值的类型
oldValue = BeanUtils.getProperty(methodConfig, methodProperty, propertyClazz);
}
} else { // 接口级配置 例如timeout
// 先通过get方法找到类型
Method getMethod = ReflectUtils.getPropertyGetterMethod(getClass(), property);
Class propertyClazz = getMethod.getReturnType(); // 旧值的类型
// 拿到旧的值
oldValue = BeanUtils.getProperty(this, property, propertyClazz);
}
return oldValue == null ? null : oldValue.toString();
} catch (Exception e) {
throw new SofaRpcRuntimeException("Exception when query attribute, The key is " + property, e);
}
} } | public class class_name {
public String queryAttribute(String property) {
try {
Object oldValue = null;
if (property.charAt(0) == RpcConstants.HIDE_KEY_PREFIX) {
// 方法级配置 例如.echoStr.timeout
String methodAndP = property.substring(1);
int index = methodAndP.indexOf(RpcConstants.HIDE_KEY_PREFIX);
if (index <= 0) {
throw ExceptionUtils.buildRuntime(property, "", "Unknown query attribute key!");
}
String methodName = methodAndP.substring(0, index);
String methodProperty = methodAndP.substring(index + 1);
MethodConfig methodConfig = getMethodConfig(methodName);
if (methodConfig != null) {
Method getMethod = ReflectUtils.getPropertyGetterMethod(MethodConfig.class, methodProperty);
Class propertyClazz = getMethod.getReturnType(); // 旧值的类型
oldValue = BeanUtils.getProperty(methodConfig, methodProperty, propertyClazz); // depends on control dependency: [if], data = [(methodConfig]
}
} else { // 接口级配置 例如timeout
// 先通过get方法找到类型
Method getMethod = ReflectUtils.getPropertyGetterMethod(getClass(), property);
Class propertyClazz = getMethod.getReturnType(); // 旧值的类型
// 拿到旧的值
oldValue = BeanUtils.getProperty(this, property, propertyClazz); // depends on control dependency: [if], data = [none]
}
return oldValue == null ? null : oldValue.toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SofaRpcRuntimeException("Exception when query attribute, The key is " + property, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected CmsADEConfigDataInternal mergeConfigurations(List<CmsADEConfigDataInternal> configurations) {
if (configurations.isEmpty()) {
return new CmsADEConfigDataInternal(null);
}
for (int i = 0; i < (configurations.size() - 1); i++) {
configurations.get(i + 1).mergeParent(configurations.get(i));
}
CmsADEConfigDataInternal result = configurations.get(configurations.size() - 1);
result.processModuleOrdering();
return result;
} } | public class class_name {
protected CmsADEConfigDataInternal mergeConfigurations(List<CmsADEConfigDataInternal> configurations) {
if (configurations.isEmpty()) {
return new CmsADEConfigDataInternal(null); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < (configurations.size() - 1); i++) {
configurations.get(i + 1).mergeParent(configurations.get(i)); // depends on control dependency: [for], data = [i]
}
CmsADEConfigDataInternal result = configurations.get(configurations.size() - 1);
result.processModuleOrdering();
return result;
} } |
public class class_name {
@Override
public ORecordIteratorCluster<REC> setLiveUpdated(boolean iLiveUpdated) {
super.setLiveUpdated(iLiveUpdated);
// SET THE RANGE LIMITS
if (iLiveUpdated) {
firstClusterEntry = 0L;
lastClusterEntry = Long.MAX_VALUE;
} else {
final long[] range = database.getStorage().getClusterDataRange(current.getClusterId());
firstClusterEntry = range[0];
lastClusterEntry = range[1];
}
totalAvailableRecords = database.countClusterElements(current.getClusterId());
return this;
} } | public class class_name {
@Override
public ORecordIteratorCluster<REC> setLiveUpdated(boolean iLiveUpdated) {
super.setLiveUpdated(iLiveUpdated);
// SET THE RANGE LIMITS
if (iLiveUpdated) {
firstClusterEntry = 0L;
// depends on control dependency: [if], data = [none]
lastClusterEntry = Long.MAX_VALUE;
// depends on control dependency: [if], data = [none]
} else {
final long[] range = database.getStorage().getClusterDataRange(current.getClusterId());
firstClusterEntry = range[0];
// depends on control dependency: [if], data = [none]
lastClusterEntry = range[1];
// depends on control dependency: [if], data = [none]
}
totalAvailableRecords = database.countClusterElements(current.getClusterId());
return this;
} } |
public class class_name {
static public final String format1ForSource(String s) {
StringBuilder buffer = new StringBuilder();
buffer.append("\"");
for (int i=0; i<s.length();) {
char c = s.charAt(i++);
if (c < '\u0020' || c == '"' || c == '\\') {
if (c == '\n') {
buffer.append("\\n");
} else if (c == '\t') {
buffer.append("\\t");
} else if (c == '\r') {
buffer.append("\\r");
} else {
// Represent control characters, backslash and double quote
// using octal notation; otherwise the string we form
// won't compile, since Unicode escape sequences are
// processed before tokenization.
buffer.append('\\');
buffer.append(HEX_DIGIT[(c & 0700) >> 6]); // HEX_DIGIT works for octal
buffer.append(HEX_DIGIT[(c & 0070) >> 3]);
buffer.append(HEX_DIGIT[(c & 0007)]);
}
}
else if (c <= '\u007E') {
buffer.append(c);
}
else {
buffer.append("\\u");
buffer.append(HEX_DIGIT[(c & 0xF000) >> 12]);
buffer.append(HEX_DIGIT[(c & 0x0F00) >> 8]);
buffer.append(HEX_DIGIT[(c & 0x00F0) >> 4]);
buffer.append(HEX_DIGIT[(c & 0x000F)]);
}
}
buffer.append('"');
return buffer.toString();
} } | public class class_name {
static public final String format1ForSource(String s) {
StringBuilder buffer = new StringBuilder();
buffer.append("\"");
for (int i=0; i<s.length();) {
char c = s.charAt(i++);
if (c < '\u0020' || c == '"' || c == '\\') {
if (c == '\n') {
buffer.append("\\n"); // depends on control dependency: [if], data = [none]
} else if (c == '\t') {
buffer.append("\\t"); // depends on control dependency: [if], data = [none]
} else if (c == '\r') {
buffer.append("\\r"); // depends on control dependency: [if], data = [none]
} else {
// Represent control characters, backslash and double quote
// using octal notation; otherwise the string we form
// won't compile, since Unicode escape sequences are
// processed before tokenization.
buffer.append('\\'); // depends on control dependency: [if], data = [none]
buffer.append(HEX_DIGIT[(c & 0700) >> 6]); // HEX_DIGIT works for octal // depends on control dependency: [if], data = [(c]
buffer.append(HEX_DIGIT[(c & 0070) >> 3]); // depends on control dependency: [if], data = [(c]
buffer.append(HEX_DIGIT[(c & 0007)]); // depends on control dependency: [if], data = [(c]
}
}
else if (c <= '\u007E') {
buffer.append(c); // depends on control dependency: [if], data = [(c]
}
else {
buffer.append("\\u"); // depends on control dependency: [if], data = [none]
buffer.append(HEX_DIGIT[(c & 0xF000) >> 12]); // depends on control dependency: [if], data = [(c]
buffer.append(HEX_DIGIT[(c & 0x0F00) >> 8]); // depends on control dependency: [if], data = [(c]
buffer.append(HEX_DIGIT[(c & 0x00F0) >> 4]); // depends on control dependency: [if], data = [(c]
buffer.append(HEX_DIGIT[(c & 0x000F)]); // depends on control dependency: [if], data = [(c]
}
}
buffer.append('"');
return buffer.toString();
} } |
public class class_name {
private List<int[]> getPairPositionList(byte[] fingerprint) {
int numFrames = FingerprintManager.getNumFrames(fingerprint);
// table for paired frames
byte[] pairedFrameTable = new byte[numFrames / anchorPointsIntervalLength + 1]; // each second has numAnchorPointsPerSecond pairs only
// end table for paired frames
List<int[]> pairList = new LinkedList<>();
List<int[]> sortedCoordinateList = getSortedCoordinateList(fingerprint);
for (int[] anchorPoint : sortedCoordinateList) {
int anchorX = anchorPoint[0];
int anchorY = anchorPoint[1];
int numPairs = 0;
for (int[] aSortedCoordinateList : sortedCoordinateList) {
if (numPairs >= maxPairs) {
break;
}
if (isReferencePairing && pairedFrameTable[anchorX
/ anchorPointsIntervalLength] >= numAnchorPointsPerInterval) {
break;
}
int targetX = aSortedCoordinateList[0];
int targetY = aSortedCoordinateList[1];
if (anchorX == targetX && anchorY == targetY) {
continue;
}
// pair up the points
int x1, y1, x2, y2; // x2 always >= x1
if (targetX >= anchorX) {
x2 = targetX;
y2 = targetY;
x1 = anchorX;
y1 = anchorY;
} else {
x2 = anchorX;
y2 = anchorY;
x1 = targetX;
y1 = targetY;
}
// check target zone
if ((x2 - x1) > maxTargetZoneDistance) {
continue;
}
// end check target zone
// check filter bank zone
if (!(y1 / bandwidthPerBank == y2 / bandwidthPerBank)) {
continue; // same filter bank should have equal value
}
// end check filter bank zone
int pairHashcode = (x2 - x1) * numFrequencyUnits * numFrequencyUnits + y2 * numFrequencyUnits + y1;
// stop list applied on sample pairing only
if (!isReferencePairing && stopPairTable.containsKey(pairHashcode)) {
numPairs++; // no reservation
continue; // escape this point only
}
// end stop list applied on sample pairing only
// pass all rules
pairList.add(new int[] {pairHashcode, anchorX});
pairedFrameTable[anchorX / anchorPointsIntervalLength]++;
numPairs++;
// end pair up the points
}
}
return pairList;
} } | public class class_name {
private List<int[]> getPairPositionList(byte[] fingerprint) {
int numFrames = FingerprintManager.getNumFrames(fingerprint);
// table for paired frames
byte[] pairedFrameTable = new byte[numFrames / anchorPointsIntervalLength + 1]; // each second has numAnchorPointsPerSecond pairs only
// end table for paired frames
List<int[]> pairList = new LinkedList<>();
List<int[]> sortedCoordinateList = getSortedCoordinateList(fingerprint);
for (int[] anchorPoint : sortedCoordinateList) {
int anchorX = anchorPoint[0];
int anchorY = anchorPoint[1];
int numPairs = 0;
for (int[] aSortedCoordinateList : sortedCoordinateList) {
if (numPairs >= maxPairs) {
break;
}
if (isReferencePairing && pairedFrameTable[anchorX
/ anchorPointsIntervalLength] >= numAnchorPointsPerInterval) {
break;
}
int targetX = aSortedCoordinateList[0];
int targetY = aSortedCoordinateList[1];
if (anchorX == targetX && anchorY == targetY) {
continue;
}
// pair up the points
int x1, y1, x2, y2; // x2 always >= x1
if (targetX >= anchorX) {
x2 = targetX; // depends on control dependency: [if], data = [none]
y2 = targetY; // depends on control dependency: [if], data = [none]
x1 = anchorX; // depends on control dependency: [if], data = [none]
y1 = anchorY; // depends on control dependency: [if], data = [none]
} else {
x2 = anchorX; // depends on control dependency: [if], data = [none]
y2 = anchorY; // depends on control dependency: [if], data = [none]
x1 = targetX; // depends on control dependency: [if], data = [none]
y1 = targetY; // depends on control dependency: [if], data = [none]
}
// check target zone
if ((x2 - x1) > maxTargetZoneDistance) {
continue;
}
// end check target zone
// check filter bank zone
if (!(y1 / bandwidthPerBank == y2 / bandwidthPerBank)) {
continue; // same filter bank should have equal value
}
// end check filter bank zone
int pairHashcode = (x2 - x1) * numFrequencyUnits * numFrequencyUnits + y2 * numFrequencyUnits + y1;
// stop list applied on sample pairing only
if (!isReferencePairing && stopPairTable.containsKey(pairHashcode)) {
numPairs++; // no reservation // depends on control dependency: [if], data = [none]
continue; // escape this point only
}
// end stop list applied on sample pairing only
// pass all rules
pairList.add(new int[] {pairHashcode, anchorX}); // depends on control dependency: [for], data = [none]
pairedFrameTable[anchorX / anchorPointsIntervalLength]++; // depends on control dependency: [for], data = [none]
numPairs++; // depends on control dependency: [for], data = [none]
// end pair up the points
}
}
return pairList;
} } |
public class class_name {
public static long between(Date s, Date e, long unit) {
Date start;
Date end;
if (s.before(e)) {
start = s;
end = e;
} else {
start = e;
end = s;
}
long diff = end.getTime() - start.getTime();
return diff / unit;
} } | public class class_name {
public static long between(Date s, Date e, long unit) {
Date start;
Date end;
if (s.before(e)) {
start = s;
// depends on control dependency: [if], data = [none]
end = e;
// depends on control dependency: [if], data = [none]
} else {
start = e;
// depends on control dependency: [if], data = [none]
end = s;
// depends on control dependency: [if], data = [none]
}
long diff = end.getTime() - start.getTime();
return diff / unit;
} } |
public class class_name {
public static String getTextValue(Element element) {
String ret = "";
String textContent = element.getTextContent();
if (textContent != null && !textContent.equals("")) {
ret = textContent;
} else if (element.hasAttribute("title")) {
ret = element.getAttribute("title");
} else if (element.hasAttribute("alt")) {
ret = element.getAttribute("alt");
}
if (ret.length() > TEXT_CUTOFF) {
return ret.substring(0, TEXT_CUTOFF);
} else {
return ret;
}
} } | public class class_name {
public static String getTextValue(Element element) {
String ret = "";
String textContent = element.getTextContent();
if (textContent != null && !textContent.equals("")) {
ret = textContent; // depends on control dependency: [if], data = [none]
} else if (element.hasAttribute("title")) {
ret = element.getAttribute("title"); // depends on control dependency: [if], data = [none]
} else if (element.hasAttribute("alt")) {
ret = element.getAttribute("alt"); // depends on control dependency: [if], data = [none]
}
if (ret.length() > TEXT_CUTOFF) {
return ret.substring(0, TEXT_CUTOFF); // depends on control dependency: [if], data = [TEXT_CUTOFF)]
} else {
return ret; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void close(VirtualConnection inVC, Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close(vc, e) called H2InboundLink: " + this + " " + inVC);
}
//At this point our side should be in the close state, as we have sent out our data
//Should probably check if the connection is closed, if so issue the destroy up the chain
//Then call the close on the underlying muxLink so we can close the connection if everything has been closed
//Additionally, don't close the underlying link if this is a push stream
if (streamID == 0 || streamID % 2 == 1) {
// if this isn't an http/2 exception, don't pass it down, since that will cause a GOAWAY to be sent immediately
if (e == null || e instanceof Http2Exception) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: closing with exception: " + e);
}
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (1)httpInboundServiceContextImpl.clear()");
}
httpInboundServiceContextImpl.clear();
httpInboundServiceContextImpl = null;
}
this.muxLink.close(inVC, e);
} else {
H2StreamProcessor h2sp = muxLink.getStreamProcessor(streamID);
if (h2sp != null && !h2sp.isStreamClosed()) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: attempting to reset stream: " + streamID);
}
int PROTOCOL_ERROR = 0x1;
Frame reset = new FrameRstStream(streamID, PROTOCOL_ERROR, false);
h2sp.processNextFrame(reset, Constants.Direction.WRITING_OUT);
} catch (Http2Exception h2e) {
// if we can't write out RST frame, throw the original exception
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (2)httpInboundServiceContextImpl.clear()");
}
httpInboundServiceContextImpl.clear();
httpInboundServiceContextImpl = null;
}
this.muxLink.close(inVC, e);
}
}
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (3)httpInboundServiceContextImpl.clear()");
}
httpInboundServiceContextImpl.clear();
httpInboundServiceContextImpl = null;
}
this.muxLink.close(inVC, null);
}
} else { // try to send an RST_STREAM to let the client know the push promise has been canceled
H2StreamProcessor h2sp = muxLink.getStreamProcessor(streamID);
if (h2sp != null && !h2sp.isStreamClosed() && !h2sp.isHalfClosed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: attempting to reset stream: " + streamID);
}
int PROTOCOL_ERROR = 0x1;
Frame reset = new FrameRstStream(streamID, PROTOCOL_ERROR, false);
try {
h2sp.processNextFrame(reset, Constants.Direction.WRITING_OUT);
} catch (Http2Exception h2e) {
// don't close
}
}
}
} } | public class class_name {
@Override
public void close(VirtualConnection inVC, Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close(vc, e) called H2InboundLink: " + this + " " + inVC); // depends on control dependency: [if], data = [none]
}
//At this point our side should be in the close state, as we have sent out our data
//Should probably check if the connection is closed, if so issue the destroy up the chain
//Then call the close on the underlying muxLink so we can close the connection if everything has been closed
//Additionally, don't close the underlying link if this is a push stream
if (streamID == 0 || streamID % 2 == 1) {
// if this isn't an http/2 exception, don't pass it down, since that will cause a GOAWAY to be sent immediately
if (e == null || e instanceof Http2Exception) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: closing with exception: " + e); // depends on control dependency: [if], data = [none]
}
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (1)httpInboundServiceContextImpl.clear()"); // depends on control dependency: [if], data = [none]
}
httpInboundServiceContextImpl.clear(); // depends on control dependency: [if], data = [none]
httpInboundServiceContextImpl = null; // depends on control dependency: [if], data = [none]
}
this.muxLink.close(inVC, e); // depends on control dependency: [if], data = [none]
} else {
H2StreamProcessor h2sp = muxLink.getStreamProcessor(streamID);
if (h2sp != null && !h2sp.isStreamClosed()) {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: attempting to reset stream: " + streamID); // depends on control dependency: [if], data = [none]
}
int PROTOCOL_ERROR = 0x1;
Frame reset = new FrameRstStream(streamID, PROTOCOL_ERROR, false);
h2sp.processNextFrame(reset, Constants.Direction.WRITING_OUT); // depends on control dependency: [try], data = [none]
} catch (Http2Exception h2e) {
// if we can't write out RST frame, throw the original exception
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (2)httpInboundServiceContextImpl.clear()"); // depends on control dependency: [if], data = [none]
}
httpInboundServiceContextImpl.clear(); // depends on control dependency: [if], data = [none]
httpInboundServiceContextImpl = null; // depends on control dependency: [if], data = [none]
}
this.muxLink.close(inVC, e);
} // depends on control dependency: [catch], data = [none]
}
if (httpInboundServiceContextImpl != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: (3)httpInboundServiceContextImpl.clear()"); // depends on control dependency: [if], data = [none]
}
httpInboundServiceContextImpl.clear(); // depends on control dependency: [if], data = [none]
httpInboundServiceContextImpl = null; // depends on control dependency: [if], data = [none]
}
this.muxLink.close(inVC, null); // depends on control dependency: [if], data = [none]
}
} else { // try to send an RST_STREAM to let the client know the push promise has been canceled
H2StreamProcessor h2sp = muxLink.getStreamProcessor(streamID);
if (h2sp != null && !h2sp.isStreamClosed() && !h2sp.isHalfClosed()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "close: attempting to reset stream: " + streamID); // depends on control dependency: [if], data = [none]
}
int PROTOCOL_ERROR = 0x1;
Frame reset = new FrameRstStream(streamID, PROTOCOL_ERROR, false);
try {
h2sp.processNextFrame(reset, Constants.Direction.WRITING_OUT); // depends on control dependency: [try], data = [none]
} catch (Http2Exception h2e) {
// don't close
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
void collectDbStats(ArrayList<com.couchbase.lite.internal.database.sqlite.SQLiteDebug.DbStats> dbStatsList) {
// Get information about the main database.
int lookaside = nativeGetDbLookaside(mConnectionPtr);
long pageCount = 0;
long pageSize = 0;
try {
pageCount = executeForLong("PRAGMA page_count;", null, null);
pageSize = executeForLong("PRAGMA page_size;", null, null);
} catch (com.couchbase.lite.internal.database.sqlite.exception.SQLiteException ex) {
// Ignore.
}
dbStatsList.add(getMainDbStatsUnsafe(lookaside, pageCount, pageSize));
} } | public class class_name {
void collectDbStats(ArrayList<com.couchbase.lite.internal.database.sqlite.SQLiteDebug.DbStats> dbStatsList) {
// Get information about the main database.
int lookaside = nativeGetDbLookaside(mConnectionPtr);
long pageCount = 0;
long pageSize = 0;
try {
pageCount = executeForLong("PRAGMA page_count;", null, null); // depends on control dependency: [try], data = [none]
pageSize = executeForLong("PRAGMA page_size;", null, null); // depends on control dependency: [try], data = [none]
} catch (com.couchbase.lite.internal.database.sqlite.exception.SQLiteException ex) {
// Ignore.
} // depends on control dependency: [catch], data = [none]
dbStatsList.add(getMainDbStatsUnsafe(lookaside, pageCount, pageSize));
} } |
public class class_name {
public @NotNull FileAssert hasSameContentAs(@NotNull File expected) {
checkNotNull(expected);
isNotNull();
assertExists(actual).assertExists(expected);
try {
LineDiff[] diffs = comparator.compareContents(actual, expected);
if (!isNullOrEmpty(diffs)) {
fail(expected, diffs);
}
} catch (IOException e) {
cannotCompareToExpectedFile(expected, e);
}
return this;
} } | public class class_name {
public @NotNull FileAssert hasSameContentAs(@NotNull File expected) {
checkNotNull(expected);
isNotNull();
assertExists(actual).assertExists(expected);
try {
LineDiff[] diffs = comparator.compareContents(actual, expected);
if (!isNullOrEmpty(diffs)) {
fail(expected, diffs); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
cannotCompareToExpectedFile(expected, e);
} // depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
public EClass getGeometryData() {
if (geometryDataEClass == null) {
geometryDataEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(GeometryPackage.eNS_URI).getEClassifiers().get(4);
}
return geometryDataEClass;
} } | public class class_name {
public EClass getGeometryData() {
if (geometryDataEClass == null) {
geometryDataEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(GeometryPackage.eNS_URI).getEClassifiers().get(4);
// depends on control dependency: [if], data = [none]
}
return geometryDataEClass;
} } |
public class class_name {
public void setBugzillaURL(final String bugzillaURL) {
if (bugzillaURL == null && this.bugzillaURL == null) {
return;
} else if (bugzillaURL == null) {
removeChild(this.bugzillaURL);
this.bugzillaURL = null;
} else if (this.bugzillaURL == null) {
this.bugzillaURL = new KeyValueNode<String>(CommonConstants.CS_BUGZILLA_URL_TITLE, bugzillaURL);
appendChild(this.bugzillaURL, false);
} else {
this.bugzillaURL.setValue(bugzillaURL);
}
} } | public class class_name {
public void setBugzillaURL(final String bugzillaURL) {
if (bugzillaURL == null && this.bugzillaURL == null) {
return; // depends on control dependency: [if], data = [none]
} else if (bugzillaURL == null) {
removeChild(this.bugzillaURL); // depends on control dependency: [if], data = [none]
this.bugzillaURL = null; // depends on control dependency: [if], data = [none]
} else if (this.bugzillaURL == null) {
this.bugzillaURL = new KeyValueNode<String>(CommonConstants.CS_BUGZILLA_URL_TITLE, bugzillaURL); // depends on control dependency: [if], data = [none]
appendChild(this.bugzillaURL, false); // depends on control dependency: [if], data = [(this.bugzillaURL]
} else {
this.bugzillaURL.setValue(bugzillaURL); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String findAlias(String varName) {
if (aliases == null)
return varName;
String alias = aliases.get(varName);
if (alias == null) {
return varName;
}
return alias;
} } | public class class_name {
private String findAlias(String varName) {
if (aliases == null)
return varName;
String alias = aliases.get(varName);
if (alias == null) {
return varName; // depends on control dependency: [if], data = [none]
}
return alias;
} } |
public class class_name {
public static boolean isValid(@Nullable final String hourRange) {
if (hourRange == null) {
return true;
}
final int p = hourRange.indexOf('-');
if (p != 5) {
return false;
}
final String fromStr = hourRange.substring(0, 5);
final String toStr = hourRange.substring(6);
if (!(Hour.isValid(fromStr) && Hour.isValid(toStr))) {
return false;
}
final Hour from = new Hour(fromStr);
final Hour to = new Hour(toStr);
if (from.equals(to)) {
return false;
}
if (from.equals(new Hour(24, 0))) {
return false;
}
return !to.equals(new Hour(0, 0));
} } | public class class_name {
public static boolean isValid(@Nullable final String hourRange) {
if (hourRange == null) {
return true; // depends on control dependency: [if], data = [none]
}
final int p = hourRange.indexOf('-');
if (p != 5) {
return false; // depends on control dependency: [if], data = [none]
}
final String fromStr = hourRange.substring(0, 5);
final String toStr = hourRange.substring(6);
if (!(Hour.isValid(fromStr) && Hour.isValid(toStr))) {
return false; // depends on control dependency: [if], data = [none]
}
final Hour from = new Hour(fromStr);
final Hour to = new Hour(toStr);
if (from.equals(to)) {
return false; // depends on control dependency: [if], data = [none]
}
if (from.equals(new Hour(24, 0))) {
return false; // depends on control dependency: [if], data = [none]
}
return !to.equals(new Hour(0, 0));
} } |
public class class_name {
@Override
public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException {
ChannelSftp sftp;
Progress monitor;
try {
sftp = alloc();
monitor = new Progress();
try {
sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip);
} finally {
free(sftp);
}
return Math.max(0, monitor.sum - skip);
} catch (SftpException e) {
if (e.id == 2 || e.id == 4) {
throw new FileNotFoundException(this);
}
throw new CopyFileToException(this, e);
} catch (JSchException e) {
throw new CopyFileToException(this, e);
}
} } | public class class_name {
@Override
public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException {
ChannelSftp sftp;
Progress monitor;
try {
sftp = alloc();
monitor = new Progress();
try {
sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip); // depends on control dependency: [try], data = [none]
} finally {
free(sftp);
}
return Math.max(0, monitor.sum - skip);
} catch (SftpException e) {
if (e.id == 2 || e.id == 4) {
throw new FileNotFoundException(this);
}
throw new CopyFileToException(this, e);
} catch (JSchException e) {
throw new CopyFileToException(this, e);
}
} } |
public class class_name {
protected boolean closeCamera() {
if( verbose )
Log.i(TAG,"closeCamera() activity="+getClass().getSimpleName());
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Attempted to close camera not on the main looper thread!");
}
boolean closed = false;
// if( verbose ) {
// StackTraceElement[] trace = new RuntimeException().getStackTrace();
// for (int i = 0; i < Math.min(trace.length, 3); i++) {
// System.out.println("[ " + i + " ] = " + trace[i].toString());
// }
// }
// NOTE: Since open can only be called in the main looper this won't be enough to prevent
// it from closing before it opens. That's why open.state exists
open.mLock.lock();
try {
if( verbose )
Log.i(TAG,"closeCamera: camera="+(open.mCameraDevice==null)+" state="+open.state);
closePreviewSession();
// close has been called while trying to open the camera!
if( open.state == CameraState.OPENING ) {
// If it's in this state that means an asych task is opening the camera. By changing the state
// to closing it will not abort that process when the task is called.
open.state = CameraState.CLOSING;
if( open.mCameraDevice != null ) {
throw new RuntimeException("BUG! Camera is opening and should be null until opened");
}
} else {
if (null != open.mCameraDevice) {
closed = true;
open.closeCamera();
}
open.state = CameraState.CLOSED;
open.clearCamera();
}
} finally {
open.mLock.unlock();
}
return closed;
} } | public class class_name {
protected boolean closeCamera() {
if( verbose )
Log.i(TAG,"closeCamera() activity="+getClass().getSimpleName());
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Attempted to close camera not on the main looper thread!");
}
boolean closed = false;
// if( verbose ) {
// StackTraceElement[] trace = new RuntimeException().getStackTrace();
// for (int i = 0; i < Math.min(trace.length, 3); i++) {
// System.out.println("[ " + i + " ] = " + trace[i].toString());
// }
// }
// NOTE: Since open can only be called in the main looper this won't be enough to prevent
// it from closing before it opens. That's why open.state exists
open.mLock.lock();
try {
if( verbose )
Log.i(TAG,"closeCamera: camera="+(open.mCameraDevice==null)+" state="+open.state);
closePreviewSession(); // depends on control dependency: [try], data = [none]
// close has been called while trying to open the camera!
if( open.state == CameraState.OPENING ) {
// If it's in this state that means an asych task is opening the camera. By changing the state
// to closing it will not abort that process when the task is called.
open.state = CameraState.CLOSING; // depends on control dependency: [if], data = [none]
if( open.mCameraDevice != null ) {
throw new RuntimeException("BUG! Camera is opening and should be null until opened");
}
} else {
if (null != open.mCameraDevice) {
closed = true; // depends on control dependency: [if], data = [none]
open.closeCamera(); // depends on control dependency: [if], data = [none]
}
open.state = CameraState.CLOSED; // depends on control dependency: [if], data = [none]
open.clearCamera(); // depends on control dependency: [if], data = [none]
}
} finally {
open.mLock.unlock();
}
return closed;
} } |
public class class_name {
private static MethodDescriptor[] getMdescriptor() {
final MethodDescriptor[] methods = new MethodDescriptor[36];
try {
methods[METHOD_addAttribute0] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
java.lang.String.class, java.lang.Object.class})); // NOI18N
methods[METHOD_addAttribute0].setDisplayName("");
methods[METHOD_addAttribute1] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N
methods[METHOD_addAttribute1].setDisplayName("");
methods[METHOD_addChild2] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N
methods[METHOD_addChild2].setDisplayName("");
methods[METHOD_addChild3] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_addChild3].setDisplayName("");
methods[METHOD_addChild4] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N
methods[METHOD_addChild4].setDisplayName("");
methods[METHOD_addChild5] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_addChild5].setDisplayName("");
methods[METHOD_build6] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("build", new Class[] {})); // NOI18N
methods[METHOD_build6].setDisplayName("");
methods[METHOD_buildPartial7] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("buildPartial",
new Class[] {})); // NOI18N
methods[METHOD_buildPartial7].setDisplayName("");
methods[METHOD_clear8] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clear", new Class[] {})); // NOI18N
methods[METHOD_clear8].setDisplayName("");
methods[METHOD_clone9] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clone", new Class[] {})); // NOI18N
methods[METHOD_clone9].setDisplayName("");
methods[METHOD_getAttribute10] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_getAttribute10].setDisplayName("");
methods[METHOD_getAttribute11] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_getAttribute11].setDisplayName("");
methods[METHOD_getChild12] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_getChild12].setDisplayName("");
methods[METHOD_getChild13] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_getChild13].setDisplayName("");
methods[METHOD_isAttribute14] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isAttribute",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_isAttribute14].setDisplayName("");
methods[METHOD_isFieldIndexed15] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isFieldIndexed",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_isFieldIndexed15].setDisplayName("");
methods[METHOD_mergeFrom16] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("mergeFrom",
new Class[] {com.google.protobuf.Message.class})); // NOI18N
methods[METHOD_mergeFrom16].setDisplayName("");
methods[METHOD_newSavePoint17] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("newSavePoint",
new Class[] {})); // NOI18N
methods[METHOD_newSavePoint17].setDisplayName("");
methods[METHOD_removeAttribute18] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_removeAttribute18].setDisplayName("");
methods[METHOD_removeAttribute19] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
new Class[] {java.lang.String.class, int.class})); // NOI18N
methods[METHOD_removeAttribute19].setDisplayName("");
methods[METHOD_removeChild20] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_removeChild20].setDisplayName("");
methods[METHOD_removeChild21] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_removeChild21].setDisplayName("");
methods[METHOD_setAttribute24] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
java.lang.String.class, java.lang.Object.class})); // NOI18N
methods[METHOD_setAttribute24].setDisplayName("");
methods[METHOD_setAttribute25] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N
methods[METHOD_setAttribute25].setDisplayName("");
methods[METHOD_setChild26] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N
methods[METHOD_setChild26].setDisplayName("");
methods[METHOD_setChild27] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_setChild27].setDisplayName("");
methods[METHOD_setChild28] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N
methods[METHOD_setChild28].setDisplayName("");
methods[METHOD_setChild29] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_setChild29].setDisplayName("");
methods[METHOD_size30] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("size", new Class[] {})); // NOI18N
methods[METHOD_size30].setDisplayName("");
methods[METHOD_toChild31] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_toChild31].setDisplayName("");
methods[METHOD_toChild32] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N
methods[METHOD_toChild32].setDisplayName("");
methods[METHOD_toLastChild33] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toLastChild",
new Class[] {java.lang.String.class})); // NOI18N
methods[METHOD_toLastChild33].setDisplayName("");
methods[METHOD_toParent34] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toParent", new Class[] {})); // NOI18N
methods[METHOD_toParent34].setDisplayName("");
methods[METHOD_toRoot35] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toRoot", new Class[] {})); // NOI18N
methods[METHOD_toRoot35].setDisplayName("");
} catch (final Exception e) {
}// GEN-HEADEREND:Methods
// Here you can add code for customizing the methods array.
return methods;
} } | public class class_name {
private static MethodDescriptor[] getMdescriptor() {
final MethodDescriptor[] methods = new MethodDescriptor[36];
try {
methods[METHOD_addAttribute0] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
java.lang.String.class, java.lang.Object.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addAttribute0].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_addAttribute1] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addAttribute1].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_addChild2] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addChild2].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_addChild3] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addChild3].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_addChild4] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addChild4].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_addChild5] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_addChild5].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_build6] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("build", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_build6].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_buildPartial7] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("buildPartial",
new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_buildPartial7].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_clear8] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clear", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_clear8].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_clone9] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clone", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_clone9].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_getAttribute10] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_getAttribute10].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_getAttribute11] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_getAttribute11].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_getChild12] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_getChild12].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_getChild13] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_getChild13].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_isAttribute14] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isAttribute",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_isAttribute14].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_isFieldIndexed15] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isFieldIndexed",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_isFieldIndexed15].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_mergeFrom16] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("mergeFrom",
new Class[] {com.google.protobuf.Message.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_mergeFrom16].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_newSavePoint17] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("newSavePoint",
new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_newSavePoint17].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_removeAttribute18] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_removeAttribute18].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_removeAttribute19] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
new Class[] {java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_removeAttribute19].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_removeChild20] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_removeChild20].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_removeChild21] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_removeChild21].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setAttribute24] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
java.lang.String.class, java.lang.Object.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setAttribute24].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setAttribute25] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setAttribute25].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setChild26] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setChild26].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setChild27] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setChild27].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setChild28] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setChild28].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_setChild29] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_setChild29].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_size30] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("size", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_size30].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_toChild31] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_toChild31].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_toChild32] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild", new Class[] {
java.lang.String.class, int.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_toChild32].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_toLastChild33] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toLastChild",
new Class[] {java.lang.String.class})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_toLastChild33].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_toParent34] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toParent", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_toParent34].setDisplayName(""); // depends on control dependency: [try], data = [none]
methods[METHOD_toRoot35] =
new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toRoot", new Class[] {})); // NOI18N // depends on control dependency: [try], data = [none]
methods[METHOD_toRoot35].setDisplayName(""); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
}// GEN-HEADEREND:Methods // depends on control dependency: [catch], data = [none]
// Here you can add code for customizing the methods array.
return methods;
} } |
public class class_name {
@Override
public Location translate() {
if (this.location == null || this.location.isEmpty()) {
return Location.OUTLET;
}
Location result;
switch (this.location) {
case "Inlet":
result = Location.INLET;
break;
case "Outlet":
result = Location.OUTLET;
break;
case "Body":
result = Location.BODY;
break;
default:
throw new AssertionError(String.format("Unknown value for Location: '%s'", this.location));
}
return result;
} } | public class class_name {
@Override
public Location translate() {
if (this.location == null || this.location.isEmpty()) {
return Location.OUTLET; // depends on control dependency: [if], data = [none]
}
Location result;
switch (this.location) {
case "Inlet":
result = Location.INLET;
break;
case "Outlet":
result = Location.OUTLET;
break;
case "Body":
result = Location.BODY;
break;
default:
throw new AssertionError(String.format("Unknown value for Location: '%s'", this.location));
}
return result;
} } |
public class class_name {
static ParityFilePair verifyParity(FileStatus src, FileStatus parity,
Codec codec, Configuration conf, FileSystem destFs) throws IOException {
if (parity.getModificationTime() != src.getModificationTime()) {
return null;
}
int stripeLength = codec.stripeLength;
int parityLegnth = codec.parityLength;
long expectedSize = 0;
List<FileStatus> lfs = null;
if (codec.isDirRaid) {
FileSystem srcFs = src.getPath().getFileSystem(conf);
lfs = RaidNode.listDirectoryRaidFileStatus(conf, srcFs,
src.getPath());
if (lfs == null) {
return null;
}
long blockNum = DirectoryStripeReader.getBlockNum(lfs);
long parityBlockSize = DirectoryStripeReader.getParityBlockSize(conf,
lfs);
int parityBlocks = (int)Math.ceil(
((double)blockNum) / stripeLength) * parityLegnth;
expectedSize = parityBlocks * parityBlockSize;
} else {
double sourceBlocks = Math.ceil(
((double)src.getLen()) / src.getBlockSize());
int parityBlocks = (int)Math.ceil(
sourceBlocks / stripeLength) * parityLegnth;
expectedSize = parityBlocks * src.getBlockSize();
}
if (parity.getLen() != expectedSize) {
RaidNode.LOG.error("Bad parity file:" + parity.getPath() +
" File size doen't match. parity:" + parity.getLen() +
" expected:" + expectedSize);
return null;
}
return new ParityFilePair(parity.getPath(), parity, destFs, lfs);
} } | public class class_name {
static ParityFilePair verifyParity(FileStatus src, FileStatus parity,
Codec codec, Configuration conf, FileSystem destFs) throws IOException {
if (parity.getModificationTime() != src.getModificationTime()) {
return null;
}
int stripeLength = codec.stripeLength;
int parityLegnth = codec.parityLength;
long expectedSize = 0;
List<FileStatus> lfs = null;
if (codec.isDirRaid) {
FileSystem srcFs = src.getPath().getFileSystem(conf);
lfs = RaidNode.listDirectoryRaidFileStatus(conf, srcFs,
src.getPath());
if (lfs == null) {
return null; // depends on control dependency: [if], data = [none]
}
long blockNum = DirectoryStripeReader.getBlockNum(lfs);
long parityBlockSize = DirectoryStripeReader.getParityBlockSize(conf,
lfs);
int parityBlocks = (int)Math.ceil(
((double)blockNum) / stripeLength) * parityLegnth;
expectedSize = parityBlocks * parityBlockSize;
} else {
double sourceBlocks = Math.ceil(
((double)src.getLen()) / src.getBlockSize());
int parityBlocks = (int)Math.ceil(
sourceBlocks / stripeLength) * parityLegnth;
expectedSize = parityBlocks * src.getBlockSize();
}
if (parity.getLen() != expectedSize) {
RaidNode.LOG.error("Bad parity file:" + parity.getPath() +
" File size doen't match. parity:" + parity.getLen() +
" expected:" + expectedSize);
return null;
}
return new ParityFilePair(parity.getPath(), parity, destFs, lfs);
} } |
public class class_name {
boolean containsClose() {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null &&
req.getRequestPath().equals(Defines.RequestPath.RegisterClose.getPath())) {
return true;
}
}
}
return false;
} } | public class class_name {
boolean containsClose() {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null &&
req.getRequestPath().equals(Defines.RequestPath.RegisterClose.getPath())) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections, boolean library) {
assertLockHeld();
Binding<?> binding = null;
for (Linker linker = this; linker != null; linker = linker.base) {
binding = linker.bindings.get(key);
if (binding != null) {
if (linker != this && !binding.isLinked()) throw new AssertionError();
break;
}
}
if (binding == null) {
// We can't satisfy this binding. Make sure it'll work next time!
Binding<?> deferredBinding =
new DeferredBinding(key, classLoader, requiredBy, mustHaveInjections);
deferredBinding.setLibrary(library);
deferredBinding.setDependedOn(true);
toLink.add(deferredBinding);
attachSuccess = false;
return null;
}
if (!binding.isLinked()) {
toLink.add(binding); // This binding was never linked; link it now!
}
binding.setLibrary(library);
binding.setDependedOn(true);
return binding;
} } | public class class_name {
public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections, boolean library) {
assertLockHeld();
Binding<?> binding = null;
for (Linker linker = this; linker != null; linker = linker.base) {
binding = linker.bindings.get(key); // depends on control dependency: [for], data = [linker]
if (binding != null) {
if (linker != this && !binding.isLinked()) throw new AssertionError();
break;
}
}
if (binding == null) {
// We can't satisfy this binding. Make sure it'll work next time!
Binding<?> deferredBinding =
new DeferredBinding(key, classLoader, requiredBy, mustHaveInjections);
deferredBinding.setLibrary(library); // depends on control dependency: [if], data = [none]
deferredBinding.setDependedOn(true); // depends on control dependency: [if], data = [none]
toLink.add(deferredBinding); // depends on control dependency: [if], data = [none]
attachSuccess = false; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (!binding.isLinked()) {
toLink.add(binding); // This binding was never linked; link it now! // depends on control dependency: [if], data = [none]
}
binding.setLibrary(library);
binding.setDependedOn(true);
return binding;
} } |
public class class_name {
public int open(String url, int flags)
{
if (mOpenStream != null)
{
log.debug("attempting to open already open handler: {}",
mOpenStream);
return -1;
}
switch (flags)
{
case URL_RDWR:
log.debug("do not support read/write mode for Java IO Handlers");
return -1;
case URL_WRONLY_MODE:
mOpenStream = mOutputStream;
if (mOpenStream == null)
{
log.error("No OutputStream specified for writing: {}",url);
return -1;
}
break;
case URL_RDONLY_MODE:
mOpenStream = mInputStream;
if (mOpenStream == null)
{
log.error("No InputStream specified for reading: {}", url);
return -1;
}
break;
default:
log.error("Invalid flag passed to open: {}", url);
return -1;
}
return 0;
} } | public class class_name {
public int open(String url, int flags)
{
if (mOpenStream != null)
{
log.debug("attempting to open already open handler: {}",
mOpenStream); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
switch (flags)
{
case URL_RDWR:
log.debug("do not support read/write mode for Java IO Handlers");
return -1;
case URL_WRONLY_MODE:
mOpenStream = mOutputStream;
if (mOpenStream == null)
{
log.error("No OutputStream specified for writing: {}",url); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
break;
case URL_RDONLY_MODE:
mOpenStream = mInputStream;
if (mOpenStream == null)
{
log.error("No InputStream specified for reading: {}", url); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
break;
default:
log.error("Invalid flag passed to open: {}", url);
return -1;
}
return 0;
} } |
public class class_name {
public boolean addConnection(String endpointId, int connectionId) {
boolean added = this.entries.put(endpointId, connectionId);
if (added && log.isDebugEnabled()) {
int left = this.entries.get(endpointId).size();
log.debug("Call " + getCallIdHex() + " registered connection " + Integer.toHexString(connectionId) + " at endpoint " + endpointId + ". Connection count: " + left);
}
return added;
} } | public class class_name {
public boolean addConnection(String endpointId, int connectionId) {
boolean added = this.entries.put(endpointId, connectionId);
if (added && log.isDebugEnabled()) {
int left = this.entries.get(endpointId).size();
log.debug("Call " + getCallIdHex() + " registered connection " + Integer.toHexString(connectionId) + " at endpoint " + endpointId + ". Connection count: " + left); // depends on control dependency: [if], data = [none]
}
return added;
} } |
public class class_name {
public static int countNaN(double[] v) {
int c = 0;
for (double d : v) {
if (Double.isNaN(d)) {
c++;
}
}
return c;
} } | public class class_name {
public static int countNaN(double[] v) {
int c = 0;
for (double d : v) {
if (Double.isNaN(d)) {
c++;
// depends on control dependency: [if], data = [none]
}
}
return c;
} } |
public class class_name {
protected boolean hasOngoingTransaction() {
if(!isSupervisedMode()) {
return false;
} else {
if(ongoingTransactions != null) {
for (Transaction transaction : ongoingTransactions) {
if(TransactionState.CALLING.equals(transaction.getState()) ||
TransactionState.TRYING.equals(transaction.getState()) ||
TransactionState.PROCEEDING.equals(transaction.getState()) ||
TransactionState.COMPLETED.equals(transaction.getState()) ||
TransactionState.CONFIRMED.equals(transaction.getState())) {
return true;
}
}
}
return false;
}
} } | public class class_name {
protected boolean hasOngoingTransaction() {
if(!isSupervisedMode()) {
return false; // depends on control dependency: [if], data = [none]
} else {
if(ongoingTransactions != null) {
for (Transaction transaction : ongoingTransactions) {
if(TransactionState.CALLING.equals(transaction.getState()) ||
TransactionState.TRYING.equals(transaction.getState()) ||
TransactionState.PROCEEDING.equals(transaction.getState()) ||
TransactionState.COMPLETED.equals(transaction.getState()) ||
TransactionState.CONFIRMED.equals(transaction.getState())) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static int getCanonicalIndex(String s, boolean strict) {
int len = s.length();
if (len == 0) {
return -1;
}
int ch = s.charAt(0);
// verify that all are the same character
for (int i = 1; i < len; ++i) {
if (s.charAt(i) != ch) {
return -1;
}
}
int bestRow = -1;
for (int i = 0; i < types.length; ++i) {
int[] row = types[i];
if (row[0] != ch) continue;
bestRow = i;
if (row[3] > len) continue;
if (row[row.length-1] < len) continue;
return i;
}
return strict ? -1 : bestRow;
} } | public class class_name {
private static int getCanonicalIndex(String s, boolean strict) {
int len = s.length();
if (len == 0) {
return -1; // depends on control dependency: [if], data = [none]
}
int ch = s.charAt(0);
// verify that all are the same character
for (int i = 1; i < len; ++i) {
if (s.charAt(i) != ch) {
return -1; // depends on control dependency: [if], data = [none]
}
}
int bestRow = -1;
for (int i = 0; i < types.length; ++i) {
int[] row = types[i];
if (row[0] != ch) continue;
bestRow = i; // depends on control dependency: [for], data = [i]
if (row[3] > len) continue;
if (row[row.length-1] < len) continue;
return i; // depends on control dependency: [for], data = [i]
}
return strict ? -1 : bestRow;
} } |
public class class_name {
private String convertRelativeURIToURL(String relativeURI)
{
if (relativeURI == null)
{
throw new IllegalStateException();
}
else
{
relativeURI = relativeURI.trim();
}
// If the passed URI contains "://" before the query string then it is either an
// absolute URL or invalid and cannot be converted anyway
int indexOfSchemeDelimiter = relativeURI.indexOf("://");
if (indexOfSchemeDelimiter != -1)
{
int indexOfQueryString = relativeURI.indexOf('?');
// If "://" occurs after '?' then it's part of the query string.
// Otherwise return this absolute (or invalid) URL
if ((indexOfQueryString == -1) || (indexOfSchemeDelimiter < indexOfQueryString))
{
return relativeURI;
}
}
String urlScheme = _request.getScheme();
if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) {
if (relativeURI.startsWith("//")) {
StringBuffer url = new StringBuffer(urlScheme);
url.append(":"); // slash slash will be added from the relativeURI
url.append(relativeURI);
return url.toString();
}
}
String webAppRootURI = null;
boolean relativeToRootURI = false;
try
{
webAppRootURI = getWebApp().getContextPath().trim();
if (webAppRootURI.startsWith("/") == false)
{
webAppRootURI = ("/" + webAppRootURI);
}
}
catch (Exception ex)
{
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, "com.ibm.ws.webcontainer.webapp.WebAppDispatcherResponse.convertRelativeURIToURL", "184", this);
webAppRootURI = "/";
}
try
{
relativeToRootURI = relativeURI.startsWith("/");
// If relative URI begins with "./" (current level in URL hierarchy) then remove it
if (relativeURI.startsWith("./"))
relativeURI = relativeURI.substring(2);
IExtendedRequest request = _request;
// 112000 - begin - there was no reason to have two schemes for handling relative to root vs.
// not relative to root so redid the section below
// add the server info to the front of the url
int urlPort = request.getServerPort();
StringBuffer url = new StringBuffer(urlScheme);
url.append("://");
url.append(request.getServerName());
// Add the port to the URL if it is not the default one for the scheme
if (((urlScheme.equals("http") == true) && (urlPort != 80)) || ((urlScheme.equals("https") == true) && (urlPort != 443)))
{
url.append(":");
url.append(urlPort);
}
String redirectURL = null;
if (relativeToRootURI)
{
// 115010 - begin
// if the relative URI begins with '/' and we're in sendRedirect compatibility mode, then make uri
// relative to the context root...otherwise, make it relative to the server (no context root)
if (com.ibm.ws.webcontainer.util.WebContainerSystemProps.getSendRedirectCompatibilty())
{
// append webapp context and relative URI
url.append(webAppRootURI);
url.append(relativeURI);
}
else
{
url.append(relativeURI);
}
// 115010 - end
redirectURL = url.toString();
}
else
{
// not relative to webapp context root, but relative to the presently
// invoked URL
String requestString = HttpUtils.getRequestURL((HttpServletRequest) request).toString();
String pathInfo = request.getPathInfo();
// start PI22830
if(!webAppRootURI.equals("/") && request.getRequestURI().equals(webAppRootURI)){
requestString = requestString + "/";
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"convertRelativeURIToURL", "appended / to requestString --> " + requestString);
} // end PI22830
if ((pathInfo != null) && (pathInfo.length() > 0))
{
if (!pathInfo.startsWith("/"))
{
pathInfo = "/" + pathInfo;
}
//start PK23779
if(redirectWithPathInfo || (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31)){
requestString = requestString.substring(0, requestString.lastIndexOf("/"));
}
else{
// Remove the PathInfo from the request
requestString = requestString.substring(0, requestString.lastIndexOf(pathInfo));
}
//end PK23779
redirectURL = requestString + "/" + relativeURI;
}
else
{
redirectURL = requestString.substring(0, requestString.lastIndexOf('/') + 1) + relativeURI;
}
}
if (redirectURL.indexOf("..") > -1)
{ // only normalize where required.. this is expensive.
int skip = new String(urlScheme + "://").length();
int split = redirectURL.indexOf("/", skip);
String serverString = redirectURL.substring(0, split);
String uri = redirectURL.substring(split);
uri = getWebApp().normalize(uri);
if (uri != null)
{
return serverString + uri;
}
}
else
{ // return url since it is already normalized.
return redirectURL;
}
// 112000 - end
}
catch (Exception ex)
{
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, "com.ibm.ws.webcontainer.webapp.WebAppDispatcherResponse.convertRelativeURIToURL", "256", this);
}
// Could not convert
return relativeURI;
} } | public class class_name {
private String convertRelativeURIToURL(String relativeURI)
{
if (relativeURI == null)
{
throw new IllegalStateException();
}
else
{
relativeURI = relativeURI.trim(); // depends on control dependency: [if], data = [none]
}
// If the passed URI contains "://" before the query string then it is either an
// absolute URL or invalid and cannot be converted anyway
int indexOfSchemeDelimiter = relativeURI.indexOf("://");
if (indexOfSchemeDelimiter != -1)
{
int indexOfQueryString = relativeURI.indexOf('?');
// If "://" occurs after '?' then it's part of the query string.
// Otherwise return this absolute (or invalid) URL
if ((indexOfQueryString == -1) || (indexOfSchemeDelimiter < indexOfQueryString))
{
return relativeURI; // depends on control dependency: [if], data = [none]
}
}
String urlScheme = _request.getScheme();
if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) {
if (relativeURI.startsWith("//")) {
StringBuffer url = new StringBuffer(urlScheme);
url.append(":"); // slash slash will be added from the relativeURI
url.append(relativeURI);
return url.toString();
}
}
String webAppRootURI = null;
boolean relativeToRootURI = false;
try
{
webAppRootURI = getWebApp().getContextPath().trim();
if (webAppRootURI.startsWith("/") == false)
{
webAppRootURI = ("/" + webAppRootURI);
}
}
catch (Exception ex)
{
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, "com.ibm.ws.webcontainer.webapp.WebAppDispatcherResponse.convertRelativeURIToURL", "184", this);
webAppRootURI = "/";
}
try
{
relativeToRootURI = relativeURI.startsWith("/");
// If relative URI begins with "./" (current level in URL hierarchy) then remove it
if (relativeURI.startsWith("./"))
relativeURI = relativeURI.substring(2);
IExtendedRequest request = _request;
// 112000 - begin - there was no reason to have two schemes for handling relative to root vs.
// not relative to root so redid the section below
// add the server info to the front of the url
int urlPort = request.getServerPort();
StringBuffer url = new StringBuffer(urlScheme);
url.append("://");
url.append(request.getServerName());
// Add the port to the URL if it is not the default one for the scheme
if (((urlScheme.equals("http") == true) && (urlPort != 80)) || ((urlScheme.equals("https") == true) && (urlPort != 443)))
{
url.append(":");
url.append(urlPort);
}
String redirectURL = null;
if (relativeToRootURI)
{
// 115010 - begin
// if the relative URI begins with '/' and we're in sendRedirect compatibility mode, then make uri
// relative to the context root...otherwise, make it relative to the server (no context root)
if (com.ibm.ws.webcontainer.util.WebContainerSystemProps.getSendRedirectCompatibilty())
{
// append webapp context and relative URI
url.append(webAppRootURI);
url.append(relativeURI);
}
else
{
url.append(relativeURI);
}
// 115010 - end
redirectURL = url.toString();
}
else
{
// not relative to webapp context root, but relative to the presently
// invoked URL
String requestString = HttpUtils.getRequestURL((HttpServletRequest) request).toString();
String pathInfo = request.getPathInfo();
// start PI22830
if(!webAppRootURI.equals("/") && request.getRequestURI().equals(webAppRootURI)){
requestString = requestString + "/";
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"convertRelativeURIToURL", "appended / to requestString --> " + requestString);
} // end PI22830
if ((pathInfo != null) && (pathInfo.length() > 0))
{
if (!pathInfo.startsWith("/"))
{
pathInfo = "/" + pathInfo;
}
//start PK23779
if(redirectWithPathInfo || (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31)){
requestString = requestString.substring(0, requestString.lastIndexOf("/"));
}
else{
// Remove the PathInfo from the request
requestString = requestString.substring(0, requestString.lastIndexOf(pathInfo));
}
//end PK23779
redirectURL = requestString + "/" + relativeURI;
}
else
{
redirectURL = requestString.substring(0, requestString.lastIndexOf('/') + 1) + relativeURI;
}
}
if (redirectURL.indexOf("..") > -1)
{ // only normalize where required.. this is expensive.
int skip = new String(urlScheme + "://").length();
int split = redirectURL.indexOf("/", skip);
String serverString = redirectURL.substring(0, split);
String uri = redirectURL.substring(split);
uri = getWebApp().normalize(uri);
if (uri != null)
{
return serverString + uri;
}
}
else
{ // return url since it is already normalized.
return redirectURL;
}
// 112000 - end
}
catch (Exception ex)
{
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, "com.ibm.ws.webcontainer.webapp.WebAppDispatcherResponse.convertRelativeURIToURL", "256", this);
}
// Could not convert
return relativeURI;
} } |
public class class_name {
public java.util.List<Subscription> getSubscriptions() {
if (subscriptions == null) {
subscriptions = new com.amazonaws.internal.SdkInternalList<Subscription>();
}
return subscriptions;
} } | public class class_name {
public java.util.List<Subscription> getSubscriptions() {
if (subscriptions == null) {
subscriptions = new com.amazonaws.internal.SdkInternalList<Subscription>(); // depends on control dependency: [if], data = [none]
}
return subscriptions;
} } |
public class class_name {
public static double JensenShannonDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
double js = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
double mi = (b.x + y[i]) / 2;
js += b.x * Math.log(b.x / mi);
if (y[i] > 0) {
js += y[i] * Math.log(y[i] / mi);
}
}
return js / 2;
} } | public class class_name {
public static double JensenShannonDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
double js = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
double mi = (b.x + y[i]) / 2;
js += b.x * Math.log(b.x / mi); // depends on control dependency: [while], data = [none]
if (y[i] > 0) {
js += y[i] * Math.log(y[i] / mi); // depends on control dependency: [if], data = [(y[i]]
}
}
return js / 2;
} } |
public class class_name {
public void marshall(LambdaFunctionScheduledEventDetails lambdaFunctionScheduledEventDetails, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionScheduledEventDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getResource(), RESOURCE_BINDING);
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getInput(), INPUT_BINDING);
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getTimeoutInSeconds(), TIMEOUTINSECONDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LambdaFunctionScheduledEventDetails lambdaFunctionScheduledEventDetails, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionScheduledEventDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getResource(), RESOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getInput(), INPUT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lambdaFunctionScheduledEventDetails.getTimeoutInSeconds(), TIMEOUTINSECONDS_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 Schema flatten(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) {
Schema flattenedSchema;
// Process all Schema Types
// (Primitives are simply cloned)
switch (schema.getType()) {
case ARRAY:
// Array might be an array of recursive Records, flatten them
if (flattenComplexTypes) {
flattenedSchema = Schema.createArray(flatten(schema.getElementType(), false));
} else {
flattenedSchema = Schema.createArray(schema.getElementType());
}
break;
case BOOLEAN:
flattenedSchema = Schema.create(schema.getType());
break;
case BYTES:
flattenedSchema = Schema.create(schema.getType());
break;
case DOUBLE:
flattenedSchema = Schema.create(schema.getType());
break;
case ENUM:
flattenedSchema =
Schema.createEnum(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.getEnumSymbols());
break;
case FIXED:
flattenedSchema =
Schema.createFixed(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.getFixedSize());
break;
case FLOAT:
flattenedSchema = Schema.create(schema.getType());
break;
case INT:
flattenedSchema = Schema.create(schema.getType());
break;
case LONG:
flattenedSchema = Schema.create(schema.getType());
break;
case MAP:
if (flattenComplexTypes) {
flattenedSchema = Schema.createMap(flatten(schema.getValueType(), false));
} else {
flattenedSchema = Schema.createMap(schema.getValueType());
}
break;
case NULL:
flattenedSchema = Schema.create(schema.getType());
break;
case RECORD:
flattenedSchema = flattenRecord(schema, shouldPopulateLineage, flattenComplexTypes);
break;
case STRING:
flattenedSchema = Schema.create(schema.getType());
break;
case UNION:
flattenedSchema = flattenUnion(schema, shouldPopulateLineage, flattenComplexTypes);
break;
default:
String exceptionMessage = String.format("Schema flattening failed for \"%s\" ", schema);
LOG.error(exceptionMessage);
throw new AvroRuntimeException(exceptionMessage);
}
// Copy schema metadata
copyProperties(schema, flattenedSchema);
return flattenedSchema;
} } | public class class_name {
private Schema flatten(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) {
Schema flattenedSchema;
// Process all Schema Types
// (Primitives are simply cloned)
switch (schema.getType()) {
case ARRAY:
// Array might be an array of recursive Records, flatten them
if (flattenComplexTypes) {
flattenedSchema = Schema.createArray(flatten(schema.getElementType(), false)); // depends on control dependency: [if], data = [none]
} else {
flattenedSchema = Schema.createArray(schema.getElementType()); // depends on control dependency: [if], data = [none]
}
break;
case BOOLEAN:
flattenedSchema = Schema.create(schema.getType());
break;
case BYTES:
flattenedSchema = Schema.create(schema.getType());
break;
case DOUBLE:
flattenedSchema = Schema.create(schema.getType());
break;
case ENUM:
flattenedSchema =
Schema.createEnum(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.getEnumSymbols());
break;
case FIXED:
flattenedSchema =
Schema.createFixed(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.getFixedSize());
break;
case FLOAT:
flattenedSchema = Schema.create(schema.getType());
break;
case INT:
flattenedSchema = Schema.create(schema.getType());
break;
case LONG:
flattenedSchema = Schema.create(schema.getType());
break;
case MAP:
if (flattenComplexTypes) {
flattenedSchema = Schema.createMap(flatten(schema.getValueType(), false)); // depends on control dependency: [if], data = [none]
} else {
flattenedSchema = Schema.createMap(schema.getValueType()); // depends on control dependency: [if], data = [none]
}
break;
case NULL:
flattenedSchema = Schema.create(schema.getType());
break;
case RECORD:
flattenedSchema = flattenRecord(schema, shouldPopulateLineage, flattenComplexTypes);
break;
case STRING:
flattenedSchema = Schema.create(schema.getType());
break;
case UNION:
flattenedSchema = flattenUnion(schema, shouldPopulateLineage, flattenComplexTypes);
break;
default:
String exceptionMessage = String.format("Schema flattening failed for \"%s\" ", schema);
LOG.error(exceptionMessage);
throw new AvroRuntimeException(exceptionMessage);
}
// Copy schema metadata
copyProperties(schema, flattenedSchema);
return flattenedSchema;
} } |
public class class_name {
private List<TaskTrackerAction> getMapCompletionTasks(
TaskTrackerStatus status,
List<TaskTrackerAction> tasksToKill) {
boolean loggingEnabled = LOG.isDebugEnabled();
// Build up the list of tasks about to be killed
Set<TaskAttemptID> killedTasks = new HashSet<TaskAttemptID>();
if (tasksToKill != null) {
for (TaskTrackerAction taskToKill : tasksToKill) {
killedTasks.add(((KillTaskAction)taskToKill).getTaskID());
}
}
String trackerName = status.getTrackerName();
List<TaskTrackerAction> actions = new ArrayList<TaskTrackerAction>();
// loop through the list of task statuses
for (TaskStatus report : status.getTaskReports()) {
TaskAttemptID taskAttemptId = report.getTaskID();
SimulatorJobInProgress job = getSimulatorJob(taskAttemptId.getJobID());
if(job ==null) {
// This job has completed before.
// and this is a zombie reduce-task
Set<JobID> jobsToCleanup = trackerToJobsToCleanup.get(trackerName);
if (jobsToCleanup == null) {
jobsToCleanup = new HashSet<JobID>();
trackerToJobsToCleanup.put(trackerName, jobsToCleanup);
}
jobsToCleanup.add(taskAttemptId.getJobID());
continue;
}
JobStatus jobStatus = job.getStatus();
TaskInProgress tip = taskidToTIPMap.get(taskAttemptId);
// if the job is running, attempt is running
// no KillTask is being sent for this attempt
// task is a reduce and attempt is in shuffle phase
// this precludes sending both KillTask and AllMapsCompletion
// for same reduce-attempt
if (jobStatus.getRunState()== JobStatus.RUNNING &&
tip.isRunningTask(taskAttemptId) &&
!killedTasks.contains(taskAttemptId) &&
!report.getIsMap() &&
report.getPhase() == TaskStatus.Phase.SHUFFLE) {
if (loggingEnabled) {
LOG.debug("Need map-completion information for REDUCEattempt "
+ taskAttemptId + " in tracker " + trackerName);
LOG.debug("getMapCompletion: job=" + job.getJobID() + " pendingMaps="
+ job.pendingMaps());
}
// Check whether the number of finishedMaps equals the
// number of maps
boolean canSendMapCompletion = false;
canSendMapCompletion = (job.finishedMaps()==job.desiredMaps());
if (canSendMapCompletion) {
if (loggingEnabled) {
LOG.debug("Adding MapCompletion for taskAttempt " + taskAttemptId
+ " in tracker " + trackerName);
LOG.debug("FinishedMaps for job:" + job.getJobID() + " is = "
+ job.finishedMaps() + "/" + job.desiredMaps());
LOG.debug("AllMapsCompleted for task " + taskAttemptId + " time="
+ getClock().getTime());
}
actions.add(new AllMapsCompletedTaskAction(taskAttemptId));
}
}
}
return actions;
} } | public class class_name {
private List<TaskTrackerAction> getMapCompletionTasks(
TaskTrackerStatus status,
List<TaskTrackerAction> tasksToKill) {
boolean loggingEnabled = LOG.isDebugEnabled();
// Build up the list of tasks about to be killed
Set<TaskAttemptID> killedTasks = new HashSet<TaskAttemptID>();
if (tasksToKill != null) {
for (TaskTrackerAction taskToKill : tasksToKill) {
killedTasks.add(((KillTaskAction)taskToKill).getTaskID()); // depends on control dependency: [for], data = [taskToKill]
}
}
String trackerName = status.getTrackerName();
List<TaskTrackerAction> actions = new ArrayList<TaskTrackerAction>();
// loop through the list of task statuses
for (TaskStatus report : status.getTaskReports()) {
TaskAttemptID taskAttemptId = report.getTaskID();
SimulatorJobInProgress job = getSimulatorJob(taskAttemptId.getJobID());
if(job ==null) {
// This job has completed before.
// and this is a zombie reduce-task
Set<JobID> jobsToCleanup = trackerToJobsToCleanup.get(trackerName);
if (jobsToCleanup == null) {
jobsToCleanup = new HashSet<JobID>(); // depends on control dependency: [if], data = [none]
trackerToJobsToCleanup.put(trackerName, jobsToCleanup); // depends on control dependency: [if], data = [none]
}
jobsToCleanup.add(taskAttemptId.getJobID()); // depends on control dependency: [if], data = [none]
continue;
}
JobStatus jobStatus = job.getStatus();
TaskInProgress tip = taskidToTIPMap.get(taskAttemptId);
// if the job is running, attempt is running
// no KillTask is being sent for this attempt
// task is a reduce and attempt is in shuffle phase
// this precludes sending both KillTask and AllMapsCompletion
// for same reduce-attempt
if (jobStatus.getRunState()== JobStatus.RUNNING &&
tip.isRunningTask(taskAttemptId) &&
!killedTasks.contains(taskAttemptId) &&
!report.getIsMap() &&
report.getPhase() == TaskStatus.Phase.SHUFFLE) {
if (loggingEnabled) {
LOG.debug("Need map-completion information for REDUCEattempt "
+ taskAttemptId + " in tracker " + trackerName); // depends on control dependency: [if], data = [none]
LOG.debug("getMapCompletion: job=" + job.getJobID() + " pendingMaps="
+ job.pendingMaps()); // depends on control dependency: [if], data = [none]
}
// Check whether the number of finishedMaps equals the
// number of maps
boolean canSendMapCompletion = false;
canSendMapCompletion = (job.finishedMaps()==job.desiredMaps()); // depends on control dependency: [if], data = [none]
if (canSendMapCompletion) {
if (loggingEnabled) {
LOG.debug("Adding MapCompletion for taskAttempt " + taskAttemptId
+ " in tracker " + trackerName); // depends on control dependency: [if], data = [none]
LOG.debug("FinishedMaps for job:" + job.getJobID() + " is = "
+ job.finishedMaps() + "/" + job.desiredMaps()); // depends on control dependency: [if], data = [none]
LOG.debug("AllMapsCompleted for task " + taskAttemptId + " time="
+ getClock().getTime()); // depends on control dependency: [if], data = [none]
}
actions.add(new AllMapsCompletedTaskAction(taskAttemptId)); // depends on control dependency: [if], data = [none]
}
}
}
return actions;
} } |
public class class_name {
public void onDestroy(boolean isSaved) {
EventBus.getDefault().unregister(this);
for (RTEditText editor : mEditors.values()) {
editor.unregister();
editor.onDestroy(isSaved);
}
mEditors.clear();
for (RTToolbar toolbar : mToolbars.values()) {
toolbar.removeToolbarListener();
}
mToolbars.clear();
mRTApi = null;
} } | public class class_name {
public void onDestroy(boolean isSaved) {
EventBus.getDefault().unregister(this);
for (RTEditText editor : mEditors.values()) {
editor.unregister(); // depends on control dependency: [for], data = [editor]
editor.onDestroy(isSaved); // depends on control dependency: [for], data = [editor]
}
mEditors.clear();
for (RTToolbar toolbar : mToolbars.values()) {
toolbar.removeToolbarListener(); // depends on control dependency: [for], data = [toolbar]
}
mToolbars.clear();
mRTApi = null;
} } |
public class class_name {
private void readRelationships(Project gpProject)
{
for (net.sf.mpxj.ganttproject.schema.Task gpTask : gpProject.getTasks().getTask())
{
readRelationships(gpTask);
}
} } | public class class_name {
private void readRelationships(Project gpProject)
{
for (net.sf.mpxj.ganttproject.schema.Task gpTask : gpProject.getTasks().getTask())
{
readRelationships(gpTask); // depends on control dependency: [for], data = [gpTask]
}
} } |
public class class_name {
private void deleteAllWebserverConfigs(final String prefix) {
File file = new File(m_targetPath);
if (file.exists() && file.isDirectory()) {
File[] configFiles = file.listFiles(new FilenameFilter() {
/**
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
*/
public boolean accept(File dir, String name) {
if (name.startsWith(prefix)) {
return true;
}
return false;
}
});
for (File f : configFiles) {
getReport().println(Messages.get().container(Messages.RPT_DELETING_FILE_1, f), I_CmsReport.FORMAT_OK);
f.delete();
}
}
} } | public class class_name {
private void deleteAllWebserverConfigs(final String prefix) {
File file = new File(m_targetPath);
if (file.exists() && file.isDirectory()) {
File[] configFiles = file.listFiles(new FilenameFilter() {
/**
* @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
*/
public boolean accept(File dir, String name) {
if (name.startsWith(prefix)) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
}
});
for (File f : configFiles) {
getReport().println(Messages.get().container(Messages.RPT_DELETING_FILE_1, f), I_CmsReport.FORMAT_OK); // depends on control dependency: [for], data = [f]
f.delete(); // depends on control dependency: [for], data = [f]
}
}
} } |
public class class_name {
public void marshall(UpdateShardCountRequest updateShardCountRequest, ProtocolMarshaller protocolMarshaller) {
if (updateShardCountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateShardCountRequest.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(updateShardCountRequest.getTargetShardCount(), TARGETSHARDCOUNT_BINDING);
protocolMarshaller.marshall(updateShardCountRequest.getScalingType(), SCALINGTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateShardCountRequest updateShardCountRequest, ProtocolMarshaller protocolMarshaller) {
if (updateShardCountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateShardCountRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateShardCountRequest.getTargetShardCount(), TARGETSHARDCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateShardCountRequest.getScalingType(), SCALINGTYPE_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 Application getApplicationFromSource(final File _versionFile,
final List<String> _classpathElements,
final File _eFapsDir,
final File _outputDir,
final List<String> _includes,
final List<String> _excludes,
final Map<String, String> _file2typeMapping)
throws InstallationException
{
final Map<String, String> file2typeMapping = _file2typeMapping == null
? Application.DEFAULT_TYPE_MAPPING
: _file2typeMapping;
final Application appl;
try {
appl = Application.getApplication(_versionFile.toURI().toURL(),
_eFapsDir.toURI().toURL(),
_classpathElements);
for (final String fileName : Application.getFiles(_eFapsDir, _includes, _excludes)) {
final String type = file2typeMapping.get(fileName.substring(fileName.lastIndexOf(".") + 1));
appl.install.addFile(new InstallFile().setType(type).setURL(
new File(_eFapsDir, fileName).toURI().toURL()));
}
if (_outputDir.exists()) {
for (final String fileName : Application.getFiles(_outputDir, _includes, _excludes)) {
final String type = file2typeMapping.get(fileName.substring(fileName.lastIndexOf(".") + 1));
appl.install.addFile(new InstallFile().setType(type).setURL(
new File(_outputDir, fileName).toURI().toURL()));
}
}
} catch (final IOException e) {
throw new InstallationException("Could not open / read version file " + "'" + _versionFile + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new InstallationException("Read version file '" + _versionFile + "' failed", e);
}
return appl;
} } | public class class_name {
public static Application getApplicationFromSource(final File _versionFile,
final List<String> _classpathElements,
final File _eFapsDir,
final File _outputDir,
final List<String> _includes,
final List<String> _excludes,
final Map<String, String> _file2typeMapping)
throws InstallationException
{
final Map<String, String> file2typeMapping = _file2typeMapping == null
? Application.DEFAULT_TYPE_MAPPING
: _file2typeMapping;
final Application appl;
try {
appl = Application.getApplication(_versionFile.toURI().toURL(),
_eFapsDir.toURI().toURL(),
_classpathElements);
for (final String fileName : Application.getFiles(_eFapsDir, _includes, _excludes)) {
final String type = file2typeMapping.get(fileName.substring(fileName.lastIndexOf(".") + 1));
appl.install.addFile(new InstallFile().setType(type).setURL(
new File(_eFapsDir, fileName).toURI().toURL())); // depends on control dependency: [for], data = [none]
}
if (_outputDir.exists()) {
for (final String fileName : Application.getFiles(_outputDir, _includes, _excludes)) {
final String type = file2typeMapping.get(fileName.substring(fileName.lastIndexOf(".") + 1));
appl.install.addFile(new InstallFile().setType(type).setURL(
new File(_outputDir, fileName).toURI().toURL())); // depends on control dependency: [for], data = [none]
}
}
} catch (final IOException e) {
throw new InstallationException("Could not open / read version file " + "'" + _versionFile + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new InstallationException("Read version file '" + _versionFile + "' failed", e);
}
return appl;
} } |
public class class_name {
public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {
if (!t1.getJavaClass().equals(t2.getJavaClass())) {
return false;
}
if (!compareAnnotated(t1, t2)) {
return false;
}
if (t1.getFields().size() != t2.getFields().size()) {
return false;
}
Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();
for (AnnotatedField<?> f : t2.getFields()) {
fields.put(f.getJavaMember(), f);
}
for (AnnotatedField<?> f : t1.getFields()) {
if (fields.containsKey(f.getJavaMember())) {
if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getMethods().size() != t2.getMethods().size()) {
return false;
}
Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();
for (AnnotatedMethod<?> f : t2.getMethods()) {
methods.put(f.getJavaMember(), f);
}
for (AnnotatedMethod<?> f : t1.getMethods()) {
if (methods.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getConstructors().size() != t2.getConstructors().size()) {
return false;
}
Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();
for (AnnotatedConstructor<?> f : t2.getConstructors()) {
constructors.put(f.getJavaMember(), f);
}
for (AnnotatedConstructor<?> f : t1.getConstructors()) {
if (constructors.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
return true;
} } | public class class_name {
public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {
if (!t1.getJavaClass().equals(t2.getJavaClass())) {
return false; // depends on control dependency: [if], data = [none]
}
if (!compareAnnotated(t1, t2)) {
return false; // depends on control dependency: [if], data = [none]
}
if (t1.getFields().size() != t2.getFields().size()) {
return false; // depends on control dependency: [if], data = [none]
}
Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();
for (AnnotatedField<?> f : t2.getFields()) {
fields.put(f.getJavaMember(), f);
}
for (AnnotatedField<?> f : t1.getFields()) {
if (fields.containsKey(f.getJavaMember())) {
if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {
return false; // depends on control dependency: [if], data = [none]
}
} else {
return false;
}
}
if (t1.getMethods().size() != t2.getMethods().size()) {
return false;
}
Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();
for (AnnotatedMethod<?> f : t2.getMethods()) {
methods.put(f.getJavaMember(), f);
}
for (AnnotatedMethod<?> f : t1.getMethods()) {
if (methods.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getConstructors().size() != t2.getConstructors().size()) {
return false;
}
Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();
for (AnnotatedConstructor<?> f : t2.getConstructors()) {
constructors.put(f.getJavaMember(), f);
}
for (AnnotatedConstructor<?> f : t1.getConstructors()) {
if (constructors.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
return true;
} } |
public class class_name {
public void reorderBands( int ...order ) {
T[] bands = (T[]) Array.newInstance(type, order.length);
for (int i = 0; i < order.length; i++) {
bands[i] = this.bands[order[i]];
}
this.bands = bands;
} } | public class class_name {
public void reorderBands( int ...order ) {
T[] bands = (T[]) Array.newInstance(type, order.length);
for (int i = 0; i < order.length; i++) {
bands[i] = this.bands[order[i]]; // depends on control dependency: [for], data = [i]
}
this.bands = bands;
} } |
public class class_name {
private static String getCheckedValue(Control control)
{
if (control instanceof CheckableControl)
{
return ((CheckableControl) control).getCheckedValue();
}
return control.getValue();
} } | public class class_name {
private static String getCheckedValue(Control control)
{
if (control instanceof CheckableControl)
{
return ((CheckableControl) control).getCheckedValue(); // depends on control dependency: [if], data = [none]
}
return control.getValue();
} } |
public class class_name {
public static LongUnaryOperator longUnaryOperator(CheckedLongUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsLong(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} } | public class class_name {
public static LongUnaryOperator longUnaryOperator(CheckedLongUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsLong(t); // depends on control dependency: [try], data = [none]
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
public void end(Mapping mapping) {
if (mapping == null) {
throw new IllegalArgumentException("Method argument mapping must not be null");
}
OngoingMappings ongoingMappings = this.ongoingMappings.get();
if (ongoingMappings != null) {
ongoingMappings.remove(mapping);
if (ongoingMappings.isEmpty()) {
this.ongoingMappings.remove();
}
}
} } | public class class_name {
public void end(Mapping mapping) {
if (mapping == null) {
throw new IllegalArgumentException("Method argument mapping must not be null");
}
OngoingMappings ongoingMappings = this.ongoingMappings.get();
if (ongoingMappings != null) {
ongoingMappings.remove(mapping); // depends on control dependency: [if], data = [none]
if (ongoingMappings.isEmpty()) {
this.ongoingMappings.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void verify() {
// Copy table defs to avoid ConcurrentModificationException if we add a table.
List<TableDefinition> definedTables = new ArrayList<>(m_tableMap.values());
for (TableDefinition tableDef : definedTables) {
// Copy field defs for same reason
List<FieldDefinition> definedFields = new ArrayList<>(tableDef.getFieldDefinitions());
for (FieldDefinition fieldDef : definedFields) {
if (fieldDef.isLinkType()) {
verifyLink(tableDef, fieldDef);
}
}
}
} } | public class class_name {
private void verify() {
// Copy table defs to avoid ConcurrentModificationException if we add a table.
List<TableDefinition> definedTables = new ArrayList<>(m_tableMap.values());
for (TableDefinition tableDef : definedTables) {
// Copy field defs for same reason
List<FieldDefinition> definedFields = new ArrayList<>(tableDef.getFieldDefinitions());
for (FieldDefinition fieldDef : definedFields) {
if (fieldDef.isLinkType()) {
verifyLink(tableDef, fieldDef);
// depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public boolean isRAEntityLinkNameReferenced(String raLinkName) {
if (raLinkName == null) {
throw new NullPointerException("null ra link name");
}
boolean b = false;
try {
b = transactionManager.requireTransaction();
for (ServiceID serviceID : componentRepositoryImpl.getServiceIDs()) {
ServiceComponent serviceComponent = componentRepositoryImpl
.getComponentByID(serviceID);
if (serviceComponent.getServiceState() != ServiceState.INACTIVE
&& serviceComponent.getResourceAdaptorEntityLinks(
componentRepositoryImpl).contains(raLinkName)) {
return true;
}
}
return false;
} finally {
try {
transactionManager.requireTransactionEnd(b, false);
} catch (Throwable ex) {
throw new SLEEException(ex.getMessage(), ex);
}
}
} } | public class class_name {
public boolean isRAEntityLinkNameReferenced(String raLinkName) {
if (raLinkName == null) {
throw new NullPointerException("null ra link name");
}
boolean b = false;
try {
b = transactionManager.requireTransaction(); // depends on control dependency: [try], data = [none]
for (ServiceID serviceID : componentRepositoryImpl.getServiceIDs()) {
ServiceComponent serviceComponent = componentRepositoryImpl
.getComponentByID(serviceID);
if (serviceComponent.getServiceState() != ServiceState.INACTIVE
&& serviceComponent.getResourceAdaptorEntityLinks(
componentRepositoryImpl).contains(raLinkName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [try], data = [none]
} finally {
try {
transactionManager.requireTransactionEnd(b, false); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
throw new SLEEException(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(ListInventoryEntriesRequest listInventoryEntriesRequest, ProtocolMarshaller protocolMarshaller) {
if (listInventoryEntriesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listInventoryEntriesRequest.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(listInventoryEntriesRequest.getTypeName(), TYPENAME_BINDING);
protocolMarshaller.marshall(listInventoryEntriesRequest.getFilters(), FILTERS_BINDING);
protocolMarshaller.marshall(listInventoryEntriesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listInventoryEntriesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListInventoryEntriesRequest listInventoryEntriesRequest, ProtocolMarshaller protocolMarshaller) {
if (listInventoryEntriesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listInventoryEntriesRequest.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInventoryEntriesRequest.getTypeName(), TYPENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInventoryEntriesRequest.getFilters(), FILTERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInventoryEntriesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInventoryEntriesRequest.getMaxResults(), MAXRESULTS_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 Map<Locator, MetricData> getDatapointsForRange(List<Locator> locators, Range range, Granularity gran) {
ListMultimap<ColumnFamily, Locator> locatorsByCF =
ArrayListMultimap.create();
Map<Locator, MetricData> results = new HashMap<Locator, MetricData>();
for (Locator locator : locators) {
try {
RollupType rollupType = RollupType.fromString(
metaCache.get(locator, MetricMetadata.ROLLUP_TYPE.name().toLowerCase()));
ColumnFamily cf = CassandraModel.getColumnFamily(rollupType, gran);
List<Locator> locs = locatorsByCF.get(cf);
locs.add(locator);
} catch (Exception e) {
// pass for now. need metric to figure this stuff out.
log.error(String.format("error getting datapoints for locator %s, range %s, granularity %s", locator, range.toString(), gran.toString()), e);
}
}
for (ColumnFamily CF : locatorsByCF.keySet()) {
List<Locator> locs = locatorsByCF.get(CF);
results.putAll(getNumericDataForRangeLocatorList(range, gran, CF, locs));
}
return results;
} } | public class class_name {
public Map<Locator, MetricData> getDatapointsForRange(List<Locator> locators, Range range, Granularity gran) {
ListMultimap<ColumnFamily, Locator> locatorsByCF =
ArrayListMultimap.create();
Map<Locator, MetricData> results = new HashMap<Locator, MetricData>();
for (Locator locator : locators) {
try {
RollupType rollupType = RollupType.fromString(
metaCache.get(locator, MetricMetadata.ROLLUP_TYPE.name().toLowerCase()));
ColumnFamily cf = CassandraModel.getColumnFamily(rollupType, gran);
List<Locator> locs = locatorsByCF.get(cf);
locs.add(locator); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// pass for now. need metric to figure this stuff out.
log.error(String.format("error getting datapoints for locator %s, range %s, granularity %s", locator, range.toString(), gran.toString()), e);
} // depends on control dependency: [catch], data = [none]
}
for (ColumnFamily CF : locatorsByCF.keySet()) {
List<Locator> locs = locatorsByCF.get(CF);
results.putAll(getNumericDataForRangeLocatorList(range, gran, CF, locs)); // depends on control dependency: [for], data = [CF]
}
return results;
} } |
public class class_name {
public FacesConfigApplicationType<FacesConfigType<T>> getOrCreateApplication()
{
List<Node> nodeList = childNode.get("application");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigApplicationTypeImpl<FacesConfigType<T>>(this, "application", childNode, nodeList.get(0));
}
return createApplication();
} } | public class class_name {
public FacesConfigApplicationType<FacesConfigType<T>> getOrCreateApplication()
{
List<Node> nodeList = childNode.get("application");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigApplicationTypeImpl<FacesConfigType<T>>(this, "application", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createApplication();
} } |
public class class_name {
private Set<String> variantsFor(String input) {
// Store current invocation's results
Set<String> variants = new HashSet<>();
Matcher m = regex.matcher(input);
boolean matches = m.matches();
if (!matches) {
// if the regex does not find any patterns,
// simply add the input as is
variants.add(input);
// end recursion
return variants;
}
// isolate the part before the first pattern
String head = m.group(1);
// isolate the pattern itself, removing its wrapping {}
String patternGroup = m.group(2).replaceAll("[\\{\\}]", "");
// isolate the remaining part of the input
String tail = m.group(6);
// split the pattern into its options and add an empty
// string if it ends with a separator
List<String> patternParts = new ArrayList<>();
patternParts.addAll(asList(patternGroup.split("\\|")));
if (patternGroup.endsWith("|")) {
patternParts.add("");
}
// Iterate over the current pattern's
// variants and construct the result.
for (String part : patternParts) {
StringBuilder builder = new StringBuilder();
if (head != null) {
builder.append(head);
}
builder.append(part);
// recurse on the tail of the input
// to handle the next pattern
Set<String> tails = variantsFor(tail);
// append all variants of the tail end
// and add each of them to the part we have
// built up so far.
for (String tailVariant : tails) {
StringBuilder tailBuilder = new StringBuilder(builder.toString());
tailBuilder.append(tailVariant);
variants.add(tailBuilder.toString());
}
}
return variants;
} } | public class class_name {
private Set<String> variantsFor(String input) {
// Store current invocation's results
Set<String> variants = new HashSet<>();
Matcher m = regex.matcher(input);
boolean matches = m.matches();
if (!matches) {
// if the regex does not find any patterns,
// simply add the input as is
variants.add(input); // depends on control dependency: [if], data = [none]
// end recursion
return variants; // depends on control dependency: [if], data = [none]
}
// isolate the part before the first pattern
String head = m.group(1);
// isolate the pattern itself, removing its wrapping {}
String patternGroup = m.group(2).replaceAll("[\\{\\}]", "");
// isolate the remaining part of the input
String tail = m.group(6);
// split the pattern into its options and add an empty
// string if it ends with a separator
List<String> patternParts = new ArrayList<>();
patternParts.addAll(asList(patternGroup.split("\\|")));
if (patternGroup.endsWith("|")) {
patternParts.add(""); // depends on control dependency: [if], data = [none]
}
// Iterate over the current pattern's
// variants and construct the result.
for (String part : patternParts) {
StringBuilder builder = new StringBuilder();
if (head != null) {
builder.append(head); // depends on control dependency: [if], data = [(head]
}
builder.append(part); // depends on control dependency: [for], data = [part]
// recurse on the tail of the input
// to handle the next pattern
Set<String> tails = variantsFor(tail);
// append all variants of the tail end
// and add each of them to the part we have
// built up so far.
for (String tailVariant : tails) {
StringBuilder tailBuilder = new StringBuilder(builder.toString());
tailBuilder.append(tailVariant); // depends on control dependency: [for], data = [tailVariant]
variants.add(tailBuilder.toString()); // depends on control dependency: [for], data = [none]
}
}
return variants;
} } |
public class class_name {
@Deprecated
public StringBuilder writeToBuilder(Bean bean, boolean rootType) {
try {
write(bean, rootType, this.builder);
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
return builder;
} } | public class class_name {
@Deprecated
public StringBuilder writeToBuilder(Bean bean, boolean rootType) {
try {
write(bean, rootType, this.builder); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new IllegalStateException(ex);
} // depends on control dependency: [catch], data = [none]
return builder;
} } |
public class class_name {
public long position() throws IOException {
ensureOpen();
synchronized (positionLock) {
long p = -1;
int ti = -1;
try {
begin();
ti = threads.add();
if (!isOpen())
return 0;
if (append) {
BlockGuard.getThreadPolicy().onWriteToDisk();
}
do {
// in append-mode then position is advanced to end before writing
p = (append) ? nd.size(fd) : position0(fd, -1);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
return IOStatus.normalize(p);
} finally {
threads.remove(ti);
end(p > -1);
assert IOStatus.check(p);
}
}
} } | public class class_name {
public long position() throws IOException {
ensureOpen();
synchronized (positionLock) {
long p = -1;
int ti = -1;
try {
begin(); // depends on control dependency: [try], data = [none]
ti = threads.add(); // depends on control dependency: [try], data = [none]
if (!isOpen())
return 0;
if (append) {
BlockGuard.getThreadPolicy().onWriteToDisk(); // depends on control dependency: [if], data = [none]
}
do {
// in append-mode then position is advanced to end before writing
p = (append) ? nd.size(fd) : position0(fd, -1);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
return IOStatus.normalize(p); // depends on control dependency: [try], data = [none]
} finally {
threads.remove(ti);
end(p > -1);
assert IOStatus.check(p);
}
}
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String join(final Map value, final String delim) {
if (value == null || value.isEmpty()) {
return "";
}
final StringBuilder buf = new StringBuilder();
for (final Iterator<Map.Entry<String, String>> i = value.entrySet().iterator(); i.hasNext();) {
final Map.Entry<String, String> e = i.next();
buf.append(e.getKey()).append(EQUAL).append(e.getValue());
if (i.hasNext()) {
buf.append(delim);
}
}
return buf.toString();
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String join(final Map value, final String delim) {
if (value == null || value.isEmpty()) {
return ""; // depends on control dependency: [if], data = [none]
}
final StringBuilder buf = new StringBuilder();
for (final Iterator<Map.Entry<String, String>> i = value.entrySet().iterator(); i.hasNext();) {
final Map.Entry<String, String> e = i.next();
buf.append(e.getKey()).append(EQUAL).append(e.getValue()); // depends on control dependency: [for], data = [none]
if (i.hasNext()) {
buf.append(delim); // depends on control dependency: [if], data = [none]
}
}
return buf.toString();
} } |
public class class_name {
public static void postorder(int parent[], int N, int post[], @Nullable IGrowArray gwork) {
if (parent.length < N)
throw new IllegalArgumentException("parent must be at least of length N");
if (post.length < N)
throw new IllegalArgumentException("post must be at least of length N");
int[] w = UtilEjml.adjust(gwork, 3*N);
// w[0] to w[N-1] is initialized to the youngest child of node 'j'
// w[N] to w[2N-1] is initialized to the second youngest child of node 'j'
// w[2N] to w[3N-1] is the stacked of nodes to be examined in the dfs
final int next = N;
// specify the linked list as being empty initially
for (int j = 0; j < N; j++) {
w[j] = -1;
}
// traverse nodes in reverse order
for (int j = N-1; j >= 0; j--) {
// skip if j has no parent, i.e. is a root node
if( parent[j] == -1 )
continue;
// add j to the list of parents
w[next+j] = w[parent[j]];
w[parent[j]] = j;
}
// perform the DFS on each root node
int k = 0;
for (int j = 0; j < N; j++) {
if( parent[j] != -1 )
continue;
k = postorder_dfs(j,k,w,post,N);
}
} } | public class class_name {
public static void postorder(int parent[], int N, int post[], @Nullable IGrowArray gwork) {
if (parent.length < N)
throw new IllegalArgumentException("parent must be at least of length N");
if (post.length < N)
throw new IllegalArgumentException("post must be at least of length N");
int[] w = UtilEjml.adjust(gwork, 3*N);
// w[0] to w[N-1] is initialized to the youngest child of node 'j'
// w[N] to w[2N-1] is initialized to the second youngest child of node 'j'
// w[2N] to w[3N-1] is the stacked of nodes to be examined in the dfs
final int next = N;
// specify the linked list as being empty initially
for (int j = 0; j < N; j++) {
w[j] = -1; // depends on control dependency: [for], data = [j]
}
// traverse nodes in reverse order
for (int j = N-1; j >= 0; j--) {
// skip if j has no parent, i.e. is a root node
if( parent[j] == -1 )
continue;
// add j to the list of parents
w[next+j] = w[parent[j]]; // depends on control dependency: [for], data = [j]
w[parent[j]] = j; // depends on control dependency: [for], data = [j]
}
// perform the DFS on each root node
int k = 0;
for (int j = 0; j < N; j++) {
if( parent[j] != -1 )
continue;
k = postorder_dfs(j,k,w,post,N); // depends on control dependency: [for], data = [j]
}
} } |
public class class_name {
public void writeScript(AbstractRenderAppender sb)
{
assert(sb != null) : "The paramter 'sb' must not be null;";
if (_writeScript)
return;
_writeScript = true;
IScriptReporter sr = getParentScriptReporter();
if (sr != null) {
sr.writeScript(sb);
return;
}
writeBeforeBlocks(sb);
writeFrameworkScript(sb);
writeAfterBlocks(sb);
} } | public class class_name {
public void writeScript(AbstractRenderAppender sb)
{
assert(sb != null) : "The paramter 'sb' must not be null;";
if (_writeScript)
return;
_writeScript = true;
IScriptReporter sr = getParentScriptReporter();
if (sr != null) {
sr.writeScript(sb); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
writeBeforeBlocks(sb);
writeFrameworkScript(sb);
writeAfterBlocks(sb);
} } |
public class class_name {
private ResultSet generateKeysResultSet(final UpdateResult res) {
if (this.generatedKeysColumnIndexes == null &&
this.generatedKeysColumnNames == null) {
return res.generatedKeys.resultSet().withStatement(this);
} else if (this.generatedKeysColumnIndexes != null) {
return res.generatedKeys.resultSet().withStatement(this).
withProjection(this.generatedKeysColumnIndexes);
} else {
return res.generatedKeys.resultSet().withStatement(this).
withProjection(this.generatedKeysColumnNames);
}
} } | public class class_name {
private ResultSet generateKeysResultSet(final UpdateResult res) {
if (this.generatedKeysColumnIndexes == null &&
this.generatedKeysColumnNames == null) {
return res.generatedKeys.resultSet().withStatement(this); // depends on control dependency: [if], data = [none]
} else if (this.generatedKeysColumnIndexes != null) {
return res.generatedKeys.resultSet().withStatement(this).
withProjection(this.generatedKeysColumnIndexes); // depends on control dependency: [if], data = [none]
} else {
return res.generatedKeys.resultSet().withStatement(this).
withProjection(this.generatedKeysColumnNames); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public BooleanExpression eq(T right) {
if (right instanceof RelationalPath) {
return primaryKeyOperation(Ops.EQ, primaryKey, ((RelationalPath) right).getPrimaryKey());
} else {
return super.eq(right);
}
} } | public class class_name {
@Override
public BooleanExpression eq(T right) {
if (right instanceof RelationalPath) {
return primaryKeyOperation(Ops.EQ, primaryKey, ((RelationalPath) right).getPrimaryKey()); // depends on control dependency: [if], data = [none]
} else {
return super.eq(right); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAssessmentRuns(java.util.Collection<AssessmentRun> assessmentRuns) {
if (assessmentRuns == null) {
this.assessmentRuns = null;
return;
}
this.assessmentRuns = new java.util.ArrayList<AssessmentRun>(assessmentRuns);
} } | public class class_name {
public void setAssessmentRuns(java.util.Collection<AssessmentRun> assessmentRuns) {
if (assessmentRuns == null) {
this.assessmentRuns = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.assessmentRuns = new java.util.ArrayList<AssessmentRun>(assessmentRuns);
} } |
public class class_name {
private static Tile checkTile(MapTile map, ImageBuffer tileSprite, Integer sheet, int x, int y)
{
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
final SpriteTiled tileSheet = map.getSheet(sheet);
final ImageBuffer sheetImage = tileSheet.getSurface();
final int tilesInX = tileSheet.getWidth() / tw;
final int tilesInY = tileSheet.getHeight() / th;
for (int surfaceCurrentTileY = 0; surfaceCurrentTileY < tilesInY; surfaceCurrentTileY++)
{
for (int surfaceCurrentTileX = 0; surfaceCurrentTileX < tilesInX; surfaceCurrentTileX++)
{
// Tile number on tile sheet
final int number = surfaceCurrentTileX + surfaceCurrentTileY * tilesInX;
// Compare tiles between sheet and image map
final int xa = x * tw;
final int ya = y * th;
final int xb = surfaceCurrentTileX * tw;
final int yb = surfaceCurrentTileY * th;
if (TilesExtractor.compareTile(tw, th, tileSprite, xa, ya, sheetImage, xb, yb))
{
return map.createTile(sheet, number, xa, (map.getInTileHeight() - 1.0 - y) * th);
}
}
}
return null;
} } | public class class_name {
private static Tile checkTile(MapTile map, ImageBuffer tileSprite, Integer sheet, int x, int y)
{
final int tw = map.getTileWidth();
final int th = map.getTileHeight();
final SpriteTiled tileSheet = map.getSheet(sheet);
final ImageBuffer sheetImage = tileSheet.getSurface();
final int tilesInX = tileSheet.getWidth() / tw;
final int tilesInY = tileSheet.getHeight() / th;
for (int surfaceCurrentTileY = 0; surfaceCurrentTileY < tilesInY; surfaceCurrentTileY++)
{
for (int surfaceCurrentTileX = 0; surfaceCurrentTileX < tilesInX; surfaceCurrentTileX++)
{
// Tile number on tile sheet
final int number = surfaceCurrentTileX + surfaceCurrentTileY * tilesInX;
// Compare tiles between sheet and image map
final int xa = x * tw;
final int ya = y * th;
final int xb = surfaceCurrentTileX * tw;
final int yb = surfaceCurrentTileY * th;
if (TilesExtractor.compareTile(tw, th, tileSprite, xa, ya, sheetImage, xb, yb))
{
return map.createTile(sheet, number, xa, (map.getInTileHeight() - 1.0 - y) * th); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public void callChildVisitors(XSLTVisitor visitor, boolean callAttributes)
{
if(callAttributes && (null != m_selectExpression))
m_selectExpression.callVisitors(this, visitor);
int length = getSortElemCount();
for (int i = 0; i < length; i++)
{
getSortElem(i).callVisitors(visitor);
}
super.callChildVisitors(visitor, callAttributes);
} } | public class class_name {
public void callChildVisitors(XSLTVisitor visitor, boolean callAttributes)
{
if(callAttributes && (null != m_selectExpression))
m_selectExpression.callVisitors(this, visitor);
int length = getSortElemCount();
for (int i = 0; i < length; i++)
{
getSortElem(i).callVisitors(visitor); // depends on control dependency: [for], data = [i]
}
super.callChildVisitors(visitor, callAttributes);
} } |
public class class_name {
public void init() {
if (incNestingCount() > 1) {
return;
}
SessionFactory sf = getSessionFactory();
if (sf == null) {
return;
}
if (TransactionSynchronizationManager.hasResource(sf)) {
// Do not modify the Session: just set the participate flag.
setParticipate(true);
}
else {
setParticipate(false);
LOG.debug("Opening single Hibernate session in HibernatePersistenceContextInterceptor");
Session session = getSession();
HibernateRuntimeUtils.enableDynamicFilterEnablerIfPresent(sf, session);
TransactionSynchronizationManager.bindResource(sf, new SessionHolder(session));
}
} } | public class class_name {
public void init() {
if (incNestingCount() > 1) {
return; // depends on control dependency: [if], data = [none]
}
SessionFactory sf = getSessionFactory();
if (sf == null) {
return; // depends on control dependency: [if], data = [none]
}
if (TransactionSynchronizationManager.hasResource(sf)) {
// Do not modify the Session: just set the participate flag.
setParticipate(true); // depends on control dependency: [if], data = [none]
}
else {
setParticipate(false); // depends on control dependency: [if], data = [none]
LOG.debug("Opening single Hibernate session in HibernatePersistenceContextInterceptor"); // depends on control dependency: [if], data = [none]
Session session = getSession();
HibernateRuntimeUtils.enableDynamicFilterEnablerIfPresent(sf, session); // depends on control dependency: [if], data = [none]
TransactionSynchronizationManager.bindResource(sf, new SessionHolder(session)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getDescription(String className, String methodName, Object[] args) throws ClassNotFoundException {
Class targetClass = Class.forName(className);
Method[] methods = targetClass.getMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazz = method.getParameterTypes();
if (clazz.length == args.length) {
return method.getAnnotation(AopLog.class).value();
}
}
}
return "";
} } | public class class_name {
public static String getDescription(String className, String methodName, Object[] args) throws ClassNotFoundException {
Class targetClass = Class.forName(className);
Method[] methods = targetClass.getMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazz = method.getParameterTypes();
if (clazz.length == args.length) {
return method.getAnnotation(AopLog.class).value(); // depends on control dependency: [if], data = [none]
}
}
}
return "";
} } |
public class class_name {
public void marshall(Problem problem, ProtocolMarshaller protocolMarshaller) {
if (problem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(problem.getRun(), RUN_BINDING);
protocolMarshaller.marshall(problem.getJob(), JOB_BINDING);
protocolMarshaller.marshall(problem.getSuite(), SUITE_BINDING);
protocolMarshaller.marshall(problem.getTest(), TEST_BINDING);
protocolMarshaller.marshall(problem.getDevice(), DEVICE_BINDING);
protocolMarshaller.marshall(problem.getResult(), RESULT_BINDING);
protocolMarshaller.marshall(problem.getMessage(), MESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Problem problem, ProtocolMarshaller protocolMarshaller) {
if (problem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(problem.getRun(), RUN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getJob(), JOB_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getSuite(), SUITE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getTest(), TEST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getDevice(), DEVICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getResult(), RESULT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(problem.getMessage(), MESSAGE_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]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.