code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public void persistJoinTable(JoinTableData joinTableData)
{
String tableName = joinTableData.getJoinTableName();
String inverseJoinColumn = joinTableData.getInverseJoinColumnName();
String joinColumn = joinTableData.getJoinColumnName();
String schemaName = joinTableData.getSchemaName();
Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
Set<Object> joinKeys = joinTableRecords.keySet();
BulkRequestBuilder bulkRequest = txClient.prepareBulk().setRefresh(isRefreshIndexes());
/**
* 1_p => 1_a1,1_a2 1_a1=> 1_p,1_p1
*
* Example: join table : PERSON_ADDRESS join column : PERSON_ID (1_p)
* inverse join column : ADDRESS_ID (1_a) store in ES: schema name:
* PERSON_ADDRESS type: PERSON id: 1_p\0011_a
*
* PERSON_ADDRESS:1_p_1_a PERSON_ID 1_p ADDRESS_ID 1_a
*
* source: (PERSON_ID, 1_p) (ADDRESS_ID, 1_a)
*
* embeddable keys over many to many does not work.
*/
boolean found = false;
for (Object key : joinKeys)
{
Set<Object> inversejoinTableRecords = joinTableRecords.get(key);
Map<String, Object> source = new HashMap<String, Object>();
for (Object inverseObj : inversejoinTableRecords)
{
source = new HashMap<String, Object>();
source.put(joinTableData.getJoinColumnName(), key);
source.put(joinTableData.getInverseJoinColumnName(), inverseObj);
String joinKeyAsStr = PropertyAccessorHelper.getString(key);
String inverseKeyAsStr = PropertyAccessorHelper.getString(inverseObj);
String keyAsString = joinKeyAsStr + KEY_SEPERATOR + inverseKeyAsStr;
IndexRequest request = new IndexRequest(schemaName.toLowerCase(), tableName, keyAsString)
.source(source);
found = true;
bulkRequest.add(request);
}
}
// check made, as bulk request throws an error, in case no request is
// present.
if (found)
{
bulkRequest.execute().actionGet();
}
} }
|
public class class_name {
@Override
public void persistJoinTable(JoinTableData joinTableData)
{
String tableName = joinTableData.getJoinTableName();
String inverseJoinColumn = joinTableData.getInverseJoinColumnName();
String joinColumn = joinTableData.getJoinColumnName();
String schemaName = joinTableData.getSchemaName();
Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
Set<Object> joinKeys = joinTableRecords.keySet();
BulkRequestBuilder bulkRequest = txClient.prepareBulk().setRefresh(isRefreshIndexes());
/**
* 1_p => 1_a1,1_a2 1_a1=> 1_p,1_p1
*
* Example: join table : PERSON_ADDRESS join column : PERSON_ID (1_p)
* inverse join column : ADDRESS_ID (1_a) store in ES: schema name:
* PERSON_ADDRESS type: PERSON id: 1_p\0011_a
*
* PERSON_ADDRESS:1_p_1_a PERSON_ID 1_p ADDRESS_ID 1_a
*
* source: (PERSON_ID, 1_p) (ADDRESS_ID, 1_a)
*
* embeddable keys over many to many does not work.
*/
boolean found = false;
for (Object key : joinKeys)
{
Set<Object> inversejoinTableRecords = joinTableRecords.get(key);
Map<String, Object> source = new HashMap<String, Object>();
for (Object inverseObj : inversejoinTableRecords)
{
source = new HashMap<String, Object>(); // depends on control dependency: [for], data = [none]
source.put(joinTableData.getJoinColumnName(), key); // depends on control dependency: [for], data = [none]
source.put(joinTableData.getInverseJoinColumnName(), inverseObj); // depends on control dependency: [for], data = [inverseObj]
String joinKeyAsStr = PropertyAccessorHelper.getString(key);
String inverseKeyAsStr = PropertyAccessorHelper.getString(inverseObj);
String keyAsString = joinKeyAsStr + KEY_SEPERATOR + inverseKeyAsStr;
IndexRequest request = new IndexRequest(schemaName.toLowerCase(), tableName, keyAsString)
.source(source);
found = true; // depends on control dependency: [for], data = [none]
bulkRequest.add(request); // depends on control dependency: [for], data = [none]
}
}
// check made, as bulk request throws an error, in case no request is
// present.
if (found)
{
bulkRequest.execute().actionGet(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
LOG.log(Level.FINE, "getAudioInputStream(URL url)");
InputStream inputStream = url.openStream();
try {
return getAudioInputStream(inputStream);
} catch (UnsupportedAudioFileException | IOException e) {
if (inputStream != null) {
inputStream.close();
}
throw e;
}
} }
|
public class class_name {
@Override
public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
LOG.log(Level.FINE, "getAudioInputStream(URL url)");
InputStream inputStream = url.openStream();
try {
return getAudioInputStream(inputStream);
} catch (UnsupportedAudioFileException | IOException e) {
if (inputStream != null) {
inputStream.close(); // depends on control dependency: [if], data = [none]
}
throw e;
}
} }
|
public class class_name {
public boolean evaluate(Term term)
{
if (term.isVar() && (term instanceof Variable))
{
Variable var = (Variable) term;
return !var.isBound() && !var.isAnonymous();
}
return false;
} }
|
public class class_name {
public boolean evaluate(Term term)
{
if (term.isVar() && (term instanceof Variable))
{
Variable var = (Variable) term;
return !var.isBound() && !var.isAnonymous(); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static <T extends Map.Entry<String, String>> void formEncode(Collection<T> parameters,
OutputStream into) throws IOException {
if (parameters != null) {
boolean first = true;
for (Map.Entry<String, String> entry : parameters) {
if (first) {
first = false;
} else {
into.write('&');
}
into.write(percentEncode(safeToString(entry.getKey())).getBytes());
into.write('=');
into.write(percentEncode(safeToString(entry.getValue())).getBytes());
}
}
} }
|
public class class_name {
public static <T extends Map.Entry<String, String>> void formEncode(Collection<T> parameters,
OutputStream into) throws IOException {
if (parameters != null) {
boolean first = true;
for (Map.Entry<String, String> entry : parameters) {
if (first) {
first = false; // depends on control dependency: [if], data = [none]
} else {
into.write('&'); // depends on control dependency: [if], data = [none]
}
into.write(percentEncode(safeToString(entry.getKey())).getBytes());
into.write('=');
into.write(percentEncode(safeToString(entry.getValue())).getBytes());
}
}
} }
|
public class class_name {
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
// read entire inline XML metadata chunks into a buffer
if (m_inXMLMetadata && !m_gotAudit) {
// since this data is encoded straight back to xml,
// we need to make sure special characters &, <, >, ", and '
// are re-converted to the xml-acceptable equivalents.
ensureInlineXmlCharBuffer();
StreamUtility.enc(ch, start, length, m_dsXMLBuffer);
} else if (m_gotAudit || m_readingBinaryContent){
// Use a separate buffer to deal with the special case
// of AUDIT datastreams, which may be inline, but need to
// retrieve individual element content to deserialize correctly
// append element content into a byte buffer; or b64-encoded
// binary content
if (m_elementContent == null) {
m_elementContent = new ReadableByteArrayOutputStream();
}
CharBuffer chars = CharBuffer.wrap(ch, start, length);
ByteBuffer bytes = Charset.forName(m_characterEncoding).encode(chars);
m_elementContent.write(bytes.array(), bytes.arrayOffset(), bytes.limit());
}
} }
|
public class class_name {
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
// read entire inline XML metadata chunks into a buffer
if (m_inXMLMetadata && !m_gotAudit) {
// since this data is encoded straight back to xml,
// we need to make sure special characters &, <, >, ", and '
// are re-converted to the xml-acceptable equivalents.
ensureInlineXmlCharBuffer();
StreamUtility.enc(ch, start, length, m_dsXMLBuffer);
} else if (m_gotAudit || m_readingBinaryContent){
// Use a separate buffer to deal with the special case
// of AUDIT datastreams, which may be inline, but need to
// retrieve individual element content to deserialize correctly
// append element content into a byte buffer; or b64-encoded
// binary content
if (m_elementContent == null) {
m_elementContent = new ReadableByteArrayOutputStream(); // depends on control dependency: [if], data = [none]
}
CharBuffer chars = CharBuffer.wrap(ch, start, length);
ByteBuffer bytes = Charset.forName(m_characterEncoding).encode(chars);
m_elementContent.write(bytes.array(), bytes.arrayOffset(), bytes.limit());
}
} }
|
public class class_name {
private DataSourceWrapper createDataSource(String group) {
if (group == null) {
group = StrUtil.EMPTY;
}
final Setting config = setting.getSetting(group);
if (CollectionUtil.isEmpty(config)) {
throw new DbRuntimeException("No config for group: [{}]", group);
}
// 基本信息
final String url = config.getAndRemoveStr(KEY_ALIAS_URL);
if (StrUtil.isBlank(url)) {
throw new DbRuntimeException("No JDBC URL for group: [{}]", group);
}
// 自动识别Driver
String driver = config.getAndRemoveStr(KEY_ALIAS_DRIVER);
if (StrUtil.isBlank(driver)) {
driver = DriverUtil.identifyDriver(url);
}
final String user = config.getAndRemoveStr(KEY_ALIAS_USER);
final String pass = config.getAndRemoveStr(KEY_ALIAS_PASSWORD);
return DataSourceWrapper.wrap(createDataSource(url, driver, user, pass, config), driver);
} }
|
public class class_name {
private DataSourceWrapper createDataSource(String group) {
if (group == null) {
group = StrUtil.EMPTY;
// depends on control dependency: [if], data = [none]
}
final Setting config = setting.getSetting(group);
if (CollectionUtil.isEmpty(config)) {
throw new DbRuntimeException("No config for group: [{}]", group);
}
// 基本信息
final String url = config.getAndRemoveStr(KEY_ALIAS_URL);
if (StrUtil.isBlank(url)) {
throw new DbRuntimeException("No JDBC URL for group: [{}]", group);
}
// 自动识别Driver
String driver = config.getAndRemoveStr(KEY_ALIAS_DRIVER);
if (StrUtil.isBlank(driver)) {
driver = DriverUtil.identifyDriver(url);
// depends on control dependency: [if], data = [none]
}
final String user = config.getAndRemoveStr(KEY_ALIAS_USER);
final String pass = config.getAndRemoveStr(KEY_ALIAS_PASSWORD);
return DataSourceWrapper.wrap(createDataSource(url, driver, user, pass, config), driver);
} }
|
public class class_name {
Segment findSegmentToReleaseIfRequired() {
fetchUpdatesIfNeeded();
Segment segment = null;
synchronized (decisionLock) {
if (!releaseTimer.hasRemaining() && sync.getState().getCheckpointForReader(readerId) == null
&& doesReaderOwnTooManySegments(sync.getState())) {
segment = findSegmentToRelease();
if (segment != null) {
releaseTimer.reset(UPDATE_WINDOW);
acquireTimer.reset(UPDATE_WINDOW);
}
}
}
return segment;
} }
|
public class class_name {
Segment findSegmentToReleaseIfRequired() {
fetchUpdatesIfNeeded();
Segment segment = null;
synchronized (decisionLock) {
if (!releaseTimer.hasRemaining() && sync.getState().getCheckpointForReader(readerId) == null
&& doesReaderOwnTooManySegments(sync.getState())) {
segment = findSegmentToRelease(); // depends on control dependency: [if], data = [none]
if (segment != null) {
releaseTimer.reset(UPDATE_WINDOW); // depends on control dependency: [if], data = [none]
acquireTimer.reset(UPDATE_WINDOW); // depends on control dependency: [if], data = [none]
}
}
}
return segment;
} }
|
public class class_name {
public String leftString(final int length) {
if (length <= 0) {
return StringUtils.EMPTY;
} else if (length >= size) {
return new String(buffer, 0, size);
} else {
return new String(buffer, 0, length);
}
} }
|
public class class_name {
public String leftString(final int length) {
if (length <= 0) {
return StringUtils.EMPTY; // depends on control dependency: [if], data = [none]
} else if (length >= size) {
return new String(buffer, 0, size); // depends on control dependency: [if], data = [none]
} else {
return new String(buffer, 0, length); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void initialize( T image , int x0 , int y0 , int x1 , int y1 ) {
if( imagePyramid == null ||
imagePyramid.getInputWidth() != image.width || imagePyramid.getInputHeight() != image.height ) {
int minSize = (config.trackerFeatureRadius*2+1)*5;
int scales[] = selectPyramidScale(image.width,image.height,minSize);
imagePyramid = FactoryPyramid.discreteGaussian(scales,-1,1,true,image.getImageType());
}
imagePyramid.process(image);
reacquiring = false;
targetRegion.set(x0, y0, x1, y1);
createCascadeRegion(image.width,image.height);
template.reset();
fern.reset();
tracking.initialize(imagePyramid);
variance.setImage(image);
template.setImage(image);
fern.setImage(image);
adjustRegion.init(image.width,image.height);
learning.initialLearning(targetRegion, cascadeRegions);
strongMatch = true;
previousTrackArea = targetRegion.area();
} }
|
public class class_name {
public void initialize( T image , int x0 , int y0 , int x1 , int y1 ) {
if( imagePyramid == null ||
imagePyramid.getInputWidth() != image.width || imagePyramid.getInputHeight() != image.height ) {
int minSize = (config.trackerFeatureRadius*2+1)*5;
int scales[] = selectPyramidScale(image.width,image.height,minSize);
imagePyramid = FactoryPyramid.discreteGaussian(scales,-1,1,true,image.getImageType()); // depends on control dependency: [if], data = [none]
}
imagePyramid.process(image);
reacquiring = false;
targetRegion.set(x0, y0, x1, y1);
createCascadeRegion(image.width,image.height);
template.reset();
fern.reset();
tracking.initialize(imagePyramid);
variance.setImage(image);
template.setImage(image);
fern.setImage(image);
adjustRegion.init(image.width,image.height);
learning.initialLearning(targetRegion, cascadeRegions);
strongMatch = true;
previousTrackArea = targetRegion.area();
} }
|
public class class_name {
public Where<T, ID> reset() {
for (int i = 0; i < clauseStackLevel; i++) {
// help with gc
clauseStack[i] = null;
}
clauseStackLevel = 0;
return this;
} }
|
public class class_name {
public Where<T, ID> reset() {
for (int i = 0; i < clauseStackLevel; i++) {
// help with gc
clauseStack[i] = null; // depends on control dependency: [for], data = [i]
}
clauseStackLevel = 0;
return this;
} }
|
public class class_name {
public static List<Path> expandGlobs(List<String> pathsWithGlobs, Configuration conf)
throws IOException {
List<Path> paths = Lists.newLinkedList();
for (String pathStr : pathsWithGlobs) {
Path path = new Path(pathStr);
FileSystem fs = path.getFileSystem(conf);
FileStatus[] statuses = fs.globStatus(path);
// some versions of hadoop return null for non-existent paths
if (statuses != null) {
for (FileStatus status : statuses) {
paths.add(status.getPath());
}
}
}
return paths;
} }
|
public class class_name {
public static List<Path> expandGlobs(List<String> pathsWithGlobs, Configuration conf)
throws IOException {
List<Path> paths = Lists.newLinkedList();
for (String pathStr : pathsWithGlobs) {
Path path = new Path(pathStr);
FileSystem fs = path.getFileSystem(conf);
FileStatus[] statuses = fs.globStatus(path);
// some versions of hadoop return null for non-existent paths
if (statuses != null) {
for (FileStatus status : statuses) {
paths.add(status.getPath()); // depends on control dependency: [for], data = [status]
}
}
}
return paths;
} }
|
public class class_name {
public final hqlParser.groupByClause_return groupByClause() throws RecognitionException {
hqlParser.groupByClause_return retval = new hqlParser.groupByClause_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token GROUP121=null;
Token string_literal122=null;
Token COMMA124=null;
ParserRuleReturnScope expression123 =null;
ParserRuleReturnScope expression125 =null;
CommonTree GROUP121_tree=null;
CommonTree string_literal122_tree=null;
CommonTree COMMA124_tree=null;
try {
// hql.g:331:2: ( GROUP ^ 'by' ! expression ( COMMA ! expression )* )
// hql.g:331:4: GROUP ^ 'by' ! expression ( COMMA ! expression )*
{
root_0 = (CommonTree)adaptor.nil();
GROUP121=(Token)match(input,GROUP,FOLLOW_GROUP_in_groupByClause1573);
GROUP121_tree = (CommonTree)adaptor.create(GROUP121);
root_0 = (CommonTree)adaptor.becomeRoot(GROUP121_tree, root_0);
string_literal122=(Token)match(input,LITERAL_by,FOLLOW_LITERAL_by_in_groupByClause1579);
pushFollow(FOLLOW_expression_in_groupByClause1582);
expression123=expression();
state._fsp--;
adaptor.addChild(root_0, expression123.getTree());
// hql.g:332:20: ( COMMA ! expression )*
loop39:
while (true) {
int alt39=2;
int LA39_0 = input.LA(1);
if ( (LA39_0==COMMA) ) {
alt39=1;
}
switch (alt39) {
case 1 :
// hql.g:332:22: COMMA ! expression
{
COMMA124=(Token)match(input,COMMA,FOLLOW_COMMA_in_groupByClause1586);
pushFollow(FOLLOW_expression_in_groupByClause1589);
expression125=expression();
state._fsp--;
adaptor.addChild(root_0, expression125.getTree());
}
break;
default :
break loop39;
}
}
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
public final hqlParser.groupByClause_return groupByClause() throws RecognitionException {
hqlParser.groupByClause_return retval = new hqlParser.groupByClause_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token GROUP121=null;
Token string_literal122=null;
Token COMMA124=null;
ParserRuleReturnScope expression123 =null;
ParserRuleReturnScope expression125 =null;
CommonTree GROUP121_tree=null;
CommonTree string_literal122_tree=null;
CommonTree COMMA124_tree=null;
try {
// hql.g:331:2: ( GROUP ^ 'by' ! expression ( COMMA ! expression )* )
// hql.g:331:4: GROUP ^ 'by' ! expression ( COMMA ! expression )*
{
root_0 = (CommonTree)adaptor.nil();
GROUP121=(Token)match(input,GROUP,FOLLOW_GROUP_in_groupByClause1573);
GROUP121_tree = (CommonTree)adaptor.create(GROUP121);
root_0 = (CommonTree)adaptor.becomeRoot(GROUP121_tree, root_0);
string_literal122=(Token)match(input,LITERAL_by,FOLLOW_LITERAL_by_in_groupByClause1579);
pushFollow(FOLLOW_expression_in_groupByClause1582);
expression123=expression();
state._fsp--;
adaptor.addChild(root_0, expression123.getTree());
// hql.g:332:20: ( COMMA ! expression )*
loop39:
while (true) {
int alt39=2;
int LA39_0 = input.LA(1);
if ( (LA39_0==COMMA) ) {
alt39=1; // depends on control dependency: [if], data = [none]
}
switch (alt39) {
case 1 :
// hql.g:332:22: COMMA ! expression
{
COMMA124=(Token)match(input,COMMA,FOLLOW_COMMA_in_groupByClause1586);
pushFollow(FOLLOW_expression_in_groupByClause1589);
expression125=expression();
state._fsp--;
adaptor.addChild(root_0, expression125.getTree());
}
break;
default :
break loop39;
}
}
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
public void initProcessDefinitionCache() {
if (processDefinitionCache == null) {
if (processDefinitionCacheLimit <= 0) {
processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>();
} else {
processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>(processDefinitionCacheLimit);
}
}
} }
|
public class class_name {
public void initProcessDefinitionCache() {
if (processDefinitionCache == null) {
if (processDefinitionCacheLimit <= 0) {
processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>(); // depends on control dependency: [if], data = [none]
} else {
processDefinitionCache = new DefaultDeploymentCache<ProcessDefinitionCacheEntry>(processDefinitionCacheLimit); // depends on control dependency: [if], data = [(processDefinitionCacheLimit]
}
}
} }
|
public class class_name {
private Entity calculateNGromOTAnnotations(Entity inputEntity, Entity ontologyTermEntity) {
OntologyTermHitEntity mapEntity =
new OntologyTermHitEntity(ontologyTermEntity, ontologyTermHitMetaData);
for (Entity annotationEntity :
ontologyTermEntity.getEntities(OntologyTermMetadata.ONTOLOGY_TERM_DYNAMIC_ANNOTATION)) {
String annotationName =
annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.NAME);
String annotationValue =
annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.VALUE);
for (String attributeName : inputEntity.getAttributeNames()) {
if (StringUtils.isNotEmpty(inputEntity.getString(attributeName))
&& StringUtils.equalsIgnoreCase(attributeName, annotationName)
&& StringUtils.equalsIgnoreCase(
inputEntity.getString(attributeName), annotationValue)) {
mapEntity.set(SCORE, 100d);
mapEntity.set(COMBINED_SCORE, 100d);
return mapEntity;
}
}
}
return mapEntity;
} }
|
public class class_name {
private Entity calculateNGromOTAnnotations(Entity inputEntity, Entity ontologyTermEntity) {
OntologyTermHitEntity mapEntity =
new OntologyTermHitEntity(ontologyTermEntity, ontologyTermHitMetaData);
for (Entity annotationEntity :
ontologyTermEntity.getEntities(OntologyTermMetadata.ONTOLOGY_TERM_DYNAMIC_ANNOTATION)) {
String annotationName =
annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.NAME);
String annotationValue =
annotationEntity.getString(OntologyTermDynamicAnnotationMetadata.VALUE);
for (String attributeName : inputEntity.getAttributeNames()) {
if (StringUtils.isNotEmpty(inputEntity.getString(attributeName))
&& StringUtils.equalsIgnoreCase(attributeName, annotationName)
&& StringUtils.equalsIgnoreCase(
inputEntity.getString(attributeName), annotationValue)) {
mapEntity.set(SCORE, 100d); // depends on control dependency: [if], data = [none]
mapEntity.set(COMBINED_SCORE, 100d); // depends on control dependency: [if], data = [none]
return mapEntity; // depends on control dependency: [if], data = [none]
}
}
}
return mapEntity;
} }
|
public class class_name {
private ArrayList<Album> parseAlbumData(String json) {
ArrayList<Album> albums = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode albumNode : jsonNode.get("albums")) {
JsonNode artistsNode = albumNode.get("artists");
// Exclude albums with 0 artists
if (artistsNode.size() >= 1) {
// Only keeping the first artist for simplicity
Artist artist = new Artist(artistsNode.get(0).get("name").asText());
Album album = new Album(albumNode.get("name").asText(), artist);
albums.add(album);
}
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return albums;
} }
|
public class class_name {
private ArrayList<Album> parseAlbumData(String json) {
ArrayList<Album> albums = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode albumNode : jsonNode.get("albums")) {
JsonNode artistsNode = albumNode.get("artists");
// Exclude albums with 0 artists
if (artistsNode.size() >= 1) {
// Only keeping the first artist for simplicity
Artist artist = new Artist(artistsNode.get(0).get("name").asText());
Album album = new Album(albumNode.get("name").asText(), artist);
albums.add(album); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
} // depends on control dependency: [catch], data = [none]
return albums;
} }
|
public class class_name {
long freeSpaceWindows(String path, final long timeout) throws IOException {
path = FilenameUtil.normalize(path, false);
if (path.length() > 0 && path.charAt(0) != '"') {
path = "\"" + path + "\"";
}
// build and run the 'dir' command
final String[] cmdAttribs = new String[] { "cmd.exe", "/C", "dir /a /-c " + path };
// read in the output of the command to an ArrayList
final List<String> lines = performCommand(cmdAttribs, Integer.MAX_VALUE, timeout);
// now iterate over the lines we just read and find the LAST
// non-empty line (the free space bytes should be in the last element
// of the ArrayList anyway, but this will ensure it works even if it's
// not, still assuming it is on the last non-blank line)
for (int i = lines.size() - 1; i >= 0; i--) {
final String line = lines.get(i);
if (line.length() > 0) {
return parseDir(line, path);
}
}
// all lines are blank
throw new IOException("Command line 'dir /-c' did not return any info " + "for path '" + path + "'");
} }
|
public class class_name {
long freeSpaceWindows(String path, final long timeout) throws IOException {
path = FilenameUtil.normalize(path, false);
if (path.length() > 0 && path.charAt(0) != '"') {
path = "\"" + path + "\"";
}
// build and run the 'dir' command
final String[] cmdAttribs = new String[] { "cmd.exe", "/C", "dir /a /-c " + path };
// read in the output of the command to an ArrayList
final List<String> lines = performCommand(cmdAttribs, Integer.MAX_VALUE, timeout);
// now iterate over the lines we just read and find the LAST
// non-empty line (the free space bytes should be in the last element
// of the ArrayList anyway, but this will ensure it works even if it's
// not, still assuming it is on the last non-blank line)
for (int i = lines.size() - 1; i >= 0; i--) {
final String line = lines.get(i);
if (line.length() > 0) {
return parseDir(line, path);
// depends on control dependency: [if], data = [none]
}
}
// all lines are blank
throw new IOException("Command line 'dir /-c' did not return any info " + "for path '" + path + "'");
} }
|
public class class_name {
@Deprecated
public final void reset(String str, int start, int count)
{
char[] chars = null;
if (str != null) {
chars = str.toCharArray();
}
reset(chars, start, count);
} }
|
public class class_name {
@Deprecated
public final void reset(String str, int start, int count)
{
char[] chars = null;
if (str != null) {
chars = str.toCharArray(); // depends on control dependency: [if], data = [none]
}
reset(chars, start, count);
} }
|
public class class_name {
private int getHighestIndex(int highestIndex) {
for (Node ref : currentArgumentsAccesses) {
Node getElem = ref.getParent();
// Bail on anything but argument[c] access where c is a constant.
// TODO(user): We might not need to bail out all the time, there might
// be more cases that we can cover.
if (!getElem.isGetElem() || ref != getElem.getFirstChild()) {
return -1;
}
Node index = ref.getNext();
// We have something like arguments[x] where x is not a constant. That
// means at least one of the access is not known.
if (!index.isNumber() || index.getDouble() < 0) {
// TODO(user): Its possible not to give up just yet. The type
// inference did a 'semi value propagation'. If we know that string
// is never a subclass of the type of the index. We'd know that
// it is never 'callee'.
return -1; // Give up.
}
//We want to bail out if someone tries to access arguments[0.5] for example
if (index.getDouble() != Math.floor(index.getDouble())){
return -1;
}
Node getElemParent = getElem.getParent();
// When we have argument[0](), replacing it with a() is semantically
// different if argument[0] is a function call that refers to 'this'
if (getElemParent.isCall() && getElemParent.getFirstChild() == getElem) {
// TODO(user): We can consider using .call() if aliasing that
// argument allows shorter alias for other arguments.
return -1;
}
// Replace the highest index if we see an access that has a higher index
// than all the one we saw before.
int value = (int) index.getDouble();
if (value > highestIndex) {
highestIndex = value;
}
}
return highestIndex;
} }
|
public class class_name {
private int getHighestIndex(int highestIndex) {
for (Node ref : currentArgumentsAccesses) {
Node getElem = ref.getParent();
// Bail on anything but argument[c] access where c is a constant.
// TODO(user): We might not need to bail out all the time, there might
// be more cases that we can cover.
if (!getElem.isGetElem() || ref != getElem.getFirstChild()) {
return -1; // depends on control dependency: [if], data = [none]
}
Node index = ref.getNext();
// We have something like arguments[x] where x is not a constant. That
// means at least one of the access is not known.
if (!index.isNumber() || index.getDouble() < 0) {
// TODO(user): Its possible not to give up just yet. The type
// inference did a 'semi value propagation'. If we know that string
// is never a subclass of the type of the index. We'd know that
// it is never 'callee'.
return -1; // Give up. // depends on control dependency: [if], data = [none]
}
//We want to bail out if someone tries to access arguments[0.5] for example
if (index.getDouble() != Math.floor(index.getDouble())){
return -1; // depends on control dependency: [if], data = [none]
}
Node getElemParent = getElem.getParent();
// When we have argument[0](), replacing it with a() is semantically
// different if argument[0] is a function call that refers to 'this'
if (getElemParent.isCall() && getElemParent.getFirstChild() == getElem) {
// TODO(user): We can consider using .call() if aliasing that
// argument allows shorter alias for other arguments.
return -1; // depends on control dependency: [if], data = [none]
}
// Replace the highest index if we see an access that has a higher index
// than all the one we saw before.
int value = (int) index.getDouble();
if (value > highestIndex) {
highestIndex = value; // depends on control dependency: [if], data = [none]
}
}
return highestIndex;
} }
|
public class class_name {
public Key commit() {
Datastore datastore = transaction.getDatastore();
// [START commit]
// create an entity
KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
Key key = datastore.allocateId(keyFactory.newKey());
Entity entity = Entity.newBuilder(key).set("description", "commit()").build();
// add the entity and commit
try {
transaction.put(entity);
transaction.commit();
} catch (DatastoreException ex) {
// handle exception
}
// [END commit]
return key;
} }
|
public class class_name {
public Key commit() {
Datastore datastore = transaction.getDatastore();
// [START commit]
// create an entity
KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
Key key = datastore.allocateId(keyFactory.newKey());
Entity entity = Entity.newBuilder(key).set("description", "commit()").build();
// add the entity and commit
try {
transaction.put(entity); // depends on control dependency: [try], data = [none]
transaction.commit(); // depends on control dependency: [try], data = [none]
} catch (DatastoreException ex) {
// handle exception
} // depends on control dependency: [catch], data = [none]
// [END commit]
return key;
} }
|
public class class_name {
public void setCurrentPlayTime(long playTime) {
initAnimation();
long currentTime = AnimationUtils.currentAnimationTimeMillis();
if (mPlayingState != RUNNING) {
mSeekTime = playTime;
mPlayingState = SEEKED;
}
mStartTime = currentTime - playTime;
animationFrame(currentTime);
} }
|
public class class_name {
public void setCurrentPlayTime(long playTime) {
initAnimation();
long currentTime = AnimationUtils.currentAnimationTimeMillis();
if (mPlayingState != RUNNING) {
mSeekTime = playTime; // depends on control dependency: [if], data = [none]
mPlayingState = SEEKED; // depends on control dependency: [if], data = [none]
}
mStartTime = currentTime - playTime;
animationFrame(currentTime);
} }
|
public class class_name {
@Override
public Result<MZMLIndexElement> buildIndex(final Info info) throws Exception {
Result<MZMLIndexElement> result = new IndexBuilder.Result<>(info);
vars.reset();
XMLStreamReaderImpl reader = (pool == null) ? new XMLStreamReaderImpl() : pool.borrowObject();
try {
reader.setInput(info.is, StandardCharsets.UTF_8.name());
LogHelper.setJavolutionLogLevelFatal();
int eventType;
do {
// Read the next XML element
try {
eventType = reader.next();
} catch (XMLStreamException e) {
if (e instanceof XMLUnexpectedEndTagException) {
// it's ok to have unexpected closing tags
eventType = reader.getEventType();
} else if (e instanceof XMLUnexpectedEndOfDocumentException) {
// as we're reading arbitrary chunks of file, we will almost always finish parsing by hitting this condition
break;
} else {
throw new FileParsingException(e);
}
}
// process the read event
switch (eventType) {
case XMLStreamConstants.START_ELEMENT:
CharArray localName = reader.getLocalName();
Attributes attrs = reader.getAttributes();
if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {
if (vars.offsetLo != null) {
throw new FileParsingException("Nested spectrum tags not allowed in mzml.");
}
// these are required attributes, if they're not there, just throw an exception
try {
vars.spectrumIndex = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_INDEX.name)
.toInt();
vars.spectrumId = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_ID.name)
.toString();
vars.offsetLo = reader.getLocation().getLastStartTagPos();
addAndFlush(result, info.offsetInFile);
} catch (NumberFormatException e) {
throw new FileParsingException("Malformed scan number while building index", e);
}
}
break;
case XMLStreamConstants.CHARACTERS:
break;
case XMLStreamConstants.END_ELEMENT:
localName = reader.getLocalName();
if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {
vars.offsetHi = reader.getLocation().getTotalCharsRead();
addAndFlush(result, info.offsetInFile);
}
break;
}
} while (eventType != XMLStreamConstants.END_DOCUMENT);
} finally {
addAndFlush(result, info.offsetInFile);
// we need to return the reaer to the pool, if we borrowed it from there
if (pool != null && reader != null) {
pool.returnObject(reader);
}
}
return result;
} }
|
public class class_name {
@Override
public Result<MZMLIndexElement> buildIndex(final Info info) throws Exception {
Result<MZMLIndexElement> result = new IndexBuilder.Result<>(info);
vars.reset();
XMLStreamReaderImpl reader = (pool == null) ? new XMLStreamReaderImpl() : pool.borrowObject();
try {
reader.setInput(info.is, StandardCharsets.UTF_8.name());
LogHelper.setJavolutionLogLevelFatal();
int eventType;
do {
// Read the next XML element
try {
eventType = reader.next();
// depends on control dependency: [try], data = [none]
} catch (XMLStreamException e) {
if (e instanceof XMLUnexpectedEndTagException) {
// it's ok to have unexpected closing tags
eventType = reader.getEventType();
// depends on control dependency: [if], data = [none]
} else if (e instanceof XMLUnexpectedEndOfDocumentException) {
// as we're reading arbitrary chunks of file, we will almost always finish parsing by hitting this condition
break;
} else {
throw new FileParsingException(e);
}
}
// depends on control dependency: [catch], data = [none]
// process the read event
switch (eventType) {
case XMLStreamConstants.START_ELEMENT:
CharArray localName = reader.getLocalName();
Attributes attrs = reader.getAttributes();
if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {
if (vars.offsetLo != null) {
throw new FileParsingException("Nested spectrum tags not allowed in mzml.");
}
// these are required attributes, if they're not there, just throw an exception
try {
vars.spectrumIndex = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_INDEX.name)
.toInt();
// depends on control dependency: [try], data = [none]
vars.spectrumId = attrs.getValue(MZMLMultiSpectraParser.ATTR.SPECTRUM_ID.name)
.toString();
// depends on control dependency: [try], data = [none]
vars.offsetLo = reader.getLocation().getLastStartTagPos();
// depends on control dependency: [try], data = [none]
addAndFlush(result, info.offsetInFile);
// depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new FileParsingException("Malformed scan number while building index", e);
}
// depends on control dependency: [catch], data = [none]
}
break;
case XMLStreamConstants.CHARACTERS:
break;
case XMLStreamConstants.END_ELEMENT:
localName = reader.getLocalName();
if (localName.contentEquals(MZMLMultiSpectraParser.TAG.SPECTRUM.name)) {
vars.offsetHi = reader.getLocation().getTotalCharsRead();
// depends on control dependency: [if], data = [none]
addAndFlush(result, info.offsetInFile);
// depends on control dependency: [if], data = [none]
}
break;
}
} while (eventType != XMLStreamConstants.END_DOCUMENT);
} finally {
addAndFlush(result, info.offsetInFile);
// we need to return the reaer to the pool, if we borrowed it from there
if (pool != null && reader != null) {
pool.returnObject(reader);
// depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public void setCommunications(java.util.Collection<Communication> communications) {
if (communications == null) {
this.communications = null;
return;
}
this.communications = new com.amazonaws.internal.SdkInternalList<Communication>(communications);
} }
|
public class class_name {
public void setCommunications(java.util.Collection<Communication> communications) {
if (communications == null) {
this.communications = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.communications = new com.amazonaws.internal.SdkInternalList<Communication>(communications);
} }
|
public class class_name {
public static base_responses delete(nitro_service client, nssimpleacl6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nssimpleacl6 deleteresources[] = new nssimpleacl6[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new nssimpleacl6();
deleteresources[i].aclname = resources[i].aclname;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} }
|
public class class_name {
public static base_responses delete(nitro_service client, nssimpleacl6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nssimpleacl6 deleteresources[] = new nssimpleacl6[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new nssimpleacl6(); // depends on control dependency: [for], data = [i]
deleteresources[i].aclname = resources[i].aclname; // depends on control dependency: [for], data = [i]
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} }
|
public class class_name {
@Nonnull
public static <R> IntFunction<R> safeDefault(@Nullable IntFunction<R> func) {
if (func == null) {
return (i) -> null;
}
return func;
} }
|
public class class_name {
@Nonnull
public static <R> IntFunction<R> safeDefault(@Nullable IntFunction<R> func) {
if (func == null) {
return (i) -> null; // depends on control dependency: [if], data = [none]
}
return func;
} }
|
public class class_name {
public static <V> void addAllVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
// add all of the new vertices to prep for linking
for (V vertex : vertices) {
graph.addVertex(vertex);
}
} }
|
public class class_name {
public static <V> void addAllVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) {
// add all of the new vertices to prep for linking
for (V vertex : vertices) {
graph.addVertex(vertex); // depends on control dependency: [for], data = [vertex]
}
} }
|
public class class_name {
public void setGlobalClusters(java.util.Collection<GlobalCluster> globalClusters) {
if (globalClusters == null) {
this.globalClusters = null;
return;
}
this.globalClusters = new com.amazonaws.internal.SdkInternalList<GlobalCluster>(globalClusters);
} }
|
public class class_name {
public void setGlobalClusters(java.util.Collection<GlobalCluster> globalClusters) {
if (globalClusters == null) {
this.globalClusters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.globalClusters = new com.amazonaws.internal.SdkInternalList<GlobalCluster>(globalClusters);
} }
|
public class class_name {
private boolean isPreamble(int index) {
if (index <= buffer.length() - 6) {
if (
buffer.get(index) == '<' &&
buffer.get(index + 1) == '?' &&
buffer.get(index + 2) == 'x' &&
buffer.get(index + 3) == 'm' &&
buffer.get(index + 4) == 'l' &&
buffer.get(index + 5) == ' '
) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean isPreamble(int index) {
if (index <= buffer.length() - 6) {
if (
buffer.get(index) == '<' &&
buffer.get(index + 1) == '?' &&
buffer.get(index + 2) == 'x' &&
buffer.get(index + 3) == 'm' &&
buffer.get(index + 4) == 'l' &&
buffer.get(index + 5) == ' '
) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
protected void readyOutboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus,
boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutboundPostHandshake, vc=" + getVCHash());
}
// Exception to call destroy with in case of bad return code from SSL engine.
IOException exception = null;
if (hsStatus != HandshakeStatus.FINISHED) {
// Handshake failed.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected results of handshake after connect, " + hsStatus);
}
exception = new IOException("Unexpected results of handshake after connect, " + hsStatus);
}
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Null out the buffer references on the device side so they don't wrongly reused later.
getDeviceReadInterface().setBuffers(null);
// Clean up the buffers.
// PI48725 Start
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode());
}
// Null out the buffer references on the device side so they don't wrongly reused later.
netBuffer.release();
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining());
}
this.readInterface.setNetBuffer(netBuffer);
}
// PI48725 Finish
// Clean up the buffers.
decryptedNetBuffer.release();
encryptedAppBuffer.release();
// Call appropriate callback if async
if (async) {
if (exception != null) {
close(getVirtualConnection(), exception);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling ready method.");
}
super.ready(getVirtualConnection());
}
} else {
if (exception != null) {
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutboundPostHandshake");
}
} }
|
public class class_name {
protected void readyOutboundPostHandshake(
WsByteBuffer netBuffer,
WsByteBuffer decryptedNetBuffer,
WsByteBuffer encryptedAppBuffer,
HandshakeStatus hsStatus,
boolean async) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "readyOutboundPostHandshake, vc=" + getVCHash());
}
// Exception to call destroy with in case of bad return code from SSL engine.
IOException exception = null;
if (hsStatus != HandshakeStatus.FINISHED) {
// Handshake failed.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unexpected results of handshake after connect, " + hsStatus); // depends on control dependency: [if], data = [none]
}
exception = new IOException("Unexpected results of handshake after connect, " + hsStatus);
}
// PK16095 - take certain actions when the handshake completes
getChannel().onHandshakeFinish(getSSLEngine());
// Null out the buffer references on the device side so they don't wrongly reused later.
getDeviceReadInterface().setBuffers(null);
// Clean up the buffers.
// PI48725 Start
// Handshake complete. Now get the request. Use our read interface so unwrap already done.
// Check if data exists in the network buffer still. This would be app data beyond handshake.
if (netBuffer.remaining() == 0 || netBuffer.position() == 0) {
// No app data. Release the netBuffer as it will no longer be used.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Releasing netBuffer: " + netBuffer.hashCode()); // depends on control dependency: [if], data = [none]
}
// Null out the buffer references on the device side so they don't wrongly reused later.
netBuffer.release();
} else {
// Found encrypted app data. Don't release the network buffer yet. Let the read decrypt it.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "App data exists in netBuffer after handshake: " + netBuffer.remaining()); // depends on control dependency: [if], data = [none]
}
this.readInterface.setNetBuffer(netBuffer);
}
// PI48725 Finish
// Clean up the buffers.
decryptedNetBuffer.release();
encryptedAppBuffer.release();
// Call appropriate callback if async
if (async) {
if (exception != null) {
close(getVirtualConnection(), exception); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling ready method."); // depends on control dependency: [if], data = [none]
}
super.ready(getVirtualConnection()); // depends on control dependency: [if], data = [none]
}
} else {
if (exception != null) {
throw exception;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "readyOutboundPostHandshake");
}
} }
|
public class class_name {
@Override
public void onBindViewHolder(final VH vh, final int i) {
if(itemClickListener != null){
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = vh.getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
itemClickListener.onItemClick(v, getItem(position), position);
}
}
});
}
if(itemLongClickListener != null){
vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int position = vh.getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
return itemLongClickListener.onItemLongClick(v, getItem(position), position);
}
return false;
}
});
}
} }
|
public class class_name {
@Override
public void onBindViewHolder(final VH vh, final int i) {
if(itemClickListener != null){
vh.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = vh.getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
itemClickListener.onItemClick(v, getItem(position), position); // depends on control dependency: [if], data = [(position]
}
}
}); // depends on control dependency: [if], data = [none]
}
if(itemLongClickListener != null){
vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int position = vh.getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
return itemLongClickListener.onItemLongClick(v, getItem(position), position); // depends on control dependency: [if], data = [(position]
}
return false;
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void doWithFields(Class<?> clazz, FieldCallback fc, FieldFilter ff)
throws IllegalArgumentException {
// Keep backing up the inheritance hierarchy.
Class<?> targetClass = clazz;
do {
Field[] fields = targetClass.getDeclaredFields();
for (Field field : fields) {
// Skip static and final fields.
if (ff != null && !ff.matches(field)) {
continue;
}
try {
fc.doWith(field);
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Shouldn't be illegal to access field '" + field.getName() + "': " + ex);
}
}
targetClass = targetClass.getSuperclass();
}
while (targetClass != null && targetClass != Object.class);
} }
|
public class class_name {
public static void doWithFields(Class<?> clazz, FieldCallback fc, FieldFilter ff)
throws IllegalArgumentException {
// Keep backing up the inheritance hierarchy.
Class<?> targetClass = clazz;
do {
Field[] fields = targetClass.getDeclaredFields();
for (Field field : fields) {
// Skip static and final fields.
if (ff != null && !ff.matches(field)) {
continue;
}
try {
fc.doWith(field); // depends on control dependency: [try], data = [none]
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Shouldn't be illegal to access field '" + field.getName() + "': " + ex);
} // depends on control dependency: [catch], data = [none]
}
targetClass = targetClass.getSuperclass();
}
while (targetClass != null && targetClass != Object.class);
} }
|
public class class_name {
public void marshall(SuggestRequest suggestRequest, ProtocolMarshaller protocolMarshaller) {
if (suggestRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(suggestRequest.getQuery(), QUERY_BINDING);
protocolMarshaller.marshall(suggestRequest.getSuggester(), SUGGESTER_BINDING);
protocolMarshaller.marshall(suggestRequest.getSize(), SIZE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SuggestRequest suggestRequest, ProtocolMarshaller protocolMarshaller) {
if (suggestRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(suggestRequest.getQuery(), QUERY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(suggestRequest.getSuggester(), SUGGESTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(suggestRequest.getSize(), SIZE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String substitute(String expression) throws AbstractTracer.Exception {
Pattern compiledPattern = Pattern.compile("\\$\\{[a-zA-Z0-9.]+\\}");
Matcher matcher = compiledPattern.matcher(expression);
int pos = 0;
StringBuilder stringBuilder = new StringBuilder();
boolean flag;
do {
flag = false;
while (matcher.find()) {
stringBuilder.append(expression.substring(pos, matcher.start()));
String propertyKey = expression.substring(matcher.start() + 2, matcher.end() - 1);
if (System.getProperties().containsKey(propertyKey)) {
String propertyValue = System.getProperty(propertyKey);
stringBuilder.append(propertyValue);
pos = matcher.end();
flag = true;
}
else {
throw new AbstractTracer.Exception("Unknown property key.");
}
}
stringBuilder.append(expression.substring(pos));
expression = stringBuilder.toString();
if (flag) {
stringBuilder = new StringBuilder();
matcher.reset(expression);
pos = 0;
}
} while (flag);
return expression;
} }
|
public class class_name {
protected String substitute(String expression) throws AbstractTracer.Exception {
Pattern compiledPattern = Pattern.compile("\\$\\{[a-zA-Z0-9.]+\\}");
Matcher matcher = compiledPattern.matcher(expression);
int pos = 0;
StringBuilder stringBuilder = new StringBuilder();
boolean flag;
do {
flag = false;
while (matcher.find()) {
stringBuilder.append(expression.substring(pos, matcher.start()));
// depends on control dependency: [while], data = [none]
String propertyKey = expression.substring(matcher.start() + 2, matcher.end() - 1);
if (System.getProperties().containsKey(propertyKey)) {
String propertyValue = System.getProperty(propertyKey);
stringBuilder.append(propertyValue);
// depends on control dependency: [if], data = [none]
pos = matcher.end();
// depends on control dependency: [if], data = [none]
flag = true;
// depends on control dependency: [if], data = [none]
}
else {
throw new AbstractTracer.Exception("Unknown property key.");
}
}
stringBuilder.append(expression.substring(pos));
expression = stringBuilder.toString();
if (flag) {
stringBuilder = new StringBuilder();
// depends on control dependency: [if], data = [none]
matcher.reset(expression);
// depends on control dependency: [if], data = [none]
pos = 0;
// depends on control dependency: [if], data = [none]
}
} while (flag);
return expression;
} }
|
public class class_name {
public static void closeLogger(Logger logger) {
for (Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
handler.close();
}
} }
|
public class class_name {
public static void closeLogger(Logger logger) {
for (Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
// depends on control dependency: [for], data = [handler]
handler.close();
// depends on control dependency: [for], data = [handler]
}
} }
|
public class class_name {
public boolean setSearchFocused(final boolean focused) {
boolean updatedToNotFocused = !focused && this.mIsFocused;
if ((focused != this.mIsFocused) && mSuggestionSecHeightListener == null) {
if (mIsSuggestionsSectionHeightSet) {
setSearchFocusedInternal(focused);
} else {
mSuggestionSecHeightListener = new OnSuggestionSecHeightSetListener() {
@Override
public void onSuggestionSecHeightSet() {
setSearchFocusedInternal(focused);
mSuggestionSecHeightListener = null;
}
};
}
}
return updatedToNotFocused;
} }
|
public class class_name {
public boolean setSearchFocused(final boolean focused) {
boolean updatedToNotFocused = !focused && this.mIsFocused;
if ((focused != this.mIsFocused) && mSuggestionSecHeightListener == null) {
if (mIsSuggestionsSectionHeightSet) {
setSearchFocusedInternal(focused); // depends on control dependency: [if], data = [none]
} else {
mSuggestionSecHeightListener = new OnSuggestionSecHeightSetListener() {
@Override
public void onSuggestionSecHeightSet() {
setSearchFocusedInternal(focused);
mSuggestionSecHeightListener = null;
}
}; // depends on control dependency: [if], data = [none]
}
}
return updatedToNotFocused;
} }
|
public class class_name {
public static final Renderer<Integer> instance() { // NOPMD it's thread save!
if (IntegerRendererWithoutSeparator.instanceRenderer == null) {
synchronized (IntegerRendererWithoutSeparator.class) {
if (IntegerRendererWithoutSeparator.instanceRenderer == null) {
IntegerRendererWithoutSeparator.instanceRenderer = new IntegerRendererWithoutSeparator();
}
}
}
return IntegerRendererWithoutSeparator.instanceRenderer;
} }
|
public class class_name {
public static final Renderer<Integer> instance() { // NOPMD it's thread save!
if (IntegerRendererWithoutSeparator.instanceRenderer == null) {
synchronized (IntegerRendererWithoutSeparator.class) { // depends on control dependency: [if], data = [none]
if (IntegerRendererWithoutSeparator.instanceRenderer == null) {
IntegerRendererWithoutSeparator.instanceRenderer = new IntegerRendererWithoutSeparator(); // depends on control dependency: [if], data = [none]
}
}
}
return IntegerRendererWithoutSeparator.instanceRenderer;
} }
|
public class class_name {
public void marshall(StartNextPendingJobExecutionRequest startNextPendingJobExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (startNextPendingJobExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getThingName(), THINGNAME_BINDING);
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getStatusDetails(), STATUSDETAILS_BINDING);
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getStepTimeoutInMinutes(), STEPTIMEOUTINMINUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StartNextPendingJobExecutionRequest startNextPendingJobExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (startNextPendingJobExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getThingName(), THINGNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getStatusDetails(), STATUSDETAILS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startNextPendingJobExecutionRequest.getStepTimeoutInMinutes(), STEPTIMEOUTINMINUTES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Topic getTopic(String topicName) throws ServiceLocatorException {
Topic topic = null;
try {
if (cache.containsKey(topicName)) {
topic = (Topic) cache.get(topicName);
} else {
topic = (Topic) ic.lookup(topicName);
cache.put(topicName, topic);
}
} catch (NamingException ne) {
throw new ServiceLocatorException(ne);
} catch (Exception e) {
throw new ServiceLocatorException(e);
}
return topic;
} }
|
public class class_name {
public Topic getTopic(String topicName) throws ServiceLocatorException {
Topic topic = null;
try {
if (cache.containsKey(topicName)) {
topic = (Topic) cache.get(topicName);
// depends on control dependency: [if], data = [none]
} else {
topic = (Topic) ic.lookup(topicName);
// depends on control dependency: [if], data = [none]
cache.put(topicName, topic);
// depends on control dependency: [if], data = [none]
}
} catch (NamingException ne) {
throw new ServiceLocatorException(ne);
} catch (Exception e) {
throw new ServiceLocatorException(e);
}
return topic;
} }
|
public class class_name {
@Override
public void onNotificationMessageArrived(Context context, com.xiaomi.mipush.sdk.MiPushMessage miPushMessage) {
if (null != miPushMessage) {
String content = miPushMessage.getContent();
if (!StringUtil.isEmpty(content)) {
AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance();
androidNotificationManager.porcessMixNotificationArrived(content, AV_MIXPUSH_MI_NOTIFICATION_ARRIVED_ACTION);
}
}
} }
|
public class class_name {
@Override
public void onNotificationMessageArrived(Context context, com.xiaomi.mipush.sdk.MiPushMessage miPushMessage) {
if (null != miPushMessage) {
String content = miPushMessage.getContent();
if (!StringUtil.isEmpty(content)) {
AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance();
androidNotificationManager.porcessMixNotificationArrived(content, AV_MIXPUSH_MI_NOTIFICATION_ARRIVED_ACTION); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public void postCostConstraints() {
if (!costActivated) {
costActivated = true;
rp.getLogger().debug("Post the cost-oriented constraints");
List<IntVar> mttrs = Stream.concat(rp.getVMActions().stream(), rp.getNodeActions().stream())
.map(Transition::getEnd).collect(Collectors.toList());
rp.getModel().post(rp.getModel().sum(mttrs.toArray(new IntVar[0]), "=", cost));
}
} }
|
public class class_name {
@Override
public void postCostConstraints() {
if (!costActivated) {
costActivated = true; // depends on control dependency: [if], data = [none]
rp.getLogger().debug("Post the cost-oriented constraints"); // depends on control dependency: [if], data = [none]
List<IntVar> mttrs = Stream.concat(rp.getVMActions().stream(), rp.getNodeActions().stream())
.map(Transition::getEnd).collect(Collectors.toList());
rp.getModel().post(rp.getModel().sum(mttrs.toArray(new IntVar[0]), "=", cost)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void pluginAppears( PluginInterface pi ) {
if( pi != null ) {
this.logger.info( "Plugin '" + pi.getPluginName() + "' is now available in Roboconf's agent." );
this.plugins.add( pi );
listPlugins();
}
} }
|
public class class_name {
public void pluginAppears( PluginInterface pi ) {
if( pi != null ) {
this.logger.info( "Plugin '" + pi.getPluginName() + "' is now available in Roboconf's agent." ); // depends on control dependency: [if], data = [none]
this.plugins.add( pi ); // depends on control dependency: [if], data = [( pi]
listPlugins(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static ShortDuration of(long duration, TimeUnit unit) {
if (duration == 0) {
return ZERO;
}
checkArgument(duration >= 0, "negative duration: %s", duration);
checkArgument(duration <= MAXES.get(unit),
"ShortDuration cannot exceed 100 days: %s %s", duration, unit);
long nanos = TimeUnit.NANOSECONDS.convert(duration, unit);
return new PositiveShortDuration(nanos * 1000);
} }
|
public class class_name {
public static ShortDuration of(long duration, TimeUnit unit) {
if (duration == 0) {
return ZERO; // depends on control dependency: [if], data = [none]
}
checkArgument(duration >= 0, "negative duration: %s", duration);
checkArgument(duration <= MAXES.get(unit),
"ShortDuration cannot exceed 100 days: %s %s", duration, unit);
long nanos = TimeUnit.NANOSECONDS.convert(duration, unit);
return new PositiveShortDuration(nanos * 1000);
} }
|
public class class_name {
public static String getFullyLocalHostName() {
String hostName = null;
try {
InetAddress inet = InetAddress.getLocalHost();
hostName = inet.getCanonicalHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return hostName;
} }
|
public class class_name {
public static String getFullyLocalHostName() {
String hostName = null;
try {
InetAddress inet = InetAddress.getLocalHost();
hostName = inet.getCanonicalHostName(); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return hostName;
} }
|
public class class_name {
public static String isbnFormat(final String pstring) {
if (pstring == null) {
return null;
}
final int length = isbnCompress(pstring).length();
if (length > Isbn10Validator.ISBN10_LENGTH) {
return isbn13Format(pstring);
} else {
return isbn10Format(pstring);
}
} }
|
public class class_name {
public static String isbnFormat(final String pstring) {
if (pstring == null) {
return null; // depends on control dependency: [if], data = [none]
}
final int length = isbnCompress(pstring).length();
if (length > Isbn10Validator.ISBN10_LENGTH) {
return isbn13Format(pstring); // depends on control dependency: [if], data = [none]
} else {
return isbn10Format(pstring); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(ListDeviceDefinitionVersionsRequest listDeviceDefinitionVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listDeviceDefinitionVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getDeviceDefinitionId(), DEVICEDEFINITIONID_BINDING);
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListDeviceDefinitionVersionsRequest listDeviceDefinitionVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listDeviceDefinitionVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getDeviceDefinitionId(), DEVICEDEFINITIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDeviceDefinitionVersionsRequest.getNextToken(), NEXTTOKEN_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 addConfigurationsToReactor(Class<?> testClass, Object testClassInstance)
throws IllegalAccessException, InvocationTargetException {
numConfigurations = 0;
Method[] methods = testClass.getMethods();
for (Method m : methods) {
if (isConfiguration(m)) {
// consider as option, so prepare that one:
reactor.addConfiguration(((Option[]) m.invoke(testClassInstance)));
numConfigurations++;
}
}
failOnUnusedConfiguration(testClass.getDeclaredMethods());
} }
|
public class class_name {
private void addConfigurationsToReactor(Class<?> testClass, Object testClassInstance)
throws IllegalAccessException, InvocationTargetException {
numConfigurations = 0;
Method[] methods = testClass.getMethods();
for (Method m : methods) {
if (isConfiguration(m)) {
// consider as option, so prepare that one:
reactor.addConfiguration(((Option[]) m.invoke(testClassInstance))); // depends on control dependency: [if], data = [none]
numConfigurations++; // depends on control dependency: [if], data = [none]
}
}
failOnUnusedConfiguration(testClass.getDeclaredMethods());
} }
|
public class class_name {
private void invokeRecordAllocation(String typeName) {
Matcher matcher = namePattern.matcher(typeName);
if (matcher.find()) {
typeName = matcher.group(1);
}
// stack: ... count newobj
super.visitInsn(Opcodes.DUP_X1);
// -> stack: ... newobj count newobj
super.visitLdcInsn(typeName);
// -> stack: ... newobj count newobj typename
super.visitInsn(Opcodes.SWAP);
// -> stack: ... newobj count typename newobj
super.visitMethodInsn(
Opcodes.INVOKESTATIC, recorderClass, recorderMethod, RECORDER_SIGNATURE, false);
// -> stack: ... newobj
} }
|
public class class_name {
private void invokeRecordAllocation(String typeName) {
Matcher matcher = namePattern.matcher(typeName);
if (matcher.find()) {
typeName = matcher.group(1); // depends on control dependency: [if], data = [none]
}
// stack: ... count newobj
super.visitInsn(Opcodes.DUP_X1);
// -> stack: ... newobj count newobj
super.visitLdcInsn(typeName);
// -> stack: ... newobj count newobj typename
super.visitInsn(Opcodes.SWAP);
// -> stack: ... newobj count typename newobj
super.visitMethodInsn(
Opcodes.INVOKESTATIC, recorderClass, recorderMethod, RECORDER_SIGNATURE, false);
// -> stack: ... newobj
} }
|
public class class_name {
public static InetAddress getInetAddress( String key, InetAddress def ) {
String addr = prp.getProperty( key );
if( addr != null ) {
try {
def = InetAddress.getByName( addr );
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr );
uhe.printStackTrace( log );
}
}
}
return def;
} }
|
public class class_name {
public static InetAddress getInetAddress( String key, InetAddress def ) {
String addr = prp.getProperty( key );
if( addr != null ) {
try {
def = InetAddress.getByName( addr ); // depends on control dependency: [try], data = [none]
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr ); // depends on control dependency: [if], data = [none]
uhe.printStackTrace( log ); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
return def;
} }
|
public class class_name {
protected Paint getPolygonPaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = polygonPaint;
}
return paint;
} }
|
public class class_name {
protected Paint getPolygonPaint(FeatureStyle featureStyle) {
Paint paint = getFeatureStylePaint(featureStyle, FeatureDrawType.STROKE);
if (paint == null) {
paint = polygonPaint; // depends on control dependency: [if], data = [none]
}
return paint;
} }
|
public class class_name {
protected List<CmsResource> getResources() {
List<CmsResource> result = Collections.emptyList();
// get all image resources of the folder
CmsResourceFilter filter = CmsResourceFilter.DEFAULT;
try {
CmsObject cms = getCms();
result = cms.readResources(getParamResource(), filter, false);
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale()));
}
}
return result;
} }
|
public class class_name {
protected List<CmsResource> getResources() {
List<CmsResource> result = Collections.emptyList();
// get all image resources of the folder
CmsResourceFilter filter = CmsResourceFilter.DEFAULT;
try {
CmsObject cms = getCms();
result = cms.readResources(getParamResource(), filter, false); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale())); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
private static void mergeApiPathParamDoc(ApiPathParam apiPathParam, ApiParamDoc apiParamDoc) {
if (apiPathParam != null) {
if (apiParamDoc.getName().trim().isEmpty()) {
apiParamDoc.setName(apiPathParam.name());
}
apiParamDoc.setDescription(apiPathParam.description());
apiParamDoc.setAllowedvalues(apiPathParam.allowedvalues());
apiParamDoc.setFormat(apiPathParam.format());
}
} }
|
public class class_name {
private static void mergeApiPathParamDoc(ApiPathParam apiPathParam, ApiParamDoc apiParamDoc) {
if (apiPathParam != null) {
if (apiParamDoc.getName().trim().isEmpty()) {
apiParamDoc.setName(apiPathParam.name()); // depends on control dependency: [if], data = [none]
}
apiParamDoc.setDescription(apiPathParam.description()); // depends on control dependency: [if], data = [(apiPathParam]
apiParamDoc.setAllowedvalues(apiPathParam.allowedvalues()); // depends on control dependency: [if], data = [(apiPathParam]
apiParamDoc.setFormat(apiPathParam.format()); // depends on control dependency: [if], data = [(apiPathParam]
}
} }
|
public class class_name {
private boolean isExcludedPath(String requestURI)
{
if (requestURI == null)
return false;
if (_excludedPaths != null)
{
for (String excludedPath : _excludedPaths)
{
if (requestURI.startsWith(excludedPath))
{
return true;
}
}
}
if (_excludedPathPatterns != null)
{
for (Pattern pattern : _excludedPathPatterns)
{
if (pattern.matcher(requestURI).matches())
{
return true;
}
}
}
return false;
} }
|
public class class_name {
private boolean isExcludedPath(String requestURI)
{
if (requestURI == null)
return false;
if (_excludedPaths != null)
{
for (String excludedPath : _excludedPaths)
{
if (requestURI.startsWith(excludedPath))
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
if (_excludedPathPatterns != null)
{
for (Pattern pattern : _excludedPathPatterns)
{
if (pattern.matcher(requestURI).matches())
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public static void sleep(long millis) throws InterruptedException {
while (millis > 0) {
// abort if the user kills mlcp in local mode
String shutdown = System.getProperty("mlcp.shutdown");
if (shutdown != null) {
break;
}
if (millis > 1000) {
Thread.sleep(1000);
millis -= 1000;
} else {
Thread.sleep(millis);
millis = 0;
}
}
} }
|
public class class_name {
public static void sleep(long millis) throws InterruptedException {
while (millis > 0) {
// abort if the user kills mlcp in local mode
String shutdown = System.getProperty("mlcp.shutdown");
if (shutdown != null) {
break;
}
if (millis > 1000) {
Thread.sleep(1000); // depends on control dependency: [if], data = [1000)]
millis -= 1000; // depends on control dependency: [if], data = [none]
} else {
Thread.sleep(millis); // depends on control dependency: [if], data = [(millis]
millis = 0; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public ConfigurationProperty setDefaultValue(Object defaultValue) {
if ((defaultValue != null) && !type.isAssignableFrom(defaultValue.getClass())) {
if ((type == Long.class) && (defaultValue instanceof Integer)) {
return setDefaultValue(((Integer) defaultValue).longValue());
}
throw new UnexpectedLiquibaseException("Property "+name+" on is of type "+type.getSimpleName()+", not "+defaultValue.getClass().getSimpleName());
}
this.defaultValue = defaultValue;
return this;
} }
|
public class class_name {
public ConfigurationProperty setDefaultValue(Object defaultValue) {
if ((defaultValue != null) && !type.isAssignableFrom(defaultValue.getClass())) {
if ((type == Long.class) && (defaultValue instanceof Integer)) {
return setDefaultValue(((Integer) defaultValue).longValue()); // depends on control dependency: [if], data = [none]
}
throw new UnexpectedLiquibaseException("Property "+name+" on is of type "+type.getSimpleName()+", not "+defaultValue.getClass().getSimpleName());
}
this.defaultValue = defaultValue;
return this;
} }
|
public class class_name {
public static byte[] hash128(byte[] data, int offset, int length, int seed) {
long h1 = seed;
long h2 = seed;
final int nblocks = length >> 4;
// body
for (int i = 0; i < nblocks; i++) {
final int i16 = i << 4;
long k1 = ((long) data[offset + i16] & 0xff)
| (((long) data[offset + i16 + 1] & 0xff) << 8)
| (((long) data[offset + i16 + 2] & 0xff) << 16)
| (((long) data[offset + i16 + 3] & 0xff) << 24)
| (((long) data[offset + i16 + 4] & 0xff) << 32)
| (((long) data[offset + i16 + 5] & 0xff) << 40)
| (((long) data[offset + i16 + 6] & 0xff) << 48)
| (((long) data[offset + i16 + 7] & 0xff) << 56);
long k2 = ((long) data[offset + i16 + 8] & 0xff)
| (((long) data[offset + i16 + 9] & 0xff) << 8)
| (((long) data[offset + i16 + 10] & 0xff) << 16)
| (((long) data[offset + i16 + 11] & 0xff) << 24)
| (((long) data[offset + i16 + 12] & 0xff) << 32)
| (((long) data[offset + i16 + 13] & 0xff) << 40)
| (((long) data[offset + i16 + 14] & 0xff) << 48)
| (((long) data[offset + i16 + 15] & 0xff) << 56);
// mix functions for k1
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
k1 *= C2;
h1 ^= k1;
h1 = Long.rotateLeft(h1, R2);
h1 += h2;
h1 = h1 * M + N1;
// mix functions for k2
k2 *= C2;
k2 = Long.rotateLeft(k2, R3);
k2 *= C1;
h2 ^= k2;
h2 = Long.rotateLeft(h2, R1);
h2 += h1;
h2 = h2 * M + N2;
}
// tail
long k1 = 0;
long k2 = 0;
int tailStart = nblocks << 4;
switch (length - tailStart) {
case 15:
k2 ^= (long) (data[offset + tailStart + 14] & 0xff) << 48;
case 14:
k2 ^= (long) (data[offset + tailStart + 13] & 0xff) << 40;
case 13:
k2 ^= (long) (data[offset + tailStart + 12] & 0xff) << 32;
case 12:
k2 ^= (long) (data[offset + tailStart + 11] & 0xff) << 24;
case 11:
k2 ^= (long) (data[offset + tailStart + 10] & 0xff) << 16;
case 10:
k2 ^= (long) (data[offset + tailStart + 9] & 0xff) << 8;
case 9:
k2 ^= (long) (data[offset + tailStart + 8] & 0xff);
k2 *= C2;
k2 = Long.rotateLeft(k2, R3);
k2 *= C1;
h2 ^= k2;
case 8:
k1 ^= (long) (data[offset + tailStart + 7] & 0xff) << 56;
case 7:
k1 ^= (long) (data[offset + tailStart + 6] & 0xff) << 48;
case 6:
k1 ^= (long) (data[offset + tailStart + 5] & 0xff) << 40;
case 5:
k1 ^= (long) (data[offset + tailStart + 4] & 0xff) << 32;
case 4:
k1 ^= (long) (data[offset + tailStart + 3] & 0xff) << 24;
case 3:
k1 ^= (long) (data[offset + tailStart + 2] & 0xff) << 16;
case 2:
k1 ^= (long) (data[offset + tailStart + 1] & 0xff) << 8;
case 1:
k1 ^= (long) (data[offset + tailStart] & 0xff);
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
k1 *= C2;
h1 ^= k1;
}
// finalization
h1 ^= length;
h2 ^= length;
h1 += h2;
h2 += h1;
h1 = fmix64(h1);
h2 = fmix64(h2);
h1 += h2;
h2 += h1;
byte[] results = new byte[16];
longToBytes(h1, results, 0);
longToBytes(h2, results, 8);
return results;
} }
|
public class class_name {
public static byte[] hash128(byte[] data, int offset, int length, int seed) {
long h1 = seed;
long h2 = seed;
final int nblocks = length >> 4;
// body
for (int i = 0; i < nblocks; i++) {
final int i16 = i << 4;
long k1 = ((long) data[offset + i16] & 0xff)
| (((long) data[offset + i16 + 1] & 0xff) << 8)
| (((long) data[offset + i16 + 2] & 0xff) << 16)
| (((long) data[offset + i16 + 3] & 0xff) << 24)
| (((long) data[offset + i16 + 4] & 0xff) << 32)
| (((long) data[offset + i16 + 5] & 0xff) << 40)
| (((long) data[offset + i16 + 6] & 0xff) << 48)
| (((long) data[offset + i16 + 7] & 0xff) << 56);
long k2 = ((long) data[offset + i16 + 8] & 0xff)
| (((long) data[offset + i16 + 9] & 0xff) << 8)
| (((long) data[offset + i16 + 10] & 0xff) << 16)
| (((long) data[offset + i16 + 11] & 0xff) << 24)
| (((long) data[offset + i16 + 12] & 0xff) << 32)
| (((long) data[offset + i16 + 13] & 0xff) << 40)
| (((long) data[offset + i16 + 14] & 0xff) << 48)
| (((long) data[offset + i16 + 15] & 0xff) << 56);
// mix functions for k1
k1 *= C1; // depends on control dependency: [for], data = [none]
k1 = Long.rotateLeft(k1, R1); // depends on control dependency: [for], data = [none]
k1 *= C2; // depends on control dependency: [for], data = [none]
h1 ^= k1; // depends on control dependency: [for], data = [none]
h1 = Long.rotateLeft(h1, R2); // depends on control dependency: [for], data = [none]
h1 += h2; // depends on control dependency: [for], data = [none]
h1 = h1 * M + N1; // depends on control dependency: [for], data = [none]
// mix functions for k2
k2 *= C2; // depends on control dependency: [for], data = [none]
k2 = Long.rotateLeft(k2, R3); // depends on control dependency: [for], data = [none]
k2 *= C1; // depends on control dependency: [for], data = [none]
h2 ^= k2; // depends on control dependency: [for], data = [none]
h2 = Long.rotateLeft(h2, R1); // depends on control dependency: [for], data = [none]
h2 += h1; // depends on control dependency: [for], data = [none]
h2 = h2 * M + N2; // depends on control dependency: [for], data = [none]
}
// tail
long k1 = 0;
long k2 = 0;
int tailStart = nblocks << 4;
switch (length - tailStart) {
case 15:
k2 ^= (long) (data[offset + tailStart + 14] & 0xff) << 48;
case 14:
k2 ^= (long) (data[offset + tailStart + 13] & 0xff) << 40;
case 13:
k2 ^= (long) (data[offset + tailStart + 12] & 0xff) << 32;
case 12:
k2 ^= (long) (data[offset + tailStart + 11] & 0xff) << 24;
case 11:
k2 ^= (long) (data[offset + tailStart + 10] & 0xff) << 16;
case 10:
k2 ^= (long) (data[offset + tailStart + 9] & 0xff) << 8;
case 9:
k2 ^= (long) (data[offset + tailStart + 8] & 0xff);
k2 *= C2;
k2 = Long.rotateLeft(k2, R3);
k2 *= C1;
h2 ^= k2;
case 8:
k1 ^= (long) (data[offset + tailStart + 7] & 0xff) << 56;
case 7:
k1 ^= (long) (data[offset + tailStart + 6] & 0xff) << 48;
case 6:
k1 ^= (long) (data[offset + tailStart + 5] & 0xff) << 40;
case 5:
k1 ^= (long) (data[offset + tailStart + 4] & 0xff) << 32;
case 4:
k1 ^= (long) (data[offset + tailStart + 3] & 0xff) << 24;
case 3:
k1 ^= (long) (data[offset + tailStart + 2] & 0xff) << 16;
case 2:
k1 ^= (long) (data[offset + tailStart + 1] & 0xff) << 8;
case 1:
k1 ^= (long) (data[offset + tailStart] & 0xff);
k1 *= C1;
k1 = Long.rotateLeft(k1, R1);
k1 *= C2;
h1 ^= k1;
}
// finalization
h1 ^= length;
h2 ^= length;
h1 += h2;
h2 += h1;
h1 = fmix64(h1);
h2 = fmix64(h2);
h1 += h2;
h2 += h1;
byte[] results = new byte[16];
longToBytes(h1, results, 0);
longToBytes(h2, results, 8);
return results;
} }
|
public class class_name {
public void setUsernames(java.util.Collection<String> usernames) {
if (usernames == null) {
this.usernames = null;
return;
}
this.usernames = new java.util.ArrayList<String>(usernames);
} }
|
public class class_name {
public void setUsernames(java.util.Collection<String> usernames) {
if (usernames == null) {
this.usernames = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.usernames = new java.util.ArrayList<String>(usernames);
} }
|
public class class_name {
public static double roundDoubleToClosest (double value, double steps) {
final double down = DMatrixUtils.roundDoubleDownTo(value, steps);
final double up = DMatrixUtils.roundDoubleUpTo(value, steps);
if (Math.abs(value - down) < Math.abs(value - up)) {
return down;
}
return up;
} }
|
public class class_name {
public static double roundDoubleToClosest (double value, double steps) {
final double down = DMatrixUtils.roundDoubleDownTo(value, steps);
final double up = DMatrixUtils.roundDoubleUpTo(value, steps);
if (Math.abs(value - down) < Math.abs(value - up)) {
return down; // depends on control dependency: [if], data = [none]
}
return up;
} }
|
public class class_name {
private void recordInterfaces(FunctionType constructor, JSType relatedType, Property p) {
Iterable<ObjectType> interfaces = ancestorInterfaces.get(constructor);
if (interfaces == null) {
interfaces = constructor.getAncestorInterfaces();
ancestorInterfaces.put(constructor, interfaces);
}
for (ObjectType itype : interfaces) {
JSType top = getTypeWithProperty(p.name, itype);
if (top != null) {
p.addType(itype, relatedType);
}
// If this interface invalidated this property, return now.
if (p.skipRenaming) {
return;
}
}
} }
|
public class class_name {
private void recordInterfaces(FunctionType constructor, JSType relatedType, Property p) {
Iterable<ObjectType> interfaces = ancestorInterfaces.get(constructor);
if (interfaces == null) {
interfaces = constructor.getAncestorInterfaces(); // depends on control dependency: [if], data = [none]
ancestorInterfaces.put(constructor, interfaces); // depends on control dependency: [if], data = [none]
}
for (ObjectType itype : interfaces) {
JSType top = getTypeWithProperty(p.name, itype);
if (top != null) {
p.addType(itype, relatedType); // depends on control dependency: [if], data = [none]
}
// If this interface invalidated this property, return now.
if (p.skipRenaming) {
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void checkTreeBin(int index) {
long tb = treeBins[index];
boolean empty = (treeMap & (1 << index)) == 0;
if (tb == -1 && !empty) {
throw new AssertionError("Tree " + index + " is marked as occupied but has an invalid head pointer");
}
if (!empty) {
checkTree(tb);
}
} }
|
public class class_name {
private void checkTreeBin(int index) {
long tb = treeBins[index];
boolean empty = (treeMap & (1 << index)) == 0;
if (tb == -1 && !empty) {
throw new AssertionError("Tree " + index + " is marked as occupied but has an invalid head pointer");
}
if (!empty) {
checkTree(tb); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
Converter select(Class<?> type) throws IllegalStateException {
// Check the hashtable first.
Entry[] entries = iSelectEntries;
int length = entries.length;
int index = type == null ? 0 : type.hashCode() & (length - 1);
Entry e;
// This loop depends on there being at least one null slot.
while ((e = entries[index]) != null) {
if (e.iType == type) {
return e.iConverter;
}
if (++index >= length) {
index = 0;
}
}
// Not found in the hashtable, so do actual work.
Converter converter = selectSlow(this, type);
e = new Entry(type, converter);
// Save the entry for future selects. This class must be threadsafe,
// but there is no synchronization. Since the hashtable is being used
// as a cache, it is okay to destroy existing entries. This isn't
// likely to occur unless there is a high amount of concurrency. As
// time goes on, cache updates will occur less often, and the cache
// will fill with all the necessary entries.
// Do all updates on a copy: slots in iSelectEntries must not be
// updated by multiple threads as this can allow all null slots to be
// consumed.
entries = (Entry[])entries.clone();
// Add new entry.
entries[index] = e;
// Verify that at least one null slot exists!
for (int i=0; i<length; i++) {
if (entries[i] == null) {
// Found a null slot, swap in new hashtable.
iSelectEntries = entries;
return converter;
}
}
// Double capacity and re-hash.
int newLength = length << 1;
Entry[] newEntries = new Entry[newLength];
for (int i=0; i<length; i++) {
e = entries[i];
type = e.iType;
index = type == null ? 0 : type.hashCode() & (newLength - 1);
while (newEntries[index] != null) {
if (++index >= newLength) {
index = 0;
}
}
newEntries[index] = e;
}
// Swap in new hashtable.
iSelectEntries = newEntries;
return converter;
} }
|
public class class_name {
Converter select(Class<?> type) throws IllegalStateException {
// Check the hashtable first.
Entry[] entries = iSelectEntries;
int length = entries.length;
int index = type == null ? 0 : type.hashCode() & (length - 1);
Entry e;
// This loop depends on there being at least one null slot.
while ((e = entries[index]) != null) {
if (e.iType == type) {
return e.iConverter; // depends on control dependency: [if], data = [none]
}
if (++index >= length) {
index = 0; // depends on control dependency: [if], data = [none]
}
}
// Not found in the hashtable, so do actual work.
Converter converter = selectSlow(this, type);
e = new Entry(type, converter);
// Save the entry for future selects. This class must be threadsafe,
// but there is no synchronization. Since the hashtable is being used
// as a cache, it is okay to destroy existing entries. This isn't
// likely to occur unless there is a high amount of concurrency. As
// time goes on, cache updates will occur less often, and the cache
// will fill with all the necessary entries.
// Do all updates on a copy: slots in iSelectEntries must not be
// updated by multiple threads as this can allow all null slots to be
// consumed.
entries = (Entry[])entries.clone();
// Add new entry.
entries[index] = e;
// Verify that at least one null slot exists!
for (int i=0; i<length; i++) {
if (entries[i] == null) {
// Found a null slot, swap in new hashtable.
iSelectEntries = entries;
return converter;
}
}
// Double capacity and re-hash.
int newLength = length << 1;
Entry[] newEntries = new Entry[newLength];
for (int i=0; i<length; i++) {
e = entries[i];
type = e.iType;
index = type == null ? 0 : type.hashCode() & (newLength - 1);
while (newEntries[index] != null) {
if (++index >= newLength) {
index = 0;
}
}
newEntries[index] = e;
}
// Swap in new hashtable.
iSelectEntries = newEntries;
return converter;
} }
|
public class class_name {
protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName);
session.endSession();
}
} }
|
public class class_name {
protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName); // depends on control dependency: [if], data = [none]
session.endSession(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean confirmAndResetUsersCredentials(AuthenticationMethodType type) {
ExtensionUserManagement usersExtension = Control.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class);
if (usersExtension == null) {
return true;
}
List<User> users = usersExtension.getSharedContextUsers(getUISharedContext());
if (users.isEmpty()) {
return true;
}
if (users.stream().anyMatch(user -> user.getAuthenticationCredentials().isConfigured())) {
authenticationMethodsComboBox.transferFocus();
int choice = JOptionPane.showConfirmDialog(this,
Constant.messages.getString("authentication.dialog.confirmChange.label"),
Constant.messages.getString("authentication.dialog.confirmChange.title"),
JOptionPane.OK_CANCEL_OPTION);
if (choice == JOptionPane.CANCEL_OPTION) {
return false;
}
}
users.replaceAll(user -> {
User modifiedUser = new User(user.getContextId(), user.getName(), user.getId());
modifiedUser.setEnabled(false);
modifiedUser.setAuthenticationCredentials(type.createAuthenticationCredentials());
return modifiedUser;
});
return true;
} }
|
public class class_name {
private boolean confirmAndResetUsersCredentials(AuthenticationMethodType type) {
ExtensionUserManagement usersExtension = Control.getSingleton().getExtensionLoader().getExtension(ExtensionUserManagement.class);
if (usersExtension == null) {
return true; // depends on control dependency: [if], data = [none]
}
List<User> users = usersExtension.getSharedContextUsers(getUISharedContext());
if (users.isEmpty()) {
return true; // depends on control dependency: [if], data = [none]
}
if (users.stream().anyMatch(user -> user.getAuthenticationCredentials().isConfigured())) {
authenticationMethodsComboBox.transferFocus(); // depends on control dependency: [if], data = [none]
int choice = JOptionPane.showConfirmDialog(this,
Constant.messages.getString("authentication.dialog.confirmChange.label"),
Constant.messages.getString("authentication.dialog.confirmChange.title"),
JOptionPane.OK_CANCEL_OPTION);
if (choice == JOptionPane.CANCEL_OPTION) {
return false; // depends on control dependency: [if], data = [none]
}
}
users.replaceAll(user -> {
User modifiedUser = new User(user.getContextId(), user.getName(), user.getId());
modifiedUser.setEnabled(false);
modifiedUser.setAuthenticationCredentials(type.createAuthenticationCredentials());
return modifiedUser;
});
return true;
} }
|
public class class_name {
private Set<String> getClosureModuleDependencies(JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = new HashSet<>();
if (bundle.getDependencies() != null) {
for (JoinableResourceBundle depBundle : bundle.getDependencies()) {
bundleDependencies.add(depBundle.getName());
}
}
for (String depBundleName : dependencies) {
if (bundle.getInclusionPattern().isGlobal() && depBundleName.equals(bundle.getName())) {
break;
} else {
bundleDependencies.add(depBundleName);
}
}
return bundleDependencies;
} }
|
public class class_name {
private Set<String> getClosureModuleDependencies(JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = new HashSet<>();
if (bundle.getDependencies() != null) {
for (JoinableResourceBundle depBundle : bundle.getDependencies()) {
bundleDependencies.add(depBundle.getName()); // depends on control dependency: [for], data = [depBundle]
}
}
for (String depBundleName : dependencies) {
if (bundle.getInclusionPattern().isGlobal() && depBundleName.equals(bundle.getName())) {
break;
} else {
bundleDependencies.add(depBundleName); // depends on control dependency: [if], data = [none]
}
}
return bundleDependencies;
} }
|
public class class_name {
public String toCSV() {
StringBuilder builder = new StringBuilder();
// Header Row
builder.append(",,Predicted Class,\n");
// Predicted Classes Header Row
builder.append(",,");
for (T predicted : classes) {
builder.append(String.format("%s,", predicted));
}
builder.append("Total\n");
// Data Rows
String firstColumnLabel = "Actual Class,";
for (T actual : classes) {
builder.append(firstColumnLabel);
firstColumnLabel = ",";
builder.append(String.format("%s,", actual));
for (T predicted : classes) {
builder.append(getCount(actual, predicted));
builder.append(",");
}
// Actual Class Totals Column
builder.append(getActualTotal(actual));
builder.append("\n");
}
// Predicted Class Totals Row
builder.append(",Total,");
for (T predicted : classes) {
builder.append(getPredictedTotal(predicted));
builder.append(",");
}
builder.append("\n");
return builder.toString();
} }
|
public class class_name {
public String toCSV() {
StringBuilder builder = new StringBuilder();
// Header Row
builder.append(",,Predicted Class,\n");
// Predicted Classes Header Row
builder.append(",,");
for (T predicted : classes) {
builder.append(String.format("%s,", predicted)); // depends on control dependency: [for], data = [predicted]
}
builder.append("Total\n");
// Data Rows
String firstColumnLabel = "Actual Class,";
for (T actual : classes) {
builder.append(firstColumnLabel); // depends on control dependency: [for], data = [none]
firstColumnLabel = ","; // depends on control dependency: [for], data = [none]
builder.append(String.format("%s,", actual)); // depends on control dependency: [for], data = [actual]
for (T predicted : classes) {
builder.append(getCount(actual, predicted)); // depends on control dependency: [for], data = [predicted]
builder.append(","); // depends on control dependency: [for], data = [none]
}
// Actual Class Totals Column
builder.append(getActualTotal(actual)); // depends on control dependency: [for], data = [actual]
builder.append("\n"); // depends on control dependency: [for], data = [none]
}
// Predicted Class Totals Row
builder.append(",Total,");
for (T predicted : classes) {
builder.append(getPredictedTotal(predicted)); // depends on control dependency: [for], data = [predicted]
builder.append(","); // depends on control dependency: [for], data = [none]
}
builder.append("\n");
return builder.toString();
} }
|
public class class_name {
private Object retainAll(Schema schema, MarkSet markSet, ProtoType type, Object o) {
if (!markSet.contains(type)) {
return null; // Prune this type.
} else if (o instanceof Map) {
ImmutableMap.Builder<ProtoMember, Object> builder = ImmutableMap.builder();
for (Map.Entry<?, ?> entry : ((Map<?, ?>) o).entrySet()) {
ProtoMember protoMember = (ProtoMember) entry.getKey();
if (!markSet.contains(protoMember)) continue; // Prune this field.
Field field = schema.getField(protoMember);
Object retainedValue = retainAll(schema, markSet, field.type(), entry.getValue());
if (retainedValue != null) {
builder.put(protoMember, retainedValue); // This retained field is non-empty.
}
}
ImmutableMap<ProtoMember, Object> map = builder.build();
return !map.isEmpty() ? map : null;
} else if (o instanceof List) {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
for (Object value : ((List) o)) {
Object retainedValue = retainAll(schema, markSet, type, value);
if (retainedValue != null) {
builder.add(retainedValue); // This retained value is non-empty.
}
}
ImmutableList<Object> list = builder.build();
return !list.isEmpty() ? list : null;
} else {
return o;
}
} }
|
public class class_name {
private Object retainAll(Schema schema, MarkSet markSet, ProtoType type, Object o) {
if (!markSet.contains(type)) {
return null; // Prune this type. // depends on control dependency: [if], data = [none]
} else if (o instanceof Map) {
ImmutableMap.Builder<ProtoMember, Object> builder = ImmutableMap.builder();
for (Map.Entry<?, ?> entry : ((Map<?, ?>) o).entrySet()) {
ProtoMember protoMember = (ProtoMember) entry.getKey();
if (!markSet.contains(protoMember)) continue; // Prune this field.
Field field = schema.getField(protoMember);
Object retainedValue = retainAll(schema, markSet, field.type(), entry.getValue());
if (retainedValue != null) {
builder.put(protoMember, retainedValue); // This retained field is non-empty. // depends on control dependency: [if], data = [none]
}
}
ImmutableMap<ProtoMember, Object> map = builder.build();
return !map.isEmpty() ? map : null; // depends on control dependency: [if], data = [none]
} else if (o instanceof List) {
ImmutableList.Builder<Object> builder = ImmutableList.builder();
for (Object value : ((List) o)) {
Object retainedValue = retainAll(schema, markSet, type, value);
if (retainedValue != null) {
builder.add(retainedValue); // This retained value is non-empty. // depends on control dependency: [if], data = [(retainedValue]
}
}
ImmutableList<Object> list = builder.build();
return !list.isEmpty() ? list : null; // depends on control dependency: [if], data = [none]
} else {
return o; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static TransferListener getInstance(String xferId, AsperaTransaction transaction) {
if(instance == null) {
instance = new TransferListener();
}
if(transactions.get(xferId) != null) {
transactions.get(xferId).add(transaction);
} else {
List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>();
transferTransactions.add(transaction);
transactions.put(xferId, transferTransactions);
}
return instance;
} }
|
public class class_name {
public static TransferListener getInstance(String xferId, AsperaTransaction transaction) {
if(instance == null) {
instance = new TransferListener(); // depends on control dependency: [if], data = [none]
}
if(transactions.get(xferId) != null) {
transactions.get(xferId).add(transaction); // depends on control dependency: [if], data = [none]
} else {
List<AsperaTransaction> transferTransactions = new ArrayList<AsperaTransaction>();
transferTransactions.add(transaction); // depends on control dependency: [if], data = [none]
transactions.put(xferId, transferTransactions); // depends on control dependency: [if], data = [none]
}
return instance;
} }
|
public class class_name {
protected void nowReconnectedAsync() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reconnected async for " + this);
}
// reset the data buffers first
if (!resetWriteBuffers()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Resetting buffers (async) failed");
}
// otherwise pass the error along to the channel above us, or close
// the connection if nobody is above
IOException ioe = new IOException("Failed reconnect");
if (null != getAppWriteCallback()) {
getAppWriteCallback().error(getVC(), ioe);
} else {
// nobody above us, just close the connection
getLink().getDeviceLink().close(getVC(), ioe);
}
return;
}
// now that we've reconnected, we should reset the "broken" flag. First
// we set it to the default and then recheck the request msg
setPersistent(true);
updatePersistence(getRequestImpl());
// in case we previously read any partial data, clean out the response
resetRead();
// attempt to write the data
VirtualConnection rc = getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, HttpOSCWriteCallback.getRef(), isForceAsync(), getWriteTimeout());
if (null != rc) {
// if we've finished writing part of a request, let the channel
// above know that it can write more, otherwise start the read
// for the response
if (!isMessageSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling callback.complete of app channel.");
}
getAppWriteCallback().complete(getLink().getVirtualConnection());
} else {
if (isReadAheadEnabled()) {
// after a reconnect, there is no more read-ahead active
this.bReadAheadEnabled = false;
}
// force an async read for the response now. Avoid trying to
// re-use any existing read buffer to skip complexity with
// adjusting for partial reads before the reconnect.
setupJITRead(getHttpConfig().getIncomingHdrBufferSize());
getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), true, getReadTimeout());
}
}
} }
|
public class class_name {
protected void nowReconnectedAsync() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reconnected async for " + this); // depends on control dependency: [if], data = [none]
}
// reset the data buffers first
if (!resetWriteBuffers()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Resetting buffers (async) failed"); // depends on control dependency: [if], data = [none]
}
// otherwise pass the error along to the channel above us, or close
// the connection if nobody is above
IOException ioe = new IOException("Failed reconnect");
if (null != getAppWriteCallback()) {
getAppWriteCallback().error(getVC(), ioe); // depends on control dependency: [if], data = [none]
} else {
// nobody above us, just close the connection
getLink().getDeviceLink().close(getVC(), ioe); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// now that we've reconnected, we should reset the "broken" flag. First
// we set it to the default and then recheck the request msg
setPersistent(true);
updatePersistence(getRequestImpl());
// in case we previously read any partial data, clean out the response
resetRead();
// attempt to write the data
VirtualConnection rc = getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, HttpOSCWriteCallback.getRef(), isForceAsync(), getWriteTimeout());
if (null != rc) {
// if we've finished writing part of a request, let the channel
// above know that it can write more, otherwise start the read
// for the response
if (!isMessageSent()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Calling callback.complete of app channel."); // depends on control dependency: [if], data = [none]
}
getAppWriteCallback().complete(getLink().getVirtualConnection()); // depends on control dependency: [if], data = [none]
} else {
if (isReadAheadEnabled()) {
// after a reconnect, there is no more read-ahead active
this.bReadAheadEnabled = false; // depends on control dependency: [if], data = [none]
}
// force an async read for the response now. Avoid trying to
// re-use any existing read buffer to skip complexity with
// adjusting for partial reads before the reconnect.
setupJITRead(getHttpConfig().getIncomingHdrBufferSize()); // depends on control dependency: [if], data = [none]
getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), true, getReadTimeout()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@NonNull
static Scheduler callRequireNonNull(@NonNull Callable<Scheduler> s) {
try {
return ObjectHelper.requireNonNull(s.call(), "Scheduler Callable result can't be null");
} catch (Throwable ex) {
throw ExceptionHelper.wrapOrThrow(ex);
}
} }
|
public class class_name {
@NonNull
static Scheduler callRequireNonNull(@NonNull Callable<Scheduler> s) {
try {
return ObjectHelper.requireNonNull(s.call(), "Scheduler Callable result can't be null"); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
throw ExceptionHelper.wrapOrThrow(ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<Condition> findConditions(final Column column) {
List<Condition> result = new LinkedList<>();
for (AndCondition each : andConditions) {
result.addAll(Collections2.filter(each.getConditions(), new Predicate<Condition>() {
@Override
public boolean apply(final Condition input) {
return input.getColumn().equals(column);
}
}));
}
return result;
} }
|
public class class_name {
public List<Condition> findConditions(final Column column) {
List<Condition> result = new LinkedList<>();
for (AndCondition each : andConditions) {
result.addAll(Collections2.filter(each.getConditions(), new Predicate<Condition>() {
@Override
public boolean apply(final Condition input) {
return input.getColumn().equals(column);
}
})); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment);
}
}
} }
|
public class class_name {
private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public EClass getIfcOrientedEdge() {
if (ifcOrientedEdgeEClass == null) {
ifcOrientedEdgeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(401);
}
return ifcOrientedEdgeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcOrientedEdge() {
if (ifcOrientedEdgeEClass == null) {
ifcOrientedEdgeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(401);
// depends on control dependency: [if], data = [none]
}
return ifcOrientedEdgeEClass;
} }
|
public class class_name {
@Override
public void write(T record) {
recordConsumer.startMessage();
try {
messageWriter.writeTopLevelMessage(record);
} catch (RuntimeException e) {
Message m = (record instanceof Message.Builder) ? ((Message.Builder) record).build() : (Message) record;
LOG.error("Cannot write message " + e.getMessage() + " : " + m);
throw e;
}
recordConsumer.endMessage();
} }
|
public class class_name {
@Override
public void write(T record) {
recordConsumer.startMessage();
try {
messageWriter.writeTopLevelMessage(record); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
Message m = (record instanceof Message.Builder) ? ((Message.Builder) record).build() : (Message) record;
LOG.error("Cannot write message " + e.getMessage() + " : " + m);
throw e;
} // depends on control dependency: [catch], data = [none]
recordConsumer.endMessage();
} }
|
public class class_name {
public float calculateAirborneTimeAndVelocity (T outVelocity, JumpDescriptor<T> jumpDescriptor, float maxLinearSpeed) {
float g = gravityComponentHandler.getComponent(gravity);
// Calculate the first jump time, see time of flight at http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html
// Notice that the equation has 2 solutions. We'd ideally like to achieve the jump in the fastest time
// possible, so we want to use the smaller of the two values. However, this time value might give us
// an impossible launch velocity (required speed greater than the max), so we need to check and
// use the higher value if necessary.
float sqrtTerm = (float)Math.sqrt(2f * g * gravityComponentHandler.getComponent(jumpDescriptor.delta)
+ maxVerticalVelocity * maxVerticalVelocity);
float time = (-maxVerticalVelocity + sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "1st jump time = " + time);
// Check if we can use it
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
// Otherwise try the other time
time = (-maxVerticalVelocity - sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "2nd jump time = " + time);
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
return -1f; // Unachievable jump
}
}
return time; // Achievable jump
} }
|
public class class_name {
public float calculateAirborneTimeAndVelocity (T outVelocity, JumpDescriptor<T> jumpDescriptor, float maxLinearSpeed) {
float g = gravityComponentHandler.getComponent(gravity);
// Calculate the first jump time, see time of flight at http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html
// Notice that the equation has 2 solutions. We'd ideally like to achieve the jump in the fastest time
// possible, so we want to use the smaller of the two values. However, this time value might give us
// an impossible launch velocity (required speed greater than the max), so we need to check and
// use the higher value if necessary.
float sqrtTerm = (float)Math.sqrt(2f * g * gravityComponentHandler.getComponent(jumpDescriptor.delta)
+ maxVerticalVelocity * maxVerticalVelocity);
float time = (-maxVerticalVelocity + sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "1st jump time = " + time);
// Check if we can use it
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
// Otherwise try the other time
time = (-maxVerticalVelocity - sqrtTerm) / g; // depends on control dependency: [if], data = [none]
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "2nd jump time = " + time);
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
return -1f; // Unachievable jump // depends on control dependency: [if], data = [none]
}
}
return time; // Achievable jump
} }
|
public class class_name {
public static boolean isDirectEditDisabled(ServletRequest request) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(request.getParameter(CmsGwtConstants.PARAM_TEMPLATE_CONTEXT))) {
return true;
}
String disabledParam = request.getParameter(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(disabledParam)) {
return Boolean.parseBoolean(disabledParam);
} else {
HttpSession session = ((HttpServletRequest)request).getSession(false);
Boolean disabledAttr = null == session
? null
: (Boolean)session.getAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
return (disabledAttr != null) && disabledAttr.booleanValue();
}
} }
|
public class class_name {
public static boolean isDirectEditDisabled(ServletRequest request) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(request.getParameter(CmsGwtConstants.PARAM_TEMPLATE_CONTEXT))) {
return true; // depends on control dependency: [if], data = [none]
}
String disabledParam = request.getParameter(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(disabledParam)) {
return Boolean.parseBoolean(disabledParam); // depends on control dependency: [if], data = [none]
} else {
HttpSession session = ((HttpServletRequest)request).getSession(false);
Boolean disabledAttr = null == session
? null
: (Boolean)session.getAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
return (disabledAttr != null) && disabledAttr.booleanValue(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Field getFieldFromClass(String field, Class<? extends Object> clazz) {
try {
return clazz.getDeclaredField(field);
} catch (Exception e) {
try {
return clazz.getField(field);
} catch (Exception ex) {
}
}
return null;
} }
|
public class class_name {
public static Field getFieldFromClass(String field, Class<? extends Object> clazz) {
try {
return clazz.getDeclaredField(field); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
try {
return clazz.getField(field); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public boolean createSchema() {
List<Resource> scripts = getScripts("spring.datasource.schema",
this.properties.getSchema(), "schema");
if (!scripts.isEmpty()) {
if (!isEnabled()) {
logger.debug("Initialization disabled (not running DDL scripts)");
return false;
}
String username = this.properties.getSchemaUsername();
String password = this.properties.getSchemaPassword();
runScripts(scripts, username, password);
}
return !scripts.isEmpty();
} }
|
public class class_name {
public boolean createSchema() {
List<Resource> scripts = getScripts("spring.datasource.schema",
this.properties.getSchema(), "schema");
if (!scripts.isEmpty()) {
if (!isEnabled()) {
logger.debug("Initialization disabled (not running DDL scripts)"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
String username = this.properties.getSchemaUsername();
String password = this.properties.getSchemaPassword();
runScripts(scripts, username, password); // depends on control dependency: [if], data = [none]
}
return !scripts.isEmpty();
} }
|
public class class_name {
public List<ISubmission> omit(List<ISubmission> submissions, ISubmitter submitter){
ArrayList<ISubmission> filteredSubmissions = new ArrayList<ISubmission>();
for (ISubmission submission: submissions){
if (!submission.getSubmitter().equals(submitter)){
filteredSubmissions.add(submission);
}
}
return filteredSubmissions;
} }
|
public class class_name {
public List<ISubmission> omit(List<ISubmission> submissions, ISubmitter submitter){
ArrayList<ISubmission> filteredSubmissions = new ArrayList<ISubmission>();
for (ISubmission submission: submissions){
if (!submission.getSubmitter().equals(submitter)){
filteredSubmissions.add(submission); // depends on control dependency: [if], data = [none]
}
}
return filteredSubmissions;
} }
|
public class class_name {
private static int getAlignment() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
for (String arg : runtimeMxBean.getInputArguments()) {
if (arg.startsWith("-XX:ObjectAlignmentInBytes=")) {
try {
return Integer.parseInt(arg.substring("-XX:ObjectAlignmentInBytes=".length()));
} catch (Exception e){}
}
}
return 8;
} }
|
public class class_name {
private static int getAlignment() {
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
for (String arg : runtimeMxBean.getInputArguments()) {
if (arg.startsWith("-XX:ObjectAlignmentInBytes=")) {
try {
return Integer.parseInt(arg.substring("-XX:ObjectAlignmentInBytes=".length())); // depends on control dependency: [try], data = [none]
} catch (Exception e){} // depends on control dependency: [catch], data = [none]
}
}
return 8;
} }
|
public class class_name {
public static Set<String> getIndexEngines() {
final Set<String> engines = new HashSet<>();
final Iterator<OIndexFactory> ite = getAllFactories();
while (ite.hasNext()) {
engines.addAll(ite.next().getAlgorithms());
}
return engines;
} }
|
public class class_name {
public static Set<String> getIndexEngines() {
final Set<String> engines = new HashSet<>();
final Iterator<OIndexFactory> ite = getAllFactories();
while (ite.hasNext()) {
engines.addAll(ite.next().getAlgorithms()); // depends on control dependency: [while], data = [none]
}
return engines;
} }
|
public class class_name {
private static int getContainerPort(Service service, Annotation... qualifiers) {
for (Annotation q : qualifiers) {
if (q instanceof Port) {
Port port = (Port) q;
if (port.value() > 0) {
return port.value();
}
}
}
ServicePort servicePort = findQualifiedServicePort(service, qualifiers);
if (servicePort != null) {
return servicePort.getTargetPort().getIntVal();
}
return 0;
} }
|
public class class_name {
private static int getContainerPort(Service service, Annotation... qualifiers) {
for (Annotation q : qualifiers) {
if (q instanceof Port) {
Port port = (Port) q;
if (port.value() > 0) {
return port.value(); // depends on control dependency: [if], data = [none]
}
}
}
ServicePort servicePort = findQualifiedServicePort(service, qualifiers);
if (servicePort != null) {
return servicePort.getTargetPort().getIntVal(); // depends on control dependency: [if], data = [none]
}
return 0;
} }
|
public class class_name {
public static String encryptToMD5(String info) {
byte[] digesta = null;
try {
MessageDigest alga = MessageDigest.getInstance("MD5");
alga.update(info.getBytes());
digesta = alga.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
// to string
return byte2hex(digesta);
} }
|
public class class_name {
public static String encryptToMD5(String info) {
byte[] digesta = null;
try {
MessageDigest alga = MessageDigest.getInstance("MD5");
alga.update(info.getBytes()); // depends on control dependency: [try], data = [none]
digesta = alga.digest(); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
// to string
return byte2hex(digesta);
} }
|
public class class_name {
public final synchronized void onHttpCallback(final byte[] message) {
final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT;
while (cmdOutput != null) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime <= 0) {
break;
}
try {
wait(WAIT_TIME);
} catch (final InterruptedException e) {
LOG.log(Level.WARNING, "HttpServeShellCmdHandler onHttpCallback InterruptedException: {0}", e);
}
}
LOG.log(Level.INFO, "HttpServeShellCmdHandler OnCallback: {0}", HttpShellJobDriver.CODEC.decode(message));
cmdOutput = HttpShellJobDriver.CODEC.decode(message);
notify();
} }
|
public class class_name {
public final synchronized void onHttpCallback(final byte[] message) {
final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT;
while (cmdOutput != null) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime <= 0) {
break;
}
try {
wait(WAIT_TIME); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
LOG.log(Level.WARNING, "HttpServeShellCmdHandler onHttpCallback InterruptedException: {0}", e);
} // depends on control dependency: [catch], data = [none]
}
LOG.log(Level.INFO, "HttpServeShellCmdHandler OnCallback: {0}", HttpShellJobDriver.CODEC.decode(message));
cmdOutput = HttpShellJobDriver.CODEC.decode(message);
notify();
} }
|
public class class_name {
@Override
public boolean clientLogicalDeleteByExampleMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
for (ILogicalDeletePluginHook plugin : this.getPlugins(ILogicalDeletePluginHook.class)) {
if (!plugin.clientLogicalDeleteByExampleMethodGenerated(method, interfaze, introspectedTable)) {
return false;
}
}
return true;
} }
|
public class class_name {
@Override
public boolean clientLogicalDeleteByExampleMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
for (ILogicalDeletePluginHook plugin : this.getPlugins(ILogicalDeletePluginHook.class)) {
if (!plugin.clientLogicalDeleteByExampleMethodGenerated(method, interfaze, introspectedTable)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public ReloadableType getReloadableType(String slashedClassname, boolean allocateIdIfNotYetLoaded) {
if (allocateIdIfNotYetLoaded) {
return getReloadableType(getTypeIdFor(slashedClassname, allocateIdIfNotYetLoaded));
}
else {
for (int i = 0; i < reloadableTypesSize; i++) {
ReloadableType rtype = reloadableTypes[i];
if (rtype != null && rtype.getSlashedName().equals(slashedClassname)) {
return rtype;
}
}
return null;
}
} }
|
public class class_name {
public ReloadableType getReloadableType(String slashedClassname, boolean allocateIdIfNotYetLoaded) {
if (allocateIdIfNotYetLoaded) {
return getReloadableType(getTypeIdFor(slashedClassname, allocateIdIfNotYetLoaded)); // depends on control dependency: [if], data = [none]
}
else {
for (int i = 0; i < reloadableTypesSize; i++) {
ReloadableType rtype = reloadableTypes[i];
if (rtype != null && rtype.getSlashedName().equals(slashedClassname)) {
return rtype; // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Table cloneTable()
{
Table ret = null;
try {
ret = (Table) super.clone();
} catch (final CloneNotSupportedException e) {
e.printStackTrace();
}
return ret;
} }
|
public class class_name {
public Table cloneTable()
{
Table ret = null;
try {
ret = (Table) super.clone(); // depends on control dependency: [try], data = [none]
} catch (final CloneNotSupportedException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return ret;
} }
|
public class class_name {
static public List<String> convertLoadpathVariable(Element element) {
// Create the list of strings. Always add the empty string as this will
// force the lookup routine to always include the "current" directory.
LinkedList<String> filelist = new LinkedList<String>();
filelist.add("");
// If the argument is null (the variable doesn't exist), then just
// return the list with the current directory.
if (element == null) {
return filelist;
}
// Verify that the element is of the correct type (i.e. a list).
if (!(element instanceof ListResource)) {
throw new EvaluationException("LOADPATH variable must be a list");
}
// Loop over the values in the list.
ListResource loadpath = (ListResource) element;
for (int i = 0; i < loadpath.size(); i++) {
try {
Element child = loadpath.get(TermFactory.create(i));
if (child instanceof StringProperty) {
String sfile = ((StringProperty) child).getValue();
if (sfile.startsWith("/")) {
throw new EvaluationException(
"LOADPATH can only contain relative paths");
}
filelist.add(sfile);
} else {
throw new EvaluationException(
"LOADPATH contains non-string value");
}
} catch (InvalidTermException ite) {
// This exception should never be encountered because the terms
// are all indexes and the resource is a list.
throw CompilerError.create(MSG_INVALID_KEY_OR_INDEX);
}
}
return filelist;
} }
|
public class class_name {
static public List<String> convertLoadpathVariable(Element element) {
// Create the list of strings. Always add the empty string as this will
// force the lookup routine to always include the "current" directory.
LinkedList<String> filelist = new LinkedList<String>();
filelist.add("");
// If the argument is null (the variable doesn't exist), then just
// return the list with the current directory.
if (element == null) {
return filelist; // depends on control dependency: [if], data = [none]
}
// Verify that the element is of the correct type (i.e. a list).
if (!(element instanceof ListResource)) {
throw new EvaluationException("LOADPATH variable must be a list");
}
// Loop over the values in the list.
ListResource loadpath = (ListResource) element;
for (int i = 0; i < loadpath.size(); i++) {
try {
Element child = loadpath.get(TermFactory.create(i));
if (child instanceof StringProperty) {
String sfile = ((StringProperty) child).getValue();
if (sfile.startsWith("/")) {
throw new EvaluationException(
"LOADPATH can only contain relative paths");
}
filelist.add(sfile); // depends on control dependency: [if], data = [none]
} else {
throw new EvaluationException(
"LOADPATH contains non-string value");
}
} catch (InvalidTermException ite) {
// This exception should never be encountered because the terms
// are all indexes and the resource is a list.
throw CompilerError.create(MSG_INVALID_KEY_OR_INDEX);
} // depends on control dependency: [catch], data = [none]
}
return filelist;
} }
|
public class class_name {
public void marshall(InstanceTypeConfig instanceTypeConfig, ProtocolMarshaller protocolMarshaller) {
if (instanceTypeConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceTypeConfig.getInstanceType(), INSTANCETYPE_BINDING);
protocolMarshaller.marshall(instanceTypeConfig.getWeightedCapacity(), WEIGHTEDCAPACITY_BINDING);
protocolMarshaller.marshall(instanceTypeConfig.getBidPrice(), BIDPRICE_BINDING);
protocolMarshaller.marshall(instanceTypeConfig.getBidPriceAsPercentageOfOnDemandPrice(), BIDPRICEASPERCENTAGEOFONDEMANDPRICE_BINDING);
protocolMarshaller.marshall(instanceTypeConfig.getEbsConfiguration(), EBSCONFIGURATION_BINDING);
protocolMarshaller.marshall(instanceTypeConfig.getConfigurations(), CONFIGURATIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InstanceTypeConfig instanceTypeConfig, ProtocolMarshaller protocolMarshaller) {
if (instanceTypeConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceTypeConfig.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceTypeConfig.getWeightedCapacity(), WEIGHTEDCAPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceTypeConfig.getBidPrice(), BIDPRICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceTypeConfig.getBidPriceAsPercentageOfOnDemandPrice(), BIDPRICEASPERCENTAGEOFONDEMANDPRICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceTypeConfig.getEbsConfiguration(), EBSCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceTypeConfig.getConfigurations(), CONFIGURATIONS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override public FiveNumSummary[] getFiveNumSummary(List<String> columnNames) throws DDFException {
FiveNumSummary[] fivenums = new FiveNumSummary[columnNames.size()];
List<String> numericColumns = new ArrayList<String>();
// Filter non-numeric columns
for (String columnName : columnNames) {
if (ColumnType.isNumeric(this.getDDF().getColumn(columnName).getType())) {
numericColumns.add(columnName);
}
}
String[] rs = null;
if (numericColumns.size() > 0) {
if (this.getDDF().getEngineType().equals(DDFManager.EngineType.SPARK)) {
List<String> specs = Lists.newArrayList();
for (String columnName : columnNames) {
String query = fiveNumHiveFunction(columnName);
if (query != null && query.length() > 0) {
specs.add(query);
}
}
String command = String.format("SELECT %s FROM %%s", StringUtils.join(specs.toArray(new String[0]), ','));
mLog.info(">>>> command = " + command);
// a fivenumsummary of an Int/Long column is in the format "[min, max, 1st_quantile, median, 3rd_quantile]"
// each value can be a NULL
// a fivenumsummary of an Double/Float column is in the format "min \t max \t[1st_quantile, median, 3rd_quantile]"
// or "min \t max \t null"s
rs = this.getDDF()
.sql(command, String.format("Unable to get fivenum summary of the given columns from table %%s")).getRows()
.get(0).replaceAll("\\[|\\]| ", "").replaceAll(",", "\t").split("\t| ");
} else if (this.getDDF().getEngineType().equals(DDFManager.EngineType.POSTGRES)
|| this.getDDF().getEngineType().equals(DDFManager.EngineType.REDSHIFT)) {
rs = new String[numericColumns.size()*5];
int k = 0;
// Need to separately compute each column's five-num values
// Otherwise, combining all into a query will produce incorrect result in Redshift case
// May be due to the nature of its window functions
for(String column: numericColumns) {
String sql = buildPostgresFiveNumSql(column, this.getDDF().getTableName());
String[] ret = this.getDDF().getManager().sql(sql, false).getRows().get(0).split("\t");
System.arraycopy(ret, 0, rs, k, 5);
k += 5;
}
} else {
throw new DDFException("Unsupported engine");
}
}
int k = 0;
for (int i = 0; i < columnNames.size(); i++) {
if (!numericColumns.contains(columnNames.get(i))) {
fivenums[i] = new FiveNumSummary(Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN);
} else {
fivenums[i] = new FiveNumSummary(parseDouble(rs[5 * k]), parseDouble(rs[5 * k + 1]),
parseDouble(rs[5 * k + 2]),
parseDouble(rs[5 * k + 3]), parseDouble(rs[5 * k + 4]));
k++;
}
}
return fivenums;
} }
|
public class class_name {
@Override public FiveNumSummary[] getFiveNumSummary(List<String> columnNames) throws DDFException {
FiveNumSummary[] fivenums = new FiveNumSummary[columnNames.size()];
List<String> numericColumns = new ArrayList<String>();
// Filter non-numeric columns
for (String columnName : columnNames) {
if (ColumnType.isNumeric(this.getDDF().getColumn(columnName).getType())) {
numericColumns.add(columnName); // depends on control dependency: [if], data = [none]
}
}
String[] rs = null;
if (numericColumns.size() > 0) {
if (this.getDDF().getEngineType().equals(DDFManager.EngineType.SPARK)) {
List<String> specs = Lists.newArrayList();
for (String columnName : columnNames) {
String query = fiveNumHiveFunction(columnName);
if (query != null && query.length() > 0) {
specs.add(query); // depends on control dependency: [if], data = [(query]
}
}
String command = String.format("SELECT %s FROM %%s", StringUtils.join(specs.toArray(new String[0]), ','));
mLog.info(">>>> command = " + command);
// a fivenumsummary of an Int/Long column is in the format "[min, max, 1st_quantile, median, 3rd_quantile]"
// each value can be a NULL
// a fivenumsummary of an Double/Float column is in the format "min \t max \t[1st_quantile, median, 3rd_quantile]"
// or "min \t max \t null"s
rs = this.getDDF()
.sql(command, String.format("Unable to get fivenum summary of the given columns from table %%s")).getRows()
.get(0).replaceAll("\\[|\\]| ", "").replaceAll(",", "\t").split("\t| ");
} else if (this.getDDF().getEngineType().equals(DDFManager.EngineType.POSTGRES)
|| this.getDDF().getEngineType().equals(DDFManager.EngineType.REDSHIFT)) {
rs = new String[numericColumns.size()*5];
int k = 0;
// Need to separately compute each column's five-num values
// Otherwise, combining all into a query will produce incorrect result in Redshift case
// May be due to the nature of its window functions
for(String column: numericColumns) {
String sql = buildPostgresFiveNumSql(column, this.getDDF().getTableName());
String[] ret = this.getDDF().getManager().sql(sql, false).getRows().get(0).split("\t");
System.arraycopy(ret, 0, rs, k, 5); // depends on control dependency: [for], data = [none]
k += 5; // depends on control dependency: [for], data = [none]
}
} else {
throw new DDFException("Unsupported engine");
}
}
int k = 0;
for (int i = 0; i < columnNames.size(); i++) {
if (!numericColumns.contains(columnNames.get(i))) {
fivenums[i] = new FiveNumSummary(Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN);
} else {
fivenums[i] = new FiveNumSummary(parseDouble(rs[5 * k]), parseDouble(rs[5 * k + 1]),
parseDouble(rs[5 * k + 2]),
parseDouble(rs[5 * k + 3]), parseDouble(rs[5 * k + 4]));
k++;
}
}
return fivenums;
} }
|
public class class_name {
public boolean allowLargeMessage(long size) {
if (!getConfig().areMessagesLimited()) {
// no limits on messages, so default to yes
return true;
}
if (HttpConfigConstants.UNLIMITED == getConfig().getLargerBufferSize()) {
// no second upper limit, the first is a hard ceiling
// unlimited is the same as not-set
return false;
}
// otherwise compare sizes
if (size > getConfig().getLargerBufferSize()) {
return false;
}
// if the current setting is true, then change it to false for anybody
// else checking and let the last caller in. If it is false, then let
// them know that.
synchronized (this.key) {
if (this.allowLargeMessage) {
this.allowLargeMessage = false;
return true;
}
return false;
}
} }
|
public class class_name {
public boolean allowLargeMessage(long size) {
if (!getConfig().areMessagesLimited()) {
// no limits on messages, so default to yes
return true; // depends on control dependency: [if], data = [none]
}
if (HttpConfigConstants.UNLIMITED == getConfig().getLargerBufferSize()) {
// no second upper limit, the first is a hard ceiling
// unlimited is the same as not-set
return false; // depends on control dependency: [if], data = [none]
}
// otherwise compare sizes
if (size > getConfig().getLargerBufferSize()) {
return false; // depends on control dependency: [if], data = [none]
}
// if the current setting is true, then change it to false for anybody
// else checking and let the last caller in. If it is false, then let
// them know that.
synchronized (this.key) {
if (this.allowLargeMessage) {
this.allowLargeMessage = false; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
<T extends Component> T getComponent (ComponentType componentType) {
int componentTypeIndex = componentType.getIndex();
if (componentTypeIndex < components.getCapacity()) {
return (T)components.get(componentType.getIndex());
} else {
return null;
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
<T extends Component> T getComponent (ComponentType componentType) {
int componentTypeIndex = componentType.getIndex();
if (componentTypeIndex < components.getCapacity()) {
return (T)components.get(componentType.getIndex()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(StopContinuousExportRequest stopContinuousExportRequest, ProtocolMarshaller protocolMarshaller) {
if (stopContinuousExportRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopContinuousExportRequest.getExportId(), EXPORTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StopContinuousExportRequest stopContinuousExportRequest, ProtocolMarshaller protocolMarshaller) {
if (stopContinuousExportRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopContinuousExportRequest.getExportId(), EXPORTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void registerBeans(BeanDefinitionRegistry registry) {
finalizeDeferredProperties();
if (registry instanceof GenericApplicationContext) {
GenericApplicationContext ctx = (GenericApplicationContext) registry;
ctx.setClassLoader(classLoader);
ctx.getBeanFactory().setBeanClassLoader(classLoader);
}
springConfig.registerBeansWithRegistry(registry);
} }
|
public class class_name {
public void registerBeans(BeanDefinitionRegistry registry) {
finalizeDeferredProperties();
if (registry instanceof GenericApplicationContext) {
GenericApplicationContext ctx = (GenericApplicationContext) registry;
ctx.setClassLoader(classLoader); // depends on control dependency: [if], data = [none]
ctx.getBeanFactory().setBeanClassLoader(classLoader); // depends on control dependency: [if], data = [none]
}
springConfig.registerBeansWithRegistry(registry);
} }
|
public class class_name {
public static ObjectInfo getObjectInfo(Class c)
{
ObjectInfo info = cachedClassInfoMap.get(c);
if (info == null)
{
synchronized (c)
{
info = new ObjectInfo(c);
cachedClassInfoMap.put(c, info);
}
}
return info;
} }
|
public class class_name {
public static ObjectInfo getObjectInfo(Class c)
{
ObjectInfo info = cachedClassInfoMap.get(c);
if (info == null)
{
synchronized (c)
// depends on control dependency: [if], data = [none]
{
info = new ObjectInfo(c);
cachedClassInfoMap.put(c, info);
}
}
return info;
} }
|
public class class_name {
@Override
public Object unMarshall(Response<DeleteResponse> response, Class<?> entity) {
try {
consume(response.getResult());
return statusMessage;
} catch (Exception e) {
throw new MappingException(e);
}
} }
|
public class class_name {
@Override
public Object unMarshall(Response<DeleteResponse> response, Class<?> entity) {
try {
consume(response.getResult()); // depends on control dependency: [try], data = [none]
return statusMessage; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new MappingException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ResourceConfiguration deserialize(final File pFile, final String pResource)
throws TTIOException {
try {
final File file =
new File(new File(new File(pFile, StorageConfiguration.Paths.Data.getFile().getName()),
pResource), Paths.ConfigBinary.getFile().getName());
FileReader fileReader = new FileReader(file);
JsonReader jsonReader = new JsonReader(fileReader);
jsonReader.beginObject();
// caring about the kind of the metabucket
jsonReader.nextName().equals(JSONNAMES[0]);
Class<?> metaBucketClazz = Class.forName(jsonReader.nextString());
// caring about the versioning
jsonReader.nextName().equals(JSONNAMES[1]);
Class<?> revClazz = Class.forName(jsonReader.nextString());
// caring about the DataFactory
jsonReader.nextName().equals(JSONNAMES[2]);
Class<?> dataFacClazz = Class.forName(jsonReader.nextString());
// caring about the ByteHandlers
List<IByteHandler> handlerList = new ArrayList<IByteHandler>();
if (jsonReader.nextName().equals(JSONNAMES[3])) {
jsonReader.beginArray();
while (jsonReader.hasNext()) {
Class<?> handlerClazz = Class.forName(jsonReader.nextString());
Constructor<?> handlerCons = handlerClazz.getConstructors()[0];
if (handlerClazz.getName().equals(Encryptor.class.getName())) {
handlerList.add((IByteHandler)handlerCons.newInstance(StandardSettings.KEY));
} else {
handlerList.add((IByteHandler)handlerCons.newInstance());
}
}
jsonReader.endArray();
}
ByteHandlerPipeline pipeline =
new ByteHandlerPipeline(handlerList.toArray(new IByteHandler[handlerList.size()]));
// caring about the storage
jsonReader.nextName().equals(JSONNAMES[4]);
Class<?> storageClazz = Class.forName(jsonReader.nextString());
jsonReader.nextName().equals(JSONNAMES[5]);
Properties props = new Properties();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
props.setProperty(jsonReader.nextName(), jsonReader.nextString());
}
jsonReader.endObject();
jsonReader.endObject();
jsonReader.close();
fileReader.close();
Constructor<?> metaBucketCons = metaBucketClazz.getConstructors()[0];
IMetaEntryFactory metaFac = (IMetaEntryFactory)metaBucketCons.newInstance();
Constructor<?> dataFacCons = dataFacClazz.getConstructors()[0];
IDataFactory dataFactory = (IDataFactory)dataFacCons.newInstance();
Constructor<?> revCons = revClazz.getConstructors()[0];
IRevisioning revObject = (IRevisioning)revCons.newInstance();
Constructor<?> storageCons = storageClazz.getConstructors()[0];
IBackend backend = (IBackend)storageCons.newInstance(props, dataFactory, metaFac, pipeline);
return new ResourceConfiguration(props, backend, revObject, dataFactory, metaFac);
} catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
| InvocationTargetException exc) {
throw new TTIOException(exc);
}
} }
|
public class class_name {
public static ResourceConfiguration deserialize(final File pFile, final String pResource)
throws TTIOException {
try {
final File file =
new File(new File(new File(pFile, StorageConfiguration.Paths.Data.getFile().getName()),
pResource), Paths.ConfigBinary.getFile().getName());
FileReader fileReader = new FileReader(file);
JsonReader jsonReader = new JsonReader(fileReader);
jsonReader.beginObject();
// caring about the kind of the metabucket
jsonReader.nextName().equals(JSONNAMES[0]);
Class<?> metaBucketClazz = Class.forName(jsonReader.nextString());
// caring about the versioning
jsonReader.nextName().equals(JSONNAMES[1]);
Class<?> revClazz = Class.forName(jsonReader.nextString());
// caring about the DataFactory
jsonReader.nextName().equals(JSONNAMES[2]);
Class<?> dataFacClazz = Class.forName(jsonReader.nextString());
// caring about the ByteHandlers
List<IByteHandler> handlerList = new ArrayList<IByteHandler>();
if (jsonReader.nextName().equals(JSONNAMES[3])) {
jsonReader.beginArray();
while (jsonReader.hasNext()) {
Class<?> handlerClazz = Class.forName(jsonReader.nextString());
Constructor<?> handlerCons = handlerClazz.getConstructors()[0];
if (handlerClazz.getName().equals(Encryptor.class.getName())) {
handlerList.add((IByteHandler)handlerCons.newInstance(StandardSettings.KEY));
} else {
handlerList.add((IByteHandler)handlerCons.newInstance());
}
}
jsonReader.endArray();
}
ByteHandlerPipeline pipeline =
new ByteHandlerPipeline(handlerList.toArray(new IByteHandler[handlerList.size()]));
// caring about the storage
jsonReader.nextName().equals(JSONNAMES[4]);
Class<?> storageClazz = Class.forName(jsonReader.nextString());
jsonReader.nextName().equals(JSONNAMES[5]); // depends on control dependency: [while], data = [none]
Properties props = new Properties();
jsonReader.beginObject(); // depends on control dependency: [while], data = [none]
while (jsonReader.hasNext()) {
props.setProperty(jsonReader.nextName(), jsonReader.nextString()); // depends on control dependency: [while], data = [none]
}
jsonReader.endObject(); // depends on control dependency: [while], data = [none]
jsonReader.endObject(); // depends on control dependency: [while], data = [none]
jsonReader.close(); // depends on control dependency: [while], data = [none]
fileReader.close(); // depends on control dependency: [while], data = [none]
Constructor<?> metaBucketCons = metaBucketClazz.getConstructors()[0];
IMetaEntryFactory metaFac = (IMetaEntryFactory)metaBucketCons.newInstance();
Constructor<?> dataFacCons = dataFacClazz.getConstructors()[0];
IDataFactory dataFactory = (IDataFactory)dataFacCons.newInstance();
Constructor<?> revCons = revClazz.getConstructors()[0];
IRevisioning revObject = (IRevisioning)revCons.newInstance();
Constructor<?> storageCons = storageClazz.getConstructors()[0];
IBackend backend = (IBackend)storageCons.newInstance(props, dataFactory, metaFac, pipeline);
return new ResourceConfiguration(props, backend, revObject, dataFactory, metaFac); // depends on control dependency: [while], data = [none]
} catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
| InvocationTargetException exc) {
throw new TTIOException(exc);
}
} }
|
public class class_name {
protected void writeParamsEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
boolean isPrepared = execInfo.getStatementType() == StatementType.PREPARED;
sb.append("Params:[");
for (QueryInfo queryInfo : queryInfoList) {
for (List<ParameterSetOperation> parameters : queryInfo.getParametersList()) {
SortedMap<String, String> paramMap = getParametersToDisplay(parameters);
// parameters per batch.
// for prepared: (val1,val2,...)
// for callable: (key1=val1,key2=val2,...)
if (isPrepared) {
writeParamsForSinglePreparedEntry(sb, paramMap, execInfo, queryInfoList);
} else {
writeParamsForSingleCallableEntry(sb, paramMap, execInfo, queryInfoList);
}
}
}
chompIfEndWith(sb, ',');
sb.append("]");
} }
|
public class class_name {
protected void writeParamsEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
boolean isPrepared = execInfo.getStatementType() == StatementType.PREPARED;
sb.append("Params:[");
for (QueryInfo queryInfo : queryInfoList) {
for (List<ParameterSetOperation> parameters : queryInfo.getParametersList()) {
SortedMap<String, String> paramMap = getParametersToDisplay(parameters);
// parameters per batch.
// for prepared: (val1,val2,...)
// for callable: (key1=val1,key2=val2,...)
if (isPrepared) {
writeParamsForSinglePreparedEntry(sb, paramMap, execInfo, queryInfoList); // depends on control dependency: [if], data = [none]
} else {
writeParamsForSingleCallableEntry(sb, paramMap, execInfo, queryInfoList); // depends on control dependency: [if], data = [none]
}
}
}
chompIfEndWith(sb, ',');
sb.append("]");
} }
|
public class class_name {
public void addListeners()
{
super.addListeners();
if (this.isContactDisplay())
{
ReferenceField field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID);
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageInfoType.REQUEST));
field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID);
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageType.MESSAGE_OUT));
field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID);
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageStatus.SENT));
}
this.getMainRecord().getKeyArea().setKeyOrder(DBConstants.DESCENDING);
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_TYPE), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE).addListener(new FieldReSelectHandler(this));
this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_INFO_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_STATUS_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TRANSPORT_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.USER_ID), this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE), CompareFileFilter.GREATER_THAN_EQUAL, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE), CompareFileFilter.LESS_THAN_EQUAL, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE).addListener(new FieldReSelectHandler(this));
this.setEditing(false);
} }
|
public class class_name {
public void addListeners()
{
super.addListeners();
if (this.isContactDisplay())
{
ReferenceField field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID);
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageInfoType.REQUEST)); // depends on control dependency: [if], data = [none]
field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID); // depends on control dependency: [if], data = [none]
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageType.MESSAGE_OUT)); // depends on control dependency: [if], data = [none]
field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID); // depends on control dependency: [if], data = [none]
field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageStatus.SENT)); // depends on control dependency: [if], data = [none]
}
this.getMainRecord().getKeyArea().setKeyOrder(DBConstants.DESCENDING);
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_TYPE), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE).addListener(new FieldReSelectHandler(this));
this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_INFO_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_STATUS_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TRANSPORT_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.USER_ID), this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID), DBConstants.EQUALS, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE), CompareFileFilter.GREATER_THAN_EQUAL, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this));
this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE), CompareFileFilter.LESS_THAN_EQUAL, null, true));
this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE).addListener(new FieldReSelectHandler(this));
this.setEditing(false);
} }
|
public class class_name {
@Override
public void onThreadBegin()
{
_threadCount.incrementAndGet();
int startCount = _startingCount.decrementAndGet();
if (startCount < 0) {
_startingCount.set(0);
new IllegalStateException().printStackTrace();
}
_createCountTotal.incrementAndGet();
update();
} }
|
public class class_name {
@Override
public void onThreadBegin()
{
_threadCount.incrementAndGet();
int startCount = _startingCount.decrementAndGet();
if (startCount < 0) {
_startingCount.set(0); // depends on control dependency: [if], data = [0)]
new IllegalStateException().printStackTrace(); // depends on control dependency: [if], data = [none]
}
_createCountTotal.incrementAndGet();
update();
} }
|
public class class_name {
@Override
public void removeSession(String sessionId) {
logger.debug("removeSession({}) in Local DataSource", sessionId);
if (this.localDataSource.exists(sessionId)) {
this.localDataSource.removeSession(sessionId);
}
else if (!this.localMode && this.existReplicated(sessionId)) {
// FIXME: remove node.
}
} }
|
public class class_name {
@Override
public void removeSession(String sessionId) {
logger.debug("removeSession({}) in Local DataSource", sessionId);
if (this.localDataSource.exists(sessionId)) {
this.localDataSource.removeSession(sessionId);
// depends on control dependency: [if], data = [none]
}
else if (!this.localMode && this.existReplicated(sessionId)) {
// FIXME: remove node.
}
} }
|
public class class_name {
public java.util.List<Shard> getShards() {
if (shards == null) {
shards = new com.amazonaws.internal.SdkInternalList<Shard>();
}
return shards;
} }
|
public class class_name {
public java.util.List<Shard> getShards() {
if (shards == null) {
shards = new com.amazonaws.internal.SdkInternalList<Shard>(); // depends on control dependency: [if], data = [none]
}
return shards;
} }
|
public class class_name {
public StoredProcedureParameter<NamedStoredProcedureQuery<T>> getOrCreateParameter()
{
List<Node> nodeList = childNode.get("parameter");
if (nodeList != null && nodeList.size() > 0)
{
return new StoredProcedureParameterImpl<NamedStoredProcedureQuery<T>>(this, "parameter", childNode, nodeList.get(0));
}
return createParameter();
} }
|
public class class_name {
public StoredProcedureParameter<NamedStoredProcedureQuery<T>> getOrCreateParameter()
{
List<Node> nodeList = childNode.get("parameter");
if (nodeList != null && nodeList.size() > 0)
{
return new StoredProcedureParameterImpl<NamedStoredProcedureQuery<T>>(this, "parameter", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createParameter();
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.