code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public Font getFont(Properties attributes) {
String fontname = null;
String encoding = defaultEncoding;
boolean embedded = defaultEmbedding;
float size = Font.UNDEFINED;
int style = Font.NORMAL;
Color color = null;
String value = attributes.getProperty(Markup.HTML_ATTR_STYLE);
if (value != null && value.length() > 0) {
Properties styleAttributes = Markup.parseAttributes(value);
if (styleAttributes.isEmpty()) {
attributes.put(Markup.HTML_ATTR_STYLE, value);
}
else {
fontname = styleAttributes.getProperty(Markup.CSS_KEY_FONTFAMILY);
if (fontname != null) {
String tmp;
while (fontname.indexOf(',') != -1) {
tmp = fontname.substring(0, fontname.indexOf(','));
if (isRegistered(tmp)) {
fontname = tmp;
}
else {
fontname = fontname.substring(fontname.indexOf(',') + 1);
}
}
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSIZE)) != null) {
size = Markup.parseLength(value);
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTWEIGHT)) != null) {
style |= Font.getStyleValue(value);
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSTYLE)) != null) {
style |= Font.getStyleValue(value);
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_COLOR)) != null) {
color = Markup.decodeColor(value);
}
attributes.putAll(styleAttributes);
for (Enumeration e = styleAttributes.keys(); e.hasMoreElements();) {
Object o = e.nextElement();
attributes.put(o, styleAttributes.get(o));
}
}
}
if ((value = attributes.getProperty(ElementTags.ENCODING)) != null) {
encoding = value;
}
if ("true".equals(attributes.getProperty(ElementTags.EMBEDDED))) {
embedded = true;
}
if ((value = attributes.getProperty(ElementTags.FONT)) != null) {
fontname = value;
}
if ((value = attributes.getProperty(ElementTags.SIZE)) != null) {
size = Markup.parseLength(value);
}
if ((value = attributes.getProperty(Markup.HTML_ATTR_STYLE)) != null) {
style |= Font.getStyleValue(value);
}
if ((value = attributes.getProperty(ElementTags.STYLE)) != null) {
style |= Font.getStyleValue(value);
}
String r = attributes.getProperty(ElementTags.RED);
String g = attributes.getProperty(ElementTags.GREEN);
String b = attributes.getProperty(ElementTags.BLUE);
if (r != null || g != null || b != null) {
int red = 0;
int green = 0;
int blue = 0;
if (r != null) red = Integer.parseInt(r);
if (g != null) green = Integer.parseInt(g);
if (b != null) blue = Integer.parseInt(b);
color = new Color(red, green, blue);
}
else if ((value = attributes.getProperty(ElementTags.COLOR)) != null) {
color = Markup.decodeColor(value);
}
if (fontname == null) {
return getFont(null, encoding, embedded, size, style, color);
}
return getFont(fontname, encoding, embedded, size, style, color);
} } | public class class_name {
public Font getFont(Properties attributes) {
String fontname = null;
String encoding = defaultEncoding;
boolean embedded = defaultEmbedding;
float size = Font.UNDEFINED;
int style = Font.NORMAL;
Color color = null;
String value = attributes.getProperty(Markup.HTML_ATTR_STYLE);
if (value != null && value.length() > 0) {
Properties styleAttributes = Markup.parseAttributes(value);
if (styleAttributes.isEmpty()) {
attributes.put(Markup.HTML_ATTR_STYLE, value); // depends on control dependency: [if], data = [none]
}
else {
fontname = styleAttributes.getProperty(Markup.CSS_KEY_FONTFAMILY); // depends on control dependency: [if], data = [none]
if (fontname != null) {
String tmp;
while (fontname.indexOf(',') != -1) {
tmp = fontname.substring(0, fontname.indexOf(',')); // depends on control dependency: [while], data = [none]
if (isRegistered(tmp)) {
fontname = tmp; // depends on control dependency: [if], data = [none]
}
else {
fontname = fontname.substring(fontname.indexOf(',') + 1); // depends on control dependency: [if], data = [none]
}
}
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSIZE)) != null) {
size = Markup.parseLength(value); // depends on control dependency: [if], data = [none]
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTWEIGHT)) != null) {
style |= Font.getStyleValue(value); // depends on control dependency: [if], data = [none]
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_FONTSTYLE)) != null) {
style |= Font.getStyleValue(value); // depends on control dependency: [if], data = [none]
}
if ((value = styleAttributes.getProperty(Markup.CSS_KEY_COLOR)) != null) {
color = Markup.decodeColor(value); // depends on control dependency: [if], data = [none]
}
attributes.putAll(styleAttributes); // depends on control dependency: [if], data = [none]
for (Enumeration e = styleAttributes.keys(); e.hasMoreElements();) {
Object o = e.nextElement();
attributes.put(o, styleAttributes.get(o)); // depends on control dependency: [for], data = [none]
}
}
}
if ((value = attributes.getProperty(ElementTags.ENCODING)) != null) {
encoding = value; // depends on control dependency: [if], data = [none]
}
if ("true".equals(attributes.getProperty(ElementTags.EMBEDDED))) {
embedded = true; // depends on control dependency: [if], data = [none]
}
if ((value = attributes.getProperty(ElementTags.FONT)) != null) {
fontname = value; // depends on control dependency: [if], data = [none]
}
if ((value = attributes.getProperty(ElementTags.SIZE)) != null) {
size = Markup.parseLength(value); // depends on control dependency: [if], data = [none]
}
if ((value = attributes.getProperty(Markup.HTML_ATTR_STYLE)) != null) {
style |= Font.getStyleValue(value); // depends on control dependency: [if], data = [none]
}
if ((value = attributes.getProperty(ElementTags.STYLE)) != null) {
style |= Font.getStyleValue(value); // depends on control dependency: [if], data = [none]
}
String r = attributes.getProperty(ElementTags.RED);
String g = attributes.getProperty(ElementTags.GREEN);
String b = attributes.getProperty(ElementTags.BLUE);
if (r != null || g != null || b != null) {
int red = 0;
int green = 0;
int blue = 0;
if (r != null) red = Integer.parseInt(r);
if (g != null) green = Integer.parseInt(g);
if (b != null) blue = Integer.parseInt(b);
color = new Color(red, green, blue); // depends on control dependency: [if], data = [(r]
}
else if ((value = attributes.getProperty(ElementTags.COLOR)) != null) {
color = Markup.decodeColor(value); // depends on control dependency: [if], data = [none]
}
if (fontname == null) {
return getFont(null, encoding, embedded, size, style, color); // depends on control dependency: [if], data = [none]
}
return getFont(fontname, encoding, embedded, size, style, color);
} } |
public class class_name {
public static void main(String[] args)
{
if (args.length != 1)
{
System.out.println("\nUse Parameter: path (to biopax OWL files)\n");
System.exit(-1);
}
BioPAXIOHandler reader = new SimpleIOHandler();
final String pathname = args[0];
File testDir = new File(pathname);
/*
* Customized Fetcher is to fix the issue with Level2
* - when NEXT-STEP leads out of the pathway...
* (do not worry - those pathway steps that are part of
* the pathway must be in the PATHWAY-COMPONENTS set)
*/
Filter<PropertyEditor> nextStepPropertyFilter = new Filter<PropertyEditor>()
{
public boolean filter(PropertyEditor editor)
{
return !editor.getProperty().equals("NEXT-STEP");
}
};
fetcher = new Fetcher(SimpleEditorMap.L2, nextStepPropertyFilter);
FilenameFilter filter = new FilenameFilter()
{
public boolean accept(File dir, String name)
{
return (name.endsWith("owl"));
}
};
for (String s : testDir.list(filter))
{
try
{
process(pathname, s, reader);
}
catch (Exception e)
{
log.error("Failed at testing " + s, e);
}
}
} } | public class class_name {
public static void main(String[] args)
{
if (args.length != 1)
{
System.out.println("\nUse Parameter: path (to biopax OWL files)\n"); // depends on control dependency: [if], data = [none]
System.exit(-1); // depends on control dependency: [if], data = [1)]
}
BioPAXIOHandler reader = new SimpleIOHandler();
final String pathname = args[0];
File testDir = new File(pathname);
/*
* Customized Fetcher is to fix the issue with Level2
* - when NEXT-STEP leads out of the pathway...
* (do not worry - those pathway steps that are part of
* the pathway must be in the PATHWAY-COMPONENTS set)
*/
Filter<PropertyEditor> nextStepPropertyFilter = new Filter<PropertyEditor>()
{
public boolean filter(PropertyEditor editor)
{
return !editor.getProperty().equals("NEXT-STEP");
}
};
fetcher = new Fetcher(SimpleEditorMap.L2, nextStepPropertyFilter);
FilenameFilter filter = new FilenameFilter()
{
public boolean accept(File dir, String name)
{
return (name.endsWith("owl"));
}
};
for (String s : testDir.list(filter))
{
try
{
process(pathname, s, reader); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error("Failed at testing " + s, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
void broadcast(ClusterConfiguration config) {
Message vote = voteInfo.toMessage();
for (String server : config.getPeers()) {
this.transport.send(server, vote);
}
} } | public class class_name {
void broadcast(ClusterConfiguration config) {
Message vote = voteInfo.toMessage();
for (String server : config.getPeers()) {
this.transport.send(server, vote); // depends on control dependency: [for], data = [server]
}
} } |
public class class_name {
private void createTermDefinition(Map<String, Object> context, String term,
Map<String, Boolean> defined) throws JsonLdError {
if (defined.containsKey(term)) {
if (Boolean.TRUE.equals(defined.get(term))) {
return;
}
throw new JsonLdError(Error.CYCLIC_IRI_MAPPING, term);
}
defined.put(term, false);
if (JsonLdUtils.isKeyword(term)
&& !(options.getAllowContainerSetOnType() && JsonLdConsts.TYPE.equals(term)
&& !(context.get(term)).toString().contains(JsonLdConsts.ID))) {
throw new JsonLdError(Error.KEYWORD_REDEFINITION, term);
}
this.termDefinitions.remove(term);
Object value = context.get(term);
if (value == null || (value instanceof Map
&& ((Map<String, Object>) value).containsKey(JsonLdConsts.ID)
&& ((Map<String, Object>) value).get(JsonLdConsts.ID) == null)) {
this.termDefinitions.put(term, null);
defined.put(term, true);
return;
}
if (value instanceof String) {
value = newMap(JsonLdConsts.ID, value);
}
if (!(value instanceof Map)) {
throw new JsonLdError(Error.INVALID_TERM_DEFINITION, value);
}
// casting the value so it doesn't have to be done below everytime
final Map<String, Object> val = (Map<String, Object>) value;
// 9) create a new term definition
final Map<String, Object> definition = newMap();
// 10)
if (val.containsKey(JsonLdConsts.TYPE)) {
if (!(val.get(JsonLdConsts.TYPE) instanceof String)) {
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, val.get(JsonLdConsts.TYPE));
}
String type = (String) val.get(JsonLdConsts.TYPE);
try {
type = this.expandIri((String) val.get(JsonLdConsts.TYPE), false, true, context,
defined);
} catch (final JsonLdError error) {
if (error.getType() != Error.INVALID_IRI_MAPPING) {
throw error;
}
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type, error);
}
// TODO: fix check for absoluteIri (blank nodes shouldn't count, at
// least not here!)
if (JsonLdConsts.ID.equals(type) || JsonLdConsts.VOCAB.equals(type)
|| (!type.startsWith(JsonLdConsts.BLANK_NODE_PREFIX)
&& JsonLdUtils.isAbsoluteIri(type))) {
definition.put(JsonLdConsts.TYPE, type);
} else {
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type);
}
}
// 11)
if (val.containsKey(JsonLdConsts.REVERSE)) {
if (val.containsKey(JsonLdConsts.ID)) {
throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY, val);
}
if (!(val.get(JsonLdConsts.REVERSE) instanceof String)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"Expected String for @reverse value. got "
+ (val.get(JsonLdConsts.REVERSE) == null ? "null"
: val.get(JsonLdConsts.REVERSE).getClass()));
}
final String reverse = this.expandIri((String) val.get(JsonLdConsts.REVERSE), false,
true, context, defined);
if (!JsonLdUtils.isAbsoluteIri(reverse)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"Non-absolute @reverse IRI: " + reverse);
}
definition.put(JsonLdConsts.ID, reverse);
if (val.containsKey(JsonLdConsts.CONTAINER)) {
final String container = (String) val.get(JsonLdConsts.CONTAINER);
if (container == null || JsonLdConsts.SET.equals(container)
|| JsonLdConsts.INDEX.equals(container)) {
definition.put(JsonLdConsts.CONTAINER, container);
} else {
throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY,
"reverse properties only support set- and index-containers");
}
}
definition.put(JsonLdConsts.REVERSE, true);
this.termDefinitions.put(term, definition);
defined.put(term, true);
return;
}
// 12)
definition.put(JsonLdConsts.REVERSE, false);
// 13)
if (val.get(JsonLdConsts.ID) != null && !term.equals(val.get(JsonLdConsts.ID))) {
if (!(val.get(JsonLdConsts.ID) instanceof String)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"expected value of @id to be a string");
}
final String res = this.expandIri((String) val.get(JsonLdConsts.ID), false, true,
context, defined);
if (JsonLdUtils.isKeyword(res) || JsonLdUtils.isAbsoluteIri(res)) {
if (JsonLdConsts.CONTEXT.equals(res)) {
throw new JsonLdError(Error.INVALID_KEYWORD_ALIAS, "cannot alias @context");
}
definition.put(JsonLdConsts.ID, res);
} else {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"resulting IRI mapping should be a keyword, absolute IRI or blank node");
}
}
// 14)
else if (term.indexOf(":") >= 0) {
final int colIndex = term.indexOf(":");
final String prefix = term.substring(0, colIndex);
final String suffix = term.substring(colIndex + 1);
if (context.containsKey(prefix)) {
this.createTermDefinition(context, prefix, defined);
}
if (termDefinitions.containsKey(prefix)) {
definition.put(JsonLdConsts.ID,
((Map<String, Object>) termDefinitions.get(prefix)).get(JsonLdConsts.ID)
+ suffix);
} else {
definition.put(JsonLdConsts.ID, term);
}
// 15)
} else if (this.containsKey(JsonLdConsts.VOCAB)) {
definition.put(JsonLdConsts.ID, this.get(JsonLdConsts.VOCAB) + term);
} else if (!JsonLdConsts.TYPE.equals(term)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"relative term definition without vocab mapping");
}
// 16)
if (val.containsKey(JsonLdConsts.CONTAINER)) {
final String container = (String) val.get(JsonLdConsts.CONTAINER);
if (!JsonLdConsts.LIST.equals(container) && !JsonLdConsts.SET.equals(container)
&& !JsonLdConsts.INDEX.equals(container)
&& !JsonLdConsts.LANGUAGE.equals(container)) {
throw new JsonLdError(Error.INVALID_CONTAINER_MAPPING,
"@container must be either @list, @set, @index, or @language");
}
definition.put(JsonLdConsts.CONTAINER, container);
if (JsonLdConsts.TYPE.equals(term)) {
definition.put(JsonLdConsts.ID, "type");
}
}
// 17)
if (val.containsKey(JsonLdConsts.LANGUAGE) && !val.containsKey(JsonLdConsts.TYPE)) {
if (val.get(JsonLdConsts.LANGUAGE) == null
|| val.get(JsonLdConsts.LANGUAGE) instanceof String) {
final String language = (String) val.get(JsonLdConsts.LANGUAGE);
definition.put(JsonLdConsts.LANGUAGE,
language != null ? language.toLowerCase() : null);
} else {
throw new JsonLdError(Error.INVALID_LANGUAGE_MAPPING,
"@language must be a string or null");
}
}
// 18)
this.termDefinitions.put(term, definition);
defined.put(term, true);
} } | public class class_name {
private void createTermDefinition(Map<String, Object> context, String term,
Map<String, Boolean> defined) throws JsonLdError {
if (defined.containsKey(term)) {
if (Boolean.TRUE.equals(defined.get(term))) {
return; // depends on control dependency: [if], data = [none]
}
throw new JsonLdError(Error.CYCLIC_IRI_MAPPING, term);
}
defined.put(term, false);
if (JsonLdUtils.isKeyword(term)
&& !(options.getAllowContainerSetOnType() && JsonLdConsts.TYPE.equals(term)
&& !(context.get(term)).toString().contains(JsonLdConsts.ID))) {
throw new JsonLdError(Error.KEYWORD_REDEFINITION, term);
}
this.termDefinitions.remove(term);
Object value = context.get(term);
if (value == null || (value instanceof Map
&& ((Map<String, Object>) value).containsKey(JsonLdConsts.ID)
&& ((Map<String, Object>) value).get(JsonLdConsts.ID) == null)) {
this.termDefinitions.put(term, null);
defined.put(term, true);
return;
}
if (value instanceof String) {
value = newMap(JsonLdConsts.ID, value);
}
if (!(value instanceof Map)) {
throw new JsonLdError(Error.INVALID_TERM_DEFINITION, value);
}
// casting the value so it doesn't have to be done below everytime
final Map<String, Object> val = (Map<String, Object>) value;
// 9) create a new term definition
final Map<String, Object> definition = newMap();
// 10)
if (val.containsKey(JsonLdConsts.TYPE)) {
if (!(val.get(JsonLdConsts.TYPE) instanceof String)) {
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, val.get(JsonLdConsts.TYPE));
}
String type = (String) val.get(JsonLdConsts.TYPE);
try {
type = this.expandIri((String) val.get(JsonLdConsts.TYPE), false, true, context,
defined); // depends on control dependency: [try], data = [none]
} catch (final JsonLdError error) {
if (error.getType() != Error.INVALID_IRI_MAPPING) {
throw error;
}
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type, error);
} // depends on control dependency: [catch], data = [none]
// TODO: fix check for absoluteIri (blank nodes shouldn't count, at
// least not here!)
if (JsonLdConsts.ID.equals(type) || JsonLdConsts.VOCAB.equals(type)
|| (!type.startsWith(JsonLdConsts.BLANK_NODE_PREFIX)
&& JsonLdUtils.isAbsoluteIri(type))) {
definition.put(JsonLdConsts.TYPE, type); // depends on control dependency: [if], data = [none]
} else {
throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type);
}
}
// 11)
if (val.containsKey(JsonLdConsts.REVERSE)) {
if (val.containsKey(JsonLdConsts.ID)) {
throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY, val);
}
if (!(val.get(JsonLdConsts.REVERSE) instanceof String)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"Expected String for @reverse value. got "
+ (val.get(JsonLdConsts.REVERSE) == null ? "null"
: val.get(JsonLdConsts.REVERSE).getClass()));
}
final String reverse = this.expandIri((String) val.get(JsonLdConsts.REVERSE), false,
true, context, defined);
if (!JsonLdUtils.isAbsoluteIri(reverse)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"Non-absolute @reverse IRI: " + reverse);
}
definition.put(JsonLdConsts.ID, reverse);
if (val.containsKey(JsonLdConsts.CONTAINER)) {
final String container = (String) val.get(JsonLdConsts.CONTAINER);
if (container == null || JsonLdConsts.SET.equals(container)
|| JsonLdConsts.INDEX.equals(container)) {
definition.put(JsonLdConsts.CONTAINER, container); // depends on control dependency: [if], data = [none]
} else {
throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY,
"reverse properties only support set- and index-containers");
}
}
definition.put(JsonLdConsts.REVERSE, true);
this.termDefinitions.put(term, definition);
defined.put(term, true);
return;
}
// 12)
definition.put(JsonLdConsts.REVERSE, false);
// 13)
if (val.get(JsonLdConsts.ID) != null && !term.equals(val.get(JsonLdConsts.ID))) {
if (!(val.get(JsonLdConsts.ID) instanceof String)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"expected value of @id to be a string");
}
final String res = this.expandIri((String) val.get(JsonLdConsts.ID), false, true,
context, defined);
if (JsonLdUtils.isKeyword(res) || JsonLdUtils.isAbsoluteIri(res)) {
if (JsonLdConsts.CONTEXT.equals(res)) {
throw new JsonLdError(Error.INVALID_KEYWORD_ALIAS, "cannot alias @context");
}
definition.put(JsonLdConsts.ID, res); // depends on control dependency: [if], data = [none]
} else {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"resulting IRI mapping should be a keyword, absolute IRI or blank node");
}
}
// 14)
else if (term.indexOf(":") >= 0) {
final int colIndex = term.indexOf(":");
final String prefix = term.substring(0, colIndex);
final String suffix = term.substring(colIndex + 1);
if (context.containsKey(prefix)) {
this.createTermDefinition(context, prefix, defined); // depends on control dependency: [if], data = [none]
}
if (termDefinitions.containsKey(prefix)) {
definition.put(JsonLdConsts.ID,
((Map<String, Object>) termDefinitions.get(prefix)).get(JsonLdConsts.ID)
+ suffix); // depends on control dependency: [if], data = [none]
} else {
definition.put(JsonLdConsts.ID, term); // depends on control dependency: [if], data = [none]
}
// 15)
} else if (this.containsKey(JsonLdConsts.VOCAB)) {
definition.put(JsonLdConsts.ID, this.get(JsonLdConsts.VOCAB) + term);
} else if (!JsonLdConsts.TYPE.equals(term)) {
throw new JsonLdError(Error.INVALID_IRI_MAPPING,
"relative term definition without vocab mapping");
}
// 16)
if (val.containsKey(JsonLdConsts.CONTAINER)) {
final String container = (String) val.get(JsonLdConsts.CONTAINER);
if (!JsonLdConsts.LIST.equals(container) && !JsonLdConsts.SET.equals(container)
&& !JsonLdConsts.INDEX.equals(container)
&& !JsonLdConsts.LANGUAGE.equals(container)) {
throw new JsonLdError(Error.INVALID_CONTAINER_MAPPING,
"@container must be either @list, @set, @index, or @language");
}
definition.put(JsonLdConsts.CONTAINER, container);
if (JsonLdConsts.TYPE.equals(term)) {
definition.put(JsonLdConsts.ID, "type"); // depends on control dependency: [if], data = [none]
}
}
// 17)
if (val.containsKey(JsonLdConsts.LANGUAGE) && !val.containsKey(JsonLdConsts.TYPE)) {
if (val.get(JsonLdConsts.LANGUAGE) == null
|| val.get(JsonLdConsts.LANGUAGE) instanceof String) {
final String language = (String) val.get(JsonLdConsts.LANGUAGE);
definition.put(JsonLdConsts.LANGUAGE,
language != null ? language.toLowerCase() : null); // depends on control dependency: [if], data = [none]
} else {
throw new JsonLdError(Error.INVALID_LANGUAGE_MAPPING,
"@language must be a string or null");
}
}
// 18)
this.termDefinitions.put(term, definition);
defined.put(term, true);
} } |
public class class_name {
public Boolean isSubscribed(String channel) {
Boolean result = null;
/*
* Sanity checks
*/
if (!isConnected) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcNotConnectedException());
} else if (Strings.isNullOrEmpty(channel)) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcEmptyFieldException("Channel"));
} else if (!Strings.ortcIsValidInput(channel)) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcInvalidCharactersException("Channel"));
} else {
ChannelSubscription subscribedChannel = subscribedChannels
.get(channel);
result = subscribedChannel != null
&& subscribedChannel.isSubscribed();
}
return result;
} } | public class class_name {
public Boolean isSubscribed(String channel) {
Boolean result = null;
/*
* Sanity checks
*/
if (!isConnected) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcNotConnectedException()); // depends on control dependency: [if], data = [none]
} else if (Strings.isNullOrEmpty(channel)) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcEmptyFieldException("Channel")); // depends on control dependency: [if], data = [none]
} else if (!Strings.ortcIsValidInput(channel)) {
raiseOrtcEvent(EventEnum.OnException, this,
new OrtcInvalidCharactersException("Channel")); // depends on control dependency: [if], data = [none]
} else {
ChannelSubscription subscribedChannel = subscribedChannels
.get(channel);
result = subscribedChannel != null
&& subscribedChannel.isSubscribed(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public synchronized void processRequest(final ODistributedRequest request, final boolean waitForAcceptingRequests) {
if (!running) {
throw new ODistributedException("Server is going down or is removing the database:'" + getDatabaseName() + "' discarding");
}
final ORemoteTask task = request.getTask();
if (waitForAcceptingRequests) {
waitIsReady(task);
if (!running) {
throw new ODistributedException("Server is going down or is removing the database:'" + getDatabaseName() + "' discarding");
}
}
totalReceivedRequests.incrementAndGet();
// final ODistributedMomentum lastMomentum = filterByMomentum.get();
// if (lastMomentum != null && task instanceof OAbstractReplicatedTask) {
// final OLogSequenceNumber taskLastLSN = ((OAbstractReplicatedTask) task).getLastLSN();
//
// final String sourceServer = manager.getNodeNameById(request.getId().getNodeId());
// final OLogSequenceNumber lastLSNFromMomentum = lastMomentum.getLSN(sourceServer);
//
// if (taskLastLSN != null && lastLSNFromMomentum != null && taskLastLSN.compareTo(lastLSNFromMomentum) < 0) {
// // SKIP REQUEST BECAUSE CONTAINS AN OLD LSN
// final String msg = String.format("Skipped request %s on database '%s' because %s < current %s", request, databaseName,
// taskLastLSN, lastLSNFromMomentum);
// ODistributedServerLog.info(this, localNodeName, null, DIRECTION.NONE, msg);
// ODistributedWorker.sendResponseBack(this, manager, request, new ODistributedException(msg));
// return;
// }
// }
final int[] partitionKeys = task.getPartitionKey();
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, task.getNodeSource(), DIRECTION.IN, "Request %s on database '%s' partitionKeys=%s task=%s",
request, databaseName, Arrays.toString(partitionKeys), task);
if (partitionKeys.length > 1 || partitionKeys[0] == -1) {
final Set<Integer> involvedWorkerQueues;
if (partitionKeys.length > 1)
involvedWorkerQueues = getInvolvedQueuesByPartitionKeys(partitionKeys);
else
// LOCK ALL THE QUEUES
involvedWorkerQueues = ALL_QUEUES;
// if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, null, DIRECTION.NONE, "Request %s on database '%s' involvedQueues=%s", request, databaseName,
involvedWorkerQueues);
if (involvedWorkerQueues.size() == 1)
// JUST ONE QUEUE INVOLVED: PROCESS IT IMMEDIATELY
processRequest(involvedWorkerQueues.iterator().next(), request);
else {
// INVOLVING MULTIPLE QUEUES
// if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog.debug(this, localNodeName, null, DIRECTION.NONE,
"Request %s on database '%s' waiting for all the previous requests to be completed", request, databaseName);
CyclicBarrier started = new CyclicBarrier(involvedWorkerQueues.size());
CyclicBarrier finished = new CyclicBarrier(involvedWorkerQueues.size());
// WAIT ALL THE INVOLVED QUEUES ARE FREE AND SYNCHRONIZED
for (int queue : involvedWorkerQueues) {
ODistributedWorker worker = workerThreads.get(queue);
OWaitPartitionsReadyTask waitRequest = new OWaitPartitionsReadyTask(started, task, finished);
final ODistributedRequest syncRequest = new ODistributedRequest(null, request.getId().getNodeId(),
request.getId().getMessageId(), databaseName, waitRequest);
worker.processRequest(syncRequest);
}
}
} else if (partitionKeys.length == 1 && partitionKeys[0] == -2) {
// ANY PARTITION: USE THE FIRST EMPTY IF ANY, OTHERWISE THE FIRST IN THE LIST
boolean found = false;
for (ODistributedWorker q : workerThreads) {
if (q.isWaitingForNextRequest() && q.localQueue.isEmpty()) {
q.processRequest(request);
found = true;
break;
}
}
if (!found)
// ALL THE THREADS ARE BUSY, SELECT THE FIRST EMPTY ONE
for (ODistributedWorker q : workerThreads) {
if (q.localQueue.isEmpty()) {
q.processRequest(request);
found = true;
break;
}
}
if (!found)
// EXEC ON THE FIRST QUEUE
workerThreads.get(0).processRequest(request);
} else if (partitionKeys.length == 1 && partitionKeys[0] == -3) {
// SERVICE - LOCK
ODistributedServerLog.debug(this, localNodeName, request.getTask().getNodeSource(), DIRECTION.IN,
"Request %s on database '%s' dispatched to the lock worker", request, databaseName);
lockThread.processRequest(request);
} else if (partitionKeys.length == 1 && partitionKeys[0] == -4) {
// SERVICE - FAST_NOLOCK
ODistributedServerLog.debug(this, localNodeName, request.getTask().getNodeSource(), DIRECTION.IN,
"Request %s on database '%s' dispatched to the nowait worker", request, databaseName);
nowaitThread.processRequest(request);
} else {
processRequest(partitionKeys[0], request);
}
} } | public class class_name {
public synchronized void processRequest(final ODistributedRequest request, final boolean waitForAcceptingRequests) {
if (!running) {
throw new ODistributedException("Server is going down or is removing the database:'" + getDatabaseName() + "' discarding");
}
final ORemoteTask task = request.getTask();
if (waitForAcceptingRequests) {
waitIsReady(task); // depends on control dependency: [if], data = [none]
if (!running) {
throw new ODistributedException("Server is going down or is removing the database:'" + getDatabaseName() + "' discarding");
}
}
totalReceivedRequests.incrementAndGet();
// final ODistributedMomentum lastMomentum = filterByMomentum.get();
// if (lastMomentum != null && task instanceof OAbstractReplicatedTask) {
// final OLogSequenceNumber taskLastLSN = ((OAbstractReplicatedTask) task).getLastLSN();
//
// final String sourceServer = manager.getNodeNameById(request.getId().getNodeId());
// final OLogSequenceNumber lastLSNFromMomentum = lastMomentum.getLSN(sourceServer);
//
// if (taskLastLSN != null && lastLSNFromMomentum != null && taskLastLSN.compareTo(lastLSNFromMomentum) < 0) {
// // SKIP REQUEST BECAUSE CONTAINS AN OLD LSN
// final String msg = String.format("Skipped request %s on database '%s' because %s < current %s", request, databaseName,
// taskLastLSN, lastLSNFromMomentum);
// ODistributedServerLog.info(this, localNodeName, null, DIRECTION.NONE, msg);
// ODistributedWorker.sendResponseBack(this, manager, request, new ODistributedException(msg));
// return;
// }
// }
final int[] partitionKeys = task.getPartitionKey();
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, task.getNodeSource(), DIRECTION.IN, "Request %s on database '%s' partitionKeys=%s task=%s",
request, databaseName, Arrays.toString(partitionKeys), task);
if (partitionKeys.length > 1 || partitionKeys[0] == -1) {
final Set<Integer> involvedWorkerQueues;
if (partitionKeys.length > 1)
involvedWorkerQueues = getInvolvedQueuesByPartitionKeys(partitionKeys);
else
// LOCK ALL THE QUEUES
involvedWorkerQueues = ALL_QUEUES;
// if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, null, DIRECTION.NONE, "Request %s on database '%s' involvedQueues=%s", request, databaseName,
involvedWorkerQueues);
if (involvedWorkerQueues.size() == 1)
// JUST ONE QUEUE INVOLVED: PROCESS IT IMMEDIATELY
processRequest(involvedWorkerQueues.iterator().next(), request);
else {
// INVOLVING MULTIPLE QUEUES
// if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog.debug(this, localNodeName, null, DIRECTION.NONE,
"Request %s on database '%s' waiting for all the previous requests to be completed", request, databaseName);
CyclicBarrier started = new CyclicBarrier(involvedWorkerQueues.size());
CyclicBarrier finished = new CyclicBarrier(involvedWorkerQueues.size());
// WAIT ALL THE INVOLVED QUEUES ARE FREE AND SYNCHRONIZED
for (int queue : involvedWorkerQueues) {
ODistributedWorker worker = workerThreads.get(queue);
OWaitPartitionsReadyTask waitRequest = new OWaitPartitionsReadyTask(started, task, finished);
final ODistributedRequest syncRequest = new ODistributedRequest(null, request.getId().getNodeId(),
request.getId().getMessageId(), databaseName, waitRequest);
worker.processRequest(syncRequest);
}
}
} else if (partitionKeys.length == 1 && partitionKeys[0] == -2) {
// ANY PARTITION: USE THE FIRST EMPTY IF ANY, OTHERWISE THE FIRST IN THE LIST
boolean found = false;
for (ODistributedWorker q : workerThreads) {
if (q.isWaitingForNextRequest() && q.localQueue.isEmpty()) {
q.processRequest(request);
found = true;
break;
}
}
if (!found)
// ALL THE THREADS ARE BUSY, SELECT THE FIRST EMPTY ONE
for (ODistributedWorker q : workerThreads) {
if (q.localQueue.isEmpty()) {
q.processRequest(request);
found = true;
break;
}
}
if (!found)
// EXEC ON THE FIRST QUEUE
workerThreads.get(0).processRequest(request);
} else if (partitionKeys.length == 1 && partitionKeys[0] == -3) {
// SERVICE - LOCK
ODistributedServerLog.debug(this, localNodeName, request.getTask().getNodeSource(), DIRECTION.IN,
"Request %s on database '%s' dispatched to the lock worker", request, databaseName);
lockThread.processRequest(request);
} else if (partitionKeys.length == 1 && partitionKeys[0] == -4) {
// SERVICE - FAST_NOLOCK
ODistributedServerLog.debug(this, localNodeName, request.getTask().getNodeSource(), DIRECTION.IN,
"Request %s on database '%s' dispatched to the nowait worker", request, databaseName);
nowaitThread.processRequest(request);
} else {
processRequest(partitionKeys[0], request);
}
} } |
public class class_name {
private void ensureNext() {
// Check if the current scan result has more keys (i.e. the index did not reach the end of the result list)
if (resultIndex < scanResult.getResult().size()) {
return;
}
// Since the current scan result was fully iterated,
// if there is another cursor scan it and ensure next key (recursively)
if (!FIRST_CURSOR.equals(scanResult.getStringCursor())) {
scanResult = scan(scanResult.getStringCursor(), scanParams);
resultIndex = 0;
ensureNext();
}
} } | public class class_name {
private void ensureNext() {
// Check if the current scan result has more keys (i.e. the index did not reach the end of the result list)
if (resultIndex < scanResult.getResult().size()) {
return; // depends on control dependency: [if], data = [none]
}
// Since the current scan result was fully iterated,
// if there is another cursor scan it and ensure next key (recursively)
if (!FIRST_CURSOR.equals(scanResult.getStringCursor())) {
scanResult = scan(scanResult.getStringCursor(), scanParams); // depends on control dependency: [if], data = [none]
resultIndex = 0; // depends on control dependency: [if], data = [none]
ensureNext(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void writeBytes(byte[] value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", value);
try {
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// This method has different behaviours for storing the byte array, based on the whether the producer
// has promised not to mess with data after it's been written...
if (producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise");
// The producer has promised not to modify the payload after it's been set, so check
// the flag to see whether this is the first, or a subsequent call to writeBytes.
if (!writeByteArrayCalled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object");
writeByteArrayCalled = true;
// Set the data buffer & MFP data references to the value param & reset
// the dataStart attribute
jsBytesMsg.setBytes(value);
dataBuffer = value;
dataStart = 0;
}
else {
// The producer has promised not to modify the payload after it's been set, but the producer has
// been naughty by calling this method more than once! Throw exception to admonish the producer.
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0511", // promise broken
null, // No inserts
null, // no cause - original exception
"JmsBytesMessageImpl.writeBytes#3", // Probe ID
this, // Caller (?)
tc); // Trace component
}
}
else {
// Producer makes no promises relating to the accessing the message payload, so
// make a copy of the byte array at this point to ensure the message is transmitted safely.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer 'payload modification' promise is not in place - make a copy of the byte array");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, 0, value.length);
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// Invalidate the cached toString object, because the message payload has changed.
cachedBytesToString = null;
}
catch (IOException ex) {
// No FFDC code needed
//(exception repro'ed from 3-param writeBytes method)
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#4",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} } | public class class_name {
@Override
public void writeBytes(byte[] value) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "writeBytes", value);
try {
// Check that we are in write mode
checkBodyWriteable("writeBytes");
// This method has different behaviours for storing the byte array, based on the whether the producer
// has promised not to mess with data after it's been written...
if (producerWontModifyPayloadAfterSet) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer has promised not to modify the payload after setting it in the message - check if they've violated that promise");
// The producer has promised not to modify the payload after it's been set, so check
// the flag to see whether this is the first, or a subsequent call to writeBytes.
if (!writeByteArrayCalled) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "This is the first call to writeBytes(byte[] value) - storing the byte array reference directly in the underlying MFP object");
writeByteArrayCalled = true; // depends on control dependency: [if], data = [none]
// Set the data buffer & MFP data references to the value param & reset
// the dataStart attribute
jsBytesMsg.setBytes(value); // depends on control dependency: [if], data = [none]
dataBuffer = value; // depends on control dependency: [if], data = [none]
dataStart = 0; // depends on control dependency: [if], data = [none]
}
else {
// The producer has promised not to modify the payload after it's been set, but the producer has
// been naughty by calling this method more than once! Throw exception to admonish the producer.
throw (JMSException) JmsErrorUtils.newThrowable(
IllegalStateException.class, // JMS illegal state exception
"PROMISE_BROKEN_EXCEPTION_CWSIA0511", // promise broken
null, // No inserts
null, // no cause - original exception
"JmsBytesMessageImpl.writeBytes#3", // Probe ID
this, // Caller (?)
tc); // Trace component
}
}
else {
// Producer makes no promises relating to the accessing the message payload, so
// make a copy of the byte array at this point to ensure the message is transmitted safely.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Producer 'payload modification' promise is not in place - make a copy of the byte array");
// Write the byte array to the output stream
// We don't check for value==null as JDK1.1.6 DataOutputStream doesn't
writeStream.write(value, 0, value.length);
// Ensure that the new data gets exported when the time comes.
bodySetInJsMsg = false;
}
// Invalidate the cached toString object, because the message payload has changed.
cachedBytesToString = null;
}
catch (IOException ex) {
// No FFDC code needed
//(exception repro'ed from 3-param writeBytes method)
throw (JMSException) JmsErrorUtils.newThrowable(
ResourceAllocationException.class,
"WRITE_PROBLEM_CWSIA0186",
null,
ex,
"JmsBytesMessageImpl.writeBytes#4",
this,
tc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "writeBytes");
} } |
public class class_name {
static BindTransform getUtilTransform(TypeName type) {
String typeName = type.toString();
// Integer.class.getCanonicalName().equals(typeName)
if (Date.class.getCanonicalName().equals(typeName)) {
return new DateBindTransform();
}
if (Locale.class.getCanonicalName().equals(typeName)) {
return new LocaleBindTransform();
}
if (Currency.class.getCanonicalName().equals(typeName)) {
return new CurrencyBindTransform();
}
if (Calendar.class.getCanonicalName().equals(typeName)) {
return new CalendarBindTransform();
}
if (TimeZone.class.getCanonicalName().equals(typeName)) {
return new TimeZoneBindTransform();
}
return null;
} } | public class class_name {
static BindTransform getUtilTransform(TypeName type) {
String typeName = type.toString();
// Integer.class.getCanonicalName().equals(typeName)
if (Date.class.getCanonicalName().equals(typeName)) {
return new DateBindTransform(); // depends on control dependency: [if], data = [none]
}
if (Locale.class.getCanonicalName().equals(typeName)) {
return new LocaleBindTransform(); // depends on control dependency: [if], data = [none]
}
if (Currency.class.getCanonicalName().equals(typeName)) {
return new CurrencyBindTransform(); // depends on control dependency: [if], data = [none]
}
if (Calendar.class.getCanonicalName().equals(typeName)) {
return new CalendarBindTransform(); // depends on control dependency: [if], data = [none]
}
if (TimeZone.class.getCanonicalName().equals(typeName)) {
return new TimeZoneBindTransform(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem, OCommandContext ctx) {
if (iItem == null || !(iItem instanceof OSQLFilterItemField)) {
return null;
}
if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) {
return null;
}
final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
if (item.hasChainOperators() && !item.isFieldChain()) {
return null;
}
boolean inverted = iCondition.getRight() == iItem;
final Object origValue = inverted ? iCondition.getLeft() : iCondition.getRight();
OQueryOperator operator = iCondition.getOperator();
if (inverted) {
if (operator instanceof OQueryOperatorIn) {
operator = new OQueryOperatorContains();
} else if (operator instanceof OQueryOperatorContains) {
operator = new OQueryOperatorIn();
} else if (operator instanceof OQueryOperatorMajor) {
operator = new OQueryOperatorMinor();
} else if (operator instanceof OQueryOperatorMinor) {
operator = new OQueryOperatorMajor();
} else if (operator instanceof OQueryOperatorMajorEquals) {
operator = new OQueryOperatorMinorEquals();
} else if (operator instanceof OQueryOperatorMinorEquals) {
operator = new OQueryOperatorMajorEquals();
}
}
if (iCondition.getOperator() instanceof OQueryOperatorBetween || operator instanceof OQueryOperatorIn) {
return new OIndexSearchResult(operator, item.getFieldChain(), origValue);
}
final Object value = OSQLHelper.getValue(origValue, null, ctx);
return new OIndexSearchResult(operator, item.getFieldChain(), value);
} } | public class class_name {
private OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem, OCommandContext ctx) {
if (iItem == null || !(iItem instanceof OSQLFilterItemField)) {
return null; // depends on control dependency: [if], data = [none]
}
if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField) {
return null; // depends on control dependency: [if], data = [none]
}
final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
if (item.hasChainOperators() && !item.isFieldChain()) {
return null; // depends on control dependency: [if], data = [none]
}
boolean inverted = iCondition.getRight() == iItem;
final Object origValue = inverted ? iCondition.getLeft() : iCondition.getRight();
OQueryOperator operator = iCondition.getOperator();
if (inverted) {
if (operator instanceof OQueryOperatorIn) {
operator = new OQueryOperatorContains(); // depends on control dependency: [if], data = [none]
} else if (operator instanceof OQueryOperatorContains) {
operator = new OQueryOperatorIn(); // depends on control dependency: [if], data = [none]
} else if (operator instanceof OQueryOperatorMajor) {
operator = new OQueryOperatorMinor(); // depends on control dependency: [if], data = [none]
} else if (operator instanceof OQueryOperatorMinor) {
operator = new OQueryOperatorMajor(); // depends on control dependency: [if], data = [none]
} else if (operator instanceof OQueryOperatorMajorEquals) {
operator = new OQueryOperatorMinorEquals(); // depends on control dependency: [if], data = [none]
} else if (operator instanceof OQueryOperatorMinorEquals) {
operator = new OQueryOperatorMajorEquals(); // depends on control dependency: [if], data = [none]
}
}
if (iCondition.getOperator() instanceof OQueryOperatorBetween || operator instanceof OQueryOperatorIn) {
return new OIndexSearchResult(operator, item.getFieldChain(), origValue); // depends on control dependency: [if], data = [none]
}
final Object value = OSQLHelper.getValue(origValue, null, ctx);
return new OIndexSearchResult(operator, item.getFieldChain(), value);
} } |
public class class_name {
void initFilters() {
tempFileNameScheme.setBaseDir(job.getInputDir());
listFilter = new GenListModuleReader();
listFilter.setLogger(logger);
listFilter.setPrimaryDitamap(rootFile);
listFilter.setJob(job);
listFilter.setFormatFilter(formatFilter);
if (profilingEnabled) {
filterUtils = parseFilterFile();
}
if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) {
exportAnchorsFilter = new ExportAnchorsFilter();
exportAnchorsFilter.setInputFile(rootFile);
}
keydefFilter = new KeydefFilter();
keydefFilter.setLogger(logger);
keydefFilter.setCurrentFile(rootFile);
keydefFilter.setJob(job);
nullHandler = new DefaultHandler();
ditaWriterFilter = new DitaWriterFilter();
ditaWriterFilter.setTempFileNameScheme(tempFileNameScheme);
ditaWriterFilter.setLogger(logger);
ditaWriterFilter.setJob(job);
ditaWriterFilter.setEntityResolver(reader.getEntityResolver());
topicFragmentFilter = new TopicFragmentFilter(ATTRIBUTE_NAME_CONREF, ATTRIBUTE_NAME_CONREFEND);
} } | public class class_name {
void initFilters() {
tempFileNameScheme.setBaseDir(job.getInputDir());
listFilter = new GenListModuleReader();
listFilter.setLogger(logger);
listFilter.setPrimaryDitamap(rootFile);
listFilter.setJob(job);
listFilter.setFormatFilter(formatFilter);
if (profilingEnabled) {
filterUtils = parseFilterFile(); // depends on control dependency: [if], data = [none]
}
if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) {
exportAnchorsFilter = new ExportAnchorsFilter(); // depends on control dependency: [if], data = [none]
exportAnchorsFilter.setInputFile(rootFile); // depends on control dependency: [if], data = [none]
}
keydefFilter = new KeydefFilter();
keydefFilter.setLogger(logger);
keydefFilter.setCurrentFile(rootFile);
keydefFilter.setJob(job);
nullHandler = new DefaultHandler();
ditaWriterFilter = new DitaWriterFilter();
ditaWriterFilter.setTempFileNameScheme(tempFileNameScheme);
ditaWriterFilter.setLogger(logger);
ditaWriterFilter.setJob(job);
ditaWriterFilter.setEntityResolver(reader.getEntityResolver());
topicFragmentFilter = new TopicFragmentFilter(ATTRIBUTE_NAME_CONREF, ATTRIBUTE_NAME_CONREFEND);
} } |
public class class_name {
public static String rowIndexListToString(final List<Integer> row) {
if (row == null || row.isEmpty()) {
return null;
}
StringBuffer index = new StringBuffer();
boolean addDelimiter = false;
for (Integer lvl : row) {
if (addDelimiter) {
index.append(INDEX_DELIMITER);
}
index.append(lvl);
addDelimiter = true;
}
return index.toString();
} } | public class class_name {
public static String rowIndexListToString(final List<Integer> row) {
if (row == null || row.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuffer index = new StringBuffer();
boolean addDelimiter = false;
for (Integer lvl : row) {
if (addDelimiter) {
index.append(INDEX_DELIMITER); // depends on control dependency: [if], data = [none]
}
index.append(lvl); // depends on control dependency: [for], data = [lvl]
addDelimiter = true; // depends on control dependency: [for], data = [none]
}
return index.toString();
} } |
public class class_name {
@Deprecated
public org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy balancingStrategy() {
FailoverRequestBalancingStrategy strategy = balancingStrategyFactory.get();
if (org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy.class.isInstance(strategy)) {
return (org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy) strategy;
} else {
return null;
}
} } | public class class_name {
@Deprecated
public org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy balancingStrategy() {
FailoverRequestBalancingStrategy strategy = balancingStrategyFactory.get();
if (org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy.class.isInstance(strategy)) {
return (org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy) strategy; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Matrix timesEquals(double s)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = s * A[i][j];
}
}
return this;
} } | public class class_name {
public Matrix timesEquals(double s)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = s * A[i][j]; // depends on control dependency: [for], data = [j]
}
}
return this;
} } |
public class class_name {
private Path makePathAndBoundingBox(Line obj)
{
float x1 = (obj.x1 == null) ? 0 : obj.x1.floatValueX(this);
float y1 = (obj.y1 == null) ? 0 : obj.y1.floatValueY(this);
float x2 = (obj.x2 == null) ? 0 : obj.x2.floatValueX(this);
float y2 = (obj.y2 == null) ? 0 : obj.y2.floatValueY(this);
if (obj.boundingBox == null) {
obj.boundingBox = new Box(Math.min(x1, x2), Math.min(y1, y2), Math.abs(x2-x1), Math.abs(y2-y1));
}
Path p = new Path();
p.moveTo(x1, y1);
p.lineTo(x2, y2);
return p;
} } | public class class_name {
private Path makePathAndBoundingBox(Line obj)
{
float x1 = (obj.x1 == null) ? 0 : obj.x1.floatValueX(this);
float y1 = (obj.y1 == null) ? 0 : obj.y1.floatValueY(this);
float x2 = (obj.x2 == null) ? 0 : obj.x2.floatValueX(this);
float y2 = (obj.y2 == null) ? 0 : obj.y2.floatValueY(this);
if (obj.boundingBox == null) {
obj.boundingBox = new Box(Math.min(x1, x2), Math.min(y1, y2), Math.abs(x2-x1), Math.abs(y2-y1));
// depends on control dependency: [if], data = [none]
}
Path p = new Path();
p.moveTo(x1, y1);
p.lineTo(x2, y2);
return p;
} } |
public class class_name {
@Nullable
private Comparable<?> getCallingObject() {
String sig = getSigConstantOperand();
if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) {
return null;
}
int numParameters = SignatureUtils.getNumParameters(sig);
if (stack.getStackDepth() <= numParameters) {
return null;
}
OpcodeStack.Item caller = stack.getStackItem(numParameters);
UserObject uo = (UserObject) caller.getUserValue();
if ((uo != null) && (uo.caller != null)) {
return uo.caller;
}
int reg = caller.getRegisterNumber();
if (reg >= 0) {
return Integer.valueOf(reg);
}
/*
* We ignore the possibility of two fields with the same name in different
* classes
*/
XField f = caller.getXField();
if (f != null) {
return f.getName();
}
return null;
} } | public class class_name {
@Nullable
private Comparable<?> getCallingObject() {
String sig = getSigConstantOperand();
if (Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(sig))) {
return null; // depends on control dependency: [if], data = [none]
}
int numParameters = SignatureUtils.getNumParameters(sig);
if (stack.getStackDepth() <= numParameters) {
return null; // depends on control dependency: [if], data = [none]
}
OpcodeStack.Item caller = stack.getStackItem(numParameters);
UserObject uo = (UserObject) caller.getUserValue();
if ((uo != null) && (uo.caller != null)) {
return uo.caller; // depends on control dependency: [if], data = [none]
}
int reg = caller.getRegisterNumber();
if (reg >= 0) {
return Integer.valueOf(reg); // depends on control dependency: [if], data = [(reg]
}
/*
* We ignore the possibility of two fields with the same name in different
* classes
*/
XField f = caller.getXField();
if (f != null) {
return f.getName(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) {
MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod);
methodInjectionPoint.addThrows(astMethod.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astMethod.getParameters().size() == 1) {
methodAnnotations.addAll(astMethod.getAnnotations());
}
for (ASTParameter astParameter : astMethod.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations());
methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context));
}
return methodInjectionPoint;
} } | public class class_name {
public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) {
MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod);
methodInjectionPoint.addThrows(astMethod.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astMethod.getParameters().size() == 1) {
methodAnnotations.addAll(astMethod.getAnnotations()); // depends on control dependency: [if], data = [none]
}
for (ASTParameter astParameter : astMethod.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations()); // depends on control dependency: [for], data = [astParameter]
methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); // depends on control dependency: [for], data = [astParameter]
}
return methodInjectionPoint;
} } |
public class class_name {
public void marshall(Termination termination, ProtocolMarshaller protocolMarshaller) {
if (termination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(termination.getCpsLimit(), CPSLIMIT_BINDING);
protocolMarshaller.marshall(termination.getDefaultPhoneNumber(), DEFAULTPHONENUMBER_BINDING);
protocolMarshaller.marshall(termination.getCallingRegions(), CALLINGREGIONS_BINDING);
protocolMarshaller.marshall(termination.getCidrAllowedList(), CIDRALLOWEDLIST_BINDING);
protocolMarshaller.marshall(termination.getDisabled(), DISABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Termination termination, ProtocolMarshaller protocolMarshaller) {
if (termination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(termination.getCpsLimit(), CPSLIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(termination.getDefaultPhoneNumber(), DEFAULTPHONENUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(termination.getCallingRegions(), CALLINGREGIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(termination.getCidrAllowedList(), CIDRALLOWEDLIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(termination.getDisabled(), DISABLED_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 List<NamedStoredProcedureQuery<OrmDescriptor>> getAllNamedStoredProcedureQuery()
{
List<NamedStoredProcedureQuery<OrmDescriptor>> list = new ArrayList<NamedStoredProcedureQuery<OrmDescriptor>>();
List<Node> nodeList = model.get("named-stored-procedure-query");
for(Node node: nodeList)
{
NamedStoredProcedureQuery<OrmDescriptor> type = new NamedStoredProcedureQueryImpl<OrmDescriptor>(this, "named-stored-procedure-query", model, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<NamedStoredProcedureQuery<OrmDescriptor>> getAllNamedStoredProcedureQuery()
{
List<NamedStoredProcedureQuery<OrmDescriptor>> list = new ArrayList<NamedStoredProcedureQuery<OrmDescriptor>>();
List<Node> nodeList = model.get("named-stored-procedure-query");
for(Node node: nodeList)
{
NamedStoredProcedureQuery<OrmDescriptor> type = new NamedStoredProcedureQueryImpl<OrmDescriptor>(this, "named-stored-procedure-query", model, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
private void checkForOfTypes(NodeTraversal t, Node forOf) {
Node lhs = forOf.getFirstChild();
Node iterable = forOf.getSecondChild();
JSType iterableType = getJSType(iterable);
JSType actualType;
if (forOf.isForAwaitOf()) {
Optional<JSType> maybeType =
validator.expectAutoboxesToIterableOrAsyncIterable(
iterable,
iterableType,
"Can only async iterate over a (non-null) Iterable or AsyncIterable type");
if (!maybeType.isPresent()) {
// Not iterable or async iterable, error reported by
// expectAutoboxesToIterableOrAsyncIterable.
return;
}
actualType = maybeType.get();
} else {
validator.expectAutoboxesToIterable(
iterable, iterableType, "Can only iterate over a (non-null) Iterable type");
actualType =
// Convert primitives to their wrapper type and remove null/undefined
// If iterable is a union type, autoboxes each member of the union.
iterableType
.autobox()
.getTemplateTypeMap()
.getResolvedTemplateType(typeRegistry.getIterableTemplate());
}
if (NodeUtil.isNameDeclaration(lhs)) {
// e.g. get "x" given the VAR in "for (var x of arr) {"
lhs = lhs.getFirstChild();
}
if (lhs.isDestructuringLhs()) {
// e.g. get `[x, y]` given the VAR in `for (var [x, y] of arr) {`
lhs = lhs.getFirstChild();
}
checkCanAssignToWithScope(
t,
forOf,
lhs,
actualType,
lhs.getJSDocInfo(),
"declared type of for-of loop variable does not match inferred type");
} } | public class class_name {
private void checkForOfTypes(NodeTraversal t, Node forOf) {
Node lhs = forOf.getFirstChild();
Node iterable = forOf.getSecondChild();
JSType iterableType = getJSType(iterable);
JSType actualType;
if (forOf.isForAwaitOf()) {
Optional<JSType> maybeType =
validator.expectAutoboxesToIterableOrAsyncIterable(
iterable,
iterableType,
"Can only async iterate over a (non-null) Iterable or AsyncIterable type");
if (!maybeType.isPresent()) {
// Not iterable or async iterable, error reported by
// expectAutoboxesToIterableOrAsyncIterable.
return; // depends on control dependency: [if], data = [none]
}
actualType = maybeType.get(); // depends on control dependency: [if], data = [none]
} else {
validator.expectAutoboxesToIterable(
iterable, iterableType, "Can only iterate over a (non-null) Iterable type"); // depends on control dependency: [if], data = [none]
actualType =
// Convert primitives to their wrapper type and remove null/undefined
// If iterable is a union type, autoboxes each member of the union.
iterableType
.autobox()
.getTemplateTypeMap()
.getResolvedTemplateType(typeRegistry.getIterableTemplate()); // depends on control dependency: [if], data = [none]
}
if (NodeUtil.isNameDeclaration(lhs)) {
// e.g. get "x" given the VAR in "for (var x of arr) {"
lhs = lhs.getFirstChild(); // depends on control dependency: [if], data = [none]
}
if (lhs.isDestructuringLhs()) {
// e.g. get `[x, y]` given the VAR in `for (var [x, y] of arr) {`
lhs = lhs.getFirstChild(); // depends on control dependency: [if], data = [none]
}
checkCanAssignToWithScope(
t,
forOf,
lhs,
actualType,
lhs.getJSDocInfo(),
"declared type of for-of loop variable does not match inferred type");
} } |
public class class_name {
private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccProtected;
if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())};
out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0);
TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)};
List<Statement> body = new ArrayList<Statement>();
if (inherited) {
// Call super.
MessageSend callToSuper = new MessageSend();
callToSuper.receiver = new SuperReference(0, 0);
callToSuper.selector = FILL_VALUES_METHOD_NAME;
callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)};
body.add(callToSuper);
}
// Call the builder implemention's helper method that actually fills the values from the instance.
MessageSend callStaticFillValuesMethod = new MessageSend();
callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0);
callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME;
callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)};
body.add(callStaticFillValuesMethod);
// Return self().
MessageSend returnCall = new MessageSend();
returnCall.receiver = ThisReference.implicitThis();
returnCall.selector = SELF_METHOD_NAME;
body.add(new ReturnStatement(returnCall, 0, 0));
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} } | public class class_name {
private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccProtected;
if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())};
out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0);
TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)};
List<Statement> body = new ArrayList<Statement>();
if (inherited) {
// Call super.
MessageSend callToSuper = new MessageSend();
callToSuper.receiver = new SuperReference(0, 0); // depends on control dependency: [if], data = [none]
callToSuper.selector = FILL_VALUES_METHOD_NAME; // depends on control dependency: [if], data = [none]
callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)}; // depends on control dependency: [if], data = [none]
body.add(callToSuper); // depends on control dependency: [if], data = [none]
}
// Call the builder implemention's helper method that actually fills the values from the instance.
MessageSend callStaticFillValuesMethod = new MessageSend();
callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0);
callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME;
callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)};
body.add(callStaticFillValuesMethod);
// Return self().
MessageSend returnCall = new MessageSend();
returnCall.receiver = ThisReference.implicitThis();
returnCall.selector = SELF_METHOD_NAME;
body.add(new ReturnStatement(returnCall, 0, 0));
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} } |
public class class_name {
public static int compare(String s1, String s2, boolean ignoreCase) {
if (s1 == null && s2 == null) {
return 0;
} else if (s1 == null) {
return -1;
} else if (s2 == null) {
return 1;
}
return ignoreCase ? s1.compareToIgnoreCase(s2) : s1.compareTo(s2);
} } | public class class_name {
public static int compare(String s1, String s2, boolean ignoreCase) {
if (s1 == null && s2 == null) {
return 0; // depends on control dependency: [if], data = [none]
} else if (s1 == null) {
return -1; // depends on control dependency: [if], data = [none]
} else if (s2 == null) {
return 1; // depends on control dependency: [if], data = [none]
}
return ignoreCase ? s1.compareToIgnoreCase(s2) : s1.compareTo(s2);
} } |
public class class_name {
public static boolean compareString(String string, SoyValue other) {
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString());
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue();
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
}
}
return false;
} } | public class class_name {
public static boolean compareString(String string, SoyValue other) {
// This follows similarly to the Javascript specification, to ensure similar operation
// over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
if (other instanceof StringData || other instanceof SanitizedContent) {
return string.equals(other.toString()); // depends on control dependency: [if], data = [none]
}
if (other instanceof NumberData) {
try {
// Parse the string as a number.
return Double.parseDouble(string) == other.numberValue(); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
// Didn't parse as a number.
return false;
} // depends on control dependency: [catch], data = [none]
}
return false;
} } |
public class class_name {
public void registerNotificationSource(final NotificationSource src) {
if (!this.tracerStorage.containsKey(src)) {
TracerStorage ts = new TracerStorage(src, this);
this.tracerStorage.put(src, ts);
}
} } | public class class_name {
public void registerNotificationSource(final NotificationSource src) {
if (!this.tracerStorage.containsKey(src)) {
TracerStorage ts = new TracerStorage(src, this);
this.tracerStorage.put(src, ts);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T, U, A, R> Collector<T, ?, R> flatMapping(Function<? super T, ? extends Stream<? extends U>> mapper,
Collector<? super U, A, R> downstream) {
BiConsumer<A, ? super U> downstreamAccumulator = downstream.accumulator();
Predicate<A> finished = finished(downstream);
if (finished != null) {
return new CancellableCollectorImpl<>(downstream.supplier(), (acc, t) -> {
if (finished.test(acc))
return;
try (Stream<? extends U> stream = mapper.apply(t)) {
if (stream != null) {
stream.spliterator().forEachRemaining(u -> {
downstreamAccumulator.accept(acc, u);
if (finished.test(acc))
throw new CancelException();
});
}
} catch (CancelException ex) {
// ignore
}
}, downstream.combiner(), downstream.finisher(), finished, downstream.characteristics());
}
return Collector.of(downstream.supplier(), (acc, t) -> {
try (Stream<? extends U> stream = mapper.apply(t)) {
if (stream != null) {
stream.spliterator().forEachRemaining(u -> downstreamAccumulator.accept(acc, u));
}
}
}, downstream.combiner(), downstream.finisher(), downstream.characteristics().toArray(new Characteristics[0]));
} } | public class class_name {
public static <T, U, A, R> Collector<T, ?, R> flatMapping(Function<? super T, ? extends Stream<? extends U>> mapper,
Collector<? super U, A, R> downstream) {
BiConsumer<A, ? super U> downstreamAccumulator = downstream.accumulator();
Predicate<A> finished = finished(downstream);
if (finished != null) {
return new CancellableCollectorImpl<>(downstream.supplier(), (acc, t) -> {
if (finished.test(acc))
return;
// depends on control dependency: [if], data = [none]
try (Stream<? extends U> stream = mapper.apply(t)) {
if (stream != null) {
stream.spliterator().forEachRemaining(u -> {
downstreamAccumulator.accept(acc, u);
// depends on control dependency: [if], data = [none]
if (finished.test(acc))
throw new CancelException();
});
}
} catch (CancelException ex) {
// ignore
}
}, downstream.combiner(), downstream.finisher(), finished, downstream.characteristics());
}
return Collector.of(downstream.supplier(), (acc, t) -> {
try (Stream<? extends U> stream = mapper.apply(t)) {
if (stream != null) {
stream.spliterator().forEachRemaining(u -> downstreamAccumulator.accept(acc, u));
}
}
}, downstream.combiner(), downstream.finisher(), downstream.characteristics().toArray(new Characteristics[0]));
} } |
public class class_name {
public static boolean hasGroupBy(JPQLExpression jpqlExpression)
{
if (isSelectStatement(jpqlExpression))
{
return ((SelectStatement) jpqlExpression.getQueryStatement()).hasGroupByClause();
}
return false;
} } | public class class_name {
public static boolean hasGroupBy(JPQLExpression jpqlExpression)
{
if (isSelectStatement(jpqlExpression))
{
return ((SelectStatement) jpqlExpression.getQueryStatement()).hasGroupByClause(); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@SuppressWarnings("resource")
public void registerSolrIndex(CmsSolrIndex index) throws CmsConfigurationException {
if ((m_solrConfig == null) || !m_solrConfig.isEnabled()) {
// No solr server configured
throw new CmsConfigurationException(Messages.get().container(Messages.ERR_SOLR_NOT_ENABLED_0));
}
if (m_solrConfig.getServerUrl() != null) {
// HTTP Server configured
// TODO Implement multi core support for HTTP server
// @see http://lucidworks.lucidimagination.com/display/solr/Configuring+solr.xml
index.setSolrServer(new Builder().withBaseSolrUrl(m_solrConfig.getServerUrl()).build());
}
// get the core container that contains one core for each configured index
if (m_coreContainer == null) {
m_coreContainer = createCoreContainer();
}
// unload the existing core if it exists to avoid problems with forced unlock.
if (m_coreContainer.getAllCoreNames().contains(index.getCoreName())) {
m_coreContainer.unload(index.getCoreName(), false, false, true);
}
// ensure that all locks on the index are gone
ensureIndexIsUnlocked(index.getPath());
// load the core to the container
File dataDir = new File(index.getPath());
if (!dataDir.exists()) {
dataDir.mkdirs();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_INDEX_DIR_CREATED_2,
index.getName(),
index.getPath()));
}
}
File instanceDir = new File(m_solrConfig.getHome() + FileSystems.getDefault().getSeparator() + index.getName());
if (!instanceDir.exists()) {
instanceDir.mkdirs();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_INDEX_DIR_CREATED_2,
index.getName(),
index.getPath()));
}
}
// create the core
// TODO: suboptimal - forces always the same schema
SolrCore core = null;
try {
// creation includes registration.
// TODO: this was the old code: core = m_coreContainer.create(descriptor, false);
Map<String, String> properties = new HashMap<String, String>(3);
properties.put(CoreDescriptor.CORE_DATADIR, dataDir.getAbsolutePath());
properties.put(CoreDescriptor.CORE_CONFIGSET, "default");
core = m_coreContainer.create(index.getCoreName(), instanceDir.toPath(), properties, false);
} catch (NullPointerException e) {
if (core != null) {
core.close();
}
throw new CmsConfigurationException(
Messages.get().container(
Messages.ERR_SOLR_SERVER_NOT_CREATED_3,
index.getName() + " (" + index.getCoreName() + ")",
index.getPath(),
m_solrConfig.getSolrConfigFile().getAbsolutePath()),
e);
}
if (index.isNoSolrServerSet()) {
index.setSolrServer(new EmbeddedSolrServer(m_coreContainer, index.getCoreName()));
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_SERVER_CREATED_1,
index.getName() + " (" + index.getCoreName() + ")"));
}
} } | public class class_name {
@SuppressWarnings("resource")
public void registerSolrIndex(CmsSolrIndex index) throws CmsConfigurationException {
if ((m_solrConfig == null) || !m_solrConfig.isEnabled()) {
// No solr server configured
throw new CmsConfigurationException(Messages.get().container(Messages.ERR_SOLR_NOT_ENABLED_0));
}
if (m_solrConfig.getServerUrl() != null) {
// HTTP Server configured
// TODO Implement multi core support for HTTP server
// @see http://lucidworks.lucidimagination.com/display/solr/Configuring+solr.xml
index.setSolrServer(new Builder().withBaseSolrUrl(m_solrConfig.getServerUrl()).build());
}
// get the core container that contains one core for each configured index
if (m_coreContainer == null) {
m_coreContainer = createCoreContainer();
}
// unload the existing core if it exists to avoid problems with forced unlock.
if (m_coreContainer.getAllCoreNames().contains(index.getCoreName())) {
m_coreContainer.unload(index.getCoreName(), false, false, true);
}
// ensure that all locks on the index are gone
ensureIndexIsUnlocked(index.getPath());
// load the core to the container
File dataDir = new File(index.getPath());
if (!dataDir.exists()) {
dataDir.mkdirs();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_INDEX_DIR_CREATED_2,
index.getName(),
index.getPath())); // depends on control dependency: [if], data = [none]
}
}
File instanceDir = new File(m_solrConfig.getHome() + FileSystems.getDefault().getSeparator() + index.getName());
if (!instanceDir.exists()) {
instanceDir.mkdirs();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_INDEX_DIR_CREATED_2,
index.getName(),
index.getPath()));
}
}
// create the core
// TODO: suboptimal - forces always the same schema
SolrCore core = null;
try {
// creation includes registration.
// TODO: this was the old code: core = m_coreContainer.create(descriptor, false);
Map<String, String> properties = new HashMap<String, String>(3);
properties.put(CoreDescriptor.CORE_DATADIR, dataDir.getAbsolutePath());
properties.put(CoreDescriptor.CORE_CONFIGSET, "default");
core = m_coreContainer.create(index.getCoreName(), instanceDir.toPath(), properties, false);
} catch (NullPointerException e) {
if (core != null) {
core.close();
}
throw new CmsConfigurationException(
Messages.get().container(
Messages.ERR_SOLR_SERVER_NOT_CREATED_3,
index.getName() + " (" + index.getCoreName() + ")",
index.getPath(),
m_solrConfig.getSolrConfigFile().getAbsolutePath()),
e);
}
if (index.isNoSolrServerSet()) {
index.setSolrServer(new EmbeddedSolrServer(m_coreContainer, index.getCoreName()));
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_SERVER_CREATED_1,
index.getName() + " (" + index.getCoreName() + ")"));
}
} } |
public class class_name {
public GVRMesh loadMesh(GVRAndroidResource androidResource,
EnumSet<GVRImportSettings> settings)
{
GVRMesh mesh = mMeshCache.get(androidResource);
if (mesh == null)
{
try
{
GVRSceneObject model = loadModel(androidResource, settings, true, null);
mesh = findMesh(model);
if (mesh != null)
{
mMeshCache.put(androidResource, mesh);
}
else
{
throw new IOException("No mesh found in model " + androidResource.getResourcePath());
}
}
catch (IOException ex)
{
mContext.getEventManager().sendEvent(this, IAssetEvents.class,
"onModelError", new Object[] { mContext, ex.getMessage(),
androidResource.getResourcePath()});
return null;
}
}
return mesh;
} } | public class class_name {
public GVRMesh loadMesh(GVRAndroidResource androidResource,
EnumSet<GVRImportSettings> settings)
{
GVRMesh mesh = mMeshCache.get(androidResource);
if (mesh == null)
{
try
{
GVRSceneObject model = loadModel(androidResource, settings, true, null);
mesh = findMesh(model); // depends on control dependency: [try], data = [none]
if (mesh != null)
{
mMeshCache.put(androidResource, mesh); // depends on control dependency: [if], data = [none]
}
else
{
throw new IOException("No mesh found in model " + androidResource.getResourcePath());
}
}
catch (IOException ex)
{
mContext.getEventManager().sendEvent(this, IAssetEvents.class,
"onModelError", new Object[] { mContext, ex.getMessage(),
androidResource.getResourcePath()});
return null;
} // depends on control dependency: [catch], data = [none]
}
return mesh;
} } |
public class class_name {
public static String getQuestionMark(int count) {
StringBuilder qMark = new StringBuilder();
for (int i = 0; i < count; i++) {
if(i > 0) {
qMark.append(", ");
}
qMark.append("?");
}
return qMark.toString();
} } | public class class_name {
public static String getQuestionMark(int count) {
StringBuilder qMark = new StringBuilder();
for (int i = 0; i < count; i++) {
if(i > 0) {
qMark.append(", "); // depends on control dependency: [if], data = [none]
}
qMark.append("?"); // depends on control dependency: [for], data = [none]
}
return qMark.toString();
} } |
public class class_name {
public long getPosition()
{
initialize();
long position = scoreNodes.getPosition() - invalid;
// scoreNode.getPosition() is one ahead
// if there is a prefetched node
if (next != null)
{
position--;
}
return position;
} } | public class class_name {
public long getPosition()
{
initialize();
long position = scoreNodes.getPosition() - invalid;
// scoreNode.getPosition() is one ahead
// if there is a prefetched node
if (next != null)
{
position--; // depends on control dependency: [if], data = [none]
}
return position;
} } |
public class class_name {
public static boolean showJson() {
String result = getInstance().conf.get("conf.show.json");
if ("true".equalsIgnoreCase(result) || "1".equals(result)) {
return true;
}
return false;
} } | public class class_name {
public static boolean showJson() {
String result = getInstance().conf.get("conf.show.json");
if ("true".equalsIgnoreCase(result) || "1".equals(result)) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
static String decapitalizeNormally(String propertyName) {
if (Strings.isNullOrEmpty(propertyName)) {
return propertyName;
}
return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
} } | public class class_name {
static String decapitalizeNormally(String propertyName) {
if (Strings.isNullOrEmpty(propertyName)) {
return propertyName; // depends on control dependency: [if], data = [none]
}
return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
} } |
public class class_name {
public final Node buildNode(Object entity, PersistenceDelegator pd, Object entityId, NodeState nodeState)
{
String nodeId = ObjectGraphUtils.getNodeId(entityId, entity.getClass());
Node node = this.graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
// return node in case has already been traversed.
if (node != null)
{
if (this.generator.traversedNodes.contains(node))
{
return node;
}
return null;
}
node = new NodeBuilder().assignState(nodeState).buildNode(entity, pd, entityId, nodeId).node;
this.graph.addNode(node.getNodeId(), node);
return node;
} } | public class class_name {
public final Node buildNode(Object entity, PersistenceDelegator pd, Object entityId, NodeState nodeState)
{
String nodeId = ObjectGraphUtils.getNodeId(entityId, entity.getClass());
Node node = this.graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
// return node in case has already been traversed.
if (node != null)
{
if (this.generator.traversedNodes.contains(node))
{
return node; // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
node = new NodeBuilder().assignState(nodeState).buildNode(entity, pd, entityId, nodeId).node;
this.graph.addNode(node.getNodeId(), node);
return node;
} } |
public class class_name {
public JarProbeOption resources(String... resourcePaths) {
for (String resource : resourcePaths) {
resources.add(resource);
}
return this;
} } | public class class_name {
public JarProbeOption resources(String... resourcePaths) {
for (String resource : resourcePaths) {
resources.add(resource); // depends on control dependency: [for], data = [resource]
}
return this;
} } |
public class class_name {
private void sendRequest(
Node retriedNode,
Queue<Node> queryPlan,
int currentExecutionIndex,
int retryCount,
boolean scheduleNextExecution) {
if (result.isDone()) {
return;
}
Node node = retriedNode;
DriverChannel channel = null;
if (node == null || (channel = session.getChannel(node, logPrefix)) == null) {
while (!result.isDone() && (node = queryPlan.poll()) != null) {
channel = session.getChannel(node, logPrefix);
if (channel != null) {
break;
}
}
}
if (channel == null) {
// We've reached the end of the query plan without finding any node to write to
if (!result.isDone() && activeExecutionsCount.decrementAndGet() == 0) {
// We're the last execution so fail the result
setFinalError(AllNodesFailedException.fromErrors(this.errors), null, -1);
}
} else {
NodeResponseCallback nodeResponseCallback =
new NodeResponseCallback(
node,
queryPlan,
channel,
currentExecutionIndex,
retryCount,
scheduleNextExecution,
logPrefix);
channel
.write(message, statement.isTracing(), statement.getCustomPayload(), nodeResponseCallback)
.addListener(nodeResponseCallback);
}
} } | public class class_name {
private void sendRequest(
Node retriedNode,
Queue<Node> queryPlan,
int currentExecutionIndex,
int retryCount,
boolean scheduleNextExecution) {
if (result.isDone()) {
return; // depends on control dependency: [if], data = [none]
}
Node node = retriedNode;
DriverChannel channel = null;
if (node == null || (channel = session.getChannel(node, logPrefix)) == null) {
while (!result.isDone() && (node = queryPlan.poll()) != null) {
channel = session.getChannel(node, logPrefix); // depends on control dependency: [while], data = [none]
if (channel != null) {
break;
}
}
}
if (channel == null) {
// We've reached the end of the query plan without finding any node to write to
if (!result.isDone() && activeExecutionsCount.decrementAndGet() == 0) {
// We're the last execution so fail the result
setFinalError(AllNodesFailedException.fromErrors(this.errors), null, -1); // depends on control dependency: [if], data = [none]
}
} else {
NodeResponseCallback nodeResponseCallback =
new NodeResponseCallback(
node,
queryPlan,
channel,
currentExecutionIndex,
retryCount,
scheduleNextExecution,
logPrefix);
channel
.write(message, statement.isTracing(), statement.getCustomPayload(), nodeResponseCallback)
.addListener(nodeResponseCallback); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ActivityTypeInfos withTypeInfos(ActivityTypeInfo... typeInfos) {
if (this.typeInfos == null) {
setTypeInfos(new java.util.ArrayList<ActivityTypeInfo>(typeInfos.length));
}
for (ActivityTypeInfo ele : typeInfos) {
this.typeInfos.add(ele);
}
return this;
} } | public class class_name {
public ActivityTypeInfos withTypeInfos(ActivityTypeInfo... typeInfos) {
if (this.typeInfos == null) {
setTypeInfos(new java.util.ArrayList<ActivityTypeInfo>(typeInfos.length)); // depends on control dependency: [if], data = [none]
}
for (ActivityTypeInfo ele : typeInfos) {
this.typeInfos.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public T orElseSupplier(final Supplier<T> other) {
checkNotNull(other, "orElse requires a non null supplier");
if (isPresent()) {
return get();
}
return other.get();
} } | public class class_name {
public T orElseSupplier(final Supplier<T> other) {
checkNotNull(other, "orElse requires a non null supplier");
if (isPresent()) {
return get(); // depends on control dependency: [if], data = [none]
}
return other.get();
} } |
public class class_name {
public static <T, L extends List<T>> L sortThis(L list, final Predicate2<? super T, ? super T> predicate)
{
return Iterate.sortThis(list, new Comparator<T>()
{
public int compare(T o1, T o2)
{
if (predicate.accept(o1, o2))
{
return -1;
}
if (predicate.accept(o2, o1))
{
return 1;
}
return 0;
}
});
} } | public class class_name {
public static <T, L extends List<T>> L sortThis(L list, final Predicate2<? super T, ? super T> predicate)
{
return Iterate.sortThis(list, new Comparator<T>()
{
public int compare(T o1, T o2)
{
if (predicate.accept(o1, o2))
{
return -1; // depends on control dependency: [if], data = [none]
}
if (predicate.accept(o2, o1))
{
return 1; // depends on control dependency: [if], data = [none]
}
return 0;
}
});
} } |
public class class_name {
private void deliverAsynchExceptionToClient(Throwable throwable, String probeId) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "deliverAsynchExceptionToClient", throwable);
if (!isComplete()) {
if (alarm != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Cancelling the alarm: " + alarm.toString());
alarm.cancel();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Alarm cancelled");
}
if (!isComplete()) {
//Deregister listener as we are now done with our receive.
//Deregistration will probably fail in most cases so ignore any exceptions.
try {
final MPConsumerSession mpSession = (MPConsumerSession) mainConsumer.getConsumerSession();
mpSession.getConnection().removeConnectionListener(this);
} catch (SIException s) {
//No FFDC code needed as everything has likely gone wrong already at this point.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, s.getMessage(), s);
}
sendErrorToClient(throwable, probeId);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "deliverAsynchExceptionToClient");
} } | public class class_name {
private void deliverAsynchExceptionToClient(Throwable throwable, String probeId) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "deliverAsynchExceptionToClient", throwable);
if (!isComplete()) {
if (alarm != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Cancelling the alarm: " + alarm.toString());
alarm.cancel(); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Alarm cancelled");
}
if (!isComplete()) {
//Deregister listener as we are now done with our receive.
//Deregistration will probably fail in most cases so ignore any exceptions.
try {
final MPConsumerSession mpSession = (MPConsumerSession) mainConsumer.getConsumerSession();
mpSession.getConnection().removeConnectionListener(this); // depends on control dependency: [try], data = [none]
} catch (SIException s) {
//No FFDC code needed as everything has likely gone wrong already at this point.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, s.getMessage(), s);
} // depends on control dependency: [catch], data = [none]
sendErrorToClient(throwable, probeId); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "deliverAsynchExceptionToClient");
} } |
public class class_name {
public static InputStream getStringInputStream(String string)
{
InputStream is = null;
try {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(ba);
os.writeUTF(string);
os.flush();
is = new ByteArrayInputStream(ba.toByteArray());
} catch (IOException ex) {
ex.printStackTrace();
}
return is;
} } | public class class_name {
public static InputStream getStringInputStream(String string)
{
InputStream is = null;
try {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(ba);
os.writeUTF(string); // depends on control dependency: [try], data = [none]
os.flush(); // depends on control dependency: [try], data = [none]
is = new ByteArrayInputStream(ba.toByteArray()); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return is;
} } |
public class class_name {
public BlockEncodeRequest getWaitingRequest() {
BlockEncodeRequest result = null;
synchronized(getLock) {
boolean loop = true;
try {
while(loop) {
result = unassignedEncodeRequests.poll(500, TimeUnit.MILLISECONDS);
if(result != null) {
synchronized(outstandingCountLock) {
outstandingCountLock.notifyAll();
}
orderedEncodeRequests.add(result);
}
loop = false;
}
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
}
}
return result;
} } | public class class_name {
public BlockEncodeRequest getWaitingRequest() {
BlockEncodeRequest result = null;
synchronized(getLock) {
boolean loop = true;
try {
while(loop) {
result = unassignedEncodeRequests.poll(500, TimeUnit.MILLISECONDS); // depends on control dependency: [while], data = [none]
if(result != null) {
synchronized(outstandingCountLock) { // depends on control dependency: [if], data = [none]
outstandingCountLock.notifyAll();
}
orderedEncodeRequests.add(result); // depends on control dependency: [if], data = [(result]
}
loop = false; // depends on control dependency: [while], data = [none]
}
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public void writeResources()
{
StreamOut out = null;
Record registration = this.getMainRecord();
Resource resource = (Resource)this.getRecord(Resource.RESOURCE_FILE);
String strCurrentFileName = "none";
String strCurrentLanguage = "none";
String strCurrentLocale = "none";
try {
registration.setKeyArea(Registration.RESOURCE_ID_KEY);
registration.close();
boolean bFirstTime = true;
boolean bResourceListBundle = true;
while (registration.hasNext())
{
registration.next();
String strFileName = resource.getField(Resource.CODE).toString();
String strLanguage = registration.getField(Registration.LANGUAGE).toString();
String strLocale = registration.getField(Registration.LOCALE).toString();
if ((!strCurrentFileName.equals(strFileName))
|| (!strCurrentLanguage.equals(strLanguage))
|| (!strCurrentLocale.equals(strLocale)))
{ // New file
if (out != null)
this.printEndFile(out, strCurrentFileName, bResourceListBundle); // End file stuff
out = null;
if (ResourceTypeField.PROPERTIES.equals(resource.getField(Resource.TYPE).getString()))
bResourceListBundle = false;
else
bResourceListBundle = true;
// Start new file
strCurrentFileName = strFileName;
strCurrentLanguage = strLanguage;
strCurrentLocale = strLocale;
String packageName = resource.getField(Resource.LOCATION).toString();
strFileName += "Resources";
if (strLanguage != null)
if (strLanguage.length() > 0)
strFileName += "_" + strLanguage;
if (strLocale != null)
if (strLocale.length() > 0)
strFileName += "_" + strLocale;
ClassProject recClassProject = (ClassProject)((ReferenceField)resource.getField(Resource.CLASS_PROJECT_ID)).getReference();
strFileName = strFileName.replace('.', '/');
String basePackageName = packageName;
if (basePackageName.startsWith("." + DBConstants.RES_SUBPACKAGE.substring(0, DBConstants.RES_SUBPACKAGE.length() - 1)))
basePackageName = basePackageName.substring(DBConstants.RES_SUBPACKAGE.length()); // Get rid of ".res".. it will be added back later
String strFullFileName = recClassProject.getFileName(strFileName, basePackageName, bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, true, true);
packageName = recClassProject.getFullPackage(bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, packageName);
out = this.createFile(strFullFileName);
out.writeit(this.getStartSourceCode(packageName, strFileName, resource.getField(Resource.DESCRIPTION).toString(), bResourceListBundle));
if (bResourceListBundle)
{
out.writeit(" static final Object[][] contents = {\n");
out.writeit(" // LOCALIZE THIS\n");
}
bFirstTime = true;
}
if (!bFirstTime)
{
if (bResourceListBundle)
out.writeit(",\n");
else
out.writeit("\n");
}
bFirstTime = false;
this.writeDetailLine(registration, out, bResourceListBundle);
}
if (out != null)
this.printEndFile(out, strCurrentFileName, bResourceListBundle); // End file stuff
out = null;
} catch (DBException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void writeResources()
{
StreamOut out = null;
Record registration = this.getMainRecord();
Resource resource = (Resource)this.getRecord(Resource.RESOURCE_FILE);
String strCurrentFileName = "none";
String strCurrentLanguage = "none";
String strCurrentLocale = "none";
try {
registration.setKeyArea(Registration.RESOURCE_ID_KEY);
registration.close();
boolean bFirstTime = true;
boolean bResourceListBundle = true;
while (registration.hasNext())
{
registration.next(); // depends on control dependency: [while], data = [none]
String strFileName = resource.getField(Resource.CODE).toString();
String strLanguage = registration.getField(Registration.LANGUAGE).toString();
String strLocale = registration.getField(Registration.LOCALE).toString();
if ((!strCurrentFileName.equals(strFileName))
|| (!strCurrentLanguage.equals(strLanguage))
|| (!strCurrentLocale.equals(strLocale)))
{ // New file
if (out != null)
this.printEndFile(out, strCurrentFileName, bResourceListBundle); // End file stuff
out = null; // depends on control dependency: [if], data = [none]
if (ResourceTypeField.PROPERTIES.equals(resource.getField(Resource.TYPE).getString()))
bResourceListBundle = false;
else
bResourceListBundle = true;
// Start new file
strCurrentFileName = strFileName; // depends on control dependency: [if], data = [none]
strCurrentLanguage = strLanguage; // depends on control dependency: [if], data = [none]
strCurrentLocale = strLocale; // depends on control dependency: [if], data = [none]
String packageName = resource.getField(Resource.LOCATION).toString();
strFileName += "Resources"; // depends on control dependency: [if], data = [none]
if (strLanguage != null)
if (strLanguage.length() > 0)
strFileName += "_" + strLanguage;
if (strLocale != null)
if (strLocale.length() > 0)
strFileName += "_" + strLocale;
ClassProject recClassProject = (ClassProject)((ReferenceField)resource.getField(Resource.CLASS_PROJECT_ID)).getReference();
strFileName = strFileName.replace('.', '/'); // depends on control dependency: [if], data = [none]
String basePackageName = packageName;
if (basePackageName.startsWith("." + DBConstants.RES_SUBPACKAGE.substring(0, DBConstants.RES_SUBPACKAGE.length() - 1)))
basePackageName = basePackageName.substring(DBConstants.RES_SUBPACKAGE.length()); // Get rid of ".res".. it will be added back later
String strFullFileName = recClassProject.getFileName(strFileName, basePackageName, bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, true, true);
packageName = recClassProject.getFullPackage(bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, packageName); // depends on control dependency: [if], data = [none]
out = this.createFile(strFullFileName); // depends on control dependency: [if], data = [none]
out.writeit(this.getStartSourceCode(packageName, strFileName, resource.getField(Resource.DESCRIPTION).toString(), bResourceListBundle)); // depends on control dependency: [if], data = [none]
if (bResourceListBundle)
{
out.writeit(" static final Object[][] contents = {\n"); // depends on control dependency: [if], data = [none]
out.writeit(" // LOCALIZE THIS\n");
}
bFirstTime = true; // depends on control dependency: [if], data = [none]
}
if (!bFirstTime)
{
if (bResourceListBundle)
out.writeit(",\n");
else
out.writeit("\n");
}
bFirstTime = false; // depends on control dependency: [if], data = [none]
this.writeDetailLine(registration, out, bResourceListBundle); // depends on control dependency: [if], data = [none]
}
if (out != null)
this.printEndFile(out, strCurrentFileName, bResourceListBundle); // End file stuff
out = null; // depends on control dependency: [while], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
}
} } |
public class class_name {
private void checkForDuplicateConditions(List<Stmt.Case> cases) {
HashSet<Expr> seen = new HashSet<>();
for(int i=0;i!=cases.size();++i) {
Stmt.Case c = cases.get(i);
Tuple<Expr> conditions = c.getConditions();
// Check whether any of these conditions already seen.
for(int j=0;j!=conditions.size();++j) {
Expr condition = conditions.get(j);
if(seen.contains(condition)) {
syntaxError("duplicate case label", condition);
} else {
seen.add(condition);
}
}
}
} } | public class class_name {
private void checkForDuplicateConditions(List<Stmt.Case> cases) {
HashSet<Expr> seen = new HashSet<>();
for(int i=0;i!=cases.size();++i) {
Stmt.Case c = cases.get(i);
Tuple<Expr> conditions = c.getConditions();
// Check whether any of these conditions already seen.
for(int j=0;j!=conditions.size();++j) {
Expr condition = conditions.get(j);
if(seen.contains(condition)) {
syntaxError("duplicate case label", condition); // depends on control dependency: [if], data = [none]
} else {
seen.add(condition); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
protected static UBTree<Literal> generateSubsumedUBTree(final Formula formula) {
final SortedMap<Integer, List<SortedSet<Literal>>> mapping = new TreeMap<>();
for (final Formula term : formula) {
List<SortedSet<Literal>> terms = mapping.get(term.literals().size());
if (terms == null) {
terms = new LinkedList<>();
mapping.put(term.literals().size(), terms);
}
terms.add(term.literals());
}
final UBTree<Literal> ubTree = new UBTree<>();
for (final Map.Entry<Integer, List<SortedSet<Literal>>> entry : mapping.entrySet()) {
for (final SortedSet<Literal> set : entry.getValue()) {
if (ubTree.firstSubset(set) == null) {
ubTree.addSet(set);
}
}
}
return ubTree;
} } | public class class_name {
protected static UBTree<Literal> generateSubsumedUBTree(final Formula formula) {
final SortedMap<Integer, List<SortedSet<Literal>>> mapping = new TreeMap<>();
for (final Formula term : formula) {
List<SortedSet<Literal>> terms = mapping.get(term.literals().size());
if (terms == null) {
terms = new LinkedList<>(); // depends on control dependency: [if], data = [none]
mapping.put(term.literals().size(), terms); // depends on control dependency: [if], data = [none]
}
terms.add(term.literals()); // depends on control dependency: [for], data = [term]
}
final UBTree<Literal> ubTree = new UBTree<>();
for (final Map.Entry<Integer, List<SortedSet<Literal>>> entry : mapping.entrySet()) {
for (final SortedSet<Literal> set : entry.getValue()) {
if (ubTree.firstSubset(set) == null) {
ubTree.addSet(set); // depends on control dependency: [if], data = [none]
}
}
}
return ubTree;
} } |
public class class_name {
public void checkTags(Doc doc, Tag[] tags, boolean areInlineTags) {
if (tags == null) {
return;
}
Taglet taglet;
for (int i = 0; i < tags.length; i++) {
String name = tags[i].name();
if (name.length() > 0 && name.charAt(0) == '@') {
name = name.substring(1, name.length());
}
if (! (standardTags.contains(name) || customTags.containsKey(name))) {
if (standardTagsLowercase.contains(StringUtils.toLowerCase(name))) {
message.warning(tags[i].position(), "doclet.UnknownTagLowercase", tags[i].name());
continue;
} else {
message.warning(tags[i].position(), "doclet.UnknownTag", tags[i].name());
continue;
}
}
//Check if this tag is being used in the wrong location.
if ((taglet = customTags.get(name)) != null) {
if (areInlineTags && ! taglet.isInlineTag()) {
printTagMisuseWarn(taglet, tags[i], "inline");
}
if ((doc instanceof RootDoc) && ! taglet.inOverview()) {
printTagMisuseWarn(taglet, tags[i], "overview");
} else if ((doc instanceof PackageDoc) && ! taglet.inPackage()) {
printTagMisuseWarn(taglet, tags[i], "package");
} else if ((doc instanceof ClassDoc) && ! taglet.inType()) {
printTagMisuseWarn(taglet, tags[i], "class");
} else if ((doc instanceof ConstructorDoc) && ! taglet.inConstructor()) {
printTagMisuseWarn(taglet, tags[i], "constructor");
} else if ((doc instanceof FieldDoc) && ! taglet.inField()) {
printTagMisuseWarn(taglet, tags[i], "field");
} else if ((doc instanceof MethodDoc) && ! taglet.inMethod()) {
printTagMisuseWarn(taglet, tags[i], "method");
}
}
}
} } | public class class_name {
public void checkTags(Doc doc, Tag[] tags, boolean areInlineTags) {
if (tags == null) {
return; // depends on control dependency: [if], data = [none]
}
Taglet taglet;
for (int i = 0; i < tags.length; i++) {
String name = tags[i].name();
if (name.length() > 0 && name.charAt(0) == '@') {
name = name.substring(1, name.length()); // depends on control dependency: [if], data = [none]
}
if (! (standardTags.contains(name) || customTags.containsKey(name))) {
if (standardTagsLowercase.contains(StringUtils.toLowerCase(name))) {
message.warning(tags[i].position(), "doclet.UnknownTagLowercase", tags[i].name()); // depends on control dependency: [if], data = [none]
continue;
} else {
message.warning(tags[i].position(), "doclet.UnknownTag", tags[i].name()); // depends on control dependency: [if], data = [none]
continue;
}
}
//Check if this tag is being used in the wrong location.
if ((taglet = customTags.get(name)) != null) {
if (areInlineTags && ! taglet.isInlineTag()) {
printTagMisuseWarn(taglet, tags[i], "inline"); // depends on control dependency: [if], data = [none]
}
if ((doc instanceof RootDoc) && ! taglet.inOverview()) {
printTagMisuseWarn(taglet, tags[i], "overview"); // depends on control dependency: [if], data = [none]
} else if ((doc instanceof PackageDoc) && ! taglet.inPackage()) {
printTagMisuseWarn(taglet, tags[i], "package"); // depends on control dependency: [if], data = [none]
} else if ((doc instanceof ClassDoc) && ! taglet.inType()) {
printTagMisuseWarn(taglet, tags[i], "class"); // depends on control dependency: [if], data = [none]
} else if ((doc instanceof ConstructorDoc) && ! taglet.inConstructor()) {
printTagMisuseWarn(taglet, tags[i], "constructor"); // depends on control dependency: [if], data = [none]
} else if ((doc instanceof FieldDoc) && ! taglet.inField()) {
printTagMisuseWarn(taglet, tags[i], "field"); // depends on control dependency: [if], data = [none]
} else if ((doc instanceof MethodDoc) && ! taglet.inMethod()) {
printTagMisuseWarn(taglet, tags[i], "method"); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private List<Class<?>> scanClassAndPutMetadata(InputStream bits, Reader reader,
Map<String, EntityMetadata> entityMetadataMap, Map<String, Class<?>> entityNameToClassMap,
String persistenceUnit, String client, Map<String, List<String>> clazzToPuMap,
Map<String, IdDiscriptor> entityNameToKeyDiscriptorMap) throws IOException
{
DataInputStream dstream = new DataInputStream(new BufferedInputStream(bits));
ClassFile cf = null;
String className = null;
List<Class<?>> classes = new ArrayList<Class<?>>();
try
{
cf = new ClassFile(dstream);
className = cf.getName();
List<String> annotations = new ArrayList<String>();
reader.accumulateAnnotations(annotations,
(AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag));
reader.accumulateAnnotations(annotations,
(AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag));
// iterate through all valid annotations
for (String validAnn : reader.getValidAnnotations())
{
// check if the current class has one?
if (annotations.contains(validAnn))
{
Class<?> clazz = this.getClass().getClassLoader().loadClass(className);
this.factory.validate(clazz);
// get the name of entity to be used for entity to class map
// if or not annotated with name
String entityName = getEntityName(clazz);
if ((entityNameToClassMap.containsKey(entityName) && !entityNameToClassMap.get(entityName)
.getName().equals(clazz.getName())))
{
throw new MetamodelLoaderException("Name conflict between classes "
+ entityNameToClassMap.get(entityName).getName() + " and " + clazz.getName()
+ ". Make sure no two entity classes with the same name "
+ " are specified for persistence unit " + persistenceUnit);
}
entityNameToClassMap.put(entityName, clazz);
EntityMetadata metadata = entityMetadataMap.get(clazz);
if (null == metadata)
{
log.debug("Metadata not found in cache for " + clazz.getName());
// double check locking.
synchronized (clazz)
{
if (null == metadata)
{
MetadataBuilder metadataBuilder = new MetadataBuilder(persistenceUnit, client,
KunderaCoreUtils.getExternalProperties(persistenceUnit, externalPropertyMap,
persistenceUnits), kunderaMetadata);
metadata = metadataBuilder.buildEntityMetadata(clazz);
// in case entity's pu does not belong to parse
// persistence unit, it will be null.
if (metadata != null)
{
entityMetadataMap.put(clazz.getName(), metadata);
mapClazztoPu(clazz, persistenceUnit, clazzToPuMap);
processGeneratedValueAnnotation(clazz, persistenceUnit, metadata,
entityNameToKeyDiscriptorMap);
}
}
}
}
// TODO :
onValidateClientProperties(classes, clazz, persistenceUnit);
}
}
}
catch (ClassNotFoundException e)
{
log.error("Class " + className + " not found, it won't be loaded as entity");
}
finally
{
if (dstream != null)
{
dstream.close();
}
if (bits != null)
{
bits.close();
}
}
return classes;
} } | public class class_name {
private List<Class<?>> scanClassAndPutMetadata(InputStream bits, Reader reader,
Map<String, EntityMetadata> entityMetadataMap, Map<String, Class<?>> entityNameToClassMap,
String persistenceUnit, String client, Map<String, List<String>> clazzToPuMap,
Map<String, IdDiscriptor> entityNameToKeyDiscriptorMap) throws IOException
{
DataInputStream dstream = new DataInputStream(new BufferedInputStream(bits));
ClassFile cf = null;
String className = null;
List<Class<?>> classes = new ArrayList<Class<?>>();
try
{
cf = new ClassFile(dstream);
className = cf.getName();
List<String> annotations = new ArrayList<String>();
reader.accumulateAnnotations(annotations,
(AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag));
reader.accumulateAnnotations(annotations,
(AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag));
// iterate through all valid annotations
for (String validAnn : reader.getValidAnnotations())
{
// check if the current class has one?
if (annotations.contains(validAnn))
{
Class<?> clazz = this.getClass().getClassLoader().loadClass(className);
this.factory.validate(clazz);
// get the name of entity to be used for entity to class map
// if or not annotated with name
String entityName = getEntityName(clazz);
if ((entityNameToClassMap.containsKey(entityName) && !entityNameToClassMap.get(entityName)
.getName().equals(clazz.getName())))
{
throw new MetamodelLoaderException("Name conflict between classes "
+ entityNameToClassMap.get(entityName).getName() + " and " + clazz.getName()
+ ". Make sure no two entity classes with the same name "
+ " are specified for persistence unit " + persistenceUnit);
}
entityNameToClassMap.put(entityName, clazz);
EntityMetadata metadata = entityMetadataMap.get(clazz);
if (null == metadata)
{
log.debug("Metadata not found in cache for " + clazz.getName());
// depends on control dependency: [if], data = [none]
// double check locking.
synchronized (clazz)
// depends on control dependency: [if], data = [none]
{
if (null == metadata)
{
MetadataBuilder metadataBuilder = new MetadataBuilder(persistenceUnit, client,
KunderaCoreUtils.getExternalProperties(persistenceUnit, externalPropertyMap,
persistenceUnits), kunderaMetadata);
metadata = metadataBuilder.buildEntityMetadata(clazz);
// depends on control dependency: [if], data = [none]
// in case entity's pu does not belong to parse
// persistence unit, it will be null.
if (metadata != null)
{
entityMetadataMap.put(clazz.getName(), metadata);
// depends on control dependency: [if], data = [none]
mapClazztoPu(clazz, persistenceUnit, clazzToPuMap);
// depends on control dependency: [if], data = [none]
processGeneratedValueAnnotation(clazz, persistenceUnit, metadata,
entityNameToKeyDiscriptorMap);
// depends on control dependency: [if], data = [none]
}
}
}
}
// TODO :
onValidateClientProperties(classes, clazz, persistenceUnit);
}
}
}
catch (ClassNotFoundException e)
{
log.error("Class " + className + " not found, it won't be loaded as entity");
}
finally
{
if (dstream != null)
{
dstream.close();
}
if (bits != null)
{
bits.close();
}
}
return classes;
} } |
public class class_name {
public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId)
{
try {
Stat stat = new Stat();
final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoin_node_blocker, false, stat)).getInt();
if (hostId == rejoiningHost) {
zk.delete(rejoin_node_blocker, stat.getVersion());
return true;
}
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.NONODE ||
e.code() == KeeperException.Code.BADVERSION) {
// Okay if the rejoin blocker for the given hostId is already gone.
return true;
}
} catch (InterruptedException e) {
return false;
}
return false;
} } | public class class_name {
public static boolean removeRejoinNodeIndicatorForHost(ZooKeeper zk, int hostId)
{
try {
Stat stat = new Stat();
final int rejoiningHost = ByteBuffer.wrap(zk.getData(rejoin_node_blocker, false, stat)).getInt();
if (hostId == rejoiningHost) {
zk.delete(rejoin_node_blocker, stat.getVersion()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} catch (KeeperException e) {
if (e.code() == KeeperException.Code.NONODE ||
e.code() == KeeperException.Code.BADVERSION) {
// Okay if the rejoin blocker for the given hostId is already gone.
return true; // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
return false;
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
public void includeSilent(String target, String element) {
try {
include(target, element, null);
} catch (Throwable t) {
// ignore
}
} } | public class class_name {
public void includeSilent(String target, String element) {
try {
include(target, element, null); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// ignore
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EJSHome getHomeByName(String application, String beanName)
throws EJBNotFoundException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getHomeByName : " + application + ", " + beanName);
AppLinkData linkData = getAppLinkData(application); // F743-26072
if (linkData == null)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "application " + application + " not found");
}
else
{
J2EEName j2eeName;
synchronized (linkData)
{
j2eeName = findApplicationBean(linkData, application, beanName);
}
if (j2eeName != null)
{
EJSHome retHome = (EJSHome) getHome(j2eeName);
if (retHome != null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getHomeByName : " + retHome.getJ2EEName());
return retHome;
}
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "EJB " + beanName + " not found");
}
}
EJBNotFoundException ex =
new EJBNotFoundException("EJB named " + beanName +
" not present in application " +
application + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getHomeByName : " + ex);
throw ex;
} } | public class class_name {
public EJSHome getHomeByName(String application, String beanName)
throws EJBNotFoundException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getHomeByName : " + application + ", " + beanName);
AppLinkData linkData = getAppLinkData(application); // F743-26072
if (linkData == null)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "application " + application + " not found");
}
else
{
J2EEName j2eeName;
synchronized (linkData)
{
j2eeName = findApplicationBean(linkData, application, beanName);
}
if (j2eeName != null)
{
EJSHome retHome = (EJSHome) getHome(j2eeName);
if (retHome != null)
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getHomeByName : " + retHome.getJ2EEName());
return retHome; // depends on control dependency: [if], data = [none]
}
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "EJB " + beanName + " not found");
}
}
EJBNotFoundException ex =
new EJBNotFoundException("EJB named " + beanName +
" not present in application " +
application + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getHomeByName : " + ex);
throw ex;
} } |
public class class_name {
void setId(String sessionAuthId) {
synchronized (lock) {
if (isCreatingSession.get()) {
this.sessionAuthId = sessionAuthId;
}
lock.notifyAll();
}
} } | public class class_name {
void setId(String sessionAuthId) {
synchronized (lock) {
if (isCreatingSession.get()) {
this.sessionAuthId = sessionAuthId; // depends on control dependency: [if], data = [none]
}
lock.notifyAll();
}
} } |
public class class_name {
public double getLowerBound(final int numStdDev) {
if (!isEstimationMode()) { return getRetainedEntries(); }
return BinomialBoundsN.getLowerBound(getRetainedEntries(), getTheta(), numStdDev, isEmpty_);
} } | public class class_name {
public double getLowerBound(final int numStdDev) {
if (!isEstimationMode()) { return getRetainedEntries(); } // depends on control dependency: [if], data = [none]
return BinomialBoundsN.getLowerBound(getRetainedEntries(), getTheta(), numStdDev, isEmpty_);
} } |
public class class_name {
ValidationDriver createSchematronDriver(String phase) {
SchemaReaderLoader loader = new SchemaReaderLoader();
SchemaReader schReader = loader.createSchemaReader(SCHEMATRON_NS_URI);
this.configPropBuilder = new PropertyMapBuilder();
SchematronProperty.DIAGNOSE.add(this.configPropBuilder);
if (this.outputLogger == null) {
this.outputLogger = new PrintWriter(System.out);
}
if (null != phase && !phase.isEmpty()) {
this.configPropBuilder.put(SchematronProperty.PHASE, phase);
}
ErrorHandler eh = new ErrorHandlerImpl("Schematron", outputLogger);
this.configPropBuilder.put(ValidateProperty.ERROR_HANDLER, eh);
ValidationDriver validator = new ValidationDriver(
this.configPropBuilder.toPropertyMap(), schReader);
return validator;
} } | public class class_name {
ValidationDriver createSchematronDriver(String phase) {
SchemaReaderLoader loader = new SchemaReaderLoader();
SchemaReader schReader = loader.createSchemaReader(SCHEMATRON_NS_URI);
this.configPropBuilder = new PropertyMapBuilder();
SchematronProperty.DIAGNOSE.add(this.configPropBuilder);
if (this.outputLogger == null) {
this.outputLogger = new PrintWriter(System.out);
// depends on control dependency: [if], data = [none]
}
if (null != phase && !phase.isEmpty()) {
this.configPropBuilder.put(SchematronProperty.PHASE, phase);
// depends on control dependency: [if], data = [none]
}
ErrorHandler eh = new ErrorHandlerImpl("Schematron", outputLogger);
this.configPropBuilder.put(ValidateProperty.ERROR_HANDLER, eh);
ValidationDriver validator = new ValidationDriver(
this.configPropBuilder.toPropertyMap(), schReader);
return validator;
} } |
public class class_name {
void onFilterLabelRemoved(String columnId, int row) {
super.filterUpdate(columnId, row);
// Update the displayer view in order to reflect the current selection
// (only if not has already been redrawn in the previous filterUpdate() call)
if (!displayerSettings.isFilterSelfApplyEnabled()) {
updateVisualization();
}
} } | public class class_name {
void onFilterLabelRemoved(String columnId, int row) {
super.filterUpdate(columnId, row);
// Update the displayer view in order to reflect the current selection
// (only if not has already been redrawn in the previous filterUpdate() call)
if (!displayerSettings.isFilterSelfApplyEnabled()) {
updateVisualization(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int indexForColumnName(String name) {
final Integer index = rs.getColumnNames().get(name);
if (index == null) { return -1; }
return ((missingColumns & (1 << index.intValue())) == 0) ? index.intValue() : -1;
} } | public class class_name {
private int indexForColumnName(String name) {
final Integer index = rs.getColumnNames().get(name);
if (index == null) { return -1; } // depends on control dependency: [if], data = [none]
return ((missingColumns & (1 << index.intValue())) == 0) ? index.intValue() : -1;
} } |
public class class_name {
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes)
{
for (ElemTemplateElement node = m_firstChild;
node != null;
node = node.m_nextSibling)
{
node.callVisitors(visitor);
}
} } | public class class_name {
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes)
{
for (ElemTemplateElement node = m_firstChild;
node != null;
node = node.m_nextSibling)
{
node.callVisitors(visitor); // depends on control dependency: [for], data = [node]
}
} } |
public class class_name {
private static <V> ListenableFuture<List<V>> listFuture(
ImmutableList<ListenableFuture<? extends V>> futures,
boolean allMustSucceed, Executor listenerExecutor) {
return new CombinedFuture<V, List<V>>(
futures, allMustSucceed, listenerExecutor,
new FutureCombiner<V, List<V>>() {
@Override
public List<V> combine(List<Optional<V>> values) {
List<V> result = Lists.newArrayList();
for (Optional<V> element : values) {
result.add(element != null ? element.orNull() : null);
}
return Collections.unmodifiableList(result);
}
});
} } | public class class_name {
private static <V> ListenableFuture<List<V>> listFuture(
ImmutableList<ListenableFuture<? extends V>> futures,
boolean allMustSucceed, Executor listenerExecutor) {
return new CombinedFuture<V, List<V>>(
futures, allMustSucceed, listenerExecutor,
new FutureCombiner<V, List<V>>() {
@Override
public List<V> combine(List<Optional<V>> values) {
List<V> result = Lists.newArrayList();
for (Optional<V> element : values) {
result.add(element != null ? element.orNull() : null); // depends on control dependency: [for], data = [element]
}
return Collections.unmodifiableList(result);
}
});
} } |
public class class_name {
public void marshall(DescribePolicyRequest describePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (describePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describePolicyRequest.getPolicyId(), POLICYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribePolicyRequest describePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (describePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describePolicyRequest.getPolicyId(), POLICYID_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 buildAttributeValueObject(final String name) {
attrval.name = name;
attrval.quality = AttrQuality.ATTR_VALID;
attrval.time = new TimeVal();
attrval.r_dim = new AttributeDim();
attrval.w_dim = new AttributeDim();
attrval.r_dim.dim_x = 1;
attrval.r_dim.dim_y = 0;
attrval.w_dim.dim_x = 0;
attrval.w_dim.dim_y = 0;
try {
attrval.value = ApiUtil.get_orb().create_any();
} catch (final DevFailed e) {
}
final long now = System.currentTimeMillis();
attrval.time.tv_sec = (int) (now / 1000);
attrval.time.tv_usec = (int) (now - attrval.time.tv_sec * 1000) * 1000;
attrval.time.tv_nsec = 0;
attrval.err_list = null;
} } | public class class_name {
private void buildAttributeValueObject(final String name) {
attrval.name = name;
attrval.quality = AttrQuality.ATTR_VALID;
attrval.time = new TimeVal();
attrval.r_dim = new AttributeDim();
attrval.w_dim = new AttributeDim();
attrval.r_dim.dim_x = 1;
attrval.r_dim.dim_y = 0;
attrval.w_dim.dim_x = 0;
attrval.w_dim.dim_y = 0;
try {
attrval.value = ApiUtil.get_orb().create_any(); // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
} // depends on control dependency: [catch], data = [none]
final long now = System.currentTimeMillis();
attrval.time.tv_sec = (int) (now / 1000);
attrval.time.tv_usec = (int) (now - attrval.time.tv_sec * 1000) * 1000;
attrval.time.tv_nsec = 0;
attrval.err_list = null;
} } |
public class class_name {
public boolean isAnnotated(ExecutableElement method) {
List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : annotationMirrors) {
String typeName = annotationMirror.getAnnotationType().toString();
if (!AnnotationUtil.INTERNAL_ANNOTATION_NAMES.contains(typeName)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean isAnnotated(ExecutableElement method) {
List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : annotationMirrors) {
String typeName = annotationMirror.getAnnotationType().toString();
if (!AnnotationUtil.INTERNAL_ANNOTATION_NAMES.contains(typeName)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
protected void throwExceptionForError(final int errorCode) {
try {
m_connection.throwException(errorCode);
} catch (final IOException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@Override
protected void throwExceptionForError(final int errorCode) {
try {
m_connection.throwException(errorCode); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isValid(@Nullable final String multiDayOfTheWeeks) {
if (multiDayOfTheWeeks == null) {
return true;
}
final StringTokenizer tok = new StringTokenizer(multiDayOfTheWeeks, "/");
if (tok.countTokens() == 0) {
return false;
}
final List<DayOfTheWeek> days = new ArrayList<>();
while (tok.hasMoreTokens()) {
final String part = tok.nextToken();
final int p = part.indexOf('-');
if (p > -1) {
// dd-dd
final String part1 = part.substring(0, p);
final String part2 = part.substring(p + 1);
if (!DayOfTheWeek.isValid(part1) || !DayOfTheWeek.isValid(part2)) {
return false;
}
final DayOfTheWeek from = DayOfTheWeek.valueOf(part1);
final DayOfTheWeek to = DayOfTheWeek.valueOf(part2);
if (from == to || from.after(to)) {
return false;
}
for (final DayOfTheWeek dow : DayOfTheWeek.getPart(from, to)) {
if (days.contains(dow)) {
return false;
}
days.add(dow);
}
} else {
// dd
if (!DayOfTheWeek.isValid(part)) {
return false;
}
final DayOfTheWeek dow = DayOfTheWeek.valueOf(part);
if (days.contains(dow)) {
return false;
}
days.add(dow);
}
}
return true;
} } | public class class_name {
public static boolean isValid(@Nullable final String multiDayOfTheWeeks) {
if (multiDayOfTheWeeks == null) {
return true; // depends on control dependency: [if], data = [none]
}
final StringTokenizer tok = new StringTokenizer(multiDayOfTheWeeks, "/");
if (tok.countTokens() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
final List<DayOfTheWeek> days = new ArrayList<>();
while (tok.hasMoreTokens()) {
final String part = tok.nextToken();
final int p = part.indexOf('-');
if (p > -1) {
// dd-dd
final String part1 = part.substring(0, p);
final String part2 = part.substring(p + 1);
if (!DayOfTheWeek.isValid(part1) || !DayOfTheWeek.isValid(part2)) {
return false; // depends on control dependency: [if], data = [none]
}
final DayOfTheWeek from = DayOfTheWeek.valueOf(part1);
final DayOfTheWeek to = DayOfTheWeek.valueOf(part2);
if (from == to || from.after(to)) {
return false; // depends on control dependency: [if], data = [none]
}
for (final DayOfTheWeek dow : DayOfTheWeek.getPart(from, to)) {
if (days.contains(dow)) {
return false; // depends on control dependency: [if], data = [none]
}
days.add(dow); // depends on control dependency: [for], data = [dow]
}
} else {
// dd
if (!DayOfTheWeek.isValid(part)) {
return false; // depends on control dependency: [if], data = [none]
}
final DayOfTheWeek dow = DayOfTheWeek.valueOf(part);
if (days.contains(dow)) {
return false; // depends on control dependency: [if], data = [none]
}
days.add(dow); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void execute(final String[] args) {
try {
Options options = createOptions();
if (collectOptions(options, args)) {
setDefaults();
loadConfig();
execute(getInput(), getInputEncoding(), getOutput(),
getTargetNamespacePrefix(), getXsltFileName());
}
} catch (Exception e) {
_log.error("COBOL to Xsd translation failure", e);
throw new RuntimeException(e);
}
} } | public class class_name {
public void execute(final String[] args) {
try {
Options options = createOptions();
if (collectOptions(options, args)) {
setDefaults(); // depends on control dependency: [if], data = [none]
loadConfig(); // depends on control dependency: [if], data = [none]
execute(getInput(), getInputEncoding(), getOutput(),
getTargetNamespacePrefix(), getXsltFileName()); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
_log.error("COBOL to Xsd translation failure", e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String createDocumentFeatureDescriptor(
final TrainingParameters params) throws IOException {
// <generators>
final Element generators = new Element("generators");
final Document doc = new Document(generators);
// <custom bagofwords /.
if (Flags.isBagOfWordsFeature(params)) {
final String tokenFeatureRange = Flags.getBagOfWordsFeaturesRange(params);
final Element tokenFeature = new Element("custom");
tokenFeature.setAttribute("class", BagOfWordsFeatureGenerator.class.getName());
tokenFeature.setAttribute("range", tokenFeatureRange);
generators.addContent(tokenFeature);
System.err.println("-> BOW features added!");
}
if (Flags.isTokenClassFeature(params)) {
final String tokenClassFeatureRange = Flags
.getTokenClassFeaturesRange(params);
final Element tokenClassFeature = new Element("custom");
tokenClassFeature.setAttribute("class",
DocTokenClassFeatureGenerator.class.getName());
tokenClassFeature.setAttribute("range", tokenClassFeatureRange);
generators.addContent(tokenClassFeature);
System.err.println("-> Token Class Features added!");
}
if (Flags.isOutcomePriorFeature(params)) {
final Element outcomePriorFeature = new Element("custom");
outcomePriorFeature.setAttribute("class",
DocOutcomePriorFeatureGenerator.class.getName());
generators.addContent(outcomePriorFeature);
System.err.println("-> Outcome Prior Features added!");
}
if (Flags.isSentenceFeature(params)) {
final String beginSentence = Flags.getSentenceFeaturesBegin(params);
final String endSentence = Flags.getSentenceFeaturesEnd(params);
final Element sentenceFeature = new Element("custom");
sentenceFeature.setAttribute("class",
DocSentenceFeatureGenerator.class.getName());
sentenceFeature.setAttribute("begin", beginSentence);
sentenceFeature.setAttribute("end", endSentence);
generators.addContent(sentenceFeature);
System.err.println("-> Sentence Features added!");
}
if (Flags.isPrefixFeature(params)) {
final String beginPrefix = Flags.getPrefixFeaturesBegin(params);
final String endPrefix = Flags.getPrefixFeaturesEnd(params);
final Element prefixFeature = new Element("custom");
prefixFeature.setAttribute("class",
DocPrefixFeatureGenerator.class.getName());
prefixFeature.setAttribute("begin", beginPrefix);
prefixFeature.setAttribute("end", endPrefix);
generators.addContent(prefixFeature);
System.err.println("-> Prefix Features added!");
}
if (Flags.isSuffixFeature(params)) {
final String beginSuffix = Flags.getSuffixFeaturesBegin(params);
final String endSuffix = Flags.getSuffixFeaturesEnd(params);
final Element suffixFeature = new Element("custom");
suffixFeature.setAttribute("class",
DocSuffixFeatureGenerator.class.getName());
suffixFeature.setAttribute("begin", beginSuffix);
suffixFeature.setAttribute("end", endSuffix);
generators.addContent(suffixFeature);
System.err.println("-> Suffix Features added!");
}
if (Flags.isNgramFeature(params)) {
final String charngramRange = Flags.getNgramFeaturesRange(params);
final String[] rangeArray = Flags.processNgramRange(charngramRange);
final Element charngramFeature = new Element("custom");
charngramFeature.setAttribute("class",
NGramFeatureGenerator.class.getName());
charngramFeature.setAttribute("minLength", rangeArray[0]);
charngramFeature.setAttribute("maxLength", rangeArray[1]);
generators.addContent(charngramFeature);
System.err.println("-> Ngram Features added!");
}
if (Flags.isCharNgramClassFeature(params)) {
final String charngramRange = Flags.getCharNgramFeaturesRange(params);
final String[] rangeArray = Flags.processNgramRange(charngramRange);
final Element charngramFeature = new Element("custom");
charngramFeature.setAttribute("class",
DocCharacterNgramFeatureGenerator.class.getName());
charngramFeature.setAttribute("minLength", rangeArray[0]);
charngramFeature.setAttribute("maxLength", rangeArray[1]);
generators.addContent(charngramFeature);
System.err.println("-> CharNgram Class Features added!");
}
// Polarity Dictionary Features
if (Flags.isDictionaryPolarityFeatures(params)) {
final String dictPath = Flags.getDictionaryPolarityFeatures(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
DocPolarityDictionaryFeatureGenerator.class.getName());
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName()));
generators.addContent(dictFeatures);
}
System.err.println("-> Dictionary Features added!");
}
// Frequent Word Features
if (Flags.isFrequentWordFeatures(params)) {
final String dictPath = Flags.getFrequentWordFeatures(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
FrequentWordFeatureGenerator.class.getName());
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName()));
generators.addContent(dictFeatures);
}
System.err.println("-> Frequent Word Features added!");
}
//Opinion Target Extraction Features
if (Flags.isTargetFeatures(params)) {
final String targetModelPath = Flags.getTargetFeatures(params);
final String targetModelRange = Flags.getTargetFeaturesRange(params);
final Element targetClassFeatureElement = new Element("custom");
targetClassFeatureElement.setAttribute("class",
DocTargetFeatureGenerator.class.getName());
targetClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(targetModelPath).getName()));
targetClassFeatureElement.setAttribute("range", targetModelRange);
generators.addContent(targetClassFeatureElement);
System.err.println("-> Target Model Features added!");
}
// Dictionary Features
if (Flags.isDictionaryFeatures(params)) {
final String dictPath = Flags.getDictionaryFeatures(params);
final String seqCodec = Flags.getSequenceCodec(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
DocDictionaryFeatureGenerator.class.getName());
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName()));
dictFeatures.setAttribute("seqCodec", seqCodec);
generators.addContent(dictFeatures);
}
System.err.println("-> Dictionary Features added!");
}
// Brown clustering features
if (Flags.isBrownFeatures(params)) {
final String brownClusterPath = Flags.getBrownFeatures(params);
final List<File> brownClusterFiles = Flags
.getClusterLexiconFiles(brownClusterPath);
for (final File brownClusterFile : brownClusterFiles) {
// brown bigram class features
final Element brownBigramFeatures = new Element("custom");
brownBigramFeatures.setAttribute("class",
DocBrownBigramFeatureGenerator.class.getName());
brownBigramFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName()));
//generators.addContent(brownBigramFeatures);
// brown token feature
final Element brownTokenFeature = new Element("custom");
brownTokenFeature.setAttribute("class",
DocBrownTokenFeatureGenerator.class.getName());
brownTokenFeature.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName()));
generators.addContent(brownTokenFeature);
// brown token class feature
final Element brownTokenClassFeature = new Element("custom");
brownTokenClassFeature.setAttribute("class",
DocBrownTokenClassFeatureGenerator.class.getName());
brownTokenClassFeature.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName()));
//generators.addContent(brownTokenClassFeature);
}
System.err.println("-> Brown Cluster Features added!");
}
// Clark clustering features
if (Flags.isClarkFeatures(params)) {
final String clarkClusterPath = Flags.getClarkFeatures(params);
final List<File> clarkClusterFiles = Flags
.getClusterLexiconFiles(clarkClusterPath);
for (final File clarkCluster : clarkClusterFiles) {
final Element clarkFeatures = new Element("custom");
clarkFeatures.setAttribute("class",
DocClarkFeatureGenerator.class.getName());
clarkFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(clarkCluster.getName()));
generators.addContent(clarkFeatures);
}
System.err.println("-> Clark Cluster Features added!");
}
// word2vec clustering features
if (Flags.isWord2VecClusterFeatures(params)) {
final String word2vecClusterPath = Flags
.getWord2VecClusterFeatures(params);
final List<File> word2vecClusterFiles = Flags
.getClusterLexiconFiles(word2vecClusterPath);
for (final File word2vecFile : word2vecClusterFiles) {
final Element word2vecClusterFeatures = new Element("custom");
word2vecClusterFeatures.setAttribute("class",
DocWord2VecClusterFeatureGenerator.class.getName());
word2vecClusterFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(word2vecFile.getName()));
generators.addContent(word2vecClusterFeatures);
}
System.err.println("-> Word2Vec Clusters Features added!");
}
// Morphological features
if (Flags.isPOSTagModelFeatures(params)) {
final String posModelPath = Flags.getPOSTagModelFeatures(params);
final String posModelRange = Flags.getPOSTagModelFeaturesRange(params);
final Element posTagClassFeatureElement = new Element("custom");
posTagClassFeatureElement.setAttribute("class",
DocPOSTagModelFeatureGenerator.class.getName());
posTagClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(posModelPath).getName()));
posTagClassFeatureElement.setAttribute("range", posModelRange);
generators.addContent(posTagClassFeatureElement);
System.err.println("-> POSTagModel Features added!");
}
if (Flags.isLemmaModelFeatures(params)) {
final String lemmaModelPath = Flags.getLemmaModelFeatures(params);
final Element lemmaClassFeatureElement = new Element("custom");
lemmaClassFeatureElement.setAttribute("class",
DocLemmaModelFeatureGenerator.class.getName());
lemmaClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(lemmaModelPath).getName()));
generators.addContent(lemmaClassFeatureElement);
System.err.println("-> LemmaModel Features added!");
}
if (Flags.isLemmaDictionaryFeatures(params)) {
final String lemmaDictPath = Flags.getLemmaDictionaryFeatures(params);
final String[] lemmaDictResources = Flags
.getLemmaDictionaryResources(lemmaDictPath);
final Element lemmaClassFeatureElement = new Element("custom");
lemmaClassFeatureElement.setAttribute("class",
DocLemmaDictionaryFeatureGenerator.class.getName());
lemmaClassFeatureElement.setAttribute("model", IOUtils
.normalizeLexiconName(new File(lemmaDictResources[0]).getName()));
lemmaClassFeatureElement.setAttribute("dict", IOUtils
.normalizeLexiconName(new File(lemmaDictResources[1]).getName()));
generators.addContent(lemmaClassFeatureElement);
System.err.println("-> LemmaDictionary Features added!");
}
final XMLOutputter xmlOutput = new XMLOutputter();
final Format format = Format.getPrettyFormat();
xmlOutput.setFormat(format);
return xmlOutput.outputString(doc);
} } | public class class_name {
public static String createDocumentFeatureDescriptor(
final TrainingParameters params) throws IOException {
// <generators>
final Element generators = new Element("generators");
final Document doc = new Document(generators);
// <custom bagofwords /.
if (Flags.isBagOfWordsFeature(params)) {
final String tokenFeatureRange = Flags.getBagOfWordsFeaturesRange(params);
final Element tokenFeature = new Element("custom");
tokenFeature.setAttribute("class", BagOfWordsFeatureGenerator.class.getName());
tokenFeature.setAttribute("range", tokenFeatureRange);
generators.addContent(tokenFeature);
System.err.println("-> BOW features added!");
}
if (Flags.isTokenClassFeature(params)) {
final String tokenClassFeatureRange = Flags
.getTokenClassFeaturesRange(params);
final Element tokenClassFeature = new Element("custom");
tokenClassFeature.setAttribute("class",
DocTokenClassFeatureGenerator.class.getName());
tokenClassFeature.setAttribute("range", tokenClassFeatureRange);
generators.addContent(tokenClassFeature);
System.err.println("-> Token Class Features added!");
}
if (Flags.isOutcomePriorFeature(params)) {
final Element outcomePriorFeature = new Element("custom");
outcomePriorFeature.setAttribute("class",
DocOutcomePriorFeatureGenerator.class.getName());
generators.addContent(outcomePriorFeature);
System.err.println("-> Outcome Prior Features added!");
}
if (Flags.isSentenceFeature(params)) {
final String beginSentence = Flags.getSentenceFeaturesBegin(params);
final String endSentence = Flags.getSentenceFeaturesEnd(params);
final Element sentenceFeature = new Element("custom");
sentenceFeature.setAttribute("class",
DocSentenceFeatureGenerator.class.getName());
sentenceFeature.setAttribute("begin", beginSentence);
sentenceFeature.setAttribute("end", endSentence);
generators.addContent(sentenceFeature);
System.err.println("-> Sentence Features added!");
}
if (Flags.isPrefixFeature(params)) {
final String beginPrefix = Flags.getPrefixFeaturesBegin(params);
final String endPrefix = Flags.getPrefixFeaturesEnd(params);
final Element prefixFeature = new Element("custom");
prefixFeature.setAttribute("class",
DocPrefixFeatureGenerator.class.getName());
prefixFeature.setAttribute("begin", beginPrefix);
prefixFeature.setAttribute("end", endPrefix);
generators.addContent(prefixFeature);
System.err.println("-> Prefix Features added!");
}
if (Flags.isSuffixFeature(params)) {
final String beginSuffix = Flags.getSuffixFeaturesBegin(params);
final String endSuffix = Flags.getSuffixFeaturesEnd(params);
final Element suffixFeature = new Element("custom");
suffixFeature.setAttribute("class",
DocSuffixFeatureGenerator.class.getName());
suffixFeature.setAttribute("begin", beginSuffix);
suffixFeature.setAttribute("end", endSuffix);
generators.addContent(suffixFeature);
System.err.println("-> Suffix Features added!");
}
if (Flags.isNgramFeature(params)) {
final String charngramRange = Flags.getNgramFeaturesRange(params);
final String[] rangeArray = Flags.processNgramRange(charngramRange);
final Element charngramFeature = new Element("custom");
charngramFeature.setAttribute("class",
NGramFeatureGenerator.class.getName());
charngramFeature.setAttribute("minLength", rangeArray[0]);
charngramFeature.setAttribute("maxLength", rangeArray[1]);
generators.addContent(charngramFeature);
System.err.println("-> Ngram Features added!");
}
if (Flags.isCharNgramClassFeature(params)) {
final String charngramRange = Flags.getCharNgramFeaturesRange(params);
final String[] rangeArray = Flags.processNgramRange(charngramRange);
final Element charngramFeature = new Element("custom");
charngramFeature.setAttribute("class",
DocCharacterNgramFeatureGenerator.class.getName());
charngramFeature.setAttribute("minLength", rangeArray[0]);
charngramFeature.setAttribute("maxLength", rangeArray[1]);
generators.addContent(charngramFeature);
System.err.println("-> CharNgram Class Features added!");
}
// Polarity Dictionary Features
if (Flags.isDictionaryPolarityFeatures(params)) {
final String dictPath = Flags.getDictionaryPolarityFeatures(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
DocPolarityDictionaryFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName())); // depends on control dependency: [for], data = [none]
generators.addContent(dictFeatures); // depends on control dependency: [for], data = [none]
}
System.err.println("-> Dictionary Features added!");
}
// Frequent Word Features
if (Flags.isFrequentWordFeatures(params)) {
final String dictPath = Flags.getFrequentWordFeatures(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
FrequentWordFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName())); // depends on control dependency: [for], data = [none]
generators.addContent(dictFeatures); // depends on control dependency: [for], data = [none]
}
System.err.println("-> Frequent Word Features added!");
}
//Opinion Target Extraction Features
if (Flags.isTargetFeatures(params)) {
final String targetModelPath = Flags.getTargetFeatures(params);
final String targetModelRange = Flags.getTargetFeaturesRange(params);
final Element targetClassFeatureElement = new Element("custom");
targetClassFeatureElement.setAttribute("class",
DocTargetFeatureGenerator.class.getName());
targetClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(targetModelPath).getName()));
targetClassFeatureElement.setAttribute("range", targetModelRange);
generators.addContent(targetClassFeatureElement);
System.err.println("-> Target Model Features added!");
}
// Dictionary Features
if (Flags.isDictionaryFeatures(params)) {
final String dictPath = Flags.getDictionaryFeatures(params);
final String seqCodec = Flags.getSequenceCodec(params);
final List<File> fileList = StringUtils.getFilesInDir(new File(dictPath));
for (final File dictFile : fileList) {
final Element dictFeatures = new Element("custom");
dictFeatures.setAttribute("class",
DocDictionaryFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
dictFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(dictFile.getName())); // depends on control dependency: [for], data = [none]
dictFeatures.setAttribute("seqCodec", seqCodec); // depends on control dependency: [for], data = [none]
generators.addContent(dictFeatures); // depends on control dependency: [for], data = [none]
}
System.err.println("-> Dictionary Features added!");
}
// Brown clustering features
if (Flags.isBrownFeatures(params)) {
final String brownClusterPath = Flags.getBrownFeatures(params);
final List<File> brownClusterFiles = Flags
.getClusterLexiconFiles(brownClusterPath);
for (final File brownClusterFile : brownClusterFiles) {
// brown bigram class features
final Element brownBigramFeatures = new Element("custom");
brownBigramFeatures.setAttribute("class",
DocBrownBigramFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
brownBigramFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName())); // depends on control dependency: [for], data = [none]
//generators.addContent(brownBigramFeatures);
// brown token feature
final Element brownTokenFeature = new Element("custom");
brownTokenFeature.setAttribute("class",
DocBrownTokenFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
brownTokenFeature.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName())); // depends on control dependency: [for], data = [none]
generators.addContent(brownTokenFeature); // depends on control dependency: [for], data = [none]
// brown token class feature
final Element brownTokenClassFeature = new Element("custom");
brownTokenClassFeature.setAttribute("class",
DocBrownTokenClassFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
brownTokenClassFeature.setAttribute("dict",
IOUtils.normalizeLexiconName(brownClusterFile.getName())); // depends on control dependency: [for], data = [none]
//generators.addContent(brownTokenClassFeature);
}
System.err.println("-> Brown Cluster Features added!");
}
// Clark clustering features
if (Flags.isClarkFeatures(params)) {
final String clarkClusterPath = Flags.getClarkFeatures(params);
final List<File> clarkClusterFiles = Flags
.getClusterLexiconFiles(clarkClusterPath);
for (final File clarkCluster : clarkClusterFiles) {
final Element clarkFeatures = new Element("custom");
clarkFeatures.setAttribute("class",
DocClarkFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
clarkFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(clarkCluster.getName())); // depends on control dependency: [for], data = [none]
generators.addContent(clarkFeatures); // depends on control dependency: [for], data = [none]
}
System.err.println("-> Clark Cluster Features added!");
}
// word2vec clustering features
if (Flags.isWord2VecClusterFeatures(params)) {
final String word2vecClusterPath = Flags
.getWord2VecClusterFeatures(params);
final List<File> word2vecClusterFiles = Flags
.getClusterLexiconFiles(word2vecClusterPath);
for (final File word2vecFile : word2vecClusterFiles) {
final Element word2vecClusterFeatures = new Element("custom");
word2vecClusterFeatures.setAttribute("class",
DocWord2VecClusterFeatureGenerator.class.getName()); // depends on control dependency: [for], data = [none]
word2vecClusterFeatures.setAttribute("dict",
IOUtils.normalizeLexiconName(word2vecFile.getName())); // depends on control dependency: [for], data = [none]
generators.addContent(word2vecClusterFeatures); // depends on control dependency: [for], data = [none]
}
System.err.println("-> Word2Vec Clusters Features added!");
}
// Morphological features
if (Flags.isPOSTagModelFeatures(params)) {
final String posModelPath = Flags.getPOSTagModelFeatures(params);
final String posModelRange = Flags.getPOSTagModelFeaturesRange(params);
final Element posTagClassFeatureElement = new Element("custom");
posTagClassFeatureElement.setAttribute("class",
DocPOSTagModelFeatureGenerator.class.getName());
posTagClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(posModelPath).getName()));
posTagClassFeatureElement.setAttribute("range", posModelRange);
generators.addContent(posTagClassFeatureElement);
System.err.println("-> POSTagModel Features added!");
}
if (Flags.isLemmaModelFeatures(params)) {
final String lemmaModelPath = Flags.getLemmaModelFeatures(params);
final Element lemmaClassFeatureElement = new Element("custom");
lemmaClassFeatureElement.setAttribute("class",
DocLemmaModelFeatureGenerator.class.getName());
lemmaClassFeatureElement.setAttribute("model",
IOUtils.normalizeLexiconName(new File(lemmaModelPath).getName()));
generators.addContent(lemmaClassFeatureElement);
System.err.println("-> LemmaModel Features added!");
}
if (Flags.isLemmaDictionaryFeatures(params)) {
final String lemmaDictPath = Flags.getLemmaDictionaryFeatures(params);
final String[] lemmaDictResources = Flags
.getLemmaDictionaryResources(lemmaDictPath);
final Element lemmaClassFeatureElement = new Element("custom");
lemmaClassFeatureElement.setAttribute("class",
DocLemmaDictionaryFeatureGenerator.class.getName());
lemmaClassFeatureElement.setAttribute("model", IOUtils
.normalizeLexiconName(new File(lemmaDictResources[0]).getName()));
lemmaClassFeatureElement.setAttribute("dict", IOUtils
.normalizeLexiconName(new File(lemmaDictResources[1]).getName()));
generators.addContent(lemmaClassFeatureElement);
System.err.println("-> LemmaDictionary Features added!");
}
final XMLOutputter xmlOutput = new XMLOutputter();
final Format format = Format.getPrettyFormat();
xmlOutput.setFormat(format);
return xmlOutput.outputString(doc);
} } |
public class class_name {
SSLContext getSSLContext(String protocol, KeyManager[] keyManagers, TrustManager[] trustManagers) {
try {
SSLContext sslContext = SSLContext.getInstance(protocol);
sslContext.init(keyManagers, trustManagers, null);
return sslContext;
} catch (NoSuchAlgorithmException e) {
throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND);
} catch (Exception e) {
throw SeedException.wrap(e, CryptoErrorCode.UNEXPECTED_EXCEPTION);
}
} } | public class class_name {
SSLContext getSSLContext(String protocol, KeyManager[] keyManagers, TrustManager[] trustManagers) {
try {
SSLContext sslContext = SSLContext.getInstance(protocol);
sslContext.init(keyManagers, trustManagers, null); // depends on control dependency: [try], data = [none]
return sslContext; // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw SeedException.wrap(e, CryptoErrorCode.UNEXPECTED_EXCEPTION);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public TRow getRow() {
TRow row = null;
if (table != null) {
int[] columnTypes = new int[table.columnCount()];
Object[] values = new Object[table.columnCount()];
try {
ResultSetMetaData metaData = resultSet.getMetaData();
for (TColumn column : table.getColumns()) {
int index = column.getIndex();
Object value = getValue(column);
values[index] = value;
int columnType;
if (value == null) {
columnType = ResultUtils.FIELD_TYPE_NULL;
} else {
int metadataColumnType = metaData
.getColumnType(resultIndexToResultSetIndex(index));
columnType = resultSetTypeToSqlLite(metadataColumnType);
}
columnTypes[index] = columnType;
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to retrieve the row", e);
}
row = getRow(columnTypes, values);
}
return row;
} } | public class class_name {
@Override
public TRow getRow() {
TRow row = null;
if (table != null) {
int[] columnTypes = new int[table.columnCount()];
Object[] values = new Object[table.columnCount()];
try {
ResultSetMetaData metaData = resultSet.getMetaData();
for (TColumn column : table.getColumns()) {
int index = column.getIndex();
Object value = getValue(column);
values[index] = value; // depends on control dependency: [for], data = [none]
int columnType;
if (value == null) {
columnType = ResultUtils.FIELD_TYPE_NULL; // depends on control dependency: [if], data = [none]
} else {
int metadataColumnType = metaData
.getColumnType(resultIndexToResultSetIndex(index));
columnType = resultSetTypeToSqlLite(metadataColumnType); // depends on control dependency: [if], data = [none]
}
columnTypes[index] = columnType; // depends on control dependency: [for], data = [column]
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to retrieve the row", e);
} // depends on control dependency: [catch], data = [none]
row = getRow(columnTypes, values); // depends on control dependency: [if], data = [none]
}
return row;
} } |
public class class_name {
public synchronized Object put(Object key, Object value) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
//PM16861 Modified trace statement by removing toString of session object to avoid deadlock
StringBuffer sb = new StringBuffer("key=").append(key);
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[PUT], sb.toString());
}
if (maxSize == 0)
return null;
CacheEntryWrapper currEntry;
CacheEntryWrapper oldestEntry = null;
// See if entry exists
currEntry = (CacheEntryWrapper) super.get(key);
if (currEntry == null) { // need new entry
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Doesn't exist in HashMap");
}
currentSize++;
if (_iStoreCallback != null) {
_iStoreCallback.sessionLiveCountInc(value);
}
if (currentSize > maxSize) {
// too many entries, remove the oldest
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Too Many Entries.. Remove the oldest entry: " + lru.key);
}
oldestEntry = (CacheEntryWrapper) removeGuts(lru.key);
if (_iStoreCallback != null) {
_iStoreCallback.sessionCacheDiscard(oldestEntry.value);
}
}
currEntry = new CacheEntryWrapper();
currEntry.key = key;
currEntry.value = value;
currEntry.next = mru;
if (mru != null)
mru.prev = currEntry;
else
lru = currEntry;
mru = currEntry;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Adding new entry to the map");
}
}
else { // found entry
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Key already in use .. Reuse the entry");
}
updateCacheList(key);
currEntry.value = value;
}
Object replacedEntry = super.put(key, currEntry);
if (oldestEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
//PM16861
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "Returning object associated with this key: " + oldestEntry.key);
}
return oldestEntry.value;
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], null);
}
return null;
} } | public class class_name {
public synchronized Object put(Object key, Object value) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
//PM16861 Modified trace statement by removing toString of session object to avoid deadlock
StringBuffer sb = new StringBuffer("key=").append(key);
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[PUT], sb.toString()); // depends on control dependency: [if], data = [none]
}
if (maxSize == 0)
return null;
CacheEntryWrapper currEntry;
CacheEntryWrapper oldestEntry = null;
// See if entry exists
currEntry = (CacheEntryWrapper) super.get(key);
if (currEntry == null) { // need new entry
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Doesn't exist in HashMap"); // depends on control dependency: [if], data = [none]
}
currentSize++; // depends on control dependency: [if], data = [none]
if (_iStoreCallback != null) {
_iStoreCallback.sessionLiveCountInc(value); // depends on control dependency: [if], data = [none]
}
if (currentSize > maxSize) {
// too many entries, remove the oldest
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Too Many Entries.. Remove the oldest entry: " + lru.key); // depends on control dependency: [if], data = [none]
}
oldestEntry = (CacheEntryWrapper) removeGuts(lru.key); // depends on control dependency: [if], data = [none]
if (_iStoreCallback != null) {
_iStoreCallback.sessionCacheDiscard(oldestEntry.value); // depends on control dependency: [if], data = [none]
}
}
currEntry = new CacheEntryWrapper(); // depends on control dependency: [if], data = [none]
currEntry.key = key; // depends on control dependency: [if], data = [none]
currEntry.value = value; // depends on control dependency: [if], data = [none]
currEntry.next = mru; // depends on control dependency: [if], data = [none]
if (mru != null)
mru.prev = currEntry;
else
lru = currEntry;
mru = currEntry; // depends on control dependency: [if], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Adding new entry to the map"); // depends on control dependency: [if], data = [none]
}
}
else { // found entry
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[PUT], "Key already in use .. Reuse the entry"); // depends on control dependency: [if], data = [none]
}
updateCacheList(key); // depends on control dependency: [if], data = [none]
currEntry.value = value; // depends on control dependency: [if], data = [none]
}
Object replacedEntry = super.put(key, currEntry);
if (oldestEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
//PM16861
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "Returning object associated with this key: " + oldestEntry.key); // depends on control dependency: [if], data = [none]
}
return oldestEntry.value; // depends on control dependency: [if], data = [none]
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], null); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Double averagePrecision()
{
double n = 0;
double sumPrecision = 0;
for (int i=0; i<pairs.length; i++) {
if (correctPair(i)) {
n++;
double precisionAtRankI = n/(i+1.0);
sumPrecision += precisionAtRankI;
}
}
return new Double(sumPrecision / numCorrectPairs);
} } | public class class_name {
public Double averagePrecision()
{
double n = 0;
double sumPrecision = 0;
for (int i=0; i<pairs.length; i++) {
if (correctPair(i)) {
n++; // depends on control dependency: [if], data = [none]
double precisionAtRankI = n/(i+1.0);
sumPrecision += precisionAtRankI; // depends on control dependency: [if], data = [none]
}
}
return new Double(sumPrecision / numCorrectPairs);
} } |
public class class_name {
private boolean continueBlock() throws IOException {
byte lastByte = buffer[readPtr - 1];
while(true) {
if(maybeFlush()) return true;
if(!hasFullBlock()) {
refillBuffer();
if(!hasFullBlock()) {
state = StateContinuePartialBlock;
return continueContinuePartialBlock(lastByte);
}
}
int weakHash = rc.roll(lastByte, buffer[readPtr + blockSize - 1]);
int blockNum = signatureTable.findBlock(weakHash, buffer, readPtr, blockSize);
if(blockNum != -1) {
writeBlock(blockNum, blockSize);
state = StateNewBlock;
return true;
}
lastByte = buffer[readPtr];
readPtr += 1;
}
} } | public class class_name {
private boolean continueBlock() throws IOException {
byte lastByte = buffer[readPtr - 1];
while(true) {
if(maybeFlush()) return true;
if(!hasFullBlock()) {
refillBuffer(); // depends on control dependency: [if], data = [none]
if(!hasFullBlock()) {
state = StateContinuePartialBlock; // depends on control dependency: [if], data = [none]
return continueContinuePartialBlock(lastByte); // depends on control dependency: [if], data = [none]
}
}
int weakHash = rc.roll(lastByte, buffer[readPtr + blockSize - 1]);
int blockNum = signatureTable.findBlock(weakHash, buffer, readPtr, blockSize);
if(blockNum != -1) {
writeBlock(blockNum, blockSize); // depends on control dependency: [if], data = [(blockNum]
state = StateNewBlock; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
lastByte = buffer[readPtr];
readPtr += 1;
}
} } |
public class class_name {
public static final String translateUser(String name) {
String ouSeparator = (String)(OpenCms.getRuntimeProperty(PARAM_JLAN_OU_SEPARATOR));
if (ouSeparator == null) {
ouSeparator = DEFAULT_OU_SEPARATOR;
}
String result = name;
result = result.replace(ouSeparator, "/");
return result;
} } | public class class_name {
public static final String translateUser(String name) {
String ouSeparator = (String)(OpenCms.getRuntimeProperty(PARAM_JLAN_OU_SEPARATOR));
if (ouSeparator == null) {
ouSeparator = DEFAULT_OU_SEPARATOR;
// depends on control dependency: [if], data = [none]
}
String result = name;
result = result.replace(ouSeparator, "/");
return result;
} } |
public class class_name {
public EClass getCDD() {
if (cddEClass == null) {
cddEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(225);
}
return cddEClass;
} } | public class class_name {
public EClass getCDD() {
if (cddEClass == null) {
cddEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(225); // depends on control dependency: [if], data = [none]
}
return cddEClass;
} } |
public class class_name {
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<JSLProperties> getProperties() {
if (properties == null) {
properties = new ArrayList<JSLProperties>();
}
return this.properties;
} } | public class class_name {
@Generated(value = "com.ibm.jtc.jax.tools.xjc.Driver", date = "2014-06-11T05:49:00-04:00", comments = "JAXB RI v2.2.3-11/28/2011 06:21 AM(foreman)-")
public List<JSLProperties> getProperties() {
if (properties == null) {
properties = new ArrayList<JSLProperties>(); // depends on control dependency: [if], data = [none]
}
return this.properties;
} } |
public class class_name {
public ServiceGroup createServiceGroup(Set<ResourceClass> resourceClasses, ServiceGroup.ServiceGroupBuilder serviceGroupBuilder) {
for (ResourceClass resourceClass : resourceClasses) {
Logger.info("{0} processing started", resourceClass.getClazz().getCanonicalName());
Service service = createResource(resourceClass);
serviceGroupBuilder.service(service);
Logger.info("{0} processing finished", resourceClass.getClazz().getCanonicalName());
}
return serviceGroupBuilder.build();
} } | public class class_name {
public ServiceGroup createServiceGroup(Set<ResourceClass> resourceClasses, ServiceGroup.ServiceGroupBuilder serviceGroupBuilder) {
for (ResourceClass resourceClass : resourceClasses) {
Logger.info("{0} processing started", resourceClass.getClazz().getCanonicalName()); // depends on control dependency: [for], data = [resourceClass]
Service service = createResource(resourceClass);
serviceGroupBuilder.service(service); // depends on control dependency: [for], data = [none]
Logger.info("{0} processing finished", resourceClass.getClazz().getCanonicalName()); // depends on control dependency: [for], data = [resourceClass]
}
return serviceGroupBuilder.build();
} } |
public class class_name {
static synchronized boolean isJettyNpnConfigured() {
try {
Class.forName("org.eclipse.jetty.npn.NextProtoNego", true, null);
return true;
} catch (ClassNotFoundException e) {
jettyNpnUnavailabilityCause = e;
return false;
}
} } | public class class_name {
static synchronized boolean isJettyNpnConfigured() {
try {
Class.forName("org.eclipse.jetty.npn.NextProtoNego", true, null);
return true; // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
jettyNpnUnavailabilityCause = e;
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Traverson traverson(final LinkResolver linkResolver,
final ObjectMapper objectMapper) {
if (objectMapper.isEnabled(ACCEPT_SINGLE_VALUE_AS_ARRAY)) {
return new Traverson(linkResolver, objectMapper);
} else {
return new Traverson(linkResolver, objectMapper
.copy()
.configure(ACCEPT_SINGLE_VALUE_AS_ARRAY, true));
}
} } | public class class_name {
public static Traverson traverson(final LinkResolver linkResolver,
final ObjectMapper objectMapper) {
if (objectMapper.isEnabled(ACCEPT_SINGLE_VALUE_AS_ARRAY)) {
return new Traverson(linkResolver, objectMapper); // depends on control dependency: [if], data = [none]
} else {
return new Traverson(linkResolver, objectMapper
.copy()
.configure(ACCEPT_SINGLE_VALUE_AS_ARRAY, true)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<String> getHostReservationIdSet() {
if (hostReservationIdSet == null) {
hostReservationIdSet = new com.amazonaws.internal.SdkInternalList<String>();
}
return hostReservationIdSet;
} } | public class class_name {
public java.util.List<String> getHostReservationIdSet() {
if (hostReservationIdSet == null) {
hostReservationIdSet = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return hostReservationIdSet;
} } |
public class class_name {
public void addField(String name, Object value, Object type) {
if (value == null) {
this.fields.add(new Field(name, null, null));
} else {
this.fields.add(new Field(name, value.toString(), type.toString()));
}
} } | public class class_name {
public void addField(String name, Object value, Object type) {
if (value == null) {
this.fields.add(new Field(name, null, null)); // depends on control dependency: [if], data = [null)]
} else {
this.fields.add(new Field(name, value.toString(), type.toString())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setMetricGroups(java.util.Collection<String> metricGroups) {
if (metricGroups == null) {
this.metricGroups = null;
return;
}
this.metricGroups = new java.util.ArrayList<String>(metricGroups);
} } | public class class_name {
public void setMetricGroups(java.util.Collection<String> metricGroups) {
if (metricGroups == null) {
this.metricGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.metricGroups = new java.util.ArrayList<String>(metricGroups);
} } |
public class class_name {
public int[] multiply(int[] p, int[] q) {
int len = p.length + q.length - 1;
int[] result = new int[len];
for (int i = 0; i < len; i++) {
result[i] = 0;
}
for (int i = 0; i < p.length; i++) {
for (int j = 0; j < q.length; j++) {
result[i + j] = add(result[i + j], multiply(p[i], q[j]));
}
}
return result;
} } | public class class_name {
public int[] multiply(int[] p, int[] q) {
int len = p.length + q.length - 1;
int[] result = new int[len];
for (int i = 0; i < len; i++) {
result[i] = 0; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < p.length; i++) {
for (int j = 0; j < q.length; j++) {
result[i + j] = add(result[i + j], multiply(p[i], q[j])); // depends on control dependency: [for], data = [j]
}
}
return result;
} } |
public class class_name {
public int compareTo(LogPosition o) {
final int val = fileName.compareTo(o.fileName);
if (val == 0) {
return (int) (position - o.position);
}
return val;
} } | public class class_name {
public int compareTo(LogPosition o) {
final int val = fileName.compareTo(o.fileName);
if (val == 0) {
return (int) (position - o.position);
// depends on control dependency: [if], data = [none]
}
return val;
} } |
public class class_name {
public void setStopbits(String stopbits) {
if (ModbusUtil.isBlank(stopbits) || stopbits.equals("1")) {
this.stopbits = AbstractSerialConnection.ONE_STOP_BIT;
}
else if (stopbits.equals("1.5")) {
this.stopbits = AbstractSerialConnection.ONE_POINT_FIVE_STOP_BITS;
}
else if (stopbits.equals("2")) {
this.stopbits = AbstractSerialConnection.TWO_STOP_BITS;
}
} } | public class class_name {
public void setStopbits(String stopbits) {
if (ModbusUtil.isBlank(stopbits) || stopbits.equals("1")) {
this.stopbits = AbstractSerialConnection.ONE_STOP_BIT; // depends on control dependency: [if], data = [none]
}
else if (stopbits.equals("1.5")) {
this.stopbits = AbstractSerialConnection.ONE_POINT_FIVE_STOP_BITS; // depends on control dependency: [if], data = [none]
}
else if (stopbits.equals("2")) {
this.stopbits = AbstractSerialConnection.TWO_STOP_BITS; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public ServerResponse readObject(ZooPC pc) {
long oid = pc.jdoZooGetOid();
FilePos oie = oidIndex.findOid(oid);
if (oie == null) {
return new ServerResponse(RESULT.OBJECT_NOT_FOUND,
"ERROR OID not found: " + Util.oidToString(oid));
// throw DBLogger.newObjectNotFoundException(
// "ERROR OID not found: " + Util.oidToString(oid));
}
try {
final DataDeSerializer dds = ddsPool.get();
dds.readObject(pc, oie.getPage(), oie.getOffs());
ddsPool.offer(dds);
} catch (RuntimeException e) {
if (DBLogger.isUser(e)) {
throw e;
}
throw DBLogger.newFatal("ERROR reading object: " + Util.oidToString(oid), e);
}
return new ServerResponse(RESULT.SUCCESS);
} } | public class class_name {
@Override
public ServerResponse readObject(ZooPC pc) {
long oid = pc.jdoZooGetOid();
FilePos oie = oidIndex.findOid(oid);
if (oie == null) {
return new ServerResponse(RESULT.OBJECT_NOT_FOUND,
"ERROR OID not found: " + Util.oidToString(oid)); // depends on control dependency: [if], data = [none]
// throw DBLogger.newObjectNotFoundException(
// "ERROR OID not found: " + Util.oidToString(oid));
}
try {
final DataDeSerializer dds = ddsPool.get();
dds.readObject(pc, oie.getPage(), oie.getOffs()); // depends on control dependency: [try], data = [none]
ddsPool.offer(dds); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
if (DBLogger.isUser(e)) {
throw e;
}
throw DBLogger.newFatal("ERROR reading object: " + Util.oidToString(oid), e);
} // depends on control dependency: [catch], data = [none]
return new ServerResponse(RESULT.SUCCESS);
} } |
public class class_name {
private Map<String, List<CmsRelation>> getBrokenRelations(List<String> resourceNames) {
Map<String, List<CmsRelation>> brokenRelations = new HashMap<String, List<CmsRelation>>();
CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterIncludeChildren().filterStructureId(
CmsUUID.getNullUUID());
Iterator<String> itFolders = resourceNames.iterator();
while (itFolders.hasNext()) {
String folderName = itFolders.next();
List<CmsRelation> relations;
try {
relations = m_cms.getRelationsForResource(folderName, filter);
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LINK_SEARCH_1, folderName), e);
continue;
}
Iterator<CmsRelation> itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = itRelations.next();
// target is broken
String resourceName = relation.getSourcePath();
List<CmsRelation> broken = brokenRelations.get(resourceName);
if (broken == null) {
broken = new ArrayList<CmsRelation>();
brokenRelations.put(resourceName, broken);
}
broken.add(relation);
}
}
return brokenRelations;
} } | public class class_name {
private Map<String, List<CmsRelation>> getBrokenRelations(List<String> resourceNames) {
Map<String, List<CmsRelation>> brokenRelations = new HashMap<String, List<CmsRelation>>();
CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterIncludeChildren().filterStructureId(
CmsUUID.getNullUUID());
Iterator<String> itFolders = resourceNames.iterator();
while (itFolders.hasNext()) {
String folderName = itFolders.next();
List<CmsRelation> relations;
try {
relations = m_cms.getRelationsForResource(folderName, filter); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_LINK_SEARCH_1, folderName), e);
continue;
} // depends on control dependency: [catch], data = [none]
Iterator<CmsRelation> itRelations = relations.iterator();
while (itRelations.hasNext()) {
CmsRelation relation = itRelations.next();
// target is broken
String resourceName = relation.getSourcePath();
List<CmsRelation> broken = brokenRelations.get(resourceName);
if (broken == null) {
broken = new ArrayList<CmsRelation>(); // depends on control dependency: [if], data = [none]
brokenRelations.put(resourceName, broken); // depends on control dependency: [if], data = [none]
}
broken.add(relation); // depends on control dependency: [while], data = [none]
}
}
return brokenRelations;
} } |
public class class_name {
@Implementation
protected PersistableBundle getConfigForSubId(int subId) {
PersistableBundle persistableBundle = bundles.get(subId);
if (persistableBundle == null) {
return new PersistableBundle();
}
return persistableBundle;
} } | public class class_name {
@Implementation
protected PersistableBundle getConfigForSubId(int subId) {
PersistableBundle persistableBundle = bundles.get(subId);
if (persistableBundle == null) {
return new PersistableBundle(); // depends on control dependency: [if], data = [none]
}
return persistableBundle;
} } |
public class class_name {
@Override
public void setVariables(Map<String, ServerVariable> variables) {
if (variables == null) {
this.variables = null;
} else {
if (this.variables == null) {
this.variables = new ServerVariablesImpl();
}
this.variables.putAll(variables);
}
} } | public class class_name {
@Override
public void setVariables(Map<String, ServerVariable> variables) {
if (variables == null) {
this.variables = null; // depends on control dependency: [if], data = [none]
} else {
if (this.variables == null) {
this.variables = new ServerVariablesImpl(); // depends on control dependency: [if], data = [none]
}
this.variables.putAll(variables); // depends on control dependency: [if], data = [(variables]
}
} } |
public class class_name {
protected static UL[] readULBatch(ByteBuffer _bb) {
int count = _bb.getInt();
_bb.getInt();
UL[] result = new UL[count];
for (int i = 0; i < count; i++) {
result[i] = UL.read(_bb);
}
return result;
} } | public class class_name {
protected static UL[] readULBatch(ByteBuffer _bb) {
int count = _bb.getInt();
_bb.getInt();
UL[] result = new UL[count];
for (int i = 0; i < count; i++) {
result[i] = UL.read(_bb); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
static List<String> path(String name, @Nullable Path path) {
if (path != null && !path.toString().isEmpty()) {
return Arrays.asList("--" + name, path.toAbsolutePath().toString());
}
return Collections.emptyList();
} } | public class class_name {
static List<String> path(String name, @Nullable Path path) {
if (path != null && !path.toString().isEmpty()) {
return Arrays.asList("--" + name, path.toAbsolutePath().toString()); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} } |
public class class_name {
public void delete(String name) {
try {
String mapKey = name.toUpperCase();
if ((m_items == null) || (m_items.containsKey(mapKey) == false)) {
throw new CatalogException("Catalog item '" + mapKey + "' doesn't exists in " + m_parent);
}
m_items.remove(mapKey);
// assign a relative index to every child item
int index = 1;
for (Entry<String, T> e : m_items.entrySet()) {
e.getValue().m_relativeIndex = index++;
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} } | public class class_name {
public void delete(String name) {
try {
String mapKey = name.toUpperCase();
if ((m_items == null) || (m_items.containsKey(mapKey) == false)) {
throw new CatalogException("Catalog item '" + mapKey + "' doesn't exists in " + m_parent);
}
m_items.remove(mapKey); // depends on control dependency: [try], data = [none]
// assign a relative index to every child item
int index = 1;
for (Entry<String, T> e : m_items.entrySet()) {
e.getValue().m_relativeIndex = index++; // depends on control dependency: [for], data = [e]
}
} catch (Exception ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void displayFacetResult(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) {
removeAllComponents();
Component categories = prepareCategoryFacets(solrResultList, resultWrapper);
if (categories != null) {
addComponent(categories);
}
Component folders = prepareFolderFacets(solrResultList, resultWrapper);
if (folders != null) {
addComponent(folders);
}
Component dates = prepareDateFacets(solrResultList, resultWrapper);
if (dates != null) {
addComponent(dates);
}
} } | public class class_name {
public void displayFacetResult(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) {
removeAllComponents();
Component categories = prepareCategoryFacets(solrResultList, resultWrapper);
if (categories != null) {
addComponent(categories); // depends on control dependency: [if], data = [(categories]
}
Component folders = prepareFolderFacets(solrResultList, resultWrapper);
if (folders != null) {
addComponent(folders); // depends on control dependency: [if], data = [(folders]
}
Component dates = prepareDateFacets(solrResultList, resultWrapper);
if (dates != null) {
addComponent(dates); // depends on control dependency: [if], data = [(dates]
}
} } |
public class class_name {
private void initStandbyFS() {
lastStandbyFSInit = System.currentTimeMillis();
try {
if (standbyFS != null) {
standbyFS.close();
}
LOG.info("DAFS initializing standbyFS");
LOG.info("DAFS primary=" + primaryURI.toString() +
" standby=" + standbyURI.toString());
standbyFS = new StandbyFS();
standbyFS.initialize(standbyURI, conf);
} catch (Exception e) {
LOG.info("DAFS cannot initialize standbyFS: " +
StringUtils.stringifyException(e));
standbyFS = null;
}
} } | public class class_name {
private void initStandbyFS() {
lastStandbyFSInit = System.currentTimeMillis();
try {
if (standbyFS != null) {
standbyFS.close(); // depends on control dependency: [if], data = [none]
}
LOG.info("DAFS initializing standbyFS"); // depends on control dependency: [try], data = [none]
LOG.info("DAFS primary=" + primaryURI.toString() +
" standby=" + standbyURI.toString()); // depends on control dependency: [try], data = [none]
standbyFS = new StandbyFS(); // depends on control dependency: [try], data = [none]
standbyFS.initialize(standbyURI, conf); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.info("DAFS cannot initialize standbyFS: " +
StringUtils.stringifyException(e));
standbyFS = null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static long parseLongBase10(final CharSequence str, final int start, final int end) {
// Current position and character.
int pos = start;
char cur = str.charAt(pos);
// Match sign
boolean isNegative = (cur == '-');
// Carefully consume the - character, update c and i:
if((isNegative || (cur == '+')) && (++pos < end)) {
cur = str.charAt(pos);
}
// Begin parsing real numbers!
if((cur < '0') || (cur > '9')) {
throw NOT_A_NUMBER;
}
// Parse digits into a long, remember offset of decimal point.
long decimal = 0;
while(true) {
final int digit = cur - '0';
if((digit >= 0) && (digit <= 9)) {
final long tmp = (decimal << 3) + (decimal << 1) + digit;
if(tmp < decimal) {
throw PRECISION_OVERFLOW;
}
decimal = tmp;
}
else { // No more digits, or a second dot.
break;
}
if(++pos < end) {
cur = str.charAt(pos);
}
else {
break;
}
}
if(pos != end) {
throw TRAILING_CHARACTERS;
}
return isNegative ? -decimal : decimal;
} } | public class class_name {
public static long parseLongBase10(final CharSequence str, final int start, final int end) {
// Current position and character.
int pos = start;
char cur = str.charAt(pos);
// Match sign
boolean isNegative = (cur == '-');
// Carefully consume the - character, update c and i:
if((isNegative || (cur == '+')) && (++pos < end)) {
cur = str.charAt(pos); // depends on control dependency: [if], data = [none]
}
// Begin parsing real numbers!
if((cur < '0') || (cur > '9')) {
throw NOT_A_NUMBER;
}
// Parse digits into a long, remember offset of decimal point.
long decimal = 0;
while(true) {
final int digit = cur - '0';
if((digit >= 0) && (digit <= 9)) {
final long tmp = (decimal << 3) + (decimal << 1) + digit;
if(tmp < decimal) {
throw PRECISION_OVERFLOW;
}
decimal = tmp; // depends on control dependency: [if], data = [none]
}
else { // No more digits, or a second dot.
break;
}
if(++pos < end) {
cur = str.charAt(pos); // depends on control dependency: [if], data = [none]
}
else {
break;
}
}
if(pos != end) {
throw TRAILING_CHARACTERS;
}
return isNegative ? -decimal : decimal;
} } |
public class class_name {
public java.util.List<String> getClientIDList() {
if (clientIDList == null) {
clientIDList = new com.amazonaws.internal.SdkInternalList<String>();
}
return clientIDList;
} } | public class class_name {
public java.util.List<String> getClientIDList() {
if (clientIDList == null) {
clientIDList = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return clientIDList;
} } |
public class class_name {
public void fileStarted(AuditEvent event) {
final String fileName = StringUtils.replace(event.getFileName(), "\\", "/");
for (File sourceDirectory : sourceDirectories) {
String sourceDirectoryPath = StringUtils.replace(sourceDirectory.getPath(), "\\", "/");
if (fileName.startsWith(sourceDirectoryPath + "/")) {
currentFile = StringUtils.substring(fileName, sourceDirectoryPath.length() + 1);
events = getResults().getFileViolations(currentFile);
break;
}
}
if (events == null) {
events = new ArrayList<>();
}
} } | public class class_name {
public void fileStarted(AuditEvent event) {
final String fileName = StringUtils.replace(event.getFileName(), "\\", "/");
for (File sourceDirectory : sourceDirectories) {
String sourceDirectoryPath = StringUtils.replace(sourceDirectory.getPath(), "\\", "/");
if (fileName.startsWith(sourceDirectoryPath + "/")) {
currentFile = StringUtils.substring(fileName, sourceDirectoryPath.length() + 1); // depends on control dependency: [if], data = [none]
events = getResults().getFileViolations(currentFile); // depends on control dependency: [if], data = [none]
break;
}
}
if (events == null) {
events = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String resolveProperty(
final String nodeAttribute,
final String defaultValue,
final INodeEntry node,
final IRundeckProject frameworkProject,
final Framework framework
)
{
if (null != node.getAttributes().get(nodeAttribute)) {
return node.getAttributes().get(nodeAttribute);
} else if (frameworkProject.hasProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute)
&& !"".equals(frameworkProject.getProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute))) {
return frameworkProject.getProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute);
} else if (framework.hasProperty(JschNodeExecutor.FWK_PROP_PREFIX + nodeAttribute)) {
return framework.getProperty(JschNodeExecutor.FWK_PROP_PREFIX + nodeAttribute);
} else {
return defaultValue;
}
} } | public class class_name {
public static String resolveProperty(
final String nodeAttribute,
final String defaultValue,
final INodeEntry node,
final IRundeckProject frameworkProject,
final Framework framework
)
{
if (null != node.getAttributes().get(nodeAttribute)) {
return node.getAttributes().get(nodeAttribute); // depends on control dependency: [if], data = [none]
} else if (frameworkProject.hasProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute)
&& !"".equals(frameworkProject.getProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute))) {
return frameworkProject.getProperty(JschNodeExecutor.PROJ_PROP_PREFIX + nodeAttribute); // depends on control dependency: [if], data = [none]
} else if (framework.hasProperty(JschNodeExecutor.FWK_PROP_PREFIX + nodeAttribute)) {
return framework.getProperty(JschNodeExecutor.FWK_PROP_PREFIX + nodeAttribute); // depends on control dependency: [if], data = [none]
} else {
return defaultValue; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static Method findGetter(String propertyName, Class entityClass) {
Method getter;
String getterName = "get" + propertyName.substring(0, 1).toUpperCase() +
propertyName.substring(1);
try {
getter = entityClass.getMethod(getterName);
} catch (NoSuchMethodException e) {
// let's try with scala setter name
try {
getter = entityClass.getMethod(propertyName + "_$eq");
} catch (NoSuchMethodException e1) {
throw new DeepIOException(e1);
}
}
return getter;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static Method findGetter(String propertyName, Class entityClass) {
Method getter;
String getterName = "get" + propertyName.substring(0, 1).toUpperCase() +
propertyName.substring(1);
try {
getter = entityClass.getMethod(getterName); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
// let's try with scala setter name
try {
getter = entityClass.getMethod(propertyName + "_$eq"); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e1) {
throw new DeepIOException(e1);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return getter;
} } |
public class class_name {
public ITreeData getNode() {
if (lastPointer.get(mRTX) != null && lastPointer.get(mRTX) < 0) {
return atomics.get(mRTX).getItem(lastPointer.get(mRTX));
} else {
return mRTX.getNode();
}
} } | public class class_name {
public ITreeData getNode() {
if (lastPointer.get(mRTX) != null && lastPointer.get(mRTX) < 0) {
return atomics.get(mRTX).getItem(lastPointer.get(mRTX)); // depends on control dependency: [if], data = [(lastPointer.get(mRTX)]
} else {
return mRTX.getNode(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Configuration generateTaskManagerConfiguration(
Configuration baseConfig,
String jobManagerHostname,
int jobManagerPort,
int numSlots,
FiniteDuration registrationTimeout) {
Configuration cfg = cloneConfiguration(baseConfig);
if (jobManagerHostname != null && !jobManagerHostname.isEmpty()) {
cfg.setString(JobManagerOptions.ADDRESS, jobManagerHostname);
}
if (jobManagerPort > 0) {
cfg.setInteger(JobManagerOptions.PORT, jobManagerPort);
}
cfg.setString(TaskManagerOptions.REGISTRATION_TIMEOUT, registrationTimeout.toString());
if (numSlots != -1){
cfg.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, numSlots);
}
return cfg;
} } | public class class_name {
public static Configuration generateTaskManagerConfiguration(
Configuration baseConfig,
String jobManagerHostname,
int jobManagerPort,
int numSlots,
FiniteDuration registrationTimeout) {
Configuration cfg = cloneConfiguration(baseConfig);
if (jobManagerHostname != null && !jobManagerHostname.isEmpty()) {
cfg.setString(JobManagerOptions.ADDRESS, jobManagerHostname); // depends on control dependency: [if], data = [none]
}
if (jobManagerPort > 0) {
cfg.setInteger(JobManagerOptions.PORT, jobManagerPort); // depends on control dependency: [if], data = [none]
}
cfg.setString(TaskManagerOptions.REGISTRATION_TIMEOUT, registrationTimeout.toString());
if (numSlots != -1){
cfg.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, numSlots); // depends on control dependency: [if], data = [none]
}
return cfg;
} } |
public class class_name {
private boolean tryResolve(final CLClause c, final int pivot, final CLClause d) {
assert !c.dumped() && !c.satisfied();
assert !d.dumped() && !d.satisfied();
boolean res = true;
assert this.seen.empty();
this.stats.steps++;
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit == pivot) { continue; }
assert marked(lit) == 0;
mark(lit);
}
this.stats.steps++;
for (int p = 0; res && p < d.lits().size(); p++) {
final int lit = d.lits().get(p);
if (lit == -pivot) { continue; }
final int m = marked(lit);
if (m > 0) { continue; }
if (m < 0) { res = false; } else { mark(lit); }
}
unmark();
return res;
} } | public class class_name {
private boolean tryResolve(final CLClause c, final int pivot, final CLClause d) {
assert !c.dumped() && !c.satisfied();
assert !d.dumped() && !d.satisfied();
boolean res = true;
assert this.seen.empty();
this.stats.steps++;
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit == pivot) { continue; }
assert marked(lit) == 0; // depends on control dependency: [for], data = [none]
mark(lit); // depends on control dependency: [for], data = [none]
}
this.stats.steps++;
for (int p = 0; res && p < d.lits().size(); p++) {
final int lit = d.lits().get(p);
if (lit == -pivot) { continue; }
final int m = marked(lit);
if (m > 0) { continue; }
if (m < 0) { res = false; } else { mark(lit); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
unmark();
return res;
} } |
public class class_name {
static int parseValidFlags(String flagChars, boolean hasUpperVariant) {
int flags = hasUpperVariant ? FLAG_UPPER_CASE : 0;
for (int i = 0; i < flagChars.length(); i++) {
int flagIdx = indexOfFlagCharacter(flagChars.charAt(i));
if (flagIdx < 0) {
throw new IllegalArgumentException("invalid flags: " + flagChars);
}
flags |= 1 << flagIdx;
}
return flags;
} } | public class class_name {
static int parseValidFlags(String flagChars, boolean hasUpperVariant) {
int flags = hasUpperVariant ? FLAG_UPPER_CASE : 0;
for (int i = 0; i < flagChars.length(); i++) {
int flagIdx = indexOfFlagCharacter(flagChars.charAt(i));
if (flagIdx < 0) {
throw new IllegalArgumentException("invalid flags: " + flagChars);
}
flags |= 1 << flagIdx; // depends on control dependency: [for], data = [none]
}
return flags;
} } |
public class class_name {
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) {
if (childOption == null) {
throw new NullPointerException("childOption");
}
if (value == null) {
synchronized (childOptions) {
childOptions.remove(childOption);
}
} else {
synchronized (childOptions) {
childOptions.put(childOption, value);
}
}
return this;
} } | public class class_name {
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) {
if (childOption == null) {
throw new NullPointerException("childOption");
}
if (value == null) {
synchronized (childOptions) { // depends on control dependency: [if], data = [none]
childOptions.remove(childOption);
}
} else {
synchronized (childOptions) { // depends on control dependency: [if], data = [none]
childOptions.put(childOption, value);
}
}
return this;
} } |
public class class_name {
public void setIsRestrictedProfile(boolean isRestrictedProfile) {
UserInfo userInfo = getUserInfo(UserHandle.myUserId());
if (isRestrictedProfile) {
userInfo.flags |= UserInfo.FLAG_RESTRICTED;
} else {
userInfo.flags &= ~UserInfo.FLAG_RESTRICTED;
}
} } | public class class_name {
public void setIsRestrictedProfile(boolean isRestrictedProfile) {
UserInfo userInfo = getUserInfo(UserHandle.myUserId());
if (isRestrictedProfile) {
userInfo.flags |= UserInfo.FLAG_RESTRICTED; // depends on control dependency: [if], data = [none]
} else {
userInfo.flags &= ~UserInfo.FLAG_RESTRICTED; // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.