code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile;
}
}
return null;
} } | public class class_name {
private File findSourceFile (final String filename)
{
final Collection <File> sourceRoots = this.nonGeneratedSourceRoots;
for (final File sourceRoot : sourceRoots)
{
final File sourceFile = new File (sourceRoot, filename);
if (sourceFile.exists ())
{
return sourceFile; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void checkHorizontalLimit(double extrp, double vx)
{
// Inside interval
if (mover.getX() >= limitLeft
&& mover.getX() <= limitRight
&& limitLeft != Integer.MIN_VALUE
&& limitRight != Integer.MAX_VALUE)
{
offset.moveLocation(extrp, vx, 0);
// Block offset on its limits
if (offset.getX() < -intervalHorizontal)
{
offset.teleportX(-intervalHorizontal);
}
else if (offset.getX() > intervalHorizontal)
{
offset.teleportX(intervalHorizontal);
}
}
// Outside interval
if ((int) offset.getX() == -intervalHorizontal || (int) offset.getX() == intervalHorizontal)
{
mover.moveLocationX(extrp, vx);
}
applyHorizontalLimit();
} } | public class class_name {
private void checkHorizontalLimit(double extrp, double vx)
{
// Inside interval
if (mover.getX() >= limitLeft
&& mover.getX() <= limitRight
&& limitLeft != Integer.MIN_VALUE
&& limitRight != Integer.MAX_VALUE)
{
offset.moveLocation(extrp, vx, 0); // depends on control dependency: [if], data = [none]
// Block offset on its limits
if (offset.getX() < -intervalHorizontal)
{
offset.teleportX(-intervalHorizontal); // depends on control dependency: [if], data = [-intervalHorizontal)]
}
else if (offset.getX() > intervalHorizontal)
{
offset.teleportX(intervalHorizontal); // depends on control dependency: [if], data = [intervalHorizontal)]
}
}
// Outside interval
if ((int) offset.getX() == -intervalHorizontal || (int) offset.getX() == intervalHorizontal)
{
mover.moveLocationX(extrp, vx); // depends on control dependency: [if], data = [none]
}
applyHorizontalLimit();
} } |
public class class_name {
private void removeFolders() throws CmsImportExportException {
try {
int size = m_folderStorage.size();
m_report.println(Messages.get().container(Messages.RPT_DELFOLDER_START_0), I_CmsReport.FORMAT_HEADLINE);
// iterate though all collected folders. Iteration must start at the end of the list,
// as folders habe to be deleted in the reverse order.
int counter = 1;
for (int j = (size - 1); j >= 0; j--) {
String resname = m_folderStorage.get(j);
resname = (resname.startsWith("/") ? "" : "/") + resname + (resname.endsWith("/") ? "" : "/");
// now check if the folder is really empty. Only delete empty folders
List<CmsResource> files = m_cms.getFilesInFolder(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (files.size() == 0) {
List<CmsResource> folders = m_cms.getSubFolders(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (folders.size() == 0) {
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(counter),
String.valueOf(size)),
I_CmsReport.FORMAT_NOTE);
m_report.print(Messages.get().container(Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resname),
I_CmsReport.FORMAT_DEFAULT);
m_cms.lockResource(resname);
m_cms.deleteResource(resname, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
counter++;
}
}
}
} catch (CmsException e) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_REMOVING_FOLDERS_OF_IMPORTED_BODY_FILES_0);
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} } | public class class_name {
private void removeFolders() throws CmsImportExportException {
try {
int size = m_folderStorage.size();
m_report.println(Messages.get().container(Messages.RPT_DELFOLDER_START_0), I_CmsReport.FORMAT_HEADLINE);
// iterate though all collected folders. Iteration must start at the end of the list,
// as folders habe to be deleted in the reverse order.
int counter = 1;
for (int j = (size - 1); j >= 0; j--) {
String resname = m_folderStorage.get(j);
resname = (resname.startsWith("/") ? "" : "/") + resname + (resname.endsWith("/") ? "" : "/");
// now check if the folder is really empty. Only delete empty folders
List<CmsResource> files = m_cms.getFilesInFolder(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (files.size() == 0) {
List<CmsResource> folders = m_cms.getSubFolders(resname, CmsResourceFilter.IGNORE_EXPIRATION);
if (folders.size() == 0) {
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_2,
String.valueOf(counter),
String.valueOf(size)),
I_CmsReport.FORMAT_NOTE); // depends on control dependency: [if], data = [none]
m_report.print(Messages.get().container(Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE); // depends on control dependency: [if], data = [0)]
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
resname),
I_CmsReport.FORMAT_DEFAULT); // depends on control dependency: [if], data = [none]
m_cms.lockResource(resname); // depends on control dependency: [if], data = [none]
m_cms.deleteResource(resname, CmsResource.DELETE_PRESERVE_SIBLINGS); // depends on control dependency: [if], data = [none]
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK); // depends on control dependency: [if], data = [none]
counter++; // depends on control dependency: [if], data = [none]
}
}
}
} catch (CmsException e) {
CmsMessageContainer message = Messages.get().container(
Messages.ERR_IMPORTEXPORT_ERROR_REMOVING_FOLDERS_OF_IMPORTED_BODY_FILES_0);
if (LOG.isDebugEnabled()) {
LOG.debug(message.key(), e);
}
throw new CmsImportExportException(message, e);
}
} } |
public class class_name {
static List<Annotation> getAnnotations(AnnotatedElement element, EnumSet<FindOption> findOptions,
Predicate<Annotation> collectingFilter) {
requireNonNull(element, "element");
requireNonNull(collectingFilter, "collectingFilter");
final Builder<Annotation> builder = new Builder<>();
for (final AnnotatedElement e : resolveTargetElements(element, findOptions)) {
for (final Annotation annotation : e.getDeclaredAnnotations()) {
if (findOptions.contains(FindOption.LOOKUP_META_ANNOTATIONS)) {
getMetaAnnotations(builder, annotation, collectingFilter);
}
if (collectingFilter.test(annotation)) {
builder.add(annotation);
}
}
}
return builder.build();
} } | public class class_name {
static List<Annotation> getAnnotations(AnnotatedElement element, EnumSet<FindOption> findOptions,
Predicate<Annotation> collectingFilter) {
requireNonNull(element, "element");
requireNonNull(collectingFilter, "collectingFilter");
final Builder<Annotation> builder = new Builder<>();
for (final AnnotatedElement e : resolveTargetElements(element, findOptions)) {
for (final Annotation annotation : e.getDeclaredAnnotations()) {
if (findOptions.contains(FindOption.LOOKUP_META_ANNOTATIONS)) {
getMetaAnnotations(builder, annotation, collectingFilter); // depends on control dependency: [if], data = [none]
}
if (collectingFilter.test(annotation)) {
builder.add(annotation); // depends on control dependency: [if], data = [none]
}
}
}
return builder.build();
} } |
public class class_name {
public boolean isRemoteBranch(final Git git, final String branch, final String remote) {
try {
final List<Ref> refs = git.branchList()
.setListMode(ListBranchCommand.ListMode.REMOTE).call();
final String remoteBranch = remote + "/" + branch;
return refs.stream().anyMatch(ref -> ref.getName().endsWith(remoteBranch));
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} } | public class class_name {
public boolean isRemoteBranch(final Git git, final String branch, final String remote) {
try {
final List<Ref> refs = git.branchList()
.setListMode(ListBranchCommand.ListMode.REMOTE).call();
final String remoteBranch = remote + "/" + branch;
return refs.stream().anyMatch(ref -> ref.getName().endsWith(remoteBranch)); // depends on control dependency: [try], data = [none]
} catch (GitAPIException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Api
public void setRoles(Map<String, List<AuthorizationInfo>> roles) {
Map<String, List<NamedRoleInfo>> namedRoles = new HashMap<String, List<NamedRoleInfo>>();
for (String ldapRole : roles.keySet()) {
DN dn;
List<AuthorizationInfo> auth = roles.get(ldapRole);
NamedRoleInfo role = new NamedRoleInfo();
role.setAuthorizations(auth);
try {
dn = new DN(ldapRole);
role.setName(dn.getRDN().getAttributeValues()[0]);
} catch (LDAPException e) {
role.setName(ldapRole);
}
namedRoles.put(ldapRole, Collections.singletonList(role));
}
setNamedRoles(namedRoles);
} } | public class class_name {
@Api
public void setRoles(Map<String, List<AuthorizationInfo>> roles) {
Map<String, List<NamedRoleInfo>> namedRoles = new HashMap<String, List<NamedRoleInfo>>();
for (String ldapRole : roles.keySet()) {
DN dn;
List<AuthorizationInfo> auth = roles.get(ldapRole);
NamedRoleInfo role = new NamedRoleInfo();
role.setAuthorizations(auth); // depends on control dependency: [for], data = [none]
try {
dn = new DN(ldapRole); // depends on control dependency: [try], data = [none]
role.setName(dn.getRDN().getAttributeValues()[0]); // depends on control dependency: [try], data = [none]
} catch (LDAPException e) {
role.setName(ldapRole);
} // depends on control dependency: [catch], data = [none]
namedRoles.put(ldapRole, Collections.singletonList(role)); // depends on control dependency: [for], data = [ldapRole]
}
setNamedRoles(namedRoles);
} } |
public class class_name {
public Map<URI, URI> getConflicTable() {
for (final Map.Entry<URI, URI> e : conflictTable.entrySet()) {
assert e.getKey().isAbsolute();
assert e.getValue().isAbsolute();
}
return conflictTable;
} } | public class class_name {
public Map<URI, URI> getConflicTable() {
for (final Map.Entry<URI, URI> e : conflictTable.entrySet()) {
assert e.getKey().isAbsolute();
assert e.getValue().isAbsolute(); // depends on control dependency: [for], data = [e]
}
return conflictTable;
} } |
public class class_name {
public com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResultOrBuilder
getCategoricalStatsResultOrBuilder() {
if (resultCase_ == 4) {
return (com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult)
result_;
}
return com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult
.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResultOrBuilder
getCategoricalStatsResultOrBuilder() {
if (resultCase_ == 4) {
return (com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult)
result_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult
.getDefaultInstance();
} } |
public class class_name {
@Override
public String cipherSuite()
{
SSLSocket sslSocket = _sslSocket;
if (sslSocket == null) {
return super.cipherSuite();
}
SSLSession sslSession = sslSocket.getSession();
if (sslSession != null) {
return sslSession.getCipherSuite();
}
else {
return null;
}
} } | public class class_name {
@Override
public String cipherSuite()
{
SSLSocket sslSocket = _sslSocket;
if (sslSocket == null) {
return super.cipherSuite(); // depends on control dependency: [if], data = [none]
}
SSLSession sslSession = sslSocket.getSession();
if (sslSession != null) {
return sslSession.getCipherSuite(); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public double getTagSequenceProb() {
// System.err.println("Parse.getTagSequenceProb: "+type+" "+this);
if (this.parts.size() == 1
&& this.parts.get(0).type.equals(ShiftReduceParser.TOK_NODE)) {
// System.err.println(this+" "+prob);
return Math.log(this.prob);
} else if (this.parts.size() == 0) {
System.err.println("Parse.getTagSequenceProb: Wrong base case!");
return 0.0;
} else {
double sum = 0.0;
for (final Parse parse : this.parts) {
sum += parse.getTagSequenceProb();
}
return sum;
}
} } | public class class_name {
public double getTagSequenceProb() {
// System.err.println("Parse.getTagSequenceProb: "+type+" "+this);
if (this.parts.size() == 1
&& this.parts.get(0).type.equals(ShiftReduceParser.TOK_NODE)) {
// System.err.println(this+" "+prob);
return Math.log(this.prob); // depends on control dependency: [if], data = [none]
} else if (this.parts.size() == 0) {
System.err.println("Parse.getTagSequenceProb: Wrong base case!"); // depends on control dependency: [if], data = [none]
return 0.0; // depends on control dependency: [if], data = [none]
} else {
double sum = 0.0;
for (final Parse parse : this.parts) {
sum += parse.getTagSequenceProb(); // depends on control dependency: [for], data = [parse]
}
return sum; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean has(DatabaseObject example, Database database) throws DatabaseException, InvalidExampleException {
// @todo I have seen duplicates in types - maybe convert the List into a Set? Need to understand it more thoroughly.
List<Class<? extends DatabaseObject>> types = new ArrayList<>(getContainerTypes(example.getClass(), database));
types.add(example.getClass());
/*
* Does the query concern the DATABASECHANGELOG / DATABASECHANGELOGLOCK table? If so, we do a quick & dirty
* SELECT COUNT(*) on that table. If that works, we count that as confirmation of existence.
*/
// @todo Actually, there may be extreme cases (distorted table statistics etc.) where a COUNT(*) might not be so cheap. Maybe SELECT a dummy constant is the better way?
if ((example instanceof Table) && (example.getName().equals(database.getDatabaseChangeLogTableName()) ||
example.getName().equals(database.getDatabaseChangeLogLockTableName()))) {
try {
ExecutorService.getInstance().getExecutor(database).queryForInt(
new RawSqlStatement("SELECT COUNT(*) FROM " +
database.escapeObjectName(database.getLiquibaseCatalogName(),
database.getLiquibaseSchemaName(), example.getName(), Table.class)));
return true;
} catch (DatabaseException e) {
if (database instanceof PostgresDatabase) { // throws "current transaction is aborted" unless we roll back the connection
database.rollback();
}
return false;
}
}
/*
* If the query is about another object, try to create a snapshot of the of the object (or used the cached
* snapshot. If that works, we count that as confirmation of existence.
*/
SnapshotControl snapshotControl = (new SnapshotControl(database, false, types.toArray(new Class[types.size()])));
snapshotControl.setWarnIfObjectNotFound(false);
if (createSnapshot(example, database,snapshotControl) != null) {
return true;
}
CatalogAndSchema catalogAndSchema;
if (example.getSchema() == null) {
catalogAndSchema = database.getDefaultSchema();
} else {
catalogAndSchema = example.getSchema().toCatalogAndSchema();
}
DatabaseSnapshot snapshot = createSnapshot(catalogAndSchema, database,
new SnapshotControl(database, false, example.getClass()).setWarnIfObjectNotFound(false)
);
for (DatabaseObject obj : snapshot.get(example.getClass())) {
if (DatabaseObjectComparatorFactory.getInstance().isSameObject(example, obj, null, database)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean has(DatabaseObject example, Database database) throws DatabaseException, InvalidExampleException {
// @todo I have seen duplicates in types - maybe convert the List into a Set? Need to understand it more thoroughly.
List<Class<? extends DatabaseObject>> types = new ArrayList<>(getContainerTypes(example.getClass(), database));
types.add(example.getClass());
/*
* Does the query concern the DATABASECHANGELOG / DATABASECHANGELOGLOCK table? If so, we do a quick & dirty
* SELECT COUNT(*) on that table. If that works, we count that as confirmation of existence.
*/
// @todo Actually, there may be extreme cases (distorted table statistics etc.) where a COUNT(*) might not be so cheap. Maybe SELECT a dummy constant is the better way?
if ((example instanceof Table) && (example.getName().equals(database.getDatabaseChangeLogTableName()) ||
example.getName().equals(database.getDatabaseChangeLogLockTableName()))) {
try {
ExecutorService.getInstance().getExecutor(database).queryForInt(
new RawSqlStatement("SELECT COUNT(*) FROM " +
database.escapeObjectName(database.getLiquibaseCatalogName(),
database.getLiquibaseSchemaName(), example.getName(), Table.class)));
return true;
} catch (DatabaseException e) {
if (database instanceof PostgresDatabase) { // throws "current transaction is aborted" unless we roll back the connection
database.rollback(); // depends on control dependency: [if], data = [none]
}
return false;
}
}
/*
* If the query is about another object, try to create a snapshot of the of the object (or used the cached
* snapshot. If that works, we count that as confirmation of existence.
*/
SnapshotControl snapshotControl = (new SnapshotControl(database, false, types.toArray(new Class[types.size()])));
snapshotControl.setWarnIfObjectNotFound(false);
if (createSnapshot(example, database,snapshotControl) != null) {
return true;
}
CatalogAndSchema catalogAndSchema;
if (example.getSchema() == null) {
catalogAndSchema = database.getDefaultSchema();
} else {
catalogAndSchema = example.getSchema().toCatalogAndSchema();
}
DatabaseSnapshot snapshot = createSnapshot(catalogAndSchema, database,
new SnapshotControl(database, false, example.getClass()).setWarnIfObjectNotFound(false)
);
for (DatabaseObject obj : snapshot.get(example.getClass())) {
if (DatabaseObjectComparatorFactory.getInstance().isSameObject(example, obj, null, database)) {
return true;
}
}
return false;
} } |
public class class_name {
public DataBinder load(String[] args, int offset) {
for (int i = offset; i < args.length; ++i) {
int equal = args[i].indexOf('=');
if (equal > 0) {
put(args[i].substring(0, equal), args[i].substring(equal + 1));
} else {
throw new RuntimeException("***InvalidParameter{" + args[i] + '}');
}
}
return this;
} } | public class class_name {
public DataBinder load(String[] args, int offset) {
for (int i = offset; i < args.length; ++i) {
int equal = args[i].indexOf('=');
if (equal > 0) {
put(args[i].substring(0, equal), args[i].substring(equal + 1)); // depends on control dependency: [if], data = [(equal]
} else {
throw new RuntimeException("***InvalidParameter{" + args[i] + '}');
}
}
return this;
} } |
public class class_name {
public DependencyInfo createDependencyInfo(File basedir, String filename) {
DependencyInfo dependency;
try {
File dependencyFile = new File(basedir, filename);
String sha1 = ChecksumUtils.calculateSHA1(dependencyFile);
dependency = new DependencyInfo(sha1);
dependency.setArtifactId(dependencyFile.getName());
dependency.setFilename(dependencyFile.getName());
// system path
try {
dependency.setSystemPath(dependencyFile.getCanonicalPath());
} catch (IOException e) {
dependency.setSystemPath(dependencyFile.getAbsolutePath());
}
// populate hints
if (calculateHints) {
DependencyHintsInfo hints = HintUtils.getHints(dependencyFile.getPath());
dependency.setHints(hints);
}
// additional sha1s
// MD5
if (calculateMd5) {
String md5 = ChecksumUtils.calculateHash(dependencyFile, HashAlgorithm.MD5);
dependency.addChecksum(ChecksumType.MD5, md5);
}
// handle JavaScript files
if (filename.toLowerCase().matches(JAVA_SCRIPT_REGEX)) {
Map<ChecksumType, String> javaScriptChecksums;
try {
javaScriptChecksums = new HashCalculator().calculateJavaScriptHashes(dependencyFile);
if (javaScriptChecksums == null || javaScriptChecksums.isEmpty()) {
logger.debug("Failed to calculate javaScript hash: {}", dependencyFile.getPath());
}
for (Map.Entry<ChecksumType, String> entry : javaScriptChecksums.entrySet()) {
dependency.addChecksum(entry.getKey(), entry.getValue());
}
} catch (Exception e) {
logger.warn("Failed to calculate javaScript hash for file: {}, error: {}", dependencyFile.getPath(), e.getMessage());
logger.debug("Failed to calculate javaScript hash for file: {}, error: {}", dependencyFile.getPath(), e.getStackTrace());
}
}
// other platform SHA1
ChecksumUtils.calculateOtherPlatformSha1(dependency, dependencyFile);
// super hash
ChecksumUtils.calculateSuperHash(dependency, dependencyFile);
} catch (IOException e) {
logger.warn("Failed to create dependency " + filename + " to dependency list: {}", e.getMessage());
dependency = null;
}
return dependency;
} } | public class class_name {
public DependencyInfo createDependencyInfo(File basedir, String filename) {
DependencyInfo dependency;
try {
File dependencyFile = new File(basedir, filename);
String sha1 = ChecksumUtils.calculateSHA1(dependencyFile);
dependency = new DependencyInfo(sha1); // depends on control dependency: [try], data = [none]
dependency.setArtifactId(dependencyFile.getName()); // depends on control dependency: [try], data = [none]
dependency.setFilename(dependencyFile.getName()); // depends on control dependency: [try], data = [none]
// system path
try {
dependency.setSystemPath(dependencyFile.getCanonicalPath()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
dependency.setSystemPath(dependencyFile.getAbsolutePath());
} // depends on control dependency: [catch], data = [none]
// populate hints
if (calculateHints) {
DependencyHintsInfo hints = HintUtils.getHints(dependencyFile.getPath());
dependency.setHints(hints); // depends on control dependency: [if], data = [none]
}
// additional sha1s
// MD5
if (calculateMd5) {
String md5 = ChecksumUtils.calculateHash(dependencyFile, HashAlgorithm.MD5);
dependency.addChecksum(ChecksumType.MD5, md5); // depends on control dependency: [if], data = [none]
}
// handle JavaScript files
if (filename.toLowerCase().matches(JAVA_SCRIPT_REGEX)) {
Map<ChecksumType, String> javaScriptChecksums;
try {
javaScriptChecksums = new HashCalculator().calculateJavaScriptHashes(dependencyFile); // depends on control dependency: [try], data = [none]
if (javaScriptChecksums == null || javaScriptChecksums.isEmpty()) {
logger.debug("Failed to calculate javaScript hash: {}", dependencyFile.getPath()); // depends on control dependency: [if], data = [none]
}
for (Map.Entry<ChecksumType, String> entry : javaScriptChecksums.entrySet()) {
dependency.addChecksum(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} catch (Exception e) {
logger.warn("Failed to calculate javaScript hash for file: {}, error: {}", dependencyFile.getPath(), e.getMessage());
logger.debug("Failed to calculate javaScript hash for file: {}, error: {}", dependencyFile.getPath(), e.getStackTrace());
} // depends on control dependency: [catch], data = [none]
}
// other platform SHA1
ChecksumUtils.calculateOtherPlatformSha1(dependency, dependencyFile); // depends on control dependency: [try], data = [none]
// super hash
ChecksumUtils.calculateSuperHash(dependency, dependencyFile); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.warn("Failed to create dependency " + filename + " to dependency list: {}", e.getMessage());
dependency = null;
} // depends on control dependency: [catch], data = [none]
return dependency;
} } |
public class class_name {
@Override
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
// re-install the cache container services
CacheContainerAddHandler.installRuntimeServices(context, operation, model);
// re-install any existing cache services
for (CacheType type: CacheType.values()) {
CacheAdd addHandler = type.getAddHandler();
if (model.hasDefined(type.pathElement().getKey())) {
for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) {
ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName())));
addHandler.installRuntimeServices(context, addOperation, model, property.getValue());
}
}
}
} } | public class class_name {
@Override
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
PathAddress address = context.getCurrentAddress();
// re-install the cache container services
CacheContainerAddHandler.installRuntimeServices(context, operation, model);
// re-install any existing cache services
for (CacheType type: CacheType.values()) {
CacheAdd addHandler = type.getAddHandler();
if (model.hasDefined(type.pathElement().getKey())) {
for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) {
ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName())));
addHandler.installRuntimeServices(context, addOperation, model, property.getValue()); // depends on control dependency: [for], data = [property]
}
}
}
} } |
public class class_name {
public void debug(final String msg) {
if (proxy.isDebugEnabled()) {
if (proxy instanceof LocationAwareLogger) {
((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null);
} else {
proxy.debug(msg);
}
}
} } | public class class_name {
public void debug(final String msg) {
if (proxy.isDebugEnabled()) {
if (proxy instanceof LocationAwareLogger) {
((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.DEBUG_INT, msg, null, null); // depends on control dependency: [if], data = [none]
} else {
proxy.debug(msg); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void checkNeedUpdateTopologies(Map<String, StateHeartbeat> localWorkerStats,
Map<Integer, LocalAssignment> localAssignments) throws Exception {
Set<String> topologies = new HashSet<>();
for (Map.Entry<Integer, LocalAssignment> entry : localAssignments.entrySet()) {
topologies.add(entry.getValue().getTopologyId());
}
for (StateHeartbeat stateHb : localWorkerStats.values()) {
State state = stateHb.getState();
if (!state.equals(State.notStarted)) {
String topologyId = stateHb.getHeartbeat().getTopologyId();
topologies.remove(topologyId);
}
}
long currTime = System.currentTimeMillis();
Set<String> needRemoveTopologies = new HashSet<>();
for (String topologyId : topologies) {
try {
long lastModifyTime = StormConfig.get_supervisor_topology_Bianrymodify_time(conf, topologyId);
if ((currTime - lastModifyTime) / 1000 < (JStormUtils.MIN_1 * 2)) {
LOG.debug("less than 2 minute, removing " + topologyId);
needRemoveTopologies.add(topologyId);
}
} catch (Exception e) {
LOG.error("Failed to get last modified time for topology" + topologyId, e);
needRemoveTopologies.add(topologyId);
}
}
topologies.removeAll(needRemoveTopologies);
if (topologies.size() > 0) {
LOG.debug("Following topologies are going to re-download jars, " + topologies);
}
needDownloadTopologies.set(topologies);
} } | public class class_name {
@SuppressWarnings("unchecked")
private void checkNeedUpdateTopologies(Map<String, StateHeartbeat> localWorkerStats,
Map<Integer, LocalAssignment> localAssignments) throws Exception {
Set<String> topologies = new HashSet<>();
for (Map.Entry<Integer, LocalAssignment> entry : localAssignments.entrySet()) {
topologies.add(entry.getValue().getTopologyId());
}
for (StateHeartbeat stateHb : localWorkerStats.values()) {
State state = stateHb.getState();
if (!state.equals(State.notStarted)) {
String topologyId = stateHb.getHeartbeat().getTopologyId();
topologies.remove(topologyId); // depends on control dependency: [if], data = [none]
}
}
long currTime = System.currentTimeMillis();
Set<String> needRemoveTopologies = new HashSet<>();
for (String topologyId : topologies) {
try {
long lastModifyTime = StormConfig.get_supervisor_topology_Bianrymodify_time(conf, topologyId);
if ((currTime - lastModifyTime) / 1000 < (JStormUtils.MIN_1 * 2)) {
LOG.debug("less than 2 minute, removing " + topologyId); // depends on control dependency: [if], data = [none]
needRemoveTopologies.add(topologyId); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.error("Failed to get last modified time for topology" + topologyId, e);
needRemoveTopologies.add(topologyId);
} // depends on control dependency: [catch], data = [none]
}
topologies.removeAll(needRemoveTopologies);
if (topologies.size() > 0) {
LOG.debug("Following topologies are going to re-download jars, " + topologies);
}
needDownloadTopologies.set(topologies);
} } |
public class class_name {
public void createFailure(BeanO beanO)
{
//-----------------------------------------------------------
// If beanO is null then it was never added to the container
// so we don't need to do anything.
//-----------------------------------------------------------
if (beanO != null) {
EJSContainer.getThreadData().popCallbackBeanO();
beanO.destroy();
try {
container.removeBean(beanO);
} catch (CSITransactionRolledbackException ex) {
//---------------------------------------------------
// If transaction rolled back beanO has already been
// successfully removed from container.
//---------------------------------------------------
FFDCFilter.processException(ex, CLASS_NAME + ".createFailure",
"1732", this);
}
}
} } | public class class_name {
public void createFailure(BeanO beanO)
{
//-----------------------------------------------------------
// If beanO is null then it was never added to the container
// so we don't need to do anything.
//-----------------------------------------------------------
if (beanO != null) {
EJSContainer.getThreadData().popCallbackBeanO(); // depends on control dependency: [if], data = [none]
beanO.destroy(); // depends on control dependency: [if], data = [none]
try {
container.removeBean(beanO); // depends on control dependency: [try], data = [none]
} catch (CSITransactionRolledbackException ex) {
//---------------------------------------------------
// If transaction rolled back beanO has already been
// successfully removed from container.
//---------------------------------------------------
FFDCFilter.processException(ex, CLASS_NAME + ".createFailure",
"1732", this);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
final void checkReturnType(TypeElement autoValueClass, ExecutableElement getter) {
TypeMirror type = getter.getReturnType();
if (type.getKind() == TypeKind.ARRAY) {
TypeMirror componentType = ((ArrayType) type).getComponentType();
if (componentType.getKind().isPrimitive()) {
warnAboutPrimitiveArrays(autoValueClass, getter);
} else {
errorReporter.reportError(
"An @"
+ simpleAnnotationName
+ " class cannot define an array-valued property unless it is a primitive array",
getter);
}
}
} } | public class class_name {
final void checkReturnType(TypeElement autoValueClass, ExecutableElement getter) {
TypeMirror type = getter.getReturnType();
if (type.getKind() == TypeKind.ARRAY) {
TypeMirror componentType = ((ArrayType) type).getComponentType();
if (componentType.getKind().isPrimitive()) {
warnAboutPrimitiveArrays(autoValueClass, getter); // depends on control dependency: [if], data = [none]
} else {
errorReporter.reportError(
"An @"
+ simpleAnnotationName
+ " class cannot define an array-valued property unless it is a primitive array",
getter); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void queryMessagesByType(int msgType, final String msgId, final long timestamp, final int limit,
final AVIMMessagesQueryCallback callback) {
if (null == callback) {
return;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(Conversation.PARAM_MESSAGE_QUERY_MSGID, msgId);
params.put(Conversation.PARAM_MESSAGE_QUERY_TIMESTAMP, timestamp);
params.put(Conversation.PARAM_MESSAGE_QUERY_STARTCLOSED, false);
params.put(Conversation.PARAM_MESSAGE_QUERY_TO_MSGID, "");
params.put(Conversation.PARAM_MESSAGE_QUERY_TO_TIMESTAMP, 0);
params.put(Conversation.PARAM_MESSAGE_QUERY_TOCLOSED, false);
params.put(Conversation.PARAM_MESSAGE_QUERY_DIRECT, AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromNewToOld.getCode());
params.put(Conversation.PARAM_MESSAGE_QUERY_LIMIT, limit);
params.put(Conversation.PARAM_MESSAGE_QUERY_TYPE, msgType);
boolean ret = InternalConfiguration.getOperationTube().queryMessages(this.client.getClientId(), getConversationId(),
getType(), JSON.toJSONString(params),
Conversation.AVIMOperation.CONVERSATION_MESSAGE_QUERY, callback);
if (!ret) {
callback.internalDone(new AVException(AVException.OPERATION_FORBIDDEN, "couldn't send request in background."));
}
} } | public class class_name {
public void queryMessagesByType(int msgType, final String msgId, final long timestamp, final int limit,
final AVIMMessagesQueryCallback callback) {
if (null == callback) {
return; // depends on control dependency: [if], data = [none]
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(Conversation.PARAM_MESSAGE_QUERY_MSGID, msgId);
params.put(Conversation.PARAM_MESSAGE_QUERY_TIMESTAMP, timestamp);
params.put(Conversation.PARAM_MESSAGE_QUERY_STARTCLOSED, false);
params.put(Conversation.PARAM_MESSAGE_QUERY_TO_MSGID, "");
params.put(Conversation.PARAM_MESSAGE_QUERY_TO_TIMESTAMP, 0);
params.put(Conversation.PARAM_MESSAGE_QUERY_TOCLOSED, false);
params.put(Conversation.PARAM_MESSAGE_QUERY_DIRECT, AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromNewToOld.getCode());
params.put(Conversation.PARAM_MESSAGE_QUERY_LIMIT, limit);
params.put(Conversation.PARAM_MESSAGE_QUERY_TYPE, msgType);
boolean ret = InternalConfiguration.getOperationTube().queryMessages(this.client.getClientId(), getConversationId(),
getType(), JSON.toJSONString(params),
Conversation.AVIMOperation.CONVERSATION_MESSAGE_QUERY, callback);
if (!ret) {
callback.internalDone(new AVException(AVException.OPERATION_FORBIDDEN, "couldn't send request in background.")); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "unused" })
private static void rewriteMergeList(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
for (int i = 0; i < tnl.size(); i++) {
Object item = snl.get(tnl.getName(i));
if (item != null && tnl.getVal(i) instanceof NamedList) {
NamedList<Object> tnnl = (NamedList<Object>) tnl.getVal(i);
Object o = tnnl.get(key);
NamedList<Object> tnnnl;
if (o != null && o instanceof NamedList) {
tnnnl = (NamedList<Object>) o;
} else {
tnnnl = new SimpleOrderedMap<>();
tnnl.add(key, tnnnl);
}
tnnnl.add(subKey, item);
}
}
} } | public class class_name {
@SuppressWarnings({ "unchecked", "unused" })
private static void rewriteMergeList(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
for (int i = 0; i < tnl.size(); i++) {
Object item = snl.get(tnl.getName(i));
if (item != null && tnl.getVal(i) instanceof NamedList) {
NamedList<Object> tnnl = (NamedList<Object>) tnl.getVal(i);
Object o = tnnl.get(key);
NamedList<Object> tnnnl;
if (o != null && o instanceof NamedList) {
tnnnl = (NamedList<Object>) o; // depends on control dependency: [if], data = [none]
} else {
tnnnl = new SimpleOrderedMap<>(); // depends on control dependency: [if], data = [none]
tnnl.add(key, tnnnl); // depends on control dependency: [if], data = [none]
}
tnnnl.add(subKey, item); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String typeToTyperef(final Class type) {
if (!type.isArray()) {
if (!type.isPrimitive()) {
return 'L' + typeToSignature(type) + ';';
}
if (type == int.class) {
return "I";
}
if (type == long.class) {
return "J";
}
if (type == boolean.class) {
return "Z";
}
if (type == double.class) {
return "D";
}
if (type == float.class) {
return "F";
}
if (type == short.class) {
return "S";
}
if (type == void.class) {
return "V";
}
if (type == byte.class) {
return "B";
}
if (type == char.class) {
return "C";
}
}
return type.getName();
} } | public class class_name {
public static String typeToTyperef(final Class type) {
if (!type.isArray()) {
if (!type.isPrimitive()) {
return 'L' + typeToSignature(type) + ';'; // depends on control dependency: [if], data = [none]
}
if (type == int.class) {
return "I"; // depends on control dependency: [if], data = [none]
}
if (type == long.class) {
return "J"; // depends on control dependency: [if], data = [none]
}
if (type == boolean.class) {
return "Z"; // depends on control dependency: [if], data = [none]
}
if (type == double.class) {
return "D"; // depends on control dependency: [if], data = [none]
}
if (type == float.class) {
return "F"; // depends on control dependency: [if], data = [none]
}
if (type == short.class) {
return "S"; // depends on control dependency: [if], data = [none]
}
if (type == void.class) {
return "V"; // depends on control dependency: [if], data = [none]
}
if (type == byte.class) {
return "B"; // depends on control dependency: [if], data = [none]
}
if (type == char.class) {
return "C"; // depends on control dependency: [if], data = [none]
}
}
return type.getName();
} } |
public class class_name {
private List<Node> createObjectsForQualifiedName(String namespace) {
List<Node> objects = new ArrayList<>();
String[] parts = namespace.split("\\.");
createObjectIfNew(objects, parts[0], true);
if (parts.length >= 2) {
StringBuilder currPrefix = new StringBuilder().append(parts[0]);
for (int i = 1; i < parts.length; ++i) {
currPrefix.append(".").append(parts[i]);
createObjectIfNew(objects, currPrefix.toString(), false);
}
}
return objects;
} } | public class class_name {
private List<Node> createObjectsForQualifiedName(String namespace) {
List<Node> objects = new ArrayList<>();
String[] parts = namespace.split("\\.");
createObjectIfNew(objects, parts[0], true);
if (parts.length >= 2) {
StringBuilder currPrefix = new StringBuilder().append(parts[0]);
for (int i = 1; i < parts.length; ++i) {
currPrefix.append(".").append(parts[i]); // depends on control dependency: [for], data = [i]
createObjectIfNew(objects, currPrefix.toString(), false); // depends on control dependency: [for], data = [none]
}
}
return objects;
} } |
public class class_name {
public static ErrorCode isAddressValid(String address){
if (!isMustFieldValid( address, ipRegEx)) {
return ErrorCode.SERVICE_INSTANCE_ADDRESS_FORMAT_ERROR;
}
return ErrorCode.OK;
} } | public class class_name {
public static ErrorCode isAddressValid(String address){
if (!isMustFieldValid( address, ipRegEx)) {
return ErrorCode.SERVICE_INSTANCE_ADDRESS_FORMAT_ERROR; // depends on control dependency: [if], data = [none]
}
return ErrorCode.OK;
} } |
public class class_name {
public synchronized void stop() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[STOP]);
}
inProcessOfStopping = true;
sessionStoreService.setCompletedPassivation(false); // 128284
//This is only executed for Time-based writes ... not for manual or End-Of-Service writes
if (_smc.getEnableTimeBasedWrite()) {
((BackedHashMap) _sessions).doTimeBasedWrites(true);
}
// We'll get here for:
// 1) Stop server
// 2) Stop Application/ear
// 3) Restart Application/ear
// Look at all cached sessions and passivate them if necessary
Enumeration vEnum = tableKeys();
while (vEnum.hasMoreElements()) {
String id = (String) vEnum.nextElement();
BackedSession s = (BackedSession) ((BackedHashMap) _sessions).superGet(id);
_storeCallback.sessionWillPassivate(s);
//in case you update the session during passivation
if (_smc.getPersistSessionAfterPassivation()) {
//Need to also write the session if passivate updated any attributes.
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[STOP], "Persisting the session after it was passivated. " + s.getAppNameAndID());
}
s.removingSessionFromCache = true;
s.sync();
//sync calls this: ((BackedHashMap)_sessions).put(id, s);
s.removingSessionFromCache = false;
}
}
sessionStoreService.setCompletedPassivation(true); // 128284
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[STOP]);
}
} } | public class class_name {
public synchronized void stop() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[STOP]); // depends on control dependency: [if], data = [none]
}
inProcessOfStopping = true;
sessionStoreService.setCompletedPassivation(false); // 128284
//This is only executed for Time-based writes ... not for manual or End-Of-Service writes
if (_smc.getEnableTimeBasedWrite()) {
((BackedHashMap) _sessions).doTimeBasedWrites(true); // depends on control dependency: [if], data = [none]
}
// We'll get here for:
// 1) Stop server
// 2) Stop Application/ear
// 3) Restart Application/ear
// Look at all cached sessions and passivate them if necessary
Enumeration vEnum = tableKeys();
while (vEnum.hasMoreElements()) {
String id = (String) vEnum.nextElement();
BackedSession s = (BackedSession) ((BackedHashMap) _sessions).superGet(id);
_storeCallback.sessionWillPassivate(s); // depends on control dependency: [while], data = [none]
//in case you update the session during passivation
if (_smc.getPersistSessionAfterPassivation()) {
//Need to also write the session if passivate updated any attributes.
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[STOP], "Persisting the session after it was passivated. " + s.getAppNameAndID()); // depends on control dependency: [if], data = [none]
}
s.removingSessionFromCache = true; // depends on control dependency: [if], data = [none]
s.sync(); // depends on control dependency: [if], data = [none]
//sync calls this: ((BackedHashMap)_sessions).put(id, s);
s.removingSessionFromCache = false; // depends on control dependency: [if], data = [none]
}
}
sessionStoreService.setCompletedPassivation(true); // 128284
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[STOP]); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static TaggedLogger tag(final String tag) {
if (tag == null || tag.isEmpty()) {
return instance;
} else {
TaggedLogger logger = loggers.get(tag);
if (logger == null) {
logger = new TaggedLogger(tag);
TaggedLogger existing = loggers.putIfAbsent(tag, logger);
return existing == null ? logger : existing;
} else {
return logger;
}
}
} } | public class class_name {
public static TaggedLogger tag(final String tag) {
if (tag == null || tag.isEmpty()) {
return instance; // depends on control dependency: [if], data = [none]
} else {
TaggedLogger logger = loggers.get(tag);
if (logger == null) {
logger = new TaggedLogger(tag); // depends on control dependency: [if], data = [none]
TaggedLogger existing = loggers.putIfAbsent(tag, logger);
return existing == null ? logger : existing; // depends on control dependency: [if], data = [none]
} else {
return logger; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static ConnectionType getVCConnectionType(VirtualConnection vc) {
if (vc == null) {
return null;
}
return (ConnectionType) vc.getStateMap().get(CONNECTION_TYPE_VC_KEY);
} } | public class class_name {
public static ConnectionType getVCConnectionType(VirtualConnection vc) {
if (vc == null) {
return null; // depends on control dependency: [if], data = [none]
}
return (ConnectionType) vc.getStateMap().get(CONNECTION_TYPE_VC_KEY);
} } |
public class class_name {
public void setLinkSpecifiers(java.util.Collection<TypedLinkSpecifier> linkSpecifiers) {
if (linkSpecifiers == null) {
this.linkSpecifiers = null;
return;
}
this.linkSpecifiers = new java.util.ArrayList<TypedLinkSpecifier>(linkSpecifiers);
} } | public class class_name {
public void setLinkSpecifiers(java.util.Collection<TypedLinkSpecifier> linkSpecifiers) {
if (linkSpecifiers == null) {
this.linkSpecifiers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.linkSpecifiers = new java.util.ArrayList<TypedLinkSpecifier>(linkSpecifiers);
} } |
public class class_name {
public static boolean methodBelongsTo(Method m, Method[] methods){
boolean result = false;
for (int i = 0; i < methods.length && !result; i++) {
if(methodEquals (methods [i], m)){
result = true;
}
}
return result;
} } | public class class_name {
public static boolean methodBelongsTo(Method m, Method[] methods){
boolean result = false;
for (int i = 0; i < methods.length && !result; i++) {
if(methodEquals (methods [i], m)){
result = true; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static void parsePattern(List<NS> nsList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(nsList.size());
for (NS ns : nsList)
{
sbPattern.append(ns.toString());
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String value)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord);
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出地名:%s %s\n", name, value);
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length();
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_PLACE, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} } | public class class_name {
public static void parsePattern(List<NS> nsList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(nsList.size());
for (NS ns : nsList)
{
sbPattern.append(ns.toString()); // depends on control dependency: [for], data = [ns]
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String value)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord); // depends on control dependency: [for], data = [i]
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出地名:%s %s\n", name, value); // depends on control dependency: [if], data = [none]
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length(); // depends on control dependency: [for], data = [i]
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_PLACE, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} } |
public class class_name {
public Stack withNotificationARNs(String... notificationARNs) {
if (this.notificationARNs == null) {
setNotificationARNs(new com.amazonaws.internal.SdkInternalList<String>(notificationARNs.length));
}
for (String ele : notificationARNs) {
this.notificationARNs.add(ele);
}
return this;
} } | public class class_name {
public Stack withNotificationARNs(String... notificationARNs) {
if (this.notificationARNs == null) {
setNotificationARNs(new com.amazonaws.internal.SdkInternalList<String>(notificationARNs.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : notificationARNs) {
this.notificationARNs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void setId(final Integer id) {
if (id == null && this.id == null) {
return;
} else if (id == null) {
removeChild(this.id);
this.id = null;
} else if (this.id == null) {
this.id = new KeyValueNode<Integer>(CommonConstants.CS_ID_TITLE, id);
nodes.addFirst(this.id);
if (this.id.getParent() != null) {
this.id.removeParent();
}
this.id.setParent(this);
} else {
this.id.setValue(id);
}
} } | public class class_name {
public void setId(final Integer id) {
if (id == null && this.id == null) {
return; // depends on control dependency: [if], data = [none]
} else if (id == null) {
removeChild(this.id); // depends on control dependency: [if], data = [none]
this.id = null; // depends on control dependency: [if], data = [none]
} else if (this.id == null) {
this.id = new KeyValueNode<Integer>(CommonConstants.CS_ID_TITLE, id); // depends on control dependency: [if], data = [none]
nodes.addFirst(this.id); // depends on control dependency: [if], data = [(this.id]
if (this.id.getParent() != null) {
this.id.removeParent(); // depends on control dependency: [if], data = [none]
}
this.id.setParent(this); // depends on control dependency: [if], data = [none]
} else {
this.id.setValue(id); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static KeyStore load(InputStream in, char[] password) {
try {
KeyStore myTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
myTrustStore.load(in, password);
return myTrustStore;
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreException | IOException e) {
throw new TrustManagerLoadFailedException(e);
} finally {
Closeables.closeQuietly(in);
}
} } | public class class_name {
public static KeyStore load(InputStream in, char[] password) {
try {
KeyStore myTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
myTrustStore.load(in, password); // depends on control dependency: [try], data = [none]
return myTrustStore; // depends on control dependency: [try], data = [none]
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreException | IOException e) {
throw new TrustManagerLoadFailedException(e);
} finally { // depends on control dependency: [catch], data = [none]
Closeables.closeQuietly(in);
}
} } |
public class class_name {
protected ElementBox createAnonymousBox(ElementBox parent, Box child, boolean block)
{
ElementBox anbox;
if (block)
{
Element anelem = createAnonymousElement(child.getNode().getOwnerDocument(), "Xdiv", "block");
anbox = new BlockBox(anelem, (Graphics2D) child.getGraphics().create(), child.getVisualContext().create());
anbox.setViewport(viewport);
anbox.setStyle(createAnonymousStyle("block"));
((BlockBox) anbox).contblock = false;
anbox.isblock = true;
}
else
{
Element anelem = createAnonymousElement(child.getNode().getOwnerDocument(), "Xspan", "inline");
anbox = new InlineBox(anelem, (Graphics2D) child.getGraphics().create(), child.getVisualContext().create());
anbox.setViewport(viewport);
anbox.setStyle(createAnonymousStyle("inline"));
anbox.isblock = false;
}
if (parent != null)
{
computeInheritedStyle(anbox, parent);
anbox.setParent(parent);
}
anbox.setOrder(next_order++);
anbox.isempty = true;
anbox.setBase(child.getBase());
anbox.setContainingBlockBox(child.getContainingBlockBox());
anbox.setClipBlock(child.getClipBlock());
return anbox;
} } | public class class_name {
protected ElementBox createAnonymousBox(ElementBox parent, Box child, boolean block)
{
ElementBox anbox;
if (block)
{
Element anelem = createAnonymousElement(child.getNode().getOwnerDocument(), "Xdiv", "block");
anbox = new BlockBox(anelem, (Graphics2D) child.getGraphics().create(), child.getVisualContext().create()); // depends on control dependency: [if], data = [none]
anbox.setViewport(viewport); // depends on control dependency: [if], data = [none]
anbox.setStyle(createAnonymousStyle("block")); // depends on control dependency: [if], data = [none]
((BlockBox) anbox).contblock = false; // depends on control dependency: [if], data = [none]
anbox.isblock = true; // depends on control dependency: [if], data = [none]
}
else
{
Element anelem = createAnonymousElement(child.getNode().getOwnerDocument(), "Xspan", "inline");
anbox = new InlineBox(anelem, (Graphics2D) child.getGraphics().create(), child.getVisualContext().create()); // depends on control dependency: [if], data = [none]
anbox.setViewport(viewport); // depends on control dependency: [if], data = [none]
anbox.setStyle(createAnonymousStyle("inline")); // depends on control dependency: [if], data = [none]
anbox.isblock = false; // depends on control dependency: [if], data = [none]
}
if (parent != null)
{
computeInheritedStyle(anbox, parent); // depends on control dependency: [if], data = [none]
anbox.setParent(parent); // depends on control dependency: [if], data = [(parent]
}
anbox.setOrder(next_order++);
anbox.isempty = true;
anbox.setBase(child.getBase());
anbox.setContainingBlockBox(child.getContainingBlockBox());
anbox.setClipBlock(child.getClipBlock());
return anbox;
} } |
public class class_name {
public static String userTagAction(String property, ServletRequest req) {
CmsFlexController controller = CmsFlexController.getController(req);
CmsObject cms = controller.getCmsObject();
CmsUser user = cms.getRequestContext().getCurrentUser();
if (property == null) {
property = USER_PROPERTIES[0];
}
String result = null;
switch (USER_PROPERTIES_LIST.indexOf(property)) {
case 0: // name
result = user.getName();
break;
case 1: // firstname
result = user.getFirstname();
break;
case 2: // lastname
result = user.getLastname();
break;
case 3: // email
result = user.getEmail();
break;
case 4: // street
result = user.getAddress();
break;
case 5: // zip
result = user.getZipcode();
break;
case 6: // city
result = user.getCity();
break;
case 7: // description
result = user.getDescription(cms.getRequestContext().getLocale());
break;
// following 3 attributes are no longer supported
case 8: // group
case 9: // currentgroup
case 10: // defaultgroup
result = "";
break;
case 11: // otherstuff
Iterator<String> it = user.getAdditionalInfo().keySet().iterator();
CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0);
result = Messages.getLocalizedMessage(msgContainer, req);
while (it.hasNext()) {
Object o = it.next();
result += " " + o + "=" + user.getAdditionalInfo((String)o);
}
break;
case 12: // institution
result = user.getInstitution();
break;
default:
msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property);
result = Messages.getLocalizedMessage(msgContainer, req);
}
return result;
} } | public class class_name {
public static String userTagAction(String property, ServletRequest req) {
CmsFlexController controller = CmsFlexController.getController(req);
CmsObject cms = controller.getCmsObject();
CmsUser user = cms.getRequestContext().getCurrentUser();
if (property == null) {
property = USER_PROPERTIES[0]; // depends on control dependency: [if], data = [none]
}
String result = null;
switch (USER_PROPERTIES_LIST.indexOf(property)) {
case 0: // name
result = user.getName();
break;
case 1: // firstname
result = user.getFirstname();
break;
case 2: // lastname
result = user.getLastname();
break;
case 3: // email
result = user.getEmail();
break;
case 4: // street
result = user.getAddress();
break;
case 5: // zip
result = user.getZipcode();
break;
case 6: // city
result = user.getCity();
break;
case 7: // description
result = user.getDescription(cms.getRequestContext().getLocale());
break;
// following 3 attributes are no longer supported
case 8: // group
case 9: // currentgroup
case 10: // defaultgroup
result = "";
break;
case 11: // otherstuff
Iterator<String> it = user.getAdditionalInfo().keySet().iterator();
CmsMessageContainer msgContainer = Messages.get().container(Messages.GUI_TAG_USER_ADDITIONALINFO_0);
result = Messages.getLocalizedMessage(msgContainer, req);
while (it.hasNext()) {
Object o = it.next();
result += " " + o + "=" + user.getAdditionalInfo((String)o); // depends on control dependency: [while], data = [none]
}
break;
case 12: // institution
result = user.getInstitution();
break;
default:
msgContainer = Messages.get().container(Messages.GUI_ERR_INVALID_USER_PROP_1, property);
result = Messages.getLocalizedMessage(msgContainer, req);
}
return result;
} } |
public class class_name {
public static String getAbbreviatedName(final Class<?> cls, final int len) {
if (cls == null) {
return StringUtils.EMPTY;
}
return getAbbreviatedName(cls.getName(), len);
} } | public class class_name {
public static String getAbbreviatedName(final Class<?> cls, final int len) {
if (cls == null) {
return StringUtils.EMPTY; // depends on control dependency: [if], data = [none]
}
return getAbbreviatedName(cls.getName(), len);
} } |
public class class_name {
public static double parseDouble(String val, double defValue){
if(TextUtils.isEmpty(val)) return defValue;
try{
return Double.parseDouble(val);
}catch(NumberFormatException e){
return defValue;
}
} } | public class class_name {
public static double parseDouble(String val, double defValue){
if(TextUtils.isEmpty(val)) return defValue;
try{
return Double.parseDouble(val); // depends on control dependency: [try], data = [none]
}catch(NumberFormatException e){
return defValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int indexOfAny(final CharSequence str, final CharSequence... searchStrs) {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
// String's can't have a MAX_VALUEth index.
int ret = Integer.MAX_VALUE;
int tmp = 0;
for (final CharSequence search : searchStrs) {
if (search == null) {
continue;
}
tmp = CharSequenceUtils.indexOf(str, search, 0);
if (tmp == INDEX_NOT_FOUND) {
continue;
}
if (tmp < ret) {
ret = tmp;
}
}
return ret == Integer.MAX_VALUE ? INDEX_NOT_FOUND : ret;
} } | public class class_name {
public static int indexOfAny(final CharSequence str, final CharSequence... searchStrs) {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND; // depends on control dependency: [if], data = [none]
}
// String's can't have a MAX_VALUEth index.
int ret = Integer.MAX_VALUE;
int tmp = 0;
for (final CharSequence search : searchStrs) {
if (search == null) {
continue;
}
tmp = CharSequenceUtils.indexOf(str, search, 0); // depends on control dependency: [for], data = [search]
if (tmp == INDEX_NOT_FOUND) {
continue;
}
if (tmp < ret) {
ret = tmp; // depends on control dependency: [if], data = [none]
}
}
return ret == Integer.MAX_VALUE ? INDEX_NOT_FOUND : ret;
} } |
public class class_name {
public void logout() {
if (loginContext != null) {
try {
loginContext.logout();
if (logoutLogger.isDebugEnabled()) {
logoutLogger.debug("[ws/#" + getId() + "] Logout successful.");
}
} catch (LoginException e) {
logoutLogger.trace("[ws/#" + getId() + "] Exception occurred logging out of this WebSocket session.", e);
}
}
loginContext = null;
} } | public class class_name {
public void logout() {
if (loginContext != null) {
try {
loginContext.logout(); // depends on control dependency: [try], data = [none]
if (logoutLogger.isDebugEnabled()) {
logoutLogger.debug("[ws/#" + getId() + "] Logout successful."); // depends on control dependency: [if], data = [none]
}
} catch (LoginException e) {
logoutLogger.trace("[ws/#" + getId() + "] Exception occurred logging out of this WebSocket session.", e);
} // depends on control dependency: [catch], data = [none]
}
loginContext = null;
} } |
public class class_name {
public void setDisableLogTypes(java.util.Collection<String> disableLogTypes) {
if (disableLogTypes == null) {
this.disableLogTypes = null;
return;
}
this.disableLogTypes = new java.util.ArrayList<String>(disableLogTypes);
} } | public class class_name {
public void setDisableLogTypes(java.util.Collection<String> disableLogTypes) {
if (disableLogTypes == null) {
this.disableLogTypes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.disableLogTypes = new java.util.ArrayList<String>(disableLogTypes);
} } |
public class class_name {
public String getStatusCodeReply() {
flush();
this.pipelinedCommands--;
final byte[] resp = (byte[]) RedisProtocol.read(inputStream);
if (null == resp) {
return null;
} else {
return SafeEncoder.encode(resp);
}
} } | public class class_name {
public String getStatusCodeReply() {
flush();
this.pipelinedCommands--;
final byte[] resp = (byte[]) RedisProtocol.read(inputStream);
if (null == resp) {
return null; // depends on control dependency: [if], data = [none]
} else {
return SafeEncoder.encode(resp); // depends on control dependency: [if], data = [resp)]
}
} } |
public class class_name {
private synchronized void loadLookup() {
if (lookup != null)
return;
Object[][] contents = getContents();
HashMap<String,Object> temp = new HashMap<>(contents.length);
for (int i = 0; i < contents.length; ++i) {
// key must be non-null String, value must be non-null
String key = (String) contents[i][0];
Object value = contents[i][1];
if (key == null || value == null) {
throw new NullPointerException();
}
temp.put(key, value);
}
lookup = temp;
} } | public class class_name {
private synchronized void loadLookup() {
if (lookup != null)
return;
Object[][] contents = getContents();
HashMap<String,Object> temp = new HashMap<>(contents.length);
for (int i = 0; i < contents.length; ++i) {
// key must be non-null String, value must be non-null
String key = (String) contents[i][0];
Object value = contents[i][1];
if (key == null || value == null) {
throw new NullPointerException();
}
temp.put(key, value); // depends on control dependency: [for], data = [none]
}
lookup = temp;
} } |
public class class_name {
protected Icon getIcon(AbstractButton b) {
Icon icon = b.getIcon();
ButtonModel model = b.getModel();
if (!model.isEnabled()) {
icon = getSynthDisabledIcon(b, icon);
} else if (model.isPressed() && model.isArmed()) {
icon = getPressedIcon(b, getSelectedIcon(b, icon));
} else if (b.isRolloverEnabled() && model.isRollover()) {
icon = getRolloverIcon(b, getSelectedIcon(b, icon));
} else if (model.isSelected()) {
icon = getSelectedIcon(b, icon);
} else {
icon = getEnabledIcon(b, icon);
}
if (icon == null) {
return getDefaultIcon(b);
}
return icon;
} } | public class class_name {
protected Icon getIcon(AbstractButton b) {
Icon icon = b.getIcon();
ButtonModel model = b.getModel();
if (!model.isEnabled()) {
icon = getSynthDisabledIcon(b, icon); // depends on control dependency: [if], data = [none]
} else if (model.isPressed() && model.isArmed()) {
icon = getPressedIcon(b, getSelectedIcon(b, icon)); // depends on control dependency: [if], data = [none]
} else if (b.isRolloverEnabled() && model.isRollover()) {
icon = getRolloverIcon(b, getSelectedIcon(b, icon)); // depends on control dependency: [if], data = [none]
} else if (model.isSelected()) {
icon = getSelectedIcon(b, icon); // depends on control dependency: [if], data = [none]
} else {
icon = getEnabledIcon(b, icon); // depends on control dependency: [if], data = [none]
}
if (icon == null) {
return getDefaultIcon(b); // depends on control dependency: [if], data = [none]
}
return icon;
} } |
public class class_name {
public void setDimensionConfigurations(java.util.Collection<CloudWatchDimensionConfiguration> dimensionConfigurations) {
if (dimensionConfigurations == null) {
this.dimensionConfigurations = null;
return;
}
this.dimensionConfigurations = new java.util.ArrayList<CloudWatchDimensionConfiguration>(dimensionConfigurations);
} } | public class class_name {
public void setDimensionConfigurations(java.util.Collection<CloudWatchDimensionConfiguration> dimensionConfigurations) {
if (dimensionConfigurations == null) {
this.dimensionConfigurations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dimensionConfigurations = new java.util.ArrayList<CloudWatchDimensionConfiguration>(dimensionConfigurations);
} } |
public class class_name {
protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
AbstractObjectQuery.LOG.debug("Executing SQL: {}", _complStmt);
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
final List<Object[]> values = new ArrayList<>();
while (rs.next()) {
final long id = rs.getLong(1);
Long typeId = null;
if (getBaseType().getMainTable().getSqlColType() != null) {
typeId = rs.getLong(2);
}
values.add(new Object[]{id, typeId});
}
rs.close();
stmt.close();
for (final Object[] row: values) {
final Long id = (Long) row[0];
final Long typeId = (Long) row[1];
getValues().add(Instance.get(typeId == null ? getBaseType() : Type.get(typeId), id));
}
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} } | public class class_name {
protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
AbstractObjectQuery.LOG.debug("Executing SQL: {}", _complStmt);
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
final List<Object[]> values = new ArrayList<>();
while (rs.next()) {
final long id = rs.getLong(1);
Long typeId = null;
if (getBaseType().getMainTable().getSqlColType() != null) {
typeId = rs.getLong(2); // depends on control dependency: [if], data = [none]
}
values.add(new Object[]{id, typeId}); // depends on control dependency: [while], data = [none]
}
rs.close();
stmt.close();
for (final Object[] row: values) {
final Long id = (Long) row[0];
final Long typeId = (Long) row[1];
getValues().add(Instance.get(typeId == null ? getBaseType() : Type.get(typeId), id)); // depends on control dependency: [for], data = [none]
}
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} } |
public class class_name {
public static final boolean toBoolean(String str, boolean trueIfNull) {
if (str == null && trueIfNull) {
return true;
}
return toBoolean(str);
} } | public class class_name {
public static final boolean toBoolean(String str, boolean trueIfNull) {
if (str == null && trueIfNull) {
return true; // depends on control dependency: [if], data = [none]
}
return toBoolean(str);
} } |
public class class_name {
@Override
public String toUriString() {
StringBuilder uriBuilder = new StringBuilder();
if (getScheme() != null) {
uriBuilder.append(getScheme());
uriBuilder.append(':');
}
if (this.userInfo != null || this.host != null) {
uriBuilder.append("//");
if (this.userInfo != null) {
uriBuilder.append(this.userInfo);
uriBuilder.append('@');
}
if (this.host != null) {
uriBuilder.append(host);
}
if (getPort() != -1) {
uriBuilder.append(':');
uriBuilder.append(port);
}
}
String path = getPath();
if (StringUtils.hasLength(path)) {
if (uriBuilder.length() != 0 && path.charAt(0) != PATH_DELIMITER) {
uriBuilder.append(PATH_DELIMITER);
}
uriBuilder.append(path);
}
String query = getQuery();
if (query != null) {
uriBuilder.append('?');
uriBuilder.append(query);
}
if (getFragment() != null) {
uriBuilder.append('#');
uriBuilder.append(getFragment());
}
return uriBuilder.toString();
} } | public class class_name {
@Override
public String toUriString() {
StringBuilder uriBuilder = new StringBuilder();
if (getScheme() != null) {
uriBuilder.append(getScheme()); // depends on control dependency: [if], data = [(getScheme()]
uriBuilder.append(':'); // depends on control dependency: [if], data = [none]
}
if (this.userInfo != null || this.host != null) {
uriBuilder.append("//");
if (this.userInfo != null) {
uriBuilder.append(this.userInfo);
uriBuilder.append('@'); // depends on control dependency: [if], data = [none]
}
if (this.host != null) {
uriBuilder.append(host); // depends on control dependency: [if], data = [none]
}
if (getPort() != -1) {
uriBuilder.append(':'); // depends on control dependency: [if], data = [none]
uriBuilder.append(port); // depends on control dependency: [if], data = [none]
}
}
String path = getPath();
if (StringUtils.hasLength(path)) {
if (uriBuilder.length() != 0 && path.charAt(0) != PATH_DELIMITER) {
uriBuilder.append(PATH_DELIMITER); // depends on control dependency: [if], data = [none]
}
uriBuilder.append(path);
}
String query = getQuery();
if (query != null) {
uriBuilder.append('?');
uriBuilder.append(query);
}
if (getFragment() != null) {
uriBuilder.append('#');
uriBuilder.append(getFragment());
}
return uriBuilder.toString();
} } |
public class class_name {
public static boolean parseRanges(FileRequestContext context) {
if( !StringUtils.isBlank(context.range) ) {
Matcher rangeMatcher = rangePattern.matcher(context.range);
if(rangeMatcher.matches()) {
String ranges[] = rangeMatcher.group(1).split(",");
for(String range : ranges) {
long startBound = -1;
int hyphenIndex = range.indexOf('-');
if( hyphenIndex > 0 ) {
startBound = Long.parseLong(range.substring(0, hyphenIndex));
}
long endBound = -1;
if( hyphenIndex >= 0 && (hyphenIndex + 1) < range.length() ) {
endBound = Long.parseLong(range.substring(hyphenIndex + 1));
}
Range newRange = new Range(startBound, endBound);
if(!(startBound != -1 && endBound != -1 && startBound > endBound) && !(startBound == -1 && endBound == -1)) {
context.ranges.add(newRange);
}
}
return !context.ranges.isEmpty();
}
}
return true;
} } | public class class_name {
public static boolean parseRanges(FileRequestContext context) {
if( !StringUtils.isBlank(context.range) ) {
Matcher rangeMatcher = rangePattern.matcher(context.range);
if(rangeMatcher.matches()) {
String ranges[] = rangeMatcher.group(1).split(",");
for(String range : ranges) {
long startBound = -1;
int hyphenIndex = range.indexOf('-');
if( hyphenIndex > 0 ) {
startBound = Long.parseLong(range.substring(0, hyphenIndex)); // depends on control dependency: [if], data = [none]
}
long endBound = -1;
if( hyphenIndex >= 0 && (hyphenIndex + 1) < range.length() ) {
endBound = Long.parseLong(range.substring(hyphenIndex + 1)); // depends on control dependency: [if], data = [none]
}
Range newRange = new Range(startBound, endBound);
if(!(startBound != -1 && endBound != -1 && startBound > endBound) && !(startBound == -1 && endBound == -1)) {
context.ranges.add(newRange); // depends on control dependency: [if], data = [none]
}
}
return !context.ranges.isEmpty(); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static HttpServletResponse getHttpServletResponse(ExternalContext ec)
{
if (isHttpServletRequest(ec))
{
return (HttpServletResponse) ec.getResponse();
}
return null;
} } | public class class_name {
public static HttpServletResponse getHttpServletResponse(ExternalContext ec)
{
if (isHttpServletRequest(ec))
{
return (HttpServletResponse) ec.getResponse(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public int getHeight() {
View view = viewRef.get();
if (view != null) {
final ViewGroup.LayoutParams params = view.getLayoutParams();
int height = 0;
if (checkActualViewSize && params != null && params.height != ViewGroup.LayoutParams.WRAP_CONTENT) {
height = view.getHeight(); // Get actual image height
}
if (height <= 0 && params != null) height = params.height; // Get layout height parameter
return height;
}
return 0;
} } | public class class_name {
@Override
public int getHeight() {
View view = viewRef.get();
if (view != null) {
final ViewGroup.LayoutParams params = view.getLayoutParams();
int height = 0;
if (checkActualViewSize && params != null && params.height != ViewGroup.LayoutParams.WRAP_CONTENT) {
height = view.getHeight(); // Get actual image height // depends on control dependency: [if], data = [none]
}
if (height <= 0 && params != null) height = params.height; // Get layout height parameter
return height; // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
public void setAdditionalLanguageCodes(java.util.Collection<String> additionalLanguageCodes) {
if (additionalLanguageCodes == null) {
this.additionalLanguageCodes = null;
return;
}
this.additionalLanguageCodes = new java.util.ArrayList<String>(additionalLanguageCodes);
} } | public class class_name {
public void setAdditionalLanguageCodes(java.util.Collection<String> additionalLanguageCodes) {
if (additionalLanguageCodes == null) {
this.additionalLanguageCodes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.additionalLanguageCodes = new java.util.ArrayList<String>(additionalLanguageCodes);
} } |
public class class_name {
public void processRequestAck(long tick, long dmeVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"processRequestAck",
new Object[] { Long.valueOf(tick), Long.valueOf(dmeVersion)});
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
_targetStream.setCursor(tick);
TickRange tickRange = _targetStream.getNext();
// Make sure that we still have a Q/G
if (tickRange.type == TickRange.Requested)
{
AIRequestedTick airt = (AIRequestedTick) tickRange.value;
// serialize with get repetition and request timeouts
synchronized (airt)
{
// Set the request timer to slow, but only if it is not already slowed
if (!airt.isSlowed())
{
_eagerGetTOM.removeTimeoutEntry(airt);
airt.setSlowed(true);
airt.setAckingDMEVersion(dmeVersion);
long to = airt.getTimeout();
if (to > 0 || to == _mp.getCustomProperties().get_infinite_timeout())
{
_slowedGetTOM.addTimeoutEntry(airt);
}
}
}
}
else
{
// This can happen if the request ack got in too late and the Q/G was timed out and rejected
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processRequestAck");
} } | public class class_name {
public void processRequestAck(long tick, long dmeVersion)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"processRequestAck",
new Object[] { Long.valueOf(tick), Long.valueOf(dmeVersion)});
// Only consider non-stale request acks
if (dmeVersion >= _latestDMEVersion)
{
_targetStream.setCursor(tick); // depends on control dependency: [if], data = [none]
TickRange tickRange = _targetStream.getNext();
// Make sure that we still have a Q/G
if (tickRange.type == TickRange.Requested)
{
AIRequestedTick airt = (AIRequestedTick) tickRange.value;
// serialize with get repetition and request timeouts
synchronized (airt) // depends on control dependency: [if], data = [none]
{
// Set the request timer to slow, but only if it is not already slowed
if (!airt.isSlowed())
{
_eagerGetTOM.removeTimeoutEntry(airt); // depends on control dependency: [if], data = [none]
airt.setSlowed(true); // depends on control dependency: [if], data = [none]
airt.setAckingDMEVersion(dmeVersion); // depends on control dependency: [if], data = [none]
long to = airt.getTimeout();
if (to > 0 || to == _mp.getCustomProperties().get_infinite_timeout())
{
_slowedGetTOM.addTimeoutEntry(airt); // depends on control dependency: [if], data = [none]
}
}
}
}
else
{
// This can happen if the request ack got in too late and the Q/G was timed out and rejected
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "processRequestAck");
} } |
public class class_name {
protected void processLayer(GrayF32 image1 , GrayF32 image2 , GrayF32 derivX2 , GrayF32 derivY2) {
float w = SOR_RELAXATION;
float uf,vf;
// outer Taylor expansion iterations
for( int warp = 0; warp < numWarps; warp++ ) {
initFlowX.setTo(flowX);
initFlowY.setTo(flowY);
warpImageTaylor(derivX2, initFlowX, initFlowY, warpDeriv2X);
warpImageTaylor(derivY2, initFlowX, initFlowY, warpDeriv2Y);
warpImageTaylor(image2, initFlowX, initFlowY, warpImage2);
float error;
int iter = 0;
do {
// inner SOR iteration.
error = 0;
// inner portion
for( int y = 1; y < image1.height-1; y++ ) {
int pixelIndex = y*image1.width+1;
for (int x = 1; x < image1.width-1; x++, pixelIndex++ ) {
// could speed this up a bit more by precomputing the constant portion before the do-while loop
float ui = initFlowX.data[pixelIndex];
float vi = initFlowY.data[pixelIndex];
float u = flowX.data[pixelIndex];
float v = flowY.data[pixelIndex];
float I1 = image1.data[pixelIndex];
float I2 = warpImage2.data[pixelIndex];
float I2x = warpDeriv2X.data[pixelIndex];
float I2y = warpDeriv2Y.data[pixelIndex];
float AU = A(x,y,flowX);
float AV = A(x,y,flowY);
flowX.data[pixelIndex] = uf = (1-w)*u + w*((I1-I2+I2x*ui - I2y*(v-vi))*I2x + alpha2*AU)/(I2x*I2x + alpha2);
flowY.data[pixelIndex] = vf = (1-w)*v + w*((I1-I2+I2y*vi - I2x*(uf-ui))*I2y + alpha2*AV)/(I2y*I2y + alpha2);
error += (uf - u)*(uf - u) + (vf - v)*(vf - v);
}
}
// border regions require special treatment
int pixelIndex0 = 0;
int pixelIndex1 = (image1.height-1)*image1.width;
for (int x = 0; x < image1.width; x++ ) {
error += iterationSorSafe(image1,x,0,pixelIndex0++);
error += iterationSorSafe(image1,x,image1.height-1,pixelIndex1++);
}
pixelIndex0 = image1.width;
pixelIndex1 = image1.width + image1.width-1;
for( int y = 1; y < image1.height-1; y++ ) {
error += iterationSorSafe(image1,0,y,pixelIndex0);
error += iterationSorSafe(image1,image1.width-1,y,pixelIndex1);
pixelIndex0 += image1.width;
pixelIndex1 += image1.width;
}
} while( error > convergeTolerance*image1.width*image1.height && ++iter < maxInnerIterations);
}
} } | public class class_name {
protected void processLayer(GrayF32 image1 , GrayF32 image2 , GrayF32 derivX2 , GrayF32 derivY2) {
float w = SOR_RELAXATION;
float uf,vf;
// outer Taylor expansion iterations
for( int warp = 0; warp < numWarps; warp++ ) {
initFlowX.setTo(flowX); // depends on control dependency: [for], data = [none]
initFlowY.setTo(flowY); // depends on control dependency: [for], data = [none]
warpImageTaylor(derivX2, initFlowX, initFlowY, warpDeriv2X); // depends on control dependency: [for], data = [none]
warpImageTaylor(derivY2, initFlowX, initFlowY, warpDeriv2Y); // depends on control dependency: [for], data = [none]
warpImageTaylor(image2, initFlowX, initFlowY, warpImage2); // depends on control dependency: [for], data = [none]
float error;
int iter = 0;
do {
// inner SOR iteration.
error = 0;
// inner portion
for( int y = 1; y < image1.height-1; y++ ) {
int pixelIndex = y*image1.width+1;
for (int x = 1; x < image1.width-1; x++, pixelIndex++ ) {
// could speed this up a bit more by precomputing the constant portion before the do-while loop
float ui = initFlowX.data[pixelIndex];
float vi = initFlowY.data[pixelIndex];
float u = flowX.data[pixelIndex];
float v = flowY.data[pixelIndex];
float I1 = image1.data[pixelIndex];
float I2 = warpImage2.data[pixelIndex];
float I2x = warpDeriv2X.data[pixelIndex];
float I2y = warpDeriv2Y.data[pixelIndex];
float AU = A(x,y,flowX);
float AV = A(x,y,flowY);
flowX.data[pixelIndex] = uf = (1-w)*u + w*((I1-I2+I2x*ui - I2y*(v-vi))*I2x + alpha2*AU)/(I2x*I2x + alpha2); // depends on control dependency: [for], data = [none]
flowY.data[pixelIndex] = vf = (1-w)*v + w*((I1-I2+I2y*vi - I2x*(uf-ui))*I2y + alpha2*AV)/(I2y*I2y + alpha2); // depends on control dependency: [for], data = [none]
error += (uf - u)*(uf - u) + (vf - v)*(vf - v); // depends on control dependency: [for], data = [none]
}
}
// border regions require special treatment
int pixelIndex0 = 0;
int pixelIndex1 = (image1.height-1)*image1.width;
for (int x = 0; x < image1.width; x++ ) {
error += iterationSorSafe(image1,x,0,pixelIndex0++); // depends on control dependency: [for], data = [x]
error += iterationSorSafe(image1,x,image1.height-1,pixelIndex1++); // depends on control dependency: [for], data = [x]
}
pixelIndex0 = image1.width;
pixelIndex1 = image1.width + image1.width-1;
for( int y = 1; y < image1.height-1; y++ ) {
error += iterationSorSafe(image1,0,y,pixelIndex0); // depends on control dependency: [for], data = [y]
error += iterationSorSafe(image1,image1.width-1,y,pixelIndex1); // depends on control dependency: [for], data = [y]
pixelIndex0 += image1.width; // depends on control dependency: [for], data = [none]
pixelIndex1 += image1.width; // depends on control dependency: [for], data = [none]
}
} while( error > convergeTolerance*image1.width*image1.height && ++iter < maxInnerIterations);
}
} } |
public class class_name {
public byte[] getGravatarForUser(User userParam, int sizeParam)
{
if(userParam == null)
{
return null;
}
try {
JSONObject gravatarJSONObj = this.postJson(
userParam,
WS.Path.User.Version1.getGravatarByUser(sizeParam));
String base64Text = gravatarJSONObj.optString(JSON_TAG_DATA,"");
if(base64Text == null || base64Text.isEmpty())
{
return null;
}
return UtilGlobal.decodeBase64(base64Text);
}
//JSON problem...
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
}
} } | public class class_name {
public byte[] getGravatarForUser(User userParam, int sizeParam)
{
if(userParam == null)
{
return null; // depends on control dependency: [if], data = [none]
}
try {
JSONObject gravatarJSONObj = this.postJson(
userParam,
WS.Path.User.Version1.getGravatarByUser(sizeParam));
String base64Text = gravatarJSONObj.optString(JSON_TAG_DATA,"");
if(base64Text == null || base64Text.isEmpty())
{
return null; // depends on control dependency: [if], data = [none]
}
return UtilGlobal.decodeBase64(base64Text); // depends on control dependency: [try], data = [none]
}
//JSON problem...
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private E setRelationEntities(Object enhanceEntity, Client client, EntityMetadata m)
{
E result = null;
if (enhanceEntity != null)
{
if (!(enhanceEntity instanceof EnhanceEntity))
{
enhanceEntity = new EnhanceEntity(enhanceEntity, PropertyAccessorHelper.getId(enhanceEntity, m), null);
}
EnhanceEntity ee = (EnhanceEntity) enhanceEntity;
result = (E) client.getReader().recursivelyFindEntities(ee.getEntity(), ee.getRelations(), m,
persistenceDelegator, false, new HashMap<Object, Object>());
}
return result;
} } | public class class_name {
private E setRelationEntities(Object enhanceEntity, Client client, EntityMetadata m)
{
E result = null;
if (enhanceEntity != null)
{
if (!(enhanceEntity instanceof EnhanceEntity))
{
enhanceEntity = new EnhanceEntity(enhanceEntity, PropertyAccessorHelper.getId(enhanceEntity, m), null); // depends on control dependency: [if], data = [none]
}
EnhanceEntity ee = (EnhanceEntity) enhanceEntity;
result = (E) client.getReader().recursivelyFindEntities(ee.getEntity(), ee.getRelations(), m,
persistenceDelegator, false, new HashMap<Object, Object>()); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public String getTimeline() {
StringBuilder builder = new StringBuilder();
for (Event event : events) {
builder.append(event.name()).append(":").append(event.timestamp()).append(";");
}
return builder.toString();
} } | public class class_name {
public String getTimeline() {
StringBuilder builder = new StringBuilder();
for (Event event : events) {
builder.append(event.name()).append(":").append(event.timestamp()).append(";"); // depends on control dependency: [for], data = [event]
}
return builder.toString();
} } |
public class class_name {
@Nullable
public static Templates newTemplates (@Nonnull final TransformerFactory aTransformerFactory,
@Nonnull final Source aSource)
{
ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory");
ValueEnforcer.notNull (aSource, "Source");
try
{
return aTransformerFactory.newTemplates (aSource);
}
catch (final TransformerConfigurationException ex)
{
LOGGER.error ("Failed to parse " + aSource, ex);
return null;
}
} } | public class class_name {
@Nullable
public static Templates newTemplates (@Nonnull final TransformerFactory aTransformerFactory,
@Nonnull final Source aSource)
{
ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory");
ValueEnforcer.notNull (aSource, "Source");
try
{
return aTransformerFactory.newTemplates (aSource); // depends on control dependency: [try], data = [none]
}
catch (final TransformerConfigurationException ex)
{
LOGGER.error ("Failed to parse " + aSource, ex);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final Object make(Parameterization config) {
if(state != STATE_FRESH) {
throw new AbortException("Parameterizers may only be used once!");
}
state = STATE_INIT;
Object owner = this.getClass().getDeclaringClass();
config = config.descend(owner == null ? this : owner);
makeOptions(config);
if(!config.hasErrors()) {
state = STATE_COMPLETE;
Object ret = makeInstance();
if(ret == null) {
throw new AbortException("makeInstance() returned null!", new Throwable());
}
return ret;
}
else {
state = STATE_ERRORS;
return null;
}
} } | public class class_name {
public final Object make(Parameterization config) {
if(state != STATE_FRESH) {
throw new AbortException("Parameterizers may only be used once!");
}
state = STATE_INIT;
Object owner = this.getClass().getDeclaringClass();
config = config.descend(owner == null ? this : owner);
makeOptions(config);
if(!config.hasErrors()) {
state = STATE_COMPLETE; // depends on control dependency: [if], data = [none]
Object ret = makeInstance();
if(ret == null) {
throw new AbortException("makeInstance() returned null!", new Throwable());
}
return ret; // depends on control dependency: [if], data = [none]
}
else {
state = STATE_ERRORS; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void removeAuthorizedClient(String clientRegistrationId, String principalName) {
Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty");
Assert.hasText(principalName, "principalName cannot be empty");
ClientRegistration registration =
this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId);
if (registration != null) {
this.authorizedClients.remove(this.getIdentifier(registration, principalName));
}
} } | public class class_name {
@Override
public void removeAuthorizedClient(String clientRegistrationId, String principalName) {
Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty");
Assert.hasText(principalName, "principalName cannot be empty");
ClientRegistration registration =
this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId);
if (registration != null) {
this.authorizedClients.remove(this.getIdentifier(registration, principalName)); // depends on control dependency: [if], data = [(registration]
}
} } |
public class class_name {
protected void refreshPeer (NodeRecord record)
{
PeerNode peer = _peers.get(record.nodeName);
if (peer == null) {
peer = _injector.getInstance(getPeerNodeClass());
_peers.put(record.nodeName, peer);
peer.init(record);
}
peer.refresh(record);
} } | public class class_name {
protected void refreshPeer (NodeRecord record)
{
PeerNode peer = _peers.get(record.nodeName);
if (peer == null) {
peer = _injector.getInstance(getPeerNodeClass()); // depends on control dependency: [if], data = [none]
_peers.put(record.nodeName, peer); // depends on control dependency: [if], data = [none]
peer.init(record); // depends on control dependency: [if], data = [none]
}
peer.refresh(record);
} } |
public class class_name {
public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream,
String keyPassword) {
X509Certificate[] keyCertChain;
PrivateKey key;
try {
keyCertChain = SslContext.toX509Certificates(keyCertChainInputStream);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream not contain valid certificates.", e);
}
try {
key = SslContext.toPrivateKey(keyInputStream, keyPassword);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream does not contain valid private key.", e);
}
return keyManager(key, keyPassword, keyCertChain);
} } | public class class_name {
public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream,
String keyPassword) {
X509Certificate[] keyCertChain;
PrivateKey key;
try {
keyCertChain = SslContext.toX509Certificates(keyCertChainInputStream); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Input stream not contain valid certificates.", e);
} // depends on control dependency: [catch], data = [none]
try {
key = SslContext.toPrivateKey(keyInputStream, keyPassword); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Input stream does not contain valid private key.", e);
} // depends on control dependency: [catch], data = [none]
return keyManager(key, keyPassword, keyCertChain);
} } |
public class class_name {
public Number doParse(String text, ParsePosition parsePosition, boolean isFractionRule,
double upperBound) {
// internally we operate on a copy of the string being parsed
// (because we're going to change it) and use our own ParsePosition
ParsePosition pp = new ParsePosition(0);
// check to see whether the text before the first substitution
// matches the text at the beginning of the string being
// parsed. If it does, strip that off the front of workText;
// otherwise, dump out with a mismatch
int sub1Pos = sub1 != null ? sub1.getPos() : ruleText.length();
int sub2Pos = sub2 != null ? sub2.getPos() : ruleText.length();
String workText = stripPrefix(text, ruleText.substring(0, sub1Pos), pp);
int prefixLength = text.length() - workText.length();
if (pp.getIndex() == 0 && sub1Pos != 0) {
// commented out because ParsePosition doesn't have error index in 1.1.x
// parsePosition.setErrorIndex(pp.getErrorIndex());
return ZERO;
}
if (baseValue == INFINITY_RULE) {
// If you match this, don't try to perform any calculations on it.
parsePosition.setIndex(pp.getIndex());
return Double.POSITIVE_INFINITY;
}
if (baseValue == NAN_RULE) {
// If you match this, don't try to perform any calculations on it.
parsePosition.setIndex(pp.getIndex());
return Double.NaN;
}
// this is the fun part. The basic guts of the rule-matching
// logic is matchToDelimiter(), which is called twice. The first
// time it searches the input string for the rule text BETWEEN
// the substitutions and tries to match the intervening text
// in the input string with the first substitution. If that
// succeeds, it then calls it again, this time to look for the
// rule text after the second substitution and to match the
// intervening input text against the second substitution.
//
// For example, say we have a rule that looks like this:
// first << middle >> last;
// and input text that looks like this:
// first one middle two last
// First we use stripPrefix() to match "first " in both places and
// strip it off the front, leaving
// one middle two last
// Then we use matchToDelimiter() to match " middle " and try to
// match "one" against a substitution. If it's successful, we now
// have
// two last
// We use matchToDelimiter() a second time to match " last" and
// try to match "two" against a substitution. If "two" matches
// the substitution, we have a successful parse.
//
// Since it's possible in many cases to find multiple instances
// of each of these pieces of rule text in the input string,
// we need to try all the possible combinations of these
// locations. This prevents us from prematurely declaring a mismatch,
// and makes sure we match as much input text as we can.
int highWaterMark = 0;
double result = 0;
int start = 0;
double tempBaseValue = Math.max(0, baseValue);
do {
// our partial parse result starts out as this rule's base
// value. If it finds a successful match, matchToDelimiter()
// will compose this in some way with what it gets back from
// the substitution, giving us a new partial parse result
pp.setIndex(0);
double partialResult = matchToDelimiter(workText, start, tempBaseValue,
ruleText.substring(sub1Pos, sub2Pos), rulePatternFormat,
pp, sub1, upperBound).doubleValue();
// if we got a successful match (or were trying to match a
// null substitution), pp is now pointing at the first unmatched
// character. Take note of that, and try matchToDelimiter()
// on the input text again
if (pp.getIndex() != 0 || sub1 == null) {
start = pp.getIndex();
String workText2 = workText.substring(pp.getIndex());
ParsePosition pp2 = new ParsePosition(0);
// the second matchToDelimiter() will compose our previous
// partial result with whatever it gets back from its
// substitution if there's a successful match, giving us
// a real result
partialResult = matchToDelimiter(workText2, 0, partialResult,
ruleText.substring(sub2Pos), rulePatternFormat, pp2, sub2,
upperBound).doubleValue();
// if we got a successful match on this second
// matchToDelimiter() call, update the high-water mark
// and result (if necessary)
if (pp2.getIndex() != 0 || sub2 == null) {
if (prefixLength + pp.getIndex() + pp2.getIndex() > highWaterMark) {
highWaterMark = prefixLength + pp.getIndex() + pp2.getIndex();
result = partialResult;
}
}
// commented out because ParsePosition doesn't have error index in 1.1.x
// else {
// int temp = pp2.getErrorIndex() + sub1.getPos() + pp.getIndex();
// if (temp> parsePosition.getErrorIndex()) {
// parsePosition.setErrorIndex(temp);
// }
// }
}
// commented out because ParsePosition doesn't have error index in 1.1.x
// else {
// int temp = sub1.getPos() + pp.getErrorIndex();
// if (temp > parsePosition.getErrorIndex()) {
// parsePosition.setErrorIndex(temp);
// }
// }
// keep trying to match things until the outer matchToDelimiter()
// call fails to make a match (each time, it picks up where it
// left off the previous time)
}
while (sub1Pos != sub2Pos && pp.getIndex() > 0 && pp.getIndex()
< workText.length() && pp.getIndex() != start);
// update the caller's ParsePosition with our high-water mark
// (i.e., it now points at the first character this function
// didn't match-- the ParsePosition is therefore unchanged if
// we didn't match anything)
parsePosition.setIndex(highWaterMark);
// commented out because ParsePosition doesn't have error index in 1.1.x
// if (highWaterMark > 0) {
// parsePosition.setErrorIndex(0);
// }
// this is a hack for one unusual condition: Normally, whether this
// rule belong to a fraction rule set or not is handled by its
// substitutions. But if that rule HAS NO substitutions, then
// we have to account for it here. By definition, if the matching
// rule in a fraction rule set has no substitutions, its numerator
// is 1, and so the result is the reciprocal of its base value.
if (isFractionRule && highWaterMark > 0 && sub1 == null) {
result = 1 / result;
}
// return the result as a Long if possible, or as a Double
if (result == (long)result) {
return Long.valueOf((long)result);
} else {
return new Double(result);
}
} } | public class class_name {
public Number doParse(String text, ParsePosition parsePosition, boolean isFractionRule,
double upperBound) {
// internally we operate on a copy of the string being parsed
// (because we're going to change it) and use our own ParsePosition
ParsePosition pp = new ParsePosition(0);
// check to see whether the text before the first substitution
// matches the text at the beginning of the string being
// parsed. If it does, strip that off the front of workText;
// otherwise, dump out with a mismatch
int sub1Pos = sub1 != null ? sub1.getPos() : ruleText.length();
int sub2Pos = sub2 != null ? sub2.getPos() : ruleText.length();
String workText = stripPrefix(text, ruleText.substring(0, sub1Pos), pp);
int prefixLength = text.length() - workText.length();
if (pp.getIndex() == 0 && sub1Pos != 0) {
// commented out because ParsePosition doesn't have error index in 1.1.x
// parsePosition.setErrorIndex(pp.getErrorIndex());
return ZERO; // depends on control dependency: [if], data = [none]
}
if (baseValue == INFINITY_RULE) {
// If you match this, don't try to perform any calculations on it.
parsePosition.setIndex(pp.getIndex()); // depends on control dependency: [if], data = [none]
return Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none]
}
if (baseValue == NAN_RULE) {
// If you match this, don't try to perform any calculations on it.
parsePosition.setIndex(pp.getIndex()); // depends on control dependency: [if], data = [none]
return Double.NaN; // depends on control dependency: [if], data = [none]
}
// this is the fun part. The basic guts of the rule-matching
// logic is matchToDelimiter(), which is called twice. The first
// time it searches the input string for the rule text BETWEEN
// the substitutions and tries to match the intervening text
// in the input string with the first substitution. If that
// succeeds, it then calls it again, this time to look for the
// rule text after the second substitution and to match the
// intervening input text against the second substitution.
//
// For example, say we have a rule that looks like this:
// first << middle >> last;
// and input text that looks like this:
// first one middle two last
// First we use stripPrefix() to match "first " in both places and
// strip it off the front, leaving
// one middle two last
// Then we use matchToDelimiter() to match " middle " and try to
// match "one" against a substitution. If it's successful, we now
// have
// two last
// We use matchToDelimiter() a second time to match " last" and
// try to match "two" against a substitution. If "two" matches
// the substitution, we have a successful parse.
//
// Since it's possible in many cases to find multiple instances
// of each of these pieces of rule text in the input string,
// we need to try all the possible combinations of these
// locations. This prevents us from prematurely declaring a mismatch,
// and makes sure we match as much input text as we can.
int highWaterMark = 0;
double result = 0;
int start = 0;
double tempBaseValue = Math.max(0, baseValue);
do {
// our partial parse result starts out as this rule's base
// value. If it finds a successful match, matchToDelimiter()
// will compose this in some way with what it gets back from
// the substitution, giving us a new partial parse result
pp.setIndex(0);
double partialResult = matchToDelimiter(workText, start, tempBaseValue,
ruleText.substring(sub1Pos, sub2Pos), rulePatternFormat,
pp, sub1, upperBound).doubleValue();
// if we got a successful match (or were trying to match a
// null substitution), pp is now pointing at the first unmatched
// character. Take note of that, and try matchToDelimiter()
// on the input text again
if (pp.getIndex() != 0 || sub1 == null) {
start = pp.getIndex(); // depends on control dependency: [if], data = [none]
String workText2 = workText.substring(pp.getIndex());
ParsePosition pp2 = new ParsePosition(0);
// the second matchToDelimiter() will compose our previous
// partial result with whatever it gets back from its
// substitution if there's a successful match, giving us
// a real result
partialResult = matchToDelimiter(workText2, 0, partialResult,
ruleText.substring(sub2Pos), rulePatternFormat, pp2, sub2,
upperBound).doubleValue(); // depends on control dependency: [if], data = [none]
// if we got a successful match on this second
// matchToDelimiter() call, update the high-water mark
// and result (if necessary)
if (pp2.getIndex() != 0 || sub2 == null) {
if (prefixLength + pp.getIndex() + pp2.getIndex() > highWaterMark) {
highWaterMark = prefixLength + pp.getIndex() + pp2.getIndex(); // depends on control dependency: [if], data = [none]
result = partialResult; // depends on control dependency: [if], data = [none]
}
}
// commented out because ParsePosition doesn't have error index in 1.1.x
// else {
// int temp = pp2.getErrorIndex() + sub1.getPos() + pp.getIndex();
// if (temp> parsePosition.getErrorIndex()) {
// parsePosition.setErrorIndex(temp);
// }
// }
}
// commented out because ParsePosition doesn't have error index in 1.1.x
// else {
// int temp = sub1.getPos() + pp.getErrorIndex();
// if (temp > parsePosition.getErrorIndex()) {
// parsePosition.setErrorIndex(temp);
// }
// }
// keep trying to match things until the outer matchToDelimiter()
// call fails to make a match (each time, it picks up where it
// left off the previous time)
}
while (sub1Pos != sub2Pos && pp.getIndex() > 0 && pp.getIndex()
< workText.length() && pp.getIndex() != start);
// update the caller's ParsePosition with our high-water mark
// (i.e., it now points at the first character this function
// didn't match-- the ParsePosition is therefore unchanged if
// we didn't match anything)
parsePosition.setIndex(highWaterMark);
// commented out because ParsePosition doesn't have error index in 1.1.x
// if (highWaterMark > 0) {
// parsePosition.setErrorIndex(0);
// }
// this is a hack for one unusual condition: Normally, whether this
// rule belong to a fraction rule set or not is handled by its
// substitutions. But if that rule HAS NO substitutions, then
// we have to account for it here. By definition, if the matching
// rule in a fraction rule set has no substitutions, its numerator
// is 1, and so the result is the reciprocal of its base value.
if (isFractionRule && highWaterMark > 0 && sub1 == null) {
result = 1 / result; // depends on control dependency: [if], data = [none]
}
// return the result as a Long if possible, or as a Double
if (result == (long)result) {
return Long.valueOf((long)result); // depends on control dependency: [if], data = [(long)result)]
} else {
return new Double(result); // depends on control dependency: [if], data = [(result]
}
} } |
public class class_name {
public void load(Class<? extends Describable> c) {
try {
Class.forName(c.getName(), true, c.getClassLoader());
} catch (ClassNotFoundException e) {
throw new AssertionError(e); // Can't happen
}
} } | public class class_name {
public void load(Class<? extends Describable> c) {
try {
Class.forName(c.getName(), true, c.getClassLoader());
} catch (ClassNotFoundException e) {
throw new AssertionError(e); // Can't happen
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void validate() {
if (value == null) {
throw new NoValueGivenException(getPath());
}
if (valids.size() != 0) {
boolean ok = false;
String valString = (value != null) ? value.toString() : "";
for (int i = 0; i < valids.size(); i++) {
if (valids.get(i).equals(valString)) {
ok = true;
break;
}
}
if (!ok) {
throw new NoValidValueException(getPath(), valString);
}
}
setValid(true);
} } | public class class_name {
@Override
public void validate() {
if (value == null) {
throw new NoValueGivenException(getPath());
}
if (valids.size() != 0) {
boolean ok = false;
String valString = (value != null) ? value.toString() : "";
for (int i = 0; i < valids.size(); i++) {
if (valids.get(i).equals(valString)) {
ok = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!ok) {
throw new NoValidValueException(getPath(), valString);
}
}
setValid(true);
} } |
public class class_name {
public static Integer toInteger(Object value) {
if (value == null) {
return null;
} else if (value instanceof Integer) {
return (Integer) value;
} else if (value instanceof Number) {
return ((Number) value).intValue();
} else {
try {
return Integer.valueOf(value.toString().trim());
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
}
}
} } | public class class_name {
public static Integer toInteger(Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (value instanceof Integer) {
return (Integer) value; // depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
return ((Number) value).intValue(); // depends on control dependency: [if], data = [none]
} else {
try {
return Integer.valueOf(value.toString().trim()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static boolean isDataObject(final Object object) {
if (object == null) {
return true;
}
Class<?> clazz = object.getClass();
return isDataClass(clazz);
} } | public class class_name {
public static boolean isDataObject(final Object object) {
if (object == null) {
return true; // depends on control dependency: [if], data = [none]
}
Class<?> clazz = object.getClass();
return isDataClass(clazz);
} } |
public class class_name {
private int getInt(List<byte[]> blocks)
{
int result;
if (blocks.isEmpty() == false)
{
byte[] data = blocks.remove(0);
result = MPPUtility.getInt(data, 0);
}
else
{
result = 0;
}
return (result);
} } | public class class_name {
private int getInt(List<byte[]> blocks)
{
int result;
if (blocks.isEmpty() == false)
{
byte[] data = blocks.remove(0);
result = MPPUtility.getInt(data, 0); // depends on control dependency: [if], data = [none]
}
else
{
result = 0; // depends on control dependency: [if], data = [none]
}
return (result);
} } |
public class class_name {
private void detach() {
// Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach())
if (decoratedComponent != null) {
decoratedComponent.removeComponentListener(decoratedComponentTracker);
decoratedComponent.removeAncestorListener(decoratedComponentTracker);
decoratedComponent.removeHierarchyBoundsListener(decoratedComponentTracker);
decoratedComponent.removeHierarchyListener(decoratedComponentTracker);
decoratedComponent.removePropertyChangeListener("enabled", decoratedComponentTracker);
decoratedComponent.removePropertyChangeListener("ancestor", decoratedComponentTracker);
decoratedComponent = null;
detachFromLayeredPane();
}
} } | public class class_name {
private void detach() {
// Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach())
if (decoratedComponent != null) {
decoratedComponent.removeComponentListener(decoratedComponentTracker); // depends on control dependency: [if], data = [(decoratedComponent]
decoratedComponent.removeAncestorListener(decoratedComponentTracker); // depends on control dependency: [if], data = [(decoratedComponent]
decoratedComponent.removeHierarchyBoundsListener(decoratedComponentTracker); // depends on control dependency: [if], data = [(decoratedComponent]
decoratedComponent.removeHierarchyListener(decoratedComponentTracker); // depends on control dependency: [if], data = [(decoratedComponent]
decoratedComponent.removePropertyChangeListener("enabled", decoratedComponentTracker); // depends on control dependency: [if], data = [none]
decoratedComponent.removePropertyChangeListener("ancestor", decoratedComponentTracker); // depends on control dependency: [if], data = [none]
decoratedComponent = null; // depends on control dependency: [if], data = [none]
detachFromLayeredPane(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
static public <T> T loadByReflection(String className,
Object ... arguments) {
try{
return (T) new MetaClass(className).createInstance(arguments);
} catch(Exception e){
throw new ReflectionLoadingException(e);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
static public <T> T loadByReflection(String className,
Object ... arguments) {
try{
return (T) new MetaClass(className).createInstance(arguments);
// depends on control dependency: [try], data = [none]
} catch(Exception e){
throw new ReflectionLoadingException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ServletContext getCurrentServletContext() {
final ClassLoader cl = getContextClassLoader();
if (cl == null) {
return null;
}
return servletContexts.get(cl);
} } | public class class_name {
public ServletContext getCurrentServletContext() {
final ClassLoader cl = getContextClassLoader();
if (cl == null) {
return null; // depends on control dependency: [if], data = [none]
}
return servletContexts.get(cl);
} } |
public class class_name {
public static SequenceBatchCSVRecord fromDataSet(MultiDataSet dataSet) {
SequenceBatchCSVRecord batchCSVRecord = new SequenceBatchCSVRecord();
for (int i = 0; i < dataSet.numFeatureArrays(); i++) {
batchCSVRecord.add(Arrays.asList(BatchCSVRecord.fromDataSet(new DataSet(dataSet.getFeatures(i),dataSet.getLabels(i)))));
}
return batchCSVRecord;
} } | public class class_name {
public static SequenceBatchCSVRecord fromDataSet(MultiDataSet dataSet) {
SequenceBatchCSVRecord batchCSVRecord = new SequenceBatchCSVRecord();
for (int i = 0; i < dataSet.numFeatureArrays(); i++) {
batchCSVRecord.add(Arrays.asList(BatchCSVRecord.fromDataSet(new DataSet(dataSet.getFeatures(i),dataSet.getLabels(i))))); // depends on control dependency: [for], data = [i]
}
return batchCSVRecord;
} } |
public class class_name {
public AwsSecurityFinding withMalware(Malware... malware) {
if (this.malware == null) {
setMalware(new java.util.ArrayList<Malware>(malware.length));
}
for (Malware ele : malware) {
this.malware.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFinding withMalware(Malware... malware) {
if (this.malware == null) {
setMalware(new java.util.ArrayList<Malware>(malware.length)); // depends on control dependency: [if], data = [none]
}
for (Malware ele : malware) {
this.malware.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public void preProcess(@NonNull MultiDataSet toPreProcess) {
int numFeatures = toPreProcess.numFeatureArrays();
int numLabels = toPreProcess.numLabelsArrays();
for (int i = 0; i < numFeatures; i++) {
strategy.preProcess(toPreProcess.getFeatures(i), toPreProcess.getFeaturesMaskArray(i), getFeatureStats(i));
}
if (isFitLabel()) {
for (int i = 0; i < numLabels; i++) {
strategy.preProcess(toPreProcess.getLabels(i), toPreProcess.getLabelsMaskArray(i), getLabelStats(i));
}
}
} } | public class class_name {
@Override
public void preProcess(@NonNull MultiDataSet toPreProcess) {
int numFeatures = toPreProcess.numFeatureArrays();
int numLabels = toPreProcess.numLabelsArrays();
for (int i = 0; i < numFeatures; i++) {
strategy.preProcess(toPreProcess.getFeatures(i), toPreProcess.getFeaturesMaskArray(i), getFeatureStats(i)); // depends on control dependency: [for], data = [i]
}
if (isFitLabel()) {
for (int i = 0; i < numLabels; i++) {
strategy.preProcess(toPreProcess.getLabels(i), toPreProcess.getLabelsMaskArray(i), getLabelStats(i)); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
public void marshall(EnvironmentVariable environmentVariable, ProtocolMarshaller protocolMarshaller) {
if (environmentVariable == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(environmentVariable.getName(), NAME_BINDING);
protocolMarshaller.marshall(environmentVariable.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(environmentVariable.getType(), TYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EnvironmentVariable environmentVariable, ProtocolMarshaller protocolMarshaller) {
if (environmentVariable == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(environmentVariable.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(environmentVariable.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(environmentVariable.getType(), TYPE_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 void BuildInitJavaScript(InteractiveObject interactiveObject) {
String gearVRinitJavaScript = "function " + GEARVR_INIT_JAVASCRIPT_FUNCTION_NAME + "()\n{\n";
//The first two arguments are for the event - could be time or an isOver/isActive boolean -
// and the second argument is for the timeStamp which is the accumulated time for starting
// the per Frame calls to JavaScript, or 0 for isOver/isActive touch events
ScriptObject scriptObject = interactiveObject.getScriptObject();
int argumentNum = 1;
if (scriptObject.getTimeStampParameter()) argumentNum = 2;
if ( interactiveObject.getSensor() != null ) {
if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.PLANE) {
argumentNum = 2;
}
else if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.CYLINDER) {
argumentNum = 4;
}
else if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.SPHERE) {
argumentNum = 4;
}
}
// Get the parameters on X3D data types that are included with this JavaScript
if ( V8JavaScriptEngine ) {
for (ScriptObject.Field field : scriptObject.getFieldsArrayList()) {
String fieldType = scriptObject.getFieldType(field);
if (scriptObject.getFromDefinedItem(field) != null) {
if ((fieldType.equalsIgnoreCase("SFColor")) || (fieldType.equalsIgnoreCase("SFVec3f"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "], params[" + (argumentNum + 2) + "]);\n";
argumentNum += 3;
} // end if SFColor of SFVec3f, a 3-value parameter
else if (fieldType.equalsIgnoreCase("SFRotation")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "], params[" + (argumentNum + 2)
+ "], params[" + (argumentNum + 3) + "]);\n";
argumentNum += 4;
} // end if SFRotation, a 4-value parameter
else if (fieldType.equalsIgnoreCase("SFVec2f")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "]);\n";
argumentNum += 2;
} // end if SFVec2f, a 2-value parameter
else if ((fieldType.equalsIgnoreCase("SFFloat")) || (fieldType.equalsIgnoreCase("SFBool"))
|| (fieldType.equalsIgnoreCase("SFInt32")) || (fieldType.equalsIgnoreCase("SFTime")) ) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n";
argumentNum += 1;
} // end if SFFloat, SFBool, SFInt32 or SFTime - a single parameter
else if (fieldType.equalsIgnoreCase("SFString") ) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n";
argumentNum += 1;
} // end if SFString
else if (fieldType.equalsIgnoreCase("MFString") ) {
// TODO: need MFString to support more than one argument due to being used for Text Strings
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n";
argumentNum += 1;
} // end if MFString
else {
Log.e(TAG, "Error unsupported field type '" + fieldType + "' in SCRIPT '" +
interactiveObject.getScriptObject().getName() + "'");
}
}
else if (scriptObject.getFromEventUtility(field) != null) {
if (fieldType.equalsIgnoreCase("SFBool")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n";
argumentNum += 1;
} // end if SFBool
} // end scriptObject.getFromEventUtility(field) != null
else if (scriptObject.getFromTimeSensor(field) != null) {
if (fieldType.equalsIgnoreCase("SFFloat")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n";
argumentNum += 1;
} // end if SFFloat
} // end scriptObject.getFromTimeSensor(field) != null
} // for loop checking for parameters passed to the JavaScript parser
} // end if V8 engine
else {
// Mozilla Rhino engine
for (ScriptObject.Field field : scriptObject.getFieldsArrayList()) {
String fieldType = scriptObject.getFieldType(field);
if (scriptObject.getFromDefinedItem(field) != null) {
if ((fieldType.equalsIgnoreCase("SFColor")) || (fieldType.equalsIgnoreCase("SFVec3f"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ", arg" + (argumentNum + 1) + ", arg" + (argumentNum + 2) + ");\n";
argumentNum += 3;
} // end if SFColor of SFVec3f
else if (fieldType.equalsIgnoreCase("SFRotation")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ", arg" + (argumentNum + 1) + ", arg" + (argumentNum + 2)
+ ", arg" + (argumentNum + 3) + ");\n";
argumentNum += 4;
} // end if SFRotation
else if ((fieldType.equalsIgnoreCase("SFFloat")) || (fieldType.equalsIgnoreCase("SFBool"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n";
argumentNum += 1;
} // end if SFFloat or SFBool
} // end scriptObject.getFromDefinedItem(field) != null
else if (scriptObject.getFromEventUtility(field) != null) {
if (fieldType.equalsIgnoreCase("SFBool")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n";
argumentNum += 1;
} // end if SFBool
} // end scriptObject.getFromEventUtility(field) != null
else if (scriptObject.getFromTimeSensor(field) != null) {
if (fieldType.equalsIgnoreCase("SFFloat")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n";
argumentNum += 1;
} // end if SFFloat
} // end scriptObject.getFromTimeSensor(field) != null
} // for loop checking for parameters passed to the JavaScript parser
} // end if Mozilla Rhino engine
gearVRinitJavaScript += "}";
scriptObject.setGearVRinitJavaScript(gearVRinitJavaScript);
} } | public class class_name {
private void BuildInitJavaScript(InteractiveObject interactiveObject) {
String gearVRinitJavaScript = "function " + GEARVR_INIT_JAVASCRIPT_FUNCTION_NAME + "()\n{\n";
//The first two arguments are for the event - could be time or an isOver/isActive boolean -
// and the second argument is for the timeStamp which is the accumulated time for starting
// the per Frame calls to JavaScript, or 0 for isOver/isActive touch events
ScriptObject scriptObject = interactiveObject.getScriptObject();
int argumentNum = 1;
if (scriptObject.getTimeStampParameter()) argumentNum = 2;
if ( interactiveObject.getSensor() != null ) {
if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.PLANE) {
argumentNum = 2; // depends on control dependency: [if], data = [none]
}
else if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.CYLINDER) {
argumentNum = 4; // depends on control dependency: [if], data = [none]
}
else if ( interactiveObject.getSensor().getSensorType() == Sensor.Type.SPHERE) {
argumentNum = 4; // depends on control dependency: [if], data = [none]
}
}
// Get the parameters on X3D data types that are included with this JavaScript
if ( V8JavaScriptEngine ) {
for (ScriptObject.Field field : scriptObject.getFieldsArrayList()) {
String fieldType = scriptObject.getFieldType(field);
if (scriptObject.getFromDefinedItem(field) != null) {
if ((fieldType.equalsIgnoreCase("SFColor")) || (fieldType.equalsIgnoreCase("SFVec3f"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "], params[" + (argumentNum + 2) + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 3; // depends on control dependency: [if], data = [none]
} // end if SFColor of SFVec3f, a 3-value parameter
else if (fieldType.equalsIgnoreCase("SFRotation")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "], params[" + (argumentNum + 2)
+ "], params[" + (argumentNum + 3) + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 4; // depends on control dependency: [if], data = [none]
} // end if SFRotation, a 4-value parameter
else if (fieldType.equalsIgnoreCase("SFVec2f")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "], params[" + (argumentNum + 1) + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 2; // depends on control dependency: [if], data = [none]
} // end if SFVec2f, a 2-value parameter
else if ((fieldType.equalsIgnoreCase("SFFloat")) || (fieldType.equalsIgnoreCase("SFBool"))
|| (fieldType.equalsIgnoreCase("SFInt32")) || (fieldType.equalsIgnoreCase("SFTime")) ) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFFloat, SFBool, SFInt32 or SFTime - a single parameter
else if (fieldType.equalsIgnoreCase("SFString") ) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFString
else if (fieldType.equalsIgnoreCase("MFString") ) {
// TODO: need MFString to support more than one argument due to being used for Text Strings
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if MFString
else {
Log.e(TAG, "Error unsupported field type '" + fieldType + "' in SCRIPT '" +
interactiveObject.getScriptObject().getName() + "'"); // depends on control dependency: [if], data = [none]
}
}
else if (scriptObject.getFromEventUtility(field) != null) {
if (fieldType.equalsIgnoreCase("SFBool")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFBool
} // end scriptObject.getFromEventUtility(field) != null
else if (scriptObject.getFromTimeSensor(field) != null) {
if (fieldType.equalsIgnoreCase("SFFloat")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( params[" + argumentNum + "]);\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFFloat
} // end scriptObject.getFromTimeSensor(field) != null
} // for loop checking for parameters passed to the JavaScript parser
} // end if V8 engine
else {
// Mozilla Rhino engine
for (ScriptObject.Field field : scriptObject.getFieldsArrayList()) {
String fieldType = scriptObject.getFieldType(field);
if (scriptObject.getFromDefinedItem(field) != null) {
if ((fieldType.equalsIgnoreCase("SFColor")) || (fieldType.equalsIgnoreCase("SFVec3f"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ", arg" + (argumentNum + 1) + ", arg" + (argumentNum + 2) + ");\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 3; // depends on control dependency: [if], data = [none]
} // end if SFColor of SFVec3f
else if (fieldType.equalsIgnoreCase("SFRotation")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ", arg" + (argumentNum + 1) + ", arg" + (argumentNum + 2)
+ ", arg" + (argumentNum + 3) + ");\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 4; // depends on control dependency: [if], data = [none]
} // end if SFRotation
else if ((fieldType.equalsIgnoreCase("SFFloat")) || (fieldType.equalsIgnoreCase("SFBool"))) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFFloat or SFBool
} // end scriptObject.getFromDefinedItem(field) != null
else if (scriptObject.getFromEventUtility(field) != null) {
if (fieldType.equalsIgnoreCase("SFBool")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFBool
} // end scriptObject.getFromEventUtility(field) != null
else if (scriptObject.getFromTimeSensor(field) != null) {
if (fieldType.equalsIgnoreCase("SFFloat")) {
gearVRinitJavaScript += scriptObject.getFieldName(field) + " = new " + scriptObject.getFieldType(field) +
"( arg" + argumentNum + ");\n"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
argumentNum += 1; // depends on control dependency: [if], data = [none]
} // end if SFFloat
} // end scriptObject.getFromTimeSensor(field) != null
} // for loop checking for parameters passed to the JavaScript parser
} // end if Mozilla Rhino engine
gearVRinitJavaScript += "}";
scriptObject.setGearVRinitJavaScript(gearVRinitJavaScript);
} } |
public class class_name {
protected List<String> split(final String string){
if (null!=prefix){
//remove prefix before split
return Arrays.asList(string.substring(prefix.length()).split(delimiter));
}else{
return Arrays.asList(string.split(delimiter));
}
} } | public class class_name {
protected List<String> split(final String string){
if (null!=prefix){
//remove prefix before split
return Arrays.asList(string.substring(prefix.length()).split(delimiter)); // depends on control dependency: [if], data = [none]
}else{
return Arrays.asList(string.split(delimiter)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized Response getSnapshot(final String idRegex,
final long start, final long end, String... attributes) {
SnapshotRequestMessage req = new SnapshotRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
Response resp = new Response(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSnapshots.put(Long.valueOf(reqId), resp);
WorldState ws = new WorldState();
this.outstandingStates.put(Long.valueOf(reqId), ws);
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
log.error("Unable to send " + req + ".", e);
resp.setError(e);
return resp;
}
} } | public class class_name {
public synchronized Response getSnapshot(final String idRegex,
final long start, final long end, String... attributes) {
SnapshotRequestMessage req = new SnapshotRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes); // depends on control dependency: [if], data = [(attributes]
}
Response resp = new Response(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready."); // depends on control dependency: [while], data = [none]
synchronized (this) { // depends on control dependency: [while], data = [none]
try {
this.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ie) {
// Ignored
} // depends on control dependency: [catch], data = [none]
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId); // depends on control dependency: [try], data = [none]
this.outstandingSnapshots.put(Long.valueOf(reqId), resp); // depends on control dependency: [try], data = [none]
WorldState ws = new WorldState();
this.outstandingStates.put(Long.valueOf(reqId), ws); // depends on control dependency: [try], data = [none]
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp); // depends on control dependency: [try], data = [none]
return resp; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Unable to send " + req + ".", e);
resp.setError(e);
return resp;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public UntagResourceRequest withTagKeys(String... tagKeys) {
if (this.tagKeys == null) {
setTagKeys(new com.ibm.cloud.objectstorage.internal.SdkInternalList<String>(tagKeys.length));
}
for (String ele : tagKeys) {
this.tagKeys.add(ele);
}
return this;
} } | public class class_name {
public UntagResourceRequest withTagKeys(String... tagKeys) {
if (this.tagKeys == null) {
setTagKeys(new com.ibm.cloud.objectstorage.internal.SdkInternalList<String>(tagKeys.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : tagKeys) {
this.tagKeys.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static <T> Optional<T> get(Config config, Function<String, T> getter, String path) {
if (!config.hasPath(path)) {
return Optional.empty();
}
return Optional.of(getter.apply(path));
} } | public class class_name {
public static <T> Optional<T> get(Config config, Function<String, T> getter, String path) {
if (!config.hasPath(path)) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
return Optional.of(getter.apply(path));
} } |
public class class_name {
public void marshall(LambdaFunctionStartedEventAttributes lambdaFunctionStartedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionStartedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionStartedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LambdaFunctionStartedEventAttributes lambdaFunctionStartedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (lambdaFunctionStartedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lambdaFunctionStartedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String getBasePath(String path1, String path2) {
StringBuffer base = new StringBuffer();
path1 = path1.replace('\\', '/');
path2 = path2.replace('\\', '/');
String[] parts1 = path1.split("/");
String[] parts2 = path2.split("/");
for (int i = 0; i < parts1.length; i++) {
if (i >= parts2.length) {
break;
}
if (parts1[i].equals(parts2[i])) {
base.append(parts1[i] + "/");
}
}
return base.toString();
} } | public class class_name {
private String getBasePath(String path1, String path2) {
StringBuffer base = new StringBuffer();
path1 = path1.replace('\\', '/');
path2 = path2.replace('\\', '/');
String[] parts1 = path1.split("/");
String[] parts2 = path2.split("/");
for (int i = 0; i < parts1.length; i++) {
if (i >= parts2.length) {
break;
}
if (parts1[i].equals(parts2[i])) {
base.append(parts1[i] + "/"); // depends on control dependency: [if], data = [none]
}
}
return base.toString();
} } |
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WVideo videoComponent = (WVideo) component;
XmlStringBuilder xml = renderContext.getWriter();
Video[] video = videoComponent.getVideo();
if (video == null || video.length == 0) {
return;
}
Track[] tracks = videoComponent.getTracks();
WVideo.Controls controls = videoComponent.getControls();
int width = videoComponent.getWidth();
int height = videoComponent.getHeight();
int duration = video[0].getDuration();
// Check for alternative text
String alternativeText = videoComponent.getAltText();
if (alternativeText == null) {
LOG.warn("Video should have a description.");
alternativeText = null;
} else {
alternativeText = I18nUtilities.format(null, alternativeText);
}
xml.appendTagOpen("ui:video");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalUrlAttribute("poster", videoComponent.getPosterUrl());
xml.appendOptionalAttribute("alt", alternativeText);
xml.appendOptionalAttribute("autoplay", videoComponent.isAutoplay(), "true");
xml.appendOptionalAttribute("mediagroup", videoComponent.getMediaGroup());
xml.appendOptionalAttribute("loop", videoComponent.isLoop(), "true");
xml.appendOptionalAttribute("muted", videoComponent.isMuted(), "true");
xml.appendOptionalAttribute("hidden", videoComponent.isHidden(), "true");
xml.appendOptionalAttribute("disabled", videoComponent.isDisabled(), "true");
xml.appendOptionalAttribute("toolTip", videoComponent.getToolTip());
xml.appendOptionalAttribute("width", width > 0, width);
xml.appendOptionalAttribute("height", height > 0, height);
xml.appendOptionalAttribute("duration", duration > 0, duration);
switch (videoComponent.getPreload()) {
case NONE:
xml.appendAttribute("preload", "none");
break;
case META_DATA:
xml.appendAttribute("preload", "metadata");
break;
case AUTO:
default:
break;
}
if (controls != null && !WVideo.Controls.NATIVE.equals(controls)) {
switch (controls) {
case NONE:
xml.appendAttribute("controls", "none");
break;
case ALL:
xml.appendAttribute("controls", "all");
break;
case PLAY_PAUSE:
xml.appendAttribute("controls", "play");
break;
case DEFAULT:
xml.appendAttribute("controls", "default");
break;
default:
LOG.error("Unknown control type: " + controls);
}
}
xml.appendClose();
String[] urls = videoComponent.getVideoUrls();
for (int i = 0; i < urls.length; i++) {
xml.appendTagOpen("ui:src");
xml.appendUrlAttribute("uri", urls[i]);
xml.appendOptionalAttribute("type", video[i].getMimeType());
if (video[i].getSize() != null) {
xml.appendOptionalAttribute("width", video[i].getSize().width > 0, video[i].
getSize().width);
xml.appendOptionalAttribute("height", video[i].getSize().height > 0, video[i].
getSize().height);
}
xml.appendEnd();
}
if (tracks != null && tracks.length > 0) {
String[] trackUrls = videoComponent.getTrackUrls();
for (int i = 0; i < tracks.length; i++) {
xml.appendTagOpen("ui:track");
xml.appendUrlAttribute("src", trackUrls[i]);
xml.appendOptionalAttribute("lang", tracks[i].getLanguage());
xml.appendOptionalAttribute("desc", tracks[i].getDescription());
xml.appendOptionalAttribute("kind", trackKindToString(tracks[i].getKind()));
xml.appendEnd();
}
}
xml.appendEndTag("ui:video");
} } | public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WVideo videoComponent = (WVideo) component;
XmlStringBuilder xml = renderContext.getWriter();
Video[] video = videoComponent.getVideo();
if (video == null || video.length == 0) {
return; // depends on control dependency: [if], data = [none]
}
Track[] tracks = videoComponent.getTracks();
WVideo.Controls controls = videoComponent.getControls();
int width = videoComponent.getWidth();
int height = videoComponent.getHeight();
int duration = video[0].getDuration();
// Check for alternative text
String alternativeText = videoComponent.getAltText();
if (alternativeText == null) {
LOG.warn("Video should have a description."); // depends on control dependency: [if], data = [none]
alternativeText = null; // depends on control dependency: [if], data = [none]
} else {
alternativeText = I18nUtilities.format(null, alternativeText); // depends on control dependency: [if], data = [none]
}
xml.appendTagOpen("ui:video");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalUrlAttribute("poster", videoComponent.getPosterUrl());
xml.appendOptionalAttribute("alt", alternativeText);
xml.appendOptionalAttribute("autoplay", videoComponent.isAutoplay(), "true");
xml.appendOptionalAttribute("mediagroup", videoComponent.getMediaGroup());
xml.appendOptionalAttribute("loop", videoComponent.isLoop(), "true");
xml.appendOptionalAttribute("muted", videoComponent.isMuted(), "true");
xml.appendOptionalAttribute("hidden", videoComponent.isHidden(), "true");
xml.appendOptionalAttribute("disabled", videoComponent.isDisabled(), "true");
xml.appendOptionalAttribute("toolTip", videoComponent.getToolTip());
xml.appendOptionalAttribute("width", width > 0, width);
xml.appendOptionalAttribute("height", height > 0, height);
xml.appendOptionalAttribute("duration", duration > 0, duration);
switch (videoComponent.getPreload()) {
case NONE:
xml.appendAttribute("preload", "none");
break;
case META_DATA:
xml.appendAttribute("preload", "metadata");
break;
case AUTO:
default:
break;
}
if (controls != null && !WVideo.Controls.NATIVE.equals(controls)) {
switch (controls) {
case NONE:
xml.appendAttribute("controls", "none");
break;
case ALL:
xml.appendAttribute("controls", "all");
break;
case PLAY_PAUSE:
xml.appendAttribute("controls", "play");
break;
case DEFAULT:
xml.appendAttribute("controls", "default");
break;
default:
LOG.error("Unknown control type: " + controls);
}
}
xml.appendClose();
String[] urls = videoComponent.getVideoUrls();
for (int i = 0; i < urls.length; i++) {
xml.appendTagOpen("ui:src");
xml.appendUrlAttribute("uri", urls[i]);
xml.appendOptionalAttribute("type", video[i].getMimeType());
if (video[i].getSize() != null) {
xml.appendOptionalAttribute("width", video[i].getSize().width > 0, video[i].
getSize().width);
xml.appendOptionalAttribute("height", video[i].getSize().height > 0, video[i].
getSize().height);
}
xml.appendEnd();
}
if (tracks != null && tracks.length > 0) {
String[] trackUrls = videoComponent.getTrackUrls();
for (int i = 0; i < tracks.length; i++) {
xml.appendTagOpen("ui:track");
xml.appendUrlAttribute("src", trackUrls[i]);
xml.appendOptionalAttribute("lang", tracks[i].getLanguage());
xml.appendOptionalAttribute("desc", tracks[i].getDescription());
xml.appendOptionalAttribute("kind", trackKindToString(tracks[i].getKind()));
xml.appendEnd();
}
}
xml.appendEndTag("ui:video");
} } |
public class class_name {
protected void setDate(Date date, boolean firePropertyChange) {
Date oldDate = this.date;
this.date = date;
if (date == null) {
setText("");
} else {
String formattedDate = dateFormatter.format(date);
try {
setText(formattedDate);
} catch (RuntimeException e) {
e.printStackTrace();
}
}
if (date != null && dateUtil.checkDate(date)) {
setForeground(Color.BLACK);
}
if (firePropertyChange) {
firePropertyChange("date", oldDate, date);
}
} } | public class class_name {
protected void setDate(Date date, boolean firePropertyChange) {
Date oldDate = this.date;
this.date = date;
if (date == null) {
setText(""); // depends on control dependency: [if], data = [none]
} else {
String formattedDate = dateFormatter.format(date);
try {
setText(formattedDate); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (date != null && dateUtil.checkDate(date)) {
setForeground(Color.BLACK); // depends on control dependency: [if], data = [none]
}
if (firePropertyChange) {
firePropertyChange("date", oldDate, date); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean isProcessed(Trace trace, Node node, Direction direction) {
boolean ret = false;
if (trace.getTransaction() != null) {
List<ProcessorWrapper> procs = null;
synchronized (processors) {
procs = processors.get(trace.getTransaction());
}
if (procs != null) {
for (int i = 0; !ret && i < procs.size(); i++) {
ret = procs.get(i).isProcessed(trace, node, direction);
}
}
}
if (log.isLoggable(Level.FINEST)) {
log.finest("ProcessManager: isProcessed trace=" + trace + " node=" + node
+ " direction=" + direction + "? " + ret);
}
return ret;
} } | public class class_name {
public boolean isProcessed(Trace trace, Node node, Direction direction) {
boolean ret = false;
if (trace.getTransaction() != null) {
List<ProcessorWrapper> procs = null;
synchronized (processors) { // depends on control dependency: [if], data = [none]
procs = processors.get(trace.getTransaction());
}
if (procs != null) {
for (int i = 0; !ret && i < procs.size(); i++) {
ret = procs.get(i).isProcessed(trace, node, direction); // depends on control dependency: [for], data = [i]
}
}
}
if (log.isLoggable(Level.FINEST)) {
log.finest("ProcessManager: isProcessed trace=" + trace + " node=" + node
+ " direction=" + direction + "? " + ret); // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
public static boolean isPureAscii(String stringToCheck) {
if (stringToCheck == null || stringToCheck.length() == 0) {
return true;
}
synchronized (ASCII_ENCODER) {
return ASCII_ENCODER.canEncode(stringToCheck);
}
} } | public class class_name {
public static boolean isPureAscii(String stringToCheck) {
if (stringToCheck == null || stringToCheck.length() == 0) {
return true; // depends on control dependency: [if], data = [none]
}
synchronized (ASCII_ENCODER) {
return ASCII_ENCODER.canEncode(stringToCheck);
}
} } |
public class class_name {
static String generateUniqueLabel(String label, Set<String> existingLabels) {
StringBuilder newLabel = new StringBuilder(label);
while (existingLabels.contains(newLabel.toString())) {
newLabel.append(POSTFIX);
}
return newLabel.toString();
} } | public class class_name {
static String generateUniqueLabel(String label, Set<String> existingLabels) {
StringBuilder newLabel = new StringBuilder(label);
while (existingLabels.contains(newLabel.toString())) {
newLabel.append(POSTFIX); // depends on control dependency: [while], data = [none]
}
return newLabel.toString();
} } |
public class class_name {
public Integer getNextIDSeq(final String id) {
Validate.notNull(id, "ID cannot be null");
Integer count = this.idCounts.get(id);
if (count == null) {
count = Integer.valueOf(1);
}
return count;
} } | public class class_name {
public Integer getNextIDSeq(final String id) {
Validate.notNull(id, "ID cannot be null");
Integer count = this.idCounts.get(id);
if (count == null) {
count = Integer.valueOf(1); // depends on control dependency: [if], data = [none]
}
return count;
} } |
public class class_name {
private Node buildNode(int begin, int end) {
int d = keys[0].length;
// Allocate the node
Node node = new Node();
// Fill in basic info
node.count = end - begin;
node.index = begin;
// Calculate the bounding box
double[] lowerBound = new double[d];
double[] upperBound = new double[d];
for (int i = 0; i < d; i++) {
lowerBound[i] = keys[index[begin]][i];
upperBound[i] = keys[index[begin]][i];
}
for (int i = begin + 1; i < end; i++) {
for (int j = 0; j < d; j++) {
double c = keys[index[i]][j];
if (lowerBound[j] > c) {
lowerBound[j] = c;
}
if (upperBound[j] < c) {
upperBound[j] = c;
}
}
}
// Calculate bounding box stats
double maxRadius = -1;
for (int i = 0; i < d; i++) {
double radius = (upperBound[i] - lowerBound[i]) / 2;
if (radius > maxRadius) {
maxRadius = radius;
node.split = i;
node.cutoff = (upperBound[i] + lowerBound[i]) / 2;
}
}
// If the max spread is 0, make this a leaf node
if (maxRadius == 0) {
node.lower = node.upper = null;
return node;
}
// Partition the dataset around the midpoint in this dimension. The
// partitioning is done in-place by iterating from left-to-right and
// right-to-left in the same way that partioning is done in quicksort.
int i1 = begin, i2 = end - 1, size = 0;
while (i1 <= i2) {
boolean i1Good = (keys[index[i1]][node.split] < node.cutoff);
boolean i2Good = (keys[index[i2]][node.split] >= node.cutoff);
if (!i1Good && !i2Good) {
int temp = index[i1];
index[i1] = index[i2];
index[i2] = temp;
i1Good = i2Good = true;
}
if (i1Good) {
i1++;
size++;
}
if (i2Good) {
i2--;
}
}
// Create the child nodes
node.lower = buildNode(begin, begin + size);
node.upper = buildNode(begin + size, end);
return node;
} } | public class class_name {
private Node buildNode(int begin, int end) {
int d = keys[0].length;
// Allocate the node
Node node = new Node();
// Fill in basic info
node.count = end - begin;
node.index = begin;
// Calculate the bounding box
double[] lowerBound = new double[d];
double[] upperBound = new double[d];
for (int i = 0; i < d; i++) {
lowerBound[i] = keys[index[begin]][i]; // depends on control dependency: [for], data = [i]
upperBound[i] = keys[index[begin]][i]; // depends on control dependency: [for], data = [i]
}
for (int i = begin + 1; i < end; i++) {
for (int j = 0; j < d; j++) {
double c = keys[index[i]][j];
if (lowerBound[j] > c) {
lowerBound[j] = c; // depends on control dependency: [if], data = [none]
}
if (upperBound[j] < c) {
upperBound[j] = c; // depends on control dependency: [if], data = [none]
}
}
}
// Calculate bounding box stats
double maxRadius = -1;
for (int i = 0; i < d; i++) {
double radius = (upperBound[i] - lowerBound[i]) / 2;
if (radius > maxRadius) {
maxRadius = radius; // depends on control dependency: [if], data = [none]
node.split = i; // depends on control dependency: [if], data = [none]
node.cutoff = (upperBound[i] + lowerBound[i]) / 2; // depends on control dependency: [if], data = [none]
}
}
// If the max spread is 0, make this a leaf node
if (maxRadius == 0) {
node.lower = node.upper = null; // depends on control dependency: [if], data = [none]
return node; // depends on control dependency: [if], data = [none]
}
// Partition the dataset around the midpoint in this dimension. The
// partitioning is done in-place by iterating from left-to-right and
// right-to-left in the same way that partioning is done in quicksort.
int i1 = begin, i2 = end - 1, size = 0;
while (i1 <= i2) {
boolean i1Good = (keys[index[i1]][node.split] < node.cutoff);
boolean i2Good = (keys[index[i2]][node.split] >= node.cutoff);
if (!i1Good && !i2Good) {
int temp = index[i1];
index[i1] = index[i2]; // depends on control dependency: [if], data = [none]
index[i2] = temp; // depends on control dependency: [if], data = [none]
i1Good = i2Good = true; // depends on control dependency: [if], data = [none]
}
if (i1Good) {
i1++; // depends on control dependency: [if], data = [none]
size++; // depends on control dependency: [if], data = [none]
}
if (i2Good) {
i2--; // depends on control dependency: [if], data = [none]
}
}
// Create the child nodes
node.lower = buildNode(begin, begin + size);
node.upper = buildNode(begin + size, end);
return node;
} } |
public class class_name {
public void removeElement(CmsContainerPageElementPanel elementWidget) {
if (elementWidget.getInheritanceInfo().isNew()) {
getHandler().removeElement(elementWidget, ElementRemoveMode.saveAndCheckReferences);
} else {
elementWidget.getInheritanceInfo().setVisible(false);
elementWidget.addStyleName(HIDDEN_ELEMENT_CLASS);
Element elementOverlay = DOM.createDiv();
elementOverlay.setClassName(HIDDEN_ELEMENT_OVERLAY_CLASS);
elementWidget.getElement().appendChild(elementOverlay);
getGroupContainerWidget().add(elementWidget);
updateButtonVisibility(elementWidget);
m_showElementsButton.enable();
getGroupContainerWidget().refreshHighlighting();
}
m_changedInheritanceInfo = true;
} } | public class class_name {
public void removeElement(CmsContainerPageElementPanel elementWidget) {
if (elementWidget.getInheritanceInfo().isNew()) {
getHandler().removeElement(elementWidget, ElementRemoveMode.saveAndCheckReferences);
// depends on control dependency: [if], data = [none]
} else {
elementWidget.getInheritanceInfo().setVisible(false);
// depends on control dependency: [if], data = [none]
elementWidget.addStyleName(HIDDEN_ELEMENT_CLASS);
// depends on control dependency: [if], data = [none]
Element elementOverlay = DOM.createDiv();
elementOverlay.setClassName(HIDDEN_ELEMENT_OVERLAY_CLASS);
// depends on control dependency: [if], data = [none]
elementWidget.getElement().appendChild(elementOverlay);
// depends on control dependency: [if], data = [none]
getGroupContainerWidget().add(elementWidget);
// depends on control dependency: [if], data = [none]
updateButtonVisibility(elementWidget);
// depends on control dependency: [if], data = [none]
m_showElementsButton.enable();
// depends on control dependency: [if], data = [none]
getGroupContainerWidget().refreshHighlighting();
// depends on control dependency: [if], data = [none]
}
m_changedInheritanceInfo = true;
} } |
public class class_name {
@Override
public void removeByG_C(long groupId, long commerceCountryId) {
for (CommerceWarehouse commerceWarehouse : findByG_C(groupId,
commerceCountryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceWarehouse);
}
} } | public class class_name {
@Override
public void removeByG_C(long groupId, long commerceCountryId) {
for (CommerceWarehouse commerceWarehouse : findByG_C(groupId,
commerceCountryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceWarehouse); // depends on control dependency: [for], data = [commerceWarehouse]
}
} } |
public class class_name {
public void set(Vector2f start, Vector2f end) {
super.pointsDirty = true;
if (this.start == null) {
this.start = new Vector2f();
}
this.start.set(start);
if (this.end == null) {
this.end = new Vector2f();
}
this.end.set(end);
vec = new Vector2f(end);
vec.sub(start);
lenSquared = vec.lengthSquared();
} } | public class class_name {
public void set(Vector2f start, Vector2f end) {
super.pointsDirty = true;
if (this.start == null) {
this.start = new Vector2f();
// depends on control dependency: [if], data = [none]
}
this.start.set(start);
if (this.end == null) {
this.end = new Vector2f();
// depends on control dependency: [if], data = [none]
}
this.end.set(end);
vec = new Vector2f(end);
vec.sub(start);
lenSquared = vec.lengthSquared();
} } |
public class class_name {
public void setDomainIspPlacements(java.util.Collection<DomainIspPlacement> domainIspPlacements) {
if (domainIspPlacements == null) {
this.domainIspPlacements = null;
return;
}
this.domainIspPlacements = new java.util.ArrayList<DomainIspPlacement>(domainIspPlacements);
} } | public class class_name {
public void setDomainIspPlacements(java.util.Collection<DomainIspPlacement> domainIspPlacements) {
if (domainIspPlacements == null) {
this.domainIspPlacements = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.domainIspPlacements = new java.util.ArrayList<DomainIspPlacement>(domainIspPlacements);
} } |
public class class_name {
private void processResultHandlers(RHI resultHandlerInput) {
for (ResultHandler<RHI> resultHandler : resultHandlers) {
resultHandler.handleResult(resultHandlerInput);
}
} } | public class class_name {
private void processResultHandlers(RHI resultHandlerInput) {
for (ResultHandler<RHI> resultHandler : resultHandlers) {
resultHandler.handleResult(resultHandlerInput); // depends on control dependency: [for], data = [resultHandler]
}
} } |
public class class_name {
public int span(CharSequence s, int start, SpanCondition spanCondition) {
if (spanCondition == SpanCondition.NOT_CONTAINED) {
return spanNot(s, start, null);
}
int spanLimit = spanSet.span(s, start, SpanCondition.CONTAINED);
if (spanLimit == s.length()) {
return spanLimit;
}
return spanWithStrings(s, start, spanLimit, spanCondition);
} } | public class class_name {
public int span(CharSequence s, int start, SpanCondition spanCondition) {
if (spanCondition == SpanCondition.NOT_CONTAINED) {
return spanNot(s, start, null); // depends on control dependency: [if], data = [none]
}
int spanLimit = spanSet.span(s, start, SpanCondition.CONTAINED);
if (spanLimit == s.length()) {
return spanLimit; // depends on control dependency: [if], data = [none]
}
return spanWithStrings(s, start, spanLimit, spanCondition);
} } |
public class class_name {
public void await() { // public as parts
if (server == null) {
throw new IllegalStateException("server has not been started.");
}
try {
server.join();
} catch (Exception e) {
throw new IllegalStateException("server join failed.", e);
}
} } | public class class_name {
public void await() { // public as parts
if (server == null) {
throw new IllegalStateException("server has not been started.");
}
try {
server.join(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalStateException("server join failed.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected I_CmsSearchConfigurationFacetField parseFieldFacet(final String pathPrefix) {
try {
final String field = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_FACET_FIELD);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final Integer limit = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_LIMIT);
final String prefix = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_PREFIX);
final String sorder = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_ORDER);
I_CmsSearchConfigurationFacet.SortOrder order;
try {
order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);
} catch (@SuppressWarnings("unused") final Exception e) {
order = null;
}
final String filterQueryModifier = parseOptionalStringValue(
pathPrefix + XML_ELEMENT_FACET_FILTERQUERYMODIFIER);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetField(
field,
name,
minCount,
limit,
prefix,
label,
order,
filterQueryModifier,
isAndFacet,
preselection,
ignoreAllFacetFilters);
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_FACET_FIELD),
e);
return null;
}
} } | public class class_name {
protected I_CmsSearchConfigurationFacetField parseFieldFacet(final String pathPrefix) {
try {
final String field = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_FACET_FIELD);
final String name = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_NAME);
final String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_LABEL);
final Integer minCount = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_MINCOUNT);
final Integer limit = parseOptionalIntValue(pathPrefix + XML_ELEMENT_FACET_LIMIT);
final String prefix = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_PREFIX);
final String sorder = parseOptionalStringValue(pathPrefix + XML_ELEMENT_FACET_ORDER);
I_CmsSearchConfigurationFacet.SortOrder order;
try {
order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder); // depends on control dependency: [try], data = [none]
} catch (@SuppressWarnings("unused") final Exception e) {
order = null;
} // depends on control dependency: [catch], data = [none]
final String filterQueryModifier = parseOptionalStringValue(
pathPrefix + XML_ELEMENT_FACET_FILTERQUERYMODIFIER);
final Boolean isAndFacet = parseOptionalBooleanValue(pathPrefix + XML_ELEMENT_FACET_ISANDFACET);
final List<String> preselection = parseOptionalStringValues(pathPrefix + XML_ELEMENT_FACET_PRESELECTION);
final Boolean ignoreAllFacetFilters = parseOptionalBooleanValue(
pathPrefix + XML_ELEMENT_FACET_IGNOREALLFACETFILTERS);
return new CmsSearchConfigurationFacetField(
field,
name,
minCount,
limit,
prefix,
label,
order,
filterQueryModifier,
isAndFacet,
preselection,
ignoreAllFacetFilters); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1,
XML_ELEMENT_FACET_FIELD),
e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T> QueryParameterValue array(T[] array, StandardSQLTypeName type) {
List<QueryParameterValue> listValues = new ArrayList<>();
for (T obj : array) {
listValues.add(QueryParameterValue.of(obj, type));
}
return QueryParameterValue.newBuilder()
.setArrayValues(listValues)
.setType(StandardSQLTypeName.ARRAY)
.setArrayType(type)
.build();
} } | public class class_name {
public static <T> QueryParameterValue array(T[] array, StandardSQLTypeName type) {
List<QueryParameterValue> listValues = new ArrayList<>();
for (T obj : array) {
listValues.add(QueryParameterValue.of(obj, type)); // depends on control dependency: [for], data = [obj]
}
return QueryParameterValue.newBuilder()
.setArrayValues(listValues)
.setType(StandardSQLTypeName.ARRAY)
.setArrayType(type)
.build();
} } |
public class class_name {
private List<Date> getListOfMarkerDateForNonComputedStats(final Application application,
final Account account,
final Date startDate) {
final List<Date> retVal = new LinkedList<>();
final Date endDate = getLastDayOfMonth(getNowMinusAMonth());
for(Date markerDate : getListOfMarkerDateBetWeenTwoDates(startDate, endDate)) {
if (!daoService.isStatisticExistsForApplicationAndAccountAndDate(application,
account,
markerDate)) {
retVal.add(markerDate);
}
}
return retVal;
} } | public class class_name {
private List<Date> getListOfMarkerDateForNonComputedStats(final Application application,
final Account account,
final Date startDate) {
final List<Date> retVal = new LinkedList<>();
final Date endDate = getLastDayOfMonth(getNowMinusAMonth());
for(Date markerDate : getListOfMarkerDateBetWeenTwoDates(startDate, endDate)) {
if (!daoService.isStatisticExistsForApplicationAndAccountAndDate(application,
account,
markerDate)) {
retVal.add(markerDate);
// depends on control dependency: [if], data = [none]
}
}
return retVal;
} } |
public class class_name {
void mergeBeanInfo(BeanInfo beanInfo, boolean force)
throws IntrospectionException {
if (force || !explicitProperties) {
PropertyDescriptor[] superDescs = beanInfo.getPropertyDescriptors();
if (superDescs != null) {
if (getPropertyDescriptors() != null) {
properties = mergeProps(superDescs, beanInfo
.getDefaultPropertyIndex());
} else {
properties = superDescs;
defaultPropertyIndex = beanInfo.getDefaultPropertyIndex();
}
}
}
if (force || !explicitMethods) {
MethodDescriptor[] superMethods = beanInfo.getMethodDescriptors();
if (superMethods != null) {
if (methods != null) {
methods = mergeMethods(superMethods);
} else {
methods = superMethods;
}
}
}
if (force || !explicitEvents) {
EventSetDescriptor[] superEvents = beanInfo
.getEventSetDescriptors();
if (superEvents != null) {
if (events != null) {
events = mergeEvents(superEvents, beanInfo
.getDefaultEventIndex());
} else {
events = superEvents;
defaultEventIndex = beanInfo.getDefaultEventIndex();
}
}
}
} } | public class class_name {
void mergeBeanInfo(BeanInfo beanInfo, boolean force)
throws IntrospectionException {
if (force || !explicitProperties) {
PropertyDescriptor[] superDescs = beanInfo.getPropertyDescriptors();
if (superDescs != null) {
if (getPropertyDescriptors() != null) {
properties = mergeProps(superDescs, beanInfo
.getDefaultPropertyIndex()); // depends on control dependency: [if], data = [none]
} else {
properties = superDescs; // depends on control dependency: [if], data = [none]
defaultPropertyIndex = beanInfo.getDefaultPropertyIndex(); // depends on control dependency: [if], data = [none]
}
}
}
if (force || !explicitMethods) {
MethodDescriptor[] superMethods = beanInfo.getMethodDescriptors();
if (superMethods != null) {
if (methods != null) {
methods = mergeMethods(superMethods); // depends on control dependency: [if], data = [none]
} else {
methods = superMethods; // depends on control dependency: [if], data = [none]
}
}
}
if (force || !explicitEvents) {
EventSetDescriptor[] superEvents = beanInfo
.getEventSetDescriptors();
if (superEvents != null) {
if (events != null) {
events = mergeEvents(superEvents, beanInfo
.getDefaultEventIndex()); // depends on control dependency: [if], data = [none]
} else {
events = superEvents; // depends on control dependency: [if], data = [none]
defaultEventIndex = beanInfo.getDefaultEventIndex(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public String getPrettyName(Symbol sym) {
if (!sym.getSimpleName().isEmpty()) {
return sym.getSimpleName().toString();
}
if (sym.getKind() == ElementKind.ENUM) {
// anonymous classes for enum constants are identified by the enclosing constant
// declaration
return sym.owner.getSimpleName().toString();
}
// anonymous classes have an empty name, but a recognizable superclass or interface
// e.g. refer to `new Runnable() { ... }` as "Runnable"
Type superType = state.getTypes().supertype(sym.type);
if (state.getTypes().isSameType(superType, state.getSymtab().objectType)) {
superType = Iterables.getFirst(state.getTypes().interfaces(sym.type), superType);
}
return superType.tsym.getSimpleName().toString();
} } | public class class_name {
public String getPrettyName(Symbol sym) {
if (!sym.getSimpleName().isEmpty()) {
return sym.getSimpleName().toString(); // depends on control dependency: [if], data = [none]
}
if (sym.getKind() == ElementKind.ENUM) {
// anonymous classes for enum constants are identified by the enclosing constant
// declaration
return sym.owner.getSimpleName().toString(); // depends on control dependency: [if], data = [none]
}
// anonymous classes have an empty name, but a recognizable superclass or interface
// e.g. refer to `new Runnable() { ... }` as "Runnable"
Type superType = state.getTypes().supertype(sym.type);
if (state.getTypes().isSameType(superType, state.getSymtab().objectType)) {
superType = Iterables.getFirst(state.getTypes().interfaces(sym.type), superType); // depends on control dependency: [if], data = [none]
}
return superType.tsym.getSimpleName().toString();
} } |
public class class_name {
synchronized void resumeStatsCollection(Timestamp now) {
for (Entry<String, Collection<MutableViewData>> entry : mutableMap.asMap().entrySet()) {
for (MutableViewData mutableViewData : entry.getValue()) {
mutableViewData.resumeStatsCollection(now);
}
}
} } | public class class_name {
synchronized void resumeStatsCollection(Timestamp now) {
for (Entry<String, Collection<MutableViewData>> entry : mutableMap.asMap().entrySet()) {
for (MutableViewData mutableViewData : entry.getValue()) {
mutableViewData.resumeStatsCollection(now); // depends on control dependency: [for], data = [mutableViewData]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.